[Mesa-dev] [PATCH v2 3/6] glsl: add support for GL_OES_geometry_shader

Lofstedt, Marta marta.lofstedt at intel.com
Tue Dec 1 06:43:39 PST 2015


> -----Original Message-----
> From: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] On
> Behalf Of Ian Romanick
> Sent: Monday, November 30, 2015 8:48 PM
> To: Marta Lofstedt; mesa-dev at lists.freedesktop.org
> Subject: Re: [Mesa-dev] [PATCH v2 3/6] glsl: add support for
> GL_OES_geometry_shader
> 
> On 11/27/2015 06:31 AM, Marta Lofstedt wrote:
> > From: Marta Lofstedt <marta.lofstedt at intel.com>
> >
> > This adds glsl support of GL_OES_geometry_shader for OpenGL ES 3.1.
> >
> > Signed-off-by: Marta Lofstedt <marta.lofstedt at linux.intel.com>
> > ---
> >  src/glsl/builtin_variables.cpp  | 17 +++++------------
> >  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(+), 14 deletions(-)
> >
> > diff --git a/src/glsl/builtin_variables.cpp
> > b/src/glsl/builtin_variables.cpp index e8eab80..6a53789 100644
> > --- a/src/glsl/builtin_variables.cpp
> > +++ b/src/glsl/builtin_variables.cpp
> > @@ -667,7 +667,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, 320) ||
> > + state->OES_geometry_shader_enable) {
> 
> I think it would be better to have a separate patch that adds a
> _mesa_glsl_parse_state::has_geometry_shader() method.  This patch would
> then (mostly) just update that function to know about the new OES
> extension.
> 
> I'm suggesting this because I think there are some apps that use the EXT
> version, so we may want to add support for that later.  It also makes the code
> less cluttered.
>
I agree Ian. In this case I believe it looks better with a has_geometry_shader().
V3 coming up.

> 
> >        add_const("gl_MaxVertexOutputComponents",
> >                  state->Const.MaxVertexOutputComponents);
> >        add_const("gl_MaxGeometryInputComponents",
> > @@ -729,11 +729,7 @@ builtin_variable_generator::generate_constants()
> >                  state->Const.MaxCombinedAtomicCounters);
> >        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);
> >           add_const("gl_MaxTessControlAtomicCounters",
> > @@ -753,10 +749,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",
> > @@ -814,7 +807,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", @@ -1057,7 +1050,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, 320) ||
> > + state->OES_geometry_shader_enable) {
> >        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
> > 5a8f980..fae6d0b 100644
> > --- a/src/glsl/glsl_parser.yy
> > +++ b/src/glsl/glsl_parser.yy
> > @@ -1262,7 +1262,7 @@ layout_qualifier_id:
> >              }
> >           }
> >
> > -         if ($$.flags.i && !state->is_version(150, 0)) {
> > +         if ($$.flags.i && !state->is_version(150, 320) &&
> > + !state->OES_geometry_shader_enable) {
> >              _mesa_glsl_error(& @1, state, "#version 150 layout "
> >                               "qualifier `%s' used", $1);
> >           }
> > @@ -1499,7 +1499,7 @@ layout_qualifier_id:
> >        if (match_layout_qualifier("max_vertices", $1, state) == 0) {
> >           $$.flags.q.max_vertices = 1;
> >           $$.max_vertices = new(ctx) ast_layout_expression(@1, $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 7138925..193cc2a 100644
> > --- a/src/glsl/glsl_parser_extras.cpp
> > +++ b/src/glsl/glsl_parser_extras.cpp
> > @@ -635,6 +635,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,
> OES_geometry_shader),
> >     EXT(OES_standard_derivatives,       false, true,
> OES_standard_derivatives),
> >     EXT(OES_texture_3D,                 false, true,      dummy_true),
> >     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 17ff0b5..deca934 100644
> > --- a/src/glsl/glsl_parser_extras.h
> > +++ b/src/glsl/glsl_parser_extras.h
> > @@ -579,6 +579,8 @@ struct _mesa_glsl_parse_state {
> >      */
> >     bool OES_EGL_image_external_enable;
> >     bool OES_EGL_image_external_warn;
> > +   bool OES_geometry_shader_enable;
> > +   bool OES_geometry_shader_warn;
> >     bool OES_standard_derivatives_enable;
> >     bool OES_standard_derivatives_warn;
> >     bool OES_texture_3D_enable;
> >
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list