Commit 6ab37b0f by Alexis Hetu Committed by Alexis Hétu

vkGetImageSubresourceLayout implementation

The Image class now contains all the required functions to fill out the VkSubresourceLayout structure, so this simply hooks the proper calls to implement vkGetImageSubresourceLayout. Bug b/119620767 Change-Id: I104811be4a5be31ef5db7ad55965ba263dd110ed Reviewed-on: https://swiftshader-review.googlesource.com/c/24051Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 76e40024
...@@ -60,6 +60,16 @@ void Image::bind(VkDeviceMemory pDeviceMemory, VkDeviceSize pMemoryOffset) ...@@ -60,6 +60,16 @@ void Image::bind(VkDeviceMemory pDeviceMemory, VkDeviceSize pMemoryOffset)
memoryOffset = pMemoryOffset; memoryOffset = pMemoryOffset;
} }
void Image::getSubresourceLayout(const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) const
{
uint32_t bpp = bytesPerTexel(flags);
pLayout->offset = getMemoryOffset(flags, pSubresource->mipLevel, pSubresource->arrayLayer);
pLayout->size = getMipLevelSize(flags, pSubresource->mipLevel);
pLayout->rowPitch = rowPitchBytes(flags, pSubresource->mipLevel);
pLayout->depthPitch = slicePitchBytes(flags, pSubresource->mipLevel);
pLayout->arrayPitch = getLayerSize(flags);
}
void Image::copyTo(VkImage dstImage, const VkImageCopy& pRegion) void Image::copyTo(VkImage dstImage, const VkImageCopy& pRegion)
{ {
// Image copy does not perform any conversion, it simply copies memory from // Image copy does not perform any conversion, it simply copies memory from
......
...@@ -38,6 +38,7 @@ public: ...@@ -38,6 +38,7 @@ public:
static size_t ComputeRequiredAllocationSize(const VkImageCreateInfo* pCreateInfo); static size_t ComputeRequiredAllocationSize(const VkImageCreateInfo* pCreateInfo);
const VkMemoryRequirements getMemoryRequirements() const; const VkMemoryRequirements getMemoryRequirements() const;
void getSubresourceLayout(const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) const;
void bind(VkDeviceMemory pDeviceMemory, VkDeviceSize pMemoryOffset); void bind(VkDeviceMemory pDeviceMemory, VkDeviceSize pMemoryOffset);
void copyTo(VkImage dstImage, const VkImageCopy& pRegion); void copyTo(VkImage dstImage, const VkImageCopy& pRegion);
void copyTo(VkBuffer dstBuffer, const VkBufferImageCopy& region); void copyTo(VkBuffer dstBuffer, const VkBufferImageCopy& region);
......
...@@ -830,8 +830,10 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const ...@@ -830,8 +830,10 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const
VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
{ {
TRACE("()"); TRACE("(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)",
UNIMPLEMENTED(); device, image, pSubresource, pLayout);
vk::Cast(image)->getSubresourceLayout(pSubresource, pLayout);
} }
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView) VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment