Improve logging

This commit is contained in:
FakeMichau
2024-09-16 00:46:24 +02:00
parent 67ac3a3cb1
commit 303c45f321
2 changed files with 33 additions and 9 deletions
+12 -3
View File
@@ -329,7 +329,16 @@ namespace nvd {
}
NvAPI_Status __cdecl NvAPI_D3D_SetSleepMode(IUnknown* pDevice, NV_SET_SLEEP_MODE_PARAMS* pSetSleepModeParams) {
lowlatency_ctx.active = pSetSleepModeParams->bLowLatencyMode;
static bool previous_boost = false;
if (lowlatency_ctx.active != pSetSleepModeParams->bLowLatencyMode || previous_boost != pSetSleepModeParams->bLowLatencyBoost) {
spdlog::info(
"Changed reflex settings to: {}, boost: {}",
pSetSleepModeParams->bLowLatencyMode ? "enabled" : "disabled",
pSetSleepModeParams->bLowLatencyBoost ? "enabled" : "disabled"
);
lowlatency_ctx.active = pSetSleepModeParams->bLowLatencyMode;
previous_boost = pSetSleepModeParams->bLowLatencyBoost;
}
lowlatency_ctx.set_min_interval_us(pSetSleepModeParams->minimumIntervalUs);
return Ok();
}
@@ -354,7 +363,7 @@ namespace nvd {
spdlog::debug("LowLatency update called on input sample with result: {}", lowlatency_ctx.update());
break;
case PRESENT_START:
if (lowlatency_ctx.fg) lowlatency_ctx.mark_end_of_rendering();
lowlatency_ctx.mark_end_of_rendering();
break;
}
return Ok();
@@ -573,7 +582,7 @@ namespace nvd {
if (lowlatency_ctx.fg && repeat_count == 0) lowlatency_ctx.fg = false;
else if (!lowlatency_ctx.fg && repeat_count >= history_size / 2) lowlatency_ctx.fg = true;
if (lowlatency_ctx.fg) lowlatency_ctx.set_fg_type(previous_frame_id == current_frame_id);
lowlatency_ctx.set_fg_type(previous_frame_id == current_frame_id);
previous_frame_id = current_frame_id;
}
spdlog::debug("Async markerType: {}, frame id: {}", (unsigned int)pSetAsyncFrameMarkerParams->markerType, (unsigned long long)pSetAsyncFrameMarkerParams->frameID);
+21 -6
View File
@@ -80,12 +80,20 @@ public:
HRESULT hr = pDevice->QueryInterface(__uuidof(ID3D12Device), reinterpret_cast<void**>(&device));
if (hr == S_OK) {
HRESULT init_return = AMD::AntiLag2DX12::Initialize(&context_dx12, device);
al_available = init_return == S_OK;
spdlog::info("AntiLag 2 DX12 initialized");
if (al_available = init_return == S_OK; !al_available) {
mode = LatencyFlex;
spdlog::info("AntiLag 2 DX12 initialization failed");
} else {
spdlog::info("AntiLag 2 DX12 initialized");
}
} else {
HRESULT init_return = AMD::AntiLag2DX11::Initialize(&context_dx11);
al_available = init_return == S_OK;
spdlog::info("AntiLag 2 DX11 initialized");
if (al_available = init_return == S_OK; !al_available) {
mode = LatencyFlex;
spdlog::info("AntiLag 2 DX11 initialization failed");
} else {
spdlog::info("AntiLag 2 DX11 initialized");
}
}
}
#else
@@ -103,11 +111,18 @@ public:
inline HRESULT update() {
if (force_reflex == ForceDisable || (force_reflex == InGame && !active)) return S_FALSE;
Mode previous_mode = mode;
static bool previous_fg_status = fg;
if (al_available && !force_latencyflex && (min_interval_us == 0 || !fg))
mode = AntiLag2;
else
mode = LatencyFlex;
if (previous_mode != mode) spdlog::info("Changed low latency algorithm to: {}", mode == AntiLag2 ? "AntiLag 2" : "LatencyFlex");
if (previous_fg_status != fg) spdlog::info("FG mode changed to: {}", fg ? "enabled" : "disabled");
previous_fg_status = fg;
spdlog::debug("LowLatency algo: {}", mode == AntiLag2 ? "AntiLag 2" : "LatencyFlex");
spdlog::debug("FG status: {}", fg ? "enabled" : "disabled");
@@ -162,7 +177,7 @@ public:
inline HRESULT set_fg_type(bool interpolated) {
#if _MSC_VER && _WIN64
if (mode == AntiLag2)
if (fg && mode == AntiLag2)
return AMD::AntiLag2DX12::SetFrameGenFrameType(&context_dx12, interpolated);
#endif
return S_FALSE;
@@ -170,7 +185,7 @@ public:
inline HRESULT mark_end_of_rendering() {
#if _MSC_VER && _WIN64
if (mode == AntiLag2)
if (fg && mode == AntiLag2)
return AMD::AntiLag2DX12::MarkEndOfFrameRendering(&context_dx12);
#endif
return S_FALSE;