aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_queryobj.c43
-rw-r--r--src/mesa/state_tracker/st_context.c2
-rw-r--r--src/mesa/state_tracker/st_context.h1
-rw-r--r--src/mesa/state_tracker/st_extensions.c1
4 files changed, 45 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index 9c551da005f..abb126547c9 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -88,6 +88,44 @@ st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q)
free(stq);
}
+static int
+target_to_index(const struct st_context *st, const struct gl_query_object *q)
+{
+ if (q->Target == GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN ||
+ q->Target == GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB)
+ return q->Stream;
+
+ if (st->has_single_pipe_stat) {
+ switch (q->Target) {
+ case GL_VERTICES_SUBMITTED_ARB:
+ return PIPE_STAT_QUERY_IA_VERTICES;
+ case GL_PRIMITIVES_SUBMITTED_ARB:
+ return PIPE_STAT_QUERY_IA_PRIMITIVES;
+ case GL_VERTEX_SHADER_INVOCATIONS_ARB:
+ return PIPE_STAT_QUERY_VS_INVOCATIONS;
+ case GL_GEOMETRY_SHADER_INVOCATIONS:
+ return PIPE_STAT_QUERY_GS_INVOCATIONS;
+ case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB:
+ return PIPE_STAT_QUERY_GS_PRIMITIVES;
+ case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
+ return PIPE_STAT_QUERY_C_INVOCATIONS;
+ case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
+ return PIPE_STAT_QUERY_C_PRIMITIVES;
+ case GL_FRAGMENT_SHADER_INVOCATIONS_ARB:
+ return PIPE_STAT_QUERY_PS_INVOCATIONS;
+ case GL_TESS_CONTROL_SHADER_PATCHES_ARB:
+ return PIPE_STAT_QUERY_HS_INVOCATIONS;
+ case GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB:
+ return PIPE_STAT_QUERY_DS_INVOCATIONS;
+ case GL_COMPUTE_SHADER_INVOCATIONS_ARB:
+ return PIPE_STAT_QUERY_CS_INVOCATIONS;
+ default:
+ break;
+ }
+ }
+
+ return 0;
+}
static void
st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
@@ -140,7 +178,8 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
case GL_COMPUTE_SHADER_INVOCATIONS_ARB:
case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
- type = PIPE_QUERY_PIPELINE_STATISTICS;
+ type = st->has_single_pipe_stat ? PIPE_QUERY_PIPELINE_STATISTICS_SINGLE
+ : PIPE_QUERY_PIPELINE_STATISTICS;
break;
default:
assert(0 && "unexpected query target in st_BeginQuery()");
@@ -164,7 +203,7 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
ret = pipe->end_query(pipe, stq->pq_begin);
} else {
if (!stq->pq) {
- stq->pq = pipe->create_query(pipe, type, q->Stream);
+ stq->pq = pipe->create_query(pipe, type, target_to_index(st, q));
stq->type = type;
}
if (stq->pq)
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 354876746f4..30380446041 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -462,6 +462,8 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
screen->get_param(screen, PIPE_CAP_TGSI_PACK_HALF_FLOAT);
st->has_multi_draw_indirect =
screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT);
+ st->has_single_pipe_stat =
+ screen->get_param(screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE);
st->has_hw_atomics =
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index b31e719708e..8b736ebff75 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -127,6 +127,7 @@ struct st_context
boolean has_shareable_shaders;
boolean has_half_float_packing;
boolean has_multi_draw_indirect;
+ boolean has_single_pipe_stat;
boolean can_bind_const_buffer_as_vertex;
/**
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 931a2643bfa..46280792603 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -704,6 +704,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY },
{ o(ARB_occlusion_query2), PIPE_CAP_OCCLUSION_QUERY },
{ o(ARB_pipeline_statistics_query), PIPE_CAP_QUERY_PIPELINE_STATISTICS },
+ { o(ARB_pipeline_statistics_query), PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE },
{ o(ARB_point_sprite), PIPE_CAP_POINT_SPRITE },
{ o(ARB_polygon_offset_clamp), PIPE_CAP_POLYGON_OFFSET_CLAMP },
{ o(ARB_post_depth_coverage), PIPE_CAP_POST_DEPTH_COVERAGE },