Ensure that depth write state is updated before transparent pass in OpenGL3 renderer#75968
Merged
Merged
Conversation
lawnjelly
approved these changes
Apr 12, 2023
Member
|
Thanks! |
Contributor
|
Cherry-picked for 4.0.3. |
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: #75063
The core of the issue comes from here:
godot/drivers/gles3/rasterizer_scene_gles3.cpp
Lines 1949 to 1951 in ab7cb2a
and here:
godot/drivers/gles3/rasterizer_scene_gles3.cpp
Lines 2138 to 2152 in ab7cb2a
The behaviour of
DEPTH_DRAW_OPAQUEchanges depending on if we are in the transparent pass or in the Opaque pass. Further, the setting doesn't get updated unless another depth draw type is used.#75063 is fixed just by setting the default depth draw mode to
DEPTH_DRAW_ALWAYSbefore the opaque pass. However, a similar issue would arise if there were opaque objects in the scene. Therefore, the full solution is to ensure that the depth mode defaults toDEPTH_DRAW_DISABLEDbefore the transparent pass so theglMask()state is correctly set regardless of what states were used in the opaque pass.This PR also removes a check for the depth test state that was totally unnecessary as the state was set immediately after.