mesa: Track transform feedback overflow query objects.
authorRafael Antognolli <rafael.antognolli@intel.com>
Fri, 20 Jan 2017 17:53:23 +0000 (09:53 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 22 Feb 2017 00:28:31 +0000 (16:28 -0800)
Also update checks on conditional rendering.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/condrender.c
src/mesa/main/queryobj.c
src/mesa/state_tracker/st_cb_queryobj.c

index 46c6036d2a50ce9ff5988f7805f439e6d9fbc4a9..2ea2c8821d8761a62fd9957deaee71835d5fbc35 100644 (file)
@@ -99,7 +99,9 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
     */
    if ((q->Target != GL_SAMPLES_PASSED &&
         q->Target != GL_ANY_SAMPLES_PASSED &&
-        q->Target != GL_ANY_SAMPLES_PASSED_CONSERVATIVE) || q->Active) {
+        q->Target != GL_ANY_SAMPLES_PASSED_CONSERVATIVE &&
+        q->Target != GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB &&
+        q->Target != GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB) || q->Active) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginConditionalRender()");
       return;
    }
index 1fa02795c1c7c5280b4cde93f8882a0df681aa2b..e4edb519344c6d6a8afc99d562a870b3d0eebb3c 100644 (file)
@@ -197,6 +197,16 @@ get_query_binding_point(struct gl_context *ctx, GLenum target, GLuint index)
          return &ctx->Query.PrimitivesWritten[index];
       else
          return NULL;
+   case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
+      if (ctx->Extensions.ARB_transform_feedback_overflow_query)
+         return &ctx->Query.TransformFeedbackOverflow[index];
+      else
+         return NULL;
+   case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:
+      if (ctx->Extensions.ARB_transform_feedback_overflow_query)
+         return &ctx->Query.TransformFeedbackOverflowAny;
+      else
+         return NULL;
 
    case GL_VERTICES_SUBMITTED_ARB:
    case GL_PRIMITIVES_SUBMITTED_ARB:
@@ -293,6 +303,8 @@ _mesa_CreateQueries(GLenum target, GLsizei n, GLuint *ids)
    case GL_TIMESTAMP:
    case GL_PRIMITIVES_GENERATED:
    case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+   case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
+   case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:
       break;
    default:
       _mesa_error(ctx, GL_INVALID_ENUM, "glCreateQueries(invalid target = %s)",
@@ -368,6 +380,7 @@ query_error_check_index(struct gl_context *ctx, GLenum target, GLuint index)
    switch (target) {
    case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
    case GL_PRIMITIVES_GENERATED:
+   case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
       if (index >= ctx->Const.MaxVertexStreams) {
          _mesa_error(ctx, GL_INVALID_VALUE,
                      "glBeginQueryIndexed(index>=MaxVertexStreams)");
@@ -677,6 +690,14 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
          case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
             *params = ctx->Const.QueryCounterBits.PrimitivesWritten;
             break;
+         case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
+         case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:
+            /* The minimum value of this is 1 if it's nonzero, and the value
+             * is only ever GL_TRUE or GL_FALSE, so no sense in reporting more
+             * bits.
+             */
+            *params = 1;
+            break;
          case GL_VERTICES_SUBMITTED_ARB:
             *params = ctx->Const.QueryCounterBits.VerticesSubmitted;
             break;
index 24896762340c64a26809fbb64a0e1ada384301fa..b1ac2aab6dae632c8bfea850ab1f49130828e37c 100644 (file)
@@ -114,6 +114,12 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
    case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
       type = PIPE_QUERY_PRIMITIVES_EMITTED;
       break;
+   case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:
+      type = PIPE_QUERY_SO_OVERFLOW_PREDICATE;
+      break;
+   case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:
+      type = PIPE_QUERY_SO_OVERFLOW_PREDICATE;
+      break;
    case GL_TIME_ELAPSED:
       if (st->has_time_elapsed)
          type = PIPE_QUERY_TIME_ELAPSED;