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

Unified Diff: gpu/command_buffer/service/framebuffer_manager.cc

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/framebuffer_manager.cc
diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc
index 0c5d96708e856d8e9c3d8578eb785c9f2d18c71e..a26483eb291b5655b5a41f3fc7cbbaac4182c991 100644
--- a/gpu/command_buffer/service/framebuffer_manager.cc
+++ b/gpu/command_buffer/service/framebuffer_manager.cc
@@ -48,8 +48,11 @@ class RenderbufferAttachment
: public Framebuffer::Attachment {
public:
explicit RenderbufferAttachment(
- Renderbuffer* renderbuffer)
- : renderbuffer_(renderbuffer) {
+ Renderbuffer* renderbuffer, GLenum attachment)
+ : renderbuffer_(renderbuffer),
+ attachment_(attachment) {
+ is_depth_stencil_ = renderbuffer ?
+ Framebuffer::IsDepthStencilFormat(internal_format()) : false;
}
GLsizei width() const override { return renderbuffer_->width(); }
@@ -69,13 +72,27 @@ class RenderbufferAttachment
GLuint object_name() const override { return renderbuffer_->client_id(); }
- bool cleared() const override { return renderbuffer_->cleared(); }
+ GLenum attachment() const override { return attachment_; }
+
+ bool IsDepthStencil() const override { return is_depth_stencil_; }
+
+ bool cleared() const override {
+ if (!is_depth_stencil_)
+ return renderbuffer_->cleared();
+ else
+ return renderbuffer_->cleared(attachment_);
+ }
void SetCleared(RenderbufferManager* renderbuffer_manager,
TextureManager* /* texture_manager */,
bool cleared) override {
DCHECK(renderbuffer_manager);
- renderbuffer_manager->SetCleared(renderbuffer_.get(), cleared);
+ if (!is_depth_stencil_)
+ renderbuffer_manager->SetCleared(renderbuffer_.get(), cleared);
+ else
+ renderbuffer_manager->SetCleared(renderbuffer_.get(),
+ attachment_,
+ cleared);
}
bool IsPartiallyCleared() const override { return false; }
@@ -139,6 +156,9 @@ class RenderbufferAttachment
private:
scoped_refptr<Renderbuffer> renderbuffer_;
+ GLenum attachment_;
+ bool is_depth_stencil_;
+
DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment);
};
@@ -147,12 +167,15 @@ class TextureAttachment
public:
TextureAttachment(
TextureRef* texture_ref, GLenum target, GLint level,
- GLsizei samples, GLint layer)
+ GLsizei samples, GLint layer, GLenum attachment)
: texture_ref_(texture_ref),
target_(target),
level_(level),
samples_(samples),
- layer_(layer) {
+ layer_(layer),
+ attachment_(attachment) {
+ is_depth_stencil_ = texture_ref ?
+ Framebuffer::IsDepthStencilFormat(internal_format()) : false;
}
GLsizei width() const override {
@@ -197,16 +220,28 @@ class TextureAttachment
GLuint object_name() const override { return texture_ref_->client_id(); }
+ GLenum attachment() const override { return attachment_; }
+
+ bool IsDepthStencil() const override { return is_depth_stencil_; }
+
bool cleared() const override {
- return texture_ref_->texture()->IsLevelCleared(target_, level_);
+ if (!is_depth_stencil_)
+ return texture_ref_->texture()->IsLevelCleared(target_, level_);
+ else
+ return texture_ref_->texture()->IsLevelCleared(target_, level_,
+ attachment_);
}
void SetCleared(RenderbufferManager* /* renderbuffer_manager */,
TextureManager* texture_manager,
bool cleared) override {
DCHECK(texture_manager);
- texture_manager->SetLevelCleared(
- texture_ref_.get(), target_, level_, cleared);
+ if (!is_depth_stencil_)
+ texture_manager->SetLevelCleared(
+ texture_ref_.get(), target_, level_, cleared);
+ else
+ texture_manager->SetLevelCleared(
+ texture_ref_.get(), target_, level_, attachment_, cleared);
}
bool IsPartiallyCleared() const override {
@@ -303,6 +338,9 @@ class TextureAttachment
GLsizei samples_;
GLint layer_;
+ GLenum attachment_;
+ bool is_depth_stencil_;
+
DISALLOW_COPY_AND_ASSIGN(TextureAttachment);
};
@@ -536,6 +574,11 @@ void Framebuffer::MarkAttachmentAsCleared(
texture_manager,
cleared);
}
+ } else if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
qiankun 2016/07/14 06:48:21 What about move the else branch out of MarkAttachm
+ MarkAttachmentAsCleared(renderbuffer_manager, texture_manager,
+ GL_DEPTH_ATTACHMENT, cleared);
+ MarkAttachmentAsCleared(renderbuffer_manager, texture_manager,
+ GL_STENCIL_ATTACHMENT, cleared);
}
}
@@ -724,7 +767,7 @@ GLenum Framebuffer::GetStatus(
}
bool Framebuffer::IsCleared() const {
- // are all the attachments cleaared?
+ // are all the attachments cleared?
for (AttachmentMap::const_iterator it = attachments_.begin();
it != attachments_.end(); ++it) {
Attachment* attachment = it->second.get();
@@ -847,7 +890,7 @@ void Framebuffer::AttachRenderbuffer(
a->DetachFromFramebuffer(this);
if (renderbuffer) {
attachments_[attachment] = scoped_refptr<Attachment>(
- new RenderbufferAttachment(renderbuffer));
+ new RenderbufferAttachment(renderbuffer, attachment));
} else {
attachments_.erase(attachment);
}
@@ -862,7 +905,8 @@ void Framebuffer::AttachTexture(
a->DetachFromFramebuffer(this);
if (texture_ref) {
attachments_[attachment] = scoped_refptr<Attachment>(
- new TextureAttachment(texture_ref, target, level, samples, 0));
+ new TextureAttachment(texture_ref, target, level,
+ samples, 0, attachment));
texture_ref->texture()->AttachToFramebuffer();
} else {
attachments_.erase(attachment);
@@ -878,7 +922,8 @@ void Framebuffer::AttachTextureLayer(
a->DetachFromFramebuffer(this);
if (texture_ref) {
attachments_[attachment] = scoped_refptr<Attachment>(
- new TextureAttachment(texture_ref, target, level, 0, layer));
+ new TextureAttachment(texture_ref, target, level,
+ 0, layer, attachment));
texture_ref->texture()->AttachToFramebuffer();
} else {
attachments_.erase(attachment);

Powered by Google App Engine
This is Rietveld 408576698