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 8068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8079 // Set up the texture. | 8079 // Set up the texture. |
8080 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8080 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
8081 TextureRef* texture_ref = GetTexture(client_texture_id_); | 8081 TextureRef* texture_ref = GetTexture(client_texture_id_); |
8082 Texture* texture = texture_ref->texture(); | 8082 Texture* texture = texture_ref->texture(); |
8083 | 8083 |
8084 // Set a mock Async delegate | 8084 // Set a mock Async delegate |
8085 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = | 8085 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = |
8086 new StrictMock<gpu::MockAsyncPixelTransferManager>; | 8086 new StrictMock<gpu::MockAsyncPixelTransferManager>; |
8087 manager->Initialize(group().texture_manager()); | 8087 manager->Initialize(group().texture_manager()); |
8088 decoder_->SetAsyncPixelTransferManagerForTest(manager); | 8088 decoder_->SetAsyncPixelTransferManagerForTest(manager); |
8089 scoped_ptr<StrictMock<gpu::MockAsyncPixelTransferDelegate> > delegate( | 8089 StrictMock<gpu::MockAsyncPixelTransferDelegate>* delegate = NULL; |
8090 new StrictMock<gpu::MockAsyncPixelTransferDelegate>); | |
8091 EXPECT_CALL(*manager, GetAsyncPixelTransferDelegate()) | |
8092 .WillRepeatedly(Return(delegate.get())); | |
8093 StrictMock<gpu::MockAsyncPixelTransferState>* state = NULL; | |
8094 | 8090 |
8095 // Tex(Sub)Image2D upload commands. | 8091 // Tex(Sub)Image2D upload commands. |
8096 AsyncTexImage2DCHROMIUM teximage_cmd; | 8092 AsyncTexImage2DCHROMIUM teximage_cmd; |
8097 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, | 8093 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, |
8098 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 8094 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
8099 AsyncTexSubImage2DCHROMIUM texsubimage_cmd; | 8095 AsyncTexSubImage2DCHROMIUM texsubimage_cmd; |
8100 texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA, | 8096 texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA, |
8101 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 8097 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
8102 WaitAsyncTexImage2DCHROMIUM wait_cmd; | 8098 WaitAsyncTexImage2DCHROMIUM wait_cmd; |
8103 wait_cmd.Init(GL_TEXTURE_2D); | 8099 wait_cmd.Init(GL_TEXTURE_2D); |
8104 | 8100 |
8105 // No transfer state exists initially. | 8101 // No transfer state exists initially. |
8106 EXPECT_FALSE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8102 EXPECT_FALSE( |
8107 texture_ref)); | 8103 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8104 texture_ref)); |
8108 | 8105 |
8109 base::Closure bind_callback; | 8106 base::Closure bind_callback; |
8110 | 8107 |
8111 // AsyncTexImage2D | 8108 // AsyncTexImage2D |
8112 { | 8109 { |
8113 // Create transfer state since it doesn't exist. | 8110 // Create transfer state since it doesn't exist. |
8114 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) | 8111 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) |
8115 .WillOnce(Return( | 8112 .WillOnce(Return( |
8116 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) | 8113 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) |
8117 .RetiresOnSaturation(); | 8114 .RetiresOnSaturation(); |
8118 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _, _)) | 8115 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)) |
8119 .WillOnce(SaveArg<3>(&bind_callback)) | 8116 .WillOnce(SaveArg<2>(&bind_callback)) |
8120 .RetiresOnSaturation(); | 8117 .RetiresOnSaturation(); |
8121 // Command succeeds. | 8118 // Command succeeds. |
8122 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8119 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
8123 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8120 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
8124 EXPECT_TRUE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8121 EXPECT_EQ( |
8125 texture_ref)); | 8122 delegate, |
| 8123 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8124 texture_ref)); |
8126 EXPECT_TRUE(texture->IsImmutable()); | 8125 EXPECT_TRUE(texture->IsImmutable()); |
8127 // The texture is safe but the level has not been defined yet. | 8126 // The texture is safe but the level has not been defined yet. |
8128 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8127 EXPECT_TRUE(texture->SafeToRenderFrom()); |
8129 GLsizei width, height; | 8128 GLsizei width, height; |
8130 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 8129 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
8131 } | 8130 } |
8132 { | 8131 { |
8133 // Async redefinitions are not allowed! | 8132 // Async redefinitions are not allowed! |
8134 // Command fails. | 8133 // Command fails. |
8135 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8134 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
8136 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 8135 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
8137 EXPECT_TRUE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8136 EXPECT_EQ( |
8138 texture_ref)); | 8137 delegate, |
| 8138 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8139 texture_ref)); |
8139 EXPECT_TRUE(texture->IsImmutable()); | 8140 EXPECT_TRUE(texture->IsImmutable()); |
8140 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8141 EXPECT_TRUE(texture->SafeToRenderFrom()); |
8141 } | 8142 } |
8142 | 8143 |
8143 // Binding/defining of the async transfer | 8144 // Binding/defining of the async transfer |
8144 { | 8145 { |
8145 // TODO(epenner): We should check that the delegate gets the | 8146 // TODO(epenner): We should check that the manager gets the |
8146 // BindCompletedAsyncTransfers() call, which is required to | 8147 // BindCompletedAsyncTransfers() call, which is required to |
8147 // guarantee the delegate calls the bind callback. | 8148 // guarantee the delegate calls the bind callback. |
8148 | 8149 |
8149 // Simulate the bind callback from the delegate. | 8150 // Simulate the bind callback from the delegate. |
8150 bind_callback.Run(); | 8151 bind_callback.Run(); |
8151 | 8152 |
8152 // After the bind callback is run, the texture is safe, | 8153 // After the bind callback is run, the texture is safe, |
8153 // and has the right size etc. | 8154 // and has the right size etc. |
8154 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8155 EXPECT_TRUE(texture->SafeToRenderFrom()); |
8155 GLsizei width, height; | 8156 GLsizei width, height; |
8156 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 8157 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
8157 EXPECT_EQ(width, 8); | 8158 EXPECT_EQ(width, 8); |
8158 EXPECT_EQ(height, 8); | 8159 EXPECT_EQ(height, 8); |
8159 } | 8160 } |
8160 | 8161 |
8161 // AsyncTexSubImage2D | 8162 // AsyncTexSubImage2D |
8162 decoder_->GetAsyncPixelTransferManager() | 8163 decoder_->GetAsyncPixelTransferManager() |
8163 ->ClearPixelTransferStateForTest(texture_ref); | 8164 ->ClearPixelTransferDelegateForTest(texture_ref); |
8164 texture->SetImmutable(false); | 8165 texture->SetImmutable(false); |
8165 { | 8166 { |
8166 // Create transfer state since it doesn't exist. | 8167 // Create transfer state since it doesn't exist. |
8167 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) | 8168 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) |
8168 .WillOnce(Return( | 8169 .WillOnce(Return( |
8169 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) | 8170 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) |
8170 .RetiresOnSaturation(); | 8171 .RetiresOnSaturation(); |
8171 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) | 8172 EXPECT_CALL(*delegate, AsyncTexSubImage2D(_, _)) |
8172 .RetiresOnSaturation(); | 8173 .RetiresOnSaturation(); |
8173 // Command succeeds. | 8174 // Command succeeds. |
8174 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8175 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
8175 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8176 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
8176 EXPECT_TRUE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8177 EXPECT_EQ( |
8177 texture_ref)); | 8178 delegate, |
| 8179 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8180 texture_ref)); |
8178 EXPECT_TRUE(texture->IsImmutable()); | 8181 EXPECT_TRUE(texture->IsImmutable()); |
8179 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8182 EXPECT_TRUE(texture->SafeToRenderFrom()); |
8180 } | 8183 } |
8181 { | 8184 { |
8182 // No transfer is in progress. | 8185 // No transfer is in progress. |
8183 EXPECT_CALL(*state, TransferIsInProgress()) | 8186 EXPECT_CALL(*delegate, TransferIsInProgress()) |
8184 .WillOnce(Return(false)) // texSubImage validation | 8187 .WillOnce(Return(false)) // texSubImage validation |
8185 .WillOnce(Return(false)) // async validation | 8188 .WillOnce(Return(false)) // async validation |
8186 .RetiresOnSaturation(); | 8189 .RetiresOnSaturation(); |
8187 EXPECT_CALL(*delegate, AsyncTexSubImage2D(state, _, _)) | 8190 EXPECT_CALL(*delegate, AsyncTexSubImage2D(_, _)) |
8188 .RetiresOnSaturation(); | 8191 .RetiresOnSaturation(); |
8189 // Command succeeds. | 8192 // Command succeeds. |
8190 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8193 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
8191 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8194 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
8192 EXPECT_TRUE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8195 EXPECT_EQ( |
8193 texture_ref)); | 8196 delegate, |
| 8197 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8198 texture_ref)); |
8194 EXPECT_TRUE(texture->IsImmutable()); | 8199 EXPECT_TRUE(texture->IsImmutable()); |
8195 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8200 EXPECT_TRUE(texture->SafeToRenderFrom()); |
8196 } | 8201 } |
8197 { | 8202 { |
8198 // A transfer is still in progress! | 8203 // A transfer is still in progress! |
8199 EXPECT_CALL(*state, TransferIsInProgress()) | 8204 EXPECT_CALL(*delegate, TransferIsInProgress()) |
8200 .WillOnce(Return(true)) | 8205 .WillOnce(Return(true)) |
8201 .RetiresOnSaturation(); | 8206 .RetiresOnSaturation(); |
8202 // No async call, command fails. | 8207 // No async call, command fails. |
8203 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); | 8208 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); |
8204 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 8209 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
8205 EXPECT_TRUE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8210 EXPECT_EQ( |
8206 texture_ref)); | 8211 delegate, |
| 8212 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8213 texture_ref)); |
8207 EXPECT_TRUE(texture->IsImmutable()); | 8214 EXPECT_TRUE(texture->IsImmutable()); |
8208 EXPECT_TRUE(texture->SafeToRenderFrom()); | 8215 EXPECT_TRUE(texture->SafeToRenderFrom()); |
8209 } | 8216 } |
8210 | 8217 |
8211 // Delete state on DeleteTexture. | 8218 // Delete delegate on DeleteTexture. |
8212 { | 8219 { |
8213 EXPECT_CALL(*state, Destroy()).RetiresOnSaturation(); | 8220 EXPECT_CALL(*delegate, Destroy()).RetiresOnSaturation(); |
8214 DoDeleteTexture(client_texture_id_, kServiceTextureId); | 8221 DoDeleteTexture(client_texture_id_, kServiceTextureId); |
8215 EXPECT_FALSE( | 8222 EXPECT_FALSE( |
8216 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8223 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
8217 texture_ref)); | 8224 texture_ref)); |
8218 state = NULL; | 8225 delegate = NULL; |
8219 } | 8226 } |
8220 | 8227 |
8221 // WaitAsyncTexImage2D | 8228 // WaitAsyncTexImage2D |
8222 { | 8229 { |
8223 // Get a fresh texture since the existing texture cannot be respecified | 8230 // Get a fresh texture since the existing texture cannot be respecified |
8224 // asynchronously and AsyncTexSubImage2D does not involved binding. | 8231 // asynchronously and AsyncTexSubImage2D does not involved binding. |
8225 EXPECT_CALL(*gl_, GenTextures(1, _)) | 8232 EXPECT_CALL(*gl_, GenTextures(1, _)) |
8226 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); | 8233 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); |
8227 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8234 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
8228 texture_ref = GetTexture(client_texture_id_); | 8235 texture_ref = GetTexture(client_texture_id_); |
8229 texture = texture_ref->texture(); | 8236 texture = texture_ref->texture(); |
8230 decoder_->GetAsyncPixelTransferManager() | |
8231 ->ClearPixelTransferStateForTest(texture_ref); | |
8232 texture->SetImmutable(false); | 8237 texture->SetImmutable(false); |
8233 // Create transfer state since it doesn't exist. | 8238 // Create transfer state since it doesn't exist. |
8234 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) | 8239 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) |
8235 .WillOnce(Return( | 8240 .WillOnce(Return( |
8236 state = new StrictMock<gpu::MockAsyncPixelTransferState>)) | 8241 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) |
8237 .RetiresOnSaturation(); | 8242 .RetiresOnSaturation(); |
8238 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _, _)) | 8243 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)) |
8239 .RetiresOnSaturation(); | 8244 .RetiresOnSaturation(); |
8240 // Start async transfer. | 8245 // Start async transfer. |
8241 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8246 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
8242 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8247 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
8243 EXPECT_TRUE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8248 EXPECT_EQ( |
8244 texture_ref)); | 8249 delegate, |
| 8250 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8251 texture_ref)); |
8245 | 8252 |
8246 EXPECT_TRUE(texture->IsImmutable()); | 8253 EXPECT_TRUE(texture->IsImmutable()); |
8247 // Wait for completion. | 8254 // Wait for completion. |
8248 EXPECT_CALL(*delegate, WaitForTransferCompletion(state)); | 8255 EXPECT_CALL(*delegate, WaitForTransferCompletion()); |
8249 EXPECT_CALL(*manager, BindCompletedAsyncTransfers()); | 8256 EXPECT_CALL(*manager, BindCompletedAsyncTransfers()); |
8250 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); | 8257 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd)); |
8251 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8258 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
8252 } | 8259 } |
8253 } | 8260 } |
8254 | 8261 |
8255 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) { | 8262 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) { |
8256 InitDecoder( | 8263 InitDecoder( |
8257 "GL_CHROMIUM_async_pixel_transfers", // extensions | 8264 "GL_CHROMIUM_async_pixel_transfers", // extensions |
8258 false, false, false, // has alpha/depth/stencil | 8265 false, false, false, // has alpha/depth/stencil |
8259 false, false, false, // request alpha/depth/stencil | 8266 false, false, false, // request alpha/depth/stencil |
8260 true); // bind generates resource | 8267 true); // bind generates resource |
8261 | 8268 |
8262 // Set up the texture. | 8269 // Set up the texture. |
8263 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8270 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
8264 TextureRef* texture_ref = GetTexture(client_texture_id_); | 8271 TextureRef* texture_ref = GetTexture(client_texture_id_); |
8265 | 8272 |
8266 // Set a mock Async delegate. | 8273 // Set a mock Async delegate. |
8267 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = | 8274 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = |
8268 new StrictMock<gpu::MockAsyncPixelTransferManager>; | 8275 new StrictMock<gpu::MockAsyncPixelTransferManager>; |
8269 manager->Initialize(group().texture_manager()); | 8276 manager->Initialize(group().texture_manager()); |
8270 decoder_->SetAsyncPixelTransferManagerForTest(manager); | 8277 decoder_->SetAsyncPixelTransferManagerForTest(manager); |
8271 scoped_ptr<StrictMock<gpu::MockAsyncPixelTransferDelegate> > delegate( | 8278 StrictMock<gpu::MockAsyncPixelTransferDelegate>* delegate = NULL; |
8272 new StrictMock<gpu::MockAsyncPixelTransferDelegate>); | |
8273 EXPECT_CALL(*manager, GetAsyncPixelTransferDelegate()) | |
8274 .WillRepeatedly(Return(delegate.get())); | |
8275 StrictMock<gpu::MockAsyncPixelTransferState>* state = NULL; | |
8276 | 8279 |
8277 AsyncTexImage2DCHROMIUM teximage_cmd; | 8280 AsyncTexImage2DCHROMIUM teximage_cmd; |
8278 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, | 8281 teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, |
8279 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); | 8282 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); |
8280 | 8283 |
8281 // No transfer state exists initially. | 8284 // No transfer delegate exists initially. |
8282 EXPECT_FALSE(decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8285 EXPECT_FALSE( |
8283 texture_ref)); | 8286 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
| 8287 texture_ref)); |
8284 | 8288 |
8285 // Create state on AsyncTexImage2D. | 8289 // Create delegate on AsyncTexImage2D. |
8286 { | 8290 { |
8287 EXPECT_CALL(*delegate, CreatePixelTransferState(kServiceTextureId, _)) | 8291 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) |
8288 .WillOnce( | 8292 .WillOnce(Return( |
8289 Return(state = new StrictMock<gpu::MockAsyncPixelTransferState>)) | 8293 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) |
8290 .RetiresOnSaturation(); | 8294 .RetiresOnSaturation(); |
8291 EXPECT_CALL(*delegate, AsyncTexImage2D(state, _, _, _)) | 8295 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation(); |
8292 .RetiresOnSaturation(); | |
8293 | 8296 |
8294 // Command succeeds. | 8297 // Command succeeds. |
8295 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); | 8298 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); |
8296 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8299 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
8297 } | 8300 } |
8298 | 8301 |
8299 // State is cached. | 8302 // Delegate is cached. |
8300 EXPECT_EQ(state, | 8303 EXPECT_EQ(delegate, |
8301 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferState( | 8304 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( |
8302 texture_ref)); | 8305 texture_ref)); |
8303 | 8306 |
8304 // Delete state on manager teardown. | 8307 // Delete delegate on manager teardown. |
8305 { | 8308 { |
8306 EXPECT_CALL(*state, Destroy()).RetiresOnSaturation(); | 8309 EXPECT_CALL(*delegate, Destroy()).RetiresOnSaturation(); |
8307 decoder_->ResetAsyncPixelTransferManagerForTest(); | 8310 decoder_->ResetAsyncPixelTransferManagerForTest(); |
8308 | 8311 |
8309 // Texture ref still valid. | 8312 // Texture ref still valid. |
8310 EXPECT_EQ(texture_ref, GetTexture(client_texture_id_)); | 8313 EXPECT_EQ(texture_ref, GetTexture(client_texture_id_)); |
8311 } | 8314 } |
8312 } | 8315 } |
8313 | 8316 |
8314 namespace { | 8317 namespace { |
8315 | 8318 |
8316 class SizeOnlyMemoryTracker : public MemoryTracker { | 8319 class SizeOnlyMemoryTracker : public MemoryTracker { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8639 // TODO(gman): TexImage2DImmediate | 8642 // TODO(gman): TexImage2DImmediate |
8640 | 8643 |
8641 // TODO(gman): TexSubImage2DImmediate | 8644 // TODO(gman): TexSubImage2DImmediate |
8642 | 8645 |
8643 // TODO(gman): UseProgram | 8646 // TODO(gman): UseProgram |
8644 | 8647 |
8645 // TODO(gman): SwapBuffers | 8648 // TODO(gman): SwapBuffers |
8646 | 8649 |
8647 } // namespace gles2 | 8650 } // namespace gles2 |
8648 } // namespace gpu | 8651 } // namespace gpu |
OLD | NEW |