Skip to content

Commit

Permalink
Add test for deferred clear + attachment gaps
Browse files Browse the repository at this point in the history
This test makes sure the list of clear values given to the render pass
(for deferred clears) are correctly passed.

Bug: angleproject:4862
Change-Id: I4830a72a6f2b01570f6d4427ffb025429b5aa03c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2309109
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
  • Loading branch information
ShabbyX authored and Commit Bot committed Jul 21, 2020
1 parent 1685602 commit 1cfc6f0
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/tests/gl_tests/DrawBuffersTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,47 @@ TEST_P(DrawBuffersTest, Gaps)
glDeleteProgram(program);
}

// Test that clear works with gaps
TEST_P(DrawBuffersTest, ClearWithGaps)
{
// TODO(syoussefi): Qualcomm driver crashes in the presence of VK_ATTACHMENT_UNUSED.
// http://anglebug.com/3423
ANGLE_SKIP_TEST_IF(IsVulkan() && IsAndroid());

ANGLE_SKIP_TEST_IF(!setupTest());

glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mMaxDrawBuffers);
ASSERT_GE(mMaxDrawBuffers, 4);

glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextures[0], 0);

glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, mTextures[1], 0);

const GLenum bufs[] = {GL_COLOR_ATTACHMENT0, GL_NONE, GL_NONE, GL_COLOR_ATTACHMENT3};

bool flags[8] = {true, false, false, true};
GLuint program;
setupMRTProgram(flags, &program);

setDrawBuffers(4, bufs);

glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

// A bogus draw to make sure clears are done with a render pass in the Vulkan backend.
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_ONE);
drawQuad(program, positionAttrib(), 0.5);
EXPECT_GL_NO_ERROR();

verifyAttachment2DColor(0, mTextures[0], GL_TEXTURE_2D, 0, GLColor::yellow);
verifyAttachment2DColor(3, mTextures[1], GL_TEXTURE_2D, 0, GLColor::yellow);

EXPECT_GL_NO_ERROR();
}

TEST_P(DrawBuffersTest, FirstAndLast)
{
ANGLE_SKIP_TEST_IF(!setupTest());
Expand Down

0 comments on commit 1cfc6f0

Please sign in to comment.