summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-01-09 10:06:08 +0100
committerSamuel Pitoiset <[email protected]>2019-01-09 14:22:38 +0100
commitb8c4f523b40e3d9dbe1f81f2c69b31618f7a9b62 (patch)
treee3b112e3bad9323bfc13970c4411a502c0905f89
parenta2b5cc3c39940402e067e10b255226538467a672 (diff)
radv: skip draws with instance_count == 0
Loosely based on RadeonSI. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/vulkan/radv_cmd_buffer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 4382062c411..f41d6c0b3e7 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -3696,6 +3696,19 @@ radv_draw(struct radv_cmd_buffer *cmd_buffer,
radeon_check_space(cmd_buffer->device->ws,
cmd_buffer->cs, 4096);
+ 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->strmout_buffer))
+ return;
+ }
+
/* Use optimal packet order based on whether we need to sync the
* pipeline.
*/