yum-mirror/VkFFT

git clone https://git.yummers.dev/yum-mirror/VkFFT

Tolmachev DmitriiMetal support in VkFFTba7001c

master
7.2 KiB189 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLIndirectCommandBuffer.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 "MTLIndirectCommandBuffer.hpp"
30#include "MTLResource.hpp"
31
32namespace MTL
33{
34_MTL_OPTIONS(NS::UInteger, IndirectCommandType) {
35    IndirectCommandTypeDraw = 1,
36    IndirectCommandTypeDrawIndexed = 2,
37    IndirectCommandTypeDrawPatches = 4,
38    IndirectCommandTypeDrawIndexedPatches = 8,
39    IndirectCommandTypeConcurrentDispatch = 32,
40    IndirectCommandTypeConcurrentDispatchThreads = 64,
41};
42
43struct IndirectCommandBufferExecutionRange
44{
45    uint32_t location;
46    uint32_t length;
47} _MTL_PACKED;
48
49class IndirectCommandBufferDescriptor : public NS::Copying<IndirectCommandBufferDescriptor>
50{
51public:
52    static class IndirectCommandBufferDescriptor* alloc();
53
54    class IndirectCommandBufferDescriptor*        init();
55
56    MTL::IndirectCommandType                      commandTypes() const;
57    void                                          setCommandTypes(MTL::IndirectCommandType commandTypes);
58
59    bool                                          inheritPipelineState() const;
60    void                                          setInheritPipelineState(bool inheritPipelineState);
61
62    bool                                          inheritBuffers() const;
63    void                                          setInheritBuffers(bool inheritBuffers);
64
65    NS::UInteger                                  maxVertexBufferBindCount() const;
66    void                                          setMaxVertexBufferBindCount(NS::UInteger maxVertexBufferBindCount);
67
68    NS::UInteger                                  maxFragmentBufferBindCount() const;
69    void                                          setMaxFragmentBufferBindCount(NS::UInteger maxFragmentBufferBindCount);
70
71    NS::UInteger                                  maxKernelBufferBindCount() const;
72    void                                          setMaxKernelBufferBindCount(NS::UInteger maxKernelBufferBindCount);
73};
74
75class IndirectCommandBuffer : public NS::Referencing<IndirectCommandBuffer, Resource>
76{
77public:
78    NS::UInteger                  size() const;
79
80    void                          reset(NS::Range range);
81
82    class IndirectRenderCommand*  indirectRenderCommand(NS::UInteger commandIndex);
83
84    class IndirectComputeCommand* indirectComputeCommand(NS::UInteger commandIndex);
85};
86
87}
88
89// static method: alloc
90_MTL_INLINE MTL::IndirectCommandBufferDescriptor* MTL::IndirectCommandBufferDescriptor::alloc()
91{
92    return NS::Object::alloc<MTL::IndirectCommandBufferDescriptor>(_MTL_PRIVATE_CLS(MTLIndirectCommandBufferDescriptor));
93}
94
95// method: init
96_MTL_INLINE MTL::IndirectCommandBufferDescriptor* MTL::IndirectCommandBufferDescriptor::init()
97{
98    return NS::Object::init<MTL::IndirectCommandBufferDescriptor>();
99}
100
101// property: commandTypes
102_MTL_INLINE MTL::IndirectCommandType MTL::IndirectCommandBufferDescriptor::commandTypes() const
103{
104    return Object::sendMessage<MTL::IndirectCommandType>(this, _MTL_PRIVATE_SEL(commandTypes));
105}
106
107_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setCommandTypes(MTL::IndirectCommandType commandTypes)
108{
109    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCommandTypes_), commandTypes);
110}
111
112// property: inheritPipelineState
113_MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::inheritPipelineState() const
114{
115    return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(inheritPipelineState));
116}
117
118_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setInheritPipelineState(bool inheritPipelineState)
119{
120    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInheritPipelineState_), inheritPipelineState);
121}
122
123// property: inheritBuffers
124_MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::inheritBuffers() const
125{
126    return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(inheritBuffers));
127}
128
129_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setInheritBuffers(bool inheritBuffers)
130{
131    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInheritBuffers_), inheritBuffers);
132}
133
134// property: maxVertexBufferBindCount
135_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxVertexBufferBindCount() const
136{
137    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxVertexBufferBindCount));
138}
139
140_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxVertexBufferBindCount(NS::UInteger maxVertexBufferBindCount)
141{
142    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxVertexBufferBindCount_), maxVertexBufferBindCount);
143}
144
145// property: maxFragmentBufferBindCount
146_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxFragmentBufferBindCount() const
147{
148    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxFragmentBufferBindCount));
149}
150
151_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxFragmentBufferBindCount(NS::UInteger maxFragmentBufferBindCount)
152{
153    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxFragmentBufferBindCount_), maxFragmentBufferBindCount);
154}
155
156// property: maxKernelBufferBindCount
157_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxKernelBufferBindCount() const
158{
159    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxKernelBufferBindCount));
160}
161
162_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxKernelBufferBindCount(NS::UInteger maxKernelBufferBindCount)
163{
164    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxKernelBufferBindCount_), maxKernelBufferBindCount);
165}
166
167// property: size
168_MTL_INLINE NS::UInteger MTL::IndirectCommandBuffer::size() const
169{
170    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
171}
172
173// method: resetWithRange:
174_MTL_INLINE void MTL::IndirectCommandBuffer::reset(NS::Range range)
175{
176    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetWithRange_), range);
177}
178
179// method: indirectRenderCommandAtIndex:
180_MTL_INLINE MTL::IndirectRenderCommand* MTL::IndirectCommandBuffer::indirectRenderCommand(NS::UInteger commandIndex)
181{
182    return Object::sendMessage<MTL::IndirectRenderCommand*>(this, _MTL_PRIVATE_SEL(indirectRenderCommandAtIndex_), commandIndex);
183}
184
185// method: indirectComputeCommandAtIndex:
186_MTL_INLINE MTL::IndirectComputeCommand* MTL::IndirectCommandBuffer::indirectComputeCommand(NS::UInteger commandIndex)
187{
188    return Object::sendMessage<MTL::IndirectComputeCommand*>(this, _MTL_PRIVATE_SEL(indirectComputeCommandAtIndex_), commandIndex);
189}