Made XeFG Depth Invert global for all inputs

This commit is contained in:
cdozdil
2025-10-12 20:57:51 +03:00
parent 4c1583c49e
commit 799d8b88ca
4 changed files with 38 additions and 39 deletions
+2 -1
View File
@@ -162,7 +162,8 @@ void IFGFeature_Dx12::FlipResource(Dx12Resource* resource)
if (flip->get()->IsInit())
{
auto result = flip->get()->Dispatch(_device, (ID3D12GraphicsCommandList*) resource->cmdList, resource->resource,
auto cmdList = (resource->cmdList != nullptr) ? resource->cmdList : GetUICommandList(fIndex);
auto result = flip->get()->Dispatch(_device, (ID3D12GraphicsCommandList*) cmdList, resource->resource,
flipOutput, resource->width, resource->height, true);
if (result)
+32 -6
View File
@@ -244,9 +244,9 @@ bool XeFG_Dx12::CreateSwapchain(IDXGIFactory* factory, ID3D12CommandQueue* cmdQu
params.initFlags = XEFG_SWAPCHAIN_INIT_FLAG_NONE;
if (State::Instance().activeFgInput != FGInput::Upscaler &&
Config::Instance()->FGXeFGDepthInverted.value_or_default())
params.initFlags |= XEFG_SWAPCHAIN_INIT_FLAG_INVERTED_DEPTH;
// if (State::Instance().activeFgInput != FGInput::Upscaler &&
// Config::Instance()->FGXeFGDepthInverted.value_or_default())
// params.initFlags |= XEFG_SWAPCHAIN_INIT_FLAG_INVERTED_DEPTH;
if (Config::Instance()->FGXeFGJitteredMV.value_or_default())
params.initFlags |= XEFG_SWAPCHAIN_INIT_FLAG_JITTERED_MV;
@@ -336,9 +336,9 @@ bool XeFG_Dx12::CreateSwapchain1(IDXGIFactory* factory, ID3D12CommandQueue* cmdQ
params.initFlags = XEFG_SWAPCHAIN_INIT_FLAG_NONE;
if (State::Instance().activeFgInput != FGInput::Upscaler &&
Config::Instance()->FGXeFGDepthInverted.value_or_default())
params.initFlags |= XEFG_SWAPCHAIN_INIT_FLAG_INVERTED_DEPTH;
// if (State::Instance().activeFgInput != FGInput::Upscaler &&
// Config::Instance()->FGXeFGDepthInverted.value_or_default())
// params.initFlags |= XEFG_SWAPCHAIN_INIT_FLAG_INVERTED_DEPTH;
if (Config::Instance()->FGXeFGJitteredMV.value_or_default())
params.initFlags |= XEFG_SWAPCHAIN_INIT_FLAG_JITTERED_MV;
@@ -869,6 +869,32 @@ void XeFG_Dx12::SetResource(Dx12Resource* inputResource)
FlipResource(fResource);
}
if (type == FG_ResourceType::Depth && !Config::Instance()->FGXeFGDepthInverted.value_or_default())
{
if (_depthInvert.get() == nullptr)
{
_depthInvert = std::make_unique<DI_Dx12>("DepthInvert", _device);
}
else if (_depthInvert->IsInit())
{
if (_depthInvert->CreateBufferResource(_device, fResource->GetResource(), fResource->width,
fResource->height, fResource->state) &&
_depthInvert->Buffer() != nullptr)
{
auto cmdList = (fResource->cmdList != nullptr) ? fResource->cmdList : GetUICommandList(fIndex);
_depthInvert->SetBufferState(cmdList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
if (_depthInvert->Dispatch(_device, cmdList, fResource->GetResource(), _depthInvert->Buffer()))
{
fResource->copy = _depthInvert->Buffer();
}
_depthInvert->SetBufferState(cmdList, fResource->state);
}
}
}
// We usually don't copy any resources for XeFG, the ones with this tag are the exception
if (inputResource->cmdList != nullptr && fResource->validity == FG_ResourceValidity::ValidButMakeCopy)
{
+4
View File
@@ -5,6 +5,8 @@
#include <proxies/XeLL_Proxy.h>
#include <proxies/XeFG_Proxy.h>
#include "shaders/depth_invert/DI_Dx12.h"
#include <xell.h>
#include <xell_d3d12.h>
#include <xefg_swapchain.h>
@@ -22,6 +24,8 @@ class XeFG_Dx12 : public virtual IFGFeature_Dx12
bool _infiniteDepth = false;
UINT64 _reEnableTargetFrame = 0;
std::unique_ptr<DI_Dx12> _depthInvert;
static void xefgLogCallback(const char* message, xefg_swapchain_logging_level_t level, void* userData);
bool CreateSwapchainContext(ID3D12Device* device);
@@ -4,10 +4,8 @@
#include <resource_tracking/ResTrack_dx12.h>
#include "shaders/depth_scale/DS_Dx12.h"
#include "shaders/depth_invert/DI_Dx12.h"
static DS_Dx12* DepthScale = nullptr;
static DI_Dx12* DepthInvert = nullptr;
void UpscalerInputsDx12::Init(ID3D12Device* device)
{
@@ -214,36 +212,6 @@ void UpscalerInputsDx12::UpscaleStart(ID3D12GraphicsCommandList* InCmdList, NVSD
}
}
}
else if (State::Instance().activeFgOutput == FGOutput::XeFG &&
!Config::Instance()->FGXeFGDepthInverted.value_or_default())
{
if (DepthInvert == nullptr)
DepthInvert = new DI_Dx12("Depth Invert", _device);
if (DepthInvert->CreateBufferResource(_device, paramDepth, feature->DisplayWidth(),
feature->DisplayHeight(),
D3D12_RESOURCE_STATE_UNORDERED_ACCESS) &&
DepthInvert->Buffer() != nullptr)
{
DepthInvert->SetBufferState(InCmdList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
if (DepthInvert->Dispatch(_device, InCmdList, paramDepth, DepthInvert->Buffer()))
{
Dx12Resource setResource {};
setResource.type = FG_ResourceType::Depth;
setResource.cmdList = commandList;
setResource.resource = DepthInvert->Buffer();
setResource.width = feature->RenderWidth();
setResource.height = feature->RenderHeight();
setResource.state = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
setResource.validity = FG_ResourceValidity::JustTrackCmdlist;
fg->SetResource(&setResource);
done = true;
}
}
}
if (!done)
{