[Mesa-dev] [PATCH 4/6] radv: allow to skip constants upload when binding a pipeline

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Oct 6 10:19:48 UTC 2017


When a meta operation doesn't use any constants, we don't
need to re-upload them.

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

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 2f884cd282..f98bc4144e 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2460,7 +2460,9 @@ radv_bind_pipeline(struct radv_cmd_buffer *cmd_buffer,
 			radv_mark_descriptor_sets_dirty(cmd_buffer);
 
 		cmd_buffer->state.compute_pipeline = pipeline;
-		cmd_buffer->push_constant_stages |= VK_SHADER_STAGE_COMPUTE_BIT;
+
+		if (!(bind_flags & RADV_BIND_PIPELINE_SKIP_CONSTANTS))
+			cmd_buffer->push_constant_stages |= VK_SHADER_STAGE_COMPUTE_BIT;
 		break;
 	case VK_PIPELINE_BIND_POINT_GRAPHICS:
 		if (cmd_buffer->state.pipeline == pipeline)
@@ -2474,7 +2476,9 @@ radv_bind_pipeline(struct radv_cmd_buffer *cmd_buffer,
 			break;
 
 		cmd_buffer->state.dirty |= RADV_CMD_DIRTY_PIPELINE;
-		cmd_buffer->push_constant_stages |= pipeline->active_stages;
+
+		if (!(bind_flags & RADV_BIND_PIPELINE_SKIP_CONSTANTS))
+			cmd_buffer->push_constant_stages |= pipeline->active_stages;
 
 		/* Apply the dynamic state from the pipeline */
 		cmd_buffer->state.dirty |= pipeline->dynamic_state_mask;
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index cf49429b37..b7a4268019 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1530,6 +1530,7 @@ void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer,
 
 enum {
 	RADV_BIND_PIPELINE_SKIP_DESCRIPTORS = (1 << 0),
+	RADV_BIND_PIPELINE_SKIP_CONSTANTS   = (1 << 1),
 };
 
 void
-- 
2.14.2



More information about the mesa-dev mailing list