summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-02-07 19:44:42 +0000
committerMichel Dänzer <michel@tungstengraphics.com>2008-02-07 19:45:24 +0000
commit909c703bfbf7404414befaa0a94b76d78ba3cb4c (patch)
tree0d01e5427636de8a7f864304898b8696470d2dcf
parent28ecb986d958d52c9a996453e53418d1f98d7f75 (diff)
tgsi: Fall back to interpreter instead of assert(0) on unimplemented SSE code.
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c22
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_sse2.c3
-rw-r--r--src/mesa/x86/rtasm/x86sse.c1
3 files changed, 18 insertions, 8 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c
index e6590eafcc..5ca93aa615 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader.c
@@ -121,11 +121,16 @@ run_vertex_program(struct draw_context *draw,
= (struct draw_vertex_shader *)draw->vertex_shader;
codegen_function func
= (codegen_function) x86_get_func( &shader->sse2_program );
- func(
- machine->Inputs,
- machine->Outputs,
- machine->Consts,
- machine->Temps );
+
+ if (func)
+ func(
+ machine->Inputs,
+ machine->Outputs,
+ machine->Consts,
+ machine->Temps );
+ else
+ /* interpreter */
+ tgsi_exec_machine_run( machine );
}
else
#endif
@@ -269,7 +274,12 @@ draw_create_vertex_shader(struct draw_context *draw,
struct pipe_shader_state *sh = (struct pipe_shader_state *) shader;
x86_init_func( &vs->sse2_program );
- tgsi_emit_sse2( (struct tgsi_token *) sh->tokens, &vs->sse2_program );
+ if (!tgsi_emit_sse2( (struct tgsi_token *) sh->tokens,
+ &vs->sse2_program )) {
+ x86_release_func( (struct x86_function *) &vs->sse2_program );
+ fprintf(stdout /*err*/,
+ "tgsi_emit_sse2() failed, falling back to interpreter\n");
+ }
}
#endif
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
index f2180082f1..40bacf8552 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
@@ -2254,8 +2254,7 @@ tgsi_emit_sse2(
case TGSI_TOKEN_TYPE_IMMEDIATE:
/* XXX implement this */
- assert(0);
- break;
+ return 0;
default:
assert( 0 );
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c
index 56c211eee0..f8da6e405f 100644
--- a/src/mesa/x86/rtasm/x86sse.c
+++ b/src/mesa/x86/rtasm/x86sse.c
@@ -1137,6 +1137,7 @@ void x86_init_func_size( struct x86_function *p, unsigned code_size )
void x86_release_func( struct x86_function *p )
{
_mesa_exec_free(p->store);
+ p->store = NULL;
}