Add detection of limited texture NPOT support.

svn path=/trunk/KDE/kdebase/workspace/; revision=1198553
This commit is contained in:
Fredrik Höglund 2010-11-18 21:47:29 +00:00
parent 1c9f4c1684
commit bdd0273411
2 changed files with 39 additions and 1 deletions

View file

@ -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;
}

View file

@ -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;
};