ui: Force NVIDIA present method to native

Setting the NVIDIA driver Vulkan/OpenGL present method to
"Prefer layerd on DXGI Swapchain" with vsync enabled within xemu causes
framerate to be ~halved. This change overrides the driver setting to force
the legacy/native value to be used.

Resolves one identified issue with #2790
This commit is contained in:
Erik Abair
2026-04-21 12:23:39 -07:00
committed by mborgerson
parent dc69fb4d6e
commit da38b262c7
4 changed files with 23 additions and 0 deletions
+12
View File
@@ -152,6 +152,18 @@ bool nvapi_setup_profile(NvApiProfileOpts opts)
goto cleanup;
}
NVDRS_SETTING setting_dxpresent = {
.version = NVDRS_SETTING_VER,
.settingId = OGL_CPL_PREFER_DXPRESENT_ID,
.settingType = NVDRS_DWORD_TYPE,
.u32CurrentValue = opts.present_method,
};
if (NvAPI_DRS_SetSetting(session, profile, &setting_dxpresent)) {
LOG("NvAPI_DRS_SetSetting for settingId %x failed",
setting_dxpresent.settingId);
goto cleanup;
}
if (NvAPI_DRS_SaveSettings(session)) {
LOG("NvAPI_DRS_SaveSettings failed");
goto cleanup;
+9
View File
@@ -27,10 +27,19 @@
#include <windows.h>
#include <stdbool.h>
enum EValues_OGL_CPL_PREFER_DXPRESENT {
OGL_CPL_PREFER_DXPRESENT_PREFER_DISABLED = 0x00000000,
OGL_CPL_PREFER_DXPRESENT_PREFER_ENABLED = 0x00000001,
OGL_CPL_PREFER_DXPRESENT_AUTO = 0x00000002,
OGL_CPL_PREFER_DXPRESENT_NUM_VALUES = 3,
OGL_CPL_PREFER_DXPRESENT_DEFAULT = OGL_CPL_PREFER_DXPRESENT_AUTO
};
typedef struct NvApiProfileOpts {
const wchar_t *profile_name;
const wchar_t *executable_name;
bool threaded_optimization;
enum EValues_OGL_CPL_PREFER_DXPRESENT present_method;
} NvApiProfileOpts;
bool nvapi_init(void);
+1
View File
@@ -32,6 +32,7 @@
enum ESetting {
OGL_THREAD_CONTROL_ID = 0x20C1221E,
OGL_CPL_PREFER_DXPRESENT_ID = 0x20D690F8,
};
enum EValues_OGL_THREAD_CONTROL {
+1
View File
@@ -1257,6 +1257,7 @@ static void setup_nvidia_profile(void)
.profile_name = L"xemu",
.executable_name = exe_name,
.threaded_optimization = false,
.present_method = OGL_CPL_PREFER_DXPRESENT_PREFER_DISABLED,
});
nvapi_finalize();
}