summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-08-11 17:35:21 -0600
committerBrian Paul <[email protected]>2008-08-12 08:53:49 -0600
commit42b262d01a2b0f676ead098c09e33e387b8a5e3a (patch)
tree9a5474e63c76636a624cf03bda6eb564c6e5e057
parent3eea56dc93eeeb7f0155e2113ffea6a3fae48dd9 (diff)
mesa: glsl: better mod() functions
-rw-r--r--src/mesa/shader/slang/library/slang_common_builtin.gc36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index 18b38af7586..e908e6c9401 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -872,35 +872,29 @@ vec4 mod(const vec4 a, const float b)
vec2 mod(const vec2 a, const vec2 b)
{
- float oneOverBx, oneOverBy;
- __asm float_rcp oneOverBx, b.x;
- __asm float_rcp oneOverBy, b.y;
- __retVal.x = a.x - b.x * floor(a.x * oneOverBx);
- __retVal.y = a.y - b.y * floor(a.y * oneOverBy);
+ vec2 oneOverB;
+ __asm float_rcp oneOverB.x, b.x;
+ __asm float_rcp oneOverB.y, b.y;
+ __retVal = a - b * floor(a * oneOverB);
}
vec3 mod(const vec3 a, const vec3 b)
{
- float oneOverBx, oneOverBy, oneOverBz;
- __asm float_rcp oneOverBx, b.x;
- __asm float_rcp oneOverBy, b.y;
- __asm float_rcp oneOverBz, b.z;
- __retVal.x = a.x - b.x * floor(a.x * oneOverBx);
- __retVal.y = a.y - b.y * floor(a.y * oneOverBy);
- __retVal.z = a.z - b.z * floor(a.z * oneOverBz);
+ vec3 oneOverB;
+ __asm float_rcp oneOverB.x, b.x;
+ __asm float_rcp oneOverB.y, b.y;
+ __asm float_rcp oneOverB.z, b.z;
+ __retVal = a - b * floor(a * oneOverB);
}
vec4 mod(const vec4 a, const vec4 b)
{
- float oneOverBx, oneOverBy, oneOverBz, oneOverBw;
- __asm float_rcp oneOverBx, b.x;
- __asm float_rcp oneOverBy, b.y;
- __asm float_rcp oneOverBz, b.z;
- __asm float_rcp oneOverBw, b.w;
- __retVal.x = a.x - b.x * floor(a.x * oneOverBx);
- __retVal.y = a.y - b.y * floor(a.y * oneOverBy);
- __retVal.z = a.z - b.z * floor(a.z * oneOverBz);
- __retVal.w = a.w - b.w * floor(a.w * oneOverBw);
+ vec4 oneOverB;
+ __asm float_rcp oneOverB.x, b.x;
+ __asm float_rcp oneOverB.y, b.y;
+ __asm float_rcp oneOverB.z, b.z;
+ __asm float_rcp oneOverB.w, b.w;
+ __retVal = a - b * floor(a * oneOverB);
}