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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 void RestoreTextureState(unsigned service_id) const override; | 621 void RestoreTextureState(unsigned service_id) const override; |
622 | 622 |
623 void ClearAllAttributes() const override; | 623 void ClearAllAttributes() const override; |
624 void RestoreAllAttributes() const override; | 624 void RestoreAllAttributes() const override; |
625 | 625 |
626 QueryManager* GetQueryManager() override { return query_manager_.get(); } | 626 QueryManager* GetQueryManager() override { return query_manager_.get(); } |
627 VertexArrayManager* GetVertexArrayManager() override { | 627 VertexArrayManager* GetVertexArrayManager() override { |
628 return vertex_array_manager_.get(); | 628 return vertex_array_manager_.get(); |
629 } | 629 } |
630 ImageManager* GetImageManager() override { return image_manager_.get(); } | 630 ImageManager* GetImageManager() override { return image_manager_.get(); } |
631 bool ProcessPendingQueries() override; | 631 bool ProcessPendingQueries(bool did_finish) override; |
632 bool HasMoreIdleWork() override; | 632 bool HasMoreIdleWork() override; |
633 void PerformIdleWork() override; | 633 void PerformIdleWork() override; |
634 | 634 |
635 void WaitForReadPixels(base::Closure callback) override; | 635 void WaitForReadPixels(base::Closure callback) override; |
636 | 636 |
637 void SetResizeCallback( | 637 void SetResizeCallback( |
638 const base::Callback<void(gfx::Size, float)>& callback) override; | 638 const base::Callback<void(gfx::Size, float)>& callback) override; |
639 | 639 |
640 Logger* GetLogger() override; | 640 Logger* GetLogger() override; |
641 | 641 |
(...skipping 3349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3991 GLuint service_id = glCreateShader(type); | 3991 GLuint service_id = glCreateShader(type); |
3992 if (service_id != 0) { | 3992 if (service_id != 0) { |
3993 CreateShader(client_id, service_id, type); | 3993 CreateShader(client_id, service_id, type); |
3994 } | 3994 } |
3995 return true; | 3995 return true; |
3996 } | 3996 } |
3997 | 3997 |
3998 void GLES2DecoderImpl::DoFinish() { | 3998 void GLES2DecoderImpl::DoFinish() { |
3999 glFinish(); | 3999 glFinish(); |
4000 ProcessPendingReadPixels(); | 4000 ProcessPendingReadPixels(); |
4001 ProcessPendingQueries(); | 4001 ProcessPendingQueries(true); |
4002 } | 4002 } |
4003 | 4003 |
4004 void GLES2DecoderImpl::DoFlush() { | 4004 void GLES2DecoderImpl::DoFlush() { |
4005 glFlush(); | 4005 glFlush(); |
4006 ProcessPendingQueries(); | 4006 ProcessPendingQueries(false); |
4007 } | 4007 } |
4008 | 4008 |
4009 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { | 4009 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { |
4010 GLuint texture_index = texture_unit - GL_TEXTURE0; | 4010 GLuint texture_index = texture_unit - GL_TEXTURE0; |
4011 if (texture_index >= state_.texture_units.size()) { | 4011 if (texture_index >= state_.texture_units.size()) { |
4012 LOCAL_SET_GL_ERROR_INVALID_ENUM( | 4012 LOCAL_SET_GL_ERROR_INVALID_ENUM( |
4013 "glActiveTexture", texture_unit, "texture_unit"); | 4013 "glActiveTexture", texture_unit, "texture_unit"); |
4014 return; | 4014 return; |
4015 } | 4015 } |
4016 state_.active_texture_unit = texture_index; | 4016 state_.active_texture_unit = texture_index; |
(...skipping 5933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9950 state_.current_queries.find(query->target()); | 9950 state_.current_queries.find(query->target()); |
9951 if (it != state_.current_queries.end()) | 9951 if (it != state_.current_queries.end()) |
9952 state_.current_queries.erase(it); | 9952 state_.current_queries.erase(it); |
9953 | 9953 |
9954 query->Destroy(true); | 9954 query->Destroy(true); |
9955 } | 9955 } |
9956 query_manager_->RemoveQuery(client_ids[ii]); | 9956 query_manager_->RemoveQuery(client_ids[ii]); |
9957 } | 9957 } |
9958 } | 9958 } |
9959 | 9959 |
9960 bool GLES2DecoderImpl::ProcessPendingQueries() { | 9960 bool GLES2DecoderImpl::ProcessPendingQueries(bool did_finish) { |
9961 if (query_manager_.get() == NULL) { | 9961 if (query_manager_.get() == NULL) { |
9962 return false; | 9962 return false; |
9963 } | 9963 } |
9964 if (!query_manager_->ProcessPendingQueries()) { | 9964 if (!query_manager_->ProcessPendingQueries(did_finish)) { |
9965 current_decoder_error_ = error::kOutOfBounds; | 9965 current_decoder_error_ = error::kOutOfBounds; |
9966 } | 9966 } |
9967 return query_manager_->HavePendingQueries(); | 9967 return query_manager_->HavePendingQueries(); |
9968 } | 9968 } |
9969 | 9969 |
9970 // Note that if there are no pending readpixels right now, | 9970 // Note that if there are no pending readpixels right now, |
9971 // this function will call the callback immediately. | 9971 // this function will call the callback immediately. |
9972 void GLES2DecoderImpl::WaitForReadPixels(base::Closure callback) { | 9972 void GLES2DecoderImpl::WaitForReadPixels(base::Closure callback) { |
9973 if (features().use_async_readpixels && !pending_readpixel_fences_.empty()) { | 9973 if (features().use_async_readpixels && !pending_readpixel_fences_.empty()) { |
9974 pending_readpixel_fences_.back()->callbacks.push_back(callback); | 9974 pending_readpixel_fences_.back()->callbacks.push_back(callback); |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11461 } | 11461 } |
11462 } | 11462 } |
11463 | 11463 |
11464 // Include the auto-generated part of this file. We split this because it means | 11464 // Include the auto-generated part of this file. We split this because it means |
11465 // we can easily edit the non-auto generated parts right here in this file | 11465 // we can easily edit the non-auto generated parts right here in this file |
11466 // instead of having to edit some template or the code generator. | 11466 // instead of having to edit some template or the code generator. |
11467 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11467 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11468 | 11468 |
11469 } // namespace gles2 | 11469 } // namespace gles2 |
11470 } // namespace gpu | 11470 } // namespace gpu |
OLD | NEW |