spb/forge Public MIT
Forge — LLM training from scratch in pure C++20 + Metal on Apple Silicon.
C++ 61.2%
C 23%
Python 7.6%
TeX 7.2%
CMake 1.1%
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------2//3// Metal/MTLDevice.hpp4//5// Copyright 2020-2025 Apple Inc.6//7// Licensed under the Apache License, Version 2.0 (the "License");8// you may not use this file except in compliance with the License.9// You may obtain a copy of the License at10//11// http://www.apache.org/licenses/LICENSE-2.012//13// Unless required by applicable law or agreed to in writing, software14// distributed under the License is distributed on an "AS IS" BASIS,15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.16// See the License for the specific language governing permissions and17// limitations under the License.18//19//-------------------------------------------------------------------------------------------------------------------------------------------------------------2021#pragma once2223#include "../Foundation/Foundation.hpp"24#include "MTL4Counters.hpp"25#include "MTLArgument.hpp"26#include "MTLDataType.hpp"27#include "MTLDefines.hpp"28#include "MTLHeaderBridge.hpp"29#include "MTLPixelFormat.hpp"30#include "MTLPrivate.hpp"31#include "MTLResource.hpp"32#include "MTLTexture.hpp"33#include "MTLTypes.hpp"34#include <IOSurface/IOSurfaceRef.h>35#include <cstdint>36#include <dispatch/dispatch.h>3738#include <TargetConditionals.h>39#include <cstdint>40#include <functional>4142namespace MTL43{44class AccelerationStructure;45class AccelerationStructureDescriptor;46class Architecture;47class ArgumentDescriptor;48class ArgumentEncoder;49class BinaryArchive;50class BinaryArchiveDescriptor;51class Buffer;52class BufferBinding;53class CommandQueue;54class CommandQueueDescriptor;55class CompileOptions;56class ComputePipelineDescriptor;57class ComputePipelineReflection;58class ComputePipelineState;59class CounterSampleBuffer;60class CounterSampleBufferDescriptor;61class DepthStencilDescriptor;62class DepthStencilState;63class Device;64class DynamicLibrary;65class Event;66class Fence;67class Function;68class FunctionConstantValues;69class FunctionHandle;70class Heap;71class HeapDescriptor;72class IOCommandQueue;73class IOCommandQueueDescriptor;74class IOFileHandle;75class IndirectCommandBuffer;76class IndirectCommandBufferDescriptor;77class Library;78class LogState;79class LogStateDescriptor;80class MeshRenderPipelineDescriptor;81class RasterizationRateMap;82class RasterizationRateMapDescriptor;83struct Region;84class RenderPipelineDescriptor;85class RenderPipelineReflection;86class RenderPipelineState;87class ResidencySet;88class ResidencySetDescriptor;89class ResourceViewPoolDescriptor;90struct SamplePosition;91class SamplerDescriptor;92class SamplerState;93class SharedEvent;94class SharedEventHandle;95class SharedTextureHandle;96class StitchedLibraryDescriptor;97class Tensor;98class TensorBufferAttachments;99class TensorDescriptor;100class Texture;101class TextureDescriptor;102class TextureViewPool;103class TileRenderPipelineDescriptor;104105}106namespace MTL4107{108class Archive;109class ArgumentTable;110class ArgumentTableDescriptor;111class BinaryFunction;112class CommandAllocator;113class CommandAllocatorDescriptor;114class CommandBuffer;115class CommandQueue;116class CommandQueueDescriptor;117class Compiler;118class CompilerDescriptor;119class CounterHeap;120class CounterHeapDescriptor;121class PipelineDataSetSerializer;122class PipelineDataSetSerializerDescriptor;123124}125namespace MTL126{127_MTL_ENUM(NS::Integer, IOCompressionMethod) {128 IOCompressionMethodZlib = 0,129 IOCompressionMethodLZFSE = 1,130 IOCompressionMethodLZ4 = 2,131 IOCompressionMethodLZMA = 3,132 IOCompressionMethodLZBitmap = 4,133};134135_MTL_ENUM(NS::UInteger, FeatureSet) {136 FeatureSet_iOS_GPUFamily1_v1 = 0,137 FeatureSet_iOS_GPUFamily2_v1 = 1,138 FeatureSet_iOS_GPUFamily1_v2 = 2,139 FeatureSet_iOS_GPUFamily2_v2 = 3,140 FeatureSet_iOS_GPUFamily3_v1 = 4,141 FeatureSet_iOS_GPUFamily1_v3 = 5,142 FeatureSet_iOS_GPUFamily2_v3 = 6,143 FeatureSet_iOS_GPUFamily3_v2 = 7,144 FeatureSet_iOS_GPUFamily1_v4 = 8,145 FeatureSet_iOS_GPUFamily2_v4 = 9,146 FeatureSet_iOS_GPUFamily3_v3 = 10,147 FeatureSet_iOS_GPUFamily4_v1 = 11,148 FeatureSet_iOS_GPUFamily1_v5 = 12,149 FeatureSet_iOS_GPUFamily2_v5 = 13,150 FeatureSet_iOS_GPUFamily3_v4 = 14,151 FeatureSet_iOS_GPUFamily4_v2 = 15,152 FeatureSet_iOS_GPUFamily5_v1 = 16,153 FeatureSet_macOS_GPUFamily1_v1 = 10000,154 FeatureSet_OSX_GPUFamily1_v1 = 10000,155 FeatureSet_macOS_GPUFamily1_v2 = 10001,156 FeatureSet_OSX_GPUFamily1_v2 = 10001,157 FeatureSet_macOS_ReadWriteTextureTier2 = 10002,158 FeatureSet_OSX_ReadWriteTextureTier2 = 10002,159 FeatureSet_macOS_GPUFamily1_v3 = 10003,160 FeatureSet_macOS_GPUFamily1_v4 = 10004,161 FeatureSet_macOS_GPUFamily2_v1 = 10005,162 FeatureSet_watchOS_GPUFamily1_v1 = 20000,163 FeatureSet_WatchOS_GPUFamily1_v1 = 20000,164 FeatureSet_watchOS_GPUFamily2_v1 = 20001,165 FeatureSet_WatchOS_GPUFamily2_v1 = 20001,166 FeatureSet_tvOS_GPUFamily1_v1 = 30000,167 FeatureSet_TVOS_GPUFamily1_v1 = 30000,168 FeatureSet_tvOS_GPUFamily1_v2 = 30001,169 FeatureSet_tvOS_GPUFamily1_v3 = 30002,170 FeatureSet_tvOS_GPUFamily2_v1 = 30003,171 FeatureSet_tvOS_GPUFamily1_v4 = 30004,172 FeatureSet_tvOS_GPUFamily2_v2 = 30005,173};174175_MTL_ENUM(NS::Integer, GPUFamily) {176 GPUFamilyApple1 = 1001,177 GPUFamilyApple2 = 1002,178 GPUFamilyApple3 = 1003,179 GPUFamilyApple4 = 1004,180 GPUFamilyApple5 = 1005,181 GPUFamilyApple6 = 1006,182 GPUFamilyApple7 = 1007,183 GPUFamilyApple8 = 1008,184 GPUFamilyApple9 = 1009,185 GPUFamilyApple10 = 1010,186 GPUFamilyMac1 = 2001,187 GPUFamilyMac2 = 2002,188 GPUFamilyCommon1 = 3001,189 GPUFamilyCommon2 = 3002,190 GPUFamilyCommon3 = 3003,191 GPUFamilyMacCatalyst1 = 4001,192 GPUFamilyMacCatalyst2 = 4002,193 GPUFamilyMetal3 = 5001,194 GPUFamilyMetal4 = 5002,195};196197_MTL_ENUM(NS::UInteger, DeviceLocation) {198 DeviceLocationBuiltIn = 0,199 DeviceLocationSlot = 1,200 DeviceLocationExternal = 2,201 DeviceLocationUnspecified = NS::UIntegerMax,202};203204_MTL_ENUM(NS::UInteger, ReadWriteTextureTier) {205 ReadWriteTextureTierNone = 0,206 ReadWriteTextureTier1 = 1,207 ReadWriteTextureTier2 = 2,208};209210_MTL_ENUM(NS::UInteger, ArgumentBuffersTier) {211 ArgumentBuffersTier1 = 0,212 ArgumentBuffersTier2 = 1,213};214215_MTL_ENUM(NS::UInteger, SparseTextureRegionAlignmentMode) {216 SparseTextureRegionAlignmentModeOutward = 0,217 SparseTextureRegionAlignmentModeInward = 1,218};219220_MTL_ENUM(NS::UInteger, CounterSamplingPoint) {221 CounterSamplingPointAtStageBoundary = 0,222 CounterSamplingPointAtDrawBoundary = 1,223 CounterSamplingPointAtDispatchBoundary = 2,224 CounterSamplingPointAtTileDispatchBoundary = 3,225 CounterSamplingPointAtBlitBoundary = 4,226};227228_MTL_ENUM(NS::Integer, DeviceError) {229 DeviceErrorNone = 0,230 DeviceErrorNotSupported = 1,231};232233_MTL_OPTIONS(NS::UInteger, PipelineOption) {234 PipelineOptionNone = 0,235 PipelineOptionArgumentInfo = 1,236 PipelineOptionBindingInfo = 1,237 PipelineOptionBufferTypeInfo = 1 << 1,238 PipelineOptionFailOnBinaryArchiveMiss = 1 << 2,239};240241using DeviceNotificationName = NS::String*;242using DeviceNotificationHandlerBlock = void (^)(MTL::Device* pDevice, MTL::DeviceNotificationName notifyName);243using DeviceNotificationHandlerFunction = std::function<void(MTL::Device* pDevice, MTL::DeviceNotificationName notifyName)>;244using AutoreleasedComputePipelineReflection = MTL::ComputePipelineReflection*;245using AutoreleasedRenderPipelineReflection = MTL::RenderPipelineReflection*;246using NewLibraryCompletionHandler = void (^)(MTL::Library*, NS::Error*);247using NewLibraryCompletionHandlerFunction = std::function<void(MTL::Library*, NS::Error*)>;248using NewRenderPipelineStateCompletionHandler = void (^)(MTL::RenderPipelineState*, NS::Error*);249using NewRenderPipelineStateCompletionHandlerFunction = std::function<void(MTL::RenderPipelineState*, NS::Error*)>;250using NewRenderPipelineStateWithReflectionCompletionHandler = void (^)(MTL::RenderPipelineState*, MTL::RenderPipelineReflection*, NS::Error*);251using NewRenderPipelineStateWithReflectionCompletionHandlerFunction = std::function<void(MTL::RenderPipelineState*, MTL::RenderPipelineReflection*, NS::Error*)>;252using NewComputePipelineStateCompletionHandler = void (^)(MTL::ComputePipelineState*, NS::Error*);253using NewComputePipelineStateCompletionHandlerFunction = std::function<void(MTL::ComputePipelineState*, NS::Error*)>;254using NewComputePipelineStateWithReflectionCompletionHandler = void (^)(MTL::ComputePipelineState*, MTL::ComputePipelineReflection*, NS::Error*);255using NewComputePipelineStateWithReflectionCompletionHandlerFunction = std::function<void(MTL::ComputePipelineState*, MTL::ComputePipelineReflection*, NS::Error*)>;256using Timestamp = std::uint64_t;257258_MTL_CONST(DeviceNotificationName, DeviceWasAddedNotification);259_MTL_CONST(DeviceNotificationName, DeviceRemovalRequestedNotification);260_MTL_CONST(DeviceNotificationName, DeviceWasRemovedNotification);261_MTL_CONST(NS::ErrorUserInfoKey, CommandBufferEncoderInfoErrorKey);262Device* CreateSystemDefaultDevice();263NS::Array* CopyAllDevices();264NS::Array* CopyAllDevicesWithObserver(NS::Object** pOutObserver, MTL::DeviceNotificationHandlerBlock handler);265NS::Array* CopyAllDevicesWithObserver(NS::Object** pOutObserver, const MTL::DeviceNotificationHandlerFunction& handler);266void RemoveDeviceObserver(const NS::Object* pObserver);267struct AccelerationStructureSizes268{269 NS::UInteger accelerationStructureSize;270 NS::UInteger buildScratchBufferSize;271 NS::UInteger refitScratchBufferSize;272} _MTL_PACKED;273274struct SizeAndAlign275{276 NS::UInteger size;277 NS::UInteger align;278} _MTL_PACKED;279280class ArgumentDescriptor : public NS::Copying<ArgumentDescriptor>281{282public:283 BindingAccess access() const;284285 static ArgumentDescriptor* alloc();286287 static ArgumentDescriptor* argumentDescriptor();288289 NS::UInteger arrayLength() const;290291 NS::UInteger constantBlockAlignment() const;292293 DataType dataType() const;294295 NS::UInteger index() const;296297 ArgumentDescriptor* init();298299 void setAccess(MTL::BindingAccess access);300301 void setArrayLength(NS::UInteger arrayLength);302303 void setConstantBlockAlignment(NS::UInteger constantBlockAlignment);304305 void setDataType(MTL::DataType dataType);306307 void setIndex(NS::UInteger index);308309 void setTextureType(MTL::TextureType textureType);310 TextureType textureType() const;311};312class Architecture : public NS::Copying<Architecture>313{314public:315 static Architecture* alloc();316317 Architecture* init();318319 NS::String* name() const;320};321class Device : public NS::Referencing<Device>322{323public:324 AccelerationStructureSizes accelerationStructureSizes(const MTL::AccelerationStructureDescriptor* descriptor);325326 Architecture* architecture() const;327328 bool areBarycentricCoordsSupported() const;329330 bool areProgrammableSamplePositionsSupported() const;331332 bool areRasterOrderGroupsSupported() const;333334 ArgumentBuffersTier argumentBuffersSupport() const;335336 [[deprecated("please use areBarycentricCoordsSupported instead")]]337 bool barycentricCoordsSupported() const;338339 void convertSparsePixelRegions(const MTL::Region* pixelRegions, MTL::Region* tileRegions, MTL::Size tileSize, MTL::SparseTextureRegionAlignmentMode mode, NS::UInteger numRegions);340341 void convertSparseTileRegions(const MTL::Region* tileRegions, MTL::Region* pixelRegions, MTL::Size tileSize, NS::UInteger numRegions);342343 NS::Array* counterSets() const;344345 NS::UInteger currentAllocatedSize() const;346347 [[deprecated("please use isDepth24Stencil8PixelFormatSupported instead")]]348 bool depth24Stencil8PixelFormatSupported() const;349350 FunctionHandle* functionHandle(const MTL::Function* function);351 FunctionHandle* functionHandle(const MTL4::BinaryFunction* function);352353 void getDefaultSamplePositions(MTL::SamplePosition* positions, NS::UInteger count);354355 bool hasUnifiedMemory() const;356357 [[deprecated("please use isHeadless instead")]]358 bool headless() const;359360 SizeAndAlign heapAccelerationStructureSizeAndAlign(NS::UInteger size);361 SizeAndAlign heapAccelerationStructureSizeAndAlign(const MTL::AccelerationStructureDescriptor* descriptor);362363 SizeAndAlign heapBufferSizeAndAlign(NS::UInteger length, MTL::ResourceOptions options);364365 SizeAndAlign heapTextureSizeAndAlign(const MTL::TextureDescriptor* desc);366367 bool isDepth24Stencil8PixelFormatSupported() const;368369 bool isHeadless() const;370371 bool isLowPower() const;372373 bool isRemovable() const;374375 DeviceLocation location() const;376 NS::UInteger locationNumber() const;377378 [[deprecated("please use isLowPower instead")]]379 bool lowPower() const;380381 NS::UInteger maxArgumentBufferSamplerCount() const;382383 NS::UInteger maxBufferLength() const;384385 NS::UInteger maxThreadgroupMemoryLength() const;386387 Size maxThreadsPerThreadgroup() const;388389 uint64_t maxTransferRate() const;390391 NS::UInteger maximumConcurrentCompilationTaskCount() const;392393 NS::UInteger minimumLinearTextureAlignmentForPixelFormat(MTL::PixelFormat format);394395 NS::UInteger minimumTextureBufferAlignmentForPixelFormat(MTL::PixelFormat format);396397 NS::String* name() const;398399 AccelerationStructure* newAccelerationStructure(NS::UInteger size);400 AccelerationStructure* newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor);401402 MTL4::Archive* newArchive(const NS::URL* url, NS::Error** error);403404 ArgumentEncoder* newArgumentEncoder(const NS::Array* arguments);405 ArgumentEncoder* newArgumentEncoder(const MTL::BufferBinding* bufferBinding);406407 MTL4::ArgumentTable* newArgumentTable(const MTL4::ArgumentTableDescriptor* descriptor, NS::Error** error);408409 BinaryArchive* newBinaryArchive(const MTL::BinaryArchiveDescriptor* descriptor, NS::Error** error);410411 Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);412 Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options);413 Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger));414 Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, MTL::SparsePageSize placementSparsePageSize);415416 MTL4::CommandAllocator* newCommandAllocator();417 MTL4::CommandAllocator* newCommandAllocator(const MTL4::CommandAllocatorDescriptor* descriptor, NS::Error** error);418419 MTL4::CommandBuffer* newCommandBuffer();420421 CommandQueue* newCommandQueue();422 CommandQueue* newCommandQueue(NS::UInteger maxCommandBufferCount);423 CommandQueue* newCommandQueue(const MTL::CommandQueueDescriptor* descriptor);424425 MTL4::Compiler* newCompiler(const MTL4::CompilerDescriptor* descriptor, NS::Error** error);426427 ComputePipelineState* newComputePipelineState(const MTL::Function* computeFunction, NS::Error** error);428 ComputePipelineState* newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error);429 void newComputePipelineState(const MTL::Function* computeFunction, const MTL::NewComputePipelineStateCompletionHandler completionHandler);430 void newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler);431 ComputePipelineState* newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error);432 void newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler);433 void newComputePipelineState(const MTL::Function* pFunction, const MTL::NewComputePipelineStateCompletionHandlerFunction& completionHandler);434 void newComputePipelineState(const MTL::Function* pFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler);435 void newComputePipelineState(const MTL::ComputePipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler);436437 MTL4::CounterHeap* newCounterHeap(const MTL4::CounterHeapDescriptor* descriptor, NS::Error** error);438439 CounterSampleBuffer* newCounterSampleBuffer(const MTL::CounterSampleBufferDescriptor* descriptor, NS::Error** error);440441 Library* newDefaultLibrary();442 Library* newDefaultLibrary(const NS::Bundle* bundle, NS::Error** error);443444 DepthStencilState* newDepthStencilState(const MTL::DepthStencilDescriptor* descriptor);445446 DynamicLibrary* newDynamicLibrary(const MTL::Library* library, NS::Error** error);447 DynamicLibrary* newDynamicLibrary(const NS::URL* url, NS::Error** error);448449 Event* newEvent();450451 Fence* newFence();452453 Heap* newHeap(const MTL::HeapDescriptor* descriptor);454455 IOCommandQueue* newIOCommandQueue(const MTL::IOCommandQueueDescriptor* descriptor, NS::Error** error);456457 IOFileHandle* newIOFileHandle(const NS::URL* url, NS::Error** error);458 IOFileHandle* newIOFileHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error);459460 IOFileHandle* newIOHandle(const NS::URL* url, NS::Error** error);461 IOFileHandle* newIOHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error);462463 IndirectCommandBuffer* newIndirectCommandBuffer(const MTL::IndirectCommandBufferDescriptor* descriptor, NS::UInteger maxCount, MTL::ResourceOptions options);464465 Library* newLibrary(const NS::String* filepath, NS::Error** error);466 Library* newLibrary(const NS::URL* url, NS::Error** error);467 Library* newLibrary(const dispatch_data_t data, NS::Error** error);468 Library* newLibrary(const NS::String* source, const MTL::CompileOptions* options, NS::Error** error);469 void newLibrary(const NS::String* source, const MTL::CompileOptions* options, const MTL::NewLibraryCompletionHandler completionHandler);470 Library* newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, NS::Error** error);471 void newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler);472 void newLibrary(const NS::String* pSource, const MTL::CompileOptions* pOptions, const MTL::NewLibraryCompletionHandlerFunction& completionHandler);473 void newLibrary(const MTL::StitchedLibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& completionHandler);474475 LogState* newLogState(const MTL::LogStateDescriptor* descriptor, NS::Error** error);476477 MTL4::CommandQueue* newMTL4CommandQueue();478 MTL4::CommandQueue* newMTL4CommandQueue(const MTL4::CommandQueueDescriptor* descriptor, NS::Error** error);479480 MTL4::PipelineDataSetSerializer* newPipelineDataSetSerializer(const MTL4::PipelineDataSetSerializerDescriptor* descriptor);481482 RasterizationRateMap* newRasterizationRateMap(const MTL::RasterizationRateMapDescriptor* descriptor);483484 RenderPipelineState* newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error);485 RenderPipelineState* newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);486 void newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);487 void newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);488 RenderPipelineState* newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);489 void newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);490 RenderPipelineState* newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);491 void newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);492 void newRenderPipelineState(const MTL::RenderPipelineDescriptor* pDescriptor, const MTL::NewRenderPipelineStateCompletionHandlerFunction& completionHandler);493 void newRenderPipelineState(const MTL::RenderPipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler);494 void newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler);495496 ResidencySet* newResidencySet(const MTL::ResidencySetDescriptor* desc, NS::Error** error);497498 SamplerState* newSamplerState(const MTL::SamplerDescriptor* descriptor);499500 SharedEvent* newSharedEvent();501 SharedEvent* newSharedEvent(const MTL::SharedEventHandle* sharedEventHandle);502503 Texture* newSharedTexture(const MTL::TextureDescriptor* descriptor);504 Texture* newSharedTexture(const MTL::SharedTextureHandle* sharedHandle);505506 Tensor* newTensor(const MTL::TensorDescriptor* descriptor, NS::Error** error);507 Tensor* newTensor(const MTL::TensorDescriptor* descriptor, const MTL::TensorBufferAttachments* attachments, NS::Error** error);508509 Texture* newTexture(const MTL::TextureDescriptor* descriptor);510 Texture* newTexture(const MTL::TextureDescriptor* descriptor, const IOSurfaceRef iosurface, NS::UInteger plane);511 TextureViewPool* newTextureViewPool(const MTL::ResourceViewPoolDescriptor* descriptor, NS::Error** error);512513 uint32_t peerCount() const;514515 uint64_t peerGroupID() const;516517 uint32_t peerIndex() const;518519 [[deprecated("please use areProgrammableSamplePositionsSupported instead")]]520 bool programmableSamplePositionsSupported() const;521522 uint64_t queryTimestampFrequency();523524 [[deprecated("please use areRasterOrderGroupsSupported instead")]]525 bool rasterOrderGroupsSupported() const;526527 ReadWriteTextureTier readWriteTextureSupport() const;528529 uint64_t recommendedMaxWorkingSetSize() const;530531 uint64_t registryID() const;532533 [[deprecated("please use isRemovable instead")]]534 bool removable() const;535536 void sampleTimestamps(MTL::Timestamp* cpuTimestamp, MTL::Timestamp* gpuTimestamp);537538 void setShouldMaximizeConcurrentCompilation(bool shouldMaximizeConcurrentCompilation);539 bool shouldMaximizeConcurrentCompilation() const;540541 NS::UInteger sizeOfCounterHeapEntry(MTL4::CounterHeapType type);542543 Size sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount);544 Size sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount, MTL::SparsePageSize sparsePageSize);545 NS::UInteger sparseTileSizeInBytes() const;546 NS::UInteger sparseTileSizeInBytes(MTL::SparsePageSize sparsePageSize);547548 bool supports32BitFloatFiltering() const;549550 bool supports32BitMSAA() const;551552 bool supportsBCTextureCompression() const;553554 bool supportsCounterSampling(MTL::CounterSamplingPoint samplingPoint);555556 bool supportsDynamicLibraries() const;557558 bool supportsFamily(MTL::GPUFamily gpuFamily);559560 bool supportsFeatureSet(MTL::FeatureSet featureSet);561562 bool supportsFunctionPointers() const;563 bool supportsFunctionPointersFromRender() const;564565 bool supportsPlacementSparse() const;566567 bool supportsPrimitiveMotionBlur() const;568569 bool supportsPullModelInterpolation() const;570571 bool supportsQueryTextureLOD() const;572573 bool supportsRasterizationRateMap(NS::UInteger layerCount);574575 bool supportsRaytracing() const;576 bool supportsRaytracingFromRender() const;577578 bool supportsRenderDynamicLibraries() const;579580 bool supportsShaderBarycentricCoordinates() const;581582 bool supportsTextureSampleCount(NS::UInteger sampleCount);583584 bool supportsVertexAmplificationCount(NS::UInteger count);585586 SizeAndAlign tensorSizeAndAlign(const MTL::TensorDescriptor* descriptor);587};588589}590591#if defined(MTL_PRIVATE_IMPLEMENTATION)592extern "C" MTL::Device* MTLCreateSystemDefaultDevice();593extern "C" NS::Array* MTLCopyAllDevices();594extern "C" NS::Array* MTLCopyAllDevicesWithObserver(NS::Object**, MTL::DeviceNotificationHandlerBlock);595extern "C" void MTLRemoveDeviceObserver(const NS::Object*);596_MTL_PRIVATE_DEF_WEAK_CONST(MTL::DeviceNotificationName, DeviceWasAddedNotification);597_MTL_PRIVATE_DEF_WEAK_CONST(MTL::DeviceNotificationName, DeviceRemovalRequestedNotification);598_MTL_PRIVATE_DEF_WEAK_CONST(MTL::DeviceNotificationName, DeviceWasRemovedNotification);599_MTL_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, CommandBufferEncoderInfoErrorKey);600_NS_EXPORT MTL::Device* MTL::CreateSystemDefaultDevice()601{602 return ::MTLCreateSystemDefaultDevice();603}604605_NS_EXPORT NS::Array* MTL::CopyAllDevices()606{607#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 180000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)608 return ::MTLCopyAllDevices();609#else610 return nullptr;611#endif612}613614_NS_EXPORT NS::Array* MTL::CopyAllDevicesWithObserver(NS::Object** pOutObserver, MTL::DeviceNotificationHandlerBlock handler)615{616#if TARGET_OS_OSX617 return ::MTLCopyAllDevicesWithObserver(pOutObserver, handler);618#else619 (void)pOutObserver;620 (void)handler;621 return nullptr;622#endif // TARGET_OS_OSX623}624625_NS_EXPORT NS::Array* MTL::CopyAllDevicesWithObserver(NS::Object** pOutObserver, const MTL::DeviceNotificationHandlerFunction& handler)626{627 __block DeviceNotificationHandlerFunction function = handler;628 return CopyAllDevicesWithObserver(pOutObserver, ^(Device* pDevice, DeviceNotificationName pNotificationName) { function(pDevice, pNotificationName); });629}630631_NS_EXPORT void MTL::RemoveDeviceObserver(const NS::Object* pObserver)632{633 (void)pObserver;634#if TARGET_OS_OSX635 ::MTLRemoveDeviceObserver(pObserver);636#endif // TARGET_OS_OSX637}638639#endif // MTL_PRIVATE_IMPLEMENTATION640641_MTL_INLINE MTL::BindingAccess MTL::ArgumentDescriptor::access() const642{643 return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));644}645646_MTL_INLINE MTL::ArgumentDescriptor* MTL::ArgumentDescriptor::alloc()647{648 return NS::Object::alloc<MTL::ArgumentDescriptor>(_MTL_PRIVATE_CLS(MTLArgumentDescriptor));649}650651_MTL_INLINE MTL::ArgumentDescriptor* MTL::ArgumentDescriptor::argumentDescriptor()652{653 return Object::sendMessage<MTL::ArgumentDescriptor*>(_MTL_PRIVATE_CLS(MTLArgumentDescriptor), _MTL_PRIVATE_SEL(argumentDescriptor));654}655656_MTL_INLINE NS::UInteger MTL::ArgumentDescriptor::arrayLength() const657{658 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));659}660661_MTL_INLINE NS::UInteger MTL::ArgumentDescriptor::constantBlockAlignment() const662{663 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(constantBlockAlignment));664}665666_MTL_INLINE MTL::DataType MTL::ArgumentDescriptor::dataType() const667{668 return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));669}670671_MTL_INLINE NS::UInteger MTL::ArgumentDescriptor::index() const672{673 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));674}675676_MTL_INLINE MTL::ArgumentDescriptor* MTL::ArgumentDescriptor::init()677{678 return NS::Object::init<MTL::ArgumentDescriptor>();679}680681_MTL_INLINE void MTL::ArgumentDescriptor::setAccess(MTL::BindingAccess access)682{683 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccess_), access);684}685686_MTL_INLINE void MTL::ArgumentDescriptor::setArrayLength(NS::UInteger arrayLength)687{688 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArrayLength_), arrayLength);689}690691_MTL_INLINE void MTL::ArgumentDescriptor::setConstantBlockAlignment(NS::UInteger constantBlockAlignment)692{693 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantBlockAlignment_), constantBlockAlignment);694}695696_MTL_INLINE void MTL::ArgumentDescriptor::setDataType(MTL::DataType dataType)697{698 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDataType_), dataType);699}700701_MTL_INLINE void MTL::ArgumentDescriptor::setIndex(NS::UInteger index)702{703 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndex_), index);704}705706_MTL_INLINE void MTL::ArgumentDescriptor::setTextureType(MTL::TextureType textureType)707{708 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextureType_), textureType);709}710711_MTL_INLINE MTL::TextureType MTL::ArgumentDescriptor::textureType() const712{713 return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));714}715716_MTL_INLINE MTL::Architecture* MTL::Architecture::alloc()717{718 return NS::Object::alloc<MTL::Architecture>(_MTL_PRIVATE_CLS(MTLArchitecture));719}720721_MTL_INLINE MTL::Architecture* MTL::Architecture::init()722{723 return NS::Object::init<MTL::Architecture>();724}725726_MTL_INLINE NS::String* MTL::Architecture::name() const727{728 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));729}730731_MTL_INLINE MTL::AccelerationStructureSizes MTL::Device::accelerationStructureSizes(const MTL::AccelerationStructureDescriptor* descriptor)732{733 return Object::sendMessage<MTL::AccelerationStructureSizes>(this, _MTL_PRIVATE_SEL(accelerationStructureSizesWithDescriptor_), descriptor);734}735736_MTL_INLINE MTL::Architecture* MTL::Device::architecture() const737{738 return Object::sendMessage<MTL::Architecture*>(this, _MTL_PRIVATE_SEL(architecture));739}740741_MTL_INLINE bool MTL::Device::areBarycentricCoordsSupported() const742{743 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areBarycentricCoordsSupported));744}745746_MTL_INLINE bool MTL::Device::areProgrammableSamplePositionsSupported() const747{748 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areProgrammableSamplePositionsSupported));749}750751_MTL_INLINE bool MTL::Device::areRasterOrderGroupsSupported() const752{753 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areRasterOrderGroupsSupported));754}755756_MTL_INLINE MTL::ArgumentBuffersTier MTL::Device::argumentBuffersSupport() const757{758 return Object::sendMessage<MTL::ArgumentBuffersTier>(this, _MTL_PRIVATE_SEL(argumentBuffersSupport));759}760761_MTL_INLINE bool MTL::Device::barycentricCoordsSupported() const762{763 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areBarycentricCoordsSupported));764}765766_MTL_INLINE void MTL::Device::convertSparsePixelRegions(const MTL::Region* pixelRegions, MTL::Region* tileRegions, MTL::Size tileSize, MTL::SparseTextureRegionAlignmentMode mode, NS::UInteger numRegions)767{768 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(convertSparsePixelRegions_toTileRegions_withTileSize_alignmentMode_numRegions_), pixelRegions, tileRegions, tileSize, mode, numRegions);769}770771_MTL_INLINE void MTL::Device::convertSparseTileRegions(const MTL::Region* tileRegions, MTL::Region* pixelRegions, MTL::Size tileSize, NS::UInteger numRegions)772{773 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(convertSparseTileRegions_toPixelRegions_withTileSize_numRegions_), tileRegions, pixelRegions, tileSize, numRegions);774}775776_MTL_INLINE NS::Array* MTL::Device::counterSets() const777{778 return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(counterSets));779}780781_MTL_INLINE NS::UInteger MTL::Device::currentAllocatedSize() const782{783 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(currentAllocatedSize));784}785786_MTL_INLINE bool MTL::Device::depth24Stencil8PixelFormatSupported() const787{788 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(isDepth24Stencil8PixelFormatSupported));789}790791_MTL_INLINE MTL::FunctionHandle* MTL::Device::functionHandle(const MTL::Function* function)792{793 return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithFunction_), function);794}795796_MTL_INLINE MTL::FunctionHandle* MTL::Device::functionHandle(const MTL4::BinaryFunction* function)797{798 return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithBinaryFunction_), function);799}800801_MTL_INLINE void MTL::Device::getDefaultSamplePositions(MTL::SamplePosition* positions, NS::UInteger count)802{803 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(getDefaultSamplePositions_count_), positions, count);804}805806_MTL_INLINE bool MTL::Device::hasUnifiedMemory() const807{808 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(hasUnifiedMemory));809}810811_MTL_INLINE bool MTL::Device::headless() const812{813 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isHeadless));814}815816_MTL_INLINE MTL::SizeAndAlign MTL::Device::heapAccelerationStructureSizeAndAlign(NS::UInteger size)817{818 return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapAccelerationStructureSizeAndAlignWithSize_), size);819}820821_MTL_INLINE MTL::SizeAndAlign MTL::Device::heapAccelerationStructureSizeAndAlign(const MTL::AccelerationStructureDescriptor* descriptor)822{823 return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapAccelerationStructureSizeAndAlignWithDescriptor_), descriptor);824}825826_MTL_INLINE MTL::SizeAndAlign MTL::Device::heapBufferSizeAndAlign(NS::UInteger length, MTL::ResourceOptions options)827{828 return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapBufferSizeAndAlignWithLength_options_), length, options);829}830831_MTL_INLINE MTL::SizeAndAlign MTL::Device::heapTextureSizeAndAlign(const MTL::TextureDescriptor* desc)832{833 return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapTextureSizeAndAlignWithDescriptor_), desc);834}835836_MTL_INLINE bool MTL::Device::isDepth24Stencil8PixelFormatSupported() const837{838 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(isDepth24Stencil8PixelFormatSupported));839}840841_MTL_INLINE bool MTL::Device::isHeadless() const842{843 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isHeadless));844}845846_MTL_INLINE bool MTL::Device::isLowPower() const847{848 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isLowPower));849}850851_MTL_INLINE bool MTL::Device::isRemovable() const852{853 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRemovable));854}855856_MTL_INLINE MTL::DeviceLocation MTL::Device::location() const857{858 return Object::sendMessage<MTL::DeviceLocation>(this, _MTL_PRIVATE_SEL(location));859}860861_MTL_INLINE NS::UInteger MTL::Device::locationNumber() const862{863 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(locationNumber));864}865866_MTL_INLINE bool MTL::Device::lowPower() const867{868 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isLowPower));869}870871_MTL_INLINE NS::UInteger MTL::Device::maxArgumentBufferSamplerCount() const872{873 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxArgumentBufferSamplerCount));874}875876_MTL_INLINE NS::UInteger MTL::Device::maxBufferLength() const877{878 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxBufferLength));879}880881_MTL_INLINE NS::UInteger MTL::Device::maxThreadgroupMemoryLength() const882{883 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxThreadgroupMemoryLength));884}885886_MTL_INLINE MTL::Size MTL::Device::maxThreadsPerThreadgroup() const887{888 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(maxThreadsPerThreadgroup));889}890891_MTL_INLINE uint64_t MTL::Device::maxTransferRate() const892{893 return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(maxTransferRate));894}895896_MTL_INLINE NS::UInteger MTL::Device::maximumConcurrentCompilationTaskCount() const897{898 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maximumConcurrentCompilationTaskCount));899}900901_MTL_INLINE NS::UInteger MTL::Device::minimumLinearTextureAlignmentForPixelFormat(MTL::PixelFormat format)902{903 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(minimumLinearTextureAlignmentForPixelFormat_), format);904}905906_MTL_INLINE NS::UInteger MTL::Device::minimumTextureBufferAlignmentForPixelFormat(MTL::PixelFormat format)907{908 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(minimumTextureBufferAlignmentForPixelFormat_), format);909}910911_MTL_INLINE NS::String* MTL::Device::name() const912{913 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));914}915916_MTL_INLINE MTL::AccelerationStructure* MTL::Device::newAccelerationStructure(NS::UInteger size)917{918 return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_), size);919}920921_MTL_INLINE MTL::AccelerationStructure* MTL::Device::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor)922{923 return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_), descriptor);924}925926_MTL_INLINE MTL4::Archive* MTL::Device::newArchive(const NS::URL* url, NS::Error** error)927{928 return Object::sendMessage<MTL4::Archive*>(this, _MTL_PRIVATE_SEL(newArchiveWithURL_error_), url, error);929}930931_MTL_INLINE MTL::ArgumentEncoder* MTL::Device::newArgumentEncoder(const NS::Array* arguments)932{933 return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithArguments_), arguments);934}935936_MTL_INLINE MTL::ArgumentEncoder* MTL::Device::newArgumentEncoder(const MTL::BufferBinding* bufferBinding)937{938 return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithBufferBinding_), bufferBinding);939}940941_MTL_INLINE MTL4::ArgumentTable* MTL::Device::newArgumentTable(const MTL4::ArgumentTableDescriptor* descriptor, NS::Error** error)942{943 return Object::sendMessage<MTL4::ArgumentTable*>(this, _MTL_PRIVATE_SEL(newArgumentTableWithDescriptor_error_), descriptor, error);944}945946_MTL_INLINE MTL::BinaryArchive* MTL::Device::newBinaryArchive(const MTL::BinaryArchiveDescriptor* descriptor, NS::Error** error)947{948 return Object::sendMessage<MTL::BinaryArchive*>(this, _MTL_PRIVATE_SEL(newBinaryArchiveWithDescriptor_error_), descriptor, error);949}950951_MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(NS::UInteger length, MTL::ResourceOptions options)952{953 return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_), length, options);954}955956_MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options)957{958 return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithBytes_length_options_), pointer, length, options);959}960961_MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger))962{963 return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithBytesNoCopy_length_options_deallocator_), pointer, length, options, deallocator);964}965966_MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(NS::UInteger length, MTL::ResourceOptions options, MTL::SparsePageSize placementSparsePageSize)967{968 return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_placementSparsePageSize_), length, options, placementSparsePageSize);969}970971_MTL_INLINE MTL4::CommandAllocator* MTL::Device::newCommandAllocator()972{973 return Object::sendMessage<MTL4::CommandAllocator*>(this, _MTL_PRIVATE_SEL(newCommandAllocator));974}975976_MTL_INLINE MTL4::CommandAllocator* MTL::Device::newCommandAllocator(const MTL4::CommandAllocatorDescriptor* descriptor, NS::Error** error)977{978 return Object::sendMessage<MTL4::CommandAllocator*>(this, _MTL_PRIVATE_SEL(newCommandAllocatorWithDescriptor_error_), descriptor, error);979}980981_MTL_INLINE MTL4::CommandBuffer* MTL::Device::newCommandBuffer()982{983 return Object::sendMessage<MTL4::CommandBuffer*>(this, _MTL_PRIVATE_SEL(newCommandBuffer));984}985986_MTL_INLINE MTL::CommandQueue* MTL::Device::newCommandQueue()987{988 return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(newCommandQueue));989}990991_MTL_INLINE MTL::CommandQueue* MTL::Device::newCommandQueue(NS::UInteger maxCommandBufferCount)992{993 return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(newCommandQueueWithMaxCommandBufferCount_), maxCommandBufferCount);994}995996_MTL_INLINE MTL::CommandQueue* MTL::Device::newCommandQueue(const MTL::CommandQueueDescriptor* descriptor)997{998 return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(newCommandQueueWithDescriptor_), descriptor);999}10001001_MTL_INLINE MTL4::Compiler* MTL::Device::newCompiler(const MTL4::CompilerDescriptor* descriptor, NS::Error** error)1002{1003 return Object::sendMessage<MTL4::Compiler*>(this, _MTL_PRIVATE_SEL(newCompilerWithDescriptor_error_), descriptor, error);1004}10051006_MTL_INLINE MTL::ComputePipelineState* MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, NS::Error** error)1007{1008 return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_error_), computeFunction, error);1009}10101011_MTL_INLINE MTL::ComputePipelineState* MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error)1012{1013 return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_options_reflection_error_), computeFunction, options, reflection, error);1014}10151016_MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, const MTL::NewComputePipelineStateCompletionHandler completionHandler)1017{1018 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_completionHandler_), computeFunction, completionHandler);1019}10201021_MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler)1022{1023 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_options_completionHandler_), computeFunction, options, completionHandler);1024}10251026_MTL_INLINE MTL::ComputePipelineState* MTL::Device::newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error)1027{1028 return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_options_reflection_error_), descriptor, options, reflection, error);1029}10301031_MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler)1032{1033 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_options_completionHandler_), descriptor, options, completionHandler);1034}10351036_MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::Function* pFunction, const MTL::NewComputePipelineStateCompletionHandlerFunction& completionHandler)1037{1038 __block MTL::NewComputePipelineStateCompletionHandlerFunction blockCompletionHandler = completionHandler;1039 newComputePipelineState(pFunction, ^(MTL::ComputePipelineState* pPipelineState, NS::Error* pError) { blockCompletionHandler(pPipelineState, pError); });1040}10411042_MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::Function* pFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler)1043{1044 __block MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;1045 newComputePipelineState(pFunction, options, ^(MTL::ComputePipelineState* pPipelineState, MTL::ComputePipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });1046}10471048_MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::ComputePipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler)1049{1050 __block NewComputePipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;1051 newComputePipelineState(pDescriptor, options, ^(ComputePipelineState* pPipelineState, ComputePipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });1052}10531054_MTL_INLINE MTL4::CounterHeap* MTL::Device::newCounterHeap(const MTL4::CounterHeapDescriptor* descriptor, NS::Error** error)1055{1056 return Object::sendMessage<MTL4::CounterHeap*>(this, _MTL_PRIVATE_SEL(newCounterHeapWithDescriptor_error_), descriptor, error);1057}10581059_MTL_INLINE MTL::CounterSampleBuffer* MTL::Device::newCounterSampleBuffer(const MTL::CounterSampleBufferDescriptor* descriptor, NS::Error** error)1060{1061 return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(newCounterSampleBufferWithDescriptor_error_), descriptor, error);1062}10631064_MTL_INLINE MTL::Library* MTL::Device::newDefaultLibrary()1065{1066 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newDefaultLibrary));1067}10681069_MTL_INLINE MTL::Library* MTL::Device::newDefaultLibrary(const NS::Bundle* bundle, NS::Error** error)1070{1071 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newDefaultLibraryWithBundle_error_), bundle, error);1072}10731074_MTL_INLINE MTL::DepthStencilState* MTL::Device::newDepthStencilState(const MTL::DepthStencilDescriptor* descriptor)1075{1076 return Object::sendMessage<MTL::DepthStencilState*>(this, _MTL_PRIVATE_SEL(newDepthStencilStateWithDescriptor_), descriptor);1077}10781079_MTL_INLINE MTL::DynamicLibrary* MTL::Device::newDynamicLibrary(const MTL::Library* library, NS::Error** error)1080{1081 return Object::sendMessage<MTL::DynamicLibrary*>(this, _MTL_PRIVATE_SEL(newDynamicLibrary_error_), library, error);1082}10831084_MTL_INLINE MTL::DynamicLibrary* MTL::Device::newDynamicLibrary(const NS::URL* url, NS::Error** error)1085{1086 return Object::sendMessage<MTL::DynamicLibrary*>(this, _MTL_PRIVATE_SEL(newDynamicLibraryWithURL_error_), url, error);1087}10881089_MTL_INLINE MTL::Event* MTL::Device::newEvent()1090{1091 return Object::sendMessage<MTL::Event*>(this, _MTL_PRIVATE_SEL(newEvent));1092}10931094_MTL_INLINE MTL::Fence* MTL::Device::newFence()1095{1096 return Object::sendMessage<MTL::Fence*>(this, _MTL_PRIVATE_SEL(newFence));1097}10981099_MTL_INLINE MTL::Heap* MTL::Device::newHeap(const MTL::HeapDescriptor* descriptor)1100{1101 return Object::sendMessage<MTL::Heap*>(this, _MTL_PRIVATE_SEL(newHeapWithDescriptor_), descriptor);1102}11031104_MTL_INLINE MTL::IOCommandQueue* MTL::Device::newIOCommandQueue(const MTL::IOCommandQueueDescriptor* descriptor, NS::Error** error)1105{1106 return Object::sendMessage<MTL::IOCommandQueue*>(this, _MTL_PRIVATE_SEL(newIOCommandQueueWithDescriptor_error_), descriptor, error);1107}11081109_MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOFileHandle(const NS::URL* url, NS::Error** error)1110{1111 return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOFileHandleWithURL_error_), url, error);1112}11131114_MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOFileHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error)1115{1116 return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOFileHandleWithURL_compressionMethod_error_), url, compressionMethod, error);1117}11181119_MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOHandle(const NS::URL* url, NS::Error** error)1120{1121 return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOHandleWithURL_error_), url, error);1122}11231124_MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error)1125{1126 return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOHandleWithURL_compressionMethod_error_), url, compressionMethod, error);1127}11281129_MTL_INLINE MTL::IndirectCommandBuffer* MTL::Device::newIndirectCommandBuffer(const MTL::IndirectCommandBufferDescriptor* descriptor, NS::UInteger maxCount, MTL::ResourceOptions options)1130{1131 return Object::sendMessage<MTL::IndirectCommandBuffer*>(this, _MTL_PRIVATE_SEL(newIndirectCommandBufferWithDescriptor_maxCommandCount_options_), descriptor, maxCount, options);1132}11331134_MTL_INLINE MTL::Library* MTL::Device::newLibrary(const NS::String* filepath, NS::Error** error)1135{1136 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithFile_error_), filepath, error);1137}11381139_MTL_INLINE MTL::Library* MTL::Device::newLibrary(const NS::URL* url, NS::Error** error)1140{1141 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithURL_error_), url, error);1142}11431144_MTL_INLINE MTL::Library* MTL::Device::newLibrary(const dispatch_data_t data, NS::Error** error)1145{1146 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithData_error_), data, error);1147}11481149_MTL_INLINE MTL::Library* MTL::Device::newLibrary(const NS::String* source, const MTL::CompileOptions* options, NS::Error** error)1150{1151 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithSource_options_error_), source, options, error);1152}11531154_MTL_INLINE void MTL::Device::newLibrary(const NS::String* source, const MTL::CompileOptions* options, const MTL::NewLibraryCompletionHandler completionHandler)1155{1156 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newLibraryWithSource_options_completionHandler_), source, options, completionHandler);1157}11581159_MTL_INLINE MTL::Library* MTL::Device::newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, NS::Error** error)1160{1161 return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithStitchedDescriptor_error_), descriptor, error);1162}11631164_MTL_INLINE void MTL::Device::newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler)1165{1166 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newLibraryWithStitchedDescriptor_completionHandler_), descriptor, completionHandler);1167}11681169_MTL_INLINE void MTL::Device::newLibrary(const NS::String* pSource, const MTL::CompileOptions* pOptions, const MTL::NewLibraryCompletionHandlerFunction& completionHandler)1170{1171 __block MTL::NewLibraryCompletionHandlerFunction blockCompletionHandler = completionHandler;1172 newLibrary(pSource, pOptions, ^(MTL::Library* pLibrary, NS::Error* pError) { blockCompletionHandler(pLibrary, pError); });1173}11741175_MTL_INLINE void MTL::Device::newLibrary(const MTL::StitchedLibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& completionHandler)1176{1177 __block MTL::NewLibraryCompletionHandlerFunction blockCompletionHandler = completionHandler;1178 newLibrary(pDescriptor, ^(MTL::Library* pLibrary, NS::Error* pError) { blockCompletionHandler(pLibrary, pError); });1179}11801181_MTL_INLINE MTL::LogState* MTL::Device::newLogState(const MTL::LogStateDescriptor* descriptor, NS::Error** error)1182{1183 return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(newLogStateWithDescriptor_error_), descriptor, error);1184}11851186_MTL_INLINE MTL4::CommandQueue* MTL::Device::newMTL4CommandQueue()1187{1188 return Object::sendMessage<MTL4::CommandQueue*>(this, _MTL_PRIVATE_SEL(newMTL4CommandQueue));1189}11901191_MTL_INLINE MTL4::CommandQueue* MTL::Device::newMTL4CommandQueue(const MTL4::CommandQueueDescriptor* descriptor, NS::Error** error)1192{1193 return Object::sendMessage<MTL4::CommandQueue*>(this, _MTL_PRIVATE_SEL(newMTL4CommandQueueWithDescriptor_error_), descriptor, error);1194}11951196_MTL_INLINE MTL4::PipelineDataSetSerializer* MTL::Device::newPipelineDataSetSerializer(const MTL4::PipelineDataSetSerializerDescriptor* descriptor)1197{1198 return Object::sendMessage<MTL4::PipelineDataSetSerializer*>(this, _MTL_PRIVATE_SEL(newPipelineDataSetSerializerWithDescriptor_), descriptor);1199}12001201_MTL_INLINE MTL::RasterizationRateMap* MTL::Device::newRasterizationRateMap(const MTL::RasterizationRateMapDescriptor* descriptor)1202{1203 return Object::sendMessage<MTL::RasterizationRateMap*>(this, _MTL_PRIVATE_SEL(newRasterizationRateMapWithDescriptor_), descriptor);1204}12051206_MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error)1207{1208 return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_error_), descriptor, error);1209}12101211_MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error)1212{1213 return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_options_reflection_error_), descriptor, options, reflection, error);1214}12151216_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, const MTL::NewRenderPipelineStateCompletionHandler completionHandler)1217{1218 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_completionHandler_), descriptor, completionHandler);1219}12201221_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler)1222{1223 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_options_completionHandler_), descriptor, options, completionHandler);1224}12251226_MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error)1227{1228 return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithTileDescriptor_options_reflection_error_), descriptor, options, reflection, error);1229}12301231_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler)1232{1233 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithTileDescriptor_options_completionHandler_), descriptor, options, completionHandler);1234}12351236_MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error)1237{1238 return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithMeshDescriptor_options_reflection_error_), descriptor, options, reflection, error);1239}12401241_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler)1242{1243 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithMeshDescriptor_options_completionHandler_), descriptor, options, completionHandler);1244}12451246_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* pDescriptor, const MTL::NewRenderPipelineStateCompletionHandlerFunction& completionHandler)1247{1248 __block MTL::NewRenderPipelineStateCompletionHandlerFunction blockCompletionHandler = completionHandler;1249 newRenderPipelineState(pDescriptor, ^(MTL::RenderPipelineState* pPipelineState, NS::Error* pError) { blockCompletionHandler(pPipelineState, pError); });1250}12511252_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler)1253{1254 __block MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;1255 newRenderPipelineState(pDescriptor, options, ^(MTL::RenderPipelineState* pPipelineState, MTL::RenderPipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });1256}12571258_MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler)1259{1260 __block MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;1261 newRenderPipelineState(pDescriptor, options, ^(MTL::RenderPipelineState* pPipelineState, MTL::RenderPipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });1262}12631264_MTL_INLINE MTL::ResidencySet* MTL::Device::newResidencySet(const MTL::ResidencySetDescriptor* desc, NS::Error** error)1265{1266 return Object::sendMessage<MTL::ResidencySet*>(this, _MTL_PRIVATE_SEL(newResidencySetWithDescriptor_error_), desc, error);1267}12681269_MTL_INLINE MTL::SamplerState* MTL::Device::newSamplerState(const MTL::SamplerDescriptor* descriptor)1270{1271 return Object::sendMessage<MTL::SamplerState*>(this, _MTL_PRIVATE_SEL(newSamplerStateWithDescriptor_), descriptor);1272}12731274_MTL_INLINE MTL::SharedEvent* MTL::Device::newSharedEvent()1275{1276 return Object::sendMessage<MTL::SharedEvent*>(this, _MTL_PRIVATE_SEL(newSharedEvent));1277}12781279_MTL_INLINE MTL::SharedEvent* MTL::Device::newSharedEvent(const MTL::SharedEventHandle* sharedEventHandle)1280{1281 return Object::sendMessage<MTL::SharedEvent*>(this, _MTL_PRIVATE_SEL(newSharedEventWithHandle_), sharedEventHandle);1282}12831284_MTL_INLINE MTL::Texture* MTL::Device::newSharedTexture(const MTL::TextureDescriptor* descriptor)1285{1286 return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newSharedTextureWithDescriptor_), descriptor);1287}12881289_MTL_INLINE MTL::Texture* MTL::Device::newSharedTexture(const MTL::SharedTextureHandle* sharedHandle)1290{1291 return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newSharedTextureWithHandle_), sharedHandle);1292}12931294_MTL_INLINE MTL::Tensor* MTL::Device::newTensor(const MTL::TensorDescriptor* descriptor, NS::Error** error)1295{1296 return Object::sendMessage<MTL::Tensor*>(this, _MTL_PRIVATE_SEL(newTensorWithDescriptor_error_), descriptor, error);1297}12981299_MTL_INLINE MTL::Tensor* MTL::Device::newTensor(const MTL::TensorDescriptor* descriptor, const MTL::TensorBufferAttachments* attachments, NS::Error** error)1300{1301 return Object::sendMessage<MTL::Tensor*>(this, _MTL_PRIVATE_SEL(newTensorWithDescriptor_attachments_error_), descriptor, attachments, error);1302}13031304_MTL_INLINE MTL::Texture* MTL::Device::newTexture(const MTL::TextureDescriptor* descriptor)1305{1306 return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_), descriptor);1307}13081309_MTL_INLINE MTL::Texture* MTL::Device::newTexture(const MTL::TextureDescriptor* descriptor, const IOSurfaceRef iosurface, NS::UInteger plane)1310{1311 return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_iosurface_plane_), descriptor, iosurface, plane);1312}13131314_MTL_INLINE MTL::TextureViewPool* MTL::Device::newTextureViewPool(const MTL::ResourceViewPoolDescriptor* descriptor, NS::Error** error)1315{1316 return Object::sendMessage<MTL::TextureViewPool*>(this, _MTL_PRIVATE_SEL(newTextureViewPoolWithDescriptor_error_), descriptor, error);1317}13181319_MTL_INLINE uint32_t MTL::Device::peerCount() const1320{1321 return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(peerCount));1322}13231324_MTL_INLINE uint64_t MTL::Device::peerGroupID() const1325{1326 return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(peerGroupID));1327}13281329_MTL_INLINE uint32_t MTL::Device::peerIndex() const1330{1331 return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(peerIndex));1332}13331334_MTL_INLINE bool MTL::Device::programmableSamplePositionsSupported() const1335{1336 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areProgrammableSamplePositionsSupported));1337}13381339_MTL_INLINE uint64_t MTL::Device::queryTimestampFrequency()1340{1341 return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(queryTimestampFrequency));1342}13431344_MTL_INLINE bool MTL::Device::rasterOrderGroupsSupported() const1345{1346 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areRasterOrderGroupsSupported));1347}13481349_MTL_INLINE MTL::ReadWriteTextureTier MTL::Device::readWriteTextureSupport() const1350{1351 return Object::sendMessage<MTL::ReadWriteTextureTier>(this, _MTL_PRIVATE_SEL(readWriteTextureSupport));1352}13531354_MTL_INLINE uint64_t MTL::Device::recommendedMaxWorkingSetSize() const1355{1356 return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(recommendedMaxWorkingSetSize));1357}13581359_MTL_INLINE uint64_t MTL::Device::registryID() const1360{1361 return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(registryID));1362}13631364_MTL_INLINE bool MTL::Device::removable() const1365{1366 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRemovable));1367}13681369_MTL_INLINE void MTL::Device::sampleTimestamps(MTL::Timestamp* cpuTimestamp, MTL::Timestamp* gpuTimestamp)1370{1371 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleTimestamps_gpuTimestamp_), cpuTimestamp, gpuTimestamp);1372}13731374_MTL_INLINE void MTL::Device::setShouldMaximizeConcurrentCompilation(bool shouldMaximizeConcurrentCompilation)1375{1376 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShouldMaximizeConcurrentCompilation_), shouldMaximizeConcurrentCompilation);1377}13781379_MTL_INLINE bool MTL::Device::shouldMaximizeConcurrentCompilation() const1380{1381 return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(shouldMaximizeConcurrentCompilation));1382}13831384_MTL_INLINE NS::UInteger MTL::Device::sizeOfCounterHeapEntry(MTL4::CounterHeapType type)1385{1386 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sizeOfCounterHeapEntry_), type);1387}13881389_MTL_INLINE MTL::Size MTL::Device::sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount)1390{1391 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(sparseTileSizeWithTextureType_pixelFormat_sampleCount_), textureType, pixelFormat, sampleCount);1392}13931394_MTL_INLINE MTL::Size MTL::Device::sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount, MTL::SparsePageSize sparsePageSize)1395{1396 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(sparseTileSizeWithTextureType_pixelFormat_sampleCount_sparsePageSize_), textureType, pixelFormat, sampleCount, sparsePageSize);1397}13981399_MTL_INLINE NS::UInteger MTL::Device::sparseTileSizeInBytes() const1400{1401 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sparseTileSizeInBytes));1402}14031404_MTL_INLINE NS::UInteger MTL::Device::sparseTileSizeInBytes(MTL::SparsePageSize sparsePageSize)1405{1406 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sparseTileSizeInBytesForSparsePageSize_), sparsePageSize);1407}14081409_MTL_INLINE bool MTL::Device::supports32BitFloatFiltering() const1410{1411 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supports32BitFloatFiltering));1412}14131414_MTL_INLINE bool MTL::Device::supports32BitMSAA() const1415{1416 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supports32BitMSAA));1417}14181419_MTL_INLINE bool MTL::Device::supportsBCTextureCompression() const1420{1421 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsBCTextureCompression));1422}14231424_MTL_INLINE bool MTL::Device::supportsCounterSampling(MTL::CounterSamplingPoint samplingPoint)1425{1426 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsCounterSampling_), samplingPoint);1427}14281429_MTL_INLINE bool MTL::Device::supportsDynamicLibraries() const1430{1431 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsDynamicLibraries));1432}14331434_MTL_INLINE bool MTL::Device::supportsFamily(MTL::GPUFamily gpuFamily)1435{1436 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFamily_), gpuFamily);1437}14381439_MTL_INLINE bool MTL::Device::supportsFeatureSet(MTL::FeatureSet featureSet)1440{1441 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFeatureSet_), featureSet);1442}14431444_MTL_INLINE bool MTL::Device::supportsFunctionPointers() const1445{1446 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFunctionPointers));1447}14481449_MTL_INLINE bool MTL::Device::supportsFunctionPointersFromRender() const1450{1451 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFunctionPointersFromRender));1452}14531454_MTL_INLINE bool MTL::Device::supportsPlacementSparse() const1455{1456 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsPlacementSparse));1457}14581459_MTL_INLINE bool MTL::Device::supportsPrimitiveMotionBlur() const1460{1461 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsPrimitiveMotionBlur));1462}14631464_MTL_INLINE bool MTL::Device::supportsPullModelInterpolation() const1465{1466 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsPullModelInterpolation));1467}14681469_MTL_INLINE bool MTL::Device::supportsQueryTextureLOD() const1470{1471 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsQueryTextureLOD));1472}14731474_MTL_INLINE bool MTL::Device::supportsRasterizationRateMap(NS::UInteger layerCount)1475{1476 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRasterizationRateMapWithLayerCount_), layerCount);1477}14781479_MTL_INLINE bool MTL::Device::supportsRaytracing() const1480{1481 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRaytracing));1482}14831484_MTL_INLINE bool MTL::Device::supportsRaytracingFromRender() const1485{1486 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRaytracingFromRender));1487}14881489_MTL_INLINE bool MTL::Device::supportsRenderDynamicLibraries() const1490{1491 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRenderDynamicLibraries));1492}14931494_MTL_INLINE bool MTL::Device::supportsShaderBarycentricCoordinates() const1495{1496 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsShaderBarycentricCoordinates));1497}14981499_MTL_INLINE bool MTL::Device::supportsTextureSampleCount(NS::UInteger sampleCount)1500{1501 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsTextureSampleCount_), sampleCount);1502}15031504_MTL_INLINE bool MTL::Device::supportsVertexAmplificationCount(NS::UInteger count)1505{1506 return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsVertexAmplificationCount_), count);1507}15081509_MTL_INLINE MTL::SizeAndAlign MTL::Device::tensorSizeAndAlign(const MTL::TensorDescriptor* descriptor)1510{1511 return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(tensorSizeAndAlignWithDescriptor_), descriptor);1512}1513