MTLDevice
2015-12-09 09:42
881 查看
Inherits From
Not Applicable
Conforms To
Not Applicable
Import Statement
OBJECTIVE-C
Availability
Available in iOS 8.0 and later
The
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
or select a result from the
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
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.
Asynchronously creates and returns a render pipeline state object.
OBJECTIVE-C
To use the graphics rendering pipeline state for a rendering pass, call the
of a
with the
Available in iOS 8.0 and later.
Synchronously creates and returns a render pipeline state object.
OBJECTIVE-C
A new object with the compiled graphics rendering pipeline state.
To use the graphics rendering pipeline state for a rendering pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 8.0 and later.
Asynchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
To use the compute pipeline state for a compute pass, call the
of a
with the
Available in iOS 8.0 and later.
Asynchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.
OBJECTIVE-C
To use the compute pipeline state for a compute pass, call the
of a
with the
Available in iOS 8.0 and later.
Synchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
A new object that can be used as a compute pipeline state.
To use the compute pipeline state for a compute pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 8.0 and later.
Synchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.
OBJECTIVE-C
_Nullable *)
A new object that can be used as a compute pipeline state.
To use the compute pipeline state for a compute pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 8.0 and later.
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
To use the compute pipeline state for a compute pass, call the
of a
with the
Available in iOS 9.0 and later.
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
_Nullable *)
A new object with the compiled compute pipeline state.
To use the compute pipeline state for a compute pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a
is completed.
OBJECTIVE-C
The completion handler takes the following parameters:
OBJECTIVE-C
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a
is completed.
OBJECTIVE-C
The completion handler takes the following parameters:
OBJECTIVE-C
Available in iOS 9.0 and later.
Inherits From
Not Applicable
Conforms To
Not Applicable
Import Statement
OBJECTIVE-C
Availability
Available in iOS 8.0 and later
The
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
or select a result from the
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
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.
Asynchronously creates and returns a render pipeline state object.
OBJECTIVE-C
To use the graphics rendering pipeline state for a rendering pass, call the
of a
with the
Available in iOS 8.0 and later.
Synchronously creates and returns a render pipeline state object.
OBJECTIVE-C
A new object with the compiled graphics rendering pipeline state.
To use the graphics rendering pipeline state for a rendering pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 8.0 and later.
Asynchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
To use the compute pipeline state for a compute pass, call the
of a
with the
Available in iOS 8.0 and later.
Asynchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.
OBJECTIVE-C
To use the compute pipeline state for a compute pass, call the
of a
with the
Available in iOS 8.0 and later.
Synchronously creates a new compute pipeline state object that represents a compiled compute function.
OBJECTIVE-C
A new object that can be used as a compute pipeline state.
To use the compute pipeline state for a compute pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 8.0 and later.
Synchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.
OBJECTIVE-C
_Nullable *)
A new object that can be used as a compute pipeline state.
To use the compute pipeline state for a compute pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 8.0 and later.
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
To use the compute pipeline state for a compute pass, call the
of a
with the
Available in iOS 9.0 and later.
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
_Nullable *)
A new object with the compiled compute pipeline state.
To use the compute pipeline state for a compute pass, call the
of a
with the
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
to indicate that it throws an error in cases of failure.
You call this method in a
and handle any errors in the
of a
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a
is completed.
OBJECTIVE-C
The completion handler takes the following parameters:
OBJECTIVE-C
Available in iOS 9.0 and later.
A block of code that is invoked when the logic to create a
is completed.
OBJECTIVE-C
The completion handler takes the following parameters:
OBJECTIVE-C
Available in iOS 9.0 and later.
Not Applicable
Conforms To
Not Applicable
Import Statement
OBJECTIVE-C
@import Metal;
Availability
Available in iOS 8.0 and later
The
MTLDeviceprotocol
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
MTLCreateSystemDefaultDevicefunction
or select a result from the
MTLCopyAllDevicesfunction.
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
MTLDeviceobject
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
maxThreadsPerThreadgroupRequired Property
nameRequired Property
- supportsFeatureSet:Required
- supportsTextureSampleCount:Required
Creating Metal Shader Libraries
- newDefaultLibraryRequired
- newLibraryWithFile:error:Required
- newLibraryWithSource:options:completionHandler:Required
- newLibraryWithSource:options:error:Required
- newLibraryWithData:error:Required
Creating Command Queues
- newCommandQueueRequired
- newCommandQueueWithMaxCommandBufferCount:Required
Creating Resources
- newBufferWithLength:options:Required
- newBufferWithBytes:length:options:Required
- newBufferWithBytesNoCopy:length:options:deallocator:Required
- newTextureWithDescriptor:Required
- newSamplerStateWithDescriptor:Required
Creating Command Objects Needed to Render Graphics
- newDepthStencilStateWithDescriptor:Required
- newRenderPipelineStateWithDescriptor:completionHandler:Required
Asynchronously creates and returns a render pipeline state object.
Declaration
OBJECTIVE-C- (void)newRenderPipelineStateWithDescriptor:(MTLRenderPipelineDescriptor *)descriptorcompletionHandler:(MTLNewRenderPipelineStateCompletionHandler)[code]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 setRenderPipelineState:method
of a
MTLRenderCommandEncoderobject
with the
MTLRenderPipelineStateobject.
Availability
Available in iOS 8.0 and later.- newRenderPipelineStateWithDescriptor:options:completionHandler:Required
- newRenderPipelineStateWithDescriptor:error:Required
Synchronously creates and returns a render pipeline state object.
Declaration
OBJECTIVE-C- (id<MTLRenderPipelineState>)newRenderPipelineStateWithDescriptor:(MTLRenderPipelineDescriptor *)descriptorerror:(NSError *
_Nullable *)[code]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 nilif 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 setRenderPipelineState:method
of a
MTLRenderCommandEncoderobject
with the
MTLRenderPipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 8.0 and later.- newRenderPipelineStateWithDescriptor:options:reflection:error:Required
Creating Command Objects Needed to Perform Computational Tasks
- newComputePipelineStateWithFunction:completionHandler:Required
Asynchronously creates a new compute pipeline state object that represents a compiled compute function.
Declaration
OBJECTIVE-C- (void)newComputePipelineStateWithFunction:(id<MTLFunction>)functioncompletionHandler:(MTLNewComputePipelineStateCompletionHandler)[code]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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithFunction:options:completionHandler: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<MTLFunction>)completionHandler:(MTLNewComputePipelineStateWithReflectionCompletionHandler)functionoptions:(MTLPipelineOption)[code]options
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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithFunction:error:Required
Synchronously creates a new compute pipeline state object that represents a compiled compute function.
Declaration
OBJECTIVE-C- (id<MTLComputePipelineState>)newComputePipelineStateWithFunction:(id<MTLFunction>)functionerror:(NSError *
_Nullable *)[code]error
Parameters
function | A function object to be compiled into a compute pipeline state object. |
error | An error object that describes the problem, or nilif 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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithFunction:options:reflection:error:Required
Synchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.
Declaration
OBJECTIVE-C- (id<MTLComputePipelineState>)newComputePipelineStateWithFunction:(id<MTLFunction>)reflection:(MTLAutoreleasedComputePipelineReflection *)functionoptions:(MTLPipelineOption)[code]options
reflectionerror:(NSError *
_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 nilif 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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithDescriptor:options:completionHandler: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:(MTLComputePipelineDescriptor *)completionHandler:(MTLNewComputePipelineStateWithReflectionCompletionHandler)descriptoroptions:(MTLPipelineOption)[code]options
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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
Availability
Available in iOS 9.0 and later.- newComputePipelineStateWithDescriptor:options:reflection:error: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<MTLComputePipelineState>)newComputePipelineStateWithDescriptor:(MTLComputePipelineDescriptor *)reflection:(MTLAutoreleasedComputePipelineReflection *)descriptoroptions:(MTLPipelineOption)[code]options
reflectionerror:(NSError *
_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 nilif 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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 9.0 and later.
Data Types
MTLNewLibraryCompletionHandler
MTLNewRenderPipelineStateCompletionHandler
A block of code that is invoked when the logic to create a
MTLRenderPipelineStateobject
is completed.
Declaration
OBJECTIVE-Ctypedef 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 nilif an error occurred. |
error | An error object that describes the problem, or nilif the operation succeeded. |
Import Statement
OBJECTIVE-C@import Metal;
Availability
Available in iOS 9.0 and later.MTLNewRenderPipelineStateWithReflectionCompletionHandler
MTLNewComputePipelineStateCompletionHandler
A block of code that is invoked when the logic to create a
MTLComputePipelineStateobject
is completed.
Declaration
OBJECTIVE-Ctypedef 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 nilif an error occurred. |
error | An error object that describes the problem, or nilif the operation succeeded. |
Import Statement
OBJECTIVE-C@import Metal;
Availability
Available in iOS 9.0 and later.MTLNewComputePipelineStateWithReflectionCompletionHandler
MTLAutoreleasedRenderPipelineReflection
MTLAutoreleasedComputePipelineReflection
Constants
MTLFeatureSet
MTLPipelineOption
Inherits From
Not Applicable
Conforms To
Not Applicable
Import Statement
OBJECTIVE-C
@import Metal;
Availability
Available in iOS 8.0 and later
The
MTLDeviceprotocol
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
MTLCreateSystemDefaultDevicefunction
or select a result from the
MTLCopyAllDevicesfunction.
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
MTLDeviceobject
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
maxThreadsPerThreadgroupRequired Property
nameRequired Property
- supportsFeatureSet:Required
- supportsTextureSampleCount:Required
Creating Metal Shader Libraries
- newDefaultLibraryRequired
- newLibraryWithFile:error:Required
- newLibraryWithSource:options:completionHandler:Required
- newLibraryWithSource:options:error:Required
- newLibraryWithData:error:Required
Creating Command Queues
- newCommandQueueRequired
- newCommandQueueWithMaxCommandBufferCount:Required
Creating Resources
- newBufferWithLength:options:Required
- newBufferWithBytes:length:options:Required
- newBufferWithBytesNoCopy:length:options:deallocator:Required
- newTextureWithDescriptor:Required
- newSamplerStateWithDescriptor:Required
Creating Command Objects Needed to Render Graphics
- newDepthStencilStateWithDescriptor:Required
- newRenderPipelineStateWithDescriptor:completionHandler:Required
Asynchronously creates and returns a render pipeline state object.
Declaration
OBJECTIVE-C- (void)newRenderPipelineStateWithDescriptor:(MTLRenderPipelineDescriptor *)descriptorcompletionHandler:(MTLNewRenderPipelineStateCompletionHandler)[code]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 setRenderPipelineState:method
of a
MTLRenderCommandEncoderobject
with the
MTLRenderPipelineStateobject.
Availability
Available in iOS 8.0 and later.- newRenderPipelineStateWithDescriptor:options:completionHandler:Required
- newRenderPipelineStateWithDescriptor:error:Required
Synchronously creates and returns a render pipeline state object.
Declaration
OBJECTIVE-C- (id<MTLRenderPipelineState>)newRenderPipelineStateWithDescriptor:(MTLRenderPipelineDescriptor *)descriptorerror:(NSError *
_Nullable *)[code]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 nilif 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 setRenderPipelineState:method
of a
MTLRenderCommandEncoderobject
with the
MTLRenderPipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 8.0 and later.- newRenderPipelineStateWithDescriptor:options:reflection:error:Required
Creating Command Objects Needed to Perform Computational Tasks
- newComputePipelineStateWithFunction:completionHandler:Required
Asynchronously creates a new compute pipeline state object that represents a compiled compute function.
Declaration
OBJECTIVE-C- (void)newComputePipelineStateWithFunction:(id<MTLFunction>)functioncompletionHandler:(MTLNewComputePipelineStateCompletionHandler)[code]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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithFunction:options:completionHandler: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<MTLFunction>)completionHandler:(MTLNewComputePipelineStateWithReflectionCompletionHandler)functionoptions:(MTLPipelineOption)[code]options
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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithFunction:error:Required
Synchronously creates a new compute pipeline state object that represents a compiled compute function.
Declaration
OBJECTIVE-C- (id<MTLComputePipelineState>)newComputePipelineStateWithFunction:(id<MTLFunction>)functionerror:(NSError *
_Nullable *)[code]error
Parameters
function | A function object to be compiled into a compute pipeline state object. |
error | An error object that describes the problem, or nilif 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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithFunction:options:reflection:error:Required
Synchronously creates a new compute pipeline state object that represents a compiled compute function and returns additional reflection information.
Declaration
OBJECTIVE-C- (id<MTLComputePipelineState>)newComputePipelineStateWithFunction:(id<MTLFunction>)reflection:(MTLAutoreleasedComputePipelineReflection *)functionoptions:(MTLPipelineOption)[code]options
reflectionerror:(NSError *
_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 nilif 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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 8.0 and later.- newComputePipelineStateWithDescriptor:options:completionHandler: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:(MTLComputePipelineDescriptor *)completionHandler:(MTLNewComputePipelineStateWithReflectionCompletionHandler)descriptoroptions:(MTLPipelineOption)[code]options
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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
Availability
Available in iOS 9.0 and later.- newComputePipelineStateWithDescriptor:options:reflection:error: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<MTLComputePipelineState>)newComputePipelineStateWithDescriptor:(MTLComputePipelineDescriptor *)reflection:(MTLAutoreleasedComputePipelineReflection *)descriptoroptions:(MTLPipelineOption)[code]options
reflectionerror:(NSError *
_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 nilif 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 setComputePipelineState:method
of a
MTLComputeCommandEncoderobject
with the
MTLComputePipelineStateobject.
HANDLING ERRORS IN SWIFT:
In Swift, this method returns a nonoptional result and is marked with the
throwskeyword
to indicate that it throws an error in cases of failure.
You call this method in a
tryexpression
and handle any errors in the
catchclauses
of a
dostatement, as described
in Error
Handling in The
Swift Programming Language (Swift 2.1) and Error
Handling in Using
Swift with Cocoa and Objective-C (Swift 2.1).
Availability
Available in iOS 9.0 and later.
Data Types
MTLNewLibraryCompletionHandler
MTLNewRenderPipelineStateCompletionHandler
A block of code that is invoked when the logic to create a
MTLRenderPipelineStateobject
is completed.
Declaration
OBJECTIVE-Ctypedef 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 nilif an error occurred. |
error | An error object that describes the problem, or nilif the operation succeeded. |
Import Statement
OBJECTIVE-C@import Metal;
Availability
Available in iOS 9.0 and later.MTLNewRenderPipelineStateWithReflectionCompletionHandler
MTLNewComputePipelineStateCompletionHandler
A block of code that is invoked when the logic to create a
MTLComputePipelineStateobject
is completed.
Declaration
OBJECTIVE-Ctypedef 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 nilif an error occurred. |
error | An error object that describes the problem, or nilif the operation succeeded. |
Import Statement
OBJECTIVE-C@import Metal;
Availability
Available in iOS 9.0 and later.MTLNewComputePipelineStateWithReflectionCompletionHandler
MTLAutoreleasedRenderPipelineReflection
MTLAutoreleasedComputePipelineReflection
Constants
MTLFeatureSet
MTLPipelineOption
相关文章推荐
- 【Smarty】Smarty的下载、配置与Helloworld
- ActionBar的溢出菜单中的icon和title距离太近
- Web攻防系列教程之 PHP + Mysql注入攻防实战(转载)
- OpenGL版本与OpenGL扩展机制
- 数学公式计算 结合 JavaBean
- C++下 VMP加壳宏
- 取html文本中的图片路径
- udhcpc
- 用 Hadoop 进行分布式并行编程Ⅰ
- lucene学习网址
- JavaScript的IE和火狐的兼容性解决办法
- 需求分析
- 垂直搜索能否抢占通用搜索地盘?
- Oracle exp/imp导出导入工具的使用
- 用Jsp来实现文件下载功能的几种方式
- 垃圾收集器
- 如何利用Java制作起始页面计数器
- Eclipse快捷键大全
- ContentProvider的案例
- php配置php-fpm启动参数及配置详解