Blender V5.3
BLI_winstuff.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11
12#ifndef _WIN32
13# error "This include is for Windows only!"
14#endif
15
16#include "BLI_sys_types.hh"
17
18#include <windows.h>
19
20#undef rad
21#undef rad1
22#undef rad2
23#undef rad3
24#undef vec
25#undef rect
26#undef rct1
27#undef rct2
28
29#undef small
30
31/* These definitions are also in BLI_math for simplicity. */
32
33#if !defined(_USE_MATH_DEFINES)
34# define _USE_MATH_DEFINES
35#endif
36
37#ifndef S_ISREG
38# define S_ISREG(x) (((x) & _S_IFREG) == _S_IFREG)
39#endif
40#ifndef S_ISDIR
41# define S_ISDIR(x) (((x) & _S_IFDIR) == _S_IFDIR)
42#endif
43
44#if defined(_MSC_VER)
45# define R_OK 4
46# define W_OK 2
47/* Not accepted by `access()` on windows. */
48// # define X_OK 1
49# define F_OK 0
50#endif
51
52typedef unsigned int mode_t;
53
55struct dirent {
56 int d_ino;
57 int d_off;
58 unsigned short d_reclen;
59 char *d_name;
60};
61
63typedef struct __dirstream DIR;
64
65DIR *opendir(const char *path);
66struct dirent *readdir(DIR *dp);
67int closedir(DIR *dp);
68const char *dirname(char *path);
69
70namespace blender {
71
72/* Windows utility functions. */
73
77bool BLI_windows_update_pinned_launcher(const char *launcher_path);
78
79/* Gets the version of the currently loaded DirectX driver for the first device that matches
80 * deviceString. This is required for Qualcomm devices which use Mesa's Gallium D2D12 layer for
81 * OpenGL functionality */
82bool BLI_windows_get_directx_driver_version(const wchar_t *deviceSubString,
83 long long *r_driverVersion);
84
85/* Obtains the driver version and device ID for the device matching the passed LUID.
86 * The DXGI User Mode Driver (UMD) version is parsed to fit the Intel GPU driver "xxx.yyyy"
87 * (major.minor) versioning scheme. This function is used for obtaining this information in the
88 * OpenGL backend, which otherwise does not have access to this information. */
90 int *driver_version_minor,
91 int *driver_version_major,
92 uint32_t *device_id);
93
94/* Checks the version of the Windows build in the format "major.minor.build".
95 * Example: 10.0.22000 corresponds to Windows 11 21H2. */
97 DWORD minorVersion,
98 DWORD buildNumber);
99
105void BLI_windows_get_default_root_dir(char root_dir[4]);
106int BLI_windows_get_executable_dir(char r_dirpath[/*FILE_MAXDIR*/]);
107
108/* ShellExecute Helpers. */
109
110bool BLI_windows_external_operation_supported(const char *filepath, const char *operation);
111bool BLI_windows_external_operation_execute(const char *filepath, const char *operation);
112
121bool BLI_windows_execute_self(const char *parameters,
122 const bool wait,
123 const bool elevated,
124 const bool silent);
125
130enum class QoSMode {
134 HIGH = 1,
136 ECO = 2
137};
138
143enum class QoSPrecedence {
145 JOB = 0,
148};
149
156void BLI_windows_process_set_qos(QoSMode qos_mode, QoSPrecedence qos_precedence);
157
158} // namespace blender
struct __dirstream DIR
struct dirent * readdir(DIR *dp)
int closedir(DIR *dp)
const char * dirname(char *path)
DIR * opendir(const char *path)
unsigned int mode_t
#define HIGH(x)
Definition RandGen.cpp:35
BMesh Iterators.
bool BLI_windows_unregister_blend_extension(bool all_users)
unsigned __int64 uint64_t
Definition BKE_text.h:91
bool BLI_windows_execute_self(const char *parameters, const bool wait, const bool elevated, const bool silent)
bool BLI_windows_external_operation_execute(const char *filepath, const char *operation)
bool BLI_windows_get_directx_driver_version(const wchar_t *deviceSubString, long long *r_driverVersion)
unsigned int uint32_t
Definition BKE_text.h:81
bool BLI_windows_update_pinned_launcher(const char *launcher_path)
bool BLI_windows_is_store_install(void)
bool BLI_windows_get_directx_intel_driver_info(uint64_t device_luid, int *driver_version_minor, int *driver_version_major, uint32_t *device_id)
void BLI_windows_process_set_qos(QoSMode qos_mode, QoSPrecedence qos_precedence)
bool BLI_windows_external_operation_supported(const char *filepath, const char *operation)
bool BLI_windows_register_blend_extension(bool all_users)
int BLI_windows_get_executable_dir(char r_dirpath[])
void BLI_windows_get_default_root_dir(char root_dir[4])
bool BLI_windows_is_build_version_greater_or_equal(DWORD majorVersion, DWORD minorVersion, DWORD buildNumber)
unsigned short d_reclen
char * d_name