google / google/shaderc

Opimizer pass failing on simple HLSL repro case

Open
#601 3 comments 0 reactions 1 assignee Assigned to @dneto0 View on GitHub
bug
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.