diff options
author | Dave Airlie <[email protected]> | 2017-06-13 05:33:19 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-06-13 09:29:54 +1000 |
commit | 8ec4975cd83365c791a1852a6515ed5d4ade2daf (patch) | |
tree | 3eb9caa19d04cb29e018627c090e4dac57ddb9f0 /src | |
parent | ca69b5e78c49be2474dab7be92161cd9f957c4e7 (diff) |
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 <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
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; |