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

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

Issue 2662003002: Fix a bug where PIXEL_UNPACK_BUFFER is cleared but never restored. (Closed)
Patch Set: Fix a bug where PIXEL_UNPACK_BUFFER is cleared but never restored. 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
« no previous file with comments | « no previous file | 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 7ec6b2eac83aa8f3e36774d88a8034e0f475149b..e4a0bf40951a7ffc29e0c81ce372d7ef43edff3a 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 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 {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698