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

Unified Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 10388010: Decoupling backbuffer allocation suggestion from frontbuffer allocation suggestion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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: content/common/gpu/texture_image_transport_surface.cc
diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
index de9d3357c228ed844581e5710786f2b608f67197..bd40acf892203dcee9b17303ad931950e1b12595 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -65,6 +65,8 @@ TextureImageTransportSurface::TextureImageTransportSurface(
: fbo_id_(0),
front_(0),
stub_destroyed_(false),
+ backbuffer_suggested_allocation_(true),
+ frontbuffer_suggested_allocation_(true),
parent_stub_(NULL) {
GpuChannel* parent_channel = manager->LookupChannel(handle.parent_client_id);
DCHECK(parent_channel);
@@ -155,19 +157,27 @@ unsigned int TextureImageTransportSurface::GetBackingFrameBufferObject() {
return fbo_id_;
}
-void TextureImageTransportSurface::SetBufferAllocation(
- BufferAllocationState state) {
+void TextureImageTransportSurface::SetBackbufferAllocation(bool allocation) {
+ if (backbuffer_suggested_allocation_ == allocation)
+ return;
+ backbuffer_suggested_allocation_ = allocation;
+ AdjustBufferAllocations();
+}
+
+void TextureImageTransportSurface::SetFrontbufferAllocation(bool allocation) {
+ if (frontbuffer_suggested_allocation_ == allocation)
+ return;
+ frontbuffer_suggested_allocation_ = allocation;
+ AdjustBufferAllocations();
jonathan.backer 2012/05/09 18:13:01 Why are we doing this when AdjustBufferAllocations
mmocny 2012/05/09 18:59:15 Just for consistency. I can remove it from this p
jonathan.backer 2012/05/10 21:37:48 I'm concerned that order of allocating buffers mat
+}
+
+void TextureImageTransportSurface::AdjustBufferAllocations() {
if (!helper_->MakeCurrent())
return;
- switch (state) {
- case BUFFER_ALLOCATION_FRONT_AND_BACK:
- CreateBackTexture(textures_[back()].size);
- break;
- case BUFFER_ALLOCATION_FRONT_ONLY:
- case BUFFER_ALLOCATION_NONE:
- ReleaseBackTexture();
- break;
- };
+ if (backbuffer_suggested_allocation_)
+ CreateBackTexture(textures_[back()].size);
+ else
+ ReleaseBackTexture();
}
void* TextureImageTransportSurface::GetShareHandle() {

Powered by Google App Engine
This is Rietveld 408576698