Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
#pragma once
#include "veyra/engine/EnhancementSettings.h"
namespace veyra::engine {
enum class FailedBackend { None, Infrastructure, OpticalFlow, NgxCore, Nr, Sr, Fg, VideoHdr, Dlaa };
// NGX 310.9.1 definitions. A failure on 566.07 alone does not establish a
// universal minimum driver. Preserve the real result and suggest recovery.
constexpr const wchar_t* ngxFailureHint(uint64_t result) {
switch(uint32_t(result)) {
case 0xBAD00002:return L"平台或驱动初始化失败;请更新 NVIDIA 驱动或选择兼容运行库";
case 0xBAD00001:return L"显卡、驱动或运行库不支持所选功能";
default:return L"初始化失败;详细原因见诊断日志";
}
}
// amdNr: the adapter is AMD, where NR runs on the lmxxf runtime (the graph
// selects it for every NR layer; an unsupported RX model fails in its own
// open/admits and is reported like any other NR backend failure).
inline bool disableUnsupportedNvidiaEffects(EnhancementSettings& settings,bool nvidia,bool amdNr=false){
if(nvidia)return false;
const auto before=settings;
if(!amdNr)settings.nr=false;
// NVOF does not exist on these adapters; NR motion uses AMD FidelityFX flow.
if(amdNr&&settings.nr&&settings.opticalFlowBackend==OpticalFlowBackend::Nvidia)
settings.opticalFlowBackend=OpticalFlowBackend::AmdFidelityFx;
settings.videoHdr.enabled=false;
// AMD FSR upscaling is vendor neutral and must survive the NVIDIA-only
// normalization; every other SR backend is NGX-only. It survives only when
// the user turned SR on: FSR is the AMD default backend, so assigning the
// backend test here switched SR on at every graph build (2.1.0 field
// report: SR could not be turned off on AMD).
settings.sr=settings.sr&&settings.videoSrQuality==kVideoSrFsr;
if(settings.frameGenerationBackend==FrameGenerationBackend::Dlss)settings.multiplier=1;
return settings!=before;
}
// A stage that only an NVIDIA adapter can run is still requested: NR outside
// the AMD runtime, SR other than FSR, and frame generation other than the
// cross-vendor XeSS/FSR providers.
inline bool nvidiaOnlyStagesRequested(bool nr,bool sr,bool fg,const EnhancementSettings& settings,bool amdNr){
return (nr&&!amdNr)||(sr&&settings.videoSrQuality!=kVideoSrFsr)||
(fg&&!crossVendorFrameGeneration(settings.frameGenerationBackend));
}
inline const wchar_t* backendFailureName(FailedBackend backend) {
switch(backend){
case FailedBackend::OpticalFlow:return L"光流";
case FailedBackend::NgxCore:return L"NGX 核心";
case FailedBackend::Nr:return L"NR";
case FailedBackend::Sr:return L"超分";
case FailedBackend::Fg:return L"帧生成";
case FailedBackend::VideoHdr:return L"RTX Video HDR";
case FailedBackend::Dlaa:return L"DLAA";
default:return L"GPU / 输入 / 显示资源";
}
}
// Disable only the failed feature and its consumers. Never substitute zero
// motion for a failed optical-flow backend while claiming normal enhancement.
inline bool disableFailedBackend(EnhancementSettings& settings,FailedBackend backend){
const auto before=settings;
const auto disableDlaa=[&] {
if(settings.antiAlias.usesDlaa())settings.antiAlias.enabled=false;
for(auto& aa:settings.additionalAntiAlias)
if(aa.usesDlaa())aa.enabled=false;
};
switch(backend){
case FailedBackend::Dlaa:disableDlaa();break;
case FailedBackend::VideoHdr:settings.videoHdr.enabled=false;break;
case FailedBackend::Nr:settings.nr=false;break;
case FailedBackend::Sr:settings.sr=false;break;
case FailedBackend::Fg:settings.multiplier=1;break;
case FailedBackend::NgxCore:
disableDlaa();
settings.videoHdr.enabled=false;
settings.nr=settings.sr=false;
if(settings.frameGenerationBackend==FrameGenerationBackend::Dlss)settings.multiplier=1;
break;
case FailedBackend::OpticalFlow:
disableDlaa();
settings.nr=false;settings.multiplier=1;
// DLSS SR as the base or the second of a double SR.
if(!settings.videoSrQuality||(settings.dualSrEnabled&&!settings.dualSrQuality))settings.sr=false;
break;
default:return false;
}
return settings!=before;
}
}