Commit bbf0ce28 by Tobin Ehlis Committed by Commit Bot

Vulkan:Add support to stage D or S textures

Correctly set image aspect for depth or stencil texture staging. This fixes 6 failing dEQP 3.0 tests and an end2end test. Note that DS combined aspect textures will need special handling to read each aspect separately which is not included in this fix. Bug: angleproject:3949 Change-Id: I8e3f8166bdd31e2c002752b2f5c107ba411b2b0d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1855964 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com>
parent 741c0aa6
......@@ -990,8 +990,14 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk,
vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
// http://anglebug.com/3949: Need to handle DS combined aspect, will require copying D & S
// separately. See ImageHelper::stageSubresourceUpdate for DS copy buff->image example.
ASSERT(mImage->getAspectFlags() == VK_IMAGE_ASPECT_COLOR_BIT ||
mImage->getAspectFlags() == VK_IMAGE_ASPECT_DEPTH_BIT ||
mImage->getAspectFlags() == VK_IMAGE_ASPECT_STENCIL_BIT);
// Transition the image to readable layout
mImage->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferSrc, commandBuffer);
mImage->changeLayout(mImage->getAspectFlags(), vk::ImageLayout::TransferSrc, commandBuffer);
// Allocate staging buffer data
ANGLE_TRY(mImage->allocateStagingMemory(contextVk, sourceCopyAllocationSize, outDataPtr,
......@@ -1007,7 +1013,7 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk,
region.imageOffset.x = sourceArea.x;
region.imageOffset.y = sourceArea.y;
region.imageOffset.z = sourceArea.z;
region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.imageSubresource.aspectMask = mImage->getAspectFlags();
region.imageSubresource.baseArrayLayer = baseLayer;
region.imageSubresource.layerCount = layerCount;
region.imageSubresource.mipLevel = static_cast<uint32_t>(sourceLevel);
......
......@@ -2371,18 +2371,16 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk
copy.bufferOffset = stagingOffset;
copy.bufferRowLength = extent.width;
copy.bufferImageHeight = extent.height;
copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
copy.imageSubresource.aspectMask = getAspectFlags();
copy.imageSubresource.mipLevel = mipLevel;
copy.imageSubresource.baseArrayLayer = baseArrayLayer;
copy.imageSubresource.layerCount = layerCount;
copy.imageOffset.x = offset.x;
copy.imageOffset.y = offset.y;
copy.imageOffset.z = offset.z;
copy.imageExtent.width = extent.width;
copy.imageExtent.height = extent.height;
copy.imageExtent.depth = extent.depth;
copy.imageOffset = offset;
copy.imageExtent = extent;
ASSERT(getAspectFlags() == VK_IMAGE_ASPECT_COLOR_BIT);
ASSERT(getAspectFlags() == VK_IMAGE_ASPECT_COLOR_BIT ||
getAspectFlags() == VK_IMAGE_ASPECT_DEPTH_BIT ||
getAspectFlags() == VK_IMAGE_ASPECT_STENCIL_BIT);
mSubresourceUpdates.emplace_back(bufferHelper, copy);
......
......@@ -556,14 +556,6 @@
// - Primitive restart with line loops:
2672 VULKAN : dEQP-GLES3.functional.primitive_restart.*.line_loop.*instanced = SKIP
// Texture staging buffer needs non-color support
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2dshadow_vertex = SKIP
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2dshadow_fragment = SKIP
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2darrayshadow_vertex = SKIP
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2darrayshadow_fragment = SKIP
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.samplercubeshadow_vertex = SKIP
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.samplercubeshadow_fragment = SKIP
// Misc unimplemented:
// Failures on newer NVIDIA drivers (411.95) and passes on older drivers (388.16). Passes on 418.12 on Linux.
......
......@@ -2677,9 +2677,6 @@ TEST_P(ShadowSamplerPlusSampler3DTestES3, ShadowSamplerPlusSampler3DDraw)
// samplerCubeShadow: TextureCube + SamplerComparisonState
TEST_P(SamplerTypeMixTestES3, SamplerTypeMixDraw)
{
// TODO(cnorthrop): Requires non-color staging buffer support. http://anglebug.com/3949
ANGLE_SKIP_TEST_IF(IsVulkan());
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
GLubyte texData[4];
......@@ -2715,6 +2712,8 @@ TEST_P(SamplerTypeMixTestES3, SamplerTypeMixDraw)
glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT,
depthTexData);
// http://anglebug.com/3949: TODO: Add a DS texture case
EXPECT_GL_NO_ERROR();
glUseProgram(mProgram);
......
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