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