Commit 16da9515 by Tobin Ehlis Committed by Commit Bot

Vulkan:ImageHelper read combined DS textures

Update ImageHelper to be able to copy both the depth and stencil aspects of a DS image to a buffer. The aspects are copied separately with the depth data preceding the stencil data. This allows dEQP-GLES31.functional.stencil_texturing.misc.base_level test to pass. Added exception for ANDROID VULKAN where test still fails and new tracking bug (4080) for this case. Bug: angleproject:3949 Bug: angleproject:4080 Change-Id: Ib6104d7fa9f516154131f3e82161078ba216cfe1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1897649Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
parent 322220a0
......@@ -969,11 +969,13 @@ angle::Result TextureVk::copyImageDataToBufferAndGetData(ContextVk *contextVk,
gl::Box area(0, 0, 0, sourceArea.width, sourceArea.height, 1);
vk::BufferHelper *copyBuffer = nullptr;
VkDeviceSize sourceCopyOffset = 0;
vk::BufferHelper *copyBuffer = nullptr;
vk::StagingBufferOffsetArray sourceCopyOffsets = {0, 0};
size_t bufferSize = 0;
ANGLE_TRY(mImage->copyImageDataToBuffer(contextVk, sourceLevel, layerCount, 0, area,
&copyBuffer, &sourceCopyOffset, outDataPtr));
&copyBuffer, &bufferSize, &sourceCopyOffsets,
outDataPtr));
// Explicitly finish. If new use cases arise where we don't want to block we can change this.
ANGLE_TRY(contextVk->finishImpl());
......@@ -1106,8 +1108,7 @@ angle::Result TextureVk::copyImageDataToStagingBuffer(ContextVk *contextVk,
uint32_t stagingDstMipLevel,
vk::BufferHelper **stagingBuffer)
{
const gl::Extents &baseLevelExtents = desc.size;
const gl::InternalFormat &baseLevelFormat = *desc.format.info;
const gl::Extents &baseLevelExtents = desc.size;
VkExtent3D updatedExtents;
VkOffset3D offset = {};
......@@ -1123,18 +1124,18 @@ angle::Result TextureVk::copyImageDataToStagingBuffer(ContextVk *contextVk,
}
// Copy from the base level image to the staging buffer
VkDeviceSize stagingBufferOffset = 0;
vk::StagingBufferOffsetArray stagingBufferOffsets = {0, 0};
size_t bufferSize = 0;
ANGLE_TRY(mImage->copyImageDataToBuffer(contextVk, sourceMipLevel, layerCount, currentLayer,
area, stagingBuffer, &stagingBufferOffset, nullptr));
area, stagingBuffer, &bufferSize, &stagingBufferOffsets,
nullptr));
// Stage an update to the new image
size_t bufferSize = updatedExtents.width * updatedExtents.height * updatedExtents.depth *
baseLevelFormat.pixelBytes;
ASSERT(*stagingBuffer);
ANGLE_TRY(mImage->stageSubresourceUpdateFromBuffer(
contextVk, bufferSize, stagingDstMipLevel, currentLayer, layerCount, updatedExtents, offset,
*stagingBuffer, stagingBufferOffset));
*stagingBuffer, stagingBufferOffsets));
// Set up write dependency, we are writing to this buffer from the old image.
(*stagingBuffer)->onWrite(contextVk, mImage, 0, VK_ACCESS_TRANSFER_WRITE_BIT);
......
......@@ -35,6 +35,8 @@ constexpr VkBufferUsageFlags kStagingBufferFlags =
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
constexpr size_t kStagingBufferSize = 1024 * 16;
using StagingBufferOffsetArray = std::array<VkDeviceSize, 2>;
struct TextureUnit final
{
TextureVk *texture;
......@@ -731,6 +733,8 @@ class ImageHelper final : public CommandGraphResource
bool valid() const { return mImage.valid(); }
VkImageAspectFlags getAspectFlags() const;
// True if image contains both depth & stencil aspects
bool isCombinedDepthStencilFormat() const;
void destroy(VkDevice device);
void init2DWeakReference(VkImage handle,
......@@ -806,7 +810,7 @@ class ImageHelper final : public CommandGraphResource
const VkExtent3D &extent,
const VkOffset3D &offset,
BufferHelper *stagingBuffer,
VkDeviceSize stagingOffset);
StagingBufferOffsetArray stagingOffsets);
angle::Result stageSubresourceUpdateFromFramebuffer(const gl::Context *context,
const gl::ImageIndex &index,
......@@ -839,7 +843,7 @@ class ImageHelper final : public CommandGraphResource
size_t sizeInBytes,
uint8_t **ptrOut,
BufferHelper **bufferOut,
VkDeviceSize *offsetOut,
StagingBufferOffsetArray *offsetOut,
bool *newBufferAllocatedOut);
// Flushes staged updates to a range of levels and layers from start to (but not including) end.
......@@ -888,7 +892,8 @@ class ImageHelper final : public CommandGraphResource
uint32_t baseLayer,
const gl::Box &sourceArea,
BufferHelper **bufferOut,
VkDeviceSize *bufferOffsetOut,
size_t *bufferSize,
StagingBufferOffsetArray *bufferOffsetsOut,
uint8_t **outDataPtr);
static angle::Result GetReadPixelsParams(ContextVk *contextVk,
......
......@@ -637,7 +637,7 @@
3683 VULKAN PIXEL2ORXL : dEQP-GLES31.functional.stencil_texturing.misc.compare_mode_effect = FAIL
// Need to support non-color when staging image updates
3949 VULKAN : dEQP-GLES31.functional.stencil_texturing.misc.base_level = SKIP
4080 ANDROID VULKAN : dEQP-GLES31.functional.stencil_texturing.misc.base_level = SKIP
// Multisampled textures:
3565 VULKAN : dEQP-GLES31.functional.texture.multisample.* = SKIP
......
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