On Wed, Jun 11, 2014 at 7:49 PM, Iago Toral Quiroga <ito...@igalia.com> wrote: > It should be possible to query the number of primitives written to each > individual stream by a geometry shader in a single draw call. For that > we need to have up to MAX_VERTEX_STREAM separate query objects. > --- > src/mesa/main/mtypes.h | 2 +- > src/mesa/main/queryobj.c | 17 +++++++++-------- > 2 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index 072d3ae..8394060 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -2917,7 +2917,7 @@ struct gl_query_state > > /** GL_EXT_transform_feedback */ > struct gl_query_object *PrimitivesGenerated; > - struct gl_query_object *PrimitivesWritten; > + struct gl_query_object *PrimitivesWritten[MAX_VERTEX_STREAMS]; > > /** GL_ARB_timer_query */ > struct gl_query_object *TimeElapsed; > diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c > index 512f45a..7e84365 100644 > --- a/src/mesa/main/queryobj.c > +++ b/src/mesa/main/queryobj.c > @@ -144,11 +144,12 @@ _mesa_init_query_object_functions(struct > dd_function_table *driver) > > > /** > - * Return pointer to the query object binding point for the given target. > - * \return NULL if invalid target, else the address of binding point > + * Return pointer to the query object binding point for the given target (and > + * stream for transform feedback queries). > + * \return NULL if invalid target or stream, else the address of binding > point > */ > static struct gl_query_object ** > -get_query_binding_point(struct gl_context *ctx, GLenum target) > +get_query_binding_point(struct gl_context *ctx, GLenum target, GLuint stream)
I think this should be `index`. It only makes sense as `stream` in the context of transform feedback, and we may get other indexed query object binding points in the future. > { > switch (target) { > case GL_SAMPLES_PASSED_ARB: > @@ -179,7 +180,7 @@ get_query_binding_point(struct gl_context *ctx, GLenum > target) > return NULL; > case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: > if (ctx->Extensions.EXT_transform_feedback) > - return &ctx->Query.PrimitivesWritten; > + return &ctx->Query.PrimitivesWritten[stream]; > else > return NULL; > default: > @@ -240,7 +241,7 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids) > if (q) { > if (q->Active) { > struct gl_query_object **bindpt; > - bindpt = get_query_binding_point(ctx, q->Target); > + bindpt = get_query_binding_point(ctx, q->Target, q->Stream); > assert(bindpt); /* Should be non-null for active q. */ > if (bindpt) { > *bindpt = NULL; > @@ -313,7 +314,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, > GLuint id) > > FLUSH_VERTICES(ctx, 0); > > - bindpt = get_query_binding_point(ctx, target); > + bindpt = get_query_binding_point(ctx, target, index); > if (!bindpt) { > _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQuery{Indexed}(target)"); > return; > @@ -391,7 +392,7 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index) > > FLUSH_VERTICES(ctx, 0); > > - bindpt = get_query_binding_point(ctx, target); > + bindpt = get_query_binding_point(ctx, target, index); > if (!bindpt) { > _mesa_error(ctx, GL_INVALID_ENUM, "glEndQuery{Indexed}(target)"); > return; > @@ -518,7 +519,7 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, > GLenum pname, > } > } > else { > - bindpt = get_query_binding_point(ctx, target); > + bindpt = get_query_binding_point(ctx, target, index); > if (!bindpt) { > _mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(target)"); > return; > -- > 1.9.1 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev