Mesa (master): glsl: Add support for GLSL 1.30's modf built-in.
Kenneth Graunke
kwg at kemper.freedesktop.org
Thu Oct 21 07:15:20 UTC 2010
Module: Mesa
Branch: master
Commit: 574c53f551cb35173aee4acfa5c374613b953264
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=574c53f551cb35173aee4acfa5c374613b953264
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Tue Oct 19 11:56:47 2010 -0700
glsl: Add support for GLSL 1.30's modf built-in.
---
src/glsl/builtins/ir/modf | 41 +++++++++++++++++++++++++++++++++++
src/glsl/builtins/profiles/130.frag | 5 ++++
src/glsl/builtins/profiles/130.vert | 5 ++++
3 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/src/glsl/builtins/ir/modf b/src/glsl/builtins/ir/modf
new file mode 100644
index 0000000..2b935a9
--- /dev/null
+++ b/src/glsl/builtins/ir/modf
@@ -0,0 +1,41 @@
+((function modf
+ (signature float
+ (parameters
+ (declare (in) float x)
+ (declare (out) float i))
+ ((declare () float t)
+ (assign (constant bool (1)) (x) (var_ref t)
+ (expression float trunc (var_ref x)))
+ (assign (constant bool (1)) (x) (var_ref i) (var_ref t))
+ (return (expression float - (var_ref x) (var_ref t)))))
+
+ (signature vec2
+ (parameters
+ (declare (in) vec2 x)
+ (declare (out) vec2 i))
+ ((declare () vec2 t)
+ (assign (constant bool (1)) (xy) (var_ref t)
+ (expression vec2 trunc (var_ref x)))
+ (assign (constant bool (1)) (xy) (var_ref i) (var_ref t))
+ (return (expression vec2 - (var_ref x) (var_ref t)))))
+
+ (signature vec3
+ (parameters
+ (declare (in) vec3 x)
+ (declare (out) vec3 i))
+ ((declare () vec3 t)
+ (assign (constant bool (1)) (xyz) (var_ref t)
+ (expression vec3 trunc (var_ref x)))
+ (assign (constant bool (1)) (xyz) (var_ref i) (var_ref t))
+ (return (expression vec3 - (var_ref x) (var_ref t)))))
+
+ (signature vec4
+ (parameters
+ (declare (in) vec4 x)
+ (declare (out) vec4 i))
+ ((declare () vec4 t)
+ (assign (constant bool (1)) (xyzw) (var_ref t)
+ (expression vec4 trunc (var_ref x)))
+ (assign (constant bool (1)) (xyzw) (var_ref i) (var_ref t))
+ (return (expression vec4 - (var_ref x) (var_ref t)))))
+))
diff --git a/src/glsl/builtins/profiles/130.frag b/src/glsl/builtins/profiles/130.frag
index 9644070..0d860eb 100644
--- a/src/glsl/builtins/profiles/130.frag
+++ b/src/glsl/builtins/profiles/130.frag
@@ -177,6 +177,11 @@ vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
+float modf(float x, out float i);
+vec2 modf(vec2 x, out vec2 i);
+vec3 modf(vec3 x, out vec3 i);
+vec4 modf(vec4 x, out vec4 i);
+
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert
index eb76518..2fd44dc 100644
--- a/src/glsl/builtins/profiles/130.vert
+++ b/src/glsl/builtins/profiles/130.vert
@@ -177,6 +177,11 @@ vec2 mod(vec2 x, vec2 y);
vec3 mod(vec3 x, vec3 y);
vec4 mod(vec4 x, vec4 y);
+float modf(float x, out float i);
+vec2 modf(vec2 x, out vec2 i);
+vec3 modf(vec3 x, out vec3 i);
+vec4 modf(vec4 x, out vec4 i);
+
float min(float x, float y);
vec2 min(vec2 x, vec2 y);
vec3 min(vec3 x, vec3 y);
More information about the mesa-commit
mailing list