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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 559 } |
560 virtual void RestoreProgramBindings() const OVERRIDE { | 560 virtual void RestoreProgramBindings() const OVERRIDE { |
561 state_.RestoreProgramBindings(); | 561 state_.RestoreProgramBindings(); |
562 } | 562 } |
563 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE { | 563 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE { |
564 state_.RestoreTextureUnitBindings(unit, NULL); | 564 state_.RestoreTextureUnitBindings(unit, NULL); |
565 } | 565 } |
566 virtual void RestoreFramebufferBindings() const OVERRIDE; | 566 virtual void RestoreFramebufferBindings() const OVERRIDE; |
567 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; | 567 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; |
568 | 568 |
| 569 virtual void ClearAllAttributes() const OVERRIDE; |
| 570 virtual void RestoreAllAttributes() const OVERRIDE; |
| 571 |
569 virtual QueryManager* GetQueryManager() OVERRIDE { | 572 virtual QueryManager* GetQueryManager() OVERRIDE { |
570 return query_manager_.get(); | 573 return query_manager_.get(); |
571 } | 574 } |
572 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 575 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |
573 return vertex_array_manager_.get(); | 576 return vertex_array_manager_.get(); |
574 } | 577 } |
575 virtual bool ProcessPendingQueries() OVERRIDE; | 578 virtual bool ProcessPendingQueries() OVERRIDE; |
576 virtual bool HasMoreIdleWork() OVERRIDE; | 579 virtual bool HasMoreIdleWork() OVERRIDE; |
577 virtual void PerformIdleWork() OVERRIDE; | 580 virtual void PerformIdleWork() OVERRIDE; |
578 | 581 |
(...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3777 glTexParameteri( | 3780 glTexParameteri( |
3778 target, GL_TEXTURE_WRAP_T, texture->wrap_t()); | 3781 target, GL_TEXTURE_WRAP_T, texture->wrap_t()); |
3779 glTexParameteri( | 3782 glTexParameteri( |
3780 target, GL_TEXTURE_MIN_FILTER, texture->min_filter()); | 3783 target, GL_TEXTURE_MIN_FILTER, texture->min_filter()); |
3781 glTexParameteri( | 3784 glTexParameteri( |
3782 target, GL_TEXTURE_MAG_FILTER, texture->mag_filter()); | 3785 target, GL_TEXTURE_MAG_FILTER, texture->mag_filter()); |
3783 RestoreTextureUnitBindings(state_.active_texture_unit); | 3786 RestoreTextureUnitBindings(state_.active_texture_unit); |
3784 } | 3787 } |
3785 } | 3788 } |
3786 | 3789 |
| 3790 void GLES2DecoderImpl::ClearAllAttributes() const { |
| 3791 for (uint32 i = 0; i < group_->max_vertex_attribs(); ++i) { |
| 3792 if (i != 0) // Never disable attribute 0 |
| 3793 glDisableVertexAttribArray(i); |
| 3794 if(features().angle_instanced_arrays) |
| 3795 glVertexAttribDivisorANGLE(i, 0); |
| 3796 } |
| 3797 } |
| 3798 |
| 3799 void GLES2DecoderImpl::RestoreAllAttributes() const { |
| 3800 for (uint32 i = 0; i < group_->max_vertex_attribs(); ++i) |
| 3801 RestoreAttribute(i); |
| 3802 } |
| 3803 |
3787 void GLES2DecoderImpl::OnFboChanged() const { | 3804 void GLES2DecoderImpl::OnFboChanged() const { |
3788 if (workarounds().restore_scissor_on_fbo_change) | 3805 if (workarounds().restore_scissor_on_fbo_change) |
3789 state_.fbo_binding_for_scissor_workaround_dirty_ = true; | 3806 state_.fbo_binding_for_scissor_workaround_dirty_ = true; |
3790 } | 3807 } |
3791 | 3808 |
3792 // Called after the FBO is checked for completeness. | 3809 // Called after the FBO is checked for completeness. |
3793 void GLES2DecoderImpl::OnUseFramebuffer() const { | 3810 void GLES2DecoderImpl::OnUseFramebuffer() const { |
3794 if (state_.fbo_binding_for_scissor_workaround_dirty_) { | 3811 if (state_.fbo_binding_for_scissor_workaround_dirty_) { |
3795 state_.fbo_binding_for_scissor_workaround_dirty_ = false; | 3812 state_.fbo_binding_for_scissor_workaround_dirty_ = false; |
3796 // The driver forgets the correct scissor when modifying the FBO binding. | 3813 // The driver forgets the correct scissor when modifying the FBO binding. |
(...skipping 6729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10526 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10543 DoDidUseTexImageIfNeeded(texture, texture->target()); |
10527 } | 10544 } |
10528 | 10545 |
10529 // Include the auto-generated part of this file. We split this because it means | 10546 // Include the auto-generated part of this file. We split this because it means |
10530 // we can easily edit the non-auto generated parts right here in this file | 10547 // we can easily edit the non-auto generated parts right here in this file |
10531 // instead of having to edit some template or the code generator. | 10548 // instead of having to edit some template or the code generator. |
10532 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10549 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10533 | 10550 |
10534 } // namespace gles2 | 10551 } // namespace gles2 |
10535 } // namespace gpu | 10552 } // namespace gpu |
OLD | NEW |