summaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-02-11 11:12:32 -0800
committerChia-I Wu <[email protected]>2019-03-11 10:02:13 -0700
commitae82b5df88b9b307c2b7ce6f0f9b59332c83e362 (patch)
tree6cedbef23c1ef849cf7abd1cf115f972ce59143a /src/freedreno
parent6cb5fd0d7163a2430f14686faad037912f18b557 (diff)
turnip: preliminary support for tu_GetImageSubresourceLayout
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/vulkan/tu_image.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 8c91ea504be..657612d42c3 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -283,12 +283,18 @@ tu_GetImageSubresourceLayout(VkDevice _device,
const VkImageSubresource *pSubresource,
VkSubresourceLayout *pLayout)
{
- tu_stub();
+ TU_FROM_HANDLE(tu_image, image, _image);
+
+ const uint32_t layer_offset = image->layer_size * pSubresource->arrayLayer;
+ const struct tu_image_level *level =
+ image->levels + pSubresource->mipLevel;
- /* Even though this is a stub, let's avoid heisenbugs by providing
- * deterministic behavior.
- */
- memset(pLayout, 0, sizeof(*pLayout));
+ pLayout->offset = layer_offset + level->offset;
+ pLayout->size = level->size;
+ pLayout->rowPitch =
+ level->pitch * vk_format_get_blocksize(image->vk_format);
+ pLayout->arrayPitch = image->layer_size;
+ pLayout->depthPitch = level->size;
}
VkResult