From 59b0c7d718edde31b8d5af4b100e0b3db7120780 Mon Sep 17 00:00:00 2001 From: Roman Lavrov Date: Mon, 27 Mar 2023 10:10:11 -0400 Subject: [PATCH] Add regression test for VVL AlphaToCoverage bug https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5520 Bug: b/264062978 Change-Id: I0619cb28495c16d0d8d83635ad7a93f0c47cea6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4374098 Reviewed-by: Shahbaz Youssefi Auto-Submit: Roman Lavrov Commit-Queue: Roman Lavrov --- src/tests/gl_tests/GLSLTest.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tests/gl_tests/GLSLTest.cpp b/src/tests/gl_tests/GLSLTest.cpp index f1fd84759..4ced3a16e 100644 --- a/src/tests/gl_tests/GLSLTest.cpp +++ b/src/tests/gl_tests/GLSLTest.cpp @@ -5177,7 +5177,7 @@ void main(void) glUseProgram(verifyProgram); - constexpr std::array kOutputInitData = {}; + constexpr std::array kOutputInitData = {}; GLBuffer outputBuffer; glBindBuffer(GL_SHADER_STORAGE_BUFFER, outputBuffer); glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(kOutputInitData), kOutputInitData.data(), @@ -10293,6 +10293,18 @@ TEST_P(GLSLTest, FragData) EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red); } +// Tests using gl_FragData[0] instead of gl_FragColor with GL_SAMPLE_ALPHA_TO_COVERAGE +// Regression test for https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5520 +TEST_P(GLSLTest, FragData_AlphaToCoverage) +{ + constexpr char kFS[] = R"(void main() { gl_FragData[0] = vec4(1, 0, 0, 1); })"; + ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), kFS); + glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); + drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f); + EXPECT_GL_NO_ERROR(); + EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red); +} + // Test angle can handle big initial stack size with dynamic stack allocation. TEST_P(GLSLTest, MemoryExhaustedTest) {