aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_scan.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-01-01 19:42:44 +0100
committerMarek Olšák <[email protected]>2016-01-07 18:26:05 +0100
commitff7e77724e0cf1409f84118d0d4ceee65535ccdb (patch)
tree6eaec8322d94fa23a7fdfe5868a43bc244bd4ade /src/gallium/auxiliary/tgsi/tgsi_scan.c
parent18ec76730a75b6fbc2783d6a84a844cb038456ff (diff)
tgsi/scan: set which color components are read by a fragment shader
This will be used by radeonsi. 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.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index e3a6fb0437c..6ea32eedd74 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -187,14 +187,28 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
}
if (procType == TGSI_PROCESSOR_FRAGMENT &&
- !src->Register.Indirect &&
- info->input_semantic_name[src->Register.Index] ==
- TGSI_SEMANTIC_POSITION &&
- (src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
- src->Register.SwizzleY == TGSI_SWIZZLE_Z ||
- src->Register.SwizzleZ == TGSI_SWIZZLE_Z ||
- src->Register.SwizzleW == TGSI_SWIZZLE_Z)) {
- info->reads_z = TRUE;
+ !src->Register.Indirect) {
+ unsigned name =
+ info->input_semantic_name[src->Register.Index];
+ unsigned index =
+ info->input_semantic_index[src->Register.Index];
+
+ if (name == TGSI_SEMANTIC_POSITION &&
+ (src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
+ src->Register.SwizzleY == TGSI_SWIZZLE_Z ||
+ src->Register.SwizzleZ == TGSI_SWIZZLE_Z ||
+ src->Register.SwizzleW == TGSI_SWIZZLE_Z))
+ info->reads_z = TRUE;
+
+ if (name == TGSI_SEMANTIC_COLOR) {
+ unsigned mask =
+ (1 << src->Register.SwizzleX) |
+ (1 << src->Register.SwizzleY) |
+ (1 << src->Register.SwizzleZ) |
+ (1 << src->Register.SwizzleW);
+
+ info->colors_read |= mask << (index * 4);
+ }
}
}