Update comment to specify actual text being referenced from the specification.
[mesa.git] / src / mesa / main / queryobj.c
index 8c5e1b82249fbb7a8baa3266f01b79188198dae7..b482b1518de8fcc58d60125cfa7b108eae098ef7 100644 (file)
@@ -50,7 +50,12 @@ _mesa_new_query_object(struct gl_context *ctx, GLuint id)
       q->Id = id;
       q->Result = 0;
       q->Active = GL_FALSE;
-      q->Ready = GL_TRUE;   /* correct, see spec */
+
+      /* This is to satisfy the language of the specification: "In the initial
+       * state of a query object, the result is available" (OpenGL 3.1 ยง
+       * 2.13).
+       */
+      q->Ready = GL_TRUE;
    }
    return q;
 }
@@ -147,6 +152,12 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
          return &ctx->Query.CurrentOcclusionObject;
       else
          return NULL;
+   case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+      if (ctx->Extensions.ARB_ES3_compatibility
+          || (ctx->API == API_OPENGLES2 && ctx->Version >= 30))
+         return &ctx->Query.CurrentOcclusionObject;
+      else
+         return NULL;
    case GL_TIME_ELAPSED_EXT:
       if (ctx->Extensions.EXT_timer_query)
          return &ctx->Query.CurrentTimerObject;
@@ -169,7 +180,7 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
 
 
 void GLAPIENTRY
-_mesa_GenQueriesARB(GLsizei n, GLuint *ids)
+_mesa_GenQueries(GLsizei n, GLuint *ids)
 {
    GLuint first;
    GET_CURRENT_CONTEXT(ctx);
@@ -208,7 +219,7 @@ _mesa_GenQueriesARB(GLsizei n, GLuint *ids)
 
 
 void GLAPIENTRY
-_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
+_mesa_DeleteQueries(GLsizei n, const GLuint *ids)
 {
    GLint i;
    GET_CURRENT_CONTEXT(ctx);
@@ -216,7 +227,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
    FLUSH_VERTICES(ctx, 0);
 
    if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glDeleeteQueries(%d)\n", n);
+      _mesa_debug(ctx, "glDeleteQueries(%d)\n", n);
 
    if (n < 0) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)");
@@ -244,7 +255,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
 
 
 GLboolean GLAPIENTRY
-_mesa_IsQueryARB(GLuint id)
+_mesa_IsQuery(GLuint id)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
@@ -321,7 +332,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
 
    q = _mesa_lookup_query_object(ctx, id);
    if (!q) {
-      if (ctx->API == API_OPENGL_CORE) {
+      if (ctx->API != API_OPENGL_COMPAT) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glBeginQuery{Indexed}(non-gen name)");
          return;
@@ -403,13 +414,13 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
 }
 
 void GLAPIENTRY
-_mesa_BeginQueryARB(GLenum target, GLuint id)
+_mesa_BeginQuery(GLenum target, GLuint id)
 {
    _mesa_BeginQueryIndexed(target, 0, id);
 }
 
 void GLAPIENTRY
-_mesa_EndQueryARB(GLenum target)
+_mesa_EndQuery(GLenum target)
 {
    _mesa_EndQueryIndexed(target, 0);
 }
@@ -547,13 +558,13 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
 }
 
 void GLAPIENTRY
-_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
+_mesa_GetQueryiv(GLenum target, GLenum pname, GLint *params)
 {
    _mesa_GetQueryIndexediv(target, 0, pname, params);
 }
 
 void GLAPIENTRY
-_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
+_mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
 {
    struct gl_query_object *q = NULL;
    GET_CURRENT_CONTEXT(ctx);
@@ -577,7 +588,8 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
          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) {
+         if (q->Target == GL_ANY_SAMPLES_PASSED
+             || q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) {
             if (q->Result)
                *params = GL_TRUE;
             else
@@ -604,7 +616,7 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
 
 
 void GLAPIENTRY
-_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
+_mesa_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
 {
    struct gl_query_object *q = NULL;
    GET_CURRENT_CONTEXT(ctx);
@@ -628,7 +640,8 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
          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) {
+         if (q->Target == GL_ANY_SAMPLES_PASSED
+             || q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) {
             if (q->Result)
                *params = GL_TRUE;
             else
@@ -658,7 +671,7 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
  * New with GL_EXT_timer_query
  */
 void GLAPIENTRY
-_mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params)
+_mesa_GetQueryObjecti64v(GLuint id, GLenum pname, GLint64EXT *params)
 {
    struct gl_query_object *q = NULL;
    GET_CURRENT_CONTEXT(ctx);
@@ -699,7 +712,7 @@ _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params)
  * New with GL_EXT_timer_query
  */
 void GLAPIENTRY
-_mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params)
+_mesa_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params)
 {
    struct gl_query_object *q = NULL;
    GET_CURRENT_CONTEXT(ctx);
@@ -740,20 +753,20 @@ void
 _mesa_init_queryobj_dispatch(const struct gl_context *ctx,
                              struct _glapi_table *disp)
 {
-   SET_GenQueriesARB(disp, _mesa_GenQueriesARB);
-   SET_DeleteQueriesARB(disp, _mesa_DeleteQueriesARB);
-   SET_IsQueryARB(disp, _mesa_IsQueryARB);
-   SET_BeginQueryARB(disp, _mesa_BeginQueryARB);
-   SET_EndQueryARB(disp, _mesa_EndQueryARB);
-   SET_GetQueryivARB(disp, _mesa_GetQueryivARB);
-   SET_GetQueryObjectuivARB(disp, _mesa_GetQueryObjectuivARB);
+   SET_GenQueries(disp, _mesa_GenQueries);
+   SET_DeleteQueries(disp, _mesa_DeleteQueries);
+   SET_IsQuery(disp, _mesa_IsQuery);
+   SET_BeginQuery(disp, _mesa_BeginQuery);
+   SET_EndQuery(disp, _mesa_EndQuery);
+   SET_GetQueryiv(disp, _mesa_GetQueryiv);
+   SET_GetQueryObjectuiv(disp, _mesa_GetQueryObjectuiv);
 
    if (_mesa_is_desktop_gl(ctx)) {
-      SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB);
+      SET_GetQueryObjectiv(disp, _mesa_GetQueryObjectiv);
       SET_QueryCounter(disp, _mesa_QueryCounter);
 
-      SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT);
-      SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT);
+      SET_GetQueryObjecti64v(disp, _mesa_GetQueryObjecti64v);
+      SET_GetQueryObjectui64v(disp, _mesa_GetQueryObjectui64v);
 
       SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed);
       SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed);