From 21e47d4280e27393d7510e232a1b1ee19b426032 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 26 Nov 2010 15:23:15 +0000 Subject: [PATCH] cogl_pipeline_equal: Fix the comparison for layer texture equality 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clutter/cogl/cogl/cogl-pipeline.c b/clutter/cogl/cogl/cogl-pipeline.c index 790e8bff6..848b27faf 100644 --- a/clutter/cogl/cogl/cogl-pipeline.c +++ b/clutter/cogl/cogl/cogl-pipeline.c @@ -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.