#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/util/tgsi_dump.h"
+#include "tgsi/util/tgsi_scan.h"
void *
struct softpipe_context *softpipe = softpipe_context(pipe);
struct sp_fragment_shader *state;
+ /* debug */
if (softpipe->dump_fs)
tgsi_dump(templ->tokens, 0);
+ /* codegen */
state = softpipe_create_fs_llvm( softpipe, templ );
- if (state)
- return state;
-
- state = softpipe_create_fs_sse( softpipe, templ );
- if (state)
- return state;
-
- state = softpipe_create_fs_exec( softpipe, templ );
+ if (!state) {
+ state = softpipe_create_fs_sse( softpipe, templ );
+ if (!state) {
+ state = softpipe_create_fs_exec( softpipe, templ );
+ }
+ }
assert(state);
+
+ /* get/save the summary info for this shader */
+ tgsi_scan_shader(templ->tokens, &state->info);
+
return state;
}
softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
{
struct sp_fragment_shader *state = fs;
+
+ assert(fs != softpipe_context(pipe)->fs);
state->delete( state );
}
softpipe->vs = (const struct sp_vertex_shader *)vs;
- draw_bind_vertex_shader(softpipe->draw, softpipe->vs->draw_data);
+ draw_bind_vertex_shader(softpipe->draw,
+ (softpipe->vs ? softpipe->vs->draw_data : NULL));
softpipe->dirty |= SP_NEW_VS;
}