When errors occur, I normally just get a rust default error message like this:
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `2`,
right: `0`', wgpu-core/src/device/mod.rs:977:9
This does not provide any useful information on what's wrong. It would be nice to get some hint at least.
Thanks for the report! I renamed the title a bit to make it more constructive and close to the problem.
Relevant code in this case is https://github.com/gfx-rs/wgpu/blob/d4a46cb60e71d6b108e9052cc581e52e44a16a44/wgpu-core/src/device/mod.rs#L977
Adding an error message is trivial, might be a good first issue.
I can pick this up :-) is there an exact error message ye have in mind?
@hgallagher1993 great! Something like
"The bind group {:?} has {} bindings, while the corresponding layout {:?} expects {}"
where the "{:?}" would be printing the IDs
Cool, I should get it done sometime over the weekend
Hi there @kvark as it seems this issue is still open. I would like to work on this one. Will open a PR once done. Would help me exercise my Rust understand and navigate the codebase.
Ya you can take it, I've been trying to get the examples to run before doing this like installing glfw 3.3 etc but haven't got it going yet and haven't had the time the week or so to really look into it
Ok cloning and patching it.
I opened a PR please take a look. Link : https://github.com/gfx-rs/wgpu/pull/511
Looks like the specific assertion inside of fn device_create_bind_group is now more explanatory. I could see two possible courses of action:
wgpu-core. I would be happy to take a stab at this. There are several dozen assertions that could probably be explained more.I'm not sure which way would be better so I think a maintainer will be able to make this decision.
You are totally right. We can have this issue for general error messages. It's typically driven by confusion people face, since in the long run we'll not have any assertions like that, and instead implement the error model in the way it's done upstream. So the efforts to make them nicer are only good in short-term.
The error message at the line https://github.com/gfx-rs/wgpu/blob/master/wgpu-core/src/device/queue.rs#L87 (as of 4c62b20282820fa723dab540ce96a8b901b90dbf) is incorrect, reporting that a buffer usage of DST_SRC (that doesn't exist) is necessary when it probably meant to say COPY_DST.
@radgeRayden thank you for spotting! I'm addressing this one in #666
This is being replaced by #638
Most helpful comment
The error message at the line https://github.com/gfx-rs/wgpu/blob/master/wgpu-core/src/device/queue.rs#L87 (as of 4c62b20282820fa723dab540ce96a8b901b90dbf) is incorrect, reporting that a buffer usage of
DST_SRC(that doesn't exist) is necessary when it probably meant to sayCOPY_DST.