* Add an extra dword per vertex to ensure an odd stride, which
* avoids bank conflicts for SoA accesses.
*/
- declare_esgs_ring(ctx);
+ if (!gfx10_is_ngg_passthrough(shader))
+ declare_esgs_ring(ctx);
/* This is really only needed when streamout and / or vertex
* compaction is enabled.
*/
- LLVMTypeRef asi32 = LLVMArrayType(ctx->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 (sel->so.num_outputs && !ctx->gs_ngg_scratch) {
+ LLVMTypeRef asi32 = LLVMArrayType(ctx->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 GFX9 merged shaders:
return &sel->main_shader_part;
}
+static inline bool
+gfx10_is_ngg_passthrough(struct si_shader *shader)
+{
+ struct si_shader_selector *sel = shader->selector;
+
+ return sel->type != PIPE_SHADER_GEOMETRY &&
+ !sel->so.num_outputs &&
+ !sel->info.writes_edgeflag &&
+ (sel->type != PIPE_SHADER_VERTEX ||
+ !shader->key.mono.u.vs_export_prim_id);
+}
+
static inline bool
si_shader_uses_bindless_samplers(struct si_shader_selector *selector)
{