-
Notifications
You must be signed in to change notification settings - Fork 939
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
Aligning CreateShaderModule with the WebGPU spec #2674
Comments
My opinions: The single-error / array-of-errors distinction should be addressed on the Firefox side for now. Naga is simply not set up to produce multiple error messages. Doing that effectively entails not just fancier plumbing for the results themselves, but also changes to prevent meaningless error cascades, parser recovery tricks, etc. etc. Once we undertake all that, then sure, let's change Representation-wise, I think the Naga
That seems pretty good for Rust consumers. I'd say we should convert from that to the WebGPU But those points aside, as far as error-handling is concerned, aligning with the spec is non-controversial - just go ahead and change whatever is helpful. I agree that the fine-grained error enums from Naga are probably not that interesting to users. They're valuable for testing, though. |
I think that having common methods like |
That sounds good to me too. (But, I'd say, go ahead and make a struct - I have no idea what those two u32's are.) |
Got started in gfx-rs/naga#1937 |
I think this is fixed, now that #5410 has been merged. Let me know if there's anything left to do, or anything that could be improved. |
Yeah, I think we are done on this front. |
Is your feature request related to a problem? Please describe.
I'm looking into aligning Gecko's WebGPU implementation of CreateShaderModule with the spec. This issue is to discuss where the pieces fit in term of the rust API vs the web's.
Describe the solution you'd like and alternatives
I'm very new to this so not strongly opinionated. My gut feeling is that perhaps wgpu_core should expose compilation messages in a format closer to the specification, perhaps decorated with its extra internal details. Questions below:
Multiple errors and warnings
Currently it looks like
Device::create_shader_module
returns a single error. It's not incompatible with the specification (which expects an array of compilation messages, since we can always return an array of size 1), but I suspect we'll want to be able to get multiple errors as well as warnings in the long run.Error representation
The error enum
CreateShaderModuleError
is very different from theCompilationMessage
of the specification. This is not necessarily a big issue as long as one can be converted into the other, however I'm going to make a subjective statement: I think thatCreateShaderModuleError
is a bit too low level and not nearly as nice as the spec from the point of view of the API's consumer (Consumer has to match the enum which differentiate between parsing, validation, etc.). On the other hand the specification exposes more generic members (line/column/message/etc.) that are immediately useful to the api consumer (more so than knowing which part of wgpu or naga's internals found the issue.Gecko can take care of converting from the wgpu_core representation to the spec's, but I suspect it would be valuable to wgpu users in general to have an easer error type to consume, either by replacing
CreateShaderModuleError
or by providing a helper to convert it to something closter to the spec's representation.Should the offset be computed by wgpu_core
I suspect not but confirmation can't hurt.
The spec exposes an offset that I didn't see in wgpu's error types.
The offset is relative to the utf16 representation, so I guess the right thing to do is for the browser to build that information from the line/column pair and the utf16 string.
Summary
The text was updated successfully, but these errors were encountered: