nvk: Advertise more format features
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:

committed by
Marge Bot

parent
77db3e99dd
commit
6909155346
@@ -14,21 +14,22 @@ nvk_get_buffer_format_features(struct nvk_physical_device *pdevice,
|
||||
{
|
||||
VkFormatFeatureFlags2 features = 0;
|
||||
|
||||
enum pipe_format p_format = vk_format_to_pipe_format(vk_format);
|
||||
if (p_format == PIPE_FORMAT_NONE)
|
||||
return 0;
|
||||
|
||||
if (!util_format_is_compressed(p_format) &&
|
||||
!util_format_is_depth_or_stencil(p_format) &&
|
||||
nil_tic_format_for_pipe(p_format) != NULL)
|
||||
features |= VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT;
|
||||
|
||||
if (nvk_is_storage_image_format(vk_format))
|
||||
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT;
|
||||
|
||||
if (nvk_get_va_format(pdevice, vk_format))
|
||||
features |= VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT;
|
||||
|
||||
enum pipe_format p_format = vk_format_to_pipe_format(vk_format);
|
||||
if (nil_format_supports_buffer(pdevice->dev, p_format)) {
|
||||
features |= VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT;
|
||||
|
||||
if (nil_format_supports_storage(pdevice->dev, p_format)) {
|
||||
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT |
|
||||
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
|
||||
}
|
||||
|
||||
if (p_format == PIPE_FORMAT_R32_UINT)
|
||||
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
|
@@ -11,57 +11,6 @@
|
||||
#include "vulkan/util/vk_enum_defines.h"
|
||||
#include "vulkan/util/vk_format.h"
|
||||
|
||||
bool
|
||||
nvk_is_storage_image_format(VkFormat vk_format)
|
||||
{
|
||||
/* TODO: This shouldn't be a fixed list */
|
||||
|
||||
switch (vk_format) {
|
||||
case VK_FORMAT_R32G32B32A32_UINT:
|
||||
case VK_FORMAT_R32G32B32A32_SINT:
|
||||
case VK_FORMAT_R32G32B32A32_SFLOAT:
|
||||
case VK_FORMAT_R32_UINT:
|
||||
case VK_FORMAT_R32_SINT:
|
||||
case VK_FORMAT_R32_SFLOAT:
|
||||
case VK_FORMAT_R16G16B16A16_UINT:
|
||||
case VK_FORMAT_R16G16B16A16_SINT:
|
||||
case VK_FORMAT_R16G16B16A16_SFLOAT:
|
||||
case VK_FORMAT_R32G32_UINT:
|
||||
case VK_FORMAT_R32G32_SINT:
|
||||
case VK_FORMAT_R32G32_SFLOAT:
|
||||
case VK_FORMAT_R8G8B8A8_UINT:
|
||||
case VK_FORMAT_R8G8B8A8_SINT:
|
||||
case VK_FORMAT_R16G16_UINT:
|
||||
case VK_FORMAT_R16G16_SINT:
|
||||
case VK_FORMAT_R16G16_SFLOAT:
|
||||
case VK_FORMAT_R8G8_UINT:
|
||||
case VK_FORMAT_R8G8_SINT:
|
||||
case VK_FORMAT_R16_UINT:
|
||||
case VK_FORMAT_R16_SFLOAT:
|
||||
case VK_FORMAT_R16_SINT:
|
||||
case VK_FORMAT_R8_UINT:
|
||||
case VK_FORMAT_R8_SINT:
|
||||
case VK_FORMAT_A2B10G10R10_UINT_PACK32:
|
||||
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
|
||||
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
|
||||
case VK_FORMAT_R16G16B16A16_UNORM:
|
||||
case VK_FORMAT_R16G16B16A16_SNORM:
|
||||
case VK_FORMAT_R8G8B8A8_UNORM:
|
||||
case VK_FORMAT_R8G8B8A8_SNORM:
|
||||
case VK_FORMAT_R16G16_UNORM:
|
||||
case VK_FORMAT_R16G16_SNORM:
|
||||
case VK_FORMAT_R8G8_UNORM:
|
||||
case VK_FORMAT_R8G8_SNORM:
|
||||
case VK_FORMAT_R16_UNORM:
|
||||
case VK_FORMAT_R16_SNORM:
|
||||
case VK_FORMAT_R8_UNORM:
|
||||
case VK_FORMAT_R8_SNORM:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nvidia names
|
||||
* _: UNORM
|
||||
|
@@ -5,8 +5,6 @@
|
||||
|
||||
struct nvk_physical_device;
|
||||
|
||||
bool nvk_is_storage_image_format(VkFormat vk_format);
|
||||
|
||||
struct nvk_format {
|
||||
VkFormat vk_format;
|
||||
uint8_t hw_format;
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include "nil_format.h"
|
||||
#include "vulkan/util/vk_format.h"
|
||||
|
||||
#include "clb197.h"
|
||||
|
||||
VkFormatFeatureFlags2
|
||||
nvk_get_image_format_features(struct nvk_physical_device *pdevice,
|
||||
VkFormat vk_format, VkImageTiling tiling)
|
||||
@@ -21,20 +23,31 @@ nvk_get_image_format_features(struct nvk_physical_device *pdevice,
|
||||
if (p_format == PIPE_FORMAT_NONE)
|
||||
return 0;
|
||||
|
||||
const struct nil_tic_format *tic_format = nil_tic_format_for_pipe(p_format);
|
||||
if (tic_format == NULL)
|
||||
if (!nil_format_supports_texturing(pdevice->dev, p_format))
|
||||
return 0;
|
||||
|
||||
features |= VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT;
|
||||
features |= VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT;
|
||||
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT;
|
||||
|
||||
if (util_format_is_float(p_format) ||
|
||||
util_format_is_unorm(p_format) ||
|
||||
util_format_is_snorm(p_format))
|
||||
if (nil_format_supports_filtering(pdevice->dev, p_format)) {
|
||||
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
|
||||
if (pdevice->dev->cls_eng3d >= MAXWELL_B)
|
||||
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT;
|
||||
}
|
||||
|
||||
if (nvk_is_storage_image_format(vk_format)) {
|
||||
/* TODO: VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT */
|
||||
|
||||
if (nil_format_supports_color_targets(pdevice->dev, p_format)) {
|
||||
features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT;
|
||||
if (nil_format_supports_blending(pdevice->dev, p_format))
|
||||
features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT;
|
||||
}
|
||||
|
||||
if (vk_format_is_depth_or_stencil(vk_format))
|
||||
return 0; /* TODO: Depth/stencil support */
|
||||
|
||||
if (nil_format_supports_storage(pdevice->dev, p_format)) {
|
||||
features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT |
|
||||
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
|
||||
}
|
||||
|
Reference in New Issue
Block a user