[Mesa-dev] [PATCH] st/mesa: fix type confusion with reladdrs
Brian Paul
brianp at vmware.com
Wed Jun 8 16:33:48 UTC 2016
On 06/08/2016 09:34 AM, Ilia Mirkin wrote:
> 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 <imirkin at alum.mit.edu>
> ---
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 634d3a5..53c01c6 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -2228,7 +2228,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;
> @@ -3249,9 +3249,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 */
> @@ -3466,9 +3466,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;
>
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list