summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/codegen
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-03-30 18:25:40 -0400
committerIlia Mirkin <[email protected]>2014-04-26 11:53:24 -0400
commitf715a0a39a0f7f19443e7721ae792878ba504eed (patch)
tree596a2c6b6570f921aec2fa915e6c7bc7b7d7c18e /src/gallium/drivers/nouveau/codegen
parentc5d822dad902b19f06c9be3c6863a51e1881ec5b (diff)
nv50: add support for PIPE_CAP_SAMPLE_SHADING
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/codegen')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir.h1
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h3
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp7
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp12
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp1
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp2
6 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 286ac834e75..96071be0e89 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -354,6 +354,7 @@ enum SVSemantic
SV_POINT_COORD,
SV_CLIP_DISTANCE,
SV_SAMPLE_INDEX,
+ SV_SAMPLE_POS,
SV_TESS_FACTOR,
SV_TESS_COORD,
SV_TID,
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index f2f4ead1f0a..2fe55912490 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -74,7 +74,6 @@ struct nv50_ir_varying
#define NV50_SEMANTIC_INVOCATIONID (TGSI_SEMANTIC_COUNT + 6)
#define NV50_SEMANTIC_TESSFACTOR (TGSI_SEMANTIC_COUNT + 7)
#define NV50_SEMANTIC_TESSCOORD (TGSI_SEMANTIC_COUNT + 8)
-#define NV50_SEMANTIC_SAMPLEMASK (TGSI_SEMANTIC_COUNT + 9)
#define NV50_SEMANTIC_COUNT (TGSI_SEMANTIC_COUNT + 10)
#define NV50_TESS_PART_FRACT_ODD 0
@@ -181,12 +180,14 @@ struct nv50_ir_prog_info
uint8_t edgeFlagOut;
uint8_t fragDepth; /* output index of FragDepth */
uint8_t sampleMask; /* output index of SampleMask */
+ boolean sampleInterp; /* perform sample interp on all fp inputs */
uint8_t backFaceColor[2]; /* input/output indices of back face colour */
uint8_t globalAccess; /* 1 for read, 2 for wr, 3 for rw */
boolean nv50styleSurfaces; /* generate gX[] access for raw buffers */
uint8_t resInfoCBSlot; /* cX[] used for tex handles, surface info */
uint16_t texBindBase; /* base address for tex handles (nve4) */
uint16_t suInfoBase; /* base address for surface info (nve4) */
+ uint16_t sampleInfoBase; /* base address for sample positions */
uint8_t msInfoCBSlot; /* cX[] used for multisample info */
uint16_t msInfoBase; /* base address for multisample info */
} io;
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 90820eace7e..0ec0b9a179d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -346,6 +346,8 @@ static nv50_ir::SVSemantic translateSysVal(uint sysval)
case TGSI_SEMANTIC_BLOCK_ID: return nv50_ir::SV_CTAID;
case TGSI_SEMANTIC_BLOCK_SIZE: return nv50_ir::SV_NTID;
case TGSI_SEMANTIC_THREAD_ID: return nv50_ir::SV_TID;
+ case TGSI_SEMANTIC_SAMPLEID: return nv50_ir::SV_SAMPLE_INDEX;
+ case TGSI_SEMANTIC_SAMPLEPOS: return nv50_ir::SV_SAMPLE_POS;
default:
assert(0);
return nv50_ir::SV_CLOCK;
@@ -925,7 +927,7 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
default:
break;
}
- if (decl->Interp.Centroid)
+ if (decl->Interp.Centroid || info->io.sampleInterp)
info->in[i].centroid = 1;
}
}
@@ -956,6 +958,9 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
decl->Declaration.UsageMask << (si * 4);
info->io.genUserClip = -1;
break;
+ case TGSI_SEMANTIC_SAMPLEMASK:
+ info->io.sampleMask = i;
+ break;
default:
break;
}
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
index 29f85cf70da..69e88e6902d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
@@ -1032,6 +1032,18 @@ NV50LoweringPreSSA::handleRDSV(Instruction *i)
bld.mkMov(def, bld.mkImm(0));
}
break;
+ case SV_SAMPLE_POS: {
+ Value *off = new_LValue(func, FILE_ADDRESS);
+ bld.mkOp1(OP_RDSV, TYPE_U32, def, bld.mkSysVal(SV_SAMPLE_INDEX, 0));
+ bld.mkOp2(OP_SHL, TYPE_U32, off, def, bld.mkImm(3));
+ bld.mkLoad(TYPE_F32,
+ def,
+ bld.mkSymbol(
+ FILE_MEMORY_CONST, prog->driver->io.resInfoCBSlot,
+ TYPE_U32, prog->driver->io.sampleInfoBase + 4 * idx),
+ off);
+ break;
+ }
default:
bld.mkFetch(i->getDef(0), i->dType,
FILE_SHADER_INPUT, addr, i->getIndirect(0, 0), NULL);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index 4093bc03893..1415eb5d209 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -253,6 +253,7 @@ static const char *SemanticStr[SV_LAST + 1] =
"POINT_COORD",
"CLIP_DISTANCE",
"SAMPLE_INDEX",
+ "SAMPLE_POS",
"TESS_FACTOR",
"TESS_COORD",
"TID",
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
index de076463f66..0b2f27ad497 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
@@ -249,6 +249,8 @@ TargetNV50::getSVAddress(DataFile shaderFile, const Symbol *sym) const
return 0x2 + 2 * sym->reg.data.sv.index;
case SV_TID:
return 0;
+ case SV_SAMPLE_POS:
+ return 0; /* sample position is handled differently */
default:
return sysvalLocation[sym->reg.data.sv.sv];
}