Commit 2d5da029 by Jamie Madill Committed by Commit Bot

Minor angle_end2end_tests cleanups.

Minor refactoring and call consolidation. Was done while working on deferring clears in the Vulkan back-end. Bug: angleproject:4517 Change-Id: I60d80d4f9646c990c4cb8bbc349fc0051389bf02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2151171 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent dc3477f3
...@@ -409,10 +409,10 @@ TEST_P(BlitFramebufferANGLETest, BlitColorToDefault) ...@@ -409,10 +409,10 @@ TEST_P(BlitFramebufferANGLETest, BlitColorToDefault)
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO); glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
EXPECT_PIXEL_EQ(getWindowWidth() / 4, getWindowHeight() / 4, 255, 0, 0, 255); EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, getWindowHeight() / 4, GLColor::red);
EXPECT_PIXEL_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, 0, 255, 0, 255); EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, GLColor::green);
EXPECT_PIXEL_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, 255, 0, 0, 255); EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::red);
EXPECT_PIXEL_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, 0, 255, 0, 255); EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::green);
} }
// Draw to system framebuffer, blit whole-buffer color to user-created framebuffer. // Draw to system framebuffer, blit whole-buffer color to user-created framebuffer.
...@@ -633,10 +633,10 @@ TEST_P(BlitFramebufferANGLETest, BlitWithDepthUserToDefault) ...@@ -633,10 +633,10 @@ TEST_P(BlitFramebufferANGLETest, BlitWithDepthUserToDefault)
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
EXPECT_PIXEL_EQ(getWindowWidth() / 4, getWindowHeight() / 4, 255, 0, 0, 255); EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, getWindowHeight() / 4, GLColor::red);
EXPECT_PIXEL_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, 255, 0, 0, 255); EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, GLColor::red);
EXPECT_PIXEL_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, 0, 0, 255, 255); EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::blue);
EXPECT_PIXEL_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, 0, 0, 255, 255); EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::blue);
} }
// blit from system FBO to user-created framebuffer, with depth buffer. // blit from system FBO to user-created framebuffer, with depth buffer.
...@@ -754,10 +754,10 @@ TEST_P(BlitFramebufferANGLETest, BlitPartialColor) ...@@ -754,10 +754,10 @@ TEST_P(BlitFramebufferANGLETest, BlitPartialColor)
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO); glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
EXPECT_PIXEL_EQ(getWindowWidth() / 4, getWindowHeight() / 4, 255, 255, 255, 255); EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, getWindowHeight() / 4, GLColor::white);
EXPECT_PIXEL_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, 255, 255, 255, 255); EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, GLColor::white);
EXPECT_PIXEL_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, 255, 255, 255, 255); EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::white);
EXPECT_PIXEL_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, 255, 0, 0, 255); EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::red);
} }
TEST_P(BlitFramebufferANGLETest, BlitDifferentSizes) TEST_P(BlitFramebufferANGLETest, BlitDifferentSizes)
...@@ -831,15 +831,14 @@ TEST_P(BlitFramebufferANGLETest, BlitStencil) ...@@ -831,15 +831,14 @@ TEST_P(BlitFramebufferANGLETest, BlitStencil)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_framebuffer_blit")); ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_framebuffer_blit"));
// TODO(jmadill): Figure out if we can fix this on D3D9. // http://anglebug.com/2205
// https://code.google.com/p/angleproject/issues/detail?id=2205
ANGLE_SKIP_TEST_IF(IsIntel() && IsD3D9()); ANGLE_SKIP_TEST_IF(IsIntel() && IsD3D9());
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO); glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
glClearColor(0.0, 1.0, 0.0, 1.0); glClearColor(0.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearStencil(0x0); glClearStencil(0x0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Scissor half the screen so we fill the stencil only halfway // Scissor half the screen so we fill the stencil only halfway
glScissor(0, 0, getWindowWidth(), getWindowHeight() / 2); glScissor(0, 0, getWindowWidth(), getWindowHeight() / 2);
......
...@@ -215,7 +215,7 @@ class MaskedScissoredClearTestBase ...@@ -215,7 +215,7 @@ class MaskedScissoredClearTestBase
setConfigStencilBits(8); setConfigStencilBits(8);
} }
void MaskedScissoredColorDepthStencilClear( void maskedScissoredColorDepthStencilClear(
const MaskedScissoredClearVariationsTestParams &params); const MaskedScissoredClearVariationsTestParams &params);
bool mHasDepth = true; bool mHasDepth = true;
...@@ -1268,7 +1268,7 @@ TEST_P(ClearTestES3, RepeatedClear) ...@@ -1268,7 +1268,7 @@ TEST_P(ClearTestES3, RepeatedClear)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
} }
void MaskedScissoredClearTestBase::MaskedScissoredColorDepthStencilClear( void MaskedScissoredClearTestBase::maskedScissoredColorDepthStencilClear(
const MaskedScissoredClearVariationsTestParams &params) const MaskedScissoredClearVariationsTestParams &params)
{ {
// Flaky on Android Nexus 5x and Pixel 2, possible Qualcomm driver bug. // Flaky on Android Nexus 5x and Pixel 2, possible Qualcomm driver bug.
...@@ -1449,7 +1449,7 @@ void MaskedScissoredClearTestBase::MaskedScissoredColorDepthStencilClear( ...@@ -1449,7 +1449,7 @@ void MaskedScissoredClearTestBase::MaskedScissoredColorDepthStencilClear(
// Tests combinations of color, depth, stencil clears with or without masks or scissor. // Tests combinations of color, depth, stencil clears with or without masks or scissor.
TEST_P(MaskedScissoredClearTest, Test) TEST_P(MaskedScissoredClearTest, Test)
{ {
MaskedScissoredColorDepthStencilClear(GetParam()); maskedScissoredColorDepthStencilClear(GetParam());
} }
// Tests combinations of color, depth, stencil clears with or without masks or scissor. // Tests combinations of color, depth, stencil clears with or without masks or scissor.
...@@ -1483,7 +1483,7 @@ TEST_P(VulkanClearTest, Test) ...@@ -1483,7 +1483,7 @@ TEST_P(VulkanClearTest, Test)
bindColorStencilFBO(); bindColorStencilFBO();
} }
MaskedScissoredColorDepthStencilClear(GetParam()); maskedScissoredColorDepthStencilClear(GetParam());
} }
// Test that just clearing a nonexistent drawbuffer of the default framebuffer doesn't cause an // Test that just clearing a nonexistent drawbuffer of the default framebuffer doesn't cause an
......
...@@ -12,6 +12,16 @@ ...@@ -12,6 +12,16 @@
using namespace angle; using namespace angle;
struct ReadbackTestParam
{
GLuint attachment;
GLuint format;
GLuint type;
void *data;
int depthBits;
int stencilBits;
};
class DepthStencilFormatsTestBase : public ANGLETest class DepthStencilFormatsTestBase : public ANGLETest
{ {
protected: protected:
...@@ -160,6 +170,14 @@ void main() ...@@ -160,6 +170,14 @@ void main()
glDeleteTextures(1, &mTexture); glDeleteTextures(1, &mTexture);
} }
bool hasReadDepthSupport() const { return IsGLExtensionEnabled("GL_NV_read_depth"); }
bool hasReadStencilSupport() const { return IsGLExtensionEnabled("GL_NV_read_stencil"); }
bool hasFloatDepthSupport() const { return IsGLExtensionEnabled("GL_NV_depth_buffer_float2"); }
void depthStencilReadbackCase(const ReadbackTestParam &type);
GLuint mProgram; GLuint mProgram;
GLuint mTexture; GLuint mTexture;
GLint mTextureUniformLocation; GLint mTextureUniformLocation;
...@@ -214,48 +232,20 @@ TEST_P(DepthStencilFormatsTest, PackedDepthStencil) ...@@ -214,48 +232,20 @@ TEST_P(DepthStencilFormatsTest, PackedDepthStencil)
} }
} }
// This test will initialize a depth texture, clear it and read it back, if possible void DepthStencilFormatsTestBase::depthStencilReadbackCase(const ReadbackTestParam &type)
TEST_P(DepthStencilFormatsTest, DepthStencilReadback)
{ {
bool shouldHaveReadDepthSupport = IsGLExtensionEnabled("GL_NV_read_depth");
bool shouldHaveReadStencilSupport = IsGLExtensionEnabled("GL_NV_read_stencil");
bool shouldHaveFloatDepthSupport = IsGLExtensionEnabled("GL_NV_depth_buffer_float2");
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_OES_depth_texture")); ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_OES_depth_texture"));
const int res = 2;
const int destRes = 4;
struct TypeInfo
{
GLuint attachment;
GLuint format;
GLuint type;
void *data;
int depthBits;
int stencilBits;
};
GLuint fakeData[10] = {0};
std::vector<TypeInfo> types = {
{GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, fakeData, 16, 0},
{GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, fakeData, 16, 0},
{GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT, GL_FLOAT, fakeData, 32, 0},
{GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8_OES, fakeData, 24, 8},
};
for (const TypeInfo &type : types)
{
const bool hasFloatDepth = (type.type == GL_FLOAT); const bool hasFloatDepth = (type.type == GL_FLOAT);
if (hasFloatDepth && !shouldHaveFloatDepthSupport) ANGLE_SKIP_TEST_IF(hasFloatDepth && !hasFloatDepthSupport());
{
continue;
}
const bool hasStencil = (type.format != GL_DEPTH_COMPONENT); const bool hasStencil = (type.format != GL_DEPTH_COMPONENT);
const bool supportPackedDepthStencilFramebuffer = getClientMajorVersion() >= 3; const bool supportPackedDepthStencilFramebuffer = getClientMajorVersion() >= 3;
const int res = 2;
const int destRes = 4;
GLTexture tex; GLTexture tex;
glBindTexture(GL_TEXTURE_2D, tex); glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
...@@ -318,10 +308,8 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback) ...@@ -318,10 +308,8 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, res, res, 0, GL_RGBA, GL_UNSIGNED_BYTE, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, res, res, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
nullptr); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTex, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTex,
0);
EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
} }
...@@ -336,6 +324,12 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback) ...@@ -336,6 +324,12 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback)
* 0 0.2 0.4 * 0 0.2 0.4
* 0---1 * 0---1
*/ */
GLbitfield clearBits = GL_DEPTH_BUFFER_BIT;
if (hasStencil)
{
clearBits |= GL_STENCIL_BUFFER_BIT;
}
const GLfloat d00 = 0.2; const GLfloat d00 = 0.2;
const GLfloat d01 = 0.4; const GLfloat d01 = 0.4;
const GLfloat d10 = 0.6; const GLfloat d10 = 0.6;
...@@ -343,68 +337,51 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback) ...@@ -343,68 +337,51 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback)
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, 1, 1); glScissor(0, 0, 1, 1);
glClearDepthf(d00); glClearDepthf(d00);
glClear(GL_DEPTH_BUFFER_BIT);
if (hasStencil)
{
glClearStencil(1); glClearStencil(1);
glClear(GL_STENCIL_BUFFER_BIT); glClear(clearBits);
}
glScissor(1, 0, 1, 1); glScissor(1, 0, 1, 1);
glClearDepthf(d10); glClearDepthf(d10);
glClear(GL_DEPTH_BUFFER_BIT);
if (hasStencil)
{
glClearStencil(2); glClearStencil(2);
glClear(GL_STENCIL_BUFFER_BIT); glClear(clearBits);
}
glScissor(0, 1, 1, 1); glScissor(0, 1, 1, 1);
glClearDepthf(d01); glClearDepthf(d01);
glClear(GL_DEPTH_BUFFER_BIT);
if (hasStencil)
{
glClearStencil(3); glClearStencil(3);
glClear(GL_STENCIL_BUFFER_BIT); glClear(clearBits);
}
glScissor(1, 1, 1, 1); glScissor(1, 1, 1, 1);
glClearDepthf(d11); glClearDepthf(d11);
glClear(GL_DEPTH_BUFFER_BIT);
if (hasStencil)
{
glClearStencil(4); glClearStencil(4);
glClear(GL_STENCIL_BUFFER_BIT); glClear(clearBits);
}
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
GLubyte actualPixels[destRes * destRes * 8]; GLubyte actualPixels[destRes * destRes * 8];
glReadPixels(0, 0, destRes, destRes, GL_DEPTH_COMPONENT, glReadPixels(0, 0, destRes, destRes, GL_DEPTH_COMPONENT,
hasFloatDepth ? GL_FLOAT : GL_UNSIGNED_SHORT, actualPixels); hasFloatDepth ? GL_FLOAT : GL_UNSIGNED_SHORT, actualPixels);
// NV_read_depth and NV_read_stencil do not support packed depth/stencil // NV_read_depth and NV_read_stencil do not support packed depth/stencil
if (shouldHaveReadDepthSupport && type.format != GL_DEPTH_STENCIL) if (hasReadDepthSupport() && type.format != GL_DEPTH_STENCIL)
{ {
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
if (hasFloatDepth) if (hasFloatDepth)
{ {
const float eps = 0.002f; constexpr float kEpsilon = 0.002f;
const float minValues[4] = {0.2f - eps, 0.4f - eps, 0.6f - eps, 0.8f - eps};
const float maxValues[4] = {0.2f + eps, 0.4f + eps, 0.6f + eps, 0.8f + eps};
const float *pixels = reinterpret_cast<const float *>(actualPixels); const float *pixels = reinterpret_cast<const float *>(actualPixels);
ASSERT_TRUE((pixels[0] >= minValues[0]) && (pixels[0] <= maxValues[0]) && ASSERT_NEAR(pixels[0], d00, kEpsilon);
(pixels[0 + destRes] >= minValues[1]) && ASSERT_NEAR(pixels[0 + destRes], d01, kEpsilon);
(pixels[0 + destRes] <= maxValues[1]) && (pixels[1] >= minValues[2]) && ASSERT_NEAR(pixels[1], d10, kEpsilon);
(pixels[1] <= maxValues[2]) && (pixels[1 + destRes] >= minValues[3]) && ASSERT_NEAR(pixels[1 + destRes], d11, kEpsilon);
(pixels[1 + destRes] <= maxValues[3]));
} }
else else
{ {
const unsigned short minValues[4] = {13106, 26213, 39320, 52427}; auto scale = [](float f) {
const unsigned short maxValues[4] = {13109, 26216, 39323, 52430}; return static_cast<uint16_t>(
const unsigned short *pixels = static_cast<float>(std::numeric_limits<uint16_t>::max()) * f);
reinterpret_cast<const unsigned short *>(actualPixels); };
ASSERT_TRUE((pixels[0] >= minValues[0]) && (pixels[0] <= maxValues[0]) &&
(pixels[0 + destRes] >= minValues[1]) && constexpr unsigned short kEpsilon = 2;
(pixels[0 + destRes] <= maxValues[1]) && (pixels[1] >= minValues[2]) && const unsigned short *pixels = reinterpret_cast<const unsigned short *>(actualPixels);
(pixels[1] <= maxValues[2]) && (pixels[1 + destRes] >= minValues[3]) && ASSERT_NEAR(pixels[0], scale(d00), kEpsilon);
(pixels[1 + destRes] <= maxValues[3])); ASSERT_NEAR(pixels[0 + destRes], scale(d01), kEpsilon);
ASSERT_NEAR(pixels[1], scale(d10), kEpsilon);
ASSERT_NEAR(pixels[1 + destRes], scale(d11), kEpsilon);
} }
} }
else else
...@@ -413,9 +390,8 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback) ...@@ -413,9 +390,8 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback)
} }
if (hasStencil) if (hasStencil)
{ {
glReadPixels(0, 0, destRes, destRes, GL_STENCIL_INDEX_OES, GL_UNSIGNED_BYTE, glReadPixels(0, 0, destRes, destRes, GL_STENCIL_INDEX_OES, GL_UNSIGNED_BYTE, actualPixels);
actualPixels); if (hasReadStencilSupport())
if (shouldHaveReadStencilSupport)
{ {
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
ASSERT_TRUE((actualPixels[0] == 1) && (actualPixels[1] == 2) && ASSERT_TRUE((actualPixels[0] == 1) && (actualPixels[1] == 2) &&
...@@ -426,7 +402,44 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback) ...@@ -426,7 +402,44 @@ TEST_P(DepthStencilFormatsTest, DepthStencilReadback)
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
} }
} }
// This test will initialize a depth texture, clear it and read it back, if possible
TEST_P(DepthStencilFormatsTest, DepthStencilReadback_UShort)
{
GLuint fakeData[10] = {0};
ReadbackTestParam type = {
GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, fakeData, 16, 0};
depthStencilReadbackCase(type);
}
// This test will initialize a depth texture, clear it and read it back, if possible
TEST_P(DepthStencilFormatsTest, DepthStencilReadback_UInt)
{
// http://anglebug.com/4573
ANGLE_SKIP_TEST_IF(IsWindows() && IsVulkan());
GLuint fakeData[10] = {0};
ReadbackTestParam type = {
GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, fakeData, 16, 0};
depthStencilReadbackCase(type);
}
// This test will initialize a depth texture, clear it and read it back, if possible
TEST_P(DepthStencilFormatsTest, DepthStencilReadback_Float)
{
GLuint fakeData[10] = {0};
ReadbackTestParam type = {GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT, GL_FLOAT, fakeData, 32, 0};
depthStencilReadbackCase(type);
}
// This test will initialize a depth texture, clear it and read it back, if possible
TEST_P(DepthStencilFormatsTest, DepthStencilReadback_DepthStencil)
{
GLuint fakeData[10] = {0};
ReadbackTestParam type = {
GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8_OES, fakeData, 24, 8};
depthStencilReadbackCase(type);
} }
// This test will initialize a depth texture and then render with it and verify // This test will initialize a depth texture and then render with it and verify
......
...@@ -372,7 +372,7 @@ TEST_P(SimpleOperationTest, DrawLine) ...@@ -372,7 +372,7 @@ TEST_P(SimpleOperationTest, DrawLine)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
for (auto x = 0; x < getWindowWidth(); x++) for (int x = 0; x < getWindowWidth(); x++)
{ {
EXPECT_PIXEL_COLOR_EQ(x, x, GLColor::green); EXPECT_PIXEL_COLOR_EQ(x, x, GLColor::green);
} }
......
...@@ -730,29 +730,26 @@ TEST_P(StateChangeRenderTest, RecreateRenderbuffer) ...@@ -730,29 +730,26 @@ TEST_P(StateChangeRenderTest, RecreateRenderbuffer)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mRenderbuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mRenderbuffer);
// Explictly check FBO status sync in some versions of ANGLE no_error skips FBO checks. // Explictly check FBO status sync in some versions of ANGLE no_error skips FBO checks.
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
// Draw with red to the FBO. // Draw with red to the FBO.
GLColor red(255, 0, 0, 255); setUniformColor(GLColor::red);
setUniformColor(red);
drawQuad(mProgram, "position", 0.5f); drawQuad(mProgram, "position", 0.5f);
EXPECT_PIXEL_COLOR_EQ(0, 0, red); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
// Recreate the renderbuffer and clear to green. // Recreate the renderbuffer and clear to green.
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 32, 32); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 32, 32);
glClearColor(0.0f, 1.0f, 0.0f, 1.0f); glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
GLColor green(0, 255, 0, 255); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
EXPECT_PIXEL_COLOR_EQ(0, 0, green);
// Explictly check FBO status sync in some versions of ANGLE no_error skips FBO checks. // Explictly check FBO status sync in some versions of ANGLE no_error skips FBO checks.
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
// Verify drawing blue gives blue. This covers the FBO sync with D3D dirty bits. // Verify drawing blue gives blue. This covers the FBO sync with D3D dirty bits.
GLColor blue(0, 0, 255, 255); setUniformColor(GLColor::blue);
setUniformColor(blue);
drawQuad(mProgram, "position", 0.5f); drawQuad(mProgram, "position", 0.5f);
EXPECT_PIXEL_COLOR_EQ(0, 0, blue); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::blue);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
......
...@@ -4380,13 +4380,13 @@ TEST_P(WebGLCompatibilityTest, DrawBuffers) ...@@ -4380,13 +4380,13 @@ TEST_P(WebGLCompatibilityTest, DrawBuffers)
GLFramebuffer readFBO; GLFramebuffer readFBO;
glBindFramebuffer(GL_FRAMEBUFFER, readFBO); glBindFramebuffer(GL_FRAMEBUFFER, readFBO);
for (int i = 0; i < 4; ++i) for (int attachmentIndex = 0; attachmentIndex < 4; ++attachmentIndex)
{ {
if (mask & (1 << i)) if (mask & (1 << attachmentIndex))
{ {
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
renderbuffers[i]); renderbuffers[attachmentIndex]);
EXPECT_PIXEL_COLOR_EQ(0, 0, color); EXPECT_PIXEL_COLOR_EQ(0, 0, color) << "attachment " << attachmentIndex;
} }
} }
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
......
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