Commit a1f1cce6 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: updateActiveImages: process each image once

There are two issues with processing the images multiple times: - The graph trips up because on the first addWriteDependency, the current writer pointer of the image will be set to the recorder, and which on the next addWriteDependency creates a self-dependency. - We transition the layout of the whole of the image, so doing that multiple times is inefficient. Bug: angleproject:4312 Change-Id: Ibae72e8698edf5db97139f48d68624d3e9a1d5db Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2022355Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 60a3d848
......@@ -3321,6 +3321,14 @@ angle::Result ContextVk::updateActiveImages(const gl::Context *context,
const gl::ActiveTextureMask &activeImages = program->getActiveImagesMask();
// Note: currently, the image layout is transitioned entirely even if only one level or layer is
// used. This is an issue if one subresource of the image is used as framebuffer attachment and
// the other as image. This is a similar issue to http://anglebug.com/2914. Another issue
// however is if multiple subresources of the same image are used at the same time.
// Inefficiencies aside, setting write dependency on the same image multiple times is not
// supported. The following makes sure write dependencies are set only once per image.
std::set<vk::ImageHelper *> alreadyProcessed;
for (size_t imageUnitIndex : activeImages)
{
const gl::ImageUnit &imageUnit = glState.getImageUnit(imageUnitIndex);
......@@ -3333,6 +3341,14 @@ angle::Result ContextVk::updateActiveImages(const gl::Context *context,
TextureVk *textureVk = vk::GetImpl(texture);
vk::ImageHelper *image = &textureVk->getImage();
mActiveImages[imageUnitIndex] = textureVk;
if (alreadyProcessed.find(image) != alreadyProcessed.end())
{
continue;
}
alreadyProcessed.insert(image);
// The image should be flushed and ready to use at this point. There may still be
// lingering staged updates in its staging buffer for unused texture mip levels or
// layers. Therefore we can't verify it has no staged updates right here.
......@@ -3349,7 +3365,7 @@ angle::Result ContextVk::updateActiveImages(const gl::Context *context,
imageLayout = vk::ImageLayout::ComputeShaderWrite;
}
// Ensure the image is in read-only layout
// Ensure the image is in the correct layout
if (image->isLayoutChangeNecessary(imageLayout))
{
vk::CommandBuffer *layoutChange;
......@@ -3360,8 +3376,6 @@ angle::Result ContextVk::updateActiveImages(const gl::Context *context,
}
image->addWriteDependency(this, recorder);
mActiveImages[imageUnitIndex] = textureVk;
}
return angle::Result::Continue;
......
......@@ -60,9 +60,7 @@
// Image related failures
4312 VULKAN : KHR-GLES31.core.shader_image_load_store.basic-glsl-misc-fs = SKIP
4312 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-sync-imageAccess = SKIP
4312 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-allMips-fs = SKIP
4313 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-sync-imageAccess2 = SKIP
4315 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-memory-order-vsfs = FAIL
4108 VULKAN : KHR-GLES31.core.shader_image_size.*-nonMS-* = 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