summaryrefslogtreecommitdiffstats
path: root/src/amd/common
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-12-20 20:56:56 +0100
committerSamuel Pitoiset <[email protected]>2018-01-04 18:43:09 +0100
commita4d2782664a215fd90d9c92a3eded3e893501420 (patch)
tree1a1786782d9f3294dbb7ee638057daf2ba811700 /src/amd/common
parent3b2cb2f99ae8f82dd172f8486753637ae580d571 (diff)
amd/common: scan if gl_PrimitiveID is used before translating to LLVM
It makes more sense to move all scan stuff in the same place. Also, we don't really need to duplicate the uses_primid field for each stages. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c4
-rw-r--r--src/amd/common/ac_nir_to_llvm.h3
-rw-r--r--src/amd/common/ac_shader_info.c3
-rw-r--r--src/amd/common/ac_shader_info.h1
4 files changed, 4 insertions, 7 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 864f58b56d0..f1db730a25c 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -4209,14 +4209,10 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
break;
case nir_intrinsic_load_primitive_id:
if (ctx->stage == MESA_SHADER_GEOMETRY) {
- if (ctx->nctx)
- ctx->nctx->shader_info->gs.uses_prim_id = true;
result = ctx->abi->gs_prim_id;
} else if (ctx->stage == MESA_SHADER_TESS_CTRL) {
- ctx->nctx->shader_info->tcs.uses_prim_id = true;
result = ctx->nctx->tcs_patch_id;
} else if (ctx->stage == MESA_SHADER_TESS_EVAL) {
- ctx->nctx->shader_info->tcs.uses_prim_id = true;
result = ctx->nctx->tes_patch_id;
} else
fprintf(stderr, "Unknown primitive id intrinsic: %d", ctx->stage);
diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/common/ac_nir_to_llvm.h
index 1d9ec8ce8b0..6c59ab916ce 100644
--- a/src/amd/common/ac_nir_to_llvm.h
+++ b/src/amd/common/ac_nir_to_llvm.h
@@ -191,10 +191,8 @@ struct ac_shader_variant_info {
unsigned invocations;
unsigned gsvs_vertex_size;
unsigned max_gsvs_emit_size;
- bool uses_prim_id;
} gs;
struct {
- bool uses_prim_id;
unsigned tcs_vertices_out;
/* Which outputs are actually written */
uint64_t outputs_written;
@@ -210,7 +208,6 @@ struct ac_shader_variant_info {
enum gl_tess_spacing spacing;
bool ccw;
bool point_mode;
- bool uses_prim_id;
} tes;
};
};
diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index 5dac1131bd0..27896a26bb4 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -73,6 +73,9 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
case nir_intrinsic_load_invocation_id:
info->uses_invocation_id = true;
break;
+ case nir_intrinsic_load_primitive_id:
+ info->uses_prim_id = true;
+ break;
case nir_intrinsic_vulkan_resource_index:
info->desc_set_used_mask |= (1 << nir_intrinsic_desc_set(instr));
break;
diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index 7c79d1a728e..437859f8910 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -32,6 +32,7 @@ struct ac_shader_info {
uint32_t desc_set_used_mask;
bool needs_multiview_view_index;
bool uses_invocation_id;
+ bool uses_prim_id;
struct {
bool has_vertex_buffers; /* needs vertex buffers and base/start */
bool needs_draw_id;