mesa/main: correct extension-checks for GL_PRIMITIVE_RESTART_FIXED_INDEX
[mesa.git] / src / mesa / main / queryobj.c
index 2a143191c629246f60a2e7a488672d52626dfd44..67d1f76a21a28d550dda3bad911ccc4b08182da0 100644 (file)
@@ -149,8 +149,7 @@ get_pipe_stats_binding_point(struct gl_context *ctx,
    const int which = target - GL_VERTICES_SUBMITTED;
    assert(which < MAX_PIPELINE_STATISTICS);
 
-   if (!_mesa_is_desktop_gl(ctx) ||
-       !ctx->Extensions.ARB_pipeline_statistics_query)
+   if (!_mesa_has_ARB_pipeline_statistics_query(ctx))
       return NULL;
 
    return &ctx->Query.pipeline_stats[which];
@@ -164,59 +163,50 @@ get_pipe_stats_binding_point(struct gl_context *ctx,
 static struct gl_query_object **
 get_query_binding_point(struct gl_context *ctx, GLenum target, GLuint index)
 {
-
-   /* From GL_EXT_occlusion_query_boolean spec:
-    *
-    *    "Accepted by the <target> parameter of BeginQueryEXT, EndQueryEXT,
-    *    and GetQueryivEXT:
-    *
-    *   ANY_SAMPLES_PASSED_EXT                         0x8C2F
-    *   ANY_SAMPLES_PASSED_CONSERVATIVE_EXT            0x8D6A"
-    */
-   if ((_mesa_is_gles(ctx) && ctx->Version == 20) &&
-       (target != GL_ANY_SAMPLES_PASSED &&
-        target != GL_ANY_SAMPLES_PASSED_CONSERVATIVE))
-      return NULL;
-
    switch (target) {
    case GL_SAMPLES_PASSED:
-      if (ctx->Extensions.ARB_occlusion_query)
+      if (_mesa_has_ARB_occlusion_query(ctx) ||
+          _mesa_has_ARB_occlusion_query2(ctx))
          return &ctx->Query.CurrentOcclusionObject;
       else
          return NULL;
    case GL_ANY_SAMPLES_PASSED:
-      if (ctx->Extensions.ARB_occlusion_query2)
+      if (_mesa_has_ARB_occlusion_query2(ctx) ||
+          _mesa_has_EXT_occlusion_query_boolean(ctx))
          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))
+      if (_mesa_has_ARB_ES3_compatibility(ctx) ||
+          _mesa_has_EXT_occlusion_query_boolean(ctx))
          return &ctx->Query.CurrentOcclusionObject;
       else
          return NULL;
    case GL_TIME_ELAPSED:
-      if (ctx->Extensions.EXT_timer_query)
+      if (_mesa_has_EXT_timer_query(ctx) ||
+          _mesa_has_EXT_disjoint_timer_query(ctx))
          return &ctx->Query.CurrentTimerObject;
       else
          return NULL;
    case GL_PRIMITIVES_GENERATED:
-      if (ctx->Extensions.EXT_transform_feedback)
+      if (_mesa_has_EXT_transform_feedback(ctx) ||
+          _mesa_has_EXT_tessellation_shader(ctx) ||
+          _mesa_has_OES_geometry_shader(ctx))
          return &ctx->Query.PrimitivesGenerated[index];
       else
          return NULL;
    case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
-      if (ctx->Extensions.EXT_transform_feedback)
+      if (_mesa_has_EXT_transform_feedback(ctx) || _mesa_is_gles3(ctx))
          return &ctx->Query.PrimitivesWritten[index];
       else
          return NULL;
    case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW:
-      if (ctx->Extensions.ARB_transform_feedback_overflow_query)
+      if (_mesa_has_ARB_transform_feedback_overflow_query(ctx))
          return &ctx->Query.TransformFeedbackOverflow[index];
       else
          return NULL;
    case GL_TRANSFORM_FEEDBACK_OVERFLOW:
-      if (ctx->Extensions.ARB_transform_feedback_overflow_query)
+      if (_mesa_has_ARB_transform_feedback_overflow_query(ctx))
          return &ctx->Query.TransformFeedbackOverflowAny;
       else
          return NULL;
@@ -676,7 +666,8 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
    }
 
    if (target == GL_TIMESTAMP) {
-      if (!ctx->Extensions.ARB_timer_query) {
+      if (!_mesa_has_ARB_timer_query(ctx) &&
+          !_mesa_has_EXT_disjoint_timer_query(ctx)) {
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)");
          return;
       }
@@ -822,7 +813,7 @@ get_query_object(struct gl_context *ctx, const char *func,
    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) {
+      if (!_mesa_has_ARB_query_buffer_object(ctx)) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(not supported)", func);
          return;
       }
@@ -855,7 +846,7 @@ get_query_object(struct gl_context *ctx, const char *func,
       value = q->Result;
       break;
    case GL_QUERY_RESULT_NO_WAIT:
-      if (!ctx->Extensions.ARB_query_buffer_object)
+      if (!_mesa_has_ARB_query_buffer_object(ctx))
          goto invalid_enum;
       ctx->Driver.CheckQuery(ctx, q);
       if (!q->Ready)