radv: be smarter with the draw packets when executing secondary buffers
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 16 Oct 2017 12:15:54 +0000 (14:15 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 16 Oct 2017 12:50:27 +0000 (14:50 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index 64e7e2637b91b4bf631c2e18b0c5be2deb5d39d1..2252d80e11ea266acb321724483f4f2106939162 100644 (file)
@@ -2669,8 +2669,16 @@ void radv_CmdExecuteCommands(
                                secondary->state.emitted_compute_pipeline;
                }
 
-               primary->state.last_primitive_reset_en = secondary->state.last_primitive_reset_en;
-               primary->state.last_primitive_reset_index = secondary->state.last_primitive_reset_index;
+               /* Only re-emit the draw packets when needed. */
+               if (secondary->state.last_primitive_reset_en != -1) {
+                       primary->state.last_primitive_reset_en =
+                               secondary->state.last_primitive_reset_en;
+               }
+
+               if (secondary->state.last_primitive_reset_index) {
+                       primary->state.last_primitive_reset_index =
+                               secondary->state.last_primitive_reset_index;
+               }
        }
 
        /* After executing commands from secondary buffers we have to dirty