From 95d93b24f639907d6e8d504c87f9908c7eb60cbc Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 10 May 2023 14:01:23 -0400 Subject: [PATCH] zink: Always set a blend state for shader-db If we're compiling shaders in shader-db, with shader-db's ./run and ZINK_DEBUG=shaderdb, we won't get much state set on the graphics pipeline, since shader-db doesn't actually do any rendering. For a driver like RADV, that is *almost* ok... Since we use dynamic vertex input, we don't need to make up any state for vertex inputs; since we use dynamic rendering, we don't need to make up any render attachments. All of that being said, we *do* need to make up a blend state to ensure that the Vulkan driver doesn't optimize away all of store_derefs in the fragment shader (and in turn, optimize the entire fragment shader away, if there are no image/SSBO writes.) So set the obvious blend state, fixing fragment shaders in shader-db with zink + radv. I don't know why other people would want to use Zink with shader-db, but for me it's an easy way to test ACO, at least until radeonsi gains aco support. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/zink/zink_context.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 023ad0a..3595dc6 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -5066,6 +5066,14 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) struct pipe_depth_stencil_alpha_state dsa = {0}; void *state = ctx->base.create_depth_stencil_alpha_state(&ctx->base, &dsa); ctx->base.bind_depth_stencil_alpha_state(&ctx->base, state); + + struct pipe_blend_state blend = { + .rt[0].colormask = 0xF + }; + + void *blend_state = ctx->base.create_blend_state(&ctx->base, &blend); + ctx->base.bind_blend_state(&ctx->base, blend_state); + zink_batch_rp(ctx); } -- 2.7.4