Skip to content
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

Remove useless depth-related stuff from 2D rendering #1439

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

slipher
Copy link
Member

@slipher slipher commented Nov 18, 2024

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.

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.
Copy link
Contributor

@VReaperV VReaperV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@slipher slipher merged commit 2b6d388 into DaemonEngine:master Nov 19, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants