We were sometimes keeping a pointer to a stack-allocated object.
Now make a copy of the pipe_shader_state object.
This should fix some seemingly random memory errors/crashes.
/* This member will disappear shortly:
*/
- const struct pipe_shader_state *state;
+ struct pipe_shader_state state;
struct tgsi_shader_info info;
{
/* specify the vertex program to interpret/execute */
tgsi_exec_machine_bind_shader(&draw->machine,
- shader->state->tokens,
+ shader->state.tokens,
PIPE_MAX_SAMPLERS,
NULL /*samplers*/ );
if (vs == NULL)
return NULL;
- vs->state = state;
+ vs->state = *state;
vs->prepare = vs_exec_prepare;
vs->run = vs_exec_run;
vs->delete = vs_exec_delete;
if (vs == NULL)
return NULL;
- vs->base.state = templ;
+ vs->base.state = *templ;
vs->base.prepare = vs_sse_prepare;
vs->base.run = vs_sse_run;
vs->base.delete = vs_sse_delete;
x86_init_func( &vs->sse2_program );
- if (!tgsi_emit_sse2( (struct tgsi_token *) vs->base.state->tokens,
+ if (!tgsi_emit_sse2( (struct tgsi_token *) vs->base.state.tokens,
&vs->sse2_program ))
goto fail;