[Mesa-dev] [PATCH 03/15] radv: add surface helper variable in radv_GetImageSubresourceLayout

Nicolai Hähnle nhaehnle at gmail.com
Thu May 18 09:53:45 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/amd/vulkan/radv_image.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index e1e9d9c..c0fc896 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -841,28 +841,29 @@ radv_DestroyImage(VkDevice _device, VkImage _image,
 
 void radv_GetImageSubresourceLayout(
 	VkDevice                                    device,
 	VkImage                                     _image,
 	const VkImageSubresource*                   pSubresource,
 	VkSubresourceLayout*                        pLayout)
 {
 	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;
 }
 
 
 VkResult
 radv_CreateImageView(VkDevice _device,
 		     const VkImageViewCreateInfo *pCreateInfo,
 		     const VkAllocationCallbacks *pAllocator,
 		     VkImageView *pView)
 {
 	RADV_FROM_HANDLE(radv_device, device, _device);
-- 
2.9.3



More information about the mesa-dev mailing list