Open Ace17 opened 1 year ago
Could you provide a full reproduction case that demonstrates the generation of invalid SPIR-V?
After reducing the test case, it turns out the generation of invalid SPIR-V code might be a separate issue (than the implicit conversion).
Here is a minimized test case anyway. Please do notice the --auto-sampled-textures
.
Texture2D Text : register(t1);
SamplerState Samp : register(s1);
struct Combined
{
Texture2D T;
SamplerState S;
};
float3 PSMain() : DUMMY
{
Combined comb;
comb.T = Text;
comb.S = Samp;
// return Text.Load(0); // OK
return comb.T.Load(0); // invalid code is generated:
// error: SPIRV-Tools Validation Errors
// error: Expected Image to be of type OpTypeImage
// %62 = OpImageFetch %v4float %54 %69 Lod %int_0
}
Compile with:
glslangValidator -S frag -e PSMain -D -V spirv_issue_3338.hlsl --spirv-val --auto-sampled-textures
The result:
spirv_issue_3338.hlsl
error: SPIRV-Tools Validation Errors
error: Expected Image to be of type OpTypeImage
%62 = OpImageFetch %v4float %54 %69 Lod %int_0
Note that this only reproduces with the --auto-sampled-textures
option.
Yeah, actually that was my point ;-)
Please do notice the --auto-sampled-textures.
I think the automatic texture/sampler combining might be at fault here.
Hi,
The following code is rejected by fxc and dxc. However, it is accepted by glslang - which will produce invalid SPIR-V code, if one tries to access
texture
inf
.https://shader-playground.timjones.io/85b34b00156e57adb4bd6c401925fb7c