Commit d7500aa8 by Fei Yang Committed by Commit Bot

Vulkan: Regression issue on AngryBird for read bandwidth

Use AllGraphicsShaderReadOnly as the image layout for graphics path. Bug: angleproject:3473 Change-Id: I1e653890e69f347b2aba4a0156a5d5b86109fd0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1732617 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 4248e115
...@@ -2432,7 +2432,6 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context, ...@@ -2432,7 +2432,6 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context,
const gl::ActiveTextureMask &activeTextures = program->getActiveSamplersMask(); const gl::ActiveTextureMask &activeTextures = program->getActiveSamplersMask();
const gl::ActiveTextureTypeArray &textureTypes = program->getActiveSamplerTypes(); const gl::ActiveTextureTypeArray &textureTypes = program->getActiveSamplerTypes();
const auto &uniforms = program->getState().getUniforms();
for (size_t textureUnit : activeTextures) for (size_t textureUnit : activeTextures)
{ {
gl::Texture *texture = textures[textureUnit]; gl::Texture *texture = textures[textureUnit];
...@@ -2454,16 +2453,11 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context, ...@@ -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 // 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. // 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::AllGraphicsShadersReadOnly;
vk::ImageLayout textureLayout = vk::ImageLayout::FragmentShaderReadOnly;
if (program->isCompute()) if (program->isCompute())
{ {
textureLayout = vk::ImageLayout::ComputeShaderReadOnly; textureLayout = vk::ImageLayout::ComputeShaderReadOnly;
} }
else if (uniforms[textureUnit].isActive(gl::ShaderType::Vertex))
{
textureLayout = vk::ImageLayout::AllGraphicsShadersReadOnly;
}
// Ensure the image is in read-only layout // Ensure the image is in read-only layout
if (image.isLayoutChangeNecessary(textureLayout)) if (image.isLayoutChangeNecessary(textureLayout))
......
...@@ -774,7 +774,7 @@ angle::Result TextureVk::setStorageExternalMemory(const gl::Context *context, ...@@ -774,7 +774,7 @@ angle::Result TextureVk::setStorageExternalMemory(const gl::Context *context,
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT, mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT,
vk::ImageLayout::FragmentShaderReadOnly, vk::ImageLayout::AllGraphicsShadersReadOnly,
rendererQueueFamilyIndex, commandBuffer); rendererQueueFamilyIndex, commandBuffer);
} }
...@@ -806,7 +806,7 @@ angle::Result TextureVk::setEGLImageTarget(const gl::Context *context, ...@@ -806,7 +806,7 @@ angle::Result TextureVk::setEGLImageTarget(const gl::Context *context,
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT, mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT,
vk::ImageLayout::FragmentShaderReadOnly, vk::ImageLayout::AllGraphicsShadersReadOnly,
rendererQueueFamilyIndex, commandBuffer); rendererQueueFamilyIndex, commandBuffer);
} }
......
...@@ -1063,11 +1063,11 @@ angle::Result UtilsVk::blitResolveImpl(ContextVk *contextVk, ...@@ -1063,11 +1063,11 @@ angle::Result UtilsVk::blitResolveImpl(ContextVk *contextVk,
pipelineDesc.setScissor(gl_vk::GetRect(params.blitArea)); pipelineDesc.setScissor(gl_vk::GetRect(params.blitArea));
// Change source layout outside render pass // Change source layout outside render pass
if (src->isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly)) if (src->isLayoutChangeNecessary(vk::ImageLayout::AllGraphicsShadersReadOnly))
{ {
vk::CommandBuffer *srcLayoutChange; vk::CommandBuffer *srcLayoutChange;
ANGLE_TRY(src->recordCommands(contextVk, &srcLayoutChange)); ANGLE_TRY(src->recordCommands(contextVk, &srcLayoutChange));
src->changeLayout(src->getAspectFlags(), vk::ImageLayout::FragmentShaderReadOnly, src->changeLayout(src->getAspectFlags(), vk::ImageLayout::AllGraphicsShadersReadOnly,
srcLayoutChange); srcLayoutChange);
} }
...@@ -1394,11 +1394,11 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk, ...@@ -1394,11 +1394,11 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk,
pipelineDesc.setScissor(scissor); pipelineDesc.setScissor(scissor);
// Change source layout outside render pass // Change source layout outside render pass
if (src->isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly)) if (src->isLayoutChangeNecessary(vk::ImageLayout::AllGraphicsShadersReadOnly))
{ {
vk::CommandBuffer *srcLayoutChange; vk::CommandBuffer *srcLayoutChange;
ANGLE_TRY(src->recordCommands(contextVk, &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); srcLayoutChange);
} }
......
...@@ -147,19 +147,6 @@ constexpr angle::PackedEnumMap<ImageLayout, ImageMemoryBarrierData> kImageMemory ...@@ -147,19 +147,6 @@ constexpr angle::PackedEnumMap<ImageLayout, ImageMemoryBarrierData> kImageMemory
}, },
}, },
{ {
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, ImageLayout::ColorAttachment,
{ {
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
......
...@@ -627,14 +627,13 @@ enum class ImageLayout ...@@ -627,14 +627,13 @@ enum class ImageLayout
TransferDst = 3, TransferDst = 3,
ComputeShaderReadOnly = 4, ComputeShaderReadOnly = 4,
ComputeShaderWrite = 5, ComputeShaderWrite = 5,
FragmentShaderReadOnly = 6, AllGraphicsShadersReadOnly = 6,
ColorAttachment = 7, ColorAttachment = 7,
DepthStencilAttachment = 8, DepthStencilAttachment = 8,
AllGraphicsShadersReadOnly = 9, Present = 9,
Present = 10,
InvalidEnum = 11, InvalidEnum = 10,
EnumCount = 11, EnumCount = 10,
}; };
class ImageHelper final : public CommandGraphResource class ImageHelper final : public CommandGraphResource
......
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