Closed Roweax closed 5 years ago
Reproduced. Strange ...
Oh, on further inspection, this is illegal SPIR-V. You have this sequence:
%_Main_ = OpFunction %float None %16
%18 = OpLabel
%a = OpVariable %_ptr_Function_float Function
%param_0 = OpVariable %_ptr_Function_7 Function
%param_1 = OpVariable %_ptr_Function_7 Function
%46 = OpLoad %7 %Texture0 <--- Load texture
OpStore %param_0 %46 <--- Store texture to stack, illegal!
%47 = OpFunctionCall %float %Sum_t21_ %param_0
If I patch up the SPIR-V to be correct, i.e. pass the texture pointer around directly, it works as expected, you need to run the HLSL legalizer passes on this shader.
spirv-val doesn't catch this, so I'll file a spirv-tools bug.
commit cf5e1c280132d1ac519cd98ca64d3173342f7e2b
when i convert such HLSL shader
convert to spv, then convert to glsl
output glsl, the 'Sum' function lose argument