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>
This commit is contained in:
Neil Roberts 2012-03-31 21:30:26 +01:00
parent a000189c68
commit be9d5b34c6
2 changed files with 2 additions and 7 deletions

View File

@ -36,6 +36,7 @@ cogl_depth_state_init (CoglDepthState *state)
{ {
state->magic = COGL_DEPTH_STATE_MAGIC; state->magic = COGL_DEPTH_STATE_MAGIC;
/* The same as the GL defaults */
state->test_enabled = FALSE; state->test_enabled = FALSE;
state->write_enabled = TRUE; state->write_enabled = TRUE;
state->test_function = COGL_DEPTH_TEST_FUNCTION_LESS; state->test_function = COGL_DEPTH_TEST_FUNCTION_LESS;

View File

@ -106,7 +106,6 @@ _cogl_pipeline_init_default_pipeline (void)
CoglPipelineLightingState *lighting_state = &big_state->lighting_state; CoglPipelineLightingState *lighting_state = &big_state->lighting_state;
CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state; CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
CoglPipelineBlendState *blend_state = &big_state->blend_state; CoglPipelineBlendState *blend_state = &big_state->blend_state;
CoglDepthState *depth_state = &big_state->depth_state;
CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state; CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state;
CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state; CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state;
CoglPipelineUniformsState *uniforms_state = &big_state->uniforms_state; CoglPipelineUniformsState *uniforms_state = &big_state->uniforms_state;
@ -210,12 +209,7 @@ _cogl_pipeline_init_default_pipeline (void)
big_state->user_program = COGL_INVALID_HANDLE; big_state->user_program = COGL_INVALID_HANDLE;
/* The same as the GL defaults */ cogl_depth_state_init (&big_state->depth_state);
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;
big_state->point_size = 1.0f; big_state->point_size = 1.0f;