MTLRasterizationRate.hpp
1 //------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 // 3 // Metal/MTLRasterizationRate.hpp 4 // 5 // Copyright 2020-2024 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 "MTLDevice.hpp" 30 #include "MTLTypes.hpp" 31 32 namespace MTL 33 { 34 class RasterizationRateSampleArray : public NS::Referencing<RasterizationRateSampleArray> 35 { 36 public: 37 static class RasterizationRateSampleArray* alloc(); 38 39 class RasterizationRateSampleArray* init(); 40 41 NS::Number* object(NS::UInteger index); 42 43 void setObject(const NS::Number* value, NS::UInteger index); 44 }; 45 46 class RasterizationRateLayerDescriptor : public NS::Copying<RasterizationRateLayerDescriptor> 47 { 48 public: 49 static class RasterizationRateLayerDescriptor* alloc(); 50 51 MTL::RasterizationRateLayerDescriptor* init(); 52 53 MTL::RasterizationRateLayerDescriptor* init(MTL::Size sampleCount); 54 55 MTL::RasterizationRateLayerDescriptor* init(MTL::Size sampleCount, const float* horizontal, const float* vertical); 56 57 MTL::Size sampleCount() const; 58 59 MTL::Size maxSampleCount() const; 60 61 float* horizontalSampleStorage() const; 62 63 float* verticalSampleStorage() const; 64 65 class RasterizationRateSampleArray* horizontal() const; 66 67 class RasterizationRateSampleArray* vertical() const; 68 69 void setSampleCount(MTL::Size sampleCount); 70 }; 71 72 class RasterizationRateLayerArray : public NS::Referencing<RasterizationRateLayerArray> 73 { 74 public: 75 static class RasterizationRateLayerArray* alloc(); 76 77 class RasterizationRateLayerArray* init(); 78 79 class RasterizationRateLayerDescriptor* object(NS::UInteger layerIndex); 80 81 void setObject(const class RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex); 82 }; 83 84 class RasterizationRateMapDescriptor : public NS::Copying<RasterizationRateMapDescriptor> 85 { 86 public: 87 static class RasterizationRateMapDescriptor* alloc(); 88 89 class RasterizationRateMapDescriptor* init(); 90 91 static class RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize); 92 93 static class RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, const class RasterizationRateLayerDescriptor* layer); 94 95 static class RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, NS::UInteger layerCount, const class RasterizationRateLayerDescriptor* const* layers); 96 97 class RasterizationRateLayerDescriptor* layer(NS::UInteger layerIndex); 98 99 void setLayer(const class RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex); 100 101 class RasterizationRateLayerArray* layers() const; 102 103 MTL::Size screenSize() const; 104 void setScreenSize(MTL::Size screenSize); 105 106 NS::String* label() const; 107 void setLabel(const NS::String* label); 108 109 NS::UInteger layerCount() const; 110 }; 111 112 class RasterizationRateMap : public NS::Referencing<RasterizationRateMap> 113 { 114 public: 115 class Device* device() const; 116 117 NS::String* label() const; 118 119 MTL::Size screenSize() const; 120 121 MTL::Size physicalGranularity() const; 122 123 NS::UInteger layerCount() const; 124 125 MTL::SizeAndAlign parameterBufferSizeAndAlign() const; 126 127 void copyParameterDataToBuffer(const class Buffer* buffer, NS::UInteger offset); 128 129 MTL::Size physicalSize(NS::UInteger layerIndex); 130 131 MTL::Coordinate2D mapScreenToPhysicalCoordinates(MTL::Coordinate2D screenCoordinates, NS::UInteger layerIndex); 132 133 MTL::Coordinate2D mapPhysicalToScreenCoordinates(MTL::Coordinate2D physicalCoordinates, NS::UInteger layerIndex); 134 }; 135 136 } 137 138 // static method: alloc 139 _MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateSampleArray::alloc() 140 { 141 return NS::Object::alloc<MTL::RasterizationRateSampleArray>(_MTL_PRIVATE_CLS(MTLRasterizationRateSampleArray)); 142 } 143 144 // method: init 145 _MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateSampleArray::init() 146 { 147 return NS::Object::init<MTL::RasterizationRateSampleArray>(); 148 } 149 150 // method: objectAtIndexedSubscript: 151 _MTL_INLINE NS::Number* MTL::RasterizationRateSampleArray::object(NS::UInteger index) 152 { 153 return Object::sendMessage<NS::Number*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), index); 154 } 155 156 // method: setObject:atIndexedSubscript: 157 _MTL_INLINE void MTL::RasterizationRateSampleArray::setObject(const NS::Number* value, NS::UInteger index) 158 { 159 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), value, index); 160 } 161 162 // static method: alloc 163 _MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::alloc() 164 { 165 return NS::Object::alloc<MTL::RasterizationRateLayerDescriptor>(_MTL_PRIVATE_CLS(MTLRasterizationRateLayerDescriptor)); 166 } 167 168 // method: init 169 _MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::init() 170 { 171 return NS::Object::init<MTL::RasterizationRateLayerDescriptor>(); 172 } 173 174 // method: initWithSampleCount: 175 _MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::init(MTL::Size sampleCount) 176 { 177 return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(initWithSampleCount_), sampleCount); 178 } 179 180 // method: initWithSampleCount:horizontal:vertical: 181 _MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::init(MTL::Size sampleCount, const float* horizontal, const float* vertical) 182 { 183 return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(initWithSampleCount_horizontal_vertical_), sampleCount, horizontal, vertical); 184 } 185 186 // property: sampleCount 187 _MTL_INLINE MTL::Size MTL::RasterizationRateLayerDescriptor::sampleCount() const 188 { 189 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(sampleCount)); 190 } 191 192 // property: maxSampleCount 193 _MTL_INLINE MTL::Size MTL::RasterizationRateLayerDescriptor::maxSampleCount() const 194 { 195 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(maxSampleCount)); 196 } 197 198 // property: horizontalSampleStorage 199 _MTL_INLINE float* MTL::RasterizationRateLayerDescriptor::horizontalSampleStorage() const 200 { 201 return Object::sendMessage<float*>(this, _MTL_PRIVATE_SEL(horizontalSampleStorage)); 202 } 203 204 // property: verticalSampleStorage 205 _MTL_INLINE float* MTL::RasterizationRateLayerDescriptor::verticalSampleStorage() const 206 { 207 return Object::sendMessage<float*>(this, _MTL_PRIVATE_SEL(verticalSampleStorage)); 208 } 209 210 // property: horizontal 211 _MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateLayerDescriptor::horizontal() const 212 { 213 return Object::sendMessage<MTL::RasterizationRateSampleArray*>(this, _MTL_PRIVATE_SEL(horizontal)); 214 } 215 216 // property: vertical 217 _MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateLayerDescriptor::vertical() const 218 { 219 return Object::sendMessage<MTL::RasterizationRateSampleArray*>(this, _MTL_PRIVATE_SEL(vertical)); 220 } 221 222 // method: setSampleCount: 223 _MTL_INLINE void MTL::RasterizationRateLayerDescriptor::setSampleCount(MTL::Size sampleCount) 224 { 225 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleCount_), sampleCount); 226 } 227 228 // static method: alloc 229 _MTL_INLINE MTL::RasterizationRateLayerArray* MTL::RasterizationRateLayerArray::alloc() 230 { 231 return NS::Object::alloc<MTL::RasterizationRateLayerArray>(_MTL_PRIVATE_CLS(MTLRasterizationRateLayerArray)); 232 } 233 234 // method: init 235 _MTL_INLINE MTL::RasterizationRateLayerArray* MTL::RasterizationRateLayerArray::init() 236 { 237 return NS::Object::init<MTL::RasterizationRateLayerArray>(); 238 } 239 240 // method: objectAtIndexedSubscript: 241 _MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerArray::object(NS::UInteger layerIndex) 242 { 243 return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), layerIndex); 244 } 245 246 // method: setObject:atIndexedSubscript: 247 _MTL_INLINE void MTL::RasterizationRateLayerArray::setObject(const MTL::RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex) 248 { 249 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), layer, layerIndex); 250 } 251 252 // static method: alloc 253 _MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::alloc() 254 { 255 return NS::Object::alloc<MTL::RasterizationRateMapDescriptor>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor)); 256 } 257 258 // method: init 259 _MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::init() 260 { 261 return NS::Object::init<MTL::RasterizationRateMapDescriptor>(); 262 } 263 264 // static method: rasterizationRateMapDescriptorWithScreenSize: 265 _MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::rasterizationRateMapDescriptor(MTL::Size screenSize) 266 { 267 return Object::sendMessage<MTL::RasterizationRateMapDescriptor*>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor), _MTL_PRIVATE_SEL(rasterizationRateMapDescriptorWithScreenSize_), screenSize); 268 } 269 270 // static method: rasterizationRateMapDescriptorWithScreenSize:layer: 271 _MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::rasterizationRateMapDescriptor(MTL::Size screenSize, const MTL::RasterizationRateLayerDescriptor* layer) 272 { 273 return Object::sendMessage<MTL::RasterizationRateMapDescriptor*>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor), _MTL_PRIVATE_SEL(rasterizationRateMapDescriptorWithScreenSize_layer_), screenSize, layer); 274 } 275 276 // static method: rasterizationRateMapDescriptorWithScreenSize:layerCount:layers: 277 _MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::rasterizationRateMapDescriptor(MTL::Size screenSize, NS::UInteger layerCount, const MTL::RasterizationRateLayerDescriptor* const* layers) 278 { 279 return Object::sendMessage<MTL::RasterizationRateMapDescriptor*>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor), _MTL_PRIVATE_SEL(rasterizationRateMapDescriptorWithScreenSize_layerCount_layers_), screenSize, layerCount, layers); 280 } 281 282 // method: layerAtIndex: 283 _MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateMapDescriptor::layer(NS::UInteger layerIndex) 284 { 285 return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(layerAtIndex_), layerIndex); 286 } 287 288 // method: setLayer:atIndex: 289 _MTL_INLINE void MTL::RasterizationRateMapDescriptor::setLayer(const MTL::RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex) 290 { 291 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLayer_atIndex_), layer, layerIndex); 292 } 293 294 // property: layers 295 _MTL_INLINE MTL::RasterizationRateLayerArray* MTL::RasterizationRateMapDescriptor::layers() const 296 { 297 return Object::sendMessage<MTL::RasterizationRateLayerArray*>(this, _MTL_PRIVATE_SEL(layers)); 298 } 299 300 // property: screenSize 301 _MTL_INLINE MTL::Size MTL::RasterizationRateMapDescriptor::screenSize() const 302 { 303 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(screenSize)); 304 } 305 306 _MTL_INLINE void MTL::RasterizationRateMapDescriptor::setScreenSize(MTL::Size screenSize) 307 { 308 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setScreenSize_), screenSize); 309 } 310 311 // property: label 312 _MTL_INLINE NS::String* MTL::RasterizationRateMapDescriptor::label() const 313 { 314 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label)); 315 } 316 317 _MTL_INLINE void MTL::RasterizationRateMapDescriptor::setLabel(const NS::String* label) 318 { 319 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label); 320 } 321 322 // property: layerCount 323 _MTL_INLINE NS::UInteger MTL::RasterizationRateMapDescriptor::layerCount() const 324 { 325 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(layerCount)); 326 } 327 328 // property: device 329 _MTL_INLINE MTL::Device* MTL::RasterizationRateMap::device() const 330 { 331 return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device)); 332 } 333 334 // property: label 335 _MTL_INLINE NS::String* MTL::RasterizationRateMap::label() const 336 { 337 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label)); 338 } 339 340 // property: screenSize 341 _MTL_INLINE MTL::Size MTL::RasterizationRateMap::screenSize() const 342 { 343 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(screenSize)); 344 } 345 346 // property: physicalGranularity 347 _MTL_INLINE MTL::Size MTL::RasterizationRateMap::physicalGranularity() const 348 { 349 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(physicalGranularity)); 350 } 351 352 // property: layerCount 353 _MTL_INLINE NS::UInteger MTL::RasterizationRateMap::layerCount() const 354 { 355 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(layerCount)); 356 } 357 358 // property: parameterBufferSizeAndAlign 359 _MTL_INLINE MTL::SizeAndAlign MTL::RasterizationRateMap::parameterBufferSizeAndAlign() const 360 { 361 return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(parameterBufferSizeAndAlign)); 362 } 363 364 // method: copyParameterDataToBuffer:offset: 365 _MTL_INLINE void MTL::RasterizationRateMap::copyParameterDataToBuffer(const MTL::Buffer* buffer, NS::UInteger offset) 366 { 367 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyParameterDataToBuffer_offset_), buffer, offset); 368 } 369 370 // method: physicalSizeForLayer: 371 _MTL_INLINE MTL::Size MTL::RasterizationRateMap::physicalSize(NS::UInteger layerIndex) 372 { 373 return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(physicalSizeForLayer_), layerIndex); 374 } 375 376 // method: mapScreenToPhysicalCoordinates:forLayer: 377 _MTL_INLINE MTL::Coordinate2D MTL::RasterizationRateMap::mapScreenToPhysicalCoordinates(MTL::Coordinate2D screenCoordinates, NS::UInteger layerIndex) 378 { 379 return Object::sendMessage<MTL::Coordinate2D>(this, _MTL_PRIVATE_SEL(mapScreenToPhysicalCoordinates_forLayer_), screenCoordinates, layerIndex); 380 } 381 382 // method: mapPhysicalToScreenCoordinates:forLayer: 383 _MTL_INLINE MTL::Coordinate2D MTL::RasterizationRateMap::mapPhysicalToScreenCoordinates(MTL::Coordinate2D physicalCoordinates, NS::UInteger layerIndex) 384 { 385 return Object::sendMessage<MTL::Coordinate2D>(this, _MTL_PRIVATE_SEL(mapPhysicalToScreenCoordinates_forLayer_), physicalCoordinates, layerIndex); 386 }