iOS - Metal - MTLDevice 文檔翻譯

/*!
 @brief 返回對首選系統(tǒng)默認Metal設(shè)備的引用。
 @discussion 在Mac OS X系統(tǒng)上支持自動圖形切換,調(diào)用這種獲得Metal器件的API將使系統(tǒng)切換到高功率GPU。在支持多個GPU的其他系統(tǒng)上询微,它將返回GPU與主顯示相關(guān)聯(lián)武通。*/
@available(iOS 8.0, *)
public func MTLCreateSystemDefaultDevice() -> MTLDevice?

/*!
 @brief 返回系統(tǒng)中的所有Metal設(shè)備鞭光。
 @discussion 這個API不會導(dǎo)致系統(tǒng)切換設(shè)備,并根據(jù)它認為合適的標準來決定使用哪個GPU來使用應(yīng)用程序日戈。
*/

@available(iOS 8.0, *)
public enum MTLFeatureSet : UInt {


@available(iOS 8.0, *)
case iOS_GPUFamily1_v1

@available(iOS 8.0, *)
case iOS_GPUFamily2_v1


@available(iOS 9.0, *)
case iOS_GPUFamily1_v2

@available(iOS 9.0, *)
case iOS_GPUFamily2_v2

@available(iOS 9.0, *)
case iOS_GPUFamily3_v1


@available(iOS 10.0, *)
case iOS_GPUFamily1_v3

@available(iOS 10.0, *)
case iOS_GPUFamily2_v3

@available(iOS 10.0, *)
case iOS_GPUFamily3_v2
}

/*!
 @enum MTLPipelineOption
 @abstract 控制管道(pipeline)的創(chuàng)建
 */
@available(iOS 8.0, *)
public struct MTLPipelineOption : OptionSet {

public init(rawValue: UInt)


public static var argumentInfo: MTLPipelineOption { get }

public static var bufferTypeInfo: MTLPipelineOption { get }
}

/*!
 @abstract 表示內(nèi)存大小和字節(jié)對齊另凌。
 */
public struct MTLSizeAndAlign {

public var size: Int

public var align: Int

public init()

public init(size: Int, align: Int)
}

/* Convenience typedef谱轨,它可以很容易地聲明某些返回類型的存儲。 */
public typealias MTLAutoreleasedRenderPipelineReflection = MTLRenderPipelineReflection
public typealias MTLAutoreleasedComputePipelineReflection = MTLComputePipelineReflection

public typealias MTLNewLibraryCompletionHandler = (MTLLibrary?, Error?) -> Swift.Void

public typealias MTLNewRenderPipelineStateCompletionHandler = (MTLRenderPipelineState?, Error?) -> Swift.Void
public typealias MTLNewRenderPipelineStateWithReflectionCompletionHandler = (MTLRenderPipelineState?, MTLRenderPipelineReflection?, Error?) -> Swift.Void

public typealias MTLNewComputePipelineStateCompletionHandler = (MTLComputePipelineState?, Error?) -> Swift.Void
public typealias MTLNewComputePipelineStateWithReflectionCompletionHandler = (MTLComputePipelineState?, MTLComputePipelineReflection?, Error?) -> Swift.Void


/*!
 @protocol MTLDevice
 @abstract MTLDevice 表示能夠進行數(shù)據(jù)并行計算的處理器
 */
@available(iOS 8.0, *)
public protocol MTLDevice : NSObjectProtocol {

/*!
 @property name
 @abstract 供應(yīng)商設(shè)備的全名途茫。
 */
public var name: String? { get }


/*!
 @property maxThreadsPerThreadgroup
 @abstract 每個維度上的最大線程數(shù)碟嘴。
 */
@available(iOS 9.0, *)
public var maxThreadsPerThreadgroup: MTLSize { get }


/*!
 @method newCommandQueue
 @brief 創(chuàng)建并返回一個新的命令隊列。通過此方法創(chuàng)建的命令隊列只允許64個未完成的命令緩沖區(qū)囊卜。
 @return 新的命令隊列對象
 */
public func makeCommandQueue() -> MTLCommandQueue


/*!
 @method newCommandQueueWithMaxCommandBufferCount
 @brief 創(chuàng)建并返回一個包含未完成的命令緩沖區(qū)的新命令隊列。
 @return 新的命令隊列對象
 */
public func makeCommandQueue(maxCommandBufferCount: Int) -> MTLCommandQueue


/*!
 @method heapTextureSizeAndAlignWithDescriptor:
 @abstract 當從堆中分配時错沃,確定紋理的字節(jié)大小栅组。
 @discussion 此方法可用于幫助確定所需的堆大小。
 */
@available(iOS 10.0, *)
public func heapTextureSizeAndAlign(descriptor desc: MTLTextureDescriptor) -> MTLSizeAndAlign


/*!
 @method heapBufferSizeAndAlignWithLength:options:
 @abstract 從堆中分配子分配時枢析,確定緩沖區(qū)的字節(jié)大小玉掸。
 @discussion 此方法可用于幫助確定所需的堆大小。
 */
@available(iOS 10.0, *)
public func heapBufferSizeAndAlign(length: Int, options: MTLResourceOptions = []) -> MTLSizeAndAlign


/*!
 @method newHeapWithDescriptor:
 @abstract 創(chuàng)建帶有給定描述符的新堆醒叁。
 */
@available(iOS 10.0, *)
public func makeHeap(descriptor: MTLHeapDescriptor) -> MTLHeap


/*!
 @method newBufferWithLength:options:
 @brief Create a buffer by allocating new memory.
 */
public func makeBuffer(length: Int, options: MTLResourceOptions = []) -> MTLBuffer


/*!
 @method newBufferWithBytes:length:options:
 @brief 通過分配新的內(nèi)存創(chuàng)建緩沖區(qū)司浪。
 */
public func makeBuffer(bytes pointer: UnsafeRawPointer, length: Int, options: MTLResourceOptions = []) -> MTLBuffer


/*!
 @method newBufferWithBytesNoCopy:length:options:deallocator:
 @brief 通過封裝地址空間的現(xiàn)有部分來創(chuàng)建緩沖區(qū)。
 */
public func makeBuffer(bytesNoCopy pointer: UnsafeMutableRawPointer, length: Int, options: MTLResourceOptions = [], deallocator: ((UnsafeMutableRawPointer, Int) -> Swift.Void)? = nil) -> MTLBuffer


/*!
 @method newDepthStencilStateWithDescriptor:
 @brief 創(chuàng)建一個深度/模板測試狀態(tài)對象把沼。
 */
public func makeDepthStencilState(descriptor: MTLDepthStencilDescriptor) -> MTLDepthStencilState


/*!
 @method newTextureWithDescriptor:
 @abstract 使用私有存儲分配新紋理啊易。
 */
public func makeTexture(descriptor: MTLTextureDescriptor) -> MTLTexture


/*!
 @method newSamplerStateWithDescriptor:
 @abstract 創(chuàng)建一個新的取樣器。
*/
public func makeSamplerState(descriptor: MTLSamplerDescriptor) -> MTLSamplerState


/*!
 @method newDefaultLibrary
 @abstract 返回主包的默認庫饮睬。
 @discussion 使用newDefaultLibraryWithBundle:錯誤:得到一個NSError在失敗的情況下租谈。
 */
public func newDefaultLibrary() -> MTLLibrary?


/*
 @method newDefaultLibraryWithBundle:error:
 @abstract 返回給定bundle的默認庫
 @return 一個指向庫的指針,如果出現(xiàn)錯誤捆愁,則為nil割去。
*/
@available(iOS 10.0, *)
public func makeDefaultLibrary(bundle: Bundle) throws -> MTLLibrary


/*!
 @method newLibraryWithFile:
 @abstract 從一個Metal庫文件加載一個MTLLibrary。
 */
public func makeLibrary(filepath: String) throws -> MTLLibrary


/*!
 @method newLibraryWithData:
 @abstract 從dispatch_data_t加載一個MTLLibrary
 @param data 已經(jīng)以dispatch_data_t的形式加載的Metal庫文件昼丑。
 @param error 如果我們沒有打開Metal庫數(shù)據(jù)呻逆,會出現(xiàn)錯誤。
 */
public func makeLibrary(data: __DispatchData) throws -> MTLLibrary


/*!
 @method newLibraryWithSource:options:error:
 @abstract 從源裝載一個MTLLibrary菩帝。
 */
public func makeLibrary(source: String, options: MTLCompileOptions?) throws -> MTLLibrary


/*!
 @method newLibraryWithSource:options:completionHandler:
 @abstract 從源裝載一個MTLLibrary咖城。
 */
public func makeLibrary(source: String, options: MTLCompileOptions?, completionHandler: @escaping Metal.MTLNewLibraryCompletionHandler)


/*!
 @method newRenderPipelineStateWithDescriptor:error:
 @abstract 同步創(chuàng)建和編譯一個新的mtlrender管道對象茬腿。
 */
public func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor) throws -> MTLRenderPipelineState


/*!
 @method newRenderPipelineStateWithDescriptor:options:reflection:error:
 @abstract 創(chuàng)建并編譯一個新的mtlrender管線對象,并返回額外的反射信息酒繁。
 */
public func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer<MTLAutoreleasedRenderPipelineReflection?>?) throws -> MTLRenderPipelineState


/*!
 @method newRenderPipelineState:completionHandler:
 @abstract 異步創(chuàng)建和編譯一個新的mtlrender管線對象滓彰。
 */
public func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, completionHandler: @escaping Metal.MTLNewRenderPipelineStateCompletionHandler)


/*!
 @method newRenderPipelineState:options:completionHandler:
 @abstract 創(chuàng)建并編譯一個新的mtlrender管線對象,并返回額外的反射信息
 */
public func makeRenderPipelineState(descriptor: MTLRenderPipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping Metal.MTLNewRenderPipelineStateWithReflectionCompletionHandler)


/*!
 @method newComputePipelineStateWithDescriptor:error:
 @abstract 同步創(chuàng)建和編譯一個新的mtlcomputeUNK inestate對象州袒。
 */
public func makeComputePipelineState(function computeFunction: MTLFunction) throws -> MTLComputePipelineState


/*!
 @method newComputePipelineStateWithDescriptor:options:reflection:error:
 @abstract 同步創(chuàng)建和編譯一個新的mtlcomputeUNK inestate對象揭绑。
 */
public func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer<MTLAutoreleasedComputePipelineReflection?>?) throws -> MTLComputePipelineState


/*!
 @method newComputePipelineStateWithDescriptor:completionHandler:
 @abstract異步地創(chuàng)建和編譯一個新的mtlcomputeUNK inestate對象。
 */
public func makeComputePipelineState(function computeFunction: MTLFunction, completionHandler: @escaping Metal.MTLNewComputePipelineStateCompletionHandler)


/*!
 @method newComputePipelineStateWithDescriptor:options:completionHandler:
 @abstract異步地創(chuàng)建和編譯一個新的mtlcomputeUNK inestate對象郎哭。
 */
public func makeComputePipelineState(function computeFunction: MTLFunction, options: MTLPipelineOption, completionHandler: @escaping Metal.MTLNewComputePipelineStateWithReflectionCompletionHandler)


/*!
 @method newComputePipelineStateWithDescriptor:options:reflection:error:
 @abstract 同步創(chuàng)建和編譯一個新的mtlcomputeUNK inestate對象他匪。
 */
@available(iOS 9.0, *)
public func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, reflection: AutoreleasingUnsafeMutablePointer<MTLAutoreleasedComputePipelineReflection?>?) throws -> MTLComputePipelineState


/*!
 @method newComputePipelineStateWithDescriptor:options:completionHandler:
 @abstract異步地創(chuàng)建和編譯一個新的mtlcomputeUNK inestate對象。
 */
@available(iOS 9.0, *)
public func makeComputePipelineState(descriptor: MTLComputePipelineDescriptor, options: MTLPipelineOption, completionHandler: @escaping Metal.MTLNewComputePipelineStateWithReflectionCompletionHandler)


/*!
 @method newFence
 @abstract 創(chuàng)建一個新的MTLFence對象
 */
@available(iOS 10.0, *)
public func makeFence() -> MTLFence


/*!
 @method supportsFeatureSet:
 @abstract Returns TRUE if the feature set is supported by this MTLDevice.
 */
public func supportsFeatureSet(_ featureSet: MTLFeatureSet) -> Bool


/*!
 @method supportsTextureSampleCount:
 @brief 查詢設(shè)備夸研,如果它支持給定的sampleCount的紋理邦蜜。
 @return BOOL value. 如果是,設(shè)備支持給定的紋理樣式亥至。如果沒有悼沈,設(shè)備不支持給定的sampleCount。
 */
@available(iOS 9.0, *)
public func supportsTextureSampleCount(_ sampleCount: Int) -> Bool

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末姐扮,一起剝皮案震驚了整個濱河市絮供,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌茶敏,老刑警劉巖壤靶,帶你破解...
    沈念sama閱讀 216,470評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異惊搏,居然都是意外死亡贮乳,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,393評論 3 392
  • 文/潘曉璐 我一進店門恬惯,熙熙樓的掌柜王于貴愁眉苦臉地迎上來向拆,“玉大人,你說我怎么就攤上這事宿崭∏渍。” “怎么了?”我有些...
    開封第一講書人閱讀 162,577評論 0 353
  • 文/不壞的土叔 我叫張陵葡兑,是天一觀的道長奖蔓。 經(jīng)常有香客問我,道長讹堤,這世上最難降的妖魔是什么吆鹤? 我笑而不...
    開封第一講書人閱讀 58,176評論 1 292
  • 正文 為了忘掉前任,我火速辦了婚禮洲守,結(jié)果婚禮上疑务,老公的妹妹穿的比我還像新娘沾凄。我一直安慰自己,他們只是感情好知允,可當我...
    茶點故事閱讀 67,189評論 6 388
  • 文/花漫 我一把揭開白布撒蟀。 她就那樣靜靜地躺著,像睡著了一般温鸽。 火紅的嫁衣襯著肌膚如雪保屯。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,155評論 1 299
  • 那天涤垫,我揣著相機與錄音姑尺,去河邊找鬼。 笑死蝠猬,一個胖子當著我的面吹牛切蟋,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播榆芦,決...
    沈念sama閱讀 40,041評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼柄粹,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了匆绣?” 一聲冷哼從身側(cè)響起镰惦,我...
    開封第一講書人閱讀 38,903評論 0 274
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎犬绒,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體兑凿,經(jīng)...
    沈念sama閱讀 45,319評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡凯力,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,539評論 2 332
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了礼华。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片咐鹤。...
    茶點故事閱讀 39,703評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖圣絮,靈堂內(nèi)的尸體忽然破棺而出祈惶,到底是詐尸還是另有隱情隶垮,我是刑警寧澤恒削,帶...
    沈念sama閱讀 35,417評論 5 343
  • 正文 年R本政府宣布,位于F島的核電站些己,受9級特大地震影響棒搜,放射性物質(zhì)發(fā)生泄漏疹蛉。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,013評論 3 325
  • 文/蒙蒙 一力麸、第九天 我趴在偏房一處隱蔽的房頂上張望可款。 院中可真熱鬧育韩,春花似錦、人聲如沸闺鲸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,664評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽摸恍。三九已至悉罕,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間误墓,已是汗流浹背蛮粮。 一陣腳步聲響...
    開封第一講書人閱讀 32,818評論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留谜慌,地道東北人然想。 一個月前我還...
    沈念sama閱讀 47,711評論 2 368
  • 正文 我出身青樓,卻偏偏與公主長得像欣范,于是被迫代替她去往敵國和親变泄。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 44,601評論 2 353

推薦閱讀更多精彩內(nèi)容