During the last F2F, the idea of exposing reflection information came up. There are a few different use cases:
As far as I know, all the native APIs provide some sort of shader reflection information.
(There's no "API" GitHub tag, so I don't know how to tag this issue as both "relevant to WGSL" but also "relevant to the API")
Thank you for filing this!
It's not in the spirit of low-level APIs to expose any information that the user is already supposed to know. However, it is established in the graphics community that there are applications that work best with this approach. This includes AAA games with large variety of shaders, as well as things like Granite. So I think it's important for us to allow these use cases to exist.
As far as I know, all the native APIs provide some sort of shader reflection information.
It's not clear to me if this matters. We could extract all the relevant info from the WGSL module ourselves.
Observation: Any engine that is generating WGSL should already have enough reflection data in userspace. So adding this would only help engines which are WGSL-first.
(Notably, I think this makes it reasonable to mark post-MVP.)
As far as I know, all the native APIs provide some sort of shader reflection information.
It's not clear to me if this matters. We could extract all the relevant info from the WGSL module ourselves.
I included this not as an an implementation concern, but instead as more of a motivation for the issue. The fact that all the native APIs include this functionality is an indication that authors want it.
As far as I know, all the native APIs provide some sort of shader reflection information.
DX12 and Vulkan provide no reflection information, as far as I know. DirectXShaderCompiler provides some, but that's offline. In Vulkan, community tooling like SPIRV-Reflect is often used.
Perhaps this reflection information could be integrated with https://github.com/gpuweb/gpuweb/pull/646