mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 21:34:09 +00:00
cogl: Remove unused explicit blend-enable controls
https://gitlab.gnome.org/GNOME/mutter/merge_requests/978
This commit is contained in:
parent
02db9ee577
commit
5613f4f7f4
@ -193,27 +193,9 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
|
|||||||
|
|
||||||
if (pipeline->differences & COGL_PIPELINE_STATE_BLEND)
|
if (pipeline->differences & COGL_PIPELINE_STATE_BLEND)
|
||||||
{
|
{
|
||||||
const char *blend_enable_name;
|
|
||||||
|
|
||||||
changes = TRUE;
|
changes = TRUE;
|
||||||
|
|
||||||
switch (pipeline->blend_enable)
|
|
||||||
{
|
|
||||||
case COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC:
|
|
||||||
blend_enable_name = "AUTO";
|
|
||||||
break;
|
|
||||||
case COGL_PIPELINE_BLEND_ENABLE_ENABLED:
|
|
||||||
blend_enable_name = "ENABLED";
|
|
||||||
break;
|
|
||||||
case COGL_PIPELINE_BLEND_ENABLE_DISABLED:
|
|
||||||
blend_enable_name = "DISABLED";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
blend_enable_name = "UNKNOWN";
|
|
||||||
}
|
|
||||||
g_string_append_printf (changes_label,
|
g_string_append_printf (changes_label,
|
||||||
"\\lblend=%s\\n",
|
"\\lblend\\n");
|
||||||
blend_enable_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
|
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
|
||||||
|
@ -62,7 +62,6 @@ typedef enum
|
|||||||
{
|
{
|
||||||
/* sparse state */
|
/* sparse state */
|
||||||
COGL_PIPELINE_STATE_COLOR_INDEX,
|
COGL_PIPELINE_STATE_COLOR_INDEX,
|
||||||
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
|
||||||
COGL_PIPELINE_STATE_LAYERS_INDEX,
|
COGL_PIPELINE_STATE_LAYERS_INDEX,
|
||||||
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
|
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
|
||||||
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
|
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
|
||||||
@ -99,8 +98,6 @@ typedef enum _CoglPipelineState
|
|||||||
{
|
{
|
||||||
COGL_PIPELINE_STATE_COLOR =
|
COGL_PIPELINE_STATE_COLOR =
|
||||||
1L<<COGL_PIPELINE_STATE_COLOR_INDEX,
|
1L<<COGL_PIPELINE_STATE_COLOR_INDEX,
|
||||||
COGL_PIPELINE_STATE_BLEND_ENABLE =
|
|
||||||
1L<<COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
|
||||||
COGL_PIPELINE_STATE_LAYERS =
|
COGL_PIPELINE_STATE_LAYERS =
|
||||||
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
|
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
|
||||||
|
|
||||||
@ -147,7 +144,6 @@ typedef enum _CoglPipelineState
|
|||||||
|
|
||||||
#define COGL_PIPELINE_STATE_AFFECTS_BLENDING \
|
#define COGL_PIPELINE_STATE_AFFECTS_BLENDING \
|
||||||
(COGL_PIPELINE_STATE_COLOR | \
|
(COGL_PIPELINE_STATE_COLOR | \
|
||||||
COGL_PIPELINE_STATE_BLEND_ENABLE | \
|
|
||||||
COGL_PIPELINE_STATE_LAYERS | \
|
COGL_PIPELINE_STATE_LAYERS | \
|
||||||
COGL_PIPELINE_STATE_BLEND | \
|
COGL_PIPELINE_STATE_BLEND | \
|
||||||
COGL_PIPELINE_STATE_USER_SHADER | \
|
COGL_PIPELINE_STATE_USER_SHADER | \
|
||||||
@ -184,15 +180,6 @@ typedef struct
|
|||||||
float alpha_func_reference;
|
float alpha_func_reference;
|
||||||
} CoglPipelineAlphaFuncState;
|
} CoglPipelineAlphaFuncState;
|
||||||
|
|
||||||
typedef enum _CoglPipelineBlendEnable
|
|
||||||
{
|
|
||||||
/* XXX: we want to detect users mistakenly using TRUE or FALSE
|
|
||||||
* so start the enum at 2. */
|
|
||||||
COGL_PIPELINE_BLEND_ENABLE_ENABLED = 2,
|
|
||||||
COGL_PIPELINE_BLEND_ENABLE_DISABLED,
|
|
||||||
COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC
|
|
||||||
} CoglPipelineBlendEnable;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/* Determines how this pipeline is blended with other primitives */
|
/* Determines how this pipeline is blended with other primitives */
|
||||||
@ -367,13 +354,6 @@ struct _CoglPipeline
|
|||||||
/* Determines if pipeline->big_state is valid */
|
/* Determines if pipeline->big_state is valid */
|
||||||
unsigned int has_big_state:1;
|
unsigned int has_big_state:1;
|
||||||
|
|
||||||
/* By default blending is enabled automatically depending on the
|
|
||||||
* unlit color, the lighting colors or the texture format. The user
|
|
||||||
* can override this to explicitly enable or disable blending.
|
|
||||||
*
|
|
||||||
* This is a sparse property */
|
|
||||||
unsigned int blend_enable:3;
|
|
||||||
|
|
||||||
/* There are many factors that can determine if we need to enable
|
/* There are many factors that can determine if we need to enable
|
||||||
* blending, this holds our final decision */
|
* blending, this holds our final decision */
|
||||||
unsigned int real_blend_enable:1;
|
unsigned int real_blend_enable:1;
|
||||||
@ -774,13 +754,6 @@ void
|
|||||||
_cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
|
_cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
|
||||||
CoglPipelineFlushOptions *options);
|
CoglPipelineFlushOptions *options);
|
||||||
|
|
||||||
CoglPipelineBlendEnable
|
|
||||||
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline);
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
|
||||||
CoglPipelineBlendEnable enable);
|
|
||||||
|
|
||||||
#ifdef COGL_DEBUG_ENABLED
|
#ifdef COGL_DEBUG_ENABLED
|
||||||
void
|
void
|
||||||
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
||||||
|
@ -108,10 +108,6 @@ void
|
|||||||
_cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
_cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
||||||
CoglPipelineHashState *state);
|
CoglPipelineHashState *state);
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
|
|
||||||
CoglPipelineHashState *state);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pipeline_hash_layers_state (CoglPipeline *authority,
|
_cogl_pipeline_hash_layers_state (CoglPipeline *authority,
|
||||||
CoglPipelineHashState *state);
|
CoglPipelineHashState *state);
|
||||||
|
@ -407,56 +407,6 @@ cogl_pipeline_set_color4f (CoglPipeline *pipeline,
|
|||||||
cogl_pipeline_set_color (pipeline, &color);
|
cogl_pipeline_set_color (pipeline, &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPipelineBlendEnable
|
|
||||||
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline)
|
|
||||||
{
|
|
||||||
CoglPipeline *authority;
|
|
||||||
|
|
||||||
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
|
|
||||||
|
|
||||||
authority =
|
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
|
|
||||||
return authority->blend_enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
_cogl_pipeline_blend_enable_equal (CoglPipeline *authority0,
|
|
||||||
CoglPipeline *authority1)
|
|
||||||
{
|
|
||||||
return authority0->blend_enable == authority1->blend_enable ? TRUE : FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
|
||||||
CoglPipelineBlendEnable enable)
|
|
||||||
{
|
|
||||||
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE;
|
|
||||||
CoglPipeline *authority;
|
|
||||||
|
|
||||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
|
||||||
g_return_if_fail (enable > 1 &&
|
|
||||||
"don't pass TRUE or FALSE to _set_blend_enabled!");
|
|
||||||
|
|
||||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
|
||||||
|
|
||||||
if (authority->blend_enable == enable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* - Flush journal primitives referencing the current state.
|
|
||||||
* - Make sure the pipeline has no dependants so it may be modified.
|
|
||||||
* - If the pipeline isn't currently an authority for the state being
|
|
||||||
* changed, then initialize that state from the current authority.
|
|
||||||
*/
|
|
||||||
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
|
|
||||||
|
|
||||||
pipeline->blend_enable = enable;
|
|
||||||
|
|
||||||
_cogl_pipeline_update_authority (pipeline, authority, state,
|
|
||||||
_cogl_pipeline_blend_enable_equal);
|
|
||||||
|
|
||||||
pipeline->dirty_real_blend_enable = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
|
_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
|
||||||
CoglPipelineAlphaFunc alpha_func)
|
CoglPipelineAlphaFunc alpha_func)
|
||||||
@ -1379,14 +1329,6 @@ _cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
|||||||
_COGL_COLOR_DATA_SIZE);
|
_COGL_COLOR_DATA_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
|
|
||||||
CoglPipelineHashState *state)
|
|
||||||
{
|
|
||||||
uint8_t blend_enable = authority->blend_enable;
|
|
||||||
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
|
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
|
||||||
CoglPipelineHashState *state)
|
CoglPipelineHashState *state)
|
||||||
|
@ -104,7 +104,6 @@ _cogl_pipeline_init_default_pipeline (void)
|
|||||||
|
|
||||||
pipeline->real_blend_enable = FALSE;
|
pipeline->real_blend_enable = FALSE;
|
||||||
|
|
||||||
pipeline->blend_enable = COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC;
|
|
||||||
pipeline->layer_differences = NULL;
|
pipeline->layer_differences = NULL;
|
||||||
pipeline->n_layers = 0;
|
pipeline->n_layers = 0;
|
||||||
|
|
||||||
@ -721,24 +720,12 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
|
|||||||
const CoglColor *override_color,
|
const CoglColor *override_color,
|
||||||
gboolean unknown_color_alpha)
|
gboolean unknown_color_alpha)
|
||||||
{
|
{
|
||||||
CoglPipeline *enable_authority;
|
|
||||||
CoglPipeline *blend_authority;
|
CoglPipeline *blend_authority;
|
||||||
CoglPipelineBlendState *blend_state;
|
CoglPipelineBlendState *blend_state;
|
||||||
CoglPipelineBlendEnable enabled;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
|
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* We unconditionally check the _BLEND_ENABLE state first because
|
|
||||||
* all the other changes are irrelevent if blend_enable != _AUTOMATIC
|
|
||||||
*/
|
|
||||||
enable_authority =
|
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
|
|
||||||
|
|
||||||
enabled = enable_authority->blend_enable;
|
|
||||||
if (enabled != COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC)
|
|
||||||
return enabled == COGL_PIPELINE_BLEND_ENABLE_ENABLED ? TRUE : FALSE;
|
|
||||||
|
|
||||||
blend_authority =
|
blend_authority =
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND);
|
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND);
|
||||||
|
|
||||||
@ -826,9 +813,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
|
|||||||
if (differences & COGL_PIPELINE_STATE_COLOR)
|
if (differences & COGL_PIPELINE_STATE_COLOR)
|
||||||
dest->color = src->color;
|
dest->color = src->color;
|
||||||
|
|
||||||
if (differences & COGL_PIPELINE_STATE_BLEND_ENABLE)
|
|
||||||
dest->blend_enable = src->blend_enable;
|
|
||||||
|
|
||||||
if (differences & COGL_PIPELINE_STATE_LAYERS)
|
if (differences & COGL_PIPELINE_STATE_LAYERS)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
@ -977,7 +961,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
|
|||||||
/* XXX: avoid using a default: label so we get a warning if we
|
/* XXX: avoid using a default: label so we get a warning if we
|
||||||
* don't explicitly handle a newly defined state-group here. */
|
* don't explicitly handle a newly defined state-group here. */
|
||||||
case COGL_PIPELINE_STATE_COLOR:
|
case COGL_PIPELINE_STATE_COLOR:
|
||||||
case COGL_PIPELINE_STATE_BLEND_ENABLE:
|
|
||||||
case COGL_PIPELINE_STATE_ALPHA_FUNC:
|
case COGL_PIPELINE_STATE_ALPHA_FUNC:
|
||||||
case COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE:
|
case COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE:
|
||||||
case COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE:
|
case COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE:
|
||||||
@ -2170,7 +2153,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX:
|
|
||||||
case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX:
|
case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX:
|
||||||
case COGL_PIPELINE_STATE_COUNT:
|
case COGL_PIPELINE_STATE_COUNT:
|
||||||
g_warn_if_reached ();
|
g_warn_if_reached ();
|
||||||
@ -2514,8 +2496,6 @@ _cogl_pipeline_init_state_hash_functions (void)
|
|||||||
{
|
{
|
||||||
state_hash_functions[COGL_PIPELINE_STATE_COLOR_INDEX] =
|
state_hash_functions[COGL_PIPELINE_STATE_COLOR_INDEX] =
|
||||||
_cogl_pipeline_hash_color_state;
|
_cogl_pipeline_hash_color_state;
|
||||||
state_hash_functions[COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX] =
|
|
||||||
_cogl_pipeline_hash_blend_enable_state;
|
|
||||||
state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
|
state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
|
||||||
_cogl_pipeline_hash_layers_state;
|
_cogl_pipeline_hash_layers_state;
|
||||||
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
|
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
|
||||||
@ -2545,7 +2525,7 @@ _cogl_pipeline_init_state_hash_functions (void)
|
|||||||
|
|
||||||
{
|
{
|
||||||
/* So we get a big error if we forget to update this code! */
|
/* So we get a big error if we forget to update this code! */
|
||||||
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 15,
|
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 14,
|
||||||
"Make sure to install a hash function for "
|
"Make sure to install a hash function for "
|
||||||
"newly added pipeline state and update assert "
|
"newly added pipeline state and update assert "
|
||||||
"in _cogl_pipeline_init_state_hash_functions");
|
"in _cogl_pipeline_init_state_hash_functions");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user