[Mesa-dev] [PATCH 2/2] radv: be smarter with the dynamic state when emitting secondary buffers

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Oct 11 15:18:37 UTC 2017


Only need to re-emit the dynamic states used by the secondary
buffers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_cmd_buffer.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 69ca16b52d..df3ee5e494 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2680,8 +2680,18 @@ void radv_CmdExecuteCommands(
 		 * need to re-emit the current graphics pipeline.
 		 */
 		if (secondary->state.emitted_pipeline) {
-			primary->state.emitted_pipeline =
+			struct radv_pipeline *pipeline =
 				secondary->state.emitted_pipeline;
+
+			primary->state.emitted_pipeline = pipeline;
+
+			/* Apply the dynamic state from the emitted graphics
+			 * pipeline of the secondary command buffer.
+			 */
+			primary->state.dirty |= pipeline->dynamic_state_mask;
+			radv_dynamic_state_copy(&primary->state.dynamic,
+						&pipeline->dynamic_state,
+						pipeline->dynamic_state_mask);
 		}
 
 		/* When the secondary command buffer is graphics only we don't
@@ -2711,7 +2721,6 @@ void radv_CmdExecuteCommands(
 	 * some states.
 	 */
 	primary->state.dirty |= RADV_CMD_DIRTY_PIPELINE;
-	primary->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_ALL;
 }
 
 VkResult radv_CreateCommandPool(
-- 
2.14.2



More information about the mesa-dev mailing list