diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-11-03 21:58:24 +0100 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-11-03 21:58:24 +0100 |
| commit | cdfb1ae93444c0aa02dfe592af36d70ab36549fd (patch) | |
| tree | 2fa8d7062d907d5ab8d85d64c66be87ea4cdf0d1 /src/video_core/vulkan_common/vulkan_device.cpp | |
| parent | 51341ec09b25de1d9b01d0c00ee828dd5b861d5c (diff) | |
| parent | 4383b9787afbf6c63291bf803c8330afb4f21a16 (diff) | |
# Conflicts:
# .github/workflows/release-binaries.yml
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 |
