[Mesa-dev] [PATCH 3/3] radeonsi: replace si_shader_context::soa by bld_base
Nicolai Hähnle
nhaehnle at gmail.com
Thu Jan 12 15:21:20 UTC 2017
On 12.01.2017 14:07, Samuel Pitoiset wrote:
> We no longer need to use lp_build_tgsi_soa_context.
>
> No regressions founds with full piglit run.
Yay! For the series:
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/radeonsi/si_shader.c | 112 ++++++++++-----------
> src/gallium/drivers/radeonsi/si_shader_internal.h | 2 +-
> .../drivers/radeonsi/si_shader_tgsi_setup.c | 46 ++++-----
> 3 files changed, 78 insertions(+), 82 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 962c2f206c..c1672ef472 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -176,7 +176,7 @@ static LLVMValueRef unpack_param(struct si_shader_context *ctx,
> param);
>
> if (LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMFloatTypeKind)
> - value = bitcast(&ctx->soa.bld_base,
> + value = bitcast(&ctx->bld_base,
> TGSI_TYPE_UNSIGNED, value);
>
> if (rshift)
> @@ -251,7 +251,7 @@ get_tcs_out_patch_stride(struct si_shader_context *ctx)
> static LLVMValueRef
> get_tcs_out_patch0_offset(struct si_shader_context *ctx)
> {
> - return lp_build_mul_imm(&ctx->soa.bld_base.uint_bld,
> + return lp_build_mul_imm(&ctx->bld_base.uint_bld,
> unpack_param(ctx,
> SI_PARAM_TCS_OUT_OFFSETS,
> 0, 16),
> @@ -261,7 +261,7 @@ get_tcs_out_patch0_offset(struct si_shader_context *ctx)
> static LLVMValueRef
> get_tcs_out_patch0_patch_data_offset(struct si_shader_context *ctx)
> {
> - return lp_build_mul_imm(&ctx->soa.bld_base.uint_bld,
> + return lp_build_mul_imm(&ctx->bld_base.uint_bld,
> unpack_param(ctx,
> SI_PARAM_TCS_OUT_OFFSETS,
> 16, 16),
> @@ -322,7 +322,7 @@ static void build_indexed_store(struct si_shader_context *ctx,
> LLVMValueRef base_ptr, LLVMValueRef index,
> LLVMValueRef value)
> {
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> struct gallivm_state *gallivm = bld_base->base.gallivm;
>
> LLVMBuildStore(gallivm->builder, value,
> @@ -342,7 +342,7 @@ static LLVMValueRef build_indexed_load(struct si_shader_context *ctx,
> LLVMValueRef base_ptr, LLVMValueRef index,
> bool uniform)
> {
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> struct gallivm_state *gallivm = bld_base->base.gallivm;
> LLVMValueRef pointer;
>
> @@ -370,8 +370,8 @@ static LLVMValueRef get_instance_index_for_fetch(
> unsigned param_start_instance, unsigned divisor)
> {
> struct si_shader_context *ctx =
> - si_shader_context(&radeon_bld->soa.bld_base);
> - struct gallivm_state *gallivm = radeon_bld->soa.bld_base.base.gallivm;
> + si_shader_context(&radeon_bld->bld_base);
> + struct gallivm_state *gallivm = radeon_bld->bld_base.base.gallivm;
>
> LLVMValueRef result = LLVMGetParam(radeon_bld->main_fn,
> ctx->param_instance_id);
> @@ -391,7 +391,7 @@ static void declare_input_vs(
> const struct tgsi_full_declaration *decl,
> LLVMValueRef out[4])
> {
> - struct lp_build_context *base = &ctx->soa.bld_base.base;
> + struct lp_build_context *base = &ctx->bld_base.base;
> struct gallivm_state *gallivm = base->gallivm;
>
> unsigned chan;
> @@ -508,7 +508,7 @@ static LLVMValueRef get_indirect_index(struct si_shader_context *ctx,
> const struct tgsi_ind_register *ind,
> int rel_index)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> LLVMValueRef result;
>
> result = ctx->addrs[ind->Index][ind->Swizzle];
> @@ -548,7 +548,7 @@ static LLVMValueRef get_dw_address(struct si_shader_context *ctx,
> LLVMValueRef vertex_dw_stride,
> LLVMValueRef base_addr)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> struct tgsi_shader_info *info = &ctx->shader->selector->info;
> ubyte *name, *index, *array_first;
> int first, param;
> @@ -646,7 +646,7 @@ static LLVMValueRef get_tcs_tes_buffer_address(struct si_shader_context *ctx,
> LLVMValueRef vertex_index,
> LLVMValueRef param_index)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> LLVMValueRef base_addr, vertices_per_patch, num_patches, total_vertices;
> LLVMValueRef param_stride, constant16;
>
> @@ -690,7 +690,7 @@ static LLVMValueRef get_tcs_tes_buffer_address_from_reg(
> const struct tgsi_full_dst_register *dst,
> const struct tgsi_full_src_register *src)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> struct tgsi_shader_info *info = &ctx->shader->selector->info;
> ubyte *name, *index, *array_first;
> struct tgsi_full_src_register reg;
> @@ -1122,7 +1122,7 @@ static LLVMValueRef fetch_input_gs(
> struct lp_build_context *base = &bld_base->base;
> struct si_shader_context *ctx = si_shader_context(bld_base);
> struct si_shader *shader = ctx->shader;
> - struct lp_build_context *uint = &ctx->soa.bld_base.uint_bld;
> + struct lp_build_context *uint = &ctx->bld_base.uint_bld;
> struct gallivm_state *gallivm = base->gallivm;
> LLVMValueRef vtx_offset;
> LLVMValueRef args[9];
> @@ -1320,7 +1320,7 @@ static void interp_fs_input(struct si_shader_context *ctx,
> LLVMValueRef face,
> LLVMValueRef result[4])
> {
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> struct lp_build_context *base = &bld_base->base;
> struct lp_build_context *uint = &bld_base->uint_bld;
> struct gallivm_state *gallivm = base->gallivm;
> @@ -1433,9 +1433,9 @@ static void declare_input_fs(
> const struct tgsi_full_declaration *decl,
> LLVMValueRef out[4])
> {
> - struct lp_build_context *base = &radeon_bld->soa.bld_base.base;
> + struct lp_build_context *base = &radeon_bld->bld_base.base;
> struct si_shader_context *ctx =
> - si_shader_context(&radeon_bld->soa.bld_base);
> + si_shader_context(&radeon_bld->bld_base);
> struct si_shader *shader = ctx->shader;
> LLVMValueRef main_fn = radeon_bld->main_fn;
> LLVMValueRef interp_param = NULL;
> @@ -1479,7 +1479,7 @@ static void declare_input_fs(
>
> static LLVMValueRef get_sample_id(struct si_shader_context *radeon_bld)
> {
> - return unpack_param(si_shader_context(&radeon_bld->soa.bld_base),
> + return unpack_param(si_shader_context(&radeon_bld->bld_base),
> SI_PARAM_ANCILLARY, 8, 4);
> }
>
> @@ -1544,8 +1544,8 @@ static LLVMValueRef buffer_load_const(struct si_shader_context *ctx,
> static LLVMValueRef load_sample_position(struct si_shader_context *radeon_bld, LLVMValueRef sample_id)
> {
> struct si_shader_context *ctx =
> - si_shader_context(&radeon_bld->soa.bld_base);
> - struct lp_build_context *uint_bld = &radeon_bld->soa.bld_base.uint_bld;
> + si_shader_context(&radeon_bld->bld_base);
> + struct lp_build_context *uint_bld = &radeon_bld->bld_base.uint_bld;
> struct gallivm_state *gallivm = &radeon_bld->gallivm;
> LLVMBuilderRef builder = gallivm->builder;
> LLVMValueRef desc = LLVMGetParam(ctx->main_fn, SI_PARAM_RW_BUFFERS);
> @@ -1572,8 +1572,8 @@ static void declare_system_value(
> const struct tgsi_full_declaration *decl)
> {
> struct si_shader_context *ctx =
> - si_shader_context(&radeon_bld->soa.bld_base);
> - struct lp_build_context *bld = &radeon_bld->soa.bld_base.base;
> + si_shader_context(&radeon_bld->bld_base);
> + struct lp_build_context *bld = &radeon_bld->bld_base.base;
> struct gallivm_state *gallivm = &radeon_bld->gallivm;
> LLVMValueRef value = 0;
>
> @@ -1627,7 +1627,7 @@ static void declare_system_value(
> LLVMGetParam(radeon_bld->main_fn, SI_PARAM_POS_X_FLOAT),
> LLVMGetParam(radeon_bld->main_fn, SI_PARAM_POS_Y_FLOAT),
> LLVMGetParam(radeon_bld->main_fn, SI_PARAM_POS_Z_FLOAT),
> - lp_build_emit_llvm_unary(&radeon_bld->soa.bld_base, TGSI_OPCODE_RCP,
> + lp_build_emit_llvm_unary(&radeon_bld->bld_base, TGSI_OPCODE_RCP,
> LLVMGetParam(radeon_bld->main_fn,
> SI_PARAM_POS_W_FLOAT)),
> };
> @@ -1650,9 +1650,9 @@ static void declare_system_value(
> lp_build_const_float(gallivm, 0),
> lp_build_const_float(gallivm, 0)
> };
> - pos[0] = lp_build_emit_llvm_unary(&radeon_bld->soa.bld_base,
> + pos[0] = lp_build_emit_llvm_unary(&radeon_bld->bld_base,
> TGSI_OPCODE_FRC, pos[0]);
> - pos[1] = lp_build_emit_llvm_unary(&radeon_bld->soa.bld_base,
> + pos[1] = lp_build_emit_llvm_unary(&radeon_bld->bld_base,
> TGSI_OPCODE_FRC, pos[1]);
> value = lp_build_gather_values(gallivm, pos, 4);
> break;
> @@ -1708,7 +1708,7 @@ static void declare_system_value(
> addr = get_tcs_tes_buffer_address(ctx, NULL,
> lp_build_const_int32(gallivm, param));
>
> - value = buffer_load(&radeon_bld->soa.bld_base, TGSI_TYPE_FLOAT,
> + value = buffer_load(&radeon_bld->bld_base, TGSI_TYPE_FLOAT,
> ~0, buffer, base, addr);
>
> break;
> @@ -1733,7 +1733,7 @@ static void declare_system_value(
> }
>
> case TGSI_SEMANTIC_PRIMID:
> - value = get_primitive_id(&radeon_bld->soa.bld_base, 0);
> + value = get_primitive_id(&radeon_bld->bld_base, 0);
> break;
>
> case TGSI_SEMANTIC_GRID_SIZE:
> @@ -1797,7 +1797,7 @@ static void declare_compute_memory(struct si_shader_context *radeon_bld,
> const struct tgsi_full_declaration *decl)
> {
> struct si_shader_context *ctx =
> - si_shader_context(&radeon_bld->soa.bld_base);
> + si_shader_context(&radeon_bld->bld_base);
> struct si_shader_selector *sel = ctx->shader->selector;
> struct gallivm_state *gallivm = &radeon_bld->gallivm;
>
> @@ -1918,8 +1918,7 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base,
> LLVMValueRef *args)
> {
> struct si_shader_context *ctx = si_shader_context(bld_base);
> - struct lp_build_context *uint =
> - &ctx->soa.bld_base.uint_bld;
> + struct lp_build_context *uint = &ctx->bld_base.uint_bld;
> struct lp_build_context *base = &bld_base->base;
> struct gallivm_state *gallivm = base->gallivm;
> LLVMBuilderRef builder = base->gallivm->builder;
> @@ -2154,7 +2153,7 @@ static void si_llvm_emit_clipvertex(struct lp_build_tgsi_context *bld_base,
> {
> struct si_shader_context *ctx = si_shader_context(bld_base);
> struct lp_build_context *base = &bld_base->base;
> - struct lp_build_context *uint = &ctx->soa.bld_base.uint_bld;
> + struct lp_build_context *uint = &ctx->bld_base.uint_bld;
> unsigned reg_index;
> unsigned chan;
> unsigned const_chan;
> @@ -2362,8 +2361,7 @@ static void si_llvm_export_vs(struct lp_build_tgsi_context *bld_base,
> struct si_shader_context *ctx = si_shader_context(bld_base);
> struct si_shader *shader = ctx->shader;
> struct lp_build_context *base = &bld_base->base;
> - struct lp_build_context *uint =
> - &ctx->soa.bld_base.uint_bld;
> + struct lp_build_context *uint = &ctx->bld_base.uint_bld;
> LLVMValueRef args[9];
> LLVMValueRef pos_args[4][9] = { { 0 } };
> LLVMValueRef psize_value = NULL, edgeflag_value = NULL, layer_value = NULL, viewport_index_value = NULL;
> @@ -3661,7 +3659,7 @@ static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx,
> LLVMValueRef offset, ptr;
> int addr_space;
>
> - offset = lp_build_emit_fetch(&ctx->soa.bld_base, inst, arg, 0);
> + offset = lp_build_emit_fetch(&ctx->bld_base, inst, arg, 0);
> offset = LLVMBuildBitCast(builder, offset, ctx->i32, "");
>
> ptr = ctx->shared_memory;
> @@ -3677,7 +3675,7 @@ static void load_emit_memory(
> struct lp_build_emit_data *emit_data)
> {
> const struct tgsi_full_instruction *inst = emit_data->inst;
> - struct lp_build_context *base = &ctx->soa.bld_base.base;
> + struct lp_build_context *base = &ctx->bld_base.base;
> struct gallivm_state *gallivm = &ctx->gallivm;
> LLVMBuilderRef builder = gallivm->builder;
> unsigned writemask = inst->Dst[0].Register.WriteMask;
> @@ -3843,7 +3841,7 @@ static void store_emit_buffer(
> const struct tgsi_full_instruction *inst = emit_data->inst;
> struct gallivm_state *gallivm = &ctx->gallivm;
> LLVMBuilderRef builder = gallivm->builder;
> - struct lp_build_context *uint_bld = &ctx->soa.bld_base.uint_bld;
> + struct lp_build_context *uint_bld = &ctx->bld_base.uint_bld;
> LLVMValueRef base_data = emit_data->args[0];
> LLVMValueRef base_offset = emit_data->args[3];
> unsigned writemask = inst->Dst[0].Register.WriteMask;
> @@ -3914,7 +3912,7 @@ static void store_emit_memory(
> {
> const struct tgsi_full_instruction *inst = emit_data->inst;
> struct gallivm_state *gallivm = &ctx->gallivm;
> - struct lp_build_context *base = &ctx->soa.bld_base.base;
> + struct lp_build_context *base = &ctx->bld_base.base;
> LLVMBuilderRef builder = gallivm->builder;
> unsigned writemask = inst->Dst[0].Register.WriteMask;
> LLVMValueRef ptr, derived_ptr, data, index;
> @@ -3926,7 +3924,7 @@ static void store_emit_memory(
> if (!(writemask & (1 << chan))) {
> continue;
> }
> - data = lp_build_emit_fetch(&ctx->soa.bld_base, inst, 1, chan);
> + data = lp_build_emit_fetch(&ctx->bld_base, inst, 1, chan);
> index = lp_build_const_int32(gallivm, chan);
> derived_ptr = LLVMBuildGEP(builder, ptr, &index, 1, "");
> LLVMBuildStore(builder, data, derived_ptr);
> @@ -4044,12 +4042,12 @@ static void atomic_emit_memory(struct si_shader_context *ctx,
>
> ptr = get_memory_ptr(ctx, inst, ctx->i32, 1);
>
> - arg = lp_build_emit_fetch(&ctx->soa.bld_base, inst, 2, 0);
> + arg = lp_build_emit_fetch(&ctx->bld_base, inst, 2, 0);
> arg = LLVMBuildBitCast(builder, arg, ctx->i32, "");
>
> if (inst->Instruction.Opcode == TGSI_OPCODE_ATOMCAS) {
> LLVMValueRef new_data;
> - new_data = lp_build_emit_fetch(&ctx->soa.bld_base,
> + new_data = lp_build_emit_fetch(&ctx->bld_base,
> inst, 3, 0);
>
> new_data = LLVMBuildBitCast(builder, new_data, ctx->i32, "");
> @@ -4814,9 +4812,9 @@ static void si_lower_gather4_integer(struct si_shader_context *ctx,
> set_tex_fetch_args(ctx, &txq_emit_data, TGSI_OPCODE_TXQ,
> txq_inst.Texture.Texture,
> emit_data->args[1], NULL,
> - &ctx->soa.bld_base.uint_bld.zero,
> + &ctx->bld_base.uint_bld.zero,
> 1, 0xf);
> - txq_emit(NULL, &ctx->soa.bld_base, &txq_emit_data);
> + txq_emit(NULL, &ctx->bld_base, &txq_emit_data);
>
> /* Compute -0.5 / size. */
> for (c = 0; c < 2; c++) {
> @@ -4825,7 +4823,7 @@ static void si_lower_gather4_integer(struct si_shader_context *ctx,
> LLVMConstInt(ctx->i32, c, 0), "");
> half_texel[c] = LLVMBuildUIToFP(builder, half_texel[c], ctx->f32, "");
> half_texel[c] =
> - lp_build_emit_llvm_unary(&ctx->soa.bld_base,
> + lp_build_emit_llvm_unary(&ctx->bld_base,
> TGSI_OPCODE_RCP, half_texel[c]);
> half_texel[c] = LLVMBuildFMul(builder, half_texel[c],
> LLVMConstReal(ctx->f32, -0.5), "");
> @@ -5451,7 +5449,7 @@ static void si_create_function(struct si_shader_context *ctx,
>
> static void create_meta_data(struct si_shader_context *ctx)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
>
> ctx->invariant_load_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
> "invariant.load", 14);
> @@ -5514,7 +5512,7 @@ static unsigned llvm_get_type_size(LLVMTypeRef type)
> static void declare_tess_lds(struct si_shader_context *ctx)
> {
> struct gallivm_state *gallivm = &ctx->gallivm;
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> struct lp_build_context *uint = &bld_base->uint_bld;
>
> unsigned lds_size = ctx->screen->b.chip_class >= CIK ? 65536 : 32768;
> @@ -5542,7 +5540,7 @@ static unsigned si_get_max_workgroup_size(struct si_shader *shader)
>
> static void create_function(struct si_shader_context *ctx)
> {
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> struct gallivm_state *gallivm = bld_base->base.gallivm;
> struct si_shader *shader = ctx->shader;
> LLVMTypeRef params[SI_NUM_PARAMS + SI_NUM_VERTEX_BUFFERS], v3i32;
> @@ -5809,8 +5807,7 @@ static void create_function(struct si_shader_context *ctx)
> */
> static void preload_ring_buffers(struct si_shader_context *ctx)
> {
> - struct gallivm_state *gallivm =
> - ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> LLVMBuilderRef builder = gallivm->builder;
>
> LLVMValueRef buf_ptr = LLVMGetParam(ctx->main_fn,
> @@ -5837,7 +5834,7 @@ static void preload_ring_buffers(struct si_shader_context *ctx)
> build_indexed_load_const(ctx, buf_ptr, offset);
> } else if (ctx->type == PIPE_SHADER_GEOMETRY) {
> const struct si_shader_selector *sel = ctx->shader->selector;
> - struct lp_build_context *uint = &ctx->soa.bld_base.uint_bld;
> + struct lp_build_context *uint = &ctx->bld_base.uint_bld;
> LLVMValueRef offset = lp_build_const_int32(gallivm, SI_RING_GSVS);
> LLVMValueRef base_ring;
>
> @@ -5915,8 +5912,7 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
> LLVMValueRef param_rw_buffers,
> unsigned param_pos_fixed_pt)
> {
> - struct lp_build_tgsi_context *bld_base =
> - &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> struct gallivm_state *gallivm = bld_base->base.gallivm;
> LLVMBuilderRef builder = gallivm->builder;
> LLVMValueRef slot, desc, offset, row, bit, address[2];
> @@ -6412,7 +6408,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
> struct si_shader *shader;
> struct gallivm_state *gallivm = &ctx.gallivm;
> LLVMBuilderRef builder;
> - struct lp_build_tgsi_context *bld_base = &ctx.soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx.bld_base;
> struct lp_build_context *uint = &bld_base->uint_bld;
> struct si_shader_output_values *outputs;
> struct tgsi_shader_info *gsinfo = &gs_selector->info;
> @@ -6500,7 +6496,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
> for (unsigned chan = 0; chan < 4; chan++) {
> if (!(gsinfo->output_usagemask[i] & (1 << chan)) ||
> outputs[i].vertex_stream[chan] != stream) {
> - outputs[i].values[chan] = ctx.soa.bld_base.base.undef;
> + outputs[i].values[chan] = ctx.bld_base.base.undef;
> continue;
> }
>
> @@ -6650,7 +6646,7 @@ static void si_init_shader_ctx(struct si_shader_context *ctx,
> (shader && shader->selector) ? &shader->selector->info : NULL,
> (shader && shader->selector) ? shader->selector->tokens : NULL);
>
> - bld_base = &ctx->soa.bld_base;
> + bld_base = &ctx->bld_base;
> bld_base->emit_fetch_funcs[TGSI_FILE_CONSTANT] = fetch_constant;
>
> bld_base->op_actions[TGSI_OPCODE_INTERP_CENTROID] = interp_action;
> @@ -6896,7 +6892,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
> struct si_shader *shader)
> {
> struct si_shader_selector *sel = shader->selector;
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
>
> switch (ctx->type) {
> case PIPE_SHADER_VERTEX:
> @@ -7445,7 +7441,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
>
> shader->info.uses_instanceid = sel->info.uses_instanceid;
>
> - bld_base = &ctx.soa.bld_base;
> + bld_base = &ctx.bld_base;
> ctx.load_system_value = declare_system_value;
>
> if (!si_compile_tgsi_main(&ctx, shader)) {
> @@ -7844,7 +7840,7 @@ static void si_build_vs_epilog_function(struct si_shader_context *ctx,
> union si_shader_part_key *key)
> {
> struct gallivm_state *gallivm = &ctx->gallivm;
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> LLVMTypeRef params[5];
> int num_params, i;
>
> @@ -7965,7 +7961,7 @@ static void si_build_tcs_epilog_function(struct si_shader_context *ctx,
> union si_shader_part_key *key)
> {
> struct gallivm_state *gallivm = &ctx->gallivm;
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> LLVMTypeRef params[16];
> LLVMValueRef func;
> int last_sgpr, num_params;
> @@ -8300,7 +8296,7 @@ static void si_build_ps_epilog_function(struct si_shader_context *ctx,
> union si_shader_part_key *key)
> {
> struct gallivm_state *gallivm = &ctx->gallivm;
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
> LLVMTypeRef params[16+8*4+3];
> LLVMValueRef depth = NULL, stencil = NULL, samplemask = NULL;
> int last_sgpr, num_params, i;
> diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
> index 61ea49a02a..a28dec34c2 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_internal.h
> +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
> @@ -47,7 +47,7 @@ struct radeon_shader_binary;
> struct si_llvm_flow;
>
> struct si_shader_context {
> - struct lp_build_tgsi_soa_context soa;
> + struct lp_build_tgsi_context bld_base;
> struct gallivm_state gallivm;
> struct si_shader *shader;
> struct si_screen *screen;
> diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
> index 53b173e519..61de45474d 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
> @@ -383,7 +383,7 @@ get_temp_array_id(struct lp_build_tgsi_context *bld_base,
> const struct tgsi_ind_register *reg)
> {
> struct si_shader_context *ctx = si_shader_context(bld_base);
> - unsigned num_arrays = ctx->soa.bld_base.info->array_max[TGSI_FILE_TEMPORARY];
> + unsigned num_arrays = ctx->bld_base.info->array_max[TGSI_FILE_TEMPORARY];
> unsigned i;
>
> if (reg && reg->ArrayID > 0 && reg->ArrayID <= num_arrays)
> @@ -423,7 +423,7 @@ emit_array_index(struct si_shader_context *ctx,
> const struct tgsi_ind_register *reg,
> unsigned offset)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
>
> if (!reg) {
> return lp_build_const_int32(gallivm, offset);
> @@ -448,7 +448,7 @@ get_pointer_into_array(struct si_shader_context *ctx,
> {
> unsigned array_id;
> struct tgsi_array_info *array;
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> LLVMBuilderRef builder = gallivm->builder;
> LLVMValueRef idxs[2];
> LLVMValueRef index;
> @@ -457,7 +457,7 @@ get_pointer_into_array(struct si_shader_context *ctx,
> if (file != TGSI_FILE_TEMPORARY)
> return NULL;
>
> - array_id = get_temp_array_id(&ctx->soa.bld_base, reg_index, reg_indirect);
> + array_id = get_temp_array_id(&ctx->bld_base, reg_index, reg_indirect);
> if (!array_id)
> return NULL;
>
> @@ -497,7 +497,7 @@ get_pointer_into_array(struct si_shader_context *ctx,
> gallivm,
> util_bitcount(array->writemask & ((1 << swizzle) - 1))),
> "");
> - idxs[0] = ctx->soa.bld_base.uint_bld.zero;
> + idxs[0] = ctx->bld_base.uint_bld.zero;
> idxs[1] = index;
> return LLVMBuildGEP(builder, alloca, idxs, 2, "");
> }
> @@ -530,8 +530,9 @@ emit_array_fetch(struct lp_build_tgsi_context *bld_base,
> struct tgsi_declaration_range range,
> unsigned swizzle)
> {
> - struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
> - struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
> + struct si_shader_context *ctx = si_shader_context(bld_base);
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> +
> LLVMBuilderRef builder = bld_base->base.gallivm->builder;
>
> unsigned i, size = range.Last - range.First + 1;
> @@ -705,7 +706,7 @@ LLVMValueRef si_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base,
> * v_interp instructions are much cheaper than VMEM loads.
> */
> if (!si_preload_fs_inputs(ctx) &&
> - ctx->soa.bld_base.info->processor == PIPE_SHADER_FRAGMENT)
> + ctx->bld_base.info->processor == PIPE_SHADER_FRAGMENT)
> ctx->load_input(ctx, index, &ctx->input_decls[index], input);
> else
> memcpy(input, &ctx->inputs[index * 4], sizeof(input));
> @@ -782,7 +783,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
> for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
> ctx->addrs[idx][chan] = lp_build_alloca_undef(
> &ctx->gallivm,
> - ctx->soa.bld_base.uint_bld.elem_type, "");
> + ctx->bld_base.uint_bld.elem_type, "");
> }
> }
> break;
> @@ -932,7 +933,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
> #endif
> ctx->outputs[idx][chan] = lp_build_alloca_undef(
> &ctx->gallivm,
> - ctx->soa.bld_base.base.elem_type, name);
> + ctx->bld_base.base.elem_type, name);
> }
> }
> break;
> @@ -968,10 +969,9 @@ void si_llvm_emit_store(struct lp_build_tgsi_context *bld_base,
> LLVMValueRef dst[4])
> {
> struct si_shader_context *ctx = si_shader_context(bld_base);
> - struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
> - struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> const struct tgsi_full_dst_register *reg = &inst->Dst[0];
> - LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
> + LLVMBuilderRef builder = ctx->bld_base.base.gallivm->builder;
> LLVMValueRef temp_ptr, temp_ptr2 = NULL;
> unsigned chan, chan_index;
> bool is_vec_store = false;
> @@ -1273,7 +1273,7 @@ void si_llvm_context_init(struct si_shader_context *ctx,
> ctx->gallivm.builder = lp_create_builder(ctx->gallivm.context,
> unsafe_fpmath);
>
> - struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
> + struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
>
> bld_base->info = info;
>
> @@ -1301,12 +1301,12 @@ void si_llvm_context_init(struct si_shader_context *ctx,
> type.length = 1;
>
> lp_build_context_init(&bld_base->base, &ctx->gallivm, type);
> - lp_build_context_init(&ctx->soa.bld_base.uint_bld, &ctx->gallivm, lp_uint_type(type));
> - lp_build_context_init(&ctx->soa.bld_base.int_bld, &ctx->gallivm, lp_int_type(type));
> + lp_build_context_init(&ctx->bld_base.uint_bld, &ctx->gallivm, lp_uint_type(type));
> + lp_build_context_init(&ctx->bld_base.int_bld, &ctx->gallivm, lp_int_type(type));
> type.width *= 2;
> - lp_build_context_init(&ctx->soa.bld_base.dbl_bld, &ctx->gallivm, type);
> - lp_build_context_init(&ctx->soa.bld_base.uint64_bld, &ctx->gallivm, lp_uint_type(type));
> - lp_build_context_init(&ctx->soa.bld_base.int64_bld, &ctx->gallivm, lp_int_type(type));
> + lp_build_context_init(&ctx->bld_base.dbl_bld, &ctx->gallivm, type);
> + lp_build_context_init(&ctx->bld_base.uint64_bld, &ctx->gallivm, lp_uint_type(type));
> + lp_build_context_init(&ctx->bld_base.int64_bld, &ctx->gallivm, lp_int_type(type));
>
> bld_base->soa = 1;
> bld_base->emit_store = si_llvm_emit_store;
> @@ -1336,7 +1336,7 @@ void si_llvm_context_init(struct si_shader_context *ctx,
> bld_base->op_actions[TGSI_OPCODE_ENDIF].emit = endif_emit;
> bld_base->op_actions[TGSI_OPCODE_ENDLOOP].emit = endloop_emit;
>
> - si_shader_context_init_alu(&ctx->soa.bld_base);
> + si_shader_context_init_alu(&ctx->bld_base);
>
> ctx->voidt = LLVMVoidTypeInContext(ctx->gallivm.context);
> ctx->i1 = LLVMInt1TypeInContext(ctx->gallivm.context);
> @@ -1379,7 +1379,7 @@ void si_llvm_create_func(struct si_shader_context *ctx,
> void si_llvm_finalize_module(struct si_shader_context *ctx,
> bool run_verifier)
> {
> - struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
> + struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
> const char *triple = LLVMGetTarget(gallivm->module);
> LLVMTargetLibraryInfoRef target_library_info;
>
> @@ -1414,8 +1414,8 @@ void si_llvm_finalize_module(struct si_shader_context *ctx,
>
> void si_llvm_dispose(struct si_shader_context *ctx)
> {
> - LLVMDisposeModule(ctx->soa.bld_base.base.gallivm->module);
> - LLVMContextDispose(ctx->soa.bld_base.base.gallivm->context);
> + LLVMDisposeModule(ctx->bld_base.base.gallivm->module);
> + LLVMContextDispose(ctx->bld_base.base.gallivm->context);
> FREE(ctx->temp_arrays);
> ctx->temp_arrays = NULL;
> FREE(ctx->temp_array_allocas);
>
More information about the mesa-dev
mailing list