| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; | 538 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; |
| 539 virtual bool ProduceFrontBuffer(const Mailbox& mailbox) OVERRIDE; | 539 virtual bool ProduceFrontBuffer(const Mailbox& mailbox) OVERRIDE; |
| 540 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; | 540 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; |
| 541 void UpdateParentTextureInfo(); | 541 void UpdateParentTextureInfo(); |
| 542 virtual bool MakeCurrent() OVERRIDE; | 542 virtual bool MakeCurrent() OVERRIDE; |
| 543 virtual void ReleaseCurrent() OVERRIDE; | 543 virtual void ReleaseCurrent() OVERRIDE; |
| 544 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } | 544 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } |
| 545 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } | 545 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } |
| 546 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } | 546 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } |
| 547 virtual Capabilities GetCapabilities() OVERRIDE; | 547 virtual Capabilities GetCapabilities() OVERRIDE; |
| 548 virtual void RestoreState() const OVERRIDE; | 548 virtual void RestoreState(const ContextState* prev_state) const OVERRIDE; |
| 549 | 549 |
| 550 virtual void RestoreActiveTexture() const OVERRIDE { | 550 virtual void RestoreActiveTexture() const OVERRIDE { |
| 551 state_.RestoreActiveTexture(); | 551 state_.RestoreActiveTexture(); |
| 552 } | 552 } |
| 553 virtual void RestoreAllTextureUnitBindings() const OVERRIDE { | 553 virtual void RestoreAllTextureUnitBindings( |
| 554 state_.RestoreAllTextureUnitBindings(); | 554 const ContextState* prev_state) const OVERRIDE { |
| 555 state_.RestoreAllTextureUnitBindings(prev_state); |
| 555 } | 556 } |
| 556 virtual void RestoreAttribute(unsigned index) const OVERRIDE { | 557 virtual void RestoreAttribute(unsigned index) const OVERRIDE { |
| 557 state_.RestoreAttribute(index); | 558 state_.RestoreAttribute(index); |
| 558 } | 559 } |
| 559 virtual void RestoreBufferBindings() const OVERRIDE { | 560 virtual void RestoreBufferBindings() const OVERRIDE { |
| 560 state_.RestoreBufferBindings(); | 561 state_.RestoreBufferBindings(); |
| 561 } | 562 } |
| 562 virtual void RestoreGlobalState() const OVERRIDE { | 563 virtual void RestoreGlobalState() const OVERRIDE { |
| 563 state_.RestoreGlobalState(); | 564 state_.RestoreGlobalState(); |
| 564 } | 565 } |
| 565 virtual void RestoreProgramBindings() const OVERRIDE { | 566 virtual void RestoreProgramBindings() const OVERRIDE { |
| 566 state_.RestoreProgramBindings(); | 567 state_.RestoreProgramBindings(); |
| 567 } | 568 } |
| 568 virtual void RestoreRenderbufferBindings() const OVERRIDE { | 569 virtual void RestoreRenderbufferBindings() const OVERRIDE { |
| 569 state_.RestoreRenderbufferBindings(); | 570 state_.RestoreRenderbufferBindings(); |
| 570 } | 571 } |
| 571 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE { | 572 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE { |
| 572 state_.RestoreTextureUnitBindings(unit); | 573 state_.RestoreTextureUnitBindings(unit, NULL); |
| 573 } | 574 } |
| 574 virtual void RestoreFramebufferBindings() const OVERRIDE; | 575 virtual void RestoreFramebufferBindings() const OVERRIDE; |
| 575 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; | 576 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; |
| 576 | 577 |
| 577 virtual QueryManager* GetQueryManager() OVERRIDE { | 578 virtual QueryManager* GetQueryManager() OVERRIDE { |
| 578 return query_manager_.get(); | 579 return query_manager_.get(); |
| 579 } | 580 } |
| 580 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 581 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |
| 581 return vertex_array_manager_.get(); | 582 return vertex_array_manager_.get(); |
| 582 } | 583 } |
| 583 virtual bool ProcessPendingQueries() OVERRIDE; | 584 virtual bool ProcessPendingQueries() OVERRIDE; |
| 584 virtual bool HasMoreIdleWork() OVERRIDE; | 585 virtual bool HasMoreIdleWork() OVERRIDE; |
| 585 virtual void PerformIdleWork() OVERRIDE; | 586 virtual void PerformIdleWork() OVERRIDE; |
| 586 | 587 |
| 587 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; | 588 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; |
| 588 | 589 |
| 589 virtual void SetResizeCallback( | 590 virtual void SetResizeCallback( |
| 590 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; | 591 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; |
| 591 | 592 |
| 592 virtual Logger* GetLogger() OVERRIDE; | 593 virtual Logger* GetLogger() OVERRIDE; |
| 593 virtual ErrorState* GetErrorState() OVERRIDE; | 594 virtual ErrorState* GetErrorState() OVERRIDE; |
| 595 virtual const ContextState* GetContextState() OVERRIDE { return &state_; } |
| 594 | 596 |
| 595 virtual void SetShaderCacheCallback( | 597 virtual void SetShaderCacheCallback( |
| 596 const ShaderCacheCallback& callback) OVERRIDE; | 598 const ShaderCacheCallback& callback) OVERRIDE; |
| 597 virtual void SetWaitSyncPointCallback( | 599 virtual void SetWaitSyncPointCallback( |
| 598 const WaitSyncPointCallback& callback) OVERRIDE; | 600 const WaitSyncPointCallback& callback) OVERRIDE; |
| 599 | 601 |
| 600 virtual AsyncPixelTransferManager* | 602 virtual AsyncPixelTransferManager* |
| 601 GetAsyncPixelTransferManager() OVERRIDE; | 603 GetAsyncPixelTransferManager() OVERRIDE; |
| 602 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE; | 604 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE; |
| 603 virtual void SetAsyncPixelTransferManagerForTest( | 605 virtual void SetAsyncPixelTransferManagerForTest( |
| (...skipping 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3754 framebuffer_state_.clear_state_dirty = false; | 3756 framebuffer_state_.clear_state_dirty = false; |
| 3755 } | 3757 } |
| 3756 } | 3758 } |
| 3757 | 3759 |
| 3758 GLuint GLES2DecoderImpl::GetBackbufferServiceId() const { | 3760 GLuint GLES2DecoderImpl::GetBackbufferServiceId() const { |
| 3759 return (offscreen_target_frame_buffer_.get()) | 3761 return (offscreen_target_frame_buffer_.get()) |
| 3760 ? offscreen_target_frame_buffer_->id() | 3762 ? offscreen_target_frame_buffer_->id() |
| 3761 : (surface_.get() ? surface_->GetBackingFrameBufferObject() : 0); | 3763 : (surface_.get() ? surface_->GetBackingFrameBufferObject() : 0); |
| 3762 } | 3764 } |
| 3763 | 3765 |
| 3764 void GLES2DecoderImpl::RestoreState() const { | 3766 void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) const { |
| 3765 TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState", | 3767 TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState", |
| 3766 "context", logger_.GetLogPrefix()); | 3768 "context", logger_.GetLogPrefix()); |
| 3767 // Restore the Framebuffer first because of bugs in Intel drivers. | 3769 // Restore the Framebuffer first because of bugs in Intel drivers. |
| 3768 // Intel drivers incorrectly clip the viewport settings to | 3770 // Intel drivers incorrectly clip the viewport settings to |
| 3769 // the size of the current framebuffer object. | 3771 // the size of the current framebuffer object. |
| 3770 RestoreFramebufferBindings(); | 3772 RestoreFramebufferBindings(); |
| 3771 state_.RestoreState(); | 3773 state_.RestoreState(prev_state); |
| 3772 } | 3774 } |
| 3773 | 3775 |
| 3774 void GLES2DecoderImpl::RestoreFramebufferBindings() const { | 3776 void GLES2DecoderImpl::RestoreFramebufferBindings() const { |
| 3775 GLuint service_id = | 3777 GLuint service_id = |
| 3776 framebuffer_state_.bound_draw_framebuffer.get() | 3778 framebuffer_state_.bound_draw_framebuffer.get() |
| 3777 ? framebuffer_state_.bound_draw_framebuffer->service_id() | 3779 ? framebuffer_state_.bound_draw_framebuffer->service_id() |
| 3778 : GetBackbufferServiceId(); | 3780 : GetBackbufferServiceId(); |
| 3779 if (!features().chromium_framebuffer_multisample) { | 3781 if (!features().chromium_framebuffer_multisample) { |
| 3780 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); | 3782 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); |
| 3781 } else { | 3783 } else { |
| (...skipping 6859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10641 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10643 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10642 } | 10644 } |
| 10643 | 10645 |
| 10644 // Include the auto-generated part of this file. We split this because it means | 10646 // Include the auto-generated part of this file. We split this because it means |
| 10645 // we can easily edit the non-auto generated parts right here in this file | 10647 // we can easily edit the non-auto generated parts right here in this file |
| 10646 // instead of having to edit some template or the code generator. | 10648 // instead of having to edit some template or the code generator. |
| 10647 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10649 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10648 | 10650 |
| 10649 } // namespace gles2 | 10651 } // namespace gles2 |
| 10650 } // namespace gpu | 10652 } // namespace gpu |
| OLD | NEW |