From 066951cc127361c329e216fbcf0535ded5e3238a Mon Sep 17 00:00:00 2001 From: Ben Grater Date: Tue, 17 Jun 2025 13:09:39 -0700 Subject: [PATCH 1/4] Fixed compute based effects not supported on some OpenGL platforms --- .../Editor/Effects/AmbientOcclusionEditor.cs | 4 ++++ .../Editor/Effects/AutoExposureEditor.cs | 4 ++++ .../PostProcessing/Editor/Utils/EditorUtilities.cs | 12 ++++++++++++ .../Runtime/Effects/AmbientOcclusion.cs | 2 +- .../PostProcessing/Runtime/Effects/AutoExposure.cs | 2 +- .../PostProcessing/Runtime/Monitors/Monitor.cs | 2 +- .../PostProcessing/Runtime/Utils/RuntimeUtilities.cs | 11 ++++++++--- 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs b/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs index e329c3f4345..1cefbbb86e7 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs @@ -61,6 +61,10 @@ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (Vulkan) when running on Android.", MessageType.Warning); } + else if(EditorUtilities.isTargetingQNX) + { + EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support when running on QNX.", MessageType.Warning); + } PropertyField(m_ThicknessModifier); PropertyField(m_ZBias); diff --git a/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs b/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs index ae2e1bd8928..97e9154ec0d 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs @@ -43,6 +43,10 @@ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Auto exposure requires compute shader support (Vulkan) when running on Android.", MessageType.Warning); } + else if (EditorUtilities.isTargetingQNX) + { + EditorGUILayout.HelpBox("Auto exposure requires compute shader support when running on QNX.", MessageType.Warning); + } EditorUtilities.DrawHeaderLabel("Exposure"); diff --git a/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs b/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs index 515d8967b84..07d3b9dce1b 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs @@ -79,6 +79,18 @@ public static bool isTargetingAndroid } } + /// + /// Returns true if the current target is QNX, false otherwise. + /// + public static bool isTargetingQNX + { + get + { + var t = EditorUserBuildSettings.activeBuildTarget; + return t == BuildTarget.QNX; + } + } + /// /// Returns true if the current target is WebGL, false otherwise. /// diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs index ae5d00efd02..7351789ce0d 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs @@ -195,7 +195,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context) } state &= SystemInfo.supportsComputeShaders - && !RuntimeUtilities.isAndroidOpenGL + && !RuntimeUtilities.isOpenGLNoCompute && !RuntimeUtilities.isWebNonWebGPU #if UNITY_2023_2_OR_NEWER && SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render) diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs index 7995cdcd6e7..d099fc4452f 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs @@ -84,7 +84,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context) { return enabled.value && SystemInfo.supportsComputeShaders - && !RuntimeUtilities.isAndroidOpenGL + && !RuntimeUtilities.isOpenGLNoCompute && !RuntimeUtilities.isWebNonWebGPU && RenderTextureFormat.RFloat.IsSupported() && context.resources.computeShaders.autoExposure diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs b/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs index 0e5d1a8589f..d708e5640ec 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs @@ -47,7 +47,7 @@ public bool IsRequestedAndSupported(PostProcessRenderContext context) { return requested && SystemInfo.supportsComputeShaders - && !RuntimeUtilities.isAndroidOpenGL + && !RuntimeUtilities.isOpenGLNoCompute && !RuntimeUtilities.isWebNonWebGPU && ShaderResourcesAvailable(context); } diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs b/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs index 459cca0306b..7d9ac07583d 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs @@ -850,12 +850,17 @@ public static bool isVREnabled } /// - /// Returns true if the target platform is Android and the selected API is OpenGL, + /// Returns true if the target platform is does not support compute and the selected API is OpenGL, /// false otherwise. /// - public static bool isAndroidOpenGL + public static bool isOpenGLNoCompute { - get { return Application.platform == RuntimePlatform.Android && SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan; } + get { return (Application.platform == RuntimePlatform.Android || + Application.platform == RuntimePlatform.QNXArm32 || + Application.platform == RuntimePlatform.QNXArm64 || + Application.platform == RuntimePlatform.QNXX86 || + Application.platform == RuntimePlatform.QNXX64) && + SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan; } } /// From 30f11be8d2df834b11c41bdff6659d592a485ecb Mon Sep 17 00:00:00 2001 From: Ben Grater Date: Tue, 17 Jun 2025 13:10:08 -0700 Subject: [PATCH 2/4] Update CHANGELOG --- com.unity.postprocessing/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.postprocessing/CHANGELOG.md b/com.unity.postprocessing/CHANGELOG.md index 107ff7a74c4..df270182a56 100644 --- a/com.unity.postprocessing/CHANGELOG.md +++ b/com.unity.postprocessing/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Remove support for PVRTC format in Unity 6.1 or newer +- Fixed compute based effects not supported on some OpenGL platforms - Documentation updates ## [3.4.0] - 2023-12-11 From 9ba915839308014f431ba0d8c859ea6720977b15 Mon Sep 17 00:00:00 2001 From: Ben Grater Date: Tue, 17 Jun 2025 14:21:23 -0700 Subject: [PATCH 3/4] Fixed compute based effects not supported on OpenGLES --- .../Editor/Effects/AmbientOcclusionEditor.cs | 12 ++++------ .../Editor/Effects/AutoExposureEditor.cs | 12 ++++------ .../Editor/Utils/EditorUtilities.cs | 22 +++++++++++++++---- .../Runtime/Effects/AmbientOcclusion.cs | 2 +- .../Runtime/Effects/AutoExposure.cs | 2 +- .../Runtime/Monitors/Monitor.cs | 2 +- .../Runtime/Utils/RuntimeUtilities.cs | 13 +++++------ 7 files changed, 35 insertions(+), 30 deletions(-) diff --git a/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs b/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs index 1cefbbb86e7..fe1390a9ebd 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs @@ -53,17 +53,13 @@ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support which is not available on this platform.", MessageType.Error); } - else if (EditorUtilities.isTargetingWebGL) - { - EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (WebGPU) when running on Web.", MessageType.Warning); - } - else if(EditorUtilities.isTargetingAndroid) + if (EditorUtilities.isTargetingOpenGLES) { - EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (Vulkan) when running on Android.", MessageType.Warning); + EditorGUILayout.HelpBox("\"Multi-scale volumetric obscurance requires compute shader support which is not available for OpenGLES.", MessageType.Warning); } - else if(EditorUtilities.isTargetingQNX) + else if (EditorUtilities.isTargetingWebGL) { - EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support when running on QNX.", MessageType.Warning); + EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (WebGPU) when running on Web.", MessageType.Warning); } PropertyField(m_ThicknessModifier); diff --git a/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs b/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs index 97e9154ec0d..5bdf17c3ab6 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs @@ -35,17 +35,13 @@ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Auto exposure requires compute shader support which is not available on this platform.", MessageType.Error); } - else if (EditorUtilities.isTargetingWebGL) - { - EditorGUILayout.HelpBox("Auto exposure requires compute shader support (WebGPU) when running on Web.", MessageType.Warning); - } - else if (EditorUtilities.isTargetingAndroid) + if (EditorUtilities.isTargetingOpenGLES) { - EditorGUILayout.HelpBox("Auto exposure requires compute shader support (Vulkan) when running on Android.", MessageType.Warning); + EditorGUILayout.HelpBox("Auto exposure requires compute shader support which is not available for OpenGLES.", MessageType.Warning); } - else if (EditorUtilities.isTargetingQNX) + else if (EditorUtilities.isTargetingWebGL) { - EditorGUILayout.HelpBox("Auto exposure requires compute shader support when running on QNX.", MessageType.Warning); + EditorGUILayout.HelpBox("Auto exposure requires compute shader support (WebGPU) when running on Web.", MessageType.Warning); } EditorUtilities.DrawHeaderLabel("Exposure"); diff --git a/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs b/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs index 07d3b9dce1b..59a5112d546 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs @@ -3,6 +3,7 @@ using System.Linq; using UnityEngine; using UnityEngine.Assertions; +using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; #if XR_MANAGEMENT_4_0_1_OR_NEWER @@ -80,14 +81,27 @@ public static bool isTargetingAndroid } /// - /// Returns true if the current target is QNX, false otherwise. + /// Returns true if the current build targets OpenGLES, false otherwise. /// - public static bool isTargetingQNX + public static bool isTargetingOpenGLES { get { - var t = EditorUserBuildSettings.activeBuildTarget; - return t == BuildTarget.QNX; + var buildTargetAPIs = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget); + + foreach (var api in buildTargetAPIs) + { + if (api == GraphicsDeviceType.OpenGLES3 +#if !UNITY_2023_1_OR_NEWER + || api == GraphicsDeviceType.OpenGLES2 +#endif + ) + { + return true; + } + } + + return false; } } diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs index 7351789ce0d..1d0dc588f73 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs @@ -195,7 +195,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context) } state &= SystemInfo.supportsComputeShaders - && !RuntimeUtilities.isOpenGLNoCompute + && !RuntimeUtilities.isOpenGLES && !RuntimeUtilities.isWebNonWebGPU #if UNITY_2023_2_OR_NEWER && SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render) diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs index d099fc4452f..ae21f0ca14a 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs @@ -84,7 +84,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context) { return enabled.value && SystemInfo.supportsComputeShaders - && !RuntimeUtilities.isOpenGLNoCompute + && !RuntimeUtilities.isOpenGLES && !RuntimeUtilities.isWebNonWebGPU && RenderTextureFormat.RFloat.IsSupported() && context.resources.computeShaders.autoExposure diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs b/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs index d708e5640ec..7cae9b7a396 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs @@ -47,7 +47,7 @@ public bool IsRequestedAndSupported(PostProcessRenderContext context) { return requested && SystemInfo.supportsComputeShaders - && !RuntimeUtilities.isOpenGLNoCompute + && !RuntimeUtilities.isOpenGLES && !RuntimeUtilities.isWebNonWebGPU && ShaderResourcesAvailable(context); } diff --git a/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs b/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs index 7d9ac07583d..1551ebb96e0 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs @@ -853,14 +853,13 @@ public static bool isVREnabled /// Returns true if the target platform is does not support compute and the selected API is OpenGL, /// false otherwise. /// - public static bool isOpenGLNoCompute + public static bool isOpenGLES { - get { return (Application.platform == RuntimePlatform.Android || - Application.platform == RuntimePlatform.QNXArm32 || - Application.platform == RuntimePlatform.QNXArm64 || - Application.platform == RuntimePlatform.QNXX86 || - Application.platform == RuntimePlatform.QNXX64) && - SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan; } + get { return (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3 +#if !UNITY_2023_1_OR_NEWER + || SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES2 +#endif + ); } } /// From 2f76da261750430403ab08250798408a851ee2ec Mon Sep 17 00:00:00 2001 From: Ben Grater Date: Tue, 17 Jun 2025 14:21:51 -0700 Subject: [PATCH 4/4] Update CHANGELOG --- com.unity.postprocessing/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.postprocessing/CHANGELOG.md b/com.unity.postprocessing/CHANGELOG.md index df270182a56..81b9a4877f7 100644 --- a/com.unity.postprocessing/CHANGELOG.md +++ b/com.unity.postprocessing/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Remove support for PVRTC format in Unity 6.1 or newer -- Fixed compute based effects not supported on some OpenGL platforms +- Fixed compute based effects not supported on OpenGLES - Documentation updates ## [3.4.0] - 2023-12-11