yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
develop
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLResource.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 "MTLResource.hpp" 30 31namespace MTL 32{ 33_MTL_ENUM ( NS :: UInteger , PurgeableState ) { 34PurgeableStateKeepCurrent = 1 , 35PurgeableStateNonVolatile = 2 , 36PurgeableStateVolatile = 3 , 37PurgeableStateEmpty = 4 , 38} ; 39 40_MTL_ENUM ( NS :: UInteger , CPUCacheMode ) { 41CPUCacheModeDefaultCache = 0 , 42CPUCacheModeWriteCombined = 1 , 43} ; 44 45_MTL_ENUM ( NS :: UInteger , StorageMode ) { 46StorageModeShared = 0 , 47StorageModeManaged = 1 , 48StorageModePrivate = 2 , 49StorageModeMemoryless = 3 , 50} ; 51 52_MTL_ENUM ( NS :: UInteger , HazardTrackingMode ) { 53HazardTrackingModeDefault = 0 , 54HazardTrackingModeUntracked = 1 , 55HazardTrackingModeTracked = 2 , 56} ; 57 58_MTL_OPTIONS ( NS :: UInteger , ResourceOptions ) { 59ResourceStorageModeShared = 0 , 60ResourceHazardTrackingModeDefault = 0 , 61ResourceCPUCacheModeDefaultCache = 0 , 62ResourceOptionCPUCacheModeDefault = 0 , 63ResourceCPUCacheModeWriteCombined = 1 , 64ResourceOptionCPUCacheModeWriteCombined = 1 , 65ResourceStorageModeManaged = 16 , 66ResourceStorageModePrivate = 32 , 67ResourceStorageModeMemoryless = 48 , 68ResourceHazardTrackingModeUntracked = 256 , 69ResourceHazardTrackingModeTracked = 512 , 70} ; 71 72class Resource : public NS :: Referencing < Resource > 73{ 74public : 75NS :: String * label () const ; 76void setLabel ( const NS :: String * label ) ; 77 78class Device * device () const ; 79 80MTL :: CPUCacheMode cpuCacheMode () const ; 81 82MTL :: StorageMode storageMode () const ; 83 84MTL :: HazardTrackingMode hazardTrackingMode () const ; 85 86MTL :: ResourceOptions resourceOptions () const ; 87 88MTL :: PurgeableState setPurgeableState ( MTL :: PurgeableState state ) ; 89 90class Heap * heap () const ; 91 92NS :: UInteger heapOffset () const ; 93 94NS :: UInteger allocatedSize () const ; 95 96void makeAliasable () ; 97 98bool isAliasable () ; 99} ; 100 101} 102 103// property: label 104_MTL_INLINE NS :: String * MTL :: Resource :: label () const 105{ 106return Object :: sendMessage < NS :: String *> ( this , _MTL_PRIVATE_SEL ( label )) ; 107} 108 109_MTL_INLINE void MTL :: Resource :: setLabel ( const NS :: String * label ) 110{ 111Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setLabel_ ) , label ) ; 112} 113 114// property: device 115_MTL_INLINE MTL :: Device * MTL :: Resource :: device () const 116{ 117return Object :: sendMessage < MTL :: Device *> ( this , _MTL_PRIVATE_SEL ( device )) ; 118} 119 120// property: cpuCacheMode 121_MTL_INLINE MTL :: CPUCacheMode MTL :: Resource :: cpuCacheMode () const 122{ 123return Object :: sendMessage < MTL :: CPUCacheMode > ( this , _MTL_PRIVATE_SEL ( cpuCacheMode )) ; 124} 125 126// property: storageMode 127_MTL_INLINE MTL :: StorageMode MTL :: Resource :: storageMode () const 128{ 129return Object :: sendMessage < MTL :: StorageMode > ( this , _MTL_PRIVATE_SEL ( storageMode )) ; 130} 131 132// property: hazardTrackingMode 133_MTL_INLINE MTL :: HazardTrackingMode MTL :: Resource :: hazardTrackingMode () const 134{ 135return Object :: sendMessage < MTL :: HazardTrackingMode > ( this , _MTL_PRIVATE_SEL ( hazardTrackingMode )) ; 136} 137 138// property: resourceOptions 139_MTL_INLINE MTL :: ResourceOptions MTL :: Resource :: resourceOptions () const 140{ 141return Object :: sendMessage < MTL :: ResourceOptions > ( this , _MTL_PRIVATE_SEL ( resourceOptions )) ; 142} 143 144// method: setPurgeableState: 145_MTL_INLINE MTL :: PurgeableState MTL :: Resource :: setPurgeableState ( MTL :: PurgeableState state ) 146{ 147return Object :: sendMessage < MTL :: PurgeableState > ( this , _MTL_PRIVATE_SEL ( setPurgeableState_ ) , state ) ; 148} 149 150// property: heap 151_MTL_INLINE MTL :: Heap * MTL :: Resource :: heap () const 152{ 153return Object :: sendMessage < MTL :: Heap *> ( this , _MTL_PRIVATE_SEL ( heap )) ; 154} 155 156// property: heapOffset 157_MTL_INLINE NS :: UInteger MTL :: Resource :: heapOffset () const 158{ 159return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( heapOffset )) ; 160} 161 162// property: allocatedSize 163_MTL_INLINE NS :: UInteger MTL :: Resource :: allocatedSize () const 164{ 165return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( allocatedSize )) ; 166} 167 168// method: makeAliasable 169_MTL_INLINE void MTL :: Resource :: makeAliasable () 170{ 171Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( makeAliasable )) ; 172} 173 174// method: isAliasable 175_MTL_INLINE bool MTL :: Resource :: isAliasable () 176{ 177return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( isAliasable )) ; 178}