vkCreateRenderPass() return VK_ERROR_FORMAT_NOT_SUPPORTED if format not supported.
diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md
index 73d38a5..6440f77 100644
--- a/Docs/Whats_New.md
+++ b/Docs/Whats_New.md
@@ -28,6 +28,7 @@
- Fix crash in `vkDestroyPipelineLayout()`.
- `vkCmdBlitImage()` support format component swizzling.
- `vkCmdClearImage()` set error if attempt made to clear 1D image, and fix validation of depth attachment formats.
+- `vkCreateRenderPass()` return `VK_ERROR_FORMAT_NOT_SUPPORTED` if format not supported.
- Remove error logging on `VK_TIMEOUT` of `VkSemaphore` and `VkFence`.
- Consolidate the various linkable objects into a `MVKLinkableMixin` template base class.
- Use `MVKVector` whenever possible in MoltenVK, especially within render loop.
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.h b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.h
index 70b6ea4..253f367 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.h
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.h
@@ -134,6 +134,8 @@
const VkAttachmentDescription* pCreateInfo);
protected:
+ VkAttachmentDescription validate(const VkAttachmentDescription* pCreateInfo);
+
VkAttachmentDescription _info;
MVKRenderPass* _renderPass;
uint32_t _attachmentIndex;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
index 4ee7b1c..42b499b 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
@@ -321,9 +321,19 @@
}
}
- _info = *pCreateInfo;
+ _info = validate(pCreateInfo);
}
+// Validate and potentially modify the create info
+VkAttachmentDescription MVKRenderPassAttachment::validate(const VkAttachmentDescription* pCreateInfo) {
+ VkAttachmentDescription info = *pCreateInfo;
+
+ if ( !_renderPass->getMTLPixelFormatFromVkFormat(info.format) ) {
+ _renderPass->setConfigurationResult(reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "vkCreateRenderPass(): Attachment format %s is not supported on this device.", mvkVkFormatName(info.format)));
+ }
+
+ return info;
+}
#pragma mark -
#pragma mark MVKRenderPass
diff --git a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
index e3890a0..40d799c 100644
--- a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
+++ b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
@@ -580,7 +580,7 @@
string errMsg;
errMsg += "VkFormat ";
errMsg += (fmtDesc.vkName) ? fmtDesc.vkName : to_string(fmtDesc.vk);
- errMsg += " is not supported on this platform.";
+ errMsg += " is not supported on this device.";
if (fmtDesc.isSupportedOrSubstitutable()) {
mtlPixFmt = fmtDesc.mtlSubstitute;
@@ -702,7 +702,7 @@
string errMsg;
errMsg += "VkFormat ";
errMsg += (fmtDesc.vkName) ? fmtDesc.vkName : to_string(fmtDesc.vk);
- errMsg += " is not supported for vertex buffers on this platform.";
+ errMsg += " is not supported for vertex buffers on this device.";
if (fmtDesc.vertexIsSupportedOrSubstitutable()) {
mtlVtxFmt = fmtDesc.mtlVertexFormatSubstitute;