Fix: OSX: Compilation on OSX 10.15 target platform

This was because some features requiring OSX 11 were
not properly guarded by defines.

Pull Request: https://projects.blender.org/blender/blender/pulls/111940
This commit is contained in:
Clément Foucault
2023-09-04 22:33:04 +02:00
committed by Clément Foucault
parent 715eb4d88e
commit bb1e8bde13
2 changed files with 16 additions and 6 deletions

View File

@@ -292,12 +292,16 @@ bool MTLShader::finalize(const shader::ShaderCreateInfo *info)
options.languageVersion = MTLLanguageVersion2_2;
options.fastMathEnabled = YES;
/* Raster order groups for tile data in struct require Metal 2.3.
* Retianing Metal 2.2. for old shaders to maintain backwards
* compatibility for existing features. */
if (info->fragment_tile_inputs_.size() > 0) {
options.languageVersion = MTLLanguageVersion2_3;
#if defined(MAC_OS_X_VERSION_11_0) && __MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_11_0
if (@available(macOS 11.00, *)) {
/* Raster order groups for tile data in struct require Metal 2.3.
* Retianing Metal 2.2. for old shaders to maintain backwards
* compatibility for existing features. */
if (info->fragment_tile_inputs_.size() > 0) {
options.languageVersion = MTLLanguageVersion2_3;
}
}
#endif
NSString *source_to_compile = shd_builder_->msl_source_vert_;

View File

@@ -2138,7 +2138,13 @@ void gpu::MTLTexture::ensure_baked()
/* Override storage mode if memoryless attachments are being used. */
if (gpu_image_usage_flags_ & GPU_TEXTURE_USAGE_MEMORYLESS) {
texture_descriptor_.storageMode = MTLStorageModeMemoryless;
#if defined(MAC_OS_X_VERSION_11_0) && __MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_11_0
if (@available(macOS 11.00, *)) {
texture_descriptor_.storageMode = MTLStorageModeMemoryless;
}
#else
BLI_assert_msg(0, "GPU_TEXTURE_USAGE_MEMORYLESS is not available on older MacOS versions");
#endif
}
/* Standard texture allocation. */