On Sun, Jan 31, 2016 at 9:31 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote: > Forwards query result writes to drivers. > > Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu> > --- > src/mesa/main/queryobj.c | 280 > ++++++++++++++++++++++------------------------- > 1 file changed, 133 insertions(+), 147 deletions(-) > > diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c > index 9836685..92d8f9a 100644 > --- a/src/mesa/main/queryobj.c > +++ b/src/mesa/main/queryobj.c > @@ -23,6 +23,7 @@ > */ > > > +#include "bufferobj.h" > #include "glheader.h" > #include "context.h" > #include "enums.h" > @@ -732,14 +733,16 @@ _mesa_GetQueryiv(GLenum target, GLenum pname, GLint > *params) > _mesa_GetQueryIndexediv(target, 0, pname, params); > } > > -void GLAPIENTRY > -_mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params) > +static void > +get_query_object(struct gl_context *ctx, const char *func, > + GLuint id, GLenum pname, GLenum ptype, > + struct gl_buffer_object *buf, intptr_t offset) > { > struct gl_query_object *q = NULL; > - GET_CURRENT_CONTEXT(ctx); > + uint64_t value; > > if (MESA_VERBOSE & VERBOSE_API) > - _mesa_debug(ctx, "glGetQueryObjectiv(%u, %s)\n", id, > + _mesa_debug(ctx, "%s(%u, %s)\n", func, id, > _mesa_enum_to_string(pname)); > > if (id) > @@ -747,96 +750,109 @@ _mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint > *params) > > if (!q || q->Active || !q->EverBound) { > _mesa_error(ctx, GL_INVALID_OPERATION, > - "glGetQueryObjectivARB(id=%d is invalid or active)", id); > + "%s(id=%d is invalid or active)", func, id); > return; > } > > - switch (pname) { > - case GL_QUERY_RESULT_ARB: > - if (!q->Ready) > - ctx->Driver.WaitQuery(ctx, q); > - /* if result is too large for returned type, clamp to max value */ > - if (q->Target == GL_ANY_SAMPLES_PASSED > - || q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) { > - if (q->Result) > - *params = GL_TRUE; > - else > - *params = GL_FALSE; > - } else { > - if (q->Result > 0x7fffffff) { > - *params = 0x7fffffff; > - } > - else { > - *params = (GLint)q->Result; > - } > - } > - break; > - case GL_QUERY_RESULT_AVAILABLE_ARB: > - if (!q->Ready) > - ctx->Driver.CheckQuery( ctx, q ); > - *params = q->Ready; > - break; > + if (buf && buf != ctx->Shared->NullBufferObj) { > + bool is_64bit = ptype == GL_INT64_ARB || > + ptype == GL_UNSIGNED_INT64_ARB; > + if (!ctx->Extensions.ARB_query_buffer_object) { > + _mesa_error(ctx, GL_INVALID_OPERATION, func);
This causes: main/queryobj.c: In function 'get_query_object': main/queryobj.c:761:10: warning: format not a string literal and no format arguments [-Wformat-security] Marek _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev