docs
Loading...
Searching...
No Matches
GPUMemoryStats.h
Go to the documentation of this file.
1///
2/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3/// A license is required for commercial use. https://ultralig.ht
4///
5#pragma once
6#include "Defines.h"
7#include <stdint.h>
8
9namespace ultralight {
10
11///
12/// GPU memory statistics reported by the App's GPU driver.
13///
14/// Filled by App::GetGPUMemoryStats(). The per-category fields describe GPU
15/// resources the library has allocated through the active GPU backend; the
16/// process fields describe the video memory usage of the whole process as
17/// reported by the operating system (including allocations made outside the
18/// library).
19///
20/// How byte figures are computed depends on the active backend: backends
21/// that track allocations directly report exact allocation sizes, while
22/// others compute sizes from resource dimensions and formats, which may
23/// slightly understate the true driver allocation (internal alignment and
24/// padding are not visible).
25///
26/// @note This structure may grow over time; new fields are appended and
27/// zero-initialized, so an unset field always reads back as zero.
28///
30 ///
31 /// Bytes allocated for sampled textures (images, glyph atlases, and other
32 /// engine textures), not counting render targets.
33 ///
34 uint64_t texture_bytes = 0;
35
36 ///
37 /// Number of sampled textures currently allocated.
38 ///
39 uint32_t texture_count = 0;
40
41 ///
42 /// Bytes allocated for render targets, including multisample storage and
43 /// any single-sample resolve textures.
44 ///
45 uint64_t render_target_bytes = 0;
46
47 ///
48 /// Number of render-target textures currently allocated.
49 ///
50 uint32_t render_target_count = 0;
51
52 ///
53 /// Bytes allocated for geometry (vertex and index buffers).
54 ///
55 uint64_t geometry_bytes = 0;
56
57 ///
58 /// Number of geometry buffers currently allocated.
59 ///
60 uint32_t geometry_count = 0;
61
62 ///
63 /// Bytes allocated for window back-buffers.
64 ///
65 uint64_t swap_chain_bytes = 0;
66
67 ///
68 /// Number of swap chains currently active.
69 ///
70 uint32_t swap_chain_count = 0;
71
72 ///
73 /// Bytes allocated for transient per-frame memory (upload staging and
74 /// constant buffers).
75 ///
76 uint64_t transient_bytes = 0;
77
78 ///
79 /// Total bytes of GPU heap memory committed by the backend's allocator.
80 ///
81 /// Only reported by backends that sub-allocate resources from larger
82 /// heaps; zero elsewhere. May exceed the sum of the tracked categories due
83 /// to heap block granularity.
84 ///
86
87 ///
88 /// Current video memory usage of this process, as reported by the
89 /// operating system. Covers the whole process, including allocations made
90 /// outside the library. Zero if the OS query is unavailable.
91 ///
92 uint64_t process_usage_bytes = 0;
93
94 ///
95 /// Video memory budget for this process, as reported by the operating
96 /// system. Usage above this value may cause the OS to throttle or evict
97 /// allocations. Zero if the OS query is unavailable.
98 ///
100
101 ///
102 /// Dedicated video memory of the active display adapter, in bytes.
103 ///
105
106 ///
107 /// Human-readable name of the active display adapter (UTF-8,
108 /// null-terminated, truncated if necessary).
109 ///
110 char adapter_description[128] = {};
111};
112
113} // namespace ultralight
#define AExport
Definition Defines.h:41
Root namespace for every public Ultralight type, function, and enumeration.
GPU memory statistics reported by the App's GPU driver.
Definition GPUMemoryStats.h:29
uint64_t render_target_bytes
Bytes allocated for render targets, including multisample storage and any single-sample resolve textu...
Definition GPUMemoryStats.h:45
uint64_t process_usage_bytes
Current video memory usage of this process, as reported by the operating system.
Definition GPUMemoryStats.h:92
uint64_t texture_bytes
Bytes allocated for sampled textures (images, glyph atlases, and other engine textures),...
Definition GPUMemoryStats.h:34
uint64_t allocator_committed_bytes
Total bytes of GPU heap memory committed by the backend's allocator.
Definition GPUMemoryStats.h:85
uint32_t swap_chain_count
Number of swap chains currently active.
Definition GPUMemoryStats.h:70
uint64_t adapter_video_memory_bytes
Dedicated video memory of the active display adapter, in bytes.
Definition GPUMemoryStats.h:104
uint32_t texture_count
Number of sampled textures currently allocated.
Definition GPUMemoryStats.h:39
uint32_t render_target_count
Number of render-target textures currently allocated.
Definition GPUMemoryStats.h:50
uint32_t geometry_count
Number of geometry buffers currently allocated.
Definition GPUMemoryStats.h:60
uint64_t process_budget_bytes
Video memory budget for this process, as reported by the operating system.
Definition GPUMemoryStats.h:99
uint64_t swap_chain_bytes
Bytes allocated for window back-buffers.
Definition GPUMemoryStats.h:65
char adapter_description[128]
Human-readable name of the active display adapter (UTF-8, null-terminated, truncated if necessary).
Definition GPUMemoryStats.h:110
uint64_t transient_bytes
Bytes allocated for transient per-frame memory (upload staging and constant buffers).
Definition GPUMemoryStats.h:76
uint64_t geometry_bytes
Bytes allocated for geometry (vertex and index buffers).
Definition GPUMemoryStats.h:55