Commit b79f0351 by Jamie Madill Committed by Commit Bot

Add test for scissored clear.

This simple test will be used to debug the Vulkan back-end's basic scissored clear functionality. Bug: angleproject:2356 Change-Id: I4bed68740ac57b3cc61f2dfe9164081b05bc31b3 Reviewed-on: https://chromium-review.googlesource.com/914230Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent f0d3b901
...@@ -426,6 +426,53 @@ TEST_P(ClearTestES3, RepeatedClear) ...@@ -426,6 +426,53 @@ TEST_P(ClearTestES3, RepeatedClear)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
} }
class ScissoredClearTest : public ANGLETest
{
public:
ScissoredClearTest()
{
setWindowWidth(64);
setWindowHeight(64);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
};
// Simple scissored clear.
TEST_P(ScissoredClearTest, BasicScissoredColorClear)
{
// The Vulkan back-end does not implement scissored clears yet.
// TODO(jmadill): Enable this when we implement scissored clears in Vulkan.
// http://anglebug.com/2356
ANGLE_SKIP_TEST_IF(IsVulkan());
const int w = getWindowWidth();
const int h = getWindowHeight();
const int whalf = w >> 1;
const int hhalf = h >> 1;
// Clear who region to red.
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
// Enable scissor and clear to green.
glEnable(GL_SCISSOR_TEST);
glScissor(whalf / 2, hhalf / 2, whalf, whalf);
glClearColor(0.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
ASSERT_GL_NO_ERROR();
// Check the four corners for the original clear color, and the middle for the scissored clear
// color.
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red) << "out-of-scissor area should be red";
EXPECT_PIXEL_COLOR_EQ(w - 1, 0, GLColor::red) << "out-of-scissor area should be red";
EXPECT_PIXEL_COLOR_EQ(0, h - 1, GLColor::red) << "out-of-scissor area should be red";
EXPECT_PIXEL_COLOR_EQ(w - 1, h - 1, GLColor::red) << "out-of-scissor area should be red";
EXPECT_PIXEL_COLOR_EQ(whalf, hhalf, GLColor::green) << "in-scissor area should be green";
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_INSTANTIATE_TEST(ClearTest, ANGLE_INSTANTIATE_TEST(ClearTest,
ES2_D3D9(), ES2_D3D9(),
...@@ -436,5 +483,6 @@ ANGLE_INSTANTIATE_TEST(ClearTest, ...@@ -436,5 +483,6 @@ ANGLE_INSTANTIATE_TEST(ClearTest,
ES2_OPENGLES(), ES2_OPENGLES(),
ES3_OPENGLES()); ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(ClearTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES()); ANGLE_INSTANTIATE_TEST(ClearTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(ScissoredClearTest, ES2_D3D11(), ES2_OPENGL(), ES2_VULKAN());
} // anonymous namespace } // anonymous namespace
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