cogl-gles2-wrapper: Layers aren't equal if one is enabled and one is not
authorNeil Roberts <neil@linux.intel.com>
Tue, 13 Jul 2010 12:59:07 +0000 (13:59 +0100)
committerNeil Roberts <neil@linux.intel.com>
Tue, 13 Jul 2010 13:28:35 +0000 (14:28 +0100)
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

index 2acbee2..72d18f4 100644 (file)
@@ -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;
 }