cogl-pipeline: Fix comparing the texture data state for NULL textures

When comparing the texture data for a pipeline layer it tries to get
the GL texture handle out of the texture object. However it's valid
for a layer to have a NULL texture object but in that case the code
would just crash. This patch fixes it to compare the texture types
when the texture object is NULL.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2012-02-09 13:56:40 +00:00
parent b96e6900f5
commit d2a35a1e22

View File

@ -876,6 +876,18 @@ gboolean
_cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0, _cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1, CoglPipelineLayer *authority1,
CoglPipelineEvalFlags flags) CoglPipelineEvalFlags flags)
{
if (authority0->texture == NULL)
{
if (authority1->texture == NULL)
return (_cogl_pipeline_layer_get_texture_type (authority0) ==
_cogl_pipeline_layer_get_texture_type (authority1));
else
return FALSE;
}
else if (authority1->texture == NULL)
return FALSE;
else
{ {
GLuint gl_handle0, gl_handle1; GLuint gl_handle0, gl_handle1;
@ -884,6 +896,7 @@ _cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0,
return gl_handle0 == gl_handle1; return gl_handle0 == gl_handle1;
} }
}
gboolean gboolean
_cogl_pipeline_layer_combine_state_equal (CoglPipelineLayer *authority0, _cogl_pipeline_layer_combine_state_equal (CoglPipelineLayer *authority0,