Blender
V4.5
intern
cycles
session
session/display_driver.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2021-2025 Blender Foundation
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#include "
session/display_driver.h
"
6
7
#ifdef _WIN32
8
# include "
util/windows.h
"
9
#else
10
# include <unistd.h>
11
#endif
12
13
CCL_NAMESPACE_BEGIN
14
15
GraphicsInteropBuffer::~GraphicsInteropBuffer
()
16
{
17
clear
();
18
}
19
20
void
GraphicsInteropBuffer::assign
(
GraphicsInteropDevice::Type
type,
int64_t
handle,
size_t
size)
21
{
22
clear
();
23
24
type_
= type;
25
handle_
= handle;
26
own_handle_
=
true
;
27
size_
= size;
28
}
29
30
bool
GraphicsInteropBuffer::is_empty
()
const
31
{
32
return
handle_
== 0;
33
}
34
35
void
GraphicsInteropBuffer::zero
()
36
{
37
need_zero_
=
true
;
38
}
39
40
void
GraphicsInteropBuffer::clear
()
41
{
42
if
(
type_
==
GraphicsInteropDevice::VULKAN
&&
handle_
&&
own_handle_
) {
43
#ifdef _WIN32
44
CloseHandle(HANDLE(
handle_
));
45
#else
46
close(
handle_
);
47
#endif
48
}
49
50
type_
=
GraphicsInteropDevice::NONE
;
51
handle_
= 0;
52
size_
= 0;
53
need_zero_
=
false
;
54
own_handle_
=
false
;
55
}
56
57
GraphicsInteropDevice::Type
GraphicsInteropBuffer::get_type
()
const
58
{
59
return
type_
;
60
}
61
62
size_t
GraphicsInteropBuffer::get_size
()
const
63
{
64
return
size_
;
65
}
66
67
bool
GraphicsInteropBuffer::has_new_handle
()
const
68
{
69
return
own_handle_
;
70
}
71
72
bool
GraphicsInteropBuffer::take_zero
()
73
{
74
bool
need_zero =
need_zero_
;
75
need_zero_
=
false
;
76
return
need_zero;
77
}
78
79
int64_t
GraphicsInteropBuffer::take_handle
()
80
{
81
assert
(
own_handle_
);
82
own_handle_
=
false
;
83
return
handle_
;
84
}
85
86
CCL_NAMESPACE_END
int64_t
long long int int64_t
Definition
btConvexHullComputer.cpp:31
GraphicsInteropBuffer::own_handle_
bool own_handle_
Definition
session/display_driver.h:78
GraphicsInteropBuffer::~GraphicsInteropBuffer
~GraphicsInteropBuffer()
Definition
session/display_driver.cpp:15
GraphicsInteropBuffer::has_new_handle
bool has_new_handle() const
Definition
session/display_driver.cpp:67
GraphicsInteropBuffer::get_size
size_t get_size() const
Definition
session/display_driver.cpp:62
GraphicsInteropBuffer::assign
void assign(GraphicsInteropDevice::Type type, int64_t handle, size_t size)
Definition
session/display_driver.cpp:20
GraphicsInteropBuffer::zero
void zero()
Definition
session/display_driver.cpp:35
GraphicsInteropBuffer::need_zero_
bool need_zero_
Definition
session/display_driver.h:84
GraphicsInteropBuffer::take_zero
bool take_zero()
Definition
session/display_driver.cpp:72
GraphicsInteropBuffer::type_
GraphicsInteropDevice::Type type_
Definition
session/display_driver.h:76
GraphicsInteropBuffer::take_handle
int64_t take_handle()
Definition
session/display_driver.cpp:79
GraphicsInteropBuffer::clear
void clear()
Definition
session/display_driver.cpp:40
GraphicsInteropBuffer::size_
size_t size_
Definition
session/display_driver.h:81
GraphicsInteropBuffer::handle_
int64_t handle_
Definition
session/display_driver.h:77
GraphicsInteropBuffer::is_empty
bool is_empty() const
Definition
session/display_driver.cpp:30
GraphicsInteropBuffer::get_type
GraphicsInteropDevice::Type get_type() const
Definition
session/display_driver.cpp:57
GraphicsInteropDevice::Type
Type
Definition
session/display_driver.h:17
GraphicsInteropDevice::VULKAN
@ VULKAN
Definition
session/display_driver.h:20
GraphicsInteropDevice::NONE
@ NONE
Definition
session/display_driver.h:18
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
assert
#define assert(assertion)
Definition
gpu_glsl_cpp_stubs.hh:31
CCL_NAMESPACE_BEGIN
Definition
python.cpp:37
display_driver.h
windows.h
Generated on
for Blender by
doxygen
1.18.0