summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_execute_x86.c
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2006-04-04 10:18:07 +0000
committerMichal Krol <mjkrol@gmail.org>2006-04-04 10:18:07 +0000
commitb4e9750bf4996ca5bb622bbbe28be4f071811bc6 (patch)
treee0c595b22aeee885b4910267c8dc0995e3d362d5 /src/mesa/shader/slang/slang_execute_x86.c
parent607b61a994d8dca150d5611b18db9b55755f73b4 (diff)
More GLSL code:
- add support for varyings; GLSL fixes: - pow was wrongly computed in x86 back-end;
Diffstat (limited to 'src/mesa/shader/slang/slang_execute_x86.c')
-rw-r--r--src/mesa/shader/slang/slang_execute_x86.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/mesa/shader/slang/slang_execute_x86.c b/src/mesa/shader/slang/slang_execute_x86.c
index eabe368596..b578838e82 100644
--- a/src/mesa/shader/slang/slang_execute_x86.c
+++ b/src/mesa/shader/slang/slang_execute_x86.c
@@ -81,6 +81,12 @@ static GLvoid add_fixup (codegen_ctx *G, GLuint index, GLubyte *csr)
#define RND_NEG_FPU (FAST_X86_FPU | 0x400)
#endif
+#if 0
+
+/*
+ * XXX
+ * These should produce a valid code that computes powers. Unfortunately, it does not.
+ */
static void set_fpu_round_neg_inf (codegen_ctx *G)
{
if (G->fpucntl != RND_NEG_FPU)
@@ -107,6 +113,16 @@ static void emit_x87_ex2 (codegen_ctx *G)
x87_fscale (&G->f); /* 2^a */
}
+static void emit_pow (codegen_ctx *G)
+{
+ x87_fld (&G->f, x86_deref (G->r_esp));
+ x87_fld (&G->f, x86_make_disp (G->r_esp, 4));
+ x87_fyl2x (&G->f);
+ emit_x87_ex2 (G);
+}
+
+#endif
+
static GLfloat do_ceilf (GLfloat x)
{
return CEILF (x);
@@ -117,6 +133,11 @@ static GLfloat do_floorf (GLfloat x)
return FLOORF (x);
}
+static GLfloat do_powf (GLfloat y, GLfloat x)
+{
+ return (GLfloat) _mesa_pow ((GLdouble) x, (GLdouble) y);
+}
+
static GLvoid do_print_float (GLfloat x)
{
_mesa_printf ("slang print: %f\n", x);
@@ -285,10 +306,8 @@ static GLvoid codegen_assem (codegen_ctx *G, slang_assembly *a)
x87_fstp (&G->f, x86_deref (G->r_esp));
break;
case slang_asm_float_power:
- x87_fld (&G->f, x86_deref (G->r_esp));
- x87_fld (&G->f, x86_make_disp (G->r_esp, 4));
- x87_fyl2x (&G->f);
- emit_x87_ex2 (G);
+ /* TODO: use emit_pow() */
+ x86_call (&G->f, (GLubyte *) do_powf);
x86_lea (&G->f, G->r_esp, x86_make_disp (G->r_esp, 4));
x87_fstp (&G->f, x86_deref (G->r_esp));
break;