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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2584343002: WIP: working copy-no-compositor path
Patch Set: StatTracker destructor, delete old magic numbers, mojo export Created 3 years, 11 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: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index e4dda2d44d30bc75380860dbd2ec25774ddf4a81..e868b8595f91092046a8db7985760f8f472b5381 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -1209,6 +1209,8 @@ void WebGLRenderingContextBase::initializeNewContext() {
m_readBufferOfDefaultFramebuffer = GL_BACK;
+ m_surfaceHandle = 0;
+
m_defaultVertexArrayObject = WebGLVertexArrayObject::create(
this, WebGLVertexArrayObjectBase::VaoTypeDefault);
@@ -7658,6 +7660,35 @@ void WebGLRenderingContextBase::setBackDrawBuffer(GLenum buf) {
m_backDrawBuffer = buf;
}
+void WebGLRenderingContextBase::setSurfaceHandle(int handle) {
+ if (handle == m_surfaceHandle)
+ return;
+
+ if (isContextLost())
+ return;
+
+ // LOG(INFO) << "klausw:WebGLRenderingContextBase::setSurfaceHandle(" <<
+ // handle << ") isBoundForDraw=" << DrawingBufferClientIsBoundForDraw();
+ m_surfaceHandle = handle;
+
+ // Rebind to the drawing buffer first before releasing the surface,
+ // but only if we're currently using the default framebuffer. If
+ // we're drawing elsewhere, this will be rebound in a future
+ // bindFramebuffer call at the appropriate time.
+ if (drawingBuffer() && DrawingBufferClientIsBoundForDraw() && !handle) {
+ drawingBuffer()->bind(GL_FRAMEBUFFER);
+ }
+
+ contextGL()->SetSurfaceHandleCHROMIUM(m_surfaceHandle);
+ contextGL()->Flush();
+ contextGL()->Finish();
+
+ // Bind to the surface once it's set up.
+ if (DrawingBufferClientIsBoundForDraw() && handle) {
+ contextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
+ }
+}
+
void WebGLRenderingContextBase::setFramebuffer(GLenum target,
WebGLFramebuffer* buffer) {
if (buffer)
@@ -7668,8 +7699,12 @@ void WebGLRenderingContextBase::setFramebuffer(GLenum target,
applyStencilTest();
}
if (!buffer) {
- // Instead of binding fb 0, bind the drawing buffer.
- drawingBuffer()->bind(target);
+ if (m_surfaceHandle) {
+ contextGL()->BindFramebuffer(target, 0);
+ } else {
+ // Instead of binding fb 0, bind the drawing buffer.
+ drawingBuffer()->bind(target);
+ }
} else {
contextGL()->BindFramebuffer(target, buffer->object());
}

Powered by Google App Engine
This is Rietveld 408576698