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

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

Issue 7099007: Enforce RGB even on buggy drivers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add checks for reading GL_ALPHA_BITS etc. Created 9 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 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 190a91097bc6e63c4717e082bd902dec3e31d9b0..316bc32a20022669cea7d5fcc39821a0acc0ea08 100644
--- a/gpu/command_buffer/service/framebuffer_manager.cc
+++ b/gpu/command_buffer/service/framebuffer_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -43,6 +43,10 @@ class RenderbufferAttachment
render_buffer_->set_cleared();
}
+ virtual bool IsTexture(TextureManager::TextureInfo* /* texture */) const {
+ return false;
+ }
+
RenderbufferManager::RenderbufferInfo* render_buffer() const {
return render_buffer_.get();
}
@@ -99,6 +103,10 @@ class TextureAttachment
NOTREACHED();
}
+ virtual bool IsTexture(TextureManager::TextureInfo* texture) const {
+ return texture == texture_.get();
+ }
+
TextureManager::TextureInfo* texture() const {
return texture_.get();
}
@@ -169,6 +177,25 @@ void FramebufferManager::FramebufferInfo::MarkAttachedRenderbuffersAsCleared() {
}
}
+bool FramebufferManager::FramebufferInfo::HasDepthAttachment() const {
+ return attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT) != attachments_.end() ||
+ attachments_.find(GL_DEPTH_ATTACHMENT) != attachments_.end();
+}
+
+bool FramebufferManager::FramebufferInfo::HasStencilAttachment() const {
+ return attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT) != attachments_.end() ||
+ attachments_.find(GL_STENCIL_ATTACHMENT) != attachments_.end();
+}
+
+GLenum FramebufferManager::FramebufferInfo::GetColorAttachmentFormat() const {
+ AttachmentMap::const_iterator it = attachments_.find(GL_COLOR_ATTACHMENT0);
+ if (it == attachments_.end()) {
+ return 0;
+ }
+ const Attachment* attachment = it->second;
+ return attachment->internal_format();
+}
+
bool FramebufferManager::FramebufferInfo::IsNotComplete() const {
for (AttachmentMap::const_iterator it = attachments_.begin();
it != attachments_.end(); ++it) {
@@ -215,9 +242,14 @@ void FramebufferManager::FramebufferInfo::AttachTexture(
attachment == GL_DEPTH_ATTACHMENT ||
attachment == GL_STENCIL_ATTACHMENT ||
attachment == GL_DEPTH_STENCIL_ATTACHMENT);
+ const Attachment* a = GetAttachment(attachment);
+ if (a && a->IsTexture(texture)) {
+ texture->DetachFromFramebuffer();
+ }
if (texture) {
attachments_[attachment] = Attachment::Ref(
new TextureAttachment(texture, target, level));
+ texture->AttachToFramebuffer();
} else {
attachments_.erase(attachment);
}
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.h ('k') | gpu/command_buffer/service/framebuffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698