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

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 #4: use contextGL(), auto-restore state, add poseNum to VRPosePtr 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
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 4c2ebadfd568aebe2fd11d95476bb8508c0a495a..b5d874152cb5c5e821b0d81662282b5574d83b54 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -1136,7 +1136,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(
@@ -1375,8 +1379,12 @@ void WebGLRenderingContextBase::restoreStateAfterClear() {
return;
// Restore the state that the context set.
- if (m_scissorEnabled)
+ if (m_scissorEnabled) {
contextGL()->Enable(GL_SCISSOR_TEST);
+ // WebVR's VRDisplay uses a custom scissor box, need to restore that too.
+ contextGL()->Scissor(m_scissorBox[0], m_scissorBox[1], m_scissorBox[2],
+ m_scissorBox[3]);
+ }
contextGL()->ClearColor(m_clearColor[0], m_clearColor[1], m_clearColor[2],
m_clearColor[3]);
contextGL()->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2],
@@ -4156,6 +4164,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);
}

Powered by Google App Engine
This is Rietveld 408576698