Closed hmaarrfk closed 4 weeks ago
I can reproduce this. In a regular pygfx example I also get a crash. I also quickly changed a benchmark for buffers to use zero elements and then I get "Invalid usage flags BufferUsages(0x0)". Seems like this case is not properly covered in wgpu-core yet.
I can include a check in the pygfx Buffer
, and maybe also in wgpu-py.
It could be something we report further upstream.
My rust knowledge is 0
In #795 I added a check for buffer/texture size. Would be good to (eventually) add checks upstream, but this fixes it for us and there's plenty more important things to do 🤷
Thanks for addressing this. this is pretty huge!
Show how you can crash rust with a 0-length array
I'm really sorry for opening so many issues but this one seems intellectually interesting,
It seems that a zero length position array (which can occur easily if you try to procedurally generate points and hit an edge case) can cause a rust panic.
I modified the example code to show how it can occur in a reproducible way.
Backtrace included.
Not sure if there is a good way to avoid these errors at a pygfx/wgpu level.
See https://github.com/hmaarrfk/pygfx/pull/7/files for diff