nir: Add nir_imm_ivec2 helper
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Thu, 11 Oct 2018 00:14:34 +0000 (17:14 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 16 Oct 2018 00:29:46 +0000 (17:29 -0700)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_builder.h

index 8c883f276191cd79a10e00ddc025e207fc830c2c..398fa68c251f19e4b94b96abca82dcd4efc103fe 100644 (file)
@@ -254,6 +254,18 @@ 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_ivec2(nir_builder *build, int x, int y)
+{
+   nir_const_value v;
+
+   memset(&v, 0, sizeof(v));
+   v.i32[0] = x;
+   v.i32[1] = y;
+
+   return nir_build_imm(build, 2, 32, v);
+}
+
 static inline nir_ssa_def *
 nir_imm_int(nir_builder *build, int x)
 {