chore(macos): vendor system-sdk dependency
This commit is contained in:
		@@ -0,0 +1,551 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLAccelerationStructure.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2020 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
#import <Metal/MTLStageInputOutputDescriptor.h>
 | 
			
		||||
#import <Metal/MTLRenderCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLAccelerationStructureTypes.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
@protocol MTLBuffer;
 | 
			
		||||
@protocol MTLAccelerationStructure;
 | 
			
		||||
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLAccelerationStructureUsage) {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Default usage
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureUsageNone = 0,
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Enable refitting for this acceleration structure. Note that this may reduce
 | 
			
		||||
     * acceleration structure quality.
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureUsageRefit = (1 << 0),
 | 
			
		||||
   
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Prefer building this acceleration structure quickly at the cost of reduced ray
 | 
			
		||||
     * tracing performance.
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureUsagePreferFastBuild = (1 << 1),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Enable extended limits for this acceleration structure, possibly at the cost of
 | 
			
		||||
     * reduced ray tracing performance.
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureUsageExtendedLimits API_AVAILABLE(macos(12.0), ios(15.0)) = (1 << 2),
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_OPTIONS(uint32_t, MTLAccelerationStructureInstanceOptions) {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief No options
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptionNone = 0,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Disable triangle back or front face culling
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptionDisableTriangleCulling = (1 << 0),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Disable triangle back or front face culling
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptionTriangleFrontFacingWindingCounterClockwise = (1 << 1),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Geometry is opaque
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptionOpaque = (1 << 2),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Geometry is non-opaque
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptionNonOpaque = (1 << 3),
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Base class for acceleration structure descriptors. Do not use this class directly. Use
 | 
			
		||||
 * one of the derived classes instead.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLAccelerationStructureDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
@property (nonatomic) MTLAccelerationStructureUsage usage;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Base class for all geometry descriptors. Do not use this class directly. Use one of the derived
 | 
			
		||||
 * classes instead.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLAccelerationStructureGeometryDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
@property (nonatomic) NSUInteger intersectionFunctionTableOffset;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Whether the geometry is opaque
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) BOOL opaque;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Whether intersection functions may be invoked more than once per ray/primitive
 | 
			
		||||
 * intersection. Defaults to YES.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) BOOL allowDuplicateIntersectionFunctionInvocation;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Label
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, copy, nullable) NSString* label API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Describes what happens to the object before the first motion key and after the last
 | 
			
		||||
 * motion key.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(uint32_t, MTLMotionBorderMode){
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Motion is stopped. (default)
 | 
			
		||||
     */
 | 
			
		||||
    MTLMotionBorderModeClamp = 0,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Object disappears
 | 
			
		||||
     */
 | 
			
		||||
    MTLMotionBorderModeVanish = 1
 | 
			
		||||
} API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Descriptor for a primitive acceleration structure
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLPrimitiveAccelerationStructureDescriptor : MTLAccelerationStructureDescriptor
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Array of geometry descriptors. If motionKeyframeCount is greater than one all geometryDescriptors
 | 
			
		||||
 * must be motion versions and have motionKeyframeCount of primitive buffers.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) NSArray <MTLAccelerationStructureGeometryDescriptor *> * geometryDescriptors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Motion border mode describing what happens if acceleration structure is sampled before
 | 
			
		||||
 * motionStartTime. If not set defaults to MTLMotionBorderModeClamp.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLMotionBorderMode motionStartBorderMode API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Motion border mode describing what happens if acceleration structure is sampled after
 | 
			
		||||
 * motionEndTime. If not set defaults to MTLMotionBorderModeClamp.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLMotionBorderMode motionEndBorderMode API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Motion start time of this geometry. If not set defaults to 0.0f.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) float motionStartTime API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Motion end time of this geometry. If not set defaults to 1.0f.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) float motionEndTime API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Motion keyframe count. Is 1 by default which means no motion.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger motionKeyframeCount API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
+ (instancetype)descriptor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Descriptor for triangle geometry
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLAccelerationStructureTriangleGeometryDescriptor : MTLAccelerationStructureGeometryDescriptor
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Vertex buffer containing triangle vertices. Each vertex must consist of three 32-bit floats
 | 
			
		||||
 * encoding X, Y, and Z position. Must not be nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> vertexBuffer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Vertex buffer offset. Must be a multiple of the vertex stride and must be aligned to the
 | 
			
		||||
 * platform's buffer offset alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger vertexBufferOffset;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Stride, in bytes, between vertices in the vertex buffer. Must be at least 12 bytes and must be a
 | 
			
		||||
 * multiple of 4 bytes. Defaults to 12 bytes.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger vertexStride;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Optional index buffer containing references to vertices in the vertex buffer. May be nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> indexBuffer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Index buffer offset. Must be a multiple of the index data type size and must be aligned to both
 | 
			
		||||
 * the index data type's alignment and the platform's buffer offset alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger indexBufferOffset;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Index type
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLIndexType indexType;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Number of triangles
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger triangleCount;
 | 
			
		||||
 | 
			
		||||
+ (instancetype)descriptor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Descriptor for bounding box geometry
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLAccelerationStructureBoundingBoxGeometryDescriptor : MTLAccelerationStructureGeometryDescriptor
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Bounding box buffer containing MTLAxisAlignedBoundingBoxes. Must not be nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> boundingBoxBuffer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Bounding box buffer offset. Must be a multiple of the bounding box stride and must be
 | 
			
		||||
 * aligned to the platform's buffer offset alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger boundingBoxBufferOffset;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Stride, in bytes, between bounding boxes in the bounding box buffer. Must be at least 24
 | 
			
		||||
 * bytes and must be a multiple of 4 bytes. Defaults to 24 bytes.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger boundingBoxStride;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Number of bounding boxes
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger boundingBoxCount;
 | 
			
		||||
 | 
			
		||||
+ (instancetype)descriptor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief MTLbuffer and description how the data is stored in it.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLMotionKeyframeData : NSObject
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Buffer containing the data of a single keyframe. Multiple keyframes can be interleaved in one MTLBuffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> buffer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Buffer offset. Must be a multiple of 4 bytes.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger offset;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
+ (instancetype)data;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Descriptor for motion triangle geometry
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLAccelerationStructureMotionTriangleGeometryDescriptor : MTLAccelerationStructureGeometryDescriptor
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Vertex buffer containing triangle vertices similar to what MTLAccelerationStructureTriangleGeometryDescriptor has but array of the values.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, copy) NSArray <MTLMotionKeyframeData *> * vertexBuffers;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Stride, in bytes, between vertices in the vertex buffer. Must be at least 12 bytes and must be a
 | 
			
		||||
 * multiple of 4 bytes. Defaults to 12 bytes.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger vertexStride;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Optional index buffer containing references to vertices in the vertex buffer. May be nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> indexBuffer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Index buffer offset. Must be a multiple of the index data type size and must be aligned to both
 | 
			
		||||
 * the index data type's alignment and the platform's buffer offset alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger indexBufferOffset;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Index type
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLIndexType indexType;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Number of triangles
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger triangleCount;
 | 
			
		||||
 | 
			
		||||
+ (instancetype)descriptor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Descriptor for motion bounding box geometry
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor : MTLAccelerationStructureGeometryDescriptor
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Bounding box buffer containing MTLAxisAlignedBoundingBoxes similar to what MTLAccelerationStructureBoundingBoxGeometryDescriptor has but array of the values.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, copy) NSArray <MTLMotionKeyframeData *> * boundingBoxBuffers;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Stride, in bytes, between bounding boxes in the bounding box buffer. Must be at least 24
 | 
			
		||||
 * bytes and must be a multiple of 4 bytes. Defaults to 24 bytes.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger boundingBoxStride;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Number of bounding boxes
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger boundingBoxCount;
 | 
			
		||||
 | 
			
		||||
+ (instancetype)descriptor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Transformation matrix describing how to transform the bottom-level acceleration structure.
 | 
			
		||||
     */
 | 
			
		||||
    MTLPackedFloat4x3 transformationMatrix;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance options
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptions options;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance mask used to ignore geometry during ray tracing
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t mask;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Used to index into intersection function tables
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t intersectionFunctionTableOffset;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Acceleration structure index to use for this instance
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t accelerationStructureIndex;
 | 
			
		||||
} MTLAccelerationStructureInstanceDescriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Transformation matrix describing how to transform the bottom-level acceleration structure.
 | 
			
		||||
     */
 | 
			
		||||
    MTLPackedFloat4x3 transformationMatrix;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance options
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptions options;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance mask used to ignore geometry during ray tracing
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t mask;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Used to index into intersection function tables
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t intersectionFunctionTableOffset;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Acceleration structure index to use for this instance
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t accelerationStructureIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief User-assigned instance ID to help identify this instance in an
 | 
			
		||||
     * application-defined way
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t userID;
 | 
			
		||||
} MTLAccelerationStructureUserIDInstanceDescriptor API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLAccelerationStructureInstanceDescriptorType) {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Default instance descriptor: MTLAccelerationStructureInstanceDescriptor
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceDescriptorTypeDefault = 0,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance descriptor with an added user-ID
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceDescriptorTypeUserID = 1,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance descriptor with support for motion
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceDescriptorTypeMotion = 2,
 | 
			
		||||
} API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance options
 | 
			
		||||
     */
 | 
			
		||||
    MTLAccelerationStructureInstanceOptions options;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Instance mask used to ignore geometry during ray tracing
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t mask;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Used to index into intersection function tables
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t intersectionFunctionTableOffset;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Acceleration structure index to use for this instance
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t accelerationStructureIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief User-assigned instance ID to help identify this instance in an
 | 
			
		||||
     * application-defined way
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t userID;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief The index of the first set of transforms describing one keyframe of the animation.
 | 
			
		||||
     * These transforms are stored in a separate buffer and they are uniformly distributed over
 | 
			
		||||
     * time time span of the motion.
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t motionTransformsStartIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief The count of motion transforms belonging to this motion which are stored in consecutive
 | 
			
		||||
     * memory addresses at the separate motionTransforms buffer.
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t motionTransformsCount;
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Motion border mode describing what happens if acceleration structure is sampled
 | 
			
		||||
     * before motionStartTime
 | 
			
		||||
     */
 | 
			
		||||
    MTLMotionBorderMode motionStartBorderMode;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Motion border mode describing what happens if acceleration structure is sampled
 | 
			
		||||
     * after motionEndTime
 | 
			
		||||
     */
 | 
			
		||||
    MTLMotionBorderMode motionEndBorderMode;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Motion start time of this instance
 | 
			
		||||
     */
 | 
			
		||||
    float motionStartTime;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Motion end time of this instance
 | 
			
		||||
     */
 | 
			
		||||
    float motionEndTime;
 | 
			
		||||
} MTLAccelerationStructureMotionInstanceDescriptor API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Descriptor for an instance acceleration structure
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLInstanceAccelerationStructureDescriptor : MTLAccelerationStructureDescriptor
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Buffer containing instance descriptors of the type specified by the instanceDescriptorType property
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> instanceDescriptorBuffer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Offset into the instance descriptor buffer. Must be a multiple of 64 bytes and must be
 | 
			
		||||
 * aligned to the platform's buffer offset alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger instanceDescriptorBufferOffset;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Stride, in bytes, between instance descriptors in the instance descriptor buffer. Must
 | 
			
		||||
 * be at least the size of the instance descriptor type and must be a multiple of 4 bytes.
 | 
			
		||||
 * Defaults to the size of the instance descriptor type.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger instanceDescriptorStride;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Number of instance descriptors
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger instanceCount;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Acceleration structures to be instanced
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) NSArray <id <MTLAccelerationStructure>> * instancedAccelerationStructures;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Type of instance descriptor in the instance descriptor buffer. Defaults to
 | 
			
		||||
 * MTLAccelerationStructureInstanceDescriptorTypeDefault.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLAccelerationStructureInstanceDescriptorType instanceDescriptorType API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Buffer containing transformation information for motion
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, retain, nullable) id <MTLBuffer> motionTransformBuffer API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Offset into the instance motion descriptor buffer. Must be a multiple of 64 bytes and
 | 
			
		||||
 * must be aligned to the platform's buffer offset alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger motionTransformBufferOffset API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Number of motion transforms
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger motionTransformCount API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
+ (instancetype)descriptor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLAccelerationStructure <MTLResource>
 | 
			
		||||
 | 
			
		||||
@property (nonatomic, readonly) NSUInteger size;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,220 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLAccelerationStructureCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Created by atatarinov on 12/3/19.
 | 
			
		||||
//  Copyright © 2019 Apple, Inc. All rights reserved.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLBuffer.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
#import <Metal/MTLCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLFence.h>
 | 
			
		||||
#import <Metal/MTLCommandBuffer.h>
 | 
			
		||||
#import <Metal/MTLAccelerationStructure.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLAccelerationStructureCommandEncoder <MTLCommandEncoder>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Encode an acceleration structure build into the command buffer. All bottom-level acceleration
 | 
			
		||||
 * structure builds must have completed before a top-level acceleration structure build may begin. The
 | 
			
		||||
 * resulting acceleration structure will not retain any references to the input vertex buffer, instance buffer, etc.
 | 
			
		||||
 *
 | 
			
		||||
 * The acceleration structure build will not be completed until the command buffer has been committed
 | 
			
		||||
 * and finished executing. However, it is safe to encode ray tracing work against the acceleration
 | 
			
		||||
 * structure as long as the command buffers are scheduled and synchronized such that the command buffer
 | 
			
		||||
 * will have completed by the time the ray tracing starts.
 | 
			
		||||
 *
 | 
			
		||||
 * The acceleration structure and scratch buffer must be at least the size returned by the
 | 
			
		||||
 * [MTLDevice accelerationStructureSizesWithDescriptor:] query.
 | 
			
		||||
 *
 | 
			
		||||
 * @param accelerationStructure Acceleration structure storage to build into
 | 
			
		||||
 * @param descriptor            Object describing the acceleration structure to build
 | 
			
		||||
 * @param scratchBuffer         Scratch buffer to use while building the acceleration structure. The
 | 
			
		||||
 *                              contents may be overwritten and are undefined after the build has
 | 
			
		||||
 *                              started/completed.
 | 
			
		||||
 * @param scratchBufferOffset   Offset into the scratch buffer
 | 
			
		||||
 */
 | 
			
		||||
- (void)buildAccelerationStructure:(id <MTLAccelerationStructure>)accelerationStructure
 | 
			
		||||
                        descriptor:(MTLAccelerationStructureDescriptor *)descriptor
 | 
			
		||||
                     scratchBuffer:(id <MTLBuffer>)scratchBuffer
 | 
			
		||||
               scratchBufferOffset:(NSUInteger)scratchBufferOffset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Encode an acceleration structure refit into the command buffer. Refitting can be used to
 | 
			
		||||
 * update the acceleration structure when geometry changes and is much faster than rebuilding from
 | 
			
		||||
 * scratch. However, the quality of the acceleration structure and the subsequent ray tracing
 | 
			
		||||
 * performance will degrade depending on how much the geometry changes.
 | 
			
		||||
 * 
 | 
			
		||||
 * Refitting can not be used after certain changes, such as adding or removing geometry. Acceleration
 | 
			
		||||
 * structures can be refit in place by specifying the same source and destination acceleration structures
 | 
			
		||||
 * or by providing a nil destination acceleration structure. If the source and destination acceleration
 | 
			
		||||
 * structures are not the same, they must not overlap in memory.
 | 
			
		||||
 *
 | 
			
		||||
 * The destination acceleration structure must be at least as large as the source acceleration structure,
 | 
			
		||||
 * unless the source acceleration structure has been compacted, in which case the destination acceleration
 | 
			
		||||
 * structure must be at least as large as the compacted size of the source acceleration structure.
 | 
			
		||||
 *
 | 
			
		||||
 * The scratch buffer must be at least the size returned by the accelerationStructureSizesWithDescriptor
 | 
			
		||||
 * method of the MTLDevice.
 | 
			
		||||
 *
 | 
			
		||||
 * @param descriptor                       Object describing the acceleration structure to build
 | 
			
		||||
 * @param sourceAccelerationStructure      Acceleration structure to copy from
 | 
			
		||||
 * @param destinationAccelerationStructure Acceleration structure to copy to
 | 
			
		||||
 * @param scratchBuffer                    Scratch buffer to use while refitting the acceleration
 | 
			
		||||
 *                                         structure. The contents may be overwritten and are undefined
 | 
			
		||||
 *                                         after the refit has started/completed.
 | 
			
		||||
 * @param scratchBufferOffset              Offset into the scratch buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (void)refitAccelerationStructure:(id <MTLAccelerationStructure>)sourceAccelerationStructure
 | 
			
		||||
                        descriptor:(MTLAccelerationStructureDescriptor *)descriptor
 | 
			
		||||
                       destination:(nullable id <MTLAccelerationStructure>)destinationAccelerationStructure
 | 
			
		||||
                     scratchBuffer:(id <MTLBuffer>)scratchBuffer
 | 
			
		||||
               scratchBufferOffset:(NSUInteger)scratchBufferOffset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Copy an acceleration structure. The source and destination acceleration structures must not
 | 
			
		||||
 * overlap in memory. If this is a top level acceleration structure, references to bottom level
 | 
			
		||||
 * acceleration structures will be preserved.
 | 
			
		||||
 *
 | 
			
		||||
 * The destination acceleration structure must be at least as large as the source acceleration structure,
 | 
			
		||||
 * unless the source acceleration structure has been compacted, in which case the destination acceleration
 | 
			
		||||
 * structure must be at least as large as the compacted size of the source acceleration structure.
 | 
			
		||||
 *
 | 
			
		||||
 * @param sourceAccelerationStructure      Acceleration structure to copy from
 | 
			
		||||
 * @param destinationAccelerationStructure Acceleration structure to copy to
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyAccelerationStructure:(id <MTLAccelerationStructure>)sourceAccelerationStructure
 | 
			
		||||
          toAccelerationStructure:(id <MTLAccelerationStructure>)destinationAccelerationStructure;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Compute the compacted size for an acceleration structure and write it into a buffer.
 | 
			
		||||
 *
 | 
			
		||||
 * This size is potentially smaller than the source acceleration structure. To perform compaction,
 | 
			
		||||
 * read this size from the buffer once the command buffer has completed and use it to allocate a
 | 
			
		||||
 * smaller acceleration structure. Then create another encoder and call the 
 | 
			
		||||
 * copyAndCompactAccelerationStructure method.
 | 
			
		||||
 *
 | 
			
		||||
 * @param accelerationStructure Source acceleration structure
 | 
			
		||||
 * @param buffer                Destination size buffer. The compacted size will be written as a 32 bit
 | 
			
		||||
 *                              unsigned integer representing the compacted size in bytes.
 | 
			
		||||
 * @param offset                Offset into the size buffer
 | 
			
		||||
 */
 | 
			
		||||
- (void)writeCompactedAccelerationStructureSize:(id <MTLAccelerationStructure>)accelerationStructure
 | 
			
		||||
                                       toBuffer:(id <MTLBuffer>)buffer
 | 
			
		||||
                                         offset:(NSUInteger)offset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Compute the compacted size for an acceleration structure and write it into a buffer.
 | 
			
		||||
 *
 | 
			
		||||
 * This size is potentially smaller than the source acceleration structure. To perform compaction,
 | 
			
		||||
 * read this size from the buffer once the command buffer has completed and use it to allocate a
 | 
			
		||||
 * smaller acceleration structure. Then create another encoder and call the 
 | 
			
		||||
 * copyAndCompactAccelerationStructure method.
 | 
			
		||||
 *
 | 
			
		||||
 * @param accelerationStructure Source acceleration structure
 | 
			
		||||
 * @param buffer                Destination size buffer. The compacted size will be written as either
 | 
			
		||||
 *                              a 32 bit or 64 bit value depending on the sizeDataType argument
 | 
			
		||||
 *                              unsigned integer representing the compacted size in bytes.
 | 
			
		||||
 * @param offset                Offset into the size buffer
 | 
			
		||||
 * @param sizeDataType          Data type of the size to write into the buffer. Must be either
 | 
			
		||||
 *                              MTLDataTypeUInt (32 bit) or MTLDataTypeULong (64 bit)
 | 
			
		||||
 */
 | 
			
		||||
- (void)writeCompactedAccelerationStructureSize:(id <MTLAccelerationStructure>)accelerationStructure
 | 
			
		||||
                                       toBuffer:(id <MTLBuffer>)buffer
 | 
			
		||||
                                         offset:(NSUInteger)offset
 | 
			
		||||
                                   sizeDataType:(MTLDataType)sizeDataType API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Copy and compact an acceleration structure. The source and destination acceleration structures
 | 
			
		||||
 * must not overlap in memory. If this is a top level acceleration structure, references to bottom level
 | 
			
		||||
 * acceleration structures will be preserved.
 | 
			
		||||
 *
 | 
			
		||||
 * The destination acceleration structure must be at least as large as the compacted size of the source
 | 
			
		||||
 * acceleration structure, which is computed by the writeCompactedAccelerationStructureSize method.
 | 
			
		||||
 *
 | 
			
		||||
 * @param sourceAccelerationStructure      Acceleration structure to copy and compact
 | 
			
		||||
 * @param destinationAccelerationStructure Acceleration structure to copy to
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyAndCompactAccelerationStructure:(id <MTLAccelerationStructure>)sourceAccelerationStructure
 | 
			
		||||
                    toAccelerationStructure:(id <MTLAccelerationStructure>)destinationAccelerationStructure;
 | 
			
		||||
 | 
			
		||||
 /*!
 | 
			
		||||
 @method updateFence:
 | 
			
		||||
 @abstract Update the fence to capture all GPU work so far enqueued by this encoder.
 | 
			
		||||
 @discussion The fence is updated at kernel submission to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)updateFence:(id <MTLFence>)fence;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitForFence:
 | 
			
		||||
 @abstract Prevent further GPU work until the fence is reached.
 | 
			
		||||
 @discussion The fence is evaluated at kernel submision to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitForFence:(id <MTLFence>)fence;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResource:usage:
 | 
			
		||||
 * @abstract Declare that a resource may be accessed by the command encoder through an argument buffer
 | 
			
		||||
 * 
 | 
			
		||||
 * @discussion For tracked MTLResources, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resource through an argument buffer.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useResource:(id <MTLResource>)resource usage:(MTLResourceUsage)usage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResources:count:usage:
 | 
			
		||||
 * @abstract Declare that an array of resources may be accessed through an argument buffer by the command encoder
 | 
			
		||||
 * @discussion For tracked MTL Resources, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources through an argument buffer.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useResources:(const id <MTLResource> __nonnull[__nonnull])resources count:(NSUInteger)count usage:(MTLResourceUsage)usage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeap:
 | 
			
		||||
 * @abstract Declare that the resources allocated from a heap may be accessed as readonly by the render pass through an argument buffer
 | 
			
		||||
 * @discussion For tracked MTLHeaps, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeap:(id <MTLHeap>)heap;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeaps:count:
 | 
			
		||||
 * @abstract Declare that the resources allocated from an array of heaps may be accessed as readonly by the render pass through an argument buffer
 | 
			
		||||
 * @discussion For tracked MTLHeaps, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeaps:(const id <MTLHeap> __nonnull[__nonnull])heaps count:(NSUInteger)count;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method sampleCountersInBuffer:atSampleIndex:withBarrier:
 | 
			
		||||
 @abstract Sample hardware counters at this point in the compute encoder and
 | 
			
		||||
 store the counter sample into the sample buffer at the specified index.
 | 
			
		||||
 @param sampleBuffer The sample buffer to sample into
 | 
			
		||||
 @param sampleIndex The index into the counter buffer to write the sample
 | 
			
		||||
 @param barrier Insert a barrier before taking the sample.  Passing
 | 
			
		||||
 YES will ensure that all work encoded before this operation in the encoder is
 | 
			
		||||
 complete but does not isolate the work with respect to other encoders.  Passing
 | 
			
		||||
 NO will allow the sample to be taken concurrently with other operations in this
 | 
			
		||||
 encoder.
 | 
			
		||||
 In general, passing YES will lead to more repeatable counter results but
 | 
			
		||||
 may negatively impact performance.  Passing NO will generally be higher performance
 | 
			
		||||
 but counter results may not be repeatable.
 | 
			
		||||
 */
 | 
			
		||||
-(void)sampleCountersInBuffer:(id<MTLCounterSampleBuffer>)sampleBuffer
 | 
			
		||||
                atSampleIndex:(NSUInteger)sampleIndex
 | 
			
		||||
                  withBarrier:(BOOL)barrier API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,134 @@
 | 
			
		||||
#ifdef __METAL_VERSION__
 | 
			
		||||
#import <metal_stdlib>
 | 
			
		||||
 | 
			
		||||
typedef metal::packed_float3 MTLPackedFloat3;
 | 
			
		||||
#else
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
typedef struct _MTLPackedFloat3 {
 | 
			
		||||
    union {
 | 
			
		||||
        struct {
 | 
			
		||||
            float x;
 | 
			
		||||
            float y;
 | 
			
		||||
            float z;
 | 
			
		||||
        };
 | 
			
		||||
        float elements[3];
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
    _MTLPackedFloat3()
 | 
			
		||||
        : x(0.0f), y(0.0f), z(0.0f)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _MTLPackedFloat3(float x, float y, float z)
 | 
			
		||||
        : x(x), y(y), z(z)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    float & operator[](int idx) {
 | 
			
		||||
        return elements[idx];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const float & operator[](int idx) const {
 | 
			
		||||
        return elements[idx];
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
} MTLPackedFloat3;
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLPackedFloat3 MTLPackedFloat3Make(float x, float y, float z)
 | 
			
		||||
{
 | 
			
		||||
    MTLPackedFloat3 packedFloat3;
 | 
			
		||||
    packedFloat3.x = x;
 | 
			
		||||
    packedFloat3.y = y;
 | 
			
		||||
    packedFloat3.z = z;
 | 
			
		||||
    return packedFloat3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct _MTLPackedFloat4x3 {
 | 
			
		||||
    MTLPackedFloat3 columns[4];
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
    _MTLPackedFloat4x3() {
 | 
			
		||||
        columns[0] = MTLPackedFloat3(0.0f, 0.0f, 0.0f);
 | 
			
		||||
        columns[1] = MTLPackedFloat3(0.0f, 0.0f, 0.0f);
 | 
			
		||||
        columns[2] = MTLPackedFloat3(0.0f, 0.0f, 0.0f);
 | 
			
		||||
        columns[3] = MTLPackedFloat3(0.0f, 0.0f, 0.0f);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    _MTLPackedFloat4x3(MTLPackedFloat3 column0, MTLPackedFloat3 column1, MTLPackedFloat3 column2, MTLPackedFloat3 column3) {
 | 
			
		||||
        columns[0] = column0;
 | 
			
		||||
        columns[1] = column1;
 | 
			
		||||
        columns[2] = column2;
 | 
			
		||||
        columns[3] = column3;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
#ifndef __METAL_VERSION__
 | 
			
		||||
    MTLPackedFloat3 & operator[](int idx) {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const MTLPackedFloat3 & operator[](int idx) const {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
#else
 | 
			
		||||
    thread MTLPackedFloat3 & operator[](int idx) thread {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const thread MTLPackedFloat3 & operator[](int idx) const thread {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    device MTLPackedFloat3 & operator[](int idx) device {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const device MTLPackedFloat3 & operator[](int idx) const device {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const constant MTLPackedFloat3 & operator[](int idx) const constant {
 | 
			
		||||
        return columns[idx];
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
} MTLPackedFloat4x3;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief An axis aligned bounding box with a min and max point
 | 
			
		||||
 */
 | 
			
		||||
typedef struct _MTLAxisAlignedBoundingBox {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Minimum point
 | 
			
		||||
     */
 | 
			
		||||
    MTLPackedFloat3 min;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Maximum point
 | 
			
		||||
     */
 | 
			
		||||
    MTLPackedFloat3 max;
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
    _MTLAxisAlignedBoundingBox()
 | 
			
		||||
        : min(INFINITY, INFINITY, INFINITY),
 | 
			
		||||
          max(-INFINITY, -INFINITY, -INFINITY)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _MTLAxisAlignedBoundingBox(MTLPackedFloat3 p)
 | 
			
		||||
        : min(p),
 | 
			
		||||
          max(p)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _MTLAxisAlignedBoundingBox(MTLPackedFloat3 min, MTLPackedFloat3 max)
 | 
			
		||||
        : min(min),
 | 
			
		||||
          max(max)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
} MTLAxisAlignedBoundingBox;
 | 
			
		||||
@@ -0,0 +1,281 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLArgument.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTexture.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLDataType) {
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeNone = 0,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeStruct = 1,
 | 
			
		||||
    MTLDataTypeArray  = 2,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeFloat  = 3,
 | 
			
		||||
    MTLDataTypeFloat2 = 4,
 | 
			
		||||
    MTLDataTypeFloat3 = 5,
 | 
			
		||||
    MTLDataTypeFloat4 = 6,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeFloat2x2 = 7,
 | 
			
		||||
    MTLDataTypeFloat2x3 = 8,
 | 
			
		||||
    MTLDataTypeFloat2x4 = 9,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeFloat3x2 = 10,
 | 
			
		||||
    MTLDataTypeFloat3x3 = 11,
 | 
			
		||||
    MTLDataTypeFloat3x4 = 12,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeFloat4x2 = 13,
 | 
			
		||||
    MTLDataTypeFloat4x3 = 14,
 | 
			
		||||
    MTLDataTypeFloat4x4 = 15,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeHalf  = 16,
 | 
			
		||||
    MTLDataTypeHalf2 = 17,
 | 
			
		||||
    MTLDataTypeHalf3 = 18,
 | 
			
		||||
    MTLDataTypeHalf4 = 19,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeHalf2x2 = 20,
 | 
			
		||||
    MTLDataTypeHalf2x3 = 21,
 | 
			
		||||
    MTLDataTypeHalf2x4 = 22,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeHalf3x2 = 23,
 | 
			
		||||
    MTLDataTypeHalf3x3 = 24,
 | 
			
		||||
    MTLDataTypeHalf3x4 = 25,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeHalf4x2 = 26,
 | 
			
		||||
    MTLDataTypeHalf4x3 = 27,
 | 
			
		||||
    MTLDataTypeHalf4x4 = 28,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeInt  = 29,
 | 
			
		||||
    MTLDataTypeInt2 = 30,
 | 
			
		||||
    MTLDataTypeInt3 = 31,
 | 
			
		||||
    MTLDataTypeInt4 = 32,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeUInt  = 33,
 | 
			
		||||
    MTLDataTypeUInt2 = 34,
 | 
			
		||||
    MTLDataTypeUInt3 = 35,
 | 
			
		||||
    MTLDataTypeUInt4 = 36,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeShort  = 37,
 | 
			
		||||
    MTLDataTypeShort2 = 38,
 | 
			
		||||
    MTLDataTypeShort3 = 39,
 | 
			
		||||
    MTLDataTypeShort4 = 40,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeUShort = 41,
 | 
			
		||||
    MTLDataTypeUShort2 = 42,
 | 
			
		||||
    MTLDataTypeUShort3 = 43,
 | 
			
		||||
    MTLDataTypeUShort4 = 44,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeChar  = 45,
 | 
			
		||||
    MTLDataTypeChar2 = 46,
 | 
			
		||||
    MTLDataTypeChar3 = 47,
 | 
			
		||||
    MTLDataTypeChar4 = 48,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeUChar  = 49,
 | 
			
		||||
    MTLDataTypeUChar2 = 50,
 | 
			
		||||
    MTLDataTypeUChar3 = 51,
 | 
			
		||||
    MTLDataTypeUChar4 = 52,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeBool  = 53,
 | 
			
		||||
    MTLDataTypeBool2 = 54,
 | 
			
		||||
    MTLDataTypeBool3 = 55,
 | 
			
		||||
    MTLDataTypeBool4 = 56,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeTexture API_AVAILABLE(macos(10.13), ios(11.0)) = 58,
 | 
			
		||||
    MTLDataTypeSampler API_AVAILABLE(macos(10.13), ios(11.0)) = 59,
 | 
			
		||||
    MTLDataTypePointer API_AVAILABLE(macos(10.13), ios(11.0)) = 60,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeR8Unorm         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 62,
 | 
			
		||||
    MTLDataTypeR8Snorm         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 63,
 | 
			
		||||
    MTLDataTypeR16Unorm        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 64,
 | 
			
		||||
    MTLDataTypeR16Snorm        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 65,
 | 
			
		||||
    MTLDataTypeRG8Unorm        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 66,
 | 
			
		||||
    MTLDataTypeRG8Snorm        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 67,
 | 
			
		||||
    MTLDataTypeRG16Unorm       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 68,
 | 
			
		||||
    MTLDataTypeRG16Snorm       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 69,
 | 
			
		||||
    MTLDataTypeRGBA8Unorm      API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 70,
 | 
			
		||||
    MTLDataTypeRGBA8Unorm_sRGB API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 71,
 | 
			
		||||
    MTLDataTypeRGBA8Snorm      API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 72,
 | 
			
		||||
    MTLDataTypeRGBA16Unorm     API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 73,
 | 
			
		||||
    MTLDataTypeRGBA16Snorm     API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 74,
 | 
			
		||||
    MTLDataTypeRGB10A2Unorm    API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 75,
 | 
			
		||||
    MTLDataTypeRG11B10Float    API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 76,
 | 
			
		||||
    MTLDataTypeRGB9E5Float     API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5)) = 77,
 | 
			
		||||
    MTLDataTypeRenderPipeline  API_AVAILABLE(macos(10.14), ios(13.0)) = 78,
 | 
			
		||||
    MTLDataTypeComputePipeline API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 79,
 | 
			
		||||
    MTLDataTypeIndirectCommandBuffer   API_AVAILABLE(macos(10.14), ios(12.0)) = 80,
 | 
			
		||||
    MTLDataTypeLong  API_AVAILABLE(macos(12.0), ios(14.0)) = 81,
 | 
			
		||||
    MTLDataTypeLong2 API_AVAILABLE(macos(12.0), ios(14.0)) = 82,
 | 
			
		||||
    MTLDataTypeLong3 API_AVAILABLE(macos(12.0), ios(14.0)) = 83,
 | 
			
		||||
    MTLDataTypeLong4 API_AVAILABLE(macos(12.0), ios(14.0)) = 84,
 | 
			
		||||
 | 
			
		||||
    MTLDataTypeULong  API_AVAILABLE(macos(12.0), ios(14.0)) = 85,
 | 
			
		||||
    MTLDataTypeULong2 API_AVAILABLE(macos(12.0), ios(14.0)) = 86,
 | 
			
		||||
    MTLDataTypeULong3 API_AVAILABLE(macos(12.0), ios(14.0)) = 87,
 | 
			
		||||
    MTLDataTypeULong4 API_AVAILABLE(macos(12.0), ios(14.0)) = 88,
 | 
			
		||||
    MTLDataTypeVisibleFunctionTable API_AVAILABLE(macos(11.0), ios(14.0)) = 115,
 | 
			
		||||
    MTLDataTypeIntersectionFunctionTable API_AVAILABLE(macos(11.0), ios(14.0)) = 116,
 | 
			
		||||
    MTLDataTypePrimitiveAccelerationStructure API_AVAILABLE(macos(11.0), ios(14.0)) = 117,
 | 
			
		||||
    MTLDataTypeInstanceAccelerationStructure API_AVAILABLE(macos(11.0), ios(14.0)) = 118,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
@class MTLArgument;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLArgumentType
 | 
			
		||||
 @abstract The type for an input to a MTLRenderPipelineState or a MTLComputePipelineState
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLArgumentTypeBuffer
 | 
			
		||||
 This input is a MTLBuffer
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLArgumentTypeThreadgroupMemory
 | 
			
		||||
 This input is a pointer to the threadgroup memory.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLArgumentTypeTexture
 | 
			
		||||
 This input is a MTLTexture.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLArgumentTypeSampler
 | 
			
		||||
 This input is a sampler.
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLArgumentType) {
 | 
			
		||||
 | 
			
		||||
    MTLArgumentTypeBuffer = 0,
 | 
			
		||||
    MTLArgumentTypeThreadgroupMemory= 1,
 | 
			
		||||
    MTLArgumentTypeTexture = 2,
 | 
			
		||||
    MTLArgumentTypeSampler = 3,
 | 
			
		||||
 | 
			
		||||
    MTLArgumentTypeImageblockData API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5))     = 16,
 | 
			
		||||
    MTLArgumentTypeImageblock API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5))         = 17,
 | 
			
		||||
    MTLArgumentTypeVisibleFunctionTable API_AVAILABLE(macos(11.0), ios(14.0)) = 24,
 | 
			
		||||
    MTLArgumentTypePrimitiveAccelerationStructure API_AVAILABLE(macos(11.0), ios(14.0)) = 25,
 | 
			
		||||
    MTLArgumentTypeInstanceAccelerationStructure API_AVAILABLE(macos(11.0), ios(14.0)) = 26,
 | 
			
		||||
    MTLArgumentTypeIntersectionFunctionTable API_AVAILABLE(macos(11.0), ios(14.0)) = 27,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLArgumentAccess
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLArgumentAccess) {
 | 
			
		||||
 | 
			
		||||
    MTLArgumentAccessReadOnly   = 0,
 | 
			
		||||
    MTLArgumentAccessReadWrite  = 1,
 | 
			
		||||
    MTLArgumentAccessWriteOnly  = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
@class MTLStructType;
 | 
			
		||||
@class MTLArrayType;
 | 
			
		||||
@class MTLTextureReferenceType;
 | 
			
		||||
@class MTLPointerType;
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@interface MTLType : NSObject
 | 
			
		||||
@property (readonly) MTLDataType dataType;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLStructMember : NSObject
 | 
			
		||||
 
 | 
			
		||||
@property (readonly) NSString *name;
 | 
			
		||||
@property (readonly) NSUInteger offset;
 | 
			
		||||
@property (readonly) MTLDataType dataType;
 | 
			
		||||
 | 
			
		||||
- (nullable MTLStructType *)structType;
 | 
			
		||||
- (nullable MTLArrayType *)arrayType;
 | 
			
		||||
 | 
			
		||||
- (nullable MTLTextureReferenceType *)textureReferenceType  API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
- (nullable MTLPointerType *)pointerType  API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSUInteger argumentIndex API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLStructType  : MTLType
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSArray <MTLStructMember *> *members;
 | 
			
		||||
 | 
			
		||||
- (nullable MTLStructMember *)memberByName:(NSString *)name;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLArrayType  : MTLType
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLDataType elementType;
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSUInteger arrayLength;
 | 
			
		||||
@property (readonly) NSUInteger stride;
 | 
			
		||||
@property (readonly) NSUInteger argumentIndexStride API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
- (nullable MTLStructType *)elementStructType;
 | 
			
		||||
- (nullable MTLArrayType *)elementArrayType;
 | 
			
		||||
- (nullable MTLTextureReferenceType *)elementTextureReferenceType  API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
- (nullable MTLPointerType *)elementPointerType  API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@interface MTLPointerType : MTLType
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLDataType elementType;           // MTLDataTypeFloat, MTLDataTypeFloat4, MTLDataTypeStruct, ...
 | 
			
		||||
@property (readonly) MTLArgumentAccess access;
 | 
			
		||||
@property (readonly) NSUInteger alignment;              // min alignment for the element data
 | 
			
		||||
@property (readonly) NSUInteger dataSize;               // sizeof(T) for T *argName
 | 
			
		||||
 | 
			
		||||
@property (readonly) BOOL elementIsArgumentBuffer API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
- (nullable MTLStructType *)elementStructType  API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
- (nullable MTLArrayType *)elementArrayType  API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@interface MTLTextureReferenceType : MTLType
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLDataType textureDataType; // half, float, int, or uint.
 | 
			
		||||
@property (readonly) MTLTextureType textureType;  // texture1D, texture2D...
 | 
			
		||||
@property (readonly) MTLArgumentAccess access;    // read, write, read-write
 | 
			
		||||
@property (readonly) BOOL isDepthTexture;         // true for depth textures
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 MTLArgument
 | 
			
		||||
*/
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLArgument : NSObject
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSString *name;
 | 
			
		||||
@property (readonly) MTLArgumentType type;
 | 
			
		||||
@property (readonly) MTLArgumentAccess access;
 | 
			
		||||
@property (readonly) NSUInteger index;
 | 
			
		||||
 | 
			
		||||
@property (readonly, getter=isActive) BOOL active;
 | 
			
		||||
 | 
			
		||||
// for buffer arguments
 | 
			
		||||
@property (readonly) NSUInteger      bufferAlignment;		// min alignment of starting offset in the buffer
 | 
			
		||||
@property (readonly) NSUInteger      bufferDataSize; 		// sizeof(T) for T *argName
 | 
			
		||||
@property (readonly) MTLDataType     bufferDataType; 		// MTLDataTypeFloat, MTLDataTypeFloat4, MTLDataTypeStruct, ...
 | 
			
		||||
@property (readonly, nullable) MTLStructType  *bufferStructType;
 | 
			
		||||
@property (readonly, nullable) MTLPointerType *bufferPointerType API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
// for threadgroup memory arguments
 | 
			
		||||
@property (readonly) NSUInteger     threadgroupMemoryAlignment;
 | 
			
		||||
@property (readonly) NSUInteger     threadgroupMemoryDataSize; // sizeof(T) for T *argName
 | 
			
		||||
 | 
			
		||||
// for texture arguments
 | 
			
		||||
@property (readonly) MTLTextureType textureType; // texture1D, texture2D...
 | 
			
		||||
@property (readonly) MTLDataType    textureDataType; // half, float, int, or uint.
 | 
			
		||||
@property (readonly) BOOL           isDepthTexture API_AVAILABLE(macos(10.12), ios(10.0)); // true for depth textures
 | 
			
		||||
@property (readonly) NSUInteger     arrayLength API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,188 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLArgumentEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2016 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLBuffer;
 | 
			
		||||
@protocol MTLTexture;
 | 
			
		||||
@protocol MTLSamplerState;
 | 
			
		||||
@protocol MTLRenderPipelineState;
 | 
			
		||||
@protocol MTLComputePipelineState;
 | 
			
		||||
@protocol MTLIndirectCommandBuffer;
 | 
			
		||||
@protocol MTLVisibleFunctionTable;
 | 
			
		||||
@protocol MTLAccelerationStructure;
 | 
			
		||||
@protocol MTLIntersectionFunctionTable;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @protocol MTLArgumentEncoder
 | 
			
		||||
 * @discussion MTLArgumentEncoder encodes buffer, texture, sampler, and constant data into a buffer.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@protocol MTLArgumentEncoder <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this argument encoder was created against.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @property encodedLength
 | 
			
		||||
 * @abstract The number of bytes required to store the encoded resource bindings.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger encodedLength;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @property alignment
 | 
			
		||||
 * @abstract The alignment in bytes required to store the encoded resource bindings.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger alignment;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setArgumentBuffer:offset:
 | 
			
		||||
 * @brief Sets the destination buffer and offset at which the arguments will be encoded.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setArgumentBuffer:(nullable id <MTLBuffer>)argumentBuffer offset:(NSUInteger)offset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setArgumentBuffer:offset:arrayElement:
 | 
			
		||||
 * @brief Sets the destination buffer, starting offset and specific array element arguments will be encoded into. arrayElement represents
 | 
			
		||||
          the desired element of IAB array targetted by encoding
 | 
			
		||||
 */
 | 
			
		||||
- (void)setArgumentBuffer:(nullable id <MTLBuffer>)argumentBuffer startOffset:(NSUInteger)startOffset arrayElement:(NSUInteger)arrayElement;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setBuffer:offset:atIndex:
 | 
			
		||||
 * @brief Set a buffer at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setBuffers:offsets:withRange:
 | 
			
		||||
 * @brief Set an array of buffers at the given bind point index range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBuffers:(const id <MTLBuffer> __nullable [__nonnull])buffers offsets:(const NSUInteger [__nonnull])offsets withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setTexture:atIndex:
 | 
			
		||||
 * @brief Set a texture at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTexture:(nullable id <MTLTexture>)texture atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setTextures:withRange:
 | 
			
		||||
 * @brief Set an array of textures at the given bind point index range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTextures:(const id <MTLTexture> __nullable [__nonnull])textures withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setSamplerState:atIndex:
 | 
			
		||||
 * @brief Set a sampler at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplerState:(nullable id <MTLSamplerState>)sampler atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setSamplerStates:withRange:
 | 
			
		||||
 * @brief Set an array of samplers at the given bind point index range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method constantDataAtIndex:
 | 
			
		||||
 * @brief Returns a pointer to the constant data at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void*)constantDataAtIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setRenderPipelineState:atIndex
 | 
			
		||||
 * @brief Sets a render pipeline state at a given bind point index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setRenderPipelineState:(nullable id <MTLRenderPipelineState>)pipeline atIndex:(NSUInteger)index API_AVAILABLE(macos(10.14), macCatalyst(13.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setRenderPipelineStates:withRange
 | 
			
		||||
 * @brief Set an array of render pipeline states at a given bind point index range
 | 
			
		||||
 */
 | 
			
		||||
- (void)setRenderPipelineStates:(const id <MTLRenderPipelineState> __nullable [__nonnull])pipelines withRange:(NSRange)range API_AVAILABLE(macos(10.14), macCatalyst(13.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setComputePipelineState:atIndex
 | 
			
		||||
 * @brief Sets a compute pipeline state at a given bind point index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setComputePipelineState:(nullable id <MTLComputePipelineState>)pipeline atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setComputePipelineStates:withRange
 | 
			
		||||
 * @brief Set an array of compute pipeline states at a given bind point index range
 | 
			
		||||
 */
 | 
			
		||||
- (void)setComputePipelineStates:(const id <MTLComputePipelineState> __nullable [__nonnull])pipelines withRange:(NSRange)range API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setIndirectCommandBuffer:atIndex
 | 
			
		||||
 * @brief Sets an indirect command buffer at a given bind point index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setIndirectCommandBuffer:(nullable id <MTLIndirectCommandBuffer>)indirectCommandBuffer atIndex:(NSUInteger)index API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setIndirectCommandBuffers:withRange:
 | 
			
		||||
 * @brief Set an array of indirect command buffers at the given bind point index range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setIndirectCommandBuffers:(const id <MTLIndirectCommandBuffer> __nullable [__nonnull])buffers withRange:(NSRange)range API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
- (void)setAccelerationStructure:(nullable id <MTLAccelerationStructure>)accelerationStructure atIndex:(NSUInteger)index  API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method newArgumentEncoderForBufferAtIndex:
 | 
			
		||||
 * @brief Returns a pointer to a new MTLArgumentEncoder that can be used to encode the an argument buffer
 | 
			
		||||
 * in the buffer associated with a given index.
 | 
			
		||||
 * Returns nil if the resource at the given index is not an argument buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLArgumentEncoder>)newArgumentEncoderForBufferAtIndex:(NSUInteger)index API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setVisibleFunctionTable:atIndex:
 | 
			
		||||
 * @brief Set a visible function table at the given buffer index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVisibleFunctionTable:(nullable id <MTLVisibleFunctionTable>)visibleFunctionTable atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setVisibleFunctionTables:withRange:
 | 
			
		||||
 * @brief Set visible function tables at the given buffer index range
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVisibleFunctionTables:(const id <MTLVisibleFunctionTable> __nullable [__nonnull])visibleFunctionTables withRange:(NSRange)range API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setIntersectionFunctionTable:atIndex:
 | 
			
		||||
 * @brief Set an intersection function table at the given buffer index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setIntersectionFunctionTable:(nullable id <MTLIntersectionFunctionTable>)intersectionFunctionTable atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setIntersectionFunctionTables:withRange:
 | 
			
		||||
 * @brief Set intersection function tables at the given buffer index range
 | 
			
		||||
 */
 | 
			
		||||
- (void)setIntersectionFunctionTables:(const id <MTLIntersectionFunctionTable> __nullable [__nonnull])intersectionFunctionTables withRange:(NSRange)range API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,123 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLBinaryArchive.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2020 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
@class MTLComputePipelineDescriptor;
 | 
			
		||||
@class MTLRenderPipelineDescriptor;
 | 
			
		||||
@class MTLTileRenderPipelineDescriptor;
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
MTL_EXTERN NSErrorDomain const MTLBinaryArchiveDomain API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLBinaryArchiveError)
 | 
			
		||||
{
 | 
			
		||||
    MTLBinaryArchiveErrorNone = 0,
 | 
			
		||||
    MTLBinaryArchiveErrorInvalidFile = 1,
 | 
			
		||||
    MTLBinaryArchiveErrorUnexpectedElement = 2,
 | 
			
		||||
    MTLBinaryArchiveErrorCompilationFailure = 3,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLBinaryArchiveDescriptor
 | 
			
		||||
 @abstract A class used to indicate how an archive should be created
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLBinaryArchiveDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property url
 | 
			
		||||
 @abstract The file URL from which to open a MTLBinaryArchive, or nil to create an empty MTLBinaryArchive.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nullable, nonatomic, copy) NSURL *url;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLBinaryArchive
 | 
			
		||||
 @abstract A container of pipeline state descriptors and their associated compiled code.
 | 
			
		||||
 @discussion A MTLBinaryArchive allows to persist compiled pipeline state objects for a device, which can be used to skip recompilation on a subsequent run of the app.
 | 
			
		||||
 One or more archives may be supplied in the descriptor of a pipeline state, allowing the device to attempt to look up compiled code in them before performing compilation.
 | 
			
		||||
 If no archives are provided, or no archives contain the requested content, the pipeline state is created by compiling the code as usual.
 | 
			
		||||
 Note that software updates of the OS or device drivers may cause the archive to become outdated, causing the lookup to fail and the usual path performing on-demand compilation is taken.
 | 
			
		||||
 A MTLBinaryArchive is populated by adding functions from pipeline state descriptors to it, indicating which compiled code should be persisted in the archive.
 | 
			
		||||
 Once all desired pipeline state descriptors have been added, use serializeToURL:error: to write the contents for the current device to disk.
 | 
			
		||||
 MTLBinaryArchive files generated for multiple different devices can be combined using the "lipo" tool into a single archive, which can then be shipped with the application.
 | 
			
		||||
 It is possible to maintain different archive files for different contexts; for example each level in a game may use a different cache object.
 | 
			
		||||
 Note: Metal maintains a separate cache of pipeline states on behalf of each app that contains all compiled code; this cache is populated as compilation occurs.
 | 
			
		||||
 This cache will automatically accelerate pipeline state creation after a pipeline is created for the first time.
 | 
			
		||||
 Use MTLBinaryArchive to augment that cache by accelerating pipeline state creation even on the first run of an app.
 | 
			
		||||
 Updating a MTLBinaryArchive at runtime in a shipping app configuration is not recommended; such a scenario requires corruption resiliency, careful storage space management and may cache hard-to-reproduce errors.
 | 
			
		||||
 These kind of issues are handled transparently by the Metal maintained cache, therefore we recommend that MTLBinaryArchive is populated during development time and shipped as an asset.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLBinaryArchive <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id<MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addComputePipelineFunctionsWithDescriptor:error:
 | 
			
		||||
 @abstract Add the function(s) from a compute pipeline state to the archive.
 | 
			
		||||
 @param descriptor The descriptor from which function(s) will be added.
 | 
			
		||||
 @param error If the function fails, this will be set to describe the failure. This can be (but is not required to be) an error from the MTLBinaryArchiveDomain domain.
 | 
			
		||||
 @return Whether or not the addition succeeded. Functions referenced multiple times are silently accepted.
 | 
			
		||||
 */
 | 
			
		||||
- (BOOL) addComputePipelineFunctionsWithDescriptor:(MTLComputePipelineDescriptor*)descriptor error:(NSError**)error;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addRenderPipelineFunctionsWithDescriptor:error:
 | 
			
		||||
 @abstract Add the function(s) from a render pipeline state to the archive.
 | 
			
		||||
 @param descriptor The descriptor from which function(s) will be added.
 | 
			
		||||
 @param error If the function fails, this will be set to describe the failure. This can be (but is not required to be) an error from the MTLBinaryArchiveDomain domain.
 | 
			
		||||
 @return Whether or not the addition succeeded. Functions referenced multiple times are silently accepted.
 | 
			
		||||
 */
 | 
			
		||||
- (BOOL) addRenderPipelineFunctionsWithDescriptor:(MTLRenderPipelineDescriptor*)descriptor error:(NSError**)error;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addTileRenderPipelineFunctionsWithDescriptor:error:
 | 
			
		||||
 @abstract Add the function(s) from a tile render pipeline state to the archive.
 | 
			
		||||
 @param descriptor The descriptor from which function(s) will be added.
 | 
			
		||||
 @param error If the function fails, this will be set to describe the failure. This can be (but is not required to be) an error from the MTLBinaryArchiveDomain domain.
 | 
			
		||||
 @return Whether or not the addition succeeded. Functions referenced multiple times are silently accepted.
 | 
			
		||||
 */
 | 
			
		||||
- (BOOL) addTileRenderPipelineFunctionsWithDescriptor:(MTLTileRenderPipelineDescriptor*)descriptor error:(NSError**)error API_AVAILABLE(tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method serializeToURL:error:
 | 
			
		||||
 @abstract Write the contents of a MTLBinaryArchive to a file.
 | 
			
		||||
 @discussion Persisting the archive to a file allows opening the archive on a subsequent instance of the app, making available the contents without recompiling.
 | 
			
		||||
 @param url The file URL to which to write the file
 | 
			
		||||
 @param error If the function fails, this will be set to describe the failure. This can be (but is not required to be) an error from the MTLBinaryArchiveDomain domain. Other possible errors can be file access or I/O related.
 | 
			
		||||
 @return Whether or not the writing the file succeeded.
 | 
			
		||||
 */
 | 
			
		||||
- (BOOL) serializeToURL:(NSURL*)url error:(NSError**)error;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addFunctionWithDescriptor:library:error:
 | 
			
		||||
 @abstract Add a `visible` or `intersection` function to the archive.
 | 
			
		||||
 @param descriptor The descriptor from which the function will be added.
 | 
			
		||||
 @param library Library of functions to add the function from.
 | 
			
		||||
 @param error If the function fails, this will be set to describe the failure. This can be (but is not required to be) an error from the MTLBinaryArchiveDomain domain. Other possible errors can be file access or I/O related.
 | 
			
		||||
 @return Whether or not the addition succeeded. Functions referenced multiple times are silently accepted.
 | 
			
		||||
 */
 | 
			
		||||
- (BOOL) addFunctionWithDescriptor:(MTLFunctionDescriptor *)descriptor library:(id<MTLLibrary>)library error:(NSError **)error API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,269 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLBlitCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLResourceStateCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLBuffer.h>
 | 
			
		||||
#import <Metal/MTLTexture.h>
 | 
			
		||||
#import <Metal/MTLFence.h>
 | 
			
		||||
#import <Metal/MTLRenderPass.h>
 | 
			
		||||
#import <Metal/MTLBlitPass.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
/*!
 | 
			
		||||
 @header MTLBlitCommandEncoder.h
 | 
			
		||||
 @discussion Header file for MTLBlitCommandEncoder
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLBlitOption
 | 
			
		||||
 @abstract Controls the blit operation
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLBlitOption)
 | 
			
		||||
{
 | 
			
		||||
    MTLBlitOptionNone                       = 0,
 | 
			
		||||
    MTLBlitOptionDepthFromDepthStencil      = 1 << 0,
 | 
			
		||||
    MTLBlitOptionStencilFromDepthStencil    = 1 << 1,
 | 
			
		||||
    MTLBlitOptionRowLinearPVRTC API_AVAILABLE(ios(9.0), macos(11.0), macCatalyst(14.0)) = 1 << 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLBlitCommandEncoder
 | 
			
		||||
 @abstract A command encoder that performs basic copies and blits between buffers and textures.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLBlitCommandEncoder <MTLCommandEncoder>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method synchronizeResource:
 | 
			
		||||
 @abstract Flush any copy of this resource from the device's caches, and invalidate any CPU caches if needed.
 | 
			
		||||
 @param resource The resource to page off.
 | 
			
		||||
 @discussion When the device writes to a resource with a storage mode of MTLResourceStorageModeManaged, those writes may be cached (for example, in VRAM or on chip renderer cache),
 | 
			
		||||
 making any CPU access (either MTLBuffer.contents or -[MTLTexture getBytes:...] and -[MTLTexture replaceRegion:]) produce undefined results.  To allow the CPU to see what the device
 | 
			
		||||
 has written, a CommandBuffer containing this synchronization must be executed.  After completion of the CommandBuffer, the CPU can access the contents of the resource safely.
 | 
			
		||||
 */
 | 
			
		||||
- (void)synchronizeResource:(id<MTLResource>)resource API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method synchronizeTexture:slice:mipmapLevel:
 | 
			
		||||
 @abstract Flush any copy of this image from the device's caches, and invalidate CPU caches if needed.
 | 
			
		||||
 @param texture The texture to page off.
 | 
			
		||||
 @param slice The slice of the texture to page off.
 | 
			
		||||
 @param level The mipmap level of the texture to flush.
 | 
			
		||||
 @discussion
 | 
			
		||||
 See the discussion of -synchronizeResource.   -synchronizeTexture:slice:mipmapLevel performs the same role, except it may flush only a subset of the texture storage, rather than the entire texture.
 | 
			
		||||
 */
 | 
			
		||||
- (void)synchronizeTexture:(id<MTLTexture>)texture slice:(NSUInteger)slice level:(NSUInteger)level API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:
 | 
			
		||||
 @abstract Copy a rectangle of pixels between textures.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromTexture:(id<MTLTexture>)sourceTexture sourceSlice:(NSUInteger)sourceSlice sourceLevel:(NSUInteger)sourceLevel sourceOrigin:(MTLOrigin)sourceOrigin sourceSize:(MTLSize)sourceSize toTexture:(id<MTLTexture>)destinationTexture destinationSlice:(NSUInteger)destinationSlice destinationLevel:(NSUInteger)destinationLevel destinationOrigin:(MTLOrigin)destinationOrigin;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:
 | 
			
		||||
 @abstract Copy an image from a buffer into a texture.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromBuffer:(id<MTLBuffer>)sourceBuffer sourceOffset:(NSUInteger)sourceOffset sourceBytesPerRow:(NSUInteger)sourceBytesPerRow sourceBytesPerImage:(NSUInteger)sourceBytesPerImage sourceSize:(MTLSize)sourceSize toTexture:(id<MTLTexture>)destinationTexture destinationSlice:(NSUInteger)destinationSlice destinationLevel:(NSUInteger)destinationLevel destinationOrigin:(MTLOrigin)destinationOrigin;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:
 | 
			
		||||
 @abstract Copy an image from a buffer into a texture.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromBuffer:(id<MTLBuffer>)sourceBuffer sourceOffset:(NSUInteger)sourceOffset sourceBytesPerRow:(NSUInteger)sourceBytesPerRow sourceBytesPerImage:(NSUInteger)sourceBytesPerImage sourceSize:(MTLSize)sourceSize toTexture:(id<MTLTexture>)destinationTexture destinationSlice:(NSUInteger)destinationSlice destinationLevel:(NSUInteger)destinationLevel destinationOrigin:(MTLOrigin)destinationOrigin options:(MTLBlitOption)options API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:
 | 
			
		||||
 @abstract Copy an image from a texture into a buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromTexture:(id<MTLTexture>)sourceTexture sourceSlice:(NSUInteger)sourceSlice sourceLevel:(NSUInteger)sourceLevel sourceOrigin:(MTLOrigin)sourceOrigin sourceSize:(MTLSize)sourceSize toBuffer:(id<MTLBuffer>)destinationBuffer destinationOffset:(NSUInteger)destinationOffset destinationBytesPerRow:(NSUInteger)destinationBytesPerRow destinationBytesPerImage:(NSUInteger)destinationBytesPerImage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:sourceOptions:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:options:
 | 
			
		||||
 @abstract Copy an image from a texture into a buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromTexture:(id<MTLTexture>)sourceTexture sourceSlice:(NSUInteger)sourceSlice sourceLevel:(NSUInteger)sourceLevel sourceOrigin:(MTLOrigin)sourceOrigin sourceSize:(MTLSize)sourceSize toBuffer:(id<MTLBuffer>)destinationBuffer destinationOffset:(NSUInteger)destinationOffset destinationBytesPerRow:(NSUInteger)destinationBytesPerRow destinationBytesPerImage:(NSUInteger)destinationBytesPerImage options:(MTLBlitOption)options API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method generateMipmapsForTexture:
 | 
			
		||||
 @abstract Generate mipmaps for a texture from the base level up to the max level.
 | 
			
		||||
 */
 | 
			
		||||
- (void)generateMipmapsForTexture:(id<MTLTexture>)texture;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method fillBuffer:range:value:
 | 
			
		||||
 @abstract Fill a buffer with a fixed value in each byte.
 | 
			
		||||
 */
 | 
			
		||||
- (void)fillBuffer:(id<MTLBuffer>)buffer range:(NSRange)range value:(uint8_t)value;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:
 | 
			
		||||
 @abstract Copy whole surfaces between textures.
 | 
			
		||||
 @discussion Convenience function to copy sliceCount * levelCount whole surfaces between textures
 | 
			
		||||
 The source and destination pixel format must be identical.
 | 
			
		||||
 The source and destination sample count must be identical.
 | 
			
		||||
 The sourceLevel mip in sourceTexture must have the same dimension as the destinationLevel mip in destinationTexture.
 | 
			
		||||
 The sourceTexture must have at least sourceLevel + levelCount mips
 | 
			
		||||
 The destinationTexture must have at least destinationLevel + levelCount mips
 | 
			
		||||
 The sourceTexture must have at least sourceSlice + sliceCount array slices
 | 
			
		||||
 The destinationTexture must have at least destinationSlice + sliceCount array slices
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromTexture:(id<MTLTexture>)sourceTexture sourceSlice:(NSUInteger)sourceSlice sourceLevel:(NSUInteger)sourceLevel
 | 
			
		||||
              toTexture:(id<MTLTexture>)destinationTexture destinationSlice:(NSUInteger)destinationSlice destinationLevel:(NSUInteger)destinationLevel
 | 
			
		||||
             sliceCount:(NSUInteger)sliceCount levelCount:(NSUInteger)levelCount API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromTexture:toTexture:
 | 
			
		||||
 @abstract Copy as many whole surfaces as possible between textures.
 | 
			
		||||
 @discussion Convenience function that calls copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:
 | 
			
		||||
 The source and destination pixel format must be identical.
 | 
			
		||||
 The source and destination sample count must be identical.
 | 
			
		||||
 Either:
 | 
			
		||||
 - sourceTexture must have a mip M with identical dimensions as the first mip of destinationTexture: sourceLevel = M, destinationLevel = 0
 | 
			
		||||
 - destinationTexture must have a mip M with identical dimensions as the first mip of sourceTexture: sourceLevel = 0, destinationLevel = M
 | 
			
		||||
 Computes: levelCount = min(sourceTexture.mipmapLevelCount - sourceLevel, destinationTexture.mipmapLevelCount - destinationLevel)
 | 
			
		||||
           sliceCount = min(sourceTexture.arrayLength, destinationTexture.arrayLength)
 | 
			
		||||
 Then invokes the method above using the computed parameters.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromTexture:(id<MTLTexture>)sourceTexture toTexture:(id<MTLTexture>)destinationTexture API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:
 | 
			
		||||
 @abstract Basic memory copy between buffers.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyFromBuffer:(id <MTLBuffer>)sourceBuffer sourceOffset:(NSUInteger)sourceOffset toBuffer:(id <MTLBuffer>)destinationBuffer destinationOffset:(NSUInteger)destinationOffset size:(NSUInteger)size;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateFence:
 | 
			
		||||
 @abstract Update the fence to capture all GPU work so far enqueued by this encoder.
 | 
			
		||||
 @discussion The fence is updated at kernel submission to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)updateFence:(id <MTLFence>)fence API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitForFence:
 | 
			
		||||
 @abstract Prevent further GPU work until the fence is reached.
 | 
			
		||||
 @discussion The fence is evaluated at kernel submision to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitForFence:(id <MTLFence>)fence API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@optional
 | 
			
		||||
/*!
 | 
			
		||||
 @method getTextureAccessCounters:region:mipLevel:slice:type:resetCounters:countersBuffer:countersBufferOffset
 | 
			
		||||
 @abstract Copies tile access counters within specified region into provided buffer
 | 
			
		||||
 */
 | 
			
		||||
-(void) getTextureAccessCounters:(id<MTLTexture>)texture
 | 
			
		||||
                          region:(MTLRegion)region
 | 
			
		||||
                        mipLevel:(NSUInteger)mipLevel
 | 
			
		||||
                           slice:(NSUInteger)slice
 | 
			
		||||
                   resetCounters:(BOOL)resetCounters
 | 
			
		||||
                  countersBuffer:(id<MTLBuffer>)countersBuffer
 | 
			
		||||
            countersBufferOffset:(NSUInteger)countersBufferOffset API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method resetTextureAccessCounters:region:mipLevel:slice:type:
 | 
			
		||||
 @abstract Resets tile access counters within specified region
 | 
			
		||||
 */
 | 
			
		||||
-(void) resetTextureAccessCounters:(id<MTLTexture>)texture
 | 
			
		||||
                            region:(MTLRegion)region
 | 
			
		||||
                          mipLevel:(NSUInteger)mipLevel
 | 
			
		||||
                             slice:(NSUInteger)slice API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
@required
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method optimizeContentsForGPUAccess:
 | 
			
		||||
 @abstract Optimizes the texture data to ensure the best possible performance when accessing content on the GPU at the expense of CPU-access performance.
 | 
			
		||||
 */
 | 
			
		||||
- (void)optimizeContentsForGPUAccess:(id<MTLTexture>)texture API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method optimizeContentsForGPUAccess:slice:level:
 | 
			
		||||
 @abstract Optimizes a subset of the texture data to ensure the best possible performance when accessing content on the GPU at the expense of CPU-access performance.
 | 
			
		||||
 */
 | 
			
		||||
- (void)optimizeContentsForGPUAccess:(id<MTLTexture>)texture slice:(NSUInteger)slice level:(NSUInteger)level API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method optimizeContentsForCPUAccess:
 | 
			
		||||
 @abstract Optimizes the texture data to ensure the best possible performance when accessing content on the CPU at the expense of GPU-access performance.
 | 
			
		||||
 */
 | 
			
		||||
- (void)optimizeContentsForCPUAccess:(id<MTLTexture>)texture API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method optimizeContentsForCPUAccess:slice:level:
 | 
			
		||||
 @abstract Optimizes a subset of the texture data to ensure the best possible performance when accessing content on the CPU at the expense of GPU-access performance.
 | 
			
		||||
 */
 | 
			
		||||
- (void)optimizeContentsForCPUAccess:(id<MTLTexture>)texture slice:(NSUInteger)slice level:(NSUInteger)level API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method resetCommandsInBuffer:withRange:
 | 
			
		||||
 @abstract reset commands in a indirect command buffer using the GPU
 | 
			
		||||
 */
 | 
			
		||||
- (void) resetCommandsInBuffer:(id<MTLIndirectCommandBuffer>)buffer withRange:(NSRange)range API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyIndirectCommandBuffer:source:sourceRange:destination:destinationIndex
 | 
			
		||||
 @abstract copy a region of a buffer into a destination buffer starting at destinationIndex using the GPU
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyIndirectCommandBuffer:(id <MTLIndirectCommandBuffer>)source sourceRange:(NSRange)sourceRange
 | 
			
		||||
                      destination:(id <MTLIndirectCommandBuffer>)destination destinationIndex:(NSUInteger)destinationIndex API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method optimizeIndirectCommandBuffer:withRange:
 | 
			
		||||
 @abstract Optimizes a subset of the texture data to ensure the best possible performance when accessing content on the CPU at the expense of GPU-access performance.
 | 
			
		||||
 */
 | 
			
		||||
- (void)optimizeIndirectCommandBuffer:(id <MTLIndirectCommandBuffer>)indirectCommandBuffer withRange:(NSRange)range API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method sampleCountersInBuffer:atSampleIndex:withBarrier:
 | 
			
		||||
 @abstract Sample hardware counters at this point in the blit encoder and
 | 
			
		||||
 store the counter sample into the sample buffer at the specified index.
 | 
			
		||||
 @param sampleBuffer The sample buffer to sample into
 | 
			
		||||
 @param sampleIndex The index into the counter buffer to write the sample.
 | 
			
		||||
 @param barrier Insert a barrier before taking the sample.  Passing
 | 
			
		||||
 YES will ensure that all work encoded before this operation in the encoder is
 | 
			
		||||
 complete but does not isolate the work with respect to other encoders.  Passing
 | 
			
		||||
 NO will allow the sample to be taken concurrently with other operations in this
 | 
			
		||||
 encoder.
 | 
			
		||||
 In general, passing YES will lead to more repeatable counter results but
 | 
			
		||||
 may negatively impact performance.  Passing NO will generally be higher performance
 | 
			
		||||
 but counter results may not be repeatable.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtBlitBoundary is unsupported,
 | 
			
		||||
 this method is not available and will generate an error if called.
 | 
			
		||||
 */
 | 
			
		||||
-(void)sampleCountersInBuffer:(id<MTLCounterSampleBuffer>)sampleBuffer
 | 
			
		||||
                atSampleIndex:(NSUInteger)sampleIndex
 | 
			
		||||
                  withBarrier:(BOOL)barrier API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method resolveCounters:inRange:destinationBuffer:destinationOffset:
 | 
			
		||||
 @param sampleBuffer The sample buffer to resolve.
 | 
			
		||||
 @param range The range of indices to resolve.
 | 
			
		||||
 @param destinationBuffer The buffer to resolve values into.
 | 
			
		||||
 @param destinationOffset The offset to begin writing values out to.  This must be a multiple of
 | 
			
		||||
 the minimum constant buffer alignment.
 | 
			
		||||
 @abstract Resolve the counters from the raw buffer to a processed buffer.
 | 
			
		||||
 @discussion Samples that encountered an error during resolve will be set to
 | 
			
		||||
 MTLCounterErrorValue.
 | 
			
		||||
 */
 | 
			
		||||
-(void)resolveCounters:(id<MTLCounterSampleBuffer>)sampleBuffer
 | 
			
		||||
               inRange:(NSRange)range
 | 
			
		||||
     destinationBuffer:(id<MTLBuffer>)destinationBuffer
 | 
			
		||||
     destinationOffset:(NSUInteger)destinationOffset API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,82 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLBlitPass.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLCounters.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLBlitPassSampleBufferAttachmentDescriptor : NSObject<NSCopying>
 | 
			
		||||
/*!
 | 
			
		||||
@property sampleBuffer
 | 
			
		||||
@abstract The sample buffer to store samples for the blit-pass defined samples.
 | 
			
		||||
If sampleBuffer is non-nil, the sample indices will be used to store samples into
 | 
			
		||||
the sample buffer.  If no sample buffer is provided, no samples will be taken.
 | 
			
		||||
If any of the sample indices are specified as MTLCounterDontSample, no sample
 | 
			
		||||
will be taken for that action.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, nonatomic, retain) id<MTLCounterSampleBuffer> sampleBuffer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property startOfEncoderSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the start of
 | 
			
		||||
 command encoder processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a blit pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger startOfEncoderSampleIndex;
 | 
			
		||||
/*!
 | 
			
		||||
 @property endOfEncoderSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the end of
 | 
			
		||||
 Command encoder processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a blit pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger endOfEncoderSampleIndex;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLBlitPassSampleBufferAttachmentDescriptorArray : NSObject
 | 
			
		||||
/* Individual attachment state access */
 | 
			
		||||
- (MTLBlitPassSampleBufferAttachmentDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLBlitPassSampleBufferAttachmentDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLBlitPassDescriptor
 | 
			
		||||
 @abstract MTLBlitPassDescriptor represents a collection of attachments to be used to create a concrete blit command encoder
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLBlitPassDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method blitPassDescriptor
 | 
			
		||||
 @abstract Create an autoreleased default frame buffer descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLBlitPassDescriptor *)blitPassDescriptor;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleBufferAttachments
 | 
			
		||||
 @abstract An array of sample buffers and associated sample indices.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLBlitPassSampleBufferAttachmentDescriptorArray * sampleBufferAttachments;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,99 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLBuffer.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLPixelFormat.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
/*!
 | 
			
		||||
 @header MTLBuffer.h
 | 
			
		||||
 @discussion Header file for MTLBuffer
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@class MTLTextureDescriptor;
 | 
			
		||||
@protocol MTLTexture;
 | 
			
		||||
@protocol MTLResource;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLBuffer
 | 
			
		||||
 @abstract A typeless allocation accessible by both the CPU and the GPU (MTLDevice) or by only the GPU when the storage mode is
 | 
			
		||||
 MTLResourceStorageModePrivate.
 | 
			
		||||
 
 | 
			
		||||
 @discussion
 | 
			
		||||
 Unlike in OpenGL and OpenCL, access to buffers is not synchronized.  The caller may use the CPU to modify the data at any time
 | 
			
		||||
 but is also responsible for ensuring synchronization and coherency.
 | 
			
		||||
 
 | 
			
		||||
 The contents become undefined if both the CPU and GPU write to the same buffer without a synchronizing action between those writes.
 | 
			
		||||
 This is true even when the regions written do not overlap.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLBuffer <MTLResource>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property length
 | 
			
		||||
 @abstract The length of the buffer in bytes.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger length;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method contents
 | 
			
		||||
 @abstract Returns the data pointer of this buffer's shared copy.
 | 
			
		||||
 */
 | 
			
		||||
- (void*)contents NS_RETURNS_INNER_POINTER;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method didModifyRange:
 | 
			
		||||
 @abstract Inform the device of the range of a buffer that the CPU has modified, allowing the implementation to invalidate 
 | 
			
		||||
 its caches of the buffer's content.
 | 
			
		||||
 @discussion When the application writes to a buffer's sysmem copy via @a contents, that range of the buffer immediately 
 | 
			
		||||
 becomes undefined for any accesses by the GPU (MTLDevice).  To restore coherency, the buffer modification must be followed
 | 
			
		||||
 by -didModifyRange:, and then followed by a commit of the MTLCommandBuffer that will access the buffer.
 | 
			
		||||
 -didModifyRange does not make the contents coherent for any previously committed command buffers.
 | 
			
		||||
 Note: This method is only required if buffer is created with a storage mode of MTLResourceStorageModeManaged.
 | 
			
		||||
 It is not valid to invoke this method on buffers of other storage modes.
 | 
			
		||||
 @param range The range of bytes that have been modified.
 | 
			
		||||
 */
 | 
			
		||||
- (void)didModifyRange:(NSRange)range API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newTextureWithDescriptor:offset:bytesPerRow:
 | 
			
		||||
 @abstract Create a 2D texture or texture buffer that shares storage with this buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLTexture>)newTextureWithDescriptor:(MTLTextureDescriptor*)descriptor offset:(NSUInteger)offset bytesPerRow:(NSUInteger)bytesPerRow API_AVAILABLE(macos(10.13), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addDebugMarker:range:
 | 
			
		||||
 @abstract Adds a marker to a specific range in the buffer.
 | 
			
		||||
 When inspecting a buffer in the GPU debugging tools the marker will be shown.
 | 
			
		||||
 @param marker A label used for the marker.
 | 
			
		||||
 @param range The range of bytes the marker is using.
 | 
			
		||||
 */
 | 
			
		||||
- (void)addDebugMarker:(NSString*)marker range:(NSRange)range API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method removeAllDebugMarkers
 | 
			
		||||
 @abstract Removes all debug markers from a buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (void)removeAllDebugMarkers API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property remoteStorageBuffer
 | 
			
		||||
 @abstract For Metal buffer objects that are remote views, this returns the buffer associated with the storage on the originating device.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) id<MTLBuffer> remoteStorageBuffer API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newRemoteBufferViewForDevice:
 | 
			
		||||
 @abstract On Metal devices that support peer to peer transfers, this method is used to create a remote buffer view on another device
 | 
			
		||||
 within the peer group.  The receiver must use MTLStorageModePrivate or be backed by an IOSurface.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLBuffer>) newRemoteBufferViewForDevice:(id <MTLDevice>)device API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,113 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLCaptureManager.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2017 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
@protocol MTLCaptureScope;
 | 
			
		||||
@protocol MTLCommandQueue;
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.15), ios(13.0))
 | 
			
		||||
MTL_EXTERN NSErrorDomain const MTLCaptureErrorDomain;
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSInteger, MTLCaptureError)
 | 
			
		||||
{
 | 
			
		||||
    /// Capturing is not supported, maybe the destination is not supported.
 | 
			
		||||
    MTLCaptureErrorNotSupported = 1,
 | 
			
		||||
    /// A capture is already in progress.
 | 
			
		||||
    MTLCaptureErrorAlreadyCapturing,
 | 
			
		||||
    /// The MTLCaptureDescriptor contains an invalid parameters.
 | 
			
		||||
    MTLCaptureErrorInvalidDescriptor,
 | 
			
		||||
} API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/// The destination where you want the GPU trace to be captured to.
 | 
			
		||||
typedef NS_ENUM(NSInteger, MTLCaptureDestination)
 | 
			
		||||
{
 | 
			
		||||
    /// Capture to Developer Tools (Xcode) and stop the execution after capturing.
 | 
			
		||||
    MTLCaptureDestinationDeveloperTools = 1,
 | 
			
		||||
    /// Capture to a GPU Trace document and continue execution after capturing.
 | 
			
		||||
    MTLCaptureDestinationGPUTraceDocument,
 | 
			
		||||
} API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXTERN API_AVAILABLE(macos(10.15), ios(13.0))
 | 
			
		||||
@interface MTLCaptureDescriptor: NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
    @brief The object that is captured.
 | 
			
		||||
 | 
			
		||||
    Must be one of the following:
 | 
			
		||||
 
 | 
			
		||||
    MTLDevice captures all command queues of the device.
 | 
			
		||||
 
 | 
			
		||||
    MTLCommandQueue captures a single command queue.
 | 
			
		||||
 
 | 
			
		||||
    MTLCaptureScope captures between the next begin and end of the scope.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, strong, nullable) id captureObject;
 | 
			
		||||
 | 
			
		||||
/// The destination you want the GPU trace to be captured to.
 | 
			
		||||
@property (nonatomic, assign) MTLCaptureDestination destination;
 | 
			
		||||
 | 
			
		||||
/// URL the GPU Trace document will be captured to.
 | 
			
		||||
/// Must be specified when destiation is MTLCaptureDestinationGPUTraceDocument.
 | 
			
		||||
@property (nonatomic, copy, nullable) NSURL *outputURL;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXTERN API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@interface MTLCaptureManager : NSObject
 | 
			
		||||
 | 
			
		||||
/** Retrieves the shared capture manager for this process. There is only one capture manager per process.
 | 
			
		||||
    The capture manager allows the user to create capture scopes and trigger captures from code.
 | 
			
		||||
    When a capture has been completed, it will be displayed in Xcode and the application will be paused.
 | 
			
		||||
    @remarks: only MTLCommandBuffers created after starting a capture and committed before stopping it are captured. 
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLCaptureManager*)sharedCaptureManager;
 | 
			
		||||
 | 
			
		||||
// Use +[sharedCaptureManager]
 | 
			
		||||
- (instancetype)init API_UNAVAILABLE(macos, ios);
 | 
			
		||||
 | 
			
		||||
// Creates a new capture scope for the given capture device
 | 
			
		||||
- (id<MTLCaptureScope>)newCaptureScopeWithDevice:(id<MTLDevice>)device;
 | 
			
		||||
// Creates a new capture scope for the given command queue
 | 
			
		||||
- (id<MTLCaptureScope>)newCaptureScopeWithCommandQueue:(id<MTLCommandQueue>)commandQueue;
 | 
			
		||||
 | 
			
		||||
// Checks if a given capture destination is supported.
 | 
			
		||||
- (BOOL)supportsDestination:(MTLCaptureDestination)destination API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/// Start capturing until stopCapture is called.
 | 
			
		||||
/// @param descriptor MTLCaptureDescriptor specifies the parameters.
 | 
			
		||||
/// @param error Optional error output to check why a capture could not be started.
 | 
			
		||||
/// @return true if the capture was successfully started, otherwise false.
 | 
			
		||||
/// @remarks Only MTLCommandBuffers created after starting and committed before stopping it are captured.
 | 
			
		||||
- (BOOL)startCaptureWithDescriptor:(MTLCaptureDescriptor *)descriptor error:(__autoreleasing NSError **)error API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
// Starts capturing, for all queues of the given device, new MTLCommandBuffer's until -[stopCapture] or Xcode’s stop capture button is pressed
 | 
			
		||||
- (void)startCaptureWithDevice:(id<MTLDevice>)device API_DEPRECATED("Use startCaptureWithDescriptor:error: instead", macos(10.13, 10.15), ios(11.0, 13.0));
 | 
			
		||||
// Starts capturing, for the given command queue, command buffers that are created after invoking this method and committed before invoking -[stopCapture] or clicking Xcode’s stop capture button.
 | 
			
		||||
- (void)startCaptureWithCommandQueue:(id<MTLCommandQueue>)commandQueue API_DEPRECATED("Use startCaptureWithDescriptor:error: instead", macos(10.13, 10.15), ios(11.0, 13.0));
 | 
			
		||||
// Start a capture with the given scope: from the scope's begin until its end, restricting the capture to the scope's device(s) and, if selected, the scope's command queue
 | 
			
		||||
- (void)startCaptureWithScope:(id<MTLCaptureScope>)captureScope API_DEPRECATED("Use startCaptureWithDescriptor:error: instead", macos(10.13, 10.15), ios(11.0, 13.0));
 | 
			
		||||
 | 
			
		||||
// Stops a capture started from startCaptureWithDevice:/startCaptureWithCommandQueue:/startCaptureWithScope: or from Xcode’s capture button
 | 
			
		||||
- (void)stopCapture;
 | 
			
		||||
 | 
			
		||||
// Default scope to be captured when a capture is initiated from Xcode’s capture button. When nil, it’ll fall back to presentDrawable:, presentDrawable:atTime:, presentDrawable:afterMinimumDuration: in MTLCommandBuffer or present:, present:atTime:, present:afterMinimumDuration: in MTLDrawable.
 | 
			
		||||
@property (nullable, readwrite, strong, atomic) id<MTLCaptureScope> defaultCaptureScope;
 | 
			
		||||
 | 
			
		||||
// Query if a capture is currently in progress
 | 
			
		||||
@property (readonly) BOOL isCapturing;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLCaptureScope.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2017 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLCommandQueue;
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@protocol MTLCaptureScope <NSObject>
 | 
			
		||||
 | 
			
		||||
// Remarks: only MTLCommandBuffers created after -[beginScope] and committed before -[endScope] are captured.
 | 
			
		||||
 | 
			
		||||
// Marks the begin of the capture scope. Note: This method should be invoked repeatedly per frame.
 | 
			
		||||
- (void)beginScope;
 | 
			
		||||
// Marks the end of the capture scope. Note: This method should be invoked repeatedly per frame.
 | 
			
		||||
- (void)endScope;
 | 
			
		||||
 | 
			
		||||
/** Scope label
 | 
			
		||||
    @remarks Created capture scopes are listed in Xcode when long-pressing the capture button, performing the capture over the selected scope
 | 
			
		||||
  */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
// Associated device: this scope will capture Metal commands from the associated device
 | 
			
		||||
@property (nonnull, readonly, nonatomic)  id<MTLDevice> device;
 | 
			
		||||
/** If set, this scope will only capture Metal commands from the associated command queue. Defaults to nil (all command queues from the associated device are captured).
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly, nonatomic) id<MTLCommandQueue> commandQueue;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,432 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLCommandBuffer.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
    
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLCommandQueue;
 | 
			
		||||
@protocol MTLBlitCommandEncoder;
 | 
			
		||||
@protocol MTLRenderCommandEncoder;
 | 
			
		||||
@protocol MTLParallelRenderCommandEncoder;
 | 
			
		||||
@protocol MTLComputeCommandEncoder;
 | 
			
		||||
@protocol MTLCommandQueue;
 | 
			
		||||
@protocol MTLDrawable;
 | 
			
		||||
@protocol MTLCommandBuffer;
 | 
			
		||||
@protocol MTLEvent;
 | 
			
		||||
@protocol MTLLogContainer;
 | 
			
		||||
@protocol MTLResourceStateCommandEncoder;
 | 
			
		||||
@protocol MTLAccelerationStructureCommandEncoder;
 | 
			
		||||
@class MTLRenderPassDescriptor;
 | 
			
		||||
@class MTLComputePassDescriptor;
 | 
			
		||||
@class MTLBlitPassDescriptor;
 | 
			
		||||
@class MTLResourceStatePassDescriptor;
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLCommandBufferStatus
 | 
			
		||||
 
 | 
			
		||||
 @abstract MTLCommandBufferStatus reports the current stage in the lifetime of MTLCommandBuffer, as it proceeds to enqueued, committed, scheduled, and completed.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferStatusNotEnqueued
 | 
			
		||||
 The command buffer has not been enqueued yet.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferStatusEnqueued
 | 
			
		||||
 This command buffer is enqueued, but not committed.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferStatusCommitted
 | 
			
		||||
 Commited to its command queue, but not yet scheduled for execution.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferStatusScheduled
 | 
			
		||||
 All dependencies have been resolved and the command buffer has been scheduled for execution.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferStatusCompleted
 | 
			
		||||
 The command buffer has finished executing successfully: any blocks set with -addCompletedHandler: may now be called.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferStatusError
 | 
			
		||||
 Execution of the command buffer was aborted due to an error during execution.  Check -error for more information.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLCommandBufferStatus) {
 | 
			
		||||
    MTLCommandBufferStatusNotEnqueued = 0,
 | 
			
		||||
    MTLCommandBufferStatusEnqueued = 1,
 | 
			
		||||
    MTLCommandBufferStatusCommitted = 2,
 | 
			
		||||
    MTLCommandBufferStatusScheduled = 3,
 | 
			
		||||
    MTLCommandBufferStatusCompleted = 4,
 | 
			
		||||
    MTLCommandBufferStatusError = 5,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
 /*!
 | 
			
		||||
 @constant MTLCommandBufferErrorDomain
 | 
			
		||||
 @abstract An error domain for NSError objects produced by MTLCommandBuffer
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
MTL_EXTERN NSErrorDomain const MTLCommandBufferErrorDomain;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLCommandBufferError
 | 
			
		||||
 @abstract Error codes that can be found in MTLCommandBuffer.error
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorInternal
 | 
			
		||||
 An internal error that doesn't fit into the other categories. The actual low level error code is encoded in the local description.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorTimeout
 | 
			
		||||
 Execution of this command buffer took too long, execution of this command was interrupted and aborted.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorPageFault
 | 
			
		||||
 Execution of this command buffer generated an unserviceable GPU page fault. This can caused by buffer read write attribute mismatch or out of boundary access.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorAccessRevoked
 | 
			
		||||
 Access to this device has been revoked because this client has been responsible for too many timeouts or hangs.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorNotPermitted
 | 
			
		||||
 This process does not have access to use this device.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorOutOfMemory
 | 
			
		||||
 Insufficient memory was available to execute this command buffer.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorInvalidResource
 | 
			
		||||
 The command buffer referenced an invalid resource.  This is most commonly caused when the caller deletes a resource before executing a command buffer that refers to it.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorMemoryless
 | 
			
		||||
 One or more internal resources limits reached that prevent using memoryless render pass attachments. See error string for more detail.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorDeviceRemoved
 | 
			
		||||
 The device was physically removed before the command could finish execution
 | 
			
		||||
 | 
			
		||||
 @constant MTLCommandBufferErrorStackOverflow
 | 
			
		||||
 Execution of the command buffer was stopped due to Stack Overflow Exception. [MTLComputePipelineDescriptor maxCallStackDepth] setting needs to be checked.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLCommandBufferError)
 | 
			
		||||
{
 | 
			
		||||
    MTLCommandBufferErrorNone = 0,
 | 
			
		||||
    MTLCommandBufferErrorInternal = 1,
 | 
			
		||||
    MTLCommandBufferErrorTimeout = 2,
 | 
			
		||||
    MTLCommandBufferErrorPageFault = 3,
 | 
			
		||||
    MTLCommandBufferErrorBlacklisted = 4, // Deprecated. Please use MTLCommandBufferErrorAccessRevoked.
 | 
			
		||||
    MTLCommandBufferErrorAccessRevoked = 4,
 | 
			
		||||
    MTLCommandBufferErrorNotPermitted = 7,
 | 
			
		||||
    MTLCommandBufferErrorOutOfMemory = 8,
 | 
			
		||||
    MTLCommandBufferErrorInvalidResource = 9,
 | 
			
		||||
    MTLCommandBufferErrorMemoryless API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = 10,
 | 
			
		||||
    MTLCommandBufferErrorDeviceRemoved API_AVAILABLE(macos(10.13)) API_UNAVAILABLE(ios) = 11,
 | 
			
		||||
    MTLCommandBufferErrorStackOverflow API_AVAILABLE(macos(12.0), ios(15.0)) = 12,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract Key in the userInfo for MTLCommandBufferError NSErrors. Value is an NSArray of MTLCommandBufferEncoderInfo objects in recorded order if an appropriate MTLCommandBufferErrorOption was set, otherwise the key will not exist in the userInfo dictionary.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
MTL_EXTERN NSErrorUserInfoKey const MTLCommandBufferEncoderInfoErrorKey;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract Options for controlling the error reporting for Metal command buffer objects.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorOptionNone
 | 
			
		||||
 No special error reporting.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandBufferErrorOptionEncoderExecutionStatus
 | 
			
		||||
 Provide the execution status of the individual encoders within the command buffer. In the event of a command buffer error, populate the `userInfo` dictionary of the command buffer's NSError parameter, see MTLCommandBufferEncoderInfoErrorKey and MTLCommandBufferEncoderInfo. Note that enabling this error reporting option may increase CPU, GPU, and/or memory overhead on some platforms; testing for impact is suggested.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLCommandBufferErrorOption) {
 | 
			
		||||
    MTLCommandBufferErrorOptionNone = 0,
 | 
			
		||||
    MTLCommandBufferErrorOptionEncoderExecutionStatus = 1 << 0,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract The error states for a Metal command encoder after command buffer execution.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandEncoderErrorStateUnknown
 | 
			
		||||
 The state of the commands associated with the encoder is unknown (the error information was likely not requested).
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandEncoderErrorStateCompleted
 | 
			
		||||
 The commands associated with the encoder were completed.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandEncoderErrorStateAffected
 | 
			
		||||
 The commands associated with the encoder were affected by an error, which may or may not have been caused by the commands themselves, and failed to execute in full.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandEncoderErrorStatePending
 | 
			
		||||
 The commands associated with the encoder never started execution.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCommandEncoderErrorStateFaulted
 | 
			
		||||
 The commands associated with the encoder caused an error.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSInteger, MTLCommandEncoderErrorState) {
 | 
			
		||||
    MTLCommandEncoderErrorStateUnknown = 0,
 | 
			
		||||
    MTLCommandEncoderErrorStateCompleted = 1,
 | 
			
		||||
    MTLCommandEncoderErrorStateAffected = 2,
 | 
			
		||||
    MTLCommandEncoderErrorStatePending = 3,
 | 
			
		||||
    MTLCommandEncoderErrorStateFaulted = 4,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLCommandBufferDescriptor
 | 
			
		||||
 @abstract An object that you use to configure new Metal command buffer objects.
 | 
			
		||||
*/
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLCommandBufferDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property retainedReferences
 | 
			
		||||
 @abstract If YES, the created command buffer holds strong references to objects needed for it to execute. If NO, the created command buffer does not hold strong references to objects needed for it to execute.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic) BOOL retainedReferences;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property errorOptions
 | 
			
		||||
 @abstract A set of options to influence the error reporting of the created command buffer. See MTLCommandBufferErrorOption.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic) MTLCommandBufferErrorOption errorOptions;
 | 
			
		||||
 | 
			
		||||
@end // MTLCommandBufferDescriptor
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract Provides execution status information for a Metal command encoder.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLCommandBufferEncoderInfo <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract The debug label given to the associated Metal command encoder at command buffer submission.
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly, nonatomic) NSString* label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract The debug signposts inserted into the associated Metal command encoder.
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly, nonatomic) NSArray<NSString*>* debugSignposts;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract The error state of the associated Metal command encoder.
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly, nonatomic) MTLCommandEncoderErrorState errorState;
 | 
			
		||||
 | 
			
		||||
@end // MTLCommandBufferEncoderInfo
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef void (^MTLCommandBufferHandler)(id <MTLCommandBuffer>);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLDispatchType
 | 
			
		||||
 
 | 
			
		||||
 @abstract MTLDispatchType Describes how a command encoder will execute dispatched work.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLDispatchTypeSerial
 | 
			
		||||
 Command encoder dispatches are executed in dispatched order.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLDispatchTypeConcurrent
 | 
			
		||||
 Command encoder dispatches are executed in parallel with each other. 
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLDispatchType){
 | 
			
		||||
    MTLDispatchTypeSerial,
 | 
			
		||||
    MTLDispatchTypeConcurrent,
 | 
			
		||||
}API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLCommandBuffer
 | 
			
		||||
 @abstract A serial list of commands for the device to execute.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLCommandBuffer <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property commandQueue
 | 
			
		||||
 @abstract The command queue this command buffer was created from.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLCommandQueue> commandQueue;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property retainedReferences
 | 
			
		||||
 @abstract If YES, this command buffer holds strong references to objects needed to execute this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) BOOL retainedReferences;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract The set of options configuring the error reporting of the created command buffer.
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly) MTLCommandBufferErrorOption errorOptions API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
@property (readonly) CFTimeInterval kernelStartTime API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(10.3));
 | 
			
		||||
@property (readonly) CFTimeInterval kernelEndTime API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(10.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
@property logs
 | 
			
		||||
@abstract Logs generated by the command buffer during execution of the GPU commands. Valid after GPU execution is completed
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly) id<MTLLogContainer> logs API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property GPUStartTime
 | 
			
		||||
 @abstract The host time in seconds that GPU starts executing this command buffer. Returns zero if it has not started. This usually can be called in command buffer completion handler.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) CFTimeInterval GPUStartTime API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(10.3));
 | 
			
		||||
/*!
 | 
			
		||||
 @property GPUEndTime
 | 
			
		||||
 @abstract The host time in seconds that GPU finishes executing this command buffer. Returns zero if CPU has not received completion notification. This usually can be called in command buffer completion handler.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) CFTimeInterval GPUEndTime API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(10.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method enqueue
 | 
			
		||||
 @abstract Append this command buffer to the end of its MTLCommandQueue.
 | 
			
		||||
*/
 | 
			
		||||
- (void)enqueue;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method commit
 | 
			
		||||
 @abstract Commit a command buffer so it can be executed as soon as possible.
 | 
			
		||||
 */
 | 
			
		||||
- (void)commit;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addScheduledHandler:block:
 | 
			
		||||
 @abstract Adds a block to be called when this command buffer has been scheduled for execution.
 | 
			
		||||
 */
 | 
			
		||||
- (void)addScheduledHandler:(MTLCommandBufferHandler)block;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method presentDrawable:
 | 
			
		||||
 @abstract Add a drawable present that will be invoked when this command buffer has been scheduled for execution.
 | 
			
		||||
 @discussion The submission thread will be lock stepped with present call been serviced by window server
 | 
			
		||||
 */
 | 
			
		||||
- (void)presentDrawable:(id <MTLDrawable>)drawable;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method presentDrawable:atTime:
 | 
			
		||||
 @abstract Add a drawable present for a specific host time that will be invoked when this command buffer has been scheduled for execution.
 | 
			
		||||
 @discussion The submission thread will be lock stepped with present call been serviced by window server
 | 
			
		||||
*/
 | 
			
		||||
- (void)presentDrawable:(id <MTLDrawable>)drawable atTime:(CFTimeInterval)presentationTime;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method presentDrawable:afterMinimumDuration:
 | 
			
		||||
 @abstract Add a drawable present for a specific host time that allows previous frame to be on screen for at least duration time.
 | 
			
		||||
 @param drawable The drawable to be presented
 | 
			
		||||
 @param duration The minimum time that previous frame should be displayed. The time is double preceision floating point in the unit of seconds.
 | 
			
		||||
 @discussion The difference of this API versus presentDrawable:atTime is that this API defers calculation of the presentation time until the previous frame's actual presentation time is known, thus to be able to maintain a more consistent and stable frame time. This also provides an easy way to set frame rate.
 | 
			
		||||
    The submission thread will be lock stepped with present call been serviced by window server 
 | 
			
		||||
 */
 | 
			
		||||
- (void)presentDrawable:(id <MTLDrawable>)drawable afterMinimumDuration:(CFTimeInterval)duration API_AVAILABLE(macos(10.15.4), ios(10.3), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitUntilScheduled
 | 
			
		||||
 @abstract Synchronously wait for this command buffer to be scheduled.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitUntilScheduled;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addCompletedHandler:block:
 | 
			
		||||
 @abstract Add a block to be called when this command buffer has completed execution.
 | 
			
		||||
 */
 | 
			
		||||
- (void)addCompletedHandler:(MTLCommandBufferHandler)block;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitUntilCompleted
 | 
			
		||||
 @abstract Synchronously wait for this command buffer to complete.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitUntilCompleted;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property status
 | 
			
		||||
 @abstract status reports the current stage in the lifetime of MTLCommandBuffer, as it proceeds to enqueued, committed, scheduled, and completed.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLCommandBufferStatus status;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property error
 | 
			
		||||
 @abstract If an error occurred during execution, the NSError may contain more details about the problem.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) NSError *error;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method blitCommandEncoder
 | 
			
		||||
 @abstract returns a blit command encoder to encode into this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLBlitCommandEncoder>)blitCommandEncoder;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method renderCommandEncoderWithDescriptor:
 | 
			
		||||
 @abstract returns a render command endcoder to encode into this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLRenderCommandEncoder>)renderCommandEncoderWithDescriptor:(MTLRenderPassDescriptor *)renderPassDescriptor;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method computeCommandEncoderWithDescriptor:
 | 
			
		||||
 @abstract returns a compute command endcoder to encode into this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLComputeCommandEncoder>)computeCommandEncoderWithDescriptor:(MTLComputePassDescriptor *)computePassDescriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method blitCommandEncoderWithDescriptor:
 | 
			
		||||
 @abstract returns a blit command endcoder to encode into this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLBlitCommandEncoder>)blitCommandEncoderWithDescriptor:(MTLBlitPassDescriptor *)blitPassDescriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @method computeCommandEncoder
 | 
			
		||||
 @abstract returns a compute command encoder to encode into this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLComputeCommandEncoder>)computeCommandEncoder;
 | 
			
		||||
/*! 
 | 
			
		||||
 @method computeCommandEncoderWithDispatchType
 | 
			
		||||
 @abstract returns a compute command encoder to encode into this command buffer. Optionally allow this command encoder to execute dispatches concurrently.
 | 
			
		||||
 @discussion On devices that do not support concurrent command encoders, this call is equivalent to computeCommandEncoder
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 - (nullable id<MTLComputeCommandEncoder>)computeCommandEncoderWithDispatchType:(MTLDispatchType) dispatchType API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method encodeWaitForEvent:value:
 | 
			
		||||
 @abstract Encodes a command that pauses execution of this command buffer until the specified event reaches a given value.
 | 
			
		||||
 @discussion This method may only be called if there is no current command encoder on the receiver.
 | 
			
		||||
*/
 | 
			
		||||
- (void)encodeWaitForEvent:(id <MTLEvent>)event value:(uint64_t)value API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method encodeSignalEvent:value:
 | 
			
		||||
 @abstract Encodes a command that signals an event with a given value.
 | 
			
		||||
 @discussion This method may only be called if there is no current command encoder on the receiver.
 | 
			
		||||
 */
 | 
			
		||||
- (void)encodeSignalEvent:(id <MTLEvent>)event value:(uint64_t)value API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method parallelRenderCommandEncoderWithDescriptor:
 | 
			
		||||
 @abstract returns a parallel render pass encoder to encode into this command buffer.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLParallelRenderCommandEncoder>)parallelRenderCommandEncoderWithDescriptor:(MTLRenderPassDescriptor *)renderPassDescriptor;
 | 
			
		||||
 | 
			
		||||
- (nullable id<MTLResourceStateCommandEncoder>) resourceStateCommandEncoder API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
- (nullable id<MTLResourceStateCommandEncoder>) resourceStateCommandEncoderWithDescriptor:(MTLResourceStatePassDescriptor *) resourceStatePassDescriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
- (nullable id <MTLAccelerationStructureCommandEncoder>)accelerationStructureCommandEncoder API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method pushDebugGroup:
 | 
			
		||||
 @abstract Push a new named string onto a stack of string labels.
 | 
			
		||||
 */
 | 
			
		||||
- (void)pushDebugGroup:(NSString *)string API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method popDebugGroup
 | 
			
		||||
 @abstract Pop the latest named string off of the stack.
 | 
			
		||||
 */
 | 
			
		||||
- (void)popDebugGroup API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,80 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Describes how a resource will be used by a shader through an argument buffer
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLResourceUsage)
 | 
			
		||||
{
 | 
			
		||||
	MTLResourceUsageRead   = 1 << 0,
 | 
			
		||||
	MTLResourceUsageWrite  = 1 << 1,
 | 
			
		||||
	MTLResourceUsageSample = 1 << 2
 | 
			
		||||
} API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief Describes the types of resources that the a barrier operates on
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLBarrierScope)
 | 
			
		||||
{
 | 
			
		||||
    MTLBarrierScopeBuffers = 1 << 0,
 | 
			
		||||
    MTLBarrierScopeTextures = 1 << 1,
 | 
			
		||||
    MTLBarrierScopeRenderTargets API_AVAILABLE(macos(10.14), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 1 << 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLCommandEncoder
 | 
			
		||||
 @abstract MTLCommandEncoder is the common interface for objects that write commands into MTLCommandBuffers.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLCommandEncoder <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method endEncoding
 | 
			
		||||
 @abstract Declare that all command generation from this encoder is complete, and detach from the MTLCommandBuffer.
 | 
			
		||||
 */
 | 
			
		||||
- (void)endEncoding;
 | 
			
		||||
 | 
			
		||||
/* Debug Support */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method insertDebugSignpost:
 | 
			
		||||
 @abstract Inserts a debug string into the command buffer.  This does not change any API behavior, but can be useful when debugging.
 | 
			
		||||
 */
 | 
			
		||||
- (void)insertDebugSignpost:(NSString *)string;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method pushDebugGroup:
 | 
			
		||||
 @abstract Push a new named string onto a stack of string labels.
 | 
			
		||||
 */
 | 
			
		||||
- (void)pushDebugGroup:(NSString *)string;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method popDebugGroup
 | 
			
		||||
 @abstract Pop the latest named string off of the stack.
 | 
			
		||||
*/
 | 
			
		||||
- (void)popDebugGroup;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,58 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLCommandQueue.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/Metal.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLCommandBuffer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLCommandQueue
 | 
			
		||||
 @brief A serial queue of command buffers to be executed by the device.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLCommandQueue <NSObject>
 | 
			
		||||
 | 
			
		||||
/*! @brief A string to help identify this object */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*! @brief The device this queue will submit to */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*! 
 | 
			
		||||
 @method commandBuffer
 | 
			
		||||
 @abstract Returns a new autoreleased command buffer used to encode work into this queue that 
 | 
			
		||||
 maintains strong references to resources used within the command buffer.
 | 
			
		||||
*/
 | 
			
		||||
- (nullable id <MTLCommandBuffer>)commandBuffer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method commandBufferWithDescriptor
 | 
			
		||||
 @param descriptor The requested properties of the command buffer.
 | 
			
		||||
 @abstract Returns a new autoreleased command buffer used to encode work into this queue.
 | 
			
		||||
*/
 | 
			
		||||
- (nullable id <MTLCommandBuffer>)commandBufferWithDescriptor:(MTLCommandBufferDescriptor*)descriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method commandBufferWithUnretainedReferences
 | 
			
		||||
 @abstract Returns a new autoreleased command buffer used to encode work into this queue that 
 | 
			
		||||
 does not maintain strong references to resources used within the command buffer.
 | 
			
		||||
*/
 | 
			
		||||
- (nullable id <MTLCommandBuffer>)commandBufferWithUnretainedReferences;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method insertDebugCaptureBoundary
 | 
			
		||||
 @abstract Inform Xcode about when debug capture should start and stop.
 | 
			
		||||
 */
 | 
			
		||||
- (void)insertDebugCaptureBoundary API_DEPRECATED("Use MTLCaptureScope instead", macos(10.11, 10.13), ios(8.0, 11.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,304 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLComputeCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLTexture.h>
 | 
			
		||||
#import <Metal/MTLCommandBuffer.h>
 | 
			
		||||
#import <Metal/MTLComputePass.h>
 | 
			
		||||
#import <Metal/MTLFence.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLFunction;
 | 
			
		||||
@protocol MTLBuffer;
 | 
			
		||||
@protocol MTLSamplerState;
 | 
			
		||||
@protocol MTLTexture;
 | 
			
		||||
@protocol MTLComputePipelineState;
 | 
			
		||||
@protocol MTLResource;
 | 
			
		||||
@protocol MTLVisibleFunctionTable;
 | 
			
		||||
@protocol MTLAccelerationStructure;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint32_t threadgroupsPerGrid[3];
 | 
			
		||||
} MTLDispatchThreadgroupsIndirectArguments;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	uint32_t  stageInOrigin[3];
 | 
			
		||||
	uint32_t  stageInSize[3];
 | 
			
		||||
} MTLStageInRegionIndirectArguments API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLComputeCommandEncoder
 | 
			
		||||
 @abstract A command encoder that writes data parallel compute commands.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLComputeCommandEncoder <MTLCommandEncoder>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property dispatchType
 | 
			
		||||
 @abstract The dispatch type of the compute command encoder.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLDispatchType dispatchType API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setComputePipelineState:
 | 
			
		||||
 @abstract Set the compute pipeline state that will be used.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setComputePipelineState:(id <MTLComputePipelineState>)state;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setBytes:length:atIndex:
 | 
			
		||||
 @brief Set the data (by copy) for a given buffer binding point.  This will remove any existing MTLBuffer from the binding point.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBytes:(const void *)bytes length:(NSUInteger)length atIndex:(NSUInteger)index API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setBuffer:offset:atIndex:
 | 
			
		||||
 @brief Set a global buffer for all compute kernels at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setBufferOffset:atIndex:
 | 
			
		||||
 @brief Set the offset within the current global buffer for all compute kernels at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBufferOffset:(NSUInteger)offset atIndex:(NSUInteger)index API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setBuffers:offsets:withRange:
 | 
			
		||||
 @brief Set an array of global buffers for all compute kernels with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBuffers:(const id <MTLBuffer> __nullable [__nonnull])buffers offsets:(const NSUInteger [__nonnull])offsets withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setVisibleFunctionTable:atBufferIndex:
 | 
			
		||||
 * @brief Set a visible function table at the given buffer index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVisibleFunctionTable:(nullable id <MTLVisibleFunctionTable>)visibleFunctionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setVisibleFunctionTables:withBufferRange:
 | 
			
		||||
 * @brief Set visible function tables at the given buffer index range
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVisibleFunctionTables:(const id <MTLVisibleFunctionTable> __nullable [__nonnull])visibleFunctionTables withBufferRange:(NSRange)range API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setIntersectionFunctionTable:atBufferIndex:
 | 
			
		||||
 * @brief Set a visible function table at the given buffer index
 | 
			
		||||
 */
 | 
			
		||||
- (void)setIntersectionFunctionTable:(nullable id <MTLIntersectionFunctionTable>)intersectionFunctionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method setIntersectionFunctionTables:withBufferRange:
 | 
			
		||||
 * @brief Set visible function tables at the given buffer index range
 | 
			
		||||
 */
 | 
			
		||||
- (void)setIntersectionFunctionTables:(const id <MTLIntersectionFunctionTable> __nullable [__nonnull])intersectionFunctionTables withBufferRange:(NSRange)range API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setAccelerationStructure:atBufferIndex:
 | 
			
		||||
 @brief Set a global raytracing acceleration structure for all compute kernels at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setAccelerationStructure:(nullable id <MTLAccelerationStructure>)accelerationStructure atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTexture:atIndex:
 | 
			
		||||
 @brief Set a global texture for all compute kernels at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTexture:(nullable id <MTLTexture>)texture atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTextures:withRange:
 | 
			
		||||
 @brief Set an array of global textures for all compute kernels with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTextures:(const id <MTLTexture> __nullable [__nonnull])textures withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setSamplerState:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all compute kernels at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplerState:(nullable id <MTLSamplerState>)sampler atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setSamplers:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all compute kernels with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setSamplerState:lodMinClamp:lodMaxClamp:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all compute kernels at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplerState:(nullable id <MTLSamplerState>)sampler lodMinClamp:(float)lodMinClamp lodMaxClamp:(float)lodMaxClamp atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setSamplers:lodMinClamps:lodMaxClamps:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all compute kernels with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers lodMinClamps:(const float [__nonnull])lodMinClamps lodMaxClamps:(const float [__nonnull])lodMaxClamps withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setThreadgroupMemoryLength:atIndex:
 | 
			
		||||
 @brief Set the threadgroup memory byte length at the binding point specified by the index. This applies to all compute kernels.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setThreadgroupMemoryLength:(NSUInteger)length atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setImageblockWidth:height:
 | 
			
		||||
 @brief Set imageblock sizes.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setImageblockWidth:(NSUInteger)width height:(NSUInteger)height API_AVAILABLE(ios(11.0), macos(11.0), macCatalyst(14.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 @method setStageInRegion:region:
 | 
			
		||||
 @brief Set the region of the stage_in attributes to apply the compute kernel.
 | 
			
		||||
*/
 | 
			
		||||
- (void)setStageInRegion:(MTLRegion)region API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 @method setStageInRegionWithIndirectBuffer:indirectBufferOffset:
 | 
			
		||||
 @abstract sets the stage in region indirectly for the following indirect dispatch calls.
 | 
			
		||||
 @param indirectBuffer A buffer object that the device will read the stageIn region arguments from, see MTLStageInRegionIndirectArguments.
 | 
			
		||||
 @param indirectBufferOffset Byte offset within indirectBuffer to read arguments from. indirectBufferOffset must be a multiple of 4.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setStageInRegionWithIndirectBuffer:(id <MTLBuffer>)indirectBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 @method dispatchThreadgroups:threadsPerThreadgroup:
 | 
			
		||||
 @abstract Enqueue a compute function dispatch as a multiple of the threadgroup size.
 | 
			
		||||
 */
 | 
			
		||||
- (void)dispatchThreadgroups:(MTLSize)threadgroupsPerGrid threadsPerThreadgroup:(MTLSize)threadsPerThreadgroup;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 @method dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:
 | 
			
		||||
 @abstract Enqueue a compute function dispatch using an indirect buffer for threadgroupsPerGrid see MTLDispatchThreadgroupsIndirectArguments.
 | 
			
		||||
 @param indirectBuffer A buffer object that the device will read dispatchThreadgroups arguments from, see MTLDispatchThreadgroupsIndirectArguments.
 | 
			
		||||
 @param indirectBufferOffset Byte offset within @a indirectBuffer to read arguments from.  @a indirectBufferOffset must be a multiple of 4.
 | 
			
		||||
 */
 | 
			
		||||
- (void)dispatchThreadgroupsWithIndirectBuffer:(id <MTLBuffer>)indirectBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset threadsPerThreadgroup:(MTLSize)threadsPerThreadgroup API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 @method dispatchThreads:threadsPerThreadgroup:
 | 
			
		||||
 @abstract Enqueue a compute function dispatch using an arbitrarily-sized grid.
 | 
			
		||||
 @discussion threadsPerGrid does not have to be a multiple of the  threadGroup size
 | 
			
		||||
 */
 | 
			
		||||
- (void)dispatchThreads:(MTLSize)threadsPerGrid threadsPerThreadgroup:(MTLSize)threadsPerThreadgroup API_AVAILABLE(macos(10.13), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateFence:
 | 
			
		||||
 @abstract Update the fence to capture all GPU work so far enqueued by this encoder.
 | 
			
		||||
 @discussion The fence is updated at kernel submission to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)updateFence:(id <MTLFence>)fence API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitForFence:
 | 
			
		||||
 @abstract Prevent further GPU work until the fence is reached.
 | 
			
		||||
 @discussion The fence is evaluated at kernel submision to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitForFence:(id <MTLFence>)fence API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResource:usage:
 | 
			
		||||
 * @abstract Declare that a resource may be accessed by the command encoder through an argument buffer
 | 
			
		||||
 * 
 | 
			
		||||
 * @discussion For tracked MTLResources, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resource through an argument buffer.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useResource:(id <MTLResource>)resource usage:(MTLResourceUsage)usage API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResources:count:usage:
 | 
			
		||||
 * @abstract Declare that an array of resources may be accessed through an argument buffer by the command encoder
 | 
			
		||||
 * @discussion For tracked MTL Resources, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources through an argument buffer.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useResources:(const id <MTLResource> __nonnull[__nonnull])resources count:(NSUInteger)count usage:(MTLResourceUsage)usage API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeap:
 | 
			
		||||
 * @abstract Declare that the resources allocated from a heap may be accessed as readonly by the render pass through an argument buffer
 | 
			
		||||
 * @discussion For tracked MTLHeaps, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeap:(id <MTLHeap>)heap API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeaps:count:
 | 
			
		||||
 * @abstract Declare that the resources allocated from an array of heaps may be accessed as readonly by the render pass through an argument buffer
 | 
			
		||||
 * @discussion For tracked MTLHeaps, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 * @warning Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeaps:(const id <MTLHeap> __nonnull[__nonnull])heaps count:(NSUInteger)count API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method executeCommandsInBuffer:withRange:
 | 
			
		||||
 * @abstract Execute commands in the buffer within the range specified.
 | 
			
		||||
 * @discussion The same indirect command buffer may be executed any number of times within the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)executeCommandsInBuffer:(id<MTLIndirectCommandBuffer>)indirectCommandBuffer withRange:(NSRange)executionRange API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:
 | 
			
		||||
 * @abstract Execute commands in the buffer within the range specified by the indirect range buffer.
 | 
			
		||||
 * @param indirectRangeBuffer An indirect buffer from which the device reads the execution range parameter, as laid out in the MTLIndirectCommandBufferExecutionRange structure.
 | 
			
		||||
 * @param indirectBufferOffset The byte offset within indirectBuffer where the execution range parameter is located. Must be a multiple of 4 bytes.
 | 
			
		||||
 * @discussion The same indirect command buffer may be executed any number of times within the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)executeCommandsInBuffer:(id<MTLIndirectCommandBuffer>)indirectCommandbuffer indirectBuffer:(id<MTLBuffer>)indirectRangeBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 *@method memoryBarrierWithScope
 | 
			
		||||
 *@abstract Encodes a barrier between currently dispatched kernels in a concurrent compute command encoder and any subsequent ones on a specified resource group
 | 
			
		||||
 *@discussion  This API ensures that all dispatches in the encoder have completed execution and their side effects are visible to subsequent dispatches in that encoder. Calling barrier on a serial encoder is allowed, but ignored.
 | 
			
		||||
 */
 | 
			
		||||
-(void)memoryBarrierWithScope:(MTLBarrierScope)scope API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 *@method memoryBarrierWithResources
 | 
			
		||||
 *@abstract Encodes a barrier between currently dispatched kernels in a concurrent compute command encoder and any subsequent ones on an array of resources.
 | 
			
		||||
 *@discussion  This API ensures that all dispatches in the encoder have completed execution and side effects on the specified resources are visible to subsequent dispatches in that encoder. Calling barrier on a serial encoder is allowed, but ignored.
 | 
			
		||||
 */
 | 
			
		||||
- (void)memoryBarrierWithResources:(const id<MTLResource> __nonnull [__nonnull])resources count:(NSUInteger)count API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method sampleCountersInBuffer:atSampleIndex:withBarrier:
 | 
			
		||||
 @abstract Sample hardware counters at this point in the compute encoder and
 | 
			
		||||
 store the counter sample into the sample buffer at the specified index.
 | 
			
		||||
 @param sampleBuffer The sample buffer to sample into
 | 
			
		||||
 @param sampleIndex The index into the counter buffer to write the sample
 | 
			
		||||
 @param barrier Insert a barrier before taking the sample.  Passing
 | 
			
		||||
 YES will ensure that all work encoded before this operation in the encoder is
 | 
			
		||||
 complete but does not isolate the work with respect to other encoders.  Passing
 | 
			
		||||
 NO will allow the sample to be taken concurrently with other operations in this
 | 
			
		||||
 encoder.
 | 
			
		||||
 In general, passing YES will lead to more repeatable counter results but
 | 
			
		||||
 may negatively impact performance.  Passing NO will generally be higher performance
 | 
			
		||||
 but counter results may not be repeatable.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtDispatchBoundary is unsupported,
 | 
			
		||||
 this method is not available and will generate an error if called.
 | 
			
		||||
 */
 | 
			
		||||
-(void)sampleCountersInBuffer:(id<MTLCounterSampleBuffer>)sampleBuffer
 | 
			
		||||
                atSampleIndex:(NSUInteger)sampleIndex
 | 
			
		||||
                  withBarrier:(BOOL)barrier API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,90 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLComputePass.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLCommandBuffer.h>
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLCounters.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLComputePassSampleBufferAttachmentDescriptor : NSObject<NSCopying>
 | 
			
		||||
/*!
 | 
			
		||||
@property sampleBuffer
 | 
			
		||||
@abstract The sample buffer to store samples for the compute-pass defined samples.
 | 
			
		||||
If sampleBuffer is non-nil, the sample indices will be used to store samples into
 | 
			
		||||
the sample buffer.  If no sample buffer is provided, no samples will be taken.
 | 
			
		||||
If any of the sample indices are specified as MTLCounterDontSample, no sample
 | 
			
		||||
will be taken for that action.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, nonatomic, retain) id<MTLCounterSampleBuffer> sampleBuffer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property startOfEncoderSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the start of
 | 
			
		||||
 command encoder processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a compute pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger startOfEncoderSampleIndex;
 | 
			
		||||
/*!
 | 
			
		||||
 @property endOfEncoderSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the end of
 | 
			
		||||
 command encoder processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a compute pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger endOfEncoderSampleIndex;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLComputePassSampleBufferAttachmentDescriptorArray : NSObject
 | 
			
		||||
/* Individual attachment state access */
 | 
			
		||||
- (MTLComputePassSampleBufferAttachmentDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLComputePassSampleBufferAttachmentDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLComputePassDescriptor
 | 
			
		||||
 @abstract MTLComputePassDescriptor represents a collection of attachments to be used to create a concrete compute command encoder
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLComputePassDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method computePassDescriptor
 | 
			
		||||
 @abstract Create an autoreleased default frame buffer descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLComputePassDescriptor *)computePassDescriptor;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property dispatchType
 | 
			
		||||
 @abstract The dispatch type of the compute command encoder.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLDispatchType dispatchType;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleBufferAttachments
 | 
			
		||||
 @abstract An array of sample buffers and associated sample indices.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLComputePassSampleBufferAttachmentDescriptorArray * sampleBufferAttachments;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,218 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLComputePipeline.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
#import <Metal/MTLStageInputOutputDescriptor.h>
 | 
			
		||||
#import <Metal/MTLPipeline.h>
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLLinkedFunctions.h>
 | 
			
		||||
@protocol MTLFunctionHandle;
 | 
			
		||||
 | 
			
		||||
@protocol MTLDynamicLibrary;
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLComputePipelineReflection : NSObject
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSArray <MTLArgument *> *arguments;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(9.0))
 | 
			
		||||
@interface MTLComputePipelineDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property computeFunction
 | 
			
		||||
 @abstract The function to use with the MTLComputePipelineState
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readwrite, nonatomic, strong) id <MTLFunction> computeFunction;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property threadGroupSizeIsMultipleOfThreadExecutionWidth
 | 
			
		||||
 @abstract An optimization flag, set if the thread group size will always be a multiple of thread execution width
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL threadGroupSizeIsMultipleOfThreadExecutionWidth;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxTotalThreadsPerThreadgroup
 | 
			
		||||
 @abstract Optional property. Set the maxTotalThreadsPerThreadgroup. If it is not set, returns zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxTotalThreadsPerThreadgroup API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property computeDataDescriptor
 | 
			
		||||
 @abstract An MTLStageInputOutputDescriptor to fetch data from buffers
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, nonatomic) MTLStageInputOutputDescriptor *stageInputDescriptor API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property buffers
 | 
			
		||||
 @abstract Optional properties for each buffer binding used by the compute function.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLPipelineBufferDescriptorArray *buffers API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportIndirectCommandBuffers
 | 
			
		||||
 @abstract This flag makes this pipeline usable with indirect command buffers.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL supportIndirectCommandBuffers API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property insertLibraries
 | 
			
		||||
 @abstract The set of MTLDynamicLibrary to use to resolve external symbols before considering symbols from dependent MTLDynamicLibrary.
 | 
			
		||||
 @discussion Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use insertLibraries.
 | 
			
		||||
 This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
 | 
			
		||||
 It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
 | 
			
		||||
 @see MTLDynamicLibrary
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nullable, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* insertLibraries API_DEPRECATED_WITH_REPLACEMENT("Use preloadedLibraries instead.", macos(11.0, 12.0), ios(14.0, 15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property preloadedLibraries
 | 
			
		||||
 @abstract The set of MTLDynamicLibrary to use to resolve external symbols before considering symbols from dependent MTLDynamicLibrary.
 | 
			
		||||
 @discussion Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use preloadedLibraries.
 | 
			
		||||
 This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
 | 
			
		||||
 It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
 | 
			
		||||
 @see MTLDynamicLibrary
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonnull, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* preloadedLibraries API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property binaryArchives
 | 
			
		||||
 @abstract The set of MTLBinaryArchive to search for compiled code when creating the pipeline state.
 | 
			
		||||
 @discussion Accelerate pipeline state creation by providing archives of compiled code such that no compilation needs to happen on the fast path.
 | 
			
		||||
 @see MTLBinaryArchive
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nullable, nonatomic, copy) NSArray<id<MTLBinaryArchive>> *binaryArchives API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method reset
 | 
			
		||||
 @abstract Restore all compute pipeline descriptor properties to their default values.
 | 
			
		||||
 */
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property linkedFunctions
 | 
			
		||||
 @abstract The set of functions to be linked with the pipeline state and accessed from the compute function. 
 | 
			
		||||
 @see MTLLinkedFunctions
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, nonatomic) MTLLinkedFunctions *linkedFunctions
 | 
			
		||||
    API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportAddingBinaryFunctions
 | 
			
		||||
 @abstract This flag makes this pipeline support creating a new pipeline by adding binary functions.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL supportAddingBinaryFunctions
 | 
			
		||||
    API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxCallStackDepth
 | 
			
		||||
 @abstract The maximum depth of the call stack in stack frames from the kernel. Defaults to 1 additional stack frame.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxCallStackDepth
 | 
			
		||||
    API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLComputePipelineState
 | 
			
		||||
 @abstract A handle to compiled code for a compute function.
 | 
			
		||||
 @discussion MTLComputePipelineState is a single compute function.  It can only be used with the device that it was created against.
 | 
			
		||||
*/
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLComputePipelineState <NSObject>
 | 
			
		||||
 | 
			
		||||
@property (nullable, readonly) NSString *label API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxTotalThreadsPerThreadgroup
 | 
			
		||||
 @abstract The maximum total number of threads that can be in a single compute threadgroup.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger maxTotalThreadsPerThreadgroup;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property threadExecutionWidth
 | 
			
		||||
 @abstract For most efficient execution, the threadgroup size should be a multiple of this when executing the kernel.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger threadExecutionWidth;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property staticThreadgroupMemoryLength
 | 
			
		||||
 @abstract The length in bytes of threadgroup memory that is statically allocated.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger staticThreadgroupMemoryLength API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method imageblockMemoryLengthForDimensions:
 | 
			
		||||
 @brief Returns imageblock memory length for given image block dimensions.
 | 
			
		||||
 */
 | 
			
		||||
- (NSUInteger)imageblockMemoryLengthForDimensions:(MTLSize)imageblockDimensions API_AVAILABLE(ios(11.0), macos(11.0), macCatalyst(14.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportIndirectCommandBuffers
 | 
			
		||||
 @abstract Tells whether this pipeline state is usable through an Indirect Command Buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) BOOL supportIndirectCommandBuffers API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method functionHandleWithFunction:
 | 
			
		||||
 @brief Get the function handle for the specified function from the pipeline state.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLFunctionHandle>)functionHandleWithFunction:(id<MTLFunction>)function API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newRenderPipelineStateWithAdditionalBinaryFunctions:stage:
 | 
			
		||||
 @brief Allocate a new compute pipeline state by adding binary functions to this pipeline state.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLComputePipelineState>)newComputePipelineStateWithAdditionalBinaryFunctions:(nonnull NSArray<id<MTLFunction>> *)functions error:(__autoreleasing NSError **)error API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newVisibleFunctionTableWithDescriptor:
 | 
			
		||||
 @brief Allocate a visible function table for the pipeline with the provided descriptor.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLVisibleFunctionTable>)newVisibleFunctionTableWithDescriptor:(MTLVisibleFunctionTableDescriptor * __nonnull)descriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newIntersectionFunctionTableWithDescriptor:
 | 
			
		||||
 @brief Allocate an intersection function table for the pipeline with the provided descriptor.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLIntersectionFunctionTable>)newIntersectionFunctionTableWithDescriptor:(MTLIntersectionFunctionTableDescriptor * _Nonnull)descriptor API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,225 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLCounters.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2019 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#ifndef MTLCounters_h
 | 
			
		||||
#define MTLCounters_h
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
#define MTLCounterErrorValue ((uint64_t)-1)
 | 
			
		||||
#define MTLCounterDontSample ((NSUInteger)-1)
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLCommonCounter
 | 
			
		||||
 @abstract Common counters that, when present, are expected to have similar meanings across
 | 
			
		||||
 different implementations.
 | 
			
		||||
 @constant MTLCommonCounterTimestamp The GPU time when the sample is taken.
 | 
			
		||||
 @constant MTLCommonCounterTessellationInputPatches The number of patches input to the tessellator.
 | 
			
		||||
 @constant MTLCommonCounterVertexInvocations The number of times the vertex shader was invoked.
 | 
			
		||||
 @constant MTLCommonCounterPostTessellationVertexInvocations The number of times the post tessellation vertex shader was invoked.
 | 
			
		||||
 @constant MTLCommonCounterClipperInvocations The number of primitives passed to the clipper.
 | 
			
		||||
 @constant MTLCommonCounterClipperPrimitivesOut The number of primitives output from the clipper.
 | 
			
		||||
 @constant MTLCommonCounterFragmentInvocations The number of times the fragment shader was invoked.
 | 
			
		||||
 @constant MTLCommonCounterFragmentsPassed The number of fragments that passed Depth, Stencil, and Scissor tests.
 | 
			
		||||
 @constant MTLCommonCounterComputeKernelInvocations The number of times the computer kernel was invoked.
 | 
			
		||||
 @constant MTLCommonCounterTotalCycles The total number of cycles.
 | 
			
		||||
 @constant MTLCommonCounterVertexCycles The amount of cycles the vertex shader was running.
 | 
			
		||||
 @constant MTLCommonCounterTessellationCycles The amount of cycles spent in the tessellator.
 | 
			
		||||
 @constant MTLCommonCounterPostTessellationVertexCycles The amount of cycles the post tessellation vertex shader was running.
 | 
			
		||||
 @constant MTLCommonCounterFragmentCycles The amount of cycles the fragment shader was running.
 | 
			
		||||
 @constant MTLCommonCounterRenderTargetWriteCycles The amount of cycles spent writing to the render targets.
 | 
			
		||||
 */
 | 
			
		||||
typedef NSString * const MTLCommonCounter NS_TYPED_ENUM API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterTimestamp API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterTessellationInputPatches API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterVertexInvocations API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterPostTessellationVertexInvocations API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterClipperInvocations API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterClipperPrimitivesOut API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterFragmentInvocations API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterFragmentsPassed API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterComputeKernelInvocations API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterTotalCycles API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterVertexCycles API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterTessellationCycles API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterPostTessellationVertexCycles API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterFragmentCycles API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounter MTLCommonCounterRenderTargetWriteCycles API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLCommonCounterSet
 | 
			
		||||
 @abstract Common counter set names.
 | 
			
		||||
 @discussion Each of these common counter sets has a defined structure type.  Implementations
 | 
			
		||||
 may omit some of the counters from these sets.
 | 
			
		||||
 @constant MTLCommonCounterSetTimestamp A counter set containing only the timestamp.
 | 
			
		||||
 @constant MTLCommonCounterSetStageUtilization A counter set containing utilization per stage.
 | 
			
		||||
 @constant MTLCommonCounterSetStatistic A counter set containing various statistics.
 | 
			
		||||
 */
 | 
			
		||||
typedef NSString * const MTLCommonCounterSet NS_TYPED_ENUM API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounterSet MTLCommonCounterSetTimestamp API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounterSet MTLCommonCounterSetStageUtilization API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
MTL_EXTERN MTLCommonCounterSet MTLCommonCounterSetStatistic API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    uint64_t timestamp;
 | 
			
		||||
} MTLCounterResultTimestamp API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    uint64_t totalCycles;
 | 
			
		||||
    uint64_t vertexCycles;
 | 
			
		||||
    uint64_t tessellationCycles;
 | 
			
		||||
    uint64_t postTessellationVertexCycles;
 | 
			
		||||
    uint64_t fragmentCycles;
 | 
			
		||||
    uint64_t renderTargetCycles;
 | 
			
		||||
} MTLCounterResultStageUtilization API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    uint64_t tessellationInputPatches;
 | 
			
		||||
    uint64_t vertexInvocations;
 | 
			
		||||
    uint64_t postTessellationVertexInvocations;
 | 
			
		||||
    uint64_t clipperInvocations;
 | 
			
		||||
    uint64_t clipperPrimitivesOut;
 | 
			
		||||
    uint64_t fragmentInvocations;
 | 
			
		||||
    uint64_t fragmentsPassed;
 | 
			
		||||
    uint64_t computeKernelInvocations;
 | 
			
		||||
} MTLCounterResultStatistic API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLCounter
 | 
			
		||||
 @abstract A descriptor for a single counter.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15), ios(14.0))
 | 
			
		||||
@protocol MTLCounter <NSObject>
 | 
			
		||||
@property (readonly, copy) NSString *name API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLCounterSet
 | 
			
		||||
 @abstract A collection of MTLCounters that the device can capture in
 | 
			
		||||
 a single pass.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15), ios(14.0))
 | 
			
		||||
@protocol MTLCounterSet <NSObject>
 | 
			
		||||
/*!
 | 
			
		||||
 @property name The name of the counter set.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, copy) NSString *name API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property counters The set of counters captured by the counter set.
 | 
			
		||||
 @discussion The counters array contains all the counters that will be written
 | 
			
		||||
 when a counter sample is collected.  Counters that do not appear in this array
 | 
			
		||||
 will not be written to the resolved buffer when the samples are resolved, even if
 | 
			
		||||
 they appear in the corresponding resolved counter structure.  Instead
 | 
			
		||||
 MTLCounterErrorValue will be written in the resolved buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, copy) NSArray<id<MTLCounter>>* counters API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLCounterSampleBufferDescriptor
 | 
			
		||||
 @abstract Object to represent the counter state.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15), ios(14.0))
 | 
			
		||||
@interface MTLCounterSampleBufferDescriptor : NSObject <NSCopying>
 | 
			
		||||
/*!
 | 
			
		||||
 @property counterSet The counterset to be sampled for this counter sample buffer
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readwrite, retain) id<MTLCounterSet> counterSet API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @property label A label to identify the sample buffer in debugging tools.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, copy) NSString *label API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @property storageMode The storage mode for the sample buffer.  Only
 | 
			
		||||
 MTLStorageModeShared and MTLStorageModePrivate may be used.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite) MTLStorageMode storageMode API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleCount The number of samples that may be stored in the
 | 
			
		||||
 counter sample buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite) NSUInteger sampleCount API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLCounterSampleBuffer
 | 
			
		||||
 @abstract The Counter Sample Buffer contains opaque counter samples as well
 | 
			
		||||
 as state needed to request a sample from the API.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.15), ios(14.0))
 | 
			
		||||
@protocol MTLCounterSampleBuffer <NSObject>
 | 
			
		||||
/*!
 | 
			
		||||
 @property device The device that created the sample buffer.  It is only valid
 | 
			
		||||
 to use the sample buffer with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id<MTLDevice> device API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label The label for the sample buffer.  This is set by the label
 | 
			
		||||
 property of the descriptor that is used to create the sample buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSString *label API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleCount The number of samples that may be stored in this sample buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger sampleCount API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method resolveCounterRange:
 | 
			
		||||
 @abstract Resolve the counters from the sample buffer to an NSData containing
 | 
			
		||||
 the counter values.  This may only be used with sample buffers that have
 | 
			
		||||
 MTLStorageModeShared.
 | 
			
		||||
 @param range The range of indices in the sample buffer to resolve.
 | 
			
		||||
 @return The resolved samples.
 | 
			
		||||
 @discussion Samples that encountered an error during resolve will be set to
 | 
			
		||||
 MTLCounterErrorValue.
 | 
			
		||||
 */
 | 
			
		||||
-(nullable NSData *)resolveCounterRange:(NSRange)range
 | 
			
		||||
    API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @constant MTLCounterErrorDomain
 | 
			
		||||
 @abstract NSErrors raised when creating a counter sample buffer.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.15), ios(14.0))
 | 
			
		||||
MTL_EXTERN NSErrorDomain const MTLCounterErrorDomain;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLCounterSampleBufferError
 | 
			
		||||
 @constant MTLCounterSampleBufferErrorOutOfMemory
 | 
			
		||||
 There wasn't enough memory available to allocate the counter sample buffer.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCounterSampleBufferErrorInvalid
 | 
			
		||||
 Invalid parameter passed while creating counter sample buffer.
 | 
			
		||||
 | 
			
		||||
 @constant MTLCounterSampleBufferErrorInternal
 | 
			
		||||
 There was some other error in allocating the counter sample buffer.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSInteger, MTLCounterSampleBufferError)
 | 
			
		||||
{
 | 
			
		||||
    MTLCounterSampleBufferErrorOutOfMemory,
 | 
			
		||||
    MTLCounterSampleBufferErrorInvalid,
 | 
			
		||||
    MTLCounterSampleBufferErrorInternal,
 | 
			
		||||
} API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
#endif /* MTLCounters_h */
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLDefines.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <os/availability.h>
 | 
			
		||||
#import <TargetConditionals.h>
 | 
			
		||||
 | 
			
		||||
#define MTL_EXPORT __attribute__((visibility ("default")))
 | 
			
		||||
#define MTL_INTERN __attribute__((visibility ("hidden")))
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
#define MTL_EXTERN extern "C" MTL_EXPORT
 | 
			
		||||
#else
 | 
			
		||||
#define MTL_EXTERN extern MTL_EXPORT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
#define MTL_EXTERN_NO_EXPORT extern "C" MTL_INTERN
 | 
			
		||||
#else
 | 
			
		||||
#define MTL_EXTERN_NO_EXPORT extern MTL_INTERN
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Definition of 'MTL_INLINE'. */
 | 
			
		||||
 | 
			
		||||
#if !defined(MTL_INLINE)
 | 
			
		||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 | 
			
		||||
#  define MTL_INLINE static inline
 | 
			
		||||
# elif defined(__cplusplus)
 | 
			
		||||
#  define MTL_INLINE static inline
 | 
			
		||||
# elif defined(__GNUC__)
 | 
			
		||||
#  define MTL_INLINE static __inline__
 | 
			
		||||
# else
 | 
			
		||||
#  define MTL_INLINE static
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,93 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLDepthStencil.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLCompareFunction) {
 | 
			
		||||
    MTLCompareFunctionNever = 0,
 | 
			
		||||
    MTLCompareFunctionLess = 1,
 | 
			
		||||
    MTLCompareFunctionEqual = 2,
 | 
			
		||||
    MTLCompareFunctionLessEqual = 3,
 | 
			
		||||
    MTLCompareFunctionGreater = 4,
 | 
			
		||||
    MTLCompareFunctionNotEqual = 5,
 | 
			
		||||
    MTLCompareFunctionGreaterEqual = 6,
 | 
			
		||||
    MTLCompareFunctionAlways = 7,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLStencilOperation) {
 | 
			
		||||
    MTLStencilOperationKeep = 0,
 | 
			
		||||
    MTLStencilOperationZero = 1,
 | 
			
		||||
    MTLStencilOperationReplace = 2,
 | 
			
		||||
    MTLStencilOperationIncrementClamp = 3,
 | 
			
		||||
    MTLStencilOperationDecrementClamp = 4,
 | 
			
		||||
    MTLStencilOperationInvert = 5,
 | 
			
		||||
    MTLStencilOperationIncrementWrap = 6,
 | 
			
		||||
    MTLStencilOperationDecrementWrap = 7,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLStencilDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
@property (nonatomic) MTLCompareFunction stencilCompareFunction;
 | 
			
		||||
 | 
			
		||||
/*! Stencil is tested first.  stencilFailureOperation declares how the stencil buffer is updated when the stencil test fails. */
 | 
			
		||||
@property (nonatomic) MTLStencilOperation stencilFailureOperation;
 | 
			
		||||
 | 
			
		||||
/*! If stencil passes, depth is tested next.  Declare what happens when the depth test fails. */
 | 
			
		||||
@property (nonatomic) MTLStencilOperation depthFailureOperation;
 | 
			
		||||
 | 
			
		||||
/*! If both the stencil and depth tests pass, declare how the stencil buffer is updated. */
 | 
			
		||||
@property (nonatomic) MTLStencilOperation depthStencilPassOperation;
 | 
			
		||||
 | 
			
		||||
@property (nonatomic) uint32_t readMask;
 | 
			
		||||
@property (nonatomic) uint32_t writeMask;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLDepthStencilDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/* Defaults to MTLCompareFuncAlways, which effectively skips the depth test */
 | 
			
		||||
@property (nonatomic) MTLCompareFunction depthCompareFunction;
 | 
			
		||||
 | 
			
		||||
/* Defaults to NO, so no depth writes are performed */
 | 
			
		||||
@property (nonatomic, getter=isDepthWriteEnabled) BOOL depthWriteEnabled;
 | 
			
		||||
 | 
			
		||||
/* Separate stencil state for front and back state.  Both front and back can be made to track the same state by assigning the same MTLStencilDescriptor to both. */
 | 
			
		||||
@property (copy, nonatomic, null_resettable) MTLStencilDescriptor *frontFaceStencil;
 | 
			
		||||
@property (copy, nonatomic, null_resettable) MTLStencilDescriptor *backFaceStencil;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify the created object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Device-specific compiled depth/stencil state object */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLDepthStencilState <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLDrawable.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDrawable;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @typedef MTLDrawablePresentedHandler
 | 
			
		||||
 @abstract The presented callback function protocol
 | 
			
		||||
 @disucssion Be careful when you use delta between this presentedTime and previous frame's presentedTime to animate next frame. If the frame was presented using presentAfterMinimumDuration or presentAtTime, the presentedTime might includes delays to meet your specified present time. If you want to measure how much frame you can achieve, use GPUStartTime in the first command buffer of your frame rendering and GPUEndTime of your last frame rendering to calculate the frame interval.
 | 
			
		||||
*/
 | 
			
		||||
typedef void (^MTLDrawablePresentedHandler)(id<MTLDrawable>);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLDrawable
 | 
			
		||||
 @abstract All "drawable" objects (such as those coming from CAMetalLayer) are expected to conform to this protocol
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLDrawable <NSObject>
 | 
			
		||||
 | 
			
		||||
/* Present this drawable as soon as possible */
 | 
			
		||||
- (void)present;
 | 
			
		||||
 | 
			
		||||
/* Present this drawable at the given host time */
 | 
			
		||||
- (void)presentAtTime:(CFTimeInterval)presentationTime;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method presentAfterMinimumDuration
 | 
			
		||||
 @abstract Present this drawable while setting a minimum duration in seconds before allowing this drawable to appear on the display.
 | 
			
		||||
 @param duration Duration in seconds before this drawable is allowed to appear on the display
 | 
			
		||||
 */
 | 
			
		||||
- (void)presentAfterMinimumDuration:(CFTimeInterval)duration API_AVAILABLE(macos(10.15.4), ios(10.3), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method addPresentedHandler
 | 
			
		||||
 @abstract Add a block to be called when this drawable is presented on screen.
 | 
			
		||||
 */
 | 
			
		||||
- (void)addPresentedHandler:(MTLDrawablePresentedHandler)block API_AVAILABLE(macos(10.15.4), ios(10.3), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property presentedTime
 | 
			
		||||
 @abstract The host time that this drawable was presented on screen.
 | 
			
		||||
 @discussion Returns 0 if a frame has not been presented or has been skipped.
 | 
			
		||||
 */
 | 
			
		||||
@property(nonatomic, readonly) CFTimeInterval presentedTime API_AVAILABLE(macos(10.15.4), ios(10.3), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property drawableID
 | 
			
		||||
 @abstract The monotonically incremented ID for all MTLDrawable objects created from the same CAMetalLayer object.
 | 
			
		||||
  @discussion The value starts from 0.
 | 
			
		||||
*/
 | 
			
		||||
@property (nonatomic, readonly) NSUInteger drawableID API_AVAILABLE(macos(10.15.4), ios(10.3), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,81 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLDynamicLibrary_Private.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2020 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
MTL_EXTERN NSErrorDomain const MTLDynamicLibraryDomain API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLDynamicLibraryError)
 | 
			
		||||
{
 | 
			
		||||
    MTLDynamicLibraryErrorNone = 0,
 | 
			
		||||
    MTLDynamicLibraryErrorInvalidFile = 1,
 | 
			
		||||
    MTLDynamicLibraryErrorCompilationFailure = 2,
 | 
			
		||||
    MTLDynamicLibraryErrorUnresolvedInstallName = 3,
 | 
			
		||||
    MTLDynamicLibraryErrorDependencyLoadFailure = 4,
 | 
			
		||||
    MTLDynamicLibraryErrorUnsupported = 5,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLDynamicLibrary
 | 
			
		||||
 @abstract A container for the binary representation of code compiled for a MTLDevice.
 | 
			
		||||
 @discussion MTLDynamicLibrary can be created in two ways:
 | 
			
		||||
 1) MTLDevice newDynamicLibrary:error:
 | 
			
		||||
 This method takes an MTLLibrary (which has .type set to MTLLibraryTypeDynamic) and then compiles the code in the MTLLibrary for the current device.
 | 
			
		||||
 2) MTLDevice newDynamicLibraryWithURL:error
 | 
			
		||||
 This method loads from a file a previously serialized MTLDynamicLibrary. If the dynamic library containg compiled code for the current device, that code is loaded.
 | 
			
		||||
 Otherwise, as a fallback, the MTLLibrary contents used to create the MTLDynamicLibrary are compiled for the current device similar to path #1 above.
 | 
			
		||||
 This path may also be taken if the driver for the current device has been updated or has otherwise become incompatible with the compiled code.
 | 
			
		||||
 Either way, if a MTLDynamicLibrary is successfully created, it contains compiled code for the current device.
 | 
			
		||||
 That code may be used via MTLComputePipelineDescriptor .preloadedLibraries to allow the code to be loaded into a MTLComputePipelineState
 | 
			
		||||
 It may also be used as an argument to MTLCompileOptions .libraries so that another MTLLibrary is linked against the code in this MTLDynamicLibrary.
 | 
			
		||||
 Such library dependencies are encoded into the resulting MTLLibrary by embedding the install name of the MTLDynamicLibrary.
 | 
			
		||||
 When creating a MTLComputePipelineState from a function in that MTLLibrary, the embedded install names are used to load MTLDynamicLibrary instances via path #2 (possibly falling back to #1 as well).
 | 
			
		||||
 If an embedded install name could not be used to load a MTLDynamicLibrary from the path indicated by the install name, the creation of the MTLComputePipelineState fails.
 | 
			
		||||
 The set of both the implictly loaded MTLDynamicLibrary and the MTLDynamicLibrary specified with .preloadedLibraries are used to resolve any unresolved symbols in the source MTLLibrary (or in other MTLDynamicLibrary).
 | 
			
		||||
 If any unresolved symbols remain after searching the set, the creation of the MTLComputePipelineState fails.
 | 
			
		||||
 Otherwise, the MTLComputePipelineState creation succeeds, and the set of MTLDynamicLibraries used are retained by the MTLComputePipelineState.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLDynamicLibrary <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id<MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property installName
 | 
			
		||||
 @abstract The installName of this dynamic library. Can not be nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSString *installName;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method serializeToURL:error:
 | 
			
		||||
 @abstract Writes the contents of the MTLDynamicLibrary to a file.
 | 
			
		||||
 @discussion On success, the file will contain a representation of the MTLLibrary from which the MTLDynamicLibrary was originally created, as well as the compiled code for the current device.
 | 
			
		||||
 Such files may be combined with offline tools to contain the compiled code for multiple devices.
 | 
			
		||||
 If this MTLDynamicLibrary was created from a file that contained compiled code for multiple devices, the compiled code for all other devices is not written (since only compiled code for the current device was loaded).
 | 
			
		||||
 @param url The file URL to which to write the content of the dynamic library. It the URL does not refer to a file, the function fails.
 | 
			
		||||
 @param error If the function fails, this will be set to describe the failure. This can be (but is not required to be) an error from the MTLDynamicLibraryDomain domain. Other possible errors can be file access or I/O related.
 | 
			
		||||
 @return Whether or not the writing the file succeeded.
 | 
			
		||||
 */
 | 
			
		||||
- (BOOL) serializeToURL:(NSURL *)url error:(NSError **)error;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,71 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLEvent.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2018 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@protocol MTLEvent <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this event can be used with. Will be nil when the event is shared across devices (i.e. MTLSharedEvent).
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLSharedEventListener
 | 
			
		||||
 @abstract This class provides a simple interface for handling the dispatching of MTLSharedEvent notifications from Metal.
 | 
			
		||||
*/
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@interface MTLSharedEventListener : NSObject
 | 
			
		||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
 | 
			
		||||
- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue NS_DESIGNATED_INITIALIZER;
 | 
			
		||||
@property (nonnull, readonly) dispatch_queue_t dispatchQueue;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
@class MTLSharedEventHandle;
 | 
			
		||||
@protocol MTLSharedEvent;
 | 
			
		||||
 | 
			
		||||
typedef void (^MTLSharedEventNotificationBlock)(id <MTLSharedEvent>, uint64_t value);
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@protocol MTLSharedEvent <MTLEvent>
 | 
			
		||||
 | 
			
		||||
// When the event's signaled value reaches value or higher, invoke the block on the dispatch queue owned by the listener.
 | 
			
		||||
- (void)notifyListener:(MTLSharedEventListener *)listener atValue:(uint64_t)value block:(MTLSharedEventNotificationBlock)block;
 | 
			
		||||
 | 
			
		||||
// Convenience method for creating a shared event handle that may be passed to other processes via XPC.
 | 
			
		||||
- (MTLSharedEventHandle *)newSharedEventHandle;
 | 
			
		||||
 | 
			
		||||
@property (readwrite) uint64_t signaledValue; // Read or set signaled value
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// MTLSharedEventHandle objects may be passed between processes via XPC connections and then used to recreate
 | 
			
		||||
// a MTLSharedEvent via an existing MTLDevice.
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@interface MTLSharedEventHandle : NSObject <NSSecureCoding>
 | 
			
		||||
{
 | 
			
		||||
    struct MTLSharedEventHandlePrivate *_priv;
 | 
			
		||||
}
 | 
			
		||||
@property (readonly, nullable) NSString *label;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLFence.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2016 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.13), ios(10.0))
 | 
			
		||||
@protocol MTLFence <NSObject>
 | 
			
		||||
@property (nonnull, readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
@@ -0,0 +1,30 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLFunctionConstantValues.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2016 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLFunctionConstantValues : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
// using indices
 | 
			
		||||
- (void)setConstantValue:(const void *)value type:(MTLDataType)type atIndex:(NSUInteger)index;
 | 
			
		||||
- (void)setConstantValues:(const void *)values type:(MTLDataType)type withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
// using names
 | 
			
		||||
- (void)setConstantValue:(const void *)value type:(MTLDataType)type withName:(NSString *)name;
 | 
			
		||||
 | 
			
		||||
// delete all the constants
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,75 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLFunctionDescriptor.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
#import <Metal/MTLFunctionConstantValues.h>
 | 
			
		||||
 | 
			
		||||
@protocol MTLBinaryArchive;
 | 
			
		||||
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLFunctionOptions) {
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Default usage
 | 
			
		||||
     */
 | 
			
		||||
    MTLFunctionOptionNone = 0,
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief Compiles the found function. This enables dynamic linking of this `MTLFunction`.
 | 
			
		||||
     * Only supported for `visible` functions.
 | 
			
		||||
     */
 | 
			
		||||
    MTLFunctionOptionCompileToBinary API_AVAILABLE(macos(11.0), ios(14.0)) = 1 << 0,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLFunctionDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method functionDescriptor
 | 
			
		||||
 @abstract Create an autoreleased function descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (nonnull MTLFunctionDescriptor *)functionDescriptor;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property name
 | 
			
		||||
* @abstract The name of the `visible` function to find.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString *name;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property specializedName
 | 
			
		||||
* @abstract An optional new name for a `visible` function to allow reuse with different specializations.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString *specializedName;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property constantValues
 | 
			
		||||
* @abstract The set of constant values assigned to the function constants. Compilation fails if you do not provide valid constant values for all required function constants.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, nonatomic, copy) MTLFunctionConstantValues *constantValues;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property options
 | 
			
		||||
* @abstract The options to use for this new `MTLFunction`.
 | 
			
		||||
*/
 | 
			
		||||
@property (nonatomic) MTLFunctionOptions options;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
@property binaryArchives
 | 
			
		||||
@abstract The array of archives to be searched.
 | 
			
		||||
@discussion Binary archives to be searched for precompiled functions during the compilation of this function.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nullable, nonatomic, copy) NSArray<id<MTLBinaryArchive>> *binaryArchives API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLIntersectionFunctionDescriptor : MTLFunctionDescriptor <NSCopying>
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLFunctionHandle.h
 | 
			
		||||
//  Framework
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLLibrary.h>
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLFunctionHandle <NSObject>
 | 
			
		||||
@property (readonly) MTLFunctionType functionType;
 | 
			
		||||
@property (readonly, nonnull) NSString* name;
 | 
			
		||||
@property (readonly, nonnull) id<MTLDevice> device;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLVisibleFunctionTable.h>
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLFunctionLog.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
 | 
			
		||||
@protocol MTLFunction;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLFunctionLogType) {
 | 
			
		||||
    MTLFunctionLogTypeValidation   = 0, /// validation
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLLogContainer <NSFastEnumeration>
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLFunctionLogDebugLocation <NSObject>
 | 
			
		||||
@property (readonly, nullable, nonatomic) NSString* functionName;  // faulting function
 | 
			
		||||
@property (readonly, nullable, nonatomic) NSURL* URL;              // source location
 | 
			
		||||
@property (readonly, nonatomic) NSUInteger line;                   // line number
 | 
			
		||||
@property (readonly, nonatomic) NSUInteger column;                 // column in line
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLFunctionLog <NSObject>
 | 
			
		||||
@property (readonly, nonatomic) MTLFunctionLogType type;
 | 
			
		||||
@property (readonly, nullable, nonatomic) NSString* encoderLabel;
 | 
			
		||||
@property (readonly, nullable, nonatomic) id<MTLFunction> function;
 | 
			
		||||
@property (readonly, nullable, nonatomic) id<MTLFunctionLogDebugLocation> debugLocation;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,96 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLFunctionStitching.h
 | 
			
		||||
//  Framework
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2021 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLFunctionDescriptor.h>
 | 
			
		||||
 | 
			
		||||
@protocol MTLFunction;
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLFunctionStitchingAttribute
 | 
			
		||||
 @abstract An attribute to be applied to the produced stitched function.
 | 
			
		||||
*/
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@protocol MTLFunctionStitchingAttribute <NSObject>
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLFunctionStitchingAttributeAlwaysInline
 | 
			
		||||
 @abstract Applies the `__attribute__((always_inline))` attribute to the produced stitched function.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLFunctionStitchingAttributeAlwaysInline : NSObject<MTLFunctionStitchingAttribute>
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLFunctionStitchingNode
 | 
			
		||||
 @abstract A node used in a graph for stitching.
 | 
			
		||||
*/
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@protocol MTLFunctionStitchingNode <NSObject, NSCopying>
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLFunctionStitchingInputNode
 | 
			
		||||
 @abstract An indexed input node of the produced stitched function.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLFunctionStitchingInputNode : NSObject<MTLFunctionStitchingNode>
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger argumentIndex;
 | 
			
		||||
- (instancetype)initWithArgumentIndex:(NSUInteger)argument;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLFunctionStitchingFunctionNode
 | 
			
		||||
 @abstract A function node that calls the specified function with arguments and ordering determined by data and control dependencies.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLFunctionStitchingFunctionNode : NSObject<MTLFunctionStitchingNode>
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSString* name;
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSArray<id<MTLFunctionStitchingNode>>* arguments;
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSArray<MTLFunctionStitchingFunctionNode *>* controlDependencies;
 | 
			
		||||
- (instancetype)initWithName:(nonnull NSString*)name
 | 
			
		||||
                   arguments:(nonnull NSArray<id<MTLFunctionStitchingNode>>*)arguments
 | 
			
		||||
         controlDependencies:(nonnull NSArray<MTLFunctionStitchingFunctionNode *>*)controlDependencies;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLFunctionStitchingGraph
 | 
			
		||||
 @abstract A function graph that describes a directed acyclic graph.
 | 
			
		||||
 @discussion The return value of the output node will be used as the return value for the final stitched graph.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLFunctionStitchingGraph : NSObject<NSCopying>
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSString* functionName;
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSArray<MTLFunctionStitchingFunctionNode *>* nodes;
 | 
			
		||||
@property (readwrite, copy, nullable, nonatomic) MTLFunctionStitchingFunctionNode* outputNode;
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSArray<id<MTLFunctionStitchingAttribute>>* attributes;
 | 
			
		||||
- (instancetype)initWithFunctionName:(nonnull NSString*)functionName
 | 
			
		||||
                               nodes:(nonnull NSArray<MTLFunctionStitchingFunctionNode *>*)nodes
 | 
			
		||||
                          outputNode:(nullable MTLFunctionStitchingFunctionNode*)outputNode
 | 
			
		||||
                          attributes:(nonnull NSArray<id<MTLFunctionStitchingAttribute>>*)attributes;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLStitchedLibraryDescriptor
 | 
			
		||||
 @abstract A container for the graphs and functions needed to create the stitched functions described by the graphs.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLStitchedLibraryDescriptor : NSObject<NSCopying>
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSArray<MTLFunctionStitchingGraph *>* functionGraphs;
 | 
			
		||||
@property (readwrite, copy, nonnull, nonatomic) NSArray<id<MTLFunction>>* functions;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,229 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLHeap.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2016 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
#import <Metal/MTLBuffer.h>
 | 
			
		||||
#import <Metal/MTLTexture.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLHeapType
 | 
			
		||||
 @abstract Describes the mode of operation for an MTLHeap.
 | 
			
		||||
 @constant MTLHeapTypeAutomatic
 | 
			
		||||
 In this mode, resources are placed in the heap automatically.
 | 
			
		||||
 Automatically placed resources have optimal GPU-specific layout, and may perform better than MTLHeapTypePlacement.
 | 
			
		||||
 This heap type is recommended when the heap primarily contains temporary write-often resources.
 | 
			
		||||
 @constant MTLHeapTypePlacement
 | 
			
		||||
 In this mode, the app places resources in the heap.
 | 
			
		||||
 Manually placed resources allow the app to control memory usage and heap fragmentation directly.
 | 
			
		||||
 This heap type is recommended when the heap primarily contains persistent write-rarely resources.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSInteger, MTLHeapType)
 | 
			
		||||
{
 | 
			
		||||
    MTLHeapTypeAutomatic = 0,
 | 
			
		||||
    MTLHeapTypePlacement = 1,
 | 
			
		||||
    MTLHeapTypeSparse API_AVAILABLE(macos(11.0), macCatalyst(14.0)) = 2 ,
 | 
			
		||||
} API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLHeapDescriptor
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.13), ios(10.0))
 | 
			
		||||
@interface MTLHeapDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property size
 | 
			
		||||
 @abstract Requested size of the heap's backing memory.
 | 
			
		||||
 @discussion The size may be rounded up to GPU page granularity.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger size;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property storageMode
 | 
			
		||||
 @abstract Storage mode for the heap. Default is MTLStorageModePrivate.
 | 
			
		||||
 @discussion All resources created from this heap share the same storage mode.
 | 
			
		||||
 MTLStorageModeManaged and MTLStorageModeMemoryless are disallowed.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLStorageMode storageMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property cpuCacheMode
 | 
			
		||||
 @abstract CPU cache mode for the heap. Default is MTLCPUCacheModeDefaultCache.
 | 
			
		||||
 @discussion All resources created from this heap share the same cache mode.
 | 
			
		||||
 CPU cache mode is ignored for MTLStorageModePrivate.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLCPUCacheMode cpuCacheMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property hazardTrackingMode
 | 
			
		||||
 @abstract Set hazard tracking mode for the heap. The default value is MTLHazardTrackingModeDefault.
 | 
			
		||||
 @discussion For heaps, MTLHazardTrackingModeDefault is treated as MTLHazardTrackingModeUntracked.
 | 
			
		||||
 Setting hazardTrackingMode to MTLHazardTrackingModeTracked causes hazard tracking to be enabled heap.
 | 
			
		||||
 When a resource on a hazard tracked heap is modified, reads and writes from all resources suballocated on that heap will be delayed until the modification is complete.
 | 
			
		||||
 Similarly, modifying heap resources will be delayed until all in-flight reads and writes from all resources suballocated on that heap have completed.
 | 
			
		||||
 For optimal performance, perform hazard tracking manually through MTLFence or MTLEvent instead.
 | 
			
		||||
 All resources created from this heap shared the same hazard tracking mode.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLHazardTrackingMode hazardTrackingMode API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resourceOptions
 | 
			
		||||
 @abstract A packed tuple of the storageMode, cpuCacheMode and hazardTrackingMode properties.
 | 
			
		||||
 @discussion Modifications to this property are reflected in the other properties and vice versa.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLResourceOptions resourceOptions API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property type
 | 
			
		||||
 @abstract The type of the heap. The default value is MTLHeapTypeAutomatic.
 | 
			
		||||
 @discussion This constrains the resource creation functions that are available.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLHeapType type API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLHeap
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.13), ios(10.0))
 | 
			
		||||
@protocol MTLHeap <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this heap.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this heap was created against. This heap can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property storageMode
 | 
			
		||||
 @abstract Current heap storage mode, default is MTLStorageModePrivate.
 | 
			
		||||
 @discussion All resources created from this heap share the same storage mode.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLStorageMode storageMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property cpuCacheMode
 | 
			
		||||
 @abstract CPU cache mode for the heap. Default is MTLCPUCacheModeDefaultCache.
 | 
			
		||||
 @discussion All resources created from this heap share the same cache mode.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLCPUCacheMode cpuCacheMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property hazardTrackingMode
 | 
			
		||||
 @abstract Whether or not the heap is hazard tracked.
 | 
			
		||||
 @discussion
 | 
			
		||||
 When a resource on a hazard tracked heap is modified, reads and writes from any other resource on that heap will be delayed until the modification is complete.
 | 
			
		||||
 Similarly, modifying heap resources will be delayed until all in-flight reads and writes from resources suballocated on that heap have completed.
 | 
			
		||||
 For optimal performance, perform hazard tracking manually through MTLFence or MTLEvent instead.
 | 
			
		||||
 Resources on the heap may opt-out of hazard tracking individually when the heap is hazard tracked,
 | 
			
		||||
 however resources cannot opt-in to hazard tracking when the heap is not hazard tracked.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLHazardTrackingMode hazardTrackingMode API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resourceOptions
 | 
			
		||||
 @abstract A packed tuple of the storageMode, cpuCacheMode and hazardTrackingMode properties.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLResourceOptions resourceOptions API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property size
 | 
			
		||||
 @abstract Heap size in bytes, specified at creation time and rounded up to device specific alignment.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger size;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property usedSize
 | 
			
		||||
 @abstract The size in bytes, of all resources allocated from the heap.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger usedSize;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property currentAllocatedSize
 | 
			
		||||
 @abstract The size in bytes of the current heap allocation.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger currentAllocatedSize API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method maxAvailableSizeWithAlignment:
 | 
			
		||||
 @abstract The maximum size that can be successfully allocated from the heap in bytes, taking into notice given alignment. Alignment needs to be zero, or power of two.
 | 
			
		||||
 @discussion Provides a measure of fragmentation within the heap.
 | 
			
		||||
 */
 | 
			
		||||
- (NSUInteger)maxAvailableSizeWithAlignment:(NSUInteger)alignment;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newBufferWithLength:options:
 | 
			
		||||
 @abstract Create a new buffer backed by heap memory.
 | 
			
		||||
 @discussion The requested storage and CPU cache modes must match the storage and CPU cache modes of the heap.
 | 
			
		||||
 @return The buffer or nil if heap is full.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLBuffer>)newBufferWithLength:(NSUInteger)length
 | 
			
		||||
                                       options:(MTLResourceOptions)options;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newTextureWithDescriptor:
 | 
			
		||||
 @abstract Create a new texture backed by heap memory.
 | 
			
		||||
 @discussion The requested storage and CPU cache modes must match the storage and CPU cache modes of the heap, with the exception that the requested storage mode can be MTLStorageModeMemoryless. 
 | 
			
		||||
 @return The texture or nil if heap is full.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLTexture>)newTextureWithDescriptor:(MTLTextureDescriptor *)desc;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setPurgeabilityState:
 | 
			
		||||
 @abstract Set or query the purgeability state of the heap.
 | 
			
		||||
 */
 | 
			
		||||
- (MTLPurgeableState)setPurgeableState:(MTLPurgeableState)state;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property type
 | 
			
		||||
 @abstract The type of the heap. The default value is MTLHeapTypeAutomatic.
 | 
			
		||||
 @discussion This constrains the resource creation functions that are available on the heap.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLHeapType type API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 
 | 
			
		||||
/*!
 | 
			
		||||
 @method newBufferWithLength:options:offset:
 | 
			
		||||
 @abstract Create a new buffer backed by heap memory at the specified placement offset.
 | 
			
		||||
 @discussion This method can only be used when heapType is set to MTLHeapTypePlacement.
 | 
			
		||||
 Use "MTLDevice heapBufferSizeAndAlignWithLength:options:" to determine requiredSize and requiredAlignment.
 | 
			
		||||
 Any resources that exist in this heap at overlapping half-open range [offset, offset + requiredSize) are implicitly aliased with the new resource.
 | 
			
		||||
 @param length The requested size of the buffer, in bytes.
 | 
			
		||||
 @param options The requested options of the buffer, of which the storage and CPU cache mode must match these of the heap.
 | 
			
		||||
 @param offset The requested offset of the buffer inside the heap, in bytes. Behavior is undefined if "offset + requiredSize > heap.size" or "offset % requiredAlignment != 0".
 | 
			
		||||
 @return The buffer, or nil if the heap is not a placement heap
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLBuffer>)newBufferWithLength:(NSUInteger)length
 | 
			
		||||
                                      options:(MTLResourceOptions)options
 | 
			
		||||
                                       offset:(NSUInteger)offset API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newTextureWithDescriptor:offset:
 | 
			
		||||
 @abstract Create a new texture backed by heap memory at the specified placement offset.
 | 
			
		||||
 @discussion This method can only be used when heapType is set to MTLHeapTypePlacement.
 | 
			
		||||
 Use "MTLDevice heapTextureSizeAndAlignWithDescriptor:" to determine requiredSize and requiredAlignment.
 | 
			
		||||
 Any resources that exist in this heap at overlapping half-open range [offset, offset + requiredSize) are implicitly aliased with the new resource.
 | 
			
		||||
 @param descriptor The requested properties of the texture, of which the storage and CPU cache mode must match those of the heap.
 | 
			
		||||
 @param offset The requested offset of the texture inside the heap, in bytes. Behavior is undefined if "offset + requiredSize > heap.size" and "offset % requiredAlignment != 0".
 | 
			
		||||
 @return The texture, or nil if the heap is not a placement heap.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLTexture>)newTextureWithDescriptor:(MTLTextureDescriptor *)descriptor
 | 
			
		||||
                                             offset:(NSUInteger)offset API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,106 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLIndirectCommandBuffer.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2017 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLIndirectCommandEncoder.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract
 | 
			
		||||
 A bitfield of commands that may be performed indirectly.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLIndirectCommandType) {
 | 
			
		||||
    MTLIndirectCommandTypeDraw                = (1 << 0),
 | 
			
		||||
    MTLIndirectCommandTypeDrawIndexed         = (1 << 1),
 | 
			
		||||
    MTLIndirectCommandTypeDrawPatches         API_AVAILABLE(tvos(14.5)) = (1 << 2),
 | 
			
		||||
    MTLIndirectCommandTypeDrawIndexedPatches  API_AVAILABLE(tvos(14.5)) = (1 << 3) ,
 | 
			
		||||
 | 
			
		||||
    MTLIndirectCommandTypeConcurrentDispatch  API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = (1 << 5), /* Dispatch threadgroups with concurrent execution */
 | 
			
		||||
 | 
			
		||||
    MTLIndirectCommandTypeConcurrentDispatchThreads  API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = (1 << 6), /* Dispatch threads with concurrent execution */
 | 
			
		||||
} API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract The data layout required for specifying an indirect command buffer execution range.
 | 
			
		||||
 */
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    uint32_t location;
 | 
			
		||||
    uint32_t length;
 | 
			
		||||
}  MTLIndirectCommandBufferExecutionRange API_AVAILABLE(macos(10.14), macCatalyst(13.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLIndirectCommandBufferExecutionRange MTLIndirectCommandBufferExecutionRangeMake(uint32_t location, uint32_t length) API_AVAILABLE(macos(10.14), macCatalyst(13.0), ios(13.0))
 | 
			
		||||
{
 | 
			
		||||
    MTLIndirectCommandBufferExecutionRange icbRange = {location, length};
 | 
			
		||||
    return icbRange;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract
 | 
			
		||||
 Describes the limits and features that can be used in an indirect command
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@interface MTLIndirectCommandBufferDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract
 | 
			
		||||
 A bitfield of the command types that be encoded.
 | 
			
		||||
 @discussion
 | 
			
		||||
 MTLCommandTypeDispatch cannot be mixed with any other command type.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLIndirectCommandType commandTypes;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract
 | 
			
		||||
 Whether the render or compute pipeline are inherited from the encoder
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL inheritPipelineState API_AVAILABLE(macos(10.14), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract
 | 
			
		||||
 Whether the render or compute pipeline can set arguments.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL inheritBuffers;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract
 | 
			
		||||
 The maximum bind index of vertex argument buffers that can be set per command.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxVertexBufferBindCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @absract
 | 
			
		||||
 The maximum bind index of fragment argument buffers that can be set per command.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxFragmentBufferBindCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @absract
 | 
			
		||||
 The maximum bind index of kernel (or tile) argument buffers that can be set per command.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxKernelBufferBindCount API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@protocol MTLIndirectCommandBuffer <MTLResource>
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSUInteger size;
 | 
			
		||||
 | 
			
		||||
-(void)resetWithRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
- (id <MTLIndirectRenderCommand>)indirectRenderCommandAtIndex:(NSUInteger)commandIndex;
 | 
			
		||||
- (id <MTLIndirectComputeCommand>)indirectComputeCommandAtIndex:(NSUInteger)commandIndex API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,73 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLIndirectCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2017 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLStageInputOutputDescriptor.h>
 | 
			
		||||
#import <Metal/MTLRenderPipeline.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 @abstract
 | 
			
		||||
 Describes a CPU-recorded indirect render command
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.14), ios(12.0))
 | 
			
		||||
@protocol MTLIndirectRenderCommand <NSObject>
 | 
			
		||||
- (void)setRenderPipelineState:(id <MTLRenderPipelineState>)pipelineState API_AVAILABLE(macos(10.14), macCatalyst(13.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
- (void)setVertexBuffer:(id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
- (void)setFragmentBuffer:(id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)        drawPatches:(NSUInteger)numberOfPatchControlPoints patchStart:(NSUInteger)patchStart patchCount:(NSUInteger)patchCount patchIndexBuffer:(nullable id <MTLBuffer>)patchIndexBuffer
 | 
			
		||||
     patchIndexBufferOffset:(NSUInteger)patchIndexBufferOffset instanceCount:(NSUInteger)instanceCount baseInstance:(NSUInteger)baseInstance
 | 
			
		||||
   tessellationFactorBuffer:(id <MTLBuffer>)buffer tessellationFactorBufferOffset:(NSUInteger)offset tessellationFactorBufferInstanceStride:(NSUInteger)instanceStride API_AVAILABLE(tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)drawIndexedPatches:(NSUInteger)numberOfPatchControlPoints  patchStart:(NSUInteger)patchStart patchCount:(NSUInteger)patchCount patchIndexBuffer:(nullable id <MTLBuffer>)patchIndexBuffer
 | 
			
		||||
    patchIndexBufferOffset:(NSUInteger)patchIndexBufferOffset controlPointIndexBuffer:(id <MTLBuffer>)controlPointIndexBuffer
 | 
			
		||||
controlPointIndexBufferOffset:(NSUInteger)controlPointIndexBufferOffset instanceCount:(NSUInteger)instanceCount
 | 
			
		||||
              baseInstance:(NSUInteger)baseInstance tessellationFactorBuffer:(id <MTLBuffer>)buffer
 | 
			
		||||
tessellationFactorBufferOffset:(NSUInteger)offset tessellationFactorBufferInstanceStride:(NSUInteger)instanceStride API_AVAILABLE(tvos(14.5));
 | 
			
		||||
 | 
			
		||||
- (void)drawPrimitives:(MTLPrimitiveType)primitiveType vertexStart:(NSUInteger)vertexStart vertexCount:(NSUInteger)vertexCount instanceCount:(NSUInteger)instanceCount baseInstance:(NSUInteger)baseInstance;
 | 
			
		||||
- (void)drawIndexedPrimitives:(MTLPrimitiveType)primitiveType indexCount:(NSUInteger)indexCount indexType:(MTLIndexType)indexType indexBuffer:(id <MTLBuffer>)indexBuffer indexBufferOffset:(NSUInteger)indexBufferOffset instanceCount:(NSUInteger)instanceCount baseVertex:(NSInteger)baseVertex baseInstance:(NSUInteger)baseInstance;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(ios(13.0), macos(11.0))
 | 
			
		||||
@protocol MTLIndirectComputeCommand <NSObject>
 | 
			
		||||
- (void)setComputePipelineState:(id <MTLComputePipelineState>)pipelineState API_AVAILABLE(ios(13.0), macos(11.0));
 | 
			
		||||
 | 
			
		||||
- (void)setKernelBuffer:(id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)concurrentDispatchThreadgroups:(MTLSize)threadgroupsPerGrid
 | 
			
		||||
                 threadsPerThreadgroup:(MTLSize)threadsPerThreadgroup;
 | 
			
		||||
- (void)concurrentDispatchThreads:(MTLSize)threadsPerGrid
 | 
			
		||||
            threadsPerThreadgroup:(MTLSize)threadsPerThreadgroup;
 | 
			
		||||
 | 
			
		||||
- (void)setBarrier;
 | 
			
		||||
 | 
			
		||||
- (void)clearBarrier;
 | 
			
		||||
 | 
			
		||||
- (void)setImageblockWidth:(NSUInteger)width height:(NSUInteger)height API_AVAILABLE(ios(14.0), macos(11.0));
 | 
			
		||||
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)setThreadgroupMemoryLength:(NSUInteger)length atIndex:(NSUInteger)index;
 | 
			
		||||
- (void)setStageInRegion:(MTLRegion)region;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,117 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLIntersectionFunctionTable.h
 | 
			
		||||
//  Framework
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
#import <Metal/MTLFunctionHandle.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Signature defining what data is provided to an intersection function. The signature
 | 
			
		||||
 * must match across the shading language declaration of the intersection function table,
 | 
			
		||||
 * intersection functions in the table, and the intersector using the table.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLIntersectionFunctionSignature) {
 | 
			
		||||
	/**
 | 
			
		||||
	 * @Brief No signature
 | 
			
		||||
	 */
 | 
			
		||||
	MTLIntersectionFunctionSignatureNone = 0,
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @brief The intersection functions are entitled to read the built-in instance_id as described in
 | 
			
		||||
	 * the Metal Shading Language Guide.
 | 
			
		||||
	 */
 | 
			
		||||
	MTLIntersectionFunctionSignatureInstancing = (1 << 0),
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @brief The triangle intersection functions are entitled to to read the built-in barycentric_coord
 | 
			
		||||
	 * and front_facing as described in the Metal Shading Language Guide.
 | 
			
		||||
	 */
 | 
			
		||||
	MTLIntersectionFunctionSignatureTriangleData = (1 << 1),
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @brief The intersection functions are entitled to query world_space_origin and
 | 
			
		||||
	 * world_space_direction as described in the Metal Shading Language Guide.
 | 
			
		||||
	 */
 | 
			
		||||
    MTLIntersectionFunctionSignatureWorldSpaceData = (1 << 2),
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief The intersection functions may be called from intersectors using the
 | 
			
		||||
     * instance_motion intersection tag as described in the Metal Shading Language Guide.
 | 
			
		||||
     */
 | 
			
		||||
    MTLIntersectionFunctionSignatureInstanceMotion API_AVAILABLE(macos(12.0), ios(15.0)) = (1 << 3),
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief The intersection functions are entitled to query time, motion_start_time,
 | 
			
		||||
     * motion_end_time and key_frame_count as described in the Metal Shading Language Guide.
 | 
			
		||||
     */
 | 
			
		||||
    MTLIntersectionFunctionSignaturePrimitiveMotion API_AVAILABLE(macos(12.0), ios(15.0)) = (1 << 4),
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief The intersection functions may be called from intersectors using the
 | 
			
		||||
     * extended_limits intersection tag as described in the Metal Shading Language Guide.
 | 
			
		||||
     */
 | 
			
		||||
    MTLIntersectionFunctionSignatureExtendedLimits API_AVAILABLE(macos(12.0), ios(15.0)) = (1 << 5),
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
} MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLIntersectionFunctionTableDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method intersectionFunctionTableDescriptor
 | 
			
		||||
 @abstract Create an autoreleased intersection function table descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (nonnull MTLIntersectionFunctionTableDescriptor *)intersectionFunctionTableDescriptor;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property functionCount
 | 
			
		||||
* @abstract The number of functions in the table.
 | 
			
		||||
*/
 | 
			
		||||
@property (nonatomic) NSUInteger functionCount;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLIntersectionFunctionTable <MTLResource>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)setBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
- (void)setBuffers:(const id <MTLBuffer> __nullable [__nonnull])buffers offsets:(const NSUInteger [__nonnull])offsets withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- (void)setFunction:(nullable id <MTLFunctionHandle>)function atIndex:(NSUInteger)index;
 | 
			
		||||
- (void)setFunctions:(const id <MTLFunctionHandle> __nullable [__nonnull])functions withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * @brief Initialize the function at the given index with a triangle intersection function
 | 
			
		||||
 * with the given signature which always accepts ray/triangle intersections. If this method is
 | 
			
		||||
 * not called and an intersection function is not otherwise set at the given index,
 | 
			
		||||
 * ray/triangle intersections will be ignored if a call to the function at the given index
 | 
			
		||||
 * would be required. Ray/triangle intersections are always accepted if an intersection
 | 
			
		||||
 * function table is not provided.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setOpaqueTriangleIntersectionFunctionWithSignature:(MTLIntersectionFunctionSignature)signature atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * @brief Initialize the function at the given range with a triangle intersection function
 | 
			
		||||
 * with the given signature which always accepts ray/triangle intersections. If this method is
 | 
			
		||||
 * not called and an intersection function is not otherwise set at an index in the given range,
 | 
			
		||||
 * ray/triangle intersections will be ignored if a call to the function at that index
 | 
			
		||||
 * would be required. Ray/triangle intersections are always accepted if an intersection
 | 
			
		||||
 * function table is not provided.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setOpaqueTriangleIntersectionFunctionWithSignature:(MTLIntersectionFunctionSignature)signature withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
- (void)setVisibleFunctionTable:(nullable id <MTLVisibleFunctionTable>)functionTable atBufferIndex:(NSUInteger)bufferIndex;
 | 
			
		||||
- (void)setVisibleFunctionTables:(const id <MTLVisibleFunctionTable> __nullable [__nonnull])functionTables withBufferRange:(NSRange)bufferRange;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,384 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLLibrary.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLFunctionDescriptor.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLFunction;
 | 
			
		||||
@protocol MTLLibrary;
 | 
			
		||||
@class MTLCompileOptions;
 | 
			
		||||
@class MTLFunctionConstantValues;
 | 
			
		||||
@class MTLIntersectionFunctionDescriptor;
 | 
			
		||||
@protocol MTLDynamicLibrary;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@protocol MTLArgumentEncoder;
 | 
			
		||||
 | 
			
		||||
typedef __autoreleasing MTLArgument *__nullable MTLAutoreleasedArgument;
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLPatchType) {
 | 
			
		||||
    MTLPatchTypeNone = 0,
 | 
			
		||||
    MTLPatchTypeTriangle = 1,
 | 
			
		||||
    MTLPatchTypeQuad = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLVertexAttribute : NSObject
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSString                    *name;
 | 
			
		||||
@property (readonly) NSUInteger                   attributeIndex;
 | 
			
		||||
@property (readonly) MTLDataType                  attributeType API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
@property (readonly, getter=isActive) BOOL        active;
 | 
			
		||||
@property (readonly, getter=isPatchData) BOOL              patchData API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readonly, getter=isPatchControlPointData) BOOL  patchControlPointData API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLAttribute : NSObject
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSString                    *name;
 | 
			
		||||
@property (readonly) NSUInteger                   attributeIndex;
 | 
			
		||||
@property (readonly) MTLDataType                  attributeType;
 | 
			
		||||
@property (readonly, getter=isActive) BOOL        active;
 | 
			
		||||
@property (readonly, getter=isPatchData) BOOL              patchData API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readonly, getter=isPatchControlPointData) BOOL  patchControlPointData API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLFunctionType
 | 
			
		||||
 @abstract An identifier for a top-level Metal function.
 | 
			
		||||
 @discussion Each location in the API where a program is used requires a function written for that specific usage.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLFunctionTypeVertex
 | 
			
		||||
 A vertex shader, usable for a MTLRenderPipelineState.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLFunctionTypeFragment
 | 
			
		||||
 A fragment shader, usable for a MTLRenderPipelineState.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLFunctionTypeKernel
 | 
			
		||||
 A compute kernel, usable to create a MTLComputePipelineState.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLFunctionType) {
 | 
			
		||||
    MTLFunctionTypeVertex = 1,
 | 
			
		||||
    MTLFunctionTypeFragment = 2,
 | 
			
		||||
    MTLFunctionTypeKernel = 3,
 | 
			
		||||
    MTLFunctionTypeVisible API_AVAILABLE(macos(11.0), ios(14.0)) = 5,
 | 
			
		||||
    MTLFunctionTypeIntersection API_AVAILABLE(macos(11.0), ios(14.0)) = 6,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLFunctionConstant
 | 
			
		||||
 @abstract describe an uberShader constant used by the function
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLFunctionConstant : NSObject
 | 
			
		||||
 | 
			
		||||
@property (readonly) NSString *name;
 | 
			
		||||
@property (readonly) MTLDataType type;
 | 
			
		||||
@property (readonly) NSUInteger index;
 | 
			
		||||
@property (readonly) BOOL required;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLFunction
 | 
			
		||||
 @abstract A handle to intermediate code used as inputs for either a MTLComputePipelineState or a MTLRenderPipelineState.
 | 
			
		||||
 @discussion MTLFunction is a single vertex shader, fragment shader, or compute function.  A Function can only be used with the device that it was created against.
 | 
			
		||||
*/
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLFunction <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label  API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property functionType
 | 
			
		||||
 @abstract The overall kind of entry point: compute, vertex, or fragment.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLFunctionType functionType;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property patchType
 | 
			
		||||
 @abstract Returns the patch type. MTLPatchTypeNone if it is not a post tessellation vertex shader.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLPatchType patchType API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property patchControlPointCount
 | 
			
		||||
 @abstract Returns the number of patch control points if it was specified in the shader. Returns -1 if it
 | 
			
		||||
 was not specified.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSInteger patchControlPointCount API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@property (nullable, readonly) NSArray <MTLVertexAttribute *> *vertexAttributes;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property stageInputAttributes
 | 
			
		||||
 @abstract Returns an array describing the attributes
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) NSArray <MTLAttribute *> *stageInputAttributes API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property name
 | 
			
		||||
 @abstract The name of the function in the shading language.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSString *name;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property functionConstantsDictionary
 | 
			
		||||
 @abstract A dictionary containing information about all function contents, keyed by the constant names.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSDictionary<NSString *, MTLFunctionConstant *> *functionConstantsDictionary API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method newArgumentEncoderWithBufferIndex:
 | 
			
		||||
 * @abstract Creates an argument encoder which will encode arguments matching the layout of the argument buffer at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (id <MTLArgumentEncoder>)newArgumentEncoderWithBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method newArgumentEncoderWithBufferIndex:
 | 
			
		||||
 * @abstract Creates an argument encoder which will encode arguments matching the layout of the argument buffer at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (id <MTLArgumentEncoder>)newArgumentEncoderWithBufferIndex:(NSUInteger)bufferIndex
 | 
			
		||||
                                                                  reflection:(MTLAutoreleasedArgument * __nullable)reflection API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property options
 | 
			
		||||
 @abstract The options this function was created with.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLFunctionOptions options API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLLanguageVersion) {
 | 
			
		||||
    MTLLanguageVersion1_0 API_AVAILABLE(ios(9.0)) API_UNAVAILABLE(macos, macCatalyst) = (1 << 16),
 | 
			
		||||
    MTLLanguageVersion1_1 API_AVAILABLE(macos(10.11), ios(9.0)) = (1 << 16) + 1,
 | 
			
		||||
    MTLLanguageVersion1_2 API_AVAILABLE(macos(10.12), ios(10.0)) = (1 << 16) + 2,
 | 
			
		||||
    MTLLanguageVersion2_0 API_AVAILABLE(macos(10.13), ios(11.0)) = (2 << 16),
 | 
			
		||||
    MTLLanguageVersion2_1 API_AVAILABLE(macos(10.14), ios(12.0)) = (2 << 16) + 1,
 | 
			
		||||
    MTLLanguageVersion2_2 API_AVAILABLE(macos(10.15), ios(13.0)) = (2 << 16) + 2,
 | 
			
		||||
    MTLLanguageVersion2_3 API_AVAILABLE(macos(11.0), ios(14.0)) = (2 << 16) + 3,
 | 
			
		||||
    MTLLanguageVersion2_4 API_AVAILABLE(macos(12.0), ios(15.0)) = (2 << 16) + 4,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSInteger, MTLLibraryType) {
 | 
			
		||||
    MTLLibraryTypeExecutable = 0,
 | 
			
		||||
    MTLLibraryTypeDynamic = 1,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLCompileOptions : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
// Pre-processor options
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property preprocessorNames
 | 
			
		||||
 @abstract List of preprocessor macros to consider to when compiling this program. Specified as key value pairs, using a NSDictionary. The keys must be NSString objects and values can be either NSString or NSNumber objects.
 | 
			
		||||
 @discussion The default value is nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readwrite, copy, nonatomic) NSDictionary <NSString *, NSObject *> *preprocessorMacros;
 | 
			
		||||
 | 
			
		||||
// Math intrinsics options
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property fastMathEnabled
 | 
			
		||||
 @abstract If YES, enables the compiler to perform optimizations for floating-point arithmetic that may violate the IEEE 754 standard. It also enables the high precision variant of math functions for single precision floating-point scalar and vector types. fastMathEnabled defaults to YES.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL fastMathEnabled;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property languageVersion
 | 
			
		||||
 @abstract set the metal language version used to interpret the source.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLLanguageVersion languageVersion API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property type
 | 
			
		||||
 @abstract Which type the library should be compiled as. The default value is MTLLibraryTypeExecutable.
 | 
			
		||||
 @discussion MTLLibraryTypeExecutable is suitable to build a library of "kernel", "vertex" and "fragment" qualified functions.
 | 
			
		||||
 MTLLibraryType is suitable when the compilation result will instead be used to instantiate a MTLDynamicLibrary.
 | 
			
		||||
 MTLDynamicLibrary contains no qualified functions, but it's unqualified functions and variables can be used as an external dependency for compiling other libraries.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic) MTLLibraryType libraryType API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property installName
 | 
			
		||||
 @abstract The install name of this dynamic library.
 | 
			
		||||
 @discussion The install name is used when a pipeline state is created that depends, directly or indirectly, on a dynamic library.
 | 
			
		||||
 The installName is embedded into any other MTLLibrary that links against the compilation result.
 | 
			
		||||
 This property should be set such that the dynamic library can be found in the file system at the time a pipeline state is created.
 | 
			
		||||
 Specify one of:
 | 
			
		||||
 - an absolute path to a file from which the dynamic library can be loaded, or
 | 
			
		||||
 - a path relative to @executable_path, where @executable_path is substituted with the directory name from which the MTLLibrary containing the MTLFunction entrypoint used to create the pipeline state is loaded, or
 | 
			
		||||
 - a path relative to @loader_path, where @loader_path is substituted with the directory name from which the MTLLibrary with the reference to this installName embedded is loaded.
 | 
			
		||||
 The first is appropriate for MTLDynamicLibrary written to the file-system using its serializeToURL:error: method on the current device.
 | 
			
		||||
 The others are appropriate when the MTLDynamicLibrary is installed as part of a bundle or app, where the absolute path is not known.
 | 
			
		||||
 This property is ignored when the type property is not set to MTLLibraryTypeDynamic.
 | 
			
		||||
 This propery should not be null if the property type is set to MTLLibraryTypeDynamic: the compilation will fail in that scenario.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nullable, copy, nonatomic) NSString *installName API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property libraries
 | 
			
		||||
 @abstract A set of MTLDynamicLibrary instances to link against.
 | 
			
		||||
 The installName of the provided MTLDynamicLibrary is embedded into the compilation result.
 | 
			
		||||
 When a function from the resulting MTLLibrary is used (either as an MTLFunction, or as an to create a pipeline state, the embedded install names are used to automatically load the MTLDynamicLibrary instances.
 | 
			
		||||
 This property can be null if no libraries should be automatically loaded, either because the MTLLibrary has no external dependencies, or because you will use preloadedLibraries to specify the libraries to use at pipeline creation time.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nullable, copy, nonatomic) NSArray<id<MTLDynamicLibrary>> *libraries API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property preserveInvariance
 | 
			
		||||
 @abstract If YES,  set the compiler to compile shaders to preserve invariance.  The default is false.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL preserveInvariance API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @constant MTLLibraryErrorDomain
 | 
			
		||||
 @abstract NSErrors raised when creating a library.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
MTL_EXTERN NSErrorDomain const MTLLibraryErrorDomain;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLLibraryError
 | 
			
		||||
 @abstract NSErrors raised when creating a library.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLLibraryError) {
 | 
			
		||||
    MTLLibraryErrorUnsupported      = 1,
 | 
			
		||||
    MTLLibraryErrorInternal         = 2,
 | 
			
		||||
    MTLLibraryErrorCompileFailure   = 3,
 | 
			
		||||
    MTLLibraryErrorCompileWarning   = 4,
 | 
			
		||||
    MTLLibraryErrorFunctionNotFound API_AVAILABLE(macos(10.12), ios(10.0)) = 5,
 | 
			
		||||
    MTLLibraryErrorFileNotFound API_AVAILABLE(macos(10.12), ios(10.0)) = 6,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLLibrary <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newFunctionWithName
 | 
			
		||||
 @abstract Returns a pointer to a function object, return nil if the function is not found in the library.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLFunction>) newFunctionWithName:(NSString *)functionName;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newFunctionWithName:constantValues:error:
 | 
			
		||||
 @abstract Returns a pointer to a function object obtained by applying the constant values to the named function.
 | 
			
		||||
 @discussion This method will call the compiler. Use newFunctionWithName:constantValues:completionHandler: to
 | 
			
		||||
 avoid waiting on the compiler.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLFunction>) newFunctionWithName:(NSString *)name constantValues:(MTLFunctionConstantValues *)constantValues
 | 
			
		||||
					error:(__autoreleasing NSError **)error API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newFunctionWithName:constantValues:completionHandler:
 | 
			
		||||
 @abstract Returns a pointer to a function object obtained by applying the constant values to the named function.
 | 
			
		||||
 @discussion This method is asynchronous since it is will call the compiler.
 | 
			
		||||
 */
 | 
			
		||||
- (void) newFunctionWithName:(NSString *)name constantValues:(MTLFunctionConstantValues *)constantValues
 | 
			
		||||
			completionHandler:(void (^)(id<MTLFunction> __nullable function, NSError* __nullable error))completionHandler API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newFunctionWithDescriptor:completionHandler:
 | 
			
		||||
 @abstract Create a new MTLFunction object asynchronously.
 | 
			
		||||
 */
 | 
			
		||||
- (void)newFunctionWithDescriptor:(nonnull MTLFunctionDescriptor *)descriptor
 | 
			
		||||
                completionHandler:(void (^)(id<MTLFunction> __nullable function, NSError* __nullable error))completionHandler API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newFunctionWithDescriptor:error:
 | 
			
		||||
 @abstract Create  a new MTLFunction object synchronously.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLFunction>)newFunctionWithDescriptor:(nonnull MTLFunctionDescriptor *)descriptor
 | 
			
		||||
                                                 error:(__autoreleasing NSError **)error API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newIntersectionFunctionWithDescriptor:completionHandler:
 | 
			
		||||
 @abstract Create a new MTLFunction object asynchronously.
 | 
			
		||||
 */
 | 
			
		||||
- (void)newIntersectionFunctionWithDescriptor:(nonnull MTLIntersectionFunctionDescriptor *)descriptor
 | 
			
		||||
                            completionHandler:(void (^)(id<MTLFunction> __nullable function, NSError* __nullable error))completionHandler
 | 
			
		||||
    API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newIntersectionFunctionWithDescriptor:error:
 | 
			
		||||
 @abstract Create  a new MTLFunction object synchronously.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLFunction>)newIntersectionFunctionWithDescriptor:(nonnull MTLIntersectionFunctionDescriptor *)descriptor
 | 
			
		||||
                                                             error:(__autoreleasing NSError **)error
 | 
			
		||||
    API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property functionNames
 | 
			
		||||
 @abstract The array contains NSString objects, with the name of each function in library.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSArray <NSString *> *functionNames;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property type
 | 
			
		||||
 @abstract The library type provided when this MTLLibrary was created.
 | 
			
		||||
 Libraries with MTLLibraryTypeExecutable can be used to obtain MTLFunction from.
 | 
			
		||||
 Libraries with MTLLibraryTypeDynamic can be used to resolve external references in other MTLLibrary from.
 | 
			
		||||
 @see MTLCompileOptions
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLLibraryType type API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property installName
 | 
			
		||||
 @abstract The installName provided when this MTLLibrary was created.
 | 
			
		||||
 @discussion Always nil if the type of the library is not MTLLibraryTypeDynamic.
 | 
			
		||||
 @see MTLCompileOptions
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nullable) NSString* installName API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,57 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLLinkedFunctions.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@protocol MTLFunction;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLLinkedFunctions
 | 
			
		||||
 @abstract A class to set functions to be linked.
 | 
			
		||||
 @discussion All functions set on this object must have unique names.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLLinkedFunctions : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method linkedFunctions
 | 
			
		||||
 @abstract Create an autoreleased MTLLinkedFunctions object.
 | 
			
		||||
 */
 | 
			
		||||
+ (nonnull MTLLinkedFunctions *)linkedFunctions;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property functions
 | 
			
		||||
* @abstract The array of functions to be AIR linked.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic, copy, nullable) NSArray<id<MTLFunction>> *functions;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property binaryFunctions
 | 
			
		||||
* @abstract The array of functions compiled to binary to be linked.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic, copy, nullable) NSArray<id<MTLFunction>> *binaryFunctions;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property groups
 | 
			
		||||
* @abstract Groups of functions, grouped to match callsites in the shader code.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic, copy, nullable) NSDictionary<NSString*, NSArray<id<MTLFunction>>*> *groups;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
@property privateFunctions
 | 
			
		||||
@abstract The array of functions to be AIR linked.
 | 
			
		||||
@discussion These functions are not exported by the pipeline state as MTLFunctionHandle objects.
 | 
			
		||||
 Function pointer support is not required to link private functions.
 | 
			
		||||
*/
 | 
			
		||||
@property (readwrite, nonatomic, copy, nullable) NSArray<id<MTLFunction>> *privateFunctions API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,77 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLParallelRenderCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLRenderPass.h>
 | 
			
		||||
#import <Metal/MTLCommandEncoder.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLRenderCommandEncoder;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLParallelRenderCommandEncoder
 | 
			
		||||
 @discussion The MTLParallelRenderCommandEncoder protocol is designed to allow a single render to texture operation to be efficiently (and safely) broken up across multiple threads.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLParallelRenderCommandEncoder <MTLCommandEncoder>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method renderCommandEncoder
 | 
			
		||||
 @abstract Return a new autoreleased object that conforms to <MTLRenderCommandEncoder> that may be used to encode on a different thread.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLRenderCommandEncoder>)renderCommandEncoder;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setColorStoreAction:atIndex:
 | 
			
		||||
 @brief If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setColorStoreAction:atIndex: must be used to finalize the store action before endEncoding is called.
 | 
			
		||||
 @param storeAction The desired store action for the given color attachment.  This may be set to any value other than MTLStoreActionUnknown.
 | 
			
		||||
 @param colorAttachmentIndex The index of the color attachment
 | 
			
		||||
*/
 | 
			
		||||
- (void)setColorStoreAction:(MTLStoreAction)storeAction atIndex:(NSUInteger)colorAttachmentIndex API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setDepthStoreAction:
 | 
			
		||||
 @brief If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setDepthStoreAction: must be used to finalize the store action before endEncoding is called.
 | 
			
		||||
*/
 | 
			
		||||
- (void)setDepthStoreAction:(MTLStoreAction)storeAction API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setStencilStoreAction:
 | 
			
		||||
 @brief If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setStencilStoreAction: must be used to finalize the store action before endEncoding is called.
 | 
			
		||||
*/
 | 
			
		||||
- (void)setStencilStoreAction:(MTLStoreAction)storeAction API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setColorStoreActionOptions:atIndex:
 | 
			
		||||
 @brief If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setColorStoreActionOptions:atIndex: may be used to finalize the store action options before endEncoding is called.
 | 
			
		||||
 @param storeActionOptions The desired store action options for the given color attachment.
 | 
			
		||||
 @param colorAttachmentIndex The index of the color attachment
 | 
			
		||||
 */
 | 
			
		||||
- (void)setColorStoreActionOptions:(MTLStoreActionOptions)storeActionOptions atIndex:(NSUInteger)colorAttachmentIndex API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setDepthStoreActionOptions:
 | 
			
		||||
 @brief If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setDepthStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setDepthStoreActionOptions:(MTLStoreActionOptions)storeActionOptions API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setStencilStoreActionOptions:
 | 
			
		||||
 @brief If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setStencilStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setStencilStoreActionOptions:(MTLStoreActionOptions)storeActionOptions API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,44 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLPipeline.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2017 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @enum MTLMutability
 | 
			
		||||
 * @abstract Specifies whether a buffer will be modified between the time it is bound and a compute
 | 
			
		||||
 * or render pipeline is executed in a draw or dispatch.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLMutability)
 | 
			
		||||
{
 | 
			
		||||
    MTLMutabilityDefault   = 0,
 | 
			
		||||
    MTLMutabilityMutable   = 1,
 | 
			
		||||
    MTLMutabilityImmutable = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@interface MTLPipelineBufferDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*! Buffer mutability. Defaults to MTLMutabilityDefault: mutable for standard buffers, immutable for argument buffers */
 | 
			
		||||
@property (nonatomic) MTLMutability mutability;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
@interface MTLPipelineBufferDescriptorArray : NSObject
 | 
			
		||||
/* Individual buffer descriptor access */
 | 
			
		||||
- (MTLPipelineBufferDescriptor *)objectAtIndexedSubscript:(NSUInteger)bufferIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics. It is safe to set the buffer descriptor at any legal index to nil, which resets that buffer descriptor to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLPipelineBufferDescriptor *)buffer atIndexedSubscript:(NSUInteger)bufferIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,227 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLPixelFormat.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLPixelFormat)
 | 
			
		||||
{
 | 
			
		||||
    MTLPixelFormatInvalid = 0,
 | 
			
		||||
 | 
			
		||||
    /* Normal 8 bit formats */
 | 
			
		||||
    
 | 
			
		||||
    MTLPixelFormatA8Unorm      = 1,
 | 
			
		||||
    
 | 
			
		||||
    MTLPixelFormatR8Unorm                            = 10,
 | 
			
		||||
    MTLPixelFormatR8Unorm_sRGB API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 11,
 | 
			
		||||
    MTLPixelFormatR8Snorm      = 12,
 | 
			
		||||
    MTLPixelFormatR8Uint       = 13,
 | 
			
		||||
    MTLPixelFormatR8Sint       = 14,
 | 
			
		||||
    
 | 
			
		||||
    /* Normal 16 bit formats */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatR16Unorm     = 20,
 | 
			
		||||
    MTLPixelFormatR16Snorm     = 22,
 | 
			
		||||
    MTLPixelFormatR16Uint      = 23,
 | 
			
		||||
    MTLPixelFormatR16Sint      = 24,
 | 
			
		||||
    MTLPixelFormatR16Float     = 25,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRG8Unorm                            = 30,
 | 
			
		||||
    MTLPixelFormatRG8Unorm_sRGB API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 31,
 | 
			
		||||
    MTLPixelFormatRG8Snorm                            = 32,
 | 
			
		||||
    MTLPixelFormatRG8Uint                             = 33,
 | 
			
		||||
    MTLPixelFormatRG8Sint                             = 34,
 | 
			
		||||
 | 
			
		||||
    /* Packed 16 bit formats */
 | 
			
		||||
    
 | 
			
		||||
    MTLPixelFormatB5G6R5Unorm API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 40,
 | 
			
		||||
    MTLPixelFormatA1BGR5Unorm API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 41,
 | 
			
		||||
    MTLPixelFormatABGR4Unorm  API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 42,
 | 
			
		||||
    MTLPixelFormatBGR5A1Unorm API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 43,
 | 
			
		||||
 | 
			
		||||
    /* Normal 32 bit formats */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatR32Uint  = 53,
 | 
			
		||||
    MTLPixelFormatR32Sint  = 54,
 | 
			
		||||
    MTLPixelFormatR32Float = 55,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRG16Unorm  = 60,
 | 
			
		||||
    MTLPixelFormatRG16Snorm  = 62,
 | 
			
		||||
    MTLPixelFormatRG16Uint   = 63,
 | 
			
		||||
    MTLPixelFormatRG16Sint   = 64,
 | 
			
		||||
    MTLPixelFormatRG16Float  = 65,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRGBA8Unorm      = 70,
 | 
			
		||||
    MTLPixelFormatRGBA8Unorm_sRGB = 71,
 | 
			
		||||
    MTLPixelFormatRGBA8Snorm      = 72,
 | 
			
		||||
    MTLPixelFormatRGBA8Uint       = 73,
 | 
			
		||||
    MTLPixelFormatRGBA8Sint       = 74,
 | 
			
		||||
    
 | 
			
		||||
    MTLPixelFormatBGRA8Unorm      = 80,
 | 
			
		||||
    MTLPixelFormatBGRA8Unorm_sRGB = 81,
 | 
			
		||||
 | 
			
		||||
    /* Packed 32 bit formats */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRGB10A2Unorm = 90,
 | 
			
		||||
    MTLPixelFormatRGB10A2Uint  = 91,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRG11B10Float = 92,
 | 
			
		||||
    MTLPixelFormatRGB9E5Float = 93,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatBGR10A2Unorm  API_AVAILABLE(macos(10.13), ios(11.0)) = 94,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatBGR10_XR      API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = 554,
 | 
			
		||||
    MTLPixelFormatBGR10_XR_sRGB API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = 555,
 | 
			
		||||
 | 
			
		||||
    /* Normal 64 bit formats */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRG32Uint  = 103,
 | 
			
		||||
    MTLPixelFormatRG32Sint  = 104,
 | 
			
		||||
    MTLPixelFormatRG32Float = 105,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRGBA16Unorm  = 110,
 | 
			
		||||
    MTLPixelFormatRGBA16Snorm  = 112,
 | 
			
		||||
    MTLPixelFormatRGBA16Uint   = 113,
 | 
			
		||||
    MTLPixelFormatRGBA16Sint   = 114,
 | 
			
		||||
    MTLPixelFormatRGBA16Float  = 115,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatBGRA10_XR      API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = 552,
 | 
			
		||||
    MTLPixelFormatBGRA10_XR_sRGB API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = 553,
 | 
			
		||||
 | 
			
		||||
    /* Normal 128 bit formats */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatRGBA32Uint  = 123,
 | 
			
		||||
    MTLPixelFormatRGBA32Sint  = 124,
 | 
			
		||||
    MTLPixelFormatRGBA32Float = 125,
 | 
			
		||||
 | 
			
		||||
    /* Compressed formats. */
 | 
			
		||||
 | 
			
		||||
    /* S3TC/DXT */
 | 
			
		||||
    MTLPixelFormatBC1_RGBA              API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 130,
 | 
			
		||||
    MTLPixelFormatBC1_RGBA_sRGB         API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 131,
 | 
			
		||||
    MTLPixelFormatBC2_RGBA              API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 132,
 | 
			
		||||
    MTLPixelFormatBC2_RGBA_sRGB         API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 133,
 | 
			
		||||
    MTLPixelFormatBC3_RGBA              API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 134,
 | 
			
		||||
    MTLPixelFormatBC3_RGBA_sRGB         API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 135,
 | 
			
		||||
 | 
			
		||||
    /* RGTC */
 | 
			
		||||
    MTLPixelFormatBC4_RUnorm            API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 140,
 | 
			
		||||
    MTLPixelFormatBC4_RSnorm            API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 141,
 | 
			
		||||
    MTLPixelFormatBC5_RGUnorm           API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 142,
 | 
			
		||||
    MTLPixelFormatBC5_RGSnorm           API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 143,
 | 
			
		||||
 | 
			
		||||
    /* BPTC */
 | 
			
		||||
    MTLPixelFormatBC6H_RGBFloat         API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 150,
 | 
			
		||||
    MTLPixelFormatBC6H_RGBUfloat        API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 151,
 | 
			
		||||
    MTLPixelFormatBC7_RGBAUnorm         API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 152,
 | 
			
		||||
    MTLPixelFormatBC7_RGBAUnorm_sRGB    API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 153,
 | 
			
		||||
 | 
			
		||||
    /* PVRTC */
 | 
			
		||||
    MTLPixelFormatPVRTC_RGB_2BPP        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 160,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGB_2BPP_sRGB   API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 161,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGB_4BPP        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 162,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGB_4BPP_sRGB   API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 163,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGBA_2BPP       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 164,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGBA_2BPP_sRGB  API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 165,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGBA_4BPP       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 166,
 | 
			
		||||
    MTLPixelFormatPVRTC_RGBA_4BPP_sRGB  API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 167,
 | 
			
		||||
 | 
			
		||||
    /* ETC2 */
 | 
			
		||||
    MTLPixelFormatEAC_R11Unorm          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 170,
 | 
			
		||||
    MTLPixelFormatEAC_R11Snorm          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 172,
 | 
			
		||||
    MTLPixelFormatEAC_RG11Unorm         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 174,
 | 
			
		||||
    MTLPixelFormatEAC_RG11Snorm         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 176,
 | 
			
		||||
    MTLPixelFormatEAC_RGBA8             API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 178,
 | 
			
		||||
    MTLPixelFormatEAC_RGBA8_sRGB        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 179,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatETC2_RGB8             API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 180,
 | 
			
		||||
    MTLPixelFormatETC2_RGB8_sRGB        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 181,
 | 
			
		||||
    MTLPixelFormatETC2_RGB8A1           API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 182,
 | 
			
		||||
    MTLPixelFormatETC2_RGB8A1_sRGB      API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 183,
 | 
			
		||||
 | 
			
		||||
    /* ASTC */
 | 
			
		||||
    MTLPixelFormatASTC_4x4_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 186,
 | 
			
		||||
    MTLPixelFormatASTC_5x4_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 187,
 | 
			
		||||
    MTLPixelFormatASTC_5x5_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 188,
 | 
			
		||||
    MTLPixelFormatASTC_6x5_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 189,
 | 
			
		||||
    MTLPixelFormatASTC_6x6_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 190,
 | 
			
		||||
    MTLPixelFormatASTC_8x5_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 192,
 | 
			
		||||
    MTLPixelFormatASTC_8x6_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 193,
 | 
			
		||||
    MTLPixelFormatASTC_8x8_sRGB         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 194,
 | 
			
		||||
    MTLPixelFormatASTC_10x5_sRGB        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 195,
 | 
			
		||||
    MTLPixelFormatASTC_10x6_sRGB        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 196,
 | 
			
		||||
    MTLPixelFormatASTC_10x8_sRGB        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 197,
 | 
			
		||||
    MTLPixelFormatASTC_10x10_sRGB       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 198,
 | 
			
		||||
    MTLPixelFormatASTC_12x10_sRGB       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 199,
 | 
			
		||||
    MTLPixelFormatASTC_12x12_sRGB       API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 200,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatASTC_4x4_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 204,
 | 
			
		||||
    MTLPixelFormatASTC_5x4_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 205,
 | 
			
		||||
    MTLPixelFormatASTC_5x5_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 206,
 | 
			
		||||
    MTLPixelFormatASTC_6x5_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 207,
 | 
			
		||||
    MTLPixelFormatASTC_6x6_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 208,
 | 
			
		||||
    MTLPixelFormatASTC_8x5_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 210,
 | 
			
		||||
    MTLPixelFormatASTC_8x6_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 211,
 | 
			
		||||
    MTLPixelFormatASTC_8x8_LDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 212,
 | 
			
		||||
    MTLPixelFormatASTC_10x5_LDR         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 213,
 | 
			
		||||
    MTLPixelFormatASTC_10x6_LDR         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 214,
 | 
			
		||||
    MTLPixelFormatASTC_10x8_LDR         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 215,
 | 
			
		||||
    MTLPixelFormatASTC_10x10_LDR        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 216,
 | 
			
		||||
    MTLPixelFormatASTC_12x10_LDR        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 217,
 | 
			
		||||
    MTLPixelFormatASTC_12x12_LDR        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(8.0)) = 218,
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    // ASTC HDR (High Dynamic Range) Formats
 | 
			
		||||
    MTLPixelFormatASTC_4x4_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 222,
 | 
			
		||||
    MTLPixelFormatASTC_5x4_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 223,
 | 
			
		||||
    MTLPixelFormatASTC_5x5_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 224,
 | 
			
		||||
    MTLPixelFormatASTC_6x5_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 225,
 | 
			
		||||
    MTLPixelFormatASTC_6x6_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 226,
 | 
			
		||||
    MTLPixelFormatASTC_8x5_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 228,
 | 
			
		||||
    MTLPixelFormatASTC_8x6_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 229,
 | 
			
		||||
    MTLPixelFormatASTC_8x8_HDR          API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 230,
 | 
			
		||||
    MTLPixelFormatASTC_10x5_HDR         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 231,
 | 
			
		||||
    MTLPixelFormatASTC_10x6_HDR         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 232,
 | 
			
		||||
    MTLPixelFormatASTC_10x8_HDR         API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 233,
 | 
			
		||||
    MTLPixelFormatASTC_10x10_HDR        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 234,
 | 
			
		||||
    MTLPixelFormatASTC_12x10_HDR        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 235,
 | 
			
		||||
    MTLPixelFormatASTC_12x12_HDR        API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0)) = 236,
 | 
			
		||||
    /*!
 | 
			
		||||
     @constant MTLPixelFormatGBGR422
 | 
			
		||||
     @abstract A pixel format where the red and green channels are subsampled horizontally.  Two pixels are stored in 32 bits, with shared red and blue values, and unique green values.
 | 
			
		||||
     @discussion This format is equivalent to YUY2, YUYV, yuvs, or GL_RGB_422_APPLE/GL_UNSIGNED_SHORT_8_8_REV_APPLE.   The component order, from lowest addressed byte to highest, is Y0, Cb, Y1, Cr.  There is no implicit colorspace conversion from YUV to RGB, the shader will receive (Cr, Y, Cb, 1).  422 textures must have a width that is a multiple of 2, and can only be used for 2D non-mipmap textures.  When sampling, ClampToEdge is the only usable wrap mode.
 | 
			
		||||
     */
 | 
			
		||||
    MTLPixelFormatGBGR422 = 240,
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     @constant MTLPixelFormatBGRG422
 | 
			
		||||
     @abstract A pixel format where the red and green channels are subsampled horizontally.  Two pixels are stored in 32 bits, with shared red and blue values, and unique green values.
 | 
			
		||||
     @discussion This format is equivalent to UYVY, 2vuy, or GL_RGB_422_APPLE/GL_UNSIGNED_SHORT_8_8_APPLE. The component order, from lowest addressed byte to highest, is Cb, Y0, Cr, Y1.  There is no implicit colorspace conversion from YUV to RGB, the shader will receive (Cr, Y, Cb, 1).  422 textures must have a width that is a multiple of 2, and can only be used for 2D non-mipmap textures.  When sampling, ClampToEdge is the only usable wrap mode.
 | 
			
		||||
     */
 | 
			
		||||
    MTLPixelFormatBGRG422 = 241,
 | 
			
		||||
 | 
			
		||||
    /* Depth */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatDepth16Unorm          API_AVAILABLE(macos(10.12), ios(13.0)) = 250,
 | 
			
		||||
    MTLPixelFormatDepth32Float  = 252,
 | 
			
		||||
 | 
			
		||||
    /* Stencil */
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatStencil8        = 253,
 | 
			
		||||
 | 
			
		||||
    /* Depth Stencil */
 | 
			
		||||
    
 | 
			
		||||
    MTLPixelFormatDepth24Unorm_Stencil8  API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 255,
 | 
			
		||||
    MTLPixelFormatDepth32Float_Stencil8  API_AVAILABLE(macos(10.11), ios(9.0)) = 260,
 | 
			
		||||
 | 
			
		||||
    MTLPixelFormatX32_Stencil8  API_AVAILABLE(macos(10.12), ios(10.0)) = 261,
 | 
			
		||||
    MTLPixelFormatX24_Stencil8  API_AVAILABLE(macos(10.12), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 262,
 | 
			
		||||
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,323 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLRasterizationRate.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2018 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
//  Support for variable rasterization rate
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLRasterizationRateSampleArray
 | 
			
		||||
 @abstract A helper object for convient access to samples stored in an array.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
 | 
			
		||||
@interface MTLRasterizationRateSampleArray : NSObject
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method objectAtIndexedSubscript:
 | 
			
		||||
 @abstract Retrieves the sample value at the specified index.
 | 
			
		||||
 @return NSNumber instance describing the value of the sample at the specified index, or 0 if the index is out of range.
 | 
			
		||||
 */
 | 
			
		||||
- (NSNumber*)objectAtIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setObject:atIndexedSubscript:
 | 
			
		||||
 @abstract Stores a sample value at the specified index.
 | 
			
		||||
 @discussion The value will be converted to a single precision floating point value.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setObject:(NSNumber*)value atIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLRasterizationRateLayerDescriptor
 | 
			
		||||
 @abstract Describes the minimum rasterization rate screen space using two piecewise linear functions.
 | 
			
		||||
 @discussion The two piecewise linear function (PLF) describe the desired rasterization quality on the horizontal and vertical axis separately.
 | 
			
		||||
 Each quality sample in the PLF is stored in an array as single precision floating point value between 0 (lowest quality) and 1 (highest quality).
 | 
			
		||||
 The first sample in the array describes the quality at the top (vertical) or left (horizontal) edge of screen space.
 | 
			
		||||
 The last sample in the array describes the quality at the bottom (vertical) or right (horizontal) edge of screen space.
 | 
			
		||||
 All other samples are spaced equidistant in screen space.
 | 
			
		||||
 MTLRasterizationRateLayerDescriptor instances will be stored inside a MTLRasterizationRateMapDescriptor which in turn is compiled by MTLDevice into a MTLRasterizationRateMap.
 | 
			
		||||
 Because MTLDevice may not support the requested granularity, the provided samples may be rounded up (towards higher quality) during compilation.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
 | 
			
		||||
@interface MTLRasterizationRateLayerDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method init
 | 
			
		||||
 @abstract Do not use, instead use initWithNumSamples:
 | 
			
		||||
 */
 | 
			
		||||
- (instancetype)init API_UNAVAILABLE(macos, ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method initWithSampleCount:
 | 
			
		||||
 @abstract Initialize a descriptor for a layer with the given number of quality samples on the horizontal and vertical axis.
 | 
			
		||||
 @param sampleCount The width and height components are the number of samples on the horizontal and vertical axis respectively. The depth component is ignored.
 | 
			
		||||
 @discussion All values are initialized to zero.
 | 
			
		||||
 */
 | 
			
		||||
- (instancetype)initWithSampleCount:(MTLSize)sampleCount NS_DESIGNATED_INITIALIZER;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method initWithSampleCount:horizontal:vertical:
 | 
			
		||||
 @abstract Initialize a descriptor for a layer with the given number of quality samples on the horizontal and vertical axis.
 | 
			
		||||
 @param sampleCount The width and height components are the number of samples on the horizontal and vertical axis respectively. The depth component is ignored.
 | 
			
		||||
 @param horizontal The initial sample values on the horizontal axis. Must point to an array of sampleCount.width elements, of which the values will be copied into the MTLRasterizationRateLayerDescriptor.
 | 
			
		||||
 @param vertical The initial sample values on the vertical axis. Must point to an array of sampleCount.height elements, of which the values will be copied into the MTLRasterizationRateLayerDescriptor.
 | 
			
		||||
 @discussion Use initWithSampleCount: to initialize with zeroes instead.
 | 
			
		||||
 */
 | 
			
		||||
- (instancetype)initWithSampleCount:(MTLSize)sampleCount horizontal:(const float *)horizontal vertical:(const float *)vertical;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleCount
 | 
			
		||||
 @return The number of quality samples that this descriptor uses to describe its current function, for the horizontal and vertical axis. The depth component of the returned MTLSize is always 0.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) MTLSize sampleCount API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxSampleCount
 | 
			
		||||
 @return The maximum number of quality samples that this descriptor can use to describe its function, for the horizontal and vertical axis, this is the sampleCount that the descriptor was initialized with. The depth component of the returned MTLSize is always 0.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) MTLSize maxSampleCount API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property horizontalSampleStorage
 | 
			
		||||
 @abstract Provide direct access to the quality samples stored in the descriptor.
 | 
			
		||||
 @return Pointer to the (mutable) storage array for samples on the horizontal axis.
 | 
			
		||||
 @discussion The returned pointer points to the first element of an array of sampleCount.width elements.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) float* horizontalSampleStorage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property verticalSampleStorage
 | 
			
		||||
 @abstract Provide direct access to the quality samples stored in the descriptor.
 | 
			
		||||
 @return Pointer to the (mutable) storage array for samples on the vertical axis.
 | 
			
		||||
 @discussion The returned pointer points to the first element of an array of sampleCount.height elements.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) float* verticalSampleStorage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property horizontal
 | 
			
		||||
 @abstract Provide convenient bounds-checked access to the quality samples stored in the descriptor.
 | 
			
		||||
 @return Returns a syntactic sugar helper to get or set sample values on the horizontal axis.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) MTLRasterizationRateSampleArray* horizontal;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property vertical
 | 
			
		||||
 @abstract Provide convenient bounds-checked access to the quality samples stored in the descriptor.
 | 
			
		||||
 @return Returns a syntactic sugar helper to get or set sample values on the vertical axis.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) MTLRasterizationRateSampleArray* vertical;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
@interface MTLRasterizationRateLayerDescriptor()
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleCount
 | 
			
		||||
 @abstract This declaration adds a setter to the previously (prior to macOS 12.0 and iOS 15.0) read-only property.
 | 
			
		||||
 @discussion Setting a value (must be <= maxSampleCount) to allow MTLRasterizationRateLayerDescriptor to be re-used with a different number of samples without having to be recreated.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLSize sampleCount API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLRasterizationRateLayerArray
 | 
			
		||||
 @abstract Mutable array of MTLRasterizationRateLayerDescriptor
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
 | 
			
		||||
@interface MTLRasterizationRateLayerArray : NSObject
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method objectAtIndexedSubscript:
 | 
			
		||||
 @return The MTLRasterizationRateLayerDescriptor instance for the given layerIndex, or nil if no instance hasn't been set for this index.
 | 
			
		||||
 @discussion Use setObject:atIndexedSubscript: to set the layer
 | 
			
		||||
 */
 | 
			
		||||
- (MTLRasterizationRateLayerDescriptor* _Nullable)objectAtIndexedSubscript:(NSUInteger)layerIndex;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setObject:atIndexedSubscript:
 | 
			
		||||
 @abstract Sets the MTLRasterizationRateLayerDescriptor instance for the given layerIndex.
 | 
			
		||||
 @discussion The previous instance at this index will be overwritten.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setObject:(MTLRasterizationRateLayerDescriptor* _Nullable)layer atIndexedSubscript:(NSUInteger)layerIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @interface MTLRasterizationRateMapDescriptor
 | 
			
		||||
 @abstract Describes a MTLRasterizationRateMap containing an arbitrary number of MTLRasterizationRateLayerDescriptor instances.
 | 
			
		||||
 @discussion An MTLRasterizationRateMapDescriptor is compiled into an MTLRasterizationRateMap using MTLDevice.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
 | 
			
		||||
@interface MTLRasterizationRateMapDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method rasterizationRateMapDescriptorWithScreenSize:
 | 
			
		||||
 @abstract Convenience descriptor creation function without layers
 | 
			
		||||
 @param screenSize The dimensions, in screen space pixels, of the region where variable rasterization is applied. The depth component of MTLSize is ignored.
 | 
			
		||||
 @return A descriptor containing no layers. Add or remove layers using setObject:atIndexedSubscript:.
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLRasterizationRateMapDescriptor*)rasterizationRateMapDescriptorWithScreenSize:(MTLSize)screenSize;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method rasterizationRateMapDescriptorWithScreenSize:layer:
 | 
			
		||||
 @abstract Convenience descriptor creation function for a single layer.
 | 
			
		||||
 @param screenSize The dimensions, in screen space pixels, of the region where variable rasterization is applied. The depth component of MTLSize is ignored.
 | 
			
		||||
 @param layer The single layer describing how the rasterization rate varies in screen space
 | 
			
		||||
 @return A descriptor containing a single layer. Add or remove layers using setObject:atIndexedSubscript:.
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLRasterizationRateMapDescriptor*)rasterizationRateMapDescriptorWithScreenSize:(MTLSize)screenSize layer:(MTLRasterizationRateLayerDescriptor * _Nonnull)layer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:
 | 
			
		||||
 @abstract Convenience descriptor creation function for an arbitrary amount of layers stored in a C-array.
 | 
			
		||||
 @param screenSize The dimensions, in screen space pixels, of the region where variable rasterization is applied. The depth component of MTLSize is ignored.
 | 
			
		||||
 @param layerCount The number of layers in the descriptor.
 | 
			
		||||
 @param layers An array of pointers to layer descriptors. The array must contain layerCount non-null pointers to MTLRasterizationRateLayerDescriptor instances.
 | 
			
		||||
 @return A descriptor containing all the specified layers. Add or remove layers using setObject:atIndexedSubscript:.
 | 
			
		||||
 @discussion The function copies the array of pointers internally, the caller need not keep the array alive after creating the descriptor.
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLRasterizationRateMapDescriptor*)rasterizationRateMapDescriptorWithScreenSize:(MTLSize)screenSize layerCount:(NSUInteger)layerCount layers:(MTLRasterizationRateLayerDescriptor * const  _Nonnull * _Nonnull)layers;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method layerAtIndex:
 | 
			
		||||
 @return The MTLRasterizationRateLayerDescriptor instance for the given layerIndex, or nil if no instance hasn't been set for this index.
 | 
			
		||||
 @discussion Use setLayer:atIndex: to add or set the layer.
 | 
			
		||||
 Identical to "layers[layerIndex]".
 | 
			
		||||
 */
 | 
			
		||||
- (MTLRasterizationRateLayerDescriptor* _Nullable)layerAtIndex:(NSUInteger)layerIndex;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setLayer:atIndex:
 | 
			
		||||
 @abstract Sets the MTLRasterizationRateLayerDescriptor instance for the given layerIndex.
 | 
			
		||||
 @discussion The previous instance at the index, if any, will be overwritten.
 | 
			
		||||
 Set nil to an index to remove the layer at that index from the descriptor.
 | 
			
		||||
 Identical to "layers[layerIndex] = layer".
 | 
			
		||||
 */
 | 
			
		||||
- (void)setLayer:(MTLRasterizationRateLayerDescriptor* _Nullable)layer atIndex:(NSUInteger)layerIndex;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property layers
 | 
			
		||||
 @return A modifiable array of layers
 | 
			
		||||
 @discussion Accesses the layers currently stored in the descriptor.
 | 
			
		||||
 Syntactic sugar around "layerAtIndex:" and "setLayer:atIndex:"
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, readonly) MTLRasterizationRateLayerArray* layers;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property screenSize
 | 
			
		||||
 @return The dimensions, in screen space pixels, of the region where variable rasterization is applied.
 | 
			
		||||
 @discussion The region always has its origin at [0, 0].
 | 
			
		||||
 The depth component of MTLSize is ignored.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSize screenSize;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 @discussion The default value is nil.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString* label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property layerCount
 | 
			
		||||
 @return The number of subsequent non-nil layer instances stored in the descriptor, starting at index 0.
 | 
			
		||||
 @discussion This property is modified by setting new layer instances using setLayer:atIndex: or assigning to layers[X]
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic, readonly) NSUInteger layerCount;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLRasterizationRateMap
 | 
			
		||||
 @abstract Compiled read-only object that determines how variable rasterization rate is applied when rendering.
 | 
			
		||||
 @discussion A variable rasterization rate map is compiled by MTLDevice from a MTLRasterizationRateMapDescriptor containing one or more MTLRasterizationRateLayerDescriptor.
 | 
			
		||||
 During compilation, the quality samples provided in the MTLRasterizationRateLayerDescriptor may be rounded up to the nearest supported value or granularity, depending on hardware support.
 | 
			
		||||
 However, the compilation will never round values down, so the actual rasterization will always happen at a quality level matching or exceeding the provided quality samples.
 | 
			
		||||
 During rasterization using the MTLRasterizationRateMap the screen space rendering is stored in a smaller area of the framebuffer, such that lower quality regions will not occupy as many texels as higher quality regions.
 | 
			
		||||
 The quality will never exceed 1:1 in any region of screen space.
 | 
			
		||||
 Because a smaller area of the framebuffer is populated, less fragment shader invocations are required to render content, and less bandwidth is consumed to store the shaded values.
 | 
			
		||||
 Use a rasterization rate map to reduce rendering quality in less-important or less-sampled regions of the framebuffer, such as the periphery of a VR/AR display or a far-away cascade of a shadow map.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4))
 | 
			
		||||
@protocol MTLRasterizationRateMap <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @return The device on which the rasterization rate map was created
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id<MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property screenSize
 | 
			
		||||
 @return The dimensions, in screen space pixels, of the region where variable rasterization is applied.
 | 
			
		||||
 @discussion The region always has its origin at [0, 0].
 | 
			
		||||
 The depth component of the returned MTLSize is always 0.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLSize screenSize;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property physicalGranularity
 | 
			
		||||
 @return The granularity, in physical pixels, at which variable rasterization rate varies.
 | 
			
		||||
 @discussion Rendering algorithms that use binning or tiling in screen space may want to determine the screen space bin size using this value.
 | 
			
		||||
 The depth component of the returned MTLSize is always 0.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLSize physicalGranularity;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property layerCount
 | 
			
		||||
 @return The number of different configured layers in the rasterization map.
 | 
			
		||||
 @discussion Different render-target layers may target different variable rasterization configurations.
 | 
			
		||||
 The rasterization rate layer for a primitive is selected on the [[render_target_layer_index]].
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger layerCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property parameterBufferSizeAndAlign
 | 
			
		||||
 @abstract Returns the size and alignment requirements of the parameter buffer for this rate map.
 | 
			
		||||
 @discussion The parameter data can be copied into a buffer with this size and alignment using copyParameterDataToBuffer:offset:
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLSizeAndAlign parameterBufferSizeAndAlign;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method copyParameterDataToBuffer:offset:
 | 
			
		||||
 @abstract Copy the parameter data into the provided buffer at the provided offset.
 | 
			
		||||
 @discussion The buffer must have storageMode MTLStorageModeShared, and a size of at least parameterBufferSizeAndAlign.size + offset.
 | 
			
		||||
 The specified offset must be a multiple of parameterBufferSize.align.
 | 
			
		||||
 The buffer can be bound to a shader stage to map screen space to physical fragment space, or vice versa.
 | 
			
		||||
 */
 | 
			
		||||
- (void)copyParameterDataToBuffer:(id<MTLBuffer>)buffer offset:(NSUInteger)offset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method getPhysicalSizeForLayer:
 | 
			
		||||
 @abstract The dimensions, in physical fragments, of the area in the render target where variable rasterization is applied
 | 
			
		||||
 @discussion Different configured layers may have a different rasterization rate and may have different size after rendering.
 | 
			
		||||
 The rasterization rate layer for a primitive is selected on the [[render_target_layer_index]].
 | 
			
		||||
 */
 | 
			
		||||
- (MTLSize)physicalSizeForLayer:(NSUInteger)layerIndex;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method mapScreenToPhysicalCoordinates:forLayer:
 | 
			
		||||
 @abstract Computes where an offset relative to the top-left of screen space, in screen space pixels, would end up in the framebuffer, in physical fragments.
 | 
			
		||||
 The returned value is less-or-equal the input value because the rasterization quality never exceeds 1:1 in any region.
 | 
			
		||||
 */
 | 
			
		||||
- (MTLCoordinate2D)mapScreenToPhysicalCoordinates:(MTLCoordinate2D)screenCoordinates
 | 
			
		||||
                                         forLayer:(NSUInteger)layerIndex;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method mapPhysicalToScreenCoordinates:forLayer:
 | 
			
		||||
 @abstract Computes where an offset relative to the top-left of the framebuffer, in physical pixels, would end up in screen space, in screen space pixels.
 | 
			
		||||
 The returned value is greater-or-equal the input value because the rasterization quality never exceeds 1:1 in any region.
 | 
			
		||||
 */
 | 
			
		||||
- (MTLCoordinate2D)mapPhysicalToScreenCoordinates:(MTLCoordinate2D)physicalCoordinates
 | 
			
		||||
                                         forLayer:(NSUInteger)layerIndex;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,830 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLRenderCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLCommandBuffer.h>
 | 
			
		||||
#import <Metal/MTLRenderPass.h>
 | 
			
		||||
#import <Metal/MTLFence.h>
 | 
			
		||||
#import <Metal/MTLStageInputOutputDescriptor.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
@protocol MTLFunction;
 | 
			
		||||
@protocol MTLBuffer;
 | 
			
		||||
@protocol MTLSamplerState;
 | 
			
		||||
 | 
			
		||||
@protocol MTLDepthStencilState;
 | 
			
		||||
@protocol MTLTexture;
 | 
			
		||||
@protocol MTLRenderPipelineState;
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLPrimitiveType) {
 | 
			
		||||
    MTLPrimitiveTypePoint = 0,
 | 
			
		||||
    MTLPrimitiveTypeLine = 1,
 | 
			
		||||
    MTLPrimitiveTypeLineStrip = 2,
 | 
			
		||||
    MTLPrimitiveTypeTriangle = 3,
 | 
			
		||||
    MTLPrimitiveTypeTriangleStrip = 4,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLVisibilityResultMode) {
 | 
			
		||||
    MTLVisibilityResultModeDisabled = 0,
 | 
			
		||||
    MTLVisibilityResultModeBoolean = 1,
 | 
			
		||||
    MTLVisibilityResultModeCounting API_AVAILABLE(macos(10.11), ios(9.0)) = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    NSUInteger x, y, width, height;
 | 
			
		||||
} MTLScissorRect;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    double originX, originY, width, height, znear, zfar;
 | 
			
		||||
} MTLViewport;
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLCullMode) {
 | 
			
		||||
    MTLCullModeNone = 0,
 | 
			
		||||
    MTLCullModeFront = 1,
 | 
			
		||||
    MTLCullModeBack = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLWinding) {
 | 
			
		||||
    MTLWindingClockwise = 0,
 | 
			
		||||
    MTLWindingCounterClockwise = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLDepthClipMode) {
 | 
			
		||||
    MTLDepthClipModeClip = 0,
 | 
			
		||||
    MTLDepthClipModeClamp = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLTriangleFillMode) {
 | 
			
		||||
    MTLTriangleFillModeFill = 0,
 | 
			
		||||
    MTLTriangleFillModeLines = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint32_t vertexCount;
 | 
			
		||||
    uint32_t instanceCount;
 | 
			
		||||
    uint32_t vertexStart;
 | 
			
		||||
    uint32_t baseInstance;
 | 
			
		||||
} MTLDrawPrimitivesIndirectArguments;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint32_t indexCount;
 | 
			
		||||
    uint32_t instanceCount;
 | 
			
		||||
    uint32_t indexStart;
 | 
			
		||||
    int32_t  baseVertex;
 | 
			
		||||
    uint32_t baseInstance;
 | 
			
		||||
} MTLDrawIndexedPrimitivesIndirectArguments;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint32_t viewportArrayIndexOffset;
 | 
			
		||||
    uint32_t renderTargetArrayIndexOffset;
 | 
			
		||||
} MTLVertexAmplificationViewMapping API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint32_t patchCount;
 | 
			
		||||
    uint32_t instanceCount;
 | 
			
		||||
    uint32_t patchStart;
 | 
			
		||||
    uint32_t baseInstance;
 | 
			
		||||
} MTLDrawPatchIndirectArguments;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    /* NOTE: edgeTessellationFactor and insideTessellationFactor are interpreted as half (16-bit floats) */
 | 
			
		||||
    uint16_t edgeTessellationFactor[4];
 | 
			
		||||
    uint16_t insideTessellationFactor[2];
 | 
			
		||||
} MTLQuadTessellationFactorsHalf;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    /* NOTE: edgeTessellationFactor and insideTessellationFactor are interpreted as half (16-bit floats) */
 | 
			
		||||
    uint16_t edgeTessellationFactor[3];
 | 
			
		||||
    uint16_t insideTessellationFactor;
 | 
			
		||||
} MTLTriangleTessellationFactorsHalf;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @abstract Generic render stage enum
 | 
			
		||||
 @brief Can also be used for points at which a fence may be waited on or signaled.
 | 
			
		||||
 @constant MTLRenderStageVertex   All vertex work prior to rasterization has completed.
 | 
			
		||||
 @constant MTLRenderStageFragment All rendering work has completed.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLRenderStages)
 | 
			
		||||
{
 | 
			
		||||
    MTLRenderStageVertex   = (1UL << 0),
 | 
			
		||||
    MTLRenderStageFragment = (1UL << 1),
 | 
			
		||||
    MTLRenderStageTile API_AVAILABLE(macos(12.0), ios(15.0)) = (1UL << 2),
 | 
			
		||||
} API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLRenderCommandEncoder
 | 
			
		||||
 @discussion MTLRenderCommandEncoder is a container for graphics rendering state and the code to translate the state into a command format that the device can execute. 
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
 | 
			
		||||
@protocol MTLRenderCommandEncoder <MTLCommandEncoder>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setRenderPipelineState
 | 
			
		||||
 @brief Sets the current render pipeline state object.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setRenderPipelineState:(id <MTLRenderPipelineState>)pipelineState;
 | 
			
		||||
 | 
			
		||||
/* Vertex Resources */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexBytes:length:atIndex:
 | 
			
		||||
 @brief Set the data (by copy) for a given vertex buffer binding point.  This will remove any existing MTLBuffer from the binding point.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexBytes:(const void *)bytes length:(NSUInteger)length atIndex:(NSUInteger)index API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexBuffer:offset:atIndex:
 | 
			
		||||
 @brief Set a global buffer for all vertex shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexBufferOffset:atIndex:
 | 
			
		||||
 @brief Set the offset within the current global buffer for all vertex shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexBufferOffset:(NSUInteger)offset atIndex:(NSUInteger)index API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexBuffers:offsets:withRange:
 | 
			
		||||
 @brief Set an array of global buffers for all vertex shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexBuffers:(const id <MTLBuffer> __nullable [__nonnull])buffers offsets:(const NSUInteger [__nonnull])offsets withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexTexture:atIndex:
 | 
			
		||||
 @brief Set a global texture for all vertex shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexTexture:(nullable id <MTLTexture>)texture atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexTextures:withRange:
 | 
			
		||||
 @brief Set an array of global textures for all vertex shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexTextures:(const id <MTLTexture> __nullable [__nonnull])textures withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexSamplerState:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all vertex shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexSamplerState:(nullable id <MTLSamplerState>)sampler atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexSamplerStates:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all vertex shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexSamplerState:lodMinClamp:lodMaxClamp:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all vertex shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexSamplerState:(nullable id <MTLSamplerState>)sampler lodMinClamp:(float)lodMinClamp lodMaxClamp:(float)lodMaxClamp atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexSamplerStates:lodMinClamps:lodMaxClamps:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all vertex shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers lodMinClamps:(const float [__nonnull])lodMinClamps lodMaxClamps:(const float [__nonnull])lodMaxClamps withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexVisibleFunctionTable:atBufferIndex:
 | 
			
		||||
 @brief Set a global visible function table for all vertex shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexVisibleFunctionTable:(nullable id <MTLVisibleFunctionTable>)functionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexVisibleFunctionTables:withBufferRange:
 | 
			
		||||
 @brief Set an array of global visible function tables for all vertex shaders with the given buffer bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexVisibleFunctionTables:(const id <MTLVisibleFunctionTable> __nullable [__nonnull])functionTables withBufferRange:(NSRange)range API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexIntersectionFunctionTable:atBufferIndex:
 | 
			
		||||
 @brief Set a global intersection function table for all vertex shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexIntersectionFunctionTable:(nullable id <MTLIntersectionFunctionTable>)intersectionFunctionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexIntersectionFunctionTables:withBufferRange:
 | 
			
		||||
 @brief Set an array of global intersection function tables for all vertex shaders with the given buffer bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexIntersectionFunctionTables:(const id <MTLIntersectionFunctionTable> __nullable [__nonnull])intersectionFunctionTable withBufferRange:(NSRange)range API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexAccelerationStructure:atBufferIndex:
 | 
			
		||||
 @brief Set a global acceleration structure for all vertex shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexAccelerationStructure:(nullable id <MTLAccelerationStructure>)accelerationStructure atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setViewport:
 | 
			
		||||
 @brief Set the viewport, which is used to transform vertexes from normalized device coordinates to window coordinates.  Fragments that lie outside of the viewport are clipped, and optionally clamped for fragments outside of znear/zfar.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setViewport:(MTLViewport)viewport;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setViewports:
 | 
			
		||||
 @brief Specifies an array of viewports, which are used to transform vertices from normalized device coordinates to window coordinates based on [[ viewport_array_index ]] value specified in the vertex shader.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setViewports:(const MTLViewport [__nonnull])viewports count:(NSUInteger)count API_AVAILABLE(macos(10.13), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFrontFacingWinding:
 | 
			
		||||
 @brief The winding order of front-facing primitives.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFrontFacingWinding:(MTLWinding)frontFacingWinding;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVertexAmplificationCount:
 | 
			
		||||
 @brief Specifies the vertex amplification count and associated view mappings for each amplification ID.
 | 
			
		||||
 @param count the amplification count. The maximum value is currently 2.
 | 
			
		||||
 @param viewMappings an array of mapping elements.
 | 
			
		||||
 @discussion Each mapping element describes how to route the corresponding amplification ID to a specific viewport and render target array index by using offsets from the base array index provided by the [[render_target_array_index]] and/or [[viewport_array_index]] output attributes in the vertex shader. This allows a modicum of programmability for each amplified vertex to be routed to a different [[render_target_array_index]] and [[viewport_array_index]] even though these attribytes cannot be amplified themselves.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVertexAmplificationCount:(NSUInteger)count viewMappings:(nullable const MTLVertexAmplificationViewMapping *)viewMappings API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setCullMode:
 | 
			
		||||
 @brief Controls if primitives are culled when front facing, back facing, or not culled at all.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setCullMode:(MTLCullMode)cullMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
@method setDepthClipMode:
 | 
			
		||||
@brief Controls what is done with fragments outside of the near or far planes.
 | 
			
		||||
*/
 | 
			
		||||
- (void)setDepthClipMode:(MTLDepthClipMode)depthClipMode API_AVAILABLE(macos(10.11), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setDepthBias:slopeScale:clamp:
 | 
			
		||||
 @brief Depth Bias.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setDepthBias:(float)depthBias slopeScale:(float)slopeScale clamp:(float)clamp;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setScissorRect:
 | 
			
		||||
 @brief Specifies a rectangle for a fragment scissor test.  All fragments outside of this rectangle are discarded.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setScissorRect:(MTLScissorRect)rect;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setScissorRects:
 | 
			
		||||
 @brief Specifies an array of rectangles for a fragment scissor test. The specific rectangle used is based on the [[ viewport_array_index ]] value output by the vertex shader. Fragments that lie outside the scissor rectangle are discarded.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setScissorRects:(const MTLScissorRect [__nonnull])scissorRects count:(NSUInteger)count API_AVAILABLE(macos(10.13), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTriangleFillMode:
 | 
			
		||||
 @brief Set how to rasterize triangle and triangle strip primitives.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTriangleFillMode:(MTLTriangleFillMode)fillMode;
 | 
			
		||||
 | 
			
		||||
/* Fragment Resources */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentBytes:length:atIndex:
 | 
			
		||||
 @brief Set the data (by copy) for a given fragment buffer binding point.  This will remove any existing MTLBuffer from the binding point.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentBytes:(const void *)bytes length:(NSUInteger)length atIndex:(NSUInteger)index API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentBuffer:offset:atIndex:
 | 
			
		||||
 @brief Set a global buffer for all fragment shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentBufferOffset:atIndex:
 | 
			
		||||
 @brief Set the offset within the current global buffer for all fragment shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentBufferOffset:(NSUInteger)offset atIndex:(NSUInteger)index API_AVAILABLE(macos(10.11), ios(8.3));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentBuffers:offsets:withRange:
 | 
			
		||||
 @brief Set an array of global buffers for all fragment shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentBuffers:(const id <MTLBuffer> __nullable [__nonnull])buffers offsets:(const NSUInteger [__nonnull])offsets withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentTexture:atIndex:
 | 
			
		||||
 @brief Set a global texture for all fragment shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentTexture:(nullable id <MTLTexture>)texture atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentTextures:withRange:
 | 
			
		||||
 @brief Set an array of global textures for all fragment shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentTextures:(const id <MTLTexture> __nullable [__nonnull])textures withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentSamplerState:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all fragment shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentSamplerState:(nullable id <MTLSamplerState>)sampler atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentSamplerStates:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all fragment shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentSamplerState:lodMinClamp:lodMaxClamp:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all fragment shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentSamplerState:(nullable id <MTLSamplerState>)sampler lodMinClamp:(float)lodMinClamp lodMaxClamp:(float)lodMaxClamp atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all fragment shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers lodMinClamps:(const float [__nonnull])lodMinClamps lodMaxClamps:(const float [__nonnull])lodMaxClamps withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentVisibleFunctionTable:atBufferIndex:
 | 
			
		||||
 @brief Set a global visible function table for all fragment shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentVisibleFunctionTable:(nullable id <MTLVisibleFunctionTable>)functionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentVisibleFunctionTables:withBufferRange:
 | 
			
		||||
 @brief Set an array of global visible function tables for all fragment shaders with the given buffer bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentVisibleFunctionTables:(const id <MTLVisibleFunctionTable> __nullable [__nonnull])functionTables withBufferRange:(NSRange)range API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentIntersectionFunctionTable:atBufferIndex:
 | 
			
		||||
 @brief Set a global intersection function table for all fragment shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentIntersectionFunctionTable:(nullable id <MTLIntersectionFunctionTable>)intersectionFunctionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentIntersectionFunctionTables:withBufferRange:
 | 
			
		||||
 @brief Set an array of global intersection function tables for all fragment shaders with the given buffer bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentIntersectionFunctionTables:(const id <MTLIntersectionFunctionTable> __nullable [__nonnull])intersectionFunctionTable withBufferRange:(NSRange)range API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setFragmentAccelerationStructure:atBufferIndex:
 | 
			
		||||
 @brief Set a global acceleration structure for all fragment shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setFragmentAccelerationStructure:(nullable id <MTLAccelerationStructure>)accelerationStructure atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/* Constant Blend Color */
 | 
			
		||||
/*!
 | 
			
		||||
 @method setBlendColorRed:green:blue:alpha:
 | 
			
		||||
 @brief Set the constant blend color used across all blending on all render targets
 | 
			
		||||
 */
 | 
			
		||||
- (void)setBlendColorRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
 | 
			
		||||
 | 
			
		||||
/*! 
 | 
			
		||||
 @method setDepthStencilState:
 | 
			
		||||
 @brief Set the DepthStencil state object.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setDepthStencilState:(nullable id <MTLDepthStencilState>)depthStencilState;
 | 
			
		||||
 | 
			
		||||
/*! 
 | 
			
		||||
 @method setStencilReferenceValue:
 | 
			
		||||
 @brief Set the stencil reference value for both the back and front stencil buffers.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setStencilReferenceValue:(uint32_t)referenceValue;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setStencilFrontReferenceValue:backReferenceValue:
 | 
			
		||||
 @brief Set the stencil reference value for the back and front stencil buffers independently.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setStencilFrontReferenceValue:(uint32_t)frontReferenceValue backReferenceValue:(uint32_t)backReferenceValue API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setVisibilityResultMode:offset:
 | 
			
		||||
 @abstract Monitor if samples pass the depth and stencil tests.
 | 
			
		||||
 @param mode Controls if the counter is disabled or moniters passing samples.
 | 
			
		||||
 @param offset The offset relative to the occlusion query buffer provided when the command encoder was created.  offset must be a multiple of 8.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setVisibilityResultMode:(MTLVisibilityResultMode)mode offset:(NSUInteger)offset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setColorStoreAction:atIndex:
 | 
			
		||||
 @brief If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setColorStoreAction:atIndex: must be used to finalize the store action before endEncoding is called.
 | 
			
		||||
 @param storeAction The desired store action for the given color attachment.  This may be set to any value other than MTLStoreActionUnknown.
 | 
			
		||||
 @param colorAttachmentIndex The index of the color attachment
 | 
			
		||||
*/
 | 
			
		||||
- (void)setColorStoreAction:(MTLStoreAction)storeAction atIndex:(NSUInteger)colorAttachmentIndex API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setDepthStoreAction:
 | 
			
		||||
 @brief If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setDepthStoreAction: must be used to finalize the store action before endEncoding is called.
 | 
			
		||||
*/
 | 
			
		||||
- (void)setDepthStoreAction:(MTLStoreAction)storeAction API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setStencilStoreAction:
 | 
			
		||||
 @brief If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setStencilStoreAction: must be used to finalize the store action before endEncoding is called.
 | 
			
		||||
*/
 | 
			
		||||
- (void)setStencilStoreAction:(MTLStoreAction)storeAction API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setColorStoreActionOptions:atIndex:
 | 
			
		||||
 @brief If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setColorStoreActionOptions:atIndex: may be used to finalize the store action options before endEncoding is called.
 | 
			
		||||
 @param storeActionOptions The desired store action options for the given color attachment.
 | 
			
		||||
 @param colorAttachmentIndex The index of the color attachment
 | 
			
		||||
 */
 | 
			
		||||
- (void)setColorStoreActionOptions:(MTLStoreActionOptions)storeActionOptions atIndex:(NSUInteger)colorAttachmentIndex API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setDepthStoreActionOptions:
 | 
			
		||||
 @brief If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setDepthStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setDepthStoreActionOptions:(MTLStoreActionOptions)storeActionOptions API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setStencilStoreActionOptions:
 | 
			
		||||
 @brief If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
 | 
			
		||||
 setStencilStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setStencilStoreActionOptions:(MTLStoreActionOptions)storeActionOptions API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/* Drawing */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawPrimitives:vertexStart:vertexCount:instanceCount:
 | 
			
		||||
 @brief Draw primitives without an index list.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param vertexStart For each instance, the first index to draw
 | 
			
		||||
 @param vertexCount For each instance, the number of indexes to draw
 | 
			
		||||
 @param instanceCount The number of instances drawn.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawPrimitives:(MTLPrimitiveType)primitiveType vertexStart:(NSUInteger)vertexStart vertexCount:(NSUInteger)vertexCount instanceCount:(NSUInteger)instanceCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawPrimitives:vertexStart:vertexCount:
 | 
			
		||||
 @brief Draw primitives without an index list.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param vertexStart For each instance, the first index to draw
 | 
			
		||||
 @param vertexCount For each instance, the number of indexes to draw
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawPrimitives:(MTLPrimitiveType)primitiveType vertexStart:(NSUInteger)vertexStart vertexCount:(NSUInteger)vertexCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:
 | 
			
		||||
 @brief Draw primitives with an index list.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param indexCount The number of indexes to read from the index buffer for each instance.
 | 
			
		||||
 @param indexType The type if indexes, either 16 bit integer or 32 bit integer.
 | 
			
		||||
 @param indexBuffer A buffer object that the device will read indexes from.
 | 
			
		||||
 @param indexBufferOffset Byte offset within @a indexBuffer to start reading indexes from.  @a indexBufferOffset must be a multiple of the index size.
 | 
			
		||||
 @param instanceCount The number of instances drawn.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawIndexedPrimitives:(MTLPrimitiveType)primitiveType indexCount:(NSUInteger)indexCount indexType:(MTLIndexType)indexType indexBuffer:(id <MTLBuffer>)indexBuffer indexBufferOffset:(NSUInteger)indexBufferOffset instanceCount:(NSUInteger)instanceCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:
 | 
			
		||||
 @brief Draw primitives with an index list.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param indexCount The number of indexes to read from the index buffer for each instance.
 | 
			
		||||
 @param indexType The type if indexes, either 16 bit integer or 32 bit integer.
 | 
			
		||||
 @param indexBuffer A buffer object that the device will read indexes from.
 | 
			
		||||
 @param indexBufferOffset Byte offset within @a indexBuffer to start reading indexes from.  @a indexBufferOffset must be a multiple of the index size.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawIndexedPrimitives:(MTLPrimitiveType)primitiveType indexCount:(NSUInteger)indexCount indexType:(MTLIndexType)indexType indexBuffer:(id <MTLBuffer>)indexBuffer indexBufferOffset:(NSUInteger)indexBufferOffset;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:
 | 
			
		||||
 @brief Draw primitives without an index list.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param vertexStart For each instance, the first index to draw
 | 
			
		||||
 @param vertexCount For each instance, the number of indexes to draw
 | 
			
		||||
 @param instanceCount The number of instances drawn.
 | 
			
		||||
 @param baseInstance Offset for instance_id.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawPrimitives:(MTLPrimitiveType)primitiveType vertexStart:(NSUInteger)vertexStart vertexCount:(NSUInteger)vertexCount instanceCount:(NSUInteger)instanceCount baseInstance:(NSUInteger)baseInstance API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:
 | 
			
		||||
 @brief Draw primitives with an index list.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param indexCount The number of indexes to read from the index buffer for each instance.
 | 
			
		||||
 @param indexType The type if indexes, either 16 bit integer or 32 bit integer.
 | 
			
		||||
 @param indexBuffer A buffer object that the device will read indexes from.
 | 
			
		||||
 @param indexBufferOffset Byte offset within @a indexBuffer to start reading indexes from.  @a indexBufferOffset must be a multiple of the index size.
 | 
			
		||||
 @param instanceCount The number of instances drawn.
 | 
			
		||||
 @param baseVertex Offset for vertex_id. NOTE: this can be negative
 | 
			
		||||
 @param baseInstance Offset for instance_id.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawIndexedPrimitives:(MTLPrimitiveType)primitiveType indexCount:(NSUInteger)indexCount indexType:(MTLIndexType)indexType indexBuffer:(id <MTLBuffer>)indexBuffer indexBufferOffset:(NSUInteger)indexBufferOffset instanceCount:(NSUInteger)instanceCount baseVertex:(NSInteger)baseVertex baseInstance:(NSUInteger)baseInstance API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawPrimitives:indirectBuffer:indirectBufferOffset:
 | 
			
		||||
 @brief Draw primitives without an index list using an indirect buffer see MTLDrawPrimitivesIndirectArguments.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param indirectBuffer A buffer object that the device will read drawPrimitives arguments from, see MTLDrawPrimitivesIndirectArguments.
 | 
			
		||||
 @param indirectBufferOffset Byte offset within @a indirectBuffer to start reading indexes from.  @a indirectBufferOffset must be a multiple of 4.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawPrimitives:(MTLPrimitiveType)primitiveType indirectBuffer:(id <MTLBuffer>)indirectBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:
 | 
			
		||||
 @brief Draw primitives with an index list using an indirect buffer see MTLDrawIndexedPrimitivesIndirectArguments.
 | 
			
		||||
 @param primitiveType The type of primitives that elements are assembled into.
 | 
			
		||||
 @param indexType The type if indexes, either 16 bit integer or 32 bit integer.
 | 
			
		||||
 @param indexBuffer A buffer object that the device will read indexes from.
 | 
			
		||||
 @param indexBufferOffset Byte offset within @a indexBuffer to start reading indexes from.  @a indexBufferOffset must be a multiple of the index size.
 | 
			
		||||
 @param indirectBuffer A buffer object that the device will read drawIndexedPrimitives arguments from, see MTLDrawIndexedPrimitivesIndirectArguments.
 | 
			
		||||
 @param indirectBufferOffset Byte offset within @a indirectBuffer to start reading indexes from.  @a indirectBufferOffset must be a multiple of 4.
 | 
			
		||||
 */
 | 
			
		||||
- (void)drawIndexedPrimitives:(MTLPrimitiveType)primitiveType indexType:(MTLIndexType)indexType indexBuffer:(id <MTLBuffer>)indexBuffer indexBufferOffset:(NSUInteger)indexBufferOffset indirectBuffer:(id <MTLBuffer>)indirectBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method textureBarrier
 | 
			
		||||
 @brief Ensure that following fragment shaders can read textures written by previous draw calls (in particular the framebuffer)
 | 
			
		||||
 */
 | 
			
		||||
- (void)textureBarrier API_DEPRECATED_WITH_REPLACEMENT("memoryBarrierWithScope:MTLBarrierScopeRenderTargets", macos(10.11, 10.14)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateFence:afterStages:
 | 
			
		||||
 @abstract Update the fence to capture all GPU work so far enqueued by this encoder for the given stages.
 | 
			
		||||
 @discussion Unlike <st>updateFence:</st>, this method will update the fence when the given stage(s) complete, allowing for commands to overlap in execution.
 | 
			
		||||
 On iOS, render command encoder fence updates are always delayed until the end of the encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)updateFence:(id <MTLFence>)fence afterStages:(MTLRenderStages)stages API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitForFence:beforeStages:
 | 
			
		||||
 @abstract Prevent further GPU work until the fence is reached for the given stages.
 | 
			
		||||
 @discussion Unlike <st>waitForFence:</st>, this method will only block commands assoicated with the given stage(s), allowing for commands to overlap in execution.
 | 
			
		||||
 On iOS, render command encoder fence waits always occur the beginning of the encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitForFence:(id <MTLFence>)fence beforeStages:(MTLRenderStages)stages API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
-(void)setTessellationFactorBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset instanceStride:(NSUInteger)instanceStride API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
-(void)setTessellationFactorScale:(float)scale API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
-(void)drawPatches:(NSUInteger)numberOfPatchControlPoints patchStart:(NSUInteger)patchStart patchCount:(NSUInteger)patchCount patchIndexBuffer:(nullable id <MTLBuffer>)patchIndexBuffer patchIndexBufferOffset:(NSUInteger)patchIndexBufferOffset instanceCount:(NSUInteger)instanceCount baseInstance:(NSUInteger)baseInstance API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
-(void)drawPatches:(NSUInteger)numberOfPatchControlPoints patchIndexBuffer:(nullable id <MTLBuffer>)patchIndexBuffer patchIndexBufferOffset:(NSUInteger)patchIndexBufferOffset indirectBuffer:(id <MTLBuffer>)indirectBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(10.12), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
-(void)drawIndexedPatches:(NSUInteger)numberOfPatchControlPoints patchStart:(NSUInteger)patchStart patchCount:(NSUInteger)patchCount patchIndexBuffer:(nullable id <MTLBuffer>)patchIndexBuffer patchIndexBufferOffset:(NSUInteger)patchIndexBufferOffset controlPointIndexBuffer:(id <MTLBuffer>)controlPointIndexBuffer controlPointIndexBufferOffset:(NSUInteger)controlPointIndexBufferOffset instanceCount:(NSUInteger)instanceCount baseInstance:(NSUInteger)baseInstance API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
-(void)drawIndexedPatches:(NSUInteger)numberOfPatchControlPoints patchIndexBuffer:(nullable id <MTLBuffer>)patchIndexBuffer patchIndexBufferOffset:(NSUInteger)patchIndexBufferOffset controlPointIndexBuffer:(id <MTLBuffer>)controlPointIndexBuffer controlPointIndexBufferOffset:(NSUInteger)controlPointIndexBufferOffset indirectBuffer:(id <MTLBuffer>)indirectBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(10.12), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tileWidth:
 | 
			
		||||
 @abstract The width of the tile for this render pass.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger tileWidth API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tileHeight:
 | 
			
		||||
 @abstract The height of the tile for this render pass.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger tileHeight API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/* Tile Resources */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileBytes:length:atIndex:
 | 
			
		||||
 @brief Set the data (by copy) for a given tile buffer binding point.  This will remove any existing MTLBuffer from the binding point.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileBytes:(const void *)bytes length:(NSUInteger)length atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileBuffer:offset:atIndex:
 | 
			
		||||
 @brief Set a global buffer for all tile shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileBuffer:(nullable id <MTLBuffer>)buffer offset:(NSUInteger)offset atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileBufferOffset:atIndex:
 | 
			
		||||
 @brief Set the offset within the current global buffer for all tile shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileBufferOffset:(NSUInteger)offset atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileBuffers:offsets:withRange:
 | 
			
		||||
 @brief Set an array of global buffers for all tile shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileBuffers:(const id <MTLBuffer> __nullable [__nonnull])buffers offsets:(const NSUInteger [__nonnull])offsets withRange:(NSRange)range API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileTexture:atIndex:
 | 
			
		||||
 @brief Set a global texture for all tile shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileTexture:(nullable id <MTLTexture>)texture atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileTextures:withRange:
 | 
			
		||||
 @brief Set an array of global textures for all tile shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileTextures:(const id <MTLTexture> __nullable [__nonnull])textures withRange:(NSRange)range API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileSamplerState:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all tile shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileSamplerState:(nullable id <MTLSamplerState>)sampler atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileSamplerStates:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all fragment shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers withRange:(NSRange)range API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileSamplerState:lodMinClamp:lodMaxClamp:atIndex:
 | 
			
		||||
 @brief Set a global sampler for all tile shaders at the given bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileSamplerState:(nullable id <MTLSamplerState>)sampler lodMinClamp:(float)lodMinClamp lodMaxClamp:(float)lodMaxClamp atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileSamplerStates:lodMinClamps:lodMaxClamps:withRange:
 | 
			
		||||
 @brief Set an array of global samplers for all tile shaders with the given bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileSamplerStates:(const id <MTLSamplerState> __nullable [__nonnull])samplers lodMinClamps:(const float [__nonnull])lodMinClamps lodMaxClamps:(const float [__nonnull])lodMaxClamps withRange:(NSRange)range API_AVAILABLE(ios(11.0), tvos(14.5), macos(11.0), macCatalyst(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileVisibleFunctionTable:atBufferIndex:
 | 
			
		||||
 @brief Set a global visible function table for all tile shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileVisibleFunctionTable:(nullable id <MTLVisibleFunctionTable>)functionTable atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileVisibleFunctionTables:withBufferRange:
 | 
			
		||||
 @brief Set an array of global visible function tables for all tile shaders with the given buffer bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileVisibleFunctionTables:(const id <MTLVisibleFunctionTable> __nullable [__nonnull])functionTables withBufferRange:(NSRange)range API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileIntersectionFunctionTable:atBufferIndex:
 | 
			
		||||
 @brief Set a global intersection function table for all tile shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileIntersectionFunctionTable:(nullable id <MTLIntersectionFunctionTable>)intersectionFunctionTable atBufferIndex:(NSUInteger)bufferIndex
 | 
			
		||||
    API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileIntersectionFunctionTables:withBufferRange:
 | 
			
		||||
 @brief Set an array of global intersection function tables for all tile shaders with the given buffer bind point range.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileIntersectionFunctionTables:(const id <MTLIntersectionFunctionTable> __nullable [__nonnull])intersectionFunctionTable withBufferRange:(NSRange)range API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setTileAccelerationStructure:atBufferIndex:
 | 
			
		||||
 @brief Set a global acceleration structure for all tile shaders at the given buffer bind point index.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setTileAccelerationStructure:(nullable id <MTLAccelerationStructure>)accelerationStructure atBufferIndex:(NSUInteger)bufferIndex API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method dispatchThreadsPerTile:
 | 
			
		||||
 @brief dispatch threads to perform a mid-render compute operation.
 | 
			
		||||
 */
 | 
			
		||||
- (void)dispatchThreadsPerTile:(MTLSize)threadsPerTile API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setThreadgroupMemoryLength:offset:atIndex:
 | 
			
		||||
 @brief Set the size of the threadgroup memory argument at the given bind point index and offset.
 | 
			
		||||
 */
 | 
			
		||||
- (void)setThreadgroupMemoryLength:(NSUInteger)length offset:(NSUInteger)offset atIndex:(NSUInteger)index API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResource:usage:
 | 
			
		||||
 * @abstract Declare that a resource may be accessed by the render pass through an argument buffer
 | 
			
		||||
 * @discussion This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resource through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
 | 
			
		||||
 
 | 
			
		||||
     Note that calling useResource does not retain the resource. It is the responsiblity of the user to retain the resource until
 | 
			
		||||
     the command buffer has been executed.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useResource:(id <MTLResource>)resource usage:(MTLResourceUsage)usage API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResources:count:usage:
 | 
			
		||||
 * @abstract Declare that an array of resources may be accessed through an argument buffer by the render pass
 | 
			
		||||
 * @discussion This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
 | 
			
		||||
 
 | 
			
		||||
   Note that calling useResources does not retain the resources. It is the responsiblity of the user to retain the resources until
 | 
			
		||||
   the command buffer has been executed.
 | 
			
		||||
*/
 | 
			
		||||
- (void)useResources:(const id <MTLResource> __nonnull[__nonnull])resources count:(NSUInteger)count usage:(MTLResourceUsage)usage API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResources:usage:stage
 | 
			
		||||
 * @abstract Declare that a resource may be accessed by the render pass through an argument buffer
 | 
			
		||||
 * @For hazard tracked resources, this method protects against data hazards. This method must be called before encoding any draw commands which may access the resource through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
 | 
			
		||||
 
 | 
			
		||||
    Note that calling useResource does not retain the resource. It is the responsiblity of the user to retain the resource until
 | 
			
		||||
    the command buffer has been executed.
 | 
			
		||||
*/
 | 
			
		||||
- (void)useResource:(id <MTLResource>)resource usage:(MTLResourceUsage)usage stages:(MTLRenderStages) stages API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useResources:count:usage:stages
 | 
			
		||||
 * @abstract Declare that an array of resources may be accessed through an argument buffer by the render pass
 | 
			
		||||
 * @discussion For hazard tracked resources, this method protects against data hazards.  This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
 | 
			
		||||
 
 | 
			
		||||
   Note that calling useResources does not retain the resources. It is the responsiblity of the user to retain the resources until
 | 
			
		||||
   the command buffer has been executed.
 | 
			
		||||
*/
 | 
			
		||||
- (void)useResources:(const id <MTLResource> __nonnull[__nonnull])resources count:(NSUInteger)count usage:(MTLResourceUsage)usage stages:(MTLRenderStages)stages API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeap:
 | 
			
		||||
 * @abstract Declare that the resources allocated from a heap may be accessed by the render pass through an argument buffer
 | 
			
		||||
 * @discussion This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeap:(id <MTLHeap>)heap API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeaps:count:
 | 
			
		||||
 * @abstract Declare that the resources allocated from an array of heaps may be accessed by the render pass through an argument buffer
 | 
			
		||||
 * @discussion This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeaps:(const id <MTLHeap> __nonnull[__nonnull])heaps count:(NSUInteger)count API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeap:stages
 | 
			
		||||
 * @abstract Declare that the resources allocated from a heap may be accessed by the render pass through an argument buffer
 | 
			
		||||
 * @discussion If the heap is tracked, this method protects against hazard tracking; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeap:(id <MTLHeap>)heap stages:(MTLRenderStages)stages API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method useHeaps:count:stages
 | 
			
		||||
 * @abstract Declare that the resources allocated from an array of heaps may be accessed by the render pass through an argument buffer
 | 
			
		||||
 * @discussion This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
 | 
			
		||||
 */
 | 
			
		||||
- (void)useHeaps:(const id <MTLHeap> __nonnull[__nonnull])heaps count:(NSUInteger)count stages:(MTLRenderStages)stages API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method executeCommandsInBuffer:withRange:
 | 
			
		||||
 * @abstract Execute commands in the buffer within the range specified.
 | 
			
		||||
 * @discussion The same indirect command buffer may be executed any number of times within the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)executeCommandsInBuffer:(id<MTLIndirectCommandBuffer>)indirectCommandBuffer withRange:(NSRange)executionRange API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:
 | 
			
		||||
 * @abstract Execute commands in the buffer within the range specified by the indirect range buffer.
 | 
			
		||||
 * @param indirectRangeBuffer An indirect buffer from which the device reads the execution range parameter, as laid out in the MTLIndirectCommandBufferExecutionRange structure.
 | 
			
		||||
 * @param indirectBufferOffset The byte offset within indirectBuffer where the execution range parameter is located. Must be a multiple of 4 bytes.
 | 
			
		||||
 * @discussion The same indirect command buffer may be executed any number of times within the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)executeCommandsInBuffer:(id<MTLIndirectCommandBuffer>)indirectCommandbuffer indirectBuffer:(id<MTLBuffer>)indirectRangeBuffer indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(10.14), macCatalyst(13.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method memoryBarrierWithScope:afterStages:beforeStages:
 | 
			
		||||
 * @abstract Make stores to memory encoded before the barrier coherent with loads from memory encoded after the barrier.
 | 
			
		||||
 * @discussion The barrier makes stores coherent that 1) are to a resource with a type in the given scope, and 2) happen at (or before) the stage given by afterStages. Only affects loads that happen at (or after) the stage given by beforeStages.
 | 
			
		||||
 */
 | 
			
		||||
-(void)memoryBarrierWithScope:(MTLBarrierScope)scope afterStages:(MTLRenderStages)after beforeStages:(MTLRenderStages)before API_AVAILABLE(macos(10.14), macCatalyst(13.0)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @method memoryBarrierWithResources:count:afterStages:beforeStages:
 | 
			
		||||
 * @abstract Make stores to memory encoded before the barrier coherent with loads from memory encoded after the barrier.
 | 
			
		||||
 * @discussion The barrier makes stores coherent that 1) are to resources in given array, and 2) happen at (or before) the stage given by afterStages. Only affects loads that happen at (or after) the stage give by beforeStages.
 | 
			
		||||
 */
 | 
			
		||||
-(void)memoryBarrierWithResources:(const id<MTLResource> __nonnull[__nonnull])resources count:(NSUInteger)count afterStages:(MTLRenderStages)after beforeStages:(MTLRenderStages)before API_AVAILABLE(macos(10.14), macCatalyst(13.0)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method sampleCountersInBuffer:atSampleIndex:withBarrier:
 | 
			
		||||
 @abstract Sample hardware counters at this point in the render encoder and
 | 
			
		||||
 store the counter sample into the sample buffer at the specified index.
 | 
			
		||||
 @param sampleBuffer The sample buffer to sample into
 | 
			
		||||
 @param sampleIndex The index into the counter buffer to write the sample.
 | 
			
		||||
 @param barrier Insert a barrier before taking the sample.  Passing
 | 
			
		||||
 YES will ensure that all work encoded before this operation in the encoder is
 | 
			
		||||
 complete but does not isolate the work with respect to other encoders.  Passing
 | 
			
		||||
 NO will allow the sample to be taken concurrently with other operations in this
 | 
			
		||||
 encoder.
 | 
			
		||||
 In general, passing YES will lead to more repeatable counter results but
 | 
			
		||||
 may negatively impact performance.  Passing NO will generally be higher performance
 | 
			
		||||
 but counter results may not be repeatable.
 | 
			
		||||
 */
 | 
			
		||||
-(void)sampleCountersInBuffer:(id<MTLCounterSampleBuffer>)sampleBuffer
 | 
			
		||||
                atSampleIndex:(NSUInteger)sampleIndex
 | 
			
		||||
                  withBarrier:(BOOL)barrier API_AVAILABLE(macos(10.15), ios(14.0));
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,403 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLRenderPass.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@protocol MTLRasterizationRateMap;
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLCounters.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLLoadAction) {
 | 
			
		||||
    MTLLoadActionDontCare = 0,
 | 
			
		||||
    MTLLoadActionLoad = 1,
 | 
			
		||||
    MTLLoadActionClear = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLStoreAction) {
 | 
			
		||||
    MTLStoreActionDontCare = 0,
 | 
			
		||||
    MTLStoreActionStore = 1,
 | 
			
		||||
    MTLStoreActionMultisampleResolve = 2,
 | 
			
		||||
    MTLStoreActionStoreAndMultisampleResolve API_AVAILABLE(macos(10.12), ios(10.0)) = 3,
 | 
			
		||||
    MTLStoreActionUnknown API_AVAILABLE(macos(10.12), ios(10.0)) = 4,
 | 
			
		||||
    MTLStoreActionCustomSampleDepthStore API_AVAILABLE(macos(10.13), ios(11.0)) = 5,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLStoreActionOptions) {
 | 
			
		||||
    MTLStoreActionOptionNone                  = 0,
 | 
			
		||||
    MTLStoreActionOptionCustomSamplePositions = 1 << 0,
 | 
			
		||||
} API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    double red;
 | 
			
		||||
    double green;
 | 
			
		||||
    double blue;
 | 
			
		||||
    double alpha;
 | 
			
		||||
} MTLClearColor;
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLClearColor MTLClearColorMake(double red, double green, double blue, double alpha);
 | 
			
		||||
 | 
			
		||||
@protocol MTLTexture;
 | 
			
		||||
@protocol MTLBuffer;
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPassAttachmentDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property texture
 | 
			
		||||
 @abstract The MTLTexture object for this attachment.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, strong) id <MTLTexture> texture;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property level
 | 
			
		||||
 @abstract The mipmap level of the texture to be used for rendering.  Default is zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger level;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property slice
 | 
			
		||||
 @abstract The slice of the texture to be used for rendering.  Default is zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger slice;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property depthPlane
 | 
			
		||||
 @abstract The depth plane of the texture to be used for rendering.  Default is zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger depthPlane;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resolveTexture
 | 
			
		||||
 @abstract The texture used for multisample resolve operations.  Only used (and required)
 | 
			
		||||
 if the store action is set to MTLStoreActionMultisampleResolve.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, strong) id <MTLTexture> resolveTexture;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resolveLevel
 | 
			
		||||
 @abstract The mipmap level of the resolve texture to be used for multisample resolve.  Defaults to zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger resolveLevel;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resolveLevel
 | 
			
		||||
 @abstract The texture slice of the resolve texture to be used for multisample resolve.  Defaults to zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger resolveSlice;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resolveDepthPlane
 | 
			
		||||
 @abstract The texture depth plane of the resolve texture to be used for multisample resolve.  Defaults to zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger resolveDepthPlane;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property loadAction
 | 
			
		||||
 @abstract The action to be performed with this attachment at the beginning of a render pass.  Default is
 | 
			
		||||
 MTLLoadActionDontCare unless specified by a creation or init method.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLLoadAction loadAction;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property storeAction
 | 
			
		||||
 @abstract The action to be performed with this attachment at the end of a render pass.  Default is
 | 
			
		||||
 MTLStoreActionDontCare unless specified by a creation or init method.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLStoreAction storeAction;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property storeActionOptions
 | 
			
		||||
 @abstract Optional configuration for the store action performed with this attachment at the end of a render pass.  Default is
 | 
			
		||||
 MTLStoreActionOptionNone.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLStoreActionOptions storeActionOptions API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPassColorAttachmentDescriptor : MTLRenderPassAttachmentDescriptor
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property clearColor
 | 
			
		||||
 @abstract The clear color to be used if the loadAction property is MTLLoadActionClear
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLClearColor clearColor;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLMultisampleDepthResolveFilter
 | 
			
		||||
 @abstract Controls the MSAA depth resolve operation. Supported on iOS GPU Family 3 and later.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLMultisampleDepthResolveFilter)
 | 
			
		||||
{
 | 
			
		||||
    MTLMultisampleDepthResolveFilterSample0 = 0,
 | 
			
		||||
    MTLMultisampleDepthResolveFilterMin = 1,
 | 
			
		||||
    MTLMultisampleDepthResolveFilterMax = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.14), ios(9.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPassDepthAttachmentDescriptor : MTLRenderPassAttachmentDescriptor
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property clearDepth
 | 
			
		||||
 @abstract The clear depth value to be used if the loadAction property is MTLLoadActionClear
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) double clearDepth;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resolveFilter
 | 
			
		||||
 @abstract The filter to be used for depth multisample resolve.  Defaults to MTLMultisampleDepthResolveFilterSample0.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLMultisampleDepthResolveFilter depthResolveFilter API_AVAILABLE(macos(10.14), ios(9.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLMultisampleStencilResolveFilter
 | 
			
		||||
 @abstract Controls the MSAA stencil resolve operation.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLMultisampleStencilResolveFilter)
 | 
			
		||||
{
 | 
			
		||||
    /*!
 | 
			
		||||
     @constant MTLMultisampleStencilResolveFilterSample0
 | 
			
		||||
     @abstract The stencil sample corresponding to sample 0. This is the default behavior.
 | 
			
		||||
     */
 | 
			
		||||
    MTLMultisampleStencilResolveFilterSample0               = 0,
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     @constant MTLMultisampleStencilResolveFilterDepthResolvedSample
 | 
			
		||||
     @abstract The stencil sample corresponding to whichever depth sample is selected by the depth resolve filter. If depth resolve is not enabled, the stencil sample is chosen based on what a depth resolve filter would have selected.
 | 
			
		||||
     */
 | 
			
		||||
    MTLMultisampleStencilResolveFilterDepthResolvedSample   = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.14), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPassStencilAttachmentDescriptor : MTLRenderPassAttachmentDescriptor
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property clearStencil
 | 
			
		||||
 @abstract The clear stencil value to be used if the loadAction property is MTLLoadActionClear
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) uint32_t clearStencil;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property stencilResolveFilter
 | 
			
		||||
 @abstract The filter to be used for stencil multisample resolve. Defaults to MTLMultisampleStencilResolveFilterSample0.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLMultisampleStencilResolveFilter stencilResolveFilter API_AVAILABLE(macos(10.14), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPassColorAttachmentDescriptorArray : NSObject
 | 
			
		||||
/* Individual attachment state access */
 | 
			
		||||
- (MTLRenderPassColorAttachmentDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLRenderPassColorAttachmentDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLRenderPassSampleBufferAttachmentDescriptor : NSObject<NSCopying>
 | 
			
		||||
/*!
 | 
			
		||||
@property sampleBuffer
 | 
			
		||||
@abstract The sample buffer to store samples for the render-pass defined samples.
 | 
			
		||||
If sampleBuffer is non-nil, the sample indices will be used to store samples into
 | 
			
		||||
the sample buffer.  If no sample buffer is provided, no samples will be taken.
 | 
			
		||||
If any of the sample indices are specified as MTLCounterDontSample, no sample
 | 
			
		||||
will be taken for that action.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, nonatomic, retain) id<MTLCounterSampleBuffer> sampleBuffer API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property startOfVertexSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the start of
 | 
			
		||||
 vertex processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a render pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger startOfVertexSampleIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @property endOfVertexSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the end of
 | 
			
		||||
 vertex processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a render pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger endOfVertexSampleIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @property startOfFragmentSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the start of
 | 
			
		||||
 fragment processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a render pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger startOfFragmentSampleIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
/*!
 | 
			
		||||
 @property endOfFragmentSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the end of
 | 
			
		||||
 fragment processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a render pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger endOfFragmentSampleIndex API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLRenderPassSampleBufferAttachmentDescriptorArray : NSObject
 | 
			
		||||
/* Individual attachment state access */
 | 
			
		||||
- (MTLRenderPassSampleBufferAttachmentDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLRenderPassSampleBufferAttachmentDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLRenderPassDescriptor
 | 
			
		||||
 @abstract MTLRenderPassDescriptor represents a collection of attachments to be used to create a concrete render command encoder
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPassDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method renderPassDescriptor
 | 
			
		||||
 @abstract Create an autoreleased default frame buffer descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLRenderPassDescriptor *)renderPassDescriptor;
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLRenderPassColorAttachmentDescriptorArray *colorAttachments;
 | 
			
		||||
 | 
			
		||||
@property (copy, nonatomic, null_resettable) MTLRenderPassDepthAttachmentDescriptor *depthAttachment;
 | 
			
		||||
 | 
			
		||||
@property (copy, nonatomic, null_resettable) MTLRenderPassStencilAttachmentDescriptor *stencilAttachment;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property visibilityResultBuffer:
 | 
			
		||||
 @abstract Buffer into which samples passing the depth and stencil tests are counted.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, strong) id <MTLBuffer> visibilityResultBuffer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property renderTargetArrayLength:
 | 
			
		||||
 @abstract The number of active layers
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger renderTargetArrayLength API_AVAILABLE(macos(10.11), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property imageblockSampleLength:
 | 
			
		||||
 @abstract The per sample size in bytes of the largest explicit imageblock layout in the renderPass.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger imageblockSampleLength API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property threadgroupMemoryLength:
 | 
			
		||||
 @abstract The per tile size in bytes of the persistent threadgroup memory allocation.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger threadgroupMemoryLength API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tileWidth:
 | 
			
		||||
 @abstract The width in pixels of the tile.
 | 
			
		||||
 @discssion Defaults to 0. Zero means Metal chooses a width that fits within the local memory.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger tileWidth API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tileHeight:
 | 
			
		||||
 @abstract The height in pixels of the tile.
 | 
			
		||||
 @discssion Defaults to 0. Zero means Metal chooses a height that fits within the local memory.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger tileHeight API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property defaultRasterSampleCount:
 | 
			
		||||
 @abstract The raster sample count for the render pass when no attachments are given.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger defaultRasterSampleCount API_AVAILABLE(ios(11.0), tvos(14.5), macos(10.15), macCatalyst(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property renderTargetWidth:
 | 
			
		||||
 @abstract The width in pixels to constrain the render target to.
 | 
			
		||||
 @discussion Defaults to 0. If non-zero the value must be smaller than or equal to the minimum width of all attachments.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger renderTargetWidth API_AVAILABLE(ios(11.0), tvos(14.5), macos(10.15), macCatalyst(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property renderTargetHeight:
 | 
			
		||||
 @abstract The height in pixels to constrain the render target to.
 | 
			
		||||
 @discussion Defaults to 0. If non-zero the value must be smaller than or equal to the minimum height of all attachments.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger renderTargetHeight API_AVAILABLE(ios(11.0), tvos(14.5), macos(10.15), macCatalyst(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setSamplePositions:count:
 | 
			
		||||
 @abstract Configure the custom sample positions, to be used in MSAA rendering (i.e. when sample count > 1).
 | 
			
		||||
 @param positions The source array for custom sample position data.
 | 
			
		||||
 @param count Specifies the length of the positions array, and must be a valid sample count or 0 (to disable custom sample positions).
 | 
			
		||||
 */
 | 
			
		||||
- (void)setSamplePositions:(const MTLSamplePosition * _Nullable)positions count:(NSUInteger)count API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method getSamplePositions:count:
 | 
			
		||||
 @abstract Retrieve the previously configured custom sample positions. The positions input array will only be modified when count specifies a length sufficient for the number of previously configured positions.
 | 
			
		||||
 @param positions The destination array for custom sample position data.
 | 
			
		||||
 @param count Specifies the length of the positions array, which must be large enough to hold all configured sample positions.
 | 
			
		||||
 @return The number of previously configured custom sample positions.
 | 
			
		||||
 */
 | 
			
		||||
- (NSUInteger)getSamplePositions:(MTLSamplePosition * _Nullable)positions count:(NSUInteger)count API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property rasterizationRateMap
 | 
			
		||||
 @abstract The variable rasterization rate map to use when rendering this pass, or nil to not use variable rasterization rate.
 | 
			
		||||
 @discussion The default value is nil. Enabling variable rasterization rate allows for decreasing the rasterization rate in unimportant regions of screen space.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, strong) id<MTLRasterizationRateMap> rasterizationRateMap API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleBufferAttachments
 | 
			
		||||
 @abstract An array of sample buffers and associated sample indices.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLRenderPassSampleBufferAttachmentDescriptorArray * sampleBufferAttachments API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
// Inline definitions
 | 
			
		||||
MTL_INLINE MTLClearColor MTLClearColorMake(double red, double green, double blue, double alpha)
 | 
			
		||||
{
 | 
			
		||||
    MTLClearColor result;
 | 
			
		||||
    result.red = red;
 | 
			
		||||
    result.green = green;
 | 
			
		||||
    result.blue = blue;
 | 
			
		||||
    result.alpha = alpha;
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,465 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLRenderPipeline.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
#import <Metal/MTLRenderCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLRenderPass.h>
 | 
			
		||||
#import <Metal/MTLPixelFormat.h>
 | 
			
		||||
#import <Metal/MTLArgument.h>
 | 
			
		||||
#import <Metal/MTLFunctionConstantValues.h>
 | 
			
		||||
#import <Metal/MTLPipeline.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLLinkedFunctions.h>
 | 
			
		||||
#import <Metal/MTLFunctionHandle.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@class MTLVertexDescriptor;
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLBlendFactor) {
 | 
			
		||||
    MTLBlendFactorZero = 0,
 | 
			
		||||
    MTLBlendFactorOne = 1,
 | 
			
		||||
    MTLBlendFactorSourceColor = 2,
 | 
			
		||||
    MTLBlendFactorOneMinusSourceColor = 3,
 | 
			
		||||
    MTLBlendFactorSourceAlpha = 4,
 | 
			
		||||
    MTLBlendFactorOneMinusSourceAlpha = 5,
 | 
			
		||||
    MTLBlendFactorDestinationColor = 6,
 | 
			
		||||
    MTLBlendFactorOneMinusDestinationColor = 7,
 | 
			
		||||
    MTLBlendFactorDestinationAlpha = 8,
 | 
			
		||||
    MTLBlendFactorOneMinusDestinationAlpha = 9,
 | 
			
		||||
    MTLBlendFactorSourceAlphaSaturated = 10,
 | 
			
		||||
    MTLBlendFactorBlendColor = 11,
 | 
			
		||||
    MTLBlendFactorOneMinusBlendColor = 12,
 | 
			
		||||
    MTLBlendFactorBlendAlpha = 13,
 | 
			
		||||
    MTLBlendFactorOneMinusBlendAlpha = 14,
 | 
			
		||||
    MTLBlendFactorSource1Color              API_AVAILABLE(macos(10.12), ios(10.11)) = 15,
 | 
			
		||||
    MTLBlendFactorOneMinusSource1Color      API_AVAILABLE(macos(10.12), ios(10.11)) = 16,
 | 
			
		||||
    MTLBlendFactorSource1Alpha              API_AVAILABLE(macos(10.12), ios(10.11)) = 17,
 | 
			
		||||
    MTLBlendFactorOneMinusSource1Alpha      API_AVAILABLE(macos(10.12), ios(10.11)) = 18,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLBlendOperation) {
 | 
			
		||||
    MTLBlendOperationAdd = 0,
 | 
			
		||||
    MTLBlendOperationSubtract = 1,
 | 
			
		||||
    MTLBlendOperationReverseSubtract = 2,
 | 
			
		||||
    MTLBlendOperationMin = 3,
 | 
			
		||||
    MTLBlendOperationMax = 4,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLColorWriteMask) {
 | 
			
		||||
    MTLColorWriteMaskNone  = 0,
 | 
			
		||||
    MTLColorWriteMaskRed   = 0x1 << 3,
 | 
			
		||||
    MTLColorWriteMaskGreen = 0x1 << 2,
 | 
			
		||||
    MTLColorWriteMaskBlue  = 0x1 << 1,
 | 
			
		||||
    MTLColorWriteMaskAlpha = 0x1 << 0,
 | 
			
		||||
    MTLColorWriteMaskAll   = 0xf
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLPrimitiveTopologyClass) {
 | 
			
		||||
    MTLPrimitiveTopologyClassUnspecified = 0,
 | 
			
		||||
    MTLPrimitiveTopologyClassPoint = 1,
 | 
			
		||||
    MTLPrimitiveTopologyClassLine = 2,
 | 
			
		||||
    MTLPrimitiveTopologyClassTriangle = 3,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(12.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLTessellationPartitionMode) {
 | 
			
		||||
    MTLTessellationPartitionModePow2 = 0,
 | 
			
		||||
    MTLTessellationPartitionModeInteger = 1,
 | 
			
		||||
    MTLTessellationPartitionModeFractionalOdd = 2,
 | 
			
		||||
    MTLTessellationPartitionModeFractionalEven = 3,
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLTessellationFactorStepFunction) {
 | 
			
		||||
    MTLTessellationFactorStepFunctionConstant = 0,
 | 
			
		||||
    MTLTessellationFactorStepFunctionPerPatch = 1,
 | 
			
		||||
    MTLTessellationFactorStepFunctionPerInstance = 2,
 | 
			
		||||
    MTLTessellationFactorStepFunctionPerPatchAndPerInstance = 3,
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLTessellationFactorFormat) {
 | 
			
		||||
    MTLTessellationFactorFormatHalf = 0,
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLTessellationControlPointIndexType) {
 | 
			
		||||
    MTLTessellationControlPointIndexTypeNone = 0,
 | 
			
		||||
    MTLTessellationControlPointIndexTypeUInt16 = 1,
 | 
			
		||||
    MTLTessellationControlPointIndexTypeUInt32 = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@class MTLRenderPipelineColorAttachmentDescriptorArray;
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPipelineColorAttachmentDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*! Pixel format.  Defaults to MTLPixelFormatInvalid */
 | 
			
		||||
@property (nonatomic) MTLPixelFormat pixelFormat;
 | 
			
		||||
 | 
			
		||||
/*! Enable blending.  Defaults to NO. */
 | 
			
		||||
@property (nonatomic, getter = isBlendingEnabled) BOOL blendingEnabled;
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLBlendFactorOne */
 | 
			
		||||
@property (nonatomic) MTLBlendFactor sourceRGBBlendFactor;
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLBlendFactorZero */
 | 
			
		||||
@property (nonatomic) MTLBlendFactor destinationRGBBlendFactor;
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLBlendOperationAdd */
 | 
			
		||||
@property (nonatomic) MTLBlendOperation rgbBlendOperation;
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLBlendFactorOne */
 | 
			
		||||
@property (nonatomic) MTLBlendFactor sourceAlphaBlendFactor;
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLBlendFactorZero */
 | 
			
		||||
@property (nonatomic) MTLBlendFactor destinationAlphaBlendFactor;
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLBlendOperationAdd */
 | 
			
		||||
@property (nonatomic) MTLBlendOperation alphaBlendOperation;
 | 
			
		||||
 | 
			
		||||
/* Other Options */
 | 
			
		||||
 | 
			
		||||
/*! Defaults to MTLColorWriteMaskAll */
 | 
			
		||||
@property (nonatomic) MTLColorWriteMask writeMask;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPipelineReflection : NSObject
 | 
			
		||||
 | 
			
		||||
@property (nullable, readonly) NSArray <MTLArgument *> *vertexArguments;
 | 
			
		||||
@property (nullable, readonly) NSArray <MTLArgument *> *fragmentArguments;
 | 
			
		||||
@property (nullable, readonly) NSArray <MTLArgument *> *tileArguments API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPipelineDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
@property (nullable, readwrite, nonatomic, strong) id <MTLFunction> vertexFunction;
 | 
			
		||||
@property (nullable, readwrite, nonatomic, strong) id <MTLFunction> fragmentFunction;
 | 
			
		||||
 | 
			
		||||
@property (nullable, copy, nonatomic) MTLVertexDescriptor *vertexDescriptor;
 | 
			
		||||
 | 
			
		||||
/* Rasterization and visibility state */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger sampleCount; //DEPRECATED - aliases rasterSampleCount property
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger rasterSampleCount;
 | 
			
		||||
@property (readwrite, nonatomic, getter = isAlphaToCoverageEnabled) BOOL alphaToCoverageEnabled;
 | 
			
		||||
@property (readwrite, nonatomic, getter = isAlphaToOneEnabled) BOOL alphaToOneEnabled;
 | 
			
		||||
@property (readwrite, nonatomic, getter = isRasterizationEnabled) BOOL rasterizationEnabled;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxVertexAmplificationCount API_AVAILABLE(macos(10.15.4), ios(13.0), macCatalyst(13.4));
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLRenderPipelineColorAttachmentDescriptorArray *colorAttachments;
 | 
			
		||||
 | 
			
		||||
@property (nonatomic) MTLPixelFormat depthAttachmentPixelFormat;
 | 
			
		||||
@property (nonatomic) MTLPixelFormat stencilAttachmentPixelFormat;
 | 
			
		||||
 | 
			
		||||
@property (readwrite, nonatomic) MTLPrimitiveTopologyClass inputPrimitiveTopology API_AVAILABLE(macos(10.11), ios(12.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
@property (readwrite, nonatomic) MTLTessellationPartitionMode tessellationPartitionMode API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxTessellationFactor API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readwrite, nonatomic, getter = isTessellationFactorScaleEnabled) BOOL tessellationFactorScaleEnabled API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readwrite, nonatomic) MTLTessellationFactorFormat tessellationFactorFormat API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readwrite, nonatomic) MTLTessellationControlPointIndexType tessellationControlPointIndexType API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readwrite, nonatomic) MTLTessellationFactorStepFunction tessellationFactorStepFunction API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
@property (readwrite, nonatomic) MTLWinding tessellationOutputWindingOrder API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLPipelineBufferDescriptorArray *vertexBuffers API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
@property (readonly) MTLPipelineBufferDescriptorArray *fragmentBuffers API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
@property (readwrite, nonatomic) BOOL supportIndirectCommandBuffers API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property binaryArchives
 | 
			
		||||
 @abstract The set of MTLBinaryArchive to search for compiled code when creating the pipeline state.
 | 
			
		||||
 @discussion Accelerate pipeline state creation by providing archives of compiled code such that no compilation needs to happen on the fast path.
 | 
			
		||||
 @see MTLBinaryArchive
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nullable, nonatomic, copy) NSArray<id<MTLBinaryArchive>> *binaryArchives API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property vertexPreloadedLibraries
 | 
			
		||||
 @abstract The set of MTLDynamicLibrary to use to resolve external symbols for the vertexFunction before considering symbols from dependent MTLDynamicLibrary.
 | 
			
		||||
 @discussion Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use vertexPreloadedLibraries.
 | 
			
		||||
 This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
 | 
			
		||||
 It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
 | 
			
		||||
 @see MTLDynamicLibrary
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonnull, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* vertexPreloadedLibraries API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property fragmentPreloadedLibraries
 | 
			
		||||
 @abstract The set of MTLDynamicLibrary to use to resolve external symbols for the fragmentFunction before considering symbols from dependent MTLDynamicLibrary.
 | 
			
		||||
 @discussion Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use fragmentPreloadedLibraries.
 | 
			
		||||
 This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
 | 
			
		||||
 It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
 | 
			
		||||
 @see MTLDynamicLibrary
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonnull, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* fragmentPreloadedLibraries API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property vertexLinkedFunctions
 | 
			
		||||
 @abstract The set of functions to be linked with the pipeline state and accessed from the vertex function.
 | 
			
		||||
 @see MTLLinkedFunctions
 | 
			
		||||
 */
 | 
			
		||||
@property (null_resettable, copy, nonatomic) MTLLinkedFunctions *vertexLinkedFunctions
 | 
			
		||||
    API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property fragmentLinkedFunctions
 | 
			
		||||
 @abstract The set of functions to be linked with the pipeline state and accessed from the fragment function.
 | 
			
		||||
 @see MTLLinkedFunctions
 | 
			
		||||
 */
 | 
			
		||||
@property (null_resettable, copy, nonatomic) MTLLinkedFunctions *fragmentLinkedFunctions
 | 
			
		||||
    API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportAddingVertexBinaryFunctions
 | 
			
		||||
 @abstract This flag makes this pipeline support creating a new pipeline by adding binary functions.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL supportAddingVertexBinaryFunctions
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportFragmentAddingBinaryFunctions
 | 
			
		||||
 @abstract This flag makes this pipeline support creating a new pipeline by adding binary functions.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL supportAddingFragmentBinaryFunctions
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxVertexCallStackDepth
 | 
			
		||||
 @abstract The maximum depth of the call stack in stack frames from the shader. Defaults to 1 additional stack frame.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxVertexCallStackDepth
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxFragmentCallStackDepth
 | 
			
		||||
 @abstract The maximum depth of the call stack in stack frames from the shader. Defaults to 1 additional stack frame.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxFragmentCallStackDepth
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method reset
 | 
			
		||||
 @abstract Restore all pipeline descriptor properties to their default values.
 | 
			
		||||
 */
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(12.0), ios(15.0))
 | 
			
		||||
@interface MTLRenderPipelineFunctionsDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property vertexAdditionalBinaryFunctions
 | 
			
		||||
 @abstract The set of additional binary functions to be accessed from the vertex function in an incrementally created pipeline state.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, copy) NSArray<id<MTLFunction>> *vertexAdditionalBinaryFunctions;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property fragmentAdditionalBinaryFunctions
 | 
			
		||||
 @abstract The set of additional binary functions to be accessed from the fragment function in an incrementally created pipeline state.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, copy) NSArray<id<MTLFunction>> *fragmentAdditionalBinaryFunctions;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tileAdditionalBinaryFunctions
 | 
			
		||||
 @abstract The set of additional binary functions to be accessed from the tile function in an incrementally created pipeline state.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, nonatomic, copy) NSArray<id<MTLFunction>> *tileAdditionalBinaryFunctions;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLRenderPipelineState
 | 
			
		||||
 @abstract MTLRenderPipelineState represents a compiled render pipeline
 | 
			
		||||
 
 | 
			
		||||
 @discussion MTLRenderPipelineState is a compiled render pipeline and can be set on a MTLRenderCommandEncoder.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLRenderPipelineState <NSObject>
 | 
			
		||||
 | 
			
		||||
@property (nullable, readonly) NSString *label;
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxTotalThreadsPerThreadgroup
 | 
			
		||||
 @abstract The maximum total number of threads that can be in a single tile shader threadgroup.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger maxTotalThreadsPerThreadgroup API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property threadgroupSizeMatchesTileSize
 | 
			
		||||
 @abstract Returns true when the pipeline state requires a tile shader threadgroup size equal to the tile size
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) BOOL threadgroupSizeMatchesTileSize API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property imageblockSampleLength
 | 
			
		||||
 @brief Returns imageblock memory length used by a single sample when rendered using this pipeline.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger imageblockSampleLength API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method imageblockMemoryLengthForDimensions:sampleCount:
 | 
			
		||||
 @brief Returns imageblock memory length for given image block dimensions. Dimensions must be valid tile dimensions.
 | 
			
		||||
 */
 | 
			
		||||
- (NSUInteger)imageblockMemoryLengthForDimensions:(MTLSize)imageblockDimensions API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@property (readonly) BOOL supportIndirectCommandBuffers API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method functionHandleWithFunction:stage:
 | 
			
		||||
 @brief Gets the function handle for the specified function on the specified stage of the pipeline.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLFunctionHandle>)functionHandleWithFunction:(id<MTLFunction>)function stage:(MTLRenderStages)stage API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newVisibleFunctionTableWithDescriptor:stage:
 | 
			
		||||
 @brief Allocate a visible function table for the specified stage of the pipeline with the provided descriptor.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLVisibleFunctionTable>)newVisibleFunctionTableWithDescriptor:(MTLVisibleFunctionTableDescriptor * __nonnull)descriptor stage:(MTLRenderStages)stage API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newIntersectionFunctionTableWithDescriptor:stage:
 | 
			
		||||
 @brief Allocate an intersection function table for the specified stage of the pipeline with the provided descriptor.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLIntersectionFunctionTable>)newIntersectionFunctionTableWithDescriptor:(MTLIntersectionFunctionTableDescriptor * _Nonnull)descriptor stage:(MTLRenderStages)stage API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newRenderPipelineStateWithAdditionalBinaryFunctions:error:
 | 
			
		||||
 @brief Allocate a new render pipeline state by adding binary functions for each stage of this pipeline state.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLRenderPipelineState>)newRenderPipelineStateWithAdditionalBinaryFunctions:(nonnull MTLRenderPipelineFunctionsDescriptor *)additionalBinaryFunctions error:(__autoreleasing NSError **)error API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLRenderPipelineColorAttachmentDescriptorArray : NSObject
 | 
			
		||||
 | 
			
		||||
/* Individual attachment state access */
 | 
			
		||||
- (MTLRenderPipelineColorAttachmentDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLRenderPipelineColorAttachmentDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5))
 | 
			
		||||
@interface MTLTileRenderPipelineColorAttachmentDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*! Pixel format.  Defaults to MTLPixelFormatInvalid */
 | 
			
		||||
@property (nonatomic) MTLPixelFormat pixelFormat;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5))
 | 
			
		||||
@interface MTLTileRenderPipelineColorAttachmentDescriptorArray : NSObject
 | 
			
		||||
 | 
			
		||||
/* Individual tile attachment state access */
 | 
			
		||||
- (MTLTileRenderPipelineColorAttachmentDescriptor*)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(MTLTileRenderPipelineColorAttachmentDescriptor*)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0), tvos(14.5))
 | 
			
		||||
@interface MTLTileRenderPipelineDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label:
 | 
			
		||||
 @abstract The descriptor label.
 | 
			
		||||
 */
 | 
			
		||||
@property (copy, nonatomic, nullable) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tileFunction:
 | 
			
		||||
 @abstract  The kernel or fragment function that serves as the tile shader for this pipeline.
 | 
			
		||||
 @discussion Both kernel-based and fragment-based tile pipelines dispatches will barrier against previous
 | 
			
		||||
 draws and other dispatches. Kernel-based pipelines will wait until all prior access to the tile completes.
 | 
			
		||||
 Fragment-based pipelines will only wait until all prior access to the fragment's location completes.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic, strong) id <MTLFunction> tileFunction;
 | 
			
		||||
 | 
			
		||||
/* Rasterization and visibility state */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger rasterSampleCount;
 | 
			
		||||
@property (readonly) MTLTileRenderPipelineColorAttachmentDescriptorArray *colorAttachments;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property threadgroupSizeMatchesTileSize:
 | 
			
		||||
 @abstract Whether all threadgroups associated with this pipeline will cover tiles entirely.
 | 
			
		||||
 @discussion Metal can optimize code generation for this case.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL threadgroupSizeMatchesTileSize;
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLPipelineBufferDescriptorArray *tileBuffers API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxTotalThreadsPerThreadgroup
 | 
			
		||||
 @abstract Optional property. Set the maxTotalThreadsPerThreadgroup. If it is not set, returns zero.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxTotalThreadsPerThreadgroup API_AVAILABLE(macos(10.15), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property binaryArchives
 | 
			
		||||
 @abstract The set of MTLBinaryArchive to search for compiled code when creating the pipeline state.
 | 
			
		||||
 @discussion Accelerate pipeline state creation by providing archives of compiled code such that no compilation needs to happen on the fast path.
 | 
			
		||||
 @see MTLBinaryArchive
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nullable, nonatomic, copy) NSArray<id<MTLBinaryArchive>> *binaryArchives API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property preloadedLibraries
 | 
			
		||||
 @abstract The set of MTLDynamicLibrary to use to resolve external symbols before considering symbols from dependent MTLDynamicLibrary.
 | 
			
		||||
 @discussion Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use preloadedLibraries.
 | 
			
		||||
 This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
 | 
			
		||||
 It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
 | 
			
		||||
 @see MTLDynamicLibrary
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonnull, nonatomic, copy) NSArray<id<MTLDynamicLibrary>>* preloadedLibraries API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property linkedFunctions
 | 
			
		||||
 @abstract The set of functions to be linked with the pipeline state and accessed from the tile function.
 | 
			
		||||
 @see MTLLinkedFunctions
 | 
			
		||||
 */
 | 
			
		||||
@property (null_resettable, copy, nonatomic) MTLLinkedFunctions *linkedFunctions
 | 
			
		||||
    API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportAddingBinaryFunctions
 | 
			
		||||
 @abstract This flag makes this pipeline support creating a new pipeline by adding binary functions.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL supportAddingBinaryFunctions
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxCallStackDepth
 | 
			
		||||
 @abstract The maximum depth of the call stack in stack frames from the tile function. Defaults to 1 additional stack frame.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger maxCallStackDepth
 | 
			
		||||
API_AVAILABLE(macos(12.0), ios(15.0));
 | 
			
		||||
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,288 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLResource.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLPurgeableOption
 | 
			
		||||
 @abstract Options for setPurgeable call.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLPurgeableStateNonVolatile
 | 
			
		||||
 The contents of this resource may not be discarded.
 | 
			
		||||
 | 
			
		||||
 @constant MTLPurgeableStateVolatile
 | 
			
		||||
 The contents of this resource may be discarded.
 | 
			
		||||
 | 
			
		||||
 @constant MTLPurgeableStateEmpty
 | 
			
		||||
 The contents of this are discarded.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLPurgeableStateKeepCurrent
 | 
			
		||||
 The purgeabelity state is not changed.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLPurgeableState)
 | 
			
		||||
{
 | 
			
		||||
    MTLPurgeableStateKeepCurrent = 1,
 | 
			
		||||
    
 | 
			
		||||
    MTLPurgeableStateNonVolatile = 2,
 | 
			
		||||
    MTLPurgeableStateVolatile = 3,
 | 
			
		||||
    MTLPurgeableStateEmpty = 4,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLCPUCacheMode
 | 
			
		||||
 @abstract Describes what CPU cache mode is used for the CPU's mapping of a texture resource.
 | 
			
		||||
 @constant MTLCPUCacheModeDefaultCache
 | 
			
		||||
 The default cache mode for the system.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLCPUCacheModeWriteCombined
 | 
			
		||||
 Write combined memory is optimized for resources that the CPU will write into, but never read.  On some implementations, writes may bypass caches avoiding cache pollution, and reads perform very poorly.
 | 
			
		||||
 
 | 
			
		||||
 @discussion
 | 
			
		||||
 Applications should only investigate changing the cache mode if writing to normally cached buffers is known to cause performance issues due to cache pollution, as write combined memory can have surprising performance pitfalls.  Another approach is to use non-temporal stores to normally cached memory (STNP on ARMv8, _mm_stream_* on x86_64).
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLCPUCacheMode)
 | 
			
		||||
{
 | 
			
		||||
    MTLCPUCacheModeDefaultCache = 0,
 | 
			
		||||
    MTLCPUCacheModeWriteCombined = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLStorageMode
 | 
			
		||||
 @abstract Describes location and CPU mapping of MTLTexture.
 | 
			
		||||
 @constant MTLStorageModeShared
 | 
			
		||||
 In this mode, CPU and device will nominally both use the same underlying memory when accessing the contents of the texture resource.
 | 
			
		||||
 However, coherency is only guaranteed at command buffer boundaries to minimize the required flushing of CPU and GPU caches.
 | 
			
		||||
 This is the default storage mode for iOS Textures.
 | 
			
		||||
 | 
			
		||||
 @constant MTLStorageModeManaged
 | 
			
		||||
 This mode relaxes the coherency requirements and requires that the developer make explicit requests to maintain
 | 
			
		||||
 coherency between a CPU and GPU version of the texture resource.  In order for CPU to access up to date GPU results,
 | 
			
		||||
 first, a blit synchronizations must be completed (see synchronize methods of MTLBlitCommandEncoder).
 | 
			
		||||
 Blit overhead is only incurred if GPU has modified the resource.
 | 
			
		||||
 This is the default storage mode for OS X Textures.
 | 
			
		||||
 | 
			
		||||
 @constant MTLStorageModePrivate
 | 
			
		||||
 This mode allows the texture resource data to be kept entirely to GPU (or driver) private memory that will never be accessed by the CPU directly, so no
 | 
			
		||||
 conherency of any kind must be maintained.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLStorageModeMemoryless
 | 
			
		||||
 This mode allows creation of resources that do not have a GPU or CPU memory backing, but do have on-chip storage for TBDR
 | 
			
		||||
 devices. The contents of the on-chip storage is undefined and does not persist, but its configuration is controlled by the
 | 
			
		||||
 MTLTexture descriptor. Textures created with MTLStorageModeMemoryless dont have an IOAccelResource at any point in their
 | 
			
		||||
 lifetime. The only way to populate such resource is to perform rendering operations on it. Blit operations are disallowed.
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLStorageMode)
 | 
			
		||||
{
 | 
			
		||||
    MTLStorageModeShared  = 0,
 | 
			
		||||
    MTLStorageModeManaged API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = 1,
 | 
			
		||||
    MTLStorageModePrivate = 2,
 | 
			
		||||
    MTLStorageModeMemoryless API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = 3,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLHazardTrackingMode
 | 
			
		||||
 @abstract Describes how hazard tracking is performed.
 | 
			
		||||
 @constant MTLHazardTrackingModeDefault The default hazard tracking mode for the context. Refer to the usage of the field for semantics.
 | 
			
		||||
 @constant MTLHazardTrackingModeUntracked Do not perform hazard tracking.
 | 
			
		||||
 @constant MTLHazardTrackingModeTracked Do perform hazard tracking.
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLHazardTrackingMode)
 | 
			
		||||
{
 | 
			
		||||
    MTLHazardTrackingModeDefault = 0,
 | 
			
		||||
    MTLHazardTrackingModeUntracked = 1,
 | 
			
		||||
    MTLHazardTrackingModeTracked = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLResourceOptions
 | 
			
		||||
 @abstract A set of optional arguments to influence the creation of a MTLResource (MTLTexture or MTLBuffer)
 | 
			
		||||
 | 
			
		||||
 @constant MTLResourceCPUCacheModeDefault
 | 
			
		||||
 The default CPU cache mode for the resource.
 | 
			
		||||
 Applications should only investigate changing the cache mode if writing to normally cached buffers is known to
 | 
			
		||||
 cause performance issues due to cache pollution, as write combined memory can have surprising performance pitfalls.
 | 
			
		||||
 Another approach is to use non-temporal stores to normally cached memory (STNP on ARMv8, _mm_stream_* on x86_64).
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLResourceCPUCacheModeWriteCombined
 | 
			
		||||
 Write combined memory is optimized for resources that the CPU will write into, but never read.
 | 
			
		||||
 On some implementations, writes may bypass caches avoiding cache pollution, and reads perform very poorly.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLResourceStorageModeShared
 | 
			
		||||
 In this mode, CPU and device will nominally both use the same underlying memory when accessing the contents of the resource.
 | 
			
		||||
 However, coherency is only guaranteed at command buffer boundaries to minimize the required flushing of CPU and GPU caches.
 | 
			
		||||
 This is the default storage mode for iOS Textures.
 | 
			
		||||
 | 
			
		||||
 @constant MTLResourceStorageModeManaged
 | 
			
		||||
 This mode relaxes the coherency requirements and requires that the developer make explicit requests to maintain
 | 
			
		||||
 coherency between a CPU and GPU version of the resource.  Changes due to CPU stores outside of the Metal API must be
 | 
			
		||||
 indicated to Metal via MTLBuffer::didModifyRange:(NSRange)range.  In order for CPU to access up to date GPU results,
 | 
			
		||||
 first, a blit synchronizations must be completed (see synchronize methods of MTLBlitCommandEncoder).
 | 
			
		||||
 Blit overhead is only incurred if GPU has modified the resource.
 | 
			
		||||
 This storage mode is only defined for OS X.
 | 
			
		||||
 This is the default storage mode for OS X Textures.
 | 
			
		||||
 | 
			
		||||
 @constant MTLResourceStorageModePrivate
 | 
			
		||||
 This mode allows the data to be kept entirely to GPU (or driver) private memory that will never be accessed by the CPU directly, so no
 | 
			
		||||
 conherency of any kind must be maintained.
 | 
			
		||||
 | 
			
		||||
 @constant MTLResourceStorageModeMemoryless
 | 
			
		||||
 This mode allows creation of resources that do not have a GPU or CPU memory backing, but do have on-chip storage for TBDR
 | 
			
		||||
 devices. The contents of the on-chip storage is undefined and does not persist, but its configuration is controlled by the
 | 
			
		||||
 MTLTexture descriptor. Textures created with MTLStorageModeMemoryless dont have an IOAccelResource at any point in their
 | 
			
		||||
 lifetime. The only way to populate such resource is to perform rendering operations on it. Blit operations are disallowed.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLResourceHazardTrackingModeDefault
 | 
			
		||||
 This mode is the default for the context in which it is specified,
 | 
			
		||||
 which may be either MTLResourceHazardTrackingModeUntracked or MTLResourceHazardTrackingModeTracked.
 | 
			
		||||
 Refer to the point of use to determing the meaning of this flag.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLResourceHazardTrackingModeUntracked
 | 
			
		||||
 In this mode, command encoder dependencies for this resource are tracked manually with MTLFence.
 | 
			
		||||
 This value is the default for MTLHeap and resources sub-allocated from a MTLHeap,
 | 
			
		||||
 and may optionally be specified for non-heap resources.
 | 
			
		||||
 | 
			
		||||
 @constant MTLResourceHazardTrackingModeTracked
 | 
			
		||||
 In this mode, command encoder dependencies for this resource are tracked automatically.
 | 
			
		||||
 This value is the default for resources allocated from a MTLDevice,
 | 
			
		||||
 and may optionally be specified for MTLHeap and resources sub-allocated from such heaps.
 | 
			
		||||
 
 | 
			
		||||
 @discussion
 | 
			
		||||
 Note that resource options are a property of MTLTextureDescriptor (resourceOptions), so apply to texture creation.
 | 
			
		||||
 they are also passed directly into MTLBuffer creation methods.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#define MTLResourceCPUCacheModeShift            0
 | 
			
		||||
#define MTLResourceCPUCacheModeMask             (0xfUL << MTLResourceCPUCacheModeShift)
 | 
			
		||||
 | 
			
		||||
#define MTLResourceStorageModeShift             4
 | 
			
		||||
#define MTLResourceStorageModeMask              (0xfUL << MTLResourceStorageModeShift)
 | 
			
		||||
 | 
			
		||||
#define MTLResourceHazardTrackingModeShift      8
 | 
			
		||||
#define MTLResourceHazardTrackingModeMask       (0x3UL << MTLResourceHazardTrackingModeShift)
 | 
			
		||||
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLResourceOptions)
 | 
			
		||||
{
 | 
			
		||||
    MTLResourceCPUCacheModeDefaultCache  = MTLCPUCacheModeDefaultCache  << MTLResourceCPUCacheModeShift,
 | 
			
		||||
    MTLResourceCPUCacheModeWriteCombined = MTLCPUCacheModeWriteCombined << MTLResourceCPUCacheModeShift,
 | 
			
		||||
 | 
			
		||||
    MTLResourceStorageModeShared API_AVAILABLE(macos(10.11), ios(9.0)) = MTLStorageModeShared << MTLResourceStorageModeShift,
 | 
			
		||||
    MTLResourceStorageModeManaged API_AVAILABLE(macos(10.11), macCatalyst(13.0)) API_UNAVAILABLE(ios) = MTLStorageModeManaged << MTLResourceStorageModeShift,
 | 
			
		||||
    MTLResourceStorageModePrivate API_AVAILABLE(macos(10.11), ios(9.0)) = MTLStorageModePrivate << MTLResourceStorageModeShift,
 | 
			
		||||
    MTLResourceStorageModeMemoryless API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(10.0)) = MTLStorageModeMemoryless << MTLResourceStorageModeShift,
 | 
			
		||||
    
 | 
			
		||||
    MTLResourceHazardTrackingModeDefault API_AVAILABLE(macos(10.13), ios(10.0)) = MTLHazardTrackingModeDefault << MTLResourceHazardTrackingModeShift,
 | 
			
		||||
    MTLResourceHazardTrackingModeUntracked API_AVAILABLE(macos(10.13), ios(10.0)) = MTLHazardTrackingModeUntracked << MTLResourceHazardTrackingModeShift,
 | 
			
		||||
    MTLResourceHazardTrackingModeTracked API_AVAILABLE(macos(10.15), ios(13.0)) = MTLHazardTrackingModeTracked << MTLResourceHazardTrackingModeShift,
 | 
			
		||||
    
 | 
			
		||||
    // Deprecated spellings
 | 
			
		||||
    MTLResourceOptionCPUCacheModeDefault       = MTLResourceCPUCacheModeDefaultCache,
 | 
			
		||||
    MTLResourceOptionCPUCacheModeWriteCombined = MTLResourceCPUCacheModeWriteCombined,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
@protocol MTLHeap;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLResource
 | 
			
		||||
 @abstract Common APIs available for MTLBuffer and MTLTexture instances
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLResource <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, atomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property cpuCacheMode
 | 
			
		||||
 @abstract The cache mode used for the CPU mapping for this resource
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLCPUCacheMode cpuCacheMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property storageMode
 | 
			
		||||
 @abstract The resource storage mode used for the CPU mapping for this resource
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLStorageMode storageMode API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property hazardTrackingMode
 | 
			
		||||
 @abstract Whether or not the resource is hazard tracked.
 | 
			
		||||
 @discussion This value can be either MTLHazardTrackingModeUntracked or MTLHazardTrackingModeTracked.
 | 
			
		||||
 Resources created from heaps are by default untracked, whereas resources created from the device are by default tracked.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLHazardTrackingMode hazardTrackingMode API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resourceOptions
 | 
			
		||||
 @abstract A packed tuple of the storageMode, cpuCacheMode and hazardTrackingMode properties.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLResourceOptions resourceOptions API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method setPurgeableState
 | 
			
		||||
 @abstract Set (or query) the purgeability state of a resource
 | 
			
		||||
 @discussion Synchronously set the purgeability state of a resource and return what the prior (or current) state is.
 | 
			
		||||
 FIXME: If the device is keeping a cached copy of the resource, both the shared copy and cached copy are made purgeable.  Any access to the resource by either the CPU or device will be undefined.
 | 
			
		||||
 */
 | 
			
		||||
- (MTLPurgeableState)setPurgeableState:(MTLPurgeableState)state;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property heap
 | 
			
		||||
 @abstract The heap from which this resouce was created.
 | 
			
		||||
 @discussion Nil when this resource is not backed by a heap.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nullable) id <MTLHeap> heap API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property heapOffset
 | 
			
		||||
 @abstract The offset inside the heap at which this resource was created.
 | 
			
		||||
 @discussion Zero when this resource was not created on a heap with MTLHeapTypePlacement.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger heapOffset API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property allocatedSize
 | 
			
		||||
 @abstrace The size in bytes occupied by this resource
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly) NSUInteger allocatedSize API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method makeAliasable
 | 
			
		||||
 @abstract Allow future heap sub-allocations to alias against this resource's memory.
 | 
			
		||||
 @discussion It is illegal to call this method on a non heap-based resource. 
 | 
			
		||||
 It is also illegal to call this method on texture views created from heap-based textures.
 | 
			
		||||
 The debug layer will raise an exception. Calling this method on textures sub-allocated
 | 
			
		||||
 from Buffers backed by heap memory has no effect.
 | 
			
		||||
 Once a resource is made aliasable, the decision cannot be reverted.
 | 
			
		||||
 */
 | 
			
		||||
-(void) makeAliasable API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method isAliasable
 | 
			
		||||
 @abstract Returns whether future heap sub-allocations may alias against this resource's memory.
 | 
			
		||||
 @return YES if <st>makeAliasable</st> was previously successfully called on this resource. NO otherwise.
 | 
			
		||||
 If resource is sub-allocated from other resource created on the heap, isAliasable returns 
 | 
			
		||||
 aliasing state of that base resource. Also returns NO when storage mode is memoryless.
 | 
			
		||||
 */
 | 
			
		||||
-(BOOL) isAliasable API_AVAILABLE(macos(10.13), ios(10.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,116 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLResourceStateCommandEncoder.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Created by kpiddington on 9/7/18.
 | 
			
		||||
//  Copyright © 2018 Apple, Inc. All rights reserved.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLTexture.h>
 | 
			
		||||
#import <Metal/MTLFence.h>
 | 
			
		||||
#import <Metal/MTLResourceStatePass.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
/*!
 | 
			
		||||
 @header MTLResourceStateCommandEncoder
 | 
			
		||||
 @discussion Header file for MTLResourceStateCommandEncoder
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLSparseTextureMappingMode
 | 
			
		||||
 @abstract Type of mapping operation for sparse texture
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLSparseTextureMappingMode)
 | 
			
		||||
{
 | 
			
		||||
    MTLSparseTextureMappingModeMap   = 0,
 | 
			
		||||
    MTLSparseTextureMappingModeUnmap = 1,
 | 
			
		||||
} API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLMapIndirectArguments
 | 
			
		||||
 @abstract Structure describing indirect mapping region. This structure is used to populate a buffer for the method  'MTLResourceStateCommandEncoder updateTextureMapping:indirectBuffer:indirectBufferOffset:'
 | 
			
		||||
 @discussion The correct data format for the buffer used in 'MTLResourceStateCommandEncoder updateTextureMapping:indirectBuffer:indirectBufferOffset: is the following:
 | 
			
		||||
 
 | 
			
		||||
 struct MTLMapIndirectBufferFormat{
 | 
			
		||||
     uint32_t numMappings;
 | 
			
		||||
     MTLMapIndirectArguments mappings[numMappings];
 | 
			
		||||
 }
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint32_t regionOriginX;
 | 
			
		||||
    uint32_t regionOriginY;
 | 
			
		||||
    uint32_t regionOriginZ;
 | 
			
		||||
    uint32_t regionSizeWidth;
 | 
			
		||||
    uint32_t regionSizeHeight;
 | 
			
		||||
    uint32_t regionSizeDepth;
 | 
			
		||||
    uint32_t mipMapLevel;
 | 
			
		||||
    uint32_t sliceId;
 | 
			
		||||
} MTLMapIndirectArguments;
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.15), ios(13.0))
 | 
			
		||||
@protocol MTLResourceStateCommandEncoder <MTLCommandEncoder>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@optional
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateTextureMappings:regions:mipLevels:slices:numRegions:mode:
 | 
			
		||||
 @abstract Updates multiple regions within a sparse texture.
 | 
			
		||||
 */
 | 
			
		||||
-(void) updateTextureMappings:(id<MTLTexture>) texture
 | 
			
		||||
                         mode:(const MTLSparseTextureMappingMode)mode
 | 
			
		||||
                      regions:(const MTLRegion[_Nonnull])regions
 | 
			
		||||
                    mipLevels:(const NSUInteger[_Nonnull])mipLevels
 | 
			
		||||
                       slices:(const NSUInteger[_Nonnull])slices
 | 
			
		||||
                   numRegions:(NSUInteger)numRegions API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateTextureMapping:region:mipLevel:slice:mode:
 | 
			
		||||
 @abstract Updates mapping for given sparse texture
 | 
			
		||||
 */
 | 
			
		||||
-(void) updateTextureMapping:(id<MTLTexture>) texture
 | 
			
		||||
                        mode:(const MTLSparseTextureMappingMode)mode
 | 
			
		||||
                      region:(const MTLRegion)region
 | 
			
		||||
                    mipLevel:(const NSUInteger)mipLevel
 | 
			
		||||
                       slice:(const NSUInteger)slice API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateTextureMapping:indirectBuffer:indirectBufferOffset:
 | 
			
		||||
 @abstract Updates mapping for given sparse texture. Updates are driven via a MTLBuffer with the structure format defined by MTLMapIndirectBufferFormat.
 | 
			
		||||
 
 | 
			
		||||
  struct MTLMapIndirectBufferFormat{
 | 
			
		||||
      uint32_t numMappings;
 | 
			
		||||
      MTLMapIndirectArguments mappings[numMappings]; 
 | 
			
		||||
  }
 | 
			
		||||
 */
 | 
			
		||||
-(void) updateTextureMapping:(id<MTLTexture>) texture
 | 
			
		||||
                        mode:(const MTLSparseTextureMappingMode)mode
 | 
			
		||||
              indirectBuffer:(id<MTLBuffer>)indirectBuffer
 | 
			
		||||
        indirectBufferOffset:(NSUInteger)indirectBufferOffset API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method updateFence:
 | 
			
		||||
 @abstract Update the fence to capture all GPU work so far enqueued by this encoder.
 | 
			
		||||
 @discussion The fence is updated at kernel submission to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)updateFence:(id <MTLFence>)fence API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method waitForFence:
 | 
			
		||||
 @abstract Prevent further GPU work until the fence is reached.
 | 
			
		||||
 @discussion The fence is evaluated at kernel submision to maintain global order and prevent deadlock.
 | 
			
		||||
 Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
 | 
			
		||||
 */
 | 
			
		||||
- (void)waitForFence:(id <MTLFence>)fence API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@required
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,85 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLResourceStatePass.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLCounters.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
@protocol MTLDevice;
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLResourceStatePassSampleBufferAttachmentDescriptor : NSObject<NSCopying>
 | 
			
		||||
/*!
 | 
			
		||||
@property sampleBuffer
 | 
			
		||||
@abstract The sample buffer to store samples for the resourceState-pass defined samples.
 | 
			
		||||
If sampleBuffer is non-nil, the sample indices will be used to store samples into
 | 
			
		||||
the sample buffer.  If no sample buffer is provided, no samples will be taken.
 | 
			
		||||
If any of the sample indices are specified as MTLCounterDontSample, no sample
 | 
			
		||||
will be taken for that action.
 | 
			
		||||
*/
 | 
			
		||||
@property (nullable, nonatomic, retain) id<MTLCounterSampleBuffer> sampleBuffer;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property startOfEncoderSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the start of
 | 
			
		||||
 command encoder processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a resourceState pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger startOfEncoderSampleIndex;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property endOfEncoderSampleIndex
 | 
			
		||||
 @abstract The sample index to use to store the sample taken at the end of
 | 
			
		||||
 Command encoder processing.  Setting the value to MTLCounterDontSample will cause
 | 
			
		||||
 this sample to be omitted.
 | 
			
		||||
 @discussion On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
 | 
			
		||||
 this sample index is invalid and must be set to MTLCounterDontSample or creation of a resourceState pass will fail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger endOfEncoderSampleIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLResourceStatePassSampleBufferAttachmentDescriptorArray : NSObject
 | 
			
		||||
/* Individual attachment state access */
 | 
			
		||||
- (MTLResourceStatePassSampleBufferAttachmentDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
/* This always uses 'copy' semantics.  It is safe to set the attachment state at any legal index to nil, which resets that attachment descriptor state to default vaules. */
 | 
			
		||||
- (void)setObject:(nullable MTLResourceStatePassSampleBufferAttachmentDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLResourceStatePassDescriptor
 | 
			
		||||
 @abstract MTLResourceStatePassDescriptor represents a collection of attachments to be used to create a concrete resourceState command encoder
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLResourceStatePassDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method resourceStatePassDescriptor
 | 
			
		||||
 @abstract Create an autoreleased default frame buffer descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLResourceStatePassDescriptor *)resourceStatePassDescriptor;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleBufferAttachments
 | 
			
		||||
 @abstract An array of sample buffers and associated sample indices.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLResourceStatePassSampleBufferAttachmentDescriptorArray * sampleBufferAttachments API_AVAILABLE(macos(11.0), ios(14.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,219 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLSampler.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
#import <Metal/MTLDepthStencil.h>
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLSamplerMinMagFilter
 | 
			
		||||
 @abstract Options for filtering texels within a mip level.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerMinMagFilterNearest
 | 
			
		||||
 Select the single texel nearest to the sample point.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerMinMagFilterLinear
 | 
			
		||||
 Select two texels in each dimension, and interpolate linearly between them.  Not all devices support linear filtering for all formats.  Integer textures can not use linear filtering on any device, and only some devices support linear filtering of Float textures.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLSamplerMinMagFilter) {
 | 
			
		||||
    MTLSamplerMinMagFilterNearest = 0,
 | 
			
		||||
    MTLSamplerMinMagFilterLinear = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLSamplerMipFilter
 | 
			
		||||
 @abstract Options for selecting and filtering between mipmap levels
 | 
			
		||||
 @constant MTLSamplerMipFilterNotMipmapped The texture is sampled as if it only had a single mipmap level.  All samples are read from level 0.
 | 
			
		||||
 @constant MTLSamplerMipFilterNearest The nearst mipmap level is selected.
 | 
			
		||||
 @constant MTLSamplerMipFilterLinear If the filter falls between levels, both levels are sampled, and their results linearly interpolated between levels.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLSamplerMipFilter) {
 | 
			
		||||
    MTLSamplerMipFilterNotMipmapped = 0,
 | 
			
		||||
    MTLSamplerMipFilterNearest = 1,
 | 
			
		||||
    MTLSamplerMipFilterLinear = 2,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLSamplerAddressMode
 | 
			
		||||
 @abstract Options for what value is returned when a fetch falls outside the bounds of a texture.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerAddressModeClampToEdge
 | 
			
		||||
 Texture coordinates will be clamped between 0 and 1.
 | 
			
		||||
 | 
			
		||||
 @constant MTLSamplerAddressModeMirrorClampToEdge
 | 
			
		||||
 Mirror the texture while coordinates are within -1..1, and clamp to edge when outside.
 | 
			
		||||
 | 
			
		||||
 @constant MTLSamplerAddressModeRepeat
 | 
			
		||||
 Wrap to the other side of the texture, effectively ignoring fractional parts of the texture coordinate.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerAddressModeMirrorRepeat
 | 
			
		||||
 Between -1 and 1 the texture is mirrored across the 0 axis.  The image is repeated outside of that range.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerAddressModeClampToZero
 | 
			
		||||
 ClampToZero returns transparent zero (0,0,0,0) for images with an alpha channel, and returns opaque zero (0,0,0,1) for images without an alpha channel.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerAddressModeClampToBorderColor
 | 
			
		||||
 Clamp to border color returns the value specified by the borderColor variable of the MTLSamplerDesc.
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLSamplerAddressMode) {
 | 
			
		||||
    MTLSamplerAddressModeClampToEdge = 0,
 | 
			
		||||
    MTLSamplerAddressModeMirrorClampToEdge API_AVAILABLE(macos(10.11), ios(14.0)) = 1,
 | 
			
		||||
    MTLSamplerAddressModeRepeat = 2,
 | 
			
		||||
    MTLSamplerAddressModeMirrorRepeat = 3,
 | 
			
		||||
    MTLSamplerAddressModeClampToZero = 4,
 | 
			
		||||
    MTLSamplerAddressModeClampToBorderColor API_AVAILABLE(macos(10.12), ios(14.0)) = 5,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLSamplerBorderColor
 | 
			
		||||
 @abstract Specify the color value that will be clamped to when the sampler address mode is MTLSamplerAddressModeClampToBorderColor.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerBorderColorTransparentBlack
 | 
			
		||||
 Transparent black returns {0,0,0,0} for clamped texture values.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerBorderColorOpaqueBlack
 | 
			
		||||
 OpaqueBlack returns {0,0,0,1} for clamped texture values.
 | 
			
		||||
 
 | 
			
		||||
 @constant MTLSamplerBorderColorOpaqueWhite
 | 
			
		||||
 OpaqueWhite returns {1,1,1,1} for clamped texture values.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLSamplerBorderColor) {
 | 
			
		||||
    MTLSamplerBorderColorTransparentBlack = 0,  // {0,0,0,0}
 | 
			
		||||
    MTLSamplerBorderColorOpaqueBlack = 1,       // {0,0,0,1}
 | 
			
		||||
    MTLSamplerBorderColorOpaqueWhite = 2,       // {1,1,1,1}
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @class MTLSamplerDescriptor
 | 
			
		||||
 @abstract A mutable descriptor used to configure a sampler.  When complete, this can be used to create an immutable MTLSamplerState.
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLSamplerDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property minFilter
 | 
			
		||||
 @abstract Filter option for combining texels within a mipmap level the sample footprint is larger than a pixel (minification).
 | 
			
		||||
 @discussion The default value is MTLSamplerMinMagFilterNearest.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerMinMagFilter minFilter;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property magFilter
 | 
			
		||||
 @abstract Filter option for combining texels within a mipmap level the sample footprint is smaller than a pixel (magnification).
 | 
			
		||||
 @discussion The default value is MTLSamplerMinMagFilterNearest.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerMinMagFilter magFilter;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property mipFilter
 | 
			
		||||
 @abstract Filter options for filtering between two mipmap levels.
 | 
			
		||||
 @discussion The default value is MTLSamplerMipFilterNotMipmapped
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerMipFilter mipFilter;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property maxAnisotropy
 | 
			
		||||
 @abstract The number of samples that can be taken to improve quality of sample footprints that are anisotropic.
 | 
			
		||||
 @discussion The default value is 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) NSUInteger maxAnisotropy;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sAddressMode
 | 
			
		||||
 @abstract Set the wrap mode for the S texture coordinate.  The default value is MTLSamplerAddressModeClampToEdge.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerAddressMode sAddressMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tAddressMode
 | 
			
		||||
 @abstract Set the wrap mode for the T texture coordinate.  The default value is MTLSamplerAddressModeClampToEdge.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerAddressMode tAddressMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property rAddressMode
 | 
			
		||||
 @abstract Set the wrap mode for the R texture coordinate.  The default value is MTLSamplerAddressModeClampToEdge.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerAddressMode rAddressMode;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property borderColor
 | 
			
		||||
 @abstract Set the color for the MTLSamplerAddressMode to one of the predefined in the MTLSamplerBorderColor enum.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLSamplerBorderColor borderColor API_AVAILABLE(macos(10.12), ios(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property normalizedCoordinates.
 | 
			
		||||
 @abstract If YES, texture coordates are from 0 to 1.  If NO, texture coordinates are 0..width, 0..height.
 | 
			
		||||
 @discussion normalizedCoordinates defaults to YES.  Non-normalized coordinates should only be used with 1D and 2D textures with the ClampToEdge wrap mode, otherwise the results of sampling are undefined.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) BOOL normalizedCoordinates;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property lodMinClamp
 | 
			
		||||
 @abstract The minimum level of detail that will be used when sampling from a texture.
 | 
			
		||||
 @discussion The default value of lodMinClamp is 0.0.  Clamp values are ignored for texture sample variants that specify an explicit level of detail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) float lodMinClamp;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property lodMaxClamp
 | 
			
		||||
 @abstract The maximum level of detail that will be used when sampling from a texture.
 | 
			
		||||
 @discussion The default value of lodMaxClamp is FLT_MAX.  Clamp values are ignored for texture sample variants that specify an explicit level of detail.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) float lodMaxClamp;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property lodAverage
 | 
			
		||||
 @abstract If YES, an average level of detail will be used when sampling from a texture. If NO, no averaging is performed.
 | 
			
		||||
 @discussion lodAverage defaults to NO. This option is a performance hint. An implementation is free to ignore this property.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) BOOL lodAverage API_AVAILABLE(ios(9.0), macos(11.0), macCatalyst(14.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property compareFunction
 | 
			
		||||
 @abstract Set the comparison function used when sampling shadow maps. The default value is MTLCompareFunctionNever.
 | 
			
		||||
 */
 | 
			
		||||
@property (nonatomic) MTLCompareFunction compareFunction API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property supportArgumentBuffers
 | 
			
		||||
 @abstract true if the sampler can be used inside an argument buffer
 | 
			
		||||
*/
 | 
			
		||||
@property (nonatomic) BOOL supportArgumentBuffers API_AVAILABLE(macos(10.13), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify the created object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, copy, nonatomic) NSString *label;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLSamplerState
 | 
			
		||||
 @abstract An immutable collection of sampler state compiled for a single device.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLSamplerState <NSObject>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A string to help identify this object.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) NSString *label;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this resource was created against.  This resource can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,161 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLStageInputOutputDescriptor.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 MTLAttributeFormat
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLAttributeFormat)
 | 
			
		||||
{
 | 
			
		||||
    MTLAttributeFormatInvalid = 0,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUChar2 = 1,
 | 
			
		||||
    MTLAttributeFormatUChar3 = 2,
 | 
			
		||||
    MTLAttributeFormatUChar4 = 3,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatChar2 = 4,
 | 
			
		||||
    MTLAttributeFormatChar3 = 5,
 | 
			
		||||
    MTLAttributeFormatChar4 = 6,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUChar2Normalized = 7,
 | 
			
		||||
    MTLAttributeFormatUChar3Normalized = 8,
 | 
			
		||||
    MTLAttributeFormatUChar4Normalized = 9,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatChar2Normalized = 10,
 | 
			
		||||
    MTLAttributeFormatChar3Normalized = 11,
 | 
			
		||||
    MTLAttributeFormatChar4Normalized = 12,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUShort2 = 13,
 | 
			
		||||
    MTLAttributeFormatUShort3 = 14,
 | 
			
		||||
    MTLAttributeFormatUShort4 = 15,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatShort2 = 16,
 | 
			
		||||
    MTLAttributeFormatShort3 = 17,
 | 
			
		||||
    MTLAttributeFormatShort4 = 18,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUShort2Normalized = 19,
 | 
			
		||||
    MTLAttributeFormatUShort3Normalized = 20,
 | 
			
		||||
    MTLAttributeFormatUShort4Normalized = 21,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatShort2Normalized = 22,
 | 
			
		||||
    MTLAttributeFormatShort3Normalized = 23,
 | 
			
		||||
    MTLAttributeFormatShort4Normalized = 24,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatHalf2 = 25,
 | 
			
		||||
    MTLAttributeFormatHalf3 = 26,
 | 
			
		||||
    MTLAttributeFormatHalf4 = 27,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatFloat = 28,
 | 
			
		||||
    MTLAttributeFormatFloat2 = 29,
 | 
			
		||||
    MTLAttributeFormatFloat3 = 30,
 | 
			
		||||
    MTLAttributeFormatFloat4 = 31,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatInt = 32,
 | 
			
		||||
    MTLAttributeFormatInt2 = 33,
 | 
			
		||||
    MTLAttributeFormatInt3 = 34,
 | 
			
		||||
    MTLAttributeFormatInt4 = 35,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUInt = 36,
 | 
			
		||||
    MTLAttributeFormatUInt2 = 37,
 | 
			
		||||
    MTLAttributeFormatUInt3 = 38,
 | 
			
		||||
    MTLAttributeFormatUInt4 = 39,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatInt1010102Normalized = 40,
 | 
			
		||||
    MTLAttributeFormatUInt1010102Normalized = 41,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUChar4Normalized_BGRA API_AVAILABLE(macos(10.13), ios(11.0)) = 42,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUChar API_AVAILABLE(macos(10.13), ios(11.0)) = 45,
 | 
			
		||||
    MTLAttributeFormatChar API_AVAILABLE(macos(10.13), ios(11.0)) = 46,
 | 
			
		||||
    MTLAttributeFormatUCharNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 47,
 | 
			
		||||
    MTLAttributeFormatCharNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 48,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatUShort API_AVAILABLE(macos(10.13), ios(11.0)) = 49,
 | 
			
		||||
    MTLAttributeFormatShort API_AVAILABLE(macos(10.13), ios(11.0)) = 50,
 | 
			
		||||
    MTLAttributeFormatUShortNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 51,
 | 
			
		||||
    MTLAttributeFormatShortNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 52,
 | 
			
		||||
    
 | 
			
		||||
    MTLAttributeFormatHalf API_AVAILABLE(macos(10.13), ios(11.0)) = 53,
 | 
			
		||||
    
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLIndexType) {
 | 
			
		||||
    MTLIndexTypeUInt16 = 0,
 | 
			
		||||
    MTLIndexTypeUInt32 = 1,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLStepFunction)
 | 
			
		||||
{
 | 
			
		||||
    MTLStepFunctionConstant = 0,
 | 
			
		||||
 | 
			
		||||
    // vertex functions only
 | 
			
		||||
    MTLStepFunctionPerVertex = 1,
 | 
			
		||||
    MTLStepFunctionPerInstance = 2,
 | 
			
		||||
    MTLStepFunctionPerPatch API_AVAILABLE(macos(10.12), ios(10.0)) = 3,
 | 
			
		||||
    MTLStepFunctionPerPatchControlPoint API_AVAILABLE(macos(10.12), ios(10.0)) = 4,
 | 
			
		||||
 | 
			
		||||
    // compute functions only
 | 
			
		||||
    MTLStepFunctionThreadPositionInGridX = 5,
 | 
			
		||||
    MTLStepFunctionThreadPositionInGridY = 6,
 | 
			
		||||
    MTLStepFunctionThreadPositionInGridXIndexed = 7,
 | 
			
		||||
    MTLStepFunctionThreadPositionInGridYIndexed = 8,
 | 
			
		||||
} API_AVAILABLE(macos(10.12), ios(10.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLBufferLayoutDescriptor : NSObject <NSCopying>
 | 
			
		||||
@property (assign, nonatomic) NSUInteger stride;
 | 
			
		||||
@property (assign, nonatomic) MTLStepFunction stepFunction;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger stepRate;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLBufferLayoutDescriptorArray : NSObject
 | 
			
		||||
- (MTLBufferLayoutDescriptor *)objectAtIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
- (void)setObject:(nullable MTLBufferLayoutDescriptor *)bufferDesc atIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLAttributeDescriptor : NSObject <NSCopying>
 | 
			
		||||
@property (assign, nonatomic) MTLAttributeFormat format;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger offset;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger bufferIndex;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLAttributeDescriptorArray : NSObject
 | 
			
		||||
- (MTLAttributeDescriptor *)objectAtIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
- (void)setObject:(nullable MTLAttributeDescriptor *)attributeDesc atIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 MTLStageInputOutputDescriptor
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.12), ios(10.0))
 | 
			
		||||
@interface MTLStageInputOutputDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
+ (MTLStageInputOutputDescriptor *)stageInputOutputDescriptor;
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLBufferLayoutDescriptorArray *layouts;
 | 
			
		||||
@property (readonly) MTLAttributeDescriptorArray *attributes;
 | 
			
		||||
 | 
			
		||||
/* only used for compute with MTLStepFunction...Indexed */
 | 
			
		||||
@property (assign, nonatomic) MTLIndexType indexType;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger indexBufferIndex;
 | 
			
		||||
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,468 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLTexture.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
#import <Metal/MTLBuffer.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <IOSurface/IOSurface.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLTextureType
 | 
			
		||||
 @abstract MTLTextureType describes the dimensionality of each image, and if multiple images are arranged into an array or cube.
 | 
			
		||||
 */
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLTextureType)
 | 
			
		||||
{
 | 
			
		||||
    MTLTextureType1D = 0,
 | 
			
		||||
    MTLTextureType1DArray = 1,
 | 
			
		||||
    MTLTextureType2D = 2,
 | 
			
		||||
    MTLTextureType2DArray = 3,
 | 
			
		||||
    MTLTextureType2DMultisample = 4,
 | 
			
		||||
    MTLTextureTypeCube = 5,
 | 
			
		||||
    MTLTextureTypeCubeArray API_AVAILABLE(macos(10.11), ios(11.0)) = 6,
 | 
			
		||||
    MTLTextureType3D = 7,
 | 
			
		||||
    MTLTextureType2DMultisampleArray API_AVAILABLE(macos(10.14), ios(14.0)) = 8,
 | 
			
		||||
    MTLTextureTypeTextureBuffer API_AVAILABLE(macos(10.14), ios(12.0)) = 9
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(uint8_t, MTLTextureSwizzle) {
 | 
			
		||||
    MTLTextureSwizzleZero = 0,
 | 
			
		||||
    MTLTextureSwizzleOne = 1,
 | 
			
		||||
    MTLTextureSwizzleRed = 2,
 | 
			
		||||
    MTLTextureSwizzleGreen = 3,
 | 
			
		||||
    MTLTextureSwizzleBlue = 4,
 | 
			
		||||
    MTLTextureSwizzleAlpha = 5,
 | 
			
		||||
} API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    MTLTextureSwizzle red;
 | 
			
		||||
    MTLTextureSwizzle green;
 | 
			
		||||
    MTLTextureSwizzle blue;
 | 
			
		||||
    MTLTextureSwizzle alpha;
 | 
			
		||||
} MTLTextureSwizzleChannels API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(10.15), ios(13.0)) NS_SWIFT_UNAVAILABLE("Use MTLTextureSwizzleChannels.init instead")
 | 
			
		||||
MTL_INLINE MTLTextureSwizzleChannels MTLTextureSwizzleChannelsMake(MTLTextureSwizzle r, MTLTextureSwizzle g, MTLTextureSwizzle b, MTLTextureSwizzle a)
 | 
			
		||||
{
 | 
			
		||||
    MTLTextureSwizzleChannels swizzle;
 | 
			
		||||
    swizzle.red = r;
 | 
			
		||||
    swizzle.green = g;
 | 
			
		||||
    swizzle.blue = b;
 | 
			
		||||
    swizzle.alpha = a;
 | 
			
		||||
    return swizzle;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define MTLTextureSwizzleChannelsDefault (MTLTextureSwizzleChannelsMake(MTLTextureSwizzleRed, MTLTextureSwizzleGreen, MTLTextureSwizzleBlue, MTLTextureSwizzleAlpha))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.14), ios(13.0))
 | 
			
		||||
@interface MTLSharedTextureHandle : NSObject <NSSecureCoding>
 | 
			
		||||
{
 | 
			
		||||
    struct MTLSharedTextureHandlePrivate *_priv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property device
 | 
			
		||||
 @abstract The device this texture was created against.
 | 
			
		||||
 @discussion This shared texture handle can only be used with this device.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) id <MTLDevice> device;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property label
 | 
			
		||||
 @abstract A copy of the original texture's label property, if any
 | 
			
		||||
*/
 | 
			
		||||
@property (readonly, nullable) NSString *label;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLTextureUsage
 | 
			
		||||
 @abstract MTLTextureUsage declares how the texture will be used over its lifetime (bitwise OR for multiple uses).
 | 
			
		||||
 @discussion This information may be used by the driver to make optimization decisions.
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_OPTIONS(NSUInteger, MTLTextureUsage)
 | 
			
		||||
{
 | 
			
		||||
    MTLTextureUsageUnknown         = 0x0000,
 | 
			
		||||
    MTLTextureUsageShaderRead      = 0x0001,
 | 
			
		||||
    MTLTextureUsageShaderWrite     = 0x0002,
 | 
			
		||||
    MTLTextureUsageRenderTarget    = 0x0004,
 | 
			
		||||
    MTLTextureUsagePixelFormatView = 0x0010,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLTextureDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method texture2DDescriptorWithPixelFormat:width:height:mipmapped:
 | 
			
		||||
 @abstract Create a TextureDescriptor for a common 2D texture.
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLTextureDescriptor*)texture2DDescriptorWithPixelFormat:(MTLPixelFormat)pixelFormat width:(NSUInteger)width height:(NSUInteger)height mipmapped:(BOOL)mipmapped;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method textureCubeDescriptorWithPixelFormat:size:mipmapped:
 | 
			
		||||
 @abstract Create a TextureDescriptor for a common Cube texture.
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLTextureDescriptor*)textureCubeDescriptorWithPixelFormat:(MTLPixelFormat)pixelFormat size:(NSUInteger)size mipmapped:(BOOL)mipmapped;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method textureBufferDescriptorWithPixelFormat:width:resourceOptions:usage:
 | 
			
		||||
 @abstract Create a TextureDescriptor for a common texture buffer.
 | 
			
		||||
 */
 | 
			
		||||
+ (MTLTextureDescriptor*)textureBufferDescriptorWithPixelFormat:(MTLPixelFormat)pixelFormat
 | 
			
		||||
                                                          width:(NSUInteger)width
 | 
			
		||||
                                                resourceOptions:(MTLResourceOptions)resourceOptions
 | 
			
		||||
                                                          usage:(MTLTextureUsage)usage API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property type
 | 
			
		||||
 @abstract The overall type of the texture to be created. The default value is MTLTextureType2D.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLTextureType textureType;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property pixelFormat
 | 
			
		||||
 @abstract The pixel format to use when allocating this texture. This is also the pixel format that will be used to when the caller writes or reads pixels from this texture. The default value is MTLPixelFormatRGBA8Unorm.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLPixelFormat pixelFormat;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property width
 | 
			
		||||
 @abstract The width of the texture to create. The default value is 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger width;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property height
 | 
			
		||||
 @abstract The height of the texture to create. The default value is 1.
 | 
			
		||||
 @discussion height If allocating a 1D texture, height must be 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger height;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property depth
 | 
			
		||||
 @abstract The depth of the texture to create. The default value is 1.
 | 
			
		||||
 @discussion depth When allocating any texture types other than 3D, depth must be 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger depth;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property mipmapLevelCount
 | 
			
		||||
 @abstract The number of mipmap levels to allocate. The default value is 1.
 | 
			
		||||
 @discussion When creating Buffer and Multisample textures, mipmapLevelCount must be 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger mipmapLevelCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleCount
 | 
			
		||||
 @abstract The number of samples in the texture to create. The default value is 1.
 | 
			
		||||
 @discussion When creating Buffer textures sampleCount must be 1. Implementations may round sample counts up to the next supported value.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger sampleCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property arrayLength
 | 
			
		||||
 @abstract The number of array elements to allocate. The default value is 1.
 | 
			
		||||
 @discussion When allocating any non-Array texture type, arrayLength has to be 1. Otherwise it must be set to something greater than 1 and less than 2048.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) NSUInteger arrayLength;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property resourceOptions
 | 
			
		||||
 @abstract Options to control memory allocation parameters, etc.
 | 
			
		||||
 @discussion Contains a packed set of the storageMode, cpuCacheMode and hazardTrackingMode properties.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLResourceOptions resourceOptions;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property cpuCacheMode
 | 
			
		||||
 @abstract Options to specify CPU cache mode of texture resource.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLCPUCacheMode cpuCacheMode API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property storageMode
 | 
			
		||||
 @abstract To specify storage mode of texture resource.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLStorageMode storageMode API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property hazardTrackingMode
 | 
			
		||||
 @abstract Set hazard tracking mode for the texture. The default value is MTLHazardTrackingModeDefault.
 | 
			
		||||
 @discussion
 | 
			
		||||
 For resources created from the device, MTLHazardTrackingModeDefault is treated as MTLHazardTrackingModeTracked.
 | 
			
		||||
 For resources created on a heap, MTLHazardTrackingModeDefault is treated as the hazardTrackingMode of the heap itself.
 | 
			
		||||
 In either case, it is possible to opt-out of hazard tracking by setting MTLHazardTrackingModeUntracked.
 | 
			
		||||
 It is not possible to opt-in to hazard tracking on a heap that itself is not hazard tracked.
 | 
			
		||||
 For optimal performance, perform hazard tracking manually through MTLFence or MTLEvent instead.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLHazardTrackingMode hazardTrackingMode API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property usage
 | 
			
		||||
 @abstract Description of texture usage
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLTextureUsage usage API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property allowGPUOptimizedContents
 | 
			
		||||
 @abstract Allow GPU-optimization for the contents of this texture. The default value is true.
 | 
			
		||||
 @discussion Useful for opting-out of GPU-optimization when implicit optimization (e.g. RT writes) is regressing CPU-read-back performance. See the documentation for optimizeContentsForGPUAccess: and optimizeContentsForCPUAccess: APIs.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) BOOL allowGPUOptimizedContents API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property swizzle
 | 
			
		||||
 @abstract Channel swizzle to use when reading or sampling from the texture, the default value is MTLTextureSwizzleChannelsDefault.
 | 
			
		||||
 */
 | 
			
		||||
@property (readwrite, nonatomic) MTLTextureSwizzleChannels swizzle API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @protocol MTLTexture
 | 
			
		||||
 @abstract MTLTexture represents a collection of 1D, 2D, or 3D images.
 | 
			
		||||
 @discussion
 | 
			
		||||
 Each image in a texture is a 1D, 2D, 2DMultisample, or 3D image. The texture contains one or more images arranged in a mipmap stack. If there are multiple mipmap stacks, each one is referred to as a slice of the texture. 1D, 2D, 2DMultisample, and 3D textures have a single slice. In 1DArray and 2DArray textures, every slice is an array element. A Cube texture always has 6 slices, one for each face. In a CubeArray texture, each set of six slices is one element in the array.
 | 
			
		||||
 
 | 
			
		||||
 Most APIs that operate on individual images in a texture address those images via a tuple of a Slice, and Mipmap Level within that slice.
 | 
			
		||||
 */
 | 
			
		||||
API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@protocol MTLTexture <MTLResource>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property rootResource
 | 
			
		||||
 @abstract The resource this texture was created from. It may be a texture or a buffer. If this texture is not reusing storage of another MTLResource, then nil is returned.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) id <MTLResource> rootResource API_DEPRECATED("Use parentTexture or buffer instead", macos(10.11, 10.12), ios(8.0, 10.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property parentTexture
 | 
			
		||||
 @abstract The texture this texture view was created from, or nil if this is not a texture view or it was not created from a texture.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) id <MTLTexture> parentTexture API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property parentRelativeLevel
 | 
			
		||||
 @abstract The base level of the texture this texture view was created from, or 0 if this is not a texture view.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger parentRelativeLevel API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property parentRelativeSlice
 | 
			
		||||
 @abstract The base slice of the texture this texture view was created from, or 0 if this is not a texture view.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger parentRelativeSlice API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property buffer
 | 
			
		||||
 @abstract The buffer this texture view was created from, or nil if this is not a texture view or it was not created from a buffer.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) id <MTLBuffer> buffer API_AVAILABLE(macos(10.12), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property bufferOffset
 | 
			
		||||
 @abstract The offset of the buffer this texture view was created from, or 0 if this is not a texture view.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger bufferOffset API_AVAILABLE(macos(10.12), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property bufferBytesPerRow
 | 
			
		||||
 @abstract The bytesPerRow of the buffer this texture view was created from, or 0 if this is not a texture view.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger bufferBytesPerRow API_AVAILABLE(macos(10.12), ios(9.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property iosurface
 | 
			
		||||
 @abstract If this texture was created from an IOSurface, this returns a reference to that IOSurface. iosurface is nil if this texture was not created from an IOSurface.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) IOSurfaceRef iosurface API_AVAILABLE(macos(10.11), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property iosurfacePlane
 | 
			
		||||
 @abstract If this texture was created from an IOSurface, this returns the plane of the IOSurface from which the texture was created. iosurfacePlane is 0 if this texture was not created from an IOSurface.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger iosurfacePlane API_AVAILABLE(macos(10.11), ios(11.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property type
 | 
			
		||||
 @abstract The type of this texture.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLTextureType textureType;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property pixelFormat
 | 
			
		||||
 @abstract The MTLPixelFormat that is used to interpret this texture's contents.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLPixelFormat pixelFormat;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property width
 | 
			
		||||
 @abstract The width of the MTLTexture instance in pixels.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger width;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property height
 | 
			
		||||
 @abstract The height of the MTLTexture instance in pixels.
 | 
			
		||||
 @discussion. height is 1 if the texture is 1D.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger height;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property depth
 | 
			
		||||
 @abstract The depth of this MTLTexture instance in pixels.
 | 
			
		||||
 @discussion If this MTLTexture is not a 3D texture, the depth is 1
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger depth;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property mipmapLevelCount
 | 
			
		||||
 @abstract The number of mipmap levels in each slice of this MTLTexture.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger mipmapLevelCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property sampleCount
 | 
			
		||||
 @abstract The number of samples in each pixel of this MTLTexture.
 | 
			
		||||
 @discussion If this texture is any type other than 2DMultisample, samples is 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger sampleCount;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property arrayLength
 | 
			
		||||
 @abstract The number of array elements in this MTLTexture.
 | 
			
		||||
 @discussion For non-Array texture types, arrayLength is 1.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger arrayLength;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property usage
 | 
			
		||||
 @abstract Description of texture usage.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) MTLTextureUsage usage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property shareable
 | 
			
		||||
 @abstract If YES, this texture can be shared with other processes.
 | 
			
		||||
 @discussion Texture can be shared across process addres space boundaries through use of sharedTextureHandle and XPC.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, getter = isShareable) BOOL shareable API_AVAILABLE(macos(10.14), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property framebufferOnly
 | 
			
		||||
 @abstract If YES, this texture can only be used with a MTLAttachmentDescriptor, and cannot be used as a texture argument for MTLRenderCommandEncoder, MTLBlitCommandEncoder, or MTLComputeCommandEncoder. Furthermore, when this property's value is YES, readPixels/writePixels may not be used with this texture.
 | 
			
		||||
 @discussion Textures obtained from CAMetalDrawables may have this property set to YES, depending on the value of frameBufferOnly passed to their parent CAMetalLayer. Textures created directly by the application will not have any restrictions.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, getter = isFramebufferOnly) BOOL framebufferOnly;
 | 
			
		||||
 | 
			
		||||
@optional
 | 
			
		||||
/*!
 | 
			
		||||
 @property firstMipmapInTail
 | 
			
		||||
 @abstract For sparse textures this property returns index of first mipmap that is packed in tail.
 | 
			
		||||
 Mapping this mipmap level will map all subsequent mipmap levels.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger firstMipmapInTail API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property tailSizeInBytes
 | 
			
		||||
 @abstract Amount of memory in bytes required to map sparse texture tail.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) NSUInteger tailSizeInBytes API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
 | 
			
		||||
@property (readonly) BOOL isSparse API_AVAILABLE(macos(11.0), macCatalyst(14.0), ios(13.0));
 | 
			
		||||
@required
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property allowGPUOptimizedContents
 | 
			
		||||
 @abstract Allow GPU-optimization for the contents texture. The default value is true.
 | 
			
		||||
 @discussion Useful for opting-out of GPU-optimization when implicit optimization (e.g. RT writes) is regressing CPU-read-back performance. See the documentation for optimizeContentsForGPUAccess: and optimizeContentsForCPUAccess: APIs.
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly) BOOL allowGPUOptimizedContents API_AVAILABLE(macos(10.14), ios(12.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice:
 | 
			
		||||
 @abstract Copies a block of pixels from a texture slice into the application's memory.
 | 
			
		||||
 */
 | 
			
		||||
- (void)getBytes:(void *)pixelBytes bytesPerRow:(NSUInteger)bytesPerRow bytesPerImage:(NSUInteger)bytesPerImage fromRegion:(MTLRegion)region mipmapLevel:(NSUInteger)level slice:(NSUInteger)slice;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:
 | 
			
		||||
 @abstract Copy a block of pixel data from the caller's pointer into a texture slice.
 | 
			
		||||
 */
 | 
			
		||||
- (void)replaceRegion:(MTLRegion)region mipmapLevel:(NSUInteger)level slice:(NSUInteger)slice withBytes:(const void *)pixelBytes bytesPerRow:(NSUInteger)bytesPerRow bytesPerImage:(NSUInteger)bytesPerImage;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method getBytes:bytesPerRow:fromRegion:mipmapLevel:
 | 
			
		||||
 @abstract Convenience for getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice: that doesn't require slice related arguments
 | 
			
		||||
 */
 | 
			
		||||
- (void)getBytes:(void *)pixelBytes bytesPerRow:(NSUInteger)bytesPerRow fromRegion:(MTLRegion)region mipmapLevel:(NSUInteger)level;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method replaceRegion:mipmapLevel:withBytes:bytesPerRow:
 | 
			
		||||
 @abstract Convenience for replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage: that doesn't require slice related arguments
 | 
			
		||||
 */
 | 
			
		||||
- (void)replaceRegion:(MTLRegion)region mipmapLevel:(NSUInteger)level withBytes:(const void *)pixelBytes bytesPerRow:(NSUInteger)bytesPerRow;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newTextureViewWithPixelFormat:
 | 
			
		||||
 @abstract Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLTexture>)newTextureViewWithPixelFormat:(MTLPixelFormat)pixelFormat;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newTextureViewWithPixelFormat:textureType:levels:slices:
 | 
			
		||||
 @abstract Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format, texture type, levels and slices.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLTexture>)newTextureViewWithPixelFormat:(MTLPixelFormat)pixelFormat textureType:(MTLTextureType)textureType levels:(NSRange)levelRange slices:(NSRange)sliceRange API_AVAILABLE(macos(10.11), ios(9.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newSharedTextureHandle
 | 
			
		||||
 @abstract Create a new texture handle, that can be shared across process addres space boundaries.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable MTLSharedTextureHandle *)newSharedTextureHandle API_AVAILABLE(macos(10.14), ios(13.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property remoteStorageTexture
 | 
			
		||||
 @abstract For Metal texture objects that are remote views, this returns the texture associated with the storage on the originating device.
 | 
			
		||||
 */
 | 
			
		||||
@property (nullable, readonly) id<MTLTexture> remoteStorageTexture API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newRemoteTextureViewForDevice:
 | 
			
		||||
 @abstract On Metal devices that support peer to peer transfers, this method is used to create a remote texture view on another device
 | 
			
		||||
 within the peer group.  The receiver must use MTLStorageModePrivate or be backed by an IOSurface.
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id <MTLTexture>) newRemoteTextureViewForDevice:(id <MTLDevice>)device API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @property swizzle
 | 
			
		||||
 @abstract The channel swizzle used when reading or sampling from this texture
 | 
			
		||||
 */
 | 
			
		||||
@property (readonly, nonatomic) MTLTextureSwizzleChannels swizzle API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method newTextureViewWithPixelFormat:textureType:levels:slices:swizzle:
 | 
			
		||||
 @abstract Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format, texture type, levels, slices and swizzle. 
 | 
			
		||||
 */
 | 
			
		||||
- (nullable id<MTLTexture>)newTextureViewWithPixelFormat:(MTLPixelFormat)pixelFormat textureType:(MTLTextureType)textureType levels:(NSRange)levelRange slices:(NSRange)sliceRange swizzle:(MTLTextureSwizzleChannels)swizzle API_AVAILABLE(macos(10.15), ios(13.0));
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,104 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLTypes.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Foundation/Foundation.h>
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @struct MTLOrigin
 | 
			
		||||
 @abstract Identify a pixel in an image. MTLOrigin is ususally used as the upper-left corner of a region of a texture.
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    NSUInteger x, y, z;
 | 
			
		||||
} MTLOrigin;
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLOrigin MTLOriginMake(NSUInteger x, NSUInteger y, NSUInteger z)
 | 
			
		||||
{
 | 
			
		||||
    MTLOrigin origin = {x, y, z};
 | 
			
		||||
    return origin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @typedef MTLSize
 | 
			
		||||
 @abstract A set of dimensions to declare the size of an object, such as an image, texture, threadgroup, or grid.
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    NSUInteger width, height, depth;
 | 
			
		||||
} MTLSize;
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLSize MTLSizeMake(NSUInteger width, NSUInteger height, NSUInteger depth)
 | 
			
		||||
{
 | 
			
		||||
    MTLSize size = {width, height, depth};
 | 
			
		||||
    return size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @struct MTLRegion
 | 
			
		||||
 @abstract Identify a region in an image or texture.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    MTLOrigin origin;
 | 
			
		||||
    MTLSize   size;
 | 
			
		||||
} MTLRegion;
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLRegion MTLRegionMake1D(NSUInteger x, NSUInteger width)
 | 
			
		||||
{
 | 
			
		||||
    MTLRegion region;
 | 
			
		||||
    region.origin.x = x; region.origin.y = 0; region.origin.z = 0;
 | 
			
		||||
    region.size.width = width; region.size.height = 1; region.size.depth = 1;
 | 
			
		||||
    return region;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLRegion MTLRegionMake2D(NSUInteger x, NSUInteger y, NSUInteger width, NSUInteger height)
 | 
			
		||||
{
 | 
			
		||||
    MTLRegion region;
 | 
			
		||||
    region.origin.x = x; region.origin.y = y; region.origin.z = 0;
 | 
			
		||||
    region.size.width = width; region.size.height = height; region.size.depth = 1;
 | 
			
		||||
    return region;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLRegion MTLRegionMake3D(NSUInteger x, NSUInteger y, NSUInteger z, NSUInteger width, NSUInteger height, NSUInteger depth)
 | 
			
		||||
{
 | 
			
		||||
    MTLRegion region;
 | 
			
		||||
    region.origin.x = x; region.origin.y = y; region.origin.z = z;
 | 
			
		||||
    region.size.width = width; region.size.height = height; region.size.depth = depth;
 | 
			
		||||
    return region;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @struct MTLSamplePosition
 | 
			
		||||
 @abstract Identify a sample within a pixel. Origin is top-left with a range [0,1) for both x and y.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    float x, y;
 | 
			
		||||
} MTLSamplePosition;
 | 
			
		||||
 | 
			
		||||
MTL_INLINE MTLSamplePosition MTLSamplePositionMake(float x, float y) API_AVAILABLE(macos(10.13), ios(11.0))
 | 
			
		||||
{
 | 
			
		||||
    MTLSamplePosition position = {x, y};
 | 
			
		||||
    return position;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @typedef MTLCoordinate2D
 | 
			
		||||
 @abstract A floating point coordinate in an abstract 2D space.
 | 
			
		||||
 Refer to location of use for concrete information on the space in which the coordinate exists.
 | 
			
		||||
 */
 | 
			
		||||
typedef MTLSamplePosition MTLCoordinate2D;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @function MTLCoordinate2DMake
 | 
			
		||||
 @abstract Convenience function to create a 2D coordinate from 2 values.
 | 
			
		||||
 */
 | 
			
		||||
MTL_INLINE MTLCoordinate2D MTLCoordinate2DMake(float x, float y)
 | 
			
		||||
{
 | 
			
		||||
    MTLCoordinate2D result = {x, y};
 | 
			
		||||
    return result;
 | 
			
		||||
} 
 | 
			
		||||
@@ -0,0 +1,141 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLVertexDescriptor.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NS_ASSUME_NONNULL_BEGIN
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @enum MTLVertexFormat
 | 
			
		||||
 @abstract specifies how the vertex attribute data is laid out in memory.
 | 
			
		||||
*/
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLVertexFormat)
 | 
			
		||||
{
 | 
			
		||||
    MTLVertexFormatInvalid = 0,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUChar2 = 1,
 | 
			
		||||
    MTLVertexFormatUChar3 = 2,
 | 
			
		||||
    MTLVertexFormatUChar4 = 3,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatChar2 = 4,
 | 
			
		||||
    MTLVertexFormatChar3 = 5,
 | 
			
		||||
    MTLVertexFormatChar4 = 6,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUChar2Normalized = 7,
 | 
			
		||||
    MTLVertexFormatUChar3Normalized = 8,
 | 
			
		||||
    MTLVertexFormatUChar4Normalized = 9,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatChar2Normalized = 10,
 | 
			
		||||
    MTLVertexFormatChar3Normalized = 11,
 | 
			
		||||
    MTLVertexFormatChar4Normalized = 12,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUShort2 = 13,
 | 
			
		||||
    MTLVertexFormatUShort3 = 14,
 | 
			
		||||
    MTLVertexFormatUShort4 = 15,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatShort2 = 16,
 | 
			
		||||
    MTLVertexFormatShort3 = 17,
 | 
			
		||||
    MTLVertexFormatShort4 = 18,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUShort2Normalized = 19,
 | 
			
		||||
    MTLVertexFormatUShort3Normalized = 20,
 | 
			
		||||
    MTLVertexFormatUShort4Normalized = 21,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatShort2Normalized = 22,
 | 
			
		||||
    MTLVertexFormatShort3Normalized = 23,
 | 
			
		||||
    MTLVertexFormatShort4Normalized = 24,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatHalf2 = 25,
 | 
			
		||||
    MTLVertexFormatHalf3 = 26,
 | 
			
		||||
    MTLVertexFormatHalf4 = 27,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatFloat = 28,
 | 
			
		||||
    MTLVertexFormatFloat2 = 29,
 | 
			
		||||
    MTLVertexFormatFloat3 = 30,
 | 
			
		||||
    MTLVertexFormatFloat4 = 31,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatInt = 32,
 | 
			
		||||
    MTLVertexFormatInt2 = 33,
 | 
			
		||||
    MTLVertexFormatInt3 = 34,
 | 
			
		||||
    MTLVertexFormatInt4 = 35,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUInt = 36,
 | 
			
		||||
    MTLVertexFormatUInt2 = 37,
 | 
			
		||||
    MTLVertexFormatUInt3 = 38,
 | 
			
		||||
    MTLVertexFormatUInt4 = 39,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatInt1010102Normalized = 40,
 | 
			
		||||
    MTLVertexFormatUInt1010102Normalized = 41,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUChar4Normalized_BGRA API_AVAILABLE(macos(10.13), ios(11.0)) = 42,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUChar API_AVAILABLE(macos(10.13), ios(11.0)) = 45,
 | 
			
		||||
    MTLVertexFormatChar API_AVAILABLE(macos(10.13), ios(11.0)) = 46,
 | 
			
		||||
    MTLVertexFormatUCharNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 47,
 | 
			
		||||
    MTLVertexFormatCharNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 48,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatUShort API_AVAILABLE(macos(10.13), ios(11.0)) = 49,
 | 
			
		||||
    MTLVertexFormatShort API_AVAILABLE(macos(10.13), ios(11.0)) = 50,
 | 
			
		||||
    MTLVertexFormatUShortNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 51,
 | 
			
		||||
    MTLVertexFormatShortNormalized API_AVAILABLE(macos(10.13), ios(11.0)) = 52,
 | 
			
		||||
    
 | 
			
		||||
    MTLVertexFormatHalf API_AVAILABLE(macos(10.13), ios(11.0)) = 53,
 | 
			
		||||
    
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
typedef NS_ENUM(NSUInteger, MTLVertexStepFunction)
 | 
			
		||||
{
 | 
			
		||||
    MTLVertexStepFunctionConstant = 0,
 | 
			
		||||
    MTLVertexStepFunctionPerVertex = 1,
 | 
			
		||||
    MTLVertexStepFunctionPerInstance = 2,
 | 
			
		||||
    MTLVertexStepFunctionPerPatch API_AVAILABLE(macos(10.12), ios(10.0)) = 3,
 | 
			
		||||
    MTLVertexStepFunctionPerPatchControlPoint API_AVAILABLE(macos(10.12), ios(10.0)) = 4,
 | 
			
		||||
} API_AVAILABLE(macos(10.11), ios(8.0));
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLVertexBufferLayoutDescriptor : NSObject <NSCopying>
 | 
			
		||||
@property (assign, nonatomic) NSUInteger stride;
 | 
			
		||||
@property (assign, nonatomic) MTLVertexStepFunction stepFunction;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger stepRate;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLVertexBufferLayoutDescriptorArray : NSObject
 | 
			
		||||
- (MTLVertexBufferLayoutDescriptor *)objectAtIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
- (void)setObject:(nullable MTLVertexBufferLayoutDescriptor *)bufferDesc atIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLVertexAttributeDescriptor : NSObject <NSCopying>
 | 
			
		||||
@property (assign, nonatomic) MTLVertexFormat format;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger offset;
 | 
			
		||||
@property (assign, nonatomic) NSUInteger bufferIndex;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLVertexAttributeDescriptorArray : NSObject
 | 
			
		||||
- (MTLVertexAttributeDescriptor *)objectAtIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
- (void)setObject:(nullable MTLVertexAttributeDescriptor *)attributeDesc atIndexedSubscript:(NSUInteger)index;
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 MTLVertexDescriptor
 | 
			
		||||
 */
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(10.11), ios(8.0))
 | 
			
		||||
@interface MTLVertexDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
+ (MTLVertexDescriptor *)vertexDescriptor;
 | 
			
		||||
 | 
			
		||||
@property (readonly) MTLVertexBufferLayoutDescriptorArray *layouts;
 | 
			
		||||
@property (readonly) MTLVertexAttributeDescriptorArray *attributes;
 | 
			
		||||
 | 
			
		||||
- (void)reset;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
NS_ASSUME_NONNULL_END
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
//
 | 
			
		||||
//  MTLVisibleFunctionTable.h
 | 
			
		||||
//  Framework
 | 
			
		||||
//
 | 
			
		||||
//  Copyright © 2020 Apple, Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLResource.h>
 | 
			
		||||
#import <Metal/MTLFunctionHandle.h>
 | 
			
		||||
 | 
			
		||||
MTL_EXPORT API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@interface MTLVisibleFunctionTableDescriptor : NSObject <NSCopying>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 @method visibleFunctionTableDescriptor
 | 
			
		||||
 @abstract Create an autoreleased visible function table descriptor
 | 
			
		||||
 */
 | 
			
		||||
+ (nonnull MTLVisibleFunctionTableDescriptor *)visibleFunctionTableDescriptor;
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
* @property functionCount
 | 
			
		||||
* @abstract The number of functions in the table.
 | 
			
		||||
*/
 | 
			
		||||
@property (nonatomic) NSUInteger functionCount;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
API_AVAILABLE(macos(11.0), ios(14.0))
 | 
			
		||||
@protocol MTLVisibleFunctionTable <MTLResource>
 | 
			
		||||
 | 
			
		||||
- (void)setFunction:(nullable id <MTLFunctionHandle>)function atIndex:(NSUInteger)index;
 | 
			
		||||
 | 
			
		||||
- (void)setFunctions:(const id <MTLFunctionHandle> __nullable [__nonnull])functions withRange:(NSRange)range;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
//
 | 
			
		||||
//  Metal.h
 | 
			
		||||
//  Metal
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2014 Apple Inc. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <Metal/MTLDefines.h>
 | 
			
		||||
#import <Metal/MTLTypes.h>
 | 
			
		||||
#import <Metal/MTLBlitCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLBuffer.h>
 | 
			
		||||
#import <Metal/MTLCommandBuffer.h>
 | 
			
		||||
#import <Metal/MTLComputeCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLCommandQueue.h>
 | 
			
		||||
#import <Metal/MTLCounters.h>
 | 
			
		||||
#import <Metal/MTLDevice.h>
 | 
			
		||||
#import <Metal/MTLDepthStencil.h>
 | 
			
		||||
#import <Metal/MTLDrawable.h>
 | 
			
		||||
#import <Metal/MTLRenderPass.h>
 | 
			
		||||
#import <Metal/MTLComputePass.h>
 | 
			
		||||
#import <Metal/MTLBlitPass.h>
 | 
			
		||||
#import <Metal/MTLResourceStatePass.h>
 | 
			
		||||
#import <Metal/MTLComputePipeline.h>
 | 
			
		||||
#import <Metal/MTLLibrary.h>
 | 
			
		||||
#import <Metal/MTLPixelFormat.h>
 | 
			
		||||
#import <Metal/MTLRenderPipeline.h>
 | 
			
		||||
#import <Metal/MTLVertexDescriptor.h>
 | 
			
		||||
#import <Metal/MTLParallelRenderCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLRenderCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLSampler.h>
 | 
			
		||||
#import <Metal/MTLTexture.h>
 | 
			
		||||
#import <Metal/MTLHeap.h>
 | 
			
		||||
#import <Metal/MTLArgumentEncoder.h>
 | 
			
		||||
#import <Metal/MTLCaptureManager.h>
 | 
			
		||||
#import <Metal/MTLCaptureScope.h>
 | 
			
		||||
#import <Metal/MTLIndirectCommandBuffer.h>
 | 
			
		||||
#import <Metal/MTLIndirectCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLFence.h>
 | 
			
		||||
#import <Metal/MTLEvent.h>
 | 
			
		||||
#import <Metal/MTLFunctionLog.h>
 | 
			
		||||
#import <Metal/MTLResourceStateCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLAccelerationStructureCommandEncoder.h>
 | 
			
		||||
#import <Metal/MTLRasterizationRate.h>
 | 
			
		||||
#import <Metal/MTLDynamicLibrary.h>
 | 
			
		||||
#import <Metal/MTLFunctionDescriptor.h>
 | 
			
		||||
#import <Metal/MTLLinkedFunctions.h>
 | 
			
		||||
#import <Metal/MTLFunctionHandle.h>
 | 
			
		||||
#import <Metal/MTLVisibleFunctionTable.h>
 | 
			
		||||
#import <Metal/MTLBinaryArchive.h>
 | 
			
		||||
#import <Metal/MTLIntersectionFunctionTable.h>
 | 
			
		||||
#import <Metal/MTLFunctionStitching.h>
 | 
			
		||||
@@ -0,0 +1,400 @@
 | 
			
		||||
--- !tapi-tbd
 | 
			
		||||
tbd-version:     4
 | 
			
		||||
targets:         [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 
 | 
			
		||||
                   arm64e-macos, arm64e-maccatalyst ]
 | 
			
		||||
uuids:
 | 
			
		||||
  - target:          x86_64-macos
 | 
			
		||||
    value:           9DAF91CE-093B-3347-A62A-C30606F62EFE
 | 
			
		||||
  - target:          x86_64-maccatalyst
 | 
			
		||||
    value:           9DAF91CE-093B-3347-A62A-C30606F62EFE
 | 
			
		||||
  - target:          arm64-macos
 | 
			
		||||
    value:           00000000-0000-0000-0000-000000000000
 | 
			
		||||
  - target:          arm64-maccatalyst
 | 
			
		||||
    value:           00000000-0000-0000-0000-000000000000
 | 
			
		||||
  - target:          arm64e-macos
 | 
			
		||||
    value:           E4C2E79B-A8DD-3D5F-9F53-3A5A721DEA21
 | 
			
		||||
  - target:          arm64e-maccatalyst
 | 
			
		||||
    value:           E4C2E79B-A8DD-3D5F-9F53-3A5A721DEA21
 | 
			
		||||
install-name:    '/System/Library/Frameworks/Metal.framework/Versions/A/Metal'
 | 
			
		||||
current-version: 257.24
 | 
			
		||||
exports:
 | 
			
		||||
  - targets:         [ x86_64-macos, arm64e-macos, x86_64-maccatalyst, arm64e-maccatalyst, 
 | 
			
		||||
                       arm64-macos, arm64-maccatalyst ]
 | 
			
		||||
    symbols:         [ _MTLAddDevice, _MTLAddDeviceClass, _MTLAddMessageObserver, 
 | 
			
		||||
                       _MTLBVHDescriptorForMTLAccelerationStructureDescriptor, _MTLBinaryArchiveDomain, 
 | 
			
		||||
                       _MTLBinaryFunctionPerformanceKeyFunctionName, _MTLCPUCacheModeString, 
 | 
			
		||||
                       _MTLCaptureEnabled, _MTLCaptureErrorDomain, _MTLCommandBufferCommitTime, 
 | 
			
		||||
                       _MTLCommandBufferCompletionHandlerEnqueueTime, _MTLCommandBufferCompletionHandlerExecutionTime, 
 | 
			
		||||
                       _MTLCommandBufferCreationTime, _MTLCommandBufferEncoderInfoErrorKey, 
 | 
			
		||||
                       _MTLCommandBufferEnqueueTime, _MTLCommandBufferErrorDomain, 
 | 
			
		||||
                       _MTLCommandBufferKernelCompleteTime, _MTLCommandBufferKernelScheduledTime, 
 | 
			
		||||
                       _MTLCommandBufferSubmitToHWTime, _MTLCommandBufferSubmitToKernelTime, 
 | 
			
		||||
                       _MTLCommonCounterClipperInvocations, _MTLCommonCounterClipperPrimitivesOut, 
 | 
			
		||||
                       _MTLCommonCounterComputeKernelInvocations, _MTLCommonCounterFragmentCycles, 
 | 
			
		||||
                       _MTLCommonCounterFragmentInvocations, _MTLCommonCounterFragmentsPassed, 
 | 
			
		||||
                       _MTLCommonCounterPostTessellationVertexCycles, _MTLCommonCounterPostTessellationVertexInvocations, 
 | 
			
		||||
                       _MTLCommonCounterRenderTargetWriteCycles, _MTLCommonCounterSetStageUtilization, 
 | 
			
		||||
                       _MTLCommonCounterSetStatistic, _MTLCommonCounterSetTimestamp, 
 | 
			
		||||
                       _MTLCommonCounterTessellationCycles, _MTLCommonCounterTessellationInputPatches, 
 | 
			
		||||
                       _MTLCommonCounterTimestamp, _MTLCommonCounterTotalCycles, 
 | 
			
		||||
                       _MTLCommonCounterVertexCycles, _MTLCommonCounterVertexInvocations, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyBackend, _MTLCompileTimeStatisticsKeyBackendCompilerBuildRequest, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyBinaryFunctions, _MTLCompileTimeStatisticsKeyCachedFunction, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyCompilerTotal, _MTLCompileTimeStatisticsKeyDriverTotal, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyDynamicLibraries, _MTLCompileTimeStatisticsKeyFrameworkInstrumentation, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyFrameworkTotal, _MTLCompileTimeStatisticsKeyFunctionName, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyLibrariesFromSource, _MTLCompileTimeStatisticsKeyMTLCompilerService, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyOptimization, _MTLCompileTimeStatisticsKeyPipelineTotal, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyPipelines, _MTLCompileTimeStatisticsKeyPipelinesCompute, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyPipelinesRender, _MTLCompileTimeStatisticsKeyTotal, 
 | 
			
		||||
                       _MTLCompileTimeStatisticsKeyTranslator, _MTLCopyAllDevices, 
 | 
			
		||||
                       _MTLCopyAllDevicesWithObserver, _MTLCopyDeviceForRegistryID, 
 | 
			
		||||
                       _MTLCounterDescriptionClipperInvocations, _MTLCounterDescriptionClipperPrimitivesOut, 
 | 
			
		||||
                       _MTLCounterDescriptionComputeKernelInvocations, _MTLCounterDescriptionFragmentCycles, 
 | 
			
		||||
                       _MTLCounterDescriptionFragmentInvocations, _MTLCounterDescriptionFragmentsPassed, 
 | 
			
		||||
                       _MTLCounterDescriptionPostTessellationVertexCycles, _MTLCounterDescriptionPostTessellationVertexInvocations, 
 | 
			
		||||
                       _MTLCounterDescriptionRenderTargetWriteCycles, _MTLCounterDescriptionTessellationCycles, 
 | 
			
		||||
                       _MTLCounterDescriptionTessellationInputPatches, _MTLCounterDescriptionTimestamp, 
 | 
			
		||||
                       _MTLCounterDescriptionTotalCycles, _MTLCounterDescriptionVertexCycles, 
 | 
			
		||||
                       _MTLCounterDescriptionVertexInvocations, _MTLCounterErrorDomain, 
 | 
			
		||||
                       _MTLCounterSetDescriptionStageUtilization, _MTLCounterSetDescriptionStatistics, 
 | 
			
		||||
                       _MTLCounterSetDescriptionTimestamp, _MTLCountersLayerEnabled, 
 | 
			
		||||
                       _MTLCreateCompilerConnectionManager, _MTLCreateDeviceWithID, 
 | 
			
		||||
                       _MTLCreateStructTypeFromArgumentDescriptors, _MTLCreateSystemDefaultDevice, 
 | 
			
		||||
                       _MTLDataTypeGetAlignment, _MTLDataTypeGetComponentCount, _MTLDataTypeGetComponentType, 
 | 
			
		||||
                       _MTLDataTypeGetShaderTypeName, _MTLDataTypeGetSignedType, 
 | 
			
		||||
                       _MTLDataTypeGetSize, _MTLDataTypeGetVectorDataType, _MTLDataTypeString, 
 | 
			
		||||
                       _MTLDebugValidateMTLPixelFormat, _MTLDeviceRemovalRequestedNotification, 
 | 
			
		||||
                       _MTLDeviceWasAddedNotification, _MTLDeviceWasRemovedNotification, 
 | 
			
		||||
                       _MTLDispatchListAppendBlock, _MTLDispatchListApply, _MTLDynamicLibraryDomain, 
 | 
			
		||||
                       _MTLDynamicLibraryLoadOptionsFromPipelineOptions, _MTLDynamicLibraryPerformanceKeyInstallName, 
 | 
			
		||||
                       _MTLEnumerateIndirectResources, _MTLFailureTypeGetEnabled, 
 | 
			
		||||
                       _MTLFailureTypeGetErrorModeType, _MTLFailureTypeSetErrorModeType, 
 | 
			
		||||
                       _MTLFeatureSetSupportsSamplingFromPixelFormat, _MTLFunctionTypeString, 
 | 
			
		||||
                       _MTLGPUFamilySupportsSamplingFromPixelFormat, _MTLGPUOperationString, 
 | 
			
		||||
                       _MTLGetAllArchitectures, _MTLGetArchitectures, _MTLGetDisallowedTextureUsagesWhenSwizzling, 
 | 
			
		||||
                       _MTLGetEnvDefault, _MTLGetGPUFamilyFromFeatureSet, _MTLGetModulesCachePath, 
 | 
			
		||||
                       _MTLGetOverridenDeviceCreationFlags, _MTLGetReportFailureBlock, 
 | 
			
		||||
                       _MTLGetShaderCachePath, _MTLGetTextureLevelInfoForDevice, 
 | 
			
		||||
                       _MTLGetTextureLevelInfoForDeviceWithOptions, _MTLGetWarningMode, 
 | 
			
		||||
                       _MTLHazardTrackingModeString, _MTLIOAccelCommandBufferStorageAllocResourceAtIndex, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageBeginKernelCommands, _MTLIOAccelCommandBufferStorageBeginSegment, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageCreate, _MTLIOAccelCommandBufferStorageCreateExt, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageDealloc, _MTLIOAccelCommandBufferStorageEndKernelCommands, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageEndSegment, _MTLIOAccelCommandBufferStorageFinalizeShmemHeader, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageGetSegmentListLockedPeerIndex, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageGetSegmentListPointers, _MTLIOAccelCommandBufferStorageGrowKernelCommandBuffer, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageGrowSegmentList, _MTLIOAccelCommandBufferStoragePoolCreate, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStoragePoolCreateStorage, _MTLIOAccelCommandBufferStoragePoolDealloc, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStoragePoolPurge, _MTLIOAccelCommandBufferStoragePoolReturnStorage, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageReleaseAllResources, _MTLIOAccelCommandBufferStorageReleaseDeviceShmems, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageReset, _MTLIOAccelCommandBufferStorageResumeSegment, 
 | 
			
		||||
                       _MTLIOAccelCommandBufferStorageSetSegmentListLockedPeerIndex, 
 | 
			
		||||
                       _MTLIOAccelDeviceShmemRelease, _MTLIOAccelPooledResourceRelease, 
 | 
			
		||||
                       _MTLIOAccelResourcePoolCreatePooledResource, _MTLLibraryErrorDomain, 
 | 
			
		||||
                       _MTLLibraryPerformanceKeyCachedLibrary, _MTLLibraryPerformanceKeyCoreImageSPI, 
 | 
			
		||||
                       _MTLLibraryPerformanceKeyFunctionNames, _MTLLibraryPerformanceKeyFunctionSpecialization, 
 | 
			
		||||
                       _MTLLibraryPerformanceKeyTotalFrontendTotalTime, _MTLMakeShaderCacheWritableByAllUsers, 
 | 
			
		||||
                       _MTLMessageArrayKey, _MTLOverrideDeviceCreationFlags, _MTLPipelinePerformanceKeyALUCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyBranchCount, _MTLPipelinePerformanceKeyCompilationTime, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyCompileTimeStatistics, _MTLPipelinePerformanceKeyDeviceAtomicCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyDeviceLoadCount, _MTLPipelinePerformanceKeyDeviceStoreCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyFP16InstructionCount, _MTLPipelinePerformanceKeyFP32InstructionCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyFragmentShader, _MTLPipelinePerformanceKeyINT16InstructionCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyINT32InstructionCount, _MTLPipelinePerformanceKeyInstructionCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyLoopCount, _MTLPipelinePerformanceKeyMaxTemporaryRegisters, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyMaxTheoreticalOccupancy, _MTLPipelinePerformanceKeyMaxThreadgroupMemory, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyMaxUniformRegisters, _MTLPipelinePerformanceKeyRemarks, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeySpillsCount, _MTLPipelinePerformanceKeyTemporaryRegisterCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyTextureReadCount, _MTLPipelinePerformanceKeyTextureWriteCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyThreadgroupAtomicCount, _MTLPipelinePerformanceKeyThreadgroupLoadCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyThreadgroupMemory, _MTLPipelinePerformanceKeyThreadgroupStoreCount, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyUniformRegisterCount, _MTLPipelinePerformanceKeyVertexShader, 
 | 
			
		||||
                       _MTLPipelinePerformanceKeyWaitCount, _MTLPixelFormatCompatibilityString, 
 | 
			
		||||
                       _MTLPixelFormatComputeTotalSizeUsed, _MTLPixelFormatComputeiOSTotalSizeUsed, 
 | 
			
		||||
                       _MTLPixelFormatGetInfo, _MTLPixelFormatGetInfoForDevice, _MTLPixelFormatGetName, 
 | 
			
		||||
                       _MTLPurgeableStateString, _MTLRangeAllocatorAllocate, _MTLRangeAllocatorAllocateRange, 
 | 
			
		||||
                       _MTLRangeAllocatorDeallocate, _MTLRangeAllocatorDestroy, _MTLRangeAllocatorGetFragmentCapacity, 
 | 
			
		||||
                       _MTLRangeAllocatorGetFragmentCount, _MTLRangeAllocatorGetFreeCount, 
 | 
			
		||||
                       _MTLRangeAllocatorGetMaxFreeSize, _MTLRangeAllocatorInit, 
 | 
			
		||||
                       _MTLRangeAllocatorSetFragmentCapacityIncrement, _MTLReadWriteTextureIsSupported, 
 | 
			
		||||
                       _MTLReleaseAssertionFailure, _MTLRemoveDeviceObserver, _MTLRemoveMessageObserver, 
 | 
			
		||||
                       _MTLRenderPipelineColorAttachmentDescriptorDescription, _MTLReportFailure, 
 | 
			
		||||
                       _MTLReportFailureTypeEnabled, _MTLResourceListAddResource, 
 | 
			
		||||
                       _MTLResourceListPoolCreateResourceList, _MTLResourceListRelease, 
 | 
			
		||||
                       _MTLResourceOptionsString, _MTLSamplerBorderColorString, _MTLSetCompilerTestMode, 
 | 
			
		||||
                       _MTLSetReportFailureBlock, _MTLSetShaderCachePath, _MTLSetWarningMode, 
 | 
			
		||||
                       _MTLStorageModeString, _MTLTagTypeString, _MTLTextureSwizzleChannelsToKey, 
 | 
			
		||||
                       _MTLTextureSwizzleKeyToChannels, _MTLTextureSwizzleString, 
 | 
			
		||||
                       _MTLTextureSwizzleViewSwizzle, _MTLTextureTypeString, _MTLTextureUsageString, 
 | 
			
		||||
                       _MTLTraceEnabled, _MTLTraceEnabledSPI, _MTLTraceEventSPI, 
 | 
			
		||||
                       _MTLValidateFeatureSupport, _MTLValidateFeatureSupportWithContext, 
 | 
			
		||||
                       _MTLValidationEnabled, _MTLValidationErrorDomain, _MTLVertexAmplificationModeString, 
 | 
			
		||||
                       __MTLAddCompileBinaryFunctionPerformanceStatistics, __MTLAddCompileDynamicLibraryPerformanceStatistics, 
 | 
			
		||||
                       __MTLAddCompileLibraryPerformanceStatistics, __MTLAddCompilePipelinePerformanceStatistics, 
 | 
			
		||||
                       __MTLAddCompilerServiceCompileTimeStats, __MTLAdjustMTLSize, 
 | 
			
		||||
                       __MTLCompatibleTextureDataTypeAndPixelFormat, __MTLCompatibleTextureDataTypeAndPixelFormatInfo, 
 | 
			
		||||
                       __MTLCompilePerformanceStatisticsEnabled, __MTLCompileTimeStatistics, 
 | 
			
		||||
                       __MTLConstantDataSize, __MTLDeviceRemoveRequested, __MTLDeviceTerminated, 
 | 
			
		||||
                       __MTLFeatureSetDictionary, __MTLGLLabel, __MTLGPUFamilyString, 
 | 
			
		||||
                       __MTLGetAttachmentSize, __MTLHashState, __MTLInvalidResourceIndex, 
 | 
			
		||||
                       __MTLLibraryTypeString, __MTLMessageContextBegin_, __MTLMessageContextEnd, 
 | 
			
		||||
                       __MTLMessageContextPush_, __MTLMessageTypeFromFailureType, 
 | 
			
		||||
                       __MTLNotifyDeviceRemovalRequested, __MTLNotifyDeviceWasAdded, 
 | 
			
		||||
                       __MTLNotifyDeviceWasRemoved, __MTLNotifyMessageObservers, 
 | 
			
		||||
                       __MTLOverrideCurrentPreferredDevice, __MTLSetCompileTimeStatisticsEnabled, 
 | 
			
		||||
                       __MTLSystemSupportsRemovableGPUs, __Z23_MTLRequestHashToString12MTLUINT256_t, 
 | 
			
		||||
                       __Z46MTLAccelerationStructureInstanceDescriptorSize46MTLAccelerationStructureInstanceDescriptorType, 
 | 
			
		||||
                       __Z53isValidMTLAccelerationStructureInstanceDescriptorType46MTLAccelerationStructureInstanceDescriptorType, 
 | 
			
		||||
                       __ZN13MTLStatistics10cvtGPU_CPUEy, __ZN13MTLStatistics12freePointersEv, 
 | 
			
		||||
                       __ZN13MTLStatistics12newTimeTupleEyy, __ZN13MTLStatistics16copySampleToUserEPyS0_Pc, 
 | 
			
		||||
                       __ZN13MTLStatistics19getSampleHeaderSizeEv, __ZN13MTLStatistics23getAllAvailableCountersEPU29objcproto18MTLCommandQueueSPI11objc_objectjP11StatInfoRec, 
 | 
			
		||||
                       __ZN13MTLStatistics23getAllAvailableCountersEjP11StatInfoRec, 
 | 
			
		||||
                       __ZN13MTLStatistics28validateAllRequestedCountersEPU29objcproto18MTLCommandQueueSPI11objc_objectjP7NSArrayjP11StatInfoRec, 
 | 
			
		||||
                       __defaultSamplePositions_1, __defaultSamplePositions_16, __defaultSamplePositions_2, 
 | 
			
		||||
                       __defaultSamplePositions_4, __defaultSamplePositions_8, __mtlNumMipmapLevelsForSize, 
 | 
			
		||||
                       __mtlValidateArgumentsForTextureViewOnDevice, __mtlValidateMTLTextureSwizzleKey, 
 | 
			
		||||
                       __mtlValidateStrideTextureParameters, __mtlValidateTextureUsage, 
 | 
			
		||||
                       _getShaderCachePath, _initLogMode, _isVertexAmplificationModeValid, 
 | 
			
		||||
                       _kMetalRegistryID, _kMetalTextureArrayLength, _kMetalTextureDepth, 
 | 
			
		||||
                       _kMetalTextureGPUOptimization, _kMetalTextureHeight, _kMetalTextureMipmapLevelCount, 
 | 
			
		||||
                       _kMetalTexturePixelFormat, _kMetalTextureResourceOptions, 
 | 
			
		||||
                       _kMetalTextureSampleCount, _kMetalTextureSparseValue, _kMetalTextureSwizzleKey, 
 | 
			
		||||
                       _kMetalTextureType, _kMetalTextureUsage, _kMetalTextureWidth, 
 | 
			
		||||
                       _logMode, _setShaderCachePath ]
 | 
			
		||||
    objc-classes:    [ MTLAccelerationStructureBoundingBoxGeometryDescriptor, MTLAccelerationStructureDescriptor, 
 | 
			
		||||
                       MTLAccelerationStructureGeometryDescriptor, MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor, 
 | 
			
		||||
                       MTLAccelerationStructureMotionTriangleGeometryDescriptor, 
 | 
			
		||||
                       MTLAccelerationStructureTriangleGeometryDescriptor, MTLArgument, 
 | 
			
		||||
                       MTLArgumentDescriptor, MTLArrayType, MTLAttribute, MTLAttributeDescriptor, 
 | 
			
		||||
                       MTLAttributeDescriptorArray, MTLBVHBoundingBoxGeometryDescriptor, 
 | 
			
		||||
                       MTLBVHBuilder, MTLBVHDescriptor, MTLBVHGeometryDescriptor, 
 | 
			
		||||
                       MTLBVHPolygonGeometryDescriptor, MTLBinaryArchiveDescriptor, 
 | 
			
		||||
                       MTLBlitPassDescriptor, MTLBlitPassSampleBufferAttachmentDescriptor, 
 | 
			
		||||
                       MTLBlitPassSampleBufferAttachmentDescriptorArray, MTLBufferDescriptor, 
 | 
			
		||||
                       MTLBufferLayoutDescriptor, MTLBufferLayoutDescriptorArray, 
 | 
			
		||||
                       MTLBufferRelocation, MTLCaptureDescriptor, MTLCaptureManager, 
 | 
			
		||||
                       MTLCaptureScope, MTLCommandBufferDescriptor, MTLCommandQueueDescriptor, 
 | 
			
		||||
                       MTLCompileFunctionRequestData, MTLCompileOptions, MTLCompiler, 
 | 
			
		||||
                       MTLComputePassDescriptor, MTLComputePassSampleBufferAttachmentDescriptor, 
 | 
			
		||||
                       MTLComputePassSampleBufferAttachmentDescriptorArray, MTLComputePipelineDescriptor, 
 | 
			
		||||
                       MTLComputePipelineReflection, MTLConstantRelocation, MTLCounterInternal, 
 | 
			
		||||
                       MTLCounterSampleBufferDescriptor, MTLCounterSampleBufferDescriptorInternal, 
 | 
			
		||||
                       MTLCounterSetInternal, MTLDebugInstrumentationData, MTLDepthStencilDescriptor, 
 | 
			
		||||
                       MTLEmulationIndirectArgumentBufferLayout, MTLFunctionConstant, 
 | 
			
		||||
                       MTLFunctionConstantValues, MTLFunctionDescriptor, MTLFunctionReflectionInternal, 
 | 
			
		||||
                       MTLFunctionStitchingAttributeAlwaysInline, MTLFunctionStitchingBuiltinThreadPositionInGrid, 
 | 
			
		||||
                       MTLFunctionStitchingBuiltinThreadPositionInThreadgroup, MTLFunctionStitchingFunctionNode, 
 | 
			
		||||
                       MTLFunctionStitchingFunctionNodeSPI, MTLFunctionStitchingGraph, 
 | 
			
		||||
                       MTLFunctionStitchingGraphSPI, MTLFunctionStitchingInputBuffer, 
 | 
			
		||||
                       MTLFunctionStitchingInputBufferAddress, MTLFunctionStitchingInputImageblock, 
 | 
			
		||||
                       MTLFunctionStitchingInputNode, MTLFunctionStitchingInputSampler, 
 | 
			
		||||
                       MTLFunctionStitchingInputTexture, MTLFunctionStitchingInputThreadgroup, 
 | 
			
		||||
                       MTLFunctionVariant, MTLGPUBVHBuilder, MTLHeapDescriptor, MTLIOAccelAccelerationStructure, 
 | 
			
		||||
                       MTLIOAccelBlitCommandEncoder, MTLIOAccelBuffer, MTLIOAccelCommandBuffer, 
 | 
			
		||||
                       MTLIOAccelCommandEncoder, MTLIOAccelCommandQueue, MTLIOAccelComputeCommandEncoder, 
 | 
			
		||||
                       MTLIOAccelDebugCommandEncoder, MTLIOAccelDevice, MTLIOAccelDeviceShmem, 
 | 
			
		||||
                       MTLIOAccelDeviceShmemPool, MTLIOAccelFence, MTLIOAccelGLDrawable, 
 | 
			
		||||
                       MTLIOAccelHeap, MTLIOAccelIndirectArgumentEncoder, MTLIOAccelIndirectCommandBuffer, 
 | 
			
		||||
                       MTLIOAccelIndirectComputeCommand, MTLIOAccelIndirectRenderCommand, 
 | 
			
		||||
                       MTLIOAccelIntersectionFunctionTable, MTLIOAccelParallelRenderCommandEncoder, 
 | 
			
		||||
                       MTLIOAccelPooledResource, MTLIOAccelRenderCommandEncoder, 
 | 
			
		||||
                       MTLIOAccelResource, MTLIOAccelResourcePool, MTLIOAccelResourceStateCommandEncoder, 
 | 
			
		||||
                       MTLIOAccelTexture, MTLIOAccelTextureLayout, MTLIOAccelVisibleFunctionTable, 
 | 
			
		||||
                       MTLIndirectCommandBufferDescriptor, MTLIndirectCommandBufferDescriptorInternal, 
 | 
			
		||||
                       MTLIndirectConstantArgument, MTLInstanceAccelerationStructureDescriptor, 
 | 
			
		||||
                       MTLIntersectionFunctionDescriptor, MTLIntersectionFunctionTableDescriptor, 
 | 
			
		||||
                       MTLLinkedFunctions, MTLMessage, MTLMessageFilter, MTLMotionEstimationPipelineDescriptor, 
 | 
			
		||||
                       MTLMotionEstimatorCapabilities, MTLMotionKeyframeData, MTLPipelineBufferDescriptor, 
 | 
			
		||||
                       MTLPipelineBufferDescriptorArray, MTLPointerType, MTLPrecompiledData, 
 | 
			
		||||
                       MTLPrimitiveAccelerationStructureDescriptor, MTLRasterizationRateLayerArray, 
 | 
			
		||||
                       MTLRasterizationRateLayerArrayInternal, MTLRasterizationRateLayerDescriptor, 
 | 
			
		||||
                       MTLRasterizationRateLayerDescriptorInternal, MTLRasterizationRateMapDescriptor, 
 | 
			
		||||
                       MTLRasterizationRateSampleArray, MTLRasterizationRateSampleArrayInternal, 
 | 
			
		||||
                       MTLRenderPassAttachmentDescriptor, MTLRenderPassColorAttachmentDescriptor, 
 | 
			
		||||
                       MTLRenderPassColorAttachmentDescriptorArray, MTLRenderPassDepthAttachmentDescriptor, 
 | 
			
		||||
                       MTLRenderPassDescriptor, MTLRenderPassSampleBufferAttachmentDescriptor, 
 | 
			
		||||
                       MTLRenderPassSampleBufferAttachmentDescriptorArray, MTLRenderPassStencilAttachmentDescriptor, 
 | 
			
		||||
                       MTLRenderPipelineColorAttachmentDescriptor, MTLRenderPipelineColorAttachmentDescriptorArray, 
 | 
			
		||||
                       MTLRenderPipelineDescriptor, MTLRenderPipelineFunctionsDescriptor, 
 | 
			
		||||
                       MTLRenderPipelineReflection, MTLResourceAllocationInfo, MTLResourceList, 
 | 
			
		||||
                       MTLResourceListPool, MTLResourceStatePassDescriptor, MTLResourceStatePassSampleBufferAttachmentDescriptor, 
 | 
			
		||||
                       MTLResourceStatePassSampleBufferAttachmentDescriptorArray, 
 | 
			
		||||
                       MTLSamplerDescriptor, MTLSharedEventHandle, MTLSharedEventListener, 
 | 
			
		||||
                       MTLSharedTextureHandle, MTLStageInputOutputDescriptor, MTLStencilDescriptor, 
 | 
			
		||||
                       MTLStitchedLibraryDescriptor, MTLStitchedLibraryDescriptorSPI, 
 | 
			
		||||
                       MTLStructMember, MTLStructType, MTLTargetDeviceArchitecture, 
 | 
			
		||||
                       MTLTextureDescriptor, MTLTextureReferenceType, MTLTileRenderPipelineColorAttachmentDescriptor, 
 | 
			
		||||
                       MTLTileRenderPipelineColorAttachmentDescriptorArray, MTLTileRenderPipelineDescriptor, 
 | 
			
		||||
                       MTLType, MTLVertexAttribute, MTLVertexAttributeDescriptor, 
 | 
			
		||||
                       MTLVertexAttributeDescriptorArray, MTLVertexBufferLayoutDescriptor, 
 | 
			
		||||
                       MTLVertexBufferLayoutDescriptorArray, MTLVertexDescriptor, 
 | 
			
		||||
                       MTLVisibleFunctionTableDescriptor, _MTLAccelerationStructureCommandEncoder, 
 | 
			
		||||
                       _MTLBinaryArchive, _MTLCommandBuffer, _MTLCommandBufferDescriptor, 
 | 
			
		||||
                       _MTLCommandBufferEncoderInfo, _MTLCommandEncoder, _MTLCommandQueue, 
 | 
			
		||||
                       _MTLComputePipelineState, _MTLDebugCommandEncoder, _MTLDepthStencilState, 
 | 
			
		||||
                       _MTLDevice, _MTLDynamicLibrary, _MTLFence, _MTLFunction, _MTLFunctionHandle, 
 | 
			
		||||
                       _MTLFunctionLogDebugLocation, _MTLHeap, _MTLImageBlockArguments, 
 | 
			
		||||
                       _MTLIndirectArgumentBufferLayout, _MTLIndirectArgumentEncoder, 
 | 
			
		||||
                       _MTLIndirectComputeCommand, _MTLIndirectDispatchThreadgroupsArguments, 
 | 
			
		||||
                       _MTLIndirectDispatchThreadsArguments, _MTLIndirectDrawArguments, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedArguments, _MTLIndirectDrawIndexedPatchesArguments, 
 | 
			
		||||
                       _MTLIndirectDrawPatchesArguments, _MTLIndirectRenderCommand, 
 | 
			
		||||
                       _MTLIndirectTessellationFactorArguments, _MTLLibrary, _MTLObjectWithLabel, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder, _MTLPipelineCache, _MTLPipelineStateBinary, 
 | 
			
		||||
                       _MTLProgramAddressTable, _MTLProgramAddressTableMappedBinary, 
 | 
			
		||||
                       _MTLRasterizationRateMap, _MTLRenderPipelineState, _MTLResource, 
 | 
			
		||||
                       _MTLSWRaytracingAccelerationStructureCommandEncoder, _MTLSamplerState, 
 | 
			
		||||
                       _MTLSharedEvent, _PipelineLibrarySerializer ]
 | 
			
		||||
    objc-ivars:      [ MTLCaptureScope._commandQueue, MTLCaptureScope._device, MTLCounterInternal._description, 
 | 
			
		||||
                       MTLCounterInternal._name, MTLCounterSampleBufferDescriptorInternal._counterSet, 
 | 
			
		||||
                       MTLCounterSampleBufferDescriptorInternal._label, MTLCounterSampleBufferDescriptorInternal._sampleCount, 
 | 
			
		||||
                       MTLCounterSampleBufferDescriptorInternal._storageMode, MTLCounterSetInternal._counters, 
 | 
			
		||||
                       MTLCounterSetInternal._description, MTLCounterSetInternal._name, 
 | 
			
		||||
                       MTLIOAccelBuffer._deallocator, MTLIOAccelBuffer._iosurface, 
 | 
			
		||||
                       MTLIOAccelBuffer._length, MTLIOAccelBuffer._masterBuffer, 
 | 
			
		||||
                       MTLIOAccelBuffer._masterBufferIndex, MTLIOAccelBuffer._masterBufferOffset, 
 | 
			
		||||
                       MTLIOAccelBuffer._masterHeapIndex, MTLIOAccelBuffer._pointer, 
 | 
			
		||||
                       MTLIOAccelCommandBuffer._device, MTLIOAccelCommandQueue._commandQueue, 
 | 
			
		||||
                       MTLIOAccelCommandQueue._device, MTLIOAccelDebugCommandEncoder._api_resourceList, 
 | 
			
		||||
                       MTLIOAccelDebugCommandEncoder._kernelCommandBufferCurrent, 
 | 
			
		||||
                       MTLIOAccelDebugCommandEncoder._kernelCommandBufferEnd, MTLIOAccelDebugCommandEncoder._resourceList, 
 | 
			
		||||
                       MTLIOAccelDevice._accelID, MTLIOAccelDevice._acceleratorPort, 
 | 
			
		||||
                       MTLIOAccelDevice._acceleratorService, MTLIOAccelDevice._commandBufferStoragePool, 
 | 
			
		||||
                       MTLIOAccelDevice._configBits, MTLIOAccelDevice._deviceBits, 
 | 
			
		||||
                       MTLIOAccelDevice._deviceRef, MTLIOAccelDevice._numCommandBuffers, 
 | 
			
		||||
                       MTLIOAccelDevice._peerConnections, MTLIOAccelDevice._peerConnectionsLock, 
 | 
			
		||||
                       MTLIOAccelDevice._peerCount, MTLIOAccelDevice._peerGroupID, 
 | 
			
		||||
                       MTLIOAccelDevice._peerIndex, MTLIOAccelDevice._peerMask, MTLIOAccelDevice._segmentByteThreshold, 
 | 
			
		||||
                       MTLIOAccelDevice._sharedMemorySize, MTLIOAccelDevice._sharedRef, 
 | 
			
		||||
                       MTLIOAccelDevice._storageCreateParams, MTLIOAccelDevice._textureRam, 
 | 
			
		||||
                       MTLIOAccelDevice._videoRam, MTLIOAccelFence._device, MTLIOAccelFence._fenceIndex, 
 | 
			
		||||
                       MTLIOAccelGLDrawable._drawableRef, MTLIOAccelGLDrawable._surfaceConfig, 
 | 
			
		||||
                       MTLIOAccelHeap._resource, MTLIOAccelResource._res, MTLIOAccelTexture._allowGPUOptimizedContents, 
 | 
			
		||||
                       MTLIOAccelTexture._arrayLength, MTLIOAccelTexture._buffer, 
 | 
			
		||||
                       MTLIOAccelTexture._bufferBytesPerRow, MTLIOAccelTexture._bufferOffset, 
 | 
			
		||||
                       MTLIOAccelTexture._depth, MTLIOAccelTexture._framebufferOnly, 
 | 
			
		||||
                       MTLIOAccelTexture._height, MTLIOAccelTexture._iosurface, MTLIOAccelTexture._iosurfacePlane, 
 | 
			
		||||
                       MTLIOAccelTexture._isCompressed, MTLIOAccelTexture._isDrawable, 
 | 
			
		||||
                       MTLIOAccelTexture._length, MTLIOAccelTexture._masterBuffer, 
 | 
			
		||||
                       MTLIOAccelTexture._masterBufferIndex, MTLIOAccelTexture._masterBufferOffset, 
 | 
			
		||||
                       MTLIOAccelTexture._masterHeapIndex, MTLIOAccelTexture._mipmapLevelCount, 
 | 
			
		||||
                       MTLIOAccelTexture._numFaces, MTLIOAccelTexture._parentRelativeLevel, 
 | 
			
		||||
                       MTLIOAccelTexture._parentRelativeSlice, MTLIOAccelTexture._parentTexture, 
 | 
			
		||||
                       MTLIOAccelTexture._pixelFormat, MTLIOAccelTexture._rootResourceIsSuballocatedBuffer, 
 | 
			
		||||
                       MTLIOAccelTexture._rotation, MTLIOAccelTexture._sampleCount, 
 | 
			
		||||
                       MTLIOAccelTexture._shareable, MTLIOAccelTexture._swizzle, 
 | 
			
		||||
                       MTLIOAccelTexture._textureType, MTLIOAccelTexture._usage, 
 | 
			
		||||
                       MTLIOAccelTexture._width, MTLIOAccelTexture._writeSwizzleEnabled, 
 | 
			
		||||
                       MTLIndirectConstantArgument._alignment, MTLIndirectConstantArgument._aluType, 
 | 
			
		||||
                       MTLIndirectConstantArgument._dataSize, MTLIndirectConstantArgument._dataType, 
 | 
			
		||||
                       MTLIndirectConstantArgument._pixelFormat, MTLPrecompiledData._type, 
 | 
			
		||||
                       MTLSharedEventHandle._priv, MTLSharedTextureHandle._priv, 
 | 
			
		||||
                       _MTLCommandBuffer._StatEnabled, _MTLCommandBuffer._StatLocations, 
 | 
			
		||||
                       _MTLCommandBuffer._StatOptions, _MTLCommandBuffer._commitTime, 
 | 
			
		||||
                       _MTLCommandBuffer._completedCallbacksDone, _MTLCommandBuffer._completedDispatchList, 
 | 
			
		||||
                       _MTLCommandBuffer._completedDispatchListTail, _MTLCommandBuffer._completionHandlerEnqueueTime, 
 | 
			
		||||
                       _MTLCommandBuffer._completionHandlerExecutionTime, _MTLCommandBuffer._completionInterruptTime, 
 | 
			
		||||
                       _MTLCommandBuffer._cond, _MTLCommandBuffer._creatingProgressEncoder, 
 | 
			
		||||
                       _MTLCommandBuffer._creationTime, _MTLCommandBuffer._currentCommandEncoder, 
 | 
			
		||||
                       _MTLCommandBuffer._currentSample, _MTLCommandBuffer._encoderInfos, 
 | 
			
		||||
                       _MTLCommandBuffer._enqueueTime, _MTLCommandBuffer._error, 
 | 
			
		||||
                       _MTLCommandBuffer._globalTraceObjectID, _MTLCommandBuffer._gpuEndTime, 
 | 
			
		||||
                       _MTLCommandBuffer._gpuStartTime, _MTLCommandBuffer._hasPresent, 
 | 
			
		||||
                       _MTLCommandBuffer._internalCounterSampleSize, _MTLCommandBuffer._kernelEndTime, 
 | 
			
		||||
                       _MTLCommandBuffer._kernelStartTime, _MTLCommandBuffer._labelTraceID, 
 | 
			
		||||
                       _MTLCommandBuffer._listIndex, _MTLCommandBuffer._mutex, _MTLCommandBuffer._needsCommandBufferSemaphoreSignal, 
 | 
			
		||||
                       _MTLCommandBuffer._needsFrameworkAssistedErrorTracking, _MTLCommandBuffer._numEncoders, 
 | 
			
		||||
                       _MTLCommandBuffer._numInternalSampleCounters, _MTLCommandBuffer._numRequestedCounters, 
 | 
			
		||||
                       _MTLCommandBuffer._numThisCommandBuffer, _MTLCommandBuffer._ownedByParallelEncoder, 
 | 
			
		||||
                       _MTLCommandBuffer._perfSampleHandlerBlock, _MTLCommandBuffer._profilingEnabled, 
 | 
			
		||||
                       _MTLCommandBuffer._profilingResults, _MTLCommandBuffer._progressBuffer, 
 | 
			
		||||
                       _MTLCommandBuffer._progressOffset, _MTLCommandBuffer._queue, 
 | 
			
		||||
                       _MTLCommandBuffer._retainedObjects, _MTLCommandBuffer._retainedReferences, 
 | 
			
		||||
                       _MTLCommandBuffer._sampleLock, _MTLCommandBuffer._sampleStorage, 
 | 
			
		||||
                       _MTLCommandBuffer._samples, _MTLCommandBuffer._samplesPerStorageBlock, 
 | 
			
		||||
                       _MTLCommandBuffer._scheduledCallbacksDone, _MTLCommandBuffer._scheduledDispatchList, 
 | 
			
		||||
                       _MTLCommandBuffer._scheduledDispatchListTail, _MTLCommandBuffer._sharedIndirectionTable, 
 | 
			
		||||
                       _MTLCommandBuffer._skipRender, _MTLCommandBuffer._statCommandBuffer, 
 | 
			
		||||
                       _MTLCommandBuffer._status, _MTLCommandBuffer._strongObjectReferences, 
 | 
			
		||||
                       _MTLCommandBuffer._submitToHardwareTime, _MTLCommandBuffer._submitToKernelTime, 
 | 
			
		||||
                       _MTLCommandBuffer._syncDispatchList, _MTLCommandBuffer._syncDispatchListTail, 
 | 
			
		||||
                       _MTLCommandBuffer._synchronousDebugMode, _MTLCommandBuffer._totalNumStatSamples, 
 | 
			
		||||
                       _MTLCommandBuffer._userDictionary, _MTLCommandBuffer._wakeOnCommit, 
 | 
			
		||||
                       _MTLCommandEncoder._StatEnabled, _MTLCommandEncoder._StatLocations, 
 | 
			
		||||
                       _MTLCommandEncoder._StatOptions, _MTLCommandEncoder._commandBuffer, 
 | 
			
		||||
                       _MTLCommandEncoder._debugSignposts, _MTLCommandEncoder._device, 
 | 
			
		||||
                       _MTLCommandEncoder._globalTraceObjectID, _MTLCommandEncoder._isProgressTrackingEncoder, 
 | 
			
		||||
                       _MTLCommandEncoder._labelTraceID, _MTLCommandEncoder._needsFrameworkAssistedErrorTracking, 
 | 
			
		||||
                       _MTLCommandEncoder._numCommands, _MTLCommandEncoder._numThisEncoder, 
 | 
			
		||||
                       _MTLCommandEncoder._progressFence, _MTLCommandQueue._StatEnabled, 
 | 
			
		||||
                       _MTLCommandQueue._StatLocations, _MTLCommandQueue._StatOptions, 
 | 
			
		||||
                       _MTLCommandQueue._backgroundTrackingPID, _MTLCommandQueue._commandBufferSemaphore, 
 | 
			
		||||
                       _MTLCommandQueue._commandQueueBacktraceInfo, _MTLCommandQueue._commandQueueDispatch, 
 | 
			
		||||
                       _MTLCommandQueue._commandQueueEventSource, _MTLCommandQueue._commitQueue, 
 | 
			
		||||
                       _MTLCommandQueue._commitSynchronously, _MTLCommandQueue._completionQueue, 
 | 
			
		||||
                       _MTLCommandQueue._completionQueueDispatch, _MTLCommandQueue._counterInfo, 
 | 
			
		||||
                       _MTLCommandQueue._dev, _MTLCommandQueue._disableCrossQueueHazardTracking, 
 | 
			
		||||
                       _MTLCommandQueue._executionEnabled, _MTLCommandQueue._forceImmediateSubmissionOnCommitThread, 
 | 
			
		||||
                       _MTLCommandQueue._globalTraceObjectID, _MTLCommandQueue._hasLoggedTelemetry, 
 | 
			
		||||
                       _MTLCommandQueue._labelTraceID, _MTLCommandQueue._listIndex, 
 | 
			
		||||
                       _MTLCommandQueue._maxCommandBufferCount, _MTLCommandQueue._numCommandBuffers, 
 | 
			
		||||
                       _MTLCommandQueue._numInternalSampleCounters, _MTLCommandQueue._numRequestedCounters, 
 | 
			
		||||
                       _MTLCommandQueue._openGLQueue, _MTLCommandQueue._pendingQueue, 
 | 
			
		||||
                       _MTLCommandQueue._pendingQueueLock, _MTLCommandQueue._perfSampleHandlerBlock, 
 | 
			
		||||
                       _MTLCommandQueue._presentScheduledSemaphore, _MTLCommandQueue._profilingEnabled, 
 | 
			
		||||
                       _MTLCommandQueue._qosLevel, _MTLCommandQueue._skipRender, 
 | 
			
		||||
                       _MTLCommandQueue._submittedGroup, _MTLCommandQueue._submittedQueue, 
 | 
			
		||||
                       _MTLCommandQueue._submittedQueueLock, _MTLDepthStencilState._device, 
 | 
			
		||||
                       _MTLDepthStencilState._label, _MTLDevice._commandQueueCount, 
 | 
			
		||||
                       _MTLDevice._featureQueries, _MTLDevice._globalTraceObjectID, 
 | 
			
		||||
                       _MTLDevice._limits, _MTLDevice._needsEncoderTypeMatchingProgressBlits, 
 | 
			
		||||
                       _MTLDevice._progressTrackBufferStack, _MTLDevice._progressTrackComputePipeline, 
 | 
			
		||||
                       _MTLDevice._progressTrackRenderPipeline, _MTLFunction._debugInstrumentationData, 
 | 
			
		||||
                       _MTLFunction._device, _MTLFunction._functionConstantDictionary, 
 | 
			
		||||
                       _MTLFunction._functionConstants, _MTLFunction._functionType, 
 | 
			
		||||
                       _MTLFunction._libraryData, _MTLFunction._name, _MTLFunction._options, 
 | 
			
		||||
                       _MTLFunction._precompiledOutput, _MTLFunction._vendorPrivate, 
 | 
			
		||||
                       _MTLFunction._vertexAttributes, _MTLHeap._heapResourceOptions, 
 | 
			
		||||
                       _MTLHeap._heapType, _MTLImageBlockArguments._height, _MTLImageBlockArguments._width, 
 | 
			
		||||
                       _MTLIndirectArgumentBufferLayout._private, _MTLIndirectArgumentEncoder._device, 
 | 
			
		||||
                       _MTLIndirectArgumentEncoder._layout, _MTLIndirectDispatchThreadgroupsArguments._threadgroupsPerGrid, 
 | 
			
		||||
                       _MTLIndirectDispatchThreadgroupsArguments._threadsPerThreadgroup, 
 | 
			
		||||
                       _MTLIndirectDispatchThreadsArguments._threadsPerGrid, _MTLIndirectDispatchThreadsArguments._threadsPerThreadgroup, 
 | 
			
		||||
                       _MTLIndirectDrawArguments._baseInstance, _MTLIndirectDrawArguments._instanceCount, 
 | 
			
		||||
                       _MTLIndirectDrawArguments._primitiveType, _MTLIndirectDrawArguments._vertexCount, 
 | 
			
		||||
                       _MTLIndirectDrawArguments._vertexStart, _MTLIndirectDrawIndexedArguments._baseInstance, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedArguments._baseVertex, _MTLIndirectDrawIndexedArguments._indexBufferOffset, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedArguments._indexBufferVirtualAddress, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedArguments._indexCount, _MTLIndirectDrawIndexedArguments._indexType, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedArguments._instanceCount, _MTLIndirectDrawIndexedArguments._primitiveType, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedPatchesArguments._baseInstance, _MTLIndirectDrawIndexedPatchesArguments._controlPointIndexBufferOffset, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedPatchesArguments._controlPointIndexBufferVirtualAddress, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedPatchesArguments._instanceCount, _MTLIndirectDrawIndexedPatchesArguments._numberOfPatchControlPoints, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedPatchesArguments._patchCount, _MTLIndirectDrawIndexedPatchesArguments._patchIndexBufferOffset, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedPatchesArguments._patchIndexBufferVirtualAddress, 
 | 
			
		||||
                       _MTLIndirectDrawIndexedPatchesArguments._patchStart, _MTLIndirectDrawPatchesArguments._baseInstance, 
 | 
			
		||||
                       _MTLIndirectDrawPatchesArguments._instanceCount, _MTLIndirectDrawPatchesArguments._numberOfPatchControlPoints, 
 | 
			
		||||
                       _MTLIndirectDrawPatchesArguments._patchCount, _MTLIndirectDrawPatchesArguments._patchIndexBufferOffset, 
 | 
			
		||||
                       _MTLIndirectDrawPatchesArguments._patchIndexBufferVirtualAddress, 
 | 
			
		||||
                       _MTLIndirectDrawPatchesArguments._patchStart, _MTLIndirectTessellationFactorArguments._instanceStride, 
 | 
			
		||||
                       _MTLIndirectTessellationFactorArguments._scale, _MTLIndirectTessellationFactorArguments._virtualAddress, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._StatEnabled, _MTLParallelRenderCommandEncoder._StatLocations, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._StatOptions, _MTLParallelRenderCommandEncoder._commandBuffer, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._commandBuffers, _MTLParallelRenderCommandEncoder._commandBuffersCount, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._commandBuffersSize, _MTLParallelRenderCommandEncoder._debugSignposts, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._device, _MTLParallelRenderCommandEncoder._globalTraceObjectID, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._labelTraceID, _MTLParallelRenderCommandEncoder._lock, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._needsFrameworkAssistedErrorTracking, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._numCommands, _MTLParallelRenderCommandEncoder._numRequestedCounters, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._numThisEncoder, _MTLParallelRenderCommandEncoder._progressFence, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._queue, _MTLParallelRenderCommandEncoder._renderPassDescriptor, 
 | 
			
		||||
                       _MTLParallelRenderCommandEncoder._retainedReferences, _MTLPipelineStateBinary._binary, 
 | 
			
		||||
                       _MTLPipelineStateBinary._uniqueIdentifier, _MTLProgramAddressTable._binaryMappingsEncoderInternal, 
 | 
			
		||||
                       _MTLProgramAddressTable._binaryMappingsPerInvocation, _MTLProgramAddressTable._encoderInternalBinaries, 
 | 
			
		||||
                       _MTLProgramAddressTableMappedBinary._binaryUniqueId, _MTLProgramAddressTableMappedBinary._mappedAddress, 
 | 
			
		||||
                       _MTLProgramAddressTableMappedBinary._mappedSize, _MTLProgramAddressTableMappedBinary._type, 
 | 
			
		||||
                       _MTLSamplerState._device, _MTLSamplerState._gpuAddress, _MTLSamplerState._label, 
 | 
			
		||||
                       _MTLSamplerState._pixelFormat, _MTLSamplerState._resourceIndex, 
 | 
			
		||||
                       _PipelineLibrarySerializer._binarySerializer ]
 | 
			
		||||
...
 | 
			
		||||
@@ -0,0 +1,6 @@
 | 
			
		||||
framework module Metal [extern_c] {
 | 
			
		||||
  umbrella header "Metal.h"
 | 
			
		||||
  export *
 | 
			
		||||
  module * { export * }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user