| 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 void RestoreTextureState(unsigned service_id) const override; | 620 void RestoreTextureState(unsigned service_id) const override; |
| 621 | 621 |
| 622 void ClearAllAttributes() const override; | 622 void ClearAllAttributes() const override; |
| 623 void RestoreAllAttributes() const override; | 623 void RestoreAllAttributes() const override; |
| 624 | 624 |
| 625 QueryManager* GetQueryManager() override { return query_manager_.get(); } | 625 QueryManager* GetQueryManager() override { return query_manager_.get(); } |
| 626 VertexArrayManager* GetVertexArrayManager() override { | 626 VertexArrayManager* GetVertexArrayManager() override { |
| 627 return vertex_array_manager_.get(); | 627 return vertex_array_manager_.get(); |
| 628 } | 628 } |
| 629 ImageManager* GetImageManager() override { return image_manager_.get(); } | 629 ImageManager* GetImageManager() override { return image_manager_.get(); } |
| 630 bool ProcessPendingQueries() override; | 630 bool ProcessPendingQueries(bool did_finish) override; |
| 631 bool HasMoreIdleWork() override; | 631 bool HasMoreIdleWork() override; |
| 632 void PerformIdleWork() override; | 632 void PerformIdleWork() override; |
| 633 | 633 |
| 634 void WaitForReadPixels(base::Closure callback) override; | 634 void WaitForReadPixels(base::Closure callback) override; |
| 635 | 635 |
| 636 void SetResizeCallback( | 636 void SetResizeCallback( |
| 637 const base::Callback<void(gfx::Size, float)>& callback) override; | 637 const base::Callback<void(gfx::Size, float)>& callback) override; |
| 638 | 638 |
| 639 Logger* GetLogger() override; | 639 Logger* GetLogger() override; |
| 640 | 640 |
| (...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3909 GLuint service_id = glCreateShader(type); | 3909 GLuint service_id = glCreateShader(type); |
| 3910 if (service_id != 0) { | 3910 if (service_id != 0) { |
| 3911 CreateShader(client_id, service_id, type); | 3911 CreateShader(client_id, service_id, type); |
| 3912 } | 3912 } |
| 3913 return true; | 3913 return true; |
| 3914 } | 3914 } |
| 3915 | 3915 |
| 3916 void GLES2DecoderImpl::DoFinish() { | 3916 void GLES2DecoderImpl::DoFinish() { |
| 3917 glFinish(); | 3917 glFinish(); |
| 3918 ProcessPendingReadPixels(); | 3918 ProcessPendingReadPixels(); |
| 3919 ProcessPendingQueries(); | 3919 ProcessPendingQueries(true); |
| 3920 } | 3920 } |
| 3921 | 3921 |
| 3922 void GLES2DecoderImpl::DoFlush() { | 3922 void GLES2DecoderImpl::DoFlush() { |
| 3923 glFlush(); | 3923 glFlush(); |
| 3924 ProcessPendingQueries(); | 3924 ProcessPendingQueries(false); |
| 3925 } | 3925 } |
| 3926 | 3926 |
| 3927 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { | 3927 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { |
| 3928 GLuint texture_index = texture_unit - GL_TEXTURE0; | 3928 GLuint texture_index = texture_unit - GL_TEXTURE0; |
| 3929 if (texture_index >= state_.texture_units.size()) { | 3929 if (texture_index >= state_.texture_units.size()) { |
| 3930 LOCAL_SET_GL_ERROR_INVALID_ENUM( | 3930 LOCAL_SET_GL_ERROR_INVALID_ENUM( |
| 3931 "glActiveTexture", texture_unit, "texture_unit"); | 3931 "glActiveTexture", texture_unit, "texture_unit"); |
| 3932 return; | 3932 return; |
| 3933 } | 3933 } |
| 3934 state_.active_texture_unit = texture_index; | 3934 state_.active_texture_unit = texture_index; |
| (...skipping 5875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9810 state_.current_queries.find(query->target()); | 9810 state_.current_queries.find(query->target()); |
| 9811 if (it != state_.current_queries.end()) | 9811 if (it != state_.current_queries.end()) |
| 9812 state_.current_queries.erase(it); | 9812 state_.current_queries.erase(it); |
| 9813 | 9813 |
| 9814 query->Destroy(true); | 9814 query->Destroy(true); |
| 9815 } | 9815 } |
| 9816 query_manager_->RemoveQuery(client_ids[ii]); | 9816 query_manager_->RemoveQuery(client_ids[ii]); |
| 9817 } | 9817 } |
| 9818 } | 9818 } |
| 9819 | 9819 |
| 9820 bool GLES2DecoderImpl::ProcessPendingQueries() { | 9820 bool GLES2DecoderImpl::ProcessPendingQueries(bool did_finish) { |
| 9821 if (query_manager_.get() == NULL) { | 9821 if (query_manager_.get() == NULL) { |
| 9822 return false; | 9822 return false; |
| 9823 } | 9823 } |
| 9824 if (!query_manager_->ProcessPendingQueries()) { | 9824 if (!query_manager_->ProcessPendingQueries(did_finish)) { |
| 9825 current_decoder_error_ = error::kOutOfBounds; | 9825 current_decoder_error_ = error::kOutOfBounds; |
| 9826 } | 9826 } |
| 9827 return query_manager_->HavePendingQueries(); | 9827 return query_manager_->HavePendingQueries(); |
| 9828 } | 9828 } |
| 9829 | 9829 |
| 9830 // Note that if there are no pending readpixels right now, | 9830 // Note that if there are no pending readpixels right now, |
| 9831 // this function will call the callback immediately. | 9831 // this function will call the callback immediately. |
| 9832 void GLES2DecoderImpl::WaitForReadPixels(base::Closure callback) { | 9832 void GLES2DecoderImpl::WaitForReadPixels(base::Closure callback) { |
| 9833 if (features().use_async_readpixels && !pending_readpixel_fences_.empty()) { | 9833 if (features().use_async_readpixels && !pending_readpixel_fences_.empty()) { |
| 9834 pending_readpixel_fences_.back()->callbacks.push_back(callback); | 9834 pending_readpixel_fences_.back()->callbacks.push_back(callback); |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11254 } | 11254 } |
| 11255 } | 11255 } |
| 11256 | 11256 |
| 11257 // Include the auto-generated part of this file. We split this because it means | 11257 // Include the auto-generated part of this file. We split this because it means |
| 11258 // we can easily edit the non-auto generated parts right here in this file | 11258 // we can easily edit the non-auto generated parts right here in this file |
| 11259 // instead of having to edit some template or the code generator. | 11259 // instead of having to edit some template or the code generator. |
| 11260 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11260 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 11261 | 11261 |
| 11262 } // namespace gles2 | 11262 } // namespace gles2 |
| 11263 } // namespace gpu | 11263 } // namespace gpu |
| OLD | NEW |