diff options
author | Zack Rusin <[email protected]> | 2008-02-13 07:28:26 -0500 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2008-02-13 08:33:16 -0500 |
commit | c107d572104890c83647ad611d303fe1fae70e8f (patch) | |
tree | 95c481465c36557758fcb375f90ff87123d86618 /src/mesa/pipe | |
parent | 66640c4b589db7b6b5edce7d297ae6623bfda9c1 (diff) |
try to load the consts correctly
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/llvm/storagesoa.cpp | 20 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/storagesoa.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index e09e9e8fe7d..7292333a803 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -81,6 +81,15 @@ std::vector<llvm::Value*> StorageSoa::constElement(int idx, int swizzle, llvm::Value *indIdx) { std::vector<llvm::Value*> res(4); + llvm::Value *xChannel = elementPointer(m_consts, idx, 0); + llvm::Value *yChannel = elementPointer(m_consts, idx, 1); + llvm::Value *zChannel = elementPointer(m_consts, idx, 2); + llvm::Value *wChannel = elementPointer(m_consts, idx, 3); + + res[0] = alignedArrayLoad(xChannel); + res[1] = alignedArrayLoad(yChannel); + res[2] = alignedArrayLoad(zChannel); + res[3] = alignedArrayLoad(wChannel); return res; } @@ -206,3 +215,14 @@ llvm::ConstantInt * StorageSoa::constantInt(int idx) const m_constInts[idx] = constInt; return constInt; } + +llvm::Value *StorageSoa::alignedArrayLoad(llvm::Value *val) +{ + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + PointerType *vectorPtr = PointerType::get(vectorType, 0); + + CastInst *cast = new BitCastInst(val, vectorPtr, name("toVector"), m_block); + LoadInst *load = new LoadInst(cast, name("alignLoad"), false, m_block); + load->setAlignment(8); + return load; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 84db7726a7c..43b23951deb 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -74,6 +74,8 @@ private: int channel) const; const char *name(const char *prefix) const; llvm::ConstantInt *constantInt(int) const; + llvm::Value *alignedArrayLoad(llvm::Value *val); + private: llvm::BasicBlock *m_block; |