ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Apache License 2.0
4.71k stars 493 forks source link

Add shader variable types in reflection #189

Closed TLaviron closed 3 years ago

TLaviron commented 3 years ago

Hello,

I just noticed that in Shader reflections, shader variables do not contain type information (e.g. float, uint, float3, ...). Looking at the SPIRV-Cross API, this information seems available, but is simply not saved in the Forge structures. I haven't checked D3D12 yet but I suspect it is also available since D3D11 provides this info.

Is there any chance of it being added? I could propose a Vulkan & D3D12 (maybe D3D11 too) patch to enable this, if useful.

wolfgangfengel commented 3 years ago

We are developing a new shader translator from scratch. For this shader translator -I believe- we also change some of the reflection data. Let me ask my colleagues who are working on this. On a related note, we tried the Google SPIRV reflection library but found it "too buggy" to be used. We will give it another try after it has settled for a while. I follow up here ...

TLaviron commented 3 years ago

Thanks for the feedback.

To provide some more context, our current workflow consists in feeding HLSL shaders to DXC to provide SPIR-V bytecode (for Vulkan; DXIL for D3D), and forwarding this bytecode to the Forge's addShaderBinary, then reading reflection information for the created Shader object. The shader variable type information is needed by some UI components to allow editing the values.

I'll temporarily add the minimum fonctionality we need to our clone, for now.

wolfgangfengel commented 3 years ago

Hi @TLaviron , can I close this issue?