mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl: Generalize maybe_update_max_level()
into set_max_level()
This way the caller can choose their own precondition. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1003
This commit is contained in:
parent
a3f27dfd89
commit
f4301b77fa
@ -204,7 +204,7 @@ struct _CoglTexture
|
||||
CoglContext *context;
|
||||
CoglTextureLoader *loader;
|
||||
GList *framebuffers;
|
||||
int max_level;
|
||||
int max_level_set;
|
||||
int width;
|
||||
int height;
|
||||
gboolean allocated;
|
||||
|
@ -115,7 +115,7 @@ _cogl_texture_init (CoglTexture *texture,
|
||||
const CoglTextureVtable *vtable)
|
||||
{
|
||||
texture->context = context;
|
||||
texture->max_level = 0;
|
||||
texture->max_level_set = 0;
|
||||
texture->width = width;
|
||||
texture->height = height;
|
||||
texture->allocated = FALSE;
|
||||
|
@ -567,7 +567,8 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
|
||||
&gl_format,
|
||||
&gl_type);
|
||||
|
||||
_cogl_texture_gl_maybe_update_max_level (tex, level);
|
||||
if (tex->max_level_set < level)
|
||||
cogl_texture_gl_set_max_level (tex, level);
|
||||
|
||||
status = ctx->texture_driver->upload_subregion_to_gl (ctx,
|
||||
tex,
|
||||
|
@ -53,7 +53,7 @@ _cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,
|
||||
unsigned int mag_filter);
|
||||
|
||||
void
|
||||
_cogl_texture_gl_maybe_update_max_level (CoglTexture *texture,
|
||||
cogl_texture_gl_set_max_level (CoglTexture *texture,
|
||||
int max_level);
|
||||
|
||||
void
|
||||
|
@ -107,26 +107,25 @@ _cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,
|
||||
#endif
|
||||
|
||||
void
|
||||
_cogl_texture_gl_maybe_update_max_level (CoglTexture *texture,
|
||||
cogl_texture_gl_set_max_level (CoglTexture *texture,
|
||||
int max_level)
|
||||
{
|
||||
CoglContext *ctx = texture->context;
|
||||
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL) &&
|
||||
texture->max_level < max_level)
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL))
|
||||
{
|
||||
GLuint gl_handle;
|
||||
GLenum gl_target;
|
||||
|
||||
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
||||
|
||||
texture->max_level = max_level;
|
||||
texture->max_level_set = max_level;
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target,
|
||||
gl_handle);
|
||||
|
||||
GE( ctx, glTexParameteri (gl_target,
|
||||
GL_TEXTURE_MAX_LEVEL, texture->max_level));
|
||||
GL_TEXTURE_MAX_LEVEL, texture->max_level_set));
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +137,8 @@ _cogl_texture_gl_generate_mipmaps (CoglTexture *texture)
|
||||
GLuint gl_handle;
|
||||
GLenum gl_target;
|
||||
|
||||
_cogl_texture_gl_maybe_update_max_level (texture, n_levels - 1);
|
||||
if (texture->max_level_set < n_levels - 1)
|
||||
cogl_texture_gl_set_max_level (texture, n_levels - 1);
|
||||
|
||||
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
||||
|
||||
|
@ -255,7 +255,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
|
||||
* glTexImage2D first to assert that the storage for this
|
||||
* level exists.
|
||||
*/
|
||||
if (texture->max_level < level)
|
||||
if (texture->max_level_set < level)
|
||||
{
|
||||
ctx->glTexImage2D (gl_target,
|
||||
level,
|
||||
|
@ -303,7 +303,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
|
||||
* glTexImage2D first to assert that the storage for this
|
||||
* level exists.
|
||||
*/
|
||||
if (texture->max_level < level)
|
||||
if (texture->max_level_set < level)
|
||||
{
|
||||
ctx->glTexImage2D (gl_target,
|
||||
level,
|
||||
|
Loading…
Reference in New Issue
Block a user