From dc9343b42d141a644bb7647145a8e422c22969d9 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 31 May 2021 17:39:03 +0200 Subject: [PATCH] lavapipe: query formats for shader-image support Assuming all formats are supported here isn't a good plan; we don't actually support all formats. Reviewed-By: Mike Blumenkrantz Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/frontends/lavapipe/lvp_formats.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/lavapipe/lvp_formats.c b/src/gallium/frontends/lavapipe/lvp_formats.c index 10bca26ee35..b33337b9947 100644 --- a/src/gallium/frontends/lavapipe/lvp_formats.c +++ b/src/gallium/frontends/lavapipe/lvp_formats.c @@ -239,7 +239,7 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d out_properties->bufferFeatures = buffer_features; return; } - buffer_features = VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT; + if (!util_format_is_srgb(pformat) && physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat, PIPE_BUFFER, 0, 0, PIPE_BIND_VERTEX_BUFFER)) { @@ -251,6 +251,10 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d buffer_features |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; } + if (physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat, + PIPE_BUFFER, 0, 0, PIPE_BIND_SHADER_IMAGE)) { + buffer_features |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT; + } if (physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { @@ -267,6 +271,10 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d /* SNORM blending on llvmpipe fails CTS - disable for now */ if (!util_format_is_snorm(pformat)) features |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; + } + + if (physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SHADER_IMAGE)) { features |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; }