summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/codegen
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-10-17 23:04:11 +0200
committerChristoph Bumiller <[email protected]>2011-10-21 23:00:39 +0200
commit52c8c52b222e1fdb4c1f4ca3dedde9cd7b9c321f (patch)
tree98a568e38751f6a2f669ee89b948edc7c965a965 /src/gallium/drivers/nv50/codegen
parent9c930639d9f6d713ccfd16b390a41a9f584f348c (diff)
nv50/ir: use RDSV to fetch FrontFacing before lowering
Diffstat (limited to 'src/gallium/drivers/nv50/codegen')
-rw-r--r--src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp19
-rw-r--r--src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h1
-rw-r--r--src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp2
3 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp
index 521578ac6f2..f9c18fa8d88 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp
@@ -137,6 +137,25 @@ BuildUtil::mkFetch(Value *dst, DataType ty, DataFile file, int32_t offset,
}
Instruction *
+BuildUtil::mkInterp(unsigned mode, Value *dst, int32_t offset, Value *rel)
+{
+ operation op = OP_LINTERP;
+ DataType ty = TYPE_F32;
+
+ if ((mode & NV50_IR_INTERP_MODE_MASK) == NV50_IR_INTERP_FLAT)
+ ty = TYPE_U32;
+ else
+ if ((mode & NV50_IR_INTERP_MODE_MASK) == NV50_IR_INTERP_PERSPECTIVE)
+ op = OP_PINTERP;
+
+ Symbol *sym = mkSymbol(FILE_SHADER_INPUT, 0, ty, offset);
+
+ Instruction *insn = mkOp1(op, ty, dst, sym);
+ insn->setIndirect(0, 0, rel);
+ return insn;
+}
+
+Instruction *
BuildUtil::mkMov(Value *dst, Value *src, DataType ty)
{
Instruction *insn = new_Instruction(func, OP_MOV, ty);
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h
index ad7d54f0d41..dbc6723fe90 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h
@@ -63,6 +63,7 @@ public:
Instruction *mkMovToReg(int id, Value *);
Instruction *mkMovFromReg(Value *, int id);
+ Instruction *mkInterp(unsigned mode, Value *, int32_t offset, Value *rel);
Instruction *mkFetch(Value *, DataType, DataFile, int32_t offset,
Value *attrRel, Value *primRel);
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index 40ea6a0d2d3..6cb61b87766 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -1246,6 +1246,8 @@ Converter::fetchSrc(tgsi::Instruction::SrcRegister src, int c, Value *ptr)
// don't load masked inputs, won't be assigned a slot
if (!ptr && !(info->in[idx].mask & (1 << swz)))
return loadImm(NULL, swz == TGSI_SWIZZLE_W ? 1.0f : 0.0f);
+ if (!ptr && info->in[idx].sn == TGSI_SEMANTIC_FACE)
+ return mkOp1v(OP_RDSV, TYPE_F32, getSSA(), mkSysVal(SV_FACE, 0));
return interpolate(src, c, ptr);
}
return mkLoad(TYPE_U32, srcToSym(src, c), ptr);