#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "tgsi/tgsi_exec.h"
#include "sp_clear.h"
#include "sp_context.h"
#include "sp_flush.h"
}
}
+ tgsi_exec_machine_destroy(softpipe->fs_machine);
+
FREE( softpipe );
}
softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe );
}
+ softpipe->fs_machine = tgsi_exec_machine_create();
+
/* setup quad rendering stages */
softpipe->quad.shade = sp_quad_shade_stage(softpipe);
softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe);
struct quad_shade_stage
{
struct quad_stage stage; /**< base class */
- struct tgsi_exec_machine *machine;
- struct tgsi_exec_vector *inputs, *outputs;
+
+ /* no other fields at this time */
};
static INLINE boolean
shade_quad(struct quad_stage *qs, struct quad_header *quad)
{
- struct quad_shade_stage *qss = quad_shade_stage( qs );
struct softpipe_context *softpipe = qs->softpipe;
- struct tgsi_exec_machine *machine = qss->machine;
+ struct tgsi_exec_machine *machine = softpipe->fs_machine;
/* run shader */
return softpipe->fs->run( softpipe->fs, machine, quad );
struct quad_header *quads[],
unsigned nr)
{
- struct quad_shade_stage *qss = quad_shade_stage( qs );
struct softpipe_context *softpipe = qs->softpipe;
- struct tgsi_exec_machine *machine = qss->machine;
+ struct tgsi_exec_machine *machine = softpipe->fs_machine;
unsigned i, pass = 0;
for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
static void
shade_begin(struct quad_stage *qs)
{
- struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
softpipe->fs->prepare( softpipe->fs,
- qss->machine,
+ softpipe->fs_machine,
(struct tgsi_sampler **)
softpipe->tgsi.frag_samplers_list );
static void
shade_destroy(struct quad_stage *qs)
{
- struct quad_shade_stage *qss = (struct quad_shade_stage *) qs;
-
- tgsi_exec_machine_destroy(qss->machine);
-
FREE( qs );
}
qss->stage.run = shade_quads;
qss->stage.destroy = shade_destroy;
- qss->machine = tgsi_exec_machine_create();
- if (!qss->machine)
- goto fail;
-
return &qss->stage;
fail:
- if (qss && qss->machine)
- tgsi_exec_machine_destroy(qss->machine);
-
FREE(qss);
return NULL;
}
#include "draw/draw_context.h"
#include "draw/draw_vs.h"
#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_scan.h"
#include "tgsi/tgsi_parse.h"
void
softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
struct sp_fragment_shader *state = fs;
assert(fs != softpipe_context(pipe)->fs);
-
+
+ if (softpipe->fs_machine->Tokens == state->shader.tokens) {
+ /* unbind the shader from the tgsi executor if we're
+ * deleting it.
+ */
+ tgsi_exec_machine_bind_shader(softpipe->fs_machine, NULL, 0, NULL);
+ }
+
state->delete( state );
}