Merge pull request #1142 from MarnixKuijs/master

Device fallback and fixed typo
This commit is contained in:
Bill Hollings 2020-11-06 15:11:27 -05:00 committed by GitHub
commit c593983ae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1346,7 +1346,7 @@ VkResult MVKCmdClearImage<N>::setContent(MVKCommandBuffer* cmdBuff,
// Validate
MVKMTLFmtCaps mtlFmtCaps = cmdBuff->getPixelFormats()->getCapabilities(_image->getMTLPixelFormat(planeIndex));
bool isDestUnwritableLinear = MVK_MACOS && !cmdBuff->getDevice()->_pMetalFeatures->renderLinearTextures && _dstImage->getIsLinear();
bool isDestUnwritableLinear = MVK_MACOS && !cmdBuff->getDevice()->_pMetalFeatures->renderLinearTextures && _image->getIsLinear();
uint32_t reqCap = isDS ? kMVKMTLFmtCapsDSAtt : (isDestUnwritableLinear ? kMVKMTLFmtCapsWrite : kMVKMTLFmtCapsColorAtt);
if (!mvkAreAllFlagsEnabled(mtlFmtCaps, reqCap)) {
return cmdBuff->reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdClear%sImage(): Format %s cannot be cleared on this device.", (isDS ? "DepthStencil" : "Color"), cmdBuff->getPixelFormats()->getName(_image->getVkFormat()));

View File

@ -1425,7 +1425,7 @@ void MVKPixelFormats::modifyMTLFormatCapabilities() {
#endif
#if MVK_MACOS
NSArray<id<MTLDevice>>* mtlDevices = MTLCopyAllDevices(); // temp retained
id<MTLDevice> mtlDevice = [mtlDevices[0] retain]; // temp retained
id<MTLDevice> mtlDevice = [mtlDevices count] > 0 ? [mtlDevices[0] retain] : MTLCreateSystemDefaultDevice(); // temp retained
[mtlDevices release]; // temp release
#endif
modifyMTLFormatCapabilities(mtlDevice);