Initialize light index push constants to 0xFFFFFFFF instead of 0xFFFF#70068
Merged
Conversation
akien-mga
approved these changes
Dec 14, 2022
Member
|
A rebase should fix godot-cpp CI. |
e3b5c0f to
7b0dd7a
Compare
Member
Author
Done! :) |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: #55881
Each of these push constants is a 32 bit integer used to carry 4 singly byte integers (0-255 range). In the shader, the value of 0xFF is used to check if a light is unused in which case it skips rendering that light. Since we initialized the values to 0xFFFF, the shader would think that the indices are as follows (0, 1, 0, 0) instead of (0, 1, 255, 255). So instead of skipping the last two indices, it just draws the light at index 0 3 times (actually five times because a total of 8 potential lights are used).
This PR should also improve performance as the expensive lighting calculations are now only done as many times as needed.
Before

After
