KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
2.01k stars 556 forks source link

spirv-cross standalone: interface to add_hlsl_resource_binding #1790

Open FilippoLeon opened 2 years ago

FilippoLeon commented 2 years ago

For Spirv to HLSL using the library I can manually assign registers using "compiler.add_hlsl_resource_binding": in particular I can force a specific register for push constants.

As far as I can tell this is not possible with "spirv-cross" standalone executable.

Am I missing something and this feature already exists? If not, I could give it a try and implement it myself, is there any interest for that?

HansKristian-Work commented 2 years ago

Advanced binding features are super awkward to express in a CLI, and these APIs are designed to be used as a library, with a app driving the binding model based on reflection. If the feature request is very narrow in scope, perhaps I can look at adding it, in that case please explain what you'd like the CLI to look like and what it should do.

FilippoLeon commented 2 years ago

The biggest use case would be actually push constants, and for that the CLI arguments could be simple. I'd like to always map it to, say register 0. The rest is a bonus, since I can keep al my bindings unique also among descriptor sets, I would have no problem keeping the spirv bindings.