| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearing( | 337 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearing( |
| 338 GLenum target, | 338 GLenum target, |
| 339 GLuint clear_bits, | 339 GLuint clear_bits, |
| 340 GLclampf restore_red, | 340 GLclampf restore_red, |
| 341 GLclampf restore_green, | 341 GLclampf restore_green, |
| 342 GLclampf restore_blue, | 342 GLclampf restore_blue, |
| 343 GLclampf restore_alpha, | 343 GLclampf restore_alpha, |
| 344 GLuint restore_stencil, | 344 GLuint restore_stencil, |
| 345 GLclampf restore_depth, | 345 GLclampf restore_depth, |
| 346 bool restore_scissor_test) { | 346 bool restore_scissor_test) { |
| 347 SetupExpectationsForFramebufferClearingMulti( |
| 348 0, |
| 349 0, |
| 350 target, |
| 351 clear_bits, |
| 352 restore_red, |
| 353 restore_green, |
| 354 restore_blue, |
| 355 restore_alpha, |
| 356 restore_stencil, |
| 357 restore_depth, |
| 358 restore_scissor_test); |
| 359 } |
| 360 |
| 361 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearingMulti( |
| 362 GLuint read_framebuffer_service_id, |
| 363 GLuint draw_framebuffer_service_id, |
| 364 GLenum target, |
| 365 GLuint clear_bits, |
| 366 GLclampf restore_red, |
| 367 GLclampf restore_green, |
| 368 GLclampf restore_blue, |
| 369 GLclampf restore_alpha, |
| 370 GLuint restore_stencil, |
| 371 GLclampf restore_depth, |
| 372 bool restore_scissor_test) { |
| 347 // TODO(gman): Figure out why InSequence stopped working. | 373 // TODO(gman): Figure out why InSequence stopped working. |
| 348 // InSequence sequence; | 374 // InSequence sequence; |
| 349 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(target)) | 375 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(target)) |
| 350 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 376 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 351 .RetiresOnSaturation(); | 377 .RetiresOnSaturation(); |
| 378 if (target == GL_READ_FRAMEBUFFER_EXT) { |
| 379 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0)) |
| 380 .Times(1) |
| 381 .RetiresOnSaturation(); |
| 382 EXPECT_CALL(*gl_, BindFramebufferEXT( |
| 383 GL_DRAW_FRAMEBUFFER_EXT, read_framebuffer_service_id)) |
| 384 .Times(1) |
| 385 .RetiresOnSaturation(); |
| 386 } |
| 352 if ((clear_bits & GL_COLOR_BUFFER_BIT) != 0) { | 387 if ((clear_bits & GL_COLOR_BUFFER_BIT) != 0) { |
| 353 EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0f, 0.0f, 0.0f)) | 388 EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0f, 0.0f, 0.0f)) |
| 354 .Times(1) | 389 .Times(1) |
| 355 .RetiresOnSaturation(); | 390 .RetiresOnSaturation(); |
| 356 EXPECT_CALL(*gl_, ColorMask(true, true, true, true)) | 391 EXPECT_CALL(*gl_, ColorMask(true, true, true, true)) |
| 357 .Times(1) | 392 .Times(1) |
| 358 .RetiresOnSaturation(); | 393 .RetiresOnSaturation(); |
| 359 } | 394 } |
| 360 if ((clear_bits & GL_STENCIL_BUFFER_BIT) != 0) { | 395 if ((clear_bits & GL_STENCIL_BUFFER_BIT) != 0) { |
| 361 EXPECT_CALL(*gl_, ClearStencil(0)) | 396 EXPECT_CALL(*gl_, ClearStencil(0)) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 387 .Times(1) | 422 .Times(1) |
| 388 .RetiresOnSaturation(); | 423 .RetiresOnSaturation(); |
| 389 EXPECT_CALL(*gl_, ClearDepth(restore_depth)) | 424 EXPECT_CALL(*gl_, ClearDepth(restore_depth)) |
| 390 .Times(1) | 425 .Times(1) |
| 391 .RetiresOnSaturation(); | 426 .RetiresOnSaturation(); |
| 392 if (restore_scissor_test) { | 427 if (restore_scissor_test) { |
| 393 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) | 428 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) |
| 394 .Times(1) | 429 .Times(1) |
| 395 .RetiresOnSaturation(); | 430 .RetiresOnSaturation(); |
| 396 } | 431 } |
| 432 if (target == GL_READ_FRAMEBUFFER_EXT) { |
| 433 EXPECT_CALL(*gl_, BindFramebufferEXT( |
| 434 GL_READ_FRAMEBUFFER_EXT, read_framebuffer_service_id)) |
| 435 .Times(1) |
| 436 .RetiresOnSaturation(); |
| 437 EXPECT_CALL(*gl_, BindFramebufferEXT( |
| 438 GL_DRAW_FRAMEBUFFER_EXT, draw_framebuffer_service_id)) |
| 439 .Times(1) |
| 440 .RetiresOnSaturation(); |
| 441 } |
| 397 } | 442 } |
| 398 | 443 |
| 399 void GLES2DecoderTestBase::SetupShaderForUniform() { | 444 void GLES2DecoderTestBase::SetupShaderForUniform() { |
| 400 static AttribInfo attribs[] = { | 445 static AttribInfo attribs[] = { |
| 401 { "foo", 1, GL_FLOAT, 1, }, | 446 { "foo", 1, GL_FLOAT, 1, }, |
| 402 }; | 447 }; |
| 403 static UniformInfo uniforms[] = { | 448 static UniformInfo uniforms[] = { |
| 404 { "bar", 3, GL_INT, 1, }, | 449 { "bar", 3, GL_INT, 1, }, |
| 405 }; | 450 }; |
| 406 const GLuint kClientVertexShaderId = 5001; | 451 const GLuint kClientVertexShaderId = 5001; |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 num_vertices, buffer_id, GL_NO_ERROR); | 1115 num_vertices, buffer_id, GL_NO_ERROR); |
| 1071 } | 1116 } |
| 1072 | 1117 |
| 1073 void GLES2DecoderWithShaderTestBase::SetUp() { | 1118 void GLES2DecoderWithShaderTestBase::SetUp() { |
| 1074 GLES2DecoderTestBase::SetUp(); | 1119 GLES2DecoderTestBase::SetUp(); |
| 1075 SetupDefaultProgram(); | 1120 SetupDefaultProgram(); |
| 1076 } | 1121 } |
| 1077 | 1122 |
| 1078 } // namespace gles2 | 1123 } // namespace gles2 |
| 1079 } // namespace gpu | 1124 } // namespace gpu |
| OLD | NEW |