mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-29 01:26:33 +00:00
Improved XeFG Hudless state schanges
This commit is contained in:
@@ -68,7 +68,14 @@ bool IFGFeature::IsUsingUIAny()
|
||||
return false;
|
||||
}
|
||||
bool IFGFeature::IsUsingDistortionField() { return !_noDistortionField[GetIndex()]; }
|
||||
bool IFGFeature::IsUsingHudless() { return !_noHudless[GetIndex()]; }
|
||||
bool IFGFeature::IsUsingHudless(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
index = GetIndex();
|
||||
|
||||
return !_noHudless[index];
|
||||
}
|
||||
|
||||
bool IFGFeature::IsUsingHudlessAny()
|
||||
{
|
||||
for (const auto& value : _noHudless)
|
||||
|
||||
@@ -111,7 +111,7 @@ class IFGFeature
|
||||
bool IsUsingUI();
|
||||
bool IsUsingUIAny(); // Same as IsUsingUI but checks if at least once buffer has UI
|
||||
bool IsUsingDistortionField();
|
||||
bool IsUsingHudless();
|
||||
bool IsUsingHudless(int index = -1);
|
||||
bool IsUsingHudlessAny();
|
||||
|
||||
void SetExecuted(int index = -1);
|
||||
|
||||
@@ -471,6 +471,27 @@ bool XeFG_Dx12::Dispatch()
|
||||
|
||||
LOG_DEBUG("_frameCount: {}, _willDispatchFrame: {}, fIndex: {}", _frameCount, _willDispatchFrame, fIndex);
|
||||
|
||||
if (!_haveHudless.has_value())
|
||||
{
|
||||
_haveHudless = IsUsingHudless(fIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto usingHudless = IsUsingHudless(fIndex);
|
||||
if (_haveHudless.value() != usingHudless)
|
||||
{
|
||||
LOG_INFO("Hudless state changed {} -> {}, skipping rendering for 10 frames", usingHudless,
|
||||
_haveHudless.value());
|
||||
|
||||
_haveHudless = usingHudless;
|
||||
State::Instance().FGchanged = true;
|
||||
UpdateTarget();
|
||||
Deactivate();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_resourceReady[fIndex].contains(FG_ResourceType::Depth) ||
|
||||
!_resourceReady[fIndex].at(FG_ResourceType::Depth) ||
|
||||
!_resourceReady[fIndex].contains(FG_ResourceType::Velocity) ||
|
||||
@@ -892,20 +913,23 @@ void XeFG_Dx12::SetResource(Dx12Resource* inputResource)
|
||||
else if (type == FG_ResourceType::Distortion)
|
||||
_noDistortionField[fIndex] = false;
|
||||
else if (type == FG_ResourceType::HudlessColor)
|
||||
{
|
||||
_noHudless[fIndex] = false;
|
||||
|
||||
// HACK: Prevent FG dispatch from being called for a few frames
|
||||
// Seems like XeFG doesn't like having hudless suddenly started to be tagged
|
||||
// and then be required to use it right away
|
||||
if (lastHudlessFrameId == UINT64_MAX || lastHudlessFrameId + 2 < _frameCount)
|
||||
{
|
||||
if (XeFGProxy::SetEnabled()(_swapChainContext, false) == XEFG_SWAPCHAIN_RESULT_SUCCESS)
|
||||
_reEnableTargetFrame = _frameCount + 5;
|
||||
}
|
||||
// else if (type == FG_ResourceType::HudlessColor)
|
||||
//{
|
||||
// _noHudless[fIndex] = false;
|
||||
|
||||
lastHudlessFrameId = _frameCount;
|
||||
}
|
||||
// // HACK: Prevent FG dispatch from being called for a few frames
|
||||
// // Seems like XeFG doesn't like having hudless suddenly started to be tagged
|
||||
// // and then be required to use it right away
|
||||
// if (lastHudlessFrameId == UINT64_MAX || lastHudlessFrameId + 2 < _frameCount)
|
||||
// {
|
||||
// if (XeFGProxy::SetEnabled()(_swapChainContext, false) == XEFG_SWAPCHAIN_RESULT_SUCCESS)
|
||||
// _reEnableTargetFrame = _frameCount + 5;
|
||||
// }
|
||||
|
||||
// lastHudlessFrameId = _frameCount;
|
||||
//}
|
||||
|
||||
fResource->validity = (fResource->validity != FG_ResourceValidity::ValidNow || willFlip)
|
||||
? FG_ResourceValidity::UntilPresent
|
||||
|
||||
@@ -21,6 +21,7 @@ class XeFG_Dx12 : public virtual IFGFeature_Dx12
|
||||
uint32_t _height = 0;
|
||||
bool _infiniteDepth = false;
|
||||
UINT64 _reEnableTargetFrame = 0;
|
||||
std::optional<bool> _haveHudless = std::nullopt;
|
||||
|
||||
static void xefgLogCallback(const char* message, xefg_swapchain_logging_level_t level, void* userData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user