Skip to content

mtyberg/metal-without-xcode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metal Programming without Xcode

A simple example of Metal written in Objective-C++ which can be compiled in command-line. result.png

How to pre-compile Metal shaders

Export PATH for Metal compiler

export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin

or

echo 'export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin"' >> ~/.bashrc

Compile

Just run the following command:

make shaders.metallib

or, if you want to do it manually:

Compile .metal file into .air

metal -std=osx-metal1.1 -o shaders.air shaders.metal

Archive .air into .metal-ar

metal-ar r shaders.metal-ar shaders.air

Make .metallib from metal-ar

metallib -o shaders.metallib shaders.metal-ar

About

A command-line-compilable example of Metal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C++ 85.1%
  • Metal 7.5%
  • Makefile 3.9%
  • C 3.5%