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: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Fei Yang 2019-05-28 09:44:43 +08:00 коммит произвёл Commit Bot
Родитель 7151fe54fe
Коммит a71549b112
5 изменённых файлов: 42 добавлений и 16 удалений

Просмотреть файл

@ -31,6 +31,7 @@ LG Electronics, Inc.
IBM Inc.
AdaptVis GmbH
Samsung Electronics, Inc.
Arm Ltd.
Jacek Caban
Mark Callow

Просмотреть файл

@ -152,3 +152,6 @@ Samsung Electronics, Inc.
Brandon Schade
Minkyu Jeong
Mohan Maiya
Arm Ltd.
Fei Yang

Просмотреть файл

@ -2181,10 +2181,7 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context,
const gl::ActiveTextureMask &activeTextures = program->getActiveSamplersMask();
const gl::ActiveTextureTypeArray &textureTypes = program->getActiveSamplerTypes();
const vk::ImageLayout textureLayout = program->isCompute()
? vk::ImageLayout::ComputeShaderReadOnly
: vk::ImageLayout::FragmentShaderReadOnly;
const auto &uniforms = program->getState().getUniforms();
for (size_t textureUnit : activeTextures)
{
gl::Texture *texture = textures[textureUnit];
@ -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
// 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
if (image.isLayoutChangeNecessary(textureLayout))
{

Просмотреть файл

@ -187,6 +187,19 @@ constexpr angle::PackedEnumMap<ImageLayout, ImageMemoryBarrierData> kImageMemory
false,
},
},
{
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,
{

Просмотреть файл

@ -615,19 +615,20 @@ class BufferHelper final : public CommandGraphResource
// are the same, they may occasionally be BOTTOM_OF_PIPE and TOP_OF_PIPE respectively.
enum class ImageLayout
{
Undefined = 0,
ExternalPreInitialized = 1,
TransferSrc = 2,
TransferDst = 3,
ComputeShaderReadOnly = 4,
ComputeShaderWrite = 5,
FragmentShaderReadOnly = 6,
ColorAttachment = 7,
DepthStencilAttachment = 8,
Present = 9,
Undefined = 0,
ExternalPreInitialized = 1,
TransferSrc = 2,
TransferDst = 3,
ComputeShaderReadOnly = 4,
ComputeShaderWrite = 5,
FragmentShaderReadOnly = 6,
ColorAttachment = 7,
DepthStencilAttachment = 8,
AllGraphicsShadersReadOnly = 9,
Present = 10,
InvalidEnum = 10,
EnumCount = 10,
InvalidEnum = 11,
EnumCount = 11,
};
class ImageHelper final : public CommandGraphResource