Skip to content

Compiler issues internal error: "IF statement nested too deeply" #16

@afd

Description

@afd

[Shaders, screenshots, error log, reproduction steps, etc.] [ZIP]

The fragment shader available at the above link (it is large, so not posted here) is accepted by glslangValidator (and by a recent Intel driver).

It is a large and contrived shader, so might reasonably be rejected as too large to process. However, the NVIDIA compiler gives an internal error showing details of low-level translated code; a more graceful error message would be better.

Here is a snippet of the error:


Fragment info
-------------
Internal error: assembly compile error for fragment shader at offset 5906:
-- error message --
line 309, column 7:  error: IF statement nested too deeply.
line 347, column 6:  error: ENDIF without matching IF.
-- internal assembly text --
!!NVfp5.0
OPTION NV_bindless_texture;
# cgc version 3.4.0001, build date Oct  1 2016
# command line args:
#vendor NVIDIA Corporation
#version 3.4.0.1 COP Build Date Oct  1 2016
#profile gp5fp
#program main
#semantic injectionSwitch
#var float2 injectionSwitch :  : c[0] : -1 : 1
PARAM c[1] = { program.local[0] };
TEMP R0;
TEMP RC, HC;
SGT.F R0.y, c[0].x, {1, 0, 0, 0}.x;
TRUNC.U.CC HC.x, R0.y;
MOV.U R0.x, {1, 0, 0, 0};
IF    NE.x;
MOV.U R0.x, {0, 0, 0, 0};
ENDIF;
MOV.U.CC RC.x, R0;
IF    NE.x;
SGT.F R0.y, {1, 0, 0, 0}.x, c[0];
TRUNC.U.CC HC.x, R0.y;
IF    NE.x;
SGT.F R0.y, c[0].x, {1, 0, 0, 0}.x;
TRUNC.U.CC HC.x, R0.y;
IF    NE.x;
MOV.U R0.x, {0, 0, 0, 0};
ENDIF;
ENDIF;
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions