Vulkan: fix default MSAA framebuffer clear issue.

Bug: b/290813597
Change-Id: I134c5a99382ca30dbd885a17dfa3c7ac227480ff
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4698113
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Hailin Zhang <hailinzhang@google.com>
This commit is contained in:
Hailin Zhang
2023-07-18 12:52:37 -07:00
committed by Angle LUCI CQ
parent 52fe3116ea
commit 6eea5ff4db
2 changed files with 31 additions and 2 deletions

View File

@@ -2040,8 +2040,16 @@ angle::Result WindowSurfaceVk::prePresentSubmit(ContextVk *contextVk,
vk::Framebuffer &currentFramebuffer = chooseFramebuffer(SwapchainResolveMode::Disabled);
// Make sure deferred clears are applied, if any.
ANGLE_TRY(
image.image->flushStagedUpdates(contextVk, gl::LevelIndex(0), gl::LevelIndex(1), 0, 1, {}));
if (mColorImageMS.valid())
{
ANGLE_TRY(mColorImageMS.flushStagedUpdates(contextVk, gl::LevelIndex(0), gl::LevelIndex(1),
0, 1, {}));
}
else
{
ANGLE_TRY(image.image->flushStagedUpdates(contextVk, gl::LevelIndex(0), gl::LevelIndex(1),
0, 1, {}));
}
// If user calls eglSwapBuffer without use it, image may already in Present layout (if swap
// without any draw) or Undefined (first time present). In this case, if

View File

@@ -756,6 +756,27 @@ TEST_P(MultisampleResolveTest, DISABLED_ResolveSubpassMSImage)
angle::Sleep(2000);
}
// This is a test that must be verified visually.
//
// Tests that clear of the default framebuffer with multisample applies to the window.
TEST_P(MultisampleTestES3, DISABLED_ClearMSAAReachesWindow)
{
ANGLE_GL_PROGRAM(blueProgram, essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue());
// Draw blue.
drawQuad(blueProgram, essl1_shaders::PositionAttrib(), 0.5f);
swapBuffers();
// Use glClear to clear to red. Regression test for the Vulkan backend where this clear
// remained "deferred" and didn't make it to the window on swap.
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
swapBuffers();
// Wait for visual verification.
angle::Sleep(2000);
}
// These colors match the shader in resolveToFBO which returns (0.5, 0.6, 0.7, 0.8).
const GLColor MultisampleResolveTest::kEXPECTED_R8(128, 0, 0, 255);
const GLColor MultisampleResolveTest::kEXPECTED_RG8(128, 153, 0, 255);