On 10/03/2017 08:55 PM, Bas Nieuwenhuizen wrote:
Doesn't it make more sense to do the check in radv_CmdBindPipeline?

It does.


On Tue, Oct 3, 2017 at 8:52 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
This might save some usless state changes, and it improves
consistency with the other meta operations.

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
  src/amd/vulkan/radv_meta_buffer.c     | 18 ++++++++++++------
  src/amd/vulkan/radv_meta_resolve_fs.c |  7 +++++--
  2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_buffer.c 
b/src/amd/vulkan/radv_meta_buffer.c
index ea11ed18c4..22be07a2ee 100644
--- a/src/amd/vulkan/radv_meta_buffer.c
+++ b/src/amd/vulkan/radv_meta_buffer.c
@@ -295,9 +295,12 @@ static void fill_buffer_shader(struct radv_cmd_buffer 
*cmd_buffer,
                 .size = size
         };

-       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                            VK_PIPELINE_BIND_POINT_COMPUTE,
-                            device->meta_state.buffer.fill_pipeline);
+       if (cmd_buffer->state.compute_pipeline !=
+           radv_pipeline_from_handle(device->meta_state.buffer.fill_pipeline)) 
{
+               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                                    VK_PIPELINE_BIND_POINT_COMPUTE,
+                                    device->meta_state.buffer.fill_pipeline);
+       }

         radv_meta_push_descriptor_set(cmd_buffer, 
VK_PIPELINE_BIND_POINT_COMPUTE,
                                       device->meta_state.buffer.fill_p_layout,
@@ -352,9 +355,12 @@ static void copy_buffer_shader(struct radv_cmd_buffer 
*cmd_buffer,
                 .size = size
         };

-       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                            VK_PIPELINE_BIND_POINT_COMPUTE,
-                            device->meta_state.buffer.copy_pipeline);
+       if (cmd_buffer->state.compute_pipeline !=
+           radv_pipeline_from_handle(device->meta_state.buffer.copy_pipeline)) 
{
+               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                                    VK_PIPELINE_BIND_POINT_COMPUTE,
+                                    device->meta_state.buffer.copy_pipeline);
+       }

         radv_meta_push_descriptor_set(cmd_buffer, 
VK_PIPELINE_BIND_POINT_COMPUTE,
                                       device->meta_state.buffer.copy_p_layout,
diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c 
b/src/amd/vulkan/radv_meta_resolve_fs.c
index 50d5ed7d5a..56b6e0c29a 100644
--- a/src/amd/vulkan/radv_meta_resolve_fs.c
+++ b/src/amd/vulkan/radv_meta_resolve_fs.c
@@ -418,8 +418,11 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer,
         unsigned fs_key = radv_format_meta_fs_key(dest_iview->vk_format);
         VkPipeline pipeline_h = 
device->meta_state.resolve_fragment.rc[samples_log2].pipeline[fs_key];

-       radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
-                            pipeline_h);
+       if (cmd_buffer->state.pipeline != 
radv_pipeline_from_handle(pipeline_h)) {
+               radv_CmdBindPipeline(cmd_buffer_h,
+                                    VK_PIPELINE_BIND_POINT_GRAPHICS,
+                                    pipeline_h);
+       }

         radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, 
&(VkViewport) {
                 .x = dest_offset->x,
--
2.14.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to