Upgrade all internal format feature usage to 2
This commit is contained in:
parent
e49a69e617
commit
28d512cb51
@ -1015,15 +1015,14 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
|
|||||||
maxLayers = 1;
|
maxLayers = 1;
|
||||||
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
|
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
|
||||||
} else {
|
} else {
|
||||||
VkFormatProperties fmtProps;
|
VkFormatProperties3& fmtProps = _pixelFormats.getVkFormatProperties3(format);
|
||||||
getFormatProperties(format, &fmtProps);
|
|
||||||
// Compressed multisampled textures aren't supported.
|
// Compressed multisampled textures aren't supported.
|
||||||
// Chroma-subsampled multisampled textures aren't supported.
|
// Chroma-subsampled multisampled textures aren't supported.
|
||||||
// Multisampled cube textures aren't supported.
|
// Multisampled cube textures aren't supported.
|
||||||
// Non-renderable multisampled textures aren't supported.
|
// Non-renderable multisampled textures aren't supported.
|
||||||
if (mvkFmt == kMVKFormatCompressed || isChromaSubsampled ||
|
if (mvkFmt == kMVKFormatCompressed || isChromaSubsampled ||
|
||||||
mvkIsAnyFlagEnabled(flags, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) ||
|
mvkIsAnyFlagEnabled(flags, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) ||
|
||||||
!mvkIsAnyFlagEnabled(fmtProps.optimalTilingFeatures, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT|VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) ) {
|
!mvkIsAnyFlagEnabled(fmtProps.optimalTilingFeatures, VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT) ) {
|
||||||
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
|
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
|
||||||
}
|
}
|
||||||
// BGRG and GBGR images may only have one mip level and one layer.
|
// BGRG and GBGR images may only have one mip level and one layer.
|
||||||
@ -2536,7 +2535,11 @@ void MVKPhysicalDevice::initLimits() {
|
|||||||
// to fill out the VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT struct.
|
// to fill out the VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT struct.
|
||||||
uint32_t maxStorage = 0, maxUniform = 0;
|
uint32_t maxStorage = 0, maxUniform = 0;
|
||||||
bool singleTexelStorage = true, singleTexelUniform = true;
|
bool singleTexelStorage = true, singleTexelUniform = true;
|
||||||
_pixelFormats.enumerateSupportedFormats({0, 0, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT}, true, [&](VkFormat vk) {
|
|
||||||
|
VkFormatProperties3 fmtProps = {}; // We don't initialize sType as enumerateSupportedFormats doesn't care.
|
||||||
|
fmtProps.bufferFeatures = VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT;
|
||||||
|
|
||||||
|
_pixelFormats.enumerateSupportedFormats(fmtProps, true, [&](VkFormat vk) {
|
||||||
MTLPixelFormat mtlFmt = _pixelFormats.getMTLPixelFormat(vk);
|
MTLPixelFormat mtlFmt = _pixelFormats.getMTLPixelFormat(vk);
|
||||||
if ( !mtlFmt ) { return false; } // If format is invalid, avoid validation errors on MTLDevice format alignment calls
|
if ( !mtlFmt ) { return false; } // If format is invalid, avoid validation errors on MTLDevice format alignment calls
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ public:
|
|||||||
bool isExtended = false);
|
bool isExtended = false);
|
||||||
|
|
||||||
/** Enumerates all formats that support the given features, calling a specified function for each one. */
|
/** Enumerates all formats that support the given features, calling a specified function for each one. */
|
||||||
void enumerateSupportedFormats(VkFormatProperties properties, bool any, std::function<bool(VkFormat)> func);
|
void enumerateSupportedFormats(const VkFormatProperties3& properties, bool any, std::function<bool(VkFormat)> func);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Metal MTLVertexFormat corresponding to the specified
|
* Returns the Metal MTLVertexFormat corresponding to the specified
|
||||||
|
@ -468,7 +468,7 @@ const char* MVKPixelFormats::getName(MTLVertexFormat mtlFormat) {
|
|||||||
return getMTLVertexFormatDesc(mtlFormat).name;
|
return getMTLVertexFormatDesc(mtlFormat).name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKPixelFormats::enumerateSupportedFormats(VkFormatProperties properties, bool any, std::function<bool(VkFormat)> func) {
|
void MVKPixelFormats::enumerateSupportedFormats(const VkFormatProperties3& properties, bool any, std::function<bool(VkFormat)> func) {
|
||||||
static const auto areFeaturesSupported = [any](VkFlags64 a, VkFlags64 b) {
|
static const auto areFeaturesSupported = [any](VkFlags64 a, VkFlags64 b) {
|
||||||
if (b == 0) return true;
|
if (b == 0) return true;
|
||||||
if (any)
|
if (any)
|
||||||
@ -2096,33 +2096,33 @@ void MVKPixelFormats::buildVkFormatMaps() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enumeration of Vulkan format features aligned to the MVKMTLFmtCaps enumeration.
|
// Enumeration of Vulkan format features aligned to the MVKMTLFmtCaps enumeration.
|
||||||
typedef enum : VkFormatFeatureFlags {
|
typedef enum : VkFormatFeatureFlags2 {
|
||||||
kMVKVkFormatFeatureFlagsTexNone = 0,
|
kMVKVkFormatFeatureFlagsTexNone = 0,
|
||||||
kMVKVkFormatFeatureFlagsTexRead = (VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
|
kMVKVkFormatFeatureFlagsTexRead = (VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT |
|
||||||
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
|
VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT |
|
||||||
VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
|
VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT |
|
||||||
VK_FORMAT_FEATURE_BLIT_SRC_BIT),
|
VK_FORMAT_FEATURE_2_BLIT_SRC_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexFilter = (VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT),
|
kMVKVkFormatFeatureFlagsTexFilter = (VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexWrite = (VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT),
|
kMVKVkFormatFeatureFlagsTexWrite = (VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexAtomic = (VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT),
|
kMVKVkFormatFeatureFlagsTexAtomic = (VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexColorAtt = (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
|
kMVKVkFormatFeatureFlagsTexColorAtt = (VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT |
|
||||||
VK_FORMAT_FEATURE_BLIT_DST_BIT),
|
VK_FORMAT_FEATURE_2_BLIT_DST_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexDSAtt = (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT |
|
kMVKVkFormatFeatureFlagsTexDSAtt = (VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT |
|
||||||
VK_FORMAT_FEATURE_BLIT_DST_BIT),
|
VK_FORMAT_FEATURE_2_BLIT_DST_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexBlend = (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT),
|
kMVKVkFormatFeatureFlagsTexBlend = (VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexTransfer = (VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
|
kMVKVkFormatFeatureFlagsTexTransfer = (VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT |
|
||||||
VK_FORMAT_FEATURE_TRANSFER_DST_BIT),
|
VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT),
|
||||||
kMVKVkFormatFeatureFlagsTexChromaSubsampling = (VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR |
|
kMVKVkFormatFeatureFlagsTexChromaSubsampling = (VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT_KHR |
|
||||||
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR),
|
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR),
|
||||||
kMVKVkFormatFeatureFlagsTexMultiPlanar = (VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR |
|
kMVKVkFormatFeatureFlagsTexMultiPlanar = (VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT_KHR |
|
||||||
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR |
|
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR |
|
||||||
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR |
|
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR |
|
||||||
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR |
|
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR |
|
||||||
VK_FORMAT_FEATURE_DISJOINT_BIT_KHR),
|
VK_FORMAT_FEATURE_2_DISJOINT_BIT_KHR),
|
||||||
kMVKVkFormatFeatureFlagsBufRead = (VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT),
|
kMVKVkFormatFeatureFlagsBufRead = (VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT),
|
||||||
kMVKVkFormatFeatureFlagsBufWrite = (VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT),
|
kMVKVkFormatFeatureFlagsBufWrite = (VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT),
|
||||||
kMVKVkFormatFeatureFlagsBufAtomic = (VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT),
|
kMVKVkFormatFeatureFlagsBufAtomic = (VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT),
|
||||||
kMVKVkFormatFeatureFlagsBufVertex = (VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT),
|
kMVKVkFormatFeatureFlagsBufVertex = (VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT),
|
||||||
} MVKVkFormatFeatureFlags;
|
} MVKVkFormatFeatureFlags;
|
||||||
|
|
||||||
// Sets the VkFormatProperties (optimal/linear/buffer) for the Vulkan format.
|
// Sets the VkFormatProperties (optimal/linear/buffer) for the Vulkan format.
|
||||||
@ -2180,7 +2180,7 @@ void MVKPixelFormats::setFormatProperties(MVKVkFormatDesc& vkDesc) {
|
|||||||
// Vulkan forbids blits between chroma-subsampled formats.
|
// Vulkan forbids blits between chroma-subsampled formats.
|
||||||
// If we can't write the stencil reference from the shader, we can't blit stencil.
|
// If we can't write the stencil reference from the shader, we can't blit stencil.
|
||||||
if (chromaSubsamplingComponentBits > 0 || (isStencilFormat(vkDesc.mtlPixelFormat) && !supportsStencilFeedback)) {
|
if (chromaSubsamplingComponentBits > 0 || (isStencilFormat(vkDesc.mtlPixelFormat) && !supportsStencilFeedback)) {
|
||||||
mvkDisableFlags(vkProps.optimalTilingFeatures, (VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT));
|
mvkDisableFlags(vkProps.optimalTilingFeatures, (VK_FORMAT_FEATURE_2_BLIT_SRC_BIT | VK_FORMAT_FEATURE_2_BLIT_DST_BIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
// These formats require swizzling. In order to support rendering, we'll have to swizzle
|
// These formats require swizzling. In order to support rendering, we'll have to swizzle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user