radeonsi: skip draws with instance_count == 0
authorMarek Olšák <marek.olsak@amd.com>
Mon, 5 Sep 2016 22:09:17 +0000 (00:09 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Sep 2016 09:13:13 +0000 (11:13 +0200)
loosely ported from Vulkan

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_state_draw.c

index 0a91291e4ea41389835055483c483d670fcac761..9469bb4f1154f713d87082e0f5ee007562ae5913 100644 (file)
@@ -882,9 +882,19 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
        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);