Module: Mesa Branch: staging/21.2 Commit: 62316670798130997a3eed6944ce494f32db02a2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=62316670798130997a3eed6944ce494f32db02a2
Author: Alyssa Rosenzweig <[email protected]> Date: Wed Aug 18 22:07:50 2021 +0000 pan/bi: Extract load_sample_id to a helper Will be reused in the next commit. Signed-off-by: Alyssa Rosenzweig <[email protected]> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12478> (cherry picked from commit 9f19a883bc536374d38f295f26eadeb3e1a56d47) --- .pick_status.json | 2 +- src/panfrost/bifrost/bifrost_compile.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a7fdcc5a01c..78faabe6ab0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -769,7 +769,7 @@ "description": "pan/bi: Extract load_sample_id to a helper", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 74639ff7d6b..457916591c6 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -414,6 +414,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) { @@ -1266,15 +1277,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 */
