radv: be smarter with pipelines when emitting secondary buffers
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 11 Oct 2017 13:54:40 +0000 (15:54 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 16 Oct 2017 12:09:51 +0000 (14:09 +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 397f0db26c0b1241b0ebba9f5df34d46f7565442..b01f1ee7efafa4e8698a7506cdf0e3b72492aecb 100644 (file)
@@ -2650,8 +2650,23 @@ void radv_CmdExecuteCommands(
                }
                primary->device->ws->cs_execute_secondary(primary->cs, secondary->cs);
 
-               primary->state.emitted_pipeline = secondary->state.emitted_pipeline;
-               primary->state.emitted_compute_pipeline = secondary->state.emitted_compute_pipeline;
+
+               /* When the secondary command buffer is compute only we don't
+                * need to re-emit the current graphics pipeline.
+                */
+               if (secondary->state.emitted_pipeline) {
+                       primary->state.emitted_pipeline =
+                               secondary->state.emitted_pipeline;
+               }
+
+               /* When the secondary command buffer is graphics only we don't
+                * need to re-emit the current compute pipeline.
+                */
+               if (secondary->state.emitted_compute_pipeline) {
+                       primary->state.emitted_compute_pipeline =
+                               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;
        }