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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 virtual void RestoreFramebufferBindings() const OVERRIDE; | 620 virtual void RestoreFramebufferBindings() const OVERRIDE; |
621 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; | 621 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; |
622 | 622 |
623 virtual QueryManager* GetQueryManager() OVERRIDE { | 623 virtual QueryManager* GetQueryManager() OVERRIDE { |
624 return query_manager_.get(); | 624 return query_manager_.get(); |
625 } | 625 } |
626 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 626 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |
627 return vertex_array_manager_.get(); | 627 return vertex_array_manager_.get(); |
628 } | 628 } |
629 virtual bool ProcessPendingQueries() OVERRIDE; | 629 virtual bool ProcessPendingQueries() OVERRIDE; |
| 630 virtual bool HasMoreIdleWork() OVERRIDE; |
| 631 virtual void PerformIdleWork() OVERRIDE; |
630 | 632 |
631 virtual void SetResizeCallback( | 633 virtual void SetResizeCallback( |
632 const base::Callback<void(gfx::Size)>& callback) OVERRIDE; | 634 const base::Callback<void(gfx::Size)>& callback) OVERRIDE; |
633 | 635 |
634 virtual void SetMsgCallback(const MsgCallback& callback) OVERRIDE; | 636 virtual void SetMsgCallback(const MsgCallback& callback) OVERRIDE; |
635 virtual void SetShaderCacheCallback( | 637 virtual void SetShaderCacheCallback( |
636 const ShaderCacheCallback& callback) OVERRIDE; | 638 const ShaderCacheCallback& callback) OVERRIDE; |
637 virtual void SetWaitSyncPointCallback( | 639 virtual void SetWaitSyncPointCallback( |
638 const WaitSyncPointCallback& callback) OVERRIDE; | 640 const WaitSyncPointCallback& callback) OVERRIDE; |
639 | 641 |
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 | 2857 |
2856 void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { | 2858 void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { |
2857 if (engine() && query_manager_.get()) | 2859 if (engine() && query_manager_.get()) |
2858 query_manager_->ProcessPendingTransferQueries(); | 2860 query_manager_->ProcessPendingTransferQueries(); |
2859 | 2861 |
2860 // TODO(epenner): Is there a better place to do this? | 2862 // TODO(epenner): Is there a better place to do this? |
2861 // This needs to occur before we execute any batch of commands | 2863 // This needs to occur before we execute any batch of commands |
2862 // from the client, as the client may have recieved an async | 2864 // from the client, as the client may have recieved an async |
2863 // completion while issuing those commands. | 2865 // completion while issuing those commands. |
2864 // "DidFlushStart" would be ideal if we had such a callback. | 2866 // "DidFlushStart" would be ideal if we had such a callback. |
| 2867 // TODO(reveman): We should avoid using a bool return value to determine |
| 2868 // if we need to restore some state. crbug.com/196303 |
2865 if (async_pixel_transfer_delegate_->BindCompletedAsyncTransfers()) | 2869 if (async_pixel_transfer_delegate_->BindCompletedAsyncTransfers()) |
2866 RestoreCurrentTexture2DBindings(); | 2870 RestoreCurrentTexture2DBindings(); |
2867 } | 2871 } |
2868 | 2872 |
2869 void GLES2DecoderImpl::ReleaseCurrent() { | 2873 void GLES2DecoderImpl::ReleaseCurrent() { |
2870 if (context_.get()) | 2874 if (context_.get()) |
2871 context_->ReleaseCurrent(surface_.get()); | 2875 context_->ReleaseCurrent(surface_.get()); |
2872 } | 2876 } |
2873 | 2877 |
2874 void GLES2DecoderImpl::RestoreCurrentRenderbufferBindings() { | 2878 void GLES2DecoderImpl::RestoreCurrentRenderbufferBindings() { |
(...skipping 6363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9238 bool GLES2DecoderImpl::ProcessPendingQueries() { | 9242 bool GLES2DecoderImpl::ProcessPendingQueries() { |
9239 if (query_manager_.get() == NULL) { | 9243 if (query_manager_.get() == NULL) { |
9240 return false; | 9244 return false; |
9241 } | 9245 } |
9242 if (!query_manager_->ProcessPendingQueries()) { | 9246 if (!query_manager_->ProcessPendingQueries()) { |
9243 current_decoder_error_ = error::kOutOfBounds; | 9247 current_decoder_error_ = error::kOutOfBounds; |
9244 } | 9248 } |
9245 return query_manager_->HavePendingQueries(); | 9249 return query_manager_->HavePendingQueries(); |
9246 } | 9250 } |
9247 | 9251 |
| 9252 bool GLES2DecoderImpl::HasMoreIdleWork() { |
| 9253 return async_pixel_transfer_delegate_->NeedsProcessMorePendingTransfers(); |
| 9254 } |
| 9255 |
| 9256 void GLES2DecoderImpl::PerformIdleWork() { |
| 9257 if (!async_pixel_transfer_delegate_->NeedsProcessMorePendingTransfers()) |
| 9258 return; |
| 9259 // TODO(reveman): We should avoid using a bool return value to determine |
| 9260 // if we need to restore some state. crbug.com/196303 |
| 9261 if (async_pixel_transfer_delegate_->ProcessMorePendingTransfers()) |
| 9262 RestoreCurrentTexture2DBindings(); |
| 9263 ProcessFinishedAsyncTransfers(); |
| 9264 } |
| 9265 |
9248 error::Error GLES2DecoderImpl::HandleBeginQueryEXT( | 9266 error::Error GLES2DecoderImpl::HandleBeginQueryEXT( |
9249 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { | 9267 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { |
9250 GLenum target = static_cast<GLenum>(c.target); | 9268 GLenum target = static_cast<GLenum>(c.target); |
9251 GLuint client_id = static_cast<GLuint>(c.id); | 9269 GLuint client_id = static_cast<GLuint>(c.id); |
9252 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 9270 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); |
9253 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 9271 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); |
9254 | 9272 |
9255 switch (target) { | 9273 switch (target) { |
9256 case GL_COMMANDS_ISSUED_CHROMIUM: | 9274 case GL_COMMANDS_ISSUED_CHROMIUM: |
9257 case GL_LATENCY_QUERY_CHROMIUM: | 9275 case GL_LATENCY_QUERY_CHROMIUM: |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10353 return error::kNoError; | 10371 return error::kNoError; |
10354 } | 10372 } |
10355 | 10373 |
10356 // Include the auto-generated part of this file. We split this because it means | 10374 // Include the auto-generated part of this file. We split this because it means |
10357 // we can easily edit the non-auto generated parts right here in this file | 10375 // we can easily edit the non-auto generated parts right here in this file |
10358 // instead of having to edit some template or the code generator. | 10376 // instead of having to edit some template or the code generator. |
10359 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10377 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10360 | 10378 |
10361 } // namespace gles2 | 10379 } // namespace gles2 |
10362 } // namespace gpu | 10380 } // namespace gpu |
OLD | NEW |