mesa: implement display list support for indexed query functions
authorMarek Olšák <maraeo@gmail.com>
Sun, 18 Dec 2011 03:06:29 +0000 (04:06 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 11:05:59 +0000 (13:05 +0200)
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/dlist.c

index a827d132d972dbed15629be73585e8972a2d4f83..4a7a9961453553bd3f936acd90125421e5350135 100644 (file)
@@ -472,6 +472,10 @@ typedef enum
    /* ARB_timer_query */
    OPCODE_QUERY_COUNTER,
 
+   /* ARB_transform_feedback3 */
+   OPCODE_BEGIN_QUERY_INDEXED,
+   OPCODE_END_QUERY_INDEXED,
+
    /* The following three are meta instructions */
    OPCODE_ERROR,                /* raise compiled-in error */
    OPCODE_CONTINUE,
@@ -5338,7 +5342,6 @@ save_BeginQueryARB(GLenum target, GLuint id)
    }
 }
 
-
 static void GLAPIENTRY
 save_EndQueryARB(GLenum target)
 {
@@ -5354,7 +5357,6 @@ save_EndQueryARB(GLenum target)
    }
 }
 
-
 static void GLAPIENTRY
 save_QueryCounter(GLuint id, GLenum target)
 {
@@ -5371,6 +5373,39 @@ save_QueryCounter(GLuint id, GLenum target)
    }
 }
 
+static void GLAPIENTRY
+save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
+   if (n) {
+      n[1].e = target;
+      n[2].ui = index;
+      n[3].ui = id;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
+   }
+}
+
+static void GLAPIENTRY
+save_EndQueryIndexed(GLenum target, GLuint index)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
+   if (n) {
+      n[1].e = target;
+      n[2].ui = index;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_EndQueryIndexed(ctx->Exec, (target, index));
+   }
+}
+
 #endif /* FEATURE_queryobj */
 
 
@@ -8368,6 +8403,12 @@ execute_list(struct gl_context *ctx, GLuint list)
          case OPCODE_QUERY_COUNTER:
             CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
             break;
+         case OPCODE_BEGIN_QUERY_INDEXED:
+            CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
+            break;
+         case OPCODE_END_QUERY_INDEXED:
+            CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
+            break;
 #endif
          case OPCODE_DRAW_BUFFERS_ARB:
             {
@@ -10461,6 +10502,10 @@ _mesa_create_save_table(void)
    SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
    SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
    SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
+#if FEATURE_queryobj
+   SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
+   SET_EndQueryIndexed(table, save_EndQueryIndexed);
+#endif
 #endif
 
    /* GL_ARB_instanced_arrays */