Closed nipunG314 closed 1 month ago
Thanks for reporting @nipunG314 !
These are the rules for where vk::ext_capability
can be used, but agreed that error messaging should be improved.
[[vk::ext_capability(uint _capability_)]]
- An attribute to specify
OpCapability
instruction.- It can be an attribute of
vk::ext_execution_mode(...)
,vk::ext_execution_mode_id(...)
, a function declared withvk::ext_instruction(...)
, or a function declared with[[vk::ext_type_def(...)]]
. We can use multiple[[vk::ext_extension(string extension_name)]]
for a single function.- uint capability must be a constant expression.
https://github.com/microsoft/DirectXShaderCompiler/wiki/GL_EXT_spirv_intrinsics-for-SPIR-V-code-gen
In general, we do not want these attributes to propagate. We want it close to the feature that actually requires the extension or capability.
For your case, I would recommend addin it to the typedef:
Description
The
[[vk::ext_capability(...)]]
tag doesn't propagate if it isn't attached to a[[vk::ext_instruction(...)]]
tag. It should either work on every method/function or give errors/warnings on the ones its not supposed to work on/will be ignored. Right now, we're forced to create a specialized version of the same templated function if we want to support a capability only on certain types (e.g. PhysicalStorageBufferAddresses for pointers, but not for builtin types like uint32_t)Steps to Reproduce
https://godbolt.org/z/PjY3TTq1K
The
[[vk::ext_capability(/*PhysicalStorageBufferAddresses */ 5347 )]]
at line 17 isn't being propagated correctly. If you uncomment line 13, it compiles correctly.Actual Behavior
Environment