shaderc icon indicating copy to clipboard operation
shaderc copied to clipboard

Opimizer pass failing on simple HLSL repro case

Open cmccuewg opened this issue 5 years ago • 3 comments

I'm hitting a bug in the HLSL compiler which I have stripped down as far as this simple bit of code:

uniform float4 UniformArray[6];
float4 Function(const float4 parameterArray[6])
{
	return 0;
}
float4 main() : SV_TARGET0
{
	return Function(UniformArray);
}

The error that is returned is "compilation succeeded but failed to optimize: OpFunctionCall Argument '30[%30]'s type does not match Function '10[%_arr_v4float_uint_6]'s parameter type."

I stepped through the code closely to try to see what's going on. The emitted SPIRV uses two different types for the function parameter and the data that I'm trying to pass in, the second one just gets an appended "_0" so it has a unique name:

%_arr_v4float_uint_6 = OpTypeArray %v4float %uint_6
%_arr_v4float_uint_6_0 = OpTypeArray %v4float %uint_6

cmccuewg avatar Apr 30 '19 15:04 cmccuewg

I have confirmed that this reproduces.

zoddicus avatar May 22 '19 18:05 zoddicus

I suspect that this is actually an issue in glslang, but I am not really sure how to test that. Specifically I am not sure how to take what we have here and test using the glslang stand alone to get the same SPIR-V. What I am getting is wildly different, so I am pretty sure I am not passing into the correct flags or doing the right pre-processing.

@dneto0, are you familiar with how test this against glslang or know who would be?

zoddicus avatar May 22 '19 19:05 zoddicus

@johnkslang

dj2 avatar May 22 '19 19:05 dj2