cogl: Remove unused COGL_PIPELINE_STATE_LIGHTING

https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
This commit is contained in:
Adam Jackson 2019-10-29 14:36:10 -04:00
parent 468dc99dc9
commit 711023ea93
5 changed files with 2 additions and 117 deletions

View File

@ -77,7 +77,6 @@ typedef enum
COGL_PIPELINE_STATE_COLOR_INDEX, COGL_PIPELINE_STATE_COLOR_INDEX,
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX, COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
COGL_PIPELINE_STATE_LAYERS_INDEX, COGL_PIPELINE_STATE_LAYERS_INDEX,
COGL_PIPELINE_STATE_LIGHTING_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,
COGL_PIPELINE_STATE_BLEND_INDEX, COGL_PIPELINE_STATE_BLEND_INDEX,
@ -118,8 +117,6 @@ typedef enum _CoglPipelineState
COGL_PIPELINE_STATE_LAYERS = COGL_PIPELINE_STATE_LAYERS =
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX, 1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
COGL_PIPELINE_STATE_LIGHTING =
1L<<COGL_PIPELINE_STATE_LIGHTING_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC = COGL_PIPELINE_STATE_ALPHA_FUNC =
1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX, 1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE = COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE =
@ -165,15 +162,13 @@ typedef enum _CoglPipelineState
(COGL_PIPELINE_STATE_COLOR | \ (COGL_PIPELINE_STATE_COLOR | \
COGL_PIPELINE_STATE_BLEND_ENABLE | \ COGL_PIPELINE_STATE_BLEND_ENABLE | \
COGL_PIPELINE_STATE_LAYERS | \ COGL_PIPELINE_STATE_LAYERS | \
COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_BLEND | \ COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_USER_SHADER | \ COGL_PIPELINE_STATE_USER_SHADER | \
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \ COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS) COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
#define COGL_PIPELINE_STATE_NEEDS_BIG_STATE \ #define COGL_PIPELINE_STATE_NEEDS_BIG_STATE \
(COGL_PIPELINE_STATE_LIGHTING | \ (COGL_PIPELINE_STATE_ALPHA_FUNC | \
COGL_PIPELINE_STATE_ALPHA_FUNC | \
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE | \ COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE | \
COGL_PIPELINE_STATE_BLEND | \ COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_USER_SHADER | \ COGL_PIPELINE_STATE_USER_SHADER | \
@ -188,7 +183,6 @@ typedef enum _CoglPipelineState
#define COGL_PIPELINE_STATE_MULTI_PROPERTY \ #define COGL_PIPELINE_STATE_MULTI_PROPERTY \
(COGL_PIPELINE_STATE_LAYERS | \ (COGL_PIPELINE_STATE_LAYERS | \
COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_BLEND | \ COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_DEPTH | \ COGL_PIPELINE_STATE_DEPTH | \
COGL_PIPELINE_STATE_CULL_FACE | \ COGL_PIPELINE_STATE_CULL_FACE | \

View File

@ -53,10 +53,6 @@ gboolean
_cogl_pipeline_color_equal (CoglPipeline *authority0, _cogl_pipeline_color_equal (CoglPipeline *authority0,
CoglPipeline *authority1); CoglPipeline *authority1);
gboolean
_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1);
gboolean gboolean
_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0, _cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1); CoglPipeline *authority1);
@ -120,10 +116,6 @@ void
_cogl_pipeline_hash_layers_state (CoglPipeline *authority, _cogl_pipeline_hash_layers_state (CoglPipeline *authority,
CoglPipelineHashState *state); CoglPipelineHashState *state);
void
_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
CoglPipelineHashState *state);
void void
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority, _cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
CoglPipelineHashState *state); CoglPipelineHashState *state);

View File

@ -69,27 +69,6 @@ _cogl_pipeline_color_equal (CoglPipeline *authority0,
return cogl_color_equal (&authority0->color, &authority1->color); return cogl_color_equal (&authority0->color, &authority1->color);
} }
gboolean
_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
{
CoglPipelineLightingState *state0 = &authority0->big_state->lighting_state;
CoglPipelineLightingState *state1 = &authority1->big_state->lighting_state;
if (memcmp (state0->ambient, state1->ambient, sizeof (float) * 4) != 0)
return FALSE;
if (memcmp (state0->diffuse, state1->diffuse, sizeof (float) * 4) != 0)
return FALSE;
if (memcmp (state0->specular, state1->specular, sizeof (float) * 4) != 0)
return FALSE;
if (memcmp (state0->emission, state1->emission, sizeof (float) * 4) != 0)
return FALSE;
if (state0->shininess != state1->shininess)
return FALSE;
return TRUE;
}
gboolean gboolean
_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0, _cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1) CoglPipeline *authority1)
@ -1411,17 +1390,6 @@ _cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1); state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1);
} }
void
_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
CoglPipelineHashState *state)
{
CoglPipelineLightingState *lighting_state =
&authority->big_state->lighting_state;
state->hash =
_cogl_util_one_at_a_time_hash (state->hash, lighting_state,
sizeof (CoglPipelineLightingState));
}
void void
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority, _cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
CoglPipelineHashState *state) CoglPipelineHashState *state)

View File

@ -764,32 +764,6 @@ _cogl_pipeline_change_implies_transparency (CoglPipeline *pipeline,
return TRUE; return TRUE;
} }
/* XXX: we should only need to look at these if lighting is enabled
*/
if (changes & COGL_PIPELINE_STATE_LIGHTING)
{
/* XXX: This stuff is showing up in sysprof reports which is
* silly because lighting isn't currently actually supported
* by Cogl except for these token properties. When we actually
* expose lighting support we can avoid these checks when
* lighting is disabled. */
#if 0
CoglColor tmp;
cogl_pipeline_get_ambient (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
cogl_pipeline_get_diffuse (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
cogl_pipeline_get_specular (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
cogl_pipeline_get_emission (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
#endif
}
if (changes & COGL_PIPELINE_STATE_LAYERS) if (changes & COGL_PIPELINE_STATE_LAYERS)
{ {
/* has_alpha tracks the alpha status of the GL_PREVIOUS layer. /* has_alpha tracks the alpha status of the GL_PREVIOUS layer.
@ -963,13 +937,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
else else
goto check_for_blending_change; goto check_for_blending_change;
if (differences & COGL_PIPELINE_STATE_LIGHTING)
{
memcpy (&big_state->lighting_state,
&src->big_state->lighting_state,
sizeof (CoglPipelineLightingState));
}
if (differences & COGL_PIPELINE_STATE_ALPHA_FUNC) if (differences & COGL_PIPELINE_STATE_ALPHA_FUNC)
big_state->alpha_state.alpha_func = big_state->alpha_state.alpha_func =
src->big_state->alpha_state.alpha_func; src->big_state->alpha_state.alpha_func;
@ -1095,13 +1062,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
pipeline->n_layers = authority->n_layers; pipeline->n_layers = authority->n_layers;
pipeline->layer_differences = NULL; pipeline->layer_differences = NULL;
break; break;
case COGL_PIPELINE_STATE_LIGHTING:
{
memcpy (&pipeline->big_state->lighting_state,
&authority->big_state->lighting_state,
sizeof (CoglPipelineLightingState));
break;
}
case COGL_PIPELINE_STATE_BLEND: case COGL_PIPELINE_STATE_BLEND:
{ {
memcpy (&pipeline->big_state->blend_state, memcpy (&pipeline->big_state->blend_state,
@ -2212,11 +2172,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
&authorities1[bit]->color)) &authorities1[bit]->color))
goto done; goto done;
break; break;
case COGL_PIPELINE_STATE_LIGHTING_INDEX:
if (!_cogl_pipeline_lighting_state_equal (authorities0[bit],
authorities1[bit]))
goto done;
break;
case COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX: case COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX:
if (!_cogl_pipeline_alpha_func_state_equal (authorities0[bit], if (!_cogl_pipeline_alpha_func_state_equal (authorities0[bit],
authorities1[bit])) authorities1[bit]))
@ -2672,8 +2627,6 @@ _cogl_pipeline_init_state_hash_functions (void)
_cogl_pipeline_hash_blend_enable_state; _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_LIGHTING_INDEX] =
_cogl_pipeline_hash_lighting_state;
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] = state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
_cogl_pipeline_hash_alpha_func_state; _cogl_pipeline_hash_alpha_func_state;
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX] = state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX] =
@ -2701,7 +2654,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 == 16, _COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 15,
"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");

View File

@ -546,28 +546,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
GE (ctx, glAlphaFunc (alpha_state->alpha_func, GE (ctx, glAlphaFunc (alpha_state->alpha_func,
alpha_state->alpha_func_reference)); alpha_state->alpha_func_reference));
} }
/* Under GLES2 the lighting parameters are implemented as uniforms
in the progend */
if (pipelines_difference & COGL_PIPELINE_STATE_LIGHTING)
{
CoglPipeline *authority =
_cogl_pipeline_get_authority (pipeline,
COGL_PIPELINE_STATE_LIGHTING);
CoglPipelineLightingState *lighting_state =
&authority->big_state->lighting_state;
GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT,
lighting_state->ambient));
GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE,
lighting_state->diffuse));
GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR,
lighting_state->specular));
GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_EMISSION,
lighting_state->emission));
GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS,
&lighting_state->shininess));
}
} }
#endif #endif