[Cogl] [PATCH] pipeline: Remove fixed function lighting state
Robert Bragg
robert at sixbynine.org
Tue Aug 28 08:46:39 PDT 2012
From: Robert Bragg <robert at linux.intel.com>
This removes all the pipeline api and state tracking related to fixed
function lighting. Since we never actually added support for lighting to
Cogl this state tracking has just been dead weight. It looks like we
are unlikely to ever add fixed-function lighting support to Cogl and
instead we expect application that need lighting support to rely on
programmable hardware and use the GLSL snippets api instead.
---
cogl/cogl-pipeline-opengl.c | 22 ---
cogl/cogl-pipeline-private.h | 28 +----
cogl/cogl-pipeline-state-private.h | 8 -
cogl/cogl-pipeline-state.c | 290 ------------------------------------
cogl/cogl-pipeline-state.h | 183 -----------------------
cogl/cogl-pipeline.c | 73 +---------
6 files changed, 2 insertions(+), 602 deletions(-)
diff --git a/cogl/cogl-pipeline-opengl.c b/cogl/cogl-pipeline-opengl.c
index a047e81..f0238e0 100644
--- a/cogl/cogl-pipeline-opengl.c
+++ b/cogl/cogl-pipeline-opengl.c
@@ -548,28 +548,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
GE (ctx, glAlphaFunc (alpha_state->alpha_func,
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
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index c64e9e2..5e1091c 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -172,7 +172,6 @@ typedef enum
COGL_PIPELINE_STATE_COLOR_INDEX,
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
COGL_PIPELINE_STATE_LAYERS_INDEX,
- COGL_PIPELINE_STATE_LIGHTING_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
COGL_PIPELINE_STATE_BLEND_INDEX,
@@ -212,8 +211,6 @@ typedef enum _CoglPipelineState
COGL_PIPELINE_STATE_LAYERS =
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
- COGL_PIPELINE_STATE_LIGHTING =
- 1L<<COGL_PIPELINE_STATE_LIGHTING_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC =
1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE =
@@ -257,14 +254,12 @@ typedef enum _CoglPipelineState
(COGL_PIPELINE_STATE_COLOR | \
COGL_PIPELINE_STATE_BLEND_ENABLE | \
COGL_PIPELINE_STATE_LAYERS | \
- COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
#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_BLEND | \
COGL_PIPELINE_STATE_DEPTH | \
@@ -278,7 +273,6 @@ typedef enum _CoglPipelineState
#define COGL_PIPELINE_STATE_MULTI_PROPERTY \
(COGL_PIPELINE_STATE_LAYERS | \
- COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_DEPTH | \
COGL_PIPELINE_STATE_FOG | \
@@ -292,25 +286,6 @@ typedef enum _CoglPipelineState
(COGL_PIPELINE_STATE_LAYERS | \
COGL_PIPELINE_STATE_VERTEX_SNIPPETS)
-typedef enum
-{
- COGL_PIPELINE_LIGHTING_STATE_PROPERTY_AMBIENT = 1,
- COGL_PIPELINE_LIGHTING_STATE_PROPERTY_DIFFUSE,
- COGL_PIPELINE_LIGHTING_STATE_PROPERTY_SPECULAR,
- COGL_PIPELINE_LIGHTING_STATE_PROPERTY_EMISSION,
- COGL_PIPELINE_LIGHTING_STATE_PROPERTY_SHININESS
-} CoglPipelineLightingStateProperty;
-
-typedef struct
-{
- /* Standard OpenGL lighting model attributes */
- float ambient[4];
- float diffuse[4];
- float specular[4];
- float emission[4];
- float shininess;
-} CoglPipelineLightingState;
-
typedef struct
{
/* Determines what fragments are discarded based on their alpha */
@@ -378,7 +353,6 @@ typedef struct
typedef struct
{
- CoglPipelineLightingState lighting_state;
CoglPipelineAlphaFuncState alpha_state;
CoglPipelineBlendState blend_state;
CoglDepthState depth_state;
diff --git a/cogl/cogl-pipeline-state-private.h b/cogl/cogl-pipeline-state-private.h
index f7005e9..f96f777 100644
--- a/cogl/cogl-pipeline-state-private.h
+++ b/cogl/cogl-pipeline-state-private.h
@@ -52,10 +52,6 @@ _cogl_pipeline_color_equal (CoglPipeline *authority0,
CoglPipeline *authority1);
CoglBool
-_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
- CoglPipeline *authority1);
-
-CoglBool
_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1);
@@ -116,10 +112,6 @@ _cogl_pipeline_hash_layers_state (CoglPipeline *authority,
CoglPipelineHashState *state);
void
-_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
- CoglPipelineHashState *state);
-
-void
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
CoglPipelineHashState *state);
diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c
index 504ba1c..6a9b541 100644
--- a/cogl/cogl-pipeline-state.c
+++ b/cogl/cogl-pipeline-state.c
@@ -51,27 +51,6 @@ _cogl_pipeline_color_equal (CoglPipeline *authority0,
}
CoglBool
-_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;
-}
-
-CoglBool
_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
{
@@ -468,264 +447,6 @@ _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
_cogl_pipeline_update_blend_enable (pipeline, state);
}
-void
-cogl_pipeline_get_ambient (CoglPipeline *pipeline,
- CoglColor *ambient)
-{
- CoglPipeline *authority;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority =
- _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
-
- cogl_color_init_from_4fv (ambient,
- authority->big_state->lighting_state.ambient);
-}
-
-void
-cogl_pipeline_set_ambient (CoglPipeline *pipeline,
- const CoglColor *ambient)
-{
- CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
- CoglPipeline *authority;
- CoglPipelineLightingState *lighting_state;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority = _cogl_pipeline_get_authority (pipeline, state);
-
- lighting_state = &authority->big_state->lighting_state;
- if (cogl_color_equal (ambient, &lighting_state->ambient))
- 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);
-
- lighting_state = &pipeline->big_state->lighting_state;
- lighting_state->ambient[0] = cogl_color_get_red_float (ambient);
- lighting_state->ambient[1] = cogl_color_get_green_float (ambient);
- lighting_state->ambient[2] = cogl_color_get_blue_float (ambient);
- lighting_state->ambient[3] = cogl_color_get_alpha_float (ambient);
-
- _cogl_pipeline_update_authority (pipeline, authority, state,
- _cogl_pipeline_lighting_state_equal);
-
- _cogl_pipeline_update_blend_enable (pipeline, state);
-}
-
-void
-cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
- CoglColor *diffuse)
-{
- CoglPipeline *authority;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority =
- _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
-
- cogl_color_init_from_4fv (diffuse,
- authority->big_state->lighting_state.diffuse);
-}
-
-void
-cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
- const CoglColor *diffuse)
-{
- CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
- CoglPipeline *authority;
- CoglPipelineLightingState *lighting_state;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority = _cogl_pipeline_get_authority (pipeline, state);
-
- lighting_state = &authority->big_state->lighting_state;
- if (cogl_color_equal (diffuse, &lighting_state->diffuse))
- 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);
-
- lighting_state = &pipeline->big_state->lighting_state;
- lighting_state->diffuse[0] = cogl_color_get_red_float (diffuse);
- lighting_state->diffuse[1] = cogl_color_get_green_float (diffuse);
- lighting_state->diffuse[2] = cogl_color_get_blue_float (diffuse);
- lighting_state->diffuse[3] = cogl_color_get_alpha_float (diffuse);
-
-
- _cogl_pipeline_update_authority (pipeline, authority, state,
- _cogl_pipeline_lighting_state_equal);
-
- _cogl_pipeline_update_blend_enable (pipeline, state);
-}
-
-void
-cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline,
- const CoglColor *color)
-{
- cogl_pipeline_set_ambient (pipeline, color);
- cogl_pipeline_set_diffuse (pipeline, color);
-}
-
-void
-cogl_pipeline_get_specular (CoglPipeline *pipeline,
- CoglColor *specular)
-{
- CoglPipeline *authority;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority =
- _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
-
- cogl_color_init_from_4fv (specular,
- authority->big_state->lighting_state.specular);
-}
-
-void
-cogl_pipeline_set_specular (CoglPipeline *pipeline, const CoglColor *specular)
-{
- CoglPipeline *authority;
- CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
- CoglPipelineLightingState *lighting_state;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority = _cogl_pipeline_get_authority (pipeline, state);
-
- lighting_state = &authority->big_state->lighting_state;
- if (cogl_color_equal (specular, &lighting_state->specular))
- 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);
-
- lighting_state = &pipeline->big_state->lighting_state;
- lighting_state->specular[0] = cogl_color_get_red_float (specular);
- lighting_state->specular[1] = cogl_color_get_green_float (specular);
- lighting_state->specular[2] = cogl_color_get_blue_float (specular);
- lighting_state->specular[3] = cogl_color_get_alpha_float (specular);
-
- _cogl_pipeline_update_authority (pipeline, authority, state,
- _cogl_pipeline_lighting_state_equal);
-
- _cogl_pipeline_update_blend_enable (pipeline, state);
-}
-
-float
-cogl_pipeline_get_shininess (CoglPipeline *pipeline)
-{
- CoglPipeline *authority;
-
- _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
-
- authority =
- _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
-
- return authority->big_state->lighting_state.shininess;
-}
-
-void
-cogl_pipeline_set_shininess (CoglPipeline *pipeline,
- float shininess)
-{
- CoglPipeline *authority;
- CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
- CoglPipelineLightingState *lighting_state;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- if (shininess < 0.0)
- {
- g_warning ("Out of range shininess %f supplied for pipeline\n",
- shininess);
- return;
- }
-
- authority = _cogl_pipeline_get_authority (pipeline, state);
-
- lighting_state = &authority->big_state->lighting_state;
-
- if (lighting_state->shininess == shininess)
- 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);
-
- lighting_state = &pipeline->big_state->lighting_state;
- lighting_state->shininess = shininess;
-
- _cogl_pipeline_update_authority (pipeline, authority, state,
- _cogl_pipeline_lighting_state_equal);
-}
-
-void
-cogl_pipeline_get_emission (CoglPipeline *pipeline,
- CoglColor *emission)
-{
- CoglPipeline *authority;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority =
- _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
-
- cogl_color_init_from_4fv (emission,
- authority->big_state->lighting_state.emission);
-}
-
-void
-cogl_pipeline_set_emission (CoglPipeline *pipeline, const CoglColor *emission)
-{
- CoglPipeline *authority;
- CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
- CoglPipelineLightingState *lighting_state;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- authority = _cogl_pipeline_get_authority (pipeline, state);
-
- lighting_state = &authority->big_state->lighting_state;
- if (cogl_color_equal (emission, &lighting_state->emission))
- 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);
-
- lighting_state = &pipeline->big_state->lighting_state;
- lighting_state->emission[0] = cogl_color_get_red_float (emission);
- lighting_state->emission[1] = cogl_color_get_green_float (emission);
- lighting_state->emission[2] = cogl_color_get_blue_float (emission);
- lighting_state->emission[3] = cogl_color_get_alpha_float (emission);
-
- _cogl_pipeline_update_authority (pipeline, authority, state,
- _cogl_pipeline_lighting_state_equal);
-
- _cogl_pipeline_update_blend_enable (pipeline, state);
-}
-
static void
_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
CoglPipelineAlphaFunc alpha_func)
@@ -1674,17 +1395,6 @@ _cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
}
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
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
CoglPipelineHashState *state)
{
diff --git a/cogl/cogl-pipeline-state.h b/cogl/cogl-pipeline-state.h
index d73967c..836fbce 100644
--- a/cogl/cogl-pipeline-state.h
+++ b/cogl/cogl-pipeline-state.h
@@ -117,189 +117,6 @@ cogl_pipeline_get_color (CoglPipeline *pipeline,
CoglColor *color);
/**
- * cogl_pipeline_set_ambient:
- * @pipeline: A #CoglPipeline object
- * @ambient: The components of the desired ambient color
- *
- * Sets the pipeline's ambient color, in the standard OpenGL lighting
- * model. The ambient color affects the overall color of the object.
- *
- * Since the diffuse color will be intense when the light hits the surface
- * directly, the ambient will be most apparent where the light hits at a
- * slant.
- *
- * The default value is (0.2, 0.2, 0.2, 1.0)
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_set_ambient (CoglPipeline *pipeline,
- const CoglColor *ambient);
-
-/**
- * cogl_pipeline_get_ambient:
- * @pipeline: A #CoglPipeline object
- * @ambient: The location to store the ambient color
- *
- * Retrieves the current ambient color for @pipeline
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_get_ambient (CoglPipeline *pipeline,
- CoglColor *ambient);
-
-/**
- * cogl_pipeline_set_diffuse:
- * @pipeline: A #CoglPipeline object
- * @diffuse: The components of the desired diffuse color
- *
- * Sets the pipeline's diffuse color, in the standard OpenGL lighting
- * model. The diffuse color is most intense where the light hits the
- * surface directly - perpendicular to the surface.
- *
- * The default value is (0.8, 0.8, 0.8, 1.0)
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
- const CoglColor *diffuse);
-
-/**
- * cogl_pipeline_get_diffuse:
- * @pipeline: A #CoglPipeline object
- * @diffuse: The location to store the diffuse color
- *
- * Retrieves the current diffuse color for @pipeline
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
- CoglColor *diffuse);
-
-/**
- * cogl_pipeline_set_ambient_and_diffuse:
- * @pipeline: A #CoglPipeline object
- * @color: The components of the desired ambient and diffuse colors
- *
- * Conveniently sets the diffuse and ambient color of @pipeline at the same
- * time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse().
- *
- * The default ambient color is (0.2, 0.2, 0.2, 1.0)
- *
- * The default diffuse color is (0.8, 0.8, 0.8, 1.0)
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline,
- const CoglColor *color);
-
-/**
- * cogl_pipeline_set_specular:
- * @pipeline: A #CoglPipeline object
- * @specular: The components of the desired specular color
- *
- * Sets the pipeline's specular color, in the standard OpenGL lighting
- * model. The intensity of the specular color depends on the viewport
- * position, and is brightest along the lines of reflection.
- *
- * The default value is (0.0, 0.0, 0.0, 1.0)
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_set_specular (CoglPipeline *pipeline,
- const CoglColor *specular);
-
-/**
- * cogl_pipeline_get_specular:
- * @pipeline: A #CoglPipeline object
- * @specular: The location to store the specular color
- *
- * Retrieves the pipelines current specular color.
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_get_specular (CoglPipeline *pipeline,
- CoglColor *specular);
-
-/**
- * cogl_pipeline_set_shininess:
- * @pipeline: A #CoglPipeline object
- * @shininess: The desired shininess; must be >= 0.0
- *
- * Sets the shininess of the pipeline, in the standard OpenGL lighting
- * model, which determines the size of the specular highlights. A
- * higher @shininess will produce smaller highlights which makes the
- * object appear more shiny.
- *
- * The default value is 0.0
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_set_shininess (CoglPipeline *pipeline,
- float shininess);
-
-/**
- * cogl_pipeline_get_shininess:
- * @pipeline: A #CoglPipeline object
- *
- * Retrieves the pipelines current emission color.
- *
- * Return value: The pipelines current shininess value
- *
- * Since: 2.0
- * Stability: Unstable
- */
-float
-cogl_pipeline_get_shininess (CoglPipeline *pipeline);
-
-/**
- * cogl_pipeline_set_emission:
- * @pipeline: A #CoglPipeline object
- * @emission: The components of the desired emissive color
- *
- * Sets the pipeline's emissive color, in the standard OpenGL lighting
- * model. It will look like the surface is a light source emitting this
- * color.
- *
- * The default value is (0.0, 0.0, 0.0, 1.0)
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_set_emission (CoglPipeline *pipeline,
- const CoglColor *emission);
-
-/**
- * cogl_pipeline_get_emission:
- * @pipeline: A #CoglPipeline object
- * @emission: The location to store the emission color
- *
- * Retrieves the pipelines current emission color.
- *
- * Since: 2.0
- * Stability: Unstable
- */
-void
-cogl_pipeline_get_emission (CoglPipeline *pipeline,
- CoglColor *emission);
-
-/**
* CoglPipelineAlphaFunc:
* @COGL_PIPELINE_ALPHA_FUNC_NEVER: Never let the fragment through.
* @COGL_PIPELINE_ALPHA_FUNC_LESS: Let the fragment through if the incoming
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 0c2dc9d..9ed7231 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -103,7 +103,6 @@ _cogl_pipeline_init_default_pipeline (void)
/* XXX: NB: It's important that we zero this to avoid polluting
* pipeline hash values with un-initialized data */
CoglPipelineBigState *big_state = g_slice_new0 (CoglPipelineBigState);
- CoglPipelineLightingState *lighting_state = &big_state->lighting_state;
CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
CoglPipelineBlendState *blend_state = &big_state->blend_state;
CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state;
@@ -169,29 +168,6 @@ _cogl_pipeline_init_default_pipeline (void)
cogl_color_init_from_4ub (&pipeline->color, 0xff, 0xff, 0xff, 0xff);
/* Use the same defaults as the GL spec... */
- lighting_state->ambient[0] = 0.2;
- lighting_state->ambient[1] = 0.2;
- lighting_state->ambient[2] = 0.2;
- lighting_state->ambient[3] = 1.0;
-
- lighting_state->diffuse[0] = 0.8;
- lighting_state->diffuse[1] = 0.8;
- lighting_state->diffuse[2] = 0.8;
- lighting_state->diffuse[3] = 1.0;
-
- lighting_state->specular[0] = 0;
- lighting_state->specular[1] = 0;
- lighting_state->specular[2] = 0;
- lighting_state->specular[3] = 1.0;
-
- lighting_state->emission[0] = 0;
- lighting_state->emission[1] = 0;
- lighting_state->emission[2] = 0;
- lighting_state->emission[3] = 1.0;
-
- lighting_state->shininess = 0.0f;
-
- /* Use the same defaults as the GL spec... */
alpha_state->alpha_func = COGL_PIPELINE_ALPHA_FUNC_ALWAYS;
alpha_state->alpha_func_reference = 0.0;
@@ -750,32 +726,6 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
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)
{
/* has_alpha tracks the alpha status of the GL_PREVIOUS layer.
@@ -880,13 +830,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
else
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)
big_state->alpha_state.alpha_func =
src->big_state->alpha_state.alpha_func;
@@ -1008,13 +951,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
pipeline->n_layers = authority->n_layers;
pipeline->layer_differences = NULL;
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:
{
memcpy (&pipeline->big_state->blend_state,
@@ -2181,11 +2117,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
&authorities1[bit]->color))
goto done;
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:
if (!_cogl_pipeline_alpha_func_state_equal (authorities0[bit],
authorities1[bit]))
@@ -2617,8 +2548,6 @@ _cogl_pipeline_init_state_hash_functions (void)
_cogl_pipeline_hash_blend_enable_state;
state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
_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] =
_cogl_pipeline_hash_alpha_func_state;
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX] =
@@ -2644,7 +2573,7 @@ _cogl_pipeline_init_state_hash_functions (void)
{
/* 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 "
"newly added pipeline state and update assert "
"in _cogl_pipeline_init_state_hash_functions");
--
1.7.7.6
More information about the Cogl
mailing list