MTLArgumentEncoder.hpp
1 //------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 // 3 // Metal/MTLArgumentEncoder.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 namespace MTL 30 { 31 32 static const NS::UInteger AttributeStrideStatic = NS::UIntegerMax; 33 34 class ArgumentEncoder : public NS::Referencing<ArgumentEncoder> 35 { 36 public: 37 class Device* device() const; 38 39 NS::String* label() const; 40 void setLabel(const NS::String* label); 41 42 NS::UInteger encodedLength() const; 43 44 NS::UInteger alignment() const; 45 46 void setArgumentBuffer(const class Buffer* argumentBuffer, NS::UInteger offset); 47 48 void setArgumentBuffer(const class Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement); 49 50 void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index); 51 52 void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range); 53 54 void setTexture(const class Texture* texture, NS::UInteger index); 55 56 void setTextures(const class Texture* const textures[], NS::Range range); 57 58 void setSamplerState(const class SamplerState* sampler, NS::UInteger index); 59 60 void setSamplerStates(const class SamplerState* const samplers[], NS::Range range); 61 62 void* constantData(NS::UInteger index); 63 64 void setRenderPipelineState(const class RenderPipelineState* pipeline, NS::UInteger index); 65 66 void setRenderPipelineStates(const class RenderPipelineState* const pipelines[], NS::Range range); 67 68 void setComputePipelineState(const class ComputePipelineState* pipeline, NS::UInteger index); 69 70 void setComputePipelineStates(const class ComputePipelineState* const pipelines[], NS::Range range); 71 72 void setIndirectCommandBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index); 73 74 void setIndirectCommandBuffers(const class IndirectCommandBuffer* const buffers[], NS::Range range); 75 76 void setAccelerationStructure(const class AccelerationStructure* accelerationStructure, NS::UInteger index); 77 78 class ArgumentEncoder* newArgumentEncoder(NS::UInteger index); 79 80 void setVisibleFunctionTable(const class VisibleFunctionTable* visibleFunctionTable, NS::UInteger index); 81 82 void setVisibleFunctionTables(const class VisibleFunctionTable* const visibleFunctionTables[], NS::Range range); 83 84 void setIntersectionFunctionTable(const class IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index); 85 86 void setIntersectionFunctionTables(const class IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range); 87 }; 88 89 } 90 91 // property: device 92 _MTL_INLINE MTL::Device* MTL::ArgumentEncoder::device() const 93 { 94 return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device)); 95 } 96 97 // property: label 98 _MTL_INLINE NS::String* MTL::ArgumentEncoder::label() const 99 { 100 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label)); 101 } 102 103 _MTL_INLINE void MTL::ArgumentEncoder::setLabel(const NS::String* label) 104 { 105 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label); 106 } 107 108 // property: encodedLength 109 _MTL_INLINE NS::UInteger MTL::ArgumentEncoder::encodedLength() const 110 { 111 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(encodedLength)); 112 } 113 114 // property: alignment 115 _MTL_INLINE NS::UInteger MTL::ArgumentEncoder::alignment() const 116 { 117 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment)); 118 } 119 120 // method: setArgumentBuffer:offset: 121 _MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset) 122 { 123 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_offset_), argumentBuffer, offset); 124 } 125 126 // method: setArgumentBuffer:startOffset:arrayElement: 127 _MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement) 128 { 129 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_startOffset_arrayElement_), argumentBuffer, startOffset, arrayElement); 130 } 131 132 // method: setBuffer:offset:atIndex: 133 _MTL_INLINE void MTL::ArgumentEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index) 134 { 135 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index); 136 } 137 138 // method: setBuffers:offsets:withRange: 139 _MTL_INLINE void MTL::ArgumentEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range) 140 { 141 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range); 142 } 143 144 // method: setTexture:atIndex: 145 _MTL_INLINE void MTL::ArgumentEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index) 146 { 147 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index); 148 } 149 150 // method: setTextures:withRange: 151 _MTL_INLINE void MTL::ArgumentEncoder::setTextures(const MTL::Texture* const textures[], NS::Range range) 152 { 153 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextures_withRange_), textures, range); 154 } 155 156 // method: setSamplerState:atIndex: 157 _MTL_INLINE void MTL::ArgumentEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index) 158 { 159 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index); 160 } 161 162 // method: setSamplerStates:withRange: 163 _MTL_INLINE void MTL::ArgumentEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range) 164 { 165 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_withRange_), samplers, range); 166 } 167 168 // method: constantDataAtIndex: 169 _MTL_INLINE void* MTL::ArgumentEncoder::constantData(NS::UInteger index) 170 { 171 return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(constantDataAtIndex_), index); 172 } 173 174 // method: setRenderPipelineState:atIndex: 175 _MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index) 176 { 177 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_atIndex_), pipeline, index); 178 } 179 180 // method: setRenderPipelineStates:withRange: 181 _MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineStates(const MTL::RenderPipelineState* const pipelines[], NS::Range range) 182 { 183 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineStates_withRange_), pipelines, range); 184 } 185 186 // method: setComputePipelineState:atIndex: 187 _MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index) 188 { 189 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_atIndex_), pipeline, index); 190 } 191 192 // method: setComputePipelineStates:withRange: 193 _MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineStates(const MTL::ComputePipelineState* const pipelines[], NS::Range range) 194 { 195 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineStates_withRange_), pipelines, range); 196 } 197 198 // method: setIndirectCommandBuffer:atIndex: 199 _MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index) 200 { 201 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffer_atIndex_), indirectCommandBuffer, index); 202 } 203 204 // method: setIndirectCommandBuffers:withRange: 205 _MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffers(const MTL::IndirectCommandBuffer* const buffers[], NS::Range range) 206 { 207 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffers_withRange_), buffers, range); 208 } 209 210 // method: setAccelerationStructure:atIndex: 211 _MTL_INLINE void MTL::ArgumentEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index) 212 { 213 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atIndex_), accelerationStructure, index); 214 } 215 216 // method: newArgumentEncoderForBufferAtIndex: 217 _MTL_INLINE MTL::ArgumentEncoder* MTL::ArgumentEncoder::newArgumentEncoder(NS::UInteger index) 218 { 219 return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderForBufferAtIndex_), index); 220 } 221 222 // method: setVisibleFunctionTable:atIndex: 223 _MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index) 224 { 225 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atIndex_), visibleFunctionTable, index); 226 } 227 228 // method: setVisibleFunctionTables:withRange: 229 _MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range) 230 { 231 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withRange_), visibleFunctionTables, range); 232 } 233 234 // method: setIntersectionFunctionTable:atIndex: 235 _MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index) 236 { 237 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atIndex_), intersectionFunctionTable, index); 238 } 239 240 // method: setIntersectionFunctionTables:withRange: 241 _MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range) 242 { 243 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTables_withRange_), intersectionFunctionTables, range); 244 }