From 194bc5afbde4c6b144289e7542612ef52e0e5bd4 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 19 Dec 2006 08:58:56 -0700 Subject: rewrite +=, -= etc for floats --- src/mesa/shader/slang/library/slang_core.gc | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'src/mesa/shader/slang/library/slang_core.gc') diff --git a/src/mesa/shader/slang/library/slang_core.gc b/src/mesa/shader/slang/library/slang_core.gc index 81be17f9f0..3c4862baa1 100755 --- a/src/mesa/shader/slang/library/slang_core.gc +++ b/src/mesa/shader/slang/library/slang_core.gc @@ -326,30 +326,36 @@ mat4 __constructor (const vec4 r0, const vec4 r1, const vec4 r2, const vec4 r3) } +//// operator += - -void __operator += (inout float a, const float b) { - __asm float_add a, a, b; +void __operator += (inout float a, const float b) +{ + __asm vec4_add a.x, a, b; } -float __operator - (const float a) { - float b; - __asm float_negate b, a; - return b; +void __operator -= (inout float a, const float b) +{ + __asm vec4_subtract a.x, a, b; } -void __operator -= (inout float a, const float b) { - float c; - __asm float_negate c, b; - __asm float_add a, a, c; +void __operator *= (inout float a, const float b) +{ + __asm vec4_multiply a.x, a, b; } -void __operator *= (inout float a, const float b) { - __asm float_multiply a, a, b; +void __operator /= (inout float a, const float b) +{ + float w; // = 1 / b + __asm float_rcp w.x, b; + __asm vec4_multiply a.x, a, w; } -void __operator /= (inout float a, const float b) { - __asm float_divide a, a, b; + + +float __operator - (const float a) { + float b; + __asm float_negate b, a; + return b; } float __operator + (const float a, const float b) { -- cgit v1.2.3