diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 083d38807f9f..938c5a7bee39 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -293,7 +293,8 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) "NVIDIA", "ATI", "Qualcomm", - "Imagination" + "Imagination", + "nouveau" }; mVendor = VendorOther; for (int i = 0; i < VendorOther; ++i) { @@ -512,11 +513,20 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) #ifdef XP_MACOSX if (mWorkAroundDriverBugs && mVendor == VendorIntel) { - // see bug 737182 for 2D textures, bug 684822 for cube map textures. + // see bug 737182 for 2D textures, bug 684882 for cube map textures. mMaxTextureSize = NS_MIN(mMaxTextureSize, 4096); mMaxCubeMapTextureSize = NS_MIN(mMaxCubeMapTextureSize, 512); // for good measure, we align renderbuffers on what we do for 2D textures mMaxRenderbufferSize = NS_MIN(mMaxRenderbufferSize, 4096); + mNeedsTextureSizeChecks = true; + } +#endif +#ifdef MOZ_X11 + if (mWorkAroundDriverBugs && + mVendor == VendorNouveau) { + // see bug 814716. Clamp MaxCubeMapTextureSize at 2K for Nouveau. + mMaxCubeMapTextureSize = NS_MIN(mMaxCubeMapTextureSize, 2048); + mNeedsTextureSizeChecks = true; } #endif diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index d322d6e644c9..49cd3566e70c 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -548,6 +548,7 @@ public: mMaxCubeMapTextureSize(0), mMaxTextureImageSize(0), mMaxRenderbufferSize(0), + mNeedsTextureSizeChecks(false), mWorkAroundDriverBugs(true) #ifdef DEBUG , mGLError(LOCAL_GL_NO_ERROR) @@ -724,6 +725,7 @@ public: VendorATI, VendorQualcomm, VendorImagination, + VendorNouveau, VendorOther }; @@ -1943,16 +1945,17 @@ protected: GLint mMaxCubeMapTextureSize; GLint mMaxTextureImageSize; GLint mMaxRenderbufferSize; + bool mNeedsTextureSizeChecks; bool mWorkAroundDriverBugs; bool IsTextureSizeSafeToPassToDriver(GLenum target, GLsizei width, GLsizei height) const { -#ifdef XP_MACOSX - if (mWorkAroundDriverBugs && - mVendor == VendorIntel) { - // see bug 737182 for 2D textures, bug 684822 for cube map textures. - // some drivers handle incorrectly some large texture sizes that are below the + if (mNeedsTextureSizeChecks) { + // some drivers incorrectly handle some large texture sizes that are below the // max texture size that they report. So we check ourselves against our own values // (mMax[CubeMap]TextureSize). + // see bug 737182 for Mac Intel 2D textures + // see bug 684882 for Mac Intel cube map textures + // see bug 814716 for Mesa Nouveau GLsizei maxSize = target == LOCAL_GL_TEXTURE_CUBE_MAP || (target >= LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) @@ -1960,7 +1963,6 @@ protected: : mMaxTextureSize; return width <= maxSize && height <= maxSize; } -#endif return true; }