From 51c1c4d95a05b6eb6fce74e8d624615e4a1b38ab Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Mon, 23 Dec 2019 21:45:52 -0500 Subject: [PATCH] mesa: enable GL_EXT_draw_instanced for gles2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Reviewed-by: Tapani Pälli Part-of: --- docs/relnotes/new_features.txt | 1 + src/compiler/glsl/builtin_variables.cpp | 5 +++++ src/compiler/glsl/glsl_parser_extras.cpp | 1 + src/compiler/glsl/glsl_parser_extras.h | 2 ++ src/mesa/main/extensions_table.h | 2 +- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index cf4b5fad96a..cbf7b606860 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -6,3 +6,4 @@ GL_NV_pixel_buffer_object on all gallium drivers, i915, i965, swrast. GL_NV_viewport_array2 on nvc0 (GM200+). GL_NV_viewport_swizzle on nvc0 (GM200+). VK_KHR_shader_non_semantic_info on Intel, RADV. +GL_EXT_draw_instanced on gles2 diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index e305ab9b9b8..c9fdac84666 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -1084,8 +1084,13 @@ builtin_variable_generator::generate_vs_special_vars() add_system_value(SYSTEM_VALUE_BASE_INSTANCE, int_t, "gl_BaseInstance"); add_system_value(SYSTEM_VALUE_DRAW_ID, int_t, "gl_DrawID"); } + if (state->EXT_draw_instanced_enable && state->is_version(0, 100)) + add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t, GLSL_PRECISION_HIGH, + "gl_InstanceIDEXT"); + if (state->ARB_draw_instanced_enable) add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t, "gl_InstanceIDARB"); + if (state->ARB_draw_instanced_enable || state->is_version(140, 300) || state->EXT_gpu_shader4_enable) { add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t, GLSL_PRECISION_HIGH, diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 6eb0aa2abb8..c394f00480a 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -721,6 +721,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(EXT_demote_to_helper_invocation), EXT(EXT_frag_depth), EXT(EXT_draw_buffers), + EXT(EXT_draw_instanced), EXT(EXT_clip_cull_distance), EXT(EXT_geometry_point_size), EXT_AEP(EXT_geometry_shader), diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index b5e687d6038..afbc09170bf 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -824,6 +824,8 @@ struct _mesa_glsl_parse_state { bool EXT_demote_to_helper_invocation_warn; bool EXT_draw_buffers_enable; bool EXT_draw_buffers_warn; + bool EXT_draw_instanced_enable; + bool EXT_draw_instanced_warn; bool EXT_frag_depth_enable; bool EXT_frag_depth_warn; bool EXT_geometry_point_size_enable; diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index a4194a9ac5d..66f5d2e9d9d 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -234,7 +234,7 @@ EXT(EXT_draw_buffers , dummy_true EXT(EXT_draw_buffers2 , EXT_draw_buffers2 , GLL, GLC, x , x , 2006) EXT(EXT_draw_buffers_indexed , ARB_draw_buffers_blend , x , x , x , 30, 2014) EXT(EXT_draw_elements_base_vertex , ARB_draw_elements_base_vertex , x , x , x , ES2, 2014) -EXT(EXT_draw_instanced , ARB_draw_instanced , GLL, GLC, x , x , 2006) +EXT(EXT_draw_instanced , ARB_draw_instanced , GLL, GLC, x , ES2 , 2006) EXT(EXT_draw_range_elements , dummy_true , GLL, x , x , x , 1997) EXT(EXT_float_blend , EXT_float_blend , x , x , x , 30, 2015) EXT(EXT_fog_coord , dummy_true , GLL, x , x , x , 1999) -- 2.30.2