You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPIR-V] Fixed a crash if encounter constant buffer fields with overlapping register assignments (#7636)
The issue:
simple vertex shader like so
```
uniform float4x4 gMVP : register(c0);
uniform float4 gFoo : register(c5);
uniform float4 gBar : register(c5);
float4 main(float4 pos : POSITION) : SV_Position {
return mul(gMVP, pos * gFoo + gBar);
}
```
will result in an internal crash
```
dxc.exe -spirv -T vs_6_2 -E main test.hlsl -Fo test.spirv
Internal compiler error: access violation. Attempted to read from address 0x0000000000000000
```
Due to `LowerTypeVisitor` trying to assign offsets to fields without
explicit locations.
It'll sort fields first, which will fill the map with the fields first.
And since it's using `std::map` - if there's fields with the same
`register` number - it'll only insert first, other will be left out,
resulting nullptrs in the output vector.
We read the content of the vector down the road crashing.
My change fixes the crash and tries to output somewhat useful info about
compilation fail.
I hope this helps you in fixing it properly, or you can take it as it
is.
0 commit comments