pan/bi: Extract load_sample_id to a helper

Will be reused in the next commit.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12478>
This commit is contained in:
Alyssa Rosenzweig 2021-08-18 22:07:50 +00:00 committed by Marge Bot
parent 5c2a4eb1c2
commit 9f19a883bc

View File

@ -441,6 +441,17 @@ bi_load_sysval(bi_builder *b, int sysval,
return tmp;
}
static void
bi_load_sample_id_to(bi_builder *b, bi_index dst)
{
/* r61[16:23] contains the sampleID, mask it out. Upper bits
* seem to read garbage (despite being architecturally defined
* as zero), so use a 5-bit mask instead of 8-bits */
bi_rshift_and_i32_to(b, dst, bi_register(61), bi_imm_u32(0x1f),
bi_imm_u8(16));
}
static void
bi_emit_load_blend_input(bi_builder *b, nir_intrinsic_instr *instr)
{
@ -1293,15 +1304,9 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr)
bi_u16_to_u32_to(b, dst, bi_half(bi_register(61), false));
break;
case nir_intrinsic_load_sample_id: {
/* r61[16:23] contains the sampleID, mask it out. Upper bits
* seem to read garbage (despite being architecturally defined
* as zero), so use a 5-bit mask instead of 8-bits */
bi_rshift_and_i32_to(b, dst, bi_register(61), bi_imm_u32(0x1f),
bi_imm_u8(16));
case nir_intrinsic_load_sample_id:
bi_load_sample_id_to(b, dst);
break;
}
case nir_intrinsic_load_front_face:
/* r58 == 0 means primitive is front facing */