OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 11 #include "gpu/command_buffer/common/id_allocator.h" |
| 12 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_mock.h" |
| 13 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" |
| 14 #include "gpu/command_buffer/service/async_pixel_transfer_manager_mock.h" |
| 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 16 #include "gpu/command_buffer/service/context_group.h" |
| 17 #include "gpu/command_buffer/service/context_state.h" |
| 18 #include "gpu/command_buffer/service/gl_surface_mock.h" |
| 19 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 20 |
| 21 #include "gpu/command_buffer/service/gpu_switches.h" |
| 22 #include "gpu/command_buffer/service/image_manager.h" |
| 23 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 24 #include "gpu/command_buffer/service/mocks.h" |
| 25 #include "gpu/command_buffer/service/program_manager.h" |
| 26 #include "gpu/command_buffer/service/test_helper.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 #include "ui/gl/gl_implementation.h" |
| 29 #include "ui/gl/gl_mock.h" |
| 30 #include "ui/gl/gl_surface_stub.h" |
| 31 |
| 32 #if !defined(GL_DEPTH24_STENCIL8) |
| 33 #define GL_DEPTH24_STENCIL8 0x88F0 |
| 34 #endif |
| 35 |
| 36 using ::gfx::MockGLInterface; |
| 37 using ::testing::_; |
| 38 using ::testing::DoAll; |
| 39 using ::testing::InSequence; |
| 40 using ::testing::Invoke; |
| 41 using ::testing::MatcherCast; |
| 42 using ::testing::Mock; |
| 43 using ::testing::Pointee; |
| 44 using ::testing::Return; |
| 45 using ::testing::SaveArg; |
| 46 using ::testing::SetArrayArgument; |
| 47 using ::testing::SetArgumentPointee; |
| 48 using ::testing::SetArgPointee; |
| 49 using ::testing::StrEq; |
| 50 using ::testing::StrictMock; |
| 51 |
| 52 namespace gpu { |
| 53 namespace gles2 { |
| 54 |
| 55 using namespace cmds; |
| 56 |
| 57 class GLES2DecoderGeometryInstancingTest : public GLES2DecoderWithShaderTest { |
| 58 public: |
| 59 GLES2DecoderGeometryInstancingTest() : GLES2DecoderWithShaderTest() {} |
| 60 |
| 61 virtual void SetUp() { |
| 62 InitState init; |
| 63 init.extensions = "GL_ANGLE_instanced_arrays"; |
| 64 init.gl_version = "opengl es 2.0"; |
| 65 init.has_alpha = true; |
| 66 init.has_depth = true; |
| 67 init.request_alpha = true; |
| 68 init.request_depth = true; |
| 69 init.bind_generates_resource = true; |
| 70 InitDecoder(init); |
| 71 SetupDefaultProgram(); |
| 72 } |
| 73 }; |
| 74 |
| 75 // Test that with an RGB backbuffer if we set the color mask to 1,1,1,1 it is |
| 76 // set to 1,1,1,0 at Draw time but is 1,1,1,1 at query time. |
| 77 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMask) { |
| 78 ColorMask cmd; |
| 79 cmd.Init(true, true, true, true); |
| 80 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 81 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 82 |
| 83 SetupTexture(); |
| 84 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 85 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 86 false, // Framebuffer has depth |
| 87 false, // Framebuffer has stencil |
| 88 0x1110, // color bits |
| 89 false, // depth mask |
| 90 false, // depth enabled |
| 91 0, // front stencil mask |
| 92 0, // back stencil mask |
| 93 false, // stencil enabled |
| 94 false, // cull_face_enabled |
| 95 false, // scissor_test_enabled |
| 96 false); // blend_enabled |
| 97 |
| 98 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 99 .Times(1) |
| 100 .RetiresOnSaturation(); |
| 101 DrawArrays draw_cmd; |
| 102 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 103 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 104 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 105 |
| 106 EXPECT_CALL(*gl_, GetError()) |
| 107 .WillOnce(Return(GL_NO_ERROR)) |
| 108 .WillOnce(Return(GL_NO_ERROR)) |
| 109 .RetiresOnSaturation(); |
| 110 typedef GetIntegerv::Result Result; |
| 111 Result* result = static_cast<Result*>(shared_memory_address_); |
| 112 EXPECT_CALL(*gl_, GetIntegerv(GL_COLOR_WRITEMASK, result->GetData())) |
| 113 .Times(0); |
| 114 result->size = 0; |
| 115 GetIntegerv cmd2; |
| 116 cmd2.Init(GL_COLOR_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
| 117 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 118 EXPECT_EQ( |
| 119 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_COLOR_WRITEMASK), |
| 120 result->GetNumResults()); |
| 121 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 122 EXPECT_EQ(1, result->GetData()[0]); |
| 123 EXPECT_EQ(1, result->GetData()[1]); |
| 124 EXPECT_EQ(1, result->GetData()[2]); |
| 125 EXPECT_EQ(1, result->GetData()[3]); |
| 126 } |
| 127 |
| 128 // Test that with no depth if we set DepthMask true that it's set to false at |
| 129 // draw time but querying it returns true. |
| 130 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferDepthMask) { |
| 131 EXPECT_CALL(*gl_, DepthMask(true)).Times(0).RetiresOnSaturation(); |
| 132 DepthMask cmd; |
| 133 cmd.Init(true); |
| 134 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 135 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 136 |
| 137 SetupTexture(); |
| 138 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 139 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 140 false, // Framebuffer has depth |
| 141 false, // Framebuffer has stencil |
| 142 0x1110, // color bits |
| 143 false, // depth mask |
| 144 false, // depth enabled |
| 145 0, // front stencil mask |
| 146 0, // back stencil mask |
| 147 false, // stencil enabled |
| 148 false, // cull_face_enabled |
| 149 false, // scissor_test_enabled |
| 150 false); // blend_enabled |
| 151 |
| 152 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 153 .Times(1) |
| 154 .RetiresOnSaturation(); |
| 155 DrawArrays draw_cmd; |
| 156 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 157 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 158 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 159 |
| 160 EXPECT_CALL(*gl_, GetError()) |
| 161 .WillOnce(Return(GL_NO_ERROR)) |
| 162 .WillOnce(Return(GL_NO_ERROR)) |
| 163 .RetiresOnSaturation(); |
| 164 typedef GetIntegerv::Result Result; |
| 165 Result* result = static_cast<Result*>(shared_memory_address_); |
| 166 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_WRITEMASK, result->GetData())) |
| 167 .Times(0); |
| 168 result->size = 0; |
| 169 GetIntegerv cmd2; |
| 170 cmd2.Init(GL_DEPTH_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
| 171 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 172 EXPECT_EQ( |
| 173 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_WRITEMASK), |
| 174 result->GetNumResults()); |
| 175 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 176 EXPECT_EQ(1, result->GetData()[0]); |
| 177 } |
| 178 |
| 179 // Test that with no stencil if we set the stencil mask it's still set to 0 at |
| 180 // draw time but gets our value if we query. |
| 181 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferStencilMask) { |
| 182 const GLint kMask = 123; |
| 183 EXPECT_CALL(*gl_, StencilMask(kMask)).Times(0).RetiresOnSaturation(); |
| 184 StencilMask cmd; |
| 185 cmd.Init(kMask); |
| 186 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 187 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 188 |
| 189 SetupTexture(); |
| 190 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 191 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 192 false, // Framebuffer has depth |
| 193 false, // Framebuffer has stencil |
| 194 0x1110, // color bits |
| 195 false, // depth mask |
| 196 false, // depth enabled |
| 197 0, // front stencil mask |
| 198 0, // back stencil mask |
| 199 false, // stencil enabled |
| 200 false, // cull_face_enabled |
| 201 false, // scissor_test_enabled |
| 202 false); // blend_enabled |
| 203 |
| 204 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 205 .Times(1) |
| 206 .RetiresOnSaturation(); |
| 207 DrawArrays draw_cmd; |
| 208 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 209 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 210 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 211 |
| 212 EXPECT_CALL(*gl_, GetError()) |
| 213 .WillOnce(Return(GL_NO_ERROR)) |
| 214 .WillOnce(Return(GL_NO_ERROR)) |
| 215 .RetiresOnSaturation(); |
| 216 typedef GetIntegerv::Result Result; |
| 217 Result* result = static_cast<Result*>(shared_memory_address_); |
| 218 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_WRITEMASK, result->GetData())) |
| 219 .Times(0); |
| 220 result->size = 0; |
| 221 GetIntegerv cmd2; |
| 222 cmd2.Init(GL_STENCIL_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
| 223 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 224 EXPECT_EQ( |
| 225 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_WRITEMASK), |
| 226 result->GetNumResults()); |
| 227 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 228 EXPECT_EQ(kMask, result->GetData()[0]); |
| 229 } |
| 230 |
| 231 // Test that if an FBO is bound we get the correct masks. |
| 232 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMaskFBO) { |
| 233 ColorMask cmd; |
| 234 cmd.Init(true, true, true, true); |
| 235 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 236 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 237 |
| 238 SetupTexture(); |
| 239 SetupVertexBuffer(); |
| 240 DoEnableVertexAttribArray(0); |
| 241 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 242 DoEnableVertexAttribArray(1); |
| 243 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 244 DoEnableVertexAttribArray(2); |
| 245 DoVertexAttribPointer(2, 2, GL_FLOAT, 0, 0); |
| 246 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 247 false, // Framebuffer has depth |
| 248 false, // Framebuffer has stencil |
| 249 0x1110, // color bits |
| 250 false, // depth mask |
| 251 false, // depth enabled |
| 252 0, // front stencil mask |
| 253 0, // back stencil mask |
| 254 false, // stencil enabled |
| 255 false, // cull_face_enabled |
| 256 false, // scissor_test_enabled |
| 257 false); // blend_enabled |
| 258 |
| 259 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 260 .Times(1) |
| 261 .RetiresOnSaturation(); |
| 262 DrawArrays draw_cmd; |
| 263 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 264 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 265 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 266 |
| 267 // Check that no extra calls are made on the next draw. |
| 268 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 269 .Times(1) |
| 270 .RetiresOnSaturation(); |
| 271 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 272 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 273 |
| 274 // Setup Frame buffer. |
| 275 // needs to be 1x1 or else it's not renderable. |
| 276 const GLsizei kWidth = 1; |
| 277 const GLsizei kHeight = 1; |
| 278 const GLenum kFormat = GL_RGB; |
| 279 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 280 // Pass some data so the texture will be marked as cleared. |
| 281 DoTexImage2D(GL_TEXTURE_2D, |
| 282 0, |
| 283 kFormat, |
| 284 kWidth, |
| 285 kHeight, |
| 286 0, |
| 287 kFormat, |
| 288 GL_UNSIGNED_BYTE, |
| 289 kSharedMemoryId, |
| 290 kSharedMemoryOffset); |
| 291 DoBindFramebuffer( |
| 292 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 293 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
| 294 GL_COLOR_ATTACHMENT0, |
| 295 GL_TEXTURE_2D, |
| 296 client_texture_id_, |
| 297 kServiceTextureId, |
| 298 0, |
| 299 GL_NO_ERROR); |
| 300 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 301 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 302 .RetiresOnSaturation(); |
| 303 |
| 304 // This time state needs to be set. |
| 305 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
| 306 false, // Framebuffer has depth |
| 307 false, // Framebuffer has stencil |
| 308 0x1110, // color bits |
| 309 false, // depth mask |
| 310 false, // depth enabled |
| 311 0, // front stencil mask |
| 312 0, // back stencil mask |
| 313 false, // stencil enabled |
| 314 false, // cull_face_enabled |
| 315 false, // scissor_test_enabled |
| 316 false); // blend_enabled |
| 317 |
| 318 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 319 .Times(1) |
| 320 .RetiresOnSaturation(); |
| 321 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 322 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 323 |
| 324 // Check that no extra calls are made on the next draw. |
| 325 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 326 .Times(1) |
| 327 .RetiresOnSaturation(); |
| 328 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 329 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 330 |
| 331 // Unbind |
| 332 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); |
| 333 |
| 334 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 335 false, // Framebuffer has depth |
| 336 false, // Framebuffer has stencil |
| 337 0x1110, // color bits |
| 338 false, // depth mask |
| 339 false, // depth enabled |
| 340 0, // front stencil mask |
| 341 0, // back stencil mask |
| 342 false, // stencil enabled |
| 343 false, // cull_face_enabled |
| 344 false, // scissor_test_enabled |
| 345 false); // blend_enabled |
| 346 |
| 347 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 348 .Times(1) |
| 349 .RetiresOnSaturation(); |
| 350 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 351 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 352 } |
| 353 |
| 354 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) { |
| 355 InitState init; |
| 356 init.gl_version = "3.0"; |
| 357 init.has_depth = true; |
| 358 init.request_depth = true; |
| 359 init.bind_generates_resource = true; |
| 360 InitDecoder(init); |
| 361 |
| 362 Enable cmd; |
| 363 cmd.Init(GL_DEPTH_TEST); |
| 364 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 365 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 366 |
| 367 SetupDefaultProgram(); |
| 368 SetupTexture(); |
| 369 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 370 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 371 true, // Framebuffer has depth |
| 372 false, // Framebuffer has stencil |
| 373 0x1110, // color bits |
| 374 true, // depth mask |
| 375 true, // depth enabled |
| 376 0, // front stencil mask |
| 377 0, // back stencil mask |
| 378 false, // stencil enabled |
| 379 false, // cull_face_enabled |
| 380 false, // scissor_test_enabled |
| 381 false); // blend_enabled |
| 382 |
| 383 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 384 .Times(1) |
| 385 .RetiresOnSaturation(); |
| 386 DrawArrays draw_cmd; |
| 387 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 388 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 389 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 390 |
| 391 EXPECT_CALL(*gl_, GetError()) |
| 392 .WillOnce(Return(GL_NO_ERROR)) |
| 393 .WillOnce(Return(GL_NO_ERROR)) |
| 394 .RetiresOnSaturation(); |
| 395 typedef GetIntegerv::Result Result; |
| 396 Result* result = static_cast<Result*>(shared_memory_address_); |
| 397 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_TEST, _)) |
| 398 .Times(0) |
| 399 .RetiresOnSaturation(); |
| 400 result->size = 0; |
| 401 GetIntegerv cmd2; |
| 402 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); |
| 403 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 404 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), |
| 405 result->GetNumResults()); |
| 406 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 407 EXPECT_EQ(1, result->GetData()[0]); |
| 408 } |
| 409 |
| 410 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { |
| 411 InitState init; |
| 412 init.gl_version = "3.0"; |
| 413 init.has_depth = true; |
| 414 init.bind_generates_resource = true; |
| 415 InitDecoder(init); |
| 416 |
| 417 Enable cmd; |
| 418 cmd.Init(GL_DEPTH_TEST); |
| 419 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 420 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 421 |
| 422 SetupDefaultProgram(); |
| 423 SetupTexture(); |
| 424 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 425 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 426 false, // Framebuffer has depth |
| 427 false, // Framebuffer has stencil |
| 428 0x1110, // color bits |
| 429 false, // depth mask |
| 430 false, // depth enabled |
| 431 0, // front stencil mask |
| 432 0, // back stencil mask |
| 433 false, // stencil enabled |
| 434 false, // cull_face_enabled |
| 435 false, // scissor_test_enabled |
| 436 false); // blend_enabled |
| 437 |
| 438 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 439 .Times(1) |
| 440 .RetiresOnSaturation(); |
| 441 DrawArrays draw_cmd; |
| 442 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 443 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 444 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 445 |
| 446 EXPECT_CALL(*gl_, GetError()) |
| 447 .WillOnce(Return(GL_NO_ERROR)) |
| 448 .WillOnce(Return(GL_NO_ERROR)) |
| 449 .RetiresOnSaturation(); |
| 450 typedef GetIntegerv::Result Result; |
| 451 Result* result = static_cast<Result*>(shared_memory_address_); |
| 452 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_TEST, _)) |
| 453 .Times(0) |
| 454 .RetiresOnSaturation(); |
| 455 result->size = 0; |
| 456 GetIntegerv cmd2; |
| 457 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); |
| 458 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 459 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), |
| 460 result->GetNumResults()); |
| 461 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 462 EXPECT_EQ(1, result->GetData()[0]); |
| 463 } |
| 464 |
| 465 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) { |
| 466 InitState init; |
| 467 init.gl_version = "3.0"; |
| 468 init.has_stencil = true; |
| 469 init.request_stencil = true; |
| 470 init.bind_generates_resource = true; |
| 471 InitDecoder(init); |
| 472 |
| 473 Enable cmd; |
| 474 cmd.Init(GL_STENCIL_TEST); |
| 475 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 476 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 477 |
| 478 SetupDefaultProgram(); |
| 479 SetupTexture(); |
| 480 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 481 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 482 false, // Framebuffer has depth |
| 483 true, // Framebuffer has stencil |
| 484 0x1110, // color bits |
| 485 false, // depth mask |
| 486 false, // depth enabled |
| 487 -1, // front stencil mask |
| 488 -1, // back stencil mask |
| 489 true, // stencil enabled |
| 490 false, // cull_face_enabled |
| 491 false, // scissor_test_enabled |
| 492 false); // blend_enabled |
| 493 |
| 494 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 495 .Times(1) |
| 496 .RetiresOnSaturation(); |
| 497 DrawArrays draw_cmd; |
| 498 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 499 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 500 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 501 |
| 502 EXPECT_CALL(*gl_, GetError()) |
| 503 .WillOnce(Return(GL_NO_ERROR)) |
| 504 .WillOnce(Return(GL_NO_ERROR)) |
| 505 .RetiresOnSaturation(); |
| 506 typedef GetIntegerv::Result Result; |
| 507 Result* result = static_cast<Result*>(shared_memory_address_); |
| 508 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, _)) |
| 509 .Times(0) |
| 510 .RetiresOnSaturation(); |
| 511 result->size = 0; |
| 512 GetIntegerv cmd2; |
| 513 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); |
| 514 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 515 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), |
| 516 result->GetNumResults()); |
| 517 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 518 EXPECT_EQ(1, result->GetData()[0]); |
| 519 } |
| 520 |
| 521 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { |
| 522 InitState init; |
| 523 init.gl_version = "3.0"; |
| 524 init.has_stencil = true; |
| 525 init.bind_generates_resource = true; |
| 526 InitDecoder(init); |
| 527 |
| 528 Enable cmd; |
| 529 cmd.Init(GL_STENCIL_TEST); |
| 530 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 531 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 532 |
| 533 SetupDefaultProgram(); |
| 534 SetupTexture(); |
| 535 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 536 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
| 537 false, // Framebuffer has depth |
| 538 false, // Framebuffer has stencil |
| 539 0x1110, // color bits |
| 540 false, // depth mask |
| 541 false, // depth enabled |
| 542 0, // front stencil mask |
| 543 0, // back stencil mask |
| 544 false, // stencil enabled |
| 545 false, // cull_face_enabled |
| 546 false, // scissor_test_enabled |
| 547 false); // blend_enabled |
| 548 |
| 549 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 550 .Times(1) |
| 551 .RetiresOnSaturation(); |
| 552 DrawArrays draw_cmd; |
| 553 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 554 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 555 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 556 |
| 557 EXPECT_CALL(*gl_, GetError()) |
| 558 .WillOnce(Return(GL_NO_ERROR)) |
| 559 .WillOnce(Return(GL_NO_ERROR)) |
| 560 .RetiresOnSaturation(); |
| 561 typedef GetIntegerv::Result Result; |
| 562 Result* result = static_cast<Result*>(shared_memory_address_); |
| 563 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, _)) |
| 564 .Times(0) |
| 565 .RetiresOnSaturation(); |
| 566 result->size = 0; |
| 567 GetIntegerv cmd2; |
| 568 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); |
| 569 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 570 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), |
| 571 result->GetNumResults()); |
| 572 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 573 EXPECT_EQ(1, result->GetData()[0]); |
| 574 } |
| 575 |
| 576 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { |
| 577 SetupTexture(); |
| 578 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 579 SetupExpectationsForApplyingDefaultDirtyState(); |
| 580 |
| 581 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 582 .Times(1) |
| 583 .RetiresOnSaturation(); |
| 584 DrawArrays cmd; |
| 585 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 586 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 587 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 588 } |
| 589 |
| 590 // Tests when the math overflows (0x40000000 * sizeof GLfloat) |
| 591 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OverflowFails) { |
| 592 const GLsizei kLargeCount = 0x40000000; |
| 593 SetupTexture(); |
| 594 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
| 595 DrawArrays cmd; |
| 596 cmd.Init(GL_TRIANGLES, 0, kLargeCount); |
| 597 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 598 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 599 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
| 600 } |
| 601 |
| 602 // Tests when the math overflows (0x7FFFFFFF + 1 = 0x8000000 verts) |
| 603 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0PosToNegFails) { |
| 604 const GLsizei kLargeCount = 0x7FFFFFFF; |
| 605 SetupTexture(); |
| 606 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
| 607 DrawArrays cmd; |
| 608 cmd.Init(GL_TRIANGLES, 0, kLargeCount); |
| 609 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 610 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 611 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
| 612 } |
| 613 |
| 614 // Tests when the driver returns an error |
| 615 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OOMFails) { |
| 616 const GLsizei kFakeLargeCount = 0x1234; |
| 617 SetupTexture(); |
| 618 AddExpectationsForSimulatedAttrib0WithError( |
| 619 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); |
| 620 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
| 621 DrawArrays cmd; |
| 622 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); |
| 623 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 624 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 625 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
| 626 } |
| 627 |
| 628 // Test that we lose context. |
| 629 TEST_F(GLES2DecoderManualInitTest, LoseContextWhenOOM) { |
| 630 InitState init; |
| 631 init.gl_version = "3.0"; |
| 632 init.has_alpha = true; |
| 633 init.has_depth = true; |
| 634 init.request_alpha = true; |
| 635 init.request_depth = true; |
| 636 init.bind_generates_resource = true; |
| 637 init.lose_context_when_out_of_memory = true; |
| 638 InitDecoder(init); |
| 639 SetupDefaultProgram(); |
| 640 |
| 641 const GLsizei kFakeLargeCount = 0x1234; |
| 642 SetupTexture(); |
| 643 AddExpectationsForSimulatedAttrib0WithError( |
| 644 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); |
| 645 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
| 646 // Other contexts in the group should be lost also. |
| 647 EXPECT_CALL(*mock_decoder_, LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB)) |
| 648 .Times(1) |
| 649 .RetiresOnSaturation(); |
| 650 DrawArrays cmd; |
| 651 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); |
| 652 // This context should be lost. |
| 653 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); |
| 654 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 655 EXPECT_TRUE(decoder_->WasContextLost()); |
| 656 } |
| 657 |
| 658 TEST_F(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) { |
| 659 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 660 // This is an NPOT texture. As the default filtering requires mips |
| 661 // this should trigger replacing with black textures before rendering. |
| 662 DoTexImage2D(GL_TEXTURE_2D, |
| 663 0, |
| 664 GL_RGBA, |
| 665 3, |
| 666 1, |
| 667 0, |
| 668 GL_RGBA, |
| 669 GL_UNSIGNED_BYTE, |
| 670 kSharedMemoryId, |
| 671 kSharedMemoryOffset); |
| 672 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 673 { |
| 674 InSequence sequence; |
| 675 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
| 676 .Times(1) |
| 677 .RetiresOnSaturation(); |
| 678 EXPECT_CALL( |
| 679 *gl_, BindTexture(GL_TEXTURE_2D, TestHelper::kServiceBlackTexture2dId)) |
| 680 .Times(1) |
| 681 .RetiresOnSaturation(); |
| 682 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 683 .Times(1) |
| 684 .RetiresOnSaturation(); |
| 685 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
| 686 .Times(1) |
| 687 .RetiresOnSaturation(); |
| 688 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| 689 .Times(1) |
| 690 .RetiresOnSaturation(); |
| 691 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
| 692 .Times(1) |
| 693 .RetiresOnSaturation(); |
| 694 } |
| 695 SetupExpectationsForApplyingDefaultDirtyState(); |
| 696 DrawArrays cmd; |
| 697 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 698 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 699 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 700 } |
| 701 |
| 702 TEST_F(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { |
| 703 DoEnableVertexAttribArray(1); |
| 704 |
| 705 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
| 706 DrawArrays cmd; |
| 707 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 708 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 709 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 710 } |
| 711 |
| 712 TEST_F(GLES2DecoderWithShaderTest, |
| 713 DrawArraysMissingAttributesZeroCountSucceeds) { |
| 714 DoEnableVertexAttribArray(1); |
| 715 |
| 716 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
| 717 DrawArrays cmd; |
| 718 cmd.Init(GL_TRIANGLES, 0, 0); |
| 719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 720 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 721 } |
| 722 |
| 723 TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { |
| 724 SetupTexture(); |
| 725 SetupVertexBuffer(); |
| 726 DoEnableVertexAttribArray(1); |
| 727 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 728 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 729 SetupExpectationsForApplyingDefaultDirtyState(); |
| 730 |
| 731 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 732 .Times(1) |
| 733 .RetiresOnSaturation(); |
| 734 DrawArrays cmd; |
| 735 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 736 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 737 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 738 } |
| 739 |
| 740 // Same as DrawArraysValidAttributesSucceeds, but with workaround |
| 741 // |init_vertex_attributes|. |
| 742 TEST_F(GLES2DecoderManualInitTest, InitVertexAttributes) { |
| 743 CommandLine command_line(0, NULL); |
| 744 command_line.AppendSwitchASCII( |
| 745 switches::kGpuDriverBugWorkarounds, |
| 746 base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES)); |
| 747 InitState init; |
| 748 init.gl_version = "3.0"; |
| 749 init.has_alpha = true; |
| 750 init.has_depth = true; |
| 751 init.request_alpha = true; |
| 752 init.request_depth = true; |
| 753 init.bind_generates_resource = true; |
| 754 InitDecoderWithCommandLine(init, &command_line); |
| 755 SetupDefaultProgram(); |
| 756 SetupTexture(); |
| 757 SetupVertexBuffer(); |
| 758 DoEnableVertexAttribArray(1); |
| 759 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 760 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 761 SetupExpectationsForApplyingDefaultDirtyState(); |
| 762 |
| 763 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 764 .Times(1) |
| 765 .RetiresOnSaturation(); |
| 766 DrawArrays cmd; |
| 767 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 768 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 769 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 770 } |
| 771 |
| 772 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { |
| 773 SetupVertexBuffer(); |
| 774 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 775 DeleteVertexBuffer(); |
| 776 |
| 777 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
| 778 DrawArrays cmd; |
| 779 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 780 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 781 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 782 } |
| 783 |
| 784 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { |
| 785 SetupTexture(); |
| 786 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 787 SetupExpectationsForApplyingDefaultDirtyState(); |
| 788 DoDeleteProgram(client_program_id_, kServiceProgramId); |
| 789 |
| 790 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(1).RetiresOnSaturation(); |
| 791 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)).Times(1); |
| 792 DrawArrays cmd; |
| 793 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 794 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 795 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 796 } |
| 797 |
| 798 TEST_F(GLES2DecoderWithShaderTest, DrawArraysWithInvalidModeFails) { |
| 799 SetupVertexBuffer(); |
| 800 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 801 |
| 802 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
| 803 DrawArrays cmd; |
| 804 cmd.Init(GL_QUADS, 0, 1); |
| 805 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 806 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 807 cmd.Init(GL_POLYGON, 0, 1); |
| 808 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 809 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 810 } |
| 811 |
| 812 TEST_F(GLES2DecoderWithShaderTest, DrawArraysInvalidCountFails) { |
| 813 SetupVertexBuffer(); |
| 814 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 815 |
| 816 // Try start > 0 |
| 817 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
| 818 DrawArrays cmd; |
| 819 cmd.Init(GL_TRIANGLES, 1, kNumVertices); |
| 820 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 821 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 822 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 823 |
| 824 // Try with count > size |
| 825 cmd.Init(GL_TRIANGLES, 0, kNumVertices + 1); |
| 826 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 827 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 828 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 829 |
| 830 // Try with attrib offset > 0 |
| 831 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 832 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 4); |
| 833 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 834 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 835 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 836 |
| 837 // Try with size > 2 (ie, vec3 instead of vec2) |
| 838 DoVertexAttribPointer(1, 3, GL_FLOAT, 0, 0); |
| 839 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 840 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 841 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 842 |
| 843 // Try with stride > 8 (vec2 + vec2 byte) |
| 844 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); |
| 845 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 846 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 847 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 848 } |
| 849 |
| 850 TEST_F(GLES2DecoderWithShaderTest, DrawArraysInstancedANGLEFails) { |
| 851 SetupTexture(); |
| 852 SetupVertexBuffer(); |
| 853 DoEnableVertexAttribArray(1); |
| 854 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 855 |
| 856 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
| 857 .Times(0) |
| 858 .RetiresOnSaturation(); |
| 859 DrawArraysInstancedANGLE cmd; |
| 860 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
| 861 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 862 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 863 } |
| 864 |
| 865 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 866 DrawArraysInstancedANGLENoAttributesFails) { |
| 867 SetupTexture(); |
| 868 |
| 869 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
| 870 .Times(0) |
| 871 .RetiresOnSaturation(); |
| 872 DrawArraysInstancedANGLE cmd; |
| 873 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
| 874 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 875 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 876 } |
| 877 |
| 878 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 879 DrawArraysInstancedANGLESimulatedAttrib0) { |
| 880 SetupTexture(); |
| 881 SetupVertexBuffer(); |
| 882 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 883 |
| 884 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 885 SetupExpectationsForApplyingDefaultDirtyState(); |
| 886 |
| 887 DoVertexAttribDivisorANGLE(0, 1); |
| 888 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 3)) |
| 889 .Times(1) |
| 890 .RetiresOnSaturation(); |
| 891 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) |
| 892 .Times(1) |
| 893 .RetiresOnSaturation(); |
| 894 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 1)) |
| 895 .Times(1) |
| 896 .RetiresOnSaturation(); |
| 897 DrawArraysInstancedANGLE cmd; |
| 898 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 3); |
| 899 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 900 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 901 } |
| 902 |
| 903 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 904 DrawArraysInstancedANGLEMissingAttributesFails) { |
| 905 DoEnableVertexAttribArray(1); |
| 906 |
| 907 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
| 908 DrawArraysInstancedANGLE cmd; |
| 909 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
| 910 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 911 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 912 } |
| 913 |
| 914 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 915 DrawArraysInstancedANGLEMissingAttributesZeroCountSucceeds) { |
| 916 DoEnableVertexAttribArray(1); |
| 917 |
| 918 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
| 919 DrawArraysInstancedANGLE cmd; |
| 920 cmd.Init(GL_TRIANGLES, 0, 0, 1); |
| 921 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 922 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 923 } |
| 924 |
| 925 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 926 DrawArraysInstancedANGLEValidAttributesSucceeds) { |
| 927 SetupTexture(); |
| 928 SetupVertexBuffer(); |
| 929 DoEnableVertexAttribArray(1); |
| 930 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 931 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 932 SetupExpectationsForApplyingDefaultDirtyState(); |
| 933 |
| 934 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 1)) |
| 935 .Times(1) |
| 936 .RetiresOnSaturation(); |
| 937 DrawArraysInstancedANGLE cmd; |
| 938 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
| 939 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 940 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 941 } |
| 942 |
| 943 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 944 DrawArraysInstancedANGLEWithInvalidModeFails) { |
| 945 SetupVertexBuffer(); |
| 946 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 947 |
| 948 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
| 949 DrawArraysInstancedANGLE cmd; |
| 950 cmd.Init(GL_QUADS, 0, 1, 1); |
| 951 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 952 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 953 cmd.Init(GL_POLYGON, 0, 1, 1); |
| 954 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 955 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 956 } |
| 957 |
| 958 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 959 DrawArraysInstancedANGLEInvalidPrimcountFails) { |
| 960 SetupVertexBuffer(); |
| 961 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 962 |
| 963 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
| 964 DrawArraysInstancedANGLE cmd; |
| 965 cmd.Init(GL_TRIANGLES, 0, 1, -1); |
| 966 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 967 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 968 } |
| 969 |
| 970 // Per-instance data is twice as large, but number of instances is half |
| 971 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 972 DrawArraysInstancedANGLELargeInstanceSucceeds) { |
| 973 SetupTexture(); |
| 974 SetupVertexBuffer(); |
| 975 SetupExpectationsForApplyingDefaultDirtyState(); |
| 976 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 977 |
| 978 DoEnableVertexAttribArray(0); |
| 979 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
| 980 DoVertexAttribDivisorANGLE(0, 1); |
| 981 EXPECT_CALL( |
| 982 *gl_, |
| 983 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, kNumVertices / 2)) |
| 984 .Times(1) |
| 985 .RetiresOnSaturation(); |
| 986 DrawArraysInstancedANGLE cmd; |
| 987 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices / 2); |
| 988 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 989 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 990 } |
| 991 |
| 992 // Per-instance data is twice as large, but divisor is twice |
| 993 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 994 DrawArraysInstancedANGLELargeDivisorSucceeds) { |
| 995 SetupTexture(); |
| 996 SetupVertexBuffer(); |
| 997 SetupExpectationsForApplyingDefaultDirtyState(); |
| 998 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 999 |
| 1000 DoEnableVertexAttribArray(0); |
| 1001 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
| 1002 DoVertexAttribDivisorANGLE(0, 2); |
| 1003 EXPECT_CALL( |
| 1004 *gl_, |
| 1005 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, kNumVertices)) |
| 1006 .Times(1) |
| 1007 .RetiresOnSaturation(); |
| 1008 DrawArraysInstancedANGLE cmd; |
| 1009 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices); |
| 1010 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1011 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1012 } |
| 1013 |
| 1014 TEST_F(GLES2DecoderGeometryInstancingTest, DrawArraysInstancedANGLELargeFails) { |
| 1015 SetupTexture(); |
| 1016 SetupVertexBuffer(); |
| 1017 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1018 |
| 1019 DoEnableVertexAttribArray(0); |
| 1020 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1021 DoVertexAttribDivisorANGLE(0, 1); |
| 1022 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
| 1023 .Times(0) |
| 1024 .RetiresOnSaturation(); |
| 1025 DrawArraysInstancedANGLE cmd; |
| 1026 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices + 1); |
| 1027 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1028 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1029 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1030 |
| 1031 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
| 1032 .Times(0) |
| 1033 .RetiresOnSaturation(); |
| 1034 cmd.Init(GL_TRIANGLES, 0, kNumVertices + 1, kNumVertices); |
| 1035 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1036 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1037 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1038 } |
| 1039 |
| 1040 // Per-index data is twice as large, but number of indices is half |
| 1041 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1042 DrawArraysInstancedANGLELargeIndexSucceeds) { |
| 1043 SetupTexture(); |
| 1044 SetupVertexBuffer(); |
| 1045 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1046 DoVertexAttribPointer(1, 4, GL_FLOAT, 0, 0); |
| 1047 |
| 1048 DoEnableVertexAttribArray(0); |
| 1049 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1050 DoVertexAttribDivisorANGLE(0, 1); |
| 1051 EXPECT_CALL( |
| 1052 *gl_, |
| 1053 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices / 2, kNumVertices)) |
| 1054 .Times(1) |
| 1055 .RetiresOnSaturation(); |
| 1056 DrawArraysInstancedANGLE cmd; |
| 1057 cmd.Init(GL_TRIANGLES, 0, kNumVertices / 2, kNumVertices); |
| 1058 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1059 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1060 } |
| 1061 |
| 1062 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1063 DrawArraysInstancedANGLENoDivisor0Fails) { |
| 1064 SetupTexture(); |
| 1065 SetupVertexBuffer(); |
| 1066 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1067 |
| 1068 DoEnableVertexAttribArray(0); |
| 1069 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1070 DoVertexAttribDivisorANGLE(0, 1); |
| 1071 DoVertexAttribDivisorANGLE(1, 1); |
| 1072 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
| 1073 .Times(0) |
| 1074 .RetiresOnSaturation(); |
| 1075 DrawArraysInstancedANGLE cmd; |
| 1076 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
| 1077 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1078 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1079 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1080 } |
| 1081 |
| 1082 TEST_F(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { |
| 1083 SetupTexture(); |
| 1084 SetupIndexBuffer(); |
| 1085 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
| 1086 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1087 EXPECT_CALL(*gl_, |
| 1088 DrawElements(GL_TRIANGLES, |
| 1089 kValidIndexRangeCount, |
| 1090 GL_UNSIGNED_SHORT, |
| 1091 BufferOffset(kValidIndexRangeStart * 2))) |
| 1092 .Times(1) |
| 1093 .RetiresOnSaturation(); |
| 1094 DrawElements cmd; |
| 1095 cmd.Init(GL_TRIANGLES, |
| 1096 kValidIndexRangeCount, |
| 1097 GL_UNSIGNED_SHORT, |
| 1098 kValidIndexRangeStart * 2); |
| 1099 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1100 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1101 } |
| 1102 |
| 1103 TEST_F(GLES2DecoderWithShaderTest, DrawElementsMissingAttributesFails) { |
| 1104 SetupIndexBuffer(); |
| 1105 DoEnableVertexAttribArray(1); |
| 1106 |
| 1107 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1108 DrawElements cmd; |
| 1109 cmd.Init(GL_TRIANGLES, |
| 1110 kValidIndexRangeCount, |
| 1111 GL_UNSIGNED_SHORT, |
| 1112 kValidIndexRangeStart * 2); |
| 1113 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1114 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1115 } |
| 1116 |
| 1117 TEST_F(GLES2DecoderWithShaderTest, |
| 1118 DrawElementsMissingAttributesZeroCountSucceeds) { |
| 1119 SetupIndexBuffer(); |
| 1120 DoEnableVertexAttribArray(1); |
| 1121 |
| 1122 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1123 DrawElements cmd; |
| 1124 cmd.Init(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2); |
| 1125 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1126 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1127 } |
| 1128 |
| 1129 TEST_F(GLES2DecoderWithShaderTest, DrawElementsExtraAttributesFails) { |
| 1130 SetupIndexBuffer(); |
| 1131 DoEnableVertexAttribArray(6); |
| 1132 |
| 1133 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1134 DrawElements cmd; |
| 1135 cmd.Init(GL_TRIANGLES, |
| 1136 kValidIndexRangeCount, |
| 1137 GL_UNSIGNED_SHORT, |
| 1138 kValidIndexRangeStart * 2); |
| 1139 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1140 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1141 } |
| 1142 |
| 1143 TEST_F(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { |
| 1144 SetupTexture(); |
| 1145 SetupVertexBuffer(); |
| 1146 SetupIndexBuffer(); |
| 1147 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1148 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
| 1149 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1150 |
| 1151 EXPECT_CALL(*gl_, |
| 1152 DrawElements(GL_TRIANGLES, |
| 1153 kValidIndexRangeCount, |
| 1154 GL_UNSIGNED_SHORT, |
| 1155 BufferOffset(kValidIndexRangeStart * 2))) |
| 1156 .Times(1) |
| 1157 .RetiresOnSaturation(); |
| 1158 DrawElements cmd; |
| 1159 cmd.Init(GL_TRIANGLES, |
| 1160 kValidIndexRangeCount, |
| 1161 GL_UNSIGNED_SHORT, |
| 1162 kValidIndexRangeStart * 2); |
| 1163 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1164 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1165 } |
| 1166 |
| 1167 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedBufferFails) { |
| 1168 SetupVertexBuffer(); |
| 1169 SetupIndexBuffer(); |
| 1170 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1171 DeleteIndexBuffer(); |
| 1172 |
| 1173 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1174 DrawElements cmd; |
| 1175 cmd.Init(GL_TRIANGLES, |
| 1176 kValidIndexRangeCount, |
| 1177 GL_UNSIGNED_SHORT, |
| 1178 kValidIndexRangeStart * 2); |
| 1179 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1180 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1181 } |
| 1182 |
| 1183 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { |
| 1184 SetupTexture(); |
| 1185 SetupIndexBuffer(); |
| 1186 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
| 1187 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1188 DoDeleteProgram(client_program_id_, kServiceProgramId); |
| 1189 |
| 1190 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(1); |
| 1191 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)).Times(1); |
| 1192 DrawElements cmd; |
| 1193 cmd.Init(GL_TRIANGLES, |
| 1194 kValidIndexRangeCount, |
| 1195 GL_UNSIGNED_SHORT, |
| 1196 kValidIndexRangeStart * 2); |
| 1197 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1198 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1199 } |
| 1200 |
| 1201 TEST_F(GLES2DecoderWithShaderTest, DrawElementsWithInvalidModeFails) { |
| 1202 SetupVertexBuffer(); |
| 1203 SetupIndexBuffer(); |
| 1204 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1205 |
| 1206 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1207 DrawElements cmd; |
| 1208 cmd.Init(GL_QUADS, |
| 1209 kValidIndexRangeCount, |
| 1210 GL_UNSIGNED_SHORT, |
| 1211 kValidIndexRangeStart * 2); |
| 1212 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1213 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 1214 cmd.Init(GL_POLYGON, |
| 1215 kValidIndexRangeCount, |
| 1216 GL_UNSIGNED_SHORT, |
| 1217 kValidIndexRangeStart); |
| 1218 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1219 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 1220 } |
| 1221 |
| 1222 TEST_F(GLES2DecoderWithShaderTest, DrawElementsInvalidCountFails) { |
| 1223 SetupVertexBuffer(); |
| 1224 SetupIndexBuffer(); |
| 1225 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1226 |
| 1227 // Try start > 0 |
| 1228 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1229 DrawElements cmd; |
| 1230 cmd.Init(GL_TRIANGLES, kNumIndices, GL_UNSIGNED_SHORT, 2); |
| 1231 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1232 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1233 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1234 |
| 1235 // Try with count > size |
| 1236 cmd.Init(GL_TRIANGLES, kNumIndices + 1, GL_UNSIGNED_SHORT, 0); |
| 1237 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1238 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1239 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1240 } |
| 1241 |
| 1242 TEST_F(GLES2DecoderWithShaderTest, DrawElementsOutOfRangeIndicesFails) { |
| 1243 SetupVertexBuffer(); |
| 1244 SetupIndexBuffer(); |
| 1245 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1246 |
| 1247 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1248 DrawElements cmd; |
| 1249 cmd.Init(GL_TRIANGLES, |
| 1250 kInvalidIndexRangeCount, |
| 1251 GL_UNSIGNED_SHORT, |
| 1252 kInvalidIndexRangeStart * 2); |
| 1253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1254 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1255 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1256 } |
| 1257 |
| 1258 TEST_F(GLES2DecoderWithShaderTest, DrawElementsOddOffsetForUint16Fails) { |
| 1259 SetupVertexBuffer(); |
| 1260 SetupIndexBuffer(); |
| 1261 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1262 |
| 1263 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
| 1264 DrawElements cmd; |
| 1265 cmd.Init(GL_TRIANGLES, kInvalidIndexRangeCount, GL_UNSIGNED_SHORT, 1); |
| 1266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1267 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1268 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1269 } |
| 1270 |
| 1271 TEST_F(GLES2DecoderWithShaderTest, DrawElementsInstancedANGLEFails) { |
| 1272 SetupTexture(); |
| 1273 SetupVertexBuffer(); |
| 1274 SetupIndexBuffer(); |
| 1275 DoEnableVertexAttribArray(1); |
| 1276 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1277 |
| 1278 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
| 1279 .Times(0) |
| 1280 .RetiresOnSaturation(); |
| 1281 DrawElementsInstancedANGLE cmd; |
| 1282 cmd.Init(GL_TRIANGLES, |
| 1283 kValidIndexRangeCount, |
| 1284 GL_UNSIGNED_SHORT, |
| 1285 kValidIndexRangeStart * 2, |
| 1286 1); |
| 1287 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1288 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1289 } |
| 1290 |
| 1291 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1292 DrawElementsInstancedANGLENoAttributesFails) { |
| 1293 SetupTexture(); |
| 1294 SetupIndexBuffer(); |
| 1295 |
| 1296 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
| 1297 .Times(0) |
| 1298 .RetiresOnSaturation(); |
| 1299 DrawElementsInstancedANGLE cmd; |
| 1300 cmd.Init(GL_TRIANGLES, |
| 1301 kValidIndexRangeCount, |
| 1302 GL_UNSIGNED_SHORT, |
| 1303 kValidIndexRangeStart * 2, |
| 1304 1); |
| 1305 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1306 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1307 } |
| 1308 |
| 1309 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1310 DrawElementsInstancedANGLESimulatedAttrib0) { |
| 1311 SetupTexture(); |
| 1312 SetupVertexBuffer(); |
| 1313 SetupIndexBuffer(); |
| 1314 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1315 |
| 1316 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
| 1317 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1318 |
| 1319 DoVertexAttribDivisorANGLE(0, 1); |
| 1320 EXPECT_CALL( |
| 1321 *gl_, |
| 1322 DrawElementsInstancedANGLE(GL_TRIANGLES, |
| 1323 kValidIndexRangeCount, |
| 1324 GL_UNSIGNED_SHORT, |
| 1325 BufferOffset(kValidIndexRangeStart * 2), |
| 1326 3)) |
| 1327 .Times(1) |
| 1328 .RetiresOnSaturation(); |
| 1329 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) |
| 1330 .Times(1) |
| 1331 .RetiresOnSaturation(); |
| 1332 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 1)) |
| 1333 .Times(1) |
| 1334 .RetiresOnSaturation(); |
| 1335 DrawElementsInstancedANGLE cmd; |
| 1336 cmd.Init(GL_TRIANGLES, |
| 1337 kValidIndexRangeCount, |
| 1338 GL_UNSIGNED_SHORT, |
| 1339 kValidIndexRangeStart * 2, |
| 1340 3); |
| 1341 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1342 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1343 } |
| 1344 |
| 1345 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1346 DrawElementsInstancedANGLEMissingAttributesFails) { |
| 1347 SetupIndexBuffer(); |
| 1348 DoEnableVertexAttribArray(1); |
| 1349 |
| 1350 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); |
| 1351 DrawElementsInstancedANGLE cmd; |
| 1352 cmd.Init(GL_TRIANGLES, |
| 1353 kValidIndexRangeCount, |
| 1354 GL_UNSIGNED_SHORT, |
| 1355 kValidIndexRangeStart * 2, |
| 1356 1); |
| 1357 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1358 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1359 } |
| 1360 |
| 1361 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1362 DrawElementsInstancedANGLEMissingAttributesZeroCountSucceeds) { |
| 1363 SetupIndexBuffer(); |
| 1364 DoEnableVertexAttribArray(1); |
| 1365 |
| 1366 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); |
| 1367 DrawElementsInstancedANGLE cmd; |
| 1368 cmd.Init(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2, 1); |
| 1369 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1370 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1371 } |
| 1372 |
| 1373 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1374 DrawElementsInstancedANGLEValidAttributesSucceeds) { |
| 1375 SetupIndexBuffer(); |
| 1376 SetupTexture(); |
| 1377 SetupVertexBuffer(); |
| 1378 DoEnableVertexAttribArray(1); |
| 1379 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1380 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
| 1381 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1382 |
| 1383 EXPECT_CALL( |
| 1384 *gl_, |
| 1385 DrawElementsInstancedANGLE(GL_TRIANGLES, |
| 1386 kValidIndexRangeCount, |
| 1387 GL_UNSIGNED_SHORT, |
| 1388 BufferOffset(kValidIndexRangeStart * 2), |
| 1389 1)) |
| 1390 .Times(1) |
| 1391 .RetiresOnSaturation(); |
| 1392 DrawElementsInstancedANGLE cmd; |
| 1393 cmd.Init(GL_TRIANGLES, |
| 1394 kValidIndexRangeCount, |
| 1395 GL_UNSIGNED_SHORT, |
| 1396 kValidIndexRangeStart * 2, |
| 1397 1); |
| 1398 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1399 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1400 } |
| 1401 |
| 1402 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1403 DrawElementsInstancedANGLEWithInvalidModeFails) { |
| 1404 SetupIndexBuffer(); |
| 1405 SetupVertexBuffer(); |
| 1406 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1407 |
| 1408 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); |
| 1409 DrawElementsInstancedANGLE cmd; |
| 1410 cmd.Init(GL_QUADS, |
| 1411 kValidIndexRangeCount, |
| 1412 GL_UNSIGNED_SHORT, |
| 1413 kValidIndexRangeStart * 2, |
| 1414 1); |
| 1415 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1416 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 1417 cmd.Init(GL_INVALID_ENUM, |
| 1418 kValidIndexRangeCount, |
| 1419 GL_UNSIGNED_SHORT, |
| 1420 kValidIndexRangeStart * 2, |
| 1421 1); |
| 1422 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1423 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 1424 } |
| 1425 |
| 1426 // Per-instance data is twice as large, but number of instances is half |
| 1427 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1428 DrawElementsInstancedANGLELargeInstanceSucceeds) { |
| 1429 SetupTexture(); |
| 1430 SetupIndexBuffer(); |
| 1431 SetupVertexBuffer(); |
| 1432 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1433 // Add offset so we're sure we're accessing data near the end of the buffer. |
| 1434 DoVertexAttribPointer( |
| 1435 1, |
| 1436 2, |
| 1437 GL_FLOAT, |
| 1438 0, |
| 1439 (kNumVertices - kMaxValidIndex - 1) * 2 * sizeof(GLfloat)); |
| 1440 |
| 1441 DoEnableVertexAttribArray(0); |
| 1442 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
| 1443 DoVertexAttribDivisorANGLE(0, 1); |
| 1444 EXPECT_CALL( |
| 1445 *gl_, |
| 1446 DrawElementsInstancedANGLE(GL_TRIANGLES, |
| 1447 kValidIndexRangeCount, |
| 1448 GL_UNSIGNED_SHORT, |
| 1449 BufferOffset(kValidIndexRangeStart * 2), |
| 1450 kNumVertices / 2)) |
| 1451 .Times(1) |
| 1452 .RetiresOnSaturation(); |
| 1453 DrawElementsInstancedANGLE cmd; |
| 1454 cmd.Init(GL_TRIANGLES, |
| 1455 kValidIndexRangeCount, |
| 1456 GL_UNSIGNED_SHORT, |
| 1457 kValidIndexRangeStart * 2, |
| 1458 kNumVertices / 2); |
| 1459 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1460 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1461 } |
| 1462 |
| 1463 // Per-instance data is twice as large, but divisor is twice |
| 1464 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1465 DrawElementsInstancedANGLELargeDivisorSucceeds) { |
| 1466 SetupTexture(); |
| 1467 SetupIndexBuffer(); |
| 1468 SetupVertexBuffer(); |
| 1469 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1470 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1471 |
| 1472 DoEnableVertexAttribArray(0); |
| 1473 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
| 1474 DoVertexAttribDivisorANGLE(0, 2); |
| 1475 EXPECT_CALL( |
| 1476 *gl_, |
| 1477 DrawElementsInstancedANGLE(GL_TRIANGLES, |
| 1478 kValidIndexRangeCount, |
| 1479 GL_UNSIGNED_SHORT, |
| 1480 BufferOffset(kValidIndexRangeStart * 2), |
| 1481 kNumVertices)) |
| 1482 .Times(1) |
| 1483 .RetiresOnSaturation(); |
| 1484 DrawElementsInstancedANGLE cmd; |
| 1485 cmd.Init(GL_TRIANGLES, |
| 1486 kValidIndexRangeCount, |
| 1487 GL_UNSIGNED_SHORT, |
| 1488 kValidIndexRangeStart * 2, |
| 1489 kNumVertices); |
| 1490 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1491 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1492 } |
| 1493 |
| 1494 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1495 DrawElementsInstancedANGLELargeFails) { |
| 1496 SetupTexture(); |
| 1497 SetupIndexBuffer(); |
| 1498 SetupVertexBuffer(); |
| 1499 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1500 |
| 1501 DoEnableVertexAttribArray(0); |
| 1502 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1503 DoVertexAttribDivisorANGLE(0, 1); |
| 1504 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
| 1505 .Times(0) |
| 1506 .RetiresOnSaturation(); |
| 1507 DrawElementsInstancedANGLE cmd; |
| 1508 cmd.Init(GL_TRIANGLES, |
| 1509 kValidIndexRangeCount, |
| 1510 GL_UNSIGNED_SHORT, |
| 1511 kValidIndexRangeStart * 2, |
| 1512 kNumVertices + 1); |
| 1513 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1514 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1515 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1516 |
| 1517 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
| 1518 .Times(0) |
| 1519 .RetiresOnSaturation(); |
| 1520 cmd.Init(GL_TRIANGLES, |
| 1521 kInvalidIndexRangeCount, |
| 1522 GL_UNSIGNED_SHORT, |
| 1523 kInvalidIndexRangeStart * 2, |
| 1524 kNumVertices); |
| 1525 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1526 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1527 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1528 } |
| 1529 |
| 1530 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1531 DrawElementsInstancedANGLEInvalidPrimcountFails) { |
| 1532 SetupTexture(); |
| 1533 SetupIndexBuffer(); |
| 1534 SetupVertexBuffer(); |
| 1535 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1536 |
| 1537 DoEnableVertexAttribArray(0); |
| 1538 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1539 DoVertexAttribDivisorANGLE(0, 1); |
| 1540 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
| 1541 .Times(0) |
| 1542 .RetiresOnSaturation(); |
| 1543 DrawElementsInstancedANGLE cmd; |
| 1544 cmd.Init(GL_TRIANGLES, |
| 1545 kValidIndexRangeCount, |
| 1546 GL_UNSIGNED_SHORT, |
| 1547 kValidIndexRangeStart * 2, |
| 1548 -1); |
| 1549 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1550 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 1551 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1552 } |
| 1553 |
| 1554 // Per-index data is twice as large, but values of indices are smaller |
| 1555 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1556 DrawElementsInstancedANGLELargeIndexSucceeds) { |
| 1557 SetupTexture(); |
| 1558 SetupIndexBuffer(); |
| 1559 SetupVertexBuffer(); |
| 1560 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1561 DoVertexAttribPointer(1, 4, GL_FLOAT, 0, 0); |
| 1562 |
| 1563 DoEnableVertexAttribArray(0); |
| 1564 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1565 DoVertexAttribDivisorANGLE(0, 1); |
| 1566 EXPECT_CALL( |
| 1567 *gl_, |
| 1568 DrawElementsInstancedANGLE(GL_TRIANGLES, |
| 1569 kValidIndexRangeCount, |
| 1570 GL_UNSIGNED_SHORT, |
| 1571 BufferOffset(kValidIndexRangeStart * 2), |
| 1572 kNumVertices)) |
| 1573 .Times(1) |
| 1574 .RetiresOnSaturation(); |
| 1575 DrawElementsInstancedANGLE cmd; |
| 1576 cmd.Init(GL_TRIANGLES, |
| 1577 kValidIndexRangeCount, |
| 1578 GL_UNSIGNED_SHORT, |
| 1579 kValidIndexRangeStart * 2, |
| 1580 kNumVertices); |
| 1581 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1582 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1583 } |
| 1584 |
| 1585 TEST_F(GLES2DecoderGeometryInstancingTest, |
| 1586 DrawElementsInstancedANGLENoDivisor0Fails) { |
| 1587 SetupTexture(); |
| 1588 SetupIndexBuffer(); |
| 1589 SetupVertexBuffer(); |
| 1590 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 1591 |
| 1592 DoEnableVertexAttribArray(0); |
| 1593 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 1594 DoVertexAttribDivisorANGLE(0, 1); |
| 1595 DoVertexAttribDivisorANGLE(1, 1); |
| 1596 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
| 1597 .Times(0) |
| 1598 .RetiresOnSaturation(); |
| 1599 DrawElementsInstancedANGLE cmd; |
| 1600 cmd.Init(GL_TRIANGLES, |
| 1601 kValidIndexRangeCount, |
| 1602 GL_UNSIGNED_SHORT, |
| 1603 kValidIndexRangeStart * 2, |
| 1604 kNumVertices); |
| 1605 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1606 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1607 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1608 } |
| 1609 |
| 1610 TEST_F(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) { |
| 1611 SetupAllNeededVertexBuffers(); |
| 1612 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1613 // Create an uncleared texture with 2 levels. |
| 1614 DoTexImage2D( |
| 1615 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1616 DoTexImage2D( |
| 1617 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1618 // Expect 2 levels will be cleared. |
| 1619 SetupClearTextureExpectations(kServiceTextureId, |
| 1620 kServiceTextureId, |
| 1621 GL_TEXTURE_2D, |
| 1622 GL_TEXTURE_2D, |
| 1623 0, |
| 1624 GL_RGBA, |
| 1625 GL_RGBA, |
| 1626 GL_UNSIGNED_BYTE, |
| 1627 2, |
| 1628 2); |
| 1629 SetupClearTextureExpectations(kServiceTextureId, |
| 1630 kServiceTextureId, |
| 1631 GL_TEXTURE_2D, |
| 1632 GL_TEXTURE_2D, |
| 1633 1, |
| 1634 GL_RGBA, |
| 1635 GL_RGBA, |
| 1636 GL_UNSIGNED_BYTE, |
| 1637 1, |
| 1638 1); |
| 1639 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1640 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1641 .Times(1) |
| 1642 .RetiresOnSaturation(); |
| 1643 DrawArrays cmd; |
| 1644 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1645 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1646 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1647 |
| 1648 // But not again |
| 1649 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1650 .Times(1) |
| 1651 .RetiresOnSaturation(); |
| 1652 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1653 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1654 } |
| 1655 |
| 1656 TEST_F(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) { |
| 1657 SetupAllNeededVertexBuffers(); |
| 1658 SetupIndexBuffer(); |
| 1659 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1660 // Create an uncleared texture with 2 levels. |
| 1661 DoTexImage2D( |
| 1662 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1663 DoTexImage2D( |
| 1664 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1665 // Expect 2 levels will be cleared. |
| 1666 SetupClearTextureExpectations(kServiceTextureId, |
| 1667 kServiceTextureId, |
| 1668 GL_TEXTURE_2D, |
| 1669 GL_TEXTURE_2D, |
| 1670 0, |
| 1671 GL_RGBA, |
| 1672 GL_RGBA, |
| 1673 GL_UNSIGNED_BYTE, |
| 1674 2, |
| 1675 2); |
| 1676 SetupClearTextureExpectations(kServiceTextureId, |
| 1677 kServiceTextureId, |
| 1678 GL_TEXTURE_2D, |
| 1679 GL_TEXTURE_2D, |
| 1680 1, |
| 1681 GL_RGBA, |
| 1682 GL_RGBA, |
| 1683 GL_UNSIGNED_BYTE, |
| 1684 1, |
| 1685 1); |
| 1686 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1687 |
| 1688 EXPECT_CALL(*gl_, |
| 1689 DrawElements(GL_TRIANGLES, |
| 1690 kValidIndexRangeCount, |
| 1691 GL_UNSIGNED_SHORT, |
| 1692 BufferOffset(kValidIndexRangeStart * 2))) |
| 1693 .Times(1) |
| 1694 .RetiresOnSaturation(); |
| 1695 DrawElements cmd; |
| 1696 cmd.Init(GL_TRIANGLES, |
| 1697 kValidIndexRangeCount, |
| 1698 GL_UNSIGNED_SHORT, |
| 1699 kValidIndexRangeStart * 2); |
| 1700 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1701 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1702 |
| 1703 // But not again |
| 1704 EXPECT_CALL(*gl_, |
| 1705 DrawElements(GL_TRIANGLES, |
| 1706 kValidIndexRangeCount, |
| 1707 GL_UNSIGNED_SHORT, |
| 1708 BufferOffset(kValidIndexRangeStart * 2))) |
| 1709 .Times(1) |
| 1710 .RetiresOnSaturation(); |
| 1711 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1712 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1713 } |
| 1714 |
| 1715 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterTexImage2DNULLInFBO) { |
| 1716 const GLuint kFBOClientTextureId = 4100; |
| 1717 const GLuint kFBOServiceTextureId = 4101; |
| 1718 |
| 1719 SetupAllNeededVertexBuffers(); |
| 1720 // Register a texture id. |
| 1721 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 1722 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 1723 .RetiresOnSaturation(); |
| 1724 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| 1725 |
| 1726 // Setup "render to" texture. |
| 1727 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| 1728 DoTexImage2D( |
| 1729 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1730 DoBindFramebuffer( |
| 1731 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1732 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
| 1733 GL_COLOR_ATTACHMENT0, |
| 1734 GL_TEXTURE_2D, |
| 1735 kFBOClientTextureId, |
| 1736 kFBOServiceTextureId, |
| 1737 0, |
| 1738 GL_NO_ERROR); |
| 1739 |
| 1740 // Setup "render from" texture. |
| 1741 SetupTexture(); |
| 1742 |
| 1743 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target |
| 1744 GL_COLOR_BUFFER_BIT, // clear bits |
| 1745 0, |
| 1746 0, |
| 1747 0, |
| 1748 0, // color |
| 1749 0, // stencil |
| 1750 1.0f, // depth |
| 1751 false); // scissor test |
| 1752 |
| 1753 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
| 1754 false, // Framebuffer has depth |
| 1755 false, // Framebuffer has stencil |
| 1756 0x1111, // color bits |
| 1757 false, // depth mask |
| 1758 false, // depth enabled |
| 1759 0, // front stencil mask |
| 1760 0, // back stencil mask |
| 1761 false, // stencil enabled |
| 1762 false, // cull_face_enabled |
| 1763 false, // scissor_test_enabled |
| 1764 false); // blend_enabled |
| 1765 |
| 1766 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1767 .Times(1) |
| 1768 .RetiresOnSaturation(); |
| 1769 DrawArrays cmd; |
| 1770 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1771 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1772 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1773 |
| 1774 // But not again. |
| 1775 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1776 .Times(1) |
| 1777 .RetiresOnSaturation(); |
| 1778 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1779 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1780 } |
| 1781 |
| 1782 TEST_F(GLES2DecoderWithShaderTest, DrawWitFBOThatCantClearDoesNotDraw) { |
| 1783 const GLuint kFBOClientTextureId = 4100; |
| 1784 const GLuint kFBOServiceTextureId = 4101; |
| 1785 |
| 1786 // Register a texture id. |
| 1787 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 1788 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 1789 .RetiresOnSaturation(); |
| 1790 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| 1791 |
| 1792 // Setup "render to" texture. |
| 1793 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| 1794 DoTexImage2D( |
| 1795 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1796 DoBindFramebuffer( |
| 1797 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1798 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
| 1799 GL_COLOR_ATTACHMENT0, |
| 1800 GL_TEXTURE_2D, |
| 1801 kFBOClientTextureId, |
| 1802 kFBOServiceTextureId, |
| 1803 0, |
| 1804 GL_NO_ERROR); |
| 1805 |
| 1806 // Setup "render from" texture. |
| 1807 SetupTexture(); |
| 1808 |
| 1809 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 1810 .WillOnce(Return(GL_FRAMEBUFFER_UNSUPPORTED)) |
| 1811 .RetiresOnSaturation(); |
| 1812 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
| 1813 DrawArrays cmd; |
| 1814 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1815 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1816 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); |
| 1817 } |
| 1818 |
| 1819 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { |
| 1820 SetupTexture(); |
| 1821 DoBindRenderbuffer( |
| 1822 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
| 1823 DoBindFramebuffer( |
| 1824 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1825 DoRenderbufferStorage( |
| 1826 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR); |
| 1827 DoFramebufferRenderbuffer(GL_FRAMEBUFFER, |
| 1828 GL_COLOR_ATTACHMENT0, |
| 1829 GL_RENDERBUFFER, |
| 1830 client_renderbuffer_id_, |
| 1831 kServiceRenderbufferId, |
| 1832 GL_NO_ERROR); |
| 1833 |
| 1834 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target |
| 1835 GL_COLOR_BUFFER_BIT, // clear bits |
| 1836 0, |
| 1837 0, |
| 1838 0, |
| 1839 0, // color |
| 1840 0, // stencil |
| 1841 1.0f, // depth |
| 1842 false); // scissor test |
| 1843 |
| 1844 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 1845 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
| 1846 false, // Framebuffer has depth |
| 1847 false, // Framebuffer has stencil |
| 1848 0x1111, // color bits |
| 1849 false, // depth mask |
| 1850 false, // depth enabled |
| 1851 0, // front stencil mask |
| 1852 0, // back stencil mask |
| 1853 false, // stencil enabled |
| 1854 false, // cull_face_enabled |
| 1855 false, // scissor_test_enabled |
| 1856 false); // blend_enabled |
| 1857 |
| 1858 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1859 .Times(1) |
| 1860 .RetiresOnSaturation(); |
| 1861 DrawArrays cmd; |
| 1862 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1863 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1864 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1865 } |
| 1866 |
| 1867 TEST_F(GLES2DecoderManualInitTest, DrawArraysClearsAfterTexImage2DNULLCubemap) { |
| 1868 InitState init; |
| 1869 init.gl_version = "opengl es 2.0"; |
| 1870 init.has_alpha = true; |
| 1871 init.has_depth = true; |
| 1872 init.request_alpha = true; |
| 1873 init.request_depth = true; |
| 1874 InitDecoder(init); |
| 1875 |
| 1876 static const GLenum faces[] = { |
| 1877 GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, |
| 1878 GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, |
| 1879 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, |
| 1880 }; |
| 1881 SetupCubemapProgram(); |
| 1882 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); |
| 1883 // Fill out all the faces for 2 levels, leave 2 uncleared. |
| 1884 for (int ii = 0; ii < 6; ++ii) { |
| 1885 GLenum face = faces[ii]; |
| 1886 int32 shm_id = |
| 1887 (face == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ? 0 : kSharedMemoryId; |
| 1888 uint32 shm_offset = |
| 1889 (face == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ? 0 : kSharedMemoryOffset; |
| 1890 DoTexImage2D(face, |
| 1891 0, |
| 1892 GL_RGBA, |
| 1893 2, |
| 1894 2, |
| 1895 0, |
| 1896 GL_RGBA, |
| 1897 GL_UNSIGNED_BYTE, |
| 1898 shm_id, |
| 1899 shm_offset); |
| 1900 DoTexImage2D(face, |
| 1901 1, |
| 1902 GL_RGBA, |
| 1903 1, |
| 1904 1, |
| 1905 0, |
| 1906 GL_RGBA, |
| 1907 GL_UNSIGNED_BYTE, |
| 1908 shm_id, |
| 1909 shm_offset); |
| 1910 } |
| 1911 // Expect 2 levels will be cleared. |
| 1912 SetupClearTextureExpectations(kServiceTextureId, |
| 1913 kServiceTextureId, |
| 1914 GL_TEXTURE_CUBE_MAP, |
| 1915 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, |
| 1916 0, |
| 1917 GL_RGBA, |
| 1918 GL_RGBA, |
| 1919 GL_UNSIGNED_BYTE, |
| 1920 2, |
| 1921 2); |
| 1922 SetupClearTextureExpectations(kServiceTextureId, |
| 1923 kServiceTextureId, |
| 1924 GL_TEXTURE_CUBE_MAP, |
| 1925 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, |
| 1926 1, |
| 1927 GL_RGBA, |
| 1928 GL_RGBA, |
| 1929 GL_UNSIGNED_BYTE, |
| 1930 1, |
| 1931 1); |
| 1932 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 1933 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1934 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1935 .Times(1) |
| 1936 .RetiresOnSaturation(); |
| 1937 DrawArrays cmd; |
| 1938 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1939 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1940 } |
| 1941 |
| 1942 TEST_F(GLES2DecoderWithShaderTest, |
| 1943 DrawClearsAfterRenderbuffersWithMultipleAttachments) { |
| 1944 const GLuint kFBOClientTextureId = 4100; |
| 1945 const GLuint kFBOServiceTextureId = 4101; |
| 1946 |
| 1947 // Register a texture id. |
| 1948 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 1949 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 1950 .RetiresOnSaturation(); |
| 1951 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| 1952 |
| 1953 // Setup "render to" texture. |
| 1954 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| 1955 DoTexImage2D( |
| 1956 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1957 DoBindFramebuffer( |
| 1958 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1959 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
| 1960 GL_COLOR_ATTACHMENT0, |
| 1961 GL_TEXTURE_2D, |
| 1962 kFBOClientTextureId, |
| 1963 kFBOServiceTextureId, |
| 1964 0, |
| 1965 GL_NO_ERROR); |
| 1966 |
| 1967 DoBindRenderbuffer( |
| 1968 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
| 1969 DoBindFramebuffer( |
| 1970 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1971 DoRenderbufferStorage(GL_RENDERBUFFER, |
| 1972 GL_DEPTH_COMPONENT16, |
| 1973 GL_DEPTH_COMPONENT, |
| 1974 1, |
| 1975 1, |
| 1976 GL_NO_ERROR); |
| 1977 DoFramebufferRenderbuffer(GL_FRAMEBUFFER, |
| 1978 GL_DEPTH_ATTACHMENT, |
| 1979 GL_RENDERBUFFER, |
| 1980 client_renderbuffer_id_, |
| 1981 kServiceRenderbufferId, |
| 1982 GL_NO_ERROR); |
| 1983 |
| 1984 SetupTexture(); |
| 1985 SetupExpectationsForFramebufferClearing( |
| 1986 GL_FRAMEBUFFER, // target |
| 1987 GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, // clear bits |
| 1988 0, |
| 1989 0, |
| 1990 0, |
| 1991 0, // color |
| 1992 0, // stencil |
| 1993 1.0f, // depth |
| 1994 false); // scissor test |
| 1995 |
| 1996 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 1997 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
| 1998 true, // Framebuffer has depth |
| 1999 false, // Framebuffer has stencil |
| 2000 0x1111, // color bits |
| 2001 true, // depth mask |
| 2002 false, // depth enabled |
| 2003 0, // front stencil mask |
| 2004 0, // back stencil mask |
| 2005 false, // stencil enabled |
| 2006 false, // cull_face_enabled |
| 2007 false, // scissor_test_enabled |
| 2008 false); // blend_enabled |
| 2009 |
| 2010 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 2011 .Times(1) |
| 2012 .RetiresOnSaturation(); |
| 2013 DrawArrays cmd; |
| 2014 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 2015 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2016 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2017 } |
| 2018 |
| 2019 TEST_F(GLES2DecoderWithShaderTest, |
| 2020 DrawingWithFBOTwiceChecksForFBOCompleteOnce) { |
| 2021 const GLuint kFBOClientTextureId = 4100; |
| 2022 const GLuint kFBOServiceTextureId = 4101; |
| 2023 |
| 2024 SetupAllNeededVertexBuffers(); |
| 2025 |
| 2026 // Register a texture id. |
| 2027 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 2028 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 2029 .RetiresOnSaturation(); |
| 2030 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| 2031 |
| 2032 // Setup "render to" texture that is cleared. |
| 2033 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| 2034 DoTexImage2D(GL_TEXTURE_2D, |
| 2035 0, |
| 2036 GL_RGBA, |
| 2037 1, |
| 2038 1, |
| 2039 0, |
| 2040 GL_RGBA, |
| 2041 GL_UNSIGNED_BYTE, |
| 2042 kSharedMemoryId, |
| 2043 kSharedMemoryOffset); |
| 2044 DoBindFramebuffer( |
| 2045 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 2046 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
| 2047 GL_COLOR_ATTACHMENT0, |
| 2048 GL_TEXTURE_2D, |
| 2049 kFBOClientTextureId, |
| 2050 kFBOServiceTextureId, |
| 2051 0, |
| 2052 GL_NO_ERROR); |
| 2053 |
| 2054 // Setup "render from" texture. |
| 2055 SetupTexture(); |
| 2056 |
| 2057 // Make sure we check for framebuffer complete. |
| 2058 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 2059 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 2060 .RetiresOnSaturation(); |
| 2061 |
| 2062 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
| 2063 false, // Framebuffer has depth |
| 2064 false, // Framebuffer has stencil |
| 2065 0x1111, // color bits |
| 2066 false, // depth mask |
| 2067 false, // depth enabled |
| 2068 0, // front stencil mask |
| 2069 0, // back stencil mask |
| 2070 false, // stencil enabled |
| 2071 false, // cull_face_enabled |
| 2072 false, // scissor_test_enabled |
| 2073 false); // blend_enabled |
| 2074 |
| 2075 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 2076 .Times(1) |
| 2077 .RetiresOnSaturation(); |
| 2078 DrawArrays cmd; |
| 2079 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 2080 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2081 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2082 |
| 2083 // But not again. |
| 2084 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 2085 .Times(1) |
| 2086 .RetiresOnSaturation(); |
| 2087 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2088 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2089 } |
| 2090 |
| 2091 TEST_F(GLES2DecoderManualInitTest, DrawClearsDepthTexture) { |
| 2092 InitState init; |
| 2093 init.extensions = "GL_ANGLE_depth_texture"; |
| 2094 init.gl_version = "opengl es 2.0"; |
| 2095 init.has_alpha = true; |
| 2096 init.has_depth = true; |
| 2097 init.request_alpha = true; |
| 2098 init.request_depth = true; |
| 2099 init.bind_generates_resource = true; |
| 2100 InitDecoder(init); |
| 2101 |
| 2102 SetupDefaultProgram(); |
| 2103 SetupAllNeededVertexBuffers(); |
| 2104 const GLenum attachment = GL_DEPTH_ATTACHMENT; |
| 2105 const GLenum target = GL_TEXTURE_2D; |
| 2106 const GLint level = 0; |
| 2107 DoBindTexture(target, client_texture_id_, kServiceTextureId); |
| 2108 |
| 2109 // Create a depth texture. |
| 2110 DoTexImage2D(target, |
| 2111 level, |
| 2112 GL_DEPTH_COMPONENT, |
| 2113 1, |
| 2114 1, |
| 2115 0, |
| 2116 GL_DEPTH_COMPONENT, |
| 2117 GL_UNSIGNED_INT, |
| 2118 0, |
| 2119 0); |
| 2120 |
| 2121 EXPECT_CALL(*gl_, GenFramebuffersEXT(1, _)).Times(1).RetiresOnSaturation(); |
| 2122 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, _)) |
| 2123 .Times(1) |
| 2124 .RetiresOnSaturation(); |
| 2125 |
| 2126 EXPECT_CALL(*gl_, |
| 2127 FramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, |
| 2128 attachment, |
| 2129 target, |
| 2130 kServiceTextureId, |
| 2131 level)) |
| 2132 .Times(1) |
| 2133 .RetiresOnSaturation(); |
| 2134 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT)) |
| 2135 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 2136 .RetiresOnSaturation(); |
| 2137 |
| 2138 EXPECT_CALL(*gl_, ClearStencil(0)).Times(1).RetiresOnSaturation(); |
| 2139 EXPECT_CALL(*gl_, StencilMask(-1)).Times(1).RetiresOnSaturation(); |
| 2140 EXPECT_CALL(*gl_, ClearDepth(1.0f)).Times(1).RetiresOnSaturation(); |
| 2141 EXPECT_CALL(*gl_, DepthMask(true)).Times(1).RetiresOnSaturation(); |
| 2142 EXPECT_CALL(*gl_, Disable(GL_SCISSOR_TEST)).Times(1).RetiresOnSaturation(); |
| 2143 |
| 2144 EXPECT_CALL(*gl_, Clear(GL_DEPTH_BUFFER_BIT)).Times(1).RetiresOnSaturation(); |
| 2145 |
| 2146 SetupExpectationsForRestoreClearState(0.0f, 0.0f, 0.0f, 0.0f, 0, 1.0f, false); |
| 2147 |
| 2148 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, _)).Times(1).RetiresOnSaturation(); |
| 2149 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0)) |
| 2150 .Times(1) |
| 2151 .RetiresOnSaturation(); |
| 2152 |
| 2153 SetupExpectationsForApplyingDefaultDirtyState(); |
| 2154 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 2155 .Times(1) |
| 2156 .RetiresOnSaturation(); |
| 2157 DrawArrays cmd; |
| 2158 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 2159 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2160 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2161 } |
| 2162 |
| 2163 } // namespace gles2 |
| 2164 } // namespace gpu |
OLD | NEW |