From a3952e927ed0df388be125cc8cbb28b14443aa74 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Thu, 9 Jul 2020 13:26:26 +1200 Subject: [PATCH] panfrost: Use f2fmp for framebuffer lowering conversions This allows the conversion to be removed when the output is needed as f32 anyway, for example for highp framebuffer fetch. v2: Also change operations such as i2i16 to i2imp (Alyssa). Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/util/pan_lower_framebuffer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c index 22ad2379a36..a8bc759225e 100644 --- a/src/panfrost/util/pan_lower_framebuffer.c +++ b/src/panfrost/util/pan_lower_framebuffer.c @@ -259,7 +259,7 @@ pan_unpack_unorm_8(nir_builder *b, nir_ssa_def *pack, unsigned num_components) { assert(num_components <= 4); nir_ssa_def *unpacked = nir_unpack_unorm_4x8(b, nir_channel(b, pack, 0)); - return nir_f2f16(b, unpacked); + return nir_f2fmp(b, unpacked); } /* UNORM 4 is also unpacked to f16, which prevents us from using the shared @@ -290,7 +290,7 @@ pan_unpack_unorm_small(nir_builder *b, nir_ssa_def *pack, nir_ssa_def *scales, nir_ssa_def *shifts) { nir_ssa_def *channels = nir_unpack_32_4x8(b, nir_channel(b, pack, 0)); - nir_ssa_def *raw = nir_ushr(b, nir_u2u16(b, channels), shifts); + nir_ssa_def *raw = nir_ushr(b, nir_u2ump(b, channels), shifts); return nir_fmul(b, nir_u2f16(b, raw), scales); } @@ -377,12 +377,12 @@ pan_unpack_unorm_1010102(nir_builder *b, nir_ssa_def *packed) { nir_ssa_def *p = nir_channel(b, packed, 0); nir_ssa_def *bytes = nir_unpack_32_4x8(b, p); - nir_ssa_def *ubytes = nir_u2u16(b, bytes); + nir_ssa_def *ubytes = nir_u2ump(b, bytes); nir_ssa_def *shifts = nir_ushr(b, pan_replicate_4(b, nir_channel(b, ubytes, 3)), nir_imm_ivec4(b, 0, 2, 4, 6)); nir_ssa_def *precision = nir_iand(b, shifts, - nir_i2i16(b, nir_imm_ivec4(b, 0x3, 0x3, 0x3, 0x3))); + nir_i2imp(b, nir_imm_ivec4(b, 0x3, 0x3, 0x3, 0x3))); nir_ssa_def *top_rgb = nir_ishl(b, nir_channels(b, ubytes, 0x7), nir_imm_int(b, 2)); top_rgb = nir_ior(b, nir_channels(b, precision, 0x7), top_rgb); @@ -395,7 +395,7 @@ pan_unpack_unorm_1010102(nir_builder *b, nir_ssa_def *packed) }; nir_ssa_def *scale = nir_imm_vec4(b, 1.0 / 1023.0, 1.0 / 1023.0, 1.0 / 1023.0, 1.0 / 3.0); - return nir_f2f16(b, nir_fmul(b, nir_u2f32(b, nir_vec(b, chans, 4)), scale)); + return nir_f2fmp(b, nir_fmul(b, nir_u2f32(b, nir_vec(b, chans, 4)), scale)); } /* On the other hand, the pure int RGB10_A2 is identical to the spec */ @@ -424,7 +424,7 @@ pan_unpack_uint_1010102(nir_builder *b, nir_ssa_def *packed) nir_ssa_def *mask = nir_iand(b, shift, nir_imm_ivec4(b, 0x3ff, 0x3ff, 0x3ff, 0x3)); - return nir_u2u16(b, mask); + return nir_u2ump(b, mask); } /* NIR means we can *finally* catch a break */ @@ -440,7 +440,7 @@ static nir_ssa_def * pan_unpack_r11g11b10(nir_builder *b, nir_ssa_def *v) { nir_ssa_def *f32 = nir_format_unpack_11f11f10f(b, nir_channel(b, v, 0)); - nir_ssa_def *f16 = nir_f2f16(b, f32); + nir_ssa_def *f16 = nir_f2fmp(b, f32); /* Extend to vec4 with alpha */ nir_ssa_def *components[4] = { @@ -461,7 +461,7 @@ pan_linear_to_srgb(nir_builder *b, nir_ssa_def *linear) nir_ssa_def *rgb = nir_channels(b, linear, 0x7); /* TODO: fp16 native conversion */ - nir_ssa_def *srgb = nir_f2f16(b, + nir_ssa_def *srgb = nir_f2fmp(b, nir_format_linear_to_srgb(b, nir_f2f32(b, rgb))); nir_ssa_def *comp[4] = { @@ -480,7 +480,7 @@ pan_srgb_to_linear(nir_builder *b, nir_ssa_def *srgb) nir_ssa_def *rgb = nir_channels(b, srgb, 0x7); /* TODO: fp16 native conversion */ - nir_ssa_def *linear = nir_f2f16(b, + nir_ssa_def *linear = nir_f2fmp(b, nir_format_srgb_to_linear(b, nir_f2f32(b, rgb))); nir_ssa_def *comp[4] = { -- 2.30.2