cogl: Remove unused p-axis texture wrap mode

Unused since removing 3D textures.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1015
This commit is contained in:
Adam Jackson 2020-01-21 14:05:20 -05:00 committed by Georges Basile Stavracas Neto
parent 99043e2af2
commit 600dd155ce
17 changed files with 29 additions and 200 deletions

View File

@ -252,16 +252,14 @@ _cogl_atlas_texture_foreach_sub_texture_in_region (
static void
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
GLenum wrap_mode_t)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
/* Forward on to the sub texture */
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
wrap_mode_t);
}
static void

View File

@ -308,8 +308,7 @@ _cogl_pipeline_layer_pre_paint (CoglPipelineLayer *layerr);
void
_cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer,
CoglSamplerCacheWrapMode *wrap_mode_s,
CoglSamplerCacheWrapMode *wrap_mode_t,
CoglSamplerCacheWrapMode *wrap_mode_r);
CoglSamplerCacheWrapMode *wrap_mode_t);
void
_cogl_pipeline_layer_get_filters (CoglPipelineLayer *layer,
@ -351,9 +350,6 @@ _cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer);
CoglPipelineWrapMode
_cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer);
CoglPipelineWrapMode
_cogl_pipeline_layer_get_wrap_mode_p (CoglPipelineLayer *layer);
void
_cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest,
CoglPipelineLayer *src,

View File

@ -331,9 +331,7 @@ cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
authority->sampler_cache_entry,
internal_mode,
authority->sampler_cache_entry->
wrap_mode_t,
authority->sampler_cache_entry->
wrap_mode_p);
wrap_mode_t);
_cogl_pipeline_set_layer_sampler_state (pipeline,
layer,
authority,
@ -373,62 +371,6 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
authority->sampler_cache_entry,
authority->sampler_cache_entry->
wrap_mode_s,
internal_mode,
authority->sampler_cache_entry->
wrap_mode_p);
_cogl_pipeline_set_layer_sampler_state (pipeline,
layer,
authority,
sampler_state);
}
/* The rationale for naming the third texture coordinate 'p' instead
of OpenGL's usual 'r' is that 'r' conflicts with the usual naming
of the 'red' component when treating a vector as a color. Under
GLSL this is awkward because the texture swizzling for a vector
uses a single letter for each component and the names for colors,
textures and positions are synonymous. GLSL works around this by
naming the components of the texture s, t, p and q. Cogl already
effectively already exposes this naming because it exposes GLSL so
it makes sense to use that naming consistently. Another alternative
could be u, v and w. This is what Blender and Direct3D use. However
the w component conflicts with the w component of a position
vertex. */
void
cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
int layer_index,
CoglPipelineWrapMode mode)
{
CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER;
CoglPipelineLayer *layer;
CoglPipelineLayer *authority;
CoglSamplerCacheWrapMode internal_mode =
public_to_internal_wrap_mode (mode);
const CoglSamplerCacheEntry *sampler_state;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
*
* Note: If the layer already existed it's possibly owned by another
* pipeline. If the layer is created then it will be owned by
* pipeline. */
layer = _cogl_pipeline_get_layer (pipeline, layer_index);
/* Now find the ancestor of the layer that is the authority for the
* state we want to change */
authority = _cogl_pipeline_layer_get_authority (layer, change);
sampler_state =
_cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache,
authority->sampler_cache_entry,
authority->sampler_cache_entry->
wrap_mode_s,
authority->sampler_cache_entry->
wrap_mode_t,
internal_mode);
_cogl_pipeline_set_layer_sampler_state (pipeline,
layer,
@ -468,14 +410,11 @@ cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline,
_cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache,
authority->sampler_cache_entry,
internal_mode,
internal_mode,
internal_mode);
_cogl_pipeline_set_layer_sampler_state (pipeline,
layer,
authority,
sampler_state);
/* XXX: I wonder if we should really be duplicating the mode into
* the 'p' wrap mode too? */
}
/* FIXME: deprecate this API */
@ -552,41 +491,10 @@ cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, int layer_index)
return _cogl_pipeline_layer_get_wrap_mode_t (layer);
}
CoglPipelineWrapMode
_cogl_pipeline_layer_get_wrap_mode_p (CoglPipelineLayer *layer)
{
CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER;
CoglPipelineLayer *authority =
_cogl_pipeline_layer_get_authority (layer, change);
const CoglSamplerCacheEntry *sampler_state;
sampler_state = authority->sampler_cache_entry;
return internal_to_public_wrap_mode (sampler_state->wrap_mode_p);
}
CoglPipelineWrapMode
cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, int layer_index)
{
CoglPipelineLayer *layer;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
*
* Note: If the layer already existed it's possibly owned by another
* pipeline. If the layer is created then it will be owned by
* pipeline. */
layer = _cogl_pipeline_get_layer (pipeline, layer_index);
return _cogl_pipeline_layer_get_wrap_mode_p (layer);
}
void
_cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer,
CoglSamplerCacheWrapMode *wrap_mode_s,
CoglSamplerCacheWrapMode *wrap_mode_t,
CoglSamplerCacheWrapMode *wrap_mode_p)
CoglSamplerCacheWrapMode *wrap_mode_t)
{
CoglPipelineLayer *authority =
_cogl_pipeline_layer_get_authority (layer,
@ -594,7 +502,6 @@ _cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer,
*wrap_mode_s = authority->sampler_cache_entry->wrap_mode_s;
*wrap_mode_t = authority->sampler_cache_entry->wrap_mode_t;
*wrap_mode_p = authority->sampler_cache_entry->wrap_mode_p;
}
gboolean

View File

@ -529,41 +529,6 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
int layer_index,
CoglPipelineWrapMode mode);
/**
* cogl_pipeline_get_layer_wrap_mode_p:
* @pipeline: A #CoglPipeline object
* @layer_index: the layer number to change.
*
* Returns the wrap mode for the 'p' coordinate of texture lookups on this
* layer.
*
* Return value: the wrap mode for the 'p' coordinate of texture lookups on
* this layer.
*
* Since: 1.6
* Stability: unstable
*/
CoglPipelineWrapMode
cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline,
int layer_index);
/**
* cogl_pipeline_set_layer_wrap_mode_p:
* @pipeline: A #CoglPipeline object
* @layer_index: the layer number to change.
* @mode: the new wrap mode
*
* Sets the wrap mode for the 'p' coordinate of texture lookups on
* this layer. 'p' is the third coordinate.
*
* Since: 2.0
* Stability: unstable
*/
void
cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
int layer_index,
CoglPipelineWrapMode mode);
/**
* cogl_pipeline_set_layer_wrap_mode:
* @pipeline: A #CoglPipeline object
@ -572,9 +537,8 @@ cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
*
* Sets the wrap mode for all three coordinates of texture lookups on
* this layer. This is equivalent to calling
* cogl_pipeline_set_layer_wrap_mode_s(),
* cogl_pipeline_set_layer_wrap_mode_t() and
* cogl_pipeline_set_layer_wrap_mode_p() separately.
* cogl_pipeline_set_layer_wrap_mode_s() and
* cogl_pipeline_set_layer_wrap_mode_t() separately.
*
* Since: 2.0
* Stability: unstable

View File

@ -68,7 +68,6 @@ typedef struct _CoglSamplerCacheEntry
CoglSamplerCacheWrapMode wrap_mode_s;
CoglSamplerCacheWrapMode wrap_mode_t;
CoglSamplerCacheWrapMode wrap_mode_p;
} CoglSamplerCacheEntry;
CoglSamplerCache *
@ -81,8 +80,7 @@ const CoglSamplerCacheEntry *
_cogl_sampler_cache_update_wrap_modes (CoglSamplerCache *cache,
const CoglSamplerCacheEntry *old_entry,
CoglSamplerCacheWrapMode wrap_mode_s,
CoglSamplerCacheWrapMode wrap_mode_t,
CoglSamplerCacheWrapMode wrap_mode_p);
CoglSamplerCacheWrapMode wrap_mode_t);
const CoglSamplerCacheEntry *
_cogl_sampler_cache_update_filters (CoglSamplerCache *cache,

View File

@ -77,7 +77,6 @@ canonicalize_key (CoglSamplerCacheEntry *key)
sampler object for the state */
key->wrap_mode_s = get_real_wrap_mode (key->wrap_mode_s);
key->wrap_mode_t = get_real_wrap_mode (key->wrap_mode_t);
key->wrap_mode_p = get_real_wrap_mode (key->wrap_mode_p);
}
static gboolean
@ -100,8 +99,7 @@ sampler_state_equal_gl (const void *value0,
return (state0->mag_filter == state1->mag_filter &&
state0->min_filter == state1->min_filter &&
wrap_mode_equal_gl (state0->wrap_mode_s, state1->wrap_mode_s) &&
wrap_mode_equal_gl (state0->wrap_mode_t, state1->wrap_mode_t) &&
wrap_mode_equal_gl (state0->wrap_mode_p, state1->wrap_mode_p));
wrap_mode_equal_gl (state0->wrap_mode_t, state1->wrap_mode_t));
}
static unsigned int
@ -130,7 +128,6 @@ hash_sampler_state_gl (const void *key)
sizeof (entry->min_filter));
hash = hash_wrap_mode_gl (hash, entry->wrap_mode_s);
hash = hash_wrap_mode_gl (hash, entry->wrap_mode_t);
hash = hash_wrap_mode_gl (hash, entry->wrap_mode_p);
return _cogl_util_one_at_a_time_mix (hash);
}
@ -145,8 +142,7 @@ sampler_state_equal_cogl (const void *value0,
return (state0->mag_filter == state1->mag_filter &&
state0->min_filter == state1->min_filter &&
state0->wrap_mode_s == state1->wrap_mode_s &&
state0->wrap_mode_t == state1->wrap_mode_t &&
state0->wrap_mode_p == state1->wrap_mode_p);
state0->wrap_mode_t == state1->wrap_mode_t);
}
static unsigned int
@ -163,8 +159,6 @@ hash_sampler_state_cogl (const void *key)
sizeof (entry->wrap_mode_s));
hash = _cogl_util_one_at_a_time_hash (hash, &entry->wrap_mode_t,
sizeof (entry->wrap_mode_t));
hash = _cogl_util_one_at_a_time_hash (hash, &entry->wrap_mode_p,
sizeof (entry->wrap_mode_p));
return _cogl_util_one_at_a_time_mix (hash);
}
@ -232,10 +226,6 @@ _cogl_sampler_cache_get_entry_gl (CoglSamplerCache *cache,
entry->sampler_object,
GL_TEXTURE_WRAP_T,
entry->wrap_mode_t);
set_wrap_mode (context,
entry->sampler_object,
GL_TEXTURE_WRAP_R,
entry->wrap_mode_p);
}
else
{
@ -287,7 +277,6 @@ _cogl_sampler_cache_get_default_entry (CoglSamplerCache *cache)
key.wrap_mode_s = COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC;
key.wrap_mode_t = COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC;
key.wrap_mode_p = COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC;
key.min_filter = GL_LINEAR;
key.mag_filter = GL_LINEAR;
@ -299,14 +288,12 @@ const CoglSamplerCacheEntry *
_cogl_sampler_cache_update_wrap_modes (CoglSamplerCache *cache,
const CoglSamplerCacheEntry *old_entry,
CoglSamplerCacheWrapMode wrap_mode_s,
CoglSamplerCacheWrapMode wrap_mode_t,
CoglSamplerCacheWrapMode wrap_mode_p)
CoglSamplerCacheWrapMode wrap_mode_t)
{
CoglSamplerCacheEntry key = *old_entry;
key.wrap_mode_s = wrap_mode_s;
key.wrap_mode_t = wrap_mode_t;
key.wrap_mode_p = wrap_mode_p;
return _cogl_sampler_cache_get_entry_cogl (cache, &key);
}

View File

@ -159,15 +159,13 @@ _cogl_sub_texture_foreach_sub_texture_in_region (
static void
_cogl_sub_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
GLenum wrap_mode_t)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (sub_tex->full_texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
wrap_mode_t);
}
static void

View File

@ -593,8 +593,7 @@ _cogl_rect_slices_for_size (int size_to_fill,
static void
_cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
GLenum wrap_mode_t)
{
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
int i;
@ -608,8 +607,7 @@ _cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (COGL_TEXTURE (slice_tex),
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
wrap_mode_t);
}
}

View File

@ -140,8 +140,7 @@ struct _CoglTextureVtable
/* 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);
GLenum wrap_mode_t);
CoglPixelFormat (* get_format) (CoglTexture *tex);
GLenum (* get_gl_format) (CoglTexture *tex);

View File

@ -671,16 +671,15 @@ static void
_cogl_pipeline_layer_forward_wrap_modes (CoglPipelineLayer *layer,
CoglTexture *texture)
{
CoglSamplerCacheWrapMode wrap_mode_s, wrap_mode_t, wrap_mode_p;
GLenum gl_wrap_mode_s, gl_wrap_mode_t, gl_wrap_mode_p;
CoglSamplerCacheWrapMode wrap_mode_s, wrap_mode_t;
GLenum gl_wrap_mode_s, gl_wrap_mode_t;
if (texture == NULL)
return;
_cogl_pipeline_layer_get_wrap_modes (layer,
&wrap_mode_s,
&wrap_mode_t,
&wrap_mode_p);
&wrap_mode_t);
/* Update the wrap mode on the texture object. The texture backend
should cache the value so that it will be a no-op if the object
@ -703,15 +702,9 @@ _cogl_pipeline_layer_forward_wrap_modes (CoglPipelineLayer *layer,
else
gl_wrap_mode_t = wrap_mode_t;
if (wrap_mode_p == COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC)
gl_wrap_mode_p = GL_CLAMP_TO_EDGE;
else
gl_wrap_mode_p = wrap_mode_p;
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (texture,
gl_wrap_mode_s,
gl_wrap_mode_t,
gl_wrap_mode_p);
gl_wrap_mode_t);
}
/* OpenGL associates the min/mag filters and repeat modes with the

View File

@ -78,8 +78,7 @@ _cogl_texture_2d_gl_flush_legacy_texobj_filters (CoglTexture *tex,
void
_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p);
GLenum wrap_mode_t);
void
_cogl_texture_2d_gl_copy_from_framebuffer (CoglTexture2D *tex_2d,

View File

@ -457,8 +457,7 @@ _cogl_texture_2d_gl_flush_legacy_texobj_filters (CoglTexture *tex,
void
_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
GLenum wrap_mode_t)
{
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
CoglContext *ctx = tex->context;

View File

@ -45,8 +45,7 @@ _cogl_texture_gl_prep_alignment_for_pixels_download (CoglContext *ctx,
void
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *texture,
unsigned int wrap_mode_s,
unsigned int wrap_mode_t,
unsigned int wrap_mode_p);
unsigned int wrap_mode_t);
void
_cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,

View File

@ -81,13 +81,11 @@ _cogl_texture_gl_prep_alignment_for_pixels_download (CoglContext *ctx,
void
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *texture,
unsigned int wrap_mode_s,
unsigned int wrap_mode_t,
unsigned int wrap_mode_p)
unsigned int wrap_mode_t)
{
texture->vtable->gl_flush_legacy_texobj_wrap_modes (texture,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
wrap_mode_t);
}
void

View File

@ -62,8 +62,7 @@ _cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex,
void
_cogl_texture_2d_nop_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p);
GLenum wrap_mode_t);
void
_cogl_texture_2d_nop_copy_from_framebuffer (CoglTexture2D *tex_2d,

View File

@ -76,8 +76,7 @@ _cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex,
void
_cogl_texture_2d_nop_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
GLenum wrap_mode_t)
{
}

View File

@ -996,8 +996,7 @@ _cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex)
static void
_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
GLenum wrap_mode_t)
{
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
@ -1005,8 +1004,7 @@ _cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
/* Forward on to the child texture */
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (child_tex,
wrap_mode_s,
wrap_mode_t,
wrap_mode_p);
wrap_mode_t);
}
static CoglPixelFormat