glsl: create gl_program at the start of linking rather than the end
authorTimothy Arceri <timothy.arceri@collabora.com>
Mon, 31 Oct 2016 12:54:03 +0000 (23:54 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Fri, 18 Nov 2016 20:42:33 +0000 (07:42 +1100)
commit9d96d3803ab5dc896d4844ac785db57bb1717f91
treee9a688d77f579e5184068bbc1aeaf349853b4871
parent2b8f97d0ff0836b1d1c8753a81a8810df385b21d
glsl: create gl_program at the start of linking rather than the end

This will allow us to directly store metadata we want to retain in
gl_program this metadata is currently stored in gl_linked_shader and
will be lost if relinking fails even though the program will remain
in use and is still valid according to the spec.

"If a program object that is active for any shader stage is re-linked
unsuccessfully, the link status will be set to FALSE, but any existing
executables and associated state will remain part of the current
rendering state until a subsequent call to UseProgram,
UseProgramStages, or BindProgramPipeline removes them from use."

This change will also help avoid the double handing that happens in
_mesa_copy_linked_program_data().

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/compiler/glsl/linker.cpp
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_nir.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp