Wgpu: Missing error messages

Created on 7 Feb 2020  路  13Comments  路  Source: gfx-rs/wgpu

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.

validation good first issue

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 say COPY_DST.

All 13 comments

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:

  1. Close the issue, now that the specific assertion is more informative
  2. Treat this as a general effort to improve assertion error messages within 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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rukai picture rukai  路  11Comments

lordnoriyuki picture lordnoriyuki  路  17Comments

FlorianUekermann picture FlorianUekermann  路  18Comments

m4b picture m4b  路  14Comments

Masterchef365 picture Masterchef365  路  14Comments