diff options
author | Timothy Arceri <[email protected]> | 2017-11-09 14:43:34 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-11-12 11:08:26 +1100 |
commit | dc42a2177c852f7737452408586f3da7cb7682f9 (patch) | |
tree | 8aeca69d1d946beaf2b526fbfbb7de9734b92757 | |
parent | 8c9f3f2c46653a94be9ded38763f81da20183e08 (diff) |
radeonsi: rework gs_vtx_offset handling
This simplifies things a bit and will enable it to work with the
common NIR -> LLVM code.
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 25 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_internal.h | 7 |
2 files changed, 10 insertions, 22 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 9a03311d5b6..afb9c10a79d 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1361,16 +1361,9 @@ static LLVMValueRef fetch_input_gs( /* Get the vertex offset parameter on GFX6. */ unsigned vtx_offset_param = reg->Dimension.Index; - if (vtx_offset_param < 2) { - vtx_offset_param += ctx->param_gs_vtx0_offset; - } else { - assert(vtx_offset_param < 6); - vtx_offset_param += ctx->param_gs_vtx2_offset - 2; - } - vtx_offset = lp_build_mul_imm(uint, - LLVMGetParam(ctx->main_fn, - vtx_offset_param), - 4); + LLVMValueRef gs_vtx_offset = ctx->gs_vtx_offset[vtx_offset_param]; + + vtx_offset = lp_build_mul_imm(uint, gs_vtx_offset, 4); soffset = LLVMConstInt(ctx->i32, (param * 4 + swizzle) * 256, 0); @@ -4612,13 +4605,13 @@ static void create_function(struct si_shader_context *ctx) ctx->param_gs_wave_id = add_arg(&fninfo, ARG_SGPR, ctx->i32); /* VGPRs */ - ctx->param_gs_vtx0_offset = add_arg(&fninfo, ARG_VGPR, ctx->i32); - ctx->param_gs_vtx1_offset = add_arg(&fninfo, ARG_VGPR, ctx->i32); + add_arg_assign(&fninfo, ARG_VGPR, ctx->i32, &ctx->gs_vtx_offset[0]); + add_arg_assign(&fninfo, ARG_VGPR, ctx->i32, &ctx->gs_vtx_offset[1]); ctx->param_gs_prim_id = add_arg(&fninfo, ARG_VGPR, ctx->i32); - ctx->param_gs_vtx2_offset = add_arg(&fninfo, ARG_VGPR, ctx->i32); - ctx->param_gs_vtx3_offset = add_arg(&fninfo, ARG_VGPR, ctx->i32); - ctx->param_gs_vtx4_offset = add_arg(&fninfo, ARG_VGPR, ctx->i32); - ctx->param_gs_vtx5_offset = add_arg(&fninfo, ARG_VGPR, ctx->i32); + add_arg_assign(&fninfo, ARG_VGPR, ctx->i32, &ctx->gs_vtx_offset[2]); + add_arg_assign(&fninfo, ARG_VGPR, ctx->i32, &ctx->gs_vtx_offset[3]); + add_arg_assign(&fninfo, ARG_VGPR, ctx->i32, &ctx->gs_vtx_offset[4]); + add_arg_assign(&fninfo, ARG_VGPR, ctx->i32, &ctx->gs_vtx_offset[5]); ctx->param_gs_instance_id = add_arg(&fninfo, ARG_VGPR, ctx->i32); break; diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index b249bf961ab..7ff8815b92f 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -182,13 +182,8 @@ struct si_shader_context { /* API GS */ int param_gs2vs_offset; int param_gs_wave_id; /* GFX6 */ - int param_gs_vtx0_offset; /* in dwords (GFX6) */ - int param_gs_vtx1_offset; /* in dwords (GFX6) */ + LLVMValueRef gs_vtx_offset[6]; /* in dwords (GFX6) */ int param_gs_prim_id; - int param_gs_vtx2_offset; /* in dwords (GFX6) */ - int param_gs_vtx3_offset; /* in dwords (GFX6) */ - int param_gs_vtx4_offset; /* in dwords (GFX6) */ - int param_gs_vtx5_offset; /* in dwords (GFX6) */ int param_gs_instance_id; int param_gs_vtx01_offset; /* in dwords (GFX9) */ int param_gs_vtx23_offset; /* in dwords (GFX9) */ |