Search Issue Tracker

By Design

Votes

0

Found in

2017.4

2018.4

2019.2

2019.2.14f1

2019.3

2020.1

Issue ID

1208664

Regression

No

[Critical] Certain Shaders remain broken when an undeclared variable is removed

Shader System

-

Reproduction steps:
1. Create a new Project
2. Create a new Unlit shader
3. In the struct v2f add the following line "float3 test;"
4. Save the Shader
5. Observe the Shader in the Inspector window. "Shader is not supported on this GPU" error is thrown
6. Delete the added line and save the shader
7. Observe the Inspector window again

Expected behavior: The error message is gone, as the code which caused the error has been removed
Actual behavior: The error remains. Any materials that have been using this shader remain magenta

Reproducible with: 2017.4.36f1, 2018.4.15f1, 2019.2.17f1, 2019.3.2f1, 2020.1.0a23

Notes:
1. Only reproducible with D3D11 and D3D12. Does not reproduce when using Vulkan, Metal or OpenGL. Reimport clears the error when Vulkan or OpenGL is used.
2. Restarting the Editor or Re-importing the assets does not resolve this
3. 2017.4 does not throw an error message, but the materials that use the affected shader remain broken
4. Shaders affected: Unlit/ImageEffect

  1. Resolution Note (2020.2.X):

    Adding members without semantics into the v2f struct will cause the shader upgrader to add these lines into the shader:
    // Upgrade NOTE: excluded shader from DX11; has structs without semantics (struct v2f members test)
    #pragma exclude_renderers d3d11

    This will exclude DX11/12 targets from this shader (renders pink). After this, removing the struct member alone won't revert the whole shader back where it was. The pragma needs to be removed too in order to make the shader run on DX targets again.

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.