summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/ir
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-10-19 11:56:47 -0700
committerKenneth Graunke <[email protected]>2010-10-21 00:14:37 -0700
commit574c53f551cb35173aee4acfa5c374613b953264 (patch)
treedf7e697717ba29c3eb98fd442371a7d1f9f4bbc1 /src/glsl/builtins/ir
parent94a36faed7ae0c795665b6cfb4dd4324ffaa5fa8 (diff)
glsl: Add support for GLSL 1.30's modf built-in.
Diffstat (limited to 'src/glsl/builtins/ir')
-rw-r--r--src/glsl/builtins/ir/modf41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/glsl/builtins/ir/modf b/src/glsl/builtins/ir/modf
new file mode 100644
index 00000000000..2b935a91a7c
--- /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)))))
+))