[Mesa-dev] [PATCH RESEND 1/2] radv: store the dynamic state mask into radv_dynamic_state

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Oct 25 17:26:47 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_cmd_buffer.c | 10 +++++-----
 src/amd/vulkan/radv_pipeline.c   |  2 +-
 src/amd/vulkan/radv_private.h    |  7 ++++++-
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 807283be1d..744d9d0f57 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -80,9 +80,10 @@ const struct radv_dynamic_state default_dynamic_state = {
 
 static void
 radv_dynamic_state_copy(struct radv_dynamic_state *dest,
-			const struct radv_dynamic_state *src,
-			uint32_t copy_mask)
+			const struct radv_dynamic_state *src)
 {
+	uint32_t copy_mask = src->mask;
+
 	/* Make sure to copy the number of viewports/scissors because they can
 	 * only be specified at pipeline creation time.
 	 */
@@ -2532,10 +2533,9 @@ void radv_CmdBindPipeline(
 		cmd_buffer->push_constant_stages |= pipeline->active_stages;
 
 		/* Apply the dynamic state from the pipeline */
-		cmd_buffer->state.dirty |= pipeline->dynamic_state_mask;
+		cmd_buffer->state.dirty |= pipeline->dynamic_state.mask;
 		radv_dynamic_state_copy(&cmd_buffer->state.dynamic,
-					&pipeline->dynamic_state,
-					pipeline->dynamic_state_mask);
+					&pipeline->dynamic_state);
 
 		if (pipeline->graphics.esgs_ring_size > cmd_buffer->esgs_ring_size_needed)
 			cmd_buffer->esgs_ring_size_needed = pipeline->graphics.esgs_ring_size;
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index aaaafbefa9..dcc726539b 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1137,7 +1137,7 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline *pipeline,
 		}
 	}
 
-	pipeline->dynamic_state_mask = states;
+	pipeline->dynamic_state.mask = states;
 }
 
 static struct ac_shader_variant_key
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 83529015c5..f0bb5fd83c 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -723,6 +723,12 @@ struct radv_scissor_state {
 };
 
 struct radv_dynamic_state {
+	/**
+	 * Bitmask of (1 << VK_DYNAMIC_STATE_*).
+	 * Defines the set of saved dynamic state.
+	 */
+	uint32_t mask;
+
 	struct radv_viewport_state                        viewport;
 
 	struct radv_scissor_state                         scissor;
@@ -1082,7 +1088,6 @@ struct radv_vertex_elements_info {
 
 struct radv_pipeline {
 	struct radv_device *                          device;
-	uint32_t                                     dynamic_state_mask;
 	struct radv_dynamic_state                     dynamic_state;
 
 	struct radv_pipeline_layout *                 layout;
-- 
2.14.3



More information about the mesa-dev mailing list