| 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 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 0, 0); | 1814 0, 0); |
| 1815 GenerateMipmap cmd; | 1815 GenerateMipmap cmd; |
| 1816 cmd.Init(GL_TEXTURE_2D); | 1816 cmd.Init(GL_TEXTURE_2D); |
| 1817 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1817 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1818 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1818 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1819 } | 1819 } |
| 1820 | 1820 |
| 1821 TEST_F(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { | 1821 TEST_F(GLES2DecoderTest, GenerateMipmapHandlesOutOfMemory) { |
| 1822 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1822 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1823 TextureManager* manager = group().texture_manager(); | 1823 TextureManager* manager = group().texture_manager(); |
| 1824 Texture* info = | 1824 Texture* texture = manager->GetTexture(client_texture_id_); |
| 1825 manager->GetTexture(client_texture_id_); | 1825 ASSERT_TRUE(texture != NULL); |
| 1826 ASSERT_TRUE(info != NULL); | |
| 1827 GLint width = 0; | 1826 GLint width = 0; |
| 1828 GLint height = 0; | 1827 GLint height = 0; |
| 1829 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); | 1828 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); |
| 1830 DoTexImage2D( | 1829 DoTexImage2D( |
| 1831 GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 1830 GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 1832 kSharedMemoryId, kSharedMemoryOffset); | 1831 kSharedMemoryId, kSharedMemoryOffset); |
| 1833 EXPECT_CALL(*gl_, TexParameteri( | 1832 EXPECT_CALL(*gl_, TexParameteri( |
| 1834 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) | 1833 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) |
| 1835 .Times(1) | 1834 .Times(1) |
| 1836 .RetiresOnSaturation(); | 1835 .RetiresOnSaturation(); |
| 1837 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D)) | 1836 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D)) |
| 1838 .Times(1); | 1837 .Times(1); |
| 1839 EXPECT_CALL(*gl_, TexParameteri( | 1838 EXPECT_CALL(*gl_, TexParameteri( |
| 1840 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) | 1839 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) |
| 1841 .Times(1) | 1840 .Times(1) |
| 1842 .RetiresOnSaturation(); | 1841 .RetiresOnSaturation(); |
| 1843 EXPECT_CALL(*gl_, GetError()) | 1842 EXPECT_CALL(*gl_, GetError()) |
| 1844 .WillOnce(Return(GL_NO_ERROR)) | 1843 .WillOnce(Return(GL_NO_ERROR)) |
| 1845 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 1844 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 1846 .RetiresOnSaturation(); | 1845 .RetiresOnSaturation(); |
| 1847 GenerateMipmap cmd; | 1846 GenerateMipmap cmd; |
| 1848 cmd.Init(GL_TEXTURE_2D); | 1847 cmd.Init(GL_TEXTURE_2D); |
| 1849 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1848 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1850 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1849 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 1851 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); | 1850 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); |
| 1852 } | 1851 } |
| 1853 | 1852 |
| 1854 TEST_F(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) { | 1853 TEST_F(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) { |
| 1855 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) | 1854 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) |
| 1856 .Times(0); | 1855 .Times(0); |
| 1857 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1856 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1858 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 1857 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 1859 0, 0); | 1858 0, 0); |
| 1860 SetupClearTextureExpections( | 1859 SetupClearTextureExpections( |
| 1861 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, | 1860 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, |
| (...skipping 2857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4719 GLenum target = GL_TEXTURE_2D; | 4718 GLenum target = GL_TEXTURE_2D; |
| 4720 GLint level = 0; | 4719 GLint level = 0; |
| 4721 GLenum internal_format = GL_RGBA; | 4720 GLenum internal_format = GL_RGBA; |
| 4722 GLsizei width = 2; | 4721 GLsizei width = 2; |
| 4723 GLsizei height = 4; | 4722 GLsizei height = 4; |
| 4724 GLint border = 0; | 4723 GLint border = 0; |
| 4725 GLenum format = GL_RGBA; | 4724 GLenum format = GL_RGBA; |
| 4726 GLenum type = GL_UNSIGNED_BYTE; | 4725 GLenum type = GL_UNSIGNED_BYTE; |
| 4727 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 4726 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 4728 TextureManager* manager = group().texture_manager(); | 4727 TextureManager* manager = group().texture_manager(); |
| 4729 Texture* info = | 4728 Texture* texture = manager->GetTexture(client_texture_id_); |
| 4730 manager->GetTexture(client_texture_id_); | 4729 ASSERT_TRUE(texture != NULL); |
| 4731 ASSERT_TRUE(info != NULL); | 4730 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); |
| 4732 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); | |
| 4733 EXPECT_CALL(*gl_, GetError()) | 4731 EXPECT_CALL(*gl_, GetError()) |
| 4734 .WillOnce(Return(GL_NO_ERROR)) | 4732 .WillOnce(Return(GL_NO_ERROR)) |
| 4735 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4733 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 4736 .RetiresOnSaturation(); | 4734 .RetiresOnSaturation(); |
| 4737 EXPECT_CALL(*gl_, TexImage2D(target, level, internal_format, | 4735 EXPECT_CALL(*gl_, TexImage2D(target, level, internal_format, |
| 4738 width, height, border, format, type, _)) | 4736 width, height, border, format, type, _)) |
| 4739 .Times(1) | 4737 .Times(1) |
| 4740 .RetiresOnSaturation(); | 4738 .RetiresOnSaturation(); |
| 4741 TexImage2D cmd; | 4739 TexImage2D cmd; |
| 4742 cmd.Init(target, level, internal_format, width, height, border, format, | 4740 cmd.Init(target, level, internal_format, width, height, border, format, |
| 4743 type, kSharedMemoryId, kSharedMemoryOffset); | 4741 type, kSharedMemoryId, kSharedMemoryOffset); |
| 4744 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4742 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4745 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 4743 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 4746 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); | 4744 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); |
| 4747 } | 4745 } |
| 4748 | 4746 |
| 4749 TEST_F(GLES2DecoderTest, BufferDataGLError) { | 4747 TEST_F(GLES2DecoderTest, BufferDataGLError) { |
| 4750 GLenum target = GL_ARRAY_BUFFER; | 4748 GLenum target = GL_ARRAY_BUFFER; |
| 4751 GLsizeiptr size = 4; | 4749 GLsizeiptr size = 4; |
| 4752 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); | 4750 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); |
| 4753 BufferManager* manager = group().buffer_manager(); | 4751 BufferManager* manager = group().buffer_manager(); |
| 4754 Buffer* buffer = manager->GetBuffer(client_buffer_id_); | 4752 Buffer* buffer = manager->GetBuffer(client_buffer_id_); |
| 4755 ASSERT_TRUE(buffer != NULL); | 4753 ASSERT_TRUE(buffer != NULL); |
| 4756 EXPECT_EQ(0, buffer->size()); | 4754 EXPECT_EQ(0, buffer->size()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4770 | 4768 |
| 4771 TEST_F(GLES2DecoderTest, CopyTexImage2DGLError) { | 4769 TEST_F(GLES2DecoderTest, CopyTexImage2DGLError) { |
| 4772 GLenum target = GL_TEXTURE_2D; | 4770 GLenum target = GL_TEXTURE_2D; |
| 4773 GLint level = 0; | 4771 GLint level = 0; |
| 4774 GLenum internal_format = GL_RGBA; | 4772 GLenum internal_format = GL_RGBA; |
| 4775 GLsizei width = 2; | 4773 GLsizei width = 2; |
| 4776 GLsizei height = 4; | 4774 GLsizei height = 4; |
| 4777 GLint border = 0; | 4775 GLint border = 0; |
| 4778 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 4776 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 4779 TextureManager* manager = group().texture_manager(); | 4777 TextureManager* manager = group().texture_manager(); |
| 4780 Texture* info = | 4778 Texture* texture = manager->GetTexture(client_texture_id_); |
| 4781 manager->GetTexture(client_texture_id_); | 4779 ASSERT_TRUE(texture != NULL); |
| 4782 ASSERT_TRUE(info != NULL); | 4780 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); |
| 4783 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); | |
| 4784 EXPECT_CALL(*gl_, GetError()) | 4781 EXPECT_CALL(*gl_, GetError()) |
| 4785 .WillOnce(Return(GL_NO_ERROR)) | 4782 .WillOnce(Return(GL_NO_ERROR)) |
| 4786 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4783 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 4787 .RetiresOnSaturation(); | 4784 .RetiresOnSaturation(); |
| 4788 EXPECT_CALL(*gl_, CopyTexImage2D( | 4785 EXPECT_CALL(*gl_, CopyTexImage2D( |
| 4789 target, level, internal_format, 0, 0, width, height, border)) | 4786 target, level, internal_format, 0, 0, width, height, border)) |
| 4790 .Times(1) | 4787 .Times(1) |
| 4791 .RetiresOnSaturation(); | 4788 .RetiresOnSaturation(); |
| 4792 CopyTexImage2D cmd; | 4789 CopyTexImage2D cmd; |
| 4793 cmd.Init(target, level, internal_format, 0, 0, width, height, border); | 4790 cmd.Init(target, level, internal_format, 0, 0, width, height, border); |
| 4794 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4791 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4795 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 4792 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 4796 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); | 4793 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, level, &width, &height)); |
| 4797 } | 4794 } |
| 4798 | 4795 |
| 4799 TEST_F(GLES2DecoderTest, FramebufferRenderbufferGLError) { | 4796 TEST_F(GLES2DecoderTest, FramebufferRenderbufferGLError) { |
| 4800 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 4797 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 4801 kServiceFramebufferId); | 4798 kServiceFramebufferId); |
| 4802 EXPECT_CALL(*gl_, GetError()) | 4799 EXPECT_CALL(*gl_, GetError()) |
| 4803 .WillOnce(Return(GL_NO_ERROR)) | 4800 .WillOnce(Return(GL_NO_ERROR)) |
| 4804 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4801 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 4805 .RetiresOnSaturation(); | 4802 .RetiresOnSaturation(); |
| 4806 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 4803 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5302 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5299 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5303 | 5300 |
| 5304 // Test CompressedTexSubImage not allowed | 5301 // Test CompressedTexSubImage not allowed |
| 5305 CompressedTexSubImage2DBucket sub_cmd; | 5302 CompressedTexSubImage2DBucket sub_cmd; |
| 5306 bucket->SetSize(kBlockSize); | 5303 bucket->SetSize(kBlockSize); |
| 5307 sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, kFormat, kBucketId); | 5304 sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, kFormat, kBucketId); |
| 5308 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); | 5305 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); |
| 5309 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5306 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5310 | 5307 |
| 5311 // Test TexSubImage not allowed for ETC1 compressed texture | 5308 // Test TexSubImage not allowed for ETC1 compressed texture |
| 5312 Texture* info = GetTexture(client_texture_id_); | 5309 Texture* texture = GetTexture(client_texture_id_); |
| 5313 ASSERT_TRUE(info != NULL); | 5310 ASSERT_TRUE(texture != NULL); |
| 5314 GLenum type, internal_format; | 5311 GLenum type, internal_format; |
| 5315 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 5312 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 5316 EXPECT_EQ(kFormat, internal_format); | 5313 EXPECT_EQ(kFormat, internal_format); |
| 5317 TexSubImage2D texsub_cmd; | 5314 TexSubImage2D texsub_cmd; |
| 5318 texsub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, | 5315 texsub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5319 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); | 5316 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
| 5320 EXPECT_EQ(error::kNoError, ExecuteCmd(texsub_cmd)); | 5317 EXPECT_EQ(error::kNoError, ExecuteCmd(texsub_cmd)); |
| 5321 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5318 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5322 | 5319 |
| 5323 // Test CopyTexSubImage not allowed for ETC1 compressed texture | 5320 // Test CopyTexSubImage not allowed for ETC1 compressed texture |
| 5324 CopyTexSubImage2D copy_cmd; | 5321 CopyTexSubImage2D copy_cmd; |
| 5325 copy_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4); | 5322 copy_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5412 false, // request depth | 5409 false, // request depth |
| 5413 false, // request stencil | 5410 false, // request stencil |
| 5414 true); // bind generates resource | 5411 true); // bind generates resource |
| 5415 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); | 5412 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); |
| 5416 EXPECT_CALL(*gl_, GenTextures(1, _)) | 5413 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 5417 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 5414 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 5418 BindTexture cmd; | 5415 BindTexture cmd; |
| 5419 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); | 5416 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); |
| 5420 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5417 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5421 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5418 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5422 Texture* info = GetTexture(kNewClientId); | 5419 Texture* texture = GetTexture(kNewClientId); |
| 5423 EXPECT_TRUE(info != NULL); | 5420 EXPECT_TRUE(texture != NULL); |
| 5424 EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES); | 5421 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5425 } | 5422 } |
| 5426 | 5423 |
| 5427 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { | 5424 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { |
| 5428 InitDecoder( | 5425 InitDecoder( |
| 5429 "GL_OES_EGL_image_external", // extensions | 5426 "GL_OES_EGL_image_external", // extensions |
| 5430 false, // has alpha | 5427 false, // has alpha |
| 5431 false, // has depth | 5428 false, // has depth |
| 5432 false, // has stencil | 5429 false, // has stencil |
| 5433 false, // request alpha | 5430 false, // request alpha |
| 5434 false, // request depth | 5431 false, // request depth |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5462 "GL_OES_EGL_image_external", // extensions | 5459 "GL_OES_EGL_image_external", // extensions |
| 5463 false, // has alpha | 5460 false, // has alpha |
| 5464 false, // has depth | 5461 false, // has depth |
| 5465 false, // has stencil | 5462 false, // has stencil |
| 5466 false, // request alpha | 5463 false, // request alpha |
| 5467 false, // request depth | 5464 false, // request depth |
| 5468 false, // request stencil | 5465 false, // request stencil |
| 5469 true); // bind generates resource | 5466 true); // bind generates resource |
| 5470 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5467 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5471 | 5468 |
| 5472 Texture* info = GetTexture(client_texture_id_); | 5469 Texture* texture = GetTexture(client_texture_id_); |
| 5473 EXPECT_TRUE(info != NULL); | 5470 EXPECT_TRUE(texture != NULL); |
| 5474 EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES); | 5471 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5475 EXPECT_TRUE(info->min_filter() == GL_LINEAR); | 5472 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5476 EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE); | 5473 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5477 EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE); | 5474 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5478 } | 5475 } |
| 5479 | 5476 |
| 5480 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { | 5477 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { |
| 5481 InitDecoder( | 5478 InitDecoder( |
| 5482 "GL_OES_EGL_image_external", // extensions | 5479 "GL_OES_EGL_image_external", // extensions |
| 5483 false, // has alpha | 5480 false, // has alpha |
| 5484 false, // has depth | 5481 false, // has depth |
| 5485 false, // has stencil | 5482 false, // has stencil |
| 5486 false, // request alpha | 5483 false, // request alpha |
| 5487 false, // request depth | 5484 false, // request depth |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5520 GL_CLAMP_TO_EDGE); | 5517 GL_CLAMP_TO_EDGE); |
| 5521 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5518 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5522 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5519 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5523 | 5520 |
| 5524 cmd.Init(GL_TEXTURE_EXTERNAL_OES, | 5521 cmd.Init(GL_TEXTURE_EXTERNAL_OES, |
| 5525 GL_TEXTURE_WRAP_T, | 5522 GL_TEXTURE_WRAP_T, |
| 5526 GL_CLAMP_TO_EDGE); | 5523 GL_CLAMP_TO_EDGE); |
| 5527 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5524 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5528 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5525 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5529 | 5526 |
| 5530 Texture* info = GetTexture(client_texture_id_); | 5527 Texture* texture = GetTexture(client_texture_id_); |
| 5531 EXPECT_TRUE(info != NULL); | 5528 EXPECT_TRUE(texture != NULL); |
| 5532 EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES); | 5529 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5533 EXPECT_TRUE(info->min_filter() == GL_LINEAR); | 5530 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5534 EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE); | 5531 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5535 EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE); | 5532 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5536 } | 5533 } |
| 5537 | 5534 |
| 5538 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { | 5535 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { |
| 5539 InitDecoder( | 5536 InitDecoder( |
| 5540 "GL_OES_EGL_image_external", // extensions | 5537 "GL_OES_EGL_image_external", // extensions |
| 5541 false, // has alpha | 5538 false, // has alpha |
| 5542 false, // has depth | 5539 false, // has depth |
| 5543 false, // has stencil | 5540 false, // has stencil |
| 5544 false, // request alpha | 5541 false, // request alpha |
| 5545 false, // request depth | 5542 false, // request depth |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5560 GL_REPEAT); | 5557 GL_REPEAT); |
| 5561 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5558 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5562 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5559 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 5563 | 5560 |
| 5564 cmd.Init(GL_TEXTURE_EXTERNAL_OES, | 5561 cmd.Init(GL_TEXTURE_EXTERNAL_OES, |
| 5565 GL_TEXTURE_WRAP_T, | 5562 GL_TEXTURE_WRAP_T, |
| 5566 GL_REPEAT); | 5563 GL_REPEAT); |
| 5567 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5564 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5568 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5565 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 5569 | 5566 |
| 5570 Texture* info = GetTexture(client_texture_id_); | 5567 Texture* texture = GetTexture(client_texture_id_); |
| 5571 EXPECT_TRUE(info != NULL); | 5568 EXPECT_TRUE(texture != NULL); |
| 5572 EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES); | 5569 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5573 EXPECT_TRUE(info->min_filter() == GL_LINEAR); | 5570 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5574 EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE); | 5571 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5575 EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE); | 5572 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5576 } | 5573 } |
| 5577 | 5574 |
| 5578 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { | 5575 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { |
| 5579 InitDecoder( | 5576 InitDecoder( |
| 5580 "GL_OES_EGL_image_external", // extensions | 5577 "GL_OES_EGL_image_external", // extensions |
| 5581 false, // has alpha | 5578 false, // has alpha |
| 5582 false, // has depth | 5579 false, // has depth |
| 5583 false, // has stencil | 5580 false, // has stencil |
| 5584 false, // request alpha | 5581 false, // request alpha |
| 5585 false, // request depth | 5582 false, // request depth |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5653 .WillOnce(Return(kObjectId)) | 5650 .WillOnce(Return(kObjectId)) |
| 5654 .RetiresOnSaturation(); | 5651 .RetiresOnSaturation(); |
| 5655 | 5652 |
| 5656 CreateStreamTextureCHROMIUM cmd; | 5653 CreateStreamTextureCHROMIUM cmd; |
| 5657 CreateStreamTextureCHROMIUM::Result* result = | 5654 CreateStreamTextureCHROMIUM::Result* result = |
| 5658 static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_); | 5655 static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_); |
| 5659 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5656 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5660 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5657 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5661 EXPECT_EQ(kObjectId, *result); | 5658 EXPECT_EQ(kObjectId, *result); |
| 5662 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5659 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5663 Texture* info = GetTexture(client_texture_id_); | 5660 Texture* texture = GetTexture(client_texture_id_); |
| 5664 EXPECT_TRUE(info != NULL); | 5661 EXPECT_TRUE(texture != NULL); |
| 5665 EXPECT_TRUE(info->IsStreamTexture()); | 5662 EXPECT_TRUE(texture->IsStreamTexture()); |
| 5666 } | 5663 } |
| 5667 | 5664 |
| 5668 TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMBadId) { | 5665 TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMBadId) { |
| 5669 InitDecoder( | 5666 InitDecoder( |
| 5670 "GL_CHROMIUM_stream_texture", // extensions | 5667 "GL_CHROMIUM_stream_texture", // extensions |
| 5671 false, // has alpha | 5668 false, // has alpha |
| 5672 false, // has depth | 5669 false, // has depth |
| 5673 false, // has stencil | 5670 false, // has stencil |
| 5674 false, // request alpha | 5671 false, // request alpha |
| 5675 false, // request depth | 5672 false, // request depth |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5710 InitDecoder( | 5707 InitDecoder( |
| 5711 "GL_CHROMIUM_stream_texture", // extensions | 5708 "GL_CHROMIUM_stream_texture", // extensions |
| 5712 false, // has alpha | 5709 false, // has alpha |
| 5713 false, // has depth | 5710 false, // has depth |
| 5714 false, // has stencil | 5711 false, // has stencil |
| 5715 false, // request alpha | 5712 false, // request alpha |
| 5716 false, // request depth | 5713 false, // request depth |
| 5717 false, // request stencil | 5714 false, // request stencil |
| 5718 true); // bind generates resource | 5715 true); // bind generates resource |
| 5719 | 5716 |
| 5720 Texture* info = GetTexture(client_texture_id_); | 5717 Texture* texture = GetTexture(client_texture_id_); |
| 5721 info->SetStreamTexture(true); | 5718 texture->SetStreamTexture(true); |
| 5722 | 5719 |
| 5723 CreateStreamTextureCHROMIUM cmd; | 5720 CreateStreamTextureCHROMIUM cmd; |
| 5724 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5721 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5725 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5722 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5726 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5723 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5727 } | 5724 } |
| 5728 | 5725 |
| 5729 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUM) { | 5726 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUM) { |
| 5730 InitDecoder( | 5727 InitDecoder( |
| 5731 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions | 5728 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions |
| 5732 false, // has alpha | 5729 false, // has alpha |
| 5733 false, // has depth | 5730 false, // has depth |
| 5734 false, // has stencil | 5731 false, // has stencil |
| 5735 false, // request alpha | 5732 false, // request alpha |
| 5736 false, // request depth | 5733 false, // request depth |
| 5737 false, // request stencil | 5734 false, // request stencil |
| 5738 true); // bind generates resource | 5735 true); // bind generates resource |
| 5739 | 5736 |
| 5740 StrictMock<MockStreamTextureManager> manager; | 5737 StrictMock<MockStreamTextureManager> manager; |
| 5741 StrictMock<MockStreamTexture> texture; | 5738 StrictMock<MockStreamTexture> stream_texture; |
| 5742 decoder_->SetStreamTextureManager(&manager); | 5739 decoder_->SetStreamTextureManager(&manager); |
| 5743 | 5740 |
| 5744 Texture* info = GetTexture(client_texture_id_); | 5741 Texture* texture = GetTexture(client_texture_id_); |
| 5745 info->SetStreamTexture(true); | 5742 texture->SetStreamTexture(true); |
| 5746 | 5743 |
| 5747 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId)) | 5744 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId)) |
| 5748 .Times(1) | 5745 .Times(1) |
| 5749 .RetiresOnSaturation(); | 5746 .RetiresOnSaturation(); |
| 5750 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) | 5747 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) |
| 5751 .WillOnce(Return(&texture)) | 5748 .WillOnce(Return(&stream_texture)) |
| 5752 .RetiresOnSaturation(); | 5749 .RetiresOnSaturation(); |
| 5753 EXPECT_CALL(texture, Update()) | 5750 EXPECT_CALL(stream_texture, Update()) |
| 5754 .Times(1) | 5751 .Times(1) |
| 5755 .RetiresOnSaturation(); | 5752 .RetiresOnSaturation(); |
| 5756 | 5753 |
| 5757 BindTexture cmd; | 5754 BindTexture cmd; |
| 5758 cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_); | 5755 cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_); |
| 5759 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5756 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5760 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5757 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5761 } | 5758 } |
| 5762 | 5759 |
| 5763 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUMInvalid) { | 5760 TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUMInvalid) { |
| 5764 InitDecoder( | 5761 InitDecoder( |
| 5765 "GL_CHROMIUM_stream_texture", // extensions | 5762 "GL_CHROMIUM_stream_texture", // extensions |
| 5766 false, // has alpha | 5763 false, // has alpha |
| 5767 false, // has depth | 5764 false, // has depth |
| 5768 false, // has stencil | 5765 false, // has stencil |
| 5769 false, // request alpha | 5766 false, // request alpha |
| 5770 false, // request depth | 5767 false, // request depth |
| 5771 false, // request stencil | 5768 false, // request stencil |
| 5772 true); // bind generates resource | 5769 true); // bind generates resource |
| 5773 | 5770 |
| 5774 Texture* info = GetTexture(client_texture_id_); | 5771 Texture* texture = GetTexture(client_texture_id_); |
| 5775 info->SetStreamTexture(true); | 5772 texture->SetStreamTexture(true); |
| 5776 | 5773 |
| 5777 BindTexture cmd; | 5774 BindTexture cmd; |
| 5778 cmd.Init(GL_TEXTURE_2D, client_texture_id_); | 5775 cmd.Init(GL_TEXTURE_2D, client_texture_id_); |
| 5779 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5776 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5780 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5777 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5781 | 5778 |
| 5782 BindTexture cmd2; | 5779 BindTexture cmd2; |
| 5783 cmd2.Init(GL_TEXTURE_CUBE_MAP, client_texture_id_); | 5780 cmd2.Init(GL_TEXTURE_CUBE_MAP, client_texture_id_); |
| 5784 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 5781 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 5785 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5782 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5786 } | 5783 } |
| 5787 | 5784 |
| 5788 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUM) { | 5785 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUM) { |
| 5789 InitDecoder( | 5786 InitDecoder( |
| 5790 "GL_CHROMIUM_stream_texture", // extensions | 5787 "GL_CHROMIUM_stream_texture", // extensions |
| 5791 false, // has alpha | 5788 false, // has alpha |
| 5792 false, // has depth | 5789 false, // has depth |
| 5793 false, // has stencil | 5790 false, // has stencil |
| 5794 false, // request alpha | 5791 false, // request alpha |
| 5795 false, // request depth | 5792 false, // request depth |
| 5796 false, // request stencil | 5793 false, // request stencil |
| 5797 true); // bind generates resource | 5794 true); // bind generates resource |
| 5798 | 5795 |
| 5799 StrictMock<MockStreamTextureManager> manager; | 5796 StrictMock<MockStreamTextureManager> manager; |
| 5800 decoder_->SetStreamTextureManager(&manager); | 5797 decoder_->SetStreamTextureManager(&manager); |
| 5801 | 5798 |
| 5802 Texture* info = GetTexture(client_texture_id_); | 5799 Texture* texture = GetTexture(client_texture_id_); |
| 5803 info->SetStreamTexture(true); | 5800 texture->SetStreamTexture(true); |
| 5804 | 5801 |
| 5805 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) | 5802 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) |
| 5806 .Times(1) | 5803 .Times(1) |
| 5807 .RetiresOnSaturation(); | 5804 .RetiresOnSaturation(); |
| 5808 | 5805 |
| 5809 DestroyStreamTextureCHROMIUM cmd; | 5806 DestroyStreamTextureCHROMIUM cmd; |
| 5810 cmd.Init(client_texture_id_); | 5807 cmd.Init(client_texture_id_); |
| 5811 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5808 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5812 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5809 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5813 EXPECT_FALSE(info->IsStreamTexture()); | 5810 EXPECT_FALSE(texture->IsStreamTexture()); |
| 5814 EXPECT_EQ(0U, info->target()); | 5811 EXPECT_EQ(0U, texture->target()); |
| 5815 } | 5812 } |
| 5816 | 5813 |
| 5817 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMInvalid) { | 5814 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMInvalid) { |
| 5818 InitDecoder( | 5815 InitDecoder( |
| 5819 "GL_CHROMIUM_stream_texture", // extensions | 5816 "GL_CHROMIUM_stream_texture", // extensions |
| 5820 false, // has alpha | 5817 false, // has alpha |
| 5821 false, // has depth | 5818 false, // has depth |
| 5822 false, // has stencil | 5819 false, // has stencil |
| 5823 false, // request alpha | 5820 false, // request alpha |
| 5824 false, // request depth | 5821 false, // request depth |
| 5825 false, // request stencil | 5822 false, // request stencil |
| 5826 true); // bind generates resource | 5823 true); // bind generates resource |
| 5827 | 5824 |
| 5828 Texture* info = GetTexture(client_texture_id_); | 5825 Texture* texture = GetTexture(client_texture_id_); |
| 5829 info->SetStreamTexture(false); | 5826 texture->SetStreamTexture(false); |
| 5830 | 5827 |
| 5831 DestroyStreamTextureCHROMIUM cmd; | 5828 DestroyStreamTextureCHROMIUM cmd; |
| 5832 cmd.Init(client_texture_id_); | 5829 cmd.Init(client_texture_id_); |
| 5833 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5830 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5834 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 5831 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 5835 } | 5832 } |
| 5836 | 5833 |
| 5837 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMBadId) { | 5834 TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMBadId) { |
| 5838 InitDecoder( | 5835 InitDecoder( |
| 5839 "GL_CHROMIUM_stream_texture", // extensions | 5836 "GL_CHROMIUM_stream_texture", // extensions |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5860 false, // request alpha | 5857 false, // request alpha |
| 5861 false, // request depth | 5858 false, // request depth |
| 5862 false, // request stencil | 5859 false, // request stencil |
| 5863 true); // bind generates resource | 5860 true); // bind generates resource |
| 5864 | 5861 |
| 5865 CreateStreamTextureCHROMIUM cmd; | 5862 CreateStreamTextureCHROMIUM cmd; |
| 5866 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5863 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5867 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); | 5864 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); |
| 5868 GetGLError(); // ignore internal error | 5865 GetGLError(); // ignore internal error |
| 5869 | 5866 |
| 5870 Texture* info = GetTexture(client_texture_id_); | 5867 Texture* texture = GetTexture(client_texture_id_); |
| 5871 info->SetStreamTexture(true); | 5868 texture->SetStreamTexture(true); |
| 5872 | 5869 |
| 5873 DestroyStreamTextureCHROMIUM cmd2; | 5870 DestroyStreamTextureCHROMIUM cmd2; |
| 5874 cmd2.Init(client_texture_id_); | 5871 cmd2.Init(client_texture_id_); |
| 5875 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2)); | 5872 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2)); |
| 5876 GetGLError(); // ignore internal error | 5873 GetGLError(); // ignore internal error |
| 5877 } | 5874 } |
| 5878 | 5875 |
| 5879 TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) { | 5876 TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) { |
| 5880 const GLuint kObjectId = 123; | 5877 const GLuint kObjectId = 123; |
| 5881 InitDecoder( | 5878 InitDecoder( |
| 5882 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions | 5879 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions |
| 5883 false, // has alpha | 5880 false, // has alpha |
| 5884 false, // has depth | 5881 false, // has depth |
| 5885 false, // has stencil | 5882 false, // has stencil |
| 5886 false, // request alpha | 5883 false, // request alpha |
| 5887 false, // request depth | 5884 false, // request depth |
| 5888 false, // request stencil | 5885 false, // request stencil |
| 5889 true); // bind generates resource | 5886 true); // bind generates resource |
| 5890 | 5887 |
| 5891 StrictMock<MockStreamTextureManager> manager; | 5888 StrictMock<MockStreamTextureManager> manager; |
| 5892 StrictMock<MockStreamTexture> texture; | 5889 StrictMock<MockStreamTexture> stream_texture; |
| 5893 decoder_->SetStreamTextureManager(&manager); | 5890 decoder_->SetStreamTextureManager(&manager); |
| 5894 | 5891 |
| 5895 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) | 5892 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId)) |
| 5896 .WillOnce(Return(&texture)) | 5893 .WillOnce(Return(&stream_texture)) |
| 5897 .RetiresOnSaturation(); | 5894 .RetiresOnSaturation(); |
| 5898 EXPECT_CALL(texture, Update()) | 5895 EXPECT_CALL(stream_texture, Update()) |
| 5899 .Times(1) | 5896 .Times(1) |
| 5900 .RetiresOnSaturation(); | 5897 .RetiresOnSaturation(); |
| 5901 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) | 5898 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId)) |
| 5902 .Times(1) | 5899 .Times(1) |
| 5903 .RetiresOnSaturation(); | 5900 .RetiresOnSaturation(); |
| 5904 EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId, | 5901 EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId, |
| 5905 client_texture_id_)) | 5902 client_texture_id_)) |
| 5906 .WillOnce(Return(kObjectId)) | 5903 .WillOnce(Return(kObjectId)) |
| 5907 .RetiresOnSaturation(); | 5904 .RetiresOnSaturation(); |
| 5908 | 5905 |
| 5909 Texture* info = GetTexture(client_texture_id_); | 5906 Texture* texture = GetTexture(client_texture_id_); |
| 5910 info->SetStreamTexture(true); | 5907 texture->SetStreamTexture(true); |
| 5911 | 5908 |
| 5912 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5909 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5913 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5910 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5914 | 5911 |
| 5915 DestroyStreamTextureCHROMIUM cmd; | 5912 DestroyStreamTextureCHROMIUM cmd; |
| 5916 cmd.Init(client_texture_id_); | 5913 cmd.Init(client_texture_id_); |
| 5917 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5914 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5918 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5915 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5919 EXPECT_FALSE(info->IsStreamTexture()); | 5916 EXPECT_FALSE(texture->IsStreamTexture()); |
| 5920 | 5917 |
| 5921 CreateStreamTextureCHROMIUM cmd2; | 5918 CreateStreamTextureCHROMIUM cmd2; |
| 5922 cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); | 5919 cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_); |
| 5923 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 5920 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 5924 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5921 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5925 EXPECT_TRUE(info->IsStreamTexture()); | 5922 EXPECT_TRUE(texture->IsStreamTexture()); |
| 5926 } | 5923 } |
| 5927 | 5924 |
| 5928 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { | 5925 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { |
| 5929 InitDecoder( | 5926 InitDecoder( |
| 5930 "GL_ARB_texture_rectangle", // extensions | 5927 "GL_ARB_texture_rectangle", // extensions |
| 5931 false, // has alpha | 5928 false, // has alpha |
| 5932 false, // has depth | 5929 false, // has depth |
| 5933 false, // has stencil | 5930 false, // has stencil |
| 5934 false, // request alpha | 5931 false, // request alpha |
| 5935 false, // request depth | 5932 false, // request depth |
| 5936 false, // request stencil | 5933 false, // request stencil |
| 5937 true); // bind generates resource | 5934 true); // bind generates resource |
| 5938 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); | 5935 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); |
| 5939 EXPECT_CALL(*gl_, GenTextures(1, _)) | 5936 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 5940 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 5937 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 5941 BindTexture cmd; | 5938 BindTexture cmd; |
| 5942 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); | 5939 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); |
| 5943 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5940 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5944 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5941 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5945 Texture* info = GetTexture(kNewClientId); | 5942 Texture* texture = GetTexture(kNewClientId); |
| 5946 EXPECT_TRUE(info != NULL); | 5943 EXPECT_TRUE(texture != NULL); |
| 5947 EXPECT_TRUE(info->target() == GL_TEXTURE_RECTANGLE_ARB); | 5944 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 5948 } | 5945 } |
| 5949 | 5946 |
| 5950 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { | 5947 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { |
| 5951 InitDecoder( | 5948 InitDecoder( |
| 5952 "GL_ARB_texture_rectangle", // extensions | 5949 "GL_ARB_texture_rectangle", // extensions |
| 5953 false, // has alpha | 5950 false, // has alpha |
| 5954 false, // has depth | 5951 false, // has depth |
| 5955 false, // has stencil | 5952 false, // has stencil |
| 5956 false, // request alpha | 5953 false, // request alpha |
| 5957 false, // request depth | 5954 false, // request depth |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5987 false, // has alpha | 5984 false, // has alpha |
| 5988 false, // has depth | 5985 false, // has depth |
| 5989 false, // has stencil | 5986 false, // has stencil |
| 5990 false, // request alpha | 5987 false, // request alpha |
| 5991 false, // request depth | 5988 false, // request depth |
| 5992 false, // request stencil | 5989 false, // request stencil |
| 5993 true); // bind generates resource | 5990 true); // bind generates resource |
| 5994 DoBindTexture( | 5991 DoBindTexture( |
| 5995 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); | 5992 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); |
| 5996 | 5993 |
| 5997 Texture* info = GetTexture(client_texture_id_); | 5994 Texture* texture = GetTexture(client_texture_id_); |
| 5998 EXPECT_TRUE(info != NULL); | 5995 EXPECT_TRUE(texture != NULL); |
| 5999 EXPECT_TRUE(info->target() == GL_TEXTURE_RECTANGLE_ARB); | 5996 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6000 EXPECT_TRUE(info->min_filter() == GL_LINEAR); | 5997 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 6001 EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE); | 5998 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 6002 EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE); | 5999 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 6003 } | 6000 } |
| 6004 | 6001 |
| 6005 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { | 6002 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { |
| 6006 InitDecoder( | 6003 InitDecoder( |
| 6007 "GL_ARB_texture_rectangle", // extensions | 6004 "GL_ARB_texture_rectangle", // extensions |
| 6008 false, // has alpha | 6005 false, // has alpha |
| 6009 false, // has depth | 6006 false, // has depth |
| 6010 false, // has stencil | 6007 false, // has stencil |
| 6011 false, // request alpha | 6008 false, // request alpha |
| 6012 false, // request depth | 6009 false, // request depth |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6046 GL_CLAMP_TO_EDGE); | 6043 GL_CLAMP_TO_EDGE); |
| 6047 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6044 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6048 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6045 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6049 | 6046 |
| 6050 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, | 6047 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, |
| 6051 GL_TEXTURE_WRAP_T, | 6048 GL_TEXTURE_WRAP_T, |
| 6052 GL_CLAMP_TO_EDGE); | 6049 GL_CLAMP_TO_EDGE); |
| 6053 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6050 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6054 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6051 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6055 | 6052 |
| 6056 Texture* info = GetTexture(client_texture_id_); | 6053 Texture* texture = GetTexture(client_texture_id_); |
| 6057 EXPECT_TRUE(info != NULL); | 6054 EXPECT_TRUE(texture != NULL); |
| 6058 EXPECT_TRUE(info->target() == GL_TEXTURE_RECTANGLE_ARB); | 6055 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6059 EXPECT_TRUE(info->min_filter() == GL_LINEAR); | 6056 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 6060 EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE); | 6057 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 6061 EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE); | 6058 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 6062 } | 6059 } |
| 6063 | 6060 |
| 6064 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { | 6061 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { |
| 6065 InitDecoder( | 6062 InitDecoder( |
| 6066 "GL_ARB_texture_rectangle", // extensions | 6063 "GL_ARB_texture_rectangle", // extensions |
| 6067 false, // has alpha | 6064 false, // has alpha |
| 6068 false, // has depth | 6065 false, // has depth |
| 6069 false, // has stencil | 6066 false, // has stencil |
| 6070 false, // request alpha | 6067 false, // request alpha |
| 6071 false, // request depth | 6068 false, // request depth |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6087 GL_REPEAT); | 6084 GL_REPEAT); |
| 6088 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6085 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6089 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 6086 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 6090 | 6087 |
| 6091 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, | 6088 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, |
| 6092 GL_TEXTURE_WRAP_T, | 6089 GL_TEXTURE_WRAP_T, |
| 6093 GL_REPEAT); | 6090 GL_REPEAT); |
| 6094 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6091 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6095 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 6092 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 6096 | 6093 |
| 6097 Texture* info = GetTexture(client_texture_id_); | 6094 Texture* texture = GetTexture(client_texture_id_); |
| 6098 EXPECT_TRUE(info != NULL); | 6095 EXPECT_TRUE(texture != NULL); |
| 6099 EXPECT_TRUE(info->target() == GL_TEXTURE_RECTANGLE_ARB); | 6096 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 6100 EXPECT_TRUE(info->min_filter() == GL_LINEAR); | 6097 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 6101 EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE); | 6098 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 6102 EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE); | 6099 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 6103 } | 6100 } |
| 6104 | 6101 |
| 6105 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { | 6102 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { |
| 6106 InitDecoder( | 6103 InitDecoder( |
| 6107 "GL_ARB_texture_rectangle", // extensions | 6104 "GL_ARB_texture_rectangle", // extensions |
| 6108 false, // has alpha | 6105 false, // has alpha |
| 6109 false, // has depth | 6106 false, // has depth |
| 6110 false, // has stencil | 6107 false, // has stencil |
| 6111 false, // request alpha | 6108 false, // request alpha |
| 6112 false, // request depth | 6109 false, // request depth |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6418 DrawArrays cmd; | 6415 DrawArrays cmd; |
| 6419 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 6416 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 6420 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6417 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6421 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); | 6418 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); |
| 6422 } | 6419 } |
| 6423 | 6420 |
| 6424 TEST_F(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) { | 6421 TEST_F(GLES2DecoderTest, CopyTexImage2DMarksTextureAsCleared) { |
| 6425 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 6422 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 6426 | 6423 |
| 6427 TextureManager* manager = group().texture_manager(); | 6424 TextureManager* manager = group().texture_manager(); |
| 6428 Texture* info = | 6425 Texture* texture = manager->GetTexture(client_texture_id_); |
| 6429 manager->GetTexture(client_texture_id_); | |
| 6430 | 6426 |
| 6431 EXPECT_CALL(*gl_, GetError()) | 6427 EXPECT_CALL(*gl_, GetError()) |
| 6432 .WillOnce(Return(GL_NO_ERROR)) | 6428 .WillOnce(Return(GL_NO_ERROR)) |
| 6433 .RetiresOnSaturation(); | 6429 .RetiresOnSaturation(); |
| 6434 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0)) | 6430 EXPECT_CALL(*gl_, CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0)) |
| 6435 .Times(1) | 6431 .Times(1) |
| 6436 .RetiresOnSaturation(); | 6432 .RetiresOnSaturation(); |
| 6437 EXPECT_CALL(*gl_, GetError()) | 6433 EXPECT_CALL(*gl_, GetError()) |
| 6438 .WillOnce(Return(GL_NO_ERROR)) | 6434 .WillOnce(Return(GL_NO_ERROR)) |
| 6439 .RetiresOnSaturation(); | 6435 .RetiresOnSaturation(); |
| 6440 CopyTexImage2D cmd; | 6436 CopyTexImage2D cmd; |
| 6441 cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0); | 6437 cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0); |
| 6442 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6438 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6443 | 6439 |
| 6444 EXPECT_TRUE(info->SafeToRenderFrom()); | 6440 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 6445 } | 6441 } |
| 6446 | 6442 |
| 6447 TEST_F(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) { | 6443 TEST_F(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) { |
| 6448 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 6444 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 6449 DoTexImage2D( | 6445 DoTexImage2D( |
| 6450 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 6446 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 6451 | 6447 |
| 6452 SetupClearTextureExpections( | 6448 SetupClearTextureExpections( |
| 6453 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, | 6449 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, |
| 6454 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); | 6450 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 6480 .Times(1) | 6476 .Times(1) |
| 6481 .RetiresOnSaturation(); | 6477 .RetiresOnSaturation(); |
| 6482 EXPECT_CALL(*gl_, GetError()) | 6478 EXPECT_CALL(*gl_, GetError()) |
| 6483 .WillOnce(Return(GL_NO_ERROR)) | 6479 .WillOnce(Return(GL_NO_ERROR)) |
| 6484 .RetiresOnSaturation(); | 6480 .RetiresOnSaturation(); |
| 6485 CompressedTexImage2D cmd; | 6481 CompressedTexImage2D cmd; |
| 6486 cmd.Init(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, | 6482 cmd.Init(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, |
| 6487 8, kSharedMemoryId, kSharedMemoryOffset); | 6483 8, kSharedMemoryId, kSharedMemoryOffset); |
| 6488 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6484 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6489 TextureManager* manager = group().texture_manager(); | 6485 TextureManager* manager = group().texture_manager(); |
| 6490 Texture* info = | 6486 Texture* texture = manager->GetTexture(client_texture_id_); |
| 6491 manager->GetTexture(client_texture_id_); | 6487 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 6492 EXPECT_TRUE(info->SafeToRenderFrom()); | |
| 6493 } | 6488 } |
| 6494 | 6489 |
| 6495 TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnClear) { | 6490 TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnClear) { |
| 6496 const GLuint kFBOClientTextureId = 4100; | 6491 const GLuint kFBOClientTextureId = 4100; |
| 6497 const GLuint kFBOServiceTextureId = 4101; | 6492 const GLuint kFBOServiceTextureId = 4101; |
| 6498 | 6493 |
| 6499 // Register a texture id. | 6494 // Register a texture id. |
| 6500 EXPECT_CALL(*gl_, GenTextures(_, _)) | 6495 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 6501 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 6496 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 6502 .RetiresOnSaturation(); | 6497 .RetiresOnSaturation(); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7254 group().mailbox_manager()->GenerateMailboxName( | 7249 group().mailbox_manager()->GenerateMailboxName( |
| 7255 reinterpret_cast<MailboxName*>(mailbox)); | 7250 reinterpret_cast<MailboxName*>(mailbox)); |
| 7256 | 7251 |
| 7257 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); | 7252 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); |
| 7258 | 7253 |
| 7259 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7254 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7260 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7255 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7261 0, 0); | 7256 0, 0); |
| 7262 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7257 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7263 0, 0); | 7258 0, 0); |
| 7264 Texture* info = | 7259 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); |
| 7265 group().texture_manager()->GetTexture(client_texture_id_); | 7260 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 7266 EXPECT_EQ(kServiceTextureId, info->service_id()); | |
| 7267 | 7261 |
| 7268 // Assigns and binds new service side texture ID. | 7262 // Assigns and binds new service side texture ID. |
| 7269 EXPECT_CALL(*gl_, GenTextures(1, _)) | 7263 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 7270 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 7264 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
| 7271 .RetiresOnSaturation(); | 7265 .RetiresOnSaturation(); |
| 7272 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) | 7266 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) |
| 7273 .Times(1) | 7267 .Times(1) |
| 7274 .RetiresOnSaturation(); | 7268 .RetiresOnSaturation(); |
| 7275 | 7269 |
| 7276 ProduceTextureCHROMIUM produce_cmd; | 7270 ProduceTextureCHROMIUM produce_cmd; |
| 7277 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); | 7271 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
| 7278 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); | 7272 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); |
| 7279 | 7273 |
| 7280 // Texture is zero-by-zero. | 7274 // Texture is zero-by-zero. |
| 7281 GLsizei width; | 7275 GLsizei width; |
| 7282 GLsizei height; | 7276 GLsizei height; |
| 7283 GLenum type; | 7277 GLenum type; |
| 7284 GLenum internal_format; | 7278 GLenum internal_format; |
| 7285 | 7279 |
| 7286 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7280 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7287 EXPECT_EQ(0, width); | 7281 EXPECT_EQ(0, width); |
| 7288 EXPECT_EQ(0, height); | 7282 EXPECT_EQ(0, height); |
| 7289 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7283 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 7290 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7284 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7291 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7285 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7292 | 7286 |
| 7293 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); | 7287 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); |
| 7294 EXPECT_EQ(0, width); | 7288 EXPECT_EQ(0, width); |
| 7295 EXPECT_EQ(0, height); | 7289 EXPECT_EQ(0, height); |
| 7296 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); | 7290 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); |
| 7297 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7291 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7298 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7292 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7299 | 7293 |
| 7300 // Service ID has changed. | 7294 // Service ID has changed. |
| 7301 EXPECT_EQ(kNewServiceId, info->service_id()); | 7295 EXPECT_EQ(kNewServiceId, texture->service_id()); |
| 7302 | 7296 |
| 7303 // Assigns and binds original service size texture ID. | 7297 // Assigns and binds original service size texture ID. |
| 7304 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 7298 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
| 7305 .Times(1) | 7299 .Times(1) |
| 7306 .RetiresOnSaturation(); | 7300 .RetiresOnSaturation(); |
| 7307 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 7301 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| 7308 .Times(1) | 7302 .Times(1) |
| 7309 .RetiresOnSaturation(); | 7303 .RetiresOnSaturation(); |
| 7310 | 7304 |
| 7305 // TextureManager::Restore will set TexParameters. |
| 7306 EXPECT_CALL(*gl_, TexParameteri( |
| 7307 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) |
| 7308 .Times(1) |
| 7309 .RetiresOnSaturation(); |
| 7310 EXPECT_CALL(*gl_, TexParameteri( |
| 7311 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)) |
| 7312 .Times(1) |
| 7313 .RetiresOnSaturation(); |
| 7314 EXPECT_CALL(*gl_, TexParameteri( |
| 7315 GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)) |
| 7316 .Times(1) |
| 7317 .RetiresOnSaturation(); |
| 7318 EXPECT_CALL(*gl_, TexParameteri( |
| 7319 GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)) |
| 7320 .Times(1) |
| 7321 .RetiresOnSaturation(); |
| 7322 #if 0 |
| 7323 EXPECT_CALL(*gl_, TexParameteri( |
| 7324 GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_NONE)) |
| 7325 .Times(1) |
| 7326 .RetiresOnSaturation(); |
| 7327 #endif |
| 7328 |
| 7311 ConsumeTextureCHROMIUM consume_cmd; | 7329 ConsumeTextureCHROMIUM consume_cmd; |
| 7312 consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); | 7330 consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
| 7313 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); | 7331 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); |
| 7314 | 7332 |
| 7315 // Texture is redefined. | 7333 // Texture is redefined. |
| 7316 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7334 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7317 EXPECT_EQ(3, width); | 7335 EXPECT_EQ(3, width); |
| 7318 EXPECT_EQ(1, height); | 7336 EXPECT_EQ(1, height); |
| 7319 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7337 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 7320 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7338 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7321 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7339 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7322 | 7340 |
| 7323 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); | 7341 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); |
| 7324 EXPECT_EQ(2, width); | 7342 EXPECT_EQ(2, width); |
| 7325 EXPECT_EQ(4, height); | 7343 EXPECT_EQ(4, height); |
| 7326 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); | 7344 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); |
| 7327 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7345 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7328 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7346 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7329 | 7347 |
| 7330 // Service ID is restored. | 7348 // Service ID is restored. |
| 7331 EXPECT_EQ(kServiceTextureId, info->service_id()); | 7349 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 7332 } | 7350 } |
| 7333 | 7351 |
| 7334 | 7352 |
| 7335 TEST_F(GLES2DecoderTest, CanChangeSurface) { | 7353 TEST_F(GLES2DecoderTest, CanChangeSurface) { |
| 7336 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock); | 7354 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock); |
| 7337 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()). | 7355 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()). |
| 7338 WillOnce(Return(7)); | 7356 WillOnce(Return(7)); |
| 7339 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7)); | 7357 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7)); |
| 7340 | 7358 |
| 7341 decoder_->SetSurface(other_surface); | 7359 decoder_->SetSurface(other_surface); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7833 } | 7851 } |
| 7834 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, | 7852 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 7835 BindVertexArrayOESValidArgsNewId) { | 7853 BindVertexArrayOESValidArgsNewId) { |
| 7836 BindVertexArrayOESValidArgsNewId(); | 7854 BindVertexArrayOESValidArgsNewId(); |
| 7837 } | 7855 } |
| 7838 | 7856 |
| 7839 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUM) { | 7857 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUM) { |
| 7840 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7858 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7841 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7859 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7842 0, 0); | 7860 0, 0); |
| 7843 Texture* info = | 7861 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); |
| 7844 group().texture_manager()->GetTexture(client_texture_id_); | 7862 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 7845 EXPECT_EQ(kServiceTextureId, info->service_id()); | |
| 7846 | 7863 |
| 7847 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); | 7864 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); |
| 7848 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); | 7865 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); |
| 7849 | 7866 |
| 7850 GLsizei width; | 7867 GLsizei width; |
| 7851 GLsizei height; | 7868 GLsizei height; |
| 7852 GLenum type; | 7869 GLenum type; |
| 7853 GLenum internal_format; | 7870 GLenum internal_format; |
| 7854 | 7871 |
| 7855 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7872 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7856 EXPECT_EQ(3, width); | 7873 EXPECT_EQ(3, width); |
| 7857 EXPECT_EQ(1, height); | 7874 EXPECT_EQ(1, height); |
| 7858 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7875 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 7859 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7876 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7860 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7877 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7861 EXPECT_TRUE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7878 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7862 | 7879 |
| 7863 // Bind image to texture. | 7880 // Bind image to texture. |
| 7864 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; | 7881 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
| 7865 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 7882 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
| 7866 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); | 7883 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
| 7867 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7884 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7868 // Image should now be set. | 7885 // Image should now be set. |
| 7869 EXPECT_FALSE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7886 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7870 | 7887 |
| 7871 // Define new texture image. | 7888 // Define new texture image. |
| 7872 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7889 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7873 0, 0); | 7890 0, 0); |
| 7874 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7891 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7875 // Image should no longer be set. | 7892 // Image should no longer be set. |
| 7876 EXPECT_TRUE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7893 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7877 } | 7894 } |
| 7878 | 7895 |
| 7879 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { | 7896 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { |
| 7880 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7897 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7881 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7898 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7882 0, 0); | 7899 0, 0); |
| 7883 Texture* info = | 7900 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); |
| 7884 group().texture_manager()->GetTexture(client_texture_id_); | 7901 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 7885 EXPECT_EQ(kServiceTextureId, info->service_id()); | |
| 7886 | 7902 |
| 7887 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); | 7903 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0), 1); |
| 7888 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); | 7904 EXPECT_FALSE(group().image_manager()->LookupImage(1) == NULL); |
| 7889 | 7905 |
| 7890 GLsizei width; | 7906 GLsizei width; |
| 7891 GLsizei height; | 7907 GLsizei height; |
| 7892 GLenum type; | 7908 GLenum type; |
| 7893 GLenum internal_format; | 7909 GLenum internal_format; |
| 7894 | 7910 |
| 7895 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7911 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7896 EXPECT_EQ(3, width); | 7912 EXPECT_EQ(3, width); |
| 7897 EXPECT_EQ(1, height); | 7913 EXPECT_EQ(1, height); |
| 7898 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7914 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 7899 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7915 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7900 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7916 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7901 EXPECT_TRUE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7917 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7902 | 7918 |
| 7903 // Bind image to texture. | 7919 // Bind image to texture. |
| 7904 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; | 7920 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
| 7905 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 7921 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
| 7906 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); | 7922 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
| 7907 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7923 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7908 // Image should now be set. | 7924 // Image should now be set. |
| 7909 EXPECT_FALSE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7925 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7910 | 7926 |
| 7911 // Release image from texture. | 7927 // Release image from texture. |
| 7912 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; | 7928 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; |
| 7913 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 7929 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
| 7914 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); | 7930 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); |
| 7915 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7931 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7916 // Image should no longer be set. | 7932 // Image should no longer be set. |
| 7917 EXPECT_TRUE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7933 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7918 } | 7934 } |
| 7919 | 7935 |
| 7920 TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) { | 7936 TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) { |
| 7921 InitDecoder( | 7937 InitDecoder( |
| 7922 "GL_ARB_texture_rectangle", // extensions | 7938 "GL_ARB_texture_rectangle", // extensions |
| 7923 false, // has alpha | 7939 false, // has alpha |
| 7924 false, // has depth | 7940 false, // has depth |
| 7925 false, // has stencil | 7941 false, // has stencil |
| 7926 false, // request alpha | 7942 false, // request alpha |
| 7927 false, // request depth | 7943 false, // request depth |
| 7928 false, // request stencil | 7944 false, // request stencil |
| 7929 true); // bind generates resource | 7945 true); // bind generates resource |
| 7930 | 7946 |
| 7931 Texture* info = GetTexture(client_texture_id_); | 7947 Texture* texture = GetTexture(client_texture_id_); |
| 7932 EXPECT_TRUE(info != NULL); | 7948 EXPECT_TRUE(texture != NULL); |
| 7933 EXPECT_TRUE(info->pool() == GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); | 7949 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); |
| 7934 | 7950 |
| 7935 DoBindTexture( | 7951 DoBindTexture( |
| 7936 GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7952 GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7937 | 7953 |
| 7938 TexParameteri cmd; | 7954 TexParameteri cmd; |
| 7939 cmd.Init(GL_TEXTURE_2D, | 7955 cmd.Init(GL_TEXTURE_2D, |
| 7940 GL_TEXTURE_POOL_CHROMIUM, | 7956 GL_TEXTURE_POOL_CHROMIUM, |
| 7941 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); | 7957 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); |
| 7942 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7958 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 7943 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 7959 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 7944 | 7960 |
| 7945 cmd.Init(GL_TEXTURE_2D, | 7961 cmd.Init(GL_TEXTURE_2D, |
| 7946 GL_TEXTURE_POOL_CHROMIUM, | 7962 GL_TEXTURE_POOL_CHROMIUM, |
| 7947 GL_TEXTURE_POOL_MANAGED_CHROMIUM); | 7963 GL_TEXTURE_POOL_MANAGED_CHROMIUM); |
| 7948 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7964 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 7949 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 7965 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 7950 | 7966 |
| 7951 EXPECT_TRUE(info->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM); | 7967 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM); |
| 7952 | 7968 |
| 7953 cmd.Init(GL_TEXTURE_2D, | 7969 cmd.Init(GL_TEXTURE_2D, |
| 7954 GL_TEXTURE_POOL_CHROMIUM, | 7970 GL_TEXTURE_POOL_CHROMIUM, |
| 7955 GL_NONE); | 7971 GL_NONE); |
| 7956 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7972 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 7957 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 7973 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 7958 } | 7974 } |
| 7959 | 7975 |
| 7960 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) { | 7976 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) { |
| 7961 InitDecoder( | 7977 InitDecoder( |
| 7962 "GL_CHROMIUM_async_pixel_transfers", // extensions | 7978 "GL_CHROMIUM_async_pixel_transfers", // extensions |
| 7963 false, false, false, // has alpha/depth/stencil | 7979 false, false, false, // has alpha/depth/stencil |
| 7964 false, false, false, // request alpha/depth/stencil | 7980 false, false, false, // request alpha/depth/stencil |
| 7965 true); // bind generates resource | 7981 true); // bind generates resource |
| 7966 | 7982 |
| 7967 // Set up the texture. | 7983 // Set up the texture. |
| 7968 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7984 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7969 Texture* info = GetTexture(client_texture_id_); | 7985 Texture* texture = GetTexture(client_texture_id_); |
| 7970 | 7986 |
| 7971 // Set a mock Async delegate | 7987 // Set a mock Async delegate |
| 7972 // Async state is returned as a scoped_ptr, but we keep a raw copy. | 7988 // Async state is returned as a scoped_ptr, but we keep a raw copy. |
| 7973 StrictMock<gfx::MockAsyncPixelTransferDelegate>* delegate = | 7989 StrictMock<gfx::MockAsyncPixelTransferDelegate>* delegate = |
| 7974 new StrictMock<gfx::MockAsyncPixelTransferDelegate>; | 7990 new StrictMock<gfx::MockAsyncPixelTransferDelegate>; |
| 7975 decoder_->SetAsyncPixelTransferDelegate(delegate); | 7991 decoder_->SetAsyncPixelTransferDelegate(delegate); |
| 7976 StrictMock<gfx::MockAsyncPixelTransferState>* state = NULL; | 7992 StrictMock<gfx::MockAsyncPixelTransferState>* state = NULL; |
| 7977 | 7993 |
| 7978 // Tex(Sub)Image2D upload commands. | 7994 // Tex(Sub)Image2D upload commands. |
| 7979 AsyncTexImage2DCHROMIUM teximage_cmd; | 7995 AsyncTexImage2DCHROMIUM teximage_cmd; |
| 7980 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, | 7996 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, |
| 7981 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 7997 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
| 7982 AsyncTexSubImage2DCHROMIUM texsubimage_cmd; | 7998 AsyncTexSubImage2DCHROMIUM texsubimage_cmd; |
| 7983 texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA, | 7999 texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA, |
| 7984 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 8000 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
| 7985 WaitAsyncTexImage2DCHROMIUM wait_cmd; | 8001 WaitAsyncTexImage2DCHROMIUM wait_cmd; |
| 7986 wait_cmd.Init(GL_TEXTURE_2D); | 8002 wait_cmd.Init(GL_TEXTURE_2D); |
| 7987 gfx::AsyncTexImage2DParams teximage_params = | 8003 gfx::AsyncTexImage2DParams teximage_params = |
| 7988 {GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE}; | 8004 {GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE}; |
| 7989 | 8005 |
| 7990 // No transfer state exists initially. | 8006 // No transfer state exists initially. |
| 7991 EXPECT_FALSE(info->GetAsyncTransferState()); | 8007 EXPECT_FALSE(texture->GetAsyncTransferState()); |
| 7992 | 8008 |
| 7993 // AsyncTexImage2D | 8009 // AsyncTexImage2D |
| 7994 { | 8010 { |
| 7995 // Create transfer state since it doesn't exist. | 8011 // Create transfer state since it doesn't exist. |
| 7996 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) | 8012 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) |
| 7997 .WillOnce(Return( | 8013 .WillOnce(Return( |
| 7998 state = new StrictMock<gfx::MockAsyncPixelTransferState>)) | 8014 state = new StrictMock<gfx::MockAsyncPixelTransferState>)) |
| 7999 .RetiresOnSaturation(); | 8015 .RetiresOnSaturation(); |
| 8000 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _)) | 8016 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _)) |
| 8001 .RetiresOnSaturation(); | 8017 .RetiresOnSaturation(); |
| 8002 // Command succeeds. | 8018 // Command succeeds. |
| 8003 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8019 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
| 8004 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8020 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8005 EXPECT_TRUE(info->GetAsyncTransferState()); | 8021 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8006 EXPECT_TRUE(info->IsImmutable()); | 8022 EXPECT_TRUE(texture->IsImmutable()); |
| 8007 // The texture is safe but the level has not been defined yet. | 8023 // The texture is safe but the level has not been defined yet. |
| 8008 EXPECT_TRUE(info->SafeToRenderFrom()); | 8024 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8009 GLsizei width, height; | 8025 GLsizei width, height; |
| 8010 EXPECT_FALSE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 8026 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 8011 } | 8027 } |
| 8012 { | 8028 { |
| 8013 // Async redefinitions are not allowed! | 8029 // Async redefinitions are not allowed! |
| 8014 // Command fails. | 8030 // Command fails. |
| 8015 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8031 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
| 8016 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 8032 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 8017 EXPECT_TRUE(info->GetAsyncTransferState()); | 8033 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8018 EXPECT_TRUE(info->IsImmutable()); | 8034 EXPECT_TRUE(texture->IsImmutable()); |
| 8019 EXPECT_TRUE(info->SafeToRenderFrom()); | 8035 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8020 } | 8036 } |
| 8021 | 8037 |
| 8022 // Lazy binding/defining of the async transfer | 8038 // Lazy binding/defining of the async transfer |
| 8023 { | 8039 { |
| 8024 // We the code should check that the transfer is done, | 8040 // We the code should check that the transfer is done, |
| 8025 // call bind transfer on it, and update the texture info. | 8041 // call bind transfer on it, and update the texture texture. |
| 8026 InSequence scoped_in_sequence; | 8042 InSequence scoped_in_sequence; |
| 8027 EXPECT_CALL(*state, TransferIsInProgress()) | 8043 EXPECT_CALL(*state, TransferIsInProgress()) |
| 8028 .WillOnce(Return(false)) | 8044 .WillOnce(Return(false)) |
| 8029 .RetiresOnSaturation(); | 8045 .RetiresOnSaturation(); |
| 8030 EXPECT_CALL(*state, BindTransfer(_)) | 8046 EXPECT_CALL(*state, BindTransfer(_)) |
| 8031 .WillOnce(SetArgPointee<0>(teximage_params)) | 8047 .WillOnce(SetArgPointee<0>(teximage_params)) |
| 8032 .RetiresOnSaturation(); | 8048 .RetiresOnSaturation(); |
| 8033 TextureManager* manager = decoder_->GetContextGroup()->texture_manager(); | 8049 TextureManager* manager = decoder_->GetContextGroup()->texture_manager(); |
| 8034 bool texture_dirty, framebuffer_dirty; | 8050 bool texture_dirty, framebuffer_dirty; |
| 8035 manager->BindFinishedAsyncPixelTransfers(&texture_dirty, | 8051 manager->BindFinishedAsyncPixelTransfers(&texture_dirty, |
| 8036 &framebuffer_dirty); | 8052 &framebuffer_dirty); |
| 8037 EXPECT_TRUE(texture_dirty); | 8053 EXPECT_TRUE(texture_dirty); |
| 8038 EXPECT_FALSE(framebuffer_dirty); | 8054 EXPECT_FALSE(framebuffer_dirty); |
| 8039 // Texture is safe, and has the right size etc. | 8055 // Texture is safe, and has the right size etc. |
| 8040 EXPECT_TRUE(info->SafeToRenderFrom()); | 8056 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8041 GLsizei width, height; | 8057 GLsizei width, height; |
| 8042 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 8058 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 8043 EXPECT_EQ(width, 8); | 8059 EXPECT_EQ(width, 8); |
| 8044 EXPECT_EQ(height, 8); | 8060 EXPECT_EQ(height, 8); |
| 8045 } | 8061 } |
| 8046 | 8062 |
| 8047 // AsyncTexSubImage2D | 8063 // AsyncTexSubImage2D |
| 8048 info->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); | 8064 texture->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); |
| 8049 info->SetImmutable(false); | 8065 texture->SetImmutable(false); |
| 8050 { | 8066 { |
| 8051 // Create transfer state since it doesn't exist. | 8067 // Create transfer state since it doesn't exist. |
| 8052 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) | 8068 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) |
| 8053 .WillOnce(Return( | 8069 .WillOnce(Return( |
| 8054 state = new StrictMock<gfx::MockAsyncPixelTransferState>)) | 8070 state = new StrictMock<gfx::MockAsyncPixelTransferState>)) |
| 8055 .RetiresOnSaturation(); | 8071 .RetiresOnSaturation(); |
| 8056 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) | 8072 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) |
| 8057 .RetiresOnSaturation(); | 8073 .RetiresOnSaturation(); |
| 8058 // Command succeeds. | 8074 // Command succeeds. |
| 8059 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8075 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
| 8060 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8076 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8061 EXPECT_TRUE(info->GetAsyncTransferState()); | 8077 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8062 EXPECT_TRUE(info->IsImmutable()); | 8078 EXPECT_TRUE(texture->IsImmutable()); |
| 8063 EXPECT_TRUE(info->SafeToRenderFrom()); | 8079 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8064 } | 8080 } |
| 8065 { | 8081 { |
| 8066 // No transfer is in progress. | 8082 // No transfer is in progress. |
| 8067 EXPECT_CALL(*state, TransferIsInProgress()) | 8083 EXPECT_CALL(*state, TransferIsInProgress()) |
| 8068 .WillOnce(Return(false)) // texSubImage validation | 8084 .WillOnce(Return(false)) // texSubImage validation |
| 8069 .WillOnce(Return(false)) // async validation | 8085 .WillOnce(Return(false)) // async validation |
| 8070 .RetiresOnSaturation(); | 8086 .RetiresOnSaturation(); |
| 8071 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) | 8087 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) |
| 8072 .RetiresOnSaturation(); | 8088 .RetiresOnSaturation(); |
| 8073 // Command succeeds. | 8089 // Command succeeds. |
| 8074 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8090 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
| 8075 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8091 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8076 EXPECT_TRUE(info->GetAsyncTransferState()); | 8092 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8077 EXPECT_TRUE(info->IsImmutable()); | 8093 EXPECT_TRUE(texture->IsImmutable()); |
| 8078 EXPECT_TRUE(info->SafeToRenderFrom()); | 8094 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8079 } | 8095 } |
| 8080 { | 8096 { |
| 8081 // A transfer is still in progress! | 8097 // A transfer is still in progress! |
| 8082 EXPECT_CALL(*state, TransferIsInProgress()) | 8098 EXPECT_CALL(*state, TransferIsInProgress()) |
| 8083 .WillOnce(Return(true)) | 8099 .WillOnce(Return(true)) |
| 8084 .RetiresOnSaturation(); | 8100 .RetiresOnSaturation(); |
| 8085 // No async call, command fails. | 8101 // No async call, command fails. |
| 8086 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8102 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
| 8087 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 8103 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 8088 EXPECT_TRUE(info->GetAsyncTransferState()); | 8104 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8089 EXPECT_TRUE(info->IsImmutable()); | 8105 EXPECT_TRUE(texture->IsImmutable()); |
| 8090 EXPECT_TRUE(info->SafeToRenderFrom()); | 8106 EXPECT_TRUE(texture->SafeToRenderFrom()); |
| 8091 } | 8107 } |
| 8092 | 8108 |
| 8093 // WaitAsyncTexImage2D | 8109 // WaitAsyncTexImage2D |
| 8094 { | 8110 { |
| 8095 // Get a fresh texture since the existing texture cannot be respecified | 8111 // Get a fresh texture since the existing texture cannot be respecified |
| 8096 // asynchronously and AsyncTexSubImage2D does not involved binding. | 8112 // asynchronously and AsyncTexSubImage2D does not involved binding. |
| 8097 EXPECT_CALL(*gl_, GenTextures(1, _)) | 8113 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 8098 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); | 8114 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); |
| 8099 info->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); | 8115 texture->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); |
| 8100 DoDeleteTexture(client_texture_id_, kServiceTextureId); | 8116 DoDeleteTexture(client_texture_id_, kServiceTextureId); |
| 8101 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8117 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8102 info = GetTexture(client_texture_id_); | 8118 texture = GetTexture(client_texture_id_); |
| 8103 info->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); | 8119 texture->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); |
| 8104 info->SetImmutable(false); | 8120 texture->SetImmutable(false); |
| 8105 // Create transfer state since it doesn't exist. | 8121 // Create transfer state since it doesn't exist. |
| 8106 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) | 8122 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) |
| 8107 .WillOnce(Return( | 8123 .WillOnce(Return( |
| 8108 state = new StrictMock<gfx::MockAsyncPixelTransferState>)) | 8124 state = new StrictMock<gfx::MockAsyncPixelTransferState>)) |
| 8109 .RetiresOnSaturation(); | 8125 .RetiresOnSaturation(); |
| 8110 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _)) | 8126 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _)) |
| 8111 .RetiresOnSaturation(); | 8127 .RetiresOnSaturation(); |
| 8112 // Start async transfer. | 8128 // Start async transfer. |
| 8113 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8129 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
| 8114 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8130 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8115 EXPECT_TRUE(info->GetAsyncTransferState()); | 8131 EXPECT_TRUE(texture->GetAsyncTransferState()); |
| 8116 EXPECT_TRUE(info->IsImmutable()); | 8132 EXPECT_TRUE(texture->IsImmutable()); |
| 8117 // Wait for completion. | 8133 // Wait for completion. |
| 8118 EXPECT_CALL(*delegate, WaitForTransferCompletion(state)); | 8134 EXPECT_CALL(*delegate, WaitForTransferCompletion(state)); |
| 8119 EXPECT_CALL(*state, TransferIsInProgress()) | 8135 EXPECT_CALL(*state, TransferIsInProgress()) |
| 8120 .WillOnce(Return(false)) | 8136 .WillOnce(Return(false)) |
| 8121 .RetiresOnSaturation(); | 8137 .RetiresOnSaturation(); |
| 8122 EXPECT_CALL(*state, BindTransfer(_)) | 8138 EXPECT_CALL(*state, BindTransfer(_)) |
| 8123 .WillOnce(SetArgPointee<0>(teximage_params)) | 8139 .WillOnce(SetArgPointee<0>(teximage_params)) |
| 8124 .RetiresOnSaturation(); | 8140 .RetiresOnSaturation(); |
| 8125 // State restoration after binding. | 8141 // State restoration after binding. |
| 8126 EXPECT_CALL(*gl_, ActiveTexture(_)); | 8142 EXPECT_CALL(*gl_, ActiveTexture(_)); |
| 8127 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, _)); | 8143 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, _)); |
| 8128 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); | 8144 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); |
| 8129 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8145 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8130 } | 8146 } |
| 8131 | 8147 |
| 8132 decoder_->SetAsyncPixelTransferDelegate(NULL); | 8148 decoder_->SetAsyncPixelTransferDelegate(NULL); |
| 8133 info->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); | 8149 texture->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); |
| 8134 } | 8150 } |
| 8135 | 8151 |
| 8136 namespace { | 8152 namespace { |
| 8137 | 8153 |
| 8138 class SizeOnlyMemoryTracker : public MemoryTracker { | 8154 class SizeOnlyMemoryTracker : public MemoryTracker { |
| 8139 public: | 8155 public: |
| 8140 SizeOnlyMemoryTracker() { | 8156 SizeOnlyMemoryTracker() { |
| 8141 // These are the default textures. 1 for TEXTURE_2D and 6 faces for | 8157 // These are the default textures. 1 for TEXTURE_2D and 6 faces for |
| 8142 // TEXTURE_CUBE_MAP. | 8158 // TEXTURE_CUBE_MAP. |
| 8143 const size_t kInitialUnmanagedPoolSize = 7 * 4; | 8159 const size_t kInitialUnmanagedPoolSize = 7 * 4; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8416 // TODO(gman): TexImage2DImmediate | 8432 // TODO(gman): TexImage2DImmediate |
| 8417 | 8433 |
| 8418 // TODO(gman): TexSubImage2DImmediate | 8434 // TODO(gman): TexSubImage2DImmediate |
| 8419 | 8435 |
| 8420 // TODO(gman): UseProgram | 8436 // TODO(gman): UseProgram |
| 8421 | 8437 |
| 8422 // TODO(gman): SwapBuffers | 8438 // TODO(gman): SwapBuffers |
| 8423 | 8439 |
| 8424 } // namespace gles2 | 8440 } // namespace gles2 |
| 8425 } // namespace gpu | 8441 } // namespace gpu |
| OLD | NEW |