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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 568 |
569 virtual void SetShaderCacheCallback( | 569 virtual void SetShaderCacheCallback( |
570 const ShaderCacheCallback& callback) OVERRIDE; | 570 const ShaderCacheCallback& callback) OVERRIDE; |
571 virtual void SetWaitSyncPointCallback( | 571 virtual void SetWaitSyncPointCallback( |
572 const WaitSyncPointCallback& callback) OVERRIDE; | 572 const WaitSyncPointCallback& callback) OVERRIDE; |
573 | 573 |
574 virtual void SetStreamTextureManager(StreamTextureManager* manager) OVERRIDE; | 574 virtual void SetStreamTextureManager(StreamTextureManager* manager) OVERRIDE; |
575 | 575 |
576 virtual AsyncPixelTransferDelegate* | 576 virtual AsyncPixelTransferDelegate* |
577 GetAsyncPixelTransferDelegate() OVERRIDE; | 577 GetAsyncPixelTransferDelegate() OVERRIDE; |
578 virtual void SetAsyncPixelTransferDelegateForTest( | |
579 AsyncPixelTransferDelegate* delegate) OVERRIDE; | |
580 virtual AsyncPixelTransferManager* | 578 virtual AsyncPixelTransferManager* |
581 GetAsyncPixelTransferManager() OVERRIDE; | 579 GetAsyncPixelTransferManager() OVERRIDE; |
582 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE; | 580 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE; |
| 581 virtual void SetAsyncPixelTransferManagerForTest( |
| 582 AsyncPixelTransferManager* manager) OVERRIDE; |
583 void ProcessFinishedAsyncTransfers(); | 583 void ProcessFinishedAsyncTransfers(); |
584 | 584 |
585 virtual bool GetServiceTextureId(uint32 client_texture_id, | 585 virtual bool GetServiceTextureId(uint32 client_texture_id, |
586 uint32* service_texture_id) OVERRIDE; | 586 uint32* service_texture_id) OVERRIDE; |
587 | 587 |
588 virtual uint32 GetTextureUploadCount() OVERRIDE; | 588 virtual uint32 GetTextureUploadCount() OVERRIDE; |
589 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; | 589 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; |
590 virtual base::TimeDelta GetTotalProcessingCommandsTime() OVERRIDE; | 590 virtual base::TimeDelta GetTotalProcessingCommandsTime() OVERRIDE; |
591 virtual void AddProcessingCommandsTime(base::TimeDelta) OVERRIDE; | 591 virtual void AddProcessingCommandsTime(base::TimeDelta) OVERRIDE; |
592 | 592 |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 } | 2469 } |
2470 | 2470 |
2471 // Only compositor contexts are known to use only the subset of GL | 2471 // Only compositor contexts are known to use only the subset of GL |
2472 // that can be safely migrated between the iGPU and the dGPU. Mark | 2472 // that can be safely migrated between the iGPU and the dGPU. Mark |
2473 // those contexts as safe to forcibly transition between the GPUs. | 2473 // those contexts as safe to forcibly transition between the GPUs. |
2474 // http://crbug.com/180876, http://crbug.com/227228 | 2474 // http://crbug.com/180876, http://crbug.com/227228 |
2475 if (!offscreen) | 2475 if (!offscreen) |
2476 context_->SetSafeToForceGpuSwitch(); | 2476 context_->SetSafeToForceGpuSwitch(); |
2477 | 2477 |
2478 async_pixel_transfer_manager_.reset( | 2478 async_pixel_transfer_manager_.reset( |
2479 new AsyncPixelTransferManager(texture_manager(), context.get())); | 2479 AsyncPixelTransferManager::Create(context.get())); |
| 2480 async_pixel_transfer_manager_->Initialize(texture_manager()); |
2480 | 2481 |
2481 return true; | 2482 return true; |
2482 } | 2483 } |
2483 | 2484 |
2484 void GLES2DecoderImpl::UpdateCapabilities() { | 2485 void GLES2DecoderImpl::UpdateCapabilities() { |
2485 util_.set_num_compressed_texture_formats( | 2486 util_.set_num_compressed_texture_formats( |
2486 validators_->compressed_texture_format.GetValues().size()); | 2487 validators_->compressed_texture_format.GetValues().size()); |
2487 util_.set_num_shader_binary_formats( | 2488 util_.set_num_shader_binary_formats( |
2488 validators_->shader_binary_format.GetValues().size()); | 2489 validators_->shader_binary_format.GetValues().size()); |
2489 } | 2490 } |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 | 3053 |
3053 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { | 3054 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { |
3054 stream_texture_manager_ = manager; | 3055 stream_texture_manager_ = manager; |
3055 } | 3056 } |
3056 | 3057 |
3057 AsyncPixelTransferDelegate* | 3058 AsyncPixelTransferDelegate* |
3058 GLES2DecoderImpl::GetAsyncPixelTransferDelegate() { | 3059 GLES2DecoderImpl::GetAsyncPixelTransferDelegate() { |
3059 return async_pixel_transfer_manager_->GetAsyncPixelTransferDelegate(); | 3060 return async_pixel_transfer_manager_->GetAsyncPixelTransferDelegate(); |
3060 } | 3061 } |
3061 | 3062 |
3062 void GLES2DecoderImpl::SetAsyncPixelTransferDelegateForTest( | |
3063 AsyncPixelTransferDelegate* delegate) { | |
3064 async_pixel_transfer_manager_->SetAsyncPixelTransferDelegateForTest(delegate); | |
3065 } | |
3066 | |
3067 AsyncPixelTransferManager* | 3063 AsyncPixelTransferManager* |
3068 GLES2DecoderImpl::GetAsyncPixelTransferManager() { | 3064 GLES2DecoderImpl::GetAsyncPixelTransferManager() { |
3069 return async_pixel_transfer_manager_.get(); | 3065 return async_pixel_transfer_manager_.get(); |
3070 } | 3066 } |
3071 | 3067 |
3072 void GLES2DecoderImpl::ResetAsyncPixelTransferManagerForTest() { | 3068 void GLES2DecoderImpl::ResetAsyncPixelTransferManagerForTest() { |
3073 async_pixel_transfer_manager_.reset(); | 3069 async_pixel_transfer_manager_.reset(); |
3074 } | 3070 } |
3075 | 3071 |
| 3072 void GLES2DecoderImpl::SetAsyncPixelTransferManagerForTest( |
| 3073 AsyncPixelTransferManager* manager) { |
| 3074 async_pixel_transfer_manager_ = make_scoped_ptr(manager); |
| 3075 } |
| 3076 |
3076 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, | 3077 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, |
3077 uint32* service_texture_id) { | 3078 uint32* service_texture_id) { |
3078 TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); | 3079 TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); |
3079 if (texture_ref) { | 3080 if (texture_ref) { |
3080 *service_texture_id = texture_ref->service_id(); | 3081 *service_texture_id = texture_ref->service_id(); |
3081 return true; | 3082 return true; |
3082 } | 3083 } |
3083 return false; | 3084 return false; |
3084 } | 3085 } |
3085 | 3086 |
(...skipping 7275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10361 return error::kNoError; | 10362 return error::kNoError; |
10362 } | 10363 } |
10363 | 10364 |
10364 // Include the auto-generated part of this file. We split this because it means | 10365 // Include the auto-generated part of this file. We split this because it means |
10365 // we can easily edit the non-auto generated parts right here in this file | 10366 // we can easily edit the non-auto generated parts right here in this file |
10366 // instead of having to edit some template or the code generator. | 10367 // instead of having to edit some template or the code generator. |
10367 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10368 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10368 | 10369 |
10369 } // namespace gles2 | 10370 } // namespace gles2 |
10370 } // namespace gpu | 10371 } // namespace gpu |
OLD | NEW |