diff options
author | Timothy Arceri <[email protected]> | 2016-10-31 23:54:03 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-19 07:42:33 +1100 |
commit | 9d96d3803ab5dc896d4844ac785db57bb1717f91 (patch) | |
tree | e9a688d77f579e5184068bbc1aeaf349853b4871 /src/mesa/state_tracker | |
parent | 2b8f97d0ff0836b1d1c8753a81a8810df385b21d (diff) |
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 <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 |
2 files changed, 2 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 2d8cf81dcce..cbc7e5a693d 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -367,16 +367,10 @@ st_nir_get_mesa_program(struct gl_context *ctx, struct gl_linked_shader *shader) { struct gl_program *prog; - GLenum target = _mesa_shader_stage_to_program(shader->Stage); validate_ir_tree(shader->ir); - prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name); - if (!prog) - return NULL; - - /* Don't use _mesa_reference_program() just take ownership */ - shader->Program = prog; + prog = shader->Program; prog->Parameters = _mesa_new_parameter_list(); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b47e1470e3f..2c2bbb6c26b 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6407,7 +6407,6 @@ get_mesa_program_tgsi(struct gl_context *ctx, { glsl_to_tgsi_visitor* v; struct gl_program *prog; - GLenum target = _mesa_shader_stage_to_program(shader->Stage); struct gl_shader_compiler_options *options = &ctx->Const.ShaderCompilerOptions[shader->Stage]; struct pipe_screen *pscreen = ctx->st->pipe->screen; @@ -6415,12 +6414,7 @@ get_mesa_program_tgsi(struct gl_context *ctx, validate_ir_tree(shader->ir); - prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name); - if (!prog) - return NULL; - - /* Don't use _mesa_reference_program() just take ownership */ - shader->Program = prog; + prog = shader->Program; prog->Parameters = _mesa_new_parameter_list(); v = new glsl_to_tgsi_visitor(); |