nir_to_tgsi: Add support for nir_intrinsic_load_barycentric_at_sample.

It doesn't have to be a constant sample, so we need to store it at load
time and use the load's dest at interpolate_at time.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
This commit is contained in:
Emma Anholt 2021-09-10 16:38:43 -07:00 committed by Marge Bot
parent 15aabcd806
commit 91a5a18dbf
1 changed files with 5 additions and 6 deletions

View File

@ -1692,9 +1692,9 @@ ntt_emit_load_input(struct ntt_compile *c, nir_intrinsic_instr *instr)
break;
case nir_intrinsic_load_barycentric_at_sample:
/* We stored the sample in the fake "bary" dest. */
ureg_INTERP_SAMPLE(c->ureg, ntt_get_dest(c, &instr->dest), input,
ureg_imm1u(c->ureg,
ntt_src_as_uint(c, bary_instr->src[0])));
ntt_get_src(c, instr->src[0]));
break;
case nir_intrinsic_load_barycentric_at_offset:
@ -1997,15 +1997,14 @@ ntt_emit_intrinsic(struct ntt_compile *c, nir_intrinsic_instr *instr)
break;
/* In TGSI we don't actually generate the barycentric coords, and emit
* interp intrinsics later. However, we do need to store the _at_offset
* argument so that we can use it at that point.
* interp intrinsics later. However, we do need to store the
* load_barycentric_at_* argument so that we can use it at that point.
*/
case nir_intrinsic_load_barycentric_pixel:
case nir_intrinsic_load_barycentric_centroid:
case nir_intrinsic_load_barycentric_sample:
case nir_intrinsic_load_barycentric_at_sample:
break;
case nir_intrinsic_load_barycentric_at_sample:
case nir_intrinsic_load_barycentric_at_offset:
ntt_store(c, &instr->dest, ntt_get_src(c, instr->src[0]));
break;