[Mesa-dev] [PATCH 05/15] glsl: Add new {fr, ld}exp built-ins IR and prototypes.

Matt Turner mattst88 at gmail.com
Thu Aug 22 16:08:25 PDT 2013


---
 src/glsl/builtins/ir/frexp.ir                   | 25 +++++++++++++++++++++++++
 src/glsl/builtins/ir/ldexp.ir                   | 25 +++++++++++++++++++++++++
 src/glsl/builtins/profiles/ARB_gpu_shader5.glsl | 10 ++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 src/glsl/builtins/ir/frexp.ir
 create mode 100644 src/glsl/builtins/ir/ldexp.ir

diff --git a/src/glsl/builtins/ir/frexp.ir b/src/glsl/builtins/ir/frexp.ir
new file mode 100644
index 0000000..a514994
--- /dev/null
+++ b/src/glsl/builtins/ir/frexp.ir
@@ -0,0 +1,25 @@
+((function frexp
+   (signature float
+     (parameters
+       (declare (in) float x)
+       (declare (out) int exp))
+     ((return (expression float frexp (var_ref x) (var_ref exp)))))
+
+   (signature vec2
+     (parameters
+       (declare (in) vec2 x)
+       (declare (out) ivec2 exp))
+     ((return (expression vec2 frexp (var_ref x) (var_ref exp)))))
+
+   (signature vec3
+     (parameters
+       (declare (in) vec3 x)
+       (declare (out) ivec3 exp))
+     ((return (expression vec3 frexp (var_ref x) (var_ref exp)))))
+
+   (signature vec4
+     (parameters
+       (declare (in) vec4 x)
+       (declare (out) ivec4 exp))
+     ((return (expression vec4 frexp (var_ref x) (var_ref exp)))))
+))
diff --git a/src/glsl/builtins/ir/ldexp.ir b/src/glsl/builtins/ir/ldexp.ir
new file mode 100644
index 0000000..dd25f5a
--- /dev/null
+++ b/src/glsl/builtins/ir/ldexp.ir
@@ -0,0 +1,25 @@
+((function ldexp
+   (signature float
+     (parameters
+       (declare (in) float x)
+       (declare (in) int exp))
+     ((return (expression float ldexp (var_ref x) (var_ref exp)))))
+
+   (signature vec2
+     (parameters
+       (declare (in) vec2 x)
+       (declare (in) ivec2 exp))
+     ((return (expression vec2 ldexp (var_ref x) (var_ref exp)))))
+
+   (signature vec3
+     (parameters
+       (declare (in) vec3 x)
+       (declare (in) ivec3 exp))
+     ((return (expression vec3 ldexp (var_ref x) (var_ref exp)))))
+
+   (signature vec4
+     (parameters
+       (declare (in) vec4 x)
+       (declare (in) ivec4 exp))
+     ((return (expression vec4 ldexp (var_ref x) (var_ref exp)))))
+))
diff --git a/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl b/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
index 3f76283..36fc0de 100644
--- a/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
+++ b/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
@@ -59,3 +59,13 @@ float fma(float a, float b, float c);
 vec2  fma(vec2  a, vec2  b, vec2  c);
 vec3  fma(vec3  a, vec3  b, vec3  c);
 vec4  fma(vec4  a, vec4  b, vec4  c);
+
+float frexp(float x, out int   exp);
+vec2  frexp(vec2  x, out ivec2 exp);
+vec3  frexp(vec3  x, out ivec3 exp);
+vec4  frexp(vec4  x, out ivec4 exp);
+
+float ldexp(float x, int   exp);
+vec2  ldexp(vec2  x, ivec2 exp);
+vec3  ldexp(vec3  x, ivec3 exp);
+vec4  ldexp(vec4  x, ivec4 exp);
-- 
1.8.3.2



More information about the mesa-dev mailing list