From: Kevin Rogovin <kevin.rogo...@intel.com> The extension, GL_ARB_occlusion_queries mandates that an INVALID_OPERATION should be thrown if GenQueriesARB is called while a query is active. In contrast, the GL spec has no such requirement for GenQueries. This patch unaliases the two functions and has that the ARB variant performs that extra check.
Signed-off-by: Kevin Rogovin <kevin.rogo...@intel.com> --- src/mapi/glapi/gen/gl_API.xml | 2 +- src/mesa/main/queryobj.c | 20 +++++++++++++++++++- src/mesa/main/queryobj.h | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index cdd680c..5918e63 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -7564,7 +7564,7 @@ </enum> <enum name="SAMPLES_PASSED_ARB" value="0x8914"/> - <function name="GenQueriesARB" alias="GenQueries"> + <function name="GenQueriesARB"> <param name="n" type="GLsizei"/> <param name="ids" type="GLuint *"/> </function> diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 7a70b59..43f1b0c 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -236,7 +236,8 @@ get_query_binding_point(struct gl_context *ctx, GLenum target, GLuint index) /** * Create $n query objects and store them in *ids. Make them of type $target - * if dsa is set. Called from _mesa_GenQueries() and _mesa_CreateQueries(). + * if dsa is set. Called from _mesa_GenQueries(), _mesa_GenQueriesARB() + * and _mesa_CreateQueries(). */ static void create_queries(struct gl_context *ctx, GLenum target, GLsizei n, GLuint *ids, @@ -281,6 +282,23 @@ _mesa_GenQueries(GLsizei n, GLuint *ids) } void GLAPIENTRY +_mesa_GenQueriesARB(GLsizei n, GLuint *ids) +{ + GET_CURRENT_CONTEXT(ctx); + /* From GL_ARB_occlusion_query: + "The error INVALID_OPERATION is generated if GenQueriesARB or + DeleteQueriesARB is called when a query of any target is active." + That extension only support the target SAMPLES_PASSED_ARB, so we + only check for CurrentOcclusionObject + */ + if(ctx->Query.CurrentOcclusionObject != NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB\n"); + return; + } + create_queries(ctx, 0, n, ids, false); +} + +void GLAPIENTRY _mesa_CreateQueries(GLenum target, GLsizei n, GLuint *ids) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index d1036fc..245d104 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -51,6 +51,8 @@ _mesa_free_queryobj_data(struct gl_context *ctx); void GLAPIENTRY _mesa_GenQueries(GLsizei n, GLuint *ids); void GLAPIENTRY +_mesa_GenQueriesARB(GLsizei n, GLuint *ids); +void GLAPIENTRY _mesa_CreateQueries(GLenum target, GLsizei n, GLuint *ids); void GLAPIENTRY _mesa_DeleteQueries(GLsizei n, const GLuint *ids); -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev