Skip to content

[SPIR-V] vk::ext_capability can only tag vk::SpirvType aliases and typedefs, not other types #6958

Open

Description

Description

I have a templated struct (nbl::hlsl::bda::__ptr<T>) that uses vk::SpirvType internally to declare a PhysicalStoragePointer of another type T.

I put [[vk::ext_capability(spv::CapabilityStorageBuffer8BitAccess)]] in the typedef for a __ptr<uint16_t> (is supposed to be uint8_t later), and I expect the usage of that type to propagate the capability.

My argument for why I need extensions and capabilities to propagate is because for example CapabilityStorageBuffer8BitAccess is a specific capability of using a (u)int8 AND PhysicalStorageBuffer storage class, so I'd have to manually declare a fairly complicated SpirvType (two nested) just to be able to stick the capability on it.

This gets especially annoying for capabilities/extensions dealing with images, as an inline SPIR-V declaration for a combined image sampler or similar can be a chain of 4-5 SpirV types.

Steps to Reproduce

My own Godbolt instance with a few more headers: https://tinyurl.com/ydhdncw3

Can produce preprocessed full source and make a repro on godbolt with vanilla DXC

Actual Behavior

No OpCapability CapabilityStorageBuffer8BitAccess emitted

Environment

  • DXC version more or less commit f810e92
  • Host Operating System Windows

Activity

  1. added
    bug
    needs-triage
    spirv
    on Oct 12, 2024
  2. devshgraphicsprogramming commented on Oct 12, 2024

    @devshgraphicsprogramming
    Author

    Seems that microsoft/hlsl-specs#191 and microsoft/hlsl-specs#270 didn't foresee such a use in their design.

  3. devshgraphicsprogramming commented on Nov 20, 2024

    @devshgraphicsprogramming
    Author

    I'm also quite suprised that

    [[vk::ext_capability(spv::CapabilityRayQueryKHR)]]
    using RayQueryKHR = vk::SpirvOpaqueType<spv::OpTypeRayQueryKHR>;

    doesn't want to compile for me either

  4. moved this from For Google to Triaged in HLSL Triageon May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugspirv

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions