From 02ccef7874c270da28f2c04c3273fbd95a451b72 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 24 Oct 2018 08:50:24 +0200 Subject: [PATCH] radv: add get_image_stride_for_r32g32b32() helper For the special R32G32B32 paths. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- 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 6a5058693f4..de7e0b1e3e3 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], -- 2.30.2