summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/nir/nir_print.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 3beb70a75d3..9fa024ea783 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -186,17 +186,25 @@ print_alu_src(nir_alu_instr *instr, unsigned src, print_state *state)
print_src(&instr->src[src].src, state);
bool print_swizzle = false;
+ unsigned used_channels = 0;
+
for (unsigned i = 0; i < 4; i++) {
if (!nir_alu_instr_channel_used(instr, src, i))
continue;
+ used_channels++;
+
if (instr->src[src].swizzle[i] != i) {
print_swizzle = true;
break;
}
}
- if (print_swizzle) {
+ unsigned live_channels = instr->src[src].src.is_ssa
+ ? instr->src[src].src.ssa->num_components
+ : instr->src[src].src.reg.reg->num_components;
+
+ if (print_swizzle || used_channels != live_channels) {
fprintf(fp, ".");
for (unsigned i = 0; i < 4; i++) {
if (!nir_alu_instr_channel_used(instr, src, i))