summaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorjsjtxietian <jsjtxietian@outlook.com>2023-11-20 19:31:14 +0800
committerjsjtxietian <jsjtxietian@outlook.com>2023-11-20 19:31:14 +0800
commita3f44cd67e5397d8fb0329ebaa1ea5b7736090ad (patch)
tree11c92b8cfb35341474045af90bf86d84ddf803ba /platform
parent80de898d721f952dac0b102d48bb73d6b02ee1e8 (diff)
downloadredot-engine-a3f44cd67e5397d8fb0329ebaa1ea5b7736090ad.tar.gz
Check nullptr in `_nvapi_disable_threaded_optimization` to prevent crash
update outdated link
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/gl_manager_windows_native.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/windows/gl_manager_windows_native.cpp b/platform/windows/gl_manager_windows_native.cpp
index b350786d11..a8c6efcea1 100644
--- a/platform/windows/gl_manager_windows_native.cpp
+++ b/platform/windows/gl_manager_windows_native.cpp
@@ -104,8 +104,8 @@ static bool nvapi_err_check(const char *msg, int status) {
}
// On windows we have to disable threaded optimization when using NVIDIA graphics cards
-// to avoid stuttering, see https://github.com/microsoft/vscode-cpptools/issues/6592
-// also see https://github.com/Ryujinx/Ryujinx/blob/master/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
+// to avoid stuttering, see see https://stackoverflow.com/questions/36959508/nvidia-graphics-driver-causing-noticeable-frame-stuttering/37632948
+// also see https://github.com/Ryujinx/Ryujinx/blob/master/src/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() {
HMODULE nvapi = 0;
#ifdef _WIN64
@@ -149,6 +149,10 @@ void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() {
NvDRSSessionHandle session_handle;
+ if (NvAPI_DRS_CreateSession == nullptr) {
+ return;
+ }
+
if (!nvapi_err_check("NVAPI: Error creating DRS session", NvAPI_DRS_CreateSession(&session_handle))) {
NvAPI_Unload();
return;