-
Notifications
You must be signed in to change notification settings - Fork 35
/
BaseGlobalDeviceState.cpp
51 lines (43 loc) · 1.24 KB
/
BaseGlobalDeviceState.cpp
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
// Copyright 2022-2024 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#include "BaseGlobalDeviceState.h"
namespace helium {
BaseGlobalDeviceState::BaseGlobalDeviceState(ANARIDevice d)
{
messageFunction = [&, d](ANARIStatusSeverity severity,
const std::string &msg,
anari::DataType objType,
const void *obj) {
if (!statusCB)
return;
statusCB(statusCBUserPtr,
d,
(ANARIObject)obj,
objType,
severity,
severity <= ANARI_SEVERITY_WARNING ? ANARI_STATUS_NO_ERROR
: ANARI_STATUS_UNKNOWN_ERROR,
msg.c_str());
};
}
void BaseGlobalDeviceState::commitBufferAddObject(BaseObject *o)
{
std::lock_guard<std::mutex> guard(m_mutex);
m_commitBuffer.addObject(o);
}
void BaseGlobalDeviceState::commitBufferFlush()
{
std::lock_guard<std::mutex> guard(m_mutex);
m_commitBuffer.flush();
}
void BaseGlobalDeviceState::commitBufferClear()
{
std::lock_guard<std::mutex> guard(m_mutex);
m_commitBuffer.clear();
}
TimeStamp BaseGlobalDeviceState::commitBufferLastFlush() const
{
std::lock_guard<std::mutex> guard(m_mutex);
return m_commitBuffer.lastFlush();
}
} // namespace helium