mirror of
https://github.com/maxartz15/VolumetricLighting.git
synced 2025-06-27 21:16:05 +02:00
Fail more gracefully on platforms without compute shaders.
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user