mirror of
https://github.com/utmapp/angle.git
synced 2026-12-01 22:13:25 -10:00
Style guide dictates a camel case scheme for classes. Since the tests are actually classes, update their names to reflect that. Change-Id: Ib7422b6d8c5de8414765439704fc103eae8b2d63 Reviewed-on: https://chromium-review.googlesource.com/208680 Tested-by: Jamie Madill <[email protected]> Reviewed-by: Zhenyao Mo <[email protected]>
100 lines
2.1 KiB
C++
100 lines
2.1 KiB
C++
#include "ANGLETest.h"
|
|
|
|
class ClearTest : public ANGLETest
|
|
{
|
|
protected:
|
|
ClearTest()
|
|
{
|
|
setWindowWidth(128);
|
|
setWindowHeight(128);
|
|
setConfigRedBits(8);
|
|
setConfigGreenBits(8);
|
|
setConfigBlueBits(8);
|
|
setConfigAlphaBits(8);
|
|
setConfigDepthBits(24);
|
|
}
|
|
|
|
virtual void SetUp()
|
|
{
|
|
ANGLETest::SetUp();
|
|
|
|
const std::string vertexShaderSource = SHADER_SOURCE
|
|
(
|
|
precision highp float;
|
|
attribute vec4 position;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = position;
|
|
}
|
|
);
|
|
|
|
const std::string fragmentShaderSource = SHADER_SOURCE
|
|
(
|
|
precision highp float;
|
|
|
|
void main()
|
|
{
|
|
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
|
}
|
|
);
|
|
|
|
mProgram = compileProgram(vertexShaderSource, fragmentShaderSource);
|
|
if (mProgram == 0)
|
|
{
|
|
FAIL() << "shader compilation failed.";
|
|
}
|
|
}
|
|
|
|
virtual void TearDown()
|
|
{
|
|
glDeleteProgram(mProgram);
|
|
|
|
ANGLETest::TearDown();
|
|
}
|
|
|
|
GLuint mProgram;
|
|
};
|
|
|
|
TEST_F(ClearTest, ClearIssue)
|
|
{
|
|
EXPECT_GL_NO_ERROR();
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
glDepthFunc(GL_LEQUAL);
|
|
|
|
glClearColor(0.0, 1.0, 0.0, 1.0);
|
|
glClearDepthf(0.0);
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
EXPECT_GL_NO_ERROR();
|
|
|
|
GLuint fbo;
|
|
glGenFramebuffers(1, &fbo);
|
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
|
|
|
GLuint rbo;
|
|
glGenRenderbuffers(1, &rbo);
|
|
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
|
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB565, 16, 16);
|
|
|
|
EXPECT_GL_NO_ERROR();
|
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
|
|
|
|
EXPECT_GL_NO_ERROR();
|
|
|
|
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
|
glClearDepthf(1.0f);
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
EXPECT_GL_NO_ERROR();
|
|
|
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
|
|
drawQuad(mProgram, "position", 0.5f);
|
|
|
|
EXPECT_PIXEL_EQ(0, 0, 0, 255, 0, 255);
|
|
}
|