diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-05-01 03:21:06 +0000 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-05-01 23:20:51 +0000 |
commit | 09c669260f6d311d0d99f2c63ebd0ec5b68853f8 (patch) | |
tree | ac33901793edd578e3141b4421400c8794f2b9a0 /src/gallium/drivers/panfrost | |
parent | 910608b29a14b362b3ee21d820373a5e0cff5ff2 (diff) |
panfrost: Fix blend shader upload
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_blend_shaders.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 18 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/gallium/drivers/panfrost/pan_blend_shaders.c b/src/gallium/drivers/panfrost/pan_blend_shaders.c index 5367b7ccf5e..f716e85e3f5 100644 --- a/src/gallium/drivers/panfrost/pan_blend_shaders.c +++ b/src/gallium/drivers/panfrost/pan_blend_shaders.c @@ -96,7 +96,6 @@ void panfrost_make_blend_shader(struct panfrost_context *ctx, struct panfrost_blend_state *cso, const struct pipe_blend_color *blend_color) { const struct pipe_rt_blend_state *blend = &cso->base.rt[0]; - mali_ptr *out = &cso->blend_shader; /* Build the shader */ @@ -150,7 +149,7 @@ panfrost_make_blend_shader(struct panfrost_context *ctx, struct panfrost_blend_s hot_color[c] = blend_color->color[c]; } - *out = panfrost_upload(&ctx->shaders, dst, size, true) | program.first_tag; + cso->blend_shader = panfrost_upload(&ctx->shaders, dst, size, true) | program.first_tag; /* We need to switch to shader mode */ cso->has_blend_shader = true; diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 42db8317d37..c50c546a399 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -960,15 +960,22 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) (ctx->blend->equation.alpha_mode == 0x122) && (ctx->blend->equation.color_mask == 0xf); + /* Even on MFBD, the shader descriptor gets blend shaders. It's + * *also* copied to the blend_meta appended (by convention), + * but this is the field actually read by the hardware. (Or + * maybe both are read...?) */ + + if (ctx->blend->has_blend_shader) { + ctx->fragment_shader_core.blend_shader = ctx->blend->blend_shader; + } + if (ctx->require_sfbd) { /* When only a single render target platform is used, the blend * information is inside the shader meta itself. We * additionally need to signal CAN_DISCARD for nontrivial blend * modes (so we're able to read back the destination buffer) */ - if (ctx->blend->has_blend_shader) { - ctx->fragment_shader_core.blend_shader = ctx->blend->blend_shader; - } else { + if (!ctx->blend->has_blend_shader) { memcpy(&ctx->fragment_shader_core.blend_equation, &ctx->blend->equation, sizeof(ctx->blend->equation)); } @@ -1018,8 +1025,9 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) }, }; - if (ctx->blend->has_blend_shader) - memcpy(&blend_meta[0].blend_equation_1, &ctx->blend->blend_shader, sizeof(ctx->blend->blend_shader)); + if (ctx->blend->has_blend_shader) { + blend_meta[0].blend_shader = ctx->blend->blend_shader; + } memcpy(transfer.cpu + sizeof(struct mali_shader_meta), blend_meta, sizeof(blend_meta)); } |