[Mesa-dev] [PATCH 51/70] mesa: update active relinked program
Timothy Arceri
timothy.arceri at collabora.com
Tue Dec 20 10:38:01 UTC 2016
This likely fixes a subroutine bug were
_mesa_shader_program_init_subroutine_defaults() would never have been
called for the relinked program as we previously just set
_NEW_PROGRAM as dirty and never called the _mesa_use* functions.
We also switch to using gl_program for the CurrentProgram array so
this change will need to be sqashed with the previous two.
---
src/mesa/main/shaderapi.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 0525168..d7af0e3 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1084,7 +1084,8 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
unsigned programs_in_use = 0;
if (ctx->_Shader)
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
- if (ctx->_Shader->CurrentProgram[stage] == shProg) {
+ if (ctx->_Shader->CurrentProgram[stage] &&
+ ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) {
programs_in_use |= 1 << stage;
}
}
@@ -1102,7 +1103,15 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
* is attached."
*/
if (shProg->data->LinkStatus && programs_in_use) {
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ while (programs_in_use) {
+ const int stage = u_bit_scan(&programs_in_use);
+
+ struct gl_program *prog = NULL;
+ if (shProg->_LinkedShaders[stage])
+ prog = shProg->_LinkedShaders[stage]->Program;
+
+ _mesa_use_program(ctx, stage, prog, ctx->_Shader);
+ }
}
/* Capture .shader_test files. */
--
2.9.3
More information about the mesa-dev
mailing list