diff --git a/com.unity.postprocessing/CHANGELOG.md b/com.unity.postprocessing/CHANGELOG.md index 107ff7a74c4..81b9a4877f7 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 OpenGLES - Documentation updates ## [3.4.0] - 2023-12-11 diff --git a/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs b/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs index e329c3f4345..fe1390a9ebd 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs @@ -53,13 +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) + if (EditorUtilities.isTargetingOpenGLES) { - EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (WebGPU) when running on Web.", MessageType.Warning); + EditorGUILayout.HelpBox("\"Multi-scale volumetric obscurance requires compute shader support which is not available for OpenGLES.", MessageType.Warning); } - else if(EditorUtilities.isTargetingAndroid) + else if (EditorUtilities.isTargetingWebGL) { - 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 (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 ae2e1bd8928..5bdf17c3ab6 100644 --- a/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs +++ b/com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs @@ -35,13 +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) + if (EditorUtilities.isTargetingOpenGLES) { - EditorGUILayout.HelpBox("Auto exposure requires compute shader support (WebGPU) when running on Web.", MessageType.Warning); + EditorGUILayout.HelpBox("Auto exposure requires compute shader support which is not available for OpenGLES.", MessageType.Warning); } - else if (EditorUtilities.isTargetingAndroid) + else if (EditorUtilities.isTargetingWebGL) { - EditorGUILayout.HelpBox("Auto exposure requires compute shader support (Vulkan) when running on Android.", 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 515d8967b84..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 @@ -79,6 +80,31 @@ public static bool isTargetingAndroid } } + /// + /// Returns true if the current build targets OpenGLES, false otherwise. + /// + public static bool isTargetingOpenGLES + { + get + { + 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; + } + } + /// /// 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..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.isAndroidOpenGL + && !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 7995cdcd6e7..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.isAndroidOpenGL + && !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 0e5d1a8589f..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.isAndroidOpenGL + && !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 459cca0306b..1551ebb96e0 100644 --- a/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs +++ b/com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs @@ -850,12 +850,16 @@ 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 isOpenGLES { - get { return Application.platform == RuntimePlatform.Android && SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan; } + get { return (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3 +#if !UNITY_2023_1_OR_NEWER + || SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES2 +#endif + ); } } ///