summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-07-23 21:41:38 -0400
committerIlia Mirkin <[email protected]>2015-07-23 21:46:09 -0400
commit7e0036a49258326cc2d875f2960d18c6b3665036 (patch)
treec8e83947c73b64306ca824271e96600327437f55 /src/gallium/drivers
parent7c4768540dacab8a4853f1310413cb976b5fb351 (diff)
nvc0/ir: tess factors are now sysvals, adapt codegen to expect that
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir.h3
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_build_util.cpp7
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp17
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp2
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp3
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp3
6 files changed, 24 insertions, 11 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 529dcb9bdc2..174dca49ec0 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -372,7 +372,8 @@ enum SVSemantic
SV_SAMPLE_INDEX,
SV_SAMPLE_POS,
SV_SAMPLE_MASK,
- SV_TESS_FACTOR,
+ SV_TESS_OUTER,
+ SV_TESS_INNER,
SV_TESS_COORD,
SV_TID,
SV_CTAID,
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_build_util.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_build_util.cpp
index 708c5b322ee..19418c0e0f1 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_build_util.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_build_util.cpp
@@ -428,8 +428,7 @@ BuildUtil::mkSysVal(SVSemantic svName, uint32_t svIndex)
{
Symbol *sym = new_Symbol(prog, FILE_SYSTEM_VALUE, 0);
- assert(svIndex < 4 ||
- (svName == SV_CLIP_DISTANCE || svName == SV_TESS_FACTOR));
+ assert(svIndex < 4 || svName == SV_CLIP_DISTANCE);
switch (svName) {
case SV_POSITION:
@@ -438,7 +437,9 @@ BuildUtil::mkSysVal(SVSemantic svName, uint32_t svIndex)
case SV_POINT_SIZE:
case SV_POINT_COORD:
case SV_CLIP_DISTANCE:
- case SV_TESS_FACTOR:
+ case SV_TESS_OUTER:
+ case SV_TESS_INNER:
+ case SV_TESS_COORD:
sym->reg.type = TYPE_F32;
break;
default:
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 8dc7899e6c4..88078b157fa 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -373,6 +373,8 @@ static nv50_ir::SVSemantic translateSysVal(uint sysval)
case TGSI_SEMANTIC_SAMPLEMASK: return nv50_ir::SV_SAMPLE_MASK;
case TGSI_SEMANTIC_INVOCATIONID: return nv50_ir::SV_INVOCATION_ID;
case TGSI_SEMANTIC_TESSCOORD: return nv50_ir::SV_TESS_COORD;
+ case TGSI_SEMANTIC_TESSOUTER: return nv50_ir::SV_TESS_OUTER;
+ case TGSI_SEMANTIC_TESSINNER: return nv50_ir::SV_TESS_INNER;
case TGSI_SEMANTIC_VERTICESIN: return nv50_ir::SV_VERTEX_COUNT;
default:
assert(0);
@@ -1055,9 +1057,7 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
info->in[i].centroid = 1;
}
- if (sn == TGSI_SEMANTIC_PATCH ||
- sn == TGSI_SEMANTIC_TESSOUTER ||
- sn == TGSI_SEMANTIC_TESSINNER)
+ if (sn == TGSI_SEMANTIC_PATCH)
info->in[i].patch = 1;
if (sn == TGSI_SEMANTIC_PATCH)
info->numPatchConstants = MAX2(info->numPatchConstants, si + 1);
@@ -1125,6 +1125,13 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
info->sv[i].sn = sn;
info->sv[i].si = si;
info->sv[i].input = inferSysValDirection(sn);
+
+ switch (sn) {
+ case TGSI_SEMANTIC_TESSOUTER:
+ case TGSI_SEMANTIC_TESSINNER:
+ info->sv[i].patch = 1;
+ break;
+ }
}
break;
case TGSI_FILE_RESOURCE:
@@ -1624,7 +1631,9 @@ Converter::fetchSrc(tgsi::Instruction::SrcRegister src, int c, Value *ptr)
return ld->getDef(0);
case TGSI_FILE_SYSTEM_VALUE:
assert(!ptr);
- return mkOp1v(OP_RDSV, TYPE_U32, getSSA(), srcToSym(src, c));
+ ld = mkOp1(OP_RDSV, TYPE_U32, getSSA(), srcToSym(src, c));
+ ld->perPatch = info->sv[idx].patch;
+ return ld->getDef(0);
default:
return getArrayForFile(src.getFile(), idx2d)->load(
sub.cur->values, idx, swz, shiftAddress(ptr));
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index 85dd05d5267..cd8ee71ad2b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -1598,7 +1598,7 @@ NVC0LoweringPass::handleRDSV(Instruction *i)
ld->subOp = NV50_IR_SUBOP_PIXLD_COVMASK;
break;
default:
- if (prog->getType() == Program::TYPE_TESSELLATION_EVAL)
+ if (prog->getType() == Program::TYPE_TESSELLATION_EVAL && !i->perPatch)
vtx = bld.mkOp1v(OP_PFETCH, TYPE_U32, bld.getSSA(), bld.mkImm(0));
ld = bld.mkFetch(i->getDef(0), i->dType,
FILE_SHADER_INPUT, addr, i->getIndirect(0, 0), vtx);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index ef3de6ff92a..556d01b864d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -258,7 +258,8 @@ static const char *SemanticStr[SV_LAST + 1] =
"SAMPLE_INDEX",
"SAMPLE_POS",
"SAMPLE_MASK",
- "TESS_FACTOR",
+ "TESS_OUTER",
+ "TESS_INNER",
"TESS_COORD",
"TID",
"CTAID",
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
index 7d4a859dde4..27df0eba66b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
@@ -286,7 +286,8 @@ TargetNVC0::getSVAddress(DataFile shaderFile, const Symbol *sym) const
case SV_CLIP_DISTANCE: return 0x2c0 + idx * 4;
case SV_POINT_COORD: return 0x2e0 + idx * 4;
case SV_FACE: return 0x3fc;
- case SV_TESS_FACTOR: return 0x000 + idx * 4;
+ case SV_TESS_OUTER: return 0x000 + idx * 4;
+ case SV_TESS_INNER: return 0x010 + idx * 4;
case SV_TESS_COORD: return 0x2f0 + idx * 4;
case SV_NTID: return kepler ? (0x00 + idx * 4) : ~0;
case SV_NCTAID: return kepler ? (0x0c + idx * 4) : ~0;