You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] [SPIR-V] Add a command line option to set storage image and storage texel buffer format to Unknown #7484
Is your feature request related to a problem? Please describe.
DXC tries to guess the format of storage images and storage texel buffers from the type of the resource. For example, for RWTexture<float4> DXC will set the format to Rgba32. Recent Vulkan validation throws a warning if the format in SPIR-V doesn't match the format of the VkImage.
So developers really have two choices. Either decorate the resource with [[vk::format(...)]] or ignore the validation warning. Both solutions are not ideal. The 1st solution means touching a potentially huge set of shader code and the 2nd solution might not be possible if validation runs through some tool that can't filter messages.
According to https://vulkan.gpuinfo.org the vast majority of GPUs (90%+) nowadays support reading and writing from Unknown.
Describe the solution you'd like
To avoid breaking existing code DXC could add a command line option that stops it from guessing the format and always sets it to Unknown.
What version of Vulkan do you target? Starting in Vulkan 1.3 the feature is required. In Clang, we are using unknown by default, and plan to do that for VK1.3 and up. I wonder if we should do the same in DXC.
I'm targeting -fspv-target-env=vulkan1.1spirv1.4 but in reality I'm at Vulkan 1.3. I just realized I neglected to update the -fspv-target-env. Is that what you mean?
Tying the format to the target version sounds sensible.
I had to revert the change. It was causing regressions on some platform because the vulkan validation layers were complaining. I'll add an option as you originally suggested.
Activity
s-perron commentedon May 29, 2025
What version of Vulkan do you target? Starting in Vulkan 1.3 the feature is required. In Clang, we are using unknown by default, and plan to do that for VK1.3 and up. I wonder if we should do the same in DXC.
godlikepanos commentedon May 30, 2025
I'm targeting
-fspv-target-env=vulkan1.1spirv1.4but in reality I'm at Vulkan 1.3. I just realized I neglected to update the-fspv-target-env. Is that what you mean?Tying the format to the target version sounds sensible.
s-perron commentedon Jun 3, 2025
Great. I'll try to get to this in the next few weeks.
[SPIRV] Use unknown image format in vk1.3 and later (#7528)
s-perron commentedon Jun 24, 2025
I had to revert the change. It was causing regressions on some platform because the vulkan validation layers were complaining. I'll add an option as you originally suggested.
[SPIRV] Add option to use the Unknown image format
[SPIRV] Add option to use the Unknown image format (microsoft#7632)