Browse Source

Check shader after loading it, throw an exception with a message on failure. This is better than having a random nullref happen, if the shaders cannot be loaded for whatever reason.

mac-autoexp
Nico de Poel 3 years ago
parent
commit
9f887a5c3c
  1. 4
      Assets/Scripts/Core/Fsr2Pipeline.cs

4
Assets/Scripts/Core/Fsr2Pipeline.cs

@ -108,7 +108,11 @@ namespace FidelityFX
private void LoadComputeShader(string name, Fsr2.InitializationFlags flags, ref ComputeShader shaderRef, out int kernelIndex)
{
if (shaderRef == null)
{
shaderRef = ContextDescription.Callbacks.LoadComputeShader(name);
if (shaderRef == null)
throw new MissingReferenceException($"Shader '{name}' could not be loaded! Please ensure it is included in the project correctly.");
}
kernelIndex = shaderRef.FindKernel("CS");

Loading…
Cancel
Save