Bug 1239259 - Fix WebGL2 generateMipmap checking. r=jgilbert
authorEthan Lin <ethlin@mozilla.com>
Wed, 13 Jan 2016 02:08:00 +0100
changeset 280840 1ba31786ecfd539f6fd681a4f897d788027bbb77
parent 280839 f405663b5570ba4462a7703ba3f0b4f1d9dcc143
child 280841 9f34b95fa1d029c7eae575190efed6e2536547ad
push id70610
push usercbook@mozilla.com
push dateThu, 21 Jan 2016 08:25:59 +0000
treeherdermozilla-inbound@1ba31786ecfd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1239259
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1239259 - Fix WebGL2 generateMipmap checking. r=jgilbert
dom/canvas/WebGLTexture.cpp
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -737,16 +737,22 @@ WebGLTexture::GenerateMipmap(TexTarget t
     }
 
     if (format->hasDepth) {
         mContext->ErrorInvalidOperation("generateMipmap: Depth textures are not"
                                         " supported.");
         return;
     }
 
+    if (!baseImageInfo.mFormat->isRenderable || !baseImageInfo.mFormat->isFilterable) {
+        mContext->ErrorInvalidOperation("generateMipmap: Texture at base level is not"
+                                        " color-renderable or texture-filterable.");
+        return;
+    }
+
     // Done with validation. Do the operation.
 
     mContext->MakeContextCurrent();
     gl::GLContext* gl = mContext->gl;
 
     if (gl->WorkAroundDriverBugs()) {
         // bug 696495 - to work around failures in the texture-mips.html test on various drivers, we
         // set the minification filter before calling glGenerateMipmap. This should not carry a significant performance