[Mesa-dev] [PATCH v2 09/23] glsl: Store info about geometry shaders that emit vertices to non-zero streams.

Chris Forbes chrisf at ijw.co.nz
Thu Jun 19 00:53:41 PDT 2014


(but maybe in a separate patch)

On Thu, Jun 19, 2014 at 7:53 PM, Chris Forbes <chrisf at ijw.co.nz> wrote:
> Sounds good to me.
>
> On Thu, Jun 19, 2014 at 7:23 PM, Iago Toral <itoral at igalia.com> wrote:
>> On Wed, 2014-06-18 at 13:05 -0700, Ian Romanick wrote:
>>> On 06/18/2014 02:51 AM, Iago Toral Quiroga wrote:
>>> > On Intel hardware when a geometry shader outputs GL_POINTS primitives we
>>> > only need to emit vertex control bits if it emits vertices to non-zero
>>> > streams, so use a flag to track this.
>>> >
>>> > This flag will be set to TRUE when a geometry shader calls EmitStreamVertex()
>>> > or EndStreamPrimitive() with a non-zero stream parameter in a later patch.
>>> > ---
>>> >  src/mesa/main/mtypes.h     | 2 ++
>>> >  src/mesa/main/shaderapi.c  | 1 +
>>> >  src/mesa/main/shaderobj.c  | 1 +
>>> >  src/mesa/program/program.c | 1 +
>>> >  4 files changed, 5 insertions(+)
>>> >
>>> > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>>> > index f45dde4..5bc710e 100644
>>> > --- a/src/mesa/main/mtypes.h
>>> > +++ b/src/mesa/main/mtypes.h
>>> > @@ -2178,6 +2178,7 @@ struct gl_geometry_program
>>> >                             GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */
>>> >     GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */
>>> >     GLboolean UsesEndPrimitive;
>>> > +   GLboolean UsesStreams;
>>>
>>> For things that are not visible to the GL API, we've been trying to
>>> transition away from GL types.  Unless Brian or Chris object, I think
>>> I'd rather have this be bool (and true / false below).
>>
>> If Brian and Chris are okay with this change then I'll also change
>> UsesEndPrimitive to be bool.
>>
>>> >  };
>>> >
>>> >
>>> > @@ -2681,6 +2682,7 @@ struct gl_shader_program
>>> >        GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
>>> >                                           0 if not present. */
>>> >        GLboolean UsesEndPrimitive;
>>> > +      GLboolean UsesStreams;
>>> >     } Geom;
>>> >
>>> >     /** Vertex shader state */
>>> > diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
>>> > index 2ec2444..2bbef35 100644
>>> > --- a/src/mesa/main/shaderapi.c
>>> > +++ b/src/mesa/main/shaderapi.c
>>> > @@ -1888,6 +1888,7 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
>>> >        dst_gp->OutputType = src->Geom.OutputType;
>>> >        dst->UsesClipDistanceOut = src->Geom.UsesClipDistance;
>>> >        dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
>>> > +      dst_gp->UsesStreams = src->Geom.UsesStreams;
>>> >     }
>>> >        break;
>>> >     case MESA_SHADER_FRAGMENT: {
>>> > diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
>>> > index b0f0bfa..03db862 100644
>>> > --- a/src/mesa/main/shaderobj.c
>>> > +++ b/src/mesa/main/shaderobj.c
>>> > @@ -248,6 +248,7 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
>>> >     prog->Geom.VerticesOut = 0;
>>> >     prog->Geom.InputType = GL_TRIANGLES;
>>> >     prog->Geom.OutputType = GL_TRIANGLE_STRIP;
>>> > +   prog->Geom.UsesStreams = GL_FALSE;
>>> >
>>> >     prog->TransformFeedback.BufferMode = GL_INTERLEAVED_ATTRIBS;
>>> >
>>> > diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
>>> > index b7332fc..1263cea 100644
>>> > --- a/src/mesa/program/program.c
>>> > +++ b/src/mesa/program/program.c
>>> > @@ -552,6 +552,7 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
>>> >           gpc->InputType = gp->InputType;
>>> >           gpc->Invocations = gp->Invocations;
>>> >           gpc->OutputType = gp->OutputType;
>>> > +         gpc->UsesStreams = gp->UsesStreams;
>>> >        }
>>> >        break;
>>> >     default:
>>> >
>>>
>>>
>>
>>


More information about the mesa-dev mailing list