Path: blob/master/thirdparty/metal-cpp/Metal/MTLArgumentEncoder.hpp
21066 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTLArgumentEncoder.hpp3//4// Copyright 2020-2025 Apple Inc.5//6// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.17//18//-------------------------------------------------------------------------------------------------------------------------------------------------------------1920#pragma once2122#include "../Foundation/Foundation.hpp"23#include "MTLDefines.hpp"24#include "MTLHeaderBridge.hpp"25#include "MTLPrivate.hpp"26#include "MTLDepthStencil.hpp"2728namespace MTL29{30class AccelerationStructure;31class ArgumentEncoder;32class Buffer;33class ComputePipelineState;34class Device;35class IndirectCommandBuffer;36class IntersectionFunctionTable;37class RenderPipelineState;38class SamplerState;39class Texture;40class VisibleFunctionTable;4142static const NS::UInteger AttributeStrideStatic = NS::UIntegerMax;4344class ArgumentEncoder : public NS::Referencing<ArgumentEncoder>45{46public:47NS::UInteger alignment() const;4849void* constantData(NS::UInteger index);5051Device* device() const;5253NS::UInteger encodedLength() const;5455NS::String* label() const;5657ArgumentEncoder* newArgumentEncoder(NS::UInteger index);5859void setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index);6061void setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset);62void setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement);6364void setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);65void setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);6667void setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index);68void setComputePipelineStates(const MTL::ComputePipelineState* const pipelines[], NS::Range range);6970void setDepthStencilState(const MTL::DepthStencilState* depthStencilState, NS::UInteger index);71void setDepthStencilStates(const MTL::DepthStencilState* const depthStencilStates[], NS::Range range);7273void setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index);74void setIndirectCommandBuffers(const MTL::IndirectCommandBuffer* const buffers[], NS::Range range);7576void setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index);77void setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);7879void setLabel(const NS::String* label);8081void setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index);82void setRenderPipelineStates(const MTL::RenderPipelineState* const pipelines[], NS::Range range);8384void setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);85void setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);8687void setTexture(const MTL::Texture* texture, NS::UInteger index);88void setTextures(const MTL::Texture* const textures[], NS::Range range);8990void setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index);91void setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);92};9394}9596_MTL_INLINE NS::UInteger MTL::ArgumentEncoder::alignment() const97{98return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));99}100101_MTL_INLINE void* MTL::ArgumentEncoder::constantData(NS::UInteger index)102{103return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(constantDataAtIndex_), index);104}105106_MTL_INLINE MTL::Device* MTL::ArgumentEncoder::device() const107{108return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));109}110111_MTL_INLINE NS::UInteger MTL::ArgumentEncoder::encodedLength() const112{113return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(encodedLength));114}115116_MTL_INLINE NS::String* MTL::ArgumentEncoder::label() const117{118return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));119}120121_MTL_INLINE MTL::ArgumentEncoder* MTL::ArgumentEncoder::newArgumentEncoder(NS::UInteger index)122{123return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderForBufferAtIndex_), index);124}125126_MTL_INLINE void MTL::ArgumentEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index)127{128Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atIndex_), accelerationStructure, index);129}130131_MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset)132{133Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_offset_), argumentBuffer, offset);134}135136_MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement)137{138Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_startOffset_arrayElement_), argumentBuffer, startOffset, arrayElement);139}140141_MTL_INLINE void MTL::ArgumentEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)142{143Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);144}145146_MTL_INLINE void MTL::ArgumentEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range)147{148Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range);149}150151_MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index)152{153Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_atIndex_), pipeline, index);154}155156_MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineStates(const MTL::ComputePipelineState* const pipelines[], NS::Range range)157{158Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineStates_withRange_), pipelines, range);159}160161_MTL_INLINE void MTL::ArgumentEncoder::setDepthStencilState(const MTL::DepthStencilState* depthStencilState, NS::UInteger index)162{163Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilState_atIndex_), depthStencilState, index);164}165166_MTL_INLINE void MTL::ArgumentEncoder::setDepthStencilStates(const MTL::DepthStencilState* const depthStencilStates[], NS::Range range)167{168Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilStates_withRange_), depthStencilStates, range);169}170171_MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index)172{173Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffer_atIndex_), indirectCommandBuffer, index);174}175176_MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffers(const MTL::IndirectCommandBuffer* const buffers[], NS::Range range)177{178Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffers_withRange_), buffers, range);179}180181_MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index)182{183Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atIndex_), intersectionFunctionTable, index);184}185186_MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range)187{188Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTables_withRange_), intersectionFunctionTables, range);189}190191_MTL_INLINE void MTL::ArgumentEncoder::setLabel(const NS::String* label)192{193Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);194}195196_MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index)197{198Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_atIndex_), pipeline, index);199}200201_MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineStates(const MTL::RenderPipelineState* const pipelines[], NS::Range range)202{203Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineStates_withRange_), pipelines, range);204}205206_MTL_INLINE void MTL::ArgumentEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)207{208Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);209}210211_MTL_INLINE void MTL::ArgumentEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range)212{213Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_withRange_), samplers, range);214}215216_MTL_INLINE void MTL::ArgumentEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)217{218Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);219}220221_MTL_INLINE void MTL::ArgumentEncoder::setTextures(const MTL::Texture* const textures[], NS::Range range)222{223Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextures_withRange_), textures, range);224}225226_MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index)227{228Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atIndex_), visibleFunctionTable, index);229}230231_MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range)232{233Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withRange_), visibleFunctionTables, range);234}235236237