yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
master
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLArgument.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 "MTLArgument.hpp" 30#include "MTLTexture.hpp" 31 32namespace MTL 33{ 34_MTL_ENUM ( NS :: UInteger , DataType ) { 35DataTypeNone = 0 , 36DataTypeStruct = 1 , 37DataTypeArray = 2 , 38DataTypeFloat = 3 , 39DataTypeFloat2 = 4 , 40DataTypeFloat3 = 5 , 41DataTypeFloat4 = 6 , 42DataTypeFloat2x2 = 7 , 43DataTypeFloat2x3 = 8 , 44DataTypeFloat2x4 = 9 , 45DataTypeFloat3x2 = 10 , 46DataTypeFloat3x3 = 11 , 47DataTypeFloat3x4 = 12 , 48DataTypeFloat4x2 = 13 , 49DataTypeFloat4x3 = 14 , 50DataTypeFloat4x4 = 15 , 51DataTypeHalf = 16 , 52DataTypeHalf2 = 17 , 53DataTypeHalf3 = 18 , 54DataTypeHalf4 = 19 , 55DataTypeHalf2x2 = 20 , 56DataTypeHalf2x3 = 21 , 57DataTypeHalf2x4 = 22 , 58DataTypeHalf3x2 = 23 , 59DataTypeHalf3x3 = 24 , 60DataTypeHalf3x4 = 25 , 61DataTypeHalf4x2 = 26 , 62DataTypeHalf4x3 = 27 , 63DataTypeHalf4x4 = 28 , 64DataTypeInt = 29 , 65DataTypeInt2 = 30 , 66DataTypeInt3 = 31 , 67DataTypeInt4 = 32 , 68DataTypeUInt = 33 , 69DataTypeUInt2 = 34 , 70DataTypeUInt3 = 35 , 71DataTypeUInt4 = 36 , 72DataTypeShort = 37 , 73DataTypeShort2 = 38 , 74DataTypeShort3 = 39 , 75DataTypeShort4 = 40 , 76DataTypeUShort = 41 , 77DataTypeUShort2 = 42 , 78DataTypeUShort3 = 43 , 79DataTypeUShort4 = 44 , 80DataTypeChar = 45 , 81DataTypeChar2 = 46 , 82DataTypeChar3 = 47 , 83DataTypeChar4 = 48 , 84DataTypeUChar = 49 , 85DataTypeUChar2 = 50 , 86DataTypeUChar3 = 51 , 87DataTypeUChar4 = 52 , 88DataTypeBool = 53 , 89DataTypeBool2 = 54 , 90DataTypeBool3 = 55 , 91DataTypeBool4 = 56 , 92DataTypeTexture = 58 , 93DataTypeSampler = 59 , 94DataTypePointer = 60 , 95DataTypeR8Unorm = 62 , 96DataTypeR8Snorm = 63 , 97DataTypeR16Unorm = 64 , 98DataTypeR16Snorm = 65 , 99DataTypeRG8Unorm = 66 , 100DataTypeRG8Snorm = 67 , 101DataTypeRG16Unorm = 68 , 102DataTypeRG16Snorm = 69 , 103DataTypeRGBA8Unorm = 70 , 104DataTypeRGBA8Unorm_sRGB = 71 , 105DataTypeRGBA8Snorm = 72 , 106DataTypeRGBA16Unorm = 73 , 107DataTypeRGBA16Snorm = 74 , 108DataTypeRGB10A2Unorm = 75 , 109DataTypeRG11B10Float = 76 , 110DataTypeRGB9E5Float = 77 , 111DataTypeRenderPipeline = 78 , 112DataTypeComputePipeline = 79 , 113DataTypeIndirectCommandBuffer = 80 , 114DataTypeLong = 81 , 115DataTypeLong2 = 82 , 116DataTypeLong3 = 83 , 117DataTypeLong4 = 84 , 118DataTypeULong = 85 , 119DataTypeULong2 = 86 , 120DataTypeULong3 = 87 , 121DataTypeULong4 = 88 , 122DataTypeVisibleFunctionTable = 115 , 123DataTypeIntersectionFunctionTable = 116 , 124DataTypePrimitiveAccelerationStructure = 117 , 125DataTypeInstanceAccelerationStructure = 118 , 126} ; 127 128_MTL_ENUM ( NS :: UInteger , ArgumentType ) { 129ArgumentTypeBuffer = 0 , 130ArgumentTypeThreadgroupMemory = 1 , 131ArgumentTypeTexture = 2 , 132ArgumentTypeSampler = 3 , 133ArgumentTypeImageblockData = 16 , 134ArgumentTypeImageblock = 17 , 135ArgumentTypeVisibleFunctionTable = 24 , 136ArgumentTypePrimitiveAccelerationStructure = 25 , 137ArgumentTypeInstanceAccelerationStructure = 26 , 138ArgumentTypeIntersectionFunctionTable = 27 , 139} ; 140 141_MTL_ENUM ( NS :: UInteger , ArgumentAccess ) { 142ArgumentAccessReadOnly = 0 , 143ArgumentAccessReadWrite = 1 , 144ArgumentAccessWriteOnly = 2 , 145} ; 146 147class Type : public NS :: Referencing < Type > 148{ 149public : 150static class Type * alloc () ; 151 152class Type * init () ; 153 154MTL :: DataType dataType () const ; 155} ; 156 157class StructMember : public NS :: Referencing < StructMember > 158{ 159public : 160static class StructMember * alloc () ; 161 162class StructMember * init () ; 163 164NS :: String * name () const ; 165 166NS :: UInteger offset () const ; 167 168MTL :: DataType dataType () const ; 169 170class StructType * structType () ; 171 172class ArrayType * arrayType () ; 173 174class TextureReferenceType * textureReferenceType () ; 175 176class PointerType * pointerType () ; 177 178NS :: UInteger argumentIndex () const ; 179} ; 180 181class StructType : public NS :: Referencing < StructType , Type > 182{ 183public : 184static class StructType * alloc () ; 185 186class StructType * init () ; 187 188NS :: Array * members () const ; 189 190class StructMember * memberByName ( const NS :: String * name ) ; 191} ; 192 193class ArrayType : public NS :: Referencing < ArrayType , Type > 194{ 195public : 196static class ArrayType * alloc () ; 197 198class ArrayType * init () ; 199 200MTL :: DataType elementType () const ; 201 202NS :: UInteger arrayLength () const ; 203 204NS :: UInteger stride () const ; 205 206NS :: UInteger argumentIndexStride () const ; 207 208class StructType * elementStructType () ; 209 210class ArrayType * elementArrayType () ; 211 212class TextureReferenceType * elementTextureReferenceType () ; 213 214class PointerType * elementPointerType () ; 215} ; 216 217class PointerType : public NS :: Referencing < PointerType , Type > 218{ 219public : 220static class PointerType * alloc () ; 221 222class PointerType * init () ; 223 224MTL :: DataType elementType () const ; 225 226MTL :: ArgumentAccess access () const ; 227 228NS :: UInteger alignment () const ; 229 230NS :: UInteger dataSize () const ; 231 232bool elementIsArgumentBuffer () const ; 233 234class StructType * elementStructType () ; 235 236class ArrayType * elementArrayType () ; 237} ; 238 239class TextureReferenceType : public NS :: Referencing < TextureReferenceType , Type > 240{ 241public : 242static class TextureReferenceType * alloc () ; 243 244class TextureReferenceType * init () ; 245 246MTL :: DataType textureDataType () const ; 247 248MTL :: TextureType textureType () const ; 249 250MTL :: ArgumentAccess access () const ; 251 252bool isDepthTexture () const ; 253} ; 254 255class Argument : public NS :: Referencing < Argument > 256{ 257public : 258static class Argument * alloc () ; 259 260class Argument * init () ; 261 262NS :: String * name () const ; 263 264MTL :: ArgumentType type () const ; 265 266MTL :: ArgumentAccess access () const ; 267 268NS :: UInteger index () const ; 269 270bool active () const ; 271 272NS :: UInteger bufferAlignment () const ; 273 274NS :: UInteger bufferDataSize () const ; 275 276MTL :: DataType bufferDataType () const ; 277 278class StructType * bufferStructType () const ; 279 280class PointerType * bufferPointerType () const ; 281 282NS :: UInteger threadgroupMemoryAlignment () const ; 283 284NS :: UInteger threadgroupMemoryDataSize () const ; 285 286MTL :: TextureType textureType () const ; 287 288MTL :: DataType textureDataType () const ; 289 290bool isDepthTexture () const ; 291 292NS :: UInteger arrayLength () const ; 293} ; 294 295} 296 297// static method: alloc 298_MTL_INLINE MTL :: Type * MTL :: Type :: alloc () 299{ 300return NS :: Object :: alloc < MTL :: Type > ( _MTL_PRIVATE_CLS ( MTLType )) ; 301} 302 303// method: init 304_MTL_INLINE MTL :: Type * MTL :: Type :: init () 305{ 306return NS :: Object :: init < MTL :: Type > () ; 307} 308 309// property: dataType 310_MTL_INLINE MTL :: DataType MTL :: Type :: dataType () const 311{ 312return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( dataType )) ; 313} 314 315// static method: alloc 316_MTL_INLINE MTL :: StructMember * MTL :: StructMember :: alloc () 317{ 318return NS :: Object :: alloc < MTL :: StructMember > ( _MTL_PRIVATE_CLS ( MTLStructMember )) ; 319} 320 321// method: init 322_MTL_INLINE MTL :: StructMember * MTL :: StructMember :: init () 323{ 324return NS :: Object :: init < MTL :: StructMember > () ; 325} 326 327// property: name 328_MTL_INLINE NS :: String * MTL :: StructMember :: name () const 329{ 330return Object :: sendMessage < NS :: String *> ( this , _MTL_PRIVATE_SEL ( name )) ; 331} 332 333// property: offset 334_MTL_INLINE NS :: UInteger MTL :: StructMember :: offset () const 335{ 336return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( offset )) ; 337} 338 339// property: dataType 340_MTL_INLINE MTL :: DataType MTL :: StructMember :: dataType () const 341{ 342return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( dataType )) ; 343} 344 345// method: structType 346_MTL_INLINE MTL :: StructType * MTL :: StructMember :: structType () 347{ 348return Object :: sendMessage < MTL :: StructType *> ( this , _MTL_PRIVATE_SEL ( structType )) ; 349} 350 351// method: arrayType 352_MTL_INLINE MTL :: ArrayType * MTL :: StructMember :: arrayType () 353{ 354return Object :: sendMessage < MTL :: ArrayType *> ( this , _MTL_PRIVATE_SEL ( arrayType )) ; 355} 356 357// method: textureReferenceType 358_MTL_INLINE MTL :: TextureReferenceType * MTL :: StructMember :: textureReferenceType () 359{ 360return Object :: sendMessage < MTL :: TextureReferenceType *> ( this , _MTL_PRIVATE_SEL ( textureReferenceType )) ; 361} 362 363// method: pointerType 364_MTL_INLINE MTL :: PointerType * MTL :: StructMember :: pointerType () 365{ 366return Object :: sendMessage < MTL :: PointerType *> ( this , _MTL_PRIVATE_SEL ( pointerType )) ; 367} 368 369// property: argumentIndex 370_MTL_INLINE NS :: UInteger MTL :: StructMember :: argumentIndex () const 371{ 372return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( argumentIndex )) ; 373} 374 375// static method: alloc 376_MTL_INLINE MTL :: StructType * MTL :: StructType :: alloc () 377{ 378return NS :: Object :: alloc < MTL :: StructType > ( _MTL_PRIVATE_CLS ( MTLStructType )) ; 379} 380 381// method: init 382_MTL_INLINE MTL :: StructType * MTL :: StructType :: init () 383{ 384return NS :: Object :: init < MTL :: StructType > () ; 385} 386 387// property: members 388_MTL_INLINE NS :: Array * MTL :: StructType :: members () const 389{ 390return Object :: sendMessage < NS :: Array *> ( this , _MTL_PRIVATE_SEL ( members )) ; 391} 392 393// method: memberByName: 394_MTL_INLINE MTL :: StructMember * MTL :: StructType :: memberByName ( const NS :: String * name ) 395{ 396return Object :: sendMessage < MTL :: StructMember *> ( this , _MTL_PRIVATE_SEL ( memberByName_ ) , name ) ; 397} 398 399// static method: alloc 400_MTL_INLINE MTL :: ArrayType * MTL :: ArrayType :: alloc () 401{ 402return NS :: Object :: alloc < MTL :: ArrayType > ( _MTL_PRIVATE_CLS ( MTLArrayType )) ; 403} 404 405// method: init 406_MTL_INLINE MTL :: ArrayType * MTL :: ArrayType :: init () 407{ 408return NS :: Object :: init < MTL :: ArrayType > () ; 409} 410 411// property: elementType 412_MTL_INLINE MTL :: DataType MTL :: ArrayType :: elementType () const 413{ 414return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( elementType )) ; 415} 416 417// property: arrayLength 418_MTL_INLINE NS :: UInteger MTL :: ArrayType :: arrayLength () const 419{ 420return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( arrayLength )) ; 421} 422 423// property: stride 424_MTL_INLINE NS :: UInteger MTL :: ArrayType :: stride () const 425{ 426return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( stride )) ; 427} 428 429// property: argumentIndexStride 430_MTL_INLINE NS :: UInteger MTL :: ArrayType :: argumentIndexStride () const 431{ 432return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( argumentIndexStride )) ; 433} 434 435// method: elementStructType 436_MTL_INLINE MTL :: StructType * MTL :: ArrayType :: elementStructType () 437{ 438return Object :: sendMessage < MTL :: StructType *> ( this , _MTL_PRIVATE_SEL ( elementStructType )) ; 439} 440 441// method: elementArrayType 442_MTL_INLINE MTL :: ArrayType * MTL :: ArrayType :: elementArrayType () 443{ 444return Object :: sendMessage < MTL :: ArrayType *> ( this , _MTL_PRIVATE_SEL ( elementArrayType )) ; 445} 446 447// method: elementTextureReferenceType 448_MTL_INLINE MTL :: TextureReferenceType * MTL :: ArrayType :: elementTextureReferenceType () 449{ 450return Object :: sendMessage < MTL :: TextureReferenceType *> ( this , _MTL_PRIVATE_SEL ( elementTextureReferenceType )) ; 451} 452 453// method: elementPointerType 454_MTL_INLINE MTL :: PointerType * MTL :: ArrayType :: elementPointerType () 455{ 456return Object :: sendMessage < MTL :: PointerType *> ( this , _MTL_PRIVATE_SEL ( elementPointerType )) ; 457} 458 459// static method: alloc 460_MTL_INLINE MTL :: PointerType * MTL :: PointerType :: alloc () 461{ 462return NS :: Object :: alloc < MTL :: PointerType > ( _MTL_PRIVATE_CLS ( MTLPointerType )) ; 463} 464 465// method: init 466_MTL_INLINE MTL :: PointerType * MTL :: PointerType :: init () 467{ 468return NS :: Object :: init < MTL :: PointerType > () ; 469} 470 471// property: elementType 472_MTL_INLINE MTL :: DataType MTL :: PointerType :: elementType () const 473{ 474return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( elementType )) ; 475} 476 477// property: access 478_MTL_INLINE MTL :: ArgumentAccess MTL :: PointerType :: access () const 479{ 480return Object :: sendMessage < MTL :: ArgumentAccess > ( this , _MTL_PRIVATE_SEL ( access )) ; 481} 482 483// property: alignment 484_MTL_INLINE NS :: UInteger MTL :: PointerType :: alignment () const 485{ 486return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( alignment )) ; 487} 488 489// property: dataSize 490_MTL_INLINE NS :: UInteger MTL :: PointerType :: dataSize () const 491{ 492return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( dataSize )) ; 493} 494 495// property: elementIsArgumentBuffer 496_MTL_INLINE bool MTL :: PointerType :: elementIsArgumentBuffer () const 497{ 498return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( elementIsArgumentBuffer )) ; 499} 500 501// method: elementStructType 502_MTL_INLINE MTL :: StructType * MTL :: PointerType :: elementStructType () 503{ 504return Object :: sendMessage < MTL :: StructType *> ( this , _MTL_PRIVATE_SEL ( elementStructType )) ; 505} 506 507// method: elementArrayType 508_MTL_INLINE MTL :: ArrayType * MTL :: PointerType :: elementArrayType () 509{ 510return Object :: sendMessage < MTL :: ArrayType *> ( this , _MTL_PRIVATE_SEL ( elementArrayType )) ; 511} 512 513// static method: alloc 514_MTL_INLINE MTL :: TextureReferenceType * MTL :: TextureReferenceType :: alloc () 515{ 516return NS :: Object :: alloc < MTL :: TextureReferenceType > ( _MTL_PRIVATE_CLS ( MTLTextureReferenceType )) ; 517} 518 519// method: init 520_MTL_INLINE MTL :: TextureReferenceType * MTL :: TextureReferenceType :: init () 521{ 522return NS :: Object :: init < MTL :: TextureReferenceType > () ; 523} 524 525// property: textureDataType 526_MTL_INLINE MTL :: DataType MTL :: TextureReferenceType :: textureDataType () const 527{ 528return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( textureDataType )) ; 529} 530 531// property: textureType 532_MTL_INLINE MTL :: TextureType MTL :: TextureReferenceType :: textureType () const 533{ 534return Object :: sendMessage < MTL :: TextureType > ( this , _MTL_PRIVATE_SEL ( textureType )) ; 535} 536 537// property: access 538_MTL_INLINE MTL :: ArgumentAccess MTL :: TextureReferenceType :: access () const 539{ 540return Object :: sendMessage < MTL :: ArgumentAccess > ( this , _MTL_PRIVATE_SEL ( access )) ; 541} 542 543// property: isDepthTexture 544_MTL_INLINE bool MTL :: TextureReferenceType :: isDepthTexture () const 545{ 546return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( isDepthTexture )) ; 547} 548 549// static method: alloc 550_MTL_INLINE MTL :: Argument * MTL :: Argument :: alloc () 551{ 552return NS :: Object :: alloc < MTL :: Argument > ( _MTL_PRIVATE_CLS ( MTLArgument )) ; 553} 554 555// method: init 556_MTL_INLINE MTL :: Argument * MTL :: Argument :: init () 557{ 558return NS :: Object :: init < MTL :: Argument > () ; 559} 560 561// property: name 562_MTL_INLINE NS :: String * MTL :: Argument :: name () const 563{ 564return Object :: sendMessage < NS :: String *> ( this , _MTL_PRIVATE_SEL ( name )) ; 565} 566 567// property: type 568_MTL_INLINE MTL :: ArgumentType MTL :: Argument :: type () const 569{ 570return Object :: sendMessage < MTL :: ArgumentType > ( this , _MTL_PRIVATE_SEL ( type )) ; 571} 572 573// property: access 574_MTL_INLINE MTL :: ArgumentAccess MTL :: Argument :: access () const 575{ 576return Object :: sendMessage < MTL :: ArgumentAccess > ( this , _MTL_PRIVATE_SEL ( access )) ; 577} 578 579// property: index 580_MTL_INLINE NS :: UInteger MTL :: Argument :: index () const 581{ 582return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( index )) ; 583} 584 585// property: active 586_MTL_INLINE bool MTL :: Argument :: active () const 587{ 588return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( isActive )) ; 589} 590 591// property: bufferAlignment 592_MTL_INLINE NS :: UInteger MTL :: Argument :: bufferAlignment () const 593{ 594return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( bufferAlignment )) ; 595} 596 597// property: bufferDataSize 598_MTL_INLINE NS :: UInteger MTL :: Argument :: bufferDataSize () const 599{ 600return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( bufferDataSize )) ; 601} 602 603// property: bufferDataType 604_MTL_INLINE MTL :: DataType MTL :: Argument :: bufferDataType () const 605{ 606return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( bufferDataType )) ; 607} 608 609// property: bufferStructType 610_MTL_INLINE MTL :: StructType * MTL :: Argument :: bufferStructType () const 611{ 612return Object :: sendMessage < MTL :: StructType *> ( this , _MTL_PRIVATE_SEL ( bufferStructType )) ; 613} 614 615// property: bufferPointerType 616_MTL_INLINE MTL :: PointerType * MTL :: Argument :: bufferPointerType () const 617{ 618return Object :: sendMessage < MTL :: PointerType *> ( this , _MTL_PRIVATE_SEL ( bufferPointerType )) ; 619} 620 621// property: threadgroupMemoryAlignment 622_MTL_INLINE NS :: UInteger MTL :: Argument :: threadgroupMemoryAlignment () const 623{ 624return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( threadgroupMemoryAlignment )) ; 625} 626 627// property: threadgroupMemoryDataSize 628_MTL_INLINE NS :: UInteger MTL :: Argument :: threadgroupMemoryDataSize () const 629{ 630return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( threadgroupMemoryDataSize )) ; 631} 632 633// property: textureType 634_MTL_INLINE MTL :: TextureType MTL :: Argument :: textureType () const 635{ 636return Object :: sendMessage < MTL :: TextureType > ( this , _MTL_PRIVATE_SEL ( textureType )) ; 637} 638 639// property: textureDataType 640_MTL_INLINE MTL :: DataType MTL :: Argument :: textureDataType () const 641{ 642return Object :: sendMessage < MTL :: DataType > ( this , _MTL_PRIVATE_SEL ( textureDataType )) ; 643} 644 645// property: isDepthTexture 646_MTL_INLINE bool MTL :: Argument :: isDepthTexture () const 647{ 648return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( isDepthTexture )) ; 649} 650 651// property: arrayLength 652_MTL_INLINE NS :: UInteger MTL :: Argument :: arrayLength () const 653{ 654return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( arrayLength )) ; 655}