diff options
author | Samuel Pitoiset <[email protected]> | 2018-09-13 15:58:02 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-09-14 10:59:52 +0200 |
commit | c28ea92947ca7af205420be7789704e62c44ddd7 (patch) | |
tree | eb0ba91d12d60055d5c1880e38e101c6a76cfa5e | |
parent | 40fb8c7fcabbbff2bb7fc8fe8f154e10baaaf138 (diff) |
radv: tidy up ac_setup_rings() for the GSVS rings
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_nir_to_llvm.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index a6dbcd2a8b1..838e026c8e9 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -3135,21 +3135,42 @@ ac_setup_rings(struct radv_shader_context *ctx) } if (ctx->is_gs_copy_shader) { - ctx->gsvs_ring = ac_build_load_to_sgpr(&ctx->ac, ctx->ring_offsets, LLVMConstInt(ctx->ac.i32, RING_GSVS_VS, false)); + ctx->gsvs_ring = + ac_build_load_to_sgpr(&ctx->ac, ctx->ring_offsets, + LLVMConstInt(ctx->ac.i32, + RING_GSVS_VS, false)); } + if (ctx->stage == MESA_SHADER_GEOMETRY) { - LLVMValueRef tmp; - uint32_t num_entries = 64; - LLVMValueRef gsvs_ring_desc = LLVMConstInt(ctx->ac.i32, ctx->max_gsvs_emit_size << 16, false); - ctx->gsvs_ring = ac_build_load_to_sgpr(&ctx->ac, ctx->ring_offsets, LLVMConstInt(ctx->ac.i32, RING_GSVS_GS, false)); - - ctx->gsvs_ring = LLVMBuildBitCast(ctx->ac.builder, ctx->gsvs_ring, ctx->ac.v4i32, ""); - - tmp = LLVMConstInt(ctx->ac.i32, num_entries, false); - ctx->gsvs_ring = LLVMBuildInsertElement(ctx->ac.builder, ctx->gsvs_ring, tmp, LLVMConstInt(ctx->ac.i32, 2, false), ""); - tmp = LLVMBuildExtractElement(ctx->ac.builder, ctx->gsvs_ring, ctx->ac.i32_1, ""); - tmp = LLVMBuildOr(ctx->ac.builder, tmp, gsvs_ring_desc, ""); - ctx->gsvs_ring = LLVMBuildInsertElement(ctx->ac.builder, ctx->gsvs_ring, tmp, ctx->ac.i32_1, ""); + unsigned num_records = 64; + LLVMValueRef base_ring; + LLVMValueRef ring, tmp; + unsigned stride; + + base_ring = + ac_build_load_to_sgpr(&ctx->ac, ctx->ring_offsets, + LLVMConstInt(ctx->ac.i32, + RING_GSVS_GS, false)); + + stride = ctx->max_gsvs_emit_size; + + ring = LLVMBuildBitCast(ctx->ac.builder, base_ring, + ctx->ac.v4i32, ""); + + tmp = LLVMBuildExtractElement(ctx->ac.builder, ring, + ctx->ac.i32_1, ""); + tmp = LLVMBuildOr(ctx->ac.builder, tmp, + LLVMConstInt(ctx->ac.i32, + S_008F04_STRIDE(stride), false), ""); + ring = LLVMBuildInsertElement(ctx->ac.builder, ring, tmp, + ctx->ac.i32_1, ""); + + ring = LLVMBuildInsertElement(ctx->ac.builder, ring, + LLVMConstInt(ctx->ac.i32, + num_records, false), + LLVMConstInt(ctx->ac.i32, 2, false), ""); + + ctx->gsvs_ring = ring; } if (ctx->stage == MESA_SHADER_TESS_CTRL || |