diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2016-01-13 13:32:44 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2016-01-14 21:32:59 -0800 |
commit | bb6612f06b8320911d9f86f7463f823e76969f15 (patch) | |
tree | 4ef91bc1282360e75188539235c07ec8fb3f2289 /src/glsl/nir | |
parent | cf96bce0ca8b2d6b5d4641efea1f2feedc024957 (diff) | |
download | external_mesa3d-bb6612f06b8320911d9f86f7463f823e76969f15.zip external_mesa3d-bb6612f06b8320911d9f86f7463f823e76969f15.tar.gz external_mesa3d-bb6612f06b8320911d9f86f7463f823e76969f15.tar.bz2 |
nir/builder: Add a nir_build_ivec4() convenience helper.
nir_build_ivec4 is more readable and succinct than using nir_build_imm
directly, even if you have C99.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r-- | src/glsl/nir/nir_builder.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h index cfaaf8e..88ba3a1 100644 --- a/src/glsl/nir/nir_builder.h +++ b/src/glsl/nir/nir_builder.h @@ -121,6 +121,20 @@ nir_imm_int(nir_builder *build, int x) } static inline nir_ssa_def * +nir_imm_ivec4(nir_builder *build, int x, int y, int z, int w) +{ + nir_const_value v; + + memset(&v, 0, sizeof(v)); + v.i[0] = x; + v.i[1] = y; + v.i[2] = z; + v.i[3] = w; + + return nir_build_imm(build, 4, v); +} + +static inline nir_ssa_def * nir_build_alu(nir_builder *build, nir_op op, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2, nir_ssa_def *src3) { |