mesa/main: fix validation of GL_TIMESTAMP
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 7 Nov 2018 12:45:01 +0000 (13:45 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 23 Nov 2018 09:48:36 +0000 (10:48 +0100)
ctx->Extensions.ARB_timer_query is set based on the driver-
capabilities, not based on the context type. We need to check
against _mesa_has_ARB_timer_query(ctx) instead to figure out
if the extension is really supported. We also need to check for
EXT_disjoint_timer_query for GLES-support.

This shouln't have any functional effect, as this entry-point is only
valid on desktop GL, or on GLES with EXT_disjoint_timer_query in the
first place. But if this gets added to the core of a future version
of ES, this should be a step in the right direction.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/mesa/main/queryobj.c

index c86b9ec065b422b19020034a0e4e8ca59ca8af24..27086a4b683f9871f6e0d3f46ae42aeb8621a9b1 100644 (file)
@@ -679,7 +679,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;
       }