Search Issue Tracker
Fixed in 2020.2.X
Fixed in 2018.4.X, 2019.4.X
Votes
0
Found in
2018.4
2020.1.0b6
2020.2
Issue ID
1242345
Regression
No
[Critical] HLSLcc uses an incorrect variable in an if statement when the needed variable is defined below float type matrix
How to reproduce:
1. Open the attached project "1242345.zip"
2. Open the "Test" Scene
3. Open the "Test.compute" Compute Shader by selecting it in Project window and clicking "Open" in the top-right corner of the Inspector window
4. Open the "Test.compute" Compute Shader by selecting it in Project window and clicking "Show compiled code" in the Inspector window
5. Observe lines 26 and 27 in the compiled Compute Shader file (Compiled-Test-.shader)
Expected result: the Compute Shader's "if" statement was compiled using the value of "float(0.0)!=Globals._EnableTonemapping"
Actual result: the Compute Shader's "if" statement was compiled using the value of "float(0.0)!=Globals.hlslcc_mtx3x3_WhitePointTransform[2].w"
Reproducible with: 2018.4.26f1, 2019.4.6f1, 2020.1.0f1, 2020.2.0a19
Workaround: changing the order of variables in lines 7 (float3x3 _WhitePointTransform;) and 8 (float _EnableTonemapping;) solves the issue
Notes:
- Tested and reproduces with OpenGLCore, OpenGLES2, OpenGLES3, and Metal APIs
- Not sure if reproduces with Vulkan, DirectX11, and DirectX12 as compiled code is hardly readable
- Only reproduces if the "_WhitePointTransform" variable is a matrix of type float or int (float2x2, float 3x3, int3x3, etc...)
- In case matrix type is an int - "intBitsToFloat" method is called to handle a conversion
- Does not reproduce if the matrix size is 4x4 or 4x3 (float4x4, float4x3)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Search: Inspector section icon is less sharp/more pixelated than other editor icons
- Search description string is always truncated
- [VFX] When Grouped Nodes are converted to Subgraph Operator resulting Graph Node is not included in the Group
- Search window icons are less sharp/more pixelated than other editor icons
- The Inspector can be covered when scaling the horizontal separator bar
Resolution Note (fix version 2020.2):
Issue was fixed and should no longer reproduce in Unity 2021.1.0a5 and above
Resolution Note (fix version 2020.2):
Fixed with Unity 2020.2.3f1
Resolution Note (fix version 2019.4):
The issue has been fixed in Unity 2019.4.19f1 and above.
Resolution Note (fix version 2018.4):
This issue has been fixed and should no longer reproduce using Unity 2018.4.31f1 and above