File size: 11,624 Bytes
c4764a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLHeap.hpp
//
// Copyright 2020-2023 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <Foundation/Foundation.hpp>
#include "MTLDevice.hpp"
#include "MTLHeap.hpp"
#include "MTLResource.hpp"
namespace MTL
{
_MTL_ENUM(NS::Integer, HeapType) {
HeapTypeAutomatic = 0,
HeapTypePlacement = 1,
HeapTypeSparse = 2,
};
class HeapDescriptor : public NS::Copying<HeapDescriptor>
{
public:
static class HeapDescriptor* alloc();
class HeapDescriptor* init();
NS::UInteger size() const;
void setSize(NS::UInteger size);
MTL::StorageMode storageMode() const;
void setStorageMode(MTL::StorageMode storageMode);
MTL::CPUCacheMode cpuCacheMode() const;
void setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode);
MTL::SparsePageSize sparsePageSize() const;
void setSparsePageSize(MTL::SparsePageSize sparsePageSize);
MTL::HazardTrackingMode hazardTrackingMode() const;
void setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode);
MTL::ResourceOptions resourceOptions() const;
void setResourceOptions(MTL::ResourceOptions resourceOptions);
MTL::HeapType type() const;
void setType(MTL::HeapType type);
};
class Heap : public NS::Referencing<Heap>
{
public:
NS::String* label() const;
void setLabel(const NS::String* label);
class Device* device() const;
MTL::StorageMode storageMode() const;
MTL::CPUCacheMode cpuCacheMode() const;
MTL::HazardTrackingMode hazardTrackingMode() const;
MTL::ResourceOptions resourceOptions() const;
NS::UInteger size() const;
NS::UInteger usedSize() const;
NS::UInteger currentAllocatedSize() const;
NS::UInteger maxAvailableSize(NS::UInteger alignment);
class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);
class Texture* newTexture(const class TextureDescriptor* descriptor);
MTL::PurgeableState setPurgeableState(MTL::PurgeableState state);
MTL::HeapType type() const;
class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset);
class Texture* newTexture(const class TextureDescriptor* descriptor, NS::UInteger offset);
class AccelerationStructure* newAccelerationStructure(NS::UInteger size);
class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor);
class AccelerationStructure* newAccelerationStructure(NS::UInteger size, NS::UInteger offset);
class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor, NS::UInteger offset);
};
}
// static method: alloc
_MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::alloc()
{
return NS::Object::alloc<MTL::HeapDescriptor>(_MTL_PRIVATE_CLS(MTLHeapDescriptor));
}
// method: init
_MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::init()
{
return NS::Object::init<MTL::HeapDescriptor>();
}
// property: size
_MTL_INLINE NS::UInteger MTL::HeapDescriptor::size() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
}
_MTL_INLINE void MTL::HeapDescriptor::setSize(NS::UInteger size)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSize_), size);
}
// property: storageMode
_MTL_INLINE MTL::StorageMode MTL::HeapDescriptor::storageMode() const
{
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
}
_MTL_INLINE void MTL::HeapDescriptor::setStorageMode(MTL::StorageMode storageMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
}
// property: cpuCacheMode
_MTL_INLINE MTL::CPUCacheMode MTL::HeapDescriptor::cpuCacheMode() const
{
return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
}
_MTL_INLINE void MTL::HeapDescriptor::setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCpuCacheMode_), cpuCacheMode);
}
// property: sparsePageSize
_MTL_INLINE MTL::SparsePageSize MTL::HeapDescriptor::sparsePageSize() const
{
return Object::sendMessage<MTL::SparsePageSize>(this, _MTL_PRIVATE_SEL(sparsePageSize));
}
_MTL_INLINE void MTL::HeapDescriptor::setSparsePageSize(MTL::SparsePageSize sparsePageSize)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSparsePageSize_), sparsePageSize);
}
// property: hazardTrackingMode
_MTL_INLINE MTL::HazardTrackingMode MTL::HeapDescriptor::hazardTrackingMode() const
{
return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
}
_MTL_INLINE void MTL::HeapDescriptor::setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setHazardTrackingMode_), hazardTrackingMode);
}
// property: resourceOptions
_MTL_INLINE MTL::ResourceOptions MTL::HeapDescriptor::resourceOptions() const
{
return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
}
_MTL_INLINE void MTL::HeapDescriptor::setResourceOptions(MTL::ResourceOptions resourceOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResourceOptions_), resourceOptions);
}
// property: type
_MTL_INLINE MTL::HeapType MTL::HeapDescriptor::type() const
{
return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
}
_MTL_INLINE void MTL::HeapDescriptor::setType(MTL::HeapType type)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
}
// property: label
_MTL_INLINE NS::String* MTL::Heap::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL::Heap::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
// property: device
_MTL_INLINE MTL::Device* MTL::Heap::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
// property: storageMode
_MTL_INLINE MTL::StorageMode MTL::Heap::storageMode() const
{
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
}
// property: cpuCacheMode
_MTL_INLINE MTL::CPUCacheMode MTL::Heap::cpuCacheMode() const
{
return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
}
// property: hazardTrackingMode
_MTL_INLINE MTL::HazardTrackingMode MTL::Heap::hazardTrackingMode() const
{
return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
}
// property: resourceOptions
_MTL_INLINE MTL::ResourceOptions MTL::Heap::resourceOptions() const
{
return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
}
// property: size
_MTL_INLINE NS::UInteger MTL::Heap::size() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
}
// property: usedSize
_MTL_INLINE NS::UInteger MTL::Heap::usedSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(usedSize));
}
// property: currentAllocatedSize
_MTL_INLINE NS::UInteger MTL::Heap::currentAllocatedSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(currentAllocatedSize));
}
// method: maxAvailableSizeWithAlignment:
_MTL_INLINE NS::UInteger MTL::Heap::maxAvailableSize(NS::UInteger alignment)
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxAvailableSizeWithAlignment_), alignment);
}
// method: newBufferWithLength:options:
_MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options)
{
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_), length, options);
}
// method: newTextureWithDescriptor:
_MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor)
{
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_), descriptor);
}
// method: setPurgeableState:
_MTL_INLINE MTL::PurgeableState MTL::Heap::setPurgeableState(MTL::PurgeableState state)
{
return Object::sendMessage<MTL::PurgeableState>(this, _MTL_PRIVATE_SEL(setPurgeableState_), state);
}
// property: type
_MTL_INLINE MTL::HeapType MTL::Heap::type() const
{
return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
}
// method: newBufferWithLength:options:offset:
_MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset)
{
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_offset_), length, options, offset);
}
// method: newTextureWithDescriptor:offset:
_MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset)
{
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_offset_), descriptor, offset);
}
// method: newAccelerationStructureWithSize:
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(NS::UInteger size)
{
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_), size);
}
// method: newAccelerationStructureWithDescriptor:
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor)
{
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_), descriptor);
}
// method: newAccelerationStructureWithSize:offset:
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(NS::UInteger size, NS::UInteger offset)
{
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_offset_), size, offset);
}
// method: newAccelerationStructureWithDescriptor:offset:
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor, NS::UInteger offset)
{
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_offset_), descriptor, offset);
}
|