diff --git a/OptiScaler/OptiScaler.vcxproj b/OptiScaler/OptiScaler.vcxproj
index 17c50e69..7645a195 100644
--- a/OptiScaler/OptiScaler.vcxproj
+++ b/OptiScaler/OptiScaler.vcxproj
@@ -220,6 +220,7 @@ copy NUL "$(SolutionDir)x64\Release\a\!! EXTRACT ALL FILES TO GAME FOLDER !!" /Y
+
diff --git a/OptiScaler/OptiScaler.vcxproj.filters b/OptiScaler/OptiScaler.vcxproj.filters
index 3b19c982..1e3771bd 100644
--- a/OptiScaler/OptiScaler.vcxproj.filters
+++ b/OptiScaler/OptiScaler.vcxproj.filters
@@ -884,6 +884,9 @@
Header Files
+
+ Header Files
+
Header Files
diff --git a/OptiScaler/framegen/nvngx/IFGNvngx.h b/OptiScaler/framegen/nvngx/IFGNvngx.h
index 458fd7a6..876b1e55 100644
--- a/OptiScaler/framegen/nvngx/IFGNvngx.h
+++ b/OptiScaler/framegen/nvngx/IFGNvngx.h
@@ -24,6 +24,10 @@ class IFGNvngx
virtual bool isVulkanAvailable() = 0;
virtual feature_version extraVersion() { return {}; }; // extra version the provider may want to report
+ // Whether the provider takes the DLSSG.DispatchFlags of DLSS Enabler's frame generation: antighosting, HUD handling
+ // and debug views
+ virtual bool supportsDispatchFlags() { return false; }
+
// D3D12
virtual NVSDK_NGX_Result D3D12_Init(unsigned long long InApplicationId, const wchar_t* InApplicationDataPath,
ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo,
diff --git a/OptiScaler/framegen/nvngx/NvngxVkLayouts.h b/OptiScaler/framegen/nvngx/NvngxVkLayouts.h
new file mode 100644
index 00000000..e552dcf7
--- /dev/null
+++ b/OptiScaler/framegen/nvngx/NvngxVkLayouts.h
@@ -0,0 +1,89 @@
+#pragma once
+
+#include
+
+#include
+#include
+#include
+#include
+
+// Streamline and the DLSSG replacements sometimes transition an image from VK_IMAGE_LAYOUT_UNDEFINED while it still
+// holds a frame that is read next. RDNA2/3 reinitialize the DCC metadata on that and read the frame back as noise.
+// Such barriers start from the image's last seen layout instead.
+// Tracked images: the DLSSG parameters, plus anything barriered on the thread running the replacement's evaluate.
+class NvngxVkLayouts
+{
+ inline static std::unordered_map _layouts;
+ // ponytail: one global lock per barrier once DLSSG ran, shared_mutex or sharding if it shows in profiles
+ inline static std::mutex _mutex;
+ inline static std::atomic _active = false;
+
+ public:
+ inline static thread_local bool inEvaluate = false;
+
+ static void Track(VkImage image)
+ {
+ std::scoped_lock lock(_mutex);
+ _layouts.try_emplace(image, VK_IMAGE_LAYOUT_UNDEFINED);
+ _active = true;
+ }
+
+ // Handles get reused, a new image must not inherit the old one's layout
+ static void Forget(VkImage image)
+ {
+ if (!_active)
+ return;
+
+ std::scoped_lock lock(_mutex);
+ _layouts.erase(image);
+ }
+
+ // Returns barriers, or storage holding the fixed copies
+ template
+ static const Barrier* Fixup(const Barrier* barriers, uint32_t count, std::vector& storage)
+ {
+ if (barriers == nullptr || (!_active && !inEvaluate))
+ return barriers;
+
+ std::scoped_lock lock(_mutex);
+
+ if (inEvaluate)
+ _active = true;
+
+ for (uint32_t i = 0; i < count; i++)
+ {
+ auto it = inEvaluate ? _layouts.try_emplace(barriers[i].image, VK_IMAGE_LAYOUT_UNDEFINED).first
+ : _layouts.find(barriers[i].image);
+
+ if (it == _layouts.end())
+ continue;
+
+ if (barriers[i].oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && it->second != VK_IMAGE_LAYOUT_UNDEFINED)
+ {
+ LOG_TRACE("Image {:X}: UNDEFINED -> {} now starts from {}", (size_t) barriers[i].image,
+ (int) barriers[i].newLayout, (int) it->second);
+
+ if (storage.empty())
+ storage.assign(barriers, barriers + count);
+
+ storage[i].oldLayout = it->second;
+ }
+
+ it->second = barriers[i].newLayout;
+ }
+
+ return storage.empty() ? barriers : storage.data();
+ }
+
+ static const VkDependencyInfo* Fixup(const VkDependencyInfo* info, VkDependencyInfo& copy,
+ std::vector& storage)
+ {
+ if (info == nullptr ||
+ Fixup(info->pImageMemoryBarriers, info->imageMemoryBarrierCount, storage) == info->pImageMemoryBarriers)
+ return info;
+
+ copy = *info;
+ copy.pImageMemoryBarriers = storage.data();
+ return ©
+ }
+};
diff --git a/OptiScaler/framegen/nvngx/Nvngx_Arturs.cpp b/OptiScaler/framegen/nvngx/Nvngx_Arturs.cpp
index eeffd8a7..d522888e 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_Arturs.cpp
+++ b/OptiScaler/framegen/nvngx/Nvngx_Arturs.cpp
@@ -19,19 +19,13 @@ void Nvngx_Arturs::QueryVersions()
_version = tempVersion;
// Antighosting version
- NVNGX_Parameters tempParams(API::DX12, false);
+ QueryReportedParameters();
- if (_DLSSG_D3D12_PopulateParameters_Impl(&tempParams) == NVSDK_NGX_Result_Success)
- {
- auto result = tempParams.Get("FrameInterpolation.GhostbusterVersionMajor", &ghostbusterVersion.major);
- tempParams.Get("FrameInterpolation.GhostbusterVersionMinor", &ghostbusterVersion.minor);
-
- if (result != NVSDK_NGX_Result_Success)
- LOG_WARN("Couldn't query version");
- }
+ if (!Nvngx_DllProxy::supportsDispatchFlags())
+ LOG_WARN("Couldn't query version");
LOG_INFO("DE Ver: {}.{}.{}.{}, GB Ver: {}.{}", _version.major, _version.minor, _version.patch, _version.reserved,
- ghostbusterVersion.major, ghostbusterVersion.minor);
+ antighostingVersion.major, antighostingVersion.minor);
}
void Nvngx_Arturs::LoadLibraries()
@@ -62,6 +56,26 @@ void Nvngx_Arturs::LoadLibraries()
_DLSSG_D3D12_PopulateParameters_Impl =
(PFN_D3D12_PopulateParameters_Impl) GetProcAddress(dll, "DLSSG_NVSDK_NGX_D3D12_PopulateParameters_Impl");
+ _DLSSG_VULKAN_Init = (PFN_VULKAN_Init) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_Init");
+ _DLSSG_VULKAN_Init_Ext = (PFN_VULKAN_Init_Ext) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_Init_Ext");
+ _DLSSG_VULKAN_Init_Ext2 = (PFN_VULKAN_Init_Ext2) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_Init_Ext2");
+ _DLSSG_VULKAN_Shutdown = (PFN_VULKAN_Shutdown) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_Shutdown");
+ _DLSSG_VULKAN_Shutdown1 = (PFN_VULKAN_Shutdown1) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_Shutdown1");
+ _DLSSG_VULKAN_GetScratchBufferSize =
+ (PFN_VULKAN_GetScratchBufferSize) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_GetScratchBufferSize");
+ _DLSSG_VULKAN_CreateFeature =
+ (PFN_VULKAN_CreateFeature) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_CreateFeature");
+ _DLSSG_VULKAN_CreateFeature1 =
+ (PFN_VULKAN_CreateFeature1) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_CreateFeature1");
+ _DLSSG_VULKAN_ReleaseFeature =
+ (PFN_VULKAN_ReleaseFeature) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_ReleaseFeature");
+ _DLSSG_VULKAN_GetFeatureRequirements =
+ (PFN_VULKAN_GetFeatureRequirements) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_GetFeatureRequirements");
+ _DLSSG_VULKAN_EvaluateFeature =
+ (PFN_VULKAN_EvaluateFeature) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_EvaluateFeature");
+ _DLSSG_VULKAN_PopulateParameters_Impl =
+ (PFN_VULKAN_PopulateParameters_Impl) GetProcAddress(dll, "DLSSG_NVSDK_NGX_VULKAN_PopulateParameters_Impl");
+
QueryVersions();
LOG_INFO("Artur's initialized");
@@ -71,5 +85,3 @@ void Nvngx_Arturs::LoadLibraries()
LOG_WARN("Artur's enabled but cannot be loaded");
}
}
-
-feature_version Nvngx_Arturs::extraVersion() { return ghostbusterVersion; }
diff --git a/OptiScaler/framegen/nvngx/Nvngx_Arturs.h b/OptiScaler/framegen/nvngx/Nvngx_Arturs.h
index 140cbb5e..eaaa1453 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_Arturs.h
+++ b/OptiScaler/framegen/nvngx/Nvngx_Arturs.h
@@ -3,8 +3,6 @@
class Nvngx_Arturs : public Nvngx_DllProxy
{
- feature_version ghostbusterVersion {};
-
void QueryVersions();
protected:
@@ -15,5 +13,7 @@ class Nvngx_Arturs : public Nvngx_DllProxy
int getMaxFakeFramesCount() override { return 5; }
FGNvngxReplacement getType() override { return FGNvngxReplacement::Arturs; }
- feature_version extraVersion() override;
+
+ // DLSS Enabler's own, even when it doesn't report its antighosting version
+ bool supportsDispatchFlags() override { return true; }
};
diff --git a/OptiScaler/framegen/nvngx/Nvngx_Combo.h b/OptiScaler/framegen/nvngx/Nvngx_Combo.h
index 5431e857..e72ee12e 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_Combo.h
+++ b/OptiScaler/framegen/nvngx/Nvngx_Combo.h
@@ -68,4 +68,5 @@ class Nvngx_Combo : public IFGNvngx
FGNvngxReplacement getType() override { return FGNvngxReplacement::Combo; }
feature_version version() override;
feature_version extraVersion() override;
+ bool supportsDispatchFlags() override { return artursProvider->supportsDispatchFlags(); }
};
diff --git a/OptiScaler/framegen/nvngx/Nvngx_Custom.cpp b/OptiScaler/framegen/nvngx/Nvngx_Custom.cpp
index 3e8da64e..c59acdd5 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_Custom.cpp
+++ b/OptiScaler/framegen/nvngx/Nvngx_Custom.cpp
@@ -13,17 +13,11 @@ void Nvngx_Custom::LoadLibraries()
LoadNgxExports();
// Max fake frames are reported like DLSSG does, which only reports them once inited
- auto populate = _DLSSG_D3D12_PopulateParameters_Impl != nullptr
- ? _DLSSG_D3D12_PopulateParameters_Impl
- : (PFN_D3D12_PopulateParameters_Impl) _DLSSG_VULKAN_PopulateParameters_Impl;
- NVNGX_Parameters params(API::DX12, false);
- int countMax = 0;
+ QueryReportedParameters();
- if (populate != nullptr && populate(¶ms) == NVSDK_NGX_Result_Success &&
- params.Get("DLSSG.MultiFrameCountMax", &countMax) == NVSDK_NGX_Result_Success && countMax > 0)
- {
- _maxFakeFrames = countMax;
- }
-
- LOG_INFO("Custom DLSSG {} initialized, max fake frames: {}", _name, _maxFakeFrames);
+ if (!Nvngx_DllProxy::supportsDispatchFlags())
+ LOG_INFO("Custom DLSSG {} initialized, max fake frames: {}", _name, getMaxFakeFramesCount());
+ else
+ LOG_INFO("Custom DLSSG {} initialized, max fake frames: {}, antighosting version: {}.{}", _name,
+ getMaxFakeFramesCount(), antighostingVersion.major, antighostingVersion.minor);
}
diff --git a/OptiScaler/framegen/nvngx/Nvngx_Custom.h b/OptiScaler/framegen/nvngx/Nvngx_Custom.h
index 006e40bc..022e7f7d 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_Custom.h
+++ b/OptiScaler/framegen/nvngx/Nvngx_Custom.h
@@ -5,7 +5,6 @@
class Nvngx_Custom : public Nvngx_DllProxy
{
std::string _name;
- int _maxFakeFrames = 1;
protected:
void LoadLibraries() override final;
@@ -13,6 +12,6 @@ class Nvngx_Custom : public Nvngx_DllProxy
public:
explicit Nvngx_Custom(std::string name) : _name(std::move(name)) { LoadLibraries(); }
- int getMaxFakeFramesCount() override { return _maxFakeFrames; }
+ int getMaxFakeFramesCount() override { return reportedMaxFakeFrames > 0 ? reportedMaxFakeFrames : 1; }
FGNvngxReplacement getType() override { return FGNvngxReplacement::Custom; }
};
diff --git a/OptiScaler/framegen/nvngx/Nvngx_DllProxy.cpp b/OptiScaler/framegen/nvngx/Nvngx_DllProxy.cpp
index df51c11b..5bc5985f 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_DllProxy.cpp
+++ b/OptiScaler/framegen/nvngx/Nvngx_DllProxy.cpp
@@ -37,6 +37,37 @@ void Nvngx_DllProxy::LoadNgxExports()
(PFN_VULKAN_PopulateParameters_Impl) GetProcAddress(dll, "NVSDK_NGX_VULKAN_PopulateParameters_Impl");
}
+void Nvngx_DllProxy::QueryReportedParameters()
+{
+ // Both take the same parameters, which aren't tied to an API
+ auto populate = _DLSSG_D3D12_PopulateParameters_Impl != nullptr
+ ? _DLSSG_D3D12_PopulateParameters_Impl
+ : (PFN_D3D12_PopulateParameters_Impl) _DLSSG_VULKAN_PopulateParameters_Impl;
+ NVNGX_Parameters params(API::DX12, false);
+
+ if (populate == nullptr || populate(¶ms) != NVSDK_NGX_Result_Success)
+ return;
+
+ int countMax = 0;
+ if (params.Get("DLSSG.MultiFrameCountMax", &countMax) == NVSDK_NGX_Result_Success && countMax > 0)
+ reportedMaxFakeFrames = countMax;
+
+ if (params.Get("FrameInterpolation.GhostbusterVersionMajor", &antighostingVersion.major) ==
+ NVSDK_NGX_Result_Success)
+ {
+ params.Get("FrameInterpolation.GhostbusterVersionMinor", &antighostingVersion.minor);
+ }
+}
+
+void Nvngx_DllProxy::SetDispatchFlags(NVSDK_NGX_Parameter* InParameters)
+{
+ bool showDebug = Config::Instance()->NvngxFGShowDebug.value_or_default();
+ uint32_t flags = Config::Instance()->NvngxFGDispatchFlags.value_or_default();
+
+ InParameters->Set("DLSSG.ShowDebug", showDebug);
+ InParameters->Set("DLSSG.DispatchFlags", flags);
+}
+
NVSDK_NGX_Result Nvngx_DllProxy::D3D12_Init(unsigned long long InApplicationId, const wchar_t* InApplicationDataPath,
ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo,
NVSDK_NGX_Version InSDKVersion)
@@ -224,11 +255,7 @@ NVSDK_NGX_Result Nvngx_DllProxy::D3D12_EvaluateFeature(ID3D12GraphicsCommandList
DeferredRelease::Release(depthCopy[1]);
}
- bool showDebug = Config::Instance()->NvngxFGShowDebug.value_or_default();
- uint32_t flags = Config::Instance()->NvngxFGDispatchFlags.value_or_default();
-
- InParameters->Set("DLSSG.ShowDebug", showDebug);
- InParameters->Set("DLSSG.DispatchFlags", flags);
+ SetDispatchFlags(InParameters);
return _DLSSG_D3D12_EvaluateFeature(InCmdList, InFeatureHandle, InParameters, InCallback);
}
@@ -350,6 +377,8 @@ NVSDK_NGX_Result Nvngx_DllProxy::VULKAN_EvaluateFeature(VkCommandBuffer InCmdLis
{
if (isVulkanAvailable())
{
+ SetDispatchFlags(InParameters);
+
return _DLSSG_VULKAN_EvaluateFeature(InCmdList, InFeatureHandle, InParameters, InCallback);
}
diff --git a/OptiScaler/framegen/nvngx/Nvngx_DllProxy.h b/OptiScaler/framegen/nvngx/Nvngx_DllProxy.h
index 6e0070fa..8a392423 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_DllProxy.h
+++ b/OptiScaler/framegen/nvngx/Nvngx_DllProxy.h
@@ -34,10 +34,20 @@ class Nvngx_DllProxy : public IFGNvngx
PFN_VULKAN_EvaluateFeature _DLSSG_VULKAN_EvaluateFeature = nullptr;
PFN_VULKAN_PopulateParameters_Impl _DLSSG_VULKAN_PopulateParameters_Impl = nullptr;
+ // What PopulateParameters reports before init
+ int reportedMaxFakeFrames = 0;
+ feature_version antighostingVersion {};
+
virtual void LoadLibraries() = 0;
void LoadNgxExports();
+ // Fills reportedMaxFakeFrames and antighostingVersion from PopulateParameters, D3D12's or else Vulkan's
+ void QueryReportedParameters();
+
+ // DLSSG.ShowDebug and DLSSG.DispatchFlags from the config
+ static void SetDispatchFlags(NVSDK_NGX_Parameter* InParameters);
+
public:
Nvngx_DllProxy() = default;
~Nvngx_DllProxy()
@@ -52,6 +62,11 @@ class Nvngx_DllProxy : public IFGNvngx
bool isDx12Available() override final { return _DLSSG_D3D12_Init != nullptr; };
bool isVulkanAvailable() override final { return _DLSSG_VULKAN_Init != nullptr; };
+ // A provider reporting the antighosting (GhostBuster) version is DLSS Enabler's frame generation or passes its
+ // parameters through, so it takes DLSS Enabler's DLSSG.DispatchFlags
+ feature_version extraVersion() override { return antighostingVersion; }
+ bool supportsDispatchFlags() override { return antighostingVersion.major != 0 || antighostingVersion.minor != 0; }
+
// D3D12
NVSDK_NGX_Result D3D12_Init(unsigned long long InApplicationId, const wchar_t* InApplicationDataPath,
ID3D12Device* InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo,
diff --git a/OptiScaler/framegen/nvngx/Nvngx_FG.cpp b/OptiScaler/framegen/nvngx/Nvngx_FG.cpp
index 846c00bc..26e7121e 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_FG.cpp
+++ b/OptiScaler/framegen/nvngx/Nvngx_FG.cpp
@@ -12,6 +12,7 @@
#include "Nvngx_FFX.h"
#include "Nvngx_Combo.h"
#include "Nvngx_Custom.h"
+#include "NvngxVkLayouts.h"
#include
#include
@@ -189,6 +190,16 @@ feature_version Nvngx_FG::extraVersion()
return provider->extraVersion();
}
+bool Nvngx_FG::supportsDispatchFlags()
+{
+ auto* provider = getProvider();
+
+ if (!provider)
+ return false;
+
+ return provider->supportsDispatchFlags();
+}
+
void Nvngx_FG::setDebugView(bool enabled)
{
auto* provider = getProvider();
@@ -730,9 +741,37 @@ NVSDK_NGX_Result Nvngx_FG::VULKAN_EvaluateFeature(VkCommandBuffer InCmdList, con
if (Config::Instance()->NvngxFGDisableHudless.value_or_default())
InParameters->Set("DLSSG.HUDLess", (void*) nullptr);
+ static constexpr const char* trackedImages[] = {
+ "DLSSG.Backbuffer",
+ "DLSSG.MVecs",
+ "DLSSG.Depth",
+ "DLSSG.HUDLess",
+ "DLSSG.UI",
+ "DLSSG.UIAlpha",
+ "DLSSG.NoWarp",
+ "DLSSG.BidirectionalDistortionField",
+ "DLSSG.OutputInterpolated",
+ "DLSSG.OutputReal",
+ "DLSSG.OutputDisableInterpolation",
+ };
+
+ for (auto name : trackedImages)
+ {
+ NVSDK_NGX_Resource_VK* resource = nullptr;
+
+ if (InParameters->Get(name, (void**) &resource) == NVSDK_NGX_Result_Success && resource != nullptr &&
+ resource->Type == NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW)
+ {
+ NvngxVkLayouts::Track(resource->Resource.ImageViewInfo.Image);
+ }
+ }
+
// LOG_TRACE("Handle received from the game: {:X}", (uint64_t) InFeatureHandle);
- return provider->VULKAN_EvaluateFeature(InCmdList, ourHandle->nativeHandle, InParameters, InCallback);
+ NvngxVkLayouts::inEvaluate = true;
+ auto result = provider->VULKAN_EvaluateFeature(InCmdList, ourHandle->nativeHandle, InParameters, InCallback);
+ NvngxVkLayouts::inEvaluate = false;
+ return result;
}
NVSDK_NGX_Result Nvngx_FG::VULKAN_PopulateParameters_Impl(NVSDK_NGX_Parameter* InParameters)
diff --git a/OptiScaler/framegen/nvngx/Nvngx_FG.h b/OptiScaler/framegen/nvngx/Nvngx_FG.h
index 6432ad96..e2ab0db4 100644
--- a/OptiScaler/framegen/nvngx/Nvngx_FG.h
+++ b/OptiScaler/framegen/nvngx/Nvngx_FG.h
@@ -44,6 +44,7 @@ class Nvngx_FG
static bool isVulkanAvailable();
static feature_version version();
static feature_version extraVersion();
+ static bool supportsDispatchFlags();
// TODO: nukem-specific, unify
static void setDebugView(bool enabled);
diff --git a/OptiScaler/hooks/VulkanwDx12_Hooks.cpp b/OptiScaler/hooks/VulkanwDx12_Hooks.cpp
index b8db3065..374c0a65 100644
--- a/OptiScaler/hooks/VulkanwDx12_Hooks.cpp
+++ b/OptiScaler/hooks/VulkanwDx12_Hooks.cpp
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
static PFN_vkQueueSubmit o_vkQueueSubmit = nullptr;
static PFN_vkQueueSubmit2 o_vkQueueSubmit2 = nullptr;
@@ -33,6 +34,8 @@ static PFN_vkCreateCommandPool o_vkCreateCommandPool = nullptr;
static std::mutex mutexCommandPoolToQueueFamilyMap;
static std::unordered_map commandPoolToQueueFamilyMap;
+static PFN_vkDestroyImage o_vkDestroyImage = nullptr;
+
// #define LOG_ALL_RECORDS
#ifndef LOG_ALL_RECORDS
@@ -1056,6 +1059,9 @@ void Vulkan_wDx12::hk_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipe
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers)
{
+ std::vector fixedBarriers;
+ pImageMemoryBarriers = NvngxVkLayouts::Fixup(pImageMemoryBarriers, imageMemoryBarrierCount, fixedBarriers);
+
auto primaryGpu = IdentifyGpu::getPrimaryGpu();
if (State::Instance().gameQuirks & GameQuirk::VulkanDLSSBarrierFixup &&
(primaryGpu.vendorId != VendorId::Nvidia || !primaryGpu.dlssCapable))
@@ -1130,6 +1136,12 @@ void Vulkan_wDx12::hk_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipe
pImageMemoryBarriers);
}
+void Vulkan_wDx12::hk_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
+{
+ NvngxVkLayouts::Forget(image);
+ o_vkDestroyImage(device, image, pAllocator);
+}
+
void Vulkan_wDx12::hk_vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query,
VkQueryControlFlags flags)
{
@@ -1560,6 +1572,10 @@ void Vulkan_wDx12::hk_vkCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t e
void Vulkan_wDx12::hk_vkCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo)
{
+ std::vector fixedBarriers;
+ VkDependencyInfo fixedInfo;
+ pDependencyInfo = NvngxVkLayouts::Fixup(pDependencyInfo, fixedInfo, fixedBarriers);
+
VkCommandBuffer cmdBuffer = commandBuffer;
auto mappedVirtualCmdBuffer = GetVirtualCommandBuffer(cmdBuffer);
@@ -2778,6 +2794,10 @@ void Vulkan_wDx12::hk_vkCmdWaitEvents2KHR(VkCommandBuffer commandBuffer, uint32_
void Vulkan_wDx12::hk_vkCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo)
{
+ std::vector fixedBarriers;
+ VkDependencyInfo fixedInfo;
+ pDependencyInfo = NvngxVkLayouts::Fixup(pDependencyInfo, fixedInfo, fixedBarriers);
+
VkCommandBuffer cmdBuffer = commandBuffer;
auto mappedVirtualCmdBuffer = GetVirtualCommandBuffer(cmdBuffer);
@@ -7447,6 +7467,13 @@ PFN_vkVoidFunction Vulkan_wDx12::GetAddress(const PFN_vkVoidFunction original, c
return (PFN_vkVoidFunction) hk_vkCmdWaitEvents;
}
+ if (procName == std::string("vkDestroyImage"))
+ {
+ if (o_vkDestroyImage == nullptr)
+ o_vkDestroyImage = (PFN_vkDestroyImage) original;
+
+ return (PFN_vkVoidFunction) hk_vkDestroyImage;
+ }
if (procName == std::string("vkCmdPipelineBarrier"))
{
// LOG_DEBUG("vkCmdPipelineBarrier");
@@ -9637,6 +9664,7 @@ void Vulkan_wDx12::Hook(HMODULE vulkanModule)
o_vkCmdResetEvent = (PFN_vkCmdResetEvent) DetouredExport(vulkanModule, "vkCmdResetEvent");
o_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) DetouredExport(vulkanModule, "vkCmdWaitEvents");
o_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) DetouredExport(vulkanModule, "vkCmdPipelineBarrier");
+ o_vkDestroyImage = (PFN_vkDestroyImage) DetouredExport(vulkanModule, "vkDestroyImage");
o_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) DetouredExport(vulkanModule, "vkCmdBeginQuery");
o_vkCmdEndQuery = (PFN_vkCmdEndQuery) DetouredExport(vulkanModule, "vkCmdEndQuery");
o_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) DetouredExport(vulkanModule, "vkCmdResetQueryPool");
@@ -10170,6 +10198,9 @@ void Vulkan_wDx12::Hook(HMODULE vulkanModule)
if (o_vkCmdPipelineBarrier)
DetourAttach(&(PVOID&) o_vkCmdPipelineBarrier, hk_vkCmdPipelineBarrier);
+ if (o_vkDestroyImage)
+ DetourAttach(&(PVOID&) o_vkDestroyImage, hk_vkDestroyImage);
+
if (o_vkCmdBeginQuery)
DetourAttach(&(PVOID&) o_vkCmdBeginQuery, hk_vkCmdBeginQuery);
diff --git a/OptiScaler/hooks/VulkanwDx12_Hooks.h b/OptiScaler/hooks/VulkanwDx12_Hooks.h
index abd28e8a..c3a88384 100644
--- a/OptiScaler/hooks/VulkanwDx12_Hooks.h
+++ b/OptiScaler/hooks/VulkanwDx12_Hooks.h
@@ -154,6 +154,7 @@ class Vulkan_wDx12
const VkBufferMemoryBarrier* pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers);
+ static void hk_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
static void hk_vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query,
VkQueryControlFlags flags);
static void hk_vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query);
@@ -655,6 +656,7 @@ class Vulkan_wDx12
VALIDATE_MEMBER_HOOK(hk_vkCmdResetEvent, PFN_vkCmdResetEvent)
VALIDATE_MEMBER_HOOK(hk_vkCmdWaitEvents, PFN_vkCmdWaitEvents)
VALIDATE_MEMBER_HOOK(hk_vkCmdPipelineBarrier, PFN_vkCmdPipelineBarrier)
+ VALIDATE_MEMBER_HOOK(hk_vkDestroyImage, PFN_vkDestroyImage)
VALIDATE_MEMBER_HOOK(hk_vkCmdBeginQuery, PFN_vkCmdBeginQuery)
VALIDATE_MEMBER_HOOK(hk_vkCmdEndQuery, PFN_vkCmdEndQuery)
VALIDATE_MEMBER_HOOK(hk_vkCmdResetQueryPool, PFN_vkCmdResetQueryPool)
diff --git a/OptiScaler/menu/menu_common.cpp b/OptiScaler/menu/menu_common.cpp
index a24cc5ee..701625f6 100644
--- a/OptiScaler/menu/menu_common.cpp
+++ b/OptiScaler/menu/menu_common.cpp
@@ -6350,12 +6350,21 @@ void MenuCommon::RenderFrameGenerationRuntimeSettings(RenderMenuContext& ctx)
if (isLoaded)
{
- if (activeNvngxFg == FGNvngxReplacement::Arturs || activeNvngxFg == FGNvngxReplacement::Combo)
+ // DLSS Enabler's own, or any custom provider reporting its antighosting version
+ if (Nvngx_FG::supportsDispatchFlags())
{
- auto featureVer = Nvngx_FG::version();
auto antighostingVer = Nvngx_FG::extraVersion();
- ImGui::Text("DE Ver: %d.%d.%d.%d GB Ver: %d.%d", featureVer.major, featureVer.minor, featureVer.patch,
- featureVer.reserved, antighostingVer.major, antighostingVer.minor);
+
+ if (activeNvngxFg == FGNvngxReplacement::Arturs || activeNvngxFg == FGNvngxReplacement::Combo)
+ {
+ auto featureVer = Nvngx_FG::version();
+ ImGui::Text("DE Ver: %d.%d.%d.%d GB Ver: %d.%d", featureVer.major, featureVer.minor,
+ featureVer.patch, featureVer.reserved, antighostingVer.major, antighostingVer.minor);
+ }
+ else
+ {
+ ImGui::Text("GB Ver: %d.%d", antighostingVer.major, antighostingVer.minor);
+ }
static std::vector common_flags = {
{ "Antighosting (GB)", 0x00100000, "Enable anti-ghosting correction" },