diff options
author | Vadim Girlin <[email protected]> | 2011-12-22 18:35:35 +0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2012-01-03 09:28:58 -0500 |
commit | d4bf5cefb0943a196c603360187493e270a66442 (patch) | |
tree | f41f391e5663b1cf44ca76d11b17bef764fa03f6 /src/mesa | |
parent | f433fe015e903424d25673ebfe5dcb115381d753 (diff) |
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 <[email protected]>
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 <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index eb44df23f9f..cecceca5a01 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); |