From: Dave Airlie Date: Mon, 12 Jun 2017 19:33:19 +0000 (+1000) Subject: st_glsl_to_tgsi: don't try and pass 32-bit values to get_deref_offsets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ec4975cd83365c791a1852a6515ed5d4ade2daf;p=mesa.git st_glsl_to_tgsi: don't try and pass 32-bit values to get_deref_offsets Just use a temporary 16-bit index. This fixes coverity issue, pointed to me by Ilia. Reviewed-by: Samuel Pitoiset Signed-off-by: Dave Airlie --- diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index c5d2e0fcd2f..798831613f1 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3776,10 +3776,11 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call *ir) st_src_reg reladdr; st_src_reg image(PROGRAM_IMAGE, 0, GLSL_TYPE_UINT); - + uint16_t index; get_deref_offsets(img, &sampler_array_size, &sampler_base, - (uint16_t*)&image.index, &reladdr, true); + &index, &reladdr, true); + image.index = index; if (reladdr.file != PROGRAM_UNDEFINED) { image.reladdr = ralloc(mem_ctx, st_src_reg); *image.reladdr = reladdr; @@ -4391,9 +4392,11 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) st_src_reg sampler(PROGRAM_SAMPLER, 0, GLSL_TYPE_UINT); + uint16_t index; get_deref_offsets(ir->sampler, &sampler_array_size, &sampler_base, - (uint16_t *)&sampler.index, &reladdr, true); + &index, &reladdr, true); + sampler.index = index; if (reladdr.file != PROGRAM_UNDEFINED) { sampler.reladdr = ralloc(mem_ctx, st_src_reg); *sampler.reladdr = reladdr;