From: Alyssa Rosenzweig Date: Wed, 3 Jul 2019 20:00:14 +0000 (-0700) Subject: nir: Add nir_imm_vec4_16 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a4b48fb057a4812fbc39cc054308818d2a19b32;p=mesa.git nir: Add nir_imm_vec4_16 We already have nir_imm_float16 and nir_imm_vec4; let's add the ability to easily make immediate fp16 vectors as well, now that fp16 support is maturing in NIR/GLSL. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Matt Turner --- diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index cef84a8914e..dbeec08b97e 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -318,6 +318,20 @@ nir_imm_vec4(nir_builder *build, float x, float y, float z, float w) return nir_build_imm(build, 4, 32, v); } +static inline nir_ssa_def * +nir_imm_vec4_16(nir_builder *build, float x, float y, float z, float w) +{ + nir_const_value v[4]; + + memset(v, 0, sizeof(v)); + v[0].u16 = _mesa_float_to_half(x); + v[1].u16 = _mesa_float_to_half(y); + v[2].u16 = _mesa_float_to_half(z); + v[3].u16 = _mesa_float_to_half(w); + + return nir_build_imm(build, 4, 16, v); +} + static inline nir_ssa_def * nir_imm_ivec2(nir_builder *build, int x, int y) {