[Mesa-dev] [PATCH] glsl_to_tgsi: Make sure the 'shader' member is always initialized

Michel Dänzer michel at daenzer.net
Wed May 14 21:10:14 PDT 2014


Carl, this patch fixes a bug in commit
3e817e7e56806d8adb8f16c35136045c29908944; please hold off on backporting
that to the 10.1 branch without this fix.


On 15.05.2014 12:56, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
> 
> Fixes the valgrind report below and random crashes with piglit on radeonsi.
> 
> ==30005== Conditional jump or move depends on uninitialised value(s)
> ==30005==    at 0xB13584E: st_translate_program (st_glsl_to_tgsi.cpp:5100)
> ==30005==    by 0xB14698B: st_translate_fragment_program (st_program.c:747)
> ==30005==    by 0xB14777D: st_get_fp_variant (st_program.c:824)
> ==30005==    by 0xB11219C: get_color_fp_variant (st_cb_drawpixels.c:1042)
> ==30005==    by 0xB1131AE: st_DrawPixels (st_cb_drawpixels.c:1154)
> ==30005==    by 0xAFF8806: _mesa_DrawPixels (drawpix.c:162)
> ==30005==    by 0x4EB86DB: stub_glDrawPixels (generated_dispatch.c:6640)
> ==30005==    by 0x4F1DF08: piglit_visualize_image (piglit-util-gl.c:1574)
> ==30005==    by 0x40691D: draw_image_to_window_system_fb(int, bool) (draw-buffers-common.cpp:733)
> ==30005==    by 0x406C8B: draw_reference_image(bool, bool) (draw-buffers-common.cpp:854)
> ==30005==    by 0x40722A: piglit_display (alpha-to-coverage-dual-src-blend.cpp:117)
> ==30005==    by 0x4EA7168: run_test (piglit_fbo_framework.c:52)
> 
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 79d013d..739e108 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -3155,6 +3155,7 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
>     ctx = NULL;
>     prog = NULL;
>     shader_program = NULL;
> +   shader = NULL;
>     options = NULL;
>  }
>  
> @@ -3988,6 +3989,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
>     v->ctx = original->ctx;
>     v->prog = prog;
>     v->shader_program = NULL;
> +   v->shader = NULL;
>     v->glsl_version = original->glsl_version;
>     v->native_integers = original->native_integers;
>     v->options = original->options;
> @@ -4118,6 +4120,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
>     v->ctx = original->ctx;
>     v->prog = prog;
>     v->shader_program = NULL;
> +   v->shader = NULL;
>     v->glsl_version = original->glsl_version;
>     v->native_integers = original->native_integers;
>     v->options = original->options;
> 


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer


More information about the mesa-dev mailing list