Now, a single output vec4 can be referenced by multiple ir_variables
(gl_Fragcolor_x, gl_FragColor_y, etc.).  This gives a couple of chances
for tree grafting to work.

total instructions in shared programs: 1644020 -> 1643948 (-0.00%)
instructions in affected programs:     7446 -> 7374 (-0.97%)
GAINED:                                0
LOST:                                  0
---
 src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
index a9125ca..bf940c4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
@@ -107,7 +107,6 @@ ir_vector_reference_visitor::get_variable_entry(ir_variable 
*var)
    switch (var->data.mode) {
    case ir_var_uniform:
    case ir_var_shader_in:
-   case ir_var_shader_out:
    case ir_var_system_value:
    case ir_var_function_in:
    case ir_var_function_out:
@@ -372,8 +371,19 @@ brw_do_vector_splitting(exec_list *instructions)
                                            entry->var->name,
                                            "xyzw"[i]);
 
-        entry->components[i] = new(entry->mem_ctx) ir_variable(type, name,
-                                                               
ir_var_temporary);
+         ir_variable *new_var;
+
+         if (entry->var->data.mode == ir_var_shader_out) {
+            new_var = entry->var->clone(entry->mem_ctx, NULL);
+            new_var->type = type;
+            new_var->name = ralloc_strdup(new_var, name);
+            new_var->data.location_frac = i;
+         } else {
+            new_var = new(entry->mem_ctx) ir_variable(type, name,
+                                                      ir_var_temporary);
+         }
+
+        entry->components[i] = new_var;
         entry->var->insert_before(entry->components[i]);
       }
 
-- 
1.9.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to