-
Notifications
You must be signed in to change notification settings - Fork 950
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
Panic when indirect buffer is 0 sized #6414
Comments
Setting all of my managed buffers to start creation as size |
Per spec indirect buffer must have non-zero size, but this validation should be done later (in |
I will put up a fix for this tomorrow. |
@sagudev Can you point me to the part of the spec that says the indirect buffer must be non-zero 🙏 ? Of course I believe you, but I need practice reading the spec and can't seem to find that requirement. I'm looking at https://www.w3.org/TR/webgpu/#dom-gpurendercommandsmixin-drawindirect. |
The spec says:
The LHS of that expression is at least 16 bytes, so every |
It is not written directly but in device timeline (red) there is this check:
if this condition is not satisfied validation error is generated. Then:
So the condition is actually indirectOffset + 16 ≤ indirectBuffer.size, which implies that 0 ≤16 ≤ indirectBuffer.size. |
That's interesting in that then wouldn't the smallest indirect buffer size be Also, I guess I had read So if it is to be interpreted as But maybe I don't understand the problem? |
The problem is that previous impl failed to early (in creating buffer where no size validation should occur) instead of where buffer is actually used. |
@sagudev right, that makes sense. I'm just wondering why setting the buffer size to I'm also not totally convinced that a buffer size of |
The validation actually in the spec can be described as: when |
Thanks for explaining, @kpreid 🙇 :) |
Description
I'm tracking
trunk
in my project and just hit a panic in changes related to #5714:I'm guessing it's this binding
binding_size
on line 276 in the file mentioned:being used on line 288:
...so for some reason in my case
binding_size
is0
. Maybe the buffer passed is0
? 🤷My project creates buffers that are zero-sized as a placeholder until there's something to fill them with, at which point they'll be recreated. Is this a generally accepted pattern? If so, we probably need to handle that case?
Just to be clear, this is happening during buffer creation.
Expected vs observed behavior
I would expect to be able to create an indirect draw buffer that is zero sized.
Extra materials
Backtrace:
The text was updated successfully, but these errors were encountered: