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

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

Issue 315283002: Framebuffer clear() needs to consider the situation some draw buffers are disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 #ifndef GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 virtual ~Attachment() {} 57 virtual ~Attachment() {}
58 }; 58 };
59 59
60 Framebuffer(FramebufferManager* manager, GLuint service_id); 60 Framebuffer(FramebufferManager* manager, GLuint service_id);
61 61
62 GLuint service_id() const { 62 GLuint service_id() const {
63 return service_id_; 63 return service_id_;
64 } 64 }
65 65
66 bool HasUnclearedAttachment(GLenum attachment) const; 66 bool HasUnclearedAttachment(GLenum attachment) const;
67 bool HasUnclearedColorAttachments() const;
67 68
68 void MarkAttachmentAsCleared( 69 void MarkAttachmentAsCleared(
69 RenderbufferManager* renderbuffer_manager, 70 RenderbufferManager* renderbuffer_manager,
70 TextureManager* texture_manager, 71 TextureManager* texture_manager,
71 GLenum attachment, 72 GLenum attachment,
72 bool cleared); 73 bool cleared);
73 74
74 // Attaches a renderbuffer to a particlar attachment. 75 // Attaches a renderbuffer to a particlar attachment.
75 // Pass null to detach. 76 // Pass null to detach.
76 void AttachRenderbuffer( 77 void AttachRenderbuffer(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Implements optimized glGetFramebufferStatus. 123 // Implements optimized glGetFramebufferStatus.
123 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const; 124 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const;
124 125
125 // Check all attachments are cleared 126 // Check all attachments are cleared
126 bool IsCleared() const; 127 bool IsCleared() const;
127 128
128 GLenum GetDrawBuffer(GLenum draw_buffer) const; 129 GLenum GetDrawBuffer(GLenum draw_buffer) const;
129 130
130 void SetDrawBuffers(GLsizei n, const GLenum* bufs); 131 void SetDrawBuffers(GLsizei n, const GLenum* bufs);
131 132
133 // If a color buffer is attached to GL_COLOR_ATTACHMENTi, enable that
134 // draw buffer for glClear().
135 void PrepareDrawBuffersForClear() const;
136
137 // Recover draw buffers states that have been changed in
138 // PrepareDrawBuffersForClear().
139 void RecoverDrawBuffersAfterClear() const;
Ken Russell (switch to Gerrit) 2014/06/05 20:00:40 For consistency I suggest "Restore" instead of "Re
Zhenyao Mo 2014/06/05 21:27:49 Done.
140
132 // Return true if any draw buffers has an alpha channel. 141 // Return true if any draw buffers has an alpha channel.
133 bool HasAlphaMRT() const; 142 bool HasAlphaMRT() const;
134 143
135 static void ClearFramebufferCompleteComboMap(); 144 static void ClearFramebufferCompleteComboMap();
136 145
137 static bool AllowFramebufferComboCompleteMapForTesting() { 146 static bool AllowFramebufferComboCompleteMapForTesting() {
138 return allow_framebuffer_combo_complete_map_; 147 return allow_framebuffer_combo_complete_map_;
139 } 148 }
140 149
141 void OnTextureRefDetached(TextureRef* texture); 150 void OnTextureRefDetached(TextureRef* texture);
(...skipping 14 matching lines...) Expand all
156 bool cleared); 165 bool cleared);
157 166
158 void MarkAsComplete(unsigned state_id) { 167 void MarkAsComplete(unsigned state_id) {
159 framebuffer_complete_state_count_id_ = state_id; 168 framebuffer_complete_state_count_id_ = state_id;
160 } 169 }
161 170
162 unsigned framebuffer_complete_state_count_id() const { 171 unsigned framebuffer_complete_state_count_id() const {
163 return framebuffer_complete_state_count_id_; 172 return framebuffer_complete_state_count_id_;
164 } 173 }
165 174
175 // Helper function for PrepareDrawBuffersForClear() and
176 // RecoverDrawBuffersAfterClear().
177 void ChangeDrawBuffersHelper(bool recover) const;
178
166 // The managers that owns this. 179 // The managers that owns this.
167 FramebufferManager* manager_; 180 FramebufferManager* manager_;
168 181
169 bool deleted_; 182 bool deleted_;
170 183
171 // Service side framebuffer id. 184 // Service side framebuffer id.
172 GLuint service_id_; 185 GLuint service_id_;
173 186
174 // Whether this framebuffer has ever been bound. 187 // Whether this framebuffer has ever been bound.
175 bool has_been_bound_; 188 bool has_been_bound_;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector; 307 typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector;
295 TextureDetachObserverVector texture_detach_observers_; 308 TextureDetachObserverVector texture_detach_observers_;
296 309
297 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); 310 DISALLOW_COPY_AND_ASSIGN(FramebufferManager);
298 }; 311 };
299 312
300 } // namespace gles2 313 } // namespace gles2
301 } // namespace gpu 314 } // namespace gpu
302 315
303 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 316 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/framebuffer_manager.cc » ('j') | gpu/command_buffer/service/framebuffer_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698