OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 using ::testing::SetArgumentPointee; | 47 using ::testing::SetArgumentPointee; |
48 using ::testing::SetArgPointee; | 48 using ::testing::SetArgPointee; |
49 using ::testing::StrEq; | 49 using ::testing::StrEq; |
50 using ::testing::StrictMock; | 50 using ::testing::StrictMock; |
51 | 51 |
52 namespace gpu { | 52 namespace gpu { |
53 namespace gles2 { | 53 namespace gles2 { |
54 | 54 |
55 using namespace cmds; | 55 using namespace cmds; |
56 | 56 |
57 class GLES2DecoderTestWithExtensionsOnGLES2 | 57 class GLES2DecoderTestWithExtensionsOnGLES2 : public GLES2DecoderTest { |
58 : public GLES2DecoderTest, | |
59 public ::testing::WithParamInterface<const char*> { | |
60 public: | 58 public: |
61 GLES2DecoderTestWithExtensionsOnGLES2() {} | 59 GLES2DecoderTestWithExtensionsOnGLES2() {} |
62 | 60 |
63 virtual void SetUp() { | 61 virtual void SetUp() {} |
| 62 void Init(const char* extensions) { |
64 InitState init; | 63 InitState init; |
65 init.extensions = GetParam(); | 64 init.extensions = extensions; |
66 init.gl_version = "opengl es 2.0"; | 65 init.gl_version = "opengl es 2.0"; |
67 init.has_alpha = true; | 66 init.has_alpha = true; |
68 init.has_depth = true; | 67 init.has_depth = true; |
69 init.request_alpha = true; | 68 init.request_alpha = true; |
70 init.request_depth = true; | 69 init.request_depth = true; |
71 InitDecoder(init); | 70 InitDecoder(init); |
72 } | 71 } |
73 }; | 72 }; |
74 | 73 |
75 TEST_F(GLES2DecoderTest, CheckFramebufferStatusWithNoBoundTarget) { | 74 TEST_P(GLES2DecoderTest, CheckFramebufferStatusWithNoBoundTarget) { |
76 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)).Times(0); | 75 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)).Times(0); |
77 CheckFramebufferStatus::Result* result = | 76 CheckFramebufferStatus::Result* result = |
78 static_cast<CheckFramebufferStatus::Result*>(shared_memory_address_); | 77 static_cast<CheckFramebufferStatus::Result*>(shared_memory_address_); |
79 *result = 0; | 78 *result = 0; |
80 CheckFramebufferStatus cmd; | 79 CheckFramebufferStatus cmd; |
81 cmd.Init(GL_FRAMEBUFFER, shared_memory_id_, shared_memory_offset_); | 80 cmd.Init(GL_FRAMEBUFFER, shared_memory_id_, shared_memory_offset_); |
82 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 81 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
83 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result); | 82 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result); |
84 } | 83 } |
85 | 84 |
86 TEST_F(GLES2DecoderWithShaderTest, BindAndDeleteFramebuffer) { | 85 TEST_P(GLES2DecoderWithShaderTest, BindAndDeleteFramebuffer) { |
87 SetupTexture(); | 86 SetupTexture(); |
88 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 87 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
89 SetupExpectationsForApplyingDefaultDirtyState(); | 88 SetupExpectationsForApplyingDefaultDirtyState(); |
90 DoBindFramebuffer( | 89 DoBindFramebuffer( |
91 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 90 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
92 DoDeleteFramebuffer(client_framebuffer_id_, | 91 DoDeleteFramebuffer(client_framebuffer_id_, |
93 kServiceFramebufferId, | 92 kServiceFramebufferId, |
94 true, | 93 true, |
95 GL_FRAMEBUFFER, | 94 GL_FRAMEBUFFER, |
96 0, | 95 0, |
97 true, | 96 true, |
98 GL_FRAMEBUFFER, | 97 GL_FRAMEBUFFER, |
99 0); | 98 0); |
100 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 99 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
101 .Times(1) | 100 .Times(1) |
102 .RetiresOnSaturation(); | 101 .RetiresOnSaturation(); |
103 DrawArrays cmd; | 102 DrawArrays cmd; |
104 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 103 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
105 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 104 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
106 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 105 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
107 } | 106 } |
108 | 107 |
109 TEST_F(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) { | 108 TEST_P(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) { |
110 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)).Times(0); | 109 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)).Times(0); |
111 FramebufferRenderbuffer cmd; | 110 FramebufferRenderbuffer cmd; |
112 cmd.Init(GL_FRAMEBUFFER, | 111 cmd.Init(GL_FRAMEBUFFER, |
113 GL_COLOR_ATTACHMENT0, | 112 GL_COLOR_ATTACHMENT0, |
114 GL_RENDERBUFFER, | 113 GL_RENDERBUFFER, |
115 client_renderbuffer_id_); | 114 client_renderbuffer_id_); |
116 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 115 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
117 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 116 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
118 } | 117 } |
119 | 118 |
120 TEST_F(GLES2DecoderTest, FramebufferTexture2DWithNoBoundTarget) { | 119 TEST_P(GLES2DecoderTest, FramebufferTexture2DWithNoBoundTarget) { |
121 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0); | 120 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0); |
122 FramebufferTexture2D cmd; | 121 FramebufferTexture2D cmd; |
123 cmd.Init(GL_FRAMEBUFFER, | 122 cmd.Init(GL_FRAMEBUFFER, |
124 GL_COLOR_ATTACHMENT0, | 123 GL_COLOR_ATTACHMENT0, |
125 GL_TEXTURE_2D, | 124 GL_TEXTURE_2D, |
126 client_texture_id_, | 125 client_texture_id_, |
127 0); | 126 0); |
128 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 127 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
129 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 128 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
130 } | 129 } |
131 | 130 |
132 TEST_F(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithNoBoundTarget) { | 131 TEST_P(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithNoBoundTarget) { |
133 EXPECT_CALL(*gl_, GetError()) | 132 EXPECT_CALL(*gl_, GetError()) |
134 .WillOnce(Return(GL_NO_ERROR)) | 133 .WillOnce(Return(GL_NO_ERROR)) |
135 .WillOnce(Return(GL_NO_ERROR)) | 134 .WillOnce(Return(GL_NO_ERROR)) |
136 .RetiresOnSaturation(); | 135 .RetiresOnSaturation(); |
137 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) | 136 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) |
138 .Times(0); | 137 .Times(0); |
139 GetFramebufferAttachmentParameteriv cmd; | 138 GetFramebufferAttachmentParameteriv cmd; |
140 cmd.Init(GL_FRAMEBUFFER, | 139 cmd.Init(GL_FRAMEBUFFER, |
141 GL_COLOR_ATTACHMENT0, | 140 GL_COLOR_ATTACHMENT0, |
142 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, | 141 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, |
143 shared_memory_id_, | 142 shared_memory_id_, |
144 shared_memory_offset_); | 143 shared_memory_offset_); |
145 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 144 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
146 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 145 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
147 } | 146 } |
148 | 147 |
149 TEST_F(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithRenderbuffer) { | 148 TEST_P(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithRenderbuffer) { |
150 DoBindFramebuffer( | 149 DoBindFramebuffer( |
151 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 150 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
152 EXPECT_CALL(*gl_, GetError()) | 151 EXPECT_CALL(*gl_, GetError()) |
153 .WillOnce(Return(GL_NO_ERROR)) | 152 .WillOnce(Return(GL_NO_ERROR)) |
154 .RetiresOnSaturation(); | 153 .RetiresOnSaturation(); |
155 EXPECT_CALL(*gl_, | 154 EXPECT_CALL(*gl_, |
156 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, | 155 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, |
157 GL_COLOR_ATTACHMENT0, | 156 GL_COLOR_ATTACHMENT0, |
158 GL_RENDERBUFFER, | 157 GL_RENDERBUFFER, |
159 kServiceRenderbufferId)) | 158 kServiceRenderbufferId)) |
(...skipping 21 matching lines...) Expand all Loading... |
181 GL_COLOR_ATTACHMENT0, | 180 GL_COLOR_ATTACHMENT0, |
182 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, | 181 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, |
183 shared_memory_id_, | 182 shared_memory_id_, |
184 shared_memory_offset_); | 183 shared_memory_offset_); |
185 EXPECT_EQ(error::kNoError, ExecuteCmd(fbrb_cmd)); | 184 EXPECT_EQ(error::kNoError, ExecuteCmd(fbrb_cmd)); |
186 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 185 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
187 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 186 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
188 EXPECT_EQ(static_cast<GLuint>(*result_value), client_renderbuffer_id_); | 187 EXPECT_EQ(static_cast<GLuint>(*result_value), client_renderbuffer_id_); |
189 } | 188 } |
190 | 189 |
191 TEST_F(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithTexture) { | 190 TEST_P(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithTexture) { |
192 DoBindFramebuffer( | 191 DoBindFramebuffer( |
193 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 192 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
194 EXPECT_CALL(*gl_, GetError()) | 193 EXPECT_CALL(*gl_, GetError()) |
195 .WillOnce(Return(GL_NO_ERROR)) | 194 .WillOnce(Return(GL_NO_ERROR)) |
196 .RetiresOnSaturation(); | 195 .RetiresOnSaturation(); |
197 EXPECT_CALL(*gl_, | 196 EXPECT_CALL(*gl_, |
198 FramebufferTexture2DEXT(GL_FRAMEBUFFER, | 197 FramebufferTexture2DEXT(GL_FRAMEBUFFER, |
199 GL_COLOR_ATTACHMENT0, | 198 GL_COLOR_ATTACHMENT0, |
200 GL_TEXTURE_2D, | 199 GL_TEXTURE_2D, |
201 kServiceTextureId, | 200 kServiceTextureId, |
(...skipping 23 matching lines...) Expand all Loading... |
225 GL_COLOR_ATTACHMENT0, | 224 GL_COLOR_ATTACHMENT0, |
226 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, | 225 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, |
227 shared_memory_id_, | 226 shared_memory_id_, |
228 shared_memory_offset_); | 227 shared_memory_offset_); |
229 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); | 228 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); |
230 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 229 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
231 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 230 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
232 EXPECT_EQ(static_cast<GLuint>(*result_value), client_texture_id_); | 231 EXPECT_EQ(static_cast<GLuint>(*result_value), client_texture_id_); |
233 } | 232 } |
234 | 233 |
235 TEST_F(GLES2DecoderTest, GetRenderbufferParameterivWithNoBoundTarget) { | 234 TEST_P(GLES2DecoderTest, GetRenderbufferParameterivWithNoBoundTarget) { |
236 EXPECT_CALL(*gl_, GetError()) | 235 EXPECT_CALL(*gl_, GetError()) |
237 .WillOnce(Return(GL_NO_ERROR)) | 236 .WillOnce(Return(GL_NO_ERROR)) |
238 .WillOnce(Return(GL_NO_ERROR)) | 237 .WillOnce(Return(GL_NO_ERROR)) |
239 .RetiresOnSaturation(); | 238 .RetiresOnSaturation(); |
240 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0); | 239 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0); |
241 GetRenderbufferParameteriv cmd; | 240 GetRenderbufferParameteriv cmd; |
242 cmd.Init(GL_RENDERBUFFER, | 241 cmd.Init(GL_RENDERBUFFER, |
243 GL_RENDERBUFFER_WIDTH, | 242 GL_RENDERBUFFER_WIDTH, |
244 shared_memory_id_, | 243 shared_memory_id_, |
245 shared_memory_offset_); | 244 shared_memory_offset_); |
246 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 245 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
247 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 246 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
248 } | 247 } |
249 | 248 |
250 TEST_F(GLES2DecoderTest, RenderbufferStorageWithNoBoundTarget) { | 249 TEST_P(GLES2DecoderTest, RenderbufferStorageWithNoBoundTarget) { |
251 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); | 250 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); |
252 RenderbufferStorage cmd; | 251 RenderbufferStorage cmd; |
253 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); | 252 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); |
254 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
255 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 254 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
256 } | 255 } |
257 | 256 |
258 namespace { | 257 namespace { |
259 | 258 |
260 // A class to emulate glReadPixels | 259 // A class to emulate glReadPixels |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // check padding | 467 // check padding |
469 if (yy != in_read_height - 1) { | 468 if (yy != in_read_height - 1) { |
470 GLint num_padding_bytes = | 469 GLint num_padding_bytes = |
471 (kPackAlignment - 1) - (unpadded_row_size % kPackAlignment); | 470 (kPackAlignment - 1) - (unpadded_row_size % kPackAlignment); |
472 EXPECT_EQ(0, | 471 EXPECT_EQ(0, |
473 memcmp(pack.get(), row + unpadded_row_size, num_padding_bytes)); | 472 memcmp(pack.get(), row + unpadded_row_size, num_padding_bytes)); |
474 } | 473 } |
475 } | 474 } |
476 } | 475 } |
477 | 476 |
478 TEST_F(GLES2DecoderTest, ReadPixels) { | 477 TEST_P(GLES2DecoderTest, ReadPixels) { |
479 const GLsizei kWidth = 5; | 478 const GLsizei kWidth = 5; |
480 const GLsizei kHeight = 3; | 479 const GLsizei kHeight = 3; |
481 const GLint kBytesPerPixel = 3; | 480 const GLint kBytesPerPixel = 3; |
482 const GLint kPackAlignment = 4; | 481 const GLint kPackAlignment = 4; |
483 static const int8 kSrcPixels[kWidth * kHeight * kBytesPerPixel] = { | 482 static const int8 kSrcPixels[kWidth * kHeight * kBytesPerPixel] = { |
484 12, 13, 14, 18, 19, 18, 19, 12, 13, 14, 18, 19, 18, 19, 13, | 483 12, 13, 14, 18, 19, 18, 19, 12, 13, 14, 18, 19, 18, 19, 13, |
485 29, 28, 23, 22, 21, 22, 21, 29, 28, 23, 22, 21, 22, 21, 28, | 484 29, 28, 23, 22, 21, 22, 21, 29, 28, 23, 22, 21, 22, 21, 28, |
486 31, 34, 39, 37, 32, 37, 32, 31, 34, 39, 37, 32, 37, 32, 34, | 485 31, 34, 39, 37, 32, 37, 32, 31, 34, 39, 37, 32, 37, 32, 34, |
487 }; | 486 }; |
488 | 487 |
(...skipping 27 matching lines...) Expand all Loading... |
516 result_shm_id, | 515 result_shm_id, |
517 result_shm_offset, | 516 result_shm_offset, |
518 false); | 517 false); |
519 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 518 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
520 for (GLint yy = 0; yy < kHeight; ++yy) { | 519 for (GLint yy = 0; yy < kHeight; ++yy) { |
521 EXPECT_TRUE(emu.CompareRowSegment( | 520 EXPECT_TRUE(emu.CompareRowSegment( |
522 0, yy, kWidth, emu.ComputePackAlignmentAddress(0, yy, kWidth, dest))); | 521 0, yy, kWidth, emu.ComputePackAlignmentAddress(0, yy, kWidth, dest))); |
523 } | 522 } |
524 } | 523 } |
525 | 524 |
526 TEST_F(GLES2DecoderRGBBackbufferTest, ReadPixelsNoAlphaBackbuffer) { | 525 TEST_P(GLES2DecoderRGBBackbufferTest, ReadPixelsNoAlphaBackbuffer) { |
527 const GLsizei kWidth = 3; | 526 const GLsizei kWidth = 3; |
528 const GLsizei kHeight = 3; | 527 const GLsizei kHeight = 3; |
529 const GLint kBytesPerPixel = 4; | 528 const GLint kBytesPerPixel = 4; |
530 const GLint kPackAlignment = 4; | 529 const GLint kPackAlignment = 4; |
531 static const uint8 kExpectedPixels[kWidth * kHeight * kBytesPerPixel] = { | 530 static const uint8 kExpectedPixels[kWidth * kHeight * kBytesPerPixel] = { |
532 12, 13, 14, 255, 19, 18, 19, 255, 13, 14, 18, 255, | 531 12, 13, 14, 255, 19, 18, 19, 255, 13, 14, 18, 255, |
533 29, 28, 23, 255, 21, 22, 21, 255, 28, 23, 22, 255, | 532 29, 28, 23, 255, 21, 22, 21, 255, 28, 23, 22, 255, |
534 31, 34, 39, 255, 32, 37, 32, 255, 34, 39, 37, 255, | 533 31, 34, 39, 255, 32, 37, 32, 255, 34, 39, 37, 255, |
535 }; | 534 }; |
536 static const uint8 kSrcPixels[kWidth * kHeight * kBytesPerPixel] = { | 535 static const uint8 kSrcPixels[kWidth * kHeight * kBytesPerPixel] = { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 result_shm_id, | 571 result_shm_id, |
573 result_shm_offset, | 572 result_shm_offset, |
574 false); | 573 false); |
575 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 574 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
576 for (GLint yy = 0; yy < kHeight; ++yy) { | 575 for (GLint yy = 0; yy < kHeight; ++yy) { |
577 EXPECT_TRUE(emu.CompareRowSegment( | 576 EXPECT_TRUE(emu.CompareRowSegment( |
578 0, yy, kWidth, emu.ComputePackAlignmentAddress(0, yy, kWidth, dest))); | 577 0, yy, kWidth, emu.ComputePackAlignmentAddress(0, yy, kWidth, dest))); |
579 } | 578 } |
580 } | 579 } |
581 | 580 |
582 TEST_F(GLES2DecoderTest, ReadPixelsOutOfRange) { | 581 TEST_P(GLES2DecoderTest, ReadPixelsOutOfRange) { |
583 static GLint tests[][4] = { | 582 static GLint tests[][4] = { |
584 { | 583 { |
585 -2, -1, 9, 5, | 584 -2, -1, 9, 5, |
586 }, // out of range on all sides | 585 }, // out of range on all sides |
587 { | 586 { |
588 2, 1, 9, 5, | 587 2, 1, 9, 5, |
589 }, // out of range on right, bottom | 588 }, // out of range on right, bottom |
590 { | 589 { |
591 -7, -4, 9, 5, | 590 -7, -4, 9, 5, |
592 }, // out of range on left, top | 591 }, // out of range on left, top |
(...skipping 10 matching lines...) Expand all Loading... |
603 5, 0, 9, 5, | 602 5, 0, 9, 5, |
604 }, // completely off right | 603 }, // completely off right |
605 }; | 604 }; |
606 | 605 |
607 for (size_t tt = 0; tt < arraysize(tests); ++tt) { | 606 for (size_t tt = 0; tt < arraysize(tests); ++tt) { |
608 CheckReadPixelsOutOfRange( | 607 CheckReadPixelsOutOfRange( |
609 tests[tt][0], tests[tt][1], tests[tt][2], tests[tt][3], tt == 0); | 608 tests[tt][0], tests[tt][1], tests[tt][2], tests[tt][3], tt == 0); |
610 } | 609 } |
611 } | 610 } |
612 | 611 |
613 TEST_F(GLES2DecoderTest, ReadPixelsInvalidArgs) { | 612 TEST_P(GLES2DecoderTest, ReadPixelsInvalidArgs) { |
614 typedef ReadPixels::Result Result; | 613 typedef ReadPixels::Result Result; |
615 Result* result = GetSharedMemoryAs<Result*>(); | 614 Result* result = GetSharedMemoryAs<Result*>(); |
616 uint32 result_shm_id = kSharedMemoryId; | 615 uint32 result_shm_id = kSharedMemoryId; |
617 uint32 result_shm_offset = kSharedMemoryOffset; | 616 uint32 result_shm_offset = kSharedMemoryOffset; |
618 uint32 pixels_shm_id = kSharedMemoryId; | 617 uint32 pixels_shm_id = kSharedMemoryId; |
619 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); | 618 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); |
620 EXPECT_CALL(*gl_, ReadPixels(_, _, _, _, _, _, _)).Times(0); | 619 EXPECT_CALL(*gl_, ReadPixels(_, _, _, _, _, _, _)).Times(0); |
621 ReadPixels cmd; | 620 ReadPixels cmd; |
622 cmd.Init(0, | 621 cmd.Init(0, |
623 0, | 622 0, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 GL_RGB, | 700 GL_RGB, |
702 GL_UNSIGNED_BYTE, | 701 GL_UNSIGNED_BYTE, |
703 pixels_shm_id, | 702 pixels_shm_id, |
704 pixels_shm_offset, | 703 pixels_shm_offset, |
705 result_shm_id, | 704 result_shm_id, |
706 kInvalidSharedMemoryOffset, | 705 kInvalidSharedMemoryOffset, |
707 false); | 706 false); |
708 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 707 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
709 } | 708 } |
710 | 709 |
711 TEST_F(GLES2DecoderManualInitTest, ReadPixelsAsyncError) { | 710 TEST_P(GLES2DecoderManualInitTest, ReadPixelsAsyncError) { |
712 InitState init; | 711 InitState init; |
713 init.extensions = "GL_ARB_sync"; | 712 init.extensions = "GL_ARB_sync"; |
714 init.gl_version = "opengl es 3.0"; | 713 init.gl_version = "opengl es 3.0"; |
715 init.has_alpha = true; | 714 init.has_alpha = true; |
716 init.request_alpha = true; | 715 init.request_alpha = true; |
717 init.bind_generates_resource = true; | 716 init.bind_generates_resource = true; |
718 InitDecoder(init); | 717 InitDecoder(init); |
719 | 718 |
720 typedef ReadPixels::Result Result; | 719 typedef ReadPixels::Result Result; |
721 Result* result = GetSharedMemoryAs<Result*>(); | 720 Result* result = GetSharedMemoryAs<Result*>(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 pixels_shm_id, | 754 pixels_shm_id, |
756 pixels_shm_offset, | 755 pixels_shm_offset, |
757 result_shm_id, | 756 result_shm_id, |
758 result_shm_offset, | 757 result_shm_offset, |
759 true); | 758 true); |
760 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 759 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
761 } | 760 } |
762 | 761 |
763 // Check that if a renderbuffer is attached and GL returns | 762 // Check that if a renderbuffer is attached and GL returns |
764 // GL_FRAMEBUFFER_COMPLETE that the buffer is cleared and state is restored. | 763 // GL_FRAMEBUFFER_COMPLETE that the buffer is cleared and state is restored. |
765 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearColor) { | 764 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearColor) { |
766 DoBindFramebuffer( | 765 DoBindFramebuffer( |
767 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 766 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
768 ClearColor color_cmd; | 767 ClearColor color_cmd; |
769 ColorMask color_mask_cmd; | 768 ColorMask color_mask_cmd; |
770 Enable enable_cmd; | 769 Enable enable_cmd; |
771 FramebufferRenderbuffer cmd; | 770 FramebufferRenderbuffer cmd; |
772 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); | 771 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); |
773 color_mask_cmd.Init(0, 1, 0, 1); | 772 color_mask_cmd.Init(0, 1, 0, 1); |
774 enable_cmd.Init(GL_SCISSOR_TEST); | 773 enable_cmd.Init(GL_SCISSOR_TEST); |
775 cmd.Init(GL_FRAMEBUFFER, | 774 cmd.Init(GL_FRAMEBUFFER, |
776 GL_COLOR_ATTACHMENT0, | 775 GL_COLOR_ATTACHMENT0, |
777 GL_RENDERBUFFER, | 776 GL_RENDERBUFFER, |
778 client_renderbuffer_id_); | 777 client_renderbuffer_id_); |
779 InSequence sequence; | 778 InSequence sequence; |
780 EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f)) | 779 EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f)) |
781 .Times(1) | 780 .Times(1) |
782 .RetiresOnSaturation(); | 781 .RetiresOnSaturation(); |
| 782 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, true); |
783 EXPECT_CALL(*gl_, GetError()) | 783 EXPECT_CALL(*gl_, GetError()) |
784 .WillOnce(Return(GL_NO_ERROR)) | 784 .WillOnce(Return(GL_NO_ERROR)) |
785 .RetiresOnSaturation(); | 785 .RetiresOnSaturation(); |
786 EXPECT_CALL(*gl_, | 786 EXPECT_CALL(*gl_, |
787 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, | 787 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, |
788 GL_COLOR_ATTACHMENT0, | 788 GL_COLOR_ATTACHMENT0, |
789 GL_RENDERBUFFER, | 789 GL_RENDERBUFFER, |
790 kServiceRenderbufferId)) | 790 kServiceRenderbufferId)) |
791 .Times(1) | 791 .Times(1) |
792 .RetiresOnSaturation(); | 792 .RetiresOnSaturation(); |
793 EXPECT_CALL(*gl_, GetError()) | 793 EXPECT_CALL(*gl_, GetError()) |
794 .WillOnce(Return(GL_NO_ERROR)) | 794 .WillOnce(Return(GL_NO_ERROR)) |
795 .RetiresOnSaturation(); | 795 .RetiresOnSaturation(); |
796 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); | 796 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); |
797 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); | 797 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); |
798 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); | 798 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); |
799 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 799 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
800 } | 800 } |
801 | 801 |
802 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { | 802 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { |
803 DoBindFramebuffer( | 803 DoBindFramebuffer( |
804 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 804 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
805 ClearDepthf depth_cmd; | 805 ClearDepthf depth_cmd; |
806 DepthMask depth_mask_cmd; | 806 DepthMask depth_mask_cmd; |
807 FramebufferRenderbuffer cmd; | 807 FramebufferRenderbuffer cmd; |
808 depth_cmd.Init(0.5f); | 808 depth_cmd.Init(0.5f); |
809 depth_mask_cmd.Init(false); | 809 depth_mask_cmd.Init(false); |
810 cmd.Init(GL_FRAMEBUFFER, | 810 cmd.Init(GL_FRAMEBUFFER, |
811 GL_DEPTH_ATTACHMENT, | 811 GL_DEPTH_ATTACHMENT, |
812 GL_RENDERBUFFER, | 812 GL_RENDERBUFFER, |
(...skipping 11 matching lines...) Expand all Loading... |
824 .Times(1) | 824 .Times(1) |
825 .RetiresOnSaturation(); | 825 .RetiresOnSaturation(); |
826 EXPECT_CALL(*gl_, GetError()) | 826 EXPECT_CALL(*gl_, GetError()) |
827 .WillOnce(Return(GL_NO_ERROR)) | 827 .WillOnce(Return(GL_NO_ERROR)) |
828 .RetiresOnSaturation(); | 828 .RetiresOnSaturation(); |
829 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 829 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
830 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); | 830 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); |
831 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 831 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
832 } | 832 } |
833 | 833 |
834 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { | 834 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { |
835 DoBindFramebuffer( | 835 DoBindFramebuffer( |
836 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 836 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
837 ClearStencil stencil_cmd; | 837 ClearStencil stencil_cmd; |
838 StencilMaskSeparate stencil_mask_separate_cmd; | 838 StencilMaskSeparate stencil_mask_separate_cmd; |
839 FramebufferRenderbuffer cmd; | 839 FramebufferRenderbuffer cmd; |
840 stencil_cmd.Init(123); | 840 stencil_cmd.Init(123); |
841 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); | 841 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); |
842 cmd.Init(GL_FRAMEBUFFER, | 842 cmd.Init(GL_FRAMEBUFFER, |
843 GL_STENCIL_ATTACHMENT, | 843 GL_STENCIL_ATTACHMENT, |
844 GL_RENDERBUFFER, | 844 GL_RENDERBUFFER, |
(...skipping 12 matching lines...) Expand all Loading... |
857 .RetiresOnSaturation(); | 857 .RetiresOnSaturation(); |
858 EXPECT_CALL(*gl_, GetError()) | 858 EXPECT_CALL(*gl_, GetError()) |
859 .WillOnce(Return(GL_NO_ERROR)) | 859 .WillOnce(Return(GL_NO_ERROR)) |
860 .RetiresOnSaturation(); | 860 .RetiresOnSaturation(); |
861 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 861 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
862 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); | 862 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); |
863 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 863 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
864 } | 864 } |
865 | 865 |
866 #if 0 // Turn this test on once we allow GL_DEPTH_STENCIL_ATTACHMENT | 866 #if 0 // Turn this test on once we allow GL_DEPTH_STENCIL_ATTACHMENT |
867 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearDepthStencil) { | 867 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearDepthStencil) { |
868 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 868 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
869 kServiceFramebufferId); | 869 kServiceFramebufferId); |
870 ClearDepthf depth_cmd; | 870 ClearDepthf depth_cmd; |
871 ClearStencil stencil_cmd; | 871 ClearStencil stencil_cmd; |
872 FramebufferRenderbuffer cmd; | 872 FramebufferRenderbuffer cmd; |
873 depth_cmd.Init(0.5f); | 873 depth_cmd.Init(0.5f); |
874 stencil_cmd.Init(123); | 874 stencil_cmd.Init(123); |
875 cmd.Init( | 875 cmd.Init( |
876 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 876 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
877 client_renderbuffer_id_); | 877 client_renderbuffer_id_); |
878 InSequence sequence; | 878 InSequence sequence; |
879 EXPECT_CALL(*gl_, ClearDepth(0.5f)) | 879 EXPECT_CALL(*gl_, ClearDepth(0.5f)) |
880 .Times(1) | 880 .Times(1) |
881 .RetiresOnSaturation(); | 881 .RetiresOnSaturation(); |
882 EXPECT_CALL(*gl_, ClearStencil(123)) | 882 EXPECT_CALL(*gl_, ClearStencil(123)) |
883 .Times(1) | 883 .Times(1) |
884 .RetiresOnSaturation(); | 884 .RetiresOnSaturation(); |
885 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 885 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
886 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 886 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
887 kServiceRenderbufferId)) | 887 kServiceRenderbufferId)) |
888 .Times(1) | 888 .Times(1) |
889 .RetiresOnSaturation(); | 889 .RetiresOnSaturation(); |
890 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 890 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
891 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 891 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
892 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 892 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
893 } | 893 } |
894 #endif | 894 #endif |
895 | 895 |
896 TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { | 896 TEST_P(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { |
897 InitState init; | 897 InitState init; |
898 init.gl_version = "3.0"; | 898 init.gl_version = "3.0"; |
899 init.has_alpha = true; | 899 init.has_alpha = true; |
900 init.request_alpha = true; | 900 init.request_alpha = true; |
901 init.bind_generates_resource = true; | 901 init.bind_generates_resource = true; |
902 InitDecoder(init); | 902 InitDecoder(init); |
903 | 903 |
904 EXPECT_CALL(*gl_, GetError()) | 904 EXPECT_CALL(*gl_, GetError()) |
905 .WillOnce(Return(GL_NO_ERROR)) | 905 .WillOnce(Return(GL_NO_ERROR)) |
906 .WillOnce(Return(GL_NO_ERROR)) | 906 .WillOnce(Return(GL_NO_ERROR)) |
907 .RetiresOnSaturation(); | 907 .RetiresOnSaturation(); |
908 typedef GetIntegerv::Result Result; | 908 typedef GetIntegerv::Result Result; |
909 Result* result = static_cast<Result*>(shared_memory_address_); | 909 Result* result = static_cast<Result*>(shared_memory_address_); |
910 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 910 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
911 .WillOnce(SetArgumentPointee<1>(8)) | 911 .WillOnce(SetArgumentPointee<1>(8)) |
912 .RetiresOnSaturation(); | 912 .RetiresOnSaturation(); |
913 result->size = 0; | 913 result->size = 0; |
914 GetIntegerv cmd2; | 914 GetIntegerv cmd2; |
915 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); | 915 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
916 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 916 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
917 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), | 917 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
918 result->GetNumResults()); | 918 result->GetNumResults()); |
919 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 919 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
920 EXPECT_EQ(8, result->GetData()[0]); | 920 EXPECT_EQ(8, result->GetData()[0]); |
921 } | 921 } |
922 | 922 |
923 TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { | 923 TEST_P(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { |
924 InitState init; | 924 InitState init; |
925 init.gl_version = "3.0"; | 925 init.gl_version = "3.0"; |
926 init.has_alpha = true; | 926 init.has_alpha = true; |
927 init.bind_generates_resource = true; | 927 init.bind_generates_resource = true; |
928 InitDecoder(init); | 928 InitDecoder(init); |
929 | 929 |
930 EXPECT_CALL(*gl_, GetError()) | 930 EXPECT_CALL(*gl_, GetError()) |
931 .WillOnce(Return(GL_NO_ERROR)) | 931 .WillOnce(Return(GL_NO_ERROR)) |
932 .WillOnce(Return(GL_NO_ERROR)) | 932 .WillOnce(Return(GL_NO_ERROR)) |
933 .RetiresOnSaturation(); | 933 .RetiresOnSaturation(); |
934 typedef GetIntegerv::Result Result; | 934 typedef GetIntegerv::Result Result; |
935 Result* result = static_cast<Result*>(shared_memory_address_); | 935 Result* result = static_cast<Result*>(shared_memory_address_); |
936 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 936 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
937 .WillOnce(SetArgumentPointee<1>(8)) | 937 .WillOnce(SetArgumentPointee<1>(8)) |
938 .RetiresOnSaturation(); | 938 .RetiresOnSaturation(); |
939 result->size = 0; | 939 result->size = 0; |
940 GetIntegerv cmd2; | 940 GetIntegerv cmd2; |
941 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); | 941 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
942 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 942 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
943 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), | 943 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
944 result->GetNumResults()); | 944 result->GetNumResults()); |
945 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 945 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
946 EXPECT_EQ(0, result->GetData()[0]); | 946 EXPECT_EQ(0, result->GetData()[0]); |
947 } | 947 } |
948 | 948 |
949 TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { | 949 TEST_P(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { |
950 InitState init; | 950 InitState init; |
951 init.gl_version = "3.0"; | 951 init.gl_version = "3.0"; |
952 init.has_depth = true; | 952 init.has_depth = true; |
953 init.request_depth = true; | 953 init.request_depth = true; |
954 init.bind_generates_resource = true; | 954 init.bind_generates_resource = true; |
955 InitDecoder(init); | 955 InitDecoder(init); |
956 | 956 |
957 EXPECT_CALL(*gl_, GetError()) | 957 EXPECT_CALL(*gl_, GetError()) |
958 .WillOnce(Return(GL_NO_ERROR)) | 958 .WillOnce(Return(GL_NO_ERROR)) |
959 .WillOnce(Return(GL_NO_ERROR)) | 959 .WillOnce(Return(GL_NO_ERROR)) |
960 .RetiresOnSaturation(); | 960 .RetiresOnSaturation(); |
961 typedef GetIntegerv::Result Result; | 961 typedef GetIntegerv::Result Result; |
962 Result* result = static_cast<Result*>(shared_memory_address_); | 962 Result* result = static_cast<Result*>(shared_memory_address_); |
963 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 963 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
964 .WillOnce(SetArgumentPointee<1>(24)) | 964 .WillOnce(SetArgumentPointee<1>(24)) |
965 .RetiresOnSaturation(); | 965 .RetiresOnSaturation(); |
966 result->size = 0; | 966 result->size = 0; |
967 GetIntegerv cmd2; | 967 GetIntegerv cmd2; |
968 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); | 968 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
970 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 970 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
971 result->GetNumResults()); | 971 result->GetNumResults()); |
972 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 972 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
973 EXPECT_EQ(24, result->GetData()[0]); | 973 EXPECT_EQ(24, result->GetData()[0]); |
974 } | 974 } |
975 | 975 |
976 TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { | 976 TEST_P(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { |
977 InitState init; | 977 InitState init; |
978 init.gl_version = "3.0"; | 978 init.gl_version = "3.0"; |
979 init.has_depth = true; | 979 init.has_depth = true; |
980 init.bind_generates_resource = true; | 980 init.bind_generates_resource = true; |
981 InitDecoder(init); | 981 InitDecoder(init); |
982 | 982 |
983 EXPECT_CALL(*gl_, GetError()) | 983 EXPECT_CALL(*gl_, GetError()) |
984 .WillOnce(Return(GL_NO_ERROR)) | 984 .WillOnce(Return(GL_NO_ERROR)) |
985 .WillOnce(Return(GL_NO_ERROR)) | 985 .WillOnce(Return(GL_NO_ERROR)) |
986 .RetiresOnSaturation(); | 986 .RetiresOnSaturation(); |
987 typedef GetIntegerv::Result Result; | 987 typedef GetIntegerv::Result Result; |
988 Result* result = static_cast<Result*>(shared_memory_address_); | 988 Result* result = static_cast<Result*>(shared_memory_address_); |
989 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 989 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
990 .WillOnce(SetArgumentPointee<1>(24)) | 990 .WillOnce(SetArgumentPointee<1>(24)) |
991 .RetiresOnSaturation(); | 991 .RetiresOnSaturation(); |
992 result->size = 0; | 992 result->size = 0; |
993 GetIntegerv cmd2; | 993 GetIntegerv cmd2; |
994 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); | 994 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
995 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 995 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
996 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 996 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
997 result->GetNumResults()); | 997 result->GetNumResults()); |
998 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 998 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
999 EXPECT_EQ(0, result->GetData()[0]); | 999 EXPECT_EQ(0, result->GetData()[0]); |
1000 } | 1000 } |
1001 | 1001 |
1002 TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { | 1002 TEST_P(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { |
1003 InitState init; | 1003 InitState init; |
1004 init.gl_version = "3.0"; | 1004 init.gl_version = "3.0"; |
1005 init.has_stencil = true; | 1005 init.has_stencil = true; |
1006 init.request_stencil = true; | 1006 init.request_stencil = true; |
1007 init.bind_generates_resource = true; | 1007 init.bind_generates_resource = true; |
1008 InitDecoder(init); | 1008 InitDecoder(init); |
1009 | 1009 |
1010 EXPECT_CALL(*gl_, GetError()) | 1010 EXPECT_CALL(*gl_, GetError()) |
1011 .WillOnce(Return(GL_NO_ERROR)) | 1011 .WillOnce(Return(GL_NO_ERROR)) |
1012 .WillOnce(Return(GL_NO_ERROR)) | 1012 .WillOnce(Return(GL_NO_ERROR)) |
1013 .RetiresOnSaturation(); | 1013 .RetiresOnSaturation(); |
1014 typedef GetIntegerv::Result Result; | 1014 typedef GetIntegerv::Result Result; |
1015 Result* result = static_cast<Result*>(shared_memory_address_); | 1015 Result* result = static_cast<Result*>(shared_memory_address_); |
1016 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 1016 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
1017 .WillOnce(SetArgumentPointee<1>(8)) | 1017 .WillOnce(SetArgumentPointee<1>(8)) |
1018 .RetiresOnSaturation(); | 1018 .RetiresOnSaturation(); |
1019 result->size = 0; | 1019 result->size = 0; |
1020 GetIntegerv cmd2; | 1020 GetIntegerv cmd2; |
1021 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); | 1021 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
1022 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 1022 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
1023 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), | 1023 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
1024 result->GetNumResults()); | 1024 result->GetNumResults()); |
1025 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1025 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1026 EXPECT_EQ(8, result->GetData()[0]); | 1026 EXPECT_EQ(8, result->GetData()[0]); |
1027 } | 1027 } |
1028 | 1028 |
1029 TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { | 1029 TEST_P(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { |
1030 InitState init; | 1030 InitState init; |
1031 init.gl_version = "3.0"; | 1031 init.gl_version = "3.0"; |
1032 init.has_stencil = true; | 1032 init.has_stencil = true; |
1033 init.bind_generates_resource = true; | 1033 init.bind_generates_resource = true; |
1034 InitDecoder(init); | 1034 InitDecoder(init); |
1035 | 1035 |
1036 EXPECT_CALL(*gl_, GetError()) | 1036 EXPECT_CALL(*gl_, GetError()) |
1037 .WillOnce(Return(GL_NO_ERROR)) | 1037 .WillOnce(Return(GL_NO_ERROR)) |
1038 .WillOnce(Return(GL_NO_ERROR)) | 1038 .WillOnce(Return(GL_NO_ERROR)) |
1039 .RetiresOnSaturation(); | 1039 .RetiresOnSaturation(); |
1040 typedef GetIntegerv::Result Result; | 1040 typedef GetIntegerv::Result Result; |
1041 Result* result = static_cast<Result*>(shared_memory_address_); | 1041 Result* result = static_cast<Result*>(shared_memory_address_); |
1042 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 1042 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
1043 .WillOnce(SetArgumentPointee<1>(8)) | 1043 .WillOnce(SetArgumentPointee<1>(8)) |
1044 .RetiresOnSaturation(); | 1044 .RetiresOnSaturation(); |
1045 result->size = 0; | 1045 result->size = 0; |
1046 GetIntegerv cmd2; | 1046 GetIntegerv cmd2; |
1047 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); | 1047 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
1048 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 1048 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
1049 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), | 1049 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
1050 result->GetNumResults()); | 1050 result->GetNumResults()); |
1051 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1051 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1052 EXPECT_EQ(0, result->GetData()[0]); | 1052 EXPECT_EQ(0, result->GetData()[0]); |
1053 } | 1053 } |
1054 | 1054 |
1055 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) { | 1055 TEST_P(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) { |
1056 InitState init; | 1056 InitState init; |
1057 init.extensions = "GL_OES_packed_depth_stencil"; | 1057 init.extensions = "GL_OES_packed_depth_stencil"; |
1058 init.gl_version = "opengl es 2.0"; | 1058 init.gl_version = "opengl es 2.0"; |
1059 init.has_depth = true; | 1059 init.has_depth = true; |
1060 init.has_stencil = true; | 1060 init.has_stencil = true; |
1061 init.request_depth = true; | 1061 init.request_depth = true; |
1062 init.request_stencil = true; | 1062 init.request_stencil = true; |
1063 init.bind_generates_resource = true; | 1063 init.bind_generates_resource = true; |
1064 InitDecoder(init); | 1064 InitDecoder(init); |
1065 | 1065 |
(...skipping 21 matching lines...) Expand all Loading... |
1087 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 1087 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
1088 .WillOnce(SetArgumentPointee<1>(24)) | 1088 .WillOnce(SetArgumentPointee<1>(24)) |
1089 .RetiresOnSaturation(); | 1089 .RetiresOnSaturation(); |
1090 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 1090 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
1091 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 1091 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
1092 result->GetNumResults()); | 1092 result->GetNumResults()); |
1093 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1093 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1094 EXPECT_EQ(24, result->GetData()[0]); | 1094 EXPECT_EQ(24, result->GetData()[0]); |
1095 } | 1095 } |
1096 | 1096 |
1097 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) { | 1097 TEST_P(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) { |
1098 InitState init; | 1098 InitState init; |
1099 init.extensions = "GL_OES_packed_depth_stencil"; | 1099 init.extensions = "GL_OES_packed_depth_stencil"; |
1100 init.gl_version = "opengl es 2.0"; | 1100 init.gl_version = "opengl es 2.0"; |
1101 init.has_depth = true; | 1101 init.has_depth = true; |
1102 init.has_stencil = true; | 1102 init.has_stencil = true; |
1103 init.request_depth = true; | 1103 init.request_depth = true; |
1104 init.bind_generates_resource = true; | 1104 init.bind_generates_resource = true; |
1105 InitDecoder(init); | 1105 InitDecoder(init); |
1106 | 1106 |
1107 EXPECT_CALL(*gl_, GetError()) | 1107 EXPECT_CALL(*gl_, GetError()) |
(...skipping 20 matching lines...) Expand all Loading... |
1128 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 1128 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
1129 .WillOnce(SetArgumentPointee<1>(24)) | 1129 .WillOnce(SetArgumentPointee<1>(24)) |
1130 .RetiresOnSaturation(); | 1130 .RetiresOnSaturation(); |
1131 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 1131 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
1132 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 1132 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
1133 result->GetNumResults()); | 1133 result->GetNumResults()); |
1134 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1134 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1135 EXPECT_EQ(24, result->GetData()[0]); | 1135 EXPECT_EQ(24, result->GetData()[0]); |
1136 } | 1136 } |
1137 | 1137 |
1138 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) { | 1138 TEST_P(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) { |
1139 InitState init; | 1139 InitState init; |
1140 init.extensions = "GL_OES_packed_depth_stencil"; | 1140 init.extensions = "GL_OES_packed_depth_stencil"; |
1141 init.gl_version = "opengl es 2.0"; | 1141 init.gl_version = "opengl es 2.0"; |
1142 init.bind_generates_resource = true; | 1142 init.bind_generates_resource = true; |
1143 InitDecoder(init); | 1143 InitDecoder(init); |
1144 DoBindRenderbuffer( | 1144 DoBindRenderbuffer( |
1145 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1145 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1146 DoBindFramebuffer( | 1146 DoBindFramebuffer( |
1147 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1147 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1148 | 1148 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 1197 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
1198 .WillOnce(SetArgumentPointee<1>(24)) | 1198 .WillOnce(SetArgumentPointee<1>(24)) |
1199 .RetiresOnSaturation(); | 1199 .RetiresOnSaturation(); |
1200 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 1200 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
1201 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 1201 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
1202 result->GetNumResults()); | 1202 result->GetNumResults()); |
1203 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1203 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1204 EXPECT_EQ(24, result->GetData()[0]); | 1204 EXPECT_EQ(24, result->GetData()[0]); |
1205 } | 1205 } |
1206 | 1206 |
1207 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) { | 1207 TEST_P(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) { |
1208 InitState init; | 1208 InitState init; |
1209 init.extensions = "GL_OES_packed_depth_stencil"; | 1209 init.extensions = "GL_OES_packed_depth_stencil"; |
1210 init.gl_version = "opengl es 2.0"; | 1210 init.gl_version = "opengl es 2.0"; |
1211 init.bind_generates_resource = true; | 1211 init.bind_generates_resource = true; |
1212 InitDecoder(init); | 1212 InitDecoder(init); |
1213 DoBindRenderbuffer( | 1213 DoBindRenderbuffer( |
1214 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1214 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1215 DoBindFramebuffer( | 1215 DoBindFramebuffer( |
1216 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1216 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1217 | 1217 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 1266 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
1267 .WillOnce(SetArgumentPointee<1>(24)) | 1267 .WillOnce(SetArgumentPointee<1>(24)) |
1268 .RetiresOnSaturation(); | 1268 .RetiresOnSaturation(); |
1269 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 1269 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
1270 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 1270 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
1271 result->GetNumResults()); | 1271 result->GetNumResults()); |
1272 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1272 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1273 EXPECT_EQ(0, result->GetData()[0]); | 1273 EXPECT_EQ(0, result->GetData()[0]); |
1274 } | 1274 } |
1275 | 1275 |
1276 TEST_F(GLES2DecoderTest, FramebufferRenderbufferGLError) { | 1276 TEST_P(GLES2DecoderTest, FramebufferRenderbufferGLError) { |
1277 DoBindFramebuffer( | 1277 DoBindFramebuffer( |
1278 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1278 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1279 EXPECT_CALL(*gl_, GetError()) | 1279 EXPECT_CALL(*gl_, GetError()) |
1280 .WillOnce(Return(GL_NO_ERROR)) | 1280 .WillOnce(Return(GL_NO_ERROR)) |
1281 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 1281 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
1282 .RetiresOnSaturation(); | 1282 .RetiresOnSaturation(); |
1283 EXPECT_CALL(*gl_, | 1283 EXPECT_CALL(*gl_, |
1284 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, | 1284 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, |
1285 GL_COLOR_ATTACHMENT0, | 1285 GL_COLOR_ATTACHMENT0, |
1286 GL_RENDERBUFFER, | 1286 GL_RENDERBUFFER, |
1287 kServiceRenderbufferId)) | 1287 kServiceRenderbufferId)) |
1288 .Times(1) | 1288 .Times(1) |
1289 .RetiresOnSaturation(); | 1289 .RetiresOnSaturation(); |
1290 FramebufferRenderbuffer cmd; | 1290 FramebufferRenderbuffer cmd; |
1291 cmd.Init(GL_FRAMEBUFFER, | 1291 cmd.Init(GL_FRAMEBUFFER, |
1292 GL_COLOR_ATTACHMENT0, | 1292 GL_COLOR_ATTACHMENT0, |
1293 GL_RENDERBUFFER, | 1293 GL_RENDERBUFFER, |
1294 client_renderbuffer_id_); | 1294 client_renderbuffer_id_); |
1295 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1295 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1296 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1296 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
1297 } | 1297 } |
1298 | 1298 |
1299 TEST_F(GLES2DecoderTest, FramebufferTexture2DGLError) { | 1299 TEST_P(GLES2DecoderTest, FramebufferTexture2DGLError) { |
1300 const GLsizei kWidth = 5; | 1300 const GLsizei kWidth = 5; |
1301 const GLsizei kHeight = 3; | 1301 const GLsizei kHeight = 3; |
1302 const GLenum kFormat = GL_RGB; | 1302 const GLenum kFormat = GL_RGB; |
1303 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1303 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
1304 DoTexImage2D(GL_TEXTURE_2D, | 1304 DoTexImage2D(GL_TEXTURE_2D, |
1305 0, | 1305 0, |
1306 kFormat, | 1306 kFormat, |
1307 kWidth, | 1307 kWidth, |
1308 kHeight, | 1308 kHeight, |
1309 0, | 1309 0, |
(...skipping 18 matching lines...) Expand all Loading... |
1328 FramebufferTexture2D fbtex_cmd; | 1328 FramebufferTexture2D fbtex_cmd; |
1329 fbtex_cmd.Init(GL_FRAMEBUFFER, | 1329 fbtex_cmd.Init(GL_FRAMEBUFFER, |
1330 GL_COLOR_ATTACHMENT0, | 1330 GL_COLOR_ATTACHMENT0, |
1331 GL_TEXTURE_2D, | 1331 GL_TEXTURE_2D, |
1332 client_texture_id_, | 1332 client_texture_id_, |
1333 0); | 1333 0); |
1334 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); | 1334 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); |
1335 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1335 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
1336 } | 1336 } |
1337 | 1337 |
1338 TEST_F(GLES2DecoderTest, RenderbufferStorageGLError) { | 1338 TEST_P(GLES2DecoderTest, RenderbufferStorageGLError) { |
1339 DoBindRenderbuffer( | 1339 DoBindRenderbuffer( |
1340 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1340 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1341 EXPECT_CALL(*gl_, GetError()) | 1341 EXPECT_CALL(*gl_, GetError()) |
1342 .WillOnce(Return(GL_NO_ERROR)) | 1342 .WillOnce(Return(GL_NO_ERROR)) |
1343 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 1343 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
1344 .RetiresOnSaturation(); | 1344 .RetiresOnSaturation(); |
1345 EXPECT_CALL(*gl_, RenderbufferStorageEXT(GL_RENDERBUFFER, GL_RGBA, 100, 50)) | 1345 EXPECT_CALL(*gl_, RenderbufferStorageEXT(GL_RENDERBUFFER, GL_RGBA, 100, 50)) |
1346 .Times(1) | 1346 .Times(1) |
1347 .RetiresOnSaturation(); | 1347 .RetiresOnSaturation(); |
1348 RenderbufferStorage cmd; | 1348 RenderbufferStorage cmd; |
1349 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 100, 50); | 1349 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 100, 50); |
1350 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1350 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1351 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1351 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
1352 } | 1352 } |
1353 | 1353 |
1354 TEST_F(GLES2DecoderTest, RenderbufferStorageBadArgs) { | 1354 TEST_P(GLES2DecoderTest, RenderbufferStorageBadArgs) { |
1355 DoBindRenderbuffer( | 1355 DoBindRenderbuffer( |
1356 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1356 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1357 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)) | 1357 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)) |
1358 .Times(0) | 1358 .Times(0) |
1359 .RetiresOnSaturation(); | 1359 .RetiresOnSaturation(); |
1360 RenderbufferStorage cmd; | 1360 RenderbufferStorage cmd; |
1361 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, TestHelper::kMaxRenderbufferSize + 1, 1); | 1361 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, TestHelper::kMaxRenderbufferSize + 1, 1); |
1362 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1362 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1363 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1363 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
1364 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 1, TestHelper::kMaxRenderbufferSize + 1); | 1364 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 1, TestHelper::kMaxRenderbufferSize + 1); |
1365 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1365 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1366 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1366 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
1367 } | 1367 } |
1368 | 1368 |
1369 TEST_F(GLES2DecoderManualInitTest, | 1369 TEST_P(GLES2DecoderManualInitTest, |
1370 RenderbufferStorageMultisampleCHROMIUMGLError) { | 1370 RenderbufferStorageMultisampleCHROMIUMGLError) { |
1371 InitState init; | 1371 InitState init; |
1372 init.extensions = "GL_EXT_framebuffer_multisample"; | 1372 init.extensions = "GL_EXT_framebuffer_multisample"; |
1373 init.gl_version = "2.1"; | 1373 init.gl_version = "2.1"; |
1374 init.bind_generates_resource = true; | 1374 init.bind_generates_resource = true; |
1375 InitDecoder(init); | 1375 InitDecoder(init); |
1376 DoBindRenderbuffer( | 1376 DoBindRenderbuffer( |
1377 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1377 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1378 EXPECT_CALL(*gl_, GetError()) | 1378 EXPECT_CALL(*gl_, GetError()) |
1379 .WillOnce(Return(GL_NO_ERROR)) | 1379 .WillOnce(Return(GL_NO_ERROR)) |
1380 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 1380 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
1381 .RetiresOnSaturation(); | 1381 .RetiresOnSaturation(); |
1382 EXPECT_CALL( | 1382 EXPECT_CALL( |
1383 *gl_, | 1383 *gl_, |
1384 RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 1, GL_RGBA, 100, 50)) | 1384 RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 1, GL_RGBA, 100, 50)) |
1385 .Times(1) | 1385 .Times(1) |
1386 .RetiresOnSaturation(); | 1386 .RetiresOnSaturation(); |
1387 RenderbufferStorageMultisampleCHROMIUM cmd; | 1387 RenderbufferStorageMultisampleCHROMIUM cmd; |
1388 cmd.Init(GL_RENDERBUFFER, 1, GL_RGBA4, 100, 50); | 1388 cmd.Init(GL_RENDERBUFFER, 1, GL_RGBA4, 100, 50); |
1389 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1389 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1390 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1390 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
1391 } | 1391 } |
1392 | 1392 |
1393 TEST_F(GLES2DecoderManualInitTest, | 1393 TEST_P(GLES2DecoderManualInitTest, |
1394 RenderbufferStorageMultisampleCHROMIUMBadArgs) { | 1394 RenderbufferStorageMultisampleCHROMIUMBadArgs) { |
1395 InitState init; | 1395 InitState init; |
1396 init.extensions = "GL_EXT_framebuffer_multisample"; | 1396 init.extensions = "GL_EXT_framebuffer_multisample"; |
1397 init.gl_version = "2.1"; | 1397 init.gl_version = "2.1"; |
1398 init.bind_generates_resource = true; | 1398 init.bind_generates_resource = true; |
1399 InitDecoder(init); | 1399 InitDecoder(init); |
1400 DoBindRenderbuffer( | 1400 DoBindRenderbuffer( |
1401 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1401 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1402 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT(_, _, _, _, _)) | 1402 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT(_, _, _, _, _)) |
1403 .Times(0) | 1403 .Times(0) |
(...skipping 15 matching lines...) Expand all Loading... |
1419 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1419 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
1420 cmd.Init(GL_RENDERBUFFER, | 1420 cmd.Init(GL_RENDERBUFFER, |
1421 TestHelper::kMaxSamples, | 1421 TestHelper::kMaxSamples, |
1422 GL_RGBA4, | 1422 GL_RGBA4, |
1423 1, | 1423 1, |
1424 TestHelper::kMaxRenderbufferSize + 1); | 1424 TestHelper::kMaxRenderbufferSize + 1); |
1425 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1425 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1426 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1426 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
1427 } | 1427 } |
1428 | 1428 |
1429 TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleCHROMIUM) { | 1429 TEST_P(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleCHROMIUM) { |
1430 InitState init; | 1430 InitState init; |
1431 init.extensions = "GL_EXT_framebuffer_multisample"; | 1431 init.extensions = "GL_EXT_framebuffer_multisample"; |
1432 init.gl_version = "2.1"; | 1432 init.gl_version = "2.1"; |
1433 InitDecoder(init); | 1433 InitDecoder(init); |
1434 DoBindRenderbuffer( | 1434 DoBindRenderbuffer( |
1435 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1435 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1436 InSequence sequence; | 1436 InSequence sequence; |
1437 EXPECT_CALL(*gl_, GetError()) | 1437 EXPECT_CALL(*gl_, GetError()) |
1438 .WillOnce(Return(GL_NO_ERROR)) | 1438 .WillOnce(Return(GL_NO_ERROR)) |
1439 .RetiresOnSaturation(); | 1439 .RetiresOnSaturation(); |
(...skipping 12 matching lines...) Expand all Loading... |
1452 RenderbufferStorageMultisampleCHROMIUM cmd; | 1452 RenderbufferStorageMultisampleCHROMIUM cmd; |
1453 cmd.Init(GL_RENDERBUFFER, | 1453 cmd.Init(GL_RENDERBUFFER, |
1454 TestHelper::kMaxSamples, | 1454 TestHelper::kMaxSamples, |
1455 GL_RGBA4, | 1455 GL_RGBA4, |
1456 TestHelper::kMaxRenderbufferSize, | 1456 TestHelper::kMaxRenderbufferSize, |
1457 1); | 1457 1); |
1458 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1458 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1459 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1459 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1460 } | 1460 } |
1461 | 1461 |
1462 TEST_F(GLES2DecoderManualInitTest, | 1462 TEST_P(GLES2DecoderManualInitTest, |
1463 RenderbufferStorageMultisampleEXTNotSupported) { | 1463 RenderbufferStorageMultisampleEXTNotSupported) { |
1464 InitState init; | 1464 InitState init; |
1465 init.extensions = "GL_EXT_framebuffer_multisample"; | 1465 init.extensions = "GL_EXT_framebuffer_multisample"; |
1466 init.gl_version = "2.1"; | 1466 init.gl_version = "2.1"; |
1467 init.bind_generates_resource = true; | 1467 init.bind_generates_resource = true; |
1468 InitDecoder(init); | 1468 InitDecoder(init); |
1469 DoBindRenderbuffer( | 1469 DoBindRenderbuffer( |
1470 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1470 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1471 InSequence sequence; | 1471 InSequence sequence; |
1472 // GL_EXT_framebuffer_multisample uses RenderbufferStorageMultisampleCHROMIUM. | 1472 // GL_EXT_framebuffer_multisample uses RenderbufferStorageMultisampleCHROMIUM. |
1473 RenderbufferStorageMultisampleEXT cmd; | 1473 RenderbufferStorageMultisampleEXT cmd; |
1474 cmd.Init(GL_RENDERBUFFER, | 1474 cmd.Init(GL_RENDERBUFFER, |
1475 TestHelper::kMaxSamples, | 1475 TestHelper::kMaxSamples, |
1476 GL_RGBA4, | 1476 GL_RGBA4, |
1477 TestHelper::kMaxRenderbufferSize, | 1477 TestHelper::kMaxRenderbufferSize, |
1478 1); | 1478 1); |
1479 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1479 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1480 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1480 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1481 } | 1481 } |
1482 | 1482 |
1483 class GLES2DecoderMultisampledRenderToTextureTest | 1483 class GLES2DecoderMultisampledRenderToTextureTest |
1484 : public GLES2DecoderTestWithExtensionsOnGLES2 {}; | 1484 : public GLES2DecoderTestWithExtensionsOnGLES2 { |
| 1485 public: |
| 1486 void TestNotCompatibleWithRenderbufferStorageMultisampleCHROMIUM() { |
| 1487 DoBindRenderbuffer( |
| 1488 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
| 1489 RenderbufferStorageMultisampleCHROMIUM cmd; |
| 1490 cmd.Init(GL_RENDERBUFFER, |
| 1491 TestHelper::kMaxSamples, |
| 1492 GL_RGBA4, |
| 1493 TestHelper::kMaxRenderbufferSize, |
| 1494 1); |
| 1495 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1496 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1497 } |
| 1498 |
| 1499 void TestRenderbufferStorageMultisampleEXT(const char* extension) { |
| 1500 DoBindRenderbuffer( |
| 1501 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
| 1502 InSequence sequence; |
| 1503 EXPECT_CALL(*gl_, GetError()) |
| 1504 .WillOnce(Return(GL_NO_ERROR)) |
| 1505 .RetiresOnSaturation(); |
| 1506 if (strstr(extension, "GL_IMG_multisampled_render_to_texture")) { |
| 1507 EXPECT_CALL( |
| 1508 *gl_, |
| 1509 RenderbufferStorageMultisampleIMG(GL_RENDERBUFFER, |
| 1510 TestHelper::kMaxSamples, |
| 1511 GL_RGBA, |
| 1512 TestHelper::kMaxRenderbufferSize, |
| 1513 1)) |
| 1514 .Times(1) |
| 1515 .RetiresOnSaturation(); |
| 1516 } else { |
| 1517 EXPECT_CALL( |
| 1518 *gl_, |
| 1519 RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, |
| 1520 TestHelper::kMaxSamples, |
| 1521 GL_RGBA, |
| 1522 TestHelper::kMaxRenderbufferSize, |
| 1523 1)) |
| 1524 .Times(1) |
| 1525 .RetiresOnSaturation(); |
| 1526 } |
| 1527 EXPECT_CALL(*gl_, GetError()) |
| 1528 .WillOnce(Return(GL_NO_ERROR)) |
| 1529 .RetiresOnSaturation(); |
| 1530 RenderbufferStorageMultisampleEXT cmd; |
| 1531 cmd.Init(GL_RENDERBUFFER, |
| 1532 TestHelper::kMaxSamples, |
| 1533 GL_RGBA4, |
| 1534 TestHelper::kMaxRenderbufferSize, |
| 1535 1); |
| 1536 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1537 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1538 } |
| 1539 }; |
| 1540 |
| 1541 INSTANTIATE_TEST_CASE_P(Service, |
| 1542 GLES2DecoderMultisampledRenderToTextureTest, |
| 1543 ::testing::Bool()); |
1485 | 1544 |
1486 TEST_P(GLES2DecoderMultisampledRenderToTextureTest, | 1545 TEST_P(GLES2DecoderMultisampledRenderToTextureTest, |
1487 NotCompatibleWithRenderbufferStorageMultisampleCHROMIUM) { | 1546 NotCompatibleWithRenderbufferStorageMultisampleCHROMIUM_EXT) { |
1488 DoBindRenderbuffer( | 1547 Init("GL_EXT_multisampled_render_to_texture"); |
1489 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1548 TestNotCompatibleWithRenderbufferStorageMultisampleCHROMIUM(); |
1490 RenderbufferStorageMultisampleCHROMIUM cmd; | |
1491 cmd.Init(GL_RENDERBUFFER, | |
1492 TestHelper::kMaxSamples, | |
1493 GL_RGBA4, | |
1494 TestHelper::kMaxRenderbufferSize, | |
1495 1); | |
1496 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
1497 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | |
1498 } | 1549 } |
1499 | 1550 |
1500 TEST_P(GLES2DecoderMultisampledRenderToTextureTest, | 1551 TEST_P(GLES2DecoderMultisampledRenderToTextureTest, |
1501 RenderbufferStorageMultisampleEXT) { | 1552 NotCompatibleWithRenderbufferStorageMultisampleCHROMIUM_IMG) { |
1502 DoBindRenderbuffer( | 1553 Init("GL_IMG_multisampled_render_to_texture"); |
1503 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1554 TestNotCompatibleWithRenderbufferStorageMultisampleCHROMIUM(); |
1504 InSequence sequence; | |
1505 EXPECT_CALL(*gl_, GetError()) | |
1506 .WillOnce(Return(GL_NO_ERROR)) | |
1507 .RetiresOnSaturation(); | |
1508 if (strstr(GetParam(), "GL_IMG_multisampled_render_to_texture")) { | |
1509 EXPECT_CALL( | |
1510 *gl_, | |
1511 RenderbufferStorageMultisampleIMG(GL_RENDERBUFFER, | |
1512 TestHelper::kMaxSamples, | |
1513 GL_RGBA, | |
1514 TestHelper::kMaxRenderbufferSize, | |
1515 1)) | |
1516 .Times(1) | |
1517 .RetiresOnSaturation(); | |
1518 } else { | |
1519 EXPECT_CALL( | |
1520 *gl_, | |
1521 RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, | |
1522 TestHelper::kMaxSamples, | |
1523 GL_RGBA, | |
1524 TestHelper::kMaxRenderbufferSize, | |
1525 1)) | |
1526 .Times(1) | |
1527 .RetiresOnSaturation(); | |
1528 } | |
1529 EXPECT_CALL(*gl_, GetError()) | |
1530 .WillOnce(Return(GL_NO_ERROR)) | |
1531 .RetiresOnSaturation(); | |
1532 RenderbufferStorageMultisampleEXT cmd; | |
1533 cmd.Init(GL_RENDERBUFFER, | |
1534 TestHelper::kMaxSamples, | |
1535 GL_RGBA4, | |
1536 TestHelper::kMaxRenderbufferSize, | |
1537 1); | |
1538 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
1539 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
1540 } | 1555 } |
1541 | 1556 |
1542 INSTANTIATE_TEST_CASE_P( | 1557 TEST_P(GLES2DecoderMultisampledRenderToTextureTest, |
1543 GLES2DecoderMultisampledRenderToTextureTests, | 1558 RenderbufferStorageMultisampleEXT_EXT) { |
1544 GLES2DecoderMultisampledRenderToTextureTest, | 1559 Init("GL_EXT_multisampled_render_to_texture"); |
1545 ::testing::Values("GL_EXT_multisampled_render_to_texture", | 1560 TestRenderbufferStorageMultisampleEXT( |
1546 "GL_IMG_multisampled_render_to_texture")); | 1561 "GL_EXT_multisampled_render_to_texture"); |
| 1562 } |
1547 | 1563 |
1548 TEST_F(GLES2DecoderTest, ReadPixelsGLError) { | 1564 TEST_P(GLES2DecoderMultisampledRenderToTextureTest, |
| 1565 RenderbufferStorageMultisampleEXT_IMG) { |
| 1566 Init("GL_IMG_multisampled_render_to_texture"); |
| 1567 TestRenderbufferStorageMultisampleEXT( |
| 1568 "GL_IMG_multisampled_render_to_texture"); |
| 1569 } |
| 1570 |
| 1571 TEST_P(GLES2DecoderTest, ReadPixelsGLError) { |
1549 GLenum kFormat = GL_RGBA; | 1572 GLenum kFormat = GL_RGBA; |
1550 GLint x = 0; | 1573 GLint x = 0; |
1551 GLint y = 0; | 1574 GLint y = 0; |
1552 GLsizei width = 2; | 1575 GLsizei width = 2; |
1553 GLsizei height = 4; | 1576 GLsizei height = 4; |
1554 typedef ReadPixels::Result Result; | 1577 typedef ReadPixels::Result Result; |
1555 Result* result = GetSharedMemoryAs<Result*>(); | 1578 Result* result = GetSharedMemoryAs<Result*>(); |
1556 uint32 result_shm_id = kSharedMemoryId; | 1579 uint32 result_shm_id = kSharedMemoryId; |
1557 uint32 result_shm_offset = kSharedMemoryOffset; | 1580 uint32 result_shm_offset = kSharedMemoryOffset; |
1558 uint32 pixels_shm_id = kSharedMemoryId; | 1581 uint32 pixels_shm_id = kSharedMemoryId; |
(...skipping 15 matching lines...) Expand all Loading... |
1574 GL_UNSIGNED_BYTE, | 1597 GL_UNSIGNED_BYTE, |
1575 pixels_shm_id, | 1598 pixels_shm_id, |
1576 pixels_shm_offset, | 1599 pixels_shm_offset, |
1577 result_shm_id, | 1600 result_shm_id, |
1578 result_shm_offset, | 1601 result_shm_offset, |
1579 false); | 1602 false); |
1580 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1603 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1581 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1604 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
1582 } | 1605 } |
1583 | 1606 |
1584 TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnClear) { | 1607 TEST_P(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnClear) { |
1585 const GLuint kFBOClientTextureId = 4100; | 1608 const GLuint kFBOClientTextureId = 4100; |
1586 const GLuint kFBOServiceTextureId = 4101; | 1609 const GLuint kFBOServiceTextureId = 4101; |
1587 | 1610 |
1588 // Register a texture id. | 1611 // Register a texture id. |
1589 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1612 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1590 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1613 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
1591 .RetiresOnSaturation(); | 1614 .RetiresOnSaturation(); |
1592 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1615 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1593 | 1616 |
1594 // Setup "render to" texture. | 1617 // Setup "render to" texture. |
(...skipping 23 matching lines...) Expand all Loading... |
1618 1.0f, // depth | 1641 1.0f, // depth |
1619 false); // scissor test | 1642 false); // scissor test |
1620 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 1643 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
1621 false, // Framebuffer has depth | 1644 false, // Framebuffer has depth |
1622 false, // Framebuffer has stencil | 1645 false, // Framebuffer has stencil |
1623 0x1111, // color bits | 1646 0x1111, // color bits |
1624 false, // depth mask | 1647 false, // depth mask |
1625 false, // depth enabled | 1648 false, // depth enabled |
1626 0, // front stencil mask | 1649 0, // front stencil mask |
1627 0, // back stencil mask | 1650 0, // back stencil mask |
1628 false, // stencil enabled | 1651 false); // stencil enabled |
1629 false, // cull_face_enabled | |
1630 false, // scissor_test_enabled | |
1631 false); // blend_enabled | |
1632 | 1652 |
1633 EXPECT_CALL(*gl_, Clear(GL_COLOR_BUFFER_BIT)).Times(1).RetiresOnSaturation(); | 1653 EXPECT_CALL(*gl_, Clear(GL_COLOR_BUFFER_BIT)).Times(1).RetiresOnSaturation(); |
1634 | 1654 |
1635 Clear cmd; | 1655 Clear cmd; |
1636 cmd.Init(GL_COLOR_BUFFER_BIT); | 1656 cmd.Init(GL_COLOR_BUFFER_BIT); |
1637 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1657 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1638 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1658 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1639 } | 1659 } |
1640 | 1660 |
1641 TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnReadPixels) { | 1661 TEST_P(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnReadPixels) { |
1642 const GLuint kFBOClientTextureId = 4100; | 1662 const GLuint kFBOClientTextureId = 4100; |
1643 const GLuint kFBOServiceTextureId = 4101; | 1663 const GLuint kFBOServiceTextureId = 4101; |
1644 | 1664 |
1645 // Register a texture id. | 1665 // Register a texture id. |
1646 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1666 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1647 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1667 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
1648 .RetiresOnSaturation(); | 1668 .RetiresOnSaturation(); |
1649 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1669 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1650 | 1670 |
1651 // Setup "render to" texture. | 1671 // Setup "render to" texture. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 GL_UNSIGNED_BYTE, | 1717 GL_UNSIGNED_BYTE, |
1698 pixels_shm_id, | 1718 pixels_shm_id, |
1699 pixels_shm_offset, | 1719 pixels_shm_offset, |
1700 result_shm_id, | 1720 result_shm_id, |
1701 result_shm_offset, | 1721 result_shm_offset, |
1702 false); | 1722 false); |
1703 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1723 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1704 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1724 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1705 } | 1725 } |
1706 | 1726 |
1707 TEST_F(GLES2DecoderManualInitTest, | 1727 TEST_P(GLES2DecoderManualInitTest, |
1708 UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) { | 1728 UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) { |
1709 InitState init; | 1729 InitState init; |
1710 init.extensions = "GL_EXT_framebuffer_multisample"; | 1730 init.extensions = "GL_EXT_framebuffer_multisample"; |
1711 init.gl_version = "2.1"; | 1731 init.gl_version = "2.1"; |
1712 init.bind_generates_resource = true; | 1732 init.bind_generates_resource = true; |
1713 InitDecoder(init); | 1733 InitDecoder(init); |
1714 const GLuint kFBOClientTextureId = 4100; | 1734 const GLuint kFBOClientTextureId = 4100; |
1715 const GLuint kFBOServiceTextureId = 4101; | 1735 const GLuint kFBOServiceTextureId = 4101; |
1716 | 1736 |
1717 // Register a texture id. | 1737 // Register a texture id. |
1718 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1738 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1719 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1739 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
1720 .RetiresOnSaturation(); | 1740 .RetiresOnSaturation(); |
1721 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1741 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1722 | 1742 |
1723 // Setup "render from" texture. | 1743 // Setup "render from" texture. |
1724 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | 1744 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
1725 DoTexImage2D( | 1745 DoTexImage2D( |
1726 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1746 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1727 DoBindFramebuffer( | 1747 DoBindFramebuffer( |
1728 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1748 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1729 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, | 1749 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, |
1730 GL_COLOR_ATTACHMENT0, | 1750 GL_COLOR_ATTACHMENT0, |
1731 GL_TEXTURE_2D, | 1751 GL_TEXTURE_2D, |
1732 kFBOClientTextureId, | 1752 kFBOClientTextureId, |
1733 kFBOServiceTextureId, | 1753 kFBOServiceTextureId, |
1734 0, | 1754 0, |
1735 GL_NO_ERROR); | 1755 GL_NO_ERROR); |
1736 | 1756 |
| 1757 // Enable GL_SCISSOR_TEST to make sure we disable it in the clear, |
| 1758 // then re-enable after. |
| 1759 DoEnableDisable(GL_SCISSOR_TEST, true); |
| 1760 |
1737 SetupExpectationsForFramebufferClearingMulti( | 1761 SetupExpectationsForFramebufferClearingMulti( |
1738 kServiceFramebufferId, // read framebuffer service id | 1762 kServiceFramebufferId, // read framebuffer service id |
1739 0, // backbuffer service id | 1763 0, // backbuffer service id |
1740 GL_READ_FRAMEBUFFER, // target | 1764 GL_READ_FRAMEBUFFER, // target |
1741 GL_COLOR_BUFFER_BIT, // clear bits | 1765 GL_COLOR_BUFFER_BIT, // clear bits |
1742 0, | 1766 0, |
1743 0, | 1767 0, |
1744 0, | 1768 0, |
1745 0, // color | 1769 0, // color |
1746 0, // stencil | 1770 0, // stencil |
1747 1.0f, // depth | 1771 1.0f, // depth |
1748 false); // scissor test | 1772 true); // scissor test |
1749 | 1773 |
1750 EXPECT_CALL(*gl_, GetError()) | 1774 EXPECT_CALL(*gl_, GetError()) |
1751 .WillOnce(Return(GL_NO_ERROR)) | 1775 .WillOnce(Return(GL_NO_ERROR)) |
1752 .WillOnce(Return(GL_NO_ERROR)) | 1776 .WillOnce(Return(GL_NO_ERROR)) |
1753 .RetiresOnSaturation(); | 1777 .RetiresOnSaturation(); |
1754 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _)) | 1778 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _)) |
1755 .Times(1) | 1779 .Times(1) |
1756 .RetiresOnSaturation(); | 1780 .RetiresOnSaturation(); |
1757 typedef ReadPixels::Result Result; | 1781 typedef ReadPixels::Result Result; |
1758 uint32 result_shm_id = kSharedMemoryId; | 1782 uint32 result_shm_id = kSharedMemoryId; |
1759 uint32 result_shm_offset = kSharedMemoryOffset; | 1783 uint32 result_shm_offset = kSharedMemoryOffset; |
1760 uint32 pixels_shm_id = kSharedMemoryId; | 1784 uint32 pixels_shm_id = kSharedMemoryId; |
1761 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(Result); | 1785 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(Result); |
1762 ReadPixels cmd; | 1786 ReadPixels cmd; |
1763 cmd.Init(0, | 1787 cmd.Init(0, |
1764 0, | 1788 0, |
1765 1, | 1789 1, |
1766 1, | 1790 1, |
1767 GL_RGBA, | 1791 GL_RGBA, |
1768 GL_UNSIGNED_BYTE, | 1792 GL_UNSIGNED_BYTE, |
1769 pixels_shm_id, | 1793 pixels_shm_id, |
1770 pixels_shm_offset, | 1794 pixels_shm_offset, |
1771 result_shm_id, | 1795 result_shm_id, |
1772 result_shm_offset, | 1796 result_shm_offset, |
1773 false); | 1797 false); |
1774 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1798 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1775 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1799 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1776 } | 1800 } |
1777 | 1801 |
1778 TEST_F(GLES2DecoderWithShaderTest, CopyTexImageWithInCompleteFBOFails) { | 1802 TEST_P(GLES2DecoderWithShaderTest, CopyTexImageWithInCompleteFBOFails) { |
1779 GLenum target = GL_TEXTURE_2D; | 1803 GLenum target = GL_TEXTURE_2D; |
1780 GLint level = 0; | 1804 GLint level = 0; |
1781 GLenum internal_format = GL_RGBA; | 1805 GLenum internal_format = GL_RGBA; |
1782 GLsizei width = 2; | 1806 GLsizei width = 2; |
1783 GLsizei height = 4; | 1807 GLsizei height = 4; |
1784 GLint border = 0; | 1808 GLint border = 0; |
1785 SetupTexture(); | 1809 SetupTexture(); |
1786 DoBindRenderbuffer( | 1810 DoBindRenderbuffer( |
1787 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1811 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1788 DoBindFramebuffer( | 1812 DoBindFramebuffer( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 DoDeleteFramebuffer(client_framebuffer_id_, | 1871 DoDeleteFramebuffer(client_framebuffer_id_, |
1848 kServiceFramebufferId, | 1872 kServiceFramebufferId, |
1849 bound_fbo, | 1873 bound_fbo, |
1850 GL_FRAMEBUFFER, | 1874 GL_FRAMEBUFFER, |
1851 0, | 1875 0, |
1852 bound_fbo, | 1876 bound_fbo, |
1853 GL_FRAMEBUFFER, | 1877 GL_FRAMEBUFFER, |
1854 0); | 1878 0); |
1855 } | 1879 } |
1856 | 1880 |
1857 TEST_F(GLES2DecoderWithShaderTest, | 1881 TEST_P(GLES2DecoderWithShaderTest, |
1858 RenderbufferChangesMarkFBOAsNotCompleteBoundFBO) { | 1882 RenderbufferChangesMarkFBOAsNotCompleteBoundFBO) { |
1859 CheckRenderbufferChangesMarkFBOAsNotComplete(true); | 1883 CheckRenderbufferChangesMarkFBOAsNotComplete(true); |
1860 } | 1884 } |
1861 | 1885 |
1862 TEST_F(GLES2DecoderWithShaderTest, | 1886 TEST_P(GLES2DecoderWithShaderTest, |
1863 RenderbufferChangesMarkFBOAsNotCompleteUnboundFBO) { | 1887 RenderbufferChangesMarkFBOAsNotCompleteUnboundFBO) { |
1864 CheckRenderbufferChangesMarkFBOAsNotComplete(false); | 1888 CheckRenderbufferChangesMarkFBOAsNotComplete(false); |
1865 } | 1889 } |
1866 | 1890 |
1867 void GLES2DecoderWithShaderTest::CheckTextureChangesMarkFBOAsNotComplete( | 1891 void GLES2DecoderWithShaderTest::CheckTextureChangesMarkFBOAsNotComplete( |
1868 bool bound_fbo) { | 1892 bool bound_fbo) { |
1869 FramebufferManager* framebuffer_manager = group().framebuffer_manager(); | 1893 FramebufferManager* framebuffer_manager = group().framebuffer_manager(); |
1870 const GLuint kFBOClientTextureId = 4100; | 1894 const GLuint kFBOClientTextureId = 4100; |
1871 const GLuint kFBOServiceTextureId = 4101; | 1895 const GLuint kFBOServiceTextureId = 4101; |
1872 | 1896 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 DoDeleteFramebuffer(client_framebuffer_id_, | 1979 DoDeleteFramebuffer(client_framebuffer_id_, |
1956 kServiceFramebufferId, | 1980 kServiceFramebufferId, |
1957 bound_fbo, | 1981 bound_fbo, |
1958 GL_FRAMEBUFFER, | 1982 GL_FRAMEBUFFER, |
1959 0, | 1983 0, |
1960 bound_fbo, | 1984 bound_fbo, |
1961 GL_FRAMEBUFFER, | 1985 GL_FRAMEBUFFER, |
1962 0); | 1986 0); |
1963 } | 1987 } |
1964 | 1988 |
1965 TEST_F(GLES2DecoderWithShaderTest, TextureChangesMarkFBOAsNotCompleteBoundFBO) { | 1989 TEST_P(GLES2DecoderWithShaderTest, TextureChangesMarkFBOAsNotCompleteBoundFBO) { |
1966 CheckTextureChangesMarkFBOAsNotComplete(true); | 1990 CheckTextureChangesMarkFBOAsNotComplete(true); |
1967 } | 1991 } |
1968 | 1992 |
1969 TEST_F(GLES2DecoderWithShaderTest, | 1993 TEST_P(GLES2DecoderWithShaderTest, |
1970 TextureChangesMarkFBOAsNotCompleteUnboundFBO) { | 1994 TextureChangesMarkFBOAsNotCompleteUnboundFBO) { |
1971 CheckTextureChangesMarkFBOAsNotComplete(false); | 1995 CheckTextureChangesMarkFBOAsNotComplete(false); |
1972 } | 1996 } |
1973 | 1997 |
1974 TEST_F(GLES2DecoderTest, CanChangeSurface) { | 1998 TEST_P(GLES2DecoderTest, CanChangeSurface) { |
1975 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock); | 1999 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock); |
1976 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()) | 2000 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()) |
1977 .WillOnce(Return(7)); | 2001 .WillOnce(Return(7)); |
1978 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7)); | 2002 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7)); |
1979 | 2003 |
1980 decoder_->SetSurface(other_surface); | 2004 decoder_->SetSurface(other_surface); |
1981 } | 2005 } |
1982 | 2006 |
1983 TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateSuccceeds) { | 2007 TEST_P(GLES2DecoderTest, DrawBuffersEXTImmediateSuccceeds) { |
1984 const GLsizei count = 1; | 2008 const GLsizei count = 1; |
1985 const GLenum bufs[] = {GL_COLOR_ATTACHMENT0}; | 2009 const GLenum bufs[] = {GL_COLOR_ATTACHMENT0}; |
1986 DrawBuffersEXTImmediate& cmd = *GetImmediateAs<DrawBuffersEXTImmediate>(); | 2010 DrawBuffersEXTImmediate& cmd = *GetImmediateAs<DrawBuffersEXTImmediate>(); |
1987 cmd.Init(count, bufs); | 2011 cmd.Init(count, bufs); |
1988 | 2012 |
1989 DoBindFramebuffer( | 2013 DoBindFramebuffer( |
1990 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 2014 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1991 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)).Times(1).RetiresOnSaturation(); | 2015 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)).Times(1).RetiresOnSaturation(); |
1992 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); | 2016 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); |
1993 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2017 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1994 } | 2018 } |
1995 | 2019 |
1996 TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateFails) { | 2020 TEST_P(GLES2DecoderTest, DrawBuffersEXTImmediateFails) { |
1997 const GLsizei count = 1; | 2021 const GLsizei count = 1; |
1998 const GLenum bufs[] = {GL_COLOR_ATTACHMENT1_EXT}; | 2022 const GLenum bufs[] = {GL_COLOR_ATTACHMENT1_EXT}; |
1999 DrawBuffersEXTImmediate& cmd = *GetImmediateAs<DrawBuffersEXTImmediate>(); | 2023 DrawBuffersEXTImmediate& cmd = *GetImmediateAs<DrawBuffersEXTImmediate>(); |
2000 cmd.Init(count, bufs); | 2024 cmd.Init(count, bufs); |
2001 | 2025 |
2002 DoBindFramebuffer( | 2026 DoBindFramebuffer( |
2003 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 2027 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
2004 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); | 2028 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); |
2005 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 2029 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
2006 } | 2030 } |
2007 | 2031 |
2008 TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateBackbuffer) { | 2032 TEST_P(GLES2DecoderTest, DrawBuffersEXTImmediateBackbuffer) { |
2009 const GLsizei count = 1; | 2033 const GLsizei count = 1; |
2010 const GLenum bufs[] = {GL_BACK}; | 2034 const GLenum bufs[] = {GL_BACK}; |
2011 DrawBuffersEXTImmediate& cmd = *GetImmediateAs<DrawBuffersEXTImmediate>(); | 2035 DrawBuffersEXTImmediate& cmd = *GetImmediateAs<DrawBuffersEXTImmediate>(); |
2012 cmd.Init(count, bufs); | 2036 cmd.Init(count, bufs); |
2013 | 2037 |
2014 DoBindFramebuffer( | 2038 DoBindFramebuffer( |
2015 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 2039 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
2016 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); | 2040 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); |
2017 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 2041 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
2018 | 2042 |
2019 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); // unbind | 2043 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); // unbind |
2020 | 2044 |
2021 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)).Times(1).RetiresOnSaturation(); | 2045 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)).Times(1).RetiresOnSaturation(); |
2022 | 2046 |
2023 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); | 2047 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(bufs))); |
2024 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2048 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2025 } | 2049 } |
2026 | 2050 |
2027 TEST_F(GLES2DecoderManualInitTest, InvalidateFramebufferBinding) { | 2051 TEST_P(GLES2DecoderManualInitTest, InvalidateFramebufferBinding) { |
2028 InitState init; | 2052 InitState init; |
2029 init.gl_version = "opengl es 3.0"; | 2053 init.gl_version = "opengl es 3.0"; |
2030 InitDecoder(init); | 2054 InitDecoder(init); |
2031 | 2055 |
2032 // EXPECT_EQ can't be used to compare function pointers | 2056 // EXPECT_EQ can't be used to compare function pointers |
2033 EXPECT_TRUE( | 2057 EXPECT_TRUE( |
2034 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") == | 2058 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") == |
2035 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); | 2059 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
2036 EXPECT_TRUE( | 2060 EXPECT_TRUE( |
2037 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != | 2061 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != |
2038 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT")); | 2062 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT")); |
2039 } | 2063 } |
2040 | 2064 |
2041 TEST_F(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { | 2065 TEST_P(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { |
2042 InitState init; | 2066 InitState init; |
2043 init.extensions = "GL_EXT_discard_framebuffer"; | 2067 init.extensions = "GL_EXT_discard_framebuffer"; |
2044 init.gl_version = "opengl es 2.0"; | 2068 init.gl_version = "opengl es 2.0"; |
2045 InitDecoder(init); | 2069 InitDecoder(init); |
2046 | 2070 |
2047 // EXPECT_EQ can't be used to compare function pointers | 2071 // EXPECT_EQ can't be used to compare function pointers |
2048 EXPECT_TRUE( | 2072 EXPECT_TRUE( |
2049 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == | 2073 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == |
2050 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); | 2074 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
2051 | 2075 |
(...skipping 21 matching lines...) Expand all Loading... |
2073 .RetiresOnSaturation(); | 2097 .RetiresOnSaturation(); |
2074 DiscardFramebufferEXTImmediate& cmd = | 2098 DiscardFramebufferEXTImmediate& cmd = |
2075 *GetImmediateAs<DiscardFramebufferEXTImmediate>(); | 2099 *GetImmediateAs<DiscardFramebufferEXTImmediate>(); |
2076 cmd.Init(target, count, attachments); | 2100 cmd.Init(target, count, attachments); |
2077 | 2101 |
2078 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); | 2102 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
2079 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2103 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2080 EXPECT_FALSE(framebuffer->IsCleared()); | 2104 EXPECT_FALSE(framebuffer->IsCleared()); |
2081 } | 2105 } |
2082 | 2106 |
2083 TEST_F(GLES2DecoderTest, DiscardFramebufferEXTUnsupported) { | 2107 TEST_P(GLES2DecoderTest, DiscardFramebufferEXTUnsupported) { |
2084 const GLenum target = GL_FRAMEBUFFER; | 2108 const GLenum target = GL_FRAMEBUFFER; |
2085 const GLsizei count = 1; | 2109 const GLsizei count = 1; |
2086 const GLenum attachments[] = {GL_COLOR_EXT}; | 2110 const GLenum attachments[] = {GL_COLOR_EXT}; |
2087 DiscardFramebufferEXTImmediate& cmd = | 2111 DiscardFramebufferEXTImmediate& cmd = |
2088 *GetImmediateAs<DiscardFramebufferEXTImmediate>(); | 2112 *GetImmediateAs<DiscardFramebufferEXTImmediate>(); |
2089 cmd.Init(target, count, attachments); | 2113 cmd.Init(target, count, attachments); |
2090 | 2114 |
2091 // Should not result into a call into GL. | 2115 // Should not result into a call into GL. |
2092 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); | 2116 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
2093 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 2117 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
2094 } | 2118 } |
2095 | 2119 |
2096 TEST_F(GLES2DecoderManualInitTest, ReadFormatExtension) { | 2120 TEST_P(GLES2DecoderManualInitTest, ReadFormatExtension) { |
2097 InitState init; | 2121 InitState init; |
2098 init.extensions = "GL_OES_read_format"; | 2122 init.extensions = "GL_OES_read_format"; |
2099 init.gl_version = "2.1"; | 2123 init.gl_version = "2.1"; |
2100 init.bind_generates_resource = true; | 2124 init.bind_generates_resource = true; |
2101 InitDecoder(init); | 2125 InitDecoder(init); |
2102 | 2126 |
2103 EXPECT_CALL(*gl_, GetError()) | 2127 EXPECT_CALL(*gl_, GetError()) |
2104 .WillOnce(Return(GL_NO_ERROR)) | 2128 .WillOnce(Return(GL_NO_ERROR)) |
2105 .WillOnce(Return(GL_NO_ERROR)) | 2129 .WillOnce(Return(GL_NO_ERROR)) |
2106 .WillOnce(Return(GL_NO_ERROR)) | 2130 .WillOnce(Return(GL_NO_ERROR)) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 result->size = 0; | 2170 result->size = 0; |
2147 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation(); | 2171 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation(); |
2148 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE, | 2172 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE, |
2149 shared_memory_id_, | 2173 shared_memory_id_, |
2150 shared_memory_offset_); | 2174 shared_memory_offset_); |
2151 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2175 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2152 EXPECT_EQ(1, result->GetNumResults()); | 2176 EXPECT_EQ(1, result->GetNumResults()); |
2153 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2177 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2154 } | 2178 } |
2155 | 2179 |
2156 TEST_F(GLES2DecoderManualInitTest, NoReadFormatExtension) { | 2180 TEST_P(GLES2DecoderManualInitTest, NoReadFormatExtension) { |
2157 InitState init; | 2181 InitState init; |
2158 init.gl_version = "2.1"; | 2182 init.gl_version = "2.1"; |
2159 init.bind_generates_resource = true; | 2183 init.bind_generates_resource = true; |
2160 InitDecoder(init); | 2184 InitDecoder(init); |
2161 | 2185 |
2162 EXPECT_CALL(*gl_, GetError()) | 2186 EXPECT_CALL(*gl_, GetError()) |
2163 .WillOnce(Return(GL_NO_ERROR)) | 2187 .WillOnce(Return(GL_NO_ERROR)) |
2164 .WillOnce(Return(GL_NO_ERROR)) | 2188 .WillOnce(Return(GL_NO_ERROR)) |
2165 .WillOnce(Return(GL_NO_ERROR)) | 2189 .WillOnce(Return(GL_NO_ERROR)) |
2166 .WillOnce(Return(GL_NO_ERROR)) | 2190 .WillOnce(Return(GL_NO_ERROR)) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 EXPECT_EQ(1, result->GetNumResults()); | 2234 EXPECT_EQ(1, result->GetNumResults()); |
2211 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2235 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2212 } | 2236 } |
2213 | 2237 |
2214 // TODO(gman): PixelStorei | 2238 // TODO(gman): PixelStorei |
2215 | 2239 |
2216 // TODO(gman): SwapBuffers | 2240 // TODO(gman): SwapBuffers |
2217 | 2241 |
2218 } // namespace gles2 | 2242 } // namespace gles2 |
2219 } // namespace gpu | 2243 } // namespace gpu |
OLD | NEW |