From 6a2e3d27366c1269868de536da90d145e230dbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 1 Jun 2021 00:18:51 -0400 Subject: [PATCH] radeonsi: cleanup some primitive discard CS TODOs regarding instancing, etc. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_compute_prim_discard.c | 6 ++++-- src/gallium/drivers/radeonsi/si_state_draw.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c index 54b58bfadc0..939423ef3f3 100644 --- a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c +++ b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c @@ -956,9 +956,11 @@ si_prepare_prim_discard_or_split_draw(struct si_context *sctx, const struct pipe /* Split draws at the draw call level if the ring is full. This makes * better use of the ring space. + * + * If instancing is enabled and there is not enough ring buffer space, compute-based + * primitive discard is disabled. */ - if (ring_full && num_prims > PRIMS_PER_BATCH && - instance_count == 1) { /* TODO: support splitting instanced draws */ + if (ring_full && num_prims > PRIMS_PER_BATCH && instance_count == 1) { unsigned vert_count_per_subdraw = 0; if (prim == PIPE_PRIM_TRIANGLES) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 52d10876d3a..ce72a53c45d 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -1936,7 +1936,7 @@ static void si_draw_vbo(struct pipe_context *ctx, (1 << prim) & ((1 << PIPE_PRIM_TRIANGLES) | (1 << PIPE_PRIM_TRIANGLE_STRIP)) && /* Instancing is limited to 16-bit indices, because InstanceID is packed into VertexID. */ - /* TODO: DrawArraysInstanced doesn't sometimes work, so it's disabled. */ + /* Instanced index_size == 0 requires that start + count < USHRT_MAX, so just reject it. */ (instance_count == 1 || (instance_count <= USHRT_MAX && index_size && index_size <= 2) || pd_msg("instance_count too large or index_size == 4 or DrawArraysInstanced"))) &&