-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Viewport out-of-range when first constructing certain UIs rendered with egui-wgpu callbacks #3759
Comments
This needs an egui fix because the scissor could be smaller than the viewport. |
Is it the Why does it only happen on the first frame?
what about when it is partially outside the frame? |
Actually, we just thought about it for a bit- the problem should be that the scissor isn't being correctly set.. |
Gonna work on this right now and implement a fix. \o/ |
Okay, to recap everything:
if viewport_px.width_px <= 0 || viewport_px.height_px <= 0 {
continue;
}
Aka. The Thing Is Not Supposed to be Squished- but this is apparently wgpu's issue now? |
CC: @cwfitzgerald You're the wgpu person right? :P tldr: apparently WebGPU? says that, you should be able to set viewport to be outside of attachment, but wgpu doesn't allow that |
I think @Wumpf has thought about this before when we implemented a similar thing in Rerun |
Today, WebGPU specification requires to fail validation on the device timeline if the viewport is outside of the render targets, see https://www.w3.org/TR/webgpu/#dom-gpurenderpassencoder-setviewport so wgpu behaves correctly here. With that am I correct that the only thing wrong on the egui side is that it should discard zero area viewports? |
That is, rather annoying.. is there any other way to achieve this rendering then? Partially out of range and then clipped into the screen.
Yeah. Imo it should skip the whole callback, because if not updated it'll just use the older viewport, which is gonna override other stuff. |
Intersection of your desired rect and the screen viewport rect. |
Shapes with empty clip rects are already pruned by the egui/crates/epaint/src/tessellator.rs Lines 1140 to 1142 in 34c3414
|
In here.. egui/crates/egui-wgpu/src/renderer.rs Line 453 in 34c3414
The rect is checked during callback... ...but that rect isn't clamped to screen size yet. |
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to add commits to your PR. * Remember to run `cargo fmt` and `cargo cranky`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> Closes #3759
Describe the bug
Viewport out-of-range, causing a validation error, when first constructing certain UIs rendered with egui-wgpu callbacks.
This only happens on the first frame, the fix would simply be skipping the callback and set viewport command when the viewport rect is outside of the display.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The item to be skipped if the viewport is outside of display.
Additional context
https://github.com/automancy/automancy/blob/main/src/bin/automancy/gui/tile_selection.rs
(Remove the following from the code to actually get the panic:
)
The text was updated successfully, but these errors were encountered: