diff options
author | Marek Olšák <[email protected]> | 2017-04-19 03:34:03 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-04-28 21:47:35 +0200 |
commit | 37e22ab65e852fc585650f6df26d976e7306acce (patch) | |
tree | a3a7eaf97f0818449728e08bebc7de4f04892cfb | |
parent | d616c573425e8ee57d4f78b72c59b7c6e0fa1a1e (diff) |
radeonsi/gfx9: store ES outputs to LDS
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index ab6e125607f..4899837abfe 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2840,28 +2840,41 @@ static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context *bld_base) struct tgsi_shader_info *info = &es->selector->info; LLVMValueRef soffset = LLVMGetParam(ctx->main_fn, ctx->param_es2gs_offset); + LLVMValueRef lds_base = NULL; unsigned chan; int i; + if (ctx->screen->b.chip_class >= GFX9 && info->num_outputs) { + unsigned itemsize_dw = es->selector->esgs_itemsize / 4; + lds_base = LLVMBuildMul(gallivm->builder, ac_get_thread_id(&ctx->ac), + LLVMConstInt(ctx->i32, itemsize_dw, 0), ""); + } + for (i = 0; i < info->num_outputs; i++) { LLVMValueRef *out_ptr = ctx->outputs[i]; - int param_index; + int param; if (info->output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX || info->output_semantic_name[i] == TGSI_SEMANTIC_LAYER) continue; - param_index = si_shader_io_get_unique_index(info->output_semantic_name[i], - info->output_semantic_index[i]); + param = si_shader_io_get_unique_index(info->output_semantic_name[i], + info->output_semantic_index[i]); for (chan = 0; chan < 4; chan++) { LLVMValueRef out_val = LLVMBuildLoad(gallivm->builder, out_ptr[chan], ""); out_val = LLVMBuildBitCast(gallivm->builder, out_val, ctx->i32, ""); + /* GFX9 has the ESGS ring in LDS. */ + if (ctx->screen->b.chip_class >= GFX9) { + lds_store(bld_base, param * 4 + chan, lds_base, out_val); + continue; + } + ac_build_buffer_store_dword(&ctx->ac, ctx->esgs_ring, out_val, 1, NULL, soffset, - (4 * param_index + chan) * 4, + (4 * param + chan) * 4, 1, 1, true, true); } } |