[Mesa-dev] [PATCH] st/mesa: Initialize tex_target in compile_tgsi_instruction

Marek Olšák maraeo at gmail.com
Thu Feb 8 18:14:28 UTC 2018


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Feb 8, 2018 at 6:50 PM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Initialize to TGSI_TEXTURE_BUFFER (== 0), same as was done before the
> variable type was changed to enum tgsi_texture_type.
>
> Fixes a bunch of piglit failures with radeonsi, e.g.:
>
> gles-3.0-transform-feedback-uniform-buffer-object: ../../../../src/gallium/auxiliary/tgsi/tgsi_util.c:502: tgsi_util_get_texture_coord_dim: Assertion `!"unknown texture target"' failed.
>
> Corresponding compiler warning:
>
>   CXX      state_tracker/st_glsl_to_tgsi.lo
> ../../../src/mesa/state_tracker/st_glsl_to_tgsi.cpp: In function ‘pipe_error st_translate_program(gl_context*, uint, ureg_program*, glsl_to_tgsi_visitor*, const gl_program*, GLuint, const ubyte*, const ubyte*, const ubyte*, const ubyte*, const ubyte*, GLuint, const ubyte*, const ubyte*, const ubyte*)’:
> ../../../src/mesa/state_tracker/st_glsl_to_tgsi.cpp:5992:23: warning: ‘tex_target’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>        ureg_memory_insn(ureg, inst->op, dst, num_dst, src, num_src,
>        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                         inst->buffer_access,
>                         ~~~~~~~~~~~~~~~~~~~~
>                         tex_target, inst->image_format);
>                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../../../src/mesa/state_tracker/st_glsl_to_tgsi.cpp:5866:27: note: ‘tex_target’ was declared here
>     enum tgsi_texture_type tex_target;
>                            ^~~~~~~~~~
>
> Fixes: 9f9ce1625fb3 ("st/mesa: use TGSI enum types in st_glsl_to_tgsi.cpp")
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.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 39a81fad628..1f875918936 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);
> --
> 2.15.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list