From: Ilia Mirkin Date: Wed, 8 Jun 2016 15:32:54 +0000 (-0400) Subject: st/mesa: fix type confusion with reladdrs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f48f3447005ba4f888fa2e4a7335014c7d04878a;p=mesa.git st/mesa: fix type confusion with reladdrs The reality is that this doesn't matter, because we manually emit the ARL to the sampler reladdr, and those arguments don't get an extra load later, so it's effectively just a boolean. However having the types be wrong is confusing and could trigger very odd bugs should usage change down the line. Signed-off-by: Ilia Mirkin Reviewed-by: Brian Paul --- diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 2216bdf120d..b7eaa13ffb2 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2226,7 +2226,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op) GLSL_TYPE_UINT); if (!const_offset) { buffer.reladdr = ralloc(mem_ctx, st_src_reg); - memcpy(buffer.reladdr, &sampler_reladdr, sizeof(sampler_reladdr)); + *buffer.reladdr = op[0]; emit_arl(ir, sampler_reladdr, op[0]); } emit_asm(ir, TGSI_OPCODE_RESQ, result_dst)->buffer = buffer; @@ -3247,9 +3247,9 @@ glsl_to_tgsi_visitor::visit_ssbo_intrinsic(ir_call *ir) if (!const_block) { block->accept(this); - emit_arl(ir, sampler_reladdr, this->result); buffer.reladdr = ralloc(mem_ctx, st_src_reg); - memcpy(buffer.reladdr, &sampler_reladdr, sizeof(sampler_reladdr)); + *buffer.reladdr = this->result; + emit_arl(ir, sampler_reladdr, this->result); } /* Calculate the surface offset */ @@ -3464,9 +3464,9 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call *ir) get_deref_offsets(img, &sampler_array_size, &sampler_base, (unsigned int *)&image.index, &reladdr); if (reladdr.file != PROGRAM_UNDEFINED) { - emit_arl(ir, sampler_reladdr, reladdr); image.reladdr = ralloc(mem_ctx, st_src_reg); - memcpy(image.reladdr, &sampler_reladdr, sizeof(reladdr)); + *image.reladdr = reladdr; + emit_arl(ir, sampler_reladdr, reladdr); } st_dst_reg dst = undef_dst;