mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
panfrost: fix SAMPLE_ALPHA_TO_ONE
When SAMPLE_ALPHA_TO_ONE is enabled we need to use a blend shader, as the BlendDescriptor.alpha_to_one bit is deprecated (does not work) on bifrost and valhall. In order to generate the appopriate blend shader code, we must put the alpha_to_one status into pan_blend_state. Signed-off-by: Eric R. Smith <eric.smith@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31194>
This commit is contained in:
parent
9ee75f9141
commit
008a17da60
6 changed files with 15 additions and 16 deletions
|
|
@ -3644,6 +3644,7 @@ panfrost_create_blend_state(struct pipe_context *pipe,
|
|||
so->pan.logicop_enable = blend->logicop_enable;
|
||||
so->pan.logicop_func = blend->logicop_func;
|
||||
so->pan.rt_count = blend->max_rt + 1;
|
||||
so->pan.alpha_to_one = blend->alpha_to_one;
|
||||
|
||||
for (unsigned c = 0; c < so->pan.rt_count; ++c) {
|
||||
unsigned g = blend->independent_blend_enable ? c : 0;
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ panfrost_get_blend(struct panfrost_batch *batch, unsigned rti,
|
|||
/* Use fixed-function if the equation permits, the format is blendable,
|
||||
* and no more than one unique constant is accessed */
|
||||
if (info.fixed_function && dev->blendable_formats[fmt].internal &&
|
||||
!blend->base.alpha_to_one &&
|
||||
pan_blend_is_homogenous_constant(info.constant_mask,
|
||||
ctx->blend_color.color)) {
|
||||
return 0;
|
||||
|
|
@ -190,7 +191,7 @@ panfrost_get_blend(struct panfrost_batch *batch, unsigned rti,
|
|||
* conversion descriptor in the internal blend descriptor. (Midgard
|
||||
* requires a blend shader even for this case.)
|
||||
*/
|
||||
if (dev->arch >= 6 && info.opaque)
|
||||
if (dev->arch >= 6 && info.opaque && !blend->base.alpha_to_one)
|
||||
return 0;
|
||||
|
||||
/* Otherwise, we need to grab a shader */
|
||||
|
|
|
|||
|
|
@ -87,12 +87,6 @@ spec@egl_khr_surfaceless_context@viewport,Fail
|
|||
spec@egl_mesa_configless_context@basic,Fail
|
||||
spec@ext_base_instance@arb_base_instance-drawarrays_gles3,Fail
|
||||
spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
|
||||
spec@ext_framebuffer_multisample@alpha-to-one-dual-src-blend 2,Fail
|
||||
spec@ext_framebuffer_multisample@alpha-to-one-dual-src-blend 4,Fail
|
||||
spec@ext_framebuffer_multisample@draw-buffers-alpha-to-one 2,Fail
|
||||
spec@ext_framebuffer_multisample@draw-buffers-alpha-to-one 4,Fail
|
||||
spec@ext_framebuffer_multisample@sample-alpha-to-one 2,Fail
|
||||
spec@ext_framebuffer_multisample@sample-alpha-to-one 4,Fail
|
||||
spec@ext_framebuffer_object@fbo-blending-format-quirks,Fail
|
||||
spec@ext_framebuffer_object@fbo-blending-formats,Fail
|
||||
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
|
||||
|
|
|
|||
|
|
@ -131,12 +131,6 @@ spec@egl_khr_surfaceless_context@viewport,Fail
|
|||
spec@egl_mesa_configless_context@basic,Fail
|
||||
spec@ext_base_instance@arb_base_instance-drawarrays_gles3,Fail
|
||||
spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
|
||||
spec@ext_framebuffer_multisample@alpha-to-one-dual-src-blend 2,Fail
|
||||
spec@ext_framebuffer_multisample@alpha-to-one-dual-src-blend 4,Fail
|
||||
spec@ext_framebuffer_multisample@draw-buffers-alpha-to-one 2,Fail
|
||||
spec@ext_framebuffer_multisample@draw-buffers-alpha-to-one 4,Fail
|
||||
spec@ext_framebuffer_multisample@sample-alpha-to-one 2,Fail
|
||||
spec@ext_framebuffer_multisample@sample-alpha-to-one 4,Fail
|
||||
spec@ext_framebuffer_object@fbo-blending-format-quirks,Fail
|
||||
spec@ext_framebuffer_object@fbo-blending-formats,Fail
|
||||
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
|
||||
|
|
|
|||
|
|
@ -687,6 +687,13 @@ GENX(pan_blend_create_shader)(const struct pan_blend_state *state,
|
|||
.io_semantics.location = i ? VARYING_SLOT_VAR0 : VARYING_SLOT_COL0,
|
||||
.io_semantics.num_slots = 1, .base = i, .dest_type = src_type);
|
||||
|
||||
if (state->alpha_to_one && src_type == nir_type_float32) {
|
||||
/* force alpha to 1 */
|
||||
src = nir_vector_insert_imm(&b, src,
|
||||
nir_imm_floatN_t(&b, 1.0, src->bit_size),
|
||||
3);
|
||||
}
|
||||
|
||||
/* On Midgard, the blend shader is responsible for format conversion.
|
||||
* As the OpenGL spec requires integer conversions to saturate, we must
|
||||
* saturate ourselves here. On Bifrost and later, the conversion
|
||||
|
|
@ -808,10 +815,10 @@ GENX(pan_blend_get_shader_locked)(struct pan_blend_shader_cache *cache,
|
|||
.logicop_func = state->logicop_func,
|
||||
.nr_samples = state->rts[rt].nr_samples,
|
||||
.equation = state->rts[rt].equation,
|
||||
.alpha_to_one = state->alpha_to_one,
|
||||
};
|
||||
|
||||
/* Blend shaders should only be used for blending on Bifrost onwards */
|
||||
assert(PAN_ARCH <= 5 || state->logicop_enable ||
|
||||
assert(PAN_ARCH <= 5 || state->logicop_enable || state->alpha_to_one ||
|
||||
!pan_blend_is_opaque(state->rts[rt].equation));
|
||||
assert(state->rts[rt].equation.color_mask != 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ struct pan_blend_rt_state {
|
|||
};
|
||||
|
||||
struct pan_blend_state {
|
||||
bool alpha_to_one;
|
||||
bool logicop_enable;
|
||||
enum pipe_logicop logicop_func;
|
||||
float constants[4];
|
||||
|
|
@ -80,7 +81,8 @@ struct pan_blend_shader_key {
|
|||
uint32_t logicop_enable : 1;
|
||||
uint32_t logicop_func : 4;
|
||||
uint32_t nr_samples : 5;
|
||||
uint32_t padding : 18;
|
||||
uint32_t alpha_to_one : 1;
|
||||
uint32_t padding : 17;
|
||||
struct pan_blend_equation equation;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue