Vulkan: Bugfix in TextureVk::setSubImage and DynamicBuffer
Bug 1) The offset wasn't plumbed through for setSubImage.
Bug 2) The DynamicBuffer allocation sometime allocates a bit more
than requested, but we were using the size requested as the next offset
instead of the actual allocated size. This could get us in a situation
in certain corner cases where the next allocation would be done on the
said buffer instead of using a new allocation as it should.
Also enables a bunch of new texture_specification_* tests that were
unable to run successfully without these 2 bug fixes.
Found a weird issue on WIN AMD only and suppressed these tests for now.
Will investigate part of the same bug number as a separate change.
Bug: angleproject:2495
Bug: angleproject:2492
Change-Id: I490b1bf2d1795b7a1033365e29eac12a8bc50bff
Reviewed-on: https://chromium-review.googlesource.com/1024380
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Luc Ferron <lucferron@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp
index b72aec3..315ad32 100644
--- a/src/libANGLE/renderer/vulkan/TextureVk.cpp
+++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp
@@ -74,6 +74,7 @@
gl::Error PixelBuffer::stageSubresourceUpdate(ContextVk *contextVk,
const gl::ImageIndex &index,
const gl::Extents &extents,
+ const gl::Offset &offset,
const gl::InternalFormat &formatInfo,
const gl::PixelUnpackState &unpack,
GLenum type,
@@ -131,7 +132,7 @@
copy.imageSubresource.baseArrayLayer = index.hasLayer() ? index.getLayerIndex() : 0;
copy.imageSubresource.layerCount = index.getLayerCount();
- gl_vk::GetOffset(gl::Offset(), ©.imageOffset);
+ gl_vk::GetOffset(offset, ©.imageOffset);
gl_vk::GetExtent(extents, ©.imageExtent);
mSubresourceUpdates.emplace_back(bufferHandle, copy);
@@ -241,8 +242,8 @@
// Handle initial data.
if (pixels)
{
- ANGLE_TRY(mPixelBuffer.stageSubresourceUpdate(contextVk, index, size, formatInfo, unpack,
- type, pixels));
+ ANGLE_TRY(mPixelBuffer.stageSubresourceUpdate(contextVk, index, size, gl::Offset(),
+ formatInfo, unpack, type, pixels));
}
return gl::NoError();
@@ -258,9 +259,9 @@
{
ContextVk *contextVk = vk::GetImpl(context);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format, type);
- ANGLE_TRY(mPixelBuffer.stageSubresourceUpdate(contextVk, index,
- gl::Extents(area.width, area.height, area.depth),
- formatInfo, unpack, type, pixels));
+ ANGLE_TRY(mPixelBuffer.stageSubresourceUpdate(
+ contextVk, index, gl::Extents(area.width, area.height, area.depth),
+ gl::Offset(area.x, area.y, area.z), formatInfo, unpack, type, pixels));
return gl::NoError();
}