Last active
October 6, 2018 04:06
-
-
Save kunofellasleep/6c680caac85c6be1fd17dc08f9cda2d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ハードウェアとしてのGPUを抽象化したプロトコル | |
lazy var device: MTLDevice! = MTLCreateSystemDefaultDevice() | |
//コマンドバッファの実行順を管理するキュー | |
var commandQueue: MTLCommandQueue! | |
public func Setup() { | |
let defaultLibrary = device.makeDefaultLibrary()! | |
if let target = defaultLibrary.makeFunction(name: funcName) { | |
commandQueue = device.makeCommandQueue() | |
do { | |
pipelineState = try device.makeComputePipelineState(function: target) | |
} catch { | |
fatalError("Impossible to setup MTL") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment