summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_scan.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-09-08 19:12:00 +0200
committerMarek Olšák <[email protected]>2016-10-05 21:03:23 +0200
commitfaee2d6dda6498bde60ff13e1753f7d32019890c (patch)
tree95e0f21f553aafa0be9f329e7487aeb7a6532a91 /src/gallium/auxiliary/tgsi/tgsi_scan.c
parent10e5f126dd08849d9d209c8c0b80f2d2f6527571 (diff)
tgsi/scan: don't set interp flags for inputs only used by INTERP (v2)
(v1 pushed, then reverted) This fixes 9 randomly failing tests on radeonsi: GL45-CTS.shader_multisample_interpolation.render.interpolate_at_centroid.* v2: use input_interpolate[input] (correct) instead of input_interpolate[index] (incorrect) Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_scan.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c105
1 files changed, 57 insertions, 48 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index a3b0d9f4129..c7745ceba66 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -102,6 +102,7 @@ scan_instruction(struct tgsi_shader_info *info,
{
unsigned i;
bool is_mem_inst = false;
+ bool is_interp_instruction = false;
assert(fullinst->Instruction.Opcode < TGSI_OPCODE_LAST);
info->opcode_count[fullinst->Instruction.Opcode]++;
@@ -127,6 +128,8 @@ scan_instruction(struct tgsi_shader_info *info,
const struct tgsi_full_src_register *src0 = &fullinst->Src[0];
unsigned input;
+ is_interp_instruction = true;
+
if (src0->Register.Indirect && src0->Indirect.ArrayID)
input = info->input_array_first[src0->Indirect.ArrayID];
else
@@ -190,12 +193,16 @@ scan_instruction(struct tgsi_shader_info *info,
info->input_usage_mask[ind] |= usage_mask;
}
- if (info->processor == PIPE_SHADER_FRAGMENT &&
- !src->Register.Indirect) {
- unsigned name =
- info->input_semantic_name[src->Register.Index];
- unsigned index =
- info->input_semantic_index[src->Register.Index];
+ if (info->processor == PIPE_SHADER_FRAGMENT) {
+ unsigned name, index, input;
+
+ if (src->Register.Indirect && src->Indirect.ArrayID)
+ input = info->input_array_first[src->Indirect.ArrayID];
+ else
+ input = src->Register.Index;
+
+ name = info->input_semantic_name[input];
+ index = info->input_semantic_index[input];
if (name == TGSI_SEMANTIC_POSITION &&
(src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
@@ -213,6 +220,50 @@ scan_instruction(struct tgsi_shader_info *info,
info->colors_read |= mask << (index * 4);
}
+
+ /* Process only interpolated varyings. Don't include POSITION.
+ * Don't include integer varyings, because they are not
+ * interpolated. Don't process inputs interpolated by INTERP
+ * opcodes. Those are tracked separately.
+ */
+ if ((!is_interp_instruction || i != 0) &&
+ (name == TGSI_SEMANTIC_GENERIC ||
+ name == TGSI_SEMANTIC_TEXCOORD ||
+ name == TGSI_SEMANTIC_COLOR ||
+ name == TGSI_SEMANTIC_BCOLOR ||
+ name == TGSI_SEMANTIC_FOG ||
+ name == TGSI_SEMANTIC_CLIPDIST)) {
+ switch (info->input_interpolate[input]) {
+ case TGSI_INTERPOLATE_COLOR:
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ switch (info->input_interpolate_loc[input]) {
+ 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 (info->input_interpolate_loc[input]) {
+ 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. */
+ }
+ }
}
}
@@ -357,48 +408,6 @@ scan_declaration(struct tgsi_shader_info *info,
assert(reg < info->num_inputs);
}
- /* 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) {
- 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;
else if (procType == PIPE_SHADER_FRAGMENT) {