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

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

Issue 2384593002: Encode frame number in pixel data for pose sync (Closed)
Patch Set: bajones #40: add sanity check + pointer zeroing Created 4 years, 2 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 | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7d64f6bc8f80548d0bb6392800e0d6a5c0591839..5c875a281eaa1989a87c9b3ade362301eeeda046 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -1139,7 +1139,11 @@ void WebGLRenderingContextBase::initializeNewContext() {
m_vertexAttribType.resize(m_maxVertexAttribs);
contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight());
- contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight());
+ m_scissorBox[0] = m_scissorBox[1] = 0;
+ m_scissorBox[2] = drawingBufferWidth();
+ m_scissorBox[3] = drawingBufferHeight();
+ contextGL()->Scissor(m_scissorBox[0], m_scissorBox[1], m_scissorBox[2],
+ m_scissorBox[3]);
drawingBuffer()->contextProvider()->setLostContextCallback(
convertToBaseCallback(WTF::bind(
@@ -1378,23 +1382,80 @@ WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) {
return combinedClear ? CombinedClear : JustClear;
}
-void WebGLRenderingContextBase::restoreStateAfterClear() {
+void WebGLRenderingContextBase::restoreScissorEnabled() {
if (isContextLost())
return;
- // Restore the state that the context set.
- if (m_scissorEnabled)
+ if (m_scissorEnabled) {
contextGL()->Enable(GL_SCISSOR_TEST);
+ } else {
+ contextGL()->Disable(GL_SCISSOR_TEST);
+ }
+}
+
+void WebGLRenderingContextBase::restoreScissorBox() {
+ if (isContextLost())
+ return;
+
+ contextGL()->Scissor(m_scissorBox[0], m_scissorBox[1], m_scissorBox[2],
+ m_scissorBox[3]);
+}
+
+void WebGLRenderingContextBase::restoreClearColor() {
+ if (isContextLost())
+ return;
+
contextGL()->ClearColor(m_clearColor[0], m_clearColor[1], m_clearColor[2],
m_clearColor[3]);
+}
+
+void WebGLRenderingContextBase::restoreClearDepthf() {
+ if (isContextLost())
+ return;
+
+ contextGL()->ClearDepthf(m_clearDepth);
+}
+
+void WebGLRenderingContextBase::restoreClearStencil() {
+ if (isContextLost())
+ return;
+
+ contextGL()->ClearStencil(m_clearStencil);
+}
+
+void WebGLRenderingContextBase::restoreStencilMaskSeparate() {
+ if (isContextLost())
+ return;
+
+ contextGL()->StencilMaskSeparate(GL_FRONT, m_stencilMask);
+}
+
+void WebGLRenderingContextBase::restoreColorMask() {
+ if (isContextLost())
+ return;
+
contextGL()->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2],
m_colorMask[3]);
- contextGL()->ClearDepthf(m_clearDepth);
- contextGL()->ClearStencil(m_clearStencil);
- contextGL()->StencilMaskSeparate(GL_FRONT, m_stencilMask);
+}
+
+void WebGLRenderingContextBase::restoreDepthMask() {
+ if (isContextLost())
+ return;
+
contextGL()->DepthMask(m_depthMask);
}
+void WebGLRenderingContextBase::restoreStateAfterClear() {
+ // Restore clear-related state items back to what the context had set.
+ restoreScissorEnabled();
+ restoreClearColor();
+ restoreColorMask();
+ restoreClearDepthf();
+ restoreClearStencil();
+ restoreStencilMaskSeparate();
+ restoreDepthMask();
+}
+
void WebGLRenderingContextBase::markLayerComposited() {
if (!isContextLost())
drawingBuffer()->setBufferClearNeeded(true);
@@ -4142,6 +4203,10 @@ void WebGLRenderingContextBase::scissor(GLint x,
GLsizei height) {
if (isContextLost())
return;
+ m_scissorBox[0] = x;
+ m_scissorBox[1] = y;
+ m_scissorBox[2] = width;
+ m_scissorBox[3] = height;
contextGL()->Scissor(x, y, width, height);
}
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698