Posts

Post marked as solved
6 Replies
Thank you for sharing your project. We took a quick look and noticed that you use -O (upper case) instead of -o (lower case) to specify the output file for the Metal compiler. Using -o will solve this specific problem for you. Given this discovery there is no need for you to file a TSI. Please save that TSI for another question. If you have already filed a TSI then DTS will refund it for you.
Post not yet marked as solved
8 Replies
Sorry, we cannot comment about future software or hardware products. But we’d love to hear more about the optimization work you’ve been doing or questions you have about that. And although they don’t address your question, here’s where you’ll find sessions about using Metal with the Apple Silicon Mac: Bring your Metal app to Apple Silicon Macs - https://developer.apple.com/videos/play/wwdc2020/10631/ Optimize Metal Performance for Apple Silicon Macs - https://developer.apple.com/videos/play/wwdc2020/10632/  Mac Developer Transition Kit - https://developer.apple.com/programs/universal/
Post not yet marked as solved
1 Replies
Thanks for pointing this out. Please submit a request to get this fixed via Feedback Assistant - https://feedbackassistant.apple.com. For more information on Feedback Assistant, please visit Bug Reporting - https://developer.apple.com/bug-reporting. As a workaround, please specify the size of the vertex data.
Post marked as Apple Recommended
Currently, there is no support for assert in the Metal Shading Language. We do not recommend using the Clang’s __builtin_trap() for this. Please submit an enhancement request via Feedback Assistant - https://feedbackassistant.apple.com. For more information on Feedback Assistant, please visit [Bug Reporting](https://developer.apple.com/bug-reporting/. Having said that, please consider turning on the validation layer and performing an out-of-bounds access on a buffer as a solution to what you are trying to do. For more information on the validation layer please watch Debug GPU-side errors in Metal - https://developer.apple.com/videos/play/wwdc2020/10616/.
Post marked as solved
2 Replies
I think what you may actually want is:fragment float4 SpritePS(VS_OUT in [[stage_in]], PSResources Resources) { //... }This syntax is described in Section 2.11.2 of the Metal Shading Language Specification (v 2.2).The syntax that you are using is that of Argument Buffers described in Section 2.12. In that syntax, the binding point attributes [[ buffer(1) ]], [[texture(1)]], etc. are ignored by the compiler and it automatically assigns the [[ id(n) ]] attribute for the members of the PSResources struct.
Post not yet marked as solved
1 Replies
I recommend filing a radar for this problem and attaching as small sample project so that we can investigate this further.Another good data point and experiment would be to use the integrated GPU to see if this is specific to the discrete GPU compiler or not.
Post marked as solved
2 Replies
By default Xcode sets Enable Fast Math flags to YES which should correspond to passing the -ffast-math flag to the Metal compiler.If you change the option to NO this will correspond to the -fno-fast-math option being passed to the compiler. You can check what options are being passed to the compiler by inspecting the build logs in Xcode. You shouldn't need to add -fno-fast-math to the Other Metal Compiler Flags for this purpose.The namespace metal::precise provides developers with a mechanism to use the more precise version of Metal standard library functions in a more fine grained way. Fast math allows for compiler optimizations like reassociation over common operations like addition/subtraction/etc. which are not valid under precise math rules. Mpre information about this can be found in the Metal Shading Language Specification under the Section Math Intrinsics Compiler Options. For best performance, in general it is better to try and keep as much of the shader using Fast Math.