[Mesa-dev] [PATCH] st/mesa: Initialize tex_target otherwise it might be used uninitialized.

Michel Dänzer michel at daenzer.net
Fri Feb 9 10:10:48 UTC 2018


On 2018-02-09 08:54 AM, Gert Wollny wrote:
> The initialization of tex_target was dropped and since the value
> is used uninitialized (e.g. with Unreal Editor), an assertion
> fires in tgsi/tgsi_util.c:502: tgsi_util_get_texture_coord_dim:
>   Assertion `!"unknown texture target"' failed.
> 
> Initialize tex_target with the enum that corresponds to the value 0 used
> before.
> 
> Fixes 9f9ce1625fb32ff0b9d5b1858aa5bb7b531ded0f
>    st/mesa: use TGSI enum types in st_glsl_to_tgsi.cpp
> 
> Signed-off-by: Gert Wollny <gw.fossdev at gmail.com>
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 39a81fad62..1f87591893 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -5863,7 +5863,7 @@ compile_tgsi_instruction(struct st_translate *t,
>  
>     int num_dst;
>     int num_src;
> -   enum tgsi_texture_type tex_target;
> +   enum tgsi_texture_type tex_target = TGSI_TEXTURE_BUFFER;
>  
>     num_dst = num_inst_dst_regs(inst);
>     num_src = num_inst_src_regs(inst);
> 

I wrote the same patch yesterday and pushed it this morning:
https://patchwork.freedesktop.org/patch/203519/


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


More information about the mesa-dev mailing list