glsl: Store info about geometry shaders that emit vertices to non-zero streams.
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 6 Jun 2014 10:31:30 +0000 (12:31 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 30 Jun 2014 06:08:50 +0000 (08:08 +0200)
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.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/main/shaderobj.c
src/mesa/program/program.c

index 5b110a7cdbf2c77b3934ecf4c9689fb56a3734f7..3b472b0a1dbd8db54f0a0a5e69a554010601288a 100644 (file)
@@ -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 */
    bool UsesEndPrimitive;
+   bool UsesStreams;
 };
 
 
@@ -2681,6 +2682,7 @@ struct gl_shader_program
       GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
                                          0 if not present. */
       bool UsesEndPrimitive;
+      bool UsesStreams;
    } Geom;
 
    /** Vertex shader state */
index 2ec2444daa26096d973f512288379b68ac758c5a..2bbef35d3639f74b62f2289dc75d4e566445e707 100644 (file)
@@ -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: {
index c6e852c876c1eea65b96d2f82c64db93c5d5e2e1..b9feff4a40491d5702214d2333ad04c42df518d1 100644 (file)
@@ -249,6 +249,7 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
    prog->Geom.InputType = GL_TRIANGLES;
    prog->Geom.OutputType = GL_TRIANGLE_STRIP;
    prog->Geom.UsesEndPrimitive = false;
+   prog->Geom.UsesStreams = false;
 
    prog->TransformFeedback.BufferMode = GL_INTERLEAVED_ATTRIBS;
 
index 988def1a348fc5439f38f8250ef314ad237c128a..aedce3e3c5ea4a3ca8e366e41eac9cd8e1be1076 100644 (file)
@@ -553,6 +553,7 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
          gpc->Invocations = gp->Invocations;
          gpc->OutputType = gp->OutputType;
          gpc->UsesEndPrimitive = gp->UsesEndPrimitive;
+         gpc->UsesStreams = gp->UsesStreams;
       }
       break;
    default: