radv: add radv_handle_color_image_transition() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 13 Apr 2018 17:14:45 +0000 (19:14 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 16 Apr 2018 12:20:45 +0000 (14:20 +0200)
To handle CMASK, FMASK and DCC transitions in the same place.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index 92c00f5394d1f0da714f199051299b36058b423a..270dcd5a9e0947102eef8be2f90bfce5f27f0700 100644 (file)
@@ -3819,6 +3819,28 @@ static void radv_handle_dcc_image_transition(struct radv_cmd_buffer *cmd_buffer,
        }
 }
 
+/**
+ * Handle color image transitions for DCC/FMASK/CMASK.
+ */
+static void radv_handle_color_image_transition(struct radv_cmd_buffer *cmd_buffer,
+                                              struct radv_image *image,
+                                              VkImageLayout src_layout,
+                                              VkImageLayout dst_layout,
+                                              unsigned src_queue_mask,
+                                              unsigned dst_queue_mask,
+                                              const VkImageSubresourceRange *range)
+{
+       if (radv_image_has_dcc(image))
+               radv_handle_dcc_image_transition(cmd_buffer, image, src_layout,
+                                                dst_layout, src_queue_mask,
+                                                dst_queue_mask, range);
+
+       if (radv_image_has_cmask(image) || radv_image_has_fmask(image))
+               radv_handle_cmask_image_transition(cmd_buffer, image, src_layout,
+                                                  dst_layout, src_queue_mask,
+                                                  dst_queue_mask, range);
+}
+
 static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer,
                                         struct radv_image *image,
                                         VkImageLayout src_layout,
@@ -3854,15 +3876,9 @@ static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer,
                                                   dst_queue_mask, range,
                                                   pending_clears);
 
-       if (radv_image_has_dcc(image))
-               radv_handle_dcc_image_transition(cmd_buffer, image, src_layout,
-                                                dst_layout, src_queue_mask,
-                                                dst_queue_mask, range);
-
-       if (radv_image_has_cmask(image) || radv_image_has_fmask(image))
-               radv_handle_cmask_image_transition(cmd_buffer, image, src_layout,
-                                                  dst_layout, src_queue_mask,
-                                                  dst_queue_mask, range);
+       radv_handle_color_image_transition(cmd_buffer, image, src_layout,
+                                          dst_layout, src_queue_mask,
+                                          dst_queue_mask, range);
 }
 
 void radv_CmdPipelineBarrier(