diff --git a/18-rendering-with-rays/starter/Clouds.playground/Pages/1. SDF.xcplaygroundpage/Sources/Renderer.swift b/18-rendering-with-rays/starter/Clouds.playground/Pages/1. SDF.xcplaygroundpage/Sources/Renderer.swift index 1e6733b..763c10a 100644 --- a/18-rendering-with-rays/starter/Clouds.playground/Pages/1. SDF.xcplaygroundpage/Sources/Renderer.swift +++ b/18-rendering-with-rays/starter/Clouds.playground/Pages/1. SDF.xcplaygroundpage/Sources/Renderer.swift @@ -16,9 +16,7 @@ public class Renderer: NSObject, MTKViewDelegate { device = MTLCreateSystemDefaultDevice() queue = device!.makeCommandQueue() do { - guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() } - let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8) - let library = try device.makeLibrary(source: input, options: nil) + let library = device.makeDefaultLibrary()! guard let kernel = library.makeFunction(name: "compute") else { fatalError() } pipelineState = try device.makeComputePipelineState(function: kernel) } catch { diff --git a/18-rendering-with-rays/starter/Clouds.playground/Pages/2. Raymarching.xcplaygroundpage/Sources/Renderer.swift b/18-rendering-with-rays/starter/Clouds.playground/Pages/2. Raymarching.xcplaygroundpage/Sources/Renderer.swift index c32b2a9..eaf3c19 100644 --- a/18-rendering-with-rays/starter/Clouds.playground/Pages/2. Raymarching.xcplaygroundpage/Sources/Renderer.swift +++ b/18-rendering-with-rays/starter/Clouds.playground/Pages/2. Raymarching.xcplaygroundpage/Sources/Renderer.swift @@ -17,9 +17,7 @@ public class Renderer: NSObject, MTKViewDelegate { device = MTLCreateSystemDefaultDevice() queue = device!.makeCommandQueue() do { - guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() } - let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8) - let library = try device.makeLibrary(source: input, options: nil) + let library = device.makeDefaultLibrary()! guard let kernel = library.makeFunction(name: "compute") else { fatalError() } pipelineState = try device.makeComputePipelineState(function: kernel) } catch { diff --git a/18-rendering-with-rays/starter/Clouds.playground/Pages/3. Random Noise.xcplaygroundpage/Sources/Renderer.swift b/18-rendering-with-rays/starter/Clouds.playground/Pages/3. Random Noise.xcplaygroundpage/Sources/Renderer.swift index ed7b97c..e6539a8 100755 --- a/18-rendering-with-rays/starter/Clouds.playground/Pages/3. Random Noise.xcplaygroundpage/Sources/Renderer.swift +++ b/18-rendering-with-rays/starter/Clouds.playground/Pages/3. Random Noise.xcplaygroundpage/Sources/Renderer.swift @@ -17,10 +17,8 @@ public class Renderer: NSObject, MTKViewDelegate { func initializeMetal() { device = MTLCreateSystemDefaultDevice() queue = device!.makeCommandQueue() - let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") do { - let input = try String(contentsOfFile: path!, encoding: String.Encoding.utf8) - let library = try device!.makeLibrary(source: input, options: nil) + let library = device.makeDefaultLibrary()! let kernel = library.makeFunction(name: "compute")! pipelineState = try device!.makeComputePipelineState(function: kernel) } catch { diff --git a/18-rendering-with-rays/starter/Clouds.playground/Pages/4. Clouds.xcplaygroundpage/Sources/Renderer.swift b/18-rendering-with-rays/starter/Clouds.playground/Pages/4. Clouds.xcplaygroundpage/Sources/Renderer.swift index c32b2a9..eaf3c19 100644 --- a/18-rendering-with-rays/starter/Clouds.playground/Pages/4. Clouds.xcplaygroundpage/Sources/Renderer.swift +++ b/18-rendering-with-rays/starter/Clouds.playground/Pages/4. Clouds.xcplaygroundpage/Sources/Renderer.swift @@ -17,9 +17,7 @@ public class Renderer: NSObject, MTKViewDelegate { device = MTLCreateSystemDefaultDevice() queue = device!.makeCommandQueue() do { - guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() } - let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8) - let library = try device.makeLibrary(source: input, options: nil) + let library = device.makeDefaultLibrary()! guard let kernel = library.makeFunction(name: "compute") else { fatalError() } pipelineState = try device.makeComputePipelineState(function: kernel) } catch {