radv/gfx10: add support for NGG passthrough mode
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 9 Jan 2020 07:24:11 +0000 (08:24 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 13 Jan 2020 07:14:45 +0000 (08:14 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c
src/amd/vulkan/radv_pipeline.c

index e646ea4f93c6bb7df8e23174ccdbc298d783a57f..e870a38e059df9eaa12039b5dcc4fd09de9d1a57 100644 (file)
@@ -2974,15 +2974,19 @@ handle_ngg_outputs_post_2(struct radv_shader_context *ctx)
        {
                struct ac_ngg_prim prim = {};
 
-               prim.num_vertices = num_vertices;
-               prim.isnull = ctx->ac.i1false;
-               memcpy(prim.index, vtxindex, sizeof(vtxindex[0]) * 3);
-
-               for (unsigned i = 0; i < num_vertices; ++i) {
-                       tmp = LLVMBuildLShr(builder,
-                                           ac_get_arg(&ctx->ac, ctx->args->ac.gs_invocation_id),
-                                           LLVMConstInt(ctx->ac.i32, 8 + i, false), "");
-                       prim.edgeflag[i] = LLVMBuildTrunc(builder, tmp, ctx->ac.i1, "");
+               if (ctx->args->options->key.vs_common_out.as_ngg_passthrough) {
+                       prim.passthrough = ac_get_arg(&ctx->ac, ctx->args->gs_vtx_offset[0]);
+               } else {
+                       prim.num_vertices = num_vertices;
+                       prim.isnull = ctx->ac.i1false;
+                       memcpy(prim.index, vtxindex, sizeof(vtxindex[0]) * 3);
+
+                       for (unsigned i = 0; i < num_vertices; ++i) {
+                               tmp = LLVMBuildLShr(builder,
+                                                   ac_get_arg(&ctx->ac, ctx->args->ac.gs_invocation_id),
+                                                   LLVMConstInt(ctx->ac.i32, 8 + i, false), "");
+                               prim.edgeflag[i] = LLVMBuildTrunc(builder, tmp, ctx->ac.i1, "");
+                       }
                }
 
                ac_build_export_prim(&ctx->ac, &prim);
index 12fea44bed853709a447c89125125035f0de5f44..dcc9518bfe9ed54f1137fb4550ac1212f38bddd1 100644 (file)
@@ -4475,6 +4475,8 @@ radv_compute_vgt_shader_stages_en(const struct radv_pipeline *pipeline)
                stages |= S_028B54_PRIMGEN_EN(1);
                if (pipeline->streamout_shader)
                        stages |= S_028B54_NGG_WAVE_ID_EN(1);
+               if (radv_pipeline_has_ngg_passthrough(pipeline))
+                       stages |= S_028B54_PRIMGEN_PASSTHRU_EN(1);
        } else if (radv_pipeline_has_gs(pipeline)) {
                stages |= S_028B54_VS_EN(V_028B54_VS_STAGE_COPY_SHADER);
        }