const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
- const struct pipe_shader_state *fs;
+ const struct sp_fragment_shader_state *fs;
const struct sp_vertex_shader_state *vs;
struct pipe_blend_color blend_color;
#include "pipe/llvm/llvmtgsi.h"
+#include "x86/rtasm/x86sse.h"
+
#include "sp_context.h"
+#include "sp_state.h"
#include "sp_headers.h"
#include "sp_quad.h"
#include "sp_tex_sample.h"
/* run shader */
/* XXX: Generated code effectively unusable until it handles quad->mask */
- if( !quad->mask && softpipe->fs->executable != NULL ) {
- codegen_function func = (codegen_function) softpipe->fs->executable;
+ if( !quad->mask ) {
+ codegen_function func = (codegen_function) x86_get_func( &softpipe->fs->sse2_program );
func(
machine->Inputs,
machine->Outputs,
/* store result color */
if (qss->colorOutSlot >= 0) {
/* XXX need to handle multiple color outputs someday */
- assert(qss->stage.softpipe->fs->output_semantic_name[qss->colorOutSlot]
+ assert(qss->stage.softpipe->fs->shader.output_semantic_name[qss->colorOutSlot]
== TGSI_SEMANTIC_COLOR);
memcpy(
quad->outputs.color,
/* XXX only do this if the fragment shader changes... */
tgsi_exec_machine_init(&qss->machine,
- softpipe->fs->tokens,
+ softpipe->fs->shader.tokens,
PIPE_MAX_SAMPLERS,
qss->samplers );
/* find output slots for depth, color */
qss->colorOutSlot = -1;
qss->depthOutSlot = -1;
- for (i = 0; i < qss->stage.softpipe->fs->num_outputs; i++) {
- switch (qss->stage.softpipe->fs->output_semantic_name[i]) {
+ for (i = 0; i < qss->stage.softpipe->fs->shader.num_outputs; i++) {
+ switch (qss->stage.softpipe->fs->shader.output_semantic_name[i]) {
case TGSI_SEMANTIC_POSITION:
qss->depthOutSlot = i;
break;
}
-static void shade_destroy(struct quad_stage *qs)\r
-{\r
- free( qs );\r
+static void shade_destroy(struct quad_stage *qs)
+{
+ free( qs );
}
#include "pipe/p_state.h"
+#include "x86/rtasm/x86sse.h"
+
+/**
+ * Softpipe fs state is derived from pipe_shader_state.
+ */
+struct sp_fragment_shader_state {
+ struct pipe_shader_state shader;
+#if defined(__i386__) || defined(__386__)
+ struct x86_function sse2_program;
+#endif
+};
void *
softpipe_create_alpha_test_state(struct pipe_context *,
* that now.
*/
- struct pipe_shader_state *state = malloc(sizeof(struct pipe_shader_state));
- memcpy(state, templ, sizeof(struct pipe_shader_state));
+ struct sp_fragment_shader_state *state = malloc(sizeof(struct sp_fragment_shader_state));
+ state->shader = *templ;
#if defined(__i386__) || defined(__386__)
if (softpipe->use_sse) {
x86_init_func( &state->sse2_program );
- tgsi_emit_sse2_fs( state->tokens, &state->sse2_program );
-
- state->executable = (void *)x86_get_func( &state->sse2_program );
+ tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program );
}
#endif
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->fs = (struct pipe_shader_state *)fs;
+ softpipe->fs = (struct sp_fragment_shader_state *) fs;
softpipe->dirty |= SP_NEW_FS;
}
void *shader)
{
#if defined(__i386__) || defined(__386__)
- struct pipe_shader_state *state = shader;
+ struct sp_fragment_shader_state *state = shader;
x86_release_func( &state->sse2_program );
#endif