diff --git a/lib/kwinglplatform.cpp b/lib/kwinglplatform.cpp index 309bed3062..f67eec5218 100644 --- a/lib/kwinglplatform.cpp +++ b/lib/kwinglplatform.cpp @@ -364,6 +364,8 @@ void GLPlatform::detect() m_extensions.contains("GL_ARB_vertex_shader") && m_glslVersion >= kVersionNumber(1, 0); + m_textureNPOT = m_extensions.contains("GL_ARB_texture_non_power_of_two"); + m_chipset = "Unknown"; @@ -493,7 +495,17 @@ void GLPlatform::detect() if (m_chipClass < R300) m_supportsGLSL = false; - m_limitedGLSL = m_supportsGLSL && m_chipClass < R600; + m_limitedGLSL = false; + m_limitedNPOT = false; + + if (m_chipClass < R600) { + if (driver() == Driver_Catalyst) + m_textureNPOT = m_limitedNPOT = false; // Software fallback + else if (driver() == Driver_R300G) + m_limitedNPOT = m_textureNPOT; + + m_limitedGLSL = m_supportsGLSL; + } if (driver() == Driver_R600G || (driver() == Driver_R600C && m_renderer.contains("DRI2"))) @@ -509,6 +521,7 @@ void GLPlatform::detect() if (m_driver == Driver_NVidia) m_looseBinding = true; + m_limitedNPOT = m_textureNPOT && m_chipClass < NV40; m_limitedGLSL = m_supportsGLSL && m_chipClass < G80; } @@ -532,6 +545,12 @@ bool GLPlatform::supports(GLFeature feature) const case LimitedGLSL: return m_limitedGLSL; + case TextureNPOT: + return m_textureNPOT; + + case LimitedNPOT: + return m_limitedNPOT; + default: return false; } diff --git a/lib/kwinglplatform.h b/lib/kwinglplatform.h index b5b5d27442..c7ba2fcb77 100644 --- a/lib/kwinglplatform.h +++ b/lib/kwinglplatform.h @@ -65,6 +65,23 @@ enum GLFeature { * - Max 4 texture indirections */ LimitedGLSL, + + /** + * Set when the driver supports GL_ARB_texture_non_power_of_two. + */ + TextureNPOT, + + /** + * If set, the driver supports GL_ARB_texture_non_power_of_two with the + * GL_ARB_texture_rectangle limitations. + * + * This means no support for mipmap filters, and that only the following + * wrap modes are supported: + * - GL_CLAMP + * - GL_CLAMP_TO_EDGE + * - GL_CLAMP_TO_BORDER + */ + LimitedNPOT }; enum Driver { @@ -234,6 +251,8 @@ private: bool m_directRendering:1; bool m_supportsGLSL:1; bool m_limitedGLSL:1; + bool m_textureNPOT:1; + bool m_limitedNPOT:1; static GLPlatform *s_platform; };