Path: blob/master/thirdparty/metal-cpp/Metal/MTLComputePass.hpp
21082 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTLComputePass.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 "MTLCommandBuffer.hpp"24#include "MTLDefines.hpp"25#include "MTLHeaderBridge.hpp"26#include "MTLPrivate.hpp"2728namespace MTL29{30class ComputePassDescriptor;31class ComputePassSampleBufferAttachmentDescriptor;32class ComputePassSampleBufferAttachmentDescriptorArray;33class CounterSampleBuffer;3435class ComputePassSampleBufferAttachmentDescriptor : public NS::Copying<ComputePassSampleBufferAttachmentDescriptor>36{37public:38static ComputePassSampleBufferAttachmentDescriptor* alloc();3940NS::UInteger endOfEncoderSampleIndex() const;4142ComputePassSampleBufferAttachmentDescriptor* init();4344CounterSampleBuffer* sampleBuffer() const;4546void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);4748void setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer);4950void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);51NS::UInteger startOfEncoderSampleIndex() const;52};53class ComputePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<ComputePassSampleBufferAttachmentDescriptorArray>54{55public:56static ComputePassSampleBufferAttachmentDescriptorArray* alloc();5758ComputePassSampleBufferAttachmentDescriptorArray* init();5960ComputePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);61void setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);62};63class ComputePassDescriptor : public NS::Copying<ComputePassDescriptor>64{65public:66static ComputePassDescriptor* alloc();6768static ComputePassDescriptor* computePassDescriptor();6970DispatchType dispatchType() const;7172ComputePassDescriptor* init();7374ComputePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;7576void setDispatchType(MTL::DispatchType dispatchType);77};7879}80_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::alloc()81{82return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptor));83}8485_MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const86{87return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));88}8990_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::init()91{92return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptor>();93}9495_MTL_INLINE MTL::CounterSampleBuffer* MTL::ComputePassSampleBufferAttachmentDescriptor::sampleBuffer() const96{97return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));98}99100_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)101{102Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);103}104105_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)106{107Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);108}109110_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)111{112Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);113}114115_MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const116{117return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));118}119120_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::alloc()121{122return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptorArray));123}124125_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::init()126{127return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptorArray>();128}129130_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)131{132return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);133}134135_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)136{137Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);138}139140_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::alloc()141{142return NS::Object::alloc<MTL::ComputePassDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor));143}144145_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::computePassDescriptor()146{147return Object::sendMessage<MTL::ComputePassDescriptor*>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor), _MTL_PRIVATE_SEL(computePassDescriptor));148}149150_MTL_INLINE MTL::DispatchType MTL::ComputePassDescriptor::dispatchType() const151{152return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));153}154155_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::init()156{157return NS::Object::init<MTL::ComputePassDescriptor>();158}159160_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassDescriptor::sampleBufferAttachments() const161{162return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));163}164165_MTL_INLINE void MTL::ComputePassDescriptor::setDispatchType(MTL::DispatchType dispatchType)166{167Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDispatchType_), dispatchType);168}169170171