From: Marek Olšák <marek.ol...@amd.com>

loosely ported from Vulkan
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index 0a91291..9469bb4 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -875,23 +875,33 @@ void si_ce_post_draw_synchronization(struct si_context 
*sctx)
        }
 }
 
 void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 {
        struct si_context *sctx = (struct si_context *)ctx;
        struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
        struct pipe_index_buffer ib = {};
        unsigned mask, dirty_fb_counter, dirty_tex_counter, rast_prim;
 
-       if (!info->count && !info->indirect &&
-           (info->indexed || !info->count_from_stream_output))
-               return;
+       if (likely(!info->indirect)) {
+               /* SI-CI treat instance_count==0 as instance_count==1. There is
+                * no workaround for indirect draws, but we can at least skip
+                * direct draws.
+                */
+               if (unlikely(!info->instance_count))
+                       return;
+
+               /* Handle count == 0. */
+               if (unlikely(!info->count &&
+                            (info->indexed || 
!info->count_from_stream_output)))
+                       return;
+       }
 
        if (!sctx->vs_shader.cso) {
                assert(0);
                return;
        }
        if (!sctx->ps_shader.cso && (!rs || !rs->rasterizer_discard)) {
                assert(0);
                return;
        }
        if (!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES)) {
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to