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 */
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;
(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));
}
},
};
- 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));
}