zink: force 4 component formats for samplerview/render textures

this fixes a bunch of issues with 3-component formats, which aren't supported
for various operations on certain drivers

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8697>
This commit is contained in:
Mike Blumenkrantz 2020-08-07 09:41:12 -04:00 committed by Marge Bot
parent b45c8a8671
commit 84821964eb

View file

@ -669,8 +669,16 @@ zink_is_format_supported(struct pipe_screen *pscreen,
return false;
if (bind & PIPE_BIND_SAMPLER_VIEW &&
!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
return false;
!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
return false;
if ((bind & PIPE_BIND_SAMPLER_VIEW) || (bind & PIPE_BIND_RENDER_TARGET)) {
/* if this is a 3-component texture, force gallium to give us 4 components by rejecting this one */
const struct util_format_description *desc = util_format_description(format);
if (desc->nr_channels == 3 &&
(desc->block.bits == 24 || desc->block.bits == 48 || desc->block.bits == 96))
return false;
}
if (bind & PIPE_BIND_DEPTH_STENCIL &&
!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))