Skip to content

[Backport][2021.2][URP][2D] Fix performance regression where 2D alpha discard was broken #6224

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

Merged
merged 3 commits into from
Nov 12, 2021
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.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed disabled debug lighting modes on Vulkan and OpenGL following a shader compiler fix. [case 1334240]
- Fixed incorrect behavior of Reflections with Smoothness lighting debug mode. [case 1374181]
- Fixed an issue in where the Convert Renderering Settings would cause a freeze. [case 1353885](https://issuetracker.unity3d.com/issues/urp-builtin-to-urp-render-pipeline-converter-freezes-the-editor-when-converting-rendering-settings)
- Fixed performance regression for 2D shaders where alpha discard was disabled. [case 1335648]

## [12.1.1] - 2021-10-04

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ half4 CombinedShapeLightShared(in SurfaceData2D surfaceData, in InputData2D inpu
const half4 mask = surfaceData.mask;
const half2 lightingUV = inputData.lightingUV;

AlphaDiscard(alpha, 0);
if (alpha == 0.0)
discard;

color = color * _RendererColor; // This is needed for sprite shape

Expand Down