cogl_pipeline_equal: Fix the comparison for layer texture equality
authorNeil Roberts <neil@linux.intel.com>
Fri, 26 Nov 2010 15:23:15 +0000 (15:23 +0000)
committerNeil Roberts <neil@linux.intel.com>
Fri, 26 Nov 2010 15:49:31 +0000 (15:49 +0000)
Before commit 49898d43 CoglPipeline would compare whether a pipeline
layer's texture is equal by fetching the underlying GL handle. I
changed that so that it would only compare the CoglHandles because
that commit removes the GL handle texture overrides and sliced
textures instead log the underlying primitive texture. However I
forgot that the primitives don't always use
_cogl_texture_foreach_sub_texture_in_region when the quad fits within
the single texture so it won't use a texture override. This meant that
atlas textures and sub textures get logged with the atlas handle so
the comparison still needs to be done using the GL handles. It might
be nice to add a CoglTexture virtual to get the underlying primitive
texture instead to avoid having the pipeline poke around with GL
handles.

clutter/cogl/cogl/cogl-pipeline.c

index 790e8bf..848b27f 100644 (file)
@@ -2718,7 +2718,14 @@ static gboolean
 _cogl_pipeline_layer_texture_equal (CoglPipelineLayer *authority0,
                                     CoglPipelineLayer *authority1)
 {
-  return authority0->texture == authority1->texture;
+  GLuint gl_handle0, gl_handle1;
+  GLenum gl_target0, gl_target1;
+
+  cogl_texture_get_gl_texture (authority0->texture, &gl_handle0, &gl_target0);
+  cogl_texture_get_gl_texture (authority1->texture, &gl_handle1, &gl_target1);
+
+  return (gl_handle0 == gl_handle1 &&
+          gl_target0 == gl_target1);
 }
 
 /* Determine the mask of differences between two layers.