Don't set GL_TEXTURE_MAX_LEVEL on GLES
GL_TEXTURE_MAX_LEVEL is not supported on GLES so we can't set it. It looks like Mesa was letting us get away with this but on other drivers it may cause errors. The enum is not defined in the GLES headers so it was failing to compile unless the GL driver is also enabled. The test-texture-mipmap-get-set test is now marked as n/a on GLES2 because it can't support limiting the sampled mipmaps. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit ba51c393818582b058f5f1e66cf8d13835ad10e5) Conflicts: tests/conform/test-conform-main.c
This commit is contained in:
parent
9a242832dc
commit
da7971f6be
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user