diff options
author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2020-04-01 14:23:53 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-03 13:42:43 +0000 |
commit | 61566f2ae18c7d4906f24150965aea809b7680f9 (patch) | |
tree | a6764d2f173d1e880220a24a3f916295c2a3e82a /src/mesa/main/shaderapi.c | |
parent | 1288ac7632b31a20497a0e75f374f66ce3d5bc3c (diff) |
mesa: update pipeline when re-linking a program in use
Updating was only done for bound program, so add the
same logic for existing pipelines.
This fixes piglit test arb_shader_storage_buffer_object-issue1258.
It might also help the following issue:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/1258
Reviewed-by: Timothy Arceri <[email protected]>
Acked-by: Marek Olšák <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4404>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4404>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r-- | src/mesa/main/shaderapi.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index dfed487cb48..a812b6c06e9 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1249,6 +1249,29 @@ _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh) } +struct update_programs_in_pipeline_params +{ + struct gl_context *ctx; + struct gl_shader_program *shProg; +}; + +static void +update_programs_in_pipeline(GLuint key, void *data, void *userData) +{ + struct update_programs_in_pipeline_params *params = + (struct update_programs_in_pipeline_params *) userData; + struct gl_pipeline_object *obj = (struct gl_pipeline_object *) data; + + for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) { + if (obj->CurrentProgram[stage] && + obj->CurrentProgram[stage]->Id == params->shProg->Name) { + struct gl_program *prog = prog = params->shProg->_LinkedShaders[stage]->Program; + _mesa_use_program(params->ctx, stage, params->shProg, prog, obj); + } + } +} + + /** * Link a program's shaders. */ @@ -1279,7 +1302,7 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg, ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) { programs_in_use |= 1 << stage; } - } + } ensure_builtin_types(ctx); @@ -1296,7 +1319,7 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg, * the state of any program pipeline for all stages where the program * is attached." */ - if (shProg->data->LinkStatus && programs_in_use) { + if (shProg->data->LinkStatus) { while (programs_in_use) { const int stage = u_bit_scan(&programs_in_use); @@ -1306,6 +1329,15 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg, _mesa_use_program(ctx, stage, shProg, prog, ctx->_Shader); } + + if (ctx->Pipeline.Objects) { + struct update_programs_in_pipeline_params params = { + .ctx = ctx, + .shProg = shProg + }; + _mesa_HashWalk(ctx->Pipeline.Objects, update_programs_in_pipeline, + ¶ms); + } } /* Capture .shader_test files. */ |