diff --git a/gl/cogl.c b/gl/cogl.c index e41a3d4c9..f594c8546 100644 --- a/gl/cogl.c +++ b/gl/cogl.c @@ -840,6 +840,32 @@ cogl_setup_viewport (guint width, GE( glTranslatef (0.0f, -1.0 * height, 0.0f) ); } +#ifdef HAVE_CLUTTER_OSX +static gboolean +really_enable_npot (void) +{ + /* OSX backend + ATI Radeon X1600 + NPOT texture + GL_REPEAT seems to crash + * http://bugzilla.openedhand.com/show_bug.cgi?id=929 + * + * Temporary workaround until post 0.8 we rejig the features set up a + * little to allow the backend to overide. + */ + const char *gl_renderer; + const char *env_string; + + /* Regardless of hardware, allow user to decide. */ + env_string = g_getenv ("COGL_ENABLE_NPOT"); + if (env_string != NULL) + return env_string[0] == '1'; + + gl_renderer = (char*)glGetString (GL_RENDERER); + if (strstr (gl_renderer, "ATI Radeon X1600") != NULL) + return FALSE; + + return TRUE; +} +#endif + static void _cogl_features_init () { @@ -855,7 +881,10 @@ _cogl_features_init () if (cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions)) { - flags |= COGL_FEATURE_TEXTURE_NPOT; +#ifdef HAVE_CLUTTER_OSX + if (really_enable_npot ()) +#endif + flags |= COGL_FEATURE_TEXTURE_NPOT; } #ifdef GL_YCBCR_MESA