Mesa (gallium_draw_llvm): draw llvm: fix translation of formats with variable components

Zack Rusin zack at kemper.freedesktop.org
Fri Apr 2 22:49:26 UTC 2010


Module: Mesa
Branch: gallium_draw_llvm
Commit: 557b75248a3ebc6daabe3c2b69ac24d409aaa1e0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=557b75248a3ebc6daabe3c2b69ac24d409aaa1e0

Author: Zack Rusin <zackr at vmware.com>
Date:   Fri Apr  2 15:56:34 2010 -0400

draw llvm: fix translation of formats with variable components

---

 src/gallium/auxiliary/draw/draw_llvm_translate.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm_translate.c b/src/gallium/auxiliary/draw/draw_llvm_translate.c
index bc17d38..b29ebde 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_translate.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_translate.c
@@ -428,6 +428,12 @@ fetch(LLVMBuilderRef builder,
    int offset = 0;
    LLVMValueRef res = LLVMConstNull(
       LLVMVectorType(LLVMFloatType(), 4));
+   LLVMValueRef defaults[4];
+
+   defaults[0] = LLVMConstReal(LLVMFloatType(), 0);
+   defaults[1] = LLVMConstReal(LLVMFloatType(), 0);
+   defaults[2] = LLVMConstReal(LLVMFloatType(), 0);
+   defaults[3] = LLVMConstReal(LLVMFloatType(), 1);
 
    for (i = 0; i < nr_components; ++i) {
       LLVMValueRef src_index = LLVMConstInt(LLVMInt32Type(), offset, 0);
@@ -447,6 +453,13 @@ fetch(LLVMBuilderRef builder,
                                    dst_index, "");
       offset += val_size;
    }
+   for (; i < 4; ++i) {
+      LLVMValueRef dst_index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      res = LLVMBuildInsertElement(builder,
+                                   res,
+                                   defaults[i],
+                                   dst_index, "");
+   }
    return res;
 }
 




More information about the mesa-commit mailing list