File size: 4,976 Bytes
c4764a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLEvent.hpp
//
// Copyright 2020-2023 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <Foundation/Foundation.hpp>
#include "MTLEvent.hpp"
namespace MTL
{
class Event : public NS::Referencing<Event>
{
public:
class Device* device() const;
NS::String* label() const;
void setLabel(const NS::String* label);
};
class SharedEventListener : public NS::Referencing<SharedEventListener>
{
public:
static class SharedEventListener* alloc();
MTL::SharedEventListener* init();
MTL::SharedEventListener* init(const dispatch_queue_t dispatchQueue);
dispatch_queue_t dispatchQueue() const;
};
using SharedEventNotificationBlock = void (^)(SharedEvent* pEvent, std::uint64_t value);
class SharedEvent : public NS::Referencing<SharedEvent, Event>
{
public:
void notifyListener(const class SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block);
class SharedEventHandle* newSharedEventHandle();
uint64_t signaledValue() const;
void setSignaledValue(uint64_t signaledValue);
};
class SharedEventHandle : public NS::SecureCoding<SharedEventHandle>
{
public:
static class SharedEventHandle* alloc();
class SharedEventHandle* init();
NS::String* label() const;
};
}
// property: device
_MTL_INLINE MTL::Device* MTL::Event::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
// property: label
_MTL_INLINE NS::String* MTL::Event::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL::Event::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
// static method: alloc
_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::alloc()
{
return NS::Object::alloc<MTL::SharedEventListener>(_MTL_PRIVATE_CLS(MTLSharedEventListener));
}
// method: init
_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init()
{
return NS::Object::init<MTL::SharedEventListener>();
}
// method: initWithDispatchQueue:
_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init(const dispatch_queue_t dispatchQueue)
{
return Object::sendMessage<MTL::SharedEventListener*>(this, _MTL_PRIVATE_SEL(initWithDispatchQueue_), dispatchQueue);
}
// property: dispatchQueue
_MTL_INLINE dispatch_queue_t MTL::SharedEventListener::dispatchQueue() const
{
return Object::sendMessage<dispatch_queue_t>(this, _MTL_PRIVATE_SEL(dispatchQueue));
}
// method: notifyListener:atValue:block:
_MTL_INLINE void MTL::SharedEvent::notifyListener(const MTL::SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(notifyListener_atValue_block_), listener, value, block);
}
// method: newSharedEventHandle
_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEvent::newSharedEventHandle()
{
return Object::sendMessage<MTL::SharedEventHandle*>(this, _MTL_PRIVATE_SEL(newSharedEventHandle));
}
// property: signaledValue
_MTL_INLINE uint64_t MTL::SharedEvent::signaledValue() const
{
return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(signaledValue));
}
_MTL_INLINE void MTL::SharedEvent::setSignaledValue(uint64_t signaledValue)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSignaledValue_), signaledValue);
}
// static method: alloc
_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::alloc()
{
return NS::Object::alloc<MTL::SharedEventHandle>(_MTL_PRIVATE_CLS(MTLSharedEventHandle));
}
// method: init
_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::init()
{
return NS::Object::init<MTL::SharedEventHandle>();
}
// property: label
_MTL_INLINE NS::String* MTL::SharedEventHandle::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
|