diff options
| author | Duck <350528965+Duck912@users.noreply.github.com> | 2026-11-03 15:44:36 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-03 15:44:36 -0500 |
| commit | 05e3b9d8b08414d3163cde36de61514cb4aa2400 (patch) | |
| tree | 499efe72b68afd9e1741e5c1331adce7b6ee8ecc /src/video_core/vulkan_common/vulkan_device.cpp | |
| parent | f347ae083af5595083a5706ff857462ed8c11596 (diff) | |
| parent | 1889602c7a0dc17850692594eae2e77e16ac13fc (diff) | |
Merge pull request #434 from Duck912/streamline-dlss
video_core: NVIDIA DLSS through NVIDIA Streamline in place of a game's DLSS
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 01e13cb384..2499f46f87 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -32,6 +32,9 @@ #include "video_core/vulkan_common/vulkan_device.h" #include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/gpu_logging/gpu_logging.h" +#ifdef EGLANTINE_STREAMLINE +#include "video_core/vulkan_common/streamline.h" +#endif #if defined(__ANDROID__) && defined(ARCHITECTURE_arm64) #include <adrenotools/bcenabler.h> @@ -743,6 +746,15 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR RemoveExtensionFeature(extensions.descriptor_buffer, features.descriptor_buffer, VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME); } +#ifdef EGLANTINE_STREAMLINE + // NVIDIA's DLSS needs buffer device addresses: keep the feature enabled for + // it, but leave Eglantine's own buffers as they are without descriptor buffers. + const bool dlss_wants_device_address = + streamline_extensions && features.buffer_device_address.bufferDeviceAddress; + if (!extensions.descriptor_buffer && dlss_wants_device_address) { + extensions.buffer_device_address = false; + } else +#endif if (!extensions.descriptor_buffer) { RemoveExtensionFeature(extensions.buffer_device_address, features.buffer_device_address, VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME); @@ -753,6 +765,15 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR graphics_queue = logical.GetQueue(graphics_family); present_queue = logical.GetQueue(present_family); +#ifdef EGLANTINE_STREAMLINE + if (streamline_extensions) { + streamline_attached = + Streamline::AttachDevice(instance, physical, *logical, graphics_family, dld); + } else if (Streamline::WantsDevice()) { + Streamline::Stop(); + } +#endif + VmaVulkanFunctions functions{}; functions.vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr; functions.vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr; @@ -806,6 +827,11 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR } Device::~Device() { +#ifdef EGLANTINE_STREAMLINE + if (streamline_attached) { + Streamline::Stop(); + } +#endif SaveStaticPipelineCache(); ShutdownGPULogging(); for (auto& pools : separate_pools) { @@ -1123,6 +1149,26 @@ bool Device::GetSuitability(bool requires_swapchain) { extensions.robustness_2 = false; } +#ifdef EGLANTINE_STREAMLINE + // The extensions NVIDIA's DLSS asks for, where the device has them all. + if (Streamline::WantsDevice()) { + const std::vector<std::string> wanted = Streamline::DeviceExtensions(); + // Streamline may ask for no extensions at all. + const bool all = std::ranges::all_of( + wanted, [&](const std::string& name) { return supported_extensions.contains(name); }); + std::string names; + for (const std::string& name : wanted) { + if (all) { + loaded_extensions.insert(name); + } + names += (names.empty() ? "" : ", ") + name; + } + streamline_extensions = all; + LOG_INFO(Render_Vulkan, "NVIDIA DLSS device extensions: {} ({})", + all ? "enabled" : "unavailable", names.empty() ? "none" : names); + } +#endif + #undef FEATURE_EXTENSION #undef EXTENSION |
