agx: Introduce "no_varyings" instruction
Must be used at the end of a vertex shader that does NOT write any varyings, has rasterizer discard enabled, and is run only for its side effects. The encoding looks like st_var, but I don't know what this actually *does*. I just know that the GPU faults if this is omitted. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20446>
This commit is contained in:
@@ -1608,6 +1608,11 @@ agx_set_st_vary_final(agx_context *ctx)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we got here, there was no varying written. We need to mark that. */
|
||||
agx_block *last_block = list_last_entry(&ctx->blocks, agx_block, link);
|
||||
agx_builder _b = agx_init_builder(ctx, agx_after_block_logical(last_block));
|
||||
agx_no_varyings(&_b);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1885,7 +1890,7 @@ agx_compile_function_nir(nir_shader *nir, nir_function_impl *impl,
|
||||
agx_ra(ctx);
|
||||
agx_lower_64bit_postra(ctx);
|
||||
|
||||
if (ctx->stage == MESA_SHADER_VERTEX)
|
||||
if (ctx->stage == MESA_SHADER_VERTEX && !impl->function->is_preamble)
|
||||
agx_set_st_vary_final(ctx);
|
||||
|
||||
agx_lower_pseudo(ctx);
|
||||
|
@@ -294,6 +294,7 @@ op("convert", (0x3E | L, 0x7F | L | (0x3 << 38), 6, _), srcs = 2, imms = [ROUND]
|
||||
op("iter", (0x21, 0xBF, 8, _), srcs = 2, imms = [CHANNELS, PERSPECTIVE])
|
||||
op("ldcf", (0xA1, 0xBF, 8, _), srcs = 1, imms = [CHANNELS])
|
||||
op("st_vary", None, dests = 0, srcs = 2, can_eliminate = False)
|
||||
op("no_varyings", (0x80000051, 0xFFFFFFFF, 4, _), dests = 0, can_eliminate = False)
|
||||
op("stop", (0x88, 0xFFFF, 2, _), dests = 0, can_eliminate = False)
|
||||
op("trap", (0x08, 0xFFFF, 2, _), dests = 0, can_eliminate = False)
|
||||
op("writeout", (0x48, 0xFF, 4, _), dests = 0, imms = [WRITEOUT], can_eliminate = False)
|
||||
|
Reference in New Issue
Block a user