yum-mirror/VkFFT

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

Tolmachev DmitriiMetal support in VkFFTba7001c

develop
4.9 KiB163 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLEvent.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 "MTLEvent.hpp"
30
31namespace MTL
32{
33class Event : public NS::Referencing<Event>
34{
35public:
36    class Device* device() const;
37
38    NS::String*   label() const;
39    void          setLabel(const NS::String* label);
40};
41
42class SharedEventListener : public NS::Referencing<SharedEventListener>
43{
44public:
45    static class SharedEventListener* alloc();
46
47    MTL::SharedEventListener*         init();
48
49    MTL::SharedEventListener*         init(const dispatch_queue_t dispatchQueue);
50
51    dispatch_queue_t                  dispatchQueue() const;
52};
53
54using SharedEventNotificationBlock = void (^)(SharedEvent* pEvent, std::uint64_t value);
55
56class SharedEvent : public NS::Referencing<SharedEvent, Event>
57{
58public:
59    void                     notifyListener(const class SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block);
60
61    class SharedEventHandle* newSharedEventHandle();
62
63    uint64_t                 signaledValue() const;
64    void                     setSignaledValue(uint64_t signaledValue);
65};
66
67class SharedEventHandle : public NS::Referencing<SharedEventHandle>
68{
69public:
70    static class SharedEventHandle* alloc();
71
72    class SharedEventHandle*        init();
73
74    NS::String*                     label() const;
75};
76
77struct SharedEventHandlePrivate
78{
79} _MTL_PACKED;
80
81}
82
83// property: device
84_MTL_INLINE MTL::Device* MTL::Event::device() const
85{
86    return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
87}
88
89// property: label
90_MTL_INLINE NS::String* MTL::Event::label() const
91{
92    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
93}
94
95_MTL_INLINE void MTL::Event::setLabel(const NS::String* label)
96{
97    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
98}
99
100// static method: alloc
101_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::alloc()
102{
103    return NS::Object::alloc<MTL::SharedEventListener>(_MTL_PRIVATE_CLS(MTLSharedEventListener));
104}
105
106// method: init
107_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init()
108{
109    return NS::Object::init<MTL::SharedEventListener>();
110}
111
112// method: initWithDispatchQueue:
113_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init(const dispatch_queue_t dispatchQueue)
114{
115    return Object::sendMessage<MTL::SharedEventListener*>(this, _MTL_PRIVATE_SEL(initWithDispatchQueue_), dispatchQueue);
116}
117
118// property: dispatchQueue
119_MTL_INLINE dispatch_queue_t MTL::SharedEventListener::dispatchQueue() const
120{
121    return Object::sendMessage<dispatch_queue_t>(this, _MTL_PRIVATE_SEL(dispatchQueue));
122}
123
124// method: notifyListener:atValue:block:
125_MTL_INLINE void MTL::SharedEvent::notifyListener(const MTL::SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block)
126{
127    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(notifyListener_atValue_block_), listener, value, block);
128}
129
130// method: newSharedEventHandle
131_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEvent::newSharedEventHandle()
132{
133    return Object::sendMessage<MTL::SharedEventHandle*>(this, _MTL_PRIVATE_SEL(newSharedEventHandle));
134}
135
136// property: signaledValue
137_MTL_INLINE uint64_t MTL::SharedEvent::signaledValue() const
138{
139    return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(signaledValue));
140}
141
142_MTL_INLINE void MTL::SharedEvent::setSignaledValue(uint64_t signaledValue)
143{
144    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSignaledValue_), signaledValue);
145}
146
147// static method: alloc
148_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::alloc()
149{
150    return NS::Object::alloc<MTL::SharedEventHandle>(_MTL_PRIVATE_CLS(MTLSharedEventHandle));
151}
152
153// method: init
154_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::init()
155{
156    return NS::Object::init<MTL::SharedEventHandle>();
157}
158
159// property: label
160_MTL_INLINE NS::String* MTL::SharedEventHandle::label() const
161{
162    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
163}