Fix runtime errors
This commit is contained in:
parent
8ad28f0d9f
commit
ea2b9fc758
|
|
@ -18,9 +18,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 {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,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 {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,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 let e {
|
||||
|
|
|
|||
Loading…
Reference in New Issue