-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 by Bors] - Move texture sample out of branch in prepare_normal #5129
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the load_gltf example without breaking the array texture example.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this for me too!
@DGriffin91 can you use either "fixes" or "closes" in the PR description? These are magic words that will cause the issue to get linked properly :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me too!
bors r+ |
# Objective This fixes #5127 ## Solution - Moved texture sample out of branch in `prepare_normal()`. Co-authored-by: DGriffin91 <github@dgdigital.net>
EDIT: Ha! I spoke too soon. Griffin pointed out that both branches sample the texture. Ok. This is fine. Just noting that this is the ‘wrong’ fix. This will now always sample the texture regardless of whether it needs to or not. The uniform control flow (i.e. branching logic based on values in a uniform) can be evaluated before executing the shader for the 2x2 pixel quad (which is how rasterisation works in order to calculate gradients to identify an appropriate mip level). This means that how things were before, if the uniform flags value meant that the true case didn’t happen, then the texture would not be sampled for any of the fragments being shaded. The right fix for now is to remove the function parameters for the flags, remove the argument at call sites, and go back to using material.flags, directly referring to the uniform binding variable. |
# Objective This fixes bevyengine#5127 ## Solution - Moved texture sample out of branch in `prepare_normal()`. Co-authored-by: DGriffin91 <github@dgdigital.net>
# Objective This fixes bevyengine#5127 ## Solution - Moved texture sample out of branch in `prepare_normal()`. Co-authored-by: DGriffin91 <github@dgdigital.net>
# Objective This fixes bevyengine#5127 ## Solution - Moved texture sample out of branch in `prepare_normal()`. Co-authored-by: DGriffin91 <github@dgdigital.net>
# Objective This fixes bevyengine#5127 ## Solution - Moved texture sample out of branch in `prepare_normal()`. Co-authored-by: DGriffin91 <github@dgdigital.net>
Objective
This fixes #5127
Solution
prepare_normal()
.