├── MetalDemo ├── Images.xcassets │ └── AppIcon.appiconset │ │ ├── Icon@2x.png │ │ ├── Icon@3x.png │ │ ├── Icon~ipad.png │ │ ├── Icon@2x~ipad.png │ │ └── Contents.json ├── METLViewController.h ├── AppDelegate.h ├── main.m ├── AppDelegate.m ├── Shaders.metal ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.xib ├── Info.plist └── METLViewController.m ├── .gitignore └── MetalDemo.xcodeproj └── project.pbxproj /MetalDemo/Images.xcassets/AppIcon.appiconset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objcio/metal-demo-objcio/HEAD/MetalDemo/Images.xcassets/AppIcon.appiconset/Icon@2x.png -------------------------------------------------------------------------------- /MetalDemo/Images.xcassets/AppIcon.appiconset/Icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objcio/metal-demo-objcio/HEAD/MetalDemo/Images.xcassets/AppIcon.appiconset/Icon@3x.png -------------------------------------------------------------------------------- /MetalDemo/Images.xcassets/AppIcon.appiconset/Icon~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objcio/metal-demo-objcio/HEAD/MetalDemo/Images.xcassets/AppIcon.appiconset/Icon~ipad.png -------------------------------------------------------------------------------- /MetalDemo/Images.xcassets/AppIcon.appiconset/Icon@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objcio/metal-demo-objcio/HEAD/MetalDemo/Images.xcassets/AppIcon.appiconset/Icon@2x~ipad.png -------------------------------------------------------------------------------- /MetalDemo/METLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // METLViewController.h 3 | // MetalDemo 4 | // 5 | // Created by Warren Moore on 10/28/14. 6 | // Copyright (c) 2014 objc.io. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface METLViewController : UIViewController 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /MetalDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MetalDemo 4 | // 5 | // Created by Warren Moore on 10/28/14. 6 | // Copyright (c) 2014 objc.io. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /MetalDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MetalDemo 4 | // 5 | // Created by Warren Moore on 10/28/14. 6 | // Copyright (c) 2014 objc.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /MetalDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MetalDemo 4 | // 5 | // Created by Warren Moore on 10/28/14. 6 | // Copyright (c) 2014 objc.io. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 14 | return YES; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # XCode 4 .gitignore Template 2 | # Originally created by Gary Longsine 3 | # Extended for XCode 4 by Tod Karpinski 4 | # Compiled by Warren Moore 5 | 6 | # Mac OS X Finder and whatnot 7 | .DS_Store 8 | 9 | # Sparkle distribution Private Key 10 | dsa_priv.pem 11 | 12 | # XCode (and ancestors) per-user config 13 | *.mode1 14 | *.mode1v3 15 | *.mode2v3 16 | *.perspective 17 | *.perspectivev3 18 | *.pbxuser 19 | *.xcworkspace/ 20 | xcuserdata/ 21 | 22 | # Generated files 23 | VersionX-revision.h 24 | 25 | # build products 26 | build/ 27 | *.[oa] 28 | 29 | # Other source repository archive directories (protects when importing) 30 | .hg 31 | .svn 32 | CVS 33 | 34 | # Automatic backup files 35 | *~.nib 36 | *.swp 37 | *~ 38 | *(Autosaved).rtfd/ 39 | Backup[ ]of[ ]*.pages/ 40 | Backup[ ]of[ ]*.key/ 41 | Backup[ ]of[ ]*.numbers/ 42 | -------------------------------------------------------------------------------- /MetalDemo/Shaders.metal: -------------------------------------------------------------------------------- 1 | // 2 | // Shaders.metal 3 | // MetalDemo 4 | // 5 | // Created by Warren Moore on 10/28/14. 6 | // Copyright (c) 2014 objc.io. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | 12 | using namespace metal; 13 | 14 | typedef struct 15 | { 16 | float4x4 rotation_matrix; 17 | } Uniforms; 18 | 19 | typedef struct 20 | { 21 | float4 position; 22 | float4 color; 23 | } VertexIn; 24 | 25 | typedef struct { 26 | float4 position [[position]]; 27 | half4 color; 28 | } VertexOut; 29 | 30 | vertex VertexOut vertex_function(device VertexIn *vertices [[buffer(0)]], 31 | constant Uniforms &uniforms [[buffer(1)]], 32 | uint vid [[vertex_id]]) 33 | { 34 | VertexOut out; 35 | out.position = uniforms.rotation_matrix * vertices[vid].position; 36 | out.color = half4(vertices[vid].color); 37 | return out; 38 | } 39 | 40 | fragment half4 fragment_function(VertexOut in [[stage_in]]) 41 | { 42 | return in.color; 43 | } 44 | -------------------------------------------------------------------------------- /MetalDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "size" : "60x60", 25 | "idiom" : "iphone", 26 | "filename" : "Icon@2x.png", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "size" : "60x60", 31 | "idiom" : "iphone", 32 | "filename" : "Icon@3x.png", 33 | "scale" : "3x" 34 | }, 35 | { 36 | "idiom" : "ipad", 37 | "size" : "29x29", 38 | "scale" : "1x" 39 | }, 40 | { 41 | "idiom" : "ipad", 42 | "size" : "29x29", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "40x40", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "idiom" : "ipad", 52 | "size" : "40x40", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "size" : "76x76", 57 | "idiom" : "ipad", 58 | "filename" : "Icon~ipad.png", 59 | "scale" : "1x" 60 | }, 61 | { 62 | "size" : "76x76", 63 | "idiom" : "ipad", 64 | "filename" : "Icon@2x~ipad.png", 65 | "scale" : "2x" 66 | } 67 | ], 68 | "info" : { 69 | "version" : 1, 70 | "author" : "xcode" 71 | } 72 | } -------------------------------------------------------------------------------- /MetalDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /MetalDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | io.objc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | metal 33 | 34 | UIStatusBarHidden 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MetalDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /MetalDemo/METLViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // METLViewController.m 3 | // MetalDemo 4 | // 5 | // Created by Warren Moore on 10/28/14. 6 | // Copyright (c) 2014 objc.io. All rights reserved. 7 | // 8 | 9 | #import "METLViewController.h" 10 | 11 | @import Metal; 12 | @import simd; 13 | @import QuartzCore.CAMetalLayer; 14 | 15 | static matrix_float4x4 rotation_matrix_2d(float radians) 16 | { 17 | float cos = cosf(radians); 18 | float sin = sinf(radians); 19 | 20 | matrix_float4x4 m = { 21 | .columns[0] = { cos, sin, 0, 0 }, 22 | .columns[1] = { -sin, cos, 0, 0 }, 23 | .columns[2] = { 0, 0, 1, 0 }, 24 | .columns[3] = { 0, 0, 0, 1 } 25 | }; 26 | return m; 27 | } 28 | 29 | static float quadVertexData[] = 30 | { 31 | 0.5, -0.5, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 32 | -0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 33 | -0.5, 0.5, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 34 | 35 | 0.5, 0.5, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 36 | 0.5, -0.5, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 37 | -0.5, 0.5, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 38 | }; 39 | 40 | typedef struct 41 | { 42 | matrix_float4x4 rotation_matrix; 43 | } Uniforms; 44 | 45 | @interface METLViewController () 46 | 47 | // Long-lived Metal objects 48 | @property (nonatomic, strong) CAMetalLayer *metalLayer; 49 | @property (nonatomic, strong) id device; 50 | @property (nonatomic, strong) id commandQueue; 51 | @property (nonatomic, strong) id defaultLibrary; 52 | @property (nonatomic, strong) id pipelineState; 53 | 54 | // Resources 55 | @property (nonatomic, strong) id uniformBuffer; 56 | @property (nonatomic, strong) id vertexBuffer; 57 | 58 | // Transient objects 59 | @property (nonatomic, strong) id currentDrawable; 60 | 61 | @property (nonatomic, strong) CADisplayLink *timer; 62 | 63 | @property (nonatomic, assign) BOOL layerSizeDidUpdate; 64 | @property (nonatomic, assign) Uniforms uniforms; 65 | @property (nonatomic, assign) float rotationAngle; 66 | 67 | @end 68 | 69 | @implementation METLViewController 70 | 71 | - (void)dealloc { 72 | [_timer invalidate]; 73 | } 74 | 75 | - (void)viewDidLoad { 76 | [super viewDidLoad]; 77 | 78 | [self setupMetal]; 79 | [self buildPipeline]; 80 | 81 | // Set up the render loop to redraw in sync with the main screen refresh rate 82 | self.timer = [CADisplayLink displayLinkWithTarget:self selector:@selector(redraw)]; 83 | [self.timer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; 84 | } 85 | 86 | - (BOOL)prefersStatusBarHidden { 87 | return YES; 88 | } 89 | 90 | - (void)setupMetal { 91 | // Create the default Metal device 92 | self.device = MTLCreateSystemDefaultDevice(); 93 | 94 | // Create, configure, and add a Metal sublayer to the current layer 95 | self.metalLayer = [CAMetalLayer layer]; 96 | self.metalLayer.device = self.device; 97 | self.metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; 98 | self.metalLayer.frame = self.view.bounds; 99 | [self.view.layer addSublayer:self.metalLayer]; 100 | 101 | // Create a long-lived command queue 102 | self.commandQueue = [self.device newCommandQueue]; 103 | 104 | // Get the library that contains the functions compiled into our app bundle 105 | self.defaultLibrary = [self.device newDefaultLibrary]; 106 | 107 | self.view.contentScaleFactor = [UIScreen mainScreen].scale; 108 | } 109 | 110 | - (void)buildPipeline { 111 | // Generate a vertex buffer for holding the vertex data of the quad 112 | self.vertexBuffer = [self.device newBufferWithBytes:quadVertexData 113 | length:sizeof(quadVertexData) 114 | options:MTLResourceOptionCPUCacheModeDefault]; 115 | 116 | // Generate a buffer for holding the uniform rotation matrix 117 | self.uniformBuffer = [self.device newBufferWithLength:sizeof(Uniforms) options:MTLResourceOptionCPUCacheModeDefault]; 118 | 119 | // Fetch the vertex and fragment functions from the library 120 | id vertexProgram = [self.defaultLibrary newFunctionWithName:@"vertex_function"]; 121 | id fragmentProgram = [self.defaultLibrary newFunctionWithName:@"fragment_function"]; 122 | 123 | // Build a render pipeline descriptor with the desired functions 124 | MTLRenderPipelineDescriptor *pipelineStateDescriptor = [[MTLRenderPipelineDescriptor alloc] init]; 125 | [pipelineStateDescriptor setVertexFunction:vertexProgram]; 126 | [pipelineStateDescriptor setFragmentFunction:fragmentProgram]; 127 | pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm; 128 | 129 | // Compile the render pipeline 130 | NSError* error = NULL; 131 | self.pipelineState = [self.device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor error:&error]; 132 | if (!self.pipelineState) { 133 | NSLog(@"Failed to created pipeline state, error %@", error); 134 | } 135 | } 136 | 137 | - (MTLRenderPassDescriptor *)renderPassDescriptorForTexture:(id) texture 138 | { 139 | // Configure a render pass with properties applicable to its single color attachment (i.e., the framebuffer) 140 | MTLRenderPassDescriptor *renderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor]; 141 | renderPassDescriptor.colorAttachments[0].texture = texture; 142 | renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear; 143 | renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(1, 1, 1, 1); 144 | renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore; 145 | return renderPassDescriptor; 146 | } 147 | 148 | - (void)render { 149 | [self update]; 150 | 151 | id commandBuffer = [self.commandQueue commandBuffer]; 152 | 153 | id drawable = [self currentDrawable]; 154 | 155 | // Set up a render pass to draw into the current drawable's texture 156 | MTLRenderPassDescriptor *renderPassDescriptor = [self renderPassDescriptorForTexture:drawable.texture]; 157 | 158 | // Prepare a render command encoder with the current render pass 159 | id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; 160 | 161 | // Configure and issue our draw call 162 | [renderEncoder setRenderPipelineState:self.pipelineState]; 163 | [renderEncoder setVertexBuffer:self.vertexBuffer offset:0 atIndex:0]; 164 | [renderEncoder setVertexBuffer:self.uniformBuffer offset:0 atIndex:1]; 165 | [renderEncoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:6]; 166 | 167 | [renderEncoder endEncoding]; 168 | 169 | // Request that the current drawable be presented when rendering is done 170 | [commandBuffer presentDrawable:drawable]; 171 | 172 | // Finalize the command buffer and commit it to its queue 173 | [commandBuffer commit]; 174 | } 175 | 176 | - (void)update { 177 | // Generate a rotation matrix for the current rotation angle 178 | _uniforms.rotation_matrix = rotation_matrix_2d(self.rotationAngle); 179 | 180 | // Copy the rotation matrix into the uniform buffer for the next frame 181 | void *bufferPointer = [self.uniformBuffer contents]; 182 | memcpy(bufferPointer, &_uniforms, sizeof(Uniforms)); 183 | 184 | // Update the rotation angle 185 | _rotationAngle += 0.01; 186 | } 187 | 188 | - (void)redraw { 189 | @autoreleasepool { 190 | if (self.layerSizeDidUpdate) { 191 | // Ensure that the drawable size of the Metal layer is equal to its dimensions in pixels 192 | CGFloat nativeScale = self.view.window.screen.nativeScale; 193 | CGSize drawableSize = self.metalLayer.bounds.size; 194 | drawableSize.width *= nativeScale; 195 | drawableSize.height *= nativeScale; 196 | self.metalLayer.drawableSize = drawableSize; 197 | 198 | self.layerSizeDidUpdate = NO; 199 | } 200 | 201 | // Draw the scene 202 | [self render]; 203 | 204 | self.currentDrawable = nil; 205 | } 206 | } 207 | 208 | - (void)viewDidLayoutSubviews { 209 | self.layerSizeDidUpdate = YES; 210 | 211 | // Re-center the Metal layer in its containing layer with a 1:1 aspect ratio 212 | CGSize parentSize = self.view.bounds.size; 213 | CGFloat minSize = MIN(parentSize.width, parentSize.height); 214 | CGRect frame = CGRectMake((parentSize.width - minSize) / 2, 215 | (parentSize.height - minSize) / 2, 216 | minSize, 217 | minSize); 218 | [self.metalLayer setFrame:frame]; 219 | } 220 | 221 | - (id )currentDrawable { 222 | // Our drawable may be nil if we're not on the screen or we've taken too long to render. 223 | // Block here until we can draw again. 224 | while (_currentDrawable == nil) { 225 | _currentDrawable = [self.metalLayer nextDrawable]; 226 | } 227 | 228 | return _currentDrawable; 229 | } 230 | 231 | @end 232 | -------------------------------------------------------------------------------- /MetalDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 837871CE1A0096BB00212C67 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 837871CD1A0096BB00212C67 /* main.m */; }; 11 | 837871D11A0096BB00212C67 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 837871D01A0096BB00212C67 /* AppDelegate.m */; }; 12 | 837871D41A0096BB00212C67 /* METLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 837871D31A0096BB00212C67 /* METLViewController.m */; }; 13 | 837871D61A0096BB00212C67 /* Shaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 837871D51A0096BB00212C67 /* Shaders.metal */; }; 14 | 837871D91A0096BB00212C67 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 837871D71A0096BB00212C67 /* Main.storyboard */; }; 15 | 837871DB1A0096BB00212C67 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 837871DA1A0096BB00212C67 /* Images.xcassets */; }; 16 | 837871DE1A0096BB00212C67 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 837871DC1A0096BB00212C67 /* LaunchScreen.xib */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 837871C81A0096BB00212C67 /* MetalDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MetalDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 837871CC1A0096BB00212C67 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 22 | 837871CD1A0096BB00212C67 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 23 | 837871CF1A0096BB00212C67 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 24 | 837871D01A0096BB00212C67 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 25 | 837871D21A0096BB00212C67 /* METLViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = METLViewController.h; sourceTree = ""; }; 26 | 837871D31A0096BB00212C67 /* METLViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = METLViewController.m; sourceTree = ""; }; 27 | 837871D51A0096BB00212C67 /* Shaders.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Shaders.metal; sourceTree = ""; }; 28 | 837871D81A0096BB00212C67 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | 837871DA1A0096BB00212C67 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 30 | 837871DD1A0096BB00212C67 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 837871C51A0096BB00212C67 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 837871BF1A0096BB00212C67 = { 45 | isa = PBXGroup; 46 | children = ( 47 | 837871CA1A0096BB00212C67 /* MetalDemo */, 48 | 837871C91A0096BB00212C67 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 837871C91A0096BB00212C67 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 837871C81A0096BB00212C67 /* MetalDemo.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 837871CA1A0096BB00212C67 /* MetalDemo */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 837871CF1A0096BB00212C67 /* AppDelegate.h */, 64 | 837871D01A0096BB00212C67 /* AppDelegate.m */, 65 | 837871D21A0096BB00212C67 /* METLViewController.h */, 66 | 837871D31A0096BB00212C67 /* METLViewController.m */, 67 | 837871D51A0096BB00212C67 /* Shaders.metal */, 68 | 837871D71A0096BB00212C67 /* Main.storyboard */, 69 | 837871DA1A0096BB00212C67 /* Images.xcassets */, 70 | 837871DC1A0096BB00212C67 /* LaunchScreen.xib */, 71 | 837871CB1A0096BB00212C67 /* Supporting Files */, 72 | ); 73 | path = MetalDemo; 74 | sourceTree = ""; 75 | }; 76 | 837871CB1A0096BB00212C67 /* Supporting Files */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 837871CC1A0096BB00212C67 /* Info.plist */, 80 | 837871CD1A0096BB00212C67 /* main.m */, 81 | ); 82 | name = "Supporting Files"; 83 | sourceTree = ""; 84 | }; 85 | /* End PBXGroup section */ 86 | 87 | /* Begin PBXNativeTarget section */ 88 | 837871C71A0096BB00212C67 /* MetalDemo */ = { 89 | isa = PBXNativeTarget; 90 | buildConfigurationList = 837871ED1A0096BB00212C67 /* Build configuration list for PBXNativeTarget "MetalDemo" */; 91 | buildPhases = ( 92 | 837871C41A0096BB00212C67 /* Sources */, 93 | 837871C51A0096BB00212C67 /* Frameworks */, 94 | 837871C61A0096BB00212C67 /* Resources */, 95 | ); 96 | buildRules = ( 97 | ); 98 | dependencies = ( 99 | ); 100 | name = MetalDemo; 101 | productName = MetalDemo; 102 | productReference = 837871C81A0096BB00212C67 /* MetalDemo.app */; 103 | productType = "com.apple.product-type.application"; 104 | }; 105 | /* End PBXNativeTarget section */ 106 | 107 | /* Begin PBXProject section */ 108 | 837871C01A0096BB00212C67 /* Project object */ = { 109 | isa = PBXProject; 110 | attributes = { 111 | LastUpgradeCheck = 0610; 112 | ORGANIZATIONNAME = objc.io; 113 | TargetAttributes = { 114 | 837871C71A0096BB00212C67 = { 115 | CreatedOnToolsVersion = 6.1; 116 | }; 117 | }; 118 | }; 119 | buildConfigurationList = 837871C31A0096BB00212C67 /* Build configuration list for PBXProject "MetalDemo" */; 120 | compatibilityVersion = "Xcode 3.2"; 121 | developmentRegion = English; 122 | hasScannedForEncodings = 0; 123 | knownRegions = ( 124 | en, 125 | Base, 126 | ); 127 | mainGroup = 837871BF1A0096BB00212C67; 128 | productRefGroup = 837871C91A0096BB00212C67 /* Products */; 129 | projectDirPath = ""; 130 | projectRoot = ""; 131 | targets = ( 132 | 837871C71A0096BB00212C67 /* MetalDemo */, 133 | ); 134 | }; 135 | /* End PBXProject section */ 136 | 137 | /* Begin PBXResourcesBuildPhase section */ 138 | 837871C61A0096BB00212C67 /* Resources */ = { 139 | isa = PBXResourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | 837871D91A0096BB00212C67 /* Main.storyboard in Resources */, 143 | 837871DE1A0096BB00212C67 /* LaunchScreen.xib in Resources */, 144 | 837871DB1A0096BB00212C67 /* Images.xcassets in Resources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXResourcesBuildPhase section */ 149 | 150 | /* Begin PBXSourcesBuildPhase section */ 151 | 837871C41A0096BB00212C67 /* Sources */ = { 152 | isa = PBXSourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | 837871D61A0096BB00212C67 /* Shaders.metal in Sources */, 156 | 837871D11A0096BB00212C67 /* AppDelegate.m in Sources */, 157 | 837871D41A0096BB00212C67 /* METLViewController.m in Sources */, 158 | 837871CE1A0096BB00212C67 /* main.m in Sources */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXSourcesBuildPhase section */ 163 | 164 | /* Begin PBXVariantGroup section */ 165 | 837871D71A0096BB00212C67 /* Main.storyboard */ = { 166 | isa = PBXVariantGroup; 167 | children = ( 168 | 837871D81A0096BB00212C67 /* Base */, 169 | ); 170 | name = Main.storyboard; 171 | sourceTree = ""; 172 | }; 173 | 837871DC1A0096BB00212C67 /* LaunchScreen.xib */ = { 174 | isa = PBXVariantGroup; 175 | children = ( 176 | 837871DD1A0096BB00212C67 /* Base */, 177 | ); 178 | name = LaunchScreen.xib; 179 | sourceTree = ""; 180 | }; 181 | /* End PBXVariantGroup section */ 182 | 183 | /* Begin XCBuildConfiguration section */ 184 | 837871EB1A0096BB00212C67 /* Debug */ = { 185 | isa = XCBuildConfiguration; 186 | buildSettings = { 187 | ALWAYS_SEARCH_USER_PATHS = NO; 188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 189 | CLANG_CXX_LIBRARY = "libc++"; 190 | CLANG_ENABLE_MODULES = YES; 191 | CLANG_ENABLE_OBJC_ARC = YES; 192 | CLANG_WARN_BOOL_CONVERSION = YES; 193 | CLANG_WARN_CONSTANT_CONVERSION = YES; 194 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 195 | CLANG_WARN_EMPTY_BODY = YES; 196 | CLANG_WARN_ENUM_CONVERSION = YES; 197 | CLANG_WARN_INT_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_UNREACHABLE_CODE = YES; 200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 201 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 202 | COPY_PHASE_STRIP = NO; 203 | ENABLE_STRICT_OBJC_MSGSEND = YES; 204 | GCC_C_LANGUAGE_STANDARD = gnu99; 205 | GCC_DYNAMIC_NO_PIC = NO; 206 | GCC_OPTIMIZATION_LEVEL = 0; 207 | GCC_PREPROCESSOR_DEFINITIONS = ( 208 | "DEBUG=1", 209 | "$(inherited)", 210 | ); 211 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 212 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 213 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 214 | GCC_WARN_UNDECLARED_SELECTOR = YES; 215 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 216 | GCC_WARN_UNUSED_FUNCTION = YES; 217 | GCC_WARN_UNUSED_VARIABLE = YES; 218 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 219 | MTL_ENABLE_DEBUG_INFO = YES; 220 | ONLY_ACTIVE_ARCH = YES; 221 | SDKROOT = iphoneos; 222 | TARGETED_DEVICE_FAMILY = "1,2"; 223 | }; 224 | name = Debug; 225 | }; 226 | 837871EC1A0096BB00212C67 /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | ALWAYS_SEARCH_USER_PATHS = NO; 230 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 231 | CLANG_CXX_LIBRARY = "libc++"; 232 | CLANG_ENABLE_MODULES = YES; 233 | CLANG_ENABLE_OBJC_ARC = YES; 234 | CLANG_WARN_BOOL_CONVERSION = YES; 235 | CLANG_WARN_CONSTANT_CONVERSION = YES; 236 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 237 | CLANG_WARN_EMPTY_BODY = YES; 238 | CLANG_WARN_ENUM_CONVERSION = YES; 239 | CLANG_WARN_INT_CONVERSION = YES; 240 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 241 | CLANG_WARN_UNREACHABLE_CODE = YES; 242 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 243 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 244 | COPY_PHASE_STRIP = YES; 245 | ENABLE_NS_ASSERTIONS = NO; 246 | ENABLE_STRICT_OBJC_MSGSEND = YES; 247 | GCC_C_LANGUAGE_STANDARD = gnu99; 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 250 | GCC_WARN_UNDECLARED_SELECTOR = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 252 | GCC_WARN_UNUSED_FUNCTION = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 255 | MTL_ENABLE_DEBUG_INFO = NO; 256 | SDKROOT = iphoneos; 257 | TARGETED_DEVICE_FAMILY = "1,2"; 258 | VALIDATE_PRODUCT = YES; 259 | }; 260 | name = Release; 261 | }; 262 | 837871EE1A0096BB00212C67 /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 266 | INFOPLIST_FILE = MetalDemo/Info.plist; 267 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | }; 270 | name = Debug; 271 | }; 272 | 837871EF1A0096BB00212C67 /* Release */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 276 | INFOPLIST_FILE = MetalDemo/Info.plist; 277 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 278 | PRODUCT_NAME = "$(TARGET_NAME)"; 279 | }; 280 | name = Release; 281 | }; 282 | /* End XCBuildConfiguration section */ 283 | 284 | /* Begin XCConfigurationList section */ 285 | 837871C31A0096BB00212C67 /* Build configuration list for PBXProject "MetalDemo" */ = { 286 | isa = XCConfigurationList; 287 | buildConfigurations = ( 288 | 837871EB1A0096BB00212C67 /* Debug */, 289 | 837871EC1A0096BB00212C67 /* Release */, 290 | ); 291 | defaultConfigurationIsVisible = 0; 292 | defaultConfigurationName = Release; 293 | }; 294 | 837871ED1A0096BB00212C67 /* Build configuration list for PBXNativeTarget "MetalDemo" */ = { 295 | isa = XCConfigurationList; 296 | buildConfigurations = ( 297 | 837871EE1A0096BB00212C67 /* Debug */, 298 | 837871EF1A0096BB00212C67 /* Release */, 299 | ); 300 | defaultConfigurationIsVisible = 0; 301 | }; 302 | /* End XCConfigurationList section */ 303 | }; 304 | rootObject = 837871C01A0096BB00212C67 /* Project object */; 305 | } 306 | --------------------------------------------------------------------------------