diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp index 557cb753c..76730d929 100644 --- a/src/libANGLE/renderer/vulkan/ContextVk.cpp +++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp @@ -2432,7 +2432,6 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context, const gl::ActiveTextureMask &activeTextures = program->getActiveSamplersMask(); const gl::ActiveTextureTypeArray &textureTypes = program->getActiveSamplerTypes(); - const auto &uniforms = program->getState().getUniforms(); for (size_t textureUnit : activeTextures) { gl::Texture *texture = textures[textureUnit]; @@ -2454,16 +2453,11 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context, // 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. - // Find out the image is used in which shader stage. - vk::ImageLayout textureLayout = vk::ImageLayout::FragmentShaderReadOnly; + vk::ImageLayout textureLayout = vk::ImageLayout::AllGraphicsShadersReadOnly; if (program->isCompute()) { textureLayout = vk::ImageLayout::ComputeShaderReadOnly; } - else if (uniforms[textureUnit].isActive(gl::ShaderType::Vertex)) - { - textureLayout = vk::ImageLayout::AllGraphicsShadersReadOnly; - } // Ensure the image is in read-only layout if (image.isLayoutChangeNecessary(textureLayout)) diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp index 1783792de..ff0854ccc 100644 --- a/src/libANGLE/renderer/vulkan/TextureVk.cpp +++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp @@ -774,7 +774,7 @@ angle::Result TextureVk::setStorageExternalMemory(const gl::Context *context, vk::CommandBuffer *commandBuffer = nullptr; ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT, - vk::ImageLayout::FragmentShaderReadOnly, + vk::ImageLayout::AllGraphicsShadersReadOnly, rendererQueueFamilyIndex, commandBuffer); } @@ -806,7 +806,7 @@ angle::Result TextureVk::setEGLImageTarget(const gl::Context *context, vk::CommandBuffer *commandBuffer = nullptr; ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT, - vk::ImageLayout::FragmentShaderReadOnly, + vk::ImageLayout::AllGraphicsShadersReadOnly, rendererQueueFamilyIndex, commandBuffer); } diff --git a/src/libANGLE/renderer/vulkan/UtilsVk.cpp b/src/libANGLE/renderer/vulkan/UtilsVk.cpp index 2f53f7ced..bc47fd745 100644 --- a/src/libANGLE/renderer/vulkan/UtilsVk.cpp +++ b/src/libANGLE/renderer/vulkan/UtilsVk.cpp @@ -1063,11 +1063,11 @@ angle::Result UtilsVk::blitResolveImpl(ContextVk *contextVk, pipelineDesc.setScissor(gl_vk::GetRect(params.blitArea)); // Change source layout outside render pass - if (src->isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly)) + if (src->isLayoutChangeNecessary(vk::ImageLayout::AllGraphicsShadersReadOnly)) { vk::CommandBuffer *srcLayoutChange; ANGLE_TRY(src->recordCommands(contextVk, &srcLayoutChange)); - src->changeLayout(src->getAspectFlags(), vk::ImageLayout::FragmentShaderReadOnly, + src->changeLayout(src->getAspectFlags(), vk::ImageLayout::AllGraphicsShadersReadOnly, srcLayoutChange); } @@ -1394,11 +1394,11 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk, pipelineDesc.setScissor(scissor); // Change source layout outside render pass - if (src->isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly)) + if (src->isLayoutChangeNecessary(vk::ImageLayout::AllGraphicsShadersReadOnly)) { vk::CommandBuffer *srcLayoutChange; ANGLE_TRY(src->recordCommands(contextVk, &srcLayoutChange)); - src->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::FragmentShaderReadOnly, + src->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::AllGraphicsShadersReadOnly, srcLayoutChange); } diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp index cbd93752d..6aa21bb30 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp +++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp @@ -146,19 +146,6 @@ constexpr angle::PackedEnumMap kImageMemory true, }, }, - { - ImageLayout::FragmentShaderReadOnly, - { - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - // Transition to: all reads must happen after barrier. - VK_ACCESS_SHADER_READ_BIT, - // Transition from: RAR and WAR don't need memory barrier. - 0, - false, - }, - }, { ImageLayout::ColorAttachment, { diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.h b/src/libANGLE/renderer/vulkan/vk_helpers.h index b397e550f..158d9b2ce 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.h +++ b/src/libANGLE/renderer/vulkan/vk_helpers.h @@ -627,14 +627,13 @@ enum class ImageLayout TransferDst = 3, ComputeShaderReadOnly = 4, ComputeShaderWrite = 5, - FragmentShaderReadOnly = 6, + AllGraphicsShadersReadOnly = 6, ColorAttachment = 7, DepthStencilAttachment = 8, - AllGraphicsShadersReadOnly = 9, - Present = 10, + Present = 9, - InvalidEnum = 11, - EnumCount = 11, + InvalidEnum = 10, + EnumCount = 10, }; class ImageHelper final : public CommandGraphResource