Can GLSL support switch statements implemented as transition tables?

It seems that on AMD a few years ago ( "the switch-statement statement in optimizing the transition table is not executed by our driver" ).

From what I saw in the Nvidia intermediate language (via glGetProgramBinaryor export __GL_WriteProgramObjectAssembly=1), there is no dynamic jump command, or at least I cannot run it. Functions are impossible (all of them are inserted, I assume that this is due to the lack of a dynamic transition to return), and the switch statements seem complete as nested if-statements. Is it even possible to invoke the switch statement for a dynamic transition? (unlike the following)

#version 430

uniform int index;

void main()
{
    switch(index)
    {
    case 0: gl_Position.x = 0; break;
    case 1: gl_Position.x = 1; break;
    case 2: gl_Position.x = 2; break;
    case 3: gl_Position.x = 3; break;
    }
}

...

!!NVvp5.0
OPTION NV_bindless_texture;
OPTION NV_shader_atomic_float;
 PARAM c[1] = { program.local[0] };
TEMP R0;
TEMP RC, HC;
SEQ.S R0.x, c[0], {0, 0, 0, 0};
MOV.U.CC RC.x, -R0;
IF NE.x;
MOV.F result.position.x, {0, 0, 0, 0};
ELSE;
SEQ.S R0.x, c[0], {1, 0, 0, 0};
MOV.U.CC RC.x, -R0;
IF NE.x;
MOV.F result.position.x, {1, 0, 0, 0};
ELSE;
SEQ.S R0.x, c[0], {2, 0, 0, 0};
MOV.U.CC RC.x, -R0;
IF NE.x;
MOV.F result.position.x, {2, 0, 0, 0};
ELSE;
SEQ.S R0.x, c[0], {3, 0, 0, 0};
MOV.U.CC RC.x, -R0;
IF NE.x;
MOV.F result.position.x, {3, 0, 0, 0};
ENDIF;
ENDIF;
ENDIF;
ENDIF;
END

- SIMT , . , . , , - ?

: CUDA ? - GLSL, , , ?

+3

All Articles