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

WGPU Validation Error: Index Extends Beyond Limit #1715

Closed
zicklag opened this issue Jun 4, 2022 · 2 comments · Fixed by #1716
Closed

WGPU Validation Error: Index Extends Beyond Limit #1715

zicklag opened this issue Jun 4, 2022 · 2 comments · Fixed by #1716
Labels
bug Something is broken

Comments

@zicklag
Copy link
Contributor

zicklag commented Jun 4, 2022

Describe the bug
Very randomly I get this error with the WGPU backend:

thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `encoder`
    In a draw command, indexed:true indirect:false
      note: render pipeline = `egui_pipeline`
    index 228 extends beyond limit 0. Did you bind the correct index buffer?

', /home/zicklag/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:2273:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The numbers for the index and limit are different sometimes, with different code.

To Reproduce

This is the strange part:

  1. I have my egui dependency set to pull the master branch from GitHub
  2. I'm editing and building my egui app like normal
  3. I make some change and re-compile
  4. All of the sudden I get this error, for some seemingly random and totally normal modification to my app
  5. I clone egui and switch to the master branch from github, and switch my local egui dependency to use the path to my cloned egui codebase
  6. The error stops happening 👀

It seems to be incredibly unpredictable and somewhat rare when the issue happens, but I have a hard time reproducing when I clone the same commit of egui locally and somehow the error goes away!

Expected behavior
No error.

Screenshots

Desktop (please complete the following information):

  • OS: Pop!_OS ( Ubuntu ) 20.04

Additional context

The error is simple and I'm fairly sure it's just that the index buffers are somehow getting mixed up which vertex buffer they go to, I just don't know why the behavior is so random.

I'm going to look into fixing this, and I did see the error once or twice ( again random and rarely ) before #1704, but it still could have been due to #1684. I think I'm just going to try to refactor the wgpu renderer a little to avoid the somewhat fragile association of the index buffers to the vertex buffers and see if that helps.

Unfortunately, since I can't reliably re-produce the issue, we may have to just try making the fix and wait a while to see if it comes back again.

@zicklag zicklag added the bug Something is broken label Jun 4, 2022
zicklag added a commit to zicklag/egui that referenced this issue Jun 4, 2022
zicklag added a commit to zicklag/egui that referenced this issue Jun 4, 2022
Ensures that index and vertex buffers are sliced to their proper
dimensions to prevent reading into data from previous frames that had
longer buffers.
@zicklag
Copy link
Contributor Author

zicklag commented Jun 4, 2022

OK, I think it's fixed with #1716, but I can't be sure.

I'll be testing more and seeing if it pops up again.

If my guess is right, the error is caused when a mesh in the current frame with the same index as a previous frame's mesh has an index or vertex buffer smaller than the previous frame.

That could explain the random behavior, because that could potentially depend on all kinds of seemingly unrelated things about your app.

zicklag added a commit to zicklag/egui that referenced this issue Jun 5, 2022
zicklag added a commit to zicklag/egui that referenced this issue Jun 6, 2022
zicklag added a commit to zicklag/egui that referenced this issue Jun 6, 2022
zicklag added a commit to zicklag/egui that referenced this issue Jun 6, 2022
@microaaron
Copy link

There is a bug in wgpu, please wait for the fix. gfx-rs/wgpu#5430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants