本文共 19867 字,大约阅读时间需要 66 分钟。
Inherits From
Conforms To
Import Statement
OBJECTIVE-C
Availability
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.
Required Property
Required Property
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required Asynchronously creates and returns a render pipeline state object.
OBJECTIVE-C
- (void)newRenderPipelineStateWithDescriptor:( *)
descriptor
completionHandler:()completionHandler
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. |
To use the graphics rendering pipeline state for a rendering pass, call the method of a
object with the
object.
Available in iOS 8.0 and later.
Required
Required Synchronously creates and returns a render pipeline state object.
OBJECTIVE-C
- (id<>)newRenderPipelineStateWithDescriptor:( *)
descriptor
error:( * _Nullable *)error
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 |
A new object with the compiled graphics rendering pipeline state.
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 .
Available in iOS 8.0 and later.
Required
Required Asynchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
- (void)newComputePipelineStateWithFunction:(id<>)
function
completionHandler:()completionHandler
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. |
To use the compute pipeline state for a compute pass, call the method of a
object with the
object.
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.
OBJECTIVE-C
- (void)newComputePipelineStateWithFunction:(id<>)
function
options:()options
completionHandler:()completionHandler
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. |
To use the compute pipeline state for a compute pass, call the method of a
object with the
object.
Available in iOS 8.0 and later.
Required Synchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
- (id<>)newComputePipelineStateWithFunction:(id<>)
function
error:( * _Nullable *)error
function | A function object to be compiled into a compute pipeline state object. |
error | An error object that describes the problem, or |
A new object that can be used as a compute pipeline state.
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 .
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.
OBJECTIVE-C
- (id<>)newComputePipelineStateWithFunction:(id<>)
function
options:()options
reflection:( *)reflection
error:( * _Nullable *)error
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 |
A new object that can be used as a compute pipeline state.
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 .
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.
OBJECTIVE-C
- (void)newComputePipelineStateWithDescriptor:( *)
descriptor
options:()options
completionHandler:()completionHandler
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. |
To use the compute pipeline state for a compute pass, call the method of a
object with the
object.
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.
OBJECTIVE-C
- (id<>)newComputePipelineStateWithDescriptor:( *)
descriptor
options:()options
reflection:( *)reflection
error:( * _Nullable *)error
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 |
A new object with the compiled compute pipeline state.
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 .
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a object is completed.
OBJECTIVE-C
typedef void (^MTLNewRenderPipelineStateCompletionHandler)(id <MTLRenderPipelineState> __nullable renderPipelineState, NSError * __nullable error)
The completion handler takes the following parameters:
renderPipelineState | A new render pipeline state object that contains the compiled graphics rendering state, or |
error | An error object that describes the problem, or |
OBJECTIVE-C
@import Metal;
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a object is completed.
OBJECTIVE-C
typedef void (^MTLNewComputePipelineStateCompletionHandler)(id <MTLComputePipelineState> __nullable computePipelineState, NSError * __nullable error)
The completion handler takes the following parameters:
computePipelineState | A new compute pipeline state object that contains the compiled compute pipeline state, or |
error | An error object that describes the problem, or |
OBJECTIVE-C
@import Metal;
Available in iOS 9.0 and later.
Inherits From
Conforms To
Import Statement
OBJECTIVE-C
Availability
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.
Required Property
Required Property
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required
Required Asynchronously creates and returns a render pipeline state object.
OBJECTIVE-C
- (void)newRenderPipelineStateWithDescriptor:( *)
descriptor
completionHandler:()completionHandler
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. |
To use the graphics rendering pipeline state for a rendering pass, call the method of a
object with the
object.
Available in iOS 8.0 and later.
Required
Required Synchronously creates and returns a render pipeline state object.
OBJECTIVE-C
- (id<>)newRenderPipelineStateWithDescriptor:( *)
descriptor
error:( * _Nullable *)error
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 |
A new object with the compiled graphics rendering pipeline state.
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 .
Available in iOS 8.0 and later.
Required
Required Asynchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
- (void)newComputePipelineStateWithFunction:(id<>)
function
completionHandler:()completionHandler
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. |
To use the compute pipeline state for a compute pass, call the method of a
object with the
object.
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.
OBJECTIVE-C
- (void)newComputePipelineStateWithFunction:(id<>)
function
options:()options
completionHandler:()completionHandler
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. |
To use the compute pipeline state for a compute pass, call the method of a
object with the
object.
Available in iOS 8.0 and later.
Required Synchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
- (id<>)newComputePipelineStateWithFunction:(id<>)
function
error:( * _Nullable *)error
function | A function object to be compiled into a compute pipeline state object. |
error | An error object that describes the problem, or |
A new object that can be used as a compute pipeline state.
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 .
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.
OBJECTIVE-C
- (id<>)newComputePipelineStateWithFunction:(id<>)
function
options:()options
reflection:( *)reflection
error:( * _Nullable *)error
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 |
A new object that can be used as a compute pipeline state.
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 .
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.
OBJECTIVE-C
- (void)newComputePipelineStateWithDescriptor:( *)
descriptor
options:()options
completionHandler:()completionHandler
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. |
To use the compute pipeline state for a compute pass, call the method of a
object with the
object.
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.
OBJECTIVE-C
- (id<>)newComputePipelineStateWithDescriptor:( *)
descriptor
options:()options
reflection:( *)reflection
error:( * _Nullable *)error
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 |
A new object with the compiled compute pipeline state.
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 .
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a object is completed.
OBJECTIVE-C
typedef void (^MTLNewRenderPipelineStateCompletionHandler)(id <MTLRenderPipelineState> __nullable renderPipelineState, NSError * __nullable error)
The completion handler takes the following parameters:
renderPipelineState | A new render pipeline state object that contains the compiled graphics rendering state, or |
error | An error object that describes the problem, or |
OBJECTIVE-C
@import Metal;
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a object is completed.
OBJECTIVE-C
typedef void (^MTLNewComputePipelineStateCompletionHandler)(id <MTLComputePipelineState> __nullable computePipelineState, NSError * __nullable error)
The completion handler takes the following parameters:
computePipelineState | A new compute pipeline state object that contains the compiled compute pipeline state, or |
error | An error object that describes the problem, or |
OBJECTIVE-C
@import Metal;
Available in iOS 9.0 and later.
转载地址:http://izzkn.baihongyu.com/