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