Fix runtime errors

This commit is contained in:
daemyung jang 2022-04-05 00:11:08 +09:00
parent 6e21d3a9e9
commit 6afaf3062c
No known key found for this signature in database
GPG Key ID: 44160C9958A9C67B
3 changed files with 3 additions and 9 deletions

View File

@ -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 let e {

View File

@ -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 let e {

View File

@ -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 let e {