Chromium Code Reviews| 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 7ec6b2eac83aa8f3e36774d88a8034e0f475149b..00d44b002387f415213eae3d31c9df45ec8ea967 100644 |
| --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| @@ -1588,8 +1588,14 @@ void WebGLRenderingContextBase::reshape(int width, int height) { |
| if (isContextLost()) |
| return; |
| + GLint buffer = 0; |
| if (isWebGL2OrHigher()) { |
| - contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| + // This query returns client side cached binding, so it's trivia. |
|
Ken Russell (switch to Gerrit)
2017/01/24 00:40:56
Typo: trivia -> trivial
|
| + // If it changes in the future, such query is heavy and should be avoided. |
| + contextGL()->GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &buffer); |
| + if (buffer) { |
| + contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| + } |
| } |
| // This is an approximation because at WebGLRenderingContextBase level we |
| @@ -1618,6 +1624,11 @@ void WebGLRenderingContextBase::reshape(int width, int height) { |
| // We don't have to mark the canvas as dirty, since the newly created image |
| // buffer will also start off clear (and this matches what reshape will do). |
| drawingBuffer()->resize(IntSize(width, height)); |
| + |
| + if (buffer) { |
| + contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, |
| + static_cast<GLuint>(buffer)); |
| + } |
| } |
| int WebGLRenderingContextBase::drawingBufferWidth() const { |