diff --git a/cogl/cogl-debug-options.h b/cogl/cogl-debug-options.h index a73d7e1f6..1c0bd5bee 100644 --- a/cogl/cogl-debug-options.h +++ b/cogl/cogl-debug-options.h @@ -127,6 +127,12 @@ OPT (DISABLE_BLENDING, "disable-blending", "Disable blending", "Disable use of blending") +OPT (DISABLE_NPOT_TEXTURES, + "Root Cause", + "disable-npot-textures", + "Disable non-power-of-two textures", + "Makes Cogl think that the GL driver doesn't support NPOT textures " + "so that it will create sliced textures or textures with waste instead.") OPT (SHOW_SOURCE, "Cogl Tracing", "show-source", diff --git a/cogl/cogl-debug.c b/cogl/cogl-debug.c index 99049a6ee..94c276a91 100644 --- a/cogl/cogl-debug.c +++ b/cogl/cogl-debug.c @@ -69,7 +69,8 @@ static const GDebugKey cogl_behavioural_debug_keys[] = { { "disable-texturing", COGL_DEBUG_DISABLE_TEXTURING}, { "disable-arbfp", COGL_DEBUG_DISABLE_ARBFP}, { "disable-glsl", COGL_DEBUG_DISABLE_GLSL}, - { "disable-blending", COGL_DEBUG_DISABLE_BLENDING} + { "disable-blending", COGL_DEBUG_DISABLE_BLENDING}, + { "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES} }; static const int n_cogl_behavioural_debug_keys = G_N_ELEMENTS (cogl_behavioural_debug_keys); diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h index e9029afb2..9a390b4a8 100644 --- a/cogl/cogl-debug.h +++ b/cogl/cogl-debug.h @@ -55,7 +55,8 @@ typedef enum { COGL_DEBUG_SHOW_SOURCE = 1 << 22, COGL_DEBUG_DISABLE_BLENDING = 1 << 23, COGL_DEBUG_TEXTURE_PIXMAP = 1 << 24, - COGL_DEBUG_BITMAP = 1 << 25 + COGL_DEBUG_BITMAP = 1 << 25, + COGL_DEBUG_DISABLE_NPOT_TEXTURES = 1 << 26 } CoglDebugFlags; #ifdef COGL_ENABLE_DEBUG diff --git a/cogl/cogl.c b/cogl/cogl.c index 9f35468a7..e21b088b0 100644 --- a/cogl/cogl.c +++ b/cogl/cogl.c @@ -444,6 +444,12 @@ cogl_get_features (void) if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_GLSL)) ctx->feature_flags &= ~COGL_FEATURE_SHADERS_GLSL; + if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_NPOT_TEXTURES)) + ctx->feature_flags &= ~(COGL_FEATURE_TEXTURE_NPOT | + COGL_FEATURE_TEXTURE_NPOT_BASIC | + COGL_FEATURE_TEXTURE_NPOT_MIPMAP | + COGL_FEATURE_TEXTURE_NPOT_REPEAT); + return ctx->feature_flags; }