[Mesa-dev] [PATCH 03/20] nir: Support lowering vote intrinsics
Matt Turner
mattst88 at gmail.com
Thu Jul 6 23:48:13 UTC 2017
... trivially (as allowed by the spec!) by reusing the existing
nir_opt_intrinsics code.
---
src/compiler/nir/nir.h | 4 ++++
src/compiler/nir/nir_opt_intrinsics.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 44a1d0887e..401c41f155 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1821,6 +1821,10 @@ typedef struct nir_shader_compiler_options {
bool lower_extract_byte;
bool lower_extract_word;
+ bool lower_vote_any;
+ bool lower_vote_all;
+ bool lower_vote_eq;
+
/**
* Does the driver support real 32-bit integers? (Otherwise, integers
* are simulated by floats.)
diff --git a/src/compiler/nir/nir_opt_intrinsics.c b/src/compiler/nir/nir_opt_intrinsics.c
index b63449b4fe..0cd75d8b28 100644
--- a/src/compiler/nir/nir_opt_intrinsics.c
+++ b/src/compiler/nir/nir_opt_intrinsics.c
@@ -47,7 +47,7 @@ opt_intrinsics_impl(nir_function_impl *impl)
switch (intrin->intrinsic) {
case nir_intrinsic_vote_any: {
nir_const_value *val = nir_src_as_const_value(intrin->src[0]);
- if (!val)
+ if (!val || b.shader->options->lower_vote_any)
continue;
replacement = nir_imm_int(&b, val->i32[0]);
@@ -55,7 +55,7 @@ opt_intrinsics_impl(nir_function_impl *impl)
}
case nir_intrinsic_vote_all: {
nir_const_value *val = nir_src_as_const_value(intrin->src[0]);
- if (!val)
+ if (!val || b.shader->options->lower_vote_all)
continue;
replacement = nir_imm_int(&b, val->i32[0]);
@@ -63,7 +63,7 @@ opt_intrinsics_impl(nir_function_impl *impl)
}
case nir_intrinsic_vote_eq: {
nir_const_value *val = nir_src_as_const_value(intrin->src[0]);
- if (!val)
+ if (!val || b.shader->options->lower_vote_eq)
continue;
replacement = nir_imm_int(&b, NIR_TRUE);
--
2.13.0
More information about the mesa-dev
mailing list