mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 09:20:23 +01:00
tgsi: fix tgsi_exec_machine_bind_shader() to handle NULL tokens, samplers
This lets us unbind a shader from the tgsi_exec_machine. Since shaders aren't ref counted we need this to properly clean up when deleting shaders elsewhere.
This commit is contained in:
parent
fbb1ad33a4
commit
c8f0e805a9
1 changed files with 20 additions and 1 deletions
|
|
@ -635,6 +635,23 @@ tgsi_exec_machine_bind_shader(
|
|||
mach->Tokens = tokens;
|
||||
mach->Samplers = samplers;
|
||||
|
||||
if (!tokens) {
|
||||
/* unbind and free all */
|
||||
if (mach->Declarations) {
|
||||
FREE( mach->Declarations );
|
||||
}
|
||||
mach->Declarations = NULL;
|
||||
mach->NumDeclarations = 0;
|
||||
|
||||
if (mach->Instructions) {
|
||||
FREE( mach->Instructions );
|
||||
}
|
||||
mach->Instructions = NULL;
|
||||
mach->NumInstructions = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
k = tgsi_parse_init (&parse, mach->Tokens);
|
||||
if (k != TGSI_PARSE_OK) {
|
||||
debug_printf( "Problem parsing!\n" );
|
||||
|
|
@ -792,7 +809,9 @@ void
|
|||
tgsi_exec_machine_destroy(struct tgsi_exec_machine *mach)
|
||||
{
|
||||
if (mach) {
|
||||
FREE(mach->Instructions);
|
||||
if (mach->Instructions)
|
||||
FREE(mach->Instructions);
|
||||
if (mach->Declarations)
|
||||
FREE(mach->Declarations);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue