diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h index ce47eec19..6e2d301cc 100644 --- a/cogl/cogl-private.h +++ b/cogl/cogl-private.h @@ -55,7 +55,8 @@ typedef enum COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM = 1L<<19, COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS = 1L<<20, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES = 1L<<21, - COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE = 1L<<22 + COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE = 1L<<22, + COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL = 1L<<23 } CoglPrivateFeatureFlags; /* Sometimes when evaluating pipelines, either during comparisons or diff --git a/cogl/driver/gl/cogl-texture-gl.c b/cogl/driver/gl/cogl-texture-gl.c index 3dd4607d0..a7dfc6835 100644 --- a/cogl/driver/gl/cogl-texture-gl.c +++ b/cogl/driver/gl/cogl-texture-gl.c @@ -99,7 +99,12 @@ void _cogl_texture_gl_maybe_update_max_level (CoglTexture *texture, int max_level) { - if (texture->max_level < max_level) + /* This isn't supported on GLES */ +#ifdef HAVE_COGL_GL + CoglContext *ctx = texture->context; + + if ((ctx->private_feature_flags & COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL) && + texture->max_level < max_level) { CoglContext *ctx = texture->context; GLuint gl_handle; @@ -116,6 +121,7 @@ _cogl_texture_gl_maybe_update_max_level (CoglTexture *texture, GE( ctx, glTexParameteri (gl_target, GL_TEXTURE_MAX_LEVEL, texture->max_level)); } +#endif /* HAVE_COGL_GL */ } void diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c index e4b45cb59..713390cc5 100644 --- a/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/driver/gl/gl/cogl-driver-gl.c @@ -594,7 +594,8 @@ _cogl_driver_update_features (CoglContext *ctx, COGL_PRIVATE_FEATURE_FORMAT_CONVERSION | COGL_PRIVATE_FEATURE_BLEND_CONSTANT | COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM | - COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS); + COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS | + COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL); /* Cache features */ ctx->private_feature_flags |= private_flags; diff --git a/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c index 4fce7abc7..46da7f62f 100644 --- a/cogl/driver/gl/gl/cogl-texture-driver-gl.c +++ b/cogl/driver/gl/gl/cogl-texture-driver-gl.c @@ -73,7 +73,10 @@ _cogl_texture_driver_gen (CoglContext *ctx, * level to 0 so OpenGL will consider the texture storage to be * "complete". */ - GE( ctx, glTexParameteri (gl_target, GL_TEXTURE_MAX_LEVEL, 0)); +#ifdef HAVE_COGL_GL + if ((ctx->private_feature_flags & COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL)) + GE( ctx, glTexParameteri (gl_target, GL_TEXTURE_MAX_LEVEL, 0)); +#endif /* GL_TEXTURE_MAG_FILTER defaults to GL_LINEAR, no need to set it */ GE( ctx, glTexParameteri (gl_target, diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c index 77de3acc1..4162dbc05 100644 --- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c +++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c @@ -82,14 +82,6 @@ _cogl_texture_driver_gen (CoglContext *ctx, { case GL_TEXTURE_2D: case GL_TEXTURE_3D: - /* In case automatic mipmap generation gets disabled for this - * texture but a minification filter depending on mipmap - * interpolation is selected then we initialize the max mipmap - * level to 0 so OpenGL will consider the texture storage to be - * "complete". - */ - GE( ctx, glTexParameteri (gl_target, GL_TEXTURE_MAX_LEVEL, 0)); - /* GL_TEXTURE_MAG_FILTER defaults to GL_LINEAR, no need to set it */ GE( ctx, glTexParameteri (gl_target, GL_TEXTURE_MIN_FILTER,