From: Marek Olšák <marek.ol...@amd.com> --- .../drivers/radeonsi/si_shader_tgsi_mem.c | 33 ++++--------------- 1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c index 668238b1012..4fe8c41835e 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c @@ -1212,61 +1212,43 @@ static void tex_fetch_ptrs( AC_DESC_FMASK); } else if (target != TGSI_TEXTURE_BUFFER) { if (samp_ptr) { *samp_ptr = si_load_sampler_desc(ctx, list, index, AC_DESC_SAMPLER); *samp_ptr = sici_fix_sampler_aniso(ctx, *res_ptr, *samp_ptr); } } } -static void txq_fetch_args( - struct lp_build_tgsi_context *bld_base, - struct lp_build_emit_data *emit_data) +static void txq_emit(const struct lp_build_tgsi_action *action, + struct lp_build_tgsi_context *bld_base, + struct lp_build_emit_data *emit_data) { struct si_shader_context *ctx = si_shader_context(bld_base); const struct tgsi_full_instruction *inst = emit_data->inst; unsigned target = inst->Texture.Texture; struct ac_image_args args = {}; tex_fetch_ptrs(bld_base, emit_data, &args.resource, NULL, NULL); if (target == TGSI_TEXTURE_BUFFER) { /* Read the size from the buffer descriptor directly. */ - emit_data->args[0] = get_buffer_size(bld_base, args.resource); + emit_data->output[emit_data->chan] = + get_buffer_size(bld_base, args.resource); return; } - /* Textures - set the mip level. */ + args.opcode = ac_image_get_resinfo; + args.dim = ac_texture_dim_from_tgsi_target(ctx->screen, target); args.lod = lp_build_emit_fetch(bld_base, inst, 0, TGSI_CHAN_X); args.dmask = 0xf; - set_tex_fetch_args(ctx, emit_data, &args, target); -} - -static void txq_emit(const struct lp_build_tgsi_action *action, - struct lp_build_tgsi_context *bld_base, - struct lp_build_emit_data *emit_data) -{ - struct si_shader_context *ctx = si_shader_context(bld_base); - struct ac_image_args args; - unsigned target = emit_data->inst->Texture.Texture; - - if (target == TGSI_TEXTURE_BUFFER) { - /* Just return the buffer size. */ - emit_data->output[emit_data->chan] = emit_data->args[0]; - return; - } - - memcpy(&args, emit_data->args, sizeof(args)); /* ugly */ - - args.opcode = ac_image_get_resinfo; LLVMValueRef result = ac_build_image_opcode(&ctx->ac, &args); emit_data->output[emit_data->chan] = fix_resinfo(ctx, target, result); } /* Gather4 should follow the same rules as bilinear filtering, but the hardware * incorrectly forces nearest filtering if the texture format is integer. * The only effect it has on Gather4, which always returns 4 texels for * bilinear filtering, is that the final coordinates are off by 0.5 of * the texel size. @@ -1879,21 +1861,20 @@ void si_shader_context_init_mem(struct si_shader_context *ctx) bld_base->op_actions[TGSI_OPCODE_TEX_LZ].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TEX2].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXB].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXB2].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXD].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXF].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXF_LZ].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXL].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXL2].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXP].emit = build_tex_intrinsic; - bld_base->op_actions[TGSI_OPCODE_TXQ].fetch_args = txq_fetch_args; bld_base->op_actions[TGSI_OPCODE_TXQ].emit = txq_emit; bld_base->op_actions[TGSI_OPCODE_TG4].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_LODQ].emit = build_tex_intrinsic; bld_base->op_actions[TGSI_OPCODE_TXQS].emit = si_llvm_emit_txqs; bld_base->op_actions[TGSI_OPCODE_FBFETCH].emit = si_llvm_emit_fbfetch; bld_base->op_actions[TGSI_OPCODE_LOAD].fetch_args = load_fetch_args; bld_base->op_actions[TGSI_OPCODE_LOAD].emit = load_emit; bld_base->op_actions[TGSI_OPCODE_STORE].fetch_args = store_fetch_args; -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev