Fix issue in reporting properties of substitutable VkFormats.
Report format properties only based on the primary MTLPixelFormat
of a VkFormat, not any possible substitution MTLPixelFormat.
Update MoltenVK version to 1.0.43 and VK_MVK_MOLTENVK_SPEC_VERSION to 26.
diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md
index a2583dd..118881e 100644
--- a/Docs/Whats_New.md
+++ b/Docs/Whats_New.md
@@ -13,6 +13,19 @@
+MoltenVK 1.0.43
+---------------
+
+Released 2020/06/09
+
+- Fix issue in reporting properties of substitutable `VkFormats`.
+- Fix vertex attribute offset adjustments when vertex buffer stride is zero.
+- Update `fetchDependencies` script to use pre-built `spirv-tools` files by default.
+- Numerous documentation typo corrections.
+- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to `26`.
+- Update Travis CI to Xcode 11.5.
+
+
MoltenVK 1.0.42
---------------
diff --git a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
index 0f245ab..80be2fc 100644
--- a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
+++ b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
@@ -50,12 +50,12 @@
*/
#define MVK_VERSION_MAJOR 1
#define MVK_VERSION_MINOR 0
-#define MVK_VERSION_PATCH 42
+#define MVK_VERSION_PATCH 43
#define MVK_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch))
#define MVK_VERSION MVK_MAKE_VERSION(MVK_VERSION_MAJOR, MVK_VERSION_MINOR, MVK_VERSION_PATCH)
-#define VK_MVK_MOLTENVK_SPEC_VERSION 25
+#define VK_MVK_MOLTENVK_SPEC_VERSION 26
#define VK_MVK_MOLTENVK_EXTENSION_NAME "VK_MVK_moltenvk"
/**
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h
index 7e124f1..4227778 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h
@@ -94,11 +94,9 @@
inline bool isSupported() const { return (mtlPixelFormat != MTLPixelFormatInvalid); };
inline bool isSupportedOrSubstitutable() const { return isSupported() || (mtlPixelFormatSubstitute != MTLPixelFormatInvalid); };
- inline MTLPixelFormat getMTLPixelFormatOrSubstitute() const { return mtlPixelFormat ? mtlPixelFormat : mtlPixelFormatSubstitute; }
inline bool vertexIsSupported() const { return (mtlVertexFormat != MTLVertexFormatInvalid); };
inline bool vertexIsSupportedOrSubstitutable() const { return vertexIsSupported() || (mtlVertexFormatSubstitute != MTLVertexFormatInvalid); };
- inline MTLVertexFormat getMTLVertexFormatOrSubstitute() const { return mtlVertexFormat ? mtlVertexFormat : mtlVertexFormatSubstitute; }
} MVKVkFormatDesc;
/** Describes the properties of a MTLPixelFormat or MTLVertexFormat. */
@@ -236,7 +234,7 @@
/** Returns the default properties for the specified Vulkan format. */
VkFormatProperties& getVkFormatProperties(VkFormat vkFormat);
- /** Returns the Metal format capabilities supported by the specified Vulkan format. */
+ /** Returns the Metal format capabilities supported by the specified Vulkan format, without substitution. */
MVKMTLFmtCaps getCapabilities(VkFormat vkFormat);
/** Returns the Metal format capabilities supported by the specified Metal format. */
@@ -288,9 +286,7 @@
protected:
MVKVkFormatDesc& getVkFormatDesc(VkFormat vkFormat);
MVKVkFormatDesc& getVkFormatDesc(MTLPixelFormat mtlFormat);
- MVKMTLFormatDesc& getMTLPixelFormatDesc(VkFormat vkFormat);
MVKMTLFormatDesc& getMTLPixelFormatDesc(MTLPixelFormat mtlFormat);
- MVKMTLFormatDesc& getMTLVertexFormatDesc(VkFormat vkFormat);
MVKMTLFormatDesc& getMTLVertexFormatDesc(MTLVertexFormat mtlFormat);
void initVkFormatCapabilities();
void initMTLPixelFormatCapabilities();
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
index 06625ff..368079e 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
@@ -267,7 +267,7 @@
}
MVKMTLFmtCaps MVKPixelFormats::getCapabilities(VkFormat vkFormat) {
- return getMTLPixelFormatDesc(vkFormat).mtlFmtCaps;
+ return getMTLPixelFormatDesc(getVkFormatDesc(vkFormat).mtlPixelFormat).mtlFmtCaps;
}
MVKMTLFmtCaps MVKPixelFormats::getCapabilities(MTLPixelFormat mtlFormat) {
@@ -460,11 +460,6 @@
return getVkFormatDesc(getMTLPixelFormatDesc(mtlFormat).vkFormat);
}
-// Return a reference to the Metal format descriptor corresponding to the VkFormat.
-MVKMTLFormatDesc& MVKPixelFormats::getMTLPixelFormatDesc(VkFormat vkFormat) {
- return getMTLPixelFormatDesc(getVkFormatDesc(vkFormat).getMTLPixelFormatOrSubstitute());
-}
-
// Return a reference to the Metal format descriptor corresponding to the MTLPixelFormat.
MVKMTLFormatDesc& MVKPixelFormats::getMTLPixelFormatDesc(MTLPixelFormat mtlFormat) {
uint16_t fmtIdx = ((mtlFormat < _mtlPixelFormatCoreCount)
@@ -473,11 +468,6 @@
return _mtlPixelFormatDescriptions[fmtIdx];
}
-// Return a reference to the Metal format descriptor corresponding to the VkFormat.
-MVKMTLFormatDesc& MVKPixelFormats::getMTLVertexFormatDesc(VkFormat vkFormat) {
- return getMTLVertexFormatDesc(getVkFormatDesc(vkFormat).getMTLVertexFormatOrSubstitute());
-}
-
// Return a reference to the Metal format descriptor corresponding to the MTLVertexFormat.
MVKMTLFormatDesc& MVKPixelFormats::getMTLVertexFormatDesc(MTLVertexFormat mtlFormat) {
uint16_t fmtIdx = (mtlFormat < _mtlVertexFormatCount) ? _mtlFormatDescIndicesByMTLVertexFormats[mtlFormat] : 0;
@@ -1280,9 +1270,8 @@
mvkEnableFlags(VK_FEATS, kMVKVkFormatFeatureFlags ##TYPE ##CAP); \
}
- VkFormat vkFmt = vkDesc.vkFormat;
VkFormatProperties& vkProps = vkDesc.properties;
- MVKMTLFmtCaps mtlPixFmtCaps = getMTLPixelFormatDesc(vkFmt).mtlFmtCaps;
+ MVKMTLFmtCaps mtlPixFmtCaps = getMTLPixelFormatDesc(vkDesc.mtlPixelFormat).mtlFmtCaps;
// Set optimal tiling features first
vkProps.optimalTilingFeatures = kMVKVkFormatFeatureFlagsTexNone;
@@ -1317,7 +1306,7 @@
enableFormatFeatures(Read, Buf, mtlPixFmtCaps, vkProps.bufferFeatures);
enableFormatFeatures(Write, Buf, mtlPixFmtCaps, vkProps.bufferFeatures);
enableFormatFeatures(Atomic, Buf, mtlPixFmtCaps, vkProps.bufferFeatures);
- enableFormatFeatures(Vertex, Buf, getMTLVertexFormatDesc(vkFmt).mtlFmtCaps, vkProps.bufferFeatures);
+ enableFormatFeatures(Vertex, Buf, getMTLVertexFormatDesc(vkDesc.mtlVertexFormat).mtlFmtCaps, vkProps.bufferFeatures);
}
}
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
index 432a757..e821361 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
@@ -342,7 +342,8 @@
_lastUseSubpassIdx = max(spIdx, _lastUseSubpassIdx);
// Validate that the attachment pixel format supports the capabilities required by the subpass.
- if ( !mvkAreAllFlagsEnabled(pixFmts->getCapabilities(_info.format), reqCaps) ) {
+ // Use MTLPixelFormat to look up capabilities to permit Metal format substitution.
+ if ( !mvkAreAllFlagsEnabled(pixFmts->getCapabilities(pixFmts->getMTLPixelFormat(_info.format)), reqCaps) ) {
_renderPass->setConfigurationResult(reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "vkCreateRenderPass(): Attachment format %s on this device does not support the VkFormat attachment capabilities required by the subpass at index %d.", _renderPass->getPixelFormats()->getName(_info.format), spIdx));
}
}