From: Vadim Girlin Date: Thu, 22 Dec 2011 14:35:35 +0000 (+0400) Subject: glsl_to_tgsi: v2 Invalidate and revalidate uniform backing storage X-Git-Tag: mesa-8.0-rc1~296 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4bf5cefb0943a196c603360187493e270a66442;p=platform%2Fupstream%2Fmesa.git glsl_to_tgsi: v2 Invalidate and revalidate uniform backing storage If glUniform1i and friends are going to dump data directly in driver-allocated, the pointers have to be updated when the storage moves. This should fix the regressions seen with commit 7199096. I'm not sure if this is the only place that needs this treatment. I'm a little uncertain about the various functions in st_glsl_to_tgsi that modify the TGSI IR and try to propagate changes about that up to the gl_program. That seems sketchy to me. Signed-off-by: Ian Romanick v2: Revalidate when shader_program is not NULL. Update the pointers for all _LinkedShaders. Init glsl_to_tgsi_visitor::shader_program to NULL in the get_pixel_transfer_visitor & get_bitmap_visitor. Signed-off-by: Vadim Girlin --- diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index eb44df2..cecceca 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3716,6 +3716,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, /* Copy attributes of the glsl_to_tgsi_visitor in the original shader. */ v->ctx = original->ctx; v->prog = prog; + v->shader_program = NULL; v->glsl_version = original->glsl_version; v->native_integers = original->native_integers; v->options = original->options; @@ -3845,6 +3846,7 @@ get_bitmap_visitor(struct st_fragment_program *fp, /* Copy attributes of the glsl_to_tgsi_visitor in the original shader. */ v->ctx = original->ctx; v->prog = prog; + v->shader_program = NULL; v->glsl_version = original->glsl_version; v->native_integers = original->native_integers; v->options = original->options; @@ -4558,6 +4560,15 @@ st_translate_program( t->pointSizeOutIndex = -1; t->prevInstWrotePointSize = GL_FALSE; + if (program->shader_program) { + for (i = 0; i < program->shader_program->NumUserUniformStorage; i++) { + struct gl_uniform_storage *const storage = + &program->shader_program->UniformStorage[i]; + + _mesa_uniform_detach_all_driver_storage(storage); + } + } + /* * Declare input attributes. */ @@ -4784,6 +4795,20 @@ st_translate_program( t->insn[t->labels[i].branch_target]); } + if (program->shader_program) { + /* This has to be done last. Any operation the can cause + * prog->ParameterValues to get reallocated (e.g., anything that adds a + * program constant) has to happen before creating this linkage. + */ + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + if (program->shader_program->_LinkedShaders[i] == NULL) + continue; + + _mesa_associate_uniform_storage(ctx, program->shader_program, + program->shader_program->_LinkedShaders[i]->Program->Parameters); + } + } + out: if (t) { FREE(t->insn);