[Mesa-dev] [PATCH 70/70] mesa: update active relinked program
Timothy Arceri
timothy.arceri at collabora.com
Fri Nov 11 00:46:52 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 4ba6614..9abc57a 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1093,7 +1093,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;
}
}
@@ -1111,7 +1112,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.7.4
More information about the mesa-dev
mailing list