博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MTLDevice
阅读量:3611 次
发布时间:2019-05-21

本文共 19867 字,大约阅读时间需要 66 分钟。

Inherits From


Not Applicable

Conforms To


Not Applicable

Import Statement


OBJECTIVE-C

@import Metal;

Availability


Available in iOS 8.0 and later 

The MTLDevice protocol defines the interface to a single graphics processor (GPU). You use an object that conforms to this protocol to query the capabilities of the processor and to allocate objects used to access those capabilities.

Your app does not define classes that implement this protocol; it is used by Metal to provide a device object to your app. To obtain a system device, call the  function or select a result from the MTLCopyAllDevices function.

Most objects in Metal that perform graphics rendering and computational work are associated directly with a specific device. For example, texture objects are created by a device object and can be used only with that device. Most methods on a MTLDevice object create non-transient objects, including command queues, resources (such as buffers and textures), and pipeline states. These objects can be expensive to create and you are encouraged to create them soon after your app launches and reuse them throughout the lifetime of your app. Avoid creating these objects in performance sensitive code.

Identifying Properties

  •  
    Required 
    Property
  •  
    Required 
    Property
  •  
    Required
  •  
    Required

Creating Metal Shader Libraries

  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required

Creating Command Queues

  •  
    Required
  •  
    Required

Creating Resources

  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required

Creating Command Objects Needed to Render Graphics

  •  
    Required
  •  
    Required

    Asynchronously creates and returns a render pipeline state object.

    Declaration

    OBJECTIVE-C

    - (void)newRenderPipelineStateWithDescriptor:( *)descriptor

                               completionHandler:()completionHandler

    Parameters

    descriptor

    A descriptor object that contains graphics rendering state properties, including rasterization, visibility, function, and blend state.

    completionHandler

    A block of code that is invoked when the logic to create the render pipeline state object is completed.

    Discussion

    To use the graphics rendering pipeline state for a rendering pass, call the  method of a  object with the  object.

    Availability

    Available in iOS 8.0 and later.

  •  
    Required
  •  
    Required

    Synchronously creates and returns a render pipeline state object.

    Declaration

    OBJECTIVE-C

    - (id<>)newRenderPipelineStateWithDescriptor:( *)descriptor

                                                                 error:( * _Nullable *)error

    Parameters

    descriptor

    A descriptor object that contains graphics rendering state properties, including rasterization, visibility, programmable shader, and blend state.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object with the compiled graphics rendering pipeline state.

    Discussion

    To use the graphics rendering pipeline state for a rendering pass, call the  method of a  object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

Creating Command Objects Needed to Perform Computational Tasks

  •  
    Required

    Asynchronously creates a new compute pipeline state object that represents a compiled compute function.

    Declaration

    OBJECTIVE-C

    - (void)newComputePipelineStateWithFunction:(id<>)function

                              completionHandler:()completionHandler

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    completionHandler

    A block of code that is invoked when the logic to create the compute pipeline state object is completed.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Asynchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (void)newComputePipelineStateWithFunction:(id<>)function

                                        options:()options
                              completionHandler:()completionHandler

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    options

    The type of reflection information that should be returned.

    completionHandler

    A block of code that is invoked when the logic to create the compute pipeline state object is completed.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Synchronously creates a new compute pipeline state object that represents a compiled compute function.

    Declaration

    OBJECTIVE-C

    - (id<>)newComputePipelineStateWithFunction:(id<>)function

                                                                 error:( * _Nullable *)error

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object that can be used as a compute pipeline state.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Synchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (id<>)newComputePipelineStateWithFunction:(id<>)function

                                                               options:()options
                                                            reflection:( *)reflection
                                                                 error:( * _Nullable *)error

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    options

    The type of reflection information that should be returned.

    reflection

    Reflection data about the compute function, including details about function arguments.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object that can be used as a compute pipeline state.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Asynchronously creates a new compute pipeline state object, from a compute pipeline descriptor, that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (void)newComputePipelineStateWithDescriptor:( *)descriptor

                                          options:()options
                                completionHandler:()completionHandler

    Parameters

    descriptor

    A descriptor object that contains compute properties.

    options

    The type of reflection information that should be returned.

    completionHandler

    A block of code that is invoked when the logic to create the compute pipeline state object is completed.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    Availability

    Available in iOS 9.0 and later.

  •  
    Required

    Synchronously creates a new compute pipeline state object, from a compute pipeline descriptor, that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (id<>)newComputePipelineStateWithDescriptor:( *)descriptor

                                                                 options:()options
                                                              reflection:( *)reflection
                                                                   error:( * _Nullable *)error

    Parameters

    descriptor

    A descriptor object that contains compute properties.

    options

    The type of reflection information that should be returned.

    reflection

    Reflection data about the compute function, including details about function arguments.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object with the compiled compute pipeline state.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 9.0 and later.

Data Types

  • A block of code that is invoked when the logic to create a  object is completed.

    Declaration

    OBJECTIVE-C

    typedef void (^MTLNewRenderPipelineStateCompletionHandler)(id <MTLRenderPipelineState> __nullable renderPipelineState, NSError * __nullable error)

    Discussion

    The completion handler takes the following parameters:

    renderPipelineState

    A new render pipeline state object that contains the compiled graphics rendering state, or nil if an error occurred.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Import Statement

    OBJECTIVE-C

    @import Metal;

    Availability

    Available in iOS 9.0 and later.

  • A block of code that is invoked when the logic to create a  object is completed.

    Declaration

    OBJECTIVE-C

    typedef void (^MTLNewComputePipelineStateCompletionHandler)(id <MTLComputePipelineState> __nullable computePipelineState, NSError * __nullable error)

    Discussion

    The completion handler takes the following parameters:

    computePipelineState

    A new compute pipeline state object that contains the compiled compute pipeline state, or nil if an error occurred.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Import Statement

    OBJECTIVE-C

    @import Metal;

    Availability

    Available in iOS 9.0 and later.

Constants

Inherits From


Not Applicable

Conforms To


Not Applicable

Import Statement


OBJECTIVE-C

@import Metal;

Availability


Available in iOS 8.0 and later 

The MTLDevice protocol defines the interface to a single graphics processor (GPU). You use an object that conforms to this protocol to query the capabilities of the processor and to allocate objects used to access those capabilities.

Your app does not define classes that implement this protocol; it is used by Metal to provide a device object to your app. To obtain a system device, call the  function or select a result from the MTLCopyAllDevices function.

Most objects in Metal that perform graphics rendering and computational work are associated directly with a specific device. For example, texture objects are created by a device object and can be used only with that device. Most methods on a MTLDevice object create non-transient objects, including command queues, resources (such as buffers and textures), and pipeline states. These objects can be expensive to create and you are encouraged to create them soon after your app launches and reuse them throughout the lifetime of your app. Avoid creating these objects in performance sensitive code.

Identifying Properties

  •  
    Required 
    Property
  •  
    Required 
    Property
  •  
    Required
  •  
    Required

Creating Metal Shader Libraries

  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required

Creating Command Queues

  •  
    Required
  •  
    Required

Creating Resources

  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required
  •  
    Required

Creating Command Objects Needed to Render Graphics

  •  
    Required
  •  
    Required

    Asynchronously creates and returns a render pipeline state object.

    Declaration

    OBJECTIVE-C

    - (void)newRenderPipelineStateWithDescriptor:( *)descriptor

                               completionHandler:()completionHandler

    Parameters

    descriptor

    A descriptor object that contains graphics rendering state properties, including rasterization, visibility, function, and blend state.

    completionHandler

    A block of code that is invoked when the logic to create the render pipeline state object is completed.

    Discussion

    To use the graphics rendering pipeline state for a rendering pass, call the  method of a  object with the  object.

    Availability

    Available in iOS 8.0 and later.

  •  
    Required
  •  
    Required

    Synchronously creates and returns a render pipeline state object.

    Declaration

    OBJECTIVE-C

    - (id<>)newRenderPipelineStateWithDescriptor:( *)descriptor

                                                                 error:( * _Nullable *)error

    Parameters

    descriptor

    A descriptor object that contains graphics rendering state properties, including rasterization, visibility, programmable shader, and blend state.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object with the compiled graphics rendering pipeline state.

    Discussion

    To use the graphics rendering pipeline state for a rendering pass, call the  method of a  object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

Creating Command Objects Needed to Perform Computational Tasks

  •  
    Required

    Asynchronously creates a new compute pipeline state object that represents a compiled compute function.

    Declaration

    OBJECTIVE-C

    - (void)newComputePipelineStateWithFunction:(id<>)function

                              completionHandler:()completionHandler

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    completionHandler

    A block of code that is invoked when the logic to create the compute pipeline state object is completed.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Asynchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (void)newComputePipelineStateWithFunction:(id<>)function

                                        options:()options
                              completionHandler:()completionHandler

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    options

    The type of reflection information that should be returned.

    completionHandler

    A block of code that is invoked when the logic to create the compute pipeline state object is completed.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Synchronously creates a new compute pipeline state object that represents a compiled compute function.

    Declaration

    OBJECTIVE-C

    - (id<>)newComputePipelineStateWithFunction:(id<>)function

                                                                 error:( * _Nullable *)error

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object that can be used as a compute pipeline state.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Synchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (id<>)newComputePipelineStateWithFunction:(id<>)function

                                                               options:()options
                                                            reflection:( *)reflection
                                                                 error:( * _Nullable *)error

    Parameters

    function

    A function object to be compiled into a compute pipeline state object.

    options

    The type of reflection information that should be returned.

    reflection

    Reflection data about the compute function, including details about function arguments.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object that can be used as a compute pipeline state.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 8.0 and later.

  •  
    Required

    Asynchronously creates a new compute pipeline state object, from a compute pipeline descriptor, that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (void)newComputePipelineStateWithDescriptor:( *)descriptor

                                          options:()options
                                completionHandler:()completionHandler

    Parameters

    descriptor

    A descriptor object that contains compute properties.

    options

    The type of reflection information that should be returned.

    completionHandler

    A block of code that is invoked when the logic to create the compute pipeline state object is completed.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    Availability

    Available in iOS 9.0 and later.

  •  
    Required

    Synchronously creates a new compute pipeline state object, from a compute pipeline descriptor, that represents a compiled compute function and returns additional reflection information.

    Declaration

    OBJECTIVE-C

    - (id<>)newComputePipelineStateWithDescriptor:( *)descriptor

                                                                 options:()options
                                                              reflection:( *)reflection
                                                                   error:( * _Nullable *)error

    Parameters

    descriptor

    A descriptor object that contains compute properties.

    options

    The type of reflection information that should be returned.

    reflection

    Reflection data about the compute function, including details about function arguments.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Return Value

    A new object with the compiled compute pipeline state.

    Discussion

    To use the compute pipeline state for a compute pass, call the  method of a object with the  object.

    HANDLING ERRORS IN SWIFT:

    In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure.

    You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in  in  and  in .

    Availability

    Available in iOS 9.0 and later.

Data Types

  • A block of code that is invoked when the logic to create a  object is completed.

    Declaration

    OBJECTIVE-C

    typedef void (^MTLNewRenderPipelineStateCompletionHandler)(id <MTLRenderPipelineState> __nullable renderPipelineState, NSError * __nullable error)

    Discussion

    The completion handler takes the following parameters:

    renderPipelineState

    A new render pipeline state object that contains the compiled graphics rendering state, or nil if an error occurred.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Import Statement

    OBJECTIVE-C

    @import Metal;

    Availability

    Available in iOS 9.0 and later.

  • A block of code that is invoked when the logic to create a  object is completed.

    Declaration

    OBJECTIVE-C

    typedef void (^MTLNewComputePipelineStateCompletionHandler)(id <MTLComputePipelineState> __nullable computePipelineState, NSError * __nullable error)

    Discussion

    The completion handler takes the following parameters:

    computePipelineState

    A new compute pipeline state object that contains the compiled compute pipeline state, or nil if an error occurred.

    error

    An error object that describes the problem, or nil if the operation succeeded.

    Import Statement

    OBJECTIVE-C

    @import Metal;

    Availability

    Available in iOS 9.0 and later.

Constants

转载地址:http://izzkn.baihongyu.com/

你可能感兴趣的文章
IDEA的使用教程二:idea的内置快捷键和idea的代码模板设置
查看>>
idea使用教程三:(创建web项目)
查看>>
Window localStorage 属性(永久储存网站的数据)
查看>>
jQuery中的 $(window) load()与$(document) ready()以及jquery $(document) ready() 与window onload 的区别
查看>>
Java创建URL后台访问接口,返回数据(Http请求-HttpClient方法)
查看>>
项目部署调用接口传参编码问题
查看>>
idea每次打开都是选择项目页面
查看>>
IDEA修改文件后出现星号
查看>>
设计模式——单例模式
查看>>
工厂模式
查看>>
ClassUtils——可以由一个接口查找到所有的实现类,也可 以由父类查找到所有的子类
查看>>
责任链模式
查看>>
算法(1)——流程图和DNS图
查看>>
leetcode——442
查看>>
sentinel 控制台讲解-流控规则--阈值类型:QPS 流控模式:直接 流控效果:快速失败
查看>>
Java语言程序设计(基础篇)第十版 5.3-6
查看>>
Java语言程序设计(基础篇)第十版 5.7
查看>>
Java语言程序设计(基础篇)第十版 5.8 5.9
查看>>
Java语言程序设计(基础篇)第十版 5.10-11
查看>>
Java语言程序设计(基础篇)第十版 5.12-13
查看>>