[1/6] nir/builder: Add the nir_imm_ivec3() helper

Submitted by Boris Brezillon on June 17, 2019, 10:49 a.m.

Details

Message ID 20190617104928.24007-2-boris.brezillon@collabora.com
State New
Headers show
Series "panfrost: Add support for TXS instructions" ( rev: 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon June 17, 2019, 10:49 a.m.
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@collabora.com>
---
 src/compiler/nir/nir_builder.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch hide | download patch | download mbox

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)
 {

Comments

Reviewed-by, seems like a good idea to have the full set :)
On Mon, 17 Jun 2019 06:51:15 -0700
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> wrote:

> Reviewed-by, seems like a good idea to have the full set :)

I don't intend to post a v2 of that patch since the rework proposed by
Jason means we no longer call nir_imm_vec4(). If you think it's still
worth applying it, feel free to pick this version.