aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_state_draw.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-02-19 23:27:16 -0500
committerMarek Olšák <[email protected]>2019-05-16 13:13:36 -0400
commit0252fb92b88a3f3e0c35f8876678b84ef0672509 (patch)
tree67f9cc080edf2500ed2d33edb4346c1d0518fa39 /src/gallium/drivers/radeonsi/si_state_draw.c
parentc9b7a37b8f7979433655e269a2b161d33eb41659 (diff)
radeonsi: add primitive culling stats to the HUD
Acked-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_draw.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index b4b3fe323ee..485efcb0dff 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -1591,14 +1591,17 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
}
}
} else {
- direct_count = info->count * instance_count;
+ /* Multiply by 3 for strips and fans to get an approximate vertex
+ * count as triangles. */
+ direct_count = info->count * instance_count *
+ (prim == PIPE_PRIM_TRIANGLES ? 1 : 3);
}
/* Determine if we can use the primitive discard compute shader. */
if (si_compute_prim_discard_enabled(sctx) &&
- /* Multiply by 3 for strips and fans to get the vertex count as triangles. */
- direct_count * (prim == PIPE_PRIM_TRIANGLES ? 1 : 3) >
- sctx->prim_discard_vertex_count_threshold &&
+ (direct_count > sctx->prim_discard_vertex_count_threshold ?
+ (sctx->compute_num_verts_rejected += direct_count, true) : /* Add, then return true. */
+ (sctx->compute_num_verts_ineligible += direct_count, false)) && /* Add, then return false. */
(!info->count_from_stream_output || pd_msg("draw_opaque")) &&
(primitive_restart ?
/* Supported prim types with primitive restart: */
@@ -1648,10 +1651,13 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
index_size = 4;
instance_count = 1;
primitive_restart = false;
+ sctx->compute_num_verts_rejected -= direct_count;
+ sctx->compute_num_verts_accepted += direct_count;
break;
case SI_PRIM_DISCARD_DISABLED:
break;
case SI_PRIM_DISCARD_DRAW_SPLIT:
+ sctx->compute_num_verts_rejected -= direct_count;
goto return_cleanup;
}
}