Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(795)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

Issue 8676048: Add unit test to verify a texture can be reused with stream textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.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/gl_mock.h" 10 #include "gpu/command_buffer/common/gl_mock.h"
(...skipping 4856 matching lines...) Expand 10 before | Expand all | Expand 10 after
4867 4867
4868 TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_); 4868 TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
4869 info->SetStreamTexture(true); 4869 info->SetStreamTexture(true);
4870 4870
4871 DestroyStreamTextureCHROMIUM cmd2; 4871 DestroyStreamTextureCHROMIUM cmd2;
4872 cmd2.Init(client_texture_id_); 4872 cmd2.Init(client_texture_id_);
4873 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2)); 4873 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2));
4874 GetGLError(); // ignore internal error 4874 GetGLError(); // ignore internal error
4875 } 4875 }
4876 4876
4877 TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) {
4878 const GLuint kObjectId = 123;
4879 InitDecoder(
4880 "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
4881 false, // has alpha
4882 false, // has depth
4883 false, // has stencil
4884 false, // request alpha
4885 false, // request depth
4886 false, // request stencil
4887 true); // bind generates resource
4888
4889 StrictMock<MockStreamTextureManager> manager;
4890 StrictMock<MockStreamTexture> texture;
4891 decoder_->SetStreamTextureManager(&manager);
4892
4893 EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId))
4894 .WillOnce(Return(&texture))
4895 .RetiresOnSaturation();
4896 EXPECT_CALL(texture, Update())
4897 .Times(1)
4898 .RetiresOnSaturation();
4899 EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId))
4900 .Times(1)
4901 .RetiresOnSaturation();
4902 EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId,
4903 client_texture_id_))
4904 .WillOnce(Return(kObjectId))
4905 .RetiresOnSaturation();
4906
4907 TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
4908 info->SetStreamTexture(true);
4909
4910 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
4911 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4912
4913 DestroyStreamTextureCHROMIUM cmd;
4914 cmd.Init(client_texture_id_);
4915 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4916 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4917 EXPECT_FALSE(info->IsStreamTexture());
4918
4919 CreateStreamTextureCHROMIUM cmd2;
4920 cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
4921 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
4922 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4923 EXPECT_TRUE(info->IsStreamTexture());
4924 }
4925
4877 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { 4926 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
4878 InitDecoder( 4927 InitDecoder(
4879 "GL_ARB_texture_rectangle", // extensions 4928 "GL_ARB_texture_rectangle", // extensions
4880 false, // has alpha 4929 false, // has alpha
4881 false, // has depth 4930 false, // has depth
4882 false, // has stencil 4931 false, // has stencil
4883 false, // request alpha 4932 false, // request alpha
4884 false, // request depth 4933 false, // request depth
4885 false, // request stencil 4934 false, // request stencil
4886 true); // bind generates resource 4935 true); // bind generates resource
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
5657 // TODO(gman): TexImage2DImmediate 5706 // TODO(gman): TexImage2DImmediate
5658 5707
5659 // TODO(gman): TexSubImage2DImmediate 5708 // TODO(gman): TexSubImage2DImmediate
5660 5709
5661 // TODO(gman): UseProgram 5710 // TODO(gman): UseProgram
5662 5711
5663 // TODO(gman): SwapBuffers 5712 // TODO(gman): SwapBuffers
5664 5713
5665 } // namespace gles2 5714 } // namespace gles2
5666 } // namespace gpu 5715 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698