Use render pass uniform set to store viewport samplers. #84637
Merged
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.
Follow up to #84317
Fixes: #84083
Fixes: #65690
Fixes: #84084
Basically what this PR does is separate the "default" samplers from the per viewport samplers for the scene shaders. The difference between the sampler types is just LOD bias. However, internally, we almost always want an LOD bias of 0, we only want to apply the LOD bias to decals, projector textures, and user texture fetches with mipmaps enabled.
Accordingly, we need to pass a set of samplers for internal use and external use.
Previously we were updating the
render_base_uniform_set
each time a viewport change its samplers. Therender_base_uniform_set
is shared between all viewports. This was leading to all viewports fighting over the same uniform set. It would get cleared anytime any viewport was re-configured, then the first viewport to render would get to pick the samplers used. This behaviour was highly problematic.Now each viewport can use its own samplers and the viewport's samplers don't conflict with the Godot internal texture reads. In particular this fixes ReflectionProbes and Sky becoming less rough with a lower rendering scale, but it should also fix some of the unexplained aliasing we were getting with FSR2.2 at a low rendering scale.