In exec_prepare() we were comparing pointers to see if the fragment
shader variant had changed before calling tgsi_exec_machine_bind_shader().
This didn't work reliably when there was a lot of shader token malloc/
freeing going on because the memory might get reused.
Instead, bind the shader variant during regular state validation.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=40404
(fixes a couple of piglit's glsl-max-varyings test)
Note: This is a candidate for the stable branches.
{
/*
* Bind tokens/shader to the interpreter's machine state.
- * Avoid redundant binding.
*/
- if (machine->Tokens != var->tokens) {
- tgsi_exec_machine_bind_shader( machine,
- var->tokens,
- PIPE_MAX_SAMPLERS,
- samplers );
- }
+ tgsi_exec_machine_bind_shader(machine,
+ var->tokens,
+ PIPE_MAX_SAMPLERS,
+ samplers);
}
static void
shade_begin(struct quad_stage *qs)
{
- struct softpipe_context *softpipe = qs->softpipe;
-
- softpipe->fs_variant->prepare( softpipe->fs_variant,
- softpipe->fs_machine,
- (struct tgsi_sampler **)
- softpipe->tgsi.samplers_list[PIPE_SHADER_FRAGMENT] );
-
qs->next->begin(qs->next);
}
if (softpipe->fs) {
softpipe->fs_variant = softpipe_find_fs_variant(softpipe,
softpipe->fs, &key);
+
+ /* prepare the TGSI interpreter for FS execution */
+ softpipe->fs_variant->prepare(softpipe->fs_variant,
+ softpipe->fs_machine,
+ (struct tgsi_sampler **) softpipe->
+ tgsi.samplers_list[PIPE_SHADER_FRAGMENT]);
}
else {
softpipe->fs_variant = NULL;