xcode - Manually Compile Metal Shaders -
i'm interested in moving away xcode , manually compiling metal shaders in project mixed-language application.
i have no idea how this, though. xcode hides details of shader compilation , subsequent loading application @ runtime (you call device.newdefaultlibrary()
). possible, or have use runtime shader compilation purposes?
generally, have 3 ways load shader library in metal:
use runtime shader compilation shader source code via
mtldevice newlibrarywithsource:options:error:
ornewlibrarywithsource:options:completionhandler:
methods. although purists may shy away runtime compilation, option has minimal practical overhead, , viable. primary practical reason avoiding option might avoid making shader source code available part of application, protect ip.load compiled binary libraries using
mtllibrary newlibrarywithfile:error:
ornewlibrarywithdata:error:
methods. follow instructions in using command line utilities build library create these individual binary libraries @ build time.let xcode compile various
*.metal
files @ build time default library available throughmtldevice newdefaultlibrary
.
Comments
Post a Comment