cogl-material: Consider the shader when deciding if materials equate
authorNeil Roberts <neil@linux.intel.com>
Sat, 17 Jul 2010 13:08:28 +0000 (14:08 +0100)
committerNeil Roberts <neil@linux.intel.com>
Tue, 20 Jul 2010 16:21:12 +0000 (17:21 +0100)
_cogl_material_equal was ignoring the user shader state so rectangles
with different shaders would get batched together.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2220

clutter/cogl/cogl/cogl-material.c

index f266105..9818372 100644 (file)
@@ -3016,6 +3016,14 @@ _cogl_material_point_size_equal (CoglMaterial *authority0,
 }
 
 static gboolean
+_cogl_material_user_shader_equal (CoglMaterial *authority0,
+                                  CoglMaterial *authority1)
+{
+  return (authority0->big_state->user_program ==
+          authority1->big_state->user_program);
+}
+
+static gboolean
 _cogl_material_layers_equal (CoglMaterial *authority0,
                              CoglMaterial *authority1)
 {
@@ -3246,6 +3254,12 @@ _cogl_material_equal (CoglMaterial *material0,
 
   if (!simple_property_equal (material0, material1,
                               materials_difference,
+                              COGL_MATERIAL_STATE_USER_SHADER,
+                              _cogl_material_user_shader_equal))
+    return FALSE;
+
+  if (!simple_property_equal (material0, material1,
+                              materials_difference,
                               COGL_MATERIAL_STATE_LAYERS,
                               _cogl_material_layers_equal))
     return FALSE;