| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
|
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
|
| index 9470d088d231e79e500a5768b82458e2a6f67859..1322d58c63c32423aeb3052b89e83fefece70aee 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
|
| @@ -48,11 +48,17 @@ GLES2DecoderTestBase::GLES2DecoderTestBase()
|
| GLES2DecoderTestBase::~GLES2DecoderTestBase() {}
|
|
|
| void GLES2DecoderTestBase::SetUp() {
|
| - InitDecoder("", true);
|
| + InitDecoder("", true, true, false, true, true, false);
|
| }
|
|
|
| void GLES2DecoderTestBase::InitDecoder(
|
| - const char* extensions, bool has_alpha_backbuffer) {
|
| + const char* extensions,
|
| + bool has_alpha,
|
| + bool has_depth,
|
| + bool has_stencil,
|
| + bool request_alpha,
|
| + bool request_depth,
|
| + bool request_stencil) {
|
| gl_.reset(new StrictMock<MockGLInterface>());
|
| ::gfx::GLInterface::SetGLInterface(gl_.get());
|
| surface_manager_.reset(new StrictMock<MockSurfaceManager>);
|
| @@ -65,9 +71,6 @@ void GLES2DecoderTestBase::InitDecoder(
|
|
|
| EXPECT_TRUE(group_->Initialize(DisallowedExtensions(), extensions));
|
|
|
| - EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
|
| - .WillOnce(SetArgumentPointee<1>(has_alpha_backbuffer ? 8 : 0))
|
| - .RetiresOnSaturation();
|
| EXPECT_CALL(*gl_, EnableVertexAttribArray(0))
|
| .Times(1)
|
| .RetiresOnSaturation();
|
| @@ -113,6 +116,16 @@ void GLES2DecoderTestBase::InitDecoder(
|
| .Times(1)
|
| .RetiresOnSaturation();
|
|
|
| + EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
|
| + .WillOnce(SetArgumentPointee<1>(has_alpha ? 8 : 0))
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _))
|
| + .WillOnce(SetArgumentPointee<1>(has_depth ? 24 : 0))
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _))
|
| + .WillOnce(SetArgumentPointee<1>(has_stencil ? 8 : 0))
|
| + .RetiresOnSaturation();
|
| +
|
| EXPECT_CALL(*gl_, Enable(GL_VERTEX_PROGRAM_POINT_SIZE))
|
| .Times(1)
|
| .RetiresOnSaturation();
|
| @@ -134,10 +147,22 @@ void GLES2DecoderTestBase::InitDecoder(
|
|
|
| context_ = new gfx::GLContextStub;
|
|
|
| + // From <EGL/egl.h>.
|
| + const int32 EGL_ALPHA_SIZE = 0x3021;
|
| + const int32 EGL_DEPTH_SIZE = 0x3025;
|
| + const int32 EGL_STENCIL_SIZE = 0x3026;
|
| +
|
| + int32 attributes[] = {
|
| + EGL_ALPHA_SIZE, request_alpha ? 8 : 0,
|
| + EGL_DEPTH_SIZE, request_depth ? 24 : 0,
|
| + EGL_STENCIL_SIZE, request_stencil ? 8 : 0,
|
| + };
|
| + std::vector<int32> attribs(attributes, attributes + arraysize(attributes));
|
| +
|
| decoder_.reset(GLES2Decoder::Create(surface_manager_.get(), group_.get()));
|
| decoder_->Initialize(
|
| surface_, context_, surface_->GetSize(), DisallowedExtensions(),
|
| - NULL, std::vector<int32>(), NULL, 0);
|
| + NULL, attribs, NULL, 0);
|
| decoder_->set_engine(engine_.get());
|
|
|
| EXPECT_CALL(*gl_, GenBuffersARB(_, _))
|
| @@ -263,12 +288,8 @@ void GLES2DecoderTestBase::SetupExpectationsForFramebufferAttachment(
|
| GLclampf restore_green,
|
| GLclampf restore_blue,
|
| GLclampf restore_alpha,
|
| - GLuint restore_color_mask,
|
| GLuint restore_stencil,
|
| - GLuint restore_stencil_front_mask,
|
| - GLuint restore_stencil_back_mask,
|
| GLclampf restore_depth,
|
| - GLboolean restore_depth_mask,
|
| bool restore_scissor_test) {
|
| InSequence sequence;
|
| EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
|
| @@ -308,28 +329,12 @@ void GLES2DecoderTestBase::SetupExpectationsForFramebufferAttachment(
|
| restore_red, restore_green, restore_blue, restore_alpha))
|
| .Times(1)
|
| .RetiresOnSaturation();
|
| - EXPECT_CALL(*gl_, ColorMask(
|
| - ((restore_color_mask & 0x1000) != 0) ? 1 : 0,
|
| - ((restore_color_mask & 0x0100) != 0) ? 1 : 0,
|
| - ((restore_color_mask & 0x0010) != 0) ? 1 : 0,
|
| - ((restore_color_mask & 0x0001) != 0) ? 1 : 0))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| EXPECT_CALL(*gl_, ClearStencil(restore_stencil))
|
| .Times(1)
|
| .RetiresOnSaturation();
|
| - EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, restore_stencil_front_mask))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| - EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, restore_stencil_back_mask))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| EXPECT_CALL(*gl_, ClearDepth(restore_depth))
|
| .Times(1)
|
| .RetiresOnSaturation();
|
| - EXPECT_CALL(*gl_, DepthMask(restore_depth_mask))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| if (restore_scissor_test) {
|
| EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST))
|
| .Times(1)
|
| @@ -386,6 +391,43 @@ void GLES2DecoderTestBase::DoDeleteBuffer(
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| }
|
|
|
| +void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState(
|
| + bool framebuffer_is_rgb,
|
| + bool framebuffer_has_depth,
|
| + bool framebuffer_has_stencil,
|
| + GLuint color_bits,
|
| + bool depth_mask,
|
| + GLuint front_stencil_mask,
|
| + GLuint back_stencil_mask) {
|
| + EXPECT_CALL(*gl_, ColorMask(
|
| + (color_bits & 0x1000) != 0,
|
| + (color_bits & 0x0100) != 0,
|
| + (color_bits & 0x0010) != 0,
|
| + (color_bits & 0x0001) && !framebuffer_is_rgb))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, DepthMask(depth_mask))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, front_stencil_mask))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, back_stencil_mask))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| +}
|
| +
|
| +void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() {
|
| + SetupExpectationsForApplyingDirtyState(
|
| + false, // Framebuffer is RGB
|
| + false, // Framebuffer has depth
|
| + false, // Framebuffer has stencil
|
| + 0x1111, // color bits
|
| + true, // depth mask
|
| + 0, // front stencil mask
|
| + 0); // back stencil mask
|
| +}
|
| +
|
| void GLES2DecoderTestBase::DoBindFramebuffer(
|
| GLenum target, GLuint client_id, GLuint service_id) {
|
| EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id))
|
| @@ -535,7 +577,10 @@ const int GLES2DecoderTestBase::kBackBufferHeight;
|
|
|
| void GLES2DecoderWithShaderTestBase::SetUp() {
|
| GLES2DecoderTestBase::SetUp();
|
| + SetupDefaultProgram();
|
| +}
|
|
|
| +void GLES2DecoderWithShaderTestBase::SetupDefaultProgram() {
|
| {
|
| static AttribInfo attribs[] = {
|
| { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
|
|
|