From: Marta Lofstedt <marta.lofst...@intel.com> This adds glsl support of GL_OES_geometry_shader for OpenGL ES 3.1.
Signed-off-by: Marta Lofstedt <marta.lofst...@linux.intel.com> --- src/glsl/builtin_variables.cpp | 16 +++++----------- src/glsl/glsl_parser.yy | 4 ++-- src/glsl/glsl_parser_extras.cpp | 1 + src/glsl/glsl_parser_extras.h | 2 ++ 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index b5e2908..cd8d61c 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -611,7 +611,7 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxVaryingComponents", state->ctx->Const.MaxVarying * 4); } - if (state->is_version(150, 0)) { + if (state->is_version(150, 0) || state->OES_geometry_shader_enable) { add_const("gl_MaxVertexOutputComponents", state->Const.MaxVertexOutputComponents); add_const("gl_MaxGeometryInputComponents", @@ -674,10 +674,7 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxAtomicCounterBindings", state->Const.MaxAtomicBufferBindings); - /* When Mesa adds support for GL_OES_geometry_shader and - * GL_OES_tessellation_shader, this will need to change. - */ - if (!state->es_shader) { + if (!state->es_shader || state->OES_geometry_shader_enable) { add_const("gl_MaxGeometryAtomicCounters", state->Const.MaxGeometryAtomicCounters); @@ -701,10 +698,7 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxAtomicCounterBufferSize", state->Const.MaxAtomicCounterBufferSize); - /* When Mesa adds support for GL_OES_geometry_shader and - * GL_OES_tessellation_shader, this will need to change. - */ - if (!state->es_shader) { + if (!state->es_shader || state->OES_geometry_shader_enable) { add_const("gl_MaxGeometryAtomicCounterBuffers", state->Const.MaxGeometryAtomicCounterBuffers); add_const("gl_MaxTessControlAtomicCounterBuffers", @@ -762,7 +756,7 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxCombinedImageUniforms", state->Const.MaxCombinedImageUniforms); - if (!state->es_shader) { + if (!state->es_shader || state->OES_geometry_shader_enable) { add_const("gl_MaxCombinedImageUnitsAndFragmentOutputs", state->Const.MaxCombinedShaderOutputResources); add_const("gl_MaxImageSamples", @@ -993,7 +987,7 @@ builtin_variable_generator::generate_fs_special_vars() if (state->is_version(120, 100)) add_input(VARYING_SLOT_PNTC, vec2_t, "gl_PointCoord"); - if (state->is_version(150, 0)) { + if (state->is_version(150, 0) || state->OES_geometry_shader_enable) { ir_variable *var = add_input(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID"); var->data.interpolation = INTERP_QUALIFIER_FLAT; diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 59e4527..ab50c4b 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1250,7 +1250,7 @@ layout_qualifier_id: } } - if ($$.flags.i && !state->is_version(150, 0)) { + if ($$.flags.i && !state->is_version(150, 310)) { _mesa_glsl_error(& @1, state, "#version 150 layout " "qualifier `%s' used", $1); } @@ -1491,7 +1491,7 @@ layout_qualifier_id: YYERROR; } else { $$.max_vertices = $3; - if (!state->is_version(150, 0)) { + if (!state->is_version(150, 310)) { _mesa_glsl_error(& @3, state, "#version 150 max_vertices qualifier " "specified", $3); diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index dae5261..1cb34df 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -625,6 +625,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { /* OES extensions go here, sorted alphabetically. */ EXT(OES_EGL_image_external, false, true, OES_EGL_image_external), + EXT(OES_geometry_shader, false, true, dummy_true), EXT(OES_standard_derivatives, false, true, OES_standard_derivatives), EXT(OES_texture_3D, false, true, EXT_texture3D), EXT(OES_texture_storage_multisample_2d_array, false, true, ARB_texture_multisample), diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index d3b091d..f271d37 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -567,6 +567,8 @@ struct _mesa_glsl_parse_state { bool AMD_vertex_shader_viewport_index_warn; bool EXT_draw_buffers_enable; bool EXT_draw_buffers_warn; + bool OES_geometry_shader_enable; + bool OES_geometry_shader_warn; bool EXT_separate_shader_objects_enable; bool EXT_separate_shader_objects_warn; bool EXT_shader_integer_mix_enable; -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev