diff options
author | Brian Paul <brianp@vmware.com> | 2010-05-06 15:10:51 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-05-06 15:19:02 -0600 |
commit | 1fce9d58cc70deaff284e1d9d0ffcb15b61e7595 (patch) | |
tree | 359a66509bf0a36ee3695663c4a103f59905504b /src/gallium/drivers/softpipe/sp_quad_fs.c | |
parent | 4b274f311c2c72e40e63c02e4a6f9f5ccc59f165 (diff) | |
download | external_mesa3d-1fce9d58cc70deaff284e1d9d0ffcb15b61e7595.zip external_mesa3d-1fce9d58cc70deaff284e1d9d0ffcb15b61e7595.tar.gz external_mesa3d-1fce9d58cc70deaff284e1d9d0ffcb15b61e7595.tar.bz2 |
softpipe: fix dangling references to shaders in the TGSI executor
If a shader was bound to the fragment shader TGSI executor and it was
then deleted and a new shader was allocated at the same address as the
old shader, the new fragment shader would not get properly bound to
the TGSI machine and we'd wind up using the old one.
This would not have been a problem if shaders were refcounted.
Now the TGSI machine is owned by the context rather than the quad
pipeline's shader stage so that the softpipe_delete_fs_state()
function can access it.
Fixes sporadic failures of the piglit fp-long-alu test (fd.o bug 27989).
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_quad_fs.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_quad_fs.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index 8ae5a7f..907e94b 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -50,8 +50,8 @@ 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 */ }; @@ -70,9 +70,8 @@ quad_shade_stage(struct quad_stage *qs) 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 ); @@ -108,9 +107,8 @@ shade_quads(struct quad_stage *qs, 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++) { @@ -139,11 +137,10 @@ shade_quads(struct quad_stage *qs, 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 ); @@ -154,10 +151,6 @@ shade_begin(struct quad_stage *qs) 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 ); } @@ -174,16 +167,9 @@ sp_quad_shade_stage( struct softpipe_context *softpipe ) 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; } |