Mesa (master): radeonsi/gfx10: separate code for getting edgeflags from the gs_invocation_id VGPR
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 15 20:07:45 UTC 2020
Module: Mesa
Branch: master
Commit: 7a25521f92817c28790c59a00a21bd5b11d09e3b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a25521f92817c28790c59a00a21bd5b11d09e3b
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Jan 3 16:25:48 2020 -0500
radeonsi/gfx10: separate code for getting edgeflags from the gs_invocation_id VGPR
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
---
src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
index f951c8ca6d7..0eb422a7686 100644
--- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
+++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
@@ -71,6 +71,18 @@ static LLVMValueRef ngg_get_query_buf(struct si_shader_context *ctx)
LLVMConstInt(ctx->i32, GFX10_GS_QUERY_BUF, false));
}
+static LLVMValueRef ngg_get_initial_edgeflag(struct si_shader_context *ctx, unsigned index)
+{
+ if (ctx->type == PIPE_SHADER_VERTEX) {
+ LLVMValueRef tmp;
+ tmp = LLVMBuildLShr(ctx->ac.builder,
+ ac_get_arg(&ctx->ac, ctx->args.gs_invocation_id),
+ LLVMConstInt(ctx->ac.i32, 8 + index, false), "");
+ return LLVMBuildTrunc(ctx->ac.builder, tmp, ctx->ac.i1, "");
+ }
+ return ctx->i1false;
+}
+
static void build_streamout_vertex(struct si_shader_context *ctx,
LLVMValueRef *so_buffer, LLVMValueRef *wg_offset_dw,
unsigned stream, LLVMValueRef offset_vtx,
@@ -668,15 +680,7 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
memcpy(prim.index, vtxindex, sizeof(vtxindex[0]) * 3);
for (unsigned i = 0; i < num_vertices; ++i) {
- if (ctx->type != PIPE_SHADER_VERTEX) {
- prim.edgeflag[i] = ctx->i1false;
- continue;
- }
-
- tmp = LLVMBuildLShr(builder,
- ac_get_arg(&ctx->ac, ctx->args.gs_invocation_id),
- LLVMConstInt(ctx->ac.i32, 8 + i, false), "");
- prim.edgeflag[i] = LLVMBuildTrunc(builder, tmp, ctx->ac.i1, "");
+ prim.edgeflag[i] = ngg_get_initial_edgeflag(ctx, i);
if (sel->info.writes_edgeflag) {
tmp2 = LLVMBuildLoad(builder, user_edgeflags[i], "");
More information about the mesa-commit
mailing list