Blender V5.0
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 */
34
36
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
48 GPU_DRIVER_ANY = (0xff0000),
49};
50
56
58 /* Immediate Mode Renderer (IMR).
59 * Typically, an IMR architecture will execute GPU work in sequence, rasterizing primitives in
60 * order. */
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. */
68};
69
70struct 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. */
83 GPUOSType os,
84 GPUDriverType driver,
85 GPUBackendType backend);
86
88const char *GPU_platform_vendor();
89const char *GPU_platform_renderer();
90const char *GPU_platform_version();
92const char *GPU_platform_gpu_name();
95
96/* The UUID of the device. Can be an empty array, since it is not supported on all platforms. */
98/* The LUID of the device. Can be an empty array, since it is not supported on all platforms. */
100/* A bit field with the nth bit active identifying the nth device with the same LUID. Only matters
101 * if LUID is defined. */
#define ENUM_OPERATORS(_type, _max)
GPUDeviceType
@ GPU_DEVICE_UNKNOWN
@ GPU_DEVICE_ATI
@ GPU_DEVICE_INTEL_UHD
@ GPU_DEVICE_QUALCOMM
@ GPU_DEVICE_SOFTWARE
@ GPU_DEVICE_NVIDIA
@ GPU_DEVICE_ANY
@ GPU_DEVICE_APPLE
@ GPU_DEVICE_INTEL
blender::Span< uint8_t > GPU_platform_uuid()
GPUSupportLevel GPU_platform_support_level()
const char * GPU_platform_vendor()
const char * GPU_platform_gpu_name()
const char * GPU_platform_support_level_key()
GPUArchitectureType
@ GPU_ARCHITECTURE_TBDR
@ GPU_ARCHITECTURE_IMR
bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
blender::Span< uint8_t > GPU_platform_luid()
const char * GPU_platform_renderer()
GPUSupportLevel
@ GPU_SUPPORT_LEVEL_LIMITED
@ GPU_SUPPORT_LEVEL_SUPPORTED
@ GPU_SUPPORT_LEVEL_UNSUPPORTED
uint32_t GPU_platform_luid_node_mask()
const char * GPU_platform_version()
GPUDriverType
@ GPU_DRIVER_ANY
@ GPU_DRIVER_OFFICIAL
@ GPU_DRIVER_OPENSOURCE
@ GPU_DRIVER_SOFTWARE
blender::Span< GPUDevice > GPU_platform_devices_list()
GPUOSType
@ GPU_OS_WIN
@ GPU_OS_UNIX
@ GPU_OS_ANY
@ GPU_OS_MAC
bool GPU_type_matches_ex(GPUDeviceType device, GPUOSType os, GPUDriverType driver, GPUBackendType backend)
GPUArchitectureType GPU_platform_architecture()
GPUDevice(const DeviceInfo &info_, Stats &stats_, Profiler &profiler_, bool headless_)
uint32_t device_id
std::string identifier
std::string name
uint32_t vendor_id