diff --git a/.gitmodules b/.gitmodules index 500eaf3f8f4..8834ac0137d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -38,10 +38,10 @@ path = third-party/nv-codec-headers url = https://github.com/FFmpeg/nv-codec-headers.git branch = sdk/12.0 -[submodule "third-party/nvapi-open-source-sdk"] - path = third-party/nvapi-open-source-sdk - url = https://github.com/LizardByte/nvapi-open-source-sdk.git - branch = sdk +[submodule "third-party/nvapi"] + path = third-party/nvapi + url = https://github.com/NVIDIA/nvapi.git + branch = main [submodule "third-party/Simple-Web-Server"] path = third-party/Simple-Web-Server url = https://github.com/LizardByte-infrastructure/Simple-Web-Server.git diff --git a/cmake/compile_definitions/windows.cmake b/cmake/compile_definitions/windows.cmake index 57af5e2a435..843dafe61e5 100644 --- a/cmake/compile_definitions/windows.cmake +++ b/cmake/compile_definitions/windows.cmake @@ -31,9 +31,9 @@ add_definitions(-DMINIUPNP_STATICLIB) add_subdirectory(tools) # todo - this is temporary, only tools for Windows are needed, for now # nvidia -include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/third-party/nvapi-open-source-sdk") +include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/third-party/nvapi") file(GLOB NVPREFS_FILES CONFIGURE_DEPENDS - "${CMAKE_SOURCE_DIR}/third-party/nvapi-open-source-sdk/*.h" + "${CMAKE_SOURCE_DIR}/third-party/nvapi/*.h" "${CMAKE_SOURCE_DIR}/src/platform/windows/nvprefs/*.cpp" "${CMAKE_SOURCE_DIR}/src/platform/windows/nvprefs/*.h") diff --git a/src/platform/windows/nvprefs/driver_settings.h b/src/platform/windows/nvprefs/driver_settings.h index f62cf4bdc70..f2957156bbd 100644 --- a/src/platform/windows/nvprefs/driver_settings.h +++ b/src/platform/windows/nvprefs/driver_settings.h @@ -4,16 +4,35 @@ */ #pragma once +// local includes first so standard library headers are pulled in before nvapi's SAL macros +#include "undo_data.h" + // nvapi headers // disable clang-format header reordering // as needs types from // clang-format off + +// With GCC/MinGW, nvapi_lite_salend.h (included transitively via nvapi_lite_d3dext.h) +// undefines all SAL annotation macros (e.g. __success, __in, __out, __inout) after +// nvapi_lite_salstart.h had defined them. This leaves NVAPI_INTERFACE and other macros +// that use SAL annotations broken for the rest of nvapi.h. Defining __NVAPI_EMPTY_SAL +// makes nvapi_lite_salend.h a no-op, preserving the SAL macro definitions throughout. +// After nvapi.h, we include nvapi_lite_salend.h explicitly (without __NVAPI_EMPTY_SAL) +// to clean up the SAL macros and prevent them from polluting subsequent includes. +#if defined(__GNUC__) + #define __NVAPI_EMPTY_SAL +#endif + #include #include -// clang-format on -// local includes -#include "undo_data.h" +#if defined(__GNUC__) + #undef __NVAPI_EMPTY_SAL + // Clean up SAL macros that nvapi_lite_salstart.h defined and salend.h was + // prevented from cleaning up (due to __NVAPI_EMPTY_SAL above). + #include +#endif +// clang-format on namespace nvprefs { diff --git a/third-party/nvapi b/third-party/nvapi new file mode 160000 index 00000000000..9296d671e71 --- /dev/null +++ b/third-party/nvapi @@ -0,0 +1 @@ +Subproject commit 9296d671e71608d6d6b7749ed93989af4ada8858 diff --git a/third-party/nvapi-open-source-sdk b/third-party/nvapi-open-source-sdk deleted file mode 160000 index cce4e90b629..00000000000 --- a/third-party/nvapi-open-source-sdk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cce4e90b629f712ae6eebafac97739bd1196cdef