Mesa (master): radv: add get_image_stride_for_r32g32b32() helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 26 08:49:14 UTC 2018


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Oct 24 08:50:24 2018 +0200

radv: add get_image_stride_for_r32g32b32() helper

For the special R32G32B32 paths.

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

---

 src/amd/vulkan/radv_meta_bufimage.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_bufimage.c b/src/amd/vulkan/radv_meta_bufimage.c
index 6a5058693f..de7e0b1e3e 100644
--- a/src/amd/vulkan/radv_meta_bufimage.c
+++ b/src/amd/vulkan/radv_meta_bufimage.c
@@ -1420,6 +1420,21 @@ create_bview_for_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
 			      });
 }
 
+static unsigned
+get_image_stride_for_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
+			       struct radv_meta_blit2d_surf *surf)
+{
+	unsigned stride;
+
+	if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) {
+		stride = surf->image->surface.u.gfx9.surf_pitch;
+	} else {
+		stride = surf->image->surface.u.legacy.level[0].nblk_x * 3;
+	}
+
+	return stride;
+}
+
 static void
 itob_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
 		      struct radv_image_view *src,
@@ -1560,11 +1575,7 @@ radv_meta_buffer_to_image_cs_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
 	radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
 			     VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
-	if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) {
-		stride = dst->image->surface.u.gfx9.surf_pitch;
-	} else {
-		stride = dst->image->surface.u.legacy.level[0].nblk_x * 3;
-	}
+	stride = get_image_stride_for_r32g32b32(cmd_buffer, dst);
 
 	for (unsigned r = 0; r < num_rects; ++r) {
 		unsigned push_constants[4] = {
@@ -1802,11 +1813,7 @@ radv_meta_clear_image_cs_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
 	radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
 			     VK_PIPELINE_BIND_POINT_COMPUTE, pipeline);
 
-	if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) {
-		stride = dst->image->surface.u.gfx9.surf_pitch;
-	} else {
-		stride = dst->image->surface.u.legacy.level[0].nblk_x * 3;
-	}
+	stride = get_image_stride_for_r32g32b32(cmd_buffer, dst);
 
 	unsigned push_constants[4] = {
 		clear_color->uint32[0],




More information about the mesa-commit mailing list