MTLCompileOptions
Compilation settings for a Metal shader library.
Declaration
class MTLCompileOptionsMentioned in
Overview
You can configure the Metal compiler’s options by setting any or all of an MTLCompileOptions instance’s properties, including the following:
Target previous OS releases by assigning the languageVersion property to an MTLLanguageVersion case.
Set preprocessor macros for the Metal compiler by assigning a dictionary to the preprocessorMacros property.
Choose what the Metal compiler’s optimizer prioritizes by setting the optimizationLevel property to an MTLLibraryOptimizationLevel case.
Allow the compiler to optimize for floating-point arithmetic that may violate the IEEE 754 standard by setting mathMode to MTLMathMode.fast.
You can compile a library with your compile options instance by calling an MTLDevice instance’s makeLibrary(source:options:) or makeLibrary(source:options:completionHandler:) method.
Topics
Configuring the compiler options
enableLoggingmathModemathFloatingPointFunctionspreserveInvariancelanguageVersionpreprocessorMacrosoptimizationLevellibrariesfastMathEnabled