gallium/hud: extend check for has_srgb
gallium hud checks for the PIPE_FORMAT_B8G8R8A8_SRGB format to set has_srgb, but can then receive a different format such as PIPE_FORMAT_B8G8R8X8 in hud_run. If the driver supports PIPE_FORMAT_B8G8R8A8_SRGB but does not support the other formats such as PIPE_FORMAT_B8G8R8X8_SRGB, that will break rendering as gallium hud assumes srgb is also supported for that format. Extend the check to set has_srgb to prevent that from happening. Signed-off-by: Erico Nunes <nunes.erico@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10222>
This commit is contained in:
parent
f93dc9dc77
commit
750ddf3239
|
@ -1891,10 +1891,19 @@ hud_create(struct cso_context *cso, struct st_context_iface *st,
|
|||
}
|
||||
|
||||
hud->refcount = 1;
|
||||
hud->has_srgb = screen->is_format_supported(screen,
|
||||
PIPE_FORMAT_B8G8R8A8_SRGB,
|
||||
PIPE_TEXTURE_2D, 0, 0,
|
||||
PIPE_BIND_RENDER_TARGET) != 0;
|
||||
|
||||
static const enum pipe_format srgb_formats[] = {
|
||||
PIPE_FORMAT_B8G8R8A8_SRGB,
|
||||
PIPE_FORMAT_B8G8R8X8_SRGB
|
||||
};
|
||||
for (i = 0; i < ARRAY_SIZE(srgb_formats); i++) {
|
||||
if (!screen->is_format_supported(screen, srgb_formats[i],
|
||||
PIPE_TEXTURE_2D, 0, 0,
|
||||
PIPE_BIND_RENDER_TARGET))
|
||||
break;
|
||||
}
|
||||
|
||||
hud->has_srgb = (i == ARRAY_SIZE(srgb_formats));
|
||||
|
||||
/* blend state */
|
||||
hud->no_blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
|
Loading…
Reference in New Issue