yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
develop
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLHeap.hpp 4// 5// Copyright 2020-2021 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 at 10// 11// http://www.apache.org/licenses/LICENSE-2.0 12// 13// Unless required by applicable law or agreed to in writing, software 14// 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 and 17// limitations under the License. 18// 19//------------------------------------------------------------------------------------------------------------------------------------------------------------- 20 21#pragma once 22 23#include "MTLDefines.hpp" 24#include "MTLHeaderBridge.hpp" 25#include "MTLPrivate.hpp" 26 27#include <Foundation/Foundation.hpp> 28 29#include "MTLHeap.hpp" 30#include "MTLResource.hpp" 31 32namespace MTL 33{ 34_MTL_ENUM (NS ::Integer ,HeapType ) { 35HeapTypeAutomatic = 0 , 36HeapTypePlacement = 1 , 37HeapTypeSparse = 2 , 38}; 39 40class HeapDescriptor :public NS ::Copying < HeapDescriptor > 41{ 42public : 43static class HeapDescriptor * alloc (); 44 45class HeapDescriptor * init (); 46 47NS ::UInteger size ()const ; 48void setSize (NS ::UInteger size ); 49 50MTL ::StorageMode storageMode ()const ; 51void setStorageMode (MTL ::StorageMode storageMode ); 52 53MTL ::CPUCacheMode cpuCacheMode ()const ; 54void setCpuCacheMode (MTL ::CPUCacheMode cpuCacheMode ); 55 56MTL ::HazardTrackingMode hazardTrackingMode ()const ; 57void setHazardTrackingMode (MTL ::HazardTrackingMode hazardTrackingMode ); 58 59MTL ::ResourceOptions resourceOptions ()const ; 60void setResourceOptions (MTL ::ResourceOptions resourceOptions ); 61 62MTL ::HeapType type ()const ; 63void setType (MTL ::HeapType type ); 64}; 65 66class Heap :public NS ::Referencing < Heap > 67{ 68public : 69NS ::String * label ()const ; 70void setLabel (const NS ::String * label ); 71 72class Device * device ()const ; 73 74MTL ::StorageMode storageMode ()const ; 75 76MTL ::CPUCacheMode cpuCacheMode ()const ; 77 78MTL ::HazardTrackingMode hazardTrackingMode ()const ; 79 80MTL ::ResourceOptions resourceOptions ()const ; 81 82NS ::UInteger size ()const ; 83 84NS ::UInteger usedSize ()const ; 85 86NS ::UInteger currentAllocatedSize ()const ; 87 88NS ::UInteger maxAvailableSize (NS ::UInteger alignment ); 89 90class Buffer * newBuffer (NS ::UInteger length ,MTL ::ResourceOptions options ); 91 92class Texture * newTexture (const class TextureDescriptor * desc ); 93 94MTL ::PurgeableState setPurgeableState (MTL ::PurgeableState state ); 95 96MTL ::HeapType type ()const ; 97 98class Buffer * newBuffer (NS ::UInteger length ,MTL ::ResourceOptions options ,NS ::UInteger offset ); 99 100class Texture * newTexture (const class TextureDescriptor * descriptor ,NS ::UInteger offset ); 101}; 102 103} 104 105// static method: alloc 106_MTL_INLINE MTL ::HeapDescriptor * MTL ::HeapDescriptor ::alloc () 107{ 108return NS ::Object ::alloc < MTL ::HeapDescriptor > (_MTL_PRIVATE_CLS (MTLHeapDescriptor )); 109} 110 111// method: init 112_MTL_INLINE MTL ::HeapDescriptor * MTL ::HeapDescriptor ::init () 113{ 114return NS ::Object ::init < MTL ::HeapDescriptor > (); 115} 116 117// property: size 118_MTL_INLINE NS ::UInteger MTL ::HeapDescriptor ::size ()const 119{ 120return Object ::sendMessage < NS ::UInteger > (this ,_MTL_PRIVATE_SEL (size )); 121} 122 123_MTL_INLINE voidMTL ::HeapDescriptor ::setSize (NS ::UInteger size ) 124{ 125Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setSize_ ),size ); 126} 127 128// property: storageMode 129_MTL_INLINE MTL ::StorageMode MTL ::HeapDescriptor ::storageMode ()const 130{ 131return Object ::sendMessage < MTL ::StorageMode > (this ,_MTL_PRIVATE_SEL (storageMode )); 132} 133 134_MTL_INLINE voidMTL ::HeapDescriptor ::setStorageMode (MTL ::StorageMode storageMode ) 135{ 136Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setStorageMode_ ),storageMode ); 137} 138 139// property: cpuCacheMode 140_MTL_INLINE MTL ::CPUCacheMode MTL ::HeapDescriptor ::cpuCacheMode ()const 141{ 142return Object ::sendMessage < MTL ::CPUCacheMode > (this ,_MTL_PRIVATE_SEL (cpuCacheMode )); 143} 144 145_MTL_INLINE voidMTL ::HeapDescriptor ::setCpuCacheMode (MTL ::CPUCacheMode cpuCacheMode ) 146{ 147Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setCpuCacheMode_ ),cpuCacheMode ); 148} 149 150// property: hazardTrackingMode 151_MTL_INLINE MTL ::HazardTrackingMode MTL ::HeapDescriptor ::hazardTrackingMode ()const 152{ 153return Object ::sendMessage < MTL ::HazardTrackingMode > (this ,_MTL_PRIVATE_SEL (hazardTrackingMode )); 154} 155 156_MTL_INLINE voidMTL ::HeapDescriptor ::setHazardTrackingMode (MTL ::HazardTrackingMode hazardTrackingMode ) 157{ 158Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setHazardTrackingMode_ ),hazardTrackingMode ); 159} 160 161// property: resourceOptions 162_MTL_INLINE MTL ::ResourceOptions MTL ::HeapDescriptor ::resourceOptions ()const 163{ 164return Object ::sendMessage < MTL ::ResourceOptions > (this ,_MTL_PRIVATE_SEL (resourceOptions )); 165} 166 167_MTL_INLINE voidMTL ::HeapDescriptor ::setResourceOptions (MTL ::ResourceOptions resourceOptions ) 168{ 169Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setResourceOptions_ ),resourceOptions ); 170} 171 172// property: type 173_MTL_INLINE MTL ::HeapType MTL ::HeapDescriptor ::type ()const 174{ 175return Object ::sendMessage < MTL ::HeapType > (this ,_MTL_PRIVATE_SEL (type )); 176} 177 178_MTL_INLINE voidMTL ::HeapDescriptor ::setType (MTL ::HeapType type ) 179{ 180Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setType_ ),type ); 181} 182 183// property: label 184_MTL_INLINE NS ::String * MTL ::Heap ::label ()const 185{ 186return Object ::sendMessage < NS ::String *> (this ,_MTL_PRIVATE_SEL (label )); 187} 188 189_MTL_INLINE voidMTL ::Heap ::setLabel (const NS ::String * label ) 190{ 191Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (setLabel_ ),label ); 192} 193 194// property: device 195_MTL_INLINE MTL ::Device * MTL ::Heap ::device ()const 196{ 197return Object ::sendMessage < MTL ::Device *> (this ,_MTL_PRIVATE_SEL (device )); 198} 199 200// property: storageMode 201_MTL_INLINE MTL ::StorageMode MTL ::Heap ::storageMode ()const 202{ 203return Object ::sendMessage < MTL ::StorageMode > (this ,_MTL_PRIVATE_SEL (storageMode )); 204} 205 206// property: cpuCacheMode 207_MTL_INLINE MTL ::CPUCacheMode MTL ::Heap ::cpuCacheMode ()const 208{ 209return Object ::sendMessage < MTL ::CPUCacheMode > (this ,_MTL_PRIVATE_SEL (cpuCacheMode )); 210} 211 212// property: hazardTrackingMode 213_MTL_INLINE MTL ::HazardTrackingMode MTL ::Heap ::hazardTrackingMode ()const 214{ 215return Object ::sendMessage < MTL ::HazardTrackingMode > (this ,_MTL_PRIVATE_SEL (hazardTrackingMode )); 216} 217 218// property: resourceOptions 219_MTL_INLINE MTL ::ResourceOptions MTL ::Heap ::resourceOptions ()const 220{ 221return Object ::sendMessage < MTL ::ResourceOptions > (this ,_MTL_PRIVATE_SEL (resourceOptions )); 222} 223 224// property: size 225_MTL_INLINE NS ::UInteger MTL ::Heap ::size ()const 226{ 227return Object ::sendMessage < NS ::UInteger > (this ,_MTL_PRIVATE_SEL (size )); 228} 229 230// property: usedSize 231_MTL_INLINE NS ::UInteger MTL ::Heap ::usedSize ()const 232{ 233return Object ::sendMessage < NS ::UInteger > (this ,_MTL_PRIVATE_SEL (usedSize )); 234} 235 236// property: currentAllocatedSize 237_MTL_INLINE NS ::UInteger MTL ::Heap ::currentAllocatedSize ()const 238{ 239return Object ::sendMessage < NS ::UInteger > (this ,_MTL_PRIVATE_SEL (currentAllocatedSize )); 240} 241 242// method: maxAvailableSizeWithAlignment: 243_MTL_INLINE NS ::UInteger MTL ::Heap ::maxAvailableSize (NS ::UInteger alignment ) 244{ 245return Object ::sendMessage < NS ::UInteger > (this ,_MTL_PRIVATE_SEL (maxAvailableSizeWithAlignment_ ),alignment ); 246} 247 248// method: newBufferWithLength:options: 249_MTL_INLINE MTL ::Buffer * MTL ::Heap ::newBuffer (NS ::UInteger length ,MTL ::ResourceOptions options ) 250{ 251return Object ::sendMessage < MTL ::Buffer *> (this ,_MTL_PRIVATE_SEL (newBufferWithLength_options_ ),length ,options ); 252} 253 254// method: newTextureWithDescriptor: 255_MTL_INLINE MTL ::Texture * MTL ::Heap ::newTexture (const MTL ::TextureDescriptor * desc ) 256{ 257return Object ::sendMessage < MTL ::Texture *> (this ,_MTL_PRIVATE_SEL (newTextureWithDescriptor_ ),desc ); 258} 259 260// method: setPurgeableState: 261_MTL_INLINE MTL ::PurgeableState MTL ::Heap ::setPurgeableState (MTL ::PurgeableState state ) 262{ 263return Object ::sendMessage < MTL ::PurgeableState > (this ,_MTL_PRIVATE_SEL (setPurgeableState_ ),state ); 264} 265 266// property: type 267_MTL_INLINE MTL ::HeapType MTL ::Heap ::type ()const 268{ 269return Object ::sendMessage < MTL ::HeapType > (this ,_MTL_PRIVATE_SEL (type )); 270} 271 272// method: newBufferWithLength:options:offset: 273_MTL_INLINE MTL ::Buffer * MTL ::Heap ::newBuffer (NS ::UInteger length ,MTL ::ResourceOptions options ,NS ::UInteger offset ) 274{ 275return Object ::sendMessage < MTL ::Buffer *> (this ,_MTL_PRIVATE_SEL (newBufferWithLength_options_offset_ ),length ,options ,offset ); 276} 277 278// method: newTextureWithDescriptor:offset: 279_MTL_INLINE MTL ::Texture * MTL ::Heap ::newTexture (const MTL ::TextureDescriptor * descriptor ,NS ::UInteger offset ) 280{ 281return Object ::sendMessage < MTL ::Texture *> (this ,_MTL_PRIVATE_SEL (newTextureWithDescriptor_offset_ ),descriptor ,offset ); 282}