-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vulkan Reflex support #237
base: master
Are you sure you want to change the base?
Conversation
ec73e4f
to
ded553e
Compare
Okay, I think this is now ready for initial round of review. Still has some hacks but I have no idea how to rid of them. And I'll try to test this version again with various games I happen to have installed, for now I know that at least vk_streamline sample works with this. Feel free to ask about strange stuff in there; I lived with a variant of this code for months so I might have got used to the weirdness. |
Tested with Enshrouded, Portal RTX and Portal Prelude RTX, appears to work fine with them. Still no idea how to convince No Man's Sky and Indiana Jones and the Great Circle to let me activate Reflex. Remaining titles that would be nice to have tested (that I know of):
|
I figured out the problem NMS and Indy had: Streamline was thinking that
|
Thanks for the PR! Cool to have Vulkan Reflex. I did a first pass on the nvapi side of things for some initial thoughts. The gist is more or less that it would be nice to integrate more with the existing structure:
|
Impressive find. Probably a good idea to log only once per invalid marker type (also on the D3D side). |
I actually tried that first, only to be told to go away with my nonsense by Meson:
I think |
ah yeah, it is exactly this... I remember hitting this when playing with |
Sorry to ask here, but does the latest patch, and/or Indiana update2 fix proton black screen with dlss3 frame gen? Or is at least a step in the right direction? |
It does not. For now you should assume that any game with Vulkan renderer that isn't Portal RTX won't have DLSS Frame Generation function correctly. Indy is a bit more of a special case because it's trying to use VK-CUDA interop for DLFG, we are investigating this here: SveSop/nvcuda#9 |
@Saancreed thanks for keeping me up to date.. will follow that thread |
6a4feb9
to
bc9ac84
Compare
Pushed new version, but with changes (when compared to previous revision) as fixup commits, to hopefully make reviewing them easier. Now to figure out what Proton's mingw wants me to do to make it happy… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the rework of the nvapi
side. See comments for a few last thoughts. It would also be nice to have some tests covering the basics, but I'm fine to do this in a separate PR (but we shouldn't forget since everything is in place now for that).
Looking at the layer, some initial thoughts:
|
2ac8f12
to
5687a8b
Compare
LGTM wrt the NVAPI side. Suggested change for avoiding a nullptr check for the resource factory (because that already happens in Diffdiff --git a/src/nvapi/nvapi_vulkan_low_latency_device.cpp b/src/nvapi/nvapi_vulkan_low_latency_device.cpp
index 7472aac..f53e434 100644
--- a/src/nvapi/nvapi_vulkan_low_latency_device.cpp
+++ b/src/nvapi/nvapi_vulkan_low_latency_device.cpp
@@ -5,21 +5,18 @@ namespace dxvk {
std::unordered_map<VkDevice, NvapiVulkanLowLatencyDevice> NvapiVulkanLowLatencyDevice::m_lowLatencyDeviceMap = {};
std::mutex NvapiVulkanLowLatencyDevice::m_mutex = {};
- bool NvapiVulkanLowLatencyDevice::TryInitialize(ResourceFactory* resourceFactory) {
+ bool NvapiVulkanLowLatencyDevice::Initialize(ResourceFactory& resourceFactory) {
std::scoped_lock lock{m_mutex};
if (m_vk && m_vk->IsAvailable())
return true;
- if (resourceFactory == nullptr)
- return false;
-
- m_vk = resourceFactory->CreateVulkan("vulkan-1.dll");
+ m_vk = resourceFactory.CreateVulkan("vulkan-1.dll");
if (m_vk && m_vk->IsAvailable())
return true;
- m_vk = resourceFactory->CreateVulkan("winevulkan.dll");
+ m_vk = resourceFactory.CreateVulkan("winevulkan.dll");
return m_vk && m_vk->IsAvailable();
}
diff --git a/src/nvapi/nvapi_vulkan_low_latency_device.h b/src/nvapi/nvapi_vulkan_low_latency_device.h
index fbeb9f8..55b086d 100644
--- a/src/nvapi/nvapi_vulkan_low_latency_device.h
+++ b/src/nvapi/nvapi_vulkan_low_latency_device.h
@@ -6,7 +6,7 @@
namespace dxvk {
class NvapiVulkanLowLatencyDevice {
public:
- static bool TryInitialize(ResourceFactory* resourceFactory);
+ static bool Initialize(ResourceFactory& resourceFactory);
[[nodiscard]] static std::pair<NvapiVulkanLowLatencyDevice*, VkResult> GetOrCreate(VkDevice device);
[[nodiscard]] static NvapiVulkanLowLatencyDevice* Get(VkDevice device);
diff --git a/src/nvapi_vulkan.cpp b/src/nvapi_vulkan.cpp
index 74ff113..43449be 100644
--- a/src/nvapi_vulkan.cpp
+++ b/src/nvapi_vulkan.cpp
@@ -16,7 +16,7 @@ extern "C" {
return ApiNotInitialized(n);
static std::once_flag initialized{};
- std::call_once(initialized, []() { NvapiVulkanLowLatencyDevice::TryInitialize(resourceFactory.get()); });
+ std::call_once(initialized, []() { NvapiVulkanLowLatencyDevice::Initialize(*resourceFactory); });
auto device = reinterpret_cast<VkDevice>(vkDevice);
auto semaphore = reinterpret_cast<VkSemaphore*>(signalSemaphoreHandle); |
Weird, when I initially tried passing as reference clangd complained about binding to temporary value. But your version works so I applied it, thanks. |
I've played with the current version with RDR2 and seems to work nicely (according to the logs, my reflexes wont feel the difference ;)). Also the layer setup is really simple now by just pointing As (partially) discussed:
|
I'd prefer to keep it disabled by default, even if manual setup is required to set it up. I don't trust myself that it won't interfere with other stuff just yet, and once installed it would activate it in other games for no reason.
I kind of like having it separate.
Right, will do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the readme additions. See some minor suggestions.
Once the remaining fixup commits are squashed, this PR LGTM!
I also added a notice about potential glibc version mismatches because our CI is running on Arch, so less surprises for Ubuntu users is probably a good idea 🐧 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 typos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I don't want to rename vkNegotiateLoaderLayerInterfaceVersion just to workaround one compiler's nonsense.
Implemented via both
NvAPI_Vulkan_*
entrypoints and corresponding Linux-side Vulkan layer.Closes #166.