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

Unified Diff: gpu/command_buffer/service/renderbuffer_manager.h

Issue 2149523002: Make invalidateFramebuffer no-op for DEPTH_STENCIL attachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add depth_cleared_ and stencil_cleared_ for class texture and renderbuffer. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/renderbuffer_manager.h
diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h
index f808e967f9695293af49231cf89afdb380afe837..48a52318e5410815b1dc8c947e6306565f71452b 100644
--- a/gpu/command_buffer/service/renderbuffer_manager.h
+++ b/gpu/command_buffer/service/renderbuffer_manager.h
@@ -14,6 +14,7 @@
#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "gpu/command_buffer/service/framebuffer_manager.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/gpu_export.h"
@@ -44,6 +45,19 @@ class GPU_EXPORT Renderbuffer
return cleared_;
}
+ // Only meaningful when the format is DEPTH_STENCIL.
+ // Whether the particular part of the renderbuffer is cleared.
+ bool cleared(GLenum attachment) const {
+ if (!is_depth_stencil_)
qiankun 2016/07/14 06:48:21 Can this path be reached in your current implement
+ return cleared_;
+ if (attachment == GL_DEPTH_ATTACHMENT)
+ return depth_cleared_;
+ else if (attachment == GL_STENCIL_ATTACHMENT)
+ return stencil_cleared_;
+ // Should not be reached
qiankun 2016/07/14 06:48:21 Maybe" ? : " is better. Use NOTREACHED(); if kee
+ return cleared_;
+ }
+
GLenum internal_format() const {
return internal_format_;
}
@@ -85,15 +99,33 @@ class GPU_EXPORT Renderbuffer
void set_cleared(bool cleared) {
cleared_ = cleared;
+ depth_cleared_ = cleared;
+ stencil_cleared_ = cleared;
+ }
+
+ // Only meaningful when the format is DEPTH_STENCIL.
+ // cleared_ is true only when both depth and stencil parts are cleared.
+ void set_cleared(GLenum attachment, bool cleared) {
+ if (!is_depth_stencil_)
+ return;
+ if (attachment == GL_DEPTH_ATTACHMENT) {
+ depth_cleared_ = cleared;
+ cleared_ = (depth_cleared_ == stencil_cleared_) ? cleared : false;
+ }
+ else if (attachment == GL_STENCIL_ATTACHMENT) {
+ stencil_cleared_ = cleared;
+ cleared_ = (depth_cleared_ == stencil_cleared_) ? cleared : false;
+ }
}
void SetInfo(
GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
samples_ = samples;
internal_format_ = internalformat;
+ is_depth_stencil_ = Framebuffer::IsDepthStencilFormat(internalformat);
width_ = width;
height_ = height;
- cleared_ = false;
+ set_cleared(false);
}
void MarkAsDeleted() {
@@ -109,13 +141,22 @@ class GPU_EXPORT Renderbuffer
// Service side renderbuffer id.
GLuint service_id_;
- // Whether this renderbuffer has been cleared
+ // Whether this renderbuffer has been cleared.
bool cleared_;
+ // Whether the format of this renderbuffer is DEPTH_STENCIL.
+ bool is_depth_stencil_;
+
+ // Only meaningful when format is DEPTH_STENCIL.
+ // Whether the depth part of the renderbuffer has been cleared.
+ bool depth_cleared_;
+ // Whether the stencil part of the renderbuffer has been cleared.
+ bool stencil_cleared_;
+
// Whether this renderbuffer has ever been bound.
bool has_been_bound_;
- // Number of samples (for multi-sampled renderbuffers)
+ // Number of samples (for multi-sampled renderbuffers).
GLsizei samples_;
// Renderbuffer internalformat set through RenderbufferStorage().
@@ -155,6 +196,10 @@ class GPU_EXPORT RenderbufferManager
void SetCleared(Renderbuffer* renderbuffer, bool cleared);
+ // Only meaningful when format is DEPTH_STENCIL.
+ // Sets the particular part of the renderbuffer as cleared or uncleared.
+ void SetCleared(Renderbuffer* renderbuffer, GLenum attachment, bool cleared);
+
// Must call before destruction.
void Destroy(bool have_context);

Powered by Google App Engine
This is Rietveld 408576698