i965/vec4: Don't lose the force_writemask_all flag during CSE.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_fs_vector_splitting.cpp
index 422d801b568362155adb195ba06a04d1aee77432..01d3a569858b84fc1d8cf90dd538630ca349ccb5 100644 (file)
  * behavior we want for the results of texture lookups, but probably not for
  */
 
-extern "C" {
 #include "main/core.h"
 #include "brw_context.h"
-}
 #include "glsl/ir.h"
 #include "glsl/ir_visitor.h"
 #include "glsl/ir_rvalue_visitor.h"
@@ -363,12 +361,17 @@ brw_do_vector_splitting(exec_list *instructions)
       entry->mem_ctx = ralloc_parent(entry->var);
 
       for (unsigned int i = 0; i < entry->var->type->vector_elements; i++) {
-        const char *name = ralloc_asprintf(mem_ctx, "%s_%c",
-                                           entry->var->name,
-                                           "xyzw"[i]);
+         char *const name = ir_variable::temporaries_allocate_names
+            ? ralloc_asprintf(mem_ctx, "%s_%c",
+                              entry->var->name,
+                              "xyzw"[i])
+            : NULL;
 
         entry->components[i] = new(entry->mem_ctx) ir_variable(type, name,
                                                                ir_var_temporary);
+
+         ralloc_free(name);
+
         entry->var->insert_before(entry->components[i]);
       }