summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 01:23:55 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 01:23:55 +0000
commit5eb008af79c28949e274d3f0e8ea94cc800a3e11 (patch)
tree6cbc9dc006d2c1714b8489171bd88cc5137d85d4 /gpu
parent2b01b170dcb5ff1e454c7334c23926fa4c058ca2 (diff)
downloadchromium_src-5eb008af79c28949e274d3f0e8ea94cc800a3e11.zip
chromium_src-5eb008af79c28949e274d3f0e8ea94cc800a3e11.tar.gz
chromium_src-5eb008af79c28949e274d3f0e8ea94cc800a3e11.tar.bz2
Avoid actual MakeCurrent() calls with virtual contexts.
When switching to a context that only renders to an FBO, and when the underlying GL surface handle does not change, avoid calling GLContext::MakeCurrent(). BUG=160710 Review URL: https://chromiumcodereview.appspot.com/11308252 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gl_context_virtual.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc
index 4145d3a..ff5fd20 100644
--- a/gpu/command_buffer/service/gl_context_virtual.cc
+++ b/gpu/command_buffer/service/gl_context_virtual.cc
@@ -50,10 +50,22 @@ bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
}
void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) {
+ if (IsCurrent(surface))
+ shared_context_->ReleaseCurrent(surface);
}
bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) {
- return true;
+ bool context_current = shared_context_->IsCurrent(NULL);
+ if (!context_current)
+ return false;
+
+ if (!surface)
+ return true;
+
+ gfx::GLSurface* current_surface = gfx::GLSurface::GetCurrent();
+ return surface->GetBackingFrameBufferObject() ||
+ (current_surface &&
+ current_surface->GetHandle() == surface->GetHandle());
}
void* GLContextVirtual::GetHandle() {