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

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

Powered by Google App Engine
This is Rietveld 408576698