diff --git a/src/broadcom/compiler/vir_live_variables.c b/src/broadcom/compiler/vir_live_variables.c index 575b0481dc8..d1f44aa9cf7 100644 --- a/src/broadcom/compiler/vir_live_variables.c +++ b/src/broadcom/compiler/vir_live_variables.c @@ -179,17 +179,22 @@ vir_setup_def_use(struct v3d_compile *c) flags_inst = NULL; } - /* Payload registers: r0/1/2 contain W, centroid W, - * and Z at program start. Register allocation will - * force their nodes to R0/1/2. + /* Payload registers: for fragment shaders, W, + * centroid W, and Z will be initialized in r0/1/2 + * until v42, or r1/r2/r3 since v71. + * + * For compute shaders, payload is in r0/r2 up to v42, + * r2/r3 since v71. + * + * Register allocation will force their nodes to those + * registers. */ if (inst->src[0].file == QFILE_REG) { - switch (inst->src[0].index) { - case 0: - case 1: - case 2: + uint32_t min_payload_r = c->devinfo->ver >= 71 ? 1 : 0; + uint32_t max_payload_r = c->devinfo->ver >= 71 ? 3 : 2; + if (inst->src[0].index >= min_payload_r || + inst->src[0].index <= max_payload_r) { c->temp_start[inst->dst.index] = 0; - break; } }