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

View File

@@ -542,7 +542,6 @@ The integer capabilities:
enable :ext:`GL_EXT_multisampled_render_to_texture`.
* ``PIPE_CAP_IMAGE_ATOMIC_FLOAT_ADD``: Atomic floating point adds are
supported on images, buffers, and shared memory.
* ``PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND``: True if the driver needs blend state to use zero/one instead of destination alpha for RGB/XRGB formats.
* ``PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS``: True if the driver wants TESSINNER and TESSOUTER to be inputs (rather than system values) for tessellation evaluation shaders.
* ``PIPE_CAP_DEST_SURFACE_SRGB_CONTROL``: Indicates whether the drivers
supports switching the format between sRGB and linear for a surface that is

View File

@@ -214,7 +214,6 @@ spec@arb_texture_float@fbo-blending-formats@GL_ALPHA32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE_ALPHA32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_RGB16F,Fail
spec@arb_texture_float@fbo-blending-formats@GL_RGB32F,Fail
spec@arb_texture_float@fbo-blending-formats@GL_RGBA32F,Fail
spec@arb_texture_float@texwrap formats bordercolor,Fail

View File

@@ -100,7 +100,6 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
case PIPE_CAP_SEAMLESS_CUBE_MAP:
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
return 0;
case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART:

View File

@@ -150,7 +150,6 @@ crocus_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_PRIMITIVE_RESTART:
case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX:
case PIPE_CAP_INDEP_BLEND_ENABLE:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_FS_COORD_PIXEL_CENTER_INTEGER:
case PIPE_CAP_DEPTH_CLIP_DISABLE:

View File

@@ -82,8 +82,7 @@
MAP_FORMAT_INT(R8G8B8A8) \
MAP_FORMAT_SRGB(R8G8B8A8) \
\
/* Since we report PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND and other caps, \
* we can rely on st/mesa to force the alpha to 1 for these, so we can \
/* We can rely on st/mesa to force the alpha to 1 for these, so we can \
* just use RGBA. This is needed to support RGB configs, since some apps \
* will only choose RGB (not RGBA) configs. \
*/ \

View File

@@ -170,7 +170,6 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
return 1;

View File

@@ -206,7 +206,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
case PIPE_CAP_TEXTURE_BARRIER:
case PIPE_CAP_INVALIDATE_BUFFER:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS:
case PIPE_CAP_NIR_COMPACT_ARRAYS:
case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE:

View File

@@ -216,7 +216,6 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX:
case PIPE_CAP_INDEP_BLEND_ENABLE:
case PIPE_CAP_INDEP_BLEND_FUNC:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_FS_COORD_PIXEL_CENTER_INTEGER:
case PIPE_CAP_DEPTH_CLIP_DISABLE:

View File

@@ -143,7 +143,6 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return SP_MAX_TEXTURE_CUBE_LEVELS;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 1;

View File

@@ -590,7 +590,6 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
case PIPE_CAP_LOAD_CONSTBUF:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT:
return 1;

View File

@@ -914,7 +914,6 @@ enum pipe_cap
PIPE_CAP_SURFACE_SAMPLE_COUNT,
PIPE_CAP_IMAGE_ATOMIC_FLOAT_ADD,
PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE,
PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND,
PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
PIPE_CAP_NIR_COMPACT_ARRAYS,
PIPE_CAP_MAX_VARYINGS,

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)

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);

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 =

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;

View File

@@ -54,8 +54,6 @@ spec@arb_depth_buffer_float@fbo-stencil-gl_depth32f_stencil8-readpixels,Fail
spec@arb_depth_clamp@depth-clamp-range,Fail
spec@arb_direct_state_access@gettextureimage-formats,Fail
spec@arb_direct_state_access@gettextureimage-formats init-by-rendering,Fail
spec@arb_es2_compatibility@fbo-blending-formats,Fail
spec@arb_es2_compatibility@fbo-blending-formats@GL_RGB565,Fail
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth gl_depth32f_stencil8,Fail
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth_stencil gl_depth32f_stencil8,Fail
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_depth32f_stencil8,Fail
@@ -187,7 +185,6 @@ spec@ext_framebuffer_object@fbo-alphatest-formats@GL_INTENSITY4,Fail
spec@ext_framebuffer_object@fbo-alphatest-formats@GL_INTENSITY8,Fail
spec@ext_framebuffer_object@fbo-alphatest-formats@GL_INTENSITY,Fail
spec@ext_framebuffer_object@fbo-blending-format-quirks,Fail
spec@ext_framebuffer_object@fbo-blending-formats@3,Fail
spec@ext_framebuffer_object@fbo-blending-formats,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA8,Fail
@@ -201,10 +198,6 @@ spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8_ALPHA8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE_ALPHA,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_R3_G3_B2,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_RGB10,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_RGB8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_RGB,Fail
spec@ext_framebuffer_object@fbo-blending-snorm,Fail
spec@ext_framebuffer_object@fbo-clear-formats,Fail
spec@ext_framebuffer_object@fbo-clear-formats@GL_INTENSITY4,Fail