Commit f912b294 by Cody Northrop Committed by Commit Bot

Vulkan: Handle 2Darray base/max level change

When staging updates to the vkImage based on texture base/max level change, we weren't properly handling texture 2Darray. This CL changes several helpers to explicitly accept Vulkan extents and offsets so it is clear how things should be treated. Bug: angleproject:3991 Test: dEQP-GLES3.functional.shaders.texture_functions.texturesize.*sampler2darray* Change-Id: Iae80ce7201180224fc3bb7823f21a360950c515d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1854020Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
parent a21362f5
...@@ -1168,7 +1168,7 @@ angle::Result TextureVk::changeLevels(ContextVk *contextVk, GLuint baseLevel, GL ...@@ -1168,7 +1168,7 @@ angle::Result TextureVk::changeLevels(ContextVk *contextVk, GLuint baseLevel, GL
// First we populate the staging buffer with current level data // First we populate the staging buffer with current level data
const gl::ImageDesc &desc = const gl::ImageDesc &desc =
mState.getImageDesc(gl::TextureTypeToTarget(mState.getType(), layer), level); mState.getImageDesc(gl::TextureTypeToTarget(mState.getType(), layer), level);
const gl::Extents &extents = desc.size; const gl::Extents &glExtents = desc.size;
const gl::InternalFormat &info = *desc.format.info; const gl::InternalFormat &info = *desc.format.info;
// We need to adjust the source Vulkan level to reflect the previous base level. // We need to adjust the source Vulkan level to reflect the previous base level.
...@@ -1176,26 +1176,27 @@ angle::Result TextureVk::changeLevels(ContextVk *contextVk, GLuint baseLevel, GL ...@@ -1176,26 +1176,27 @@ angle::Result TextureVk::changeLevels(ContextVk *contextVk, GLuint baseLevel, GL
uint32_t srcLevelVK = baseLevelChanged ? level - previousBaseLevel : level; uint32_t srcLevelVK = baseLevelChanged ? level - previousBaseLevel : level;
ASSERT(srcLevelVK <= mImage->getLevelCount()); ASSERT(srcLevelVK <= mImage->getLevelCount());
// Adjust offset and depth based on our knowledge of image type here // Gather Vulkan dimensions based on our knowledge of image type here
gl::Box area(0, 0, 0, extents.width, extents.height, extents.depth); VkOffset3D vkOffset = {0};
if (gl::IsArrayTextureType(mState.getType())) VkExtent3D vkExtent;
{ uint32_t layerCountDontCare;
area.z = 0; gl_vk::GetExtentsAndLayerCount(mState.getType(), glExtents, &vkExtent,
area.depth = 1; &layerCountDontCare);
}
// Now copy from the image to the staging buffer // Now copy from the image to the staging buffer
vk::BufferHelper *stagingBuffer = nullptr; vk::BufferHelper *stagingBuffer = nullptr;
VkDeviceSize stagingBufferOffset = 0; VkDeviceSize stagingBufferOffset = 0;
gl::Box area(vkOffset.x, vkOffset.y, vkOffset.z, vkExtent.width, vkExtent.height,
vkExtent.depth);
ANGLE_TRY(copyImageDataToBuffer(contextVk, srcLevelVK, 1, layer, area, &stagingBuffer, ANGLE_TRY(copyImageDataToBuffer(contextVk, srcLevelVK, 1, layer, area, &stagingBuffer,
&stagingBufferOffset, nullptr)); &stagingBufferOffset, nullptr));
// Stage an update to the new image that we will populate with existing mip levels // Stage an update to the new image that we will populate with existing mip levels
// We're providing the buffer handle and offset to use, since we *just* populated it // We're providing the buffer handle and offset to use, since we *just* populated it
size_t bufferSize = extents.width * extents.height * extents.depth * info.pixelBytes; size_t bufferSize = vkExtent.width * vkExtent.height * vkExtent.depth * info.pixelBytes;
ANGLE_TRY(mImage->stageSubresourceUpdateFromBuffer(contextVk, bufferSize, level, layer, ANGLE_TRY(mImage->stageSubresourceUpdateFromBuffer(contextVk, bufferSize, level, layer,
1, extents, gl::Offset(), 1, vkExtent, vkOffset, stagingBuffer,
stagingBuffer, stagingBufferOffset)); stagingBufferOffset));
} }
} }
......
...@@ -2359,8 +2359,8 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk ...@@ -2359,8 +2359,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,
const gl::Extents &glExtents, const VkExtent3D &extent,
const gl::Offset &offset, const VkOffset3D &offset,
BufferHelper *bufferHelper, BufferHelper *bufferHelper,
VkDeviceSize stagingOffset) VkDeviceSize stagingOffset)
{ {
...@@ -2369,18 +2369,21 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk ...@@ -2369,18 +2369,21 @@ angle::Result ImageHelper::stageSubresourceUpdateFromBuffer(ContextVk *contextVk
VkBufferImageCopy copy = {}; VkBufferImageCopy copy = {};
copy.bufferOffset = stagingOffset; copy.bufferOffset = stagingOffset;
copy.bufferRowLength = glExtents.width; copy.bufferRowLength = extent.width;
copy.bufferImageHeight = glExtents.height; copy.bufferImageHeight = extent.height;
copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
copy.imageSubresource.mipLevel = mipLevel; copy.imageSubresource.mipLevel = mipLevel;
copy.imageSubresource.baseArrayLayer = baseArrayLayer; copy.imageSubresource.baseArrayLayer = baseArrayLayer;
copy.imageSubresource.layerCount = layerCount; 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;
ASSERT(getAspectFlags() == VK_IMAGE_ASPECT_COLOR_BIT); ASSERT(getAspectFlags() == VK_IMAGE_ASPECT_COLOR_BIT);
gl_vk::GetOffset(offset, &copy.imageOffset);
gl_vk::GetExtent(glExtents, &copy.imageExtent);
mSubresourceUpdates.emplace_back(bufferHelper, copy); mSubresourceUpdates.emplace_back(bufferHelper, copy);
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -791,8 +791,8 @@ class ImageHelper final : public CommandGraphResource ...@@ -791,8 +791,8 @@ class ImageHelper final : public CommandGraphResource
uint32_t mipLevel, uint32_t mipLevel,
uint32_t baseArrayLayer, uint32_t baseArrayLayer,
uint32_t layerCount, uint32_t layerCount,
const gl::Extents &glExtents, const VkExtent3D &extent,
const gl::Offset &offset, const VkOffset3D &offset,
BufferHelper *stagingBuffer, BufferHelper *stagingBuffer,
VkDeviceSize stagingOffset); VkDeviceSize stagingOffset);
......
...@@ -575,16 +575,6 @@ ...@@ -575,16 +575,6 @@
3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.samplercubeshadow_vertex = 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 3949 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.samplercubeshadow_fragment = SKIP
// 2D array textureSize issuing validation error.
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.isampler2darray_fragment = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.isampler2darray_vertex = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2darray_fixed_fragment = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2darray_fixed_vertex = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2darray_float_fragment = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.sampler2darray_float_vertex = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.usampler2darray_fragment = SKIP
3991 VULKAN : dEQP-GLES3.functional.shaders.texture_functions.texturesize.usampler2darray_vertex = SKIP
// Misc unimplemented: // Misc unimplemented:
// - Primitive restart with line loops: // - Primitive restart with line loops:
......
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