[Mesa-dev] [PATCH 2/2] ac/radeonsi: add load_base_vertex() to the abi
Marek Olšák
maraeo at gmail.com
Tue Feb 27 19:30:30 UTC 2018
For the series:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Mon, Feb 26, 2018 at 12:29 PM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Fixes the following piglit tests:
>
> ./bin/arb_shader_draw_parameters-basevertex basevertex -auto -fbo
> ./bin/arb_shader_draw_parameters-basevertex basevertex-baseinstance -auto -fbo
> ---
> src/amd/common/ac_nir_to_llvm.c | 8 +++++++-
> src/amd/common/ac_shader_abi.h | 2 ++
> src/gallium/drivers/radeonsi/si_shader.c | 1 +
> 3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 789928761b..c277ed5322 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -4389,7 +4389,7 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
> break;
> }
> case nir_intrinsic_load_base_vertex: {
> - result = ctx->abi->base_vertex;
> + result = ctx->abi->load_base_vertex(ctx->abi);
> break;
> }
> case nir_intrinsic_load_local_group_size:
> @@ -4630,6 +4630,11 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
> }
> }
>
> +static LLVMValueRef radv_load_base_vertex(struct ac_shader_abi *abi)
> +{
> + return abi->base_vertex;
> +}
> +
> static LLVMValueRef radv_load_ssbo(struct ac_shader_abi *abi,
> LLVMValueRef buffer_ptr, bool write)
> {
> @@ -6910,6 +6915,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
> ctx.gs_max_out_vertices = shaders[i]->info.gs.vertices_out;
> ctx.abi.load_inputs = load_gs_input;
> ctx.abi.emit_primitive = visit_end_primitive;
> + ctx.abi.load_base_vertex = radv_load_base_vertex;
> } else if (shaders[i]->info.stage == MESA_SHADER_TESS_CTRL) {
> ctx.tcs_outputs_read = shaders[i]->info.outputs_read;
> ctx.tcs_patch_outputs_read = shaders[i]->info.patch_outputs_read;
> diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h
> index 75fd8ed554..ccf26648a2 100644
> --- a/src/amd/common/ac_shader_abi.h
> +++ b/src/amd/common/ac_shader_abi.h
> @@ -183,6 +183,8 @@ struct ac_shader_abi {
>
> LLVMValueRef (*load_sample_mask_in)(struct ac_shader_abi *abi);
>
> + LLVMValueRef (*load_base_vertex)(struct ac_shader_abi *abi);
> +
> /* Whether to clamp the shadow reference value to [0,1]on VI. Radeonsi currently
> * uses it due to promoting D16 to D32, but radv needs it off. */
> bool clamp_shadow_reference;
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index adcb03f23f..8774bcab1d 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -6003,6 +6003,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
> else
> ctx->abi.emit_outputs = si_llvm_emit_vs_epilogue;
> bld_base->emit_epilogue = si_tgsi_emit_epilogue;
> + ctx->abi.load_base_vertex = get_base_vertex;
> break;
> case PIPE_SHADER_TESS_CTRL:
> bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tcs;
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list