Commit c9e0edc2 by Geoff Lang Committed by Commit Bot

Handle 3D texture entire-mip initialization for FBO attachments

FramebufferAttachmentObject::initializeContents clears the entire mip level for layered textures (not including cube map). This was done by special casing 2D array and 2D multisample array textures but did not work for 3D. Generalize the logic to work for all layered texture types. Handle clearing the entire 3D texture mip in Vulkan. TEST=conformance2/misc/uninitialized-test-2.html BUG=angleproject:4602 Change-Id: I35bb9fc3304f0553e8de68d205b0843845bf7549 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2174264Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 5b16123d
...@@ -316,19 +316,14 @@ angle::Result FramebufferAttachmentObject::initializeContents(const Context *con ...@@ -316,19 +316,14 @@ angle::Result FramebufferAttachmentObject::initializeContents(const Context *con
ASSERT(context->isRobustResourceInitEnabled()); ASSERT(context->isRobustResourceInitEnabled());
// Because gl::Texture cannot support tracking individual layer dirtiness, we only handle // Because gl::Texture cannot support tracking individual layer dirtiness, we only handle
// initializing entire mip levels for 2D array textures. // initializing entire mip levels for textures with layers
if (imageIndex.getType() == TextureType::_2DArray && imageIndex.hasLayer()) if (imageIndex.usesTex3D() && imageIndex.hasLayer())
{ {
// Compute the layer count so we get a correct 2D array index. // Compute the layer count so we get a correct layer index.
const gl::Extents &size = getAttachmentSize(imageIndex); const gl::Extents &size = getAttachmentSize(imageIndex);
ImageIndex fullMipIndex = ImageIndex::Make2DArrayRange( ImageIndex fullMipIndex = ImageIndex::MakeFromType(
imageIndex.getLevelIndex(), ImageIndex::kEntireLevel, size.depth); imageIndex.getType(), imageIndex.getLevelIndex(), ImageIndex::kEntireLevel, size.depth);
return getAttachmentImpl()->initializeContents(context, fullMipIndex);
}
else if (imageIndex.getType() == TextureType::_2DMultisampleArray && imageIndex.hasLayer())
{
ImageIndex fullMipIndex = ImageIndex::Make2DMultisampleArray(ImageIndex::kEntireLevel);
return getAttachmentImpl()->initializeContents(context, fullMipIndex); return getAttachmentImpl()->initializeContents(context, fullMipIndex);
} }
else else
......
...@@ -3807,7 +3807,8 @@ ImageHelper::SubresourceUpdate::SubresourceUpdate(VkImageAspectFlags aspectFlags ...@@ -3807,7 +3807,8 @@ ImageHelper::SubresourceUpdate::SubresourceUpdate(VkImageAspectFlags aspectFlags
clear.value = clearValue; clear.value = clearValue;
clear.levelIndex = imageIndex.getLevelIndex(); clear.levelIndex = imageIndex.getLevelIndex();
clear.layerIndex = imageIndex.hasLayer() ? imageIndex.getLayerIndex() : 0; clear.layerIndex = imageIndex.hasLayer() ? imageIndex.getLayerIndex() : 0;
clear.layerCount = imageIndex.getLayerCount(); clear.layerCount =
imageIndex.hasLayer() ? imageIndex.getLayerCount() : VK_REMAINING_ARRAY_LAYERS;
} }
ImageHelper::SubresourceUpdate::SubresourceUpdate(const SubresourceUpdate &other) ImageHelper::SubresourceUpdate::SubresourceUpdate(const SubresourceUpdate &other)
......
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