Blender
V5.0
source
blender
gpu
GPU_platform.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2005 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include <cstdint>
12
#include <optional>
13
#include <string>
14
15
#include "
BLI_span.hh
"
16
#include "
BLI_utildefines.h
"
17
18
#include "
GPU_platform_backend_enum.h
"
// IWYU pragma: export
19
20
/* GPU platform support */
21
22
/* GPU Types */
23
enum
GPUDeviceType
{
24
GPU_DEVICE_NVIDIA
= (1 << 0),
25
GPU_DEVICE_ATI
= (1 << 1),
26
GPU_DEVICE_INTEL
= (1 << 2),
27
GPU_DEVICE_INTEL_UHD
= (1 << 3),
28
GPU_DEVICE_APPLE
= (1 << 4),
29
GPU_DEVICE_SOFTWARE
= (1 << 5),
30
GPU_DEVICE_QUALCOMM
= (1 << 6),
31
GPU_DEVICE_UNKNOWN
= (1 << 7),
32
GPU_DEVICE_ANY
= (0xff),
33
};
34
35
ENUM_OPERATORS
(
GPUDeviceType
,
GPU_DEVICE_ANY
)
36
37
enum
GPUOSType
{
38
GPU_OS_WIN
= (1 << 8),
39
GPU_OS_MAC
= (1 << 9),
40
GPU_OS_UNIX
= (1 << 10),
41
GPU_OS_ANY
= (0xff00),
42
};
43
44
enum
GPUDriverType
{
45
GPU_DRIVER_OFFICIAL
= (1 << 16),
46
GPU_DRIVER_OPENSOURCE
= (1 << 17),
47
GPU_DRIVER_SOFTWARE
= (1 << 18),
48
GPU_DRIVER_ANY
= (0xff0000),
49
};
50
51
enum
GPUSupportLevel
{
52
GPU_SUPPORT_LEVEL_SUPPORTED
,
53
GPU_SUPPORT_LEVEL_LIMITED
,
54
GPU_SUPPORT_LEVEL_UNSUPPORTED
,
55
};
56
57
enum
GPUArchitectureType
{
58
/* Immediate Mode Renderer (IMR).
59
* Typically, an IMR architecture will execute GPU work in sequence, rasterizing primitives in
60
* order. */
61
GPU_ARCHITECTURE_IMR
= 0,
62
63
/* Tile-Based-Deferred-Renderer (TBDR).
64
* A TBDR architecture will typically execute the vertex stage up-front for all primitives,
65
* binning geometry into distinct tiled regions. Fragments will then be rasterized within
66
* the bounds of one tile at a time. */
67
GPU_ARCHITECTURE_TBDR
= 1,
68
};
69
70
struct
GPUDevice
{
71
std::string
identifier
;
72
int
index
;
73
uint32_t
vendor_id
;
74
uint32_t
device_id
;
75
std::string
name
;
76
};
77
78
/* GPU Types */
79
/* TODO: Verify all use-cases of GPU_type_matches to determine which graphics API it should apply
80
* to, and replace with `GPU_type_matches_ex` where appropriate. */
81
bool
GPU_type_matches
(
GPUDeviceType
device,
GPUOSType
os,
GPUDriverType
driver);
82
bool
GPU_type_matches_ex
(
GPUDeviceType
device,
83
GPUOSType
os,
84
GPUDriverType
driver,
85
GPUBackendType
backend);
86
87
GPUSupportLevel
GPU_platform_support_level
();
88
const
char
*
GPU_platform_vendor
();
89
const
char
*
GPU_platform_renderer
();
90
const
char
*
GPU_platform_version
();
91
const
char
*
GPU_platform_support_level_key
();
92
const
char
*
GPU_platform_gpu_name
();
93
GPUArchitectureType
GPU_platform_architecture
();
94
blender::Span<GPUDevice>
GPU_platform_devices_list
();
95
96
/* The UUID of the device. Can be an empty array, since it is not supported on all platforms. */
97
blender::Span<uint8_t>
GPU_platform_uuid
();
98
/* The LUID of the device. Can be an empty array, since it is not supported on all platforms. */
99
blender::Span<uint8_t>
GPU_platform_luid
();
100
/* A bit field with the nth bit active identifying the nth device with the same LUID. Only matters
101
* if LUID is defined. */
102
uint32_t
GPU_platform_luid_node_mask
();
BLI_span.hh
BLI_utildefines.h
ENUM_OPERATORS
#define ENUM_OPERATORS(_type, _max)
Definition
BLI_utildefines.h:588
GPUDeviceType
GPUDeviceType
Definition
GPU_platform.hh:23
GPU_DEVICE_UNKNOWN
@ GPU_DEVICE_UNKNOWN
Definition
GPU_platform.hh:31
GPU_DEVICE_ATI
@ GPU_DEVICE_ATI
Definition
GPU_platform.hh:25
GPU_DEVICE_INTEL_UHD
@ GPU_DEVICE_INTEL_UHD
Definition
GPU_platform.hh:27
GPU_DEVICE_QUALCOMM
@ GPU_DEVICE_QUALCOMM
Definition
GPU_platform.hh:30
GPU_DEVICE_SOFTWARE
@ GPU_DEVICE_SOFTWARE
Definition
GPU_platform.hh:29
GPU_DEVICE_NVIDIA
@ GPU_DEVICE_NVIDIA
Definition
GPU_platform.hh:24
GPU_DEVICE_ANY
@ GPU_DEVICE_ANY
Definition
GPU_platform.hh:32
GPU_DEVICE_APPLE
@ GPU_DEVICE_APPLE
Definition
GPU_platform.hh:28
GPU_DEVICE_INTEL
@ GPU_DEVICE_INTEL
Definition
GPU_platform.hh:26
GPU_platform_uuid
blender::Span< uint8_t > GPU_platform_uuid()
Definition
gpu_platform.cc:187
GPU_platform_support_level
GPUSupportLevel GPU_platform_support_level()
Definition
gpu_platform.cc:125
GPU_platform_vendor
const char * GPU_platform_vendor()
Definition
gpu_platform.cc:131
GPU_platform_gpu_name
const char * GPU_platform_gpu_name()
Definition
gpu_platform.cc:155
GPU_platform_support_level_key
const char * GPU_platform_support_level_key()
Definition
gpu_platform.cc:149
GPUArchitectureType
GPUArchitectureType
Definition
GPU_platform.hh:57
GPU_ARCHITECTURE_TBDR
@ GPU_ARCHITECTURE_TBDR
Definition
GPU_platform.hh:67
GPU_ARCHITECTURE_IMR
@ GPU_ARCHITECTURE_IMR
Definition
GPU_platform.hh:61
GPU_type_matches
bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
Definition
gpu_platform.cc:167
GPU_platform_luid
blender::Span< uint8_t > GPU_platform_luid()
Definition
gpu_platform.cc:192
GPU_platform_renderer
const char * GPU_platform_renderer()
Definition
gpu_platform.cc:137
GPUSupportLevel
GPUSupportLevel
Definition
GPU_platform.hh:51
GPU_SUPPORT_LEVEL_LIMITED
@ GPU_SUPPORT_LEVEL_LIMITED
Definition
GPU_platform.hh:53
GPU_SUPPORT_LEVEL_SUPPORTED
@ GPU_SUPPORT_LEVEL_SUPPORTED
Definition
GPU_platform.hh:52
GPU_SUPPORT_LEVEL_UNSUPPORTED
@ GPU_SUPPORT_LEVEL_UNSUPPORTED
Definition
GPU_platform.hh:54
GPU_platform_luid_node_mask
uint32_t GPU_platform_luid_node_mask()
Definition
gpu_platform.cc:197
GPU_platform_version
const char * GPU_platform_version()
Definition
gpu_platform.cc:143
GPUDriverType
GPUDriverType
Definition
GPU_platform.hh:44
GPU_DRIVER_ANY
@ GPU_DRIVER_ANY
Definition
GPU_platform.hh:48
GPU_DRIVER_OFFICIAL
@ GPU_DRIVER_OFFICIAL
Definition
GPU_platform.hh:45
GPU_DRIVER_OPENSOURCE
@ GPU_DRIVER_OPENSOURCE
Definition
GPU_platform.hh:46
GPU_DRIVER_SOFTWARE
@ GPU_DRIVER_SOFTWARE
Definition
GPU_platform.hh:47
GPU_platform_devices_list
blender::Span< GPUDevice > GPU_platform_devices_list()
Definition
gpu_platform.cc:182
GPUOSType
GPUOSType
Definition
GPU_platform.hh:37
GPU_OS_WIN
@ GPU_OS_WIN
Definition
GPU_platform.hh:38
GPU_OS_UNIX
@ GPU_OS_UNIX
Definition
GPU_platform.hh:40
GPU_OS_ANY
@ GPU_OS_ANY
Definition
GPU_platform.hh:41
GPU_OS_MAC
@ GPU_OS_MAC
Definition
GPU_platform.hh:39
GPU_type_matches_ex
bool GPU_type_matches_ex(GPUDeviceType device, GPUOSType os, GPUDriverType driver, GPUBackendType backend)
Definition
gpu_platform.cc:172
GPU_platform_architecture
GPUArchitectureType GPU_platform_architecture()
Definition
gpu_platform.cc:161
GPU_platform_backend_enum.h
GPUBackendType
GPUBackendType
Definition
GPU_platform_backend_enum.h:12
blender::Span
Definition
BLI_span.hh:74
GPUDevice::index
int index
Definition
GPU_platform.hh:72
GPUDevice::GPUDevice
GPUDevice(const DeviceInfo &info_, Stats &stats_, Profiler &profiler_, bool headless_)
Definition
device/device.h:335
GPUDevice::device_id
uint32_t device_id
Definition
GPU_platform.hh:74
GPUDevice::identifier
std::string identifier
Definition
GPU_platform.hh:71
GPUDevice::name
std::string name
Definition
GPU_platform.hh:75
GPUDevice::vendor_id
uint32_t vendor_id
Definition
GPU_platform.hh:73
Generated on
for Blender by
doxygen
1.16.1