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

Random set_scissor_rect error #48

Closed
Uriopass opened this issue Feb 24, 2021 · 2 comments
Closed

Random set_scissor_rect error #48

Uriopass opened this issue Feb 24, 2021 · 2 comments

Comments

@Uriopass
Copy link
Contributor

Uriopass commented Feb 24, 2021

This is very weird and for some reason seems to be totally random, but once in a while and only since 0.7 update, my app sometimes crash with this error.

wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 82, Vulkan)>`
    In a set_scissor_rect command
    Invalid ScissorRect parameters

I wish I could show how to reproduce it, but since it's not consistent at all I don't really know what to give.
In the meantime, maybe there's a way to validate the set_scissor_rect here to avoid crashing or to print something more helpful when it happens ?

It might also be a problem upstream where imgui randomly (UB?) gives wrong scissor rect parameters

EDIT: Also, it doesn't appear to happen with the hello_world example

@Uriopass
Copy link
Contributor Author

Looking at wgpu code, the error comes from this condition

if rect.w == 0
  || rect.h == 0
  || rect.x + rect.w > info.extent.width
  || rect.y + rect.h > info.extent.height
{
    return Err(RenderCommandError::InvalidScissorRect).map_pass_err(scope);
}

maybe it can happen that the scissor is zero, in which case we should just skip rendering instead ?

@Uriopass
Copy link
Contributor Author

I found it! it's a synchronization problem between the renderpass target texture size and the actual window size when resizing.

If this happens for someone else: Make sure that when rendering the window size as seen by imgui (in my case I used the imgui winit support crate) and the target texture in the ui render pass are the same size.

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

No branches or pull requests

1 participant