turnip: preliminary support for tu_GetImageSubresourceLayout

This commit is contained in:
Chia-I Wu 2019-02-11 11:12:32 -08:00
parent 6cb5fd0d71
commit ae82b5df88
1 changed files with 11 additions and 5 deletions

View File

@ -283,12 +283,18 @@ tu_GetImageSubresourceLayout(VkDevice _device,
const VkImageSubresource *pSubresource,
VkSubresourceLayout *pLayout)
{
tu_stub();
TU_FROM_HANDLE(tu_image, image, _image);
/* Even though this is a stub, let's avoid heisenbugs by providing
* deterministic behavior.
*/
memset(pLayout, 0, sizeof(*pLayout));
const uint32_t layer_offset = image->layer_size * pSubresource->arrayLayer;
const struct tu_image_level *level =
image->levels + pSubresource->mipLevel;
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