summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2015-09-28 21:44:54 +0200
committerMarek Olšák <marek.olsak@amd.com>2015-10-03 22:06:09 +0200
commit55d406b71ee96dc7ee2dc2f9dd7df3bd80957f5a (patch)
tree746eb607d18b7fc2da097ccf4303bbd33a74eed4 /src/gallium/auxiliary
parent6b0f21cb287bde3acaba1b0d18ab1c291acf327f (diff)
downloadexternal_mesa3d-55d406b71ee96dc7ee2dc2f9dd7df3bd80957f5a.zip
external_mesa3d-55d406b71ee96dc7ee2dc2f9dd7df3bd80957f5a.tar.gz
external_mesa3d-55d406b71ee96dc7ee2dc2f9dd7df3bd80957f5a.tar.bz2
tgsi/scan: add interpolation info into tgsi_shader_info
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c91
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.h13
2 files changed, 101 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 66306d7..00b07c8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -116,6 +116,53 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
break;
}
+ if (fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_CENTROID ||
+ fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_OFFSET ||
+ fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE) {
+ struct tgsi_full_src_register *src0 = &fullinst->Src[0];
+ unsigned input;
+
+ if (src0->Register.Indirect && src0->Indirect.ArrayID)
+ input = info->input_array_first[src0->Indirect.ArrayID];
+ else
+ input = src0->Register.Index;
+
+ /* For the INTERP opcodes, the interpolation is always
+ * PERSPECTIVE unless LINEAR is specified.
+ */
+ switch (info->input_interpolate[input]) {
+ case TGSI_INTERPOLATE_COLOR:
+ case TGSI_INTERPOLATE_CONSTANT:
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ switch (fullinst->Instruction.Opcode) {
+ case TGSI_OPCODE_INTERP_CENTROID:
+ info->uses_persp_opcode_interp_centroid = true;
+ break;
+ case TGSI_OPCODE_INTERP_OFFSET:
+ info->uses_persp_opcode_interp_offset = true;
+ break;
+ case TGSI_OPCODE_INTERP_SAMPLE:
+ info->uses_persp_opcode_interp_sample = true;
+ break;
+ }
+ break;
+
+ case TGSI_INTERPOLATE_LINEAR:
+ switch (fullinst->Instruction.Opcode) {
+ case TGSI_OPCODE_INTERP_CENTROID:
+ info->uses_linear_opcode_interp_centroid = true;
+ break;
+ case TGSI_OPCODE_INTERP_OFFSET:
+ info->uses_linear_opcode_interp_offset = true;
+ break;
+ case TGSI_OPCODE_INTERP_SAMPLE:
+ info->uses_linear_opcode_interp_sample = true;
+ break;
+ }
+ break;
+ }
+ }
+
if (fullinst->Instruction.Opcode >= TGSI_OPCODE_F2D &&
fullinst->Instruction.Opcode <= TGSI_OPCODE_DSSG)
info->uses_doubles = true;
@@ -236,8 +283,48 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
info->num_inputs++;
- if (fulldecl->Interp.Location == TGSI_INTERPOLATE_LOC_CENTROID)
- info->uses_centroid = TRUE;
+ /* Only interpolated varyings. Don't include POSITION.
+ * Don't include integer varyings, because they are not
+ * interpolated.
+ */
+ if (semName == TGSI_SEMANTIC_GENERIC ||
+ semName == TGSI_SEMANTIC_TEXCOORD ||
+ semName == TGSI_SEMANTIC_COLOR ||
+ semName == TGSI_SEMANTIC_BCOLOR ||
+ semName == TGSI_SEMANTIC_FOG ||
+ semName == TGSI_SEMANTIC_CLIPDIST ||
+ semName == TGSI_SEMANTIC_CULLDIST) {
+ switch (fulldecl->Interp.Interpolate) {
+ case TGSI_INTERPOLATE_COLOR:
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ switch (fulldecl->Interp.Location) {
+ case TGSI_INTERPOLATE_LOC_CENTER:
+ info->uses_persp_center = true;
+ break;
+ case TGSI_INTERPOLATE_LOC_CENTROID:
+ info->uses_persp_centroid = true;
+ break;
+ case TGSI_INTERPOLATE_LOC_SAMPLE:
+ info->uses_persp_sample = true;
+ break;
+ }
+ break;
+ case TGSI_INTERPOLATE_LINEAR:
+ switch (fulldecl->Interp.Location) {
+ case TGSI_INTERPOLATE_LOC_CENTER:
+ info->uses_linear_center = true;
+ break;
+ case TGSI_INTERPOLATE_LOC_CENTROID:
+ info->uses_linear_centroid = true;
+ break;
+ case TGSI_INTERPOLATE_LOC_SAMPLE:
+ info->uses_linear_sample = true;
+ break;
+ }
+ break;
+ /* TGSI_INTERPOLATE_CONSTANT doesn't do any interpolation. */
+ }
+ }
if (semName == TGSI_SEMANTIC_PRIMID)
info->uses_primid = TRUE;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 42539ee..3ceb557 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -82,7 +82,18 @@ struct tgsi_shader_info
boolean writes_stencil; /**< does fragment shader write stencil value? */
boolean writes_edgeflag; /**< vertex shader outputs edgeflag */
boolean uses_kill; /**< KILL or KILL_IF instruction used? */
- boolean uses_centroid;
+ boolean uses_persp_center;
+ boolean uses_persp_centroid;
+ boolean uses_persp_sample;
+ boolean uses_linear_center;
+ boolean uses_linear_centroid;
+ boolean uses_linear_sample;
+ boolean uses_persp_opcode_interp_centroid;
+ boolean uses_persp_opcode_interp_offset;
+ boolean uses_persp_opcode_interp_sample;
+ boolean uses_linear_opcode_interp_centroid;
+ boolean uses_linear_opcode_interp_offset;
+ boolean uses_linear_opcode_interp_sample;
boolean uses_instanceid;
boolean uses_vertexid;
boolean uses_vertexid_nobase;