2017-02-16 26 views
0

我有此錯誤'cpuCacheModeDefaultCache'不可用:使用[]構造一個空選項集。SWIFT 3 - MTLResourceOptions.cpuCacheModeDefaultCache

enter image description here

+0

然後做什麼錯誤消息告訴你做。 :)做'選項:[]'。並尋找關於「選項設置」的文檔,它會很快清楚。 – Moritz

+0

當然,刪除選項是快速的方式,我想了解cpuCacheModeDefaultCache的問題。爲什麼cpuCacheModeDefaultCache不起作用? –

+2

因爲cpuCacheModeDefaultCache是​​ default *選項,與傳遞no選項相同。 Swift 3的屬性發生了變化。一切都按預期工作,只是語法有所改變。 – Moritz

回答

0

嘗試做[],這是默認行爲。如果你想使用一些特定的選項..應使用類似的東西:

MTLResourceOptions(rawValue: UInt(MTLResourceCPUCacheModeShift)) 
// or 
MTLResourceOptions(rawValue: UInt(MTLCPUCacheMode.defaultCache.rawValue))