summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_state_fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_fs.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c69
1 files changed, 23 insertions, 46 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 1e3cadd..b0238f8 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -27,16 +27,15 @@
#include "sp_context.h"
#include "sp_state.h"
+#include "sp_fs.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "draw/draw_context.h"
#include "pipe/p_shader_tokens.h"
-#include "llvm/gallivm.h"
+#include "draw/draw_context.h"
#include "tgsi/util/tgsi_dump.h"
-#include "tgsi/exec/tgsi_sse2.h"
void *
@@ -44,40 +43,22 @@ softpipe_create_fs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_fragment_shader_state *state;
+ struct sp_fragment_shader *state;
- /* Decide whether we'll be codegenerating this shader and if so do
- * that now.
- */
-
- state = CALLOC_STRUCT(sp_fragment_shader_state);
- if (!state)
- return NULL;
+ if (softpipe->dump_fs)
+ tgsi_dump(templ->tokens, 0);
- state->shader = *templ;
-
- if (softpipe->dump_fs) {
- tgsi_dump(state->shader.tokens, 0);
- }
+ state = softpipe_create_fs_llvm( softpipe, templ );
+ if (state)
+ return state;
+
+ state = softpipe_create_fs_sse( softpipe, templ );
+ if (state)
+ return state;
-#ifdef MESA_LLVM
- state->llvm_prog = 0;
-
-#if 0
- if (!gallivm_global_cpu_engine()) {
- gallivm_cpu_engine_create(state->llvm_prog);
- }
- else
- gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog);
-#endif
-
-#elif defined(__i386__) || defined(__386__)
- if (softpipe->use_sse) {
- x86_init_func( &state->sse2_program );
- tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program );
- }
-#endif
+ state = softpipe_create_fs_exec( softpipe, templ );
+ assert(state);
return state;
}
@@ -87,7 +68,7 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->fs = (struct sp_fragment_shader_state *) fs;
+ softpipe->fs = (struct sp_fragment_shader *) fs;
softpipe->dirty |= SP_NEW_FS;
}
@@ -96,13 +77,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
void
softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
{
- struct sp_fragment_shader_state *state = fs;
-
-#if defined(__i386__) || defined(__386__)
- x86_release_func( &state->sse2_program );
-#endif
-
- FREE( state );
+ struct sp_fragment_shader *state = fs;
+
+ state->delete( state );
}
@@ -111,9 +88,9 @@ softpipe_create_vs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_vertex_shader_state *state;
+ struct sp_vertex_shader *state;
- state = CALLOC_STRUCT(sp_vertex_shader_state);
+ state = CALLOC_STRUCT(sp_vertex_shader);
if (state == NULL ) {
return NULL;
}
@@ -136,7 +113,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->vs = (const struct sp_vertex_shader_state *)vs;
+ softpipe->vs = (const struct sp_vertex_shader *)vs;
draw_bind_vertex_shader(softpipe->draw, softpipe->vs->draw_data);
@@ -149,8 +126,8 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_vertex_shader_state *state =
- (struct sp_vertex_shader_state *)vs;
+ struct sp_vertex_shader *state =
+ (struct sp_vertex_shader *)vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
FREE( state );