radv: check that pipeline is different before binding it
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 4 Oct 2017 20:27:38 +0000 (22:27 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 4 Oct 2017 21:18:48 +0000 (23:18 +0200)
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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index 61ea11c12a653067e0c7782b5809a25458a383d2..4b41b358e9914692c9021692b91f66946fc5ce75 100644 (file)
@@ -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;