Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPV2] PPB-6 Disabled compute effects on WebGL and Android OpenGL #7936

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.postprocessing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed
- Fixed obsolete FormatUsage bug
- Disabled compute based effects not supported on WebGL and Android OpenGL

## [3.3.0] - 2023-05-11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ public override void OnInspectorGUI()
}
else if (aoMode == (int)AmbientOcclusionMode.MultiScaleVolumetricObscurance)
{
if (!SystemInfo.supportsComputeShaders)
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support.", MessageType.Warning);
if (!SystemInfo.supportsComputeShaders || EditorUtilities.isTargetingWebGL)
{
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support which is not available on this platform.", MessageType.Error);
}
else if(EditorUtilities.isTargetingAndroid)
{
EditorGUILayout.HelpBox("Multi-scale volumetric obscurance requires compute shader support (Vulkan) when running on Android.", MessageType.Warning);
}

PropertyField(m_ThicknessModifier);
PropertyField(m_ZBias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ public override void OnEnable()

public override void OnInspectorGUI()
{
if (!SystemInfo.supportsComputeShaders)
EditorGUILayout.HelpBox("Auto exposure requires compute shader support.", MessageType.Warning);
if (!SystemInfo.supportsComputeShaders || EditorUtilities.isTargetingWebGL)
{
EditorGUILayout.HelpBox("Auto exposure requires compute shader support which is not available on this platform.", MessageType.Error);
}
else if (EditorUtilities.isTargetingAndroid)
{
EditorGUILayout.HelpBox("Auto exposure requires compute shader support (Vulkan) when running on Android.", MessageType.Warning);
}

EditorUtilities.DrawHeaderLabel("Exposure");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,30 @@ public static bool isTargetingMobiles
}
}

/// <summary>
/// Returns <c>true</c> if the current target is Android, <c>false</c> otherwise.
/// </summary>
public static bool isTargetingAndroid
{
get
{
var t = EditorUserBuildSettings.activeBuildTarget;
return t == BuildTarget.Android;
}
}

/// <summary>
/// Returns <c>true</c> if the current target is WebGL, <c>false</c> otherwise.
/// </summary>
public static bool isTargetingWebGL
{
get
{
var t = EditorUserBuildSettings.activeBuildTarget;
return t == BuildTarget.WebGL;
}
}

/// <summary>
/// Returns <c>true</c> if the current target is a console or a mobile, <c>false</c>
/// otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)

state &= SystemInfo.supportsComputeShaders
&& !RuntimeUtilities.isAndroidOpenGL
&& !RuntimeUtilities.isWebGL
#if UNITY_2023_2_OR_NEWER
&& SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render)
&& SystemInfo.IsFormatSupported(GraphicsFormat.R16_SFloat, GraphicsFormatUsage.Render)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
return enabled.value
&& SystemInfo.supportsComputeShaders
&& !RuntimeUtilities.isAndroidOpenGL
&& !RuntimeUtilities.isWebGL
&& RenderTextureFormat.RFloat.IsSupported()
&& context.resources.computeShaders.autoExposure
&& context.resources.computeShaders.exposureHistogram;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public bool IsRequestedAndSupported(PostProcessRenderContext context)
return requested
&& SystemInfo.supportsComputeShaders
&& !RuntimeUtilities.isAndroidOpenGL
&& !RuntimeUtilities.isWebGL
&& ShaderResourcesAvailable(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,21 @@ public static bool isAndroidOpenGL
get { return Application.platform == RuntimePlatform.Android && SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan; }
}

/// <summary>
/// Returns <c>true</c> if the target platform is WebGL,
/// <c>false</c> otherwise.
/// </summary>
public static bool isWebGL
{
get {
#if UNITY_WEBGL
return true;
#else
return false;
#endif
}
}

/// <summary>
/// Gets the default HDR render texture format for the current target platform.
/// </summary>
Expand Down