-
Notifications
You must be signed in to change notification settings - Fork 6.3k
gpui: Implement depth testing on metal #44771
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
base: main
Are you sure you want to change the base?
gpui: Implement depth testing on metal #44771
Conversation
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
|
Hi, I got to this PR through the linked issue. My 2 cents: shouldnt this be solved with a more general solution such as damage tracking and re-rendering only the changed part. I think that option would be much more performant, and also work on other platforms such as Linux. |
|
@HigherOrderLogic Damage tracking and depth testing solve orthogonal problems:
Issue #8043 specifically reports overdraw per frame (and overlapping elements), this is exactly what depth testing addresses. Even with perfect damage tracking, the same overdraw would occur within the damaged regions. Both optimizations are complementary and valuable, I can try to implement damage tracking separately to further improve performance. This PR focuses on the overdraw problem specifically |
This PR partially addresses #8043 on macOS
Still a WIP
The current renderer relies on the painter’s algorithm for draw ordering, which results in significant overdraw. Large portions of the frame are shaded multiple times even though only the frontmost fragments are visible, increasing GPU and CPU usage
This change enables depth testing and adjusts rendering to rely on depth buffering rather than strict back-to-front ordering. This allows the GPU to discard occluded fragments earlier in the pipeline, reducing unnecessary work.
Ref: https://developer.apple.com/documentation/metal/calculating-primitive-visibility-using-depth-testing
Release Notes: