projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e22ad6
)
nir/builder: Add a nir_imm_floatN_t helper
author
Neil Roberts
<nroberts@igalia.com>
Wed, 21 Mar 2018 19:34:37 +0000
(20:34 +0100)
committer
Neil Roberts
<nroberts@igalia.com>
Tue, 17 Apr 2018 18:57:36 +0000
(20:57 +0200)
This lets you easily build float immediates just given the bit size.
If we have this single place here to handle this then it will be
easier to add support for 16-bit floats later.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_builder.h
patch
|
blob
|
history
diff --git
a/src/compiler/nir/nir_builder.h
b/src/compiler/nir/nir_builder.h
index d699b5ee1bf1c91d60a15ec559c9da0e24647f3c..02a9dbfb04063f62e9a4b41660a65c8f65094cfa 100644
(file)
--- a/
src/compiler/nir/nir_builder.h
+++ b/
src/compiler/nir/nir_builder.h
@@
-227,6
+227,19
@@
nir_imm_double(nir_builder *build, double x)
return nir_build_imm(build, 1, 64, v);
}
+static inline nir_ssa_def *
+nir_imm_floatN_t(nir_builder *build, double x, unsigned bit_size)
+{
+ switch (bit_size) {
+ case 32:
+ return nir_imm_float(build, x);
+ case 64:
+ return nir_imm_double(build, x);
+ }
+
+ unreachable("unknown float immediate bit size");
+}
+
static inline nir_ssa_def *
nir_imm_vec4(nir_builder *build, float x, float y, float z, float w)
{