add gpu hints on windows (#1158)

This commit is contained in:
Logan McNaughton 2026-07-13 09:17:35 +02:00 committed by GitHub
parent 81cc78ce90
commit 282ec6c6c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -10,6 +10,13 @@
#include <cmath>
#include <map>
#ifdef _WIN32
extern "C" {
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
using namespace Vulkan;
#define DP_STATUS_XBUS_DMA 0x01

View File

@ -106,6 +106,12 @@ pub struct Ui {
}
pub fn sdl_hints() {
#[cfg(target_os = "linux")]
unsafe {
std::env::set_var("DRI_PRIME", "1");
std::env::set_var("__NV_PRIME_RENDER_OFFLOAD", "1");
}
unsafe {
let hint = std::ffi::CString::new("1").unwrap();
sdl3_sys::everything::SDL_SetHint(