summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amd/llvm/ac_nir_to_llvm.c7
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_internal.h3
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_llvm.c27
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_llvm_gs.c54
5 files changed, 4 insertions, 91 deletions
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 1848ac10ab0..fb09193443b 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -3473,13 +3473,6 @@ static LLVMValueRef visit_load(struct ac_nir_context *ctx, nir_intrinsic_instr *
/* No indirect indexing is allowed after this point. */
assert(!indir_index);
- if (ctx->stage == MESA_SHADER_GEOMETRY) {
- assert(nir_src_is_const(*vertex_index_src));
-
- return ctx->abi->load_inputs(ctx->abi, base, component, count,
- nir_src_as_uint(*vertex_index_src), component_type);
- }
-
if (ctx->stage == MESA_SHADER_FRAGMENT && is_output &&
nir_intrinsic_io_semantics(instr).fb_fetch_output)
return ctx->abi->emit_fbfetch(ctx->abi);
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index a439923fcff..720d09cac92 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1539,6 +1539,10 @@ static bool si_lower_io_to_mem(struct si_shader *shader, nir_shader *nir,
}
return true;
+ } else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
+ NIR_PASS_V(nir, ac_nir_lower_gs_inputs_to_mem, si_map_io_driver_location,
+ sel->screen->info.gfx_level, key->ge.mono.u.gs_tri_strip_adj_fix);
+ return true;
}
return false;
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index f4f4ed89fd9..348a20d06cc 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -136,9 +136,6 @@ struct si_shader_context {
struct ac_llvm_compiler *compiler;
- /* GS vertex offsets unpacked with the gfx6-9 tristrip_adj bug workaround. */
- LLVMValueRef gs_vtx_offset[6];
-
/* Preloaded descriptors. */
LLVMValueRef esgs_ring;
LLVMValueRef gsvs_ring[4];
diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm.c b/src/gallium/drivers/radeonsi/si_shader_llvm.c
index 12585b18ff2..a02e1ace0e9 100644
--- a/src/gallium/drivers/radeonsi/si_shader_llvm.c
+++ b/src/gallium/drivers/radeonsi/si_shader_llvm.c
@@ -1046,33 +1046,6 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
}
}
- if (nir->info.stage == MESA_SHADER_GEOMETRY) {
- /* Unpack GS vertex offsets. */
- for (unsigned i = 0; i < 6; i++) {
- if (ctx->screen->info.gfx_level >= GFX9) {
- ctx->gs_vtx_offset[i] = si_unpack_param(ctx, ctx->args.gs_vtx_offset[i / 2], (i & 1) * 16, 16);
- } else {
- ctx->gs_vtx_offset[i] = ac_get_arg(&ctx->ac, ctx->args.gs_vtx_offset[i]);
- }
- }
-
- /* Apply the hw bug workaround for triangle strips with adjacency. */
- if (ctx->screen->info.gfx_level <= GFX9 &&
- ctx->shader->key.ge.mono.u.gs_tri_strip_adj_fix) {
- LLVMValueRef prim_id = ac_get_arg(&ctx->ac, ctx->args.gs_prim_id);
- /* Remap GS vertex offsets for every other primitive. */
- LLVMValueRef rotate = LLVMBuildTrunc(ctx->ac.builder, prim_id, ctx->ac.i1, "");
- LLVMValueRef fixed[6];
-
- for (unsigned i = 0; i < 6; i++) {
- fixed[i] = LLVMBuildSelect(ctx->ac.builder, rotate,
- ctx->gs_vtx_offset[(i + 4) % 6],
- ctx->gs_vtx_offset[i], "");
- }
- memcpy(ctx->gs_vtx_offset, fixed, sizeof(fixed));
- }
- }
-
ctx->abi.clamp_shadow_reference = true;
ctx->abi.robust_buffer_access = true;
ctx->abi.convert_undef_to_zero = true;
diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
index 54c9b629296..47a82dd1c53 100644
--- a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
+++ b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
@@ -43,59 +43,6 @@ LLVMValueRef si_is_gs_thread(struct si_shader_context *ctx)
si_unpack_param(ctx, ctx->args.merged_wave_info, 8, 8), "");
}
-static LLVMValueRef si_llvm_load_input_gs(struct ac_shader_abi *abi, unsigned input_index,
- unsigned vtx_offset_param, LLVMTypeRef type,
- unsigned swizzle)
-{
- struct si_shader_context *ctx = si_shader_context_from_abi(abi);
- struct si_shader *shader = ctx->shader;
- LLVMValueRef vtx_offset, soffset;
- struct si_shader_info *info = &shader->selector->info;
- unsigned param;
- LLVMValueRef value;
-
- param = si_shader_io_get_unique_index(info->input[input_index].semantic, false);
-
- /* GFX9 has the ESGS ring in LDS. */
- if (ctx->screen->info.gfx_level >= GFX9) {
- unsigned offset = param * 4 + swizzle;
-
- vtx_offset = LLVMBuildAdd(ctx->ac.builder, ctx->gs_vtx_offset[vtx_offset_param],
- LLVMConstInt(ctx->ac.i32, offset, false), "");
-
- LLVMValueRef ptr = ac_build_gep0(&ctx->ac, ctx->esgs_ring, vtx_offset);
- LLVMValueRef value = LLVMBuildLoad(ctx->ac.builder, ptr, "");
- return LLVMBuildBitCast(ctx->ac.builder, value, type, "");
- }
-
- /* GFX6: input load from the ESGS ring in memory. */
- /* Get the vertex offset parameter on GFX6. */
- vtx_offset = LLVMBuildMul(ctx->ac.builder, ctx->gs_vtx_offset[vtx_offset_param],
- LLVMConstInt(ctx->ac.i32, 4, 0), "");
-
- soffset = LLVMConstInt(ctx->ac.i32, (param * 4 + swizzle) * 256, 0);
-
- value = ac_build_buffer_load(&ctx->ac, ctx->esgs_ring, 1, ctx->ac.i32_0, vtx_offset, soffset,
- ctx->ac.f32, ac_glc, true, false);
- return LLVMBuildBitCast(ctx->ac.builder, value, type, "");
-}
-
-static LLVMValueRef si_nir_load_input_gs(struct ac_shader_abi *abi,
- unsigned driver_location, unsigned component,
- unsigned num_components, unsigned vertex_index,
- LLVMTypeRef type)
-{
- struct si_shader_context *ctx = si_shader_context_from_abi(abi);
-
- LLVMValueRef value[4];
- for (unsigned i = component; i < component + num_components; i++) {
- value[i] = si_llvm_load_input_gs(&ctx->abi, driver_location,
- vertex_index, type, i);
- }
-
- return ac_build_varying_gather_values(&ctx->ac, value, num_components, component);
-}
-
/* Pass GS inputs from ES to GS on GFX9. */
static void si_set_es_return_value_for_gs(struct si_shader_context *ctx)
{
@@ -591,7 +538,6 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
void si_llvm_init_gs_callbacks(struct si_shader_context *ctx)
{
- ctx->abi.load_inputs = si_nir_load_input_gs;
ctx->abi.emit_vertex = si_llvm_emit_vertex;
ctx->abi.emit_primitive = si_llvm_emit_primitive;
}