From aa9b62cad3620d117b279836fca16fc0786d6a7f Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 6 Jan 2023 07:37:37 -0800 Subject: [PATCH] freedreno/a6xx: Workaround for no pos/psize The hw seems unhappy if there are zero outputs from the last geometry stage. So add a dummy varying as a workaround. Turnip got a similar workaround in commit d6d75fcd915 ("tu: Fix hangs for DS with no output") Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/a6xx/fd6_program.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index a5dd1182dd0..9ff022d5f5c 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -664,6 +664,14 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_context *ctx, clip_cull_mask >> 4, l.max_loc); } + /* The hw seems to be unhappy if the last geom shader has no outputs. + * Normally you'd at least see gl_Position writes, but if the last + * geom stage simply writes to an SSBO (for ex) and no other outputs, + * insert a dummy varying + */ + if (!l.cnt) + ir3_link_add(&l, 0, regid(0, 0), 0x1, l.max_loc); + /* If we have stream-out, we use the full shader for binning * pass, rather than the optimized binning pass one, so that we * have all the varying outputs available for xfb. So streamout