pipeline-state: Fix crash in the get_all_uniform_values function

The get_all_uniform_values function tries to walk the parent hierarchy
of pipelines to find pipelines overriding the uniforms state and then
grabs the values from the override. However it was accessing data
inside the ‘big state’ even if the pipeline didn't override the
uniforms state so it would crash if it encountered a parent pipeline
with no big state.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2012-02-13 18:48:17 +00:00
parent a654dac122
commit f84839e87c

View File

@ -274,17 +274,18 @@ _cogl_pipeline_get_all_uniform_values (CoglPipeline *pipeline,
do
{
const CoglPipelineUniformsState *uniforms_state =
&pipeline->big_state->uniforms_state;
data.override_count = 0;
data.src_values = uniforms_state->override_values;
if ((pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS))
_cogl_bitmask_foreach (&uniforms_state->override_mask,
get_uniforms_cb,
&data);
{
const CoglPipelineUniformsState *uniforms_state =
&pipeline->big_state->uniforms_state;
data.override_count = 0;
data.src_values = uniforms_state->override_values;
_cogl_bitmask_foreach (&uniforms_state->override_mask,
get_uniforms_cb,
&data);
}
pipeline = _cogl_pipeline_get_parent (pipeline);
}
while (pipeline);