From eead805919fd0e7191ee3c80410f8c4760093de7 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 6 Jun 2024 19:45:41 +0200 Subject: [PATCH] lavapipe: add option to enable snorm blending This is disabled by default because it fails CTS, however this may still be useful (as it generally works), hence use LVP_SNORM_BLEND env var to enable it. Acked-By: Mike Blumenkrantz Reviewed-by: Brian Paul Part-of: --- src/gallium/frontends/lavapipe/lvp_device.c | 3 +++ src/gallium/frontends/lavapipe/lvp_formats.c | 5 ++--- src/gallium/frontends/lavapipe/lvp_private.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 0984e992803..cf92276b054 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -1238,6 +1238,9 @@ lvp_physical_device_init(struct lvp_physical_device *device, device->vk.supported_extensions.EXT_image_drm_format_modifier = true; #endif + /* SNORM blending on llvmpipe fails CTS - disable by default */ + device->snorm_blend = debug_get_bool_option("LVP_SNORM_BLEND", false); + lvp_get_features(device, &device->vk.supported_features); lvp_get_properties(device, &device->vk.properties); diff --git a/src/gallium/frontends/lavapipe/lvp_formats.c b/src/gallium/frontends/lavapipe/lvp_formats.c index 85ee184766c..86a6d74e555 100644 --- a/src/gallium/frontends/lavapipe/lvp_formats.c +++ b/src/gallium/frontends/lavapipe/lvp_formats.c @@ -162,9 +162,8 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d if (pscreen->is_format_supported(pscreen, pformat, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET)) { features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT; - /* SNORM blending on llvmpipe fails CTS - disable for now */ - if (!util_format_is_snorm(pformat) && - !util_format_is_pure_integer(pformat)) + if (!util_format_is_pure_integer(pformat) && + !(util_format_is_snorm(pformat) && !physical_device->snorm_blend)) features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT; } diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index 94aaaf2e014..e3a89a2838f 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -153,6 +153,7 @@ struct lvp_physical_device { struct pipe_screen *pscreen; const nir_shader_compiler_options *drv_options[LVP_SHADER_STAGES]; uint32_t max_images; + bool snorm_blend; struct vk_sync_timeline_type sync_timeline_type; const struct vk_sync_type *sync_types[3];