/* Corresponds to MALI_MASK_* above and glColorMask arguments */
unsigned color_mask : 4;
-
- /* Attached constant for CONSTANT_ALPHA, etc */
-
-#ifndef BIFROST
- float constant;
-#endif
} __attribute__((packed));
/* Used with channel swizzling */
union midgard_blend {
mali_ptr shader;
- struct mali_blend_equation equation;
+
+ struct {
+ struct mali_blend_equation equation;
+ float constant;
+ };
};
/* On MRT Midgard systems (using an MFBD), each render target gets its own
#include <stdio.h>
#include "pan_blending.h"
+#include "pan_context.h"
/*
* Implements fixed-function blending on Midgard.
};
bool
-panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct mali_blend_equation *out, unsigned colormask, const struct pipe_blend_color *blend_color)
+panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct panfrost_blend_state *so, unsigned colormask, const struct pipe_blend_color *blend_color)
{
+ struct mali_blend_equation *out = &so->equation;
+
/* If no blending is enabled, default back on `replace` mode */
if (!blend->blend_enable)
- return panfrost_make_fixed_blend_mode(&default_blend, out, colormask, blend_color);
+ return panfrost_make_fixed_blend_mode(&default_blend, so, colormask, blend_color);
/* We have room only for a single float32 constant between the four
* components. If we need more, spill to the programmable pipeline. */
blend->alpha_src_factor, blend->alpha_dst_factor,
};
- if (!panfrost_make_constant(factors, ARRAY_SIZE(factors), blend_color, &out->constant))
+ if (!panfrost_make_constant(factors, ARRAY_SIZE(factors), blend_color, &so->constant))
return false;
unsigned rgb_mode = 0;
#include "pipe/p_defines.h"
#include <panfrost-job.h>
-bool panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct mali_blend_equation *out, unsigned colormask, const struct pipe_blend_color *blend_color);
+struct panfrost_blend_state;
+
+bool panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct panfrost_blend_state *so, unsigned colormask, const struct pipe_blend_color *blend_color);
#endif
if (!ctx->blend->has_blend_shader) {
ctx->fragment_shader_core.blend.equation = ctx->blend->equation;
+ ctx->fragment_shader_core.blend.constant = ctx->blend->constant;
}
if (!no_blending) {
for (unsigned i = 0; i < 1; ++i) {
rts[i].flags = blend_count;
- if (ctx->blend->has_blend_shader)
+ if (ctx->blend->has_blend_shader) {
rts[i].blend.shader = ctx->blend->blend_shader;
- else
+ } else {
rts[i].blend.equation = ctx->blend->equation;
+ rts[i].blend.constant = ctx->blend->constant;
+ }
}
memcpy(transfer.cpu + sizeof(struct mali_shader_meta), rts, sizeof(rts[0]) * 1);
/* Compile the blend state, first as fixed-function if we can */
- if (panfrost_make_fixed_blend_mode(&blend->rt[0], &so->equation, blend->rt[0].colormask, &ctx->blend_color))
+ if (panfrost_make_fixed_blend_mode(&blend->rt[0], so, blend->rt[0].colormask, &ctx->blend_color))
return so;
/* If we can't, compile a blend shader instead */
/* Compiled fixed function command */
struct mali_blend_equation equation;
+ float constant;
/* Compiled blend shader */
mali_ptr blend_shader;
(eq.color_mask & MALI_MASK_G) ? "G" : "",
(eq.color_mask & MALI_MASK_B) ? "B" : "",
(eq.color_mask & MALI_MASK_A) ? "A" : "");
-
- printf("Constant: %f\n", eq.constant);
}