Commit 9a79c889 by Shahbaz Youssefi Committed by Commit Bot

Run DifferentStencilMasks tests

This test was added and referenced, but was actually never added to the list of files to be compiled. The most recent validation work has been regarding WebGL. This test verifies the behavior when different stencil masks are set for front and back faces, which is unsupported in D3D and disallowed in WebGL. In the interest of running the test on all back ends, and that the validation was modified last to improve WebGL support, the test runs in WebGL compatibility mode. Bug: chromium:806557 Change-Id: I7615b9fc18d4203ed342e23881bea6bdd9b3864c Reviewed-on: https://chromium-review.googlesource.com/c/1306256Reviewed-by: 's avatarKai Ninomiya <kainino@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 3402d523
...@@ -25,6 +25,7 @@ angle_end2end_tests_sources = [ ...@@ -25,6 +25,7 @@ angle_end2end_tests_sources = [
"gl_tests/DebugMarkerTest.cpp", "gl_tests/DebugMarkerTest.cpp",
"gl_tests/DebugTest.cpp", "gl_tests/DebugTest.cpp",
"gl_tests/DepthStencilFormatsTest.cpp", "gl_tests/DepthStencilFormatsTest.cpp",
"gl_tests/DifferentStencilMasksTest.cpp",
"gl_tests/DiscardFramebufferEXTTest.cpp", "gl_tests/DiscardFramebufferEXTTest.cpp",
"gl_tests/DrawBuffersTest.cpp", "gl_tests/DrawBuffersTest.cpp",
"gl_tests/DrawElementsTest.cpp", "gl_tests/DrawElementsTest.cpp",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
// //
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
using namespace angle; using namespace angle;
...@@ -26,13 +27,15 @@ class DifferentStencilMasksTest : public ANGLETest ...@@ -26,13 +27,15 @@ class DifferentStencilMasksTest : public ANGLETest
setConfigAlphaBits(8); setConfigAlphaBits(8);
setConfigDepthBits(24); setConfigDepthBits(24);
setConfigStencilBits(8); setConfigStencilBits(8);
setWebGLCompatibilityEnabled(true);
} }
void SetUp() override void SetUp() override
{ {
ANGLETest::SetUp(); ANGLETest::SetUp();
mProgram = CompileProgram(essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue()); mProgram = CompileProgram(essl1_shaders::vs::Zero(), essl1_shaders::fs::Blue());
ASSERT_NE(0u, mProgram); ASSERT_NE(0u, mProgram);
glEnable(GL_STENCIL_TEST); glEnable(GL_STENCIL_TEST);
...@@ -60,7 +63,7 @@ TEST_P(DifferentStencilMasksTest, DrawWithSameEffectiveMask) ...@@ -60,7 +63,7 @@ TEST_P(DifferentStencilMasksTest, DrawWithSameEffectiveMask)
glUseProgram(mProgram); glUseProgram(mProgram);
drawQuad(mProgram, essl1_shaders::PositionAttrib(), 0.5f); glDrawArrays(GL_TRIANGLES, 0, 3);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
...@@ -73,64 +76,39 @@ TEST_P(DifferentStencilMasksTest, DrawWithDifferentMask) ...@@ -73,64 +76,39 @@ TEST_P(DifferentStencilMasksTest, DrawWithDifferentMask)
glUseProgram(mProgram); glUseProgram(mProgram);
drawQuad(mProgram, essl1_shaders::PositionAttrib(), 0.5f); glDrawArrays(GL_TRIANGLES, 0, 3);
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
class DifferentStencilMasksWithoutStencilBufferTest : public ANGLETest // Tests that effectively different front and back masks, without stencil bits, are legal.
TEST_P(DifferentStencilMasksTest, DrawWithDifferentMask_NoStencilBuffer)
{ {
protected: GLTexture texture;
DifferentStencilMasksWithoutStencilBufferTest() : mProgram(0) glBindTexture(GL_TEXTURE_2D, texture.get());
{ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
setWindowWidth(128);
setWindowHeight(128);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(0);
setConfigStencilBits(0);
}
void SetUp() override
{
ANGLETest::SetUp();
mProgram = CompileProgram(essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue());
ASSERT_NE(0u, mProgram);
glEnable(GL_STENCIL_TEST); GLFramebuffer framebuffer;
ASSERT_GL_NO_ERROR(); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.get());
} glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.get(), 0);
void TearDown() override
{
glDisable(GL_STENCIL_TEST);
if (mProgram != 0)
glDeleteProgram(mProgram);
ANGLETest::TearDown();
}
GLuint mProgram;
};
// Tests that effectively different front and back masks, without stencil bits, are legal.
TEST_P(DifferentStencilMasksWithoutStencilBufferTest, DrawWithDifferentMask)
{
glStencilMaskSeparate(GL_FRONT, 0x0001); glStencilMaskSeparate(GL_FRONT, 0x0001);
glStencilMaskSeparate(GL_BACK, 0x0002); glStencilMaskSeparate(GL_BACK, 0x0002);
glUseProgram(mProgram); glUseProgram(mProgram);
drawQuad(mProgram, essl1_shaders::PositionAttrib(), 0.5f); glDrawArrays(GL_TRIANGLES, 0, 3);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. // tests should be run against.
ANGLE_INSTANTIATE_TEST(DifferentStencilMasksTest, ES2_D3D9(), ES2_D3D11(), ES3_D3D11(), ES2_OPENGL(), ES3_OPENGL()); ANGLE_INSTANTIATE_TEST(DifferentStencilMasksTest,
ANGLE_INSTANTIATE_TEST(DifferentStencilMasksWithoutStencilBufferTest, ES2_D3D9(), ES2_D3D11(), ES3_D3D11(), ES2_OPENGL(), ES3_OPENGL()); ES2_D3D9(),
ES2_D3D11(),
ES3_D3D11(),
ES2_OPENGL(),
ES3_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