Bug 665578: prevented ANGLE built-in function emulation on OS X 10.7 and newer r=bjacob
authorDoug Sherk <dsherk@mozilla.com>
Mon, 07 Nov 2011 19:33:51 -0500
changeset 79956 412bc4e114ec283fd789d0a23aaeb5a168f8dd3d
parent 79955 f7355dc166cd1a38219fd5f4d31e258dc71ea14f
child 79958 69f7d8cc0c00f785984183df7b4ee4b30db09bd3
push id3221
push userbjacob@mozilla.com
push dateTue, 08 Nov 2011 00:34:10 +0000
treeherdermozilla-inbound@412bc4e114ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs665578
milestone10.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 665578: prevented ANGLE built-in function emulation on OS X 10.7 and newer r=bjacob
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -59,16 +59,21 @@
 #if defined(USE_ANGLE)
 // shader translator
 #include "angle/ShaderLang.h"
 #endif
 
 #include "WebGLTexelConversions.h"
 #include "WebGLValidateStrings.h"
 
+// needed to check if current OS is lower than 10.7
+#if defined(MOZ_WIDGET_COCOA)
+#include "nsCocoaFeatures.h"
+#endif
+
 using namespace mozilla;
 
 static bool BaseTypeAndSizeFromUniformType(WebGLenum uType, WebGLenum *baseType, WebGLint *unitSize);
 static WebGLenum InternalFormatForFormatAndType(WebGLenum format, WebGLenum type, bool isGLES2);
 
 /* Helper macros for when we're just wrapping a gl method, so that
  * we can avoid having to type this 500 times.  Note that these MUST
  * NOT BE USED if we need to check any of the parameters.
@@ -4412,22 +4417,16 @@ WebGLContext::Viewport(WebGLint x, WebGL
     if (width < 0 || height < 0)
         return ErrorInvalidValue("Viewport: negative size");
 
     MakeContextCurrent();
     gl->fViewport(x, y, width, height);
     return NS_OK;
 }
 
-#ifdef XP_MACOSX
-#define WEBGL_OS_IS_MAC 1
-#else
-#define WEBGL_OS_IS_MAC 0
-#endif
-
 NS_IMETHODIMP
 WebGLContext::CompileShader(nsIWebGLShader *sobj)
 {
     if (mContextLost)
         return NS_OK;
 
     WebGLShader *shader;
     WebGLuint shadername;
@@ -4475,19 +4474,21 @@ WebGLContext::CompileShader(nsIWebGLShad
         const PRUint32 maxSourceLength = (PRUint32(1)<<18) - 1;
         if (sourceCString.Length() > maxSourceLength)
             return ErrorInvalidValue("compileShader: source has more than %d characters", maxSourceLength);
 
         const char *s = sourceCString.get();
         
         int compileOptions = SH_OBJECT_CODE;
         
+#ifdef XP_MACOSX
         // work around bug 665578
-        if (WEBGL_OS_IS_MAC && gl->Vendor() == gl::GLContext::VendorATI)
+        if (!nsCocoaFeatures::OnLionOrLater() && gl->Vendor() == gl::GLContext::VendorATI)
             compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
+#endif
 
         if (!ShCompile(compiler, &s, 1, compileOptions)) {
             int len = 0;
             ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &len);
 
             if (len) {
                 nsCAutoString info;
                 info.SetLength(len);