-
Notifications
You must be signed in to change notification settings - Fork 45
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
Determine how to return CompilationInfo #82
Comments
Overall, I think we should keep the extensibility you have proposed. I could definitely imagine extensions like WEBGL_debug_shaders.getTranslatedShaderSource() that might fit nicely here. However, I think the way Vulkan usually handles extensibility like this for output structs is that you pass in a chained struct which the Vulkan implementation populates. Maybe one way we could do that is to also pass in
P.S. Okay, maybe not |
I just noticed that in addition to the output extension chain, there's also an output string here. So unless we do the Vulkan thing consistently (so for strings: call with null to get the string length, then call again with preallocated storage - for every message! awful)... |
#96 adds |
CompilationInfo is a little unique because it's one of the only places in the API that a structure of data is being returned out of the API. AdapterProperties seems to be the only close analog, but because CompilationInfo is queried with a promise in the JS API it would need to be supplied by a callback here.
So a first stab at this would suggest we'd want an API surface like that following?
Or, recognizing that WGPUCompilationInfo is just a list of messages, if we weren't worried about extensibility of that particular structure the callback signature could simply be:
I'm also not sure what sort of guarantees the library gives about lifetime of objects like this, if it's expected that it would only be valid for the duration of the callback or if the library would be expected to keep it alive and owned by the shader module after being queried.
The text was updated successfully, but these errors were encountered: