projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9c9edd1
)
nir/spirv/glsl450: Add helpers for calculating exp() and log().
author
Kenneth Graunke
<kenneth@whitecape.org>
Tue, 29 Dec 2015 23:15:05 +0000
(15:15 -0800)
committer
Kenneth Graunke
<kenneth@whitecape.org>
Tue, 29 Dec 2015 23:27:03 +0000
(15:27 -0800)
src/glsl/nir/spirv/vtn_glsl450.c
patch
|
blob
|
history
diff --git
a/src/glsl/nir/spirv/vtn_glsl450.c
b/src/glsl/nir/spirv/vtn_glsl450.c
index 575580e5997a0d11faa6d2c2e295d3bcd638d637..d4cb1bb9f3c218272f969ada6dabe1777f129f08 100644
(file)
--- a/
src/glsl/nir/spirv/vtn_glsl450.c
+++ b/
src/glsl/nir/spirv/vtn_glsl450.c
@@
-41,6
+41,25
@@
build_length(nir_builder *b, nir_ssa_def *vec)
}
}
+/**
+ * Return e^x.
+ */
+static nir_ssa_def *
+build_exp(nir_builder *b, nir_ssa_def *x)
+{
+ return nir_fexp2(b, nir_fmul(b, x, nir_imm_float(b, M_LOG2E)));
+}
+
+/**
+ * Return ln(x) - the natural logarithm of x.
+ */
+static nir_ssa_def *
+build_log(nir_builder *b, nir_ssa_def *x)
+{
+ return nir_fmul(b, nir_flog2(b, x), nir_imm_float(b, 1.0 / M_LOG2E));
+}
+
+
static void
handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
const uint32_t *w, unsigned count)