DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[SPIR-V] vk::image_format no work with bindless array.

Open qiutang98 opened this issue 1 year ago • 0 comments

Problem shader

[[vk::image_format("r16f")]]
[[vk::binding(3, 0)]] 
RWTexture2D<float> RWTextureBindless[];

[[vk::image_format("r16f")]] 
[[vk::binding(0, 1)]] 
globallycoherent RWTexture2D<float> mip5Dest;

The compiled result translate to GLSL by SPIRV-Cross:

layout(set = 0, binding = 3, r32f) uniform writeonly image2D RWTextureBindless[];
layout(set = 1, binding = 0, r16f) uniform coherent image2D mip5Dest;

When watching SPIR-V Asm, can find it still use r32f:

%type_2d_image_0 = OpTypeImage %float 2D 2 0 0 2 R32f
%type_2d_image_1 = OpTypeImage %float 2D 2 0 0 2 R16f

// ...
%638 = OpAccessChain %_ptr_UniformConstant_type_2d_image_0 %RWTextureBindless %636
%639 = OpLoad %type_2d_image_0 %638

// ...
%512 = OpLoad %type_2d_image_1 %mip5Dest

qiutang98 avatar Aug 25 '24 13:08 qiutang98