diff options
author | jgilbert@mozilla.com <jgilbert@mozilla.com> | 2018-05-24 15:45:25 -0700 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-07 15:55:02 +0200 |
commit | 887e2c8b190e9586f10ac16a3a90ec209ec6b7bb (patch) | |
tree | 1824c1ad72117af6c4cc79623a2c83f838d95b19 /dom/canvas | |
parent | cd4da92df48738574c832d9badefd9c542fc6149 (diff) | |
download | UXP-887e2c8b190e9586f10ac16a3a90ec209ec6b7bb.tar UXP-887e2c8b190e9586f10ac16a3a90ec209ec6b7bb.tar.gz UXP-887e2c8b190e9586f10ac16a3a90ec209ec6b7bb.tar.lz UXP-887e2c8b190e9586f10ac16a3a90ec209ec6b7bb.tar.xz UXP-887e2c8b190e9586f10ac16a3a90ec209ec6b7bb.zip |
Bug 1458264 - Reset UNPACK_SKIP vars when uploading zeros.
Diffstat (limited to 'dom/canvas')
-rw-r--r-- | dom/canvas/WebGLContextDraw.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp index 867e47cbd..fd9ee4957 100644 --- a/dom/canvas/WebGLContextDraw.cpp +++ b/dom/canvas/WebGLContextDraw.cpp @@ -216,7 +216,21 @@ WebGLContext::BindFakeBlack(uint32_t texUnit, TexTarget target, FakeBlackType fa UniquePtr<FakeBlackTexture>& fakeBlackTex = *slot; if (!fakeBlackTex) { + gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1); + if (IsWebGL2()) { + gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_PIXELS, 0); + gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_ROWS, 0); + gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, 0); + } + fakeBlackTex = FakeBlackTexture::Create(gl, target, fakeBlack); + + gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, mPixelStore_UnpackAlignment); + if (IsWebGL2()) { + gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_PIXELS, mPixelStore_UnpackSkipPixels); + gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_ROWS, mPixelStore_UnpackSkipRows); + gl->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, mPixelStore_UnpackSkipImages); + } if (!fakeBlackTex) { return false; } @@ -1212,13 +1226,8 @@ WebGLContext::FakeBlackTexture::Create(gl::GLContext* gl, TexTarget target, gl->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST); gl->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST); - // We allocate our zeros on the heap, and we overallocate (16 bytes instead of 4) to - // minimize the risk of running into a driver bug in texImage2D, as it is a bit - // unusual maybe to create 1x1 textures, and the stack may not have the alignment that - // TexImage2D expects. - const webgl::DriverUnpackInfo dui = {texFormat, texFormat, LOCAL_GL_UNSIGNED_BYTE}; - UniqueBuffer zeros = moz_xcalloc(1, 16); // Infallible allocation. + UniqueBuffer zeros = moz_xcalloc(1, 4); // Infallible allocation. MOZ_ASSERT(gl->IsCurrent()); |