radv: set prim_id for geometry shaders
authorDave Airlie <airlied@redhat.com>
Tue, 20 Jun 2017 04:03:10 +0000 (14:03 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 25 Jun 2017 22:45:22 +0000 (08:45 +1000)
Noticed in passing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_nir_to_llvm.h
src/amd/vulkan/si_cmd_buffer.c

index 4d9c070dabe94cee25923dfbef1378aba9193331..afef3fd28d49e6b685d8a2a01749445192845d4f 100644 (file)
@@ -3867,9 +3867,10 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx,
                        result = ctx->gs_invocation_id;
                break;
        case nir_intrinsic_load_primitive_id:
-               if (ctx->stage == MESA_SHADER_GEOMETRY)
+               if (ctx->stage == MESA_SHADER_GEOMETRY) {
+                       ctx->shader_info->gs.uses_prim_id = true;
                        result = ctx->gs_prim_id;
-               else if (ctx->stage == MESA_SHADER_TESS_CTRL) {
+               else if (ctx->stage == MESA_SHADER_TESS_CTRL) {
                        ctx->shader_info->tcs.uses_prim_id = true;
                        result = ctx->tcs_patch_id;
                } else if (ctx->stage == MESA_SHADER_TESS_EVAL) {
index 9ea3156b255d183405219682d7a851ac61f1ee5d..724d5e6b0fd5838e7b42780ba2cfcdfa4bded88f 100644 (file)
@@ -178,6 +178,7 @@ 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;
index 962b76fe9d93b3515479f1933c78ad138c64f0b3..86e8e3e4986bbd74254ccf51c934d1c16ee243d0 100644 (file)
@@ -789,6 +789,11 @@ si_get_ia_multi_vgt_param(struct radv_cmd_buffer *cmd_buffer,
                partial_es_wave = true;
 
        if (radv_pipeline_has_gs(cmd_buffer->state.pipeline)) {
+
+               if (radv_pipeline_has_gs(cmd_buffer->state.pipeline) &&
+                   cmd_buffer->state.pipeline->shaders[MESA_SHADER_GEOMETRY]->info.gs.uses_prim_id)
+                       ia_switch_on_eoi = true;
+
                /* GS requirement. */
                if (SI_GS_PER_ES / primgroup_size >= cmd_buffer->device->gs_table_depth - 3)
                        partial_es_wave = true;