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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
/// Win32 window class name registered for euv native windows.
pub const WIN32_CLASS_NAME: &str = "EuvNativeWindowClass";
/// Win32 `user32.dll` module name for dynamic Per-Monitor DPI awareness lookup.
pub const WIN32_DLL_USER32: &str = "user32.dll";
/// Win32 dynamic symbol name for `SetProcessDpiAwarenessContext`.
pub const WIN32_SYM_SET_DPI_CONTEXT: &str = "SetProcessDpiAwarenessContext\0";
/// Win32 `DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2` sentinel (`(HANDLE)-4`).
pub const DPI_AWARENESS_CONTEXT_PER_MONITOR_V2: isize = -4;
/// Win32 standard overlapped window style (`WS_OVERLAPPEDWINDOW`).
pub const WS_OVERLAPPEDWINDOW: u32 = 0x00CF_0000;
/// Win32 popup borderless window style (`WS_POPUP`).
pub const WS_POPUP: u32 = 0x8000_0000;
/// Win32 `SW_SHOW` command constant.
pub const SW_SHOW: i32 = 5;
/// Win32 `SW_HIDE` command constant.
pub const SW_HIDE: i32 = 0;
/// Win32 `HWND_TOPMOST` sentinel.
pub const HWND_TOPMOST: isize = -1;
/// Win32 `HWND_NOTOPMOST` sentinel.
pub const HWND_NOTOPMOST: isize = -2;
/// Win32 `SWP_NOMOVE | SWP_NOSIZE` flags.
pub const SWP_NOMOVE_NOSIZE: u32 = 0x0003;
/// Win32 `SWP_NOMOVE | SWP_NOZORDER` flags.
pub const SWP_NOMOVE_NOZORDER: u32 = 0x0006;
/// Win32 `SWP_NOZORDER | SWP_NOACTIVATE` flags honoring `WM_DPICHANGED` suggested rectangles.
pub const SWP_NOZORDER_NOACTIVATE: u32 = 0x0014;
/// Win32 `BI_RGB` uncompressed bitmap compression constant.
pub const BI_RGB: u32 = 0;
/// Win32 `DIB_RGB_COLORS` color table usage constant.
pub const DIB_RGB_COLORS: u32 = 0;
/// Win32 `SRCCOPY` raster operation code.
pub const SRCCOPY: u32 = 0x00CC_0020;
/// Win32 `HALFTONE` high-quality stretch blit mode for GDI `SetStretchBltMode`.
pub const STRETCH_HALFTONE: i32 = 4;
/// Win32 GDI `GetDeviceCaps` index for vertical display refresh rate in Hertz (`VREFRESH`).
pub const GDI_VREFRESH: i32 = 116;
/// Win32 `PM_REMOVE` flag for `PeekMessageW`.
pub const PM_REMOVE: u32 = 0x0001;
/// Win32 `WM_DESTROY` message constant.
pub const WM_DESTROY: u32 = 0x0002;
/// Win32 `WM_SIZE` message constant.
pub const WM_SIZE: u32 = 0x0005;
/// Win32 `SIZE_MINIMIZED` `w_param` value for `WM_SIZE`.
pub const SIZE_MINIMIZED: usize = 1;
/// Win32 `WM_SETFOCUS` message constant.
pub const WM_SETFOCUS: u32 = 0x0007;
/// Win32 `WM_KILLFOCUS` message constant.
pub const WM_KILLFOCUS: u32 = 0x0008;
/// Win32 `WM_PAINT` message constant.
pub const WM_PAINT: u32 = 0x000F;
/// Win32 `WM_CLOSE` message constant.
pub const WM_CLOSE: u32 = 0x0010;
/// Win32 `WM_SETTINGCHANGE` message constant.
pub const WM_SETTINGCHANGE: u32 = 0x001A;
/// Win32 `WM_ACTIVATEAPP` message constant.
pub const WM_ACTIVATEAPP: u32 = 0x001C;
/// Win32 `WM_CANCELMODE` message constant sent when OS dialogs or mode transitions cancel active pointer drags.
pub const WM_CANCELMODE: u32 = 0x001F;
/// Win32 `WM_CAPTURECHANGED` message constant sent when mouse capture is lost during a drag.
pub const WM_CAPTURECHANGED: u32 = 0x0215;
/// Win32 `WM_POWERBROADCAST` message constant.
pub const WM_POWERBROADCAST: u32 = 0x0218;
/// Win32 `PBT_POWERSTATUSCHANGE` `w_param` value for `WM_POWERBROADCAST`.
pub const PBT_POWERSTATUSCHANGE: usize = 0x000A;
/// Win32 `WM_THEMECHANGED` message constant.
pub const WM_THEMECHANGED: u32 = 0x031A;
/// Win32 `WM_CLIPBOARDUPDATE` message constant.
pub const WM_CLIPBOARDUPDATE: u32 = 0x031D;
/// Win32 `WM_KEYDOWN` message constant.
pub const WM_KEYDOWN: u32 = 0x0100;
/// Win32 `WM_KEYUP` message constant.
pub const WM_KEYUP: u32 = 0x0101;
/// Win32 `WM_CHAR` message constant.
pub const WM_CHAR: u32 = 0x0102;
/// Win32 `WM_MOUSEMOVE` message constant.
pub const WM_MOUSEMOVE: u32 = 0x0200;
/// Win32 `WM_LBUTTONDOWN` message constant.
pub const WM_LBUTTONDOWN: u32 = 0x0201;
/// Win32 `WM_LBUTTONUP` message constant.
pub const WM_LBUTTONUP: u32 = 0x0202;
/// Win32 `WM_RBUTTONDOWN` message constant.
pub const WM_RBUTTONDOWN: u32 = 0x0204;
/// Win32 `WM_RBUTTONUP` message constant.
pub const WM_RBUTTONUP: u32 = 0x0205;
/// Win32 `WM_MBUTTONDOWN` message constant.
pub const WM_MBUTTONDOWN: u32 = 0x0207;
/// Win32 `WM_MBUTTONUP` message constant.
pub const WM_MBUTTONUP: u32 = 0x0208;
/// Win32 `WM_MOUSEWHEEL` message constant.
pub const WM_MOUSEWHEEL: u32 = 0x020A;
/// Win32 `WM_DPICHANGED` message constant.
pub const WM_DPICHANGED: u32 = 0x02E0;
/// Win32 `VK_SHIFT` virtual key code.
pub const VK_SHIFT: i32 = 0x10;
/// Win32 `VK_CONTROL` virtual key code.
pub const VK_CONTROL: i32 = 0x11;
/// Win32 `VK_MENU` (Alt) virtual key code.
pub const VK_MENU: i32 = 0x12;
/// Win32 `VK_LWIN` virtual key code.
pub const VK_LWIN: i32 = 0x5B;
/// Win32 `VK_RWIN` virtual key code.
pub const VK_RWIN: i32 = 0x5C;
/// Win32 default 96 DPI baseline.
pub const WIN32_DEFAULT_DPI: f32 = 96.0;
/// Win32 `dxgi.dll` module name for dynamic DXGI 1.5/1.6 waitable swapchain & tearing probe.
pub const WIN32_DLL_DXGI: &str = "dxgi.dll";
/// Win32 dynamic symbol name for `CreateDXGIFactory1` in `dxgi.dll`.
pub const WIN32_SYM_CREATE_DXGI_FACTORY1: &str = "CreateDXGIFactory1\0";
/// Win32 `SWP_NOOWNERZORDER | SWP_FRAMECHANGED` flags for borderless fullscreen transition.
pub const SWP_FULLSCREEN_ENTER: u32 = 0x0220;
/// Win32 `SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED` flags for fullscreen restore.
pub const SWP_FULLSCREEN_EXIT: u32 = 0x0227;
/// Win32 `GWL_STYLE` index (`-16`).
pub const GWL_STYLE: i32 = -16;
/// Win32 `MONITOR_DEFAULTTONEAREST` flag (`2`) for `MonitorFromWindow`.
pub const MONITOR_DEFAULTTONEAREST: u32 = 2;
/// Win32 `ENUM_CURRENT_SETTINGS` sentinel (`u32::MAX`) for `EnumDisplaySettingsW`.
pub const ENUM_CURRENT_SETTINGS: u32 = u32MAX;
/// Win32 `WM_DISPLAYCHANGE` message constant (`0x007E`).
pub const WM_DISPLAYCHANGE: u32 = 0x007E;
/// Win32 `CREATE_WAITABLE_TIMER_HIGH_RESOLUTION` flag (`0x0000_0002`, Windows 10 1803+) breaking the 15.625ms sleep cap.
pub const CREATE_WAITABLE_TIMER_HIGH_RESOLUTION: u32 = 0x0000_0002;
/// Win32 `TIMER_ALL_ACCESS` desired access mask (`0x001F_0003`) for `CreateWaitableTimerExW`.
pub const TIMER_ALL_ACCESS: u32 = 0x001F_0003;
/// Win32 `INFINITE` wait timeout (`u32::MAX`) for `WaitForSingleObject`.
pub const WIN32_WAIT_INFINITE: u32 = u32MAX;
/// DXGI `DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT` (`0x0040`).
pub const DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT: u32 = 0x0040;
/// DXGI `DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING` (`0x0800`).
pub const DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING: u32 = 0x0800;
/// DXGI `DXGI_PRESENT_ALLOW_TEARING` (`0x0200`) flag for low-latency VRR / unlocked high-Hz presentation.
pub const DXGI_PRESENT_ALLOW_TEARING: u32 = 0x0200;
/// Win32 `CW_USEDEFAULT` position sentinel.
pub const CW_USEDEFAULT: i32 = -2_147_483_648;
/// Win32 `QS_ALLINPUT` wake mask (`0x04FF`) for blocking `MsgWaitForMultipleObjects`.
pub const WIN32_QS_ALLINPUT: u32 = 0x04FF;
/// Null-terminated ASCII `dxgi.dll` library name for `LoadLibraryA`.
pub const WIN32_DLL_DXGI_ASCII: &str = "dxgi.dll\0";
/// Null-terminated ASCII `d3d11.dll` library name for `LoadLibraryA`.
pub const WIN32_DLL_D3D11_ASCII: &str = "d3d11.dll\0";
/// Null-terminated ASCII `d3dcompiler_47.dll` library name for `LoadLibraryA`.
pub const WIN32_DLL_D3DCOMPILER_ASCII: &str = "d3dcompiler_47.dll\0";
/// Null-terminated ASCII symbol name for `D3D11CreateDevice`.
pub const WIN32_SYM_D3D11_CREATE_DEVICE: &str = "D3D11CreateDevice\0";
/// Null-terminated ASCII symbol name for `D3DCompile`.
pub const WIN32_SYM_D3D_COMPILE: &str = "D3DCompile\0";
/// Null-terminated HLSL vertex shader entry point matching `HLSL_UI_SHADER`.
pub const WIN32_HLSL_ENTRY_VS: &str = "VSMain\0";
/// Null-terminated HLSL pixel shader entry point matching `HLSL_UI_SHADER`.
pub const WIN32_HLSL_ENTRY_PS: &str = "PSMain\0";
/// Null-terminated HLSL shader model 5.0 vertex profile.
pub const WIN32_HLSL_TARGET_VS: &str = "vs_5_0\0";
/// Null-terminated HLSL shader model 5.0 pixel profile.
pub const WIN32_HLSL_TARGET_PS: &str = "ps_5_0\0";
/// `DXGI_FORMAT_UNKNOWN` (`0`) for structured buffer SRVs.
pub const DXGI_FORMAT_UNKNOWN: u32 = 0;
/// `DXGI_FORMAT_R8G8B8A8_UNORM` (`28`) for swapchain backbuffers and RGBA8 textures.
pub const DXGI_FORMAT_R8G8B8A8_UNORM: u32 = 28;
/// `DXGI_FORMAT_R8_UNORM` (`61`) for monochrome R8 glyph atlases.
pub const DXGI_FORMAT_R8_UNORM: u32 = 61;
/// `DXGI_USAGE_RENDER_TARGET_OUTPUT` (`0x20`).
pub const DXGI_USAGE_RENDER_TARGET_OUTPUT: u32 = 0x0020;
/// `DXGI_SWAP_EFFECT_FLIP_DISCARD` (`4`) for modern DXGI 1.6 flip-model presentation.
pub const DXGI_SWAP_EFFECT_FLIP_DISCARD: u32 = 4;
/// `DXGI_SCALING_NONE` (`1`) preserving exact 1:1 physical pixels without DWM stretch.
pub const DXGI_SCALING_NONE: u32 = 1;
/// `DXGI_ALPHA_MODE_IGNORE` (`3`).
pub const DXGI_ALPHA_MODE_IGNORE: u32 = 3;
/// `D3D_DRIVER_TYPE_HARDWARE` (`1`).
pub const D3D_DRIVER_TYPE_HARDWARE: u32 = 1;
/// `D3D_FEATURE_LEVEL_11_0` (`0xB000`).
pub const D3D_FEATURE_LEVEL_11_0: u32 = 0xB000;
/// `D3D11_SDK_VERSION` (`7`).
pub const D3D11_SDK_VERSION: u32 = 7;
/// `D3D11_USAGE_DEFAULT` (`0`).
pub const D3D11_USAGE_DEFAULT: u32 = 0;
/// `D3D11_USAGE_DYNAMIC` (`2`).
pub const D3D11_USAGE_DYNAMIC: u32 = 2;
/// `D3D11_BIND_CONSTANT_BUFFER` (`0x0004`).
pub const D3D11_BIND_CONSTANT_BUFFER: u32 = 0x0004;
/// `D3D11_BIND_SHADER_RESOURCE` (`0x0008`).
pub const D3D11_BIND_SHADER_RESOURCE: u32 = 0x0008;
/// `D3D11_CPU_ACCESS_WRITE` (`0x0001_0000`).
pub const D3D11_CPU_ACCESS_WRITE: u32 = 0x0001_0000;
/// `D3D11_RESOURCE_MISC_BUFFER_STRUCTURED` (`0x0040`).
pub const D3D11_RESOURCE_MISC_BUFFER_STRUCTURED: u32 = 0x0040;
/// `D3D11_MAP_WRITE_DISCARD` (`4`).
pub const D3D11_MAP_WRITE_DISCARD: u32 = 4;
/// `D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST` (`4`).
pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST: u32 = 4;
/// `D3D11_SRV_DIMENSION_BUFFER` (`1`).
pub const D3D11_SRV_DIMENSION_BUFFER: u32 = 1;
/// `D3D11_SRV_DIMENSION_TEXTURE2D` (`4`).
pub const D3D11_SRV_DIMENSION_TEXTURE2D: u32 = 4;
/// `D3D11_FILL_SOLID` (`3`).
pub const D3D11_FILL_SOLID: u32 = 3;
/// `D3D11_CULL_NONE` (`1`).
pub const D3D11_CULL_NONE: u32 = 1;
/// `D3D11_BLEND_ONE` (`2`).
pub const D3D11_BLEND_ONE: u32 = 2;
/// `D3D11_BLEND_SRC_ALPHA` (`5`).
pub const D3D11_BLEND_SRC_ALPHA: u32 = 5;
/// `D3D11_BLEND_INV_SRC_ALPHA` (`6`).
pub const D3D11_BLEND_INV_SRC_ALPHA: u32 = 6;
/// `D3D11_BLEND_OP_ADD` (`1`).
pub const D3D11_BLEND_OP_ADD: u32 = 1;
/// `D3D11_COLOR_WRITE_ENABLE_ALL` (`0x0F`).
pub const D3D11_COLOR_WRITE_ENABLE_ALL: u8 = 0x0F;
/// `D3D11_FILTER_MIN_MAG_MIP_LINEAR` (`0x15`).
pub const D3D11_FILTER_MIN_MAG_MIP_LINEAR: u32 = 0x15;
/// `D3D11_TEXTURE_ADDRESS_CLAMP` (`3`).
pub const D3D11_TEXTURE_ADDRESS_CLAMP: u32 = 3;
/// `D3D11_COMPARISON_NEVER` (`1`).
pub const D3D11_COMPARISON_NEVER: u32 = 1;
/// COM IID for `IDXGIFactory2` (`{50c83a1c-e072-4c48-87b0-3630fa36a6d0}`).
pub const IID_IDXGI_FACTORY2: = ;
/// COM IID for `IDXGISwapChain2` (`{a8be2ac4-199f-4946-b331-79599fb98de7}`).
pub const IID_IDXGI_SWAP_CHAIN2: = ;
/// COM IID for `ID3D11Texture2D` (`{6f15aaf2-d208-4e89-9ab4-489535d34f9c}`).
pub const IID_ID3D11_TEXTURE2D: = ;
/// Error text emitted when Windows D3D11/DXGI direct GPU presentation cannot be initialized.
pub const ERR_WIN32_D3D11_PRESENT: &str =
"Windows D3D11/DXGI direct GPU presentation unavailable";
/// Error message when `CreateWindowExW` returns a null `HWND`.
pub const ERR_WIN32_CREATE_WINDOW: &str = "CreateWindowExW returned null HWND";
/// Error message when native DXGI/D3D11 direct GPU swapchain presentation is requested without DXGI availability.
pub const ERR_WIN32_DXGI_UNAVAILABLE: &str =
"Windows direct GPU presentation requires DXGI swapchain availability and live HWND";
/// Error message when GDI software presentation lacks a valid `HWND` or device context (`HDC`).
pub const ERR_WIN32_GDI_SURFACE_MISSING: &str =
"Windows GDI software presentation requires a live HWND and device context";