diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-03 13:00:14 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-09 18:43:07 +0000 |
commit | 4a4b48fb057a4812fbc39cc054308818d2a19b32 (patch) | |
tree | 8f7943c9ac2d6ca954e76c2d45fc4ee2faad0eb1 | |
parent | a110a8090d656152827a1828098624a17f6d7fb7 (diff) |
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 <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
-rw-r--r-- | src/compiler/nir/nir_builder.h | 14 |
1 files changed, 14 insertions, 0 deletions
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 @@ -319,6 +319,20 @@ nir_imm_vec4(nir_builder *build, float x, float y, float z, float w) } 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) { nir_const_value v[2]; |