[Mesa-dev] [PATCH 1/6] nir/builder: Add the nir_imm_ivec3() helper
Boris Brezillon
boris.brezillon at collabora.com
Mon Jun 17 10:49:23 UTC 2019
We already have nir_imm_ivec2() and nir_imm_ivec4(), let's add
nir_imm_ivec3() instead of open-coding the logic.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
src/compiler/nir/nir_builder.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 8ca776f733ef..e158d44455bb 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -318,6 +318,19 @@ 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_ivec3(nir_builder *build, int x, int y, int z)
+{
+ nir_const_value v[3];
+
+ memset(v, 0, sizeof(v));
+ v[0].i32 = x;
+ v[1].i32 = y;
+ v[2].i32 = z;
+
+ return nir_build_imm(build, 3, 32, v);
+}
+
static inline nir_ssa_def *
nir_imm_ivec2(nir_builder *build, int x, int y)
{
--
2.20.1
More information about the mesa-dev
mailing list