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

Gert Wollny gw.fossdev at gmail.com
Fri Feb 9 07:54:06 UTC 2018


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);
-- 
2.13.6



More information about the mesa-dev mailing list