Skip to content

[Feature Request][SPIR-V] HLSL style binding assignment for array of resources #6927

Closed

Description

@manas-kulkarni

Is your feature request related to a problem? Please describe.
We have feature in engine that depends on hlsl style binding assignment for resource arrays. This doesn't work with the Vulkan style assignment where array resources takes only one binding

Describe the solution you'd like
-fspv-hlsl-resource-array-bindings

  • Resource array will take up [array-size] number of bindings when doing implicit binding assignment

Activity

  1. added
    enhancement
    needs-triage
    on Sep 23, 2024
  2. s-perron commented on Sep 23, 2024

    @s-perron
    Collaborator

    I think we already have a feature like that:

    -fspv-flatten-resource-arrays
    Flatten arrays of resources so each array element takes one binding number

    Does that work for you? If there are bug fixes to that feature, we might be able help fix those. If you require something very different, we are very unlikely to implement it in DXC.

  3. manas-kulkarni commented on Sep 24, 2024

    @manas-kulkarni
    Author

    Basically it is -fspv-flatten-resource-arrays without the changes in SpirvEmitter.cpp

  4. moved this from For Google to Triaged in HLSL Triageon Sep 26, 2024
  5. s-perron commented on Sep 26, 2024

    @s-perron
    Collaborator

    A workaround was identified in #6932. You can use -fspv-flatten-resource-arrays with -fcgl. Then you can run the legalization and optimization passes separately. If you are using the command line, it would look somethink like this:

    dxc -T cs_6_6 -spirv t.hlsl -fspv-flatten-resource-arrays -fcgl -Fo t.spv && \
    spirv-opt t.spv -o o.spv --trim-capabilities --legalize-hlsl --descriptor-composite-scalar-replacement -O
    

    Please post any change if the optimization passes do not work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-triage

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions