Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

Issue 7158002: Revert 89002 - Enforce RGB even on buggy drivers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
===================================================================
--- gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (revision 89013)
+++ gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (working copy)
@@ -45,6 +45,15 @@
bool init);
};
+class GLES2DecoderRGBBackbufferTest : public GLES2DecoderTest {
+ public:
+ GLES2DecoderRGBBackbufferTest() { }
+
+ virtual void SetUp() {
+ InitDecoder("", false);
+ }
+};
+
class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase {
public:
GLES2DecoderWithShaderTest()
@@ -80,29 +89,9 @@
}
};
-class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest {
- public:
- GLES2DecoderRGBBackbufferTest() { }
-
- virtual void SetUp() {
- InitDecoder("", false, false, false, false, false, false);
- SetupDefaultProgram();
- }
-};
-
-class GLES2DecoderManualInitTest : public GLES2DecoderWithShaderTest {
- public:
- GLES2DecoderManualInitTest() { }
-
- // Override default setup so nothing gets setup.
- virtual void SetUp() {
- }
-};
-
TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) {
SetupTexture();
AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
- SetupExpectationsForApplyingDefaultDirtyState();
EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
.Times(1)
@@ -142,7 +131,6 @@
.Times(1)
.RetiresOnSaturation();
}
- SetupExpectationsForApplyingDefaultDirtyState();
DrawArrays cmd;
cmd.Init(GL_TRIANGLES, 0, kNumVertices);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
@@ -175,10 +163,8 @@
TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) {
SetupTexture();
SetupVertexBuffer();
- DoEnableVertexAttribArray(1);
DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0);
AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId);
- SetupExpectationsForApplyingDefaultDirtyState();
EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
.Times(1)
@@ -205,7 +191,6 @@
TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) {
SetupTexture();
AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
- SetupExpectationsForApplyingDefaultDirtyState();
DoDeleteProgram(client_program_id_, kServiceProgramId);
EXPECT_CALL(*gl_, DrawArrays(_, _, _))
@@ -274,7 +259,6 @@
SetupTexture();
SetupIndexBuffer();
AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0);
- SetupExpectationsForApplyingDefaultDirtyState();
EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount,
GL_UNSIGNED_SHORT,
BufferOffset(kValidIndexRangeStart * 2)))
@@ -333,7 +317,6 @@
SetupIndexBuffer();
DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0);
AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId);
- SetupExpectationsForApplyingDefaultDirtyState();
EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount,
GL_UNSIGNED_SHORT,
@@ -366,7 +349,6 @@
SetupTexture();
SetupIndexBuffer();
AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0);
- SetupExpectationsForApplyingDefaultDirtyState();
DoDeleteProgram(client_program_id_, kServiceProgramId);
EXPECT_CALL(*gl_, DrawElements(_, _, _, _))
@@ -1263,29 +1245,13 @@
EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result);
}
-TEST_F(GLES2DecoderWithShaderTest, BindAndDeleteFramebuffer) {
- SetupTexture();
- AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
- SetupExpectationsForApplyingDefaultDirtyState();
- DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
- kServiceFramebufferId);
- DoDeleteFramebuffer(client_framebuffer_id_, kServiceFramebufferId);
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- DrawArrays cmd;
- cmd.Init(GL_TRIANGLES, 0, kNumVertices);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-}
-
TEST_F(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) {
EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _))
.Times(0);
FramebufferRenderbuffer cmd;
cmd.Init(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
- client_renderbuffer_id_);
+ GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
+ client_renderbuffer_id_);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
}
@@ -1334,8 +1300,12 @@
SetupExpectationsForFramebufferAttachment(
GL_COLOR_BUFFER_BIT, // clear bits
0, 0, 0, 0, // color
+ 0x1111, // color bits
0, // stencil
+ -1, // stencil mask back,
+ -1, // stencil mask front,
1.0f, // depth
+ 1, // depth mask
false); // scissor test
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -1390,8 +1360,12 @@
SetupExpectationsForFramebufferAttachment(
0, // clear bits
0, 0, 0, 0, // color
+ 0x1111, // color bits
0, // stencil
+ -1, // stencil mask back,
+ -1, // stencil mask front,
1.0f, // depth
+ 1, // depth mask
false); // scissor test
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -1568,8 +1542,12 @@
SetupExpectationsForFramebufferAttachment(
0, // clear bits
0, 0, 0, 0, // color
+ 0x1111, // color bits
0, // stencil
+ -1, // stencil mask back,
+ -1, // stencil mask front,
1.0f, // depth
+ 1, // depth mask
false); // scissor test
FramebufferTexture2D fbtex_cmd;
fbtex_cmd.Init(
@@ -2551,9 +2529,9 @@
EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f))
.Times(1)
.RetiresOnSaturation();
-// EXPECT_CALL(*gl_, ColorMask(0, 1, 0, 1))
-// .Times(0)
-// .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, ColorMask(0, 1, 0, 1))
+ .Times(1)
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST))
.Times(1)
.RetiresOnSaturation();
@@ -2571,8 +2549,12 @@
SetupExpectationsForFramebufferAttachment(
GL_COLOR_BUFFER_BIT, // clear bits
0.1f, 0.2f, 0.3f, 0.4f, // color
+ 0x0101, // color bits
0, // stencil
+ -1, // stencil mask back
+ -1, // stencil mask front
1.0f, // depth
+ 1, // depth mask
true); // scissor test
EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd));
EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd));
@@ -2595,9 +2577,9 @@
EXPECT_CALL(*gl_, ClearDepth(0.5f))
.Times(1)
.RetiresOnSaturation();
-// EXPECT_CALL(*gl_, DepthMask(0))
-// .Times(1)
-// .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, DepthMask(0))
+ .Times(1)
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
.RetiresOnSaturation();
@@ -2612,8 +2594,12 @@
SetupExpectationsForFramebufferAttachment(
GL_DEPTH_BUFFER_BIT, // clear bits
0, 0, 0, 0, // color
+ 0x1111, // color bits
0, // stencil
+ -1, // stencil mask back,
+ -1, // stencil mask front,
0.5f, // depth
+ 0, // depth mask
false); // scissor test
EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd));
EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd));
@@ -2635,9 +2621,9 @@
EXPECT_CALL(*gl_, ClearStencil(123))
.Times(1)
.RetiresOnSaturation();
-// EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0x1234u))
-// .Times(1)
-// .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0x1234u))
+ .Times(1)
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
.RetiresOnSaturation();
@@ -2652,8 +2638,12 @@
SetupExpectationsForFramebufferAttachment(
GL_STENCIL_BUFFER_BIT, // clear bits
0, 0, 0, 0, // color
+ 0x1111, // color bits
123, // stencil
+ -1, // stencil mask back,
+ 0x1234u, // stencil mask front,
1.0f, // depth
+ 1, // depth mask
false); // scissor test
EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd));
EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd));
@@ -2735,8 +2725,12 @@
SetupExpectationsForFramebufferAttachment(
GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, // clear bits
0, 0, 0, 0, // color
+ 0x1111, // color bits
123, // stencil
+ -1, // stencil mask back,
+ -1, // stencil mask front,
0.5f, // depth
+ 1, // depth mask
false); // scissor test
EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd));
EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd));
@@ -2980,382 +2974,7 @@
EXPECT_EQ(surface.get(), decoder_->GetGLSurface());
}
-// Test that with an RGB backbuffer if we set the color mask to 1,1,1,1 it is
-// set to 1,1,1,0 at Draw time but is 1,1,1,1 at query time.
-TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMask) {
- ColorMask cmd;
- cmd.Init(true, true, true, true);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- SetupTexture();
- AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
- SetupExpectationsForApplyingDirtyState(
- true, // Framebuffer is RGB
- false, // Framebuffer has depth
- false, // Framebuffer has stencil
- 0x1110, // color bits
- false, // depth mask
- 0, // front stencil mask
- 0); // back stencil mask
-
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- DrawArrays draw_cmd;
- draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices);
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_COLOR_WRITEMASK, result->GetData()))
- .Times(0);
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_COLOR_WRITEMASK, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_COLOR_WRITEMASK),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(1, result->GetData()[0]);
- EXPECT_EQ(1, result->GetData()[1]);
- EXPECT_EQ(1, result->GetData()[2]);
- EXPECT_EQ(1, result->GetData()[3]);
-}
-
-// Test that with no depth if we set DepthMask true that it's set to false at
-// draw time but querying it returns true.
-TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferDepthMask) {
- EXPECT_CALL(*gl_, DepthMask(true))
- .Times(0)
- .RetiresOnSaturation();
- DepthMask cmd;
- cmd.Init(true);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- SetupTexture();
- AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
- SetupExpectationsForApplyingDirtyState(
- true, // Framebuffer is RGB
- false, // Framebuffer has depth
- false, // Framebuffer has stencil
- 0x1110, // color bits
- false, // depth mask
- 0, // front stencil mask
- 0); // back stencil mask
-
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- DrawArrays draw_cmd;
- draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices);
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_WRITEMASK, result->GetData()))
- .Times(0);
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_DEPTH_WRITEMASK, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_WRITEMASK),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(1, result->GetData()[0]);
-}
-
-// Test that with no stencil if we set the stencil mask it's still set to 0 at
-// draw time but gets our value if we query.
-TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferStencilMask) {
- const GLint kMask = 123;
- EXPECT_CALL(*gl_, StencilMask(kMask))
- .Times(0)
- .RetiresOnSaturation();
- StencilMask cmd;
- cmd.Init(kMask);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- SetupTexture();
- AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
- SetupExpectationsForApplyingDirtyState(
- true, // Framebuffer is RGB
- false, // Framebuffer has depth
- false, // Framebuffer has stencil
- 0x1110, // color bits
- false, // depth mask
- 0, // front stencil mask
- 0); // back stencil mask
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- DrawArrays draw_cmd;
- draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices);
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, result->GetData()))
- .Times(0);
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_STENCIL_WRITEMASK, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_WRITEMASK),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(kMask, result->GetData()[0]);
-}
-
-// Test that if an FBO is bound we get the correct masks.
-TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMaskFBO) {
- ColorMask cmd;
- cmd.Init(true, true, true, true);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- SetupTexture();
- SetupVertexBuffer();
- DoEnableVertexAttribArray(0);
- DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0);
- DoEnableVertexAttribArray(1);
- DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0);
- DoEnableVertexAttribArray(2);
- DoVertexAttribPointer(2, 2, GL_FLOAT, 0, 0);
- SetupExpectationsForApplyingDirtyState(
- true, // Framebuffer is RGB
- false, // Framebuffer has depth
- false, // Framebuffer has stencil
- 0x1110, // color bits
- false, // depth mask
- 0, // front stencil mask
- 0); // back stencil mask
-
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- DrawArrays draw_cmd;
- draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices);
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- // Check that no extra calls are made on the next draw.
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- // Setup Frame buffer.
- DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
- kServiceFramebufferId);
- EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _))
- .Times(0);
- FramebufferRenderbuffer fbrb_cmd;
- fbrb_cmd.Init(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
- client_renderbuffer_id_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
-
- // This time state needs to be set.
- SetupExpectationsForApplyingDirtyState(
- false, // Framebuffer is RGB
- false, // Framebuffer has depth
- false, // Framebuffer has stencil
- 0x1110, // color bits
- false, // depth mask
- 0, // front stencil mask
- 0); // back stencil mask
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- // Check that no extra calls are made on the next draw.
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-
- // Unbind
- DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0);
-
- SetupExpectationsForApplyingDirtyState(
- true, // Framebuffer is RGB
- false, // Framebuffer has depth
- false, // Framebuffer has stencil
- 0x1110, // color bits
- false, // depth mask
- 0, // front stencil mask
- 0); // back stencil mask
-
- EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-}
-
-TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) {
- InitDecoder("", true, false, false, true, false, false);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
- .WillOnce(SetArgumentPointee<1>(8))
- .RetiresOnSaturation();
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(8, result->GetData()[0]);
-}
-
-TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) {
- InitDecoder("", true, false, false, false, false, false);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
- .WillOnce(SetArgumentPointee<1>(8))
- .RetiresOnSaturation();
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(0, result->GetData()[0]);
-}
-
-TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) {
- InitDecoder("", false, true, false, false, true, false);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _))
- .WillOnce(SetArgumentPointee<1>(24))
- .RetiresOnSaturation();
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(24, result->GetData()[0]);
-}
-
-TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) {
- InitDecoder("", false, true, false, false, false, false);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _))
- .WillOnce(SetArgumentPointee<1>(24))
- .RetiresOnSaturation();
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(0, result->GetData()[0]);
-}
-
-TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) {
- InitDecoder("", false, false, true, false, false, true);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _))
- .WillOnce(SetArgumentPointee<1>(8))
- .RetiresOnSaturation();
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(8, result->GetData()[0]);
-}
-
-TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) {
- InitDecoder("", false, false, true, false, false, false);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _))
- .WillOnce(SetArgumentPointee<1>(8))
- .RetiresOnSaturation();
- result->size = 0;
- GetIntegerv cmd2;
- cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
- EXPECT_EQ(
- decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS),
- result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- EXPECT_EQ(0, result->GetData()[0]);
-}
-
// TODO(gman): BufferData
// TODO(gman): BufferDataImmediate
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698