radv: remove useless checks around radv_CmdBindPipeline()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 4 Oct 2017 20:27:39 +0000 (22:27 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 4 Oct 2017 21:18:51 +0000 (23:18 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta_blit.c
src/amd/vulkan/radv_meta_blit2d.c
src/amd/vulkan/radv_meta_bufimage.c
src/amd/vulkan/radv_meta_clear.c
src/amd/vulkan/radv_meta_decompress.c
src/amd/vulkan/radv_meta_fast_clear.c
src/amd/vulkan/radv_meta_resolve.c
src/amd/vulkan/radv_meta_resolve_cs.c

index a0be498de504c61b44d7effe7415e188f37593d1..88df1f7f41829170f7effcc67827001d9056fe01 100644 (file)
@@ -409,10 +409,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer,
                unreachable(!"bad VkImageType");
        }
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
-       }
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
 
        radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
                                      device->meta_state.blit.pipeline_layout,
index 946c741a27add23a1998ad22fbb7471127b71273..30f58abb5f82590cc7241a75a14f3ffc6b8539c7 100644 (file)
@@ -186,10 +186,8 @@ bind_pipeline(struct radv_cmd_buffer *cmd_buffer,
        VkPipeline pipeline =
                cmd_buffer->device->meta_state.blit2d.pipelines[src_type][fs_key];
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
-       }
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
 }
 
 static void
@@ -199,10 +197,8 @@ bind_depth_pipeline(struct radv_cmd_buffer *cmd_buffer,
        VkPipeline pipeline =
                cmd_buffer->device->meta_state.blit2d.depth_only_pipeline[src_type];
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
-       }
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
 }
 
 static void
@@ -212,10 +208,8 @@ bind_stencil_pipeline(struct radv_cmd_buffer *cmd_buffer,
        VkPipeline pipeline =
                cmd_buffer->device->meta_state.blit2d.stencil_only_pipeline[src_type];
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
-       }
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
 }
 
 static void
index cb028dccdcc8a0d7e51d1414a8ffd6127050a17f..f5bbf3cb90f59c5f78e68a30f84a16abc2ac3286 100644 (file)
@@ -865,18 +865,6 @@ itob_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
                                      });
 }
 
-static void
-itob_bind_pipeline(struct radv_cmd_buffer *cmd_buffer)
-{
-       VkPipeline pipeline =
-               cmd_buffer->device->meta_state.itob.pipeline;
-
-       if (cmd_buffer->state.compute_pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
-       }
-}
-
 void
 radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
                          struct radv_meta_blit2d_surf *src,
@@ -884,6 +872,7 @@ radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
                          unsigned num_rects,
                          struct radv_meta_blit2d_rect *rects)
 {
+       VkPipeline pipeline = cmd_buffer->device->meta_state.itob.pipeline;
        struct radv_device *device = cmd_buffer->device;
        struct itob_temps temps;
 
@@ -891,7 +880,9 @@ radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
        create_bview(cmd_buffer, dst->buffer, dst->offset, dst->format, &temps.dst_bview);
        itob_bind_descriptors(cmd_buffer, &temps);
 
-       itob_bind_pipeline(cmd_buffer);
+
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
        for (unsigned r = 0; r < num_rects; ++r) {
                unsigned push_constants[3] = {
@@ -950,18 +941,6 @@ btoi_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
                                      });
 }
 
-static void
-btoi_bind_pipeline(struct radv_cmd_buffer *cmd_buffer)
-{
-       VkPipeline pipeline =
-               cmd_buffer->device->meta_state.btoi.pipeline;
-
-       if (cmd_buffer->state.compute_pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
-       }
-}
-
 void
 radv_meta_buffer_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
                             struct radv_meta_blit2d_buffer *src,
@@ -969,6 +948,7 @@ radv_meta_buffer_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
                             unsigned num_rects,
                             struct radv_meta_blit2d_rect *rects)
 {
+       VkPipeline pipeline = cmd_buffer->device->meta_state.btoi.pipeline;
        struct radv_device *device = cmd_buffer->device;
        struct btoi_temps temps;
 
@@ -976,7 +956,8 @@ radv_meta_buffer_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
        create_iview(cmd_buffer, dst, &temps.dst_iview);
        btoi_bind_descriptors(cmd_buffer, &temps);
 
-       btoi_bind_pipeline(cmd_buffer);
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
        for (unsigned r = 0; r < num_rects; ++r) {
                unsigned push_constants[3] = {
@@ -1041,18 +1022,6 @@ itoi_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
                                      });
 }
 
-static void
-itoi_bind_pipeline(struct radv_cmd_buffer *cmd_buffer)
-{
-       VkPipeline pipeline =
-               cmd_buffer->device->meta_state.itoi.pipeline;
-
-       if (cmd_buffer->state.compute_pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
-       }
-}
-
 void
 radv_meta_image_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
                            struct radv_meta_blit2d_surf *src,
@@ -1060,6 +1029,7 @@ radv_meta_image_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
                            unsigned num_rects,
                            struct radv_meta_blit2d_rect *rects)
 {
+       VkPipeline pipeline = cmd_buffer->device->meta_state.itoi.pipeline;
        struct radv_device *device = cmd_buffer->device;
        struct itoi_temps temps;
 
@@ -1068,7 +1038,8 @@ radv_meta_image_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
 
        itoi_bind_descriptors(cmd_buffer, &temps);
 
-       itoi_bind_pipeline(cmd_buffer);
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
        for (unsigned r = 0; r < num_rects; ++r) {
                unsigned push_constants[4] = {
@@ -1115,30 +1086,20 @@ cleari_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
                                      });
 }
 
-static void
-cleari_bind_pipeline(struct radv_cmd_buffer *cmd_buffer)
-{
-       VkPipeline pipeline =
-               cmd_buffer->device->meta_state.cleari.pipeline;
-
-       if (cmd_buffer->state.compute_pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
-       }
-}
-
 void
 radv_meta_clear_image_cs(struct radv_cmd_buffer *cmd_buffer,
                         struct radv_meta_blit2d_surf *dst,
                         const VkClearColorValue *clear_color)
 {
+       VkPipeline pipeline = cmd_buffer->device->meta_state.cleari.pipeline;
        struct radv_device *device = cmd_buffer->device;
        struct radv_image_view dst_iview;
 
        create_iview(cmd_buffer, dst, &dst_iview);
        cleari_bind_descriptors(cmd_buffer, &dst_iview);
 
-       cleari_bind_pipeline(cmd_buffer);
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
        unsigned push_constants[4] = {
                clear_color->uint32[0],
index fd2caf3d0ce95781774aae7015ed1563983e0012..3acb9e009a2e8e706337e4cffeaf2f43a6f4e9ae 100644 (file)
@@ -374,10 +374,8 @@ emit_color_clear(struct radv_cmd_buffer *cmd_buffer,
 
        radv_cmd_buffer_set_subpass(cmd_buffer, &clear_subpass, false);
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
-                                          pipeline);
-       }
+       radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
+                            pipeline);
 
        radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) {
                        .x = clear_rect->rect.offset.x,
@@ -644,10 +642,8 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer,
                                                         clear_rect,
                                                         clear_value);
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
-                                    pipeline);
-       }
+       radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
+                            pipeline);
 
        if (depth_view_can_fast_clear(cmd_buffer, iview, aspects,
                                      subpass->depth_stencil_attachment.layout,
index c68be27f1f6bdf9e5eee07f4ee23ae497980de3e..f4ed63f68be6e7c165544414efbfe03bf9b9b944 100644 (file)
@@ -269,12 +269,8 @@ emit_depth_decomp(struct radv_cmd_buffer *cmd_buffer,
 {
        VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer);
 
-       RADV_FROM_HANDLE(radv_pipeline, pipeline, pipeline_h);
-
-       if (cmd_buffer->state.pipeline != pipeline) {
-               radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
-                                    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 = 0,
index a10630173eee3c9e4e6745c7e88ee04a7782b607..0efde627ed0e3891e2e14f7b80787b32069dda63 100644 (file)
@@ -292,10 +292,8 @@ emit_fast_clear_flush(struct radv_cmd_buffer *cmd_buffer,
 {
        VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer);
 
-       if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
-                                    pipeline);
-       }
+       radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
+                            pipeline);
 
        radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) {
                        .x = 0,
index 5141ae3baaee525674a736888804d59173ff19f0..50008baf94ae80a4d80ac42f2f207d0674c86366 100644 (file)
@@ -268,13 +268,8 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer,
 
        cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_CB;
 
-       VkPipeline pipeline_h = device->meta_state.resolve.pipeline;
-       RADV_FROM_HANDLE(radv_pipeline, pipeline, pipeline_h);
-
-       if (cmd_buffer->state.pipeline != pipeline) {
-               radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
-                                    pipeline_h);
-       }
+       radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
+                            device->meta_state.resolve.pipeline);
 
        radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &(VkViewport) {
                .x = dest_offset->x,
index 55bf72071e837e5d3eeff3e50175091234410e6e..7104ccd35f5f0dfa31919eaa6d3fa7dc8f709f94 100644 (file)
@@ -351,10 +351,9 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer,
                pipeline = device->meta_state.resolve_compute.rc[samples_log2].srgb_pipeline;
        else
                pipeline = device->meta_state.resolve_compute.rc[samples_log2].pipeline;
-       if (cmd_buffer->state.compute_pipeline != radv_pipeline_from_handle(pipeline)) {
-               radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
-                                    VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
-       }
+
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+                            VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
        unsigned push_constants[4] = {
                src_offset->x,