Module: Mesa
Branch: master
Commit: 40d7be52619fbff2479dcdf56929e3e0c5b12e72
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=40d7be52619fbff2479dcdf56929e3e0c5b12e72

Author: Keith Whitwell <kei...@vmware.com>
Date:   Thu Oct  7 18:59:54 2010 +0100

llvmpipe: use alloca for fs color outputs

Don't try to emit our own phi's, let llvm mem2reg do it for us.

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 0530c61..f75ae28 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -303,8 +303,7 @@ generate_fs(struct llvmpipe_context *lp,
    /* Declare the color and z variables */
    for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {
       for(chan = 0; chan < NUM_CHANNELS; ++chan) {
-        color[cbuf][chan] = LLVMGetUndef(vec_type);
-        lp_build_flow_scope_declare(flow, &color[cbuf][chan]);
+        color[cbuf][chan] = lp_build_alloca(builder, vec_type, "color");
       }
    }
 
@@ -369,7 +368,7 @@ generate_fs(struct llvmpipe_context *lp,
                                          &mask, alpha, alpha_ref_value);
                   }
 
-                 color[cbuf][chan] = out;
+                  LLVMBuildStore(builder, out, color[cbuf][chan]);
                   break;
                }
 
@@ -665,9 +664,18 @@ generate_fragment(struct llvmpipe_context *lp,
        * Convert the fs's output color and mask to fit to the blending type. 
        */
       for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+         LLVMValueRef fs_color_vals[LP_MAX_VECTOR_LENGTH];
+         
+         for (i = 0; i < num_fs; i++) {
+            fs_color_vals[i] =
+               LLVMBuildLoad(builder, fs_out_color[cbuf][chan][i], 
"fs_color_vals");
+         }
+
         lp_build_conv(builder, fs_type, blend_type,
-                      fs_out_color[cbuf][chan], num_fs,
+                       fs_color_vals,
+                       num_fs,
                       &blend_in_color[chan], 1);
+
         lp_build_name(blend_in_color[chan], "color%d.%c", cbuf, "rgba"[chan]);
       }
 

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

Reply via email to