Fail more gracefully on platforms without compute shaders.

This commit is contained in:
Robert Cupisz
2017-10-08 22:53:04 +02:00
parent 5597b04fcc
commit d82679ae5d
4 changed files with 49 additions and 1 deletions

View File

@ -520,6 +520,14 @@ public class VolumetricFog : MonoBehaviour
[ImageEffectOpaque]
void OnRenderImage(RenderTexture src, RenderTexture dest)
{
if (!CheckSupport())
{
Debug.LogError(GetUnsupportedErrorMessage());
Graphics.Blit(src, dest);
enabled = false;
return;
}
if(m_Debug)
{
DebugDisplay(src, dest);
@ -684,4 +692,15 @@ public class VolumetricFog : MonoBehaviour
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawFrustum(Vector3.zero, cam.fieldOfView, farClip, nearClip, cam.aspect);
}
public static bool CheckSupport()
{
return SystemInfo.supportsComputeShaders;
}
public static string GetUnsupportedErrorMessage()
{
return "Volumetric Fog requires compute shaders and this platform doesn't support them. Disabling. \nDetected device type: " +
SystemInfo.graphicsDeviceType + ", version: " + SystemInfo.graphicsDeviceVersion;
}
}