Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some hardware exhibits a slowdown when shaders modify the frag_color output multiple times. In order to prevent this, we modify a temporary variable instead of the output, then write to the final output once at the end of the shader.
Partially addresses #84526.
Forward port of #84529.
Notes
frag_color
is read / modified more than once.ALBEDO
rather thanfrag_color
directly.frag_color
multiple times in shader seems to cause performance problem #84526 (comment) for tests on different hardware.scene.glsl
, I've included the fix for other potentially affected shaders, as there is no evidence of a drop in performance and potential for gain, especially if these shaders are later modified.