nvk: Disable R64_[US]INT formats when shaderImageInt64Atomics isn't supported

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35149>
This commit is contained in:
Faith Ekstrand 2025-05-24 20:26:31 -04:00 committed by Marge Bot
parent 00bbb68c08
commit 4d752ad123
4 changed files with 27 additions and 7 deletions

View file

@ -28,14 +28,14 @@ nvk_get_buffer_format_features(const struct nvk_physical_device *pdev,
if (nil_format_supports_buffer(&pdev->info, p_format)) {
features |= VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT;
if (nil_format_supports_storage(&pdev->info, p_format)) {
if (nvk_format_supports_storage(pdev, p_format)) {
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
if (pdev->info.cls_eng3d >= MAXWELL_A)
features |= VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT;
}
if (nvk_format_supports_atomics(&pdev->info, p_format))
if (nvk_format_supports_atomics(pdev, p_format))
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
}

View file

@ -18,20 +18,36 @@
#include "cl90c0.h"
bool
nvk_format_supports_atomics(const struct nv_device_info *dev,
nvk_format_supports_atomics(const struct nvk_physical_device *pdev,
enum pipe_format p_format)
{
switch (p_format) {
case PIPE_FORMAT_R32_UINT:
case PIPE_FORMAT_R32_SINT:
return true;
case PIPE_FORMAT_R64_UINT:
case PIPE_FORMAT_R64_SINT:
return true;
return pdev->vk.supported_features.shaderImageInt64Atomics;
default:
return false;
}
}
bool
nvk_format_supports_storage(const struct nvk_physical_device *pdev,
enum pipe_format p_format)
{
/* Unfortunately, the SPIR-V cap associated with 64-bit storage images (and
* formatted buffers) is gated by the atomics feature so if we have to
* disable the formats when the Vulkan feature isn't exposed.
*/
if (!pdev->vk.supported_features.shaderImageInt64Atomics &&
util_format_get_max_channel_size(p_format) == 64)
return false;
return nil_format_supports_storage(&pdev->info, p_format);
}
#define VA_FMT(vk_fmt, widths, swap_rb, type) \
[VK_FORMAT_##vk_fmt] = \
{ NV9097_SET_VERTEX_ATTRIBUTE_A_COMPONENT_BIT_WIDTHS_##widths, \

View file

@ -20,7 +20,11 @@ struct nvk_va_format {
};
bool
nvk_format_supports_atomics(const struct nv_device_info *dev,
nvk_format_supports_atomics(const struct nvk_physical_device *pdev,
enum pipe_format p_format);
bool
nvk_format_supports_storage(const struct nvk_physical_device *pdev,
enum pipe_format p_format);
const struct nvk_va_format *

View file

@ -76,14 +76,14 @@ nvk_get_image_plane_format_features(const struct nvk_physical_device *pdev,
features |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT;
}
if (nil_format_supports_storage(&pdev->info, p_format)) {
if (nvk_format_supports_storage(pdev, p_format)) {
features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
if (pdev->info.cls_eng3d >= MAXWELL_A)
features |= VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT;
}
if (nvk_format_supports_atomics(&pdev->info, p_format))
if (nvk_format_supports_atomics(pdev, p_format))
features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT;
if (p_format == PIPE_FORMAT_R8_UINT && tiling == VK_IMAGE_TILING_OPTIMAL)