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

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

Issue 1925663002: command_buffer: Defer restoring of FBO bindings when changing virtual contexts Base URL: https://chromium.googlesource.com/chromium/src.git@lazy-bindframebuffer-03-copy-texture-chromium-instantiation
Patch Set: rework Created 4 years, 7 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/framebuffer_manager.h" 5 #include "gpu/command_buffer/service/framebuffer_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 18 matching lines...) Expand all
29 case GLES2Util::kDepth | GLES2Util::kStencil: 29 case GLES2Util::kDepth | GLES2Util::kStencil:
30 return (needed_channels != channels); 30 return (needed_channels != channels);
31 default: 31 default:
32 return false; 32 return false;
33 } 33 }
34 } 34 }
35 35
36 } // namespace anonymous 36 } // namespace anonymous
37 37
38 DecoderFramebufferState::DecoderFramebufferState() 38 DecoderFramebufferState::DecoderFramebufferState()
39 : clear_state_dirty(false), 39 : draw_binding_dirty_(true),
40 bound_read_framebuffer(NULL), 40 read_binding_dirty_(true),
41 bound_draw_framebuffer(NULL) { 41 draw_framebuffer_clear_state_dirty_(true) {}
42
43 DecoderFramebufferState::~DecoderFramebufferState() {
42 } 44 }
43 45
44 DecoderFramebufferState::~DecoderFramebufferState() { 46 void DecoderFramebufferState::set_bound_draw_framebuffer(
47 Framebuffer* framebuffer) {
48 if (bound_draw_framebuffer_ == framebuffer)
49 return;
50 bound_draw_framebuffer_ = framebuffer;
51 draw_binding_dirty_ = true;
52 draw_framebuffer_clear_state_dirty_ = true;
53 }
54
55 void DecoderFramebufferState::set_bound_read_framebuffer(
56 Framebuffer* framebuffer) {
57 if (bound_read_framebuffer_ == framebuffer)
58 return;
59 bound_read_framebuffer_ = framebuffer;
60 read_binding_dirty_ = true;
61 }
62
63 void DecoderFramebufferState::NotifyFramebufferChanged(
64 Framebuffer* framebuffer) {
65 if (framebuffer == bound_draw_framebuffer_.get())
66 draw_framebuffer_clear_state_dirty_ = true;
67 }
68
69 void DecoderFramebufferState::NotifyBoundFramebuffersChanged() {
70 draw_framebuffer_clear_state_dirty_ = true;
71 }
72
73 void DecoderFramebufferState::SetBoundFramebuffer(GLenum target,
74 Framebuffer* framebuffer) {
75 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT)
76 set_bound_draw_framebuffer(framebuffer);
77 if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT)
78 set_bound_read_framebuffer(framebuffer);
79 }
80
81 bool DecoderFramebufferState::IsBindingDirty(GLenum target) const {
82 if (target == GL_READ_FRAMEBUFFER_EXT)
83 return read_binding_dirty_;
84 if (target == GL_DRAW_FRAMEBUFFER_EXT)
85 return draw_binding_dirty_;
86 return read_binding_dirty_ || draw_binding_dirty_;
87 }
88
89 void DecoderFramebufferState::MarkBindingDirty(GLenum target) {
90 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT)
91 draw_binding_dirty_ = true;
92 if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT)
93 read_binding_dirty_ = true;
94 }
95
96 void DecoderFramebufferState::MarkBindingClean(GLenum target) {
97 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT)
98 draw_binding_dirty_ = false;
99 if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT)
100 read_binding_dirty_ = false;
45 } 101 }
46 102
47 class RenderbufferAttachment 103 class RenderbufferAttachment
48 : public Framebuffer::Attachment { 104 : public Framebuffer::Attachment {
49 public: 105 public:
50 explicit RenderbufferAttachment( 106 explicit RenderbufferAttachment(
51 Renderbuffer* renderbuffer) 107 Renderbuffer* renderbuffer)
52 : renderbuffer_(renderbuffer) { 108 : renderbuffer_(renderbuffer) {
53 } 109 }
54 110
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 907
852 bool FramebufferManager::IsComplete( 908 bool FramebufferManager::IsComplete(
853 Framebuffer* framebuffer) { 909 Framebuffer* framebuffer) {
854 DCHECK(framebuffer); 910 DCHECK(framebuffer);
855 return framebuffer->framebuffer_complete_state_count_id() == 911 return framebuffer->framebuffer_complete_state_count_id() ==
856 framebuffer_state_change_count_; 912 framebuffer_state_change_count_;
857 } 913 }
858 914
859 } // namespace gles2 915 } // namespace gles2
860 } // namespace gpu 916 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698