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

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

Issue 2166923002: Add unittests for InvalidateFramebuffer with DEPTH_STENCIL_ATTACHMENT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo 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
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 caa129e9fc3625a0b4727aa225f7654df75ce9ec..3d1c4d8be199019845eb03d2c8b31d005f82d52e 100644
--- a/gpu/command_buffer/service/framebuffer_manager.cc
+++ b/gpu/command_buffer/service/framebuffer_manager.cc
@@ -421,24 +421,39 @@ Framebuffer::~Framebuffer() {
}
bool Framebuffer::HasUnclearedAttachment(
- GLenum attachment) const {
- AttachmentMap::const_iterator it =
- attachments_.find(attachment);
- if (it != attachments_.end()) {
- const Attachment* attachment = it->second.get();
- return !attachment->cleared();
+ GLenum attachment_type) const {
+ const Attachment* attachment = GetAttachment(attachment_type);
+ switch (attachment_type) {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ attachment = attachment ? attachment :
+ GetAttachment(GL_DEPTH_STENCIL_ATTACHMENT);
+ break;
+ default:
+ break;
}
- return false;
+ return attachment && !attachment->cleared();
}
-bool Framebuffer::HasDepthStencilFormatAttachment(
- GLenum attachment) const {
- AttachmentMap::const_iterator it = attachments_.find(attachment);
- if (it != attachments_.end()) {
- const Attachment* attachment = it->second.get();
- GLenum internal_format = attachment->internal_format();
- return TextureManager::ExtractFormatFromStorageFormat(internal_format) ==
- GL_DEPTH_STENCIL;
+bool Framebuffer::HasDepthStencilFormatAttachment() const {
+ const Attachment* depth_attachment = GetAttachment(GL_DEPTH_ATTACHMENT);
+ const Attachment* stencil_attachment = GetAttachment(GL_STENCIL_ATTACHMENT);
+ const Attachment* depth_stencil_attachment = GetAttachment(
+ GL_DEPTH_STENCIL_ATTACHMENT);
+ if (depth_attachment && stencil_attachment) {
+ GLenum depth_format = depth_attachment->internal_format();
+ depth_format = TextureManager::ExtractFormatFromStorageFormat(depth_format);
+ GLenum stencil_format = stencil_attachment->internal_format();
+ stencil_format = TextureManager::ExtractFormatFromStorageFormat(
+ stencil_format);
+ return depth_format == GL_DEPTH_STENCIL &&
+ stencil_format == GL_DEPTH_STENCIL;
+ }
+ if (depth_stencil_attachment) {
+ GLenum depth_stencil_format = depth_stencil_attachment->internal_format();
+ depth_stencil_format = TextureManager::ExtractFormatFromStorageFormat(
+ depth_stencil_format);
+ return depth_stencil_format == GL_DEPTH_STENCIL;
}
return false;
}
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698