Skip to content

Commit 0c7b706

Browse files
[PPV2] PPB-68 Fixed compute based effects not supported on OpenGLES (#8170)
* Fixed compute based effects not supported on some OpenGL platforms * Update CHANGELOG * Fixed compute based effects not supported on OpenGLES * Update CHANGELOG
1 parent 24518e2 commit 0c7b706

File tree

8 files changed

+45
-14
lines changed

8 files changed

+45
-14
lines changed

com.unity.postprocessing/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
### Fixed
1313
- Remove support for PVRTC format in Unity 6.1 or newer
14+
- Fixed compute based effects not supported on OpenGLES
1415
- Documentation updates
1516

1617
## [3.4.0] - 2023-12-11

com.unity.postprocessing/PostProcessing/Editor/Effects/AmbientOcclusionEditor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public override void OnInspectorGUI()
5353
{
5454
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support which is not available on this platform.", MessageType.Error);
5555
}
56-
else if (EditorUtilities.isTargetingWebGL)
56+
if (EditorUtilities.isTargetingOpenGLES)
5757
{
58-
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (WebGPU) when running on Web.", MessageType.Warning);
58+
EditorGUILayout.HelpBox("\"Multi-scale volumetric obscurance requires compute shader support which is not available for OpenGLES.", MessageType.Warning);
5959
}
60-
else if(EditorUtilities.isTargetingAndroid)
60+
else if (EditorUtilities.isTargetingWebGL)
6161
{
62-
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (Vulkan) when running on Android.", MessageType.Warning);
62+
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (WebGPU) when running on Web.", MessageType.Warning);
6363
}
6464

6565
PropertyField(m_ThicknessModifier);

com.unity.postprocessing/PostProcessing/Editor/Effects/AutoExposureEditor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public override void OnInspectorGUI()
3535
{
3636
EditorGUILayout.HelpBox("Auto exposure requires compute shader support which is not available on this platform.", MessageType.Error);
3737
}
38-
else if (EditorUtilities.isTargetingWebGL)
38+
if (EditorUtilities.isTargetingOpenGLES)
3939
{
40-
EditorGUILayout.HelpBox("Auto exposure requires compute shader support (WebGPU) when running on Web.", MessageType.Warning);
40+
EditorGUILayout.HelpBox("Auto exposure requires compute shader support which is not available for OpenGLES.", MessageType.Warning);
4141
}
42-
else if (EditorUtilities.isTargetingAndroid)
42+
else if (EditorUtilities.isTargetingWebGL)
4343
{
44-
EditorGUILayout.HelpBox("Auto exposure requires compute shader support (Vulkan) when running on Android.", MessageType.Warning);
44+
EditorGUILayout.HelpBox("Auto exposure requires compute shader support (WebGPU) when running on Web.", MessageType.Warning);
4545
}
4646

4747
EditorUtilities.DrawHeaderLabel("Exposure");

com.unity.postprocessing/PostProcessing/Editor/Utils/EditorUtilities.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using UnityEngine;
55
using UnityEngine.Assertions;
6+
using UnityEngine.Rendering;
67
using UnityEngine.Rendering.PostProcessing;
78

89
#if XR_MANAGEMENT_4_0_1_OR_NEWER
@@ -79,6 +80,31 @@ public static bool isTargetingAndroid
7980
}
8081
}
8182

83+
/// <summary>
84+
/// Returns <c>true</c> if the current build targets OpenGLES, <c>false</c> otherwise.
85+
/// </summary>
86+
public static bool isTargetingOpenGLES
87+
{
88+
get
89+
{
90+
var buildTargetAPIs = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget);
91+
92+
foreach (var api in buildTargetAPIs)
93+
{
94+
if (api == GraphicsDeviceType.OpenGLES3
95+
#if !UNITY_2023_1_OR_NEWER
96+
|| api == GraphicsDeviceType.OpenGLES2
97+
#endif
98+
)
99+
{
100+
return true;
101+
}
102+
}
103+
104+
return false;
105+
}
106+
}
107+
82108
/// <summary>
83109
/// Returns <c>true</c> if the current target is WebGL, <c>false</c> otherwise.
84110
/// </summary>

com.unity.postprocessing/PostProcessing/Runtime/Effects/AmbientOcclusion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
195195
}
196196

197197
state &= SystemInfo.supportsComputeShaders
198-
&& !RuntimeUtilities.isAndroidOpenGL
198+
&& !RuntimeUtilities.isOpenGLES
199199
&& !RuntimeUtilities.isWebNonWebGPU
200200
#if UNITY_2023_2_OR_NEWER
201201
&& SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render)

com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
8484
{
8585
return enabled.value
8686
&& SystemInfo.supportsComputeShaders
87-
&& !RuntimeUtilities.isAndroidOpenGL
87+
&& !RuntimeUtilities.isOpenGLES
8888
&& !RuntimeUtilities.isWebNonWebGPU
8989
&& RenderTextureFormat.RFloat.IsSupported()
9090
&& context.resources.computeShaders.autoExposure

com.unity.postprocessing/PostProcessing/Runtime/Monitors/Monitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public bool IsRequestedAndSupported(PostProcessRenderContext context)
4747
{
4848
return requested
4949
&& SystemInfo.supportsComputeShaders
50-
&& !RuntimeUtilities.isAndroidOpenGL
50+
&& !RuntimeUtilities.isOpenGLES
5151
&& !RuntimeUtilities.isWebNonWebGPU
5252
&& ShaderResourcesAvailable(context);
5353
}

com.unity.postprocessing/PostProcessing/Runtime/Utils/RuntimeUtilities.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,12 +850,16 @@ public static bool isVREnabled
850850
}
851851

852852
/// <summary>
853-
/// Returns <c>true</c> if the target platform is Android and the selected API is OpenGL,
853+
/// Returns <c>true</c> if the target platform is does not support compute and the selected API is OpenGL,
854854
/// <c>false</c> otherwise.
855855
/// </summary>
856-
public static bool isAndroidOpenGL
856+
public static bool isOpenGLES
857857
{
858-
get { return Application.platform == RuntimePlatform.Android && SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan; }
858+
get { return (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3
859+
#if !UNITY_2023_1_OR_NEWER
860+
|| SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES2
861+
#endif
862+
); }
859863
}
860864

861865
/// <summary>

0 commit comments

Comments
 (0)