From 31c127bfa7066f57d2b15957610ff4c12b5b5465 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 13 Jul 2010 13:59:07 +0100 Subject: [PATCH] cogl-gles2-wrapper: Layers aren't equal if one is enabled and one is not Previously when comparing whether the settings for a layer are equal it would only check if one of them was enabled. If so then it would assume the other one was enabled and continue to compare the texture environment. Now it also checks whether the enabledness differs. --- clutter/cogl/cogl/driver/gles/cogl-gles2-wrapper.c | 60 ++++++++++++---------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/clutter/cogl/cogl/driver/gles/cogl-gles2-wrapper.c b/clutter/cogl/cogl/driver/gles/cogl-gles2-wrapper.c index 2acbee2..72d18f4 100644 --- a/clutter/cogl/cogl/driver/gles/cogl-gles2-wrapper.c +++ b/clutter/cogl/cogl/driver/gles/cogl-gles2-wrapper.c @@ -252,34 +252,40 @@ cogl_gles2_settings_equal (const CoglGles2WrapperSettings *a, /* Compare layer combine operation for each active unit */ if (fragment_tests) for (i = 0; i < COGL_GLES2_MAX_TEXTURE_UNITS; i++) - if (COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (a->texture_units, i)) - { - const CoglGles2WrapperTexEnv *tex_env_a = a->tex_env + i; - const CoglGles2WrapperTexEnv *tex_env_b = b->tex_env + i; - int arg, n_args; - GLenum func; - - if (tex_env_a->point_sprite_coords != - tex_env_b->point_sprite_coords) - return FALSE; - - func = tex_env_a->texture_combine_rgb_func; - - if (func != tex_env_b->texture_combine_rgb_func) - return FALSE; - - n_args = cogl_gles2_get_n_args_for_combine_func (func); + { + if (!!COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (a->texture_units, i) != + !!COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (b->texture_units, i)) + return FALSE; - for (arg = 0; arg < n_args; arg++) - { - if (tex_env_a->texture_combine_rgb_src[arg] != - tex_env_b->texture_combine_rgb_src[arg]) - return FALSE; - if (tex_env_a->texture_combine_rgb_op[arg] != - tex_env_b->texture_combine_rgb_op[arg]) - return FALSE; - } - } + if (COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (a->texture_units, i)) + { + const CoglGles2WrapperTexEnv *tex_env_a = a->tex_env + i; + const CoglGles2WrapperTexEnv *tex_env_b = b->tex_env + i; + int arg, n_args; + GLenum func; + + if (tex_env_a->point_sprite_coords != + tex_env_b->point_sprite_coords) + return FALSE; + + func = tex_env_a->texture_combine_rgb_func; + + if (func != tex_env_b->texture_combine_rgb_func) + return FALSE; + + n_args = cogl_gles2_get_n_args_for_combine_func (func); + + for (arg = 0; arg < n_args; arg++) + { + if (tex_env_a->texture_combine_rgb_src[arg] != + tex_env_b->texture_combine_rgb_src[arg]) + return FALSE; + if (tex_env_a->texture_combine_rgb_op[arg] != + tex_env_b->texture_combine_rgb_op[arg]) + return FALSE; + } + } + } return TRUE; } -- 2.7.4