yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
v1.3.1
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLSampler.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 "MTLDepthStencil.hpp" 30#include "MTLSampler.hpp" 31 32namespace MTL 33{ 34_MTL_ENUM ( NS :: UInteger , SamplerMinMagFilter ) { 35SamplerMinMagFilterNearest = 0 , 36SamplerMinMagFilterLinear = 1 , 37} ; 38 39_MTL_ENUM ( NS :: UInteger , SamplerMipFilter ) { 40SamplerMipFilterNotMipmapped = 0 , 41SamplerMipFilterNearest = 1 , 42SamplerMipFilterLinear = 2 , 43} ; 44 45_MTL_ENUM ( NS :: UInteger , SamplerAddressMode ) { 46SamplerAddressModeClampToEdge = 0 , 47SamplerAddressModeMirrorClampToEdge = 1 , 48SamplerAddressModeRepeat = 2 , 49SamplerAddressModeMirrorRepeat = 3 , 50SamplerAddressModeClampToZero = 4 , 51SamplerAddressModeClampToBorderColor = 5 , 52} ; 53 54_MTL_ENUM ( NS :: UInteger , SamplerBorderColor ) { 55SamplerBorderColorTransparentBlack = 0 , 56SamplerBorderColorOpaqueBlack = 1 , 57SamplerBorderColorOpaqueWhite = 2 , 58} ; 59 60class SamplerDescriptor : public NS :: Copying < SamplerDescriptor > 61{ 62public : 63static class SamplerDescriptor * alloc () ; 64 65class SamplerDescriptor * init () ; 66 67MTL :: SamplerMinMagFilter minFilter () const ; 68void setMinFilter ( MTL :: SamplerMinMagFilter minFilter ) ; 69 70MTL :: SamplerMinMagFilter magFilter () const ; 71void setMagFilter ( MTL :: SamplerMinMagFilter magFilter ) ; 72 73MTL :: SamplerMipFilter mipFilter () const ; 74void setMipFilter ( MTL :: SamplerMipFilter mipFilter ) ; 75 76NS :: UInteger maxAnisotropy () const ; 77void setMaxAnisotropy ( NS :: UInteger maxAnisotropy ) ; 78 79MTL :: SamplerAddressMode sAddressMode () const ; 80void setSAddressMode ( MTL :: SamplerAddressMode sAddressMode ) ; 81 82MTL :: SamplerAddressMode tAddressMode () const ; 83void setTAddressMode ( MTL :: SamplerAddressMode tAddressMode ) ; 84 85MTL :: SamplerAddressMode rAddressMode () const ; 86void setRAddressMode ( MTL :: SamplerAddressMode rAddressMode ) ; 87 88MTL :: SamplerBorderColor borderColor () const ; 89void setBorderColor ( MTL :: SamplerBorderColor borderColor ) ; 90 91bool normalizedCoordinates () const ; 92void setNormalizedCoordinates ( bool normalizedCoordinates ) ; 93 94float lodMinClamp () const ; 95void setLodMinClamp ( float lodMinClamp ) ; 96 97float lodMaxClamp () const ; 98void setLodMaxClamp ( float lodMaxClamp ) ; 99 100bool lodAverage () const ; 101void setLodAverage ( bool lodAverage ) ; 102 103MTL :: CompareFunction compareFunction () const ; 104void setCompareFunction ( MTL :: CompareFunction compareFunction ) ; 105 106bool supportArgumentBuffers () const ; 107void setSupportArgumentBuffers ( bool supportArgumentBuffers ) ; 108 109NS :: String * label () const ; 110void setLabel ( const NS :: String * label ) ; 111} ; 112 113class SamplerState : public NS :: Referencing < SamplerState > 114{ 115public : 116NS :: String * label () const ; 117 118class Device * device () const ; 119} ; 120 121} 122 123// static method: alloc 124_MTL_INLINE MTL :: SamplerDescriptor * MTL :: SamplerDescriptor :: alloc () 125{ 126return NS :: Object :: alloc < MTL :: SamplerDescriptor > ( _MTL_PRIVATE_CLS ( MTLSamplerDescriptor )) ; 127} 128 129// method: init 130_MTL_INLINE MTL :: SamplerDescriptor * MTL :: SamplerDescriptor :: init () 131{ 132return NS :: Object :: init < MTL :: SamplerDescriptor > () ; 133} 134 135// property: minFilter 136_MTL_INLINE MTL :: SamplerMinMagFilter MTL :: SamplerDescriptor :: minFilter () const 137{ 138return Object :: sendMessage < MTL :: SamplerMinMagFilter > ( this , _MTL_PRIVATE_SEL ( minFilter )) ; 139} 140 141_MTL_INLINE void MTL :: SamplerDescriptor :: setMinFilter ( MTL :: SamplerMinMagFilter minFilter ) 142{ 143Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMinFilter_ ) , minFilter ) ; 144} 145 146// property: magFilter 147_MTL_INLINE MTL :: SamplerMinMagFilter MTL :: SamplerDescriptor :: magFilter () const 148{ 149return Object :: sendMessage < MTL :: SamplerMinMagFilter > ( this , _MTL_PRIVATE_SEL ( magFilter )) ; 150} 151 152_MTL_INLINE void MTL :: SamplerDescriptor :: setMagFilter ( MTL :: SamplerMinMagFilter magFilter ) 153{ 154Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMagFilter_ ) , magFilter ) ; 155} 156 157// property: mipFilter 158_MTL_INLINE MTL :: SamplerMipFilter MTL :: SamplerDescriptor :: mipFilter () const 159{ 160return Object :: sendMessage < MTL :: SamplerMipFilter > ( this , _MTL_PRIVATE_SEL ( mipFilter )) ; 161} 162 163_MTL_INLINE void MTL :: SamplerDescriptor :: setMipFilter ( MTL :: SamplerMipFilter mipFilter ) 164{ 165Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMipFilter_ ) , mipFilter ) ; 166} 167 168// property: maxAnisotropy 169_MTL_INLINE NS :: UInteger MTL :: SamplerDescriptor :: maxAnisotropy () const 170{ 171return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( maxAnisotropy )) ; 172} 173 174_MTL_INLINE void MTL :: SamplerDescriptor :: setMaxAnisotropy ( NS :: UInteger maxAnisotropy ) 175{ 176Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMaxAnisotropy_ ) , maxAnisotropy ) ; 177} 178 179// property: sAddressMode 180_MTL_INLINE MTL :: SamplerAddressMode MTL :: SamplerDescriptor :: sAddressMode () const 181{ 182return Object :: sendMessage < MTL :: SamplerAddressMode > ( this , _MTL_PRIVATE_SEL ( sAddressMode )) ; 183} 184 185_MTL_INLINE void MTL :: SamplerDescriptor :: setSAddressMode ( MTL :: SamplerAddressMode sAddressMode ) 186{ 187Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setSAddressMode_ ) , sAddressMode ) ; 188} 189 190// property: tAddressMode 191_MTL_INLINE MTL :: SamplerAddressMode MTL :: SamplerDescriptor :: tAddressMode () const 192{ 193return Object :: sendMessage < MTL :: SamplerAddressMode > ( this , _MTL_PRIVATE_SEL ( tAddressMode )) ; 194} 195 196_MTL_INLINE void MTL :: SamplerDescriptor :: setTAddressMode ( MTL :: SamplerAddressMode tAddressMode ) 197{ 198Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setTAddressMode_ ) , tAddressMode ) ; 199} 200 201// property: rAddressMode 202_MTL_INLINE MTL :: SamplerAddressMode MTL :: SamplerDescriptor :: rAddressMode () const 203{ 204return Object :: sendMessage < MTL :: SamplerAddressMode > ( this , _MTL_PRIVATE_SEL ( rAddressMode )) ; 205} 206 207_MTL_INLINE void MTL :: SamplerDescriptor :: setRAddressMode ( MTL :: SamplerAddressMode rAddressMode ) 208{ 209Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setRAddressMode_ ) , rAddressMode ) ; 210} 211 212// property: borderColor 213_MTL_INLINE MTL :: SamplerBorderColor MTL :: SamplerDescriptor :: borderColor () const 214{ 215return Object :: sendMessage < MTL :: SamplerBorderColor > ( this , _MTL_PRIVATE_SEL ( borderColor )) ; 216} 217 218_MTL_INLINE void MTL :: SamplerDescriptor :: setBorderColor ( MTL :: SamplerBorderColor borderColor ) 219{ 220Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setBorderColor_ ) , borderColor ) ; 221} 222 223// property: normalizedCoordinates 224_MTL_INLINE bool MTL :: SamplerDescriptor :: normalizedCoordinates () const 225{ 226return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( normalizedCoordinates )) ; 227} 228 229_MTL_INLINE void MTL :: SamplerDescriptor :: setNormalizedCoordinates ( bool normalizedCoordinates ) 230{ 231Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setNormalizedCoordinates_ ) , normalizedCoordinates ) ; 232} 233 234// property: lodMinClamp 235_MTL_INLINE float MTL :: SamplerDescriptor :: lodMinClamp () const 236{ 237return Object :: sendMessage < float > ( this , _MTL_PRIVATE_SEL ( lodMinClamp )) ; 238} 239 240_MTL_INLINE void MTL :: SamplerDescriptor :: setLodMinClamp ( float lodMinClamp ) 241{ 242Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setLodMinClamp_ ) , lodMinClamp ) ; 243} 244 245// property: lodMaxClamp 246_MTL_INLINE float MTL :: SamplerDescriptor :: lodMaxClamp () const 247{ 248return Object :: sendMessage < float > ( this , _MTL_PRIVATE_SEL ( lodMaxClamp )) ; 249} 250 251_MTL_INLINE void MTL :: SamplerDescriptor :: setLodMaxClamp ( float lodMaxClamp ) 252{ 253Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setLodMaxClamp_ ) , lodMaxClamp ) ; 254} 255 256// property: lodAverage 257_MTL_INLINE bool MTL :: SamplerDescriptor :: lodAverage () const 258{ 259return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( lodAverage )) ; 260} 261 262_MTL_INLINE void MTL :: SamplerDescriptor :: setLodAverage ( bool lodAverage ) 263{ 264Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setLodAverage_ ) , lodAverage ) ; 265} 266 267// property: compareFunction 268_MTL_INLINE MTL :: CompareFunction MTL :: SamplerDescriptor :: compareFunction () const 269{ 270return Object :: sendMessage < MTL :: CompareFunction > ( this , _MTL_PRIVATE_SEL ( compareFunction )) ; 271} 272 273_MTL_INLINE void MTL :: SamplerDescriptor :: setCompareFunction ( MTL :: CompareFunction compareFunction ) 274{ 275Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setCompareFunction_ ) , compareFunction ) ; 276} 277 278// property: supportArgumentBuffers 279_MTL_INLINE bool MTL :: SamplerDescriptor :: supportArgumentBuffers () const 280{ 281return Object :: sendMessageSafe < bool > ( this , _MTL_PRIVATE_SEL ( supportArgumentBuffers )) ; 282} 283 284_MTL_INLINE void MTL :: SamplerDescriptor :: setSupportArgumentBuffers ( bool supportArgumentBuffers ) 285{ 286Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setSupportArgumentBuffers_ ) , supportArgumentBuffers ) ; 287} 288 289// property: label 290_MTL_INLINE NS :: String * MTL :: SamplerDescriptor :: label () const 291{ 292return Object :: sendMessage < NS :: String *> ( this , _MTL_PRIVATE_SEL ( label )) ; 293} 294 295_MTL_INLINE void MTL :: SamplerDescriptor :: setLabel ( const NS :: String * label ) 296{ 297Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setLabel_ ) , label ) ; 298} 299 300// property: label 301_MTL_INLINE NS :: String * MTL :: SamplerState :: label () const 302{ 303return Object :: sendMessage < NS :: String *> ( this , _MTL_PRIVATE_SEL ( label )) ; 304} 305 306// property: device 307_MTL_INLINE MTL :: Device * MTL :: SamplerState :: device () const 308{ 309return Object :: sendMessage < MTL :: Device *> ( this , _MTL_PRIVATE_SEL ( device )) ; 310}