From 1fce9d58cc70deaff284e1d9d0ffcb15b61e7595 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 May 2010 15:10:51 -0600 Subject: 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). --- src/gallium/drivers/softpipe/sp_context.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium/drivers/softpipe/sp_context.c') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index f6e2b80d46..fea3520fa5 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -36,6 +36,7 @@ #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" @@ -123,6 +124,8 @@ softpipe_destroy( struct pipe_context *pipe ) } } + tgsi_exec_machine_destroy(softpipe->fs_machine); + FREE( softpipe ); } @@ -293,6 +296,8 @@ softpipe_create_context( struct pipe_screen *screen, 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); -- cgit v1.2.3