Bug 743813 - Fix the warnings generated by WebGL activeTexture - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Tue, 10 Apr 2012 11:51:30 -0400
changeset 91319 8a59c745c563f334651d9d896c995e755e84b974
parent 91318 971f7705b978c90cc58228fd3471ed884c7bc1b3
child 91320 95a886a80f9bee11f1cac4c31f4b49f04ca84719
push id22438
push usermbrubeck@mozilla.com
push dateWed, 11 Apr 2012 15:56:36 +0000
treeherdermozilla-central@63f78a93ae5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs743813
milestone14.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 743813 - Fix the warnings generated by WebGL activeTexture - r=jgilbert
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -129,19 +129,25 @@ NS_IMETHODIMP WebGLContext::name(t1 a1, 
 
 /* void GlActiveTexture (in GLenum texture); */
 NS_IMETHODIMP
 WebGLContext::ActiveTexture(WebGLenum texture)
 {
     if (!IsContextStable())
         return NS_OK;
 
-    if (texture < LOCAL_GL_TEXTURE0 || texture >= LOCAL_GL_TEXTURE0 + mBound2DTextures.Length())
-        return ErrorInvalidEnum("ActiveTexture: texture unit %d out of range (0..%d)",
-                                texture, mBound2DTextures.Length()-1);
+    if (texture < LOCAL_GL_TEXTURE0 ||
+        texture >= LOCAL_GL_TEXTURE0 + mGLMaxTextureUnits)
+    {
+        return ErrorInvalidEnum(
+            "ActiveTexture: texture unit %d out of range. "
+            "Accepted values range from TEXTURE0 to TEXTURE0 + %d. "
+            "Notice that TEXTURE0 != 0.",
+            texture, mGLMaxTextureUnits);
+    }
 
     MakeContextCurrent();
     mActiveTexture = texture - LOCAL_GL_TEXTURE0;
     gl->fActiveTexture(texture);
     return NS_OK;
 }
 
 NS_IMETHODIMP