radv: add surface helper variable in radv_GetImageSubresourceLayout
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 10 May 2017 20:05:52 +0000 (22:05 +0200)
committerDave Airlie <airlied@redhat.com>
Mon, 5 Jun 2017 00:43:50 +0000 (10:43 +1000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_image.c

index 22bc6b41da86e3b30f676a227de1e115b0839436..d138988f56f1fa3a97fb2d589f2def65cba95390 100644 (file)
@@ -853,14 +853,15 @@ void radv_GetImageSubresourceLayout(
        RADV_FROM_HANDLE(radv_image, image, _image);
        int level = pSubresource->mipLevel;
        int layer = pSubresource->arrayLayer;
+       struct radeon_surf *surface = &image->surface;
 
-       pLayout->offset = image->surface.level[level].offset + image->surface.level[level].slice_size * layer;
-       pLayout->rowPitch = image->surface.level[level].pitch_bytes;
-       pLayout->arrayPitch = image->surface.level[level].slice_size;
-       pLayout->depthPitch = image->surface.level[level].slice_size;
-       pLayout->size = image->surface.level[level].slice_size;
+       pLayout->offset = surface->level[level].offset + surface->level[level].slice_size * layer;
+       pLayout->rowPitch = surface->level[level].pitch_bytes;
+       pLayout->arrayPitch = surface->level[level].slice_size;
+       pLayout->depthPitch = surface->level[level].slice_size;
+       pLayout->size = surface->level[level].slice_size;
        if (image->type == VK_IMAGE_TYPE_3D)
-               pLayout->size *= image->surface.level[level].nblk_z;
+               pLayout->size *= surface->level[level].nblk_z;
 }