aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_builder.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-10-19 09:35:49 -0500
committerJason Ekstrand <[email protected]>2018-10-26 11:45:29 -0500
commitff45649bc2fc3b048a8ae19cd67ec1e8e8eeb7a8 (patch)
treedd63a76053dc0c58fb7dfc5f15930ac837fab1f3 /src/compiler/nir/nir_builder.h
parent249e32ab17bdbe1f26449079b0eafd3391b52d0f (diff)
nir/builder: Add a nir_imm_true/false helpers
Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_builder.h')
-rw-r--r--src/compiler/nir/nir_builder.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 398fa68c251..5ea0a5a2637 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -206,6 +206,29 @@ nir_build_imm(nir_builder *build, unsigned num_components,
}
static inline nir_ssa_def *
+nir_imm_bool(nir_builder *build, bool x)
+{
+ nir_const_value v;
+
+ memset(&v, 0, sizeof(v));
+ v.u32[0] = x ? NIR_TRUE : NIR_FALSE;
+
+ return nir_build_imm(build, 1, 32, v);
+}
+
+static inline nir_ssa_def *
+nir_imm_true(nir_builder *build)
+{
+ return nir_imm_bool(build, true);
+}
+
+static inline nir_ssa_def *
+nir_imm_false(nir_builder *build)
+{
+ return nir_imm_bool(build, false);
+}
+
+static inline nir_ssa_def *
nir_imm_float(nir_builder *build, float x)
{
nir_const_value v;
@@ -489,7 +512,7 @@ nir_bany_inequal(nir_builder *b, nir_ssa_def *src0, nir_ssa_def *src1)
static inline nir_ssa_def *
nir_bany(nir_builder *b, nir_ssa_def *src)
{
- return nir_bany_inequal(b, src, nir_imm_int(b, 0));
+ return nir_bany_inequal(b, src, nir_imm_false(b));
}
static inline nir_ssa_def *