gallium: Remove PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND

Since the mesa state tracker can promote RGB texture formats
to RGBA texture formats (among other formats) without exposing
any of that information to a driver, it is more desirable to
have the behaviour of `PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND`
be the default. This avoids rendering bugs where an application
sets `DST_ALPHA` blending on a format where there is no alpha
channel, that has been promoted to a format that actually has an
alpha channel. The driver can instead rely on the common code
in the state tracker to convert the blending parameter to one
that reflects the limitations of the application requested format,
as long as `PIPE_CAP_INDEP_BLEND_FUNC` is supported.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24044>
This commit is contained in:
Lucas Fryzek
2023-07-07 15:15:20 -04:00
committed by Marge Bot
parent 99e58460ef
commit 6b2fa965c6
16 changed files with 6 additions and 27 deletions
+4 -3
View File
@@ -1456,9 +1456,10 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
if (baseFormat == GL_RGB)
fb->_IsRGB |= (1 << i);
if ((baseFormat == GL_RGB && ctx->st->needs_rgb_dst_alpha_override) ||
(baseFormat == GL_LUMINANCE && !util_format_is_luminance(attFormat)) ||
(baseFormat == GL_INTENSITY && !util_format_is_intensity(attFormat)))
if (ctx->st->has_indep_blend_func &&
((baseFormat == GL_RGB) ||
(baseFormat == GL_LUMINANCE && !util_format_is_luminance(attFormat)) ||
(baseFormat == GL_INTENSITY && !util_format_is_intensity(attFormat))))
fb->_BlendForceAlphaToOne |= (1 << i);
if (type == GL_FLOAT && _mesa_get_format_max_bits(attFormat) > 16)
+1 -2
View File
@@ -184,8 +184,7 @@ blend_per_rt(const struct st_context *st, unsigned num_cb)
if (ctx->DrawBuffer->_BlendForceAlphaToOne) {
/* Overriding requires independent blend functions (not just enables),
* require drivers exposing PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND to
* also expose PIPE_CAP_INDEP_BLEND_FUNC.
* requiring drivers to expose PIPE_CAP_INDEP_BLEND_FUNC.
*/
assert(st->has_indep_blend_func);
-2
View File
@@ -619,8 +619,6 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
screen->get_param(screen, PIPE_CAP_INDEP_BLEND_ENABLE);
st->has_indep_blend_func =
screen->get_param(screen, PIPE_CAP_INDEP_BLEND_FUNC);
st->needs_rgb_dst_alpha_override =
screen->get_param(screen, PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND);
st->can_dither =
screen->get_param(screen, PIPE_CAP_DITHERING);
st->lower_flatshade =
-1
View File
@@ -167,7 +167,6 @@ struct st_context
bool has_pipeline_stat;
bool has_indep_blend_enable;
bool has_indep_blend_func;
bool needs_rgb_dst_alpha_override;
bool can_dither;
bool can_bind_const_buffer_as_vertex;
bool lower_flatshade;