Search Issue Tracker

Third Party Issue

Votes

0

Found in

6000.0.62f1

6000.2.11f1

6000.3.0b9

6000.4.0a4

Issue ID

UUM-125631

Regression

No

Error ‘cannot use casts on l-values’ when a variable is assigned inside a second-level nested if statement before being used in a conversion

-

How to reproduce:
1. Open the project “IN-123001_D3DTest”
2. Observe the Console

Expected result: No shader error appears in the Console
Actual result: Shader error “… cannot use casts on l-values at Assets/SampleShader.shader(98) (on d3d11)” in the Console

Reproducible with: 2023.1.0a1, 6000.0.62f1, 6000.2.11f1, 6000.3.0b9, 6000.4.0a4

Reproducible on: Windows 11
Not reproducible on: No other environments tested

Notes:

  • If the error does not appear, reimport the SampleShader asset (in the Assets tab, right click the asset → Reimport)
  • The shader experiencing the error does not work, appears pink
  • The issue reproduces on both DX11 and DX12
  • The error appears when nesting the variable in the second level of an if statement
  1. Resolution Note:

    Unity's compilation toolchain isn't doing anything special to the shader beforehand and none of the active FXC flags seem relevant to the issue: seems this is an FXC bug.

    Compiling through DXC (via #pragma use_dxc) functions fine, if that's an acceptable workaround.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.