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

GPUI overdraws too much #8043

Open
1 task done
kvark opened this issue Feb 20, 2024 · 7 comments
Open
1 task done

GPUI overdraws too much #8043

kvark opened this issue Feb 20, 2024 · 7 comments
Labels
bug [core label] gpui GPUI rendering framework support performance Feedback for performance issues, speed, memory usage, etc

Comments

@kvark
Copy link
Contributor

kvark commented Feb 20, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

zed-overdraw

It looks like most "ordinary" pixels are being overdraw 5-6 times on screen. See screenshot from RenderDoc's "pass overdrawn" mode. I looked at the green area (5 draws per pixel) and at the yellow one on the left (6 draws per pixel). This is burning GPU power too much unnecessarily and draining the battery.

Ideally, these areas would have 0 to 1 draw. 0 is possible because the render pass is starting with a clear color. For elements overlapping each other, there needs to be some technique for pixel rejection employed. Generally it's depth or stencil testing. For example, WebRender draws opaque elements from front to back and writes to depth, preventing deeper layers from overwriting the pixels of the front layers.

Environment

Linux (but it unlikely matters)

@kvark kvark added bug [core label] triage Maintainer needs to classify the issue admin read Pending admin review labels Feb 20, 2024
@jansol
Copy link
Contributor

jansol commented Feb 20, 2024

I'm not sure GPUI has anything fully opaque? Since practically all elements are antialiased rounded rectangles which require alpha blending.

@JosephTLyons JosephTLyons added gpui GPUI rendering framework support and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Feb 20, 2024
@kvark
Copy link
Contributor Author

kvark commented Feb 22, 2024

@jansol not all elements have rounded corners. For example, #7231 makes the fast path for such quads that are just quads, and it makes a good difference.
In WebRender we'd also split a rounded-cornered element into a "9 patch", which consists of 5 fully opaque rectangles and 4 semi-transparent rectangles. This allows drawing most of the element early as opaque.

@jansol
Copy link
Contributor

jansol commented Feb 23, 2024

Right, makes sense. And I assume it just skips elements with a non-opaque background color.

Copy link

Hi there! 👋
We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. Are you able to reproduce this issue in the latest version of Zed? If so, please let us know by commenting on this issue and we will keep it open; otherwise, we'll close it in a week. Feel free to open a new issue if you're seeing this message after the issue has been closed.
Thanks for your help!

@github-actions github-actions bot added the stale Label used by `stale` action label Sep 24, 2024
@jansol
Copy link
Contributor

jansol commented Sep 24, 2024

AFAIK there has been no change to this.

@github-actions github-actions bot removed the stale Label used by `stale` action label Sep 24, 2024
@notpeter notpeter added the performance Feedback for performance issues, speed, memory usage, etc label Oct 23, 2024
@someone13574
Copy link
Contributor

In WebRender we'd also split a rounded-cornered element into a "9 patch", which consists of 5 fully opaque rectangles and 4 semi-transparent rectangles.

Wouldn't you only need three fully opaque?

@kvark
Copy link
Contributor Author

kvark commented Oct 25, 2024

Yes, you can make just 3 opaque.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] gpui GPUI rendering framework support performance Feedback for performance issues, speed, memory usage, etc
Projects
None yet
Development

No branches or pull requests

5 participants