summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-03-31 21:30:26 +0100
committerNeil Roberts <neil@linux.intel.com>2012-04-03 16:41:50 +0100
commit1a325e61e6c4da3b964b7639b942536bb6092cd7 (patch)
treef3bc56e9ea23d0e9c9f208c9acc10719f2276e18
parente012d5f06f12ddeed4b4331e159013b6b1859382 (diff)
downloadcogl-1a325e61e6c4da3b964b7639b942536bb6092cd7.tar.gz
pipeline: Use cogl_depth_state_init to init default depth state
The previous code to initialise the depth state on the default pipeline wasn't initialising the magic number. If you later tried to retrieve the depth state using cogl_pipeline_get_depth_state you would end up with an invalid depth state struct and you would just get warnings if you tried to use it for anything. This patch just replaces the initialisation with a call to cogl_depth_state_init because it uses the same values anyway. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit be9d5b34c66ac81656e37779eb64891a062f90af)
-rw-r--r--cogl/cogl-depth-state.c1
-rw-r--r--cogl/cogl-pipeline.c8
2 files changed, 2 insertions, 7 deletions
diff --git a/cogl/cogl-depth-state.c b/cogl/cogl-depth-state.c
index 076d1b2e..d441adc7 100644
--- a/cogl/cogl-depth-state.c
+++ b/cogl/cogl-depth-state.c
@@ -35,6 +35,7 @@ cogl_depth_state_init (CoglDepthState *state)
{
state->magic = COGL_DEPTH_STATE_MAGIC;
+ /* The same as the GL defaults */
state->test_enabled = FALSE;
state->write_enabled = TRUE;
state->test_function = COGL_DEPTH_TEST_FUNCTION_LESS;
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 006885c6..d2dadec9 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -188,7 +188,6 @@ _cogl_pipeline_init_default_pipeline (void)
CoglPipelineLightingState *lighting_state = &big_state->lighting_state;
CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
CoglPipelineBlendState *blend_state = &big_state->blend_state;
- CoglDepthState *depth_state = &big_state->depth_state;
CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state;
CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state;
@@ -287,12 +286,7 @@ _cogl_pipeline_init_default_pipeline (void)
big_state->user_program = COGL_INVALID_HANDLE;
- /* The same as the GL defaults */
- depth_state->test_enabled = FALSE;
- depth_state->test_function = COGL_DEPTH_TEST_FUNCTION_LESS;
- depth_state->write_enabled = TRUE;
- depth_state->range_near = 0;
- depth_state->range_far = 1;
+ cogl_depth_state_init (&big_state->depth_state);
big_state->point_size = 1.0f;