| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 10 #include "gpu/command_buffer/common/id_allocator.h" | 10 #include "gpu/command_buffer/common/id_allocator.h" |
| (...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 0, 0); | 1815 0, 0); |
| 1816 GenerateMipmap cmd; | 1816 GenerateMipmap cmd; |
| 1817 cmd.Init(GL_TEXTURE_2D); | 1817 cmd.Init(GL_TEXTURE_2D); |
| 1818 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1818 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1819 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1819 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1820 } | 1820 } |
| 1821 | 1821 |
| 1822 TEST_F(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { | 1822 TEST_F(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { |
| 1823 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1823 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1824 TextureManager* manager = group().texture_manager(); | 1824 TextureManager* manager = group().texture_manager(); |
| 1825 Texture* texture = manager->GetTexture(client_texture_id_); | 1825 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); |
| 1826 ASSERT_TRUE(texture != NULL); | 1826 ASSERT_TRUE(texture_ref != NULL); |
| 1827 Texture* texture = texture_ref->texture(); |
| 1827 GLint width = 0; | 1828 GLint width = 0; |
| 1828 GLint height = 0; | 1829 GLint height = 0; |
| 1829 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); | 1830 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); |
| 1830 DoTexImage2D( | 1831 DoTexImage2D( |
| 1831 GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 1832 GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 1832 kSharedMemoryId, kSharedMemoryOffset); | 1833 kSharedMemoryId, kSharedMemoryOffset); |
| 1833 EXPECT_CALL(*gl_, TexParameteri( | 1834 EXPECT_CALL(*gl_, TexParameteri( |
| 1834 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) | 1835 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) |
| 1835 .Times(1) | 1836 .Times(1) |
| 1836 .RetiresOnSaturation(); | 1837 .RetiresOnSaturation(); |
| (...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4719 GLenum target = GL_TEXTURE_2D; | 4720 GLenum target = GL_TEXTURE_2D; |
| 4720 GLint level = 0; | 4721 GLint level = 0; |
| 4721 GLenum internal_format = GL_RGBA; | 4722 GLenum internal_format = GL_RGBA; |
| 4722 GLsizei width = 2; | 4723 GLsizei width = 2; |
| 4723 GLsizei height = 4; | 4724 GLsizei height = 4; |
| 4724 GLint border = 0; | 4725 GLint border = 0; |
| 4725 GLenum format = GL_RGBA; | 4726 GLenum format = GL_RGBA; |
| 4726 GLenum type = GL_UNSIGNED_BYTE; | 4727 GLenum type = GL_UNSIGNED_BYTE; |
| 4727 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 4728 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 4728 TextureManager* manager = group().texture_manager(); | 4729 TextureManager* manager = group().texture_manager(); |
| 4729 Texture* texture = manager->GetTexture(client_texture_id_); | 4730 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); |
| 4730 ASSERT_TRUE(texture != NULL); | 4731 ASSERT_TRUE(texture_ref != NULL); |
| 4732 Texture* texture = texture_ref->texture(); |
| 4731 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); | 4733 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); |
| 4732 EXPECT_CALL(*gl_, GetError()) | 4734 EXPECT_CALL(*gl_, GetError()) |
| 4733 .WillOnce(Return(GL_NO_ERROR)) | 4735 .WillOnce(Return(GL_NO_ERROR)) |
| 4734 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4736 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 4735 .RetiresOnSaturation(); | 4737 .RetiresOnSaturation(); |
| 4736 EXPECT_CALL(*gl_, TexImage2D(target, level, internal_format, | 4738 EXPECT_CALL(*gl_, TexImage2D(target, level, internal_format, |
| 4737 width, height, border, format, type, _)) | 4739 width, height, border, format, type, _)) |
| 4738 .Times(1) | 4740 .Times(1) |
| 4739 .RetiresOnSaturation(); | 4741 .RetiresOnSaturation(); |
| 4740 TexImage2D cmd; | 4742 TexImage2D cmd; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4769 | 4771 |
| 4770 TEST_F(GLES2DecoderTest, CopyTexImage2DGLError) { | 4772 TEST_F(GLES2DecoderTest, CopyTexImage2DGLError) { |
| 4771 GLenum target = GL_TEXTURE_2D; | 4773 GLenum target = GL_TEXTURE_2D; |
| 4772 GLint level = 0; | 4774 GLint level = 0; |
| 4773 GLenum internal_format = GL_RGBA; | 4775 GLenum internal_format = GL_RGBA; |
| 4774 GLsizei width = 2; | 4776 GLsizei width = 2; |
| 4775 GLsizei height = 4; | 4777 GLsizei height = 4; |
| 4776 GLint border = 0; | 4778 GLint border = 0; |
| 4777 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 4779 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 4778 TextureManager* manager = group().texture_manager(); | 4780 TextureManager* manager = group().texture_manager(); |
| 4779 Texture* texture = manager->GetTexture(client_texture_id_); | 4781 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); |
| 4780 ASSERT_TRUE(texture != NULL); | 4782 ASSERT_TRUE(texture_ref != NULL); |
| 4783 Texture* texture = texture_ref->texture(); |
| 4781 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); | 4784 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); |
| 4782 EXPECT_CALL(*gl_, GetError()) | 4785 EXPECT_CALL(*gl_, GetError()) |
| 4783 .WillOnce(Return(GL_NO_ERROR)) | 4786 .WillOnce(Return(GL_NO_ERROR)) |
| 4784 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4787 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 4785 .RetiresOnSaturation(); | 4788 .RetiresOnSaturation(); |
| 4786 EXPECT_CALL(*gl_, CopyTexImage2D( | 4789 EXPECT_CALL(*gl_, CopyTexImage2D( |
| 4787 target, level, internal_format, 0, 0, width, height, border)) | 4790 target, level, internal_format, 0, 0, width, height, border)) |
| 4788 .Times(1) | 4791 .Times(1) |
| 4789 .RetiresOnSaturation(); | 4792 .RetiresOnSaturation(); |
| 4790 CopyTexImage2D cmd; | 4793 CopyTexImage2D cmd; |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5300 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5303 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5301 | 5304 |
| 5302 // Test CompressedTexSubImage not allowed | 5305 // Test CompressedTexSubImage not allowed |
| 5303 CompressedTexSubImage2DBucket sub_cmd; | 5306 CompressedTexSubImage2DBucket sub_cmd; |
| 5304 bucket->SetSize(kBlockSize); | 5307 bucket->SetSize(kBlockSize); |
| 5305 sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, kFormat, kBucketId); | 5308 sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, kFormat, kBucketId); |
| 5306 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); | 5309 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); |
| 5307 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5310 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5308 | 5311 |
| 5309 // Test TexSubImage not allowed for ETC1 compressed texture | 5312 // Test TexSubImage not allowed for ETC1 compressed texture |
| 5310 Texture* texture = GetTexture(client_texture_id_); | 5313 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5311 ASSERT_TRUE(texture != NULL); | 5314 ASSERT_TRUE(texture_ref != NULL); |
| 5315 Texture* texture = texture_ref->texture(); |
| 5312 GLenum type, internal_format; | 5316 GLenum type, internal_format; |
| 5313 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 5317 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 5314 EXPECT_EQ(kFormat, internal_format); | 5318 EXPECT_EQ(kFormat, internal_format); |
| 5315 TexSubImage2D texsub_cmd; | 5319 TexSubImage2D texsub_cmd; |
| 5316 texsub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, | 5320 texsub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5317 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); | 5321 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
| 5318 EXPECT_EQ(error::kNoError, ExecuteCmd(texsub_cmd)); | 5322 EXPECT_EQ(error::kNoError, ExecuteCmd(texsub_cmd)); |
| 5319 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5323 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5320 | 5324 |
| 5321 // Test CopyTexSubImage not allowed for ETC1 compressed texture | 5325 // Test CopyTexSubImage not allowed for ETC1 compressed texture |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 false, // request depth | 5414 false, // request depth |
| 5411 false, // request stencil | 5415 false, // request stencil |
| 5412 true); // bind generates resource | 5416 true); // bind generates resource |
| 5413 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); | 5417 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); |
| 5414 EXPECT_CALL(*gl_, GenTextures(1, _)) | 5418 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 5415 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 5419 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 5416 BindTexture cmd; | 5420 BindTexture cmd; |
| 5417 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); | 5421 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); |
| 5418 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5422 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5419 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5423 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5420 Texture* texture = GetTexture(kNewClientId); | 5424 TextureRef* texture_ref = GetTexture(kNewClientId); |
| 5421 EXPECT_TRUE(texture != NULL); | 5425 EXPECT_TRUE(texture_ref != NULL); |
| 5422 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5426 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5423 } | 5427 } |
| 5424 | 5428 |
| 5425 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { | 5429 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { |
| 5426 InitDecoder( | 5430 InitDecoder( |
| 5427 "GL_OES_EGL_image_external", // extensions | 5431 "GL_OES_EGL_image_external", // extensions |
| 5428 false, // has alpha | 5432 false, // has alpha |
| 5429 false, // has depth | 5433 false, // has depth |
| 5430 false, // has stencil | 5434 false, // has stencil |
| 5431 false, // request alpha | 5435 false, // request alpha |
| 5432 false, // request depth | 5436 false, // request depth |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5460 "GL_OES_EGL_image_external", // extensions | 5464 "GL_OES_EGL_image_external", // extensions |
| 5461 false, // has alpha | 5465 false, // has alpha |
| 5462 false, // has depth | 5466 false, // has depth |
| 5463 false, // has stencil | 5467 false, // has stencil |
| 5464 false, // request alpha | 5468 false, // request alpha |
| 5465 false, // request depth | 5469 false, // request depth |
| 5466 false, // request stencil | 5470 false, // request stencil |
| 5467 true); // bind generates resource | 5471 true); // bind generates resource |
| 5468 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5472 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5469 | 5473 |
| 5470 Texture* texture = GetTexture(client_texture_id_); | 5474 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5471 EXPECT_TRUE(texture != NULL); | 5475 EXPECT_TRUE(texture_ref != NULL); |
| 5476 Texture* texture = texture_ref->texture(); |
| 5472 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5477 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5473 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5478 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5474 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5479 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5475 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5480 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5476 } | 5481 } |
| 5477 | 5482 |
| 5478 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { | 5483 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { |
| 5479 InitDecoder( | 5484 InitDecoder( |
| 5480 "GL_OES_EGL_image_external", // extensions | 5485 "GL_OES_EGL_image_external", // extensions |
| 5481 false, // has alpha | 5486 false, // has alpha |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5518 GL_CLAMP_TO_EDGE); | 5523 GL_CLAMP_TO_EDGE); |
| 5519 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5524 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5520 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5525 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5521 | 5526 |
| 5522 cmd.Init(GL_TEXTURE_EXTERNAL_OES, | 5527 cmd.Init(GL_TEXTURE_EXTERNAL_OES, |
| 5523 GL_TEXTURE_WRAP_T, | 5528 GL_TEXTURE_WRAP_T, |
| 5524 GL_CLAMP_TO_EDGE); | 5529 GL_CLAMP_TO_EDGE); |
| 5525 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5530 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5526 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5531 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5527 | 5532 |
| 5528 Texture* texture = GetTexture(client_texture_id_); | 5533 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5529 EXPECT_TRUE(texture != NULL); | 5534 EXPECT_TRUE(texture_ref != NULL); |
| 5535 Texture* texture = texture_ref->texture(); |
| 5530 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5536 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5531 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5537 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5532 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5538 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5533 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5539 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5534 } | 5540 } |
| 5535 | 5541 |
| 5536 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { | 5542 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { |
| 5537 InitDecoder( | 5543 InitDecoder( |
| 5538 "GL_OES_EGL_image_external", // extensions | 5544 "GL_OES_EGL_image_external", // extensions |
| 5539 false, // has alpha | 5545 false, // has alpha |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5558 GL_REPEAT); | 5564 GL_REPEAT); |
| 5559 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5565 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5560 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5566 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 5561 | 5567 |
| 5562 cmd.Init(GL_TEXTURE_EXTERNAL_OES, | 5568 cmd.Init(GL_TEXTURE_EXTERNAL_OES, |
| 5563 GL_TEXTURE_WRAP_T, | 5569 GL_TEXTURE_WRAP_T, |
| 5564 GL_REPEAT); | 5570 GL_REPEAT); |
| 5565 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5571 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5566 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5572 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 5567 | 5573 |
| 5568 Texture* texture = GetTexture(client_texture_id_); | 5574 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5569 EXPECT_TRUE(texture != NULL); | 5575 EXPECT_TRUE(texture_ref != NULL); |
| 5576 Texture* texture = texture_ref->texture(); |
| 5570 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5577 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5571 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5578 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5572 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5579 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5573 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5580 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5574 } | 5581 } |
| 5575 | 5582 |
| 5576 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { | 5583 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { |
| 5577 InitDecoder( | 5584 InitDecoder( |
| 5578 "GL_OES_EGL_image_external", // extensions | 5585 "GL_OES_EGL_image_external", // extensions |
| 5579 false, // has alpha | 5586 false, // has alpha |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5651 .WillOnce(Return(kObjectId)) | 5658 .WillOnce(Return(kObjectId)) |
| 5652 .RetiresOnSaturation(); | 5659 .RetiresOnSaturation(); |
| 5653 | 5660 |
| 5654 CreateStreamTextureCHROMIUM cmd; | 5661 CreateStreamTextureCHROMIUM cmd; |
| 5655 CreateStreamTextureCHROMIUM::Result* result = | 5662 CreateStreamTextureCHROMIUM::Result* result = |
| 5656 static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_); | 5663 static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_); |
| 5657 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5664 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5658 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5665 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5659 EXPECT_EQ(kObjectId, *result); | 5666 EXPECT_EQ(kObjectId, *result); |
| 5660 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5667 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5661 Texture* texture = GetTexture(client_texture_id_); | 5668 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5662 EXPECT_TRUE(texture != NULL); | 5669 EXPECT_TRUE(texture_ref != NULL); |
| 5663 EXPECT_TRUE(texture->IsStreamTexture()); | 5670 EXPECT_TRUE(texture_ref->texture()->IsStreamTexture()); |
| 5664 } | 5671 } |
| 5665 | 5672 |
| 5666 TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMBadId) { | 5673 TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMBadId) { |
| 5667 InitDecoder( | 5674 InitDecoder( |
| 5668 "GL_CHROMIUM_stream_texture", // extensions | 5675 "GL_CHROMIUM_stream_texture", // extensions |
| 5669 false, // has alpha | 5676 false, // has alpha |
| 5670 false, // has depth | 5677 false, // has depth |
| 5671 false, // has stencil | 5678 false, // has stencil |
| 5672 false, // request alpha | 5679 false, // request alpha |
| 5673 false, // request depth | 5680 false, // request depth |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5708 InitDecoder( | 5715 InitDecoder( |
| 5709 "GL_CHROMIUM_stream_texture", // extensions | 5716 "GL_CHROMIUM_stream_texture", // extensions |
| 5710 false, // has alpha | 5717 false, // has alpha |
| 5711 false, // has depth | 5718 false, // has depth |
| 5712 false, // has stencil | 5719 false, // has stencil |
| 5713 false, // request alpha | 5720 false, // request alpha |
| 5714 false, // request depth | 5721 false, // request depth |
| 5715 false, // request stencil | 5722 false, // request stencil |
| 5716 true); // bind generates resource | 5723 true); // bind generates resource |
| 5717 | 5724 |
| 5718 Texture* texture = GetTexture(client_texture_id_); | 5725 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5719 group().texture_manager()->SetStreamTexture(texture, true); | 5726 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5720 | 5727 |
| 5721 CreateStreamTextureCHROMIUM cmd; | 5728 CreateStreamTextureCHROMIUM cmd; |
| 5722 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5729 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5723 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5730 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5724 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5731 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5725 } | 5732 } |
| 5726 | 5733 |
| 5727 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUM) { | 5734 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUM) { |
| 5728 InitDecoder( | 5735 InitDecoder( |
| 5729 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions | 5736 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions |
| 5730 false, // has alpha | 5737 false, // has alpha |
| 5731 false, // has depth | 5738 false, // has depth |
| 5732 false, // has stencil | 5739 false, // has stencil |
| 5733 false, // request alpha | 5740 false, // request alpha |
| 5734 false, // request depth | 5741 false, // request depth |
| 5735 false, // request stencil | 5742 false, // request stencil |
| 5736 true); // bind generates resource | 5743 true); // bind generates resource |
| 5737 | 5744 |
| 5738 StrictMock<MockStreamTextureManager> manager; | 5745 StrictMock<MockStreamTextureManager> manager; |
| 5739 StrictMock<MockStreamTexture> stream_texture; | 5746 StrictMock<MockStreamTexture> stream_texture; |
| 5740 decoder_->SetStreamTextureManager(&manager); | 5747 decoder_->SetStreamTextureManager(&manager); |
| 5741 | 5748 |
| 5742 Texture* texture = GetTexture(client_texture_id_); | 5749 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5743 group().texture_manager()->SetStreamTexture(texture, true); | 5750 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5744 | 5751 |
| 5745 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId)) | 5752 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId)) |
| 5746 .Times(1) | 5753 .Times(1) |
| 5747 .RetiresOnSaturation(); | 5754 .RetiresOnSaturation(); |
| 5748 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) | 5755 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) |
| 5749 .WillOnce(Return(&stream_texture)) | 5756 .WillOnce(Return(&stream_texture)) |
| 5750 .RetiresOnSaturation(); | 5757 .RetiresOnSaturation(); |
| 5751 EXPECT_CALL(stream_texture, Update()) | 5758 EXPECT_CALL(stream_texture, Update()) |
| 5752 .Times(1) | 5759 .Times(1) |
| 5753 .RetiresOnSaturation(); | 5760 .RetiresOnSaturation(); |
| 5754 | 5761 |
| 5755 BindTexture cmd; | 5762 BindTexture cmd; |
| 5756 cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_); | 5763 cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_); |
| 5757 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5764 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5758 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5765 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5759 } | 5766 } |
| 5760 | 5767 |
| 5761 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUMInvalid) { | 5768 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUMInvalid) { |
| 5762 InitDecoder( | 5769 InitDecoder( |
| 5763 "GL_CHROMIUM_stream_texture", // extensions | 5770 "GL_CHROMIUM_stream_texture", // extensions |
| 5764 false, // has alpha | 5771 false, // has alpha |
| 5765 false, // has depth | 5772 false, // has depth |
| 5766 false, // has stencil | 5773 false, // has stencil |
| 5767 false, // request alpha | 5774 false, // request alpha |
| 5768 false, // request depth | 5775 false, // request depth |
| 5769 false, // request stencil | 5776 false, // request stencil |
| 5770 true); // bind generates resource | 5777 true); // bind generates resource |
| 5771 | 5778 |
| 5772 Texture* texture = GetTexture(client_texture_id_); | 5779 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5773 group().texture_manager()->SetStreamTexture(texture, true); | 5780 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5774 | 5781 |
| 5775 BindTexture cmd; | 5782 BindTexture cmd; |
| 5776 cmd.Init(GL_TEXTURE_2D, client_texture_id_); | 5783 cmd.Init(GL_TEXTURE_2D, client_texture_id_); |
| 5777 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5784 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5778 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5785 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5779 | 5786 |
| 5780 BindTexture cmd2; | 5787 BindTexture cmd2; |
| 5781 cmd2.Init(GL_TEXTURE_CUBE_MAP, client_texture_id_); | 5788 cmd2.Init(GL_TEXTURE_CUBE_MAP, client_texture_id_); |
| 5782 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 5789 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 5783 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5790 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5784 } | 5791 } |
| 5785 | 5792 |
| 5786 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUM) { | 5793 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUM) { |
| 5787 InitDecoder( | 5794 InitDecoder( |
| 5788 "GL_CHROMIUM_stream_texture", // extensions | 5795 "GL_CHROMIUM_stream_texture", // extensions |
| 5789 false, // has alpha | 5796 false, // has alpha |
| 5790 false, // has depth | 5797 false, // has depth |
| 5791 false, // has stencil | 5798 false, // has stencil |
| 5792 false, // request alpha | 5799 false, // request alpha |
| 5793 false, // request depth | 5800 false, // request depth |
| 5794 false, // request stencil | 5801 false, // request stencil |
| 5795 true); // bind generates resource | 5802 true); // bind generates resource |
| 5796 | 5803 |
| 5797 StrictMock<MockStreamTextureManager> manager; | 5804 StrictMock<MockStreamTextureManager> manager; |
| 5798 decoder_->SetStreamTextureManager(&manager); | 5805 decoder_->SetStreamTextureManager(&manager); |
| 5799 | 5806 |
| 5800 Texture* texture = GetTexture(client_texture_id_); | 5807 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5801 group().texture_manager()->SetStreamTexture(texture, true); | 5808 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5802 | 5809 |
| 5803 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) | 5810 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) |
| 5804 .Times(1) | 5811 .Times(1) |
| 5805 .RetiresOnSaturation(); | 5812 .RetiresOnSaturation(); |
| 5806 | 5813 |
| 5807 DestroyStreamTextureCHROMIUM cmd; | 5814 DestroyStreamTextureCHROMIUM cmd; |
| 5808 cmd.Init(client_texture_id_); | 5815 cmd.Init(client_texture_id_); |
| 5809 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5816 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5810 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5817 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5811 EXPECT_FALSE(texture->IsStreamTexture()); | 5818 EXPECT_FALSE(texture_ref->texture()->IsStreamTexture()); |
| 5812 EXPECT_EQ(0U, texture->target()); | 5819 EXPECT_EQ(0U, texture_ref->texture()->target()); |
| 5813 } | 5820 } |
| 5814 | 5821 |
| 5815 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMInvalid) { | 5822 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMInvalid) { |
| 5816 InitDecoder( | 5823 InitDecoder( |
| 5817 "GL_CHROMIUM_stream_texture", // extensions | 5824 "GL_CHROMIUM_stream_texture", // extensions |
| 5818 false, // has alpha | 5825 false, // has alpha |
| 5819 false, // has depth | 5826 false, // has depth |
| 5820 false, // has stencil | 5827 false, // has stencil |
| 5821 false, // request alpha | 5828 false, // request alpha |
| 5822 false, // request depth | 5829 false, // request depth |
| 5823 false, // request stencil | 5830 false, // request stencil |
| 5824 true); // bind generates resource | 5831 true); // bind generates resource |
| 5825 | 5832 |
| 5826 Texture* texture = GetTexture(client_texture_id_); | 5833 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5827 group().texture_manager()->SetStreamTexture(texture, false); | 5834 group().texture_manager()->SetStreamTexture(texture_ref, false); |
| 5828 | 5835 |
| 5829 DestroyStreamTextureCHROMIUM cmd; | 5836 DestroyStreamTextureCHROMIUM cmd; |
| 5830 cmd.Init(client_texture_id_); | 5837 cmd.Init(client_texture_id_); |
| 5831 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5838 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5832 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 5839 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 5833 } | 5840 } |
| 5834 | 5841 |
| 5835 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMBadId) { | 5842 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMBadId) { |
| 5836 InitDecoder( | 5843 InitDecoder( |
| 5837 "GL_CHROMIUM_stream_texture", // extensions | 5844 "GL_CHROMIUM_stream_texture", // extensions |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5858 false, // request alpha | 5865 false, // request alpha |
| 5859 false, // request depth | 5866 false, // request depth |
| 5860 false, // request stencil | 5867 false, // request stencil |
| 5861 true); // bind generates resource | 5868 true); // bind generates resource |
| 5862 | 5869 |
| 5863 CreateStreamTextureCHROMIUM cmd; | 5870 CreateStreamTextureCHROMIUM cmd; |
| 5864 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5871 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5865 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); | 5872 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); |
| 5866 GetGLError(); // ignore internal error | 5873 GetGLError(); // ignore internal error |
| 5867 | 5874 |
| 5868 Texture* texture = GetTexture(client_texture_id_); | 5875 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5869 group().texture_manager()->SetStreamTexture(texture, true); | 5876 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5870 | 5877 |
| 5871 DestroyStreamTextureCHROMIUM cmd2; | 5878 DestroyStreamTextureCHROMIUM cmd2; |
| 5872 cmd2.Init(client_texture_id_); | 5879 cmd2.Init(client_texture_id_); |
| 5873 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2)); | 5880 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2)); |
| 5874 GetGLError(); // ignore internal error | 5881 GetGLError(); // ignore internal error |
| 5875 } | 5882 } |
| 5876 | 5883 |
| 5877 TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) { | 5884 TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) { |
| 5878 const GLuint kObjectId = 123; | 5885 const GLuint kObjectId = 123; |
| 5879 InitDecoder( | 5886 InitDecoder( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5897 .Times(1) | 5904 .Times(1) |
| 5898 .RetiresOnSaturation(); | 5905 .RetiresOnSaturation(); |
| 5899 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) | 5906 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) |
| 5900 .Times(1) | 5907 .Times(1) |
| 5901 .RetiresOnSaturation(); | 5908 .RetiresOnSaturation(); |
| 5902 EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId, | 5909 EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId, |
| 5903 client_texture_id_)) | 5910 client_texture_id_)) |
| 5904 .WillOnce(Return(kObjectId)) | 5911 .WillOnce(Return(kObjectId)) |
| 5905 .RetiresOnSaturation(); | 5912 .RetiresOnSaturation(); |
| 5906 | 5913 |
| 5907 Texture* texture = GetTexture(client_texture_id_); | 5914 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5908 group().texture_manager()->SetStreamTexture(texture, true); | 5915 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5909 | 5916 |
| 5910 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5917 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5911 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5918 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5912 | 5919 |
| 5913 DestroyStreamTextureCHROMIUM cmd; | 5920 DestroyStreamTextureCHROMIUM cmd; |
| 5914 cmd.Init(client_texture_id_); | 5921 cmd.Init(client_texture_id_); |
| 5915 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5922 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5916 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5923 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5917 EXPECT_FALSE(texture->IsStreamTexture()); | 5924 EXPECT_FALSE(texture_ref->texture()->IsStreamTexture()); |
| 5918 | 5925 |
| 5919 CreateStreamTextureCHROMIUM cmd2; | 5926 CreateStreamTextureCHROMIUM cmd2; |
| 5920 cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5927 cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5921 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 5928 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 5922 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5929 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5923 EXPECT_TRUE(texture->IsStreamTexture()); | 5930 EXPECT_TRUE(texture_ref->texture()->IsStreamTexture()); |
| 5924 } | 5931 } |
| 5925 | 5932 |
| 5926 TEST_F(GLES2DecoderManualInitTest, ProduceAndConsumeStreamTextureCHROMIUM) { | 5933 TEST_F(GLES2DecoderManualInitTest, ProduceAndConsumeStreamTextureCHROMIUM) { |
| 5927 InitDecoder( | 5934 InitDecoder( |
| 5928 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions | 5935 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions |
| 5929 false, // has alpha | 5936 false, // has alpha |
| 5930 false, // has depth | 5937 false, // has depth |
| 5931 false, // has stencil | 5938 false, // has stencil |
| 5932 false, // request alpha | 5939 false, // request alpha |
| 5933 false, // request depth | 5940 false, // request depth |
| 5934 false, // request stencil | 5941 false, // request stencil |
| 5935 true); // bind generates resource | 5942 true); // bind generates resource |
| 5936 | 5943 |
| 5937 StrictMock<MockStreamTextureManager> manager; | 5944 StrictMock<MockStreamTextureManager> manager; |
| 5938 StrictMock<MockStreamTexture> stream_texture; | 5945 StrictMock<MockStreamTexture> stream_texture; |
| 5939 decoder_->SetStreamTextureManager(&manager); | 5946 decoder_->SetStreamTextureManager(&manager); |
| 5940 | 5947 |
| 5941 Texture* texture = GetTexture(client_texture_id_); | 5948 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5942 group().texture_manager()->SetStreamTexture(texture, true); | 5949 group().texture_manager()->SetStreamTexture(texture_ref, true); |
| 5943 | 5950 |
| 5944 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId)) | 5951 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId)) |
| 5945 .Times(1) | 5952 .Times(1) |
| 5946 .RetiresOnSaturation(); | 5953 .RetiresOnSaturation(); |
| 5947 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) | 5954 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) |
| 5948 .WillOnce(Return(&stream_texture)) | 5955 .WillOnce(Return(&stream_texture)) |
| 5949 .RetiresOnSaturation(); | 5956 .RetiresOnSaturation(); |
| 5950 EXPECT_CALL(stream_texture, Update()) | 5957 EXPECT_CALL(stream_texture, Update()) |
| 5951 .Times(1) | 5958 .Times(1) |
| 5952 .RetiresOnSaturation(); | 5959 .RetiresOnSaturation(); |
| 5953 | 5960 |
| 5954 BindTexture cmd; | 5961 BindTexture cmd; |
| 5955 cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_); | 5962 cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_); |
| 5956 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5963 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5957 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5964 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5958 | 5965 |
| 5959 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | 5966 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; |
| 5960 group().mailbox_manager()->GenerateMailboxName( | 5967 group().mailbox_manager()->GenerateMailboxName( |
| 5961 reinterpret_cast<MailboxName*>(mailbox)); | 5968 reinterpret_cast<MailboxName*>(mailbox)); |
| 5962 | 5969 |
| 5963 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); | 5970 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); |
| 5964 | 5971 |
| 5965 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 5972 EXPECT_EQ(kServiceTextureId, texture_ref->service_id()); |
| 5966 | 5973 |
| 5967 // Assigns and binds new service side texture ID. | 5974 // Assigns and binds new service side texture ID. |
| 5968 EXPECT_CALL(*gl_, GenTextures(1, _)) | 5975 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 5969 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 5976 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
| 5970 .RetiresOnSaturation(); | 5977 .RetiresOnSaturation(); |
| 5971 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)) | 5978 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)) |
| 5972 .Times(1) | 5979 .Times(1) |
| 5973 .RetiresOnSaturation(); | 5980 .RetiresOnSaturation(); |
| 5974 | 5981 |
| 5975 ProduceTextureCHROMIUM produce_cmd; | 5982 ProduceTextureCHROMIUM produce_cmd; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6012 | 6019 |
| 6013 // Shared mem got clobbered from GetError() above. | 6020 // Shared mem got clobbered from GetError() above. |
| 6014 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); | 6021 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); |
| 6015 ConsumeTextureCHROMIUM consume_cmd; | 6022 ConsumeTextureCHROMIUM consume_cmd; |
| 6016 consume_cmd.Init( | 6023 consume_cmd.Init( |
| 6017 GL_TEXTURE_EXTERNAL_OES, kSharedMemoryId, kSharedMemoryOffset); | 6024 GL_TEXTURE_EXTERNAL_OES, kSharedMemoryId, kSharedMemoryOffset); |
| 6018 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); | 6025 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); |
| 6019 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6026 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6020 | 6027 |
| 6021 // Service ID is restored. | 6028 // Service ID is restored. |
| 6022 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 6029 EXPECT_EQ(kServiceTextureId, texture_ref->service_id()); |
| 6023 } | 6030 } |
| 6024 | 6031 |
| 6025 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { | 6032 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { |
| 6026 InitDecoder( | 6033 InitDecoder( |
| 6027 "GL_ARB_texture_rectangle", // extensions | 6034 "GL_ARB_texture_rectangle", // extensions |
| 6028 false, // has alpha | 6035 false, // has alpha |
| 6029 false, // has depth | 6036 false, // has depth |
| 6030 false, // has stencil | 6037 false, // has stencil |
| 6031 false, // request alpha | 6038 false, // request alpha |
| 6032 false, // request depth | 6039 false, // request depth |
| 6033 false, // request stencil | 6040 false, // request stencil |
| 6034 true); // bind generates resource | 6041 true); // bind generates resource |
| 6035 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); | 6042 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); |
| 6036 EXPECT_CALL(*gl_, GenTextures(1, _)) | 6043 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 6037 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 6044 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 6038 BindTexture cmd; | 6045 BindTexture cmd; |
| 6039 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); | 6046 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); |
| 6040 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6047 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6041 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6048 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6042 Texture* texture = GetTexture(kNewClientId); | 6049 Texture* texture = GetTexture(kNewClientId)->texture(); |
| 6043 EXPECT_TRUE(texture != NULL); | 6050 EXPECT_TRUE(texture != NULL); |
| 6044 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 6051 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6045 } | 6052 } |
| 6046 | 6053 |
| 6047 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { | 6054 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { |
| 6048 InitDecoder( | 6055 InitDecoder( |
| 6049 "GL_ARB_texture_rectangle", // extensions | 6056 "GL_ARB_texture_rectangle", // extensions |
| 6050 false, // has alpha | 6057 false, // has alpha |
| 6051 false, // has depth | 6058 false, // has depth |
| 6052 false, // has stencil | 6059 false, // has stencil |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6084 false, // has alpha | 6091 false, // has alpha |
| 6085 false, // has depth | 6092 false, // has depth |
| 6086 false, // has stencil | 6093 false, // has stencil |
| 6087 false, // request alpha | 6094 false, // request alpha |
| 6088 false, // request depth | 6095 false, // request depth |
| 6089 false, // request stencil | 6096 false, // request stencil |
| 6090 true); // bind generates resource | 6097 true); // bind generates resource |
| 6091 DoBindTexture( | 6098 DoBindTexture( |
| 6092 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); | 6099 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); |
| 6093 | 6100 |
| 6094 Texture* texture = GetTexture(client_texture_id_); | 6101 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 6095 EXPECT_TRUE(texture != NULL); | 6102 EXPECT_TRUE(texture != NULL); |
| 6096 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 6103 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6097 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 6104 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 6098 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 6105 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 6099 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 6106 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 6100 } | 6107 } |
| 6101 | 6108 |
| 6102 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { | 6109 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { |
| 6103 InitDecoder( | 6110 InitDecoder( |
| 6104 "GL_ARB_texture_rectangle", // extensions | 6111 "GL_ARB_texture_rectangle", // extensions |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6143 GL_CLAMP_TO_EDGE); | 6150 GL_CLAMP_TO_EDGE); |
| 6144 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6151 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6145 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6152 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6146 | 6153 |
| 6147 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, | 6154 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, |
| 6148 GL_TEXTURE_WRAP_T, | 6155 GL_TEXTURE_WRAP_T, |
| 6149 GL_CLAMP_TO_EDGE); | 6156 GL_CLAMP_TO_EDGE); |
| 6150 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6157 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6151 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6158 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6152 | 6159 |
| 6153 Texture* texture = GetTexture(client_texture_id_); | 6160 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 6154 EXPECT_TRUE(texture != NULL); | 6161 EXPECT_TRUE(texture != NULL); |
| 6155 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 6162 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6156 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 6163 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 6157 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 6164 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 6158 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 6165 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 6159 } | 6166 } |
| 6160 | 6167 |
| 6161 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { | 6168 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { |
| 6162 InitDecoder( | 6169 InitDecoder( |
| 6163 "GL_ARB_texture_rectangle", // extensions | 6170 "GL_ARB_texture_rectangle", // extensions |
| (...skipping 20 matching lines...) Expand all Loading... |
| 6184 GL_REPEAT); | 6191 GL_REPEAT); |
| 6185 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6192 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6186 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 6193 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 6187 | 6194 |
| 6188 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, | 6195 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, |
| 6189 GL_TEXTURE_WRAP_T, | 6196 GL_TEXTURE_WRAP_T, |
| 6190 GL_REPEAT); | 6197 GL_REPEAT); |
| 6191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6198 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6192 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 6199 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 6193 | 6200 |
| 6194 Texture* texture = GetTexture(client_texture_id_); | 6201 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 6195 EXPECT_TRUE(texture != NULL); | 6202 EXPECT_TRUE(texture != NULL); |
| 6196 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 6203 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6197 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 6204 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 6198 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 6205 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 6199 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 6206 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 6200 } | 6207 } |
| 6201 | 6208 |
| 6202 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { | 6209 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { |
| 6203 InitDecoder( | 6210 InitDecoder( |
| 6204 "GL_ARB_texture_rectangle", // extensions | 6211 "GL_ARB_texture_rectangle", // extensions |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6515 DrawArrays cmd; | 6522 DrawArrays cmd; |
| 6516 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 6523 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 6517 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6524 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6518 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); | 6525 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); |
| 6519 } | 6526 } |
| 6520 | 6527 |
| 6521 TEST_F(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) { | 6528 TEST_F(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) { |
| 6522 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 6529 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 6523 | 6530 |
| 6524 TextureManager* manager = group().texture_manager(); | 6531 TextureManager* manager = group().texture_manager(); |
| 6525 Texture* texture = manager->GetTexture(client_texture_id_); | 6532 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); |
| 6533 ASSERT_TRUE(texture_ref != NULL); |
| 6534 Texture* texture = texture_ref->texture(); |
| 6526 | 6535 |
| 6527 EXPECT_CALL(*gl_, GetError()) | 6536 EXPECT_CALL(*gl_, GetError()) |
| 6528 .WillOnce(Return(GL_NO_ERROR)) | 6537 .WillOnce(Return(GL_NO_ERROR)) |
| 6529 .RetiresOnSaturation(); | 6538 .RetiresOnSaturation(); |
| 6530 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0)) | 6539 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0)) |
| 6531 .Times(1) | 6540 .Times(1) |
| 6532 .RetiresOnSaturation(); | 6541 .RetiresOnSaturation(); |
| 6533 EXPECT_CALL(*gl_, GetError()) | 6542 EXPECT_CALL(*gl_, GetError()) |
| 6534 .WillOnce(Return(GL_NO_ERROR)) | 6543 .WillOnce(Return(GL_NO_ERROR)) |
| 6535 .RetiresOnSaturation(); | 6544 .RetiresOnSaturation(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6576 .Times(1) | 6585 .Times(1) |
| 6577 .RetiresOnSaturation(); | 6586 .RetiresOnSaturation(); |
| 6578 EXPECT_CALL(*gl_, GetError()) | 6587 EXPECT_CALL(*gl_, GetError()) |
| 6579 .WillOnce(Return(GL_NO_ERROR)) | 6588 .WillOnce(Return(GL_NO_ERROR)) |
| 6580 .RetiresOnSaturation(); | 6589 .RetiresOnSaturation(); |
| 6581 CompressedTexImage2D cmd; | 6590 CompressedTexImage2D cmd; |
| 6582 cmd.Init(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, | 6591 cmd.Init(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, |
| 6583 8, kSharedMemoryId, kSharedMemoryOffset); | 6592 8, kSharedMemoryId, kSharedMemoryOffset); |
| 6584 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6593 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6585 TextureManager* manager = group().texture_manager(); | 6594 TextureManager* manager = group().texture_manager(); |
| 6586 Texture* texture = manager->GetTexture(client_texture_id_); | 6595 TextureRef* texture_ref = manager->GetTexture(client_texture_id_); |
| 6587 EXPECT_TRUE(texture->SafeToRenderFrom()); | 6596 EXPECT_TRUE(texture_ref->texture()->SafeToRenderFrom()); |
| 6588 } | 6597 } |
| 6589 | 6598 |
| 6590 TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnClear) { | 6599 TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnClear) { |
| 6591 const GLuint kFBOClientTextureId = 4100; | 6600 const GLuint kFBOClientTextureId = 4100; |
| 6592 const GLuint kFBOServiceTextureId = 4101; | 6601 const GLuint kFBOServiceTextureId = 4101; |
| 6593 | 6602 |
| 6594 // Register a texture id. | 6603 // Register a texture id. |
| 6595 EXPECT_CALL(*gl_, GenTextures(_, _)) | 6604 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 6596 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 6605 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 6597 .RetiresOnSaturation(); | 6606 .RetiresOnSaturation(); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7383 group().mailbox_manager()->GenerateMailboxName( | 7392 group().mailbox_manager()->GenerateMailboxName( |
| 7384 reinterpret_cast<MailboxName*>(mailbox)); | 7393 reinterpret_cast<MailboxName*>(mailbox)); |
| 7385 | 7394 |
| 7386 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); | 7395 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); |
| 7387 | 7396 |
| 7388 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7397 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7389 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7398 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7390 0, 0); | 7399 0, 0); |
| 7391 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7400 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7392 0, 0); | 7401 0, 0); |
| 7393 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); | 7402 TextureRef* texture_ref = group().texture_manager()->GetTexture( |
| 7403 client_texture_id_); |
| 7404 ASSERT_TRUE(texture_ref != NULL); |
| 7405 Texture* texture = texture_ref->texture(); |
| 7394 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 7406 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 7395 | 7407 |
| 7396 // Assigns and binds new service side texture ID. | 7408 // Assigns and binds new service side texture ID. |
| 7397 EXPECT_CALL(*gl_, GenTextures(1, _)) | 7409 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 7398 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 7410 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
| 7399 .RetiresOnSaturation(); | 7411 .RetiresOnSaturation(); |
| 7400 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) | 7412 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) |
| 7401 .Times(1) | 7413 .Times(1) |
| 7402 .RetiresOnSaturation(); | 7414 .RetiresOnSaturation(); |
| 7403 | 7415 |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7985 } | 7997 } |
| 7986 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, | 7998 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 7987 BindVertexArrayOESValidArgsNewId) { | 7999 BindVertexArrayOESValidArgsNewId) { |
| 7988 BindVertexArrayOESValidArgsNewId(); | 8000 BindVertexArrayOESValidArgsNewId(); |
| 7989 } | 8001 } |
| 7990 | 8002 |
| 7991 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUM) { | 8003 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUM) { |
| 7992 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8004 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7993 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 8005 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7994 0, 0); | 8006 0, 0); |
| 7995 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); | 8007 TextureRef* texture_ref = group().texture_manager()->GetTexture( |
| 8008 client_texture_id_); |
| 8009 ASSERT_TRUE(texture_ref != NULL); |
| 8010 Texture* texture = texture_ref->texture(); |
| 7996 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 8011 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 7997 | 8012 |
| 7998 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); | 8013 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); |
| 7999 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); | 8014 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); |
| 8000 | 8015 |
| 8001 GLsizei width; | 8016 GLsizei width; |
| 8002 GLsizei height; | 8017 GLsizei height; |
| 8003 GLenum type; | 8018 GLenum type; |
| 8004 GLenum internal_format; | 8019 GLenum internal_format; |
| 8005 | 8020 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 8029 0, 0); | 8044 0, 0); |
| 8030 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 8045 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 8031 // Image should no longer be set. | 8046 // Image should no longer be set. |
| 8032 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 8047 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 8033 } | 8048 } |
| 8034 | 8049 |
| 8035 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { | 8050 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { |
| 8036 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8051 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8037 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 8052 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 8038 0, 0); | 8053 0, 0); |
| 8039 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); | 8054 TextureRef* texture_ref = group().texture_manager()->GetTexture( |
| 8055 client_texture_id_); |
| 8056 ASSERT_TRUE(texture_ref != NULL); |
| 8057 Texture* texture = texture_ref->texture(); |
| 8040 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 8058 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 8041 | 8059 |
| 8042 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); | 8060 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); |
| 8043 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); | 8061 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); |
| 8044 | 8062 |
| 8045 GLsizei width; | 8063 GLsizei width; |
| 8046 GLsizei height; | 8064 GLsizei height; |
| 8047 GLenum type; | 8065 GLenum type; |
| 8048 GLenum internal_format; | 8066 GLenum internal_format; |
| 8049 | 8067 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8086 InitDecoder( | 8104 InitDecoder( |
| 8087 "GL_ARB_texture_rectangle", // extensions | 8105 "GL_ARB_texture_rectangle", // extensions |
| 8088 false, // has alpha | 8106 false, // has alpha |
| 8089 false, // has depth | 8107 false, // has depth |
| 8090 false, // has stencil | 8108 false, // has stencil |
| 8091 false, // request alpha | 8109 false, // request alpha |
| 8092 false, // request depth | 8110 false, // request depth |
| 8093 false, // request stencil | 8111 false, // request stencil |
| 8094 true); // bind generates resource | 8112 true); // bind generates resource |
| 8095 | 8113 |
| 8096 Texture* texture = GetTexture(client_texture_id_); | 8114 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 8097 EXPECT_TRUE(texture != NULL); | 8115 EXPECT_TRUE(texture != NULL); |
| 8098 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); | 8116 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); |
| 8099 | 8117 |
| 8100 DoBindTexture( | 8118 DoBindTexture( |
| 8101 GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8119 GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8102 | 8120 |
| 8103 TexParameteri cmd; | 8121 TexParameteri cmd; |
| 8104 cmd.Init(GL_TEXTURE_2D, | 8122 cmd.Init(GL_TEXTURE_2D, |
| 8105 GL_TEXTURE_POOL_CHROMIUM, | 8123 GL_TEXTURE_POOL_CHROMIUM, |
| 8106 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); | 8124 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 8124 | 8142 |
| 8125 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) { | 8143 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) { |
| 8126 InitDecoder( | 8144 InitDecoder( |
| 8127 "GL_CHROMIUM_async_pixel_transfers", // extensions | 8145 "GL_CHROMIUM_async_pixel_transfers", // extensions |
| 8128 false, false, false, // has alpha/depth/stencil | 8146 false, false, false, // has alpha/depth/stencil |
| 8129 false, false, false, // request alpha/depth/stencil | 8147 false, false, false, // request alpha/depth/stencil |
| 8130 true); // bind generates resource | 8148 true); // bind generates resource |
| 8131 | 8149 |
| 8132 // Set up the texture. | 8150 // Set up the texture. |
| 8133 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8151 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8134 Texture* texture = GetTexture(client_texture_id_); | 8152 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 8153 Texture* texture = texture_ref->texture(); |
| 8135 | 8154 |
| 8136 // Set a mock Async delegate | 8155 // Set a mock Async delegate |
| 8137 StrictMock<gpu::MockAsyncPixelTransferDelegate>* delegate = | 8156 StrictMock<gpu::MockAsyncPixelTransferDelegate>* delegate = |
| 8138 new StrictMock<gpu::MockAsyncPixelTransferDelegate>; | 8157 new StrictMock<gpu::MockAsyncPixelTransferDelegate>; |
| 8139 decoder_->SetAsyncPixelTransferDelegate(delegate); | 8158 decoder_->SetAsyncPixelTransferDelegate(delegate); |
| 8140 StrictMock<gpu::MockAsyncPixelTransferState>* state = NULL; | 8159 StrictMock<gpu::MockAsyncPixelTransferState>* state = NULL; |
| 8141 | 8160 |
| 8142 // Tex(Sub)Image2D upload commands. | 8161 // Tex(Sub)Image2D upload commands. |
| 8143 AsyncTexImage2DCHROMIUM teximage_cmd; | 8162 AsyncTexImage2DCHROMIUM teximage_cmd; |
| 8144 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, | 8163 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8196 // After the bind callback is run, the texture is safe, | 8215 // After the bind callback is run, the texture is safe, |
| 8197 // and has the right size etc. | 8216 // and has the right size etc. |
| 8198 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8217 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8199 GLsizei width, height; | 8218 GLsizei width, height; |
| 8200 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 8219 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 8201 EXPECT_EQ(width, 8); | 8220 EXPECT_EQ(width, 8); |
| 8202 EXPECT_EQ(height, 8); | 8221 EXPECT_EQ(height, 8); |
| 8203 } | 8222 } |
| 8204 | 8223 |
| 8205 // AsyncTexSubImage2D | 8224 // AsyncTexSubImage2D |
| 8206 texture->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); | 8225 texture_ref->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); |
| 8207 texture->SetImmutable(false); | 8226 texture->SetImmutable(false); |
| 8208 { | 8227 { |
| 8209 // Create transfer state since it doesn't exist. | 8228 // Create transfer state since it doesn't exist. |
| 8210 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) | 8229 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) |
| 8211 .WillOnce(Return( | 8230 .WillOnce(Return( |
| 8212 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) | 8231 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) |
| 8213 .RetiresOnSaturation(); | 8232 .RetiresOnSaturation(); |
| 8214 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) | 8233 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) |
| 8215 .RetiresOnSaturation(); | 8234 .RetiresOnSaturation(); |
| 8216 // Command succeeds. | 8235 // Command succeeds. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 8247 EXPECT_TRUE(texture->IsImmutable()); | 8266 EXPECT_TRUE(texture->IsImmutable()); |
| 8248 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8267 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8249 } | 8268 } |
| 8250 | 8269 |
| 8251 // WaitAsyncTexImage2D | 8270 // WaitAsyncTexImage2D |
| 8252 { | 8271 { |
| 8253 // Get a fresh texture since the existing texture cannot be respecified | 8272 // Get a fresh texture since the existing texture cannot be respecified |
| 8254 // asynchronously and AsyncTexSubImage2D does not involved binding. | 8273 // asynchronously and AsyncTexSubImage2D does not involved binding. |
| 8255 EXPECT_CALL(*gl_, GenTextures(1, _)) | 8274 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 8256 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); | 8275 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); |
| 8257 texture->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); | 8276 texture_ref->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); |
| 8258 DoDeleteTexture(client_texture_id_, kServiceTextureId); | 8277 DoDeleteTexture(client_texture_id_, kServiceTextureId); |
| 8259 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8278 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8260 texture = GetTexture(client_texture_id_); | 8279 texture_ref = GetTexture(client_texture_id_); |
| 8261 texture->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); | 8280 texture = texture_ref->texture(); |
| 8281 texture_ref->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); |
| 8262 texture->SetImmutable(false); | 8282 texture->SetImmutable(false); |
| 8263 // Create transfer state since it doesn't exist. | 8283 // Create transfer state since it doesn't exist. |
| 8264 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) | 8284 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) |
| 8265 .WillOnce(Return( | 8285 .WillOnce(Return( |
| 8266 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) | 8286 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) |
| 8267 .RetiresOnSaturation(); | 8287 .RetiresOnSaturation(); |
| 8268 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _, _)) | 8288 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _, _)) |
| 8269 .RetiresOnSaturation(); | 8289 .RetiresOnSaturation(); |
| 8270 // Start async transfer. | 8290 // Start async transfer. |
| 8271 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8291 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
| 8272 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8292 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8273 EXPECT_TRUE(texture->GetAsyncTransferState()); | 8293 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8274 EXPECT_TRUE(texture->IsImmutable()); | 8294 EXPECT_TRUE(texture->IsImmutable()); |
| 8275 // Wait for completion. | 8295 // Wait for completion. |
| 8276 EXPECT_CALL(*delegate, WaitForTransferCompletion(state)); | 8296 EXPECT_CALL(*delegate, WaitForTransferCompletion(state)); |
| 8277 EXPECT_CALL(*delegate, BindCompletedAsyncTransfers()); | 8297 EXPECT_CALL(*delegate, BindCompletedAsyncTransfers()); |
| 8278 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); | 8298 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); |
| 8279 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8299 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8280 } | 8300 } |
| 8281 | 8301 |
| 8282 decoder_->SetAsyncPixelTransferDelegate(NULL); | 8302 decoder_->SetAsyncPixelTransferDelegate(NULL); |
| 8283 texture->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); | 8303 texture_ref->SetAsyncTransferState(scoped_ptr<AsyncPixelTransferState>()); |
| 8284 } | 8304 } |
| 8285 | 8305 |
| 8286 namespace { | 8306 namespace { |
| 8287 | 8307 |
| 8288 class SizeOnlyMemoryTracker : public MemoryTracker { | 8308 class SizeOnlyMemoryTracker : public MemoryTracker { |
| 8289 public: | 8309 public: |
| 8290 SizeOnlyMemoryTracker() { | 8310 SizeOnlyMemoryTracker() { |
| 8291 // These are the default textures. 1 for TEXTURE_2D and 6 faces for | 8311 // These are the default textures. 1 for TEXTURE_2D and 6 faces for |
| 8292 // TEXTURE_CUBE_MAP. | 8312 // TEXTURE_CUBE_MAP. |
| 8293 const size_t kInitialUnmanagedPoolSize = 7 * 4; | 8313 const size_t kInitialUnmanagedPoolSize = 7 * 4; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8621 // TODO(gman): TexImage2DImmediate | 8641 // TODO(gman): TexImage2DImmediate |
| 8622 | 8642 |
| 8623 // TODO(gman): TexSubImage2DImmediate | 8643 // TODO(gman): TexSubImage2DImmediate |
| 8624 | 8644 |
| 8625 // TODO(gman): UseProgram | 8645 // TODO(gman): UseProgram |
| 8626 | 8646 |
| 8627 // TODO(gman): SwapBuffers | 8647 // TODO(gman): SwapBuffers |
| 8628 | 8648 |
| 8629 } // namespace gles2 | 8649 } // namespace gles2 |
| 8630 } // namespace gpu | 8650 } // namespace gpu |
| OLD | NEW |