Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 118203002: During virtual context switches only restore texture units that have changed from the previous cont… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the delta between the ContextStates to decide if we should bind a texture or not Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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() const OVERRIDE {
554 state_.RestoreAllTextureUnitBindings(); 554 state_.RestoreAllTextureUnitBindings(NULL);
555 } 555 }
556 virtual void RestoreAttribute(unsigned index) const OVERRIDE { 556 virtual void RestoreAttribute(unsigned index) const OVERRIDE {
557 state_.RestoreAttribute(index); 557 state_.RestoreAttribute(index);
558 } 558 }
559 virtual void RestoreBufferBindings() const OVERRIDE { 559 virtual void RestoreBufferBindings() const OVERRIDE {
560 state_.RestoreBufferBindings(); 560 state_.RestoreBufferBindings();
561 } 561 }
562 virtual void RestoreGlobalState() const OVERRIDE { 562 virtual void RestoreGlobalState() const OVERRIDE {
563 state_.RestoreGlobalState(); 563 state_.RestoreGlobalState();
564 } 564 }
565 virtual void RestoreProgramBindings() const OVERRIDE { 565 virtual void RestoreProgramBindings() const OVERRIDE {
566 state_.RestoreProgramBindings(); 566 state_.RestoreProgramBindings();
567 } 567 }
568 virtual void RestoreRenderbufferBindings() const OVERRIDE { 568 virtual void RestoreRenderbufferBindings() const OVERRIDE {
569 state_.RestoreRenderbufferBindings(); 569 state_.RestoreRenderbufferBindings();
570 } 570 }
571 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE { 571 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE {
572 state_.RestoreTextureUnitBindings(unit); 572 state_.RestoreTextureUnitBindings(unit, NULL);
573 } 573 }
574 virtual void RestoreFramebufferBindings() const OVERRIDE; 574 virtual void RestoreFramebufferBindings() const OVERRIDE;
575 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; 575 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE;
576 576
577 virtual QueryManager* GetQueryManager() OVERRIDE { 577 virtual QueryManager* GetQueryManager() OVERRIDE {
578 return query_manager_.get(); 578 return query_manager_.get();
579 } 579 }
580 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { 580 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE {
581 return vertex_array_manager_.get(); 581 return vertex_array_manager_.get();
582 } 582 }
583 virtual bool ProcessPendingQueries() OVERRIDE; 583 virtual bool ProcessPendingQueries() OVERRIDE;
584 virtual bool HasMoreIdleWork() OVERRIDE; 584 virtual bool HasMoreIdleWork() OVERRIDE;
585 virtual void PerformIdleWork() OVERRIDE; 585 virtual void PerformIdleWork() OVERRIDE;
586 586
587 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; 587 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE;
588 588
589 virtual void SetResizeCallback( 589 virtual void SetResizeCallback(
590 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; 590 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE;
591 591
592 virtual Logger* GetLogger() OVERRIDE; 592 virtual Logger* GetLogger() OVERRIDE;
593 virtual ErrorState* GetErrorState() OVERRIDE; 593 virtual ErrorState* GetErrorState() OVERRIDE;
594 virtual const ContextState* GetContextState() OVERRIDE { return &state_; }
594 595
595 virtual void SetShaderCacheCallback( 596 virtual void SetShaderCacheCallback(
596 const ShaderCacheCallback& callback) OVERRIDE; 597 const ShaderCacheCallback& callback) OVERRIDE;
597 virtual void SetWaitSyncPointCallback( 598 virtual void SetWaitSyncPointCallback(
598 const WaitSyncPointCallback& callback) OVERRIDE; 599 const WaitSyncPointCallback& callback) OVERRIDE;
599 600
600 virtual AsyncPixelTransferManager* 601 virtual AsyncPixelTransferManager*
601 GetAsyncPixelTransferManager() OVERRIDE; 602 GetAsyncPixelTransferManager() OVERRIDE;
602 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE; 603 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE;
603 virtual void SetAsyncPixelTransferManagerForTest( 604 virtual void SetAsyncPixelTransferManagerForTest(
(...skipping 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3754 framebuffer_state_.clear_state_dirty = false; 3755 framebuffer_state_.clear_state_dirty = false;
3755 } 3756 }
3756 } 3757 }
3757 3758
3758 GLuint GLES2DecoderImpl::GetBackbufferServiceId() const { 3759 GLuint GLES2DecoderImpl::GetBackbufferServiceId() const {
3759 return (offscreen_target_frame_buffer_.get()) 3760 return (offscreen_target_frame_buffer_.get())
3760 ? offscreen_target_frame_buffer_->id() 3761 ? offscreen_target_frame_buffer_->id()
3761 : (surface_.get() ? surface_->GetBackingFrameBufferObject() : 0); 3762 : (surface_.get() ? surface_->GetBackingFrameBufferObject() : 0);
3762 } 3763 }
3763 3764
3764 void GLES2DecoderImpl::RestoreState() const { 3765 void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) const {
3765 TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState", 3766 TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState",
3766 "context", logger_.GetLogPrefix()); 3767 "context", logger_.GetLogPrefix());
3767 // Restore the Framebuffer first because of bugs in Intel drivers. 3768 // Restore the Framebuffer first because of bugs in Intel drivers.
3768 // Intel drivers incorrectly clip the viewport settings to 3769 // Intel drivers incorrectly clip the viewport settings to
3769 // the size of the current framebuffer object. 3770 // the size of the current framebuffer object.
3770 RestoreFramebufferBindings(); 3771 RestoreFramebufferBindings();
3771 state_.RestoreState(); 3772 state_.RestoreState(prev_state);
3772 } 3773 }
3773 3774
3774 void GLES2DecoderImpl::RestoreFramebufferBindings() const { 3775 void GLES2DecoderImpl::RestoreFramebufferBindings() const {
3775 GLuint service_id = 3776 GLuint service_id =
3776 framebuffer_state_.bound_draw_framebuffer.get() 3777 framebuffer_state_.bound_draw_framebuffer.get()
3777 ? framebuffer_state_.bound_draw_framebuffer->service_id() 3778 ? framebuffer_state_.bound_draw_framebuffer->service_id()
3778 : GetBackbufferServiceId(); 3779 : GetBackbufferServiceId();
3779 if (!features().chromium_framebuffer_multisample) { 3780 if (!features().chromium_framebuffer_multisample) {
3780 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); 3781 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id);
3781 } else { 3782 } else {
(...skipping 6859 matching lines...) Expand 10 before | Expand all | Expand 10 after
10641 DoDidUseTexImageIfNeeded(texture, texture->target()); 10642 DoDidUseTexImageIfNeeded(texture, texture->target());
10642 } 10643 }
10643 10644
10644 // Include the auto-generated part of this file. We split this because it means 10645 // 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 10646 // 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. 10647 // instead of having to edit some template or the code generator.
10647 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10648 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10648 10649
10649 } // namespace gles2 10650 } // namespace gles2
10650 } // namespace gpu 10651 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698