mesa: retain gl_shader_programs after glDeleteProgram if they are in use
authorTimothy Arceri <t_arceri@yahoo.com.au>
Thu, 26 Jan 2017 08:29:20 +0000 (19:29 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 16 Feb 2017 04:01:41 +0000 (15:01 +1100)
commite6506b3cd2382a9a7e0a3494a964d2bafb3bebc3
tree2b4a50bf5da75da19f94c72dac3fb2f1e7ae0a65
parent300900516d1e15edd86ea0512f9b5ccda85d150e
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 <kenneth@whitecape.org>
src/mesa/drivers/common/meta.c
src/mesa/main/mtypes.h
src/mesa/main/pipelineobj.c
src/mesa/main/shaderapi.c
src/mesa/main/shaderapi.h