summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/llvm
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-10-25 09:03:53 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-10-25 09:04:41 -0400
commit1d17cb721afaa53317614af90488a45c26e083e3 (patch)
treec8d2a0123264a2a05e9e7d3eb9bbd646110aeb00 /src/mesa/pipe/llvm
parent1d26e9c447fd9746b2219edbf65b1991521bcfe7 (diff)
Fix nested swizzles. Actually fetch the destination contents
instead of input.
Diffstat (limited to 'src/mesa/pipe/llvm')
-rw-r--r--src/mesa/pipe/llvm/storage.cpp10
-rw-r--r--src/mesa/pipe/llvm/storage.h3
2 files changed, 9 insertions, 4 deletions
diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp
index 1072917198..cba719a8be 100644
--- a/src/mesa/pipe/llvm/storage.cpp
+++ b/src/mesa/pipe/llvm/storage.cpp
@@ -212,7 +212,9 @@ void Storage::setTempElement(int idx, llvm::Value *val, int mask)
void Storage::store(int dstIdx, llvm::Value *val, int mask)
{
if (mask != TGSI_WRITEMASK_XYZW) {
- llvm::Value *templ = m_dstCache[dstIdx];
+ llvm::Value *templ = 0;
+ if (m_destWriteMap[dstIdx])
+ templ = outputElement(dstIdx);
val = maskWrite(val, mask, templ);
}
@@ -222,7 +224,7 @@ void Storage::store(int dstIdx, llvm::Value *val, int mask)
m_block);
StoreInst *st = new StoreInst(val, getElem, false, m_block);
st->setAlignment(8);
- //m_dstCache[dstIdx] = st;
+ m_destWriteMap[dstIdx] = true;
}
llvm::Value *Storage::maskWrite(llvm::Value *src, int mask, llvm::Value *templ)
@@ -308,7 +310,7 @@ llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx )
GetElementPtrInst *getElem = 0;
if (indIdx) {
- getElem = new GetElementPtrInst(m_IN,
+ getElem = new GetElementPtrInst(m_OUT,
BinaryOperator::create(Instruction::Add,
indIdx,
constantInt(idx),
@@ -317,7 +319,7 @@ llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx )
name("output_ptr"),
m_block);
} else {
- getElem = new GetElementPtrInst(m_IN,
+ getElem = new GetElementPtrInst(m_OUT,
constantInt(idx),
name("output_ptr"),
m_block);
diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h
index a844d1c30f..ebdfcdefd6 100644
--- a/src/mesa/pipe/llvm/storage.h
+++ b/src/mesa/pipe/llvm/storage.h
@@ -34,6 +34,7 @@
#define STORAGE_H
#include <map>
+#include <set>
#include <vector>
namespace llvm {
@@ -103,6 +104,8 @@ private:
int m_idx;
int m_numConsts;
+
+ std::map<int, bool > m_destWriteMap;
};
#endif