Mesa (master): radv: check that pipeline is different before binding it

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Wed Oct 4 21:19:31 UTC 2017


Module: Mesa
Branch: master
Commit: b53c207659e65a29081c0f26b189f37fdd895406
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b53c207659e65a29081c0f26b189f37fdd895406

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Oct  4 22:27:38 2017 +0200

radv: check that pipeline is different before binding it

We only need to dirty the descriptors when the pipeline is
a new one, because user SGPRs can be potentially different.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_cmd_buffer.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 61ea11c12a..4b41b358e9 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2454,14 +2454,20 @@ void radv_CmdBindPipeline(
 	RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
 	RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
 
-	radv_mark_descriptor_sets_dirty(cmd_buffer);
-
 	switch (pipelineBindPoint) {
 	case VK_PIPELINE_BIND_POINT_COMPUTE:
+		if (cmd_buffer->state.compute_pipeline == pipeline)
+			return;
+		radv_mark_descriptor_sets_dirty(cmd_buffer);
+
 		cmd_buffer->state.compute_pipeline = pipeline;
 		cmd_buffer->push_constant_stages |= VK_SHADER_STAGE_COMPUTE_BIT;
 		break;
 	case VK_PIPELINE_BIND_POINT_GRAPHICS:
+		if (cmd_buffer->state.pipeline == pipeline)
+			return;
+		radv_mark_descriptor_sets_dirty(cmd_buffer);
+
 		cmd_buffer->state.pipeline = pipeline;
 		if (!pipeline)
 			break;




More information about the mesa-commit mailing list