From 3a0ae7b55c4c38b9d0a37aa2a741da18c33f49fe Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 23 May 2016 14:34:24 -0700 Subject: [PATCH] glsl: Allow gl_InvocationID and gl_Layer with GL_OES_geometry_shader Fixes dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_2d_array dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_2d_multisample_array dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_3d dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_cubemap v2: Don't enable gl_ViewportIndex in GLSL ES 3.20. Noticed by Ilia. Signed-off-by: Ian Romanick Reviewed-by: Ilia Mirkin Reviewed-by: Kenneth Graunke --- src/compiler/glsl/builtin_variables.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index d4ea6607b46..d379de66030 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -1078,8 +1078,10 @@ builtin_variable_generator::generate_gs_special_vars() var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex"); var->data.interpolation = INTERP_MODE_FLAT; } - if (state->is_version(400, 0) || state->ARB_gpu_shader5_enable) + if (state->is_version(400, 320) || state->ARB_gpu_shader5_enable || + state->OES_geometry_shader_enable || state->EXT_geometry_shader_enable) { add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID"); + } /* Although gl_PrimitiveID appears in tessellation control and tessellation * evaluation shaders, it has a different function there than it has in @@ -1198,9 +1200,16 @@ builtin_variable_generator::generate_fs_special_vars() add_system_value(SYSTEM_VALUE_SAMPLE_MASK_IN, array(int_t, 1), "gl_SampleMaskIn"); } - if (state->is_version(430, 0) || state->ARB_fragment_layer_viewport_enable) { + if (state->is_version(430, 320) || + state->ARB_fragment_layer_viewport_enable || + state->OES_geometry_shader_enable || + state->EXT_geometry_shader_enable) { var = add_input(VARYING_SLOT_LAYER, int_t, "gl_Layer"); var->data.interpolation = INTERP_MODE_FLAT; + } + + if (state->is_version(430, 0) || + state->ARB_fragment_layer_viewport_enable) { var = add_input(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex"); var->data.interpolation = INTERP_MODE_FLAT; } -- 2.30.2