[Mesa-dev] [PATCH] glsl_to_tgsi: Invalidate and revalidate uniform backing storage

Vadim Girlin vadimgirlin at gmail.com
Wed Nov 16 12:38:30 PST 2011


This patch fixes memory corruption, thanks.

Also there is another regression with Ligthsmark - incorrect rendering.
I've bisected it and came to the same commit again. Most noticeable
difference is in the very last scene - it should fade away, but it
doesn't. I can make the screenshots of good and bad rendering if you
need.

Vadim

On Wed, 2011-11-16 at 11:13 -0800, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> 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 <ian.d.romanick at intel.com>
> Cc: Vadim Girlin <vadimgirlin at gmail.com>
> Cc: Bryan Cain <bryancain3 at gmail.com>
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   14 ++++++++++++++
>  1 files changed, 14 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 0bf6766..c8385bb 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -4571,6 +4571,13 @@ st_translate_program(
>     t->pointSizeOutIndex = -1;
>     t->prevInstWrotePointSize = GL_FALSE;
>  
> +   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.
>      */
> @@ -4797,6 +4804,13 @@ st_translate_program(
>                         t->insn[t->labels[i].branch_target]);
>     }
>  
> +   /* 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.
> +    */
> +   _mesa_associate_uniform_storage(ctx, program->shader_program,
> +				   proginfo->Parameters);
> +
>  out:
>     if (t) {
>        FREE(t->insn);







More information about the mesa-dev mailing list