summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authormichal <michal@michal-laptop.(none)>2007-09-24 12:32:26 +0100
committermichal <michal@michal-laptop.(none)>2007-09-24 12:32:26 +0100
commitc0dd02219d47f45ce469abbef8044431f6d85d0a (patch)
tree8b5131b9b12a14bf1a47f3669d2678dbfbcabada /src/mesa/state_tracker
parentc0afc92f00e5153a168fb6df518b7a2e6b3b9406 (diff)
Enable SSE2 for FS.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c9
-rw-r--r--src/mesa/state_tracker/st_cb_program.c21
-rw-r--r--src/mesa/state_tracker/st_program.h6
3 files changed, 29 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c
index f8a1dc83cff..ef5b941c176 100644
--- a/src/mesa/state_tracker/st_atom_fs.c
+++ b/src/mesa/state_tracker/st_atom_fs.c
@@ -36,6 +36,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/tgsi/mesa/mesa_to_tgsi.h"
+#include "pipe/tgsi/exec/tgsi_core.h"
#include "pipe/tgsi/exec/tgsi_dump.h"
#include "st_context.h"
@@ -163,6 +164,14 @@ st_translate_fragment_shader(struct st_context *st,
if (TGSI_DEBUG)
tgsi_dump( stfp->tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ if (stfp->sse2_program.csr == stfp->sse2_program.store)
+ tgsi_emit_sse2_fs( stfp->tokens, &stfp->sse2_program );
+
+ if (!cso->state.executable)
+ ((struct cso_fragment_shader*)cso)->state.executable = (void *) x86_get_func( &stfp->sse2_program );
+#endif
+
stfp->dirty = 0;
return cso;
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index b9c19bdd3e4..9f46f9e93f4 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -99,13 +99,16 @@ static struct gl_program *st_new_program( GLcontext *ctx,
}
case GL_FRAGMENT_PROGRAM_ARB:
- case GL_FRAGMENT_PROGRAM_NV:
- {
+ case GL_FRAGMENT_PROGRAM_NV: {
struct st_fragment_program *prog = CALLOC_STRUCT(st_fragment_program);
prog->id = program_id++;
prog->dirty = 1;
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ x86_init_func( &prog->sse2_program );
+#endif
+
return _mesa_init_fragment_program( ctx,
&prog->Base,
target,
@@ -121,8 +124,7 @@ static void st_delete_program( GLcontext *ctx,
struct gl_program *prog )
{
switch( prog->Target ) {
- case GL_VERTEX_PROGRAM_ARB:
- {
+ case GL_VERTEX_PROGRAM_ARB: {
#if defined(USE_X86_ASM) || defined(SLANG_X86)
struct st_vertex_program *p = (struct st_vertex_program *) prog;
@@ -130,7 +132,14 @@ static void st_delete_program( GLcontext *ctx,
#endif
break;
}
+ case GL_FRAGMENT_PROGRAM_ARB: {
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ struct st_fragment_program *p = (struct st_fragment_program *) prog;
+ x86_release_func( &p->sse2_program );
+#endif
+ break;
+ }
}
_mesa_delete_program( ctx, prog );
}
@@ -156,7 +165,7 @@ static void st_program_string_notify( GLcontext *ctx,
if (prog == &ctx->FragmentProgram._Current->Base)
st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
- p->id = program_id++;
+ p->id = program_id++;
p->param_state = p->Base.Base.Parameters->StateFlags;
}
else if (target == GL_VERTEX_PROGRAM_ARB) {
@@ -165,7 +174,7 @@ static void st_program_string_notify( GLcontext *ctx,
if (prog == &ctx->VertexProgram._Current->Base)
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
- p->id = program_id++;
+ p->id = program_id++;
p->param_state = p->Base.Base.Parameters->StateFlags;
/* Also tell tnl about it:
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index c21e27628ea..419afa4e786 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -49,10 +49,14 @@ struct st_fragment_program
GLboolean error; /* If program is malformed for any reason. */
GLuint id; /**< String id, for tracking ProgramStringNotify changes. */
-
+ /** The program in TGSI format */
struct tgsi_token tokens[ST_FP_MAX_TOKENS];
GLboolean dirty;
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ struct x86_function sse2_program;
+#endif
+
/** Pointer to the corresponding cached shader */
const struct cso_fragment_shader *fs;