radv/gfx10: do not declare LDS for NGG if useless
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 8 Jan 2020 07:39:10 +0000 (08:39 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 13 Jan 2020 07:14:43 +0000 (08:14 +0100)
Only needed for NGG without passthrough mode or for NGG streamout.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c

index 5a321a0677f6377dfbb1c6a6b56a80414a32a743..e646ea4f93c6bb7df8e23174ccdbc298d783a57f 100644 (file)
@@ -4084,16 +4084,19 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
                 * Add an extra dword per vertex to ensure an odd stride, which
                 * avoids bank conflicts for SoA accesses.
                 */
-               declare_esgs_ring(&ctx);
+               if (!args->options->key.vs_common_out.as_ngg_passthrough)
+                       declare_esgs_ring(&ctx);
 
                /* This is really only needed when streamout and / or vertex
                 * compaction is enabled.
                 */
-               LLVMTypeRef asi32 = LLVMArrayType(ctx.ac.i32, 8);
-               ctx.gs_ngg_scratch = LLVMAddGlobalInAddressSpace(ctx.ac.module,
-                       asi32, "ngg_scratch", AC_ADDR_SPACE_LDS);
-               LLVMSetInitializer(ctx.gs_ngg_scratch, LLVMGetUndef(asi32));
-               LLVMSetAlignment(ctx.gs_ngg_scratch, 4);
+               if (args->shader_info->so.num_outputs) {
+                       LLVMTypeRef asi32 = LLVMArrayType(ctx.ac.i32, 8);
+                       ctx.gs_ngg_scratch = LLVMAddGlobalInAddressSpace(ctx.ac.module,
+                               asi32, "ngg_scratch", AC_ADDR_SPACE_LDS);
+                       LLVMSetInitializer(ctx.gs_ngg_scratch, LLVMGetUndef(asi32));
+                       LLVMSetAlignment(ctx.gs_ngg_scratch, 4);
+               }
        }
 
        for(int i = 0; i < shader_count; ++i) {