Fix runtime errors
This commit is contained in:
parent
6e21d3a9e9
commit
6afaf3062c
|
|
@ -17,9 +17,7 @@ public class Renderer: NSObject, MTKViewDelegate {
|
||||||
device = MTLCreateSystemDefaultDevice()
|
device = MTLCreateSystemDefaultDevice()
|
||||||
queue = device!.makeCommandQueue()
|
queue = device!.makeCommandQueue()
|
||||||
do {
|
do {
|
||||||
guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() }
|
let library = device.makeDefaultLibrary()!
|
||||||
let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
|
|
||||||
let library = try device.makeLibrary(source: input, options: nil)
|
|
||||||
guard let kernel = library.makeFunction(name: "compute") else { fatalError() }
|
guard let kernel = library.makeFunction(name: "compute") else { fatalError() }
|
||||||
pipelineState = try device.makeComputePipelineState(function: kernel)
|
pipelineState = try device.makeComputePipelineState(function: kernel)
|
||||||
} catch let e {
|
} catch let e {
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ public class Renderer: NSObject, MTKViewDelegate {
|
||||||
device = MTLCreateSystemDefaultDevice()
|
device = MTLCreateSystemDefaultDevice()
|
||||||
queue = device!.makeCommandQueue()
|
queue = device!.makeCommandQueue()
|
||||||
do {
|
do {
|
||||||
guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() }
|
let library = device.makeDefaultLibrary()!
|
||||||
let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
|
|
||||||
let library = try device.makeLibrary(source: input, options: nil)
|
|
||||||
guard let kernel = library.makeFunction(name: "compute") else { fatalError() }
|
guard let kernel = library.makeFunction(name: "compute") else { fatalError() }
|
||||||
pipelineState = try device.makeComputePipelineState(function: kernel)
|
pipelineState = try device.makeComputePipelineState(function: kernel)
|
||||||
} catch let e {
|
} catch let e {
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ public class Renderer: NSObject, MTKViewDelegate {
|
||||||
device = MTLCreateSystemDefaultDevice()
|
device = MTLCreateSystemDefaultDevice()
|
||||||
queue = device!.makeCommandQueue()
|
queue = device!.makeCommandQueue()
|
||||||
do {
|
do {
|
||||||
guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() }
|
let library = device.makeDefaultLibrary()!
|
||||||
let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
|
|
||||||
let library = try device.makeLibrary(source: input, options: nil)
|
|
||||||
guard let kernel = library.makeFunction(name: "compute") else { fatalError() }
|
guard let kernel = library.makeFunction(name: "compute") else { fatalError() }
|
||||||
pipelineState = try device.makeComputePipelineState(function: kernel)
|
pipelineState = try device.makeComputePipelineState(function: kernel)
|
||||||
} catch let e {
|
} catch let e {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue