Remove useless depth-related stuff from 2D rendering#1439
Merged
slipher merged 4 commits intoDaemonEngine:masterfrom Nov 19, 2024
Merged
Remove useless depth-related stuff from 2D rendering#1439slipher merged 4 commits intoDaemonEngine:masterfrom
slipher merged 4 commits intoDaemonEngine:masterfrom
Conversation
This is a very 3D effect, the last thing that would make sense in a 2D shader.
Also remove the 'gl_FragDepth = 0;' bit from the 2D GLSL shader. It seemed to have no effect anyway, but with depth testing and writing disabled we can be sure of it.
With RmlUi transforms and 3D CSS directives such as transform: rotateX(...), nonzero z coordinates could be produced. Instead of relying on GL_DEPTH_CLAMP which is not always available to prevent clipping by near or far planes, just use a projection matrix that always maps z to 0.
All 3D rendering and even screen-space effects are done in FBOs. The default framebuffer is only targeted when drawing the UI, so a depth buffer is not neede.
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.
Disable depth fade, depth testing, depth writing for 2D rendering. Don't create a depth or stencil channel in the default framebuffer.
Instead of using the "depth clamp" GL extension (which disables clipping based on the z-coordinate), set the projection matrix to make z always 0. This is relevant if we use 3d CSS transformations like these.