texture: rename texobj flush code as gl specific

This renames the set_filters and set_wrap_mode_parameters texture
virtual functions to gl_flush_legacy_texobj_filters and
gl_flush_legacy_texobj_wrap_modes respectively to clarify that they are
opengl driver specific and that they are only used to support the legacy
opengl apis for setting filters and wrap modes where the state is
associated with texture objects instead of being associated with sampler
objects.

This part of an effort to clearly delimit our abstraction over opengl so
that we can start to consider non-opengl backends for Cogl.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6f78b8a613340d7c6b736e51a16c625f52154430)
This commit is contained in:
Robert Bragg 2012-09-10 20:35:39 +01:00
parent ab72a2275f
commit 8326c71b6b
15 changed files with 227 additions and 212 deletions

View File

@ -247,7 +247,7 @@ _cogl_atlas_texture_foreach_sub_texture_in_region (
}
static void
_cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
@ -255,7 +255,7 @@ _cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex,
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
/* Forward on to the sub texture */
_cogl_texture_set_wrap_mode_parameters (atlas_tex->sub_texture,
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
@ -348,14 +348,15 @@ _cogl_atlas_texture_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_atlas_texture_set_filters (CoglTexture *tex,
_cogl_atlas_texture_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
/* Forward on to the sub texture */
_cogl_texture_set_filters (atlas_tex->sub_texture, min_filter, mag_filter);
_cogl_texture_gl_flush_legacy_texobj_filters (atlas_tex->sub_texture,
min_filter, mag_filter);
}
static void
@ -826,10 +827,10 @@ cogl_atlas_texture_vtable =
_cogl_atlas_texture_transform_coords_to_gl,
_cogl_atlas_texture_transform_quad_coords_to_gl,
_cogl_atlas_texture_get_gl_texture,
_cogl_atlas_texture_set_filters,
_cogl_atlas_texture_gl_flush_legacy_texobj_filters,
_cogl_atlas_texture_pre_paint,
_cogl_atlas_texture_ensure_non_quad_rendering,
_cogl_atlas_texture_set_wrap_mode_parameters,
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes,
_cogl_atlas_texture_get_format,
_cogl_atlas_texture_get_gl_format,
_cogl_atlas_texture_get_width,

View File

@ -183,14 +183,14 @@ _cogl_sub_texture_foreach_sub_texture_in_region (
}
static void
_cogl_sub_texture_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_sub_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
_cogl_texture_set_wrap_mode_parameters (sub_tex->full_texture,
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (sub_tex->full_texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
@ -341,13 +341,14 @@ _cogl_sub_texture_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_sub_texture_set_filters (CoglTexture *tex,
_cogl_sub_texture_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
_cogl_texture_set_filters (sub_tex->full_texture, min_filter, mag_filter);
_cogl_texture_gl_flush_legacy_texobj_filters (sub_tex->full_texture,
min_filter, mag_filter);
}
static void
@ -437,10 +438,10 @@ cogl_sub_texture_vtable =
_cogl_sub_texture_transform_coords_to_gl,
_cogl_sub_texture_transform_quad_coords_to_gl,
_cogl_sub_texture_get_gl_texture,
_cogl_sub_texture_set_filters,
_cogl_sub_texture_gl_flush_legacy_texobj_filters,
_cogl_sub_texture_pre_paint,
_cogl_sub_texture_ensure_non_quad_rendering,
_cogl_sub_texture_set_wrap_mode_parameters,
_cogl_sub_texture_gl_flush_legacy_texobj_wrap_modes,
_cogl_sub_texture_get_format,
_cogl_sub_texture_get_gl_format,
_cogl_sub_texture_get_width,

View File

@ -40,20 +40,24 @@ struct _CoglTexture2D
/* The internal format of the GL texture represented as a
CoglPixelFormat */
CoglPixelFormat format;
/* The internal format of the GL texture represented as a GL enum */
GLenum gl_format;
/* The texture object number */
GLuint gl_texture;
int width;
int height;
GLenum min_filter;
GLenum mag_filter;
GLint wrap_mode_s;
GLint wrap_mode_t;
CoglBool auto_mipmap;
CoglBool mipmaps_dirty;
CoglBool is_foreign;
/* TODO: factor out these OpenGL specific members into some form
* of driver private state. */
/* The internal format of the GL texture represented as a GL enum */
GLenum gl_format;
/* The texture object number */
GLuint gl_texture;
GLenum gl_legacy_texobj_min_filter;
GLenum gl_legacy_texobj_mag_filter;
GLint gl_legacy_texobj_wrap_mode_s;
GLint gl_legacy_texobj_wrap_mode_t;
CoglTexturePixel first_pixel;
};

View File

@ -584,7 +584,7 @@ _cogl_pot_slices_for_size (int size_to_fill,
}
static void
_cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
@ -599,7 +599,7 @@ _cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex,
CoglTexture2D *,
i);
_cogl_texture_set_wrap_mode_parameters (COGL_TEXTURE (slice_tex),
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (COGL_TEXTURE (slice_tex),
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
@ -1170,7 +1170,7 @@ _cogl_texture_2d_sliced_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_texture_2d_sliced_set_filters (CoglTexture *tex,
_cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
@ -1188,7 +1188,7 @@ _cogl_texture_2d_sliced_set_filters (CoglTexture *tex,
for (i = 0; i < tex_2ds->slice_textures->len; i++)
{
slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
_cogl_texture_set_filters (COGL_TEXTURE (slice_tex),
_cogl_texture_gl_flush_legacy_texobj_filters (COGL_TEXTURE (slice_tex),
min_filter, mag_filter);
}
}
@ -1328,10 +1328,10 @@ cogl_texture_2d_sliced_vtable =
_cogl_texture_2d_sliced_transform_coords_to_gl,
_cogl_texture_2d_sliced_transform_quad_coords_to_gl,
_cogl_texture_2d_sliced_get_gl_texture,
_cogl_texture_2d_sliced_set_filters,
_cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters,
_cogl_texture_2d_sliced_pre_paint,
_cogl_texture_2d_sliced_ensure_non_quad_rendering,
_cogl_texture_2d_sliced_set_wrap_mode_parameters,
_cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_2d_sliced_get_format,
_cogl_texture_2d_sliced_get_gl_format,
_cogl_texture_2d_sliced_get_width,

View File

@ -64,7 +64,7 @@ typedef struct _CoglTexture2DManualRepeatData
} CoglTexture2DManualRepeatData;
static void
_cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
@ -75,8 +75,8 @@ _cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
/* Only set the wrap mode if it's different from the current value
to avoid too many GL calls. Texture 2D doesn't make use of the r
coordinate so we can ignore its wrap mode */
if (tex_2d->wrap_mode_s != wrap_mode_s ||
tex_2d->wrap_mode_t != wrap_mode_t)
if (tex_2d->gl_legacy_texobj_wrap_mode_s != wrap_mode_s ||
tex_2d->gl_legacy_texobj_wrap_mode_t != wrap_mode_t)
{
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
tex_2d->gl_texture,
@ -88,8 +88,8 @@ _cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
GL_TEXTURE_WRAP_T,
wrap_mode_t) );
tex_2d->wrap_mode_s = wrap_mode_s;
tex_2d->wrap_mode_t = wrap_mode_t;
tex_2d->gl_legacy_texobj_wrap_mode_s = wrap_mode_s;
tex_2d->gl_legacy_texobj_wrap_mode_t = wrap_mode_t;
}
}
@ -165,12 +165,12 @@ _cogl_texture_2d_create_base (CoglContext *ctx,
tex_2d->auto_mipmap = TRUE;
/* We default to GL_LINEAR for both filters */
tex_2d->min_filter = GL_LINEAR;
tex_2d->mag_filter = GL_LINEAR;
tex_2d->gl_legacy_texobj_min_filter = GL_LINEAR;
tex_2d->gl_legacy_texobj_mag_filter = GL_LINEAR;
/* Wrap mode not yet set */
tex_2d->wrap_mode_s = GL_FALSE;
tex_2d->wrap_mode_t = GL_FALSE;
tex_2d->gl_legacy_texobj_wrap_mode_s = GL_FALSE;
tex_2d->gl_legacy_texobj_wrap_mode_t = GL_FALSE;
tex_2d->is_foreign = FALSE;
@ -481,8 +481,8 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
tex_2d->gl_format = gl_int_format;
/* Unknown filter */
tex_2d->min_filter = GL_FALSE;
tex_2d->mag_filter = GL_FALSE;
tex_2d->gl_legacy_texobj_min_filter = GL_FALSE;
tex_2d->gl_legacy_texobj_mag_filter = GL_FALSE;
return _cogl_texture_2d_object_new (tex_2d);
}
@ -724,20 +724,20 @@ _cogl_texture_2d_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_texture_2d_set_filters (CoglTexture *tex,
_cogl_texture_2d_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
CoglContext *ctx = tex->context;
if (min_filter == tex_2d->min_filter
&& mag_filter == tex_2d->mag_filter)
if (min_filter == tex_2d->gl_legacy_texobj_min_filter
&& mag_filter == tex_2d->gl_legacy_texobj_mag_filter)
return;
/* Store new values */
tex_2d->min_filter = min_filter;
tex_2d->mag_filter = mag_filter;
tex_2d->gl_legacy_texobj_min_filter = min_filter;
tex_2d->gl_legacy_texobj_mag_filter = mag_filter;
/* Apply new filters to the texture */
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
@ -934,10 +934,10 @@ cogl_texture_2d_vtable =
_cogl_texture_2d_transform_coords_to_gl,
_cogl_texture_2d_transform_quad_coords_to_gl,
_cogl_texture_2d_get_gl_texture,
_cogl_texture_2d_set_filters,
_cogl_texture_2d_gl_flush_legacy_texobj_filters,
_cogl_texture_2d_pre_paint,
_cogl_texture_2d_ensure_non_quad_rendering,
_cogl_texture_2d_set_wrap_mode_parameters,
_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_2d_get_format,
_cogl_texture_2d_get_gl_format,
_cogl_texture_2d_get_width,

View File

@ -34,24 +34,27 @@ struct _CoglTexture3D
{
CoglTexture _parent;
/* The internal format of the GL texture represented as a
/* The internal format of the texture represented as a
CoglPixelFormat */
CoglPixelFormat format;
int width;
int height;
int depth;
CoglBool auto_mipmap;
CoglBool mipmaps_dirty;
/* TODO: factor out these OpenGL specific members into some form
* of driver private state. */
/* The internal format of the GL texture represented as a GL enum */
GLenum gl_format;
/* The texture object number */
GLuint gl_texture;
int width;
int height;
int depth;
GLenum min_filter;
GLenum mag_filter;
GLint wrap_mode_s;
GLint wrap_mode_t;
GLint wrap_mode_p;
CoglBool auto_mipmap;
CoglBool mipmaps_dirty;
GLenum gl_legacy_texobj_min_filter;
GLenum gl_legacy_texobj_mag_filter;
GLint gl_legacy_texobj_wrap_mode_s;
GLint gl_legacy_texobj_wrap_mode_t;
GLint gl_legacy_texobj_wrap_mode_p;
CoglTexturePixel first_pixel;
};

View File

@ -57,7 +57,7 @@ COGL_TEXTURE_DEFINE (Texture3D, texture_3d);
static const CoglTextureVtable cogl_texture_3d_vtable;
static void
_cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_texture_3d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
@ -67,9 +67,9 @@ _cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex,
/* Only set the wrap mode if it's different from the current value
to avoid too many GL calls. */
if (tex_3d->wrap_mode_s != wrap_mode_s ||
tex_3d->wrap_mode_t != wrap_mode_t ||
tex_3d->wrap_mode_p != wrap_mode_p)
if (tex_3d->gl_legacy_texobj_wrap_mode_s != wrap_mode_s ||
tex_3d->gl_legacy_texobj_wrap_mode_t != wrap_mode_t ||
tex_3d->gl_legacy_texobj_wrap_mode_p != wrap_mode_p)
{
_cogl_bind_gl_texture_transient (GL_TEXTURE_3D,
tex_3d->gl_texture,
@ -84,9 +84,9 @@ _cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex,
GL_TEXTURE_WRAP_R,
wrap_mode_p) );
tex_3d->wrap_mode_s = wrap_mode_s;
tex_3d->wrap_mode_t = wrap_mode_t;
tex_3d->wrap_mode_p = wrap_mode_p;
tex_3d->gl_legacy_texobj_wrap_mode_s = wrap_mode_s;
tex_3d->gl_legacy_texobj_wrap_mode_t = wrap_mode_t;
tex_3d->gl_legacy_texobj_wrap_mode_p = wrap_mode_p;
}
}
@ -127,13 +127,13 @@ _cogl_texture_3d_create_base (CoglContext *ctx,
tex_3d->auto_mipmap = TRUE;
/* We default to GL_LINEAR for both filters */
tex_3d->min_filter = GL_LINEAR;
tex_3d->mag_filter = GL_LINEAR;
tex_3d->gl_legacy_texobj_min_filter = GL_LINEAR;
tex_3d->gl_legacy_texobj_mag_filter = GL_LINEAR;
/* Wrap mode not yet set */
tex_3d->wrap_mode_s = GL_FALSE;
tex_3d->wrap_mode_t = GL_FALSE;
tex_3d->wrap_mode_p = GL_FALSE;
tex_3d->gl_legacy_texobj_wrap_mode_s = GL_FALSE;
tex_3d->gl_legacy_texobj_wrap_mode_t = GL_FALSE;
tex_3d->gl_legacy_texobj_wrap_mode_p = GL_FALSE;
tex_3d->format = internal_format;
@ -480,20 +480,20 @@ _cogl_texture_3d_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_texture_3d_set_filters (CoglTexture *tex,
_cogl_texture_3d_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex);
CoglContext *ctx = tex->context;
if (min_filter == tex_3d->min_filter
&& mag_filter == tex_3d->mag_filter)
if (min_filter == tex_3d->gl_legacy_texobj_min_filter
&& mag_filter == tex_3d->gl_legacy_texobj_mag_filter)
return;
/* Store new values */
tex_3d->min_filter = min_filter;
tex_3d->mag_filter = mag_filter;
tex_3d->gl_legacy_texobj_min_filter = min_filter;
tex_3d->gl_legacy_texobj_mag_filter = mag_filter;
/* Apply new filters to the texture */
_cogl_bind_gl_texture_transient (GL_TEXTURE_3D,
@ -626,10 +626,10 @@ cogl_texture_3d_vtable =
_cogl_texture_3d_transform_coords_to_gl,
_cogl_texture_3d_transform_quad_coords_to_gl,
_cogl_texture_3d_get_gl_texture,
_cogl_texture_3d_set_filters,
_cogl_texture_3d_gl_flush_legacy_texobj_filters,
_cogl_texture_3d_pre_paint,
_cogl_texture_3d_ensure_non_quad_rendering,
_cogl_texture_3d_set_wrap_mode_parameters,
_cogl_texture_3d_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_3d_get_format,
_cogl_texture_3d_get_gl_format,
_cogl_texture_3d_get_width,

View File

@ -108,14 +108,16 @@ struct _CoglTextureVtable
GLuint *out_gl_handle,
GLenum *out_gl_target);
void (* set_filters) (CoglTexture *tex,
/* OpenGL driver specific virtual function */
void (* gl_flush_legacy_texobj_filters) (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter);
void (* pre_paint) (CoglTexture *tex, CoglTexturePrePaintFlags flags);
void (* ensure_non_quad_rendering) (CoglTexture *tex);
void (* set_wrap_mode_parameters) (CoglTexture *tex,
/* OpenGL driver specific virtual function */
void (* gl_flush_legacy_texobj_wrap_modes) (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p);
@ -207,14 +209,13 @@ GLenum
_cogl_texture_get_gl_format (CoglTexture *texture);
void
_cogl_texture_set_wrap_mode_parameters (CoglTexture *texture,
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *texture,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p);
void
_cogl_texture_set_filters (CoglTexture *texture,
_cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,
GLenum min_filter,
GLenum mag_filter);

View File

@ -32,19 +32,23 @@ struct _CoglTextureRectangle
{
CoglTexture _parent;
/* The internal format of the GL texture represented as a
/* The internal format of the texture represented as a
CoglPixelFormat */
CoglPixelFormat format;
int width;
int height;
/* TODO: factor out these OpenGL specific members into some form
* of driver private state. */
/* The internal format of the GL texture represented as a GL enum */
GLenum gl_format;
/* The texture object number */
GLuint gl_texture;
int width;
int height;
GLenum min_filter;
GLenum mag_filter;
GLint wrap_mode_s;
GLint wrap_mode_t;
GLenum gl_legacy_texobj_min_filter;
GLenum gl_legacy_texobj_mag_filter;
GLint gl_legacy_texobj_wrap_mode_s;
GLint gl_legacy_texobj_wrap_mode_t;
CoglBool is_foreign;
};

View File

@ -68,7 +68,7 @@ can_use_wrap_mode (GLenum wrap_mode)
}
static void
_cogl_texture_rectangle_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_texture_rectangle_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
@ -79,8 +79,8 @@ _cogl_texture_rectangle_set_wrap_mode_parameters (CoglTexture *tex,
/* Only set the wrap mode if it's different from the current value
to avoid too many GL calls. Texture rectangle doesn't make use of
the r coordinate so we can ignore its wrap mode */
if (tex_rect->wrap_mode_s != wrap_mode_s ||
tex_rect->wrap_mode_t != wrap_mode_t)
if (tex_rect->gl_legacy_texobj_wrap_mode_s != wrap_mode_s ||
tex_rect->gl_legacy_texobj_wrap_mode_t != wrap_mode_t)
{
g_assert (can_use_wrap_mode (wrap_mode_s));
g_assert (can_use_wrap_mode (wrap_mode_t));
@ -93,8 +93,8 @@ _cogl_texture_rectangle_set_wrap_mode_parameters (CoglTexture *tex,
GE( ctx, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB,
GL_TEXTURE_WRAP_T, wrap_mode_t) );
tex_rect->wrap_mode_s = wrap_mode_s;
tex_rect->wrap_mode_t = wrap_mode_t;
tex_rect->gl_legacy_texobj_wrap_mode_s = wrap_mode_s;
tex_rect->gl_legacy_texobj_wrap_mode_t = wrap_mode_t;
}
}
@ -176,12 +176,12 @@ _cogl_texture_rectangle_create_base (CoglContext *ctx,
tex_rect->height = height;
/* We default to GL_LINEAR for both filters */
tex_rect->min_filter = GL_LINEAR;
tex_rect->mag_filter = GL_LINEAR;
tex_rect->gl_legacy_texobj_min_filter = GL_LINEAR;
tex_rect->gl_legacy_texobj_mag_filter = GL_LINEAR;
/* Wrap mode not yet set */
tex_rect->wrap_mode_s = GL_FALSE;
tex_rect->wrap_mode_t = GL_FALSE;
tex_rect->gl_legacy_texobj_wrap_mode_s = GL_FALSE;
tex_rect->gl_legacy_texobj_wrap_mode_t = GL_FALSE;
tex_rect->format = internal_format;
@ -413,8 +413,8 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
tex_rect->gl_format = gl_int_format;
/* Unknown filter */
tex_rect->min_filter = GL_FALSE;
tex_rect->mag_filter = GL_FALSE;
tex_rect->gl_legacy_texobj_min_filter = GL_FALSE;
tex_rect->gl_legacy_texobj_mag_filter = GL_FALSE;
return _cogl_texture_rectangle_object_new (tex_rect);
}
@ -484,23 +484,23 @@ _cogl_texture_rectangle_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_texture_rectangle_set_filters (CoglTexture *tex,
_cogl_texture_rectangle_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex);
CoglContext *ctx = tex->context;
if (min_filter == tex_rect->min_filter
&& mag_filter == tex_rect->mag_filter)
if (min_filter == tex_rect->gl_legacy_texobj_min_filter
&& mag_filter == tex_rect->gl_legacy_texobj_mag_filter)
return;
/* Rectangle textures don't support mipmapping */
g_assert (min_filter == GL_LINEAR || min_filter == GL_NEAREST);
/* Store new values */
tex_rect->min_filter = min_filter;
tex_rect->mag_filter = mag_filter;
tex_rect->gl_legacy_texobj_min_filter = min_filter;
tex_rect->gl_legacy_texobj_mag_filter = mag_filter;
/* Apply new filters to the texture */
_cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB,
@ -649,10 +649,10 @@ cogl_texture_rectangle_vtable =
_cogl_texture_rectangle_transform_coords_to_gl,
_cogl_texture_rectangle_transform_quad_coords_to_gl,
_cogl_texture_rectangle_get_gl_texture,
_cogl_texture_rectangle_set_filters,
_cogl_texture_rectangle_gl_flush_legacy_texobj_filters,
_cogl_texture_rectangle_pre_paint,
_cogl_texture_rectangle_ensure_non_quad_rendering,
_cogl_texture_rectangle_set_wrap_mode_parameters,
_cogl_texture_rectangle_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_rectangle_get_format,
_cogl_texture_rectangle_get_gl_format,
_cogl_texture_rectangle_get_width,

View File

@ -301,19 +301,6 @@ _cogl_texture_prep_gl_alignment_for_pixels_download (int bpp,
GE( ctx, glPixelStorei (GL_PACK_ALIGNMENT, alignment) );
}
/* FIXME: wrap modes should be set on pipelines not textures */
void
_cogl_texture_set_wrap_mode_parameters (CoglTexture *texture,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
{
texture->vtable->set_wrap_mode_parameters (texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
}
CoglTexture *
cogl_texture_new_with_size (unsigned int width,
unsigned int height,
@ -655,14 +642,6 @@ _cogl_texture_get_type (CoglTexture *texture)
return texture->vtable->get_type (texture);
}
void
_cogl_texture_set_filters (CoglTexture *texture,
GLenum min_filter,
GLenum mag_filter)
{
texture->vtable->set_filters (texture, min_filter, mag_filter);
}
void
_cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags)
{
@ -1458,3 +1437,23 @@ _cogl_texture_spans_foreach_in_region (CoglSpan *x_spans,
}
}
void
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *texture,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
{
texture->vtable->gl_flush_legacy_texobj_wrap_modes (texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
}
void
_cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,
GLenum min_filter,
GLenum mag_filter)
{
texture->vtable->gl_flush_legacy_texobj_filters (texture,
min_filter, mag_filter);
}

View File

@ -924,8 +924,8 @@ _cogl_texture_prepare_for_upload
_cogl_texture_prep_gl_alignment_for_pixels_upload
_cogl_texture_pre_paint
_cogl_texture_register_texture_type
_cogl_texture_set_filters
_cogl_texture_set_wrap_mode_parameters
_cogl_texture_gl_flush_legacy_texobj_filters
_cogl_texture_gl_flush_legacy_texobj_wrap_modes
_cogl_texture_transform_coords_to_gl
_cogl_texture_transform_quad_coords_to_gl
#endif

View File

@ -728,7 +728,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
* the texture is actually used for rendering according to the filters set on
* the corresponding CoglPipeline.
*/
_cogl_texture_set_filters (offscreen->texture, GL_NEAREST, GL_NEAREST);
_cogl_texture_gl_flush_legacy_texobj_filters (offscreen->texture,
GL_NEAREST, GL_NEAREST);
if (((offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
try_creating_fbo (ctx,

View File

@ -947,7 +947,7 @@ _cogl_pipeline_layer_forward_wrap_modes (CoglPipelineLayer *layer,
else
gl_wrap_mode_p = wrap_mode_p;
_cogl_texture_set_wrap_mode_parameters (texture,
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (texture,
gl_wrap_mode_s,
gl_wrap_mode_t,
gl_wrap_mode_p);
@ -985,7 +985,7 @@ foreach_texture_unit_update_filter_and_wrap_modes (void)
CoglPipelineFilter mag;
_cogl_pipeline_layer_get_filters (unit->layer, &min, &mag);
_cogl_texture_set_filters (texture, min, mag);
_cogl_texture_gl_flush_legacy_texobj_filters (texture, min, mag);
_cogl_pipeline_layer_forward_wrap_modes (unit->layer, texture);
}

View File

@ -853,7 +853,7 @@ _cogl_texture_pixmap_x11_get_gl_texture (CoglTexture *tex,
}
static void
_cogl_texture_pixmap_x11_set_filters (CoglTexture *tex,
_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
@ -861,7 +861,8 @@ _cogl_texture_pixmap_x11_set_filters (CoglTexture *tex,
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
/* Forward on to the child texture */
_cogl_texture_set_filters (child_tex, min_filter, mag_filter);
_cogl_texture_gl_flush_legacy_texobj_filters (child_tex,
min_filter, mag_filter);
}
static void
@ -890,7 +891,7 @@ _cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex)
}
static void
_cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex,
_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
@ -899,7 +900,7 @@ _cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex,
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
/* Forward on to the child texture */
_cogl_texture_set_wrap_mode_parameters (child_tex,
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (child_tex,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
@ -996,10 +997,10 @@ cogl_texture_pixmap_x11_vtable =
_cogl_texture_pixmap_x11_transform_coords_to_gl,
_cogl_texture_pixmap_x11_transform_quad_coords_to_gl,
_cogl_texture_pixmap_x11_get_gl_texture,
_cogl_texture_pixmap_x11_set_filters,
_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_filters,
_cogl_texture_pixmap_x11_pre_paint,
_cogl_texture_pixmap_x11_ensure_non_quad_rendering,
_cogl_texture_pixmap_x11_set_wrap_mode_parameters,
_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_pixmap_x11_get_format,
_cogl_texture_pixmap_x11_get_gl_format,
_cogl_texture_pixmap_x11_get_width,