Commit a71549b1 by Fei Yang Committed by Commit Bot

Vulkan: Intermittent failures in many GLES2 CTS

The stage mask in vkCmdPipelineBarrier is incorrectly set. Bug: angleproject:3473 Change-Id: I4fea5994a391b0db0f81183f1c4d4ba47d387acb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1631849 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 7151fe54
...@@ -31,6 +31,7 @@ LG Electronics, Inc. ...@@ -31,6 +31,7 @@ LG Electronics, Inc.
IBM Inc. IBM Inc.
AdaptVis GmbH AdaptVis GmbH
Samsung Electronics, Inc. Samsung Electronics, Inc.
Arm Ltd.
Jacek Caban Jacek Caban
Mark Callow Mark Callow
......
...@@ -152,3 +152,6 @@ Samsung Electronics, Inc. ...@@ -152,3 +152,6 @@ Samsung Electronics, Inc.
Brandon Schade Brandon Schade
Minkyu Jeong Minkyu Jeong
Mohan Maiya Mohan Maiya
Arm Ltd.
Fei Yang
...@@ -2181,10 +2181,7 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context, ...@@ -2181,10 +2181,7 @@ 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 vk::ImageLayout textureLayout = program->isCompute() const auto &uniforms = program->getState().getUniforms();
? vk::ImageLayout::ComputeShaderReadOnly
: vk::ImageLayout::FragmentShaderReadOnly;
for (size_t textureUnit : activeTextures) for (size_t textureUnit : activeTextures)
{ {
gl::Texture *texture = textures[textureUnit]; gl::Texture *texture = textures[textureUnit];
...@@ -2204,6 +2201,17 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context, ...@@ -2204,6 +2201,17 @@ 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::FragmentShaderReadOnly;
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 // Ensure the image is in read-only layout
if (image.isLayoutChangeNecessary(textureLayout)) if (image.isLayoutChangeNecessary(textureLayout))
{ {
......
...@@ -188,6 +188,19 @@ constexpr angle::PackedEnumMap<ImageLayout, ImageMemoryBarrierData> kImageMemory ...@@ -188,6 +188,19 @@ constexpr angle::PackedEnumMap<ImageLayout, ImageMemoryBarrierData> kImageMemory
}, },
}, },
{ {
ImageLayout::AllGraphicsShadersReadOnly,
{
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_PIPELINE_STAGE_VERTEX_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::Present, ImageLayout::Present,
{ {
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
......
...@@ -615,19 +615,20 @@ class BufferHelper final : public CommandGraphResource ...@@ -615,19 +615,20 @@ class BufferHelper final : public CommandGraphResource
// are the same, they may occasionally be BOTTOM_OF_PIPE and TOP_OF_PIPE respectively. // are the same, they may occasionally be BOTTOM_OF_PIPE and TOP_OF_PIPE respectively.
enum class ImageLayout enum class ImageLayout
{ {
Undefined = 0, Undefined = 0,
ExternalPreInitialized = 1, ExternalPreInitialized = 1,
TransferSrc = 2, TransferSrc = 2,
TransferDst = 3, TransferDst = 3,
ComputeShaderReadOnly = 4, ComputeShaderReadOnly = 4,
ComputeShaderWrite = 5, ComputeShaderWrite = 5,
FragmentShaderReadOnly = 6, FragmentShaderReadOnly = 6,
ColorAttachment = 7, ColorAttachment = 7,
DepthStencilAttachment = 8, DepthStencilAttachment = 8,
Present = 9, AllGraphicsShadersReadOnly = 9,
Present = 10,
InvalidEnum = 10,
EnumCount = 10, InvalidEnum = 11,
EnumCount = 11,
}; };
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