GPU-Reshape icon indicating copy to clipboard operation
GPU-Reshape copied to clipboard

Q: Good way go get RootSignature from a spir-v shader?

Open JCash opened this issue 9 months ago • 2 comments

Hi!

Avalanche alumni here 👋 I recently got the tip to look into this tool by a former colleague of ours.

Given the nature of this tool, I wonder if there's some part I can look at in terms of generating a RootSignature for hlsl code? We're using spirv-cross to take a spir-v file to generate a .hlsl file, but it doesn't seem to have the option to generate the RootSignature.

So I'm looking into other toolsets if they have some helper code to do this. I know I could roll my own, but I think it would be beneficial for me to use a more "standard" way to do it.

Any tips or pointers in the right direction would be greatly appreciated!

Regards, Mathias

JCash avatar May 17 '25 08:05 JCash

Hiya!

I don't think there's a comparable piece of code for that here.

However, thinking out loud, if you know the (HLSL) registers allocated to the respective resources (i.e., Texture2D -> t0, etc.), you can probably generate it fairly easily.

Assuming that the descriptor layout in that SPIRV kernel is what you want. I'd generate the mappings from the Spv descriptor decorations, particularly as you already know the descriptor table groupings. For root parameters, outside of root constants, I'd consider a "global" table akin to what DXC does for static values.

Hopefully that might prove of some use! 🙂

miguel-petersen avatar May 19 '25 19:05 miguel-petersen

Thanks for your answer! Yeah, I do have access to the descriptor layout, and I guess I'll have to start rolling our own solution. It just felt like it should be a solved problem somewhere 🤔

Regards, Mathias

JCash avatar May 23 '25 07:05 JCash