mesa: GL_EXT_disjoint_timer_query extension API bits
authorTapani Pälli <tapani.palli@intel.com>
Tue, 12 Dec 2017 12:46:13 +0000 (14:46 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Fri, 15 Dec 2017 06:42:48 +0000 (08:42 +0200)
Patch adds GL_GPU_DISJOINT_EXT and enables to use timer queries when
EXT_disjoint_timer_query is enabled.

v2: enable extension only when EXT_disjoint_timer_query set

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v1)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/extensions_table.h
src/mesa/main/get.c
src/mesa/main/get_hash_params.py
src/mesa/main/glheader.h
src/mesa/main/mtypes.h
src/mesa/main/queryobj.c

index ab15ceb94148475dab95bbe033ec4b034cdb827c..3dec6ea12f338306fb87a17069147af98583a8b0 100644 (file)
@@ -210,6 +210,7 @@ EXT(EXT_copy_image                          , OES_copy_image
 EXT(EXT_copy_texture                        , dummy_true                             , GLL,  x ,  x ,  x , 1995)
 EXT(EXT_depth_bounds_test                   , EXT_depth_bounds_test                  , GLL, GLC,  x ,  x , 2002)
 EXT(EXT_discard_framebuffer                 , dummy_true                             ,  x ,  x , ES1, ES2, 2009)
+EXT(EXT_disjoint_timer_query                , EXT_disjoint_timer_query               ,  x ,  x ,  x , ES2, 2016)
 EXT(EXT_draw_buffers                        , dummy_true                             ,  x ,  x ,  x , ES2, 2012)
 EXT(EXT_draw_buffers2                       , EXT_draw_buffers2                      , GLL, GLC,  x ,  x , 2006)
 EXT(EXT_draw_buffers_indexed                , ARB_draw_buffers_blend                 ,  x ,  x ,  x ,  30, 2014)
index c1b1a89ee057fcfa7f5fe1ea671ea20939739c57..7f2d72aa4bd276ed3236781ed9c9a50006cc78c0 100644 (file)
@@ -578,6 +578,13 @@ static const int extra_EXT_provoking_vertex_32[] = {
    EXTRA_END
 };
 
+static const int extra_EXT_disjoint_timer_query[] = {
+   EXTRA_API_ES2,
+   EXTRA_API_ES3,
+   EXT(EXT_disjoint_timer_query),
+   EXTRA_END
+};
+
 
 /* This is the big table describing all the enums we accept in
  * glGet*v().  The table is partitioned into six parts: enums
@@ -1160,6 +1167,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
          v->value_int_n.ints[0] = GL_PROGRAM_BINARY_FORMAT_MESA;
       }
       break;
+   /* GL_EXT_disjoint_timer_query */
+   case GL_GPU_DISJOINT_EXT:
+      {
+         simple_mtx_lock(&ctx->Shared->Mutex);
+         v->value_int = ctx->Shared->DisjointOperation;
+         /* Reset state as expected by the spec. */
+         ctx->Shared->DisjointOperation = false;
+         simple_mtx_unlock(&ctx->Shared->Mutex);
+      }
+      break;
    }
 }
 
index eac250a1ecfabaf3fe9b64f5ae09b19c4114697f..bc71574cca9fe7f1c699b181a201a690bba12f10 100644 (file)
@@ -254,6 +254,11 @@ descriptor=[
   [ "POINT_SIZE_ARRAY_BUFFER_BINDING_OES", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
 ]},
 
+# Enums in GLES2, GLES3
+{ "apis": ["GLES2", "GLES3"], "params": [
+  [ "GPU_DISJOINT_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_disjoint_timer_query" ],
+]},
+
 { "apis": ["GL", "GL_CORE", "GLES2"], "params": [
 # == GL_MAX_TEXTURE_COORDS_NV
   [ "MAX_TEXTURE_COORDS_ARB", "CONTEXT_INT(Const.MaxTextureCoordUnits), extra_ARB_fragment_program" ],
index 3f2a923782c09a44c7bf16d08ac626d016897fe2..35a442a77bee880b957decab7872d76b3df6dde4 100644 (file)
@@ -144,6 +144,10 @@ typedef void *GLeglImageOES;
 #define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT                 0x8A52
 #endif
 
+#ifndef GL_EXT_disjoint_timer_query
+#define GL_GPU_DISJOINT_EXT                                     0x8FBB
+#endif
+
 /* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT.
  */
 #ifndef GL_HALF_FLOAT_OES
index 0aac49402e8de8a126ee82f32ed95f0266ec2504..a29d78b1017655acdfa7a0cfde3b08f7a63f293c 100644 (file)
@@ -4168,6 +4168,7 @@ struct gl_extensions
    GLboolean EXT_blend_func_separate;
    GLboolean EXT_blend_minmax;
    GLboolean EXT_depth_bounds_test;
+   GLboolean EXT_disjoint_timer_query;
    GLboolean EXT_draw_buffers2;
    GLboolean EXT_framebuffer_multisample;
    GLboolean EXT_framebuffer_multisample_blit_scaled;
index d966814a768b6f73091ae55fca2eb028cc923753..79600d7db19c2d708218598c9be14430893bf010 100644 (file)
@@ -822,7 +822,8 @@ 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 (!ctx->Extensions.ARB_query_buffer_object &&
+          !ctx->Extensions.EXT_disjoint_timer_query) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(not supported)", func);
          return;
       }