vkCreateRenderPass() return VK_ERROR_FORMAT_NOT_SUPPORTED if format not supported.

This commit is contained in:
Bill Hollings 2019-08-13 17:34:14 -04:00
parent 0bc3be3707
commit e2ce1a6329
4 changed files with 16 additions and 3 deletions

View File

@ -28,6 +28,7 @@ Released TBD
- 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.

View File

@ -134,6 +134,8 @@ public:
const VkAttachmentDescription* pCreateInfo);
protected:
VkAttachmentDescription validate(const VkAttachmentDescription* pCreateInfo);
VkAttachmentDescription _info;
MVKRenderPass* _renderPass;
uint32_t _attachmentIndex;

View File

@ -321,9 +321,19 @@ MVKRenderPassAttachment::MVKRenderPassAttachment(MVKRenderPass* renderPass,
}
}
_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

View File

@ -580,7 +580,7 @@ MTLPixelFormat mvkMTLPixelFormatFromVkFormatInObj(VkFormat vkFormat, MVKBaseObje
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 @@ MTLVertexFormat mvkMTLVertexFormatFromVkFormatInObj(VkFormat vkFormat, MVKBaseOb
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;