mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
mac memless compile issue (#4037)
This commit is contained in:
@@ -176,12 +176,17 @@ bool CCMTLTexture::createMTLTexture() {
|
||||
descriptor.arrayLength = _info.type == TextureType::CUBE ? 1 : _info.layerCount;
|
||||
|
||||
if(hasAllFlags(TextureUsage::COLOR_ATTACHMENT | TextureUsage::INPUT_ATTACHMENT, _info.usage) && mu::isImageBlockSupported()) {
|
||||
// mac SDK mem_less unavailable before 11.0
|
||||
#if MAC_MEMORY_LESS_TEXTURE_SUPPORT || CC_PLATFORM == CC_PLATFORM_MAC_IOS
|
||||
//xcode OS version warning
|
||||
if (@available(macOS 11.0, *)) {
|
||||
descriptor.storageMode = MTLStorageModeMemoryless;
|
||||
} else {
|
||||
descriptor.storageMode = MTLStorageModePrivate;
|
||||
}
|
||||
#else
|
||||
descriptor.storageMode = MTLStorageModePrivate;
|
||||
#endif
|
||||
} else if (hasFlag(_info.usage, TextureUsage::COLOR_ATTACHMENT) || hasFlag(_info.usage, TextureUsage::DEPTH_STENCIL_ATTACHMENT) || hasFlag(_info.usage, TextureUsage::INPUT_ATTACHMENT)) {
|
||||
descriptor.storageMode = MTLStorageModePrivate;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/../common/CMakeLists.txt)
|
||||
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET ${TARGET_OSX_VERSION})
|
||||
|
||||
if("${TARGET_OSX_VERSION}" VERSION_GREATER_EQUAL "11.0")
|
||||
add_definitions(-DMAC_MEMORY_LESS_TEXTURE_SUPPORT=1)
|
||||
endif()
|
||||
|
||||
set(LIB_NAME ${APP_NAME}-desktop)
|
||||
|
||||
set(UI_RESOURCES)
|
||||
|
||||
Reference in New Issue
Block a user