[cogl] cogl-pipeline: Fix comparing the texture data state for NULL textures
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] cogl-pipeline: Fix comparing the texture data state for NULL textures
- Date: Mon, 13 Feb 2012 17:31:00 +0000 (UTC)
commit d2a35a1e2227c27dde84610ffbad3d593c32d096
Author: Neil Roberts <neil linux intel com>
Date: Thu Feb 9 13:56:40 2012 +0000
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>
cogl/cogl-pipeline-layer-state.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/cogl/cogl-pipeline-layer-state.c b/cogl/cogl-pipeline-layer-state.c
index 12ee87b..e6506a8 100644
--- a/cogl/cogl-pipeline-layer-state.c
+++ b/cogl/cogl-pipeline-layer-state.c
@@ -877,12 +877,25 @@ _cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1,
CoglPipelineEvalFlags flags)
{
- GLuint gl_handle0, gl_handle1;
+ 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;
- cogl_texture_get_gl_texture (authority0->texture, &gl_handle0, NULL);
- cogl_texture_get_gl_texture (authority1->texture, &gl_handle1, NULL);
+ cogl_texture_get_gl_texture (authority0->texture, &gl_handle0, NULL);
+ cogl_texture_get_gl_texture (authority1->texture, &gl_handle1, NULL);
- return gl_handle0 == gl_handle1;
+ return gl_handle0 == gl_handle1;
+ }
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]