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 <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22948>
This commit is contained in:
Alyssa Rosenzweig
2023-05-10 14:01:23 -04:00
committed by Marge Bot
parent d3bdddcf2a
commit 95d93b24f6
+8
View File
@@ -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);
}