Log format substitution error when MTLPixelFormatDepth24Unorm_Stencil8 is not supported.

This commit is contained in:
Bill Hollings 2019-10-17 16:59:52 -04:00
parent f14e44800a
commit 47d38df764
4 changed files with 9 additions and 6 deletions

View File

@ -37,6 +37,7 @@ Released 2019/10/28
- Allow `MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS` build setting to be overridden.
- Fix memory leaks of system classes during `VkInstance` and `VkQueue` creation.
- Fix memory leaks when compiling shaders and pipelines without default OS autorelease pool.
- Log format substitution error when `MTLPixelFormatDepth24Unorm_Stencil8` is not supported.
- Reduce memory usage by adjusting default memory allocs for many `MVKVectorInline` uses and
replacing use of `MVKVectorDefault` with `std::vector` in descriptor set bindings.

View File

@ -211,8 +211,6 @@ bool MVKPhysicalDevice::getFormatIsSupported(VkFormat format) {
switch (mvkMTLPixelFormatFromVkFormat(format)) {
case MTLPixelFormatDepth24Unorm_Stencil8:
return getMTLDevice().isDepth24Stencil8PixelFormatSupported;
break;
default:
break;
}
@ -2512,7 +2510,7 @@ MTLPixelFormat MVKDevice::getMTLPixelFormatFromVkFormat(VkFormat vkFormat, MVKBa
#if MVK_MACOS
if (mtlPixFmt == MTLPixelFormatDepth24Unorm_Stencil8 &&
!getMTLDevice().isDepth24Stencil8PixelFormatSupported) {
return MTLPixelFormatDepth32Float_Stencil8;
return mvkMTLPixelFormatFromVkFormatInObj(vkFormat, mvkObj, MTLPixelFormatDepth24Unorm_Stencil8);
}
#endif
return mtlPixFmt;

View File

@ -47,7 +47,9 @@ class MVKBaseObject;
* of an MVKBaseObject subclass, which is true for all but static calling functions.
*/
MTLPixelFormat mvkMTLPixelFormatFromVkFormatInObj(VkFormat vkFormat, MVKBaseObject* mvkObj);
MTLPixelFormat mvkMTLPixelFormatFromVkFormatInObj(VkFormat vkFormat,
MVKBaseObject* mvkObj,
MTLPixelFormat mtlPixelFormatKnownUnsupported = MTLPixelFormatInvalid);
#define mvkMTLPixelFormatFromVkFormat(vkFormat) mvkMTLPixelFormatFromVkFormatInObj(vkFormat, this)
MTLVertexFormat mvkMTLVertexFormatFromVkFormatInObj(VkFormat vkFormat, MVKBaseObject* mvkObj);

View File

@ -569,11 +569,13 @@ MVK_PUBLIC_SYMBOL MTLPixelFormat mvkMTLPixelFormatFromVkFormat(VkFormat vkFormat
return mvkMTLPixelFormatFromVkFormatInObj(vkFormat, nullptr);
}
MTLPixelFormat mvkMTLPixelFormatFromVkFormatInObj(VkFormat vkFormat, MVKBaseObject* mvkObj) {
MTLPixelFormat mvkMTLPixelFormatFromVkFormatInObj(VkFormat vkFormat,
MVKBaseObject* mvkObj,
MTLPixelFormat mtlPixelFormatKnownUnsupported) {
MTLPixelFormat mtlPixFmt = MTLPixelFormatInvalid;
const MVKFormatDesc& fmtDesc = formatDescForVkFormat(vkFormat);
if (fmtDesc.isSupported()) {
if (fmtDesc.isSupported() && (fmtDesc.mtl != mtlPixelFormatKnownUnsupported)) {
mtlPixFmt = fmtDesc.mtl;
} else if (vkFormat != VK_FORMAT_UNDEFINED) {
// If the MTLPixelFormat is not supported but VkFormat is valid, attempt to substitute a different format.