| 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 7961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7972 decoder_->SetAsyncPixelTransferDelegate(delegate); | 7972 decoder_->SetAsyncPixelTransferDelegate(delegate); |
| 7973 StrictMock<gfx::MockAsyncPixelTransferState>* state = NULL; | 7973 StrictMock<gfx::MockAsyncPixelTransferState>* state = NULL; |
| 7974 | 7974 |
| 7975 // Tex(Sub)Image2D upload commands. | 7975 // Tex(Sub)Image2D upload commands. |
| 7976 AsyncTexImage2DCHROMIUM teximage_cmd; | 7976 AsyncTexImage2DCHROMIUM teximage_cmd; |
| 7977 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, | 7977 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, |
| 7978 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 7978 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
| 7979 AsyncTexSubImage2DCHROMIUM texsubimage_cmd; | 7979 AsyncTexSubImage2DCHROMIUM texsubimage_cmd; |
| 7980 texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA, | 7980 texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA, |
| 7981 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 7981 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
| 7982 WaitAsyncTexImage2DCHROMIUM wait_cmd; |
| 7983 wait_cmd.Init(GL_TEXTURE_2D); |
| 7982 gfx::AsyncTexImage2DParams teximage_params = | 7984 gfx::AsyncTexImage2DParams teximage_params = |
| 7983 {GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE}; | 7985 {GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE}; |
| 7984 | 7986 |
| 7985 // No transfer state exists initially. | 7987 // No transfer state exists initially. |
| 7986 EXPECT_FALSE(info->GetAsyncTransferState()); | 7988 EXPECT_FALSE(info->GetAsyncTransferState()); |
| 7987 | 7989 |
| 7988 // AsyncTexImage2D | 7990 // AsyncTexImage2D |
| 7989 { | 7991 { |
| 7990 // Create transfer state since it doesn't exist. | 7992 // Create transfer state since it doesn't exist. |
| 7991 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) | 7993 EXPECT_CALL(*delegate, CreateRawPixelTransferState(kServiceTextureId)) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8078 .WillOnce(Return(true)) | 8080 .WillOnce(Return(true)) |
| 8079 .RetiresOnSaturation(); | 8081 .RetiresOnSaturation(); |
| 8080 // No async call, command fails. | 8082 // No async call, command fails. |
| 8081 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8083 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
| 8082 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 8084 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 8083 EXPECT_TRUE(info->GetAsyncTransferState()); | 8085 EXPECT_TRUE(info->GetAsyncTransferState()); |
| 8084 EXPECT_TRUE(info->IsImmutable()); | 8086 EXPECT_TRUE(info->IsImmutable()); |
| 8085 EXPECT_TRUE(info->SafeToRenderFrom()); | 8087 EXPECT_TRUE(info->SafeToRenderFrom()); |
| 8086 } | 8088 } |
| 8087 | 8089 |
| 8090 // WaitAsyncTexSubImage2D |
| 8091 { |
| 8092 // Command succeeds. |
| 8093 EXPECT_CALL(*delegate, WaitForTransferCompletion(state)); |
| 8094 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); |
| 8095 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8096 } |
| 8097 |
| 8088 decoder_->SetAsyncPixelTransferDelegate(NULL); | 8098 decoder_->SetAsyncPixelTransferDelegate(NULL); |
| 8089 info->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); | 8099 info->SetAsyncTransferState(scoped_ptr<gfx::AsyncPixelTransferState>()); |
| 8090 } | 8100 } |
| 8091 | 8101 |
| 8092 namespace { | 8102 namespace { |
| 8093 | 8103 |
| 8094 class SizeOnlyMemoryTracker : public MemoryTracker { | 8104 class SizeOnlyMemoryTracker : public MemoryTracker { |
| 8095 public: | 8105 public: |
| 8096 SizeOnlyMemoryTracker() { | 8106 SizeOnlyMemoryTracker() { |
| 8097 // These are the default textures. 1 for TEXTURE_2D and 6 faces for | 8107 // These are the default textures. 1 for TEXTURE_2D and 6 faces for |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8372 // TODO(gman): TexImage2DImmediate | 8382 // TODO(gman): TexImage2DImmediate |
| 8373 | 8383 |
| 8374 // TODO(gman): TexSubImage2DImmediate | 8384 // TODO(gman): TexSubImage2DImmediate |
| 8375 | 8385 |
| 8376 // TODO(gman): UseProgram | 8386 // TODO(gman): UseProgram |
| 8377 | 8387 |
| 8378 // TODO(gman): SwapBuffers | 8388 // TODO(gman): SwapBuffers |
| 8379 | 8389 |
| 8380 } // namespace gles2 | 8390 } // namespace gles2 |
| 8381 } // namespace gpu | 8391 } // namespace gpu |
| OLD | NEW |