[Mesa-dev] [PATCH] nouveau: codegen: Take src swizzle into account on loads
Hans de Goede
hdegoede at redhat.com
Thu Apr 7 13:27:28 UTC 2016
The llvm TGSI backend does things like:
LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0].x
Expecting the data at address TEMP[0].x to get loaded to
TEMP[0].y. Before this commit the data at TEMP[0].x + 4 would be
loaded instead. This commit fixes this.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index 557608e..cc51f5a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -2279,12 +2279,16 @@ Converter::handleLOAD(Value *dst0[4])
Value *off = fetchSrc(1, c);
Symbol *sym;
+ uint32_t src0_component_offset = tgsi.getSrc(0).getSwizzle(c) * 4;
+
if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) {
off = NULL;
sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
- tgsi.getSrc(1).getValueU32(0, info) + 4 * c);
+ tgsi.getSrc(1).getValueU32(0, info) +
+ src0_component_offset);
} else {
- sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c, 4 * c);
+ sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
+ src0_component_offset);
}
Instruction *ld = mkLoad(TYPE_U32, dst0[c], sym, off);
--
2.7.3
More information about the mesa-dev
mailing list