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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 kWidth, | 395 kWidth, |
396 kHeight, | 396 kHeight, |
397 GL_RGBA, | 397 GL_RGBA, |
398 GL_UNSIGNED_BYTE, | 398 GL_UNSIGNED_BYTE, |
399 kSharedMemoryId, | 399 kSharedMemoryId, |
400 kInvalidSharedMemoryOffset, | 400 kInvalidSharedMemoryOffset, |
401 GL_FALSE); | 401 GL_FALSE); |
402 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 402 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
403 } | 403 } |
404 | 404 |
| 405 TEST_P(GLES3DecoderTest, TexSubImage2DTypesDoNotMatchUnsizedFormat) { |
| 406 const int kWidth = 16; |
| 407 const int kHeight = 8; |
| 408 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 409 DoTexImage2D(GL_TEXTURE_2D, |
| 410 1, |
| 411 GL_RGBA, |
| 412 kWidth, |
| 413 kHeight, |
| 414 0, |
| 415 GL_RGBA, |
| 416 GL_UNSIGNED_SHORT_4_4_4_4, |
| 417 kSharedMemoryId, |
| 418 kSharedMemoryOffset); |
| 419 EXPECT_CALL(*gl_, |
| 420 TexSubImage2D(GL_TEXTURE_2D, |
| 421 1, |
| 422 1, |
| 423 0, |
| 424 kWidth - 1, |
| 425 kHeight, |
| 426 GL_RGBA, |
| 427 GL_UNSIGNED_BYTE, |
| 428 shared_memory_address_)) |
| 429 .Times(1) |
| 430 .RetiresOnSaturation(); |
| 431 TexSubImage2D cmd; |
| 432 cmd.Init(GL_TEXTURE_2D, |
| 433 1, |
| 434 1, |
| 435 0, |
| 436 kWidth - 1, |
| 437 kHeight, |
| 438 GL_RGBA, |
| 439 GL_UNSIGNED_BYTE, |
| 440 kSharedMemoryId, |
| 441 kSharedMemoryOffset, |
| 442 GL_FALSE); |
| 443 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 444 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 445 } |
| 446 |
| 447 TEST_P(GLES3DecoderTest, TexSubImage2DTypesDoNotMatchSizedFormat) { |
| 448 const int kWidth = 16; |
| 449 const int kHeight = 8; |
| 450 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 451 DoTexImage2D(GL_TEXTURE_2D, |
| 452 1, |
| 453 GL_RGBA4, |
| 454 kWidth, |
| 455 kHeight, |
| 456 0, |
| 457 GL_RGBA, |
| 458 GL_UNSIGNED_BYTE, |
| 459 kSharedMemoryId, |
| 460 kSharedMemoryOffset); |
| 461 EXPECT_CALL(*gl_, |
| 462 TexSubImage2D(GL_TEXTURE_2D, |
| 463 1, |
| 464 1, |
| 465 0, |
| 466 kWidth - 1, |
| 467 kHeight, |
| 468 GL_RGBA, |
| 469 GL_UNSIGNED_SHORT_4_4_4_4, |
| 470 shared_memory_address_)) |
| 471 .Times(1) |
| 472 .RetiresOnSaturation(); |
| 473 TexSubImage2D cmd; |
| 474 cmd.Init(GL_TEXTURE_2D, |
| 475 1, |
| 476 1, |
| 477 0, |
| 478 kWidth - 1, |
| 479 kHeight, |
| 480 GL_RGBA, |
| 481 GL_UNSIGNED_SHORT_4_4_4_4, |
| 482 kSharedMemoryId, |
| 483 kSharedMemoryOffset, |
| 484 GL_FALSE); |
| 485 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 486 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 487 } |
| 488 |
405 TEST_P(GLES2DecoderTest, CopyTexSubImage2DValidArgs) { | 489 TEST_P(GLES2DecoderTest, CopyTexSubImage2DValidArgs) { |
406 const int kWidth = 16; | 490 const int kWidth = 16; |
407 const int kHeight = 8; | 491 const int kHeight = 8; |
408 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 492 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
409 DoTexImage2D(GL_TEXTURE_2D, | 493 DoTexImage2D(GL_TEXTURE_2D, |
410 1, | 494 1, |
411 GL_RGBA, | 495 GL_RGBA, |
412 kWidth, | 496 kWidth, |
413 kHeight, | 497 kHeight, |
414 0, | 498 0, |
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3318 // TODO(gman): CompressedTexSubImage2DImmediate | 3402 // TODO(gman): CompressedTexSubImage2DImmediate |
3319 | 3403 |
3320 // TODO(gman): TexImage2D | 3404 // TODO(gman): TexImage2D |
3321 | 3405 |
3322 // TODO(gman): TexImage2DImmediate | 3406 // TODO(gman): TexImage2DImmediate |
3323 | 3407 |
3324 // TODO(gman): TexSubImage2DImmediate | 3408 // TODO(gman): TexSubImage2DImmediate |
3325 | 3409 |
3326 } // namespace gles2 | 3410 } // namespace gles2 |
3327 } // namespace gpu | 3411 } // namespace gpu |
OLD | NEW |