From fb564cc2ca9579c3b444f5fd5c59ee4da040b7da Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 11 Nov 2010 15:08:38 +0000 Subject: [PATCH] cogl: remove WrapModeOverrides from FlushOptions This removes the possibility to specify wrap mode overrides within a CoglPipelineFlushOptions struct since the right way to handle these overrides is by copying the user's material and making the changes to that copy before flushing. All primitives code has already switched away from using these wrap mode overrides so this patch just removes unused code and types. It also remove the wrap_mode_overrides argument for _cogl_journal_log_quad. --- clutter/cogl/cogl/cogl-journal-private.h | 2 - clutter/cogl/cogl/cogl-journal.c | 7 --- clutter/cogl/cogl/cogl-pipeline-private.h | 32 +------------ clutter/cogl/cogl/cogl-pipeline.c | 55 ----------------------- clutter/cogl/cogl/cogl-primitives.c | 2 - 5 files changed, 1 insertion(+), 97 deletions(-) diff --git a/clutter/cogl/cogl/cogl-journal-private.h b/clutter/cogl/cogl/cogl-journal-private.h index 79d001461..eccc242bc 100644 --- a/clutter/cogl/cogl/cogl-journal-private.h +++ b/clutter/cogl/cogl/cogl-journal-private.h @@ -47,8 +47,6 @@ _cogl_journal_log_quad (const float *position, int n_layers, guint32 fallback_layers, CoglHandle layer0_override_texture, - const CoglPipelineWrapModeOverrides * - wrap_mode_overrides, const float *tex_coords, unsigned int tex_coords_len); diff --git a/clutter/cogl/cogl/cogl-journal.c b/clutter/cogl/cogl/cogl-journal.c index 9f9cfebbe..60b717094 100644 --- a/clutter/cogl/cogl/cogl-journal.c +++ b/clutter/cogl/cogl/cogl-journal.c @@ -772,8 +772,6 @@ _cogl_journal_log_quad (const float *position, int n_layers, guint32 fallback_layers, CoglHandle layer0_override_texture, - const CoglPipelineWrapModeOverrides * - wrap_mode_overrides, const float *tex_coords, unsigned int tex_coords_len) { @@ -933,11 +931,6 @@ _cogl_journal_log_quad (const float *position, flush_options.flags |= COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE; flush_options.layer0_override_texture = layer0_override_texture; } - if (wrap_mode_overrides) - { - flush_options.flags |= COGL_PIPELINE_FLUSH_WRAP_MODE_OVERRIDES; - flush_options.wrap_mode_overrides = *wrap_mode_overrides; - } if (G_UNLIKELY (flush_options.flags)) { diff --git a/clutter/cogl/cogl/cogl-pipeline-private.h b/clutter/cogl/cogl/cogl-pipeline-private.h index 9767694c1..611cd8a61 100644 --- a/clutter/cogl/cogl/cogl-pipeline-private.h +++ b/clutter/cogl/cogl/cogl-pipeline-private.h @@ -635,17 +635,13 @@ _cogl_pipeline_pre_paint_for_layer (CoglPipeline *pipeline, * not passing the option at all. * @COGL_PIPELINE_FLUSH_SKIP_GL_COLOR: When flushing the GL state for the * pipeline don't call glColor. - * @COGL_PIPELINE_FLUSH_WRAP_MODE_OVERRIDES: Specifies that a bitmask - * of overrides for the wrap modes for some or all layers is - * given. */ typedef enum _CoglPipelineFlushFlag { COGL_PIPELINE_FLUSH_FALLBACK_MASK = 1L<<0, COGL_PIPELINE_FLUSH_DISABLE_MASK = 1L<<1, COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE = 1L<<2, - COGL_PIPELINE_FLUSH_SKIP_GL_COLOR = 1L<<3, - COGL_PIPELINE_FLUSH_WRAP_MODE_OVERRIDES = 1L<<4 + COGL_PIPELINE_FLUSH_SKIP_GL_COLOR = 1L<<3 } CoglPipelineFlushFlag; /* This isn't defined in the GLES headers */ @@ -667,31 +663,6 @@ typedef enum _CoglPipelineWrapModeInternal COGL_PIPELINE_WRAP_MODE_INTERNAL_AUTOMATIC = GL_ALWAYS } CoglPipelineWrapModeInternal; -typedef enum _CoglPipelineWrapModeOverride -{ - COGL_PIPELINE_WRAP_MODE_OVERRIDE_NONE = 0, - COGL_PIPELINE_WRAP_MODE_OVERRIDE_REPEAT = - COGL_PIPELINE_WRAP_MODE_INTERNAL_REPEAT, - COGL_PIPELINE_WRAP_MODE_OVERRIDE_CLAMP_TO_EDGE = - COGL_PIPELINE_WRAP_MODE_INTERNAL_CLAMP_TO_EDGE, - COGL_PIPELINE_WRAP_MODE_OVERRIDE_CLAMP_TO_BORDER = - COGL_PIPELINE_WRAP_MODE_INTERNAL_CLAMP_TO_BORDER, -} CoglPipelineWrapModeOverride; - -/* There can't be more than 32 layers because we need to fit a bitmask - of the layers into a guint32 */ -#define COGL_PIPELINE_MAX_LAYERS 32 - -typedef struct _CoglPipelineWrapModeOverrides -{ - struct - { - CoglPipelineWrapModeOverride s; - CoglPipelineWrapModeOverride t; - CoglPipelineWrapModeOverride p; - } values[COGL_PIPELINE_MAX_LAYERS]; -} CoglPipelineWrapModeOverrides; - /* * CoglPipelineFlushOptions: * @@ -703,7 +674,6 @@ typedef struct _CoglPipelineFlushOptions guint32 fallback_layers; guint32 disable_layers; CoglHandle layer0_override_texture; - CoglPipelineWrapModeOverrides wrap_mode_overrides; } CoglPipelineFlushOptions; diff --git a/clutter/cogl/cogl/cogl-pipeline.c b/clutter/cogl/cogl/cogl-pipeline.c index 6e3428ef0..29250c5f8 100644 --- a/clutter/cogl/cogl/cogl-pipeline.c +++ b/clutter/cogl/cogl/cogl-pipeline.c @@ -2640,49 +2640,6 @@ cogl_pipeline_get_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, return authority->big_state->point_sprite_coords; } -typedef struct -{ - CoglPipeline *pipeline; - CoglPipelineWrapModeOverrides *wrap_mode_overrides; - int i; -} CoglPipelineWrapModeOverridesState; - -static gboolean -apply_wrap_mode_overrides_cb (CoglPipelineLayer *layer, - void *user_data) -{ - CoglPipelineWrapModeOverridesState *state = user_data; - CoglPipelineLayer *authority = - _cogl_pipeline_layer_get_authority (layer, - COGL_PIPELINE_LAYER_STATE_WRAP_MODES); - CoglPipelineWrapModeInternal wrap_mode_s; - CoglPipelineWrapModeInternal wrap_mode_t; - CoglPipelineWrapModeInternal wrap_mode_p; - - g_return_val_if_fail (state->i < 32, FALSE); - - wrap_mode_s = state->wrap_mode_overrides->values[state->i].s; - if (wrap_mode_s == COGL_PIPELINE_WRAP_MODE_OVERRIDE_NONE) - wrap_mode_s = (CoglPipelineWrapModeInternal)authority->wrap_mode_s; - wrap_mode_t = state->wrap_mode_overrides->values[state->i].t; - if (wrap_mode_t == COGL_PIPELINE_WRAP_MODE_OVERRIDE_NONE) - wrap_mode_t = (CoglPipelineWrapModeInternal)authority->wrap_mode_t; - wrap_mode_p = state->wrap_mode_overrides->values[state->i].p; - if (wrap_mode_p == COGL_PIPELINE_WRAP_MODE_OVERRIDE_NONE) - wrap_mode_p = (CoglPipelineWrapModeInternal)authority->wrap_mode_p; - - _cogl_pipeline_set_layer_wrap_modes (state->pipeline, - layer, - authority, - wrap_mode_s, - wrap_mode_t, - wrap_mode_p); - - state->i++; - - return TRUE; -} - typedef struct { CoglPipeline *pipeline; @@ -2754,18 +2711,6 @@ _cogl_pipeline_apply_overrides (CoglPipeline *pipeline, override_layer_texture_cb, &state); } - - if (options->flags & COGL_PIPELINE_FLUSH_WRAP_MODE_OVERRIDES) - { - CoglPipelineWrapModeOverridesState state; - - state.pipeline = pipeline; - state.wrap_mode_overrides = &options->wrap_mode_overrides; - state.i = 0; - _cogl_pipeline_foreach_layer_internal (pipeline, - apply_wrap_mode_overrides_cb, - &state); - } } static gboolean diff --git a/clutter/cogl/cogl/cogl-primitives.c b/clutter/cogl/cogl/cogl-primitives.c index c7c8ae60c..e3c69463b 100644 --- a/clutter/cogl/cogl/cogl-primitives.c +++ b/clutter/cogl/cogl/cogl-primitives.c @@ -125,7 +125,6 @@ log_quad_sub_textures_cb (CoglHandle texture_handle, 1, /* one layer */ 0, /* don't need to use fallbacks */ texture_override, /* replace the layer0 texture */ - NULL, /* we never use wrap mode overrides */ subtexture_coords, 4); } @@ -547,7 +546,6 @@ _cogl_multitexture_quad_single_primitive (const float *position, n_layers, 0, /* we don't need fallback layers */ COGL_INVALID_HANDLE, /* no texture override */ - NULL, /* we never use wrap mode overrides */ final_tex_coords, n_layers * 4);