summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/hud/hud_context.c
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2013-03-29 13:56:35 +0100
committerChristoph Bumiller <[email protected]>2013-04-03 12:54:43 +0200
commit3d2790cead7eb744341e8b1708b7a6d03524768d (patch)
tree3e078dfc33a1d8b744d820d6b4b4420ed5bc10c6 /src/gallium/auxiliary/hud/hud_context.c
parentc620aad71c2fe147dd2435c27053b435801a5237 (diff)
gallium/hud: add support for PIPE_QUERY_PIPELINE_STATISTICS
Also, renamed "pixels-rendered" to "samples-passed" because the occlusion counter increments even if colour and depth writes are disabled, or (on some implementations) for killed fragments that passed the depth test when PS early_fragment_tests is set.
Diffstat (limited to 'src/gallium/auxiliary/hud/hud_context.c')
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 9b7b63f91ba..5511f8e1011 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -90,6 +90,10 @@ struct hud_context {
unsigned max_num_vertices;
unsigned num_vertices;
} text, bg, whitelines;
+
+ struct {
+ boolean query_pipeline_statistics;
+ } cap;
};
@@ -719,15 +723,45 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
else if (sscanf(name, "cpu%u%s", &i, s) == 1) {
hud_cpu_graph_install(pane, i);
}
- else if (strcmp(name, "pixels-rendered") == 0 &&
+ else if (strcmp(name, "samples-passed") == 0 &&
has_occlusion_query(hud->pipe->screen)) {
- hud_pipe_query_install(pane, hud->pipe, "pixels-rendered",
- PIPE_QUERY_OCCLUSION_COUNTER, 0, FALSE);
+ hud_pipe_query_install(pane, hud->pipe, "samples-passed",
+ PIPE_QUERY_OCCLUSION_COUNTER, 0, 0, FALSE);
}
else if (strcmp(name, "primitives-generated") == 0 &&
has_streamout(hud->pipe->screen)) {
hud_pipe_query_install(pane, hud->pipe, "primitives-generated",
- PIPE_QUERY_PRIMITIVES_GENERATED, 0, FALSE);
+ PIPE_QUERY_PRIMITIVES_GENERATED, 0, 0, FALSE);
+ }
+ else if (strncmp(name, "pipeline-statistics-", 20) == 0) {
+ if (hud->cap.query_pipeline_statistics) {
+ static const char *pipeline_statistics_names[] =
+ {
+ "ia-vertices",
+ "ia-primitives",
+ "vs-invocations",
+ "gs-invocations",
+ "gs-primitives",
+ "clipper-invocations",
+ "clipper-primitives-generated",
+ "ps-invocations",
+ "hs-invocations",
+ "ds-invocations",
+ "cs-invocations"
+ };
+ for (i = 0; i < Elements(pipeline_statistics_names); ++i)
+ if (strcmp(&name[20], pipeline_statistics_names[i]) == 0)
+ break;
+ if (i < Elements(pipeline_statistics_names))
+ hud_pipe_query_install(pane, hud->pipe, &name[20],
+ PIPE_QUERY_PIPELINE_STATISTICS, i,
+ 0, FALSE);
+ else
+ fprintf(stderr, "gallium_hud: invalid pipeline-statistics-*\n");
+ } else {
+ fprintf(stderr, "gallium_hud: PIPE_QUERY_PIPELINE_STATISTICS "
+ "not supported by the driver\n");
+ }
}
else {
if (!hud_driver_query_install(pane, hud->pipe, name)){
@@ -990,6 +1024,9 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso)
LIST_INITHEAD(&hud->pane_list);
+ hud->cap.query_pipeline_statistics =
+ pipe->screen->get_param(pipe->screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS);
+
hud_parse_env_var(hud, env);
return hud;
}