Commit a0ba28e
authored
Metal backend: compile metal with precise and safe flags on (#16598)
This pull request updates the Metal shader compilation process to
improve numerical accuracy and safety when compiling shaders on newer
versions of macOS and iOS. The main change is the introduction of
specific compile options for math operations when supported by the
operating system.
In the compileLibrary() function, added `MTLCompileOptions` when running
on macOS 15.0, iOS 18.0, or newer, to ensure safer and more precise math
operations during shader compilation:
* `mathMode` set to `MTLMathModeSafe` (equivalent to
-fmetal-math-mode=safe)
* `mathFloatingPointFunctions` set to
`MTLMathFloatingPointFunctionsPrecise` (equivalent to
-fmetal-math-fp32-functions=precise)1 parent 9cbe754 commit a0ba28e
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
| |||
0 commit comments