18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 12:05:01 +01:00

Add DLSS Frame Generation (gfx.framegeneration x2/x3/x4) and Reflex (gfx.reflex) to the Vulkan renderer

This commit is contained in:
2026-10-25 20:52:12 +01:00
parent 1841e6d7b0
commit a6bdeeaa2b
23 changed files with 1474 additions and 85 deletions

View File

@@ -72,7 +72,7 @@ endif()
option(WITH_OPENGL_MODERN "Compile with OpenGL modern renderer" ON)
option(WITH_VULKAN "Compile with the Vulkan 1.4 renderer (gfxrenderer vulkan); needs the submodules ref/volk and ref/Vulkan-Headers" ON)
option(WITH_DLSS "Compile the Vulkan renderer with NVIDIA DLSS (gfx.antialiasing dlss); needs the DLSS SDK in DLSS_SDK_ROOT, cmake -P tools/fetch_dlss_sdk.cmake" ON)
option(WITH_DLSS "Compile the Vulkan renderer with NVIDIA DLSS (gfx.antialiasing dlss); needs the DLSS SDK in DLSS_SDK_ROOT, cmake -P tools/fetch_dlss_sdk.cmake" OFF)
option(WITH_PYTHON "Python 3.14 embedded scripting" ON)
option(WITH_UART "Compile with libserialport" ON)
option(WITH_LUA "Compile with lua scripting support" ON)
@@ -469,7 +469,8 @@ if (WITH_VULKAN)
set(DEFINITIONS ${DEFINITIONS} "WITH_VULKAN")
# nvidia dlss of the vulkan renderer, from the dlss sdk (github.com/NVIDIA/DLSS) outside the repository: the headers and the
# static library of ngx to build with, the dlss library next to the program to run with (rendering/vulkan14/vulkan14dlss.h)
# static library of ngx to build with, the dlss library next to the program to run with (rendering/vulkan14/vulkan14dlss.h), and the
# one of its frame generation (gfx.framegeneration) where the sdk has it
if (WITH_DLSS)
set(DLSS_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/ref/DLSS" CACHE PATH "The NVIDIA DLSS SDK, with include/ and lib/ (cmake -P tools/fetch_dlss_sdk.cmake)")
if (NOT EXISTS "${DLSS_SDK_ROOT}/include/nvsdk_ngx_helpers_vk.h")
@@ -491,11 +492,13 @@ if (WITH_VULKAN)
set(DLSS_NGX_LIBRARY "$<IF:$<CONFIG:Debug>,${DLSS_NGX_DIR}/nvsdk_ngx_d_dbg.lib,${DLSS_NGX_DIR}/nvsdk_ngx_d.lib>")
set(DLSS_NGX_CHECK "${DLSS_NGX_DIR}/nvsdk_ngx_d.lib")
set(DLSS_RUNTIME_PATTERN "nvngx_dlss.dll")
set(DLSSG_RUNTIME_PATTERN "nvngx_dlssg.dll")
set(DLSS_RUNTIME_DIR "${DLSS_SDK_ROOT}/lib/Windows_${DLSS_ARCH}")
elseif (UNIX AND NOT APPLE)
set(DLSS_NGX_LIBRARY "${DLSS_SDK_ROOT}/lib/Linux_${DLSS_ARCH}/libnvsdk_ngx.a")
set(DLSS_NGX_CHECK "${DLSS_NGX_LIBRARY}")
set(DLSS_RUNTIME_PATTERN "libnvidia-ngx-dlss.so.*")
set(DLSSG_RUNTIME_PATTERN "libnvidia-ngx-dlssg.so.*")
set(DLSS_RUNTIME_DIR "${DLSS_SDK_ROOT}/lib/Linux_${DLSS_ARCH}")
else()
message(FATAL_ERROR "WITH_DLSS=ON: the DLSS SDK has no libraries for this platform")
@@ -508,6 +511,14 @@ if (WITH_VULKAN)
if (NOT DLSS_RUNTIME_RELEASE)
message(WARNING "WITH_DLSS=ON: no ${DLSS_RUNTIME_PATTERN} in ${DLSS_RUNTIME_DIR}/rel, it has to be put next to the program by hand")
endif()
file(GLOB DLSSG_RUNTIME_RELEASE "${DLSS_RUNTIME_DIR}/rel/${DLSSG_RUNTIME_PATTERN}")
file(GLOB DLSSG_RUNTIME_DEVELOPMENT "${DLSS_RUNTIME_DIR}/dev/${DLSSG_RUNTIME_PATTERN}")
if (DLSSG_RUNTIME_RELEASE)
list(APPEND DLSS_RUNTIME_RELEASE ${DLSSG_RUNTIME_RELEASE})
else()
message(STATUS "WITH_DLSS=ON: no ${DLSSG_RUNTIME_PATTERN} in ${DLSS_RUNTIME_DIR}/rel, the frame generation (gfx.framegeneration) needs it next to the program")
endif()
list(APPEND DLSS_RUNTIME_DEVELOPMENT ${DLSSG_RUNTIME_DEVELOPMENT})
# the sdk is seen by vulkan14dlss.cpp only; the rest of the renderer asks vk14::dlss::compiled()
set_source_files_properties("rendering/vulkan14/vulkan14dlss.cpp" PROPERTIES COMPILE_DEFINITIONS "WITH_DLSS" SKIP_PRECOMPILE_HEADERS ON)
endif()