cogl/texture: Drop set_auto_mipmap vfunc
As it is only relavant for 2D textures. Allows getting rid of the is-primitive property which was enforcing only 2D textures can use the set_auto_mipmap function. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4200>
This commit is contained in:
parent
f613c82ab5
commit
4ee657e31f
@ -192,7 +192,7 @@ create_offscreen (ClutterStageView *view,
|
||||
width, height, format);
|
||||
}
|
||||
|
||||
cogl_texture_set_auto_mipmap (texture, FALSE);
|
||||
cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE_2D (texture), FALSE);
|
||||
|
||||
if (!cogl_texture_allocate (texture, error))
|
||||
return FALSE;
|
||||
|
@ -77,10 +77,6 @@ _cogl_texture_2d_create_base (CoglContext *ctx,
|
||||
CoglPixelFormat internal_format,
|
||||
CoglTextureLoader *loader);
|
||||
|
||||
void
|
||||
_cogl_texture_2d_set_auto_mipmap (CoglTexture *tex,
|
||||
gboolean value);
|
||||
|
||||
/*
|
||||
* _cogl_texture_2d_externally_modified:
|
||||
* @texture: A #CoglTexture2D object
|
||||
|
@ -66,12 +66,10 @@ cogl_texture_2d_dispose (GObject *object)
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_texture_2d_set_auto_mipmap (CoglTexture *tex,
|
||||
gboolean value)
|
||||
cogl_texture_2d_set_auto_mipmap (CoglTexture2D *tex,
|
||||
gboolean value)
|
||||
{
|
||||
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
||||
|
||||
tex_2d->auto_mipmap = value;
|
||||
tex->auto_mipmap = value;
|
||||
}
|
||||
|
||||
CoglTexture *
|
||||
@ -87,7 +85,6 @@ _cogl_texture_2d_create_base (CoglContext *ctx,
|
||||
"height", height,
|
||||
"loader", loader,
|
||||
"format", internal_format,
|
||||
"is-primitive", TRUE,
|
||||
NULL);
|
||||
CoglTextureDriverClass *tex_driver =
|
||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
||||
@ -355,7 +352,6 @@ cogl_texture_2d_class_init (CoglTexture2DClass *klass)
|
||||
texture_class->gl_flush_legacy_texobj_wrap_modes = _cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes;
|
||||
texture_class->get_format = _cogl_texture_2d_get_format;
|
||||
texture_class->get_gl_format = _cogl_texture_2d_get_gl_format;
|
||||
texture_class->set_auto_mipmap = _cogl_texture_2d_set_auto_mipmap;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -229,4 +229,20 @@ cogl_texture_2d_new_from_egl_image_external (CoglContext *ctx,
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* cogl_texture_2d_set_auto_mipmap:
|
||||
* @texture: A #CoglTexture2D
|
||||
* @value: The new value for whether to auto mipmap
|
||||
*
|
||||
* Sets whether the texture will automatically update the smaller
|
||||
* mipmap levels after any part of level 0 is updated. The update will
|
||||
* only occur whenever the texture is used for drawing with a texture
|
||||
* filter that requires the lower mipmap levels. An application should
|
||||
* disable this if it wants to upload its own data for the other
|
||||
* levels. By default auto mipmapping is enabled.
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
cogl_texture_2d_set_auto_mipmap (CoglTexture2D *texture,
|
||||
gboolean value);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -182,10 +182,6 @@ struct _CoglTextureClass
|
||||
|
||||
CoglPixelFormat (* get_format) (CoglTexture *tex);
|
||||
GLenum (* get_gl_format) (CoglTexture *tex);
|
||||
|
||||
/* Only needs to be implemented if is_primitive == TRUE */
|
||||
void (* set_auto_mipmap) (CoglTexture *texture,
|
||||
gboolean value);
|
||||
};
|
||||
|
||||
gboolean
|
||||
|
@ -63,7 +63,6 @@
|
||||
typedef struct _CoglTexturePrivate
|
||||
{
|
||||
CoglContext *context;
|
||||
gboolean is_primitive;
|
||||
CoglTextureLoader *loader;
|
||||
GList *framebuffers;
|
||||
int max_level_set;
|
||||
@ -90,7 +89,6 @@ enum
|
||||
PROP_HEIGHT,
|
||||
PROP_LOADER,
|
||||
PROP_FORMAT,
|
||||
PROP_IS_PRIMITIVE,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
@ -177,10 +175,6 @@ cogl_texture_set_property (GObject *gobject,
|
||||
priv->premultiplied = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_IS_PRIMITIVE:
|
||||
priv->is_primitive = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -222,10 +216,6 @@ cogl_texture_class_init (CoglTextureClass *klass)
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_IS_PRIMITIVE] =
|
||||
g_param_spec_boolean ("is-primitive", NULL, NULL,
|
||||
FALSE, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class,
|
||||
PROP_LAST,
|
||||
@ -1385,17 +1375,3 @@ cogl_texture_set_max_level_set (CoglTexture *texture,
|
||||
cogl_texture_get_instance_private (texture);
|
||||
priv->max_level_set = max_level_set;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_texture_set_auto_mipmap (CoglTexture *texture,
|
||||
gboolean value)
|
||||
{
|
||||
CoglTexturePrivate *priv;
|
||||
g_return_if_fail (COGL_IS_TEXTURE (texture));
|
||||
priv = cogl_texture_get_instance_private (texture);
|
||||
g_return_if_fail (priv->is_primitive);
|
||||
|
||||
g_assert (COGL_TEXTURE_GET_CLASS (texture)->set_auto_mipmap != NULL);
|
||||
|
||||
COGL_TEXTURE_GET_CLASS (texture)->set_auto_mipmap (texture, value);
|
||||
}
|
||||
|
@ -449,22 +449,6 @@ cogl_texture_allocate (CoglTexture *texture,
|
||||
COGL_EXPORT gboolean
|
||||
cogl_texture_is_get_data_supported (CoglTexture *texture);
|
||||
|
||||
/**
|
||||
* cogl_texture_set_auto_mipmap:
|
||||
* @texture: A #CoglTexture
|
||||
* @value: The new value for whether to auto mipmap
|
||||
*
|
||||
* Sets whether the texture will automatically update the smaller
|
||||
* mipmap levels after any part of level 0 is updated. The update will
|
||||
* only occur whenever the texture is used for drawing with a texture
|
||||
* filter that requires the lower mipmap levels. An application should
|
||||
* disable this if it wants to upload its own data for the other
|
||||
* levels. By default auto mipmapping is enabled.
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
cogl_texture_set_auto_mipmap (CoglTexture *texture,
|
||||
gboolean value);
|
||||
|
||||
COGL_EXPORT CoglPixelFormat
|
||||
cogl_texture_get_format (CoglTexture *texture);
|
||||
|
||||
|
@ -388,7 +388,7 @@ draw_cursor_sprite_via_offscreen (MetaScreenCastStreamSrc *src,
|
||||
|
||||
bitmap_texture = cogl_texture_2d_new_with_size (cogl_context,
|
||||
bitmap_width, bitmap_height);
|
||||
cogl_texture_set_auto_mipmap (bitmap_texture, FALSE);
|
||||
cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE_2D (bitmap_texture), FALSE);
|
||||
if (!cogl_texture_allocate (bitmap_texture, error))
|
||||
{
|
||||
g_object_unref (bitmap_texture);
|
||||
|
@ -1300,7 +1300,7 @@ meta_renderer_native_create_offscreen (MetaRendererNative *renderer_native,
|
||||
view_width, view_height,
|
||||
format);
|
||||
}
|
||||
cogl_texture_set_auto_mipmap (tex, FALSE);
|
||||
cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE_2D (tex), FALSE);
|
||||
|
||||
if (!cogl_texture_allocate (tex, error))
|
||||
{
|
||||
|
@ -1585,7 +1585,7 @@ create_framebuffer_from_window_actor (MetaWindowActor *self,
|
||||
if (!texture)
|
||||
return NULL;
|
||||
|
||||
cogl_texture_set_auto_mipmap (texture, FALSE);
|
||||
cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE_2D (texture), FALSE);
|
||||
|
||||
offscreen = cogl_offscreen_new_with_texture (texture);
|
||||
framebuffer = COGL_FRAMEBUFFER (offscreen);
|
||||
|
@ -193,7 +193,7 @@ set_auto_mipmap_cb (CoglTexture *sub_texture,
|
||||
const float *meta_coords,
|
||||
void *user_data)
|
||||
{
|
||||
cogl_texture_set_auto_mipmap (sub_texture, FALSE);
|
||||
cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE_2D (sub_texture), FALSE);
|
||||
}
|
||||
|
||||
CoglTexture *
|
||||
|
Loading…
x
Reference in New Issue
Block a user