Fix a few improper memory accesses in the clustered forward vertex shader #107876
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.
I noticed these issues while profiling the vertex shader. So far they are unreported, but they are very subtle bugs that will be extremely difficult to track down once they surface.
draw_call.instance_index should not be used directly since it doesn't take into account auto-batching. This bug will only surface when multiple meshes are batched together that have a different
layers
property where one should be affected by a directional light and the other shouldn't. Currently we only consider thelayers
property of the first mesh that is batched. With this PR, we match the behaviour of the other light types and always use thelayers
property that corresponds to the mesh being rendered.scene_data_block.data should not be used directly in the vertex shader since it can change between frames and impact motion vector generation. This one is less likely to cause issues. We are only considering the
IN_SHADOW_PASS
Should have been a global all along since it can only be used from inside of a function.