Search Issue Tracker

Third Party Issue

Votes

1

Found in

2017.4

2019.2.21f1

2020.2

Issue ID

1232436

Regression

No

[FXC Freeze] Specific Compute Shader compiles infinitely and causes a memory leak when imported

Shader System

-

How to reproduce:
1. Download the user's attached Compute Shader
2. Create a new project with the default 3D template
3. Import the Compute Shader by dragging it into the Assets folder
4. Wait for the Shader to compile

Expected result: Compute Shader is compiled
Actual result: Compute Shader is compiling infinitely

Reproducible with: 2017.4.39f1, 2018.4.20f1, 2019.3.8f1, 2020.1.0b4, 2020.2.0a5

Note: In addition, Unity Shader Compiler leaks memory, and it's not released when the Editor is closed

  1. Resolution Note (2020.2.X):

    There seems to be a bug in the Microsoft D3D compiler that is triggered with this particular shader. Unfortunately we can't do much anything with this sort of issues as we use the compiler dll as a binary and it is not under active development anymore. You can either try refactoring the shader to avoid this issue or in the future use an alternative compiler path when it's available.

Comments (1)

  1. SLGSimon

    Apr 01, 2020 15:30

    From my investigation this is a bug with the fxc compiler, that doesn't exist in the new dxc compiler. It seems like you are already working on integrating the new compiler.

    I was able to work around the issue by changing:
    [loop]
    for (int z = 0; z < quadsPerTile; ++z)
    {
    [loop]
    for (int x = 0; x < quadsPerTile; ++x)
    {

    to
    [loop]
    for (uint t = 0; t < quadsPerTile * quadsPerTile; ++t)
    {
    uint z = t / quadsPerTile;
    uint x = t % quadsPerTile;

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.