nvk: Advertise 64-bit atomics on buffer views

We also add an nvk_format_supports_atomics() helper.  This helper lives
in NVK for now because it's not just about the format and hardware but
also about whether or not we have compiler support in NAK.

Fixes: 1d10de539c ("nvk: Implement VK_EXT_shader_image_atomic_int64")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31633>
This commit is contained in:
Faith Ekstrand 2024-10-14 11:44:50 -05:00 committed by Marge Bot
parent d3d8271620
commit c2684968de
4 changed files with 24 additions and 3 deletions

View file

@ -35,7 +35,7 @@ nvk_get_buffer_format_features(struct nvk_physical_device *pdev,
features |= VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT;
}
if (p_format == PIPE_FORMAT_R32_UINT || p_format == PIPE_FORMAT_R32_SINT)
if (nvk_format_supports_atomics(&pdev->info, p_format))
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
}

View file

@ -17,6 +17,21 @@
#include "cl9097.h"
#include "cl90c0.h"
bool
nvk_format_supports_atomics(const struct nv_device_info *dev,
enum pipe_format p_format)
{
switch (p_format) {
case PIPE_FORMAT_R32_UINT:
case PIPE_FORMAT_R32_SINT:
case PIPE_FORMAT_R64_UINT:
case PIPE_FORMAT_R64_SINT:
return true;
default:
return false;
}
}
#define VA_FMT(vk_fmt, widths, swap_rb, type) \
[VK_FORMAT_##vk_fmt] = \
{ NV9097_SET_VERTEX_ATTRIBUTE_A_COMPONENT_BIT_WIDTHS_##widths, \

View file

@ -7,6 +7,9 @@
#include "nvk_private.h"
#include "util/format/u_formats.h"
#include "nv_device_info.h"
struct nvk_physical_device;
struct nvk_va_format {
@ -15,6 +18,10 @@ struct nvk_va_format {
uint8_t type:7;
};
bool
nvk_format_supports_atomics(const struct nv_device_info *dev,
enum pipe_format p_format);
const struct nvk_va_format *
nvk_get_va_format(const struct nvk_physical_device *pdev, VkFormat format);

View file

@ -81,8 +81,7 @@ nvk_get_image_plane_format_features(struct nvk_physical_device *pdev,
features |= VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT;
}
if (p_format == PIPE_FORMAT_R32_UINT || p_format == PIPE_FORMAT_R32_SINT ||
p_format == PIPE_FORMAT_R64_UINT || p_format == PIPE_FORMAT_R64_SINT)
if (nvk_format_supports_atomics(&pdev->info, p_format))
features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT;
if (p_format == PIPE_FORMAT_R8_UINT && tiling == VK_IMAGE_TILING_OPTIMAL)