summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/library
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-08-25 09:20:00 -0600
committerBrian Paul <[email protected]>2008-08-25 09:20:00 -0600
commit2d5087bf74f2d0e58037847058a123fe9d142038 (patch)
tree5e7069b458ac130267908f7e24ef66d2a25aa1d9 /src/mesa/shader/slang/library
parentd6df735f1c22c64c17103dd92fffd7b658a46cda (diff)
mesa: glsl: grab latest fixes from gallium-0.1 branch
Includes: 1. Fixes failed asserting about bad swizzles in src reg emit. 2. Tracks uniform var usage. 3. Emit exp() in terms of EXP2 instruction.
Diffstat (limited to 'src/mesa/shader/slang/library')
-rw-r--r--src/mesa/shader/slang/library/slang_common_builtin.gc29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index e908e6c9401..561e94f6bab 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -473,32 +473,33 @@ vec4 pow(const vec4 a, const vec4 b)
float exp(const float a)
{
- const float e = 2.71828;
- __asm float_power __retVal, e, a;
+ // NOTE: log2(e) = 1.44269502
+ float t = a * 1.44269502;
+ __asm float_exp2 __retVal, t;
}
vec2 exp(const vec2 a)
{
- const float e = 2.71828;
- __asm float_power __retVal.x, e, a.x;
- __asm float_power __retVal.y, e, a.y;
+ vec2 t = a * 1.44269502;
+ __asm float_exp2 __retVal.x, t.x;
+ __asm float_exp2 __retVal.y, t.y;
}
vec3 exp(const vec3 a)
{
- const float e = 2.71828;
- __asm float_power __retVal.x, e, a.x;
- __asm float_power __retVal.y, e, a.y;
- __asm float_power __retVal.z, e, a.z;
+ vec3 t = a * 1.44269502;
+ __asm float_exp2 __retVal.x, t.x;
+ __asm float_exp2 __retVal.y, t.y;
+ __asm float_exp2 __retVal.z, t.z;
}
vec4 exp(const vec4 a)
{
- const float e = 2.71828;
- __asm float_power __retVal.x, e, a.x;
- __asm float_power __retVal.y, e, a.y;
- __asm float_power __retVal.z, e, a.z;
- __asm float_power __retVal.w, e, a.w;
+ vec4 t = a * 1.44269502;
+ __asm float_exp2 __retVal.x, t.x;
+ __asm float_exp2 __retVal.y, t.y;
+ __asm float_exp2 __retVal.z, t.z;
+ __asm float_exp2 __retVal.w, t.w;
}