Compiling and running the metal examples

倾然丶 夕夏残阳落幕 提交于 2019-12-22 03:09:09

问题


It has been a while since I have used XCode, but since Apple revieled XCode 6 and the new Metal API I had to check it out.

They have released examples, e.g. a converted version of their Basic3D example. I am having problems making them compile and run, though. I had to add paths the Quatz and Metal frameworks for compilation and linking to work - thought that should have worked out of the box with build-in libraries?

Also the metal shader compilation step fails, it can not find the metal compiler. Where in XCode is that path setup?

If I ignore the shader compilation step I get an error that the application will not run on any of the simulators. Can metal based 3D applications only run on actual hardware and not in simulator mode?


回答1:


You can't run metal on simulator but you can use this workaround so that it will still compile as long as you have a fallback for the code.

http://medium.com/@jscampbell/bare-metal-working-with-metal-and-the-simulator-70e085e3a45




回答2:


According to a staff on Apple dev forums, Metal does not run in the simulator.

See: https://devforums.apple.com/message/971605#971605

If you look at other samples/app templates there is no need to explicitly link any framework, indeed everything runs out of the box.




回答3:


I started with the hello triangle example they give you to download. It contains all the platform #if's you need to know about. I recommend you get that project and take a look.

https://developer.apple.com/documentation/metal/hello_triangle

#if TARGET_OS_SIMULATOR
#error No simulator support for Metal API.  Must build for a device
#endif


来源:https://stackoverflow.com/questions/24046125/compiling-and-running-the-metal-examples

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!