st/mesa: Rearrange PIPE_QUERY_PIPELINE_STATISTICS result fetching.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 11 Jan 2019 21:22:57 +0000 (13:22 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 15 Jan 2019 19:43:04 +0000 (11:43 -0800)
This just changes the order of the switch statements, so we only
look at target if the query type is PIPE_QUERY_PIPELINE_STATISTICS.

The next commit will introduce a new SINGLE query type which can be
used for the same GL query types, and it won't want this processing.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/mesa/state_tracker/st_cb_queryobj.c

index 82f5324333669697b1720a68d7c9e47b29709d4d..9c551da005f8baf1d7d43e2e3b24fa6cc42ba075 100644 (file)
@@ -226,53 +226,55 @@ get_query_result(struct pipe_context *pipe,
    if (!pipe->get_query_result(pipe, stq->pq, wait, &data))
       return FALSE;
 
-   switch (stq->base.Target) {
-   case GL_VERTICES_SUBMITTED_ARB:
-      stq->base.Result = data.pipeline_statistics.ia_vertices;
-      break;
-   case GL_PRIMITIVES_SUBMITTED_ARB:
-      stq->base.Result = data.pipeline_statistics.ia_primitives;
-      break;
-   case GL_VERTEX_SHADER_INVOCATIONS_ARB:
-      stq->base.Result = data.pipeline_statistics.vs_invocations;
-      break;
-   case GL_TESS_CONTROL_SHADER_PATCHES_ARB:
-      stq->base.Result = data.pipeline_statistics.hs_invocations;
-      break;
-   case GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB:
-      stq->base.Result = data.pipeline_statistics.ds_invocations;
-      break;
-   case GL_GEOMETRY_SHADER_INVOCATIONS:
-      stq->base.Result = data.pipeline_statistics.gs_invocations;
-      break;
-   case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB:
-      stq->base.Result = data.pipeline_statistics.gs_primitives;
-      break;
-   case GL_FRAGMENT_SHADER_INVOCATIONS_ARB:
-      stq->base.Result = data.pipeline_statistics.ps_invocations;
-      break;
-   case GL_COMPUTE_SHADER_INVOCATIONS_ARB:
-      stq->base.Result = data.pipeline_statistics.cs_invocations;
-      break;
-   case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
-      stq->base.Result = data.pipeline_statistics.c_invocations;
-      break;
-   case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
-      stq->base.Result = data.pipeline_statistics.c_primitives;
-      break;
-   default:
-      switch (stq->type) {
-      case PIPE_QUERY_OCCLUSION_PREDICATE:
-      case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
-      case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
-      case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
-         stq->base.Result = !!data.b;
+   switch (stq->type) {
+   case PIPE_QUERY_PIPELINE_STATISTICS:
+      switch (stq->base.Target) {
+      case GL_VERTICES_SUBMITTED_ARB:
+         stq->base.Result = data.pipeline_statistics.ia_vertices;
          break;
-      default:
-         stq->base.Result = data.u64;
+      case GL_PRIMITIVES_SUBMITTED_ARB:
+         stq->base.Result = data.pipeline_statistics.ia_primitives;
+         break;
+      case GL_VERTEX_SHADER_INVOCATIONS_ARB:
+         stq->base.Result = data.pipeline_statistics.vs_invocations;
+         break;
+      case GL_TESS_CONTROL_SHADER_PATCHES_ARB:
+         stq->base.Result = data.pipeline_statistics.hs_invocations;
+         break;
+      case GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB:
+         stq->base.Result = data.pipeline_statistics.ds_invocations;
+         break;
+      case GL_GEOMETRY_SHADER_INVOCATIONS:
+         stq->base.Result = data.pipeline_statistics.gs_invocations;
+         break;
+      case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB:
+         stq->base.Result = data.pipeline_statistics.gs_primitives;
          break;
+      case GL_FRAGMENT_SHADER_INVOCATIONS_ARB:
+         stq->base.Result = data.pipeline_statistics.ps_invocations;
+         break;
+      case GL_COMPUTE_SHADER_INVOCATIONS_ARB:
+         stq->base.Result = data.pipeline_statistics.cs_invocations;
+         break;
+      case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
+         stq->base.Result = data.pipeline_statistics.c_invocations;
+         break;
+      case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
+         stq->base.Result = data.pipeline_statistics.c_primitives;
+         break;
+      default:
+         unreachable("invalid pipeline statistics counter");
       }
       break;
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
+   case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
+   case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+   case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
+      stq->base.Result = !!data.b;
+      break;
+   default:
+      stq->base.Result = data.u64;
+      break;
    }
 
    if (stq->base.Target == GL_TIME_ELAPSED &&