Commit 2ad30d7a by Ian Elliott Committed by Commit Bot

Vulkan: honor compressed texture block width/height

When a texture's base or max mipmap level is changed, ANGLE creates a new VkTexture (and potentially copies lots of data old->staging buffer->new). However, ANGLE wasn't looking at the texture's format, and for a compressed format ANGLE wasn't looking at/using the texture format's compressed block width and height. Bug: b/155499736 Change-Id: I11a12028aee998fa23d503c2c0db39fbb49ae6ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2180881 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com>
parent 41f7bcce
...@@ -1210,9 +1210,16 @@ angle::Result TextureVk::copyAndStageImageSubresource(ContextVk *contextVk, ...@@ -1210,9 +1210,16 @@ angle::Result TextureVk::copyAndStageImageSubresource(ContextVk *contextVk,
// Stage an update to the new image // Stage an update to the new image
ASSERT(stagingBuffer); ASSERT(stagingBuffer);
uint32_t bufferRowLength = updatedExtents.width;
uint32_t bufferImageHeight = updatedExtents.height;
if (desc.format.info->compressed)
{
bufferRowLength = std::max(bufferRowLength, desc.format.info->compressedBlockWidth);
bufferImageHeight = std::max(bufferImageHeight, desc.format.info->compressedBlockHeight);
}
ANGLE_TRY(mImage->stageSubresourceUpdateFromBuffer( ANGLE_TRY(mImage->stageSubresourceUpdateFromBuffer(
contextVk, bufferSize, stagingDstMipLevel, currentLayer, layerCount, updatedExtents, offset, contextVk, bufferSize, stagingDstMipLevel, currentLayer, layerCount, bufferRowLength,
stagingBuffer, stagingBufferOffsets)); bufferImageHeight, updatedExtents, offset, stagingBuffer, stagingBufferOffsets));
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -2961,6 +2961,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk ...@@ -2961,6 +2961,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk
uint32_t mipLevel, uint32_t mipLevel,
uint32_t baseArrayLayer, uint32_t baseArrayLayer,
uint32_t layerCount, uint32_t layerCount,
uint32_t bufferRowLength,
uint32_t bufferImageHeight,
const VkExtent3D &extent, const VkExtent3D &extent,
const VkOffset3D &offset, const VkOffset3D &offset,
BufferHelper *bufferHelper, BufferHelper *bufferHelper,
...@@ -2971,8 +2973,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk ...@@ -2971,8 +2973,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk
VkBufferImageCopy copy[2] = {}; VkBufferImageCopy copy[2] = {};
copy[0].bufferOffset = stagingOffsets[0]; copy[0].bufferOffset = stagingOffsets[0];
copy[0].bufferRowLength = extent.width; copy[0].bufferRowLength = bufferRowLength;
copy[0].bufferImageHeight = extent.height; copy[0].bufferImageHeight = bufferImageHeight;
copy[0].imageSubresource.aspectMask = getAspectFlags(); copy[0].imageSubresource.aspectMask = getAspectFlags();
copy[0].imageSubresource.mipLevel = mipLevel; copy[0].imageSubresource.mipLevel = mipLevel;
copy[0].imageSubresource.baseArrayLayer = baseArrayLayer; copy[0].imageSubresource.baseArrayLayer = baseArrayLayer;
...@@ -2986,8 +2988,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk ...@@ -2986,8 +2988,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk
copy[0].imageSubresource.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; copy[0].imageSubresource.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
// Copy stencil aspect separately // Copy stencil aspect separately
copy[1].bufferOffset = stagingOffsets[1]; copy[1].bufferOffset = stagingOffsets[1];
copy[1].bufferRowLength = extent.width; copy[1].bufferRowLength = bufferRowLength;
copy[1].bufferImageHeight = extent.height; copy[1].bufferImageHeight = bufferImageHeight;
copy[1].imageSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT; copy[1].imageSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
copy[1].imageSubresource.mipLevel = mipLevel; copy[1].imageSubresource.mipLevel = mipLevel;
copy[1].imageSubresource.baseArrayLayer = baseArrayLayer; copy[1].imageSubresource.baseArrayLayer = baseArrayLayer;
......
...@@ -910,6 +910,8 @@ class ImageHelper final : public Resource, public angle::Subject ...@@ -910,6 +910,8 @@ class ImageHelper final : public Resource, public angle::Subject
uint32_t mipLevel, uint32_t mipLevel,
uint32_t baseArrayLayer, uint32_t baseArrayLayer,
uint32_t layerCount, uint32_t layerCount,
uint32_t bufferRowLength,
uint32_t bufferImageHeight,
const VkExtent3D &extent, const VkExtent3D &extent,
const VkOffset3D &offset, const VkOffset3D &offset,
BufferHelper *stagingBuffer, BufferHelper *stagingBuffer,
......
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