[Mesa-dev] [PATCH 1/6] radv: allow to skip descriptors flush when binding a pipeline

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


When a meta operation doesn't use any descriptors, we don't
need to flush them.

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

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 4b41b358e9..2f884cd282 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2446,19 +2446,18 @@ static void radv_mark_descriptor_sets_dirty(struct radv_cmd_buffer *cmd_buffer)
 	}
 }
 
-void radv_CmdBindPipeline(
-	VkCommandBuffer                             commandBuffer,
-	VkPipelineBindPoint                         pipelineBindPoint,
-	VkPipeline                                  _pipeline)
+void
+radv_bind_pipeline(struct radv_cmd_buffer *cmd_buffer,
+		   VkPipelineBindPoint bind_point,
+		   struct radv_pipeline *pipeline, uint32_t bind_flags)
 {
-	RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
-	RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
-
-	switch (pipelineBindPoint) {
+	switch (bind_point) {
 	case VK_PIPELINE_BIND_POINT_COMPUTE:
 		if (cmd_buffer->state.compute_pipeline == pipeline)
 			return;
-		radv_mark_descriptor_sets_dirty(cmd_buffer);
+
+		if (!(bind_flags & RADV_BIND_PIPELINE_SKIP_DESCRIPTORS))
+			radv_mark_descriptor_sets_dirty(cmd_buffer);
 
 		cmd_buffer->state.compute_pipeline = pipeline;
 		cmd_buffer->push_constant_stages |= VK_SHADER_STAGE_COMPUTE_BIT;
@@ -2466,7 +2465,9 @@ void radv_CmdBindPipeline(
 	case VK_PIPELINE_BIND_POINT_GRAPHICS:
 		if (cmd_buffer->state.pipeline == pipeline)
 			return;
-		radv_mark_descriptor_sets_dirty(cmd_buffer);
+
+		if (!(bind_flags & RADV_BIND_PIPELINE_SKIP_DESCRIPTORS))
+			radv_mark_descriptor_sets_dirty(cmd_buffer);
 
 		cmd_buffer->state.pipeline = pipeline;
 		if (!pipeline)
@@ -2503,6 +2504,16 @@ void radv_CmdBindPipeline(
 		break;
 	}
 }
+void radv_CmdBindPipeline(
+	VkCommandBuffer                             commandBuffer,
+	VkPipelineBindPoint                         pipelineBindPoint,
+	VkPipeline                                  _pipeline)
+{
+	RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
+	RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
+
+	radv_bind_pipeline(cmd_buffer, pipelineBindPoint, pipeline, 0);
+}
 
 void radv_CmdSetViewport(
 	VkCommandBuffer                             commandBuffer,
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 2405d98339..cf49429b37 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1528,6 +1528,15 @@ void radv_initialise_cmask(struct radv_cmd_buffer *cmd_buffer,
 void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer,
 			 struct radv_image *image, uint32_t value);
 
+enum {
+	RADV_BIND_PIPELINE_SKIP_DESCRIPTORS = (1 << 0),
+};
+
+void
+radv_bind_pipeline(struct radv_cmd_buffer *cmd_buffer,
+		   VkPipelineBindPoint bind_point,
+		   struct radv_pipeline *pipeline, uint32_t bind_flags);
+
 struct radv_fence {
 	struct radeon_winsys_fence *fence;
 	bool submitted;
-- 
2.14.2



More information about the mesa-dev mailing list