| 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);
|
| }
|
|
|
|
|