Repository navigation
Conversation
|
Tons of operations in WebGPU are asynchronous, but we usually encode the asynchronicity internally (like in OpenGL). What's the rationale for making createShaderModule special? (forgive me if this was previously decided, but if it was could you include a link?) |
|
I don't think we ever decided this - I can't remember if we even discussed it. I realise this could be done internally in the implementation, but at some point we're going to have to process the shaders, and I think whenever that is should be exposed as a Promise. It's one of the requests I've seen a lot for WebGPU (and WebGL). Some other alternative locations could be:
However, I think it makes most sense to do this as early as possible. For one thing, I expect we'll want to expose some reflection APIs to examine the shader module. It seems like you'd want compilation errors to be exposed as soon as possible. Or maybe I'm misunderstanding what you're suggesting? |
|
I'm suggesting not having a Promise at all - it's not necessary (just like in WebGL) because shader compilation is async. However there definitely does need to be a way to know whether a pipeline is ready (so you can avoid stalling on it if you have a fallback pipeline). I don't think we have another way to do that yet - Promise might be okay, but key to note is that it prevents any queuing of work, command buffer construction, etc. until the Promise returns. That seems not ideal. |
|
Right. Pipeline creation is a set of steps. Each of the steps can cause an error. I feel like it is better to expose the errors as close to the step that caused them as possible, as long as it doesn't produce a significant pain. I think shader validation/compilation is probably one of the places where developers want to know sooner that something went wrong, rather than later when they try to use the pipeline. |
|
I guess I also don't quite understand the downside with this being a Promise. Yes, it means you can't queue any work until the Promise resolves, but that seems like a pretty small price to pay for getting the guarantee that a significant part of your pipeline is ready. And you're not going to pay the price often - usually just at startup. The work is going to happen at some point. This going to be one of the more expensive parts of the pipeline validation, so I think it's fine to have developers be aware of that. |
|
For reference here's the strawman for error handling we agreed on. We could make Also I expect that while the most expensive validation will be at |
|
What is the mechanism for getting back the error log if shader compilation uses the maybe monad? |
|
There's an error callback described in the Telemetry & Fallback: Error Logging section. |
|
Also I'd be in favor of updating the strawman by making all WebGPU objects statusable, and making |
|
OK. Sounds good. Consider this pull request killed. I'll open a new one with WebGPUObjectStatus. |
|
re @grovesNL: The Recoverable errors section is the one that would allow you to wait for creation of an object - I ought to update it to express that it is useful for more than just recoverable errors. (filed #128) |
|
Sorry, misread. Edited comment above. |
No description provided.