diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-09-10 20:35:39 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2013-01-20 18:38:22 +0000 |
commit | 5e61782972e5805e48a18221803be2fc718eb1c2 (patch) | |
tree | 2820cb1500d063c860c4309760421840aa3f7b2f | |
parent | 6a0f4bb7875526731e9e10aac35962a29bb93da7 (diff) | |
download | cogl-5e61782972e5805e48a18221803be2fc718eb1c2.tar.gz |
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)
-rw-r--r-- | cogl/cogl-atlas-texture.c | 29 | ||||
-rw-r--r-- | cogl/cogl-sub-texture.c | 29 | ||||
-rw-r--r-- | cogl/cogl-texture-2d-private.h | 30 | ||||
-rw-r--r-- | cogl/cogl-texture-2d-sliced.c | 30 | ||||
-rw-r--r-- | cogl/cogl-texture-2d.c | 46 | ||||
-rw-r--r-- | cogl/cogl-texture-3d-private.h | 33 | ||||
-rw-r--r-- | cogl/cogl-texture-3d.c | 48 | ||||
-rw-r--r-- | cogl/cogl-texture-private.h | 31 | ||||
-rw-r--r-- | cogl/cogl-texture-rectangle-private.h | 26 | ||||
-rw-r--r-- | cogl/cogl-texture-rectangle.c | 46 | ||||
-rw-r--r-- | cogl/cogl-texture.c | 41 | ||||
-rw-r--r-- | cogl/cogl.symbols | 4 | ||||
-rw-r--r-- | cogl/driver/gl/cogl-framebuffer-gl.c | 3 | ||||
-rw-r--r-- | cogl/driver/gl/cogl-pipeline-opengl.c | 10 | ||||
-rw-r--r-- | cogl/winsys/cogl-texture-pixmap-x11.c | 29 |
15 files changed, 225 insertions, 210 deletions
diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c index 2749f0b1..81a89f2e 100644 --- a/cogl/cogl-atlas-texture.c +++ b/cogl/cogl-atlas-texture.c @@ -247,18 +247,18 @@ _cogl_atlas_texture_foreach_sub_texture_in_region ( } static void -_cogl_atlas_texture_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) { CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); /* Forward on to the sub texture */ - _cogl_texture_set_wrap_mode_parameters (atlas_tex->sub_texture, - wrap_mode_s, - wrap_mode_t, - wrap_mode_p); + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); } static void @@ -348,14 +348,15 @@ _cogl_atlas_texture_get_gl_texture (CoglTexture *tex, } static void -_cogl_atlas_texture_set_filters (CoglTexture *tex, - GLenum min_filter, - GLenum mag_filter) +_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, diff --git a/cogl/cogl-sub-texture.c b/cogl/cogl-sub-texture.c index 8ca193ff..b3e3a973 100644 --- a/cogl/cogl-sub-texture.c +++ b/cogl/cogl-sub-texture.c @@ -183,17 +183,17 @@ _cogl_sub_texture_foreach_sub_texture_in_region ( } static void -_cogl_sub_texture_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_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, - wrap_mode_s, - wrap_mode_t, - wrap_mode_p); + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (sub_tex->full_texture, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); } static void @@ -341,13 +341,14 @@ _cogl_sub_texture_get_gl_texture (CoglTexture *tex, } static void -_cogl_sub_texture_set_filters (CoglTexture *tex, - GLenum min_filter, - GLenum mag_filter) +_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, diff --git a/cogl/cogl-texture-2d-private.h b/cogl/cogl-texture-2d-private.h index a7f41b6f..3180a3f8 100644 --- a/cogl/cogl-texture-2d-private.h +++ b/cogl/cogl-texture-2d-private.h @@ -35,25 +35,29 @@ struct _CoglTexture2D { - CoglTexture _parent; + CoglTexture _parent; /* The internal format of the GL texture represented as a CoglPixelFormat */ CoglPixelFormat format; + int width; + int height; + + 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; + 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; - + 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; }; diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c index a87cc394..e988a4ab 100644 --- a/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl-texture-2d-sliced.c @@ -584,10 +584,10 @@ _cogl_pot_slices_for_size (int size_to_fill, } static void -_cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) { CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); int i; @@ -599,10 +599,10 @@ _cogl_texture_2d_sliced_set_wrap_mode_parameters (CoglTexture *tex, CoglTexture2D *, i); - _cogl_texture_set_wrap_mode_parameters (COGL_TEXTURE (slice_tex), - wrap_mode_s, - wrap_mode_t, - wrap_mode_p); + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (COGL_TEXTURE (slice_tex), + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); } } @@ -1170,9 +1170,9 @@ _cogl_texture_2d_sliced_get_gl_texture (CoglTexture *tex, } static void -_cogl_texture_2d_sliced_set_filters (CoglTexture *tex, - GLenum min_filter, - GLenum mag_filter) +_cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) { CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); CoglTexture2D *slice_tex; @@ -1188,8 +1188,8 @@ _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), - min_filter, mag_filter); + _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, diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c index 52ce9ca5..e69b044b 100644 --- a/cogl/cogl-texture-2d.c +++ b/cogl/cogl-texture-2d.c @@ -64,10 +64,10 @@ typedef struct _CoglTexture2DManualRepeatData } CoglTexture2DManualRepeatData; static void -_cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) { CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); CoglContext *ctx = tex->context; @@ -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, - GLenum min_filter, - GLenum mag_filter) +_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, diff --git a/cogl/cogl-texture-3d-private.h b/cogl/cogl-texture-3d-private.h index d7fda509..7df5b9f5 100644 --- a/cogl/cogl-texture-3d-private.h +++ b/cogl/cogl-texture-3d-private.h @@ -32,26 +32,29 @@ struct _CoglTexture3D { - CoglTexture _parent; + 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; + 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; - + 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; + GLint gl_legacy_texobj_wrap_mode_p; CoglTexturePixel first_pixel; }; diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c index 7b781cbb..dee45429 100644 --- a/cogl/cogl-texture-3d.c +++ b/cogl/cogl-texture-3d.c @@ -57,19 +57,19 @@ COGL_TEXTURE_DEFINE (Texture3D, texture_3d); static const CoglTextureVtable cogl_texture_3d_vtable; static void -_cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_cogl_texture_3d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) { CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); CoglContext *ctx = tex->context; /* 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, - GLenum min_filter, - GLenum mag_filter) +_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, diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h index a3888de2..618191d4 100644 --- a/cogl/cogl-texture-private.h +++ b/cogl/cogl-texture-private.h @@ -108,17 +108,19 @@ struct _CoglTextureVtable GLuint *out_gl_handle, GLenum *out_gl_target); - void (* set_filters) (CoglTexture *tex, - GLenum min_filter, - GLenum mag_filter); + /* 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, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p); + /* 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); CoglPixelFormat (* get_format) (CoglTexture *tex); GLenum (* get_gl_format) (CoglTexture *tex); @@ -207,16 +209,15 @@ GLenum _cogl_texture_get_gl_format (CoglTexture *texture); void -_cogl_texture_set_wrap_mode_parameters (CoglTexture *texture, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p); - +_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, - GLenum min_filter, - GLenum mag_filter); +_cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture, + GLenum min_filter, + GLenum mag_filter); void _cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags); diff --git a/cogl/cogl-texture-rectangle-private.h b/cogl/cogl-texture-rectangle-private.h index b00f0d2c..366d58c4 100644 --- a/cogl/cogl-texture-rectangle-private.h +++ b/cogl/cogl-texture-rectangle-private.h @@ -30,22 +30,26 @@ struct _CoglTextureRectangle { - CoglTexture _parent; + 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; + 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 is_foreign; + 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; + CoglBool is_foreign; }; CoglTextureRectangle * diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c index 2b555649..2d985bb7 100644 --- a/cogl/cogl-texture-rectangle.c +++ b/cogl/cogl-texture-rectangle.c @@ -68,10 +68,10 @@ can_use_wrap_mode (GLenum wrap_mode) } static void -_cogl_texture_rectangle_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_cogl_texture_rectangle_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) { CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); CoglContext *ctx = tex->context; @@ -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, - GLenum min_filter, - GLenum mag_filter) +_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, diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index 7155898e..079d99cb 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -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, @@ -656,14 +643,6 @@ _cogl_texture_get_type (CoglTexture *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) { texture->vtable->pre_paint (texture, 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); +} diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols index 3d38555b..97fa523d 100644 --- a/cogl/cogl.symbols +++ b/cogl/cogl.symbols @@ -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 diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c index d1e18b61..2cbea5f8 100644 --- a/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/driver/gl/cogl-framebuffer-gl.c @@ -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, diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c index cb34cb9a..4ccfdcde 100644 --- a/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/driver/gl/cogl-pipeline-opengl.c @@ -947,10 +947,10 @@ _cogl_pipeline_layer_forward_wrap_modes (CoglPipelineLayer *layer, else gl_wrap_mode_p = wrap_mode_p; - _cogl_texture_set_wrap_mode_parameters (texture, - gl_wrap_mode_s, - gl_wrap_mode_t, - gl_wrap_mode_p); + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (texture, + gl_wrap_mode_s, + gl_wrap_mode_t, + gl_wrap_mode_p); } /* OpenGL associates the min/mag filters and repeat modes with the @@ -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); } diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c index a3f99e64..7797105a 100644 --- a/cogl/winsys/cogl-texture-pixmap-x11.c +++ b/cogl/winsys/cogl-texture-pixmap-x11.c @@ -853,15 +853,16 @@ _cogl_texture_pixmap_x11_get_gl_texture (CoglTexture *tex, } static void -_cogl_texture_pixmap_x11_set_filters (CoglTexture *tex, - GLenum min_filter, - GLenum mag_filter) +_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) { CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (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,19 +891,19 @@ _cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex) } static void -_cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex, - GLenum wrap_mode_s, - GLenum wrap_mode_t, - GLenum wrap_mode_p) +_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) { CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (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, - wrap_mode_s, - wrap_mode_t, - wrap_mode_p); + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (child_tex, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); } static CoglPixelFormat @@ -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, |