diff options
author | Timothy Arceri <[email protected]> | 2017-01-26 19:29:20 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-02-16 15:01:41 +1100 |
commit | e6506b3cd2382a9a7e0a3494a964d2bafb3bebc3 (patch) | |
tree | 2b4a50bf5da75da19f94c72dac3fb2f1e7ae0a65 /src/mesa/main/pipelineobj.c | |
parent | 300900516d1e15edd86ea0512f9b5ccda85d150e (diff) |
mesa: retain gl_shader_programs after glDeleteProgram if they are in use
Fixes regressions from c505d6d852220f4aaaee161465dd2c579647e672.
Switching from using gl_shader_program to gl_program for the pipline
objects CurrentProgram array meant we were freeing gl_shader_programs
immediately after glDeleteProgram was called, but the spec states
the program should only get deleted once it is no longer in use.
To work around this we add a new ReferencedPrograms array to track
gl_shader_programs in use.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/pipelineobj.c')
-rw-r--r-- | src/mesa/main/pipelineobj.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index ec5df896c09..c1dd8d75c76 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -60,8 +60,10 @@ _mesa_delete_pipeline_object(struct gl_context *ctx, _mesa_reference_program(ctx, &obj->_CurrentFragmentProgram, NULL); - for (i = 0; i < MESA_SHADER_STAGES; i++) + for (i = 0; i < MESA_SHADER_STAGES; i++) { _mesa_reference_program(ctx, &obj->CurrentProgram[i], NULL); + _mesa_reference_shader_program(ctx, &obj->ReferencedPrograms[i], NULL); + } _mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL); mtx_destroy(&obj->Mutex); @@ -227,7 +229,7 @@ use_program_stage(struct gl_context *ctx, GLenum type, if (shProg && shProg->_LinkedShaders[stage]) prog = shProg->_LinkedShaders[stage]->Program; - _mesa_use_program(ctx, stage, prog, pipe); + _mesa_use_program(ctx, stage, shProg, prog, pipe); } /** |