Skip to content

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++

fix: persist volume and enable double SR across DLSS and FSR

Veyra Goal Agent356013b6e7de
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 0faa4f01..d44b5811 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -5076,20 +5076,6 @@
"en": "Not used while double SR is on; it returns when double SR is turned off.",
"ja": "2段階超解像がオンの間は使用されません。オフにすると戻ります。"
},
- {
- "zh": "双重超分目前仅 RTX 视频超分支持",
- "src": "src/ui/bridge/Enhancement.cpp",
- "zh-TW": "雙重超解析目前僅 RTX 影片超解析支援",
- "en": "Double SR is currently supported by RTX Video SR only",
- "ja": "2段階超解像は現在RTX Video SRのみ対応しています"
- },
- {
- "zh": "双重超分目前使用 RTX 视频超分",
- "src": "qml/SrStageEditor.qml",
- "zh-TW": "雙重超分目前使用 RTX 視訊超分",
- "en": "Double SR currently uses RTX Video SR",
- "ja": "2段階超解像は現在RTX Video SRを使用します"
- },
{
"zh": "反馈问题",
"src": "qml/SettingsPage.qml",
@@ -12610,11 +12596,11 @@
"ja": "状態:%1"
},
{
- "zh": "独立于基础超分,可以换成另一种 RTX 视频超分。",
+ "zh": "独立于基础超分,可以选任意一种超分;DLSS SR 两次共用上面的 DLSS 模型,FSR 不支持 HDR。",
"src": "qml/SrStageEditor.qml",
- "zh-TW": "獨立於基礎超解析,可以換成另一種 RTX 影片超解析。",
- "en": "Independent of the base SR; it can use another RTX Video Super Resolution model.",
- "ja": "基本の超解像とは独立しており、別の RTX ビデオ超解像を選べます。"
+ "zh-TW": "獨立於基礎超解析,可以選任意一種超解析;DLSS SR 兩次共用上面的 DLSS 模型,FSR 不支援 HDR。",
+ "en": "Independent of the base SR; any SR algorithm works. Both DLSS SR passes use the DLSS model above; FSR does not support HDR.",
+ "ja": "基本の超解像とは独立して任意の超解像を選べます。DLSS SR は 2 回とも上の DLSS モデルを使い、FSR は HDR に対応していません。"
},
{
"zh": "独立采集音频配置失败;BMD 原生视频继续运行",
@@ -13316,6 +13302,13 @@
"en": "Endpoint open",
"ja": "エンドポイントを開きました"
},
+ {
+ "zh": "第二次 %1",
+ "src": "qml/ProPage.qml",
+ "zh-TW": "第二次 %1",
+ "en": "second pass %1",
+ "ja": "2回目 %1"
+ },
{
"zh": "第二次超分到",
"src": "qml/SrStageEditor.qml",
diff --git a/include/veyra/engine/BackendRecovery.h b/include/veyra/engine/BackendRecovery.h
index 5bde183b..73743e11 100644
--- a/include/veyra/engine/BackendRecovery.h
+++ b/include/veyra/engine/BackendRecovery.h
@@ -66,7 +66,8 @@ inline bool disableFailedBackend(EnhancementSettings& settings,FailedBackend bac
break;
case FailedBackend::OpticalFlow:
settings.nr=false;settings.multiplier=1;
- if(!settings.videoSrQuality)settings.sr=false;
+ // 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;
}
diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.h
index 94e210f7..1412f73c 100644
--- a/include/veyra/engine/EnhancementSettings.h
+++ b/include/veyra/engine/EnhancementSettings.h
@@ -81,8 +81,9 @@ inline constexpr uint32_t kDefaultVideoSrQuality=2;
// - high bitrate 16..19 and streaming 21/23 (medium/ultra only, Ampere or
// newer): NVIDIA Video Effects VideoSuperRes. High bitrate skips the
// compression clean-up to keep clean detail; streaming cleans hardest.
-// Every family runs double SR and the supersample shrink. Only the standard
-// family restores a source already at the target size.
+// Every family runs the supersample shrink; double SR takes every SR backend
+// (DLSS SR and FSR too, 2026-11-08). Only the standard family restores a source
+// already at the target size.
enum class VideoSrFamily : uint32_t { Standard = 0, HighBitrate = 1, Streaming = 2 };
inline constexpr uint32_t kVideoSrFamilyCount=3;
constexpr bool ngxVideoSr(uint32_t q){return q>=1&&q<=4;}
@@ -90,6 +91,8 @@ constexpr bool vfxVideoSr(uint32_t q){return (q>=16&&q<=19)||q==21||q==23;}
constexpr bool vfxVideoSrNeedsAmpere(uint32_t q){return q==21||q==23;}
constexpr bool rtxVideoSr(uint32_t q){return ngxVideoSr(q)||vfxVideoSr(q);}
constexpr bool validVideoSrQuality(uint32_t q){return q<=kVideoSrFsr||vfxVideoSr(q);}
+// DLSS SR and FSR are temporal: they read the SR motion source. RTX Video SR is spatial.
+constexpr bool temporalVideoSr(uint32_t q){return q==0||q==kVideoSrFsr;}
inline constexpr uint32_t kVfxVideoSrQualities[]={16,17,18,19,21,23};
constexpr VideoSrFamily videoSrFamily(uint32_t q){
return q>=16&&q<=19?VideoSrFamily::HighBitrate:q==21||q==23?VideoSrFamily::Streaming:VideoSrFamily::Standard;
@@ -372,7 +375,9 @@ struct EnhancementSettings {
pipeline::SrOutput srOutput=pipeline::SrOutput::Target;
bool dualSrEnabled=false;
pipeline::SrTarget dualSrTarget=pipeline::SrTarget::Uhd4K;
- uint32_t dualSrQuality=kDefaultVideoSrQuality; // any RTX Video SR value, independent of the base family
+ uint32_t dualSrQuality=kDefaultVideoSrQuality; // any SR value (DLSS SR, RTX Video SR family/tier, FSR), independent of the base
+ // A DLSS SR / FSR pass reads srMotion: the base, or the second of a double SR.
+ bool temporalSr() const { return temporalVideoSr(videoSrQuality)||(dualSrEnabled&&temporalVideoSr(dualSrQuality)); }
uint32_t multiplier=1;
FrameGenerationBackend frameGenerationBackend=FrameGenerationBackend::Dlss;
// NvVFX Mode: Low=0, Medium=1 (default), High=2; mixed tiers 3-5, see vfgPrimaryMode().
@@ -457,8 +462,9 @@ struct EnhancementSettings {
if(!nr||!sr)active.lowLatency=defaults.lowLatency;
if(!nr||!protection.enabled)active.protection=defaults.protection;
if(!sr){active.srTarget=defaults.srTarget;active.videoSrQuality=defaults.videoSrQuality;active.srMotion=defaults.srMotion;}
- if(!sr||videoSrQuality!=0)active.dlssSrModel=defaults.dlssSrModel;
- if(!sr||!rtxVideoSr(videoSrQuality)||!dualSrEnabled){
+ // The DLSS SR model serves every DLSS SR pass, the second of a double SR too.
+ if(!sr||(videoSrQuality!=0&&!(dualSrEnabled&&dualSrQuality==0)))active.dlssSrModel=defaults.dlssSrModel;
+ if(!sr||!dualSrEnabled){
active.srPrescale=defaults.srPrescale;
active.dualSrEnabled=false;active.dualSrTarget=defaults.dualSrTarget;active.dualSrQuality=defaults.dualSrQuality;
}
@@ -491,7 +497,7 @@ struct EnhancementSettings {
// Flow is shared. Turning off one effect does not make it inactive
// while another consumer still needs it (VFG has its own flow).
const bool flowUsed=(nr&&(motionUsesFlow(nrMotion)||usesNrTemporal()))||
- (sr&&(videoSrQuality==0||videoSrQuality==kVideoSrFsr)&&motionUsesFlow(srMotion))||
+ (sr&&temporalSr()&&motionUsesFlow(srMotion))||
(multiplier>1&&motionUsesFlow(fgMotion,frameGenerationBackend));
if(!flowUsed){active.flow=defaults.flow;active.opticalFlowBackend=defaults.opticalFlowBackend;active.amdFlowHalfResolution=defaults.amdFlowHalfResolution;}
// Only XeSS frame generation with optical-flow motion reads the refined vectors.
@@ -606,7 +612,7 @@ struct EnhancementSettings {
if(!pipeline::validSrTarget(srTarget))return "invalid SR target";
if(!pipeline::validSrPrescale(srPrescale))return "invalid SR prescale";
if(!pipeline::validSrOutput(srOutput))return "invalid SR output";
- if(!pipeline::validSrTarget(dualSrTarget)||!rtxVideoSr(dualSrQuality))return "invalid second SR target or quality";
+ if(!pipeline::validSrTarget(dualSrTarget)||!validVideoSrQuality(dualSrQuality))return "invalid second SR target or quality";
if(opticalFlowBackend!=OpticalFlowBackend::Nvidia&&opticalFlowBackend!=OpticalFlowBackend::AmdFidelityFx&&opticalFlowBackend!=OpticalFlowBackend::GpuDis)return "invalid optical flow backend";
if(multiplier<1||multiplier>(frameGenerationBackend==FrameGenerationBackend::Vfg?8u:6u))return "unsupported multiplier";
// 0 = auto quality; explicit values are capped at 300 Mbps so a typo
diff --git a/include/veyra/engine/GraphDescription.h b/include/veyra/engine/GraphDescription.h
index 031a5c25..9a5ee97c 100644
--- a/include/veyra/engine/GraphDescription.h
+++ b/include/veyra/engine/GraphDescription.h
@@ -65,10 +65,17 @@ struct StageRequest {
const ChainRuntimeOrder* nodeOrder=nullptr; // paired with this settings transaction
};
-// Double SR runs on RTX Video SR (NVIDIA, every model family) only; every other
-// backend keeps its existing single pass, regardless of saved second-pass fields.
-inline pipeline::SrPrescale runningSrPrescale(const EnhancementSettings& s,bool nvidiaAdapter){
- return nvidiaAdapter&&rtxVideoSr(s.videoSrQuality)&&s.dualSrEnabled?s.srPrescale:pipeline::SrPrescale::Off;
+// Double SR (user 2026-11-08): each pass uses DLSS SR, FSR or any RTX Video SR
+// family. It runs where both passes' backends exist - FSR on every adapter, the
+// others on NVIDIA - and not on a still image with an FSR pass (FSR skips still
+// images). Otherwise the base keeps its single pass, saved second fields intact.
+inline bool dualSrRuns(const EnhancementSettings& s,bool nvidiaAdapter,bool stillImage=false){
+ const auto runs=[nvidiaAdapter](uint32_t quality){return nvidiaAdapter||quality==kVideoSrFsr;};
+ return s.dualSrEnabled&&runs(s.videoSrQuality)&&runs(s.dualSrQuality)&&
+ !(stillImage&&(s.videoSrQuality==kVideoSrFsr||s.dualSrQuality==kVideoSrFsr));
+}
+inline pipeline::SrPrescale runningSrPrescale(const EnhancementSettings& s,bool nvidiaAdapter,bool stillImage=false){
+ return dualSrRuns(s,nvidiaAdapter,stillImage)?s.srPrescale:pipeline::SrPrescale::Off;
}
// Supersampling (user 2026-10-28): one RTX Video SR pass evaluates at its target
// and the result is area-shrunk into srOutput before every later effect. Double
@@ -111,7 +118,7 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
const bool boundedAmd=request.exportJob&&!request.stillImage&&request.amdNr&&
currentNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd;
const auto policy=request.exportJob?exportNrSizePolicy(settings.nrRuntime,settings.nrPolicy):settings.nrPolicy;
- const auto srPrescale=runningSrPrescale(settings,request.nvidiaAdapter);
+ const auto srPrescale=runningSrPrescale(settings,request.nvidiaAdapter,request.stillImage);
const auto srOutput=runningSrOutput(settings,request.nvidiaAdapter);
if(!pipeline::Extent{request.width,request.height}.valid()||!pipeline::validSrTarget(settings.srTarget)||
!pipeline::validNrSizePolicy(policy)||!pipeline::validSrPrescale(srPrescale)||!pipeline::validSrOutput(srOutput)){
@@ -126,7 +133,7 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
boundedAmd?pipeline::NrSizePolicy::Realtime:policy,
(request.stillImage||request.exportJob)&&!boundedAmd,settings.revision,settings.srTarget,lowLatency,
request.amdNr&&currentNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd?1080u:0u,srPrescale,srOutput,
- settings.dualSrEnabled&&request.nvidiaAdapter&&rtxVideoSr(settings.videoSrQuality),settings.dualSrTarget);
+ dualSrRuns(settings,request.nvidiaAdapter,request.stillImage),settings.dualSrTarget);
if(request.exportJob&&!request.stillImage)
plan.nr=exportNrProcessingExtent(plan.base,settings.nrRuntime,policy);
desc.sourceWidth=request.width;desc.sourceHeight=request.height;
diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.h
index 82b6867a..ba031eeb 100644
--- a/include/veyra/pipeline/EnhanceGraph.h
+++ b/include/veyra/pipeline/EnhanceGraph.h
@@ -129,8 +129,16 @@ struct EnhanceGraphDesc {
// Three-step SR (RTX Video SR): what SR reads after the prescale and what it
// writes before the output fit. Zero: SR reads the source and writes the work extent.
uint32_t srInputWidth=0,srInputHeight=0,srOutputWidth=0,srOutputHeight=0;
+ // Double SR: the first pass (videoSrQuality) writes firstSr*, the second
+ // (dualSrQuality) reads its reduction. Each pass has its own backend: DLSS SR,
+ // FSR or any RTX Video SR family (user 2026-11-08).
bool dualSr=false;
uint32_t firstSrWidth=0,firstSrHeight=0,dualSrQuality=engine::kDefaultVideoSrQuality;
+ uint32_t finalSrQuality()const{return dualSr?dualSrQuality:videoSrQuality;}
+ bool firstSrEnlarges()const{return firstSrWidth!=sourceWidth||firstSrHeight!=sourceHeight;}
+ // A first DLSS SR / FSR pass runs only when it enlarges; at the source size
+ // its result is the source (as for the Video Effects families).
+ bool firstSrRuns(uint32_t quality)const{return dualSr&&videoSrQuality==quality&&firstSrEnlarges();}
uint32_t fgMultiplier=2;
engine::FrameGenerationBackend frameGenerationBackend=engine::FrameGenerationBackend::Dlss;
uint32_t vfgQuality=1;
@@ -699,7 +707,9 @@ public:
bool presentSinkFg() const { return xessEnabled(); }
// AMD FSR upscaling replaces the SR stage; it is a FidelityFX effect, not
// an NGX feature, so it also works on non-NVIDIA adapters.
- bool fsrSrRequested() const { return desc_.enableSr && !desc_.stillImage && desc_.videoSrQuality==engine::kVideoSrFsr; }
+ // Double SR may run FSR in either pass; each pass is its own FidelityFX context.
+ bool fsrSrRequested() const { return desc_.enableSr && !desc_.stillImage &&
+ (desc_.finalSrQuality()==engine::kVideoSrFsr || desc_.firstSrRuns(engine::kVideoSrFsr)); }
// Out of line: the backend type is only forward declared here.
bool fsrSrEnabled() const;
// Requested output multiplier (2 = one generated frame). Consumed by the
@@ -848,6 +858,11 @@ private:
ComPtr<ID3D12Resource> videoSrInput_,videoSrOutput_;
ComPtr<ID3D12Resource> srPrescaled_; // linear second-SR input: the double SR reduction of the first result
ComPtr<ID3D12Resource> firstSrInput_,firstSrOutput_,firstSrLinear_;
+ // Double SR temporal passes: a first DLSS SR pass takes motion in its output
+ // pixels (first result), a second FSR pass in its render pixels (SR input).
+ ComPtr<ID3D12Resource> firstSrFlow_,secondSrFlow_;
+ UINT firstSrFlowSet()const{return 3+UINT(nrInstances_.size());}
+ UINT secondSrFlowSet()const{return 4+UINT(nrInstances_.size());}
ComPtr<ID3D12Resource> videoHdrInput_,videoHdrOutput_;
ComPtr<ID3D12Resource> residualRgba_,nrFlow_,baseFlow_;
ComPtr<ID3D12Resource> preSrProtectionRgba_;
@@ -1047,8 +1062,15 @@ private:
std::unique_ptr<ngx::DlssFgBackend> fgBackend_;
std::unique_ptr<gfx::FsrFgPresenter> fsrFgBackend_;
std::unique_ptr<gfx::FsrSrBackend> fsrSrBackend_;
+ // Double SR first passes on DLSS SR / FSR (the final pass keeps the members above).
+ std::unique_ptr<ngx::DlssSrBackend> firstDlssSrBackend_;
+ std::unique_ptr<gfx::FsrSrBackend> firstFsrSrBackend_;
+ // Constant far depth and zero motion for the temporal SR passes. The source
+ // extent for a single FSR pass; under double SR the largest render/motion
+ // extent of its DLSS SR / FSR passes (larger inputs are read in their subrect).
ComPtr<ID3D12Resource> fsrSrDepth_, upFsrSrDepth_, fsrSrZeroMotion_, upFsrSrZeroMotion_;
size_t fsrSrDepthPitch_=0;
+ uint32_t fsrAuxW_=0,fsrAuxH_=0;
NVSDK_NGX_Parameter* ngxParams_ = nullptr;
uint64_t nrResult_ = 0;
uint64_t fgInitResult_ = 0;
diff --git a/qml/Veyra/NodePage.qml b/qml/Veyra/NodePage.qml
index cb29cfa6..8d6fb1a6 100644
--- a/qml/Veyra/NodePage.qml
+++ b/qml/Veyra/NodePage.qml
@@ -1521,7 +1521,8 @@ VPage {
VRow {
label: qsTr("DLSS 模型")
hint: qsTr("K 保留原有模型;M、L 为 DLSS 4.5。L 针对较低输入分辨率,实际画质与耗时取决于片源。")
- visible: veyra.videoSrQuality === 0
+ // Also the model of a DLSS SR second pass under double SR.
+ visible: veyra.videoSrQuality === 0 || (veyra.dualSrEnabled && veyra.dualSrQuality === 0)
enabled: Support.available(veyra, "sr0")
VSelect {
objectName: "node-dlss-sr-model"
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index 8a6107b9..15a54c53 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -1321,13 +1321,17 @@ VPage {
+ " · " + veyra.srTargetLabel
+ (supersampleShown ? "→" + (veyra.srOutput === 1 ? qsTr("片源尺寸") : ["", "", "2K", "4K", "5K", "6K", "7K"][veyra.srOutput]) : "")
+ (dualShown ? "→" + (veyra.srPrescale >= 150 ? (veyra.srPrescale - 100) + "%" : ["", "720p", "900p", "1080p", "1440p"][veyra.srPrescale]) + "→" + ["", "2K", "4K", "8K", "5K", "6K", "7K"][veyra.dualSrTargetIndex] : "")
- + (rtxVideoSr ? " · " + veyra.srQualityLabel(veyra.videoSrQuality, false) + (dualShown ? " / " + veyra.srQualityLabel(veyra.dualSrQuality, true) : "") : "")
- // Base target, then the supersample shrink, or the double SR reduction
- // and second target while double SR is on (RTX Video SR), then the tier
- // (and the second family and tier). Each kept value is hidden while its mode is off.
+ + (rtxVideoSr ? " · " + veyra.srQualityLabel(veyra.videoSrQuality, false) + (dualShown ? " / " + secondLabel : "")
+ : dualShown ? " · " + qsTr("第二次 %1").arg(secondLabel) : "")
+ // Base target, then the supersample shrink (RTX Video SR), or the double SR
+ // reduction and second target while double SR is on (any algorithm), then the
+ // tier and the second algorithm. Each kept value is hidden while its mode is off.
readonly property bool rtxVideoSr: veyra.srAlgorithmOf(veyra.videoSrQuality).startsWith("rtx")
readonly property bool supersampleShown: !veyra.dualSrEnabled && veyra.srOutput > 0 && rtxVideoSr
- readonly property bool dualShown: veyra.dualSrEnabled && veyra.srPrescale > 0 && rtxVideoSr
+ readonly property bool dualShown: veyra.dualSrEnabled && veyra.srPrescale > 0
+ // "高码率 超高" for an RTX family, the algorithm name for DLSS SR / FSR.
+ readonly property string secondLabel: veyra.srQualityLabel(veyra.dualSrQuality, true)
+ || veyra.srBackendChoices?.find(o => o.id === veyra.srAlgorithmOf(veyra.dualSrQuality))?.label || ""
on: veyra.srEnabled
open: true
onToggled: on => veyra.srEnabled = on
@@ -1346,7 +1350,8 @@ VPage {
VRow {
label: qsTr("DLSS 模型")
hint: qsTr("K 保留原有模型;M、L 为 DLSS 4.5。L 针对较低输入分辨率,实际画质与耗时取决于片源。")
- visible: veyra.videoSrQuality === 0
+ // Also the model of a DLSS SR second pass under double SR.
+ visible: veyra.videoSrQuality === 0 || (veyra.dualSrEnabled && veyra.dualSrQuality === 0)
enabled: Support.available(veyra, "sr0")
VSelect {
objectName: "list-dlss-sr-model"
diff --git a/qml/Veyra/SrStageEditor.qml b/qml/Veyra/SrStageEditor.qml
index 0acdf515..8eedad4d 100644
--- a/qml/Veyra/SrStageEditor.qml
+++ b/qml/Veyra/SrStageEditor.qml
@@ -6,9 +6,11 @@ ColumnLayout {
id: editor
property string namePrefix: "list"
spacing: 6
- // Any RTX Video SR family (standard / high bitrate / streaming) runs the stages below.
- readonly property bool supported: veyra.srAlgorithmOf(veyra.videoSrQuality).startsWith("rtx") && Support.available(veyra,"sr")
- readonly property var rtxFamilies: (veyra.srBackendChoices || []).filter(o => o.id.startsWith("rtx"))
+ // Tiers and the supersample shrink belong to the RTX Video SR families
+ // (standard / high bitrate / streaming); double SR takes every SR algorithm.
+ readonly property bool srAvailable: Support.available(veyra,"sr")
+ readonly property bool supported: veyra.srAlgorithmOf(veyra.videoSrQuality).startsWith("rtx") && srAvailable
+ readonly property bool secondRtx: veyra.srAlgorithmOf(veyra.dualSrQuality).startsWith("rtx")
readonly property bool manual: veyra.srPrescale >= 150 && veyra.srPrescale <= 190
readonly property var targets: [{id:"1",label:"2K"},{id:"2",label:"4K"},{id:"4",label:"5K"},{id:"5",label:"6K"},{id:"6",label:"7K"},{id:"3",label:"8K"}]
VRow {
@@ -49,15 +51,15 @@ ColumnLayout {
}
VRow {
label: qsTr("双重超分")
- hint: editor.supported ? qsTr("先完成基础超分,再将结果降低分辨率并执行第二次超分;两次执行独立,会增加耗时和显存。") : qsTr("双重超分目前使用 RTX 视频超分")
- enabled: editor.supported
+ hint: qsTr("先完成基础超分,再将结果降低分辨率并执行第二次超分;两次执行独立,会增加耗时和显存。")
+ enabled: editor.srAvailable
opacity: enabled ? 1 : 0.4
VSwitch { objectName: editor.namePrefix+"-dual-sr-toggle"; checked: veyra.dualSrEnabled; onToggled: checked => veyra.dualSrEnabled=checked }
}
ColumnLayout {
objectName: editor.namePrefix+"-dual-sr-panel"
visible: veyra.dualSrEnabled
- enabled: editor.supported
+ enabled: editor.srAvailable
Layout.fillWidth: true
spacing: 6
VRow {
@@ -87,16 +89,18 @@ ColumnLayout {
}
VRow {
label: qsTr("第二次超分算法")
- hint: qsTr("独立于基础超分,可以换成另一种 RTX 视频超分。")
+ hint: qsTr("独立于基础超分,可以选任意一种超分;DLSS SR 两次共用上面的 DLSS 模型,FSR 不支持 HDR。")
VSelect {
objectName: editor.namePrefix+"-dual-sr-algorithm"
implicitWidth: 210
- options: editor.rtxFamilies
+ options: veyra.srBackendChoices || []
value: options.find(o => o.id === veyra.srAlgorithmOf(veyra.dualSrQuality))?.label || ""
+ // Switching between RTX families keeps the tier; DLSS SR and FSR have none.
onPicked: id => veyra.dualSrQuality = veyra.srQualityFor(id, veyra.srTierOf(veyra.dualSrQuality))
}
}
VRow {
+ visible: editor.secondRtx
label: qsTr("第二次超分档位")
VSeg {
objectName: editor.namePrefix+"-dual-sr-quality"
diff --git a/scripts/acceptance/sr-families-ui.qml b/scripts/acceptance/sr-families-ui.qml
index 7e05e0ef..90cd75a5 100644
--- a/scripts/acceptance/sr-families-ui.qml
+++ b/scripts/acceptance/sr-families-ui.qml
@@ -1,6 +1,8 @@
import QtQuick
// RTX Video SR families in the real list page: algorithm (standard / high bitrate /
// streaming) and tier selection, double SR with a second family, and the card summary.
+// Since 2026-11-08 the second pass offers every SR algorithm: steps 10-12 run a DLSS SR
+// second pass (no tiers, DLSS model shown), then DLSS SR -> FSR.
// Runner: the same Loader injection as sr-stage-ui.py; expects a 720p clip of 30 s or more.
Item {
id: test
@@ -61,14 +63,15 @@ Item {
check(veyra.dualSrEnabled&&find("list-dual-sr-panel").visible,"double SR opens on the streaming family")
check(veyra.srStageSummary==="1280x720 → 3840x2160 → 1920x1080 → 3840x2160","streaming base, reduction, second pass: "+veyra.srStageSummary)
const algo=find("list-dual-sr-algorithm")
- check(algo!==null&&ids(algo.options)==="rtx,rtx-hb,rtx-st","second pass offers the three RTX Video SR families")
+ check(algo!==null&&ids(algo.options)==="0,rtx,rtx-hb,rtx-st,5","second pass offers every SR algorithm ("+ids(algo.options)+")")
algo.picked("rtx-hb");next(6);return
}
if(step===6){
if(!settled())return
- check(veyra.videoSrQuality===21&&veyra.dualSrQuality===19,"the second family changes only the second pass")
+ // The second pass starts at the medium default (2.1.3, 2026-11-06), so high bitrate is 17.
+ check(veyra.videoSrQuality===21&&veyra.dualSrQuality===17,"the second family changes only the second pass ("+veyra.dualSrQuality+")")
check(veyra.srActive&&veyra.srStageSummary==="1280x720 → 3840x2160 → 1920x1080 → 3840x2160","streaming + high bitrate double SR runs")
- check(find("list-sr").summary.indexOf("中 / 高码率 超高")>=0,"card summary shows both passes: "+find("list-sr").summary)
+ check(find("list-sr").summary.indexOf("中 / 高码率 中")>=0,"card summary shows both passes: "+find("list-sr").summary)
test.saved=false
if(test.shot.length>0)test.parent.parent.grabToImage(r=>{r.saveToFile(test.shot);test.saved=true})
else test.saved=true
@@ -87,6 +90,27 @@ Item {
if(!settled())return
check(veyra.videoSrQuality===2&&veyra.dualSrEnabled&&veyra.dualSrQuality===16&&veyra.srActive,
"back to the standard family at the same tier; the high bitrate second pass stays")
+ find("list-dual-sr-algorithm").picked("0");next(10);return
+ }
+ if(step===10){
+ if(!settled())return
+ check(veyra.dualSrQuality===0&&veyra.videoSrQuality===2&&veyra.srActive&&
+ veyra.srStageSummary==="1280x720 → 3840x2160 → 1920x1080 → 3840x2160","standard base with a DLSS SR second pass runs: "+veyra.srStageSummary)
+ check(!find("list-dual-sr-quality").visible&&find("list-dlss-sr-model").visible,"a DLSS SR second pass hides the tiers and shows the DLSS model")
+ check(find("list-sr").summary.indexOf("中 / DLSS SR")>=0,"card summary names the DLSS SR second pass: "+find("list-sr").summary)
+ find("list-sr-backend").picked("0");next(11);return
+ }
+ if(step===11){
+ if(!settled())return
+ check(veyra.videoSrQuality===0&&veyra.dualSrEnabled&&veyra.dualSrQuality===0&&veyra.srActive,"DLSS SR -> DLSS SR runs")
+ check(find("list-sr").summary.indexOf("第二次 DLSS SR")>=0,"card summary without a base tier: "+find("list-sr").summary)
+ find("list-dual-sr-algorithm").picked("5");next(12);return
+ }
+ if(step===12){
+ if(!settled())return
+ check(veyra.videoSrQuality===0&&veyra.dualSrQuality===5&&veyra.srActive&&
+ veyra.srStageSummary==="1280x720 → 3840x2160 → 1920x1080 → 3840x2160","DLSS SR -> FSR runs: "+veyra.srStageSummary)
+ check(!find("list-dual-sr-quality").visible&&find("list-sr").summary.indexOf("第二次 FSR")>=0,"FSR second pass: no tiers, card "+find("list-sr").summary)
veyra.logUi("sr-stage-test","SR_STAGE_UI_PASS");console.log("SR_STAGE_UI_PASS");Qt.quit()
}
}catch(e){veyra.logUi("sr-stage-test","SR_STAGE_UI_FAIL "+e.message);console.log("SR_STAGE_UI_FAIL "+e.message);Qt.quit()}}
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index b764d476..bd8c712c 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -2867,7 +2867,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
for(size_t stage=0;stage<measured.gpu.size();++stage){const auto& sample=measured.gpu[stage];if(sample.state==diagnostics::SampleState::Measured&&sample.milliseconds&&sample.end&&sample.end!=lastGpuSampleEnd[stage]){gpuStageTimes[stage].add(*sample.milliseconds);lastGpuSampleEnd[stage]=sample.end;}}
- measured.resolution=pipeline::ResolutionPlan::make({width,height},options.sr,options.snapshot().nrPolicy,isImage,options.settings.revision,options.settings.srTarget,options.settings.lowLatency&&options.nr,0,runningSrPrescale(options.settings,ctx.adapter().isNvidia),runningSrOutput(options.settings,ctx.adapter().isNvidia),options.settings.dualSrEnabled&&ctx.adapter().isNvidia&&rtxVideoSr(options.settings.videoSrQuality),options.settings.dualSrTarget);measured.decodeCpuMs=decodeMs;measured.submitCpuMs=std::chrono::duration<double,std::milli>(processDone-processStart).count();measured.gpuWaitCpuMs=gpuWaitMs;measured.deadlineWaitCpuMs=frameWaitMs;measured.presentCpuMs=framePresentMs;measured.queueWatermark=out.batch.count;
+ measured.resolution=pipeline::ResolutionPlan::make({width,height},options.sr,options.snapshot().nrPolicy,isImage,options.settings.revision,options.settings.srTarget,options.settings.lowLatency&&options.nr,0,runningSrPrescale(options.settings,ctx.adapter().isNvidia,isImage),runningSrOutput(options.settings,ctx.adapter().isNvidia),dualSrRuns(options.settings,ctx.adapter().isNvidia,isImage),options.settings.dualSrTarget);measured.decodeCpuMs=decodeMs;measured.submitCpuMs=std::chrono::duration<double,std::milli>(processDone-processStart).count();measured.gpuWaitCpuMs=gpuWaitMs;measured.deadlineWaitCpuMs=frameWaitMs;measured.presentCpuMs=framePresentMs;measured.queueWatermark=out.batch.count;
LiveStats completed;if(liveScheduler)completed=liveStats;
uint64_t skipped=0;{std::lock_guard lock(mutex_);skipped=snapshot_.captureRateSkipped-rateSkippedBase;}
frameFlow->update([&](auto& m){m.counters.captureReceived=captureStats.received-captureFlowBase.received;m.counters.mailboxOverwritten=captureStats.dropped-captureFlowBase.dropped;m.counters.sourceSkippedBeforeGraph=skipped;m.slotReuseWaitCount=slotWaitCount;m.slotReuseWaitMs=slotWaitMilliseconds;m.counters.commandSlotsInFlight=slotsInFlight;m.counters.commandSlotHighWater=std::max(m.counters.commandSlotHighWater,slotsInFlight);});
diff --git a/src/engine/PresetLibrary.cpp b/src/engine/PresetLibrary.cpp
index 1da85cc1..90ff5a07 100644
--- a/src/engine/PresetLibrary.cpp
+++ b/src/engine/PresetLibrary.cpp
@@ -98,6 +98,7 @@ void PresetLibrary::addBuiltins() {
bool PresetLibrary::load() {
error_.clear();
addBuiltins();
+ const auto directAnySr=std::filesystem::path(path_).concat(L".dual-sr-any");
const auto directVideoAi=std::filesystem::path(path_).concat(L".video-ai");
const auto directDual=std::filesystem::path(path_).concat(L".dual-sr");
const auto directSrStage=std::filesystem::path(path_).concat(L".sr-stage");
@@ -147,6 +148,9 @@ bool PresetLibrary::load() {
if(std::filesystem::exists(directDual))path_=directDual;else if(std::filesystem::exists(dualPath))path_=dualPath;
const auto videoAiPath=std::filesystem::path(path_).concat(L".video-ai");
if(std::filesystem::exists(directVideoAi))path_=directVideoAi;else if(std::filesystem::exists(videoAiPath))path_=videoAiPath;
+ // DLSS SR / FSR as the second double SR pass (library v19, session v14).
+ const auto anySrPath=std::filesystem::path(path_).concat(L".dual-sr-any");
+ if(std::filesystem::exists(directAnySr))path_=directAnySr;else if(std::filesystem::exists(anySrPath))path_=anySrPath;
if (!std::filesystem::exists(path_)) return true;
std::error_code ec;
const auto size = std::filesystem::file_size(path_, ec);
@@ -243,6 +247,8 @@ bool PresetLibrary::save() {
// Opting into a new model must leave the older build's library intact.
// v14 (anti-aliasing nodes, chains past 16 nodes) and v15 (beauty nodes) get their own files too.
// v16 (three-step SR) as well.
+ if(data.starts_with("VEYRA_PRESET_LIBRARY 19")&&!path_.wstring().ends_with(L".dual-sr-any"))path_=std::filesystem::path(path_).concat(L".dual-sr-any");
+ if(!path_.wstring().ends_with(L".dual-sr-any")){
if(data.starts_with("VEYRA_PRESET_LIBRARY 18")&&!path_.wstring().ends_with(L".video-ai"))path_=std::filesystem::path(path_).concat(L".video-ai");
if(!path_.wstring().ends_with(L".video-ai")){
if(data.starts_with("VEYRA_PRESET_LIBRARY 17")&&!path_.wstring().ends_with(L".dual-sr"))path_=std::filesystem::path(path_).concat(L".dual-sr");
@@ -279,6 +285,7 @@ bool PresetLibrary::save() {
}
}
}
+ }
std::error_code ec;
std::filesystem::create_directories(path_.parent_path(), ec);
const auto temporary = std::filesystem::path(path_).concat(L".tmp");
@@ -740,7 +747,11 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entries
// are rejected by older readers: own version and file.
const auto videoAiOf=[](const ChainGlobalSettings& g){return vfxVideoSr(g.videoSrQuality)||vfxVideoSr(g.dualSrQuality);};
const bool videoAi=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){return (e.globals&&videoAiOf(*e.globals))||(e.nodeConfiguration&&(videoAiOf(*e.nodeConfiguration)||(e.nodeConfiguration->editor&&e.nodeConfiguration->editor->globals&&videoAiOf(*e.nodeConfiguration->editor->globals))));});
- const int version=std::max(minimumVersion, videoAi?18:dual?17:srStage?16:beauty?15:effects?14:nrModel?13:dlss?12:tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);
+ // DLSS SR / FSR as the second double SR pass (2026-11-08): readers up to v18
+ // reject a second value outside RTX Video SR, so it has its own version and file.
+ const auto anySrOf=[](const ChainGlobalSettings& g){return !rtxVideoSr(g.dualSrQuality);};
+ const bool anySr=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){return (e.globals&&anySrOf(*e.globals))||(e.nodeConfiguration&&(anySrOf(*e.nodeConfiguration)||(e.nodeConfiguration->editor&&e.nodeConfiguration->editor->globals&&anySrOf(*e.nodeConfiguration->editor->globals))));});
+ const int version=std::max(minimumVersion, anySr?19:videoAi?18:dual?17:srStage?16:beauty?15:effects?14:nrModel?13:dlss?12:tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);
o << "VEYRA_PRESET_LIBRARY " << version << '\n' << std::quoted(utf8(defaultName_)) << ' ' << entries_.size() << '\n';
for (const auto& e : entries_) {
o << std::quoted(utf8(e.name)) << ' ' << std::quoted(utf8(e.note)) << ' '
@@ -814,7 +825,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& out
std::string magic, quoted;
int version = 0;
size_t count = 0;
- const int allowedVersion=maxVersion>0?std::min(maxVersion,18):18;
+ const int allowedVersion=maxVersion>0?std::min(maxVersion,19):19;
if (!(in >> magic >> version) || magic != "VEYRA_PRESET_LIBRARY" || version < 1 || version > allowedVersion) { error = L"预设库格式或版本不支持"; return false; }
if (!(in >> std::quoted(quoted) >> count) || count > 64) { error = L"预设库条目数非法"; return false; }
def = wide(quoted);
@@ -986,7 +997,9 @@ std::string ChainSessionStore::encode(const ChainSession& session) {
const bool dual=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return dualOf(c)||(c.editor&&c.editor->globals&&dualOf(*c.editor->globals));});
const auto videoAiOf=[](const ChainGlobalSettings& g){return vfxVideoSr(g.videoSrQuality)||vfxVideoSr(g.dualSrQuality);};
const bool videoAi=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return videoAiOf(c)||(c.editor&&c.editor->globals&&videoAiOf(*c.editor->globals));});
- const int version = videoAi?13:dual?12:srStage?11:beauty?10:effects?9:nrModel?8:dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;
+ const auto anySrOf=[](const ChainGlobalSettings& g){return !rtxVideoSr(g.dualSrQuality);};
+ const bool anySr=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return anySrOf(c)||(c.editor&&c.editor->globals&&anySrOf(*c.editor->globals));});
+ const int version = anySr?14:videoAi?13:dual?12:srStage?11:beauty?10:effects?9:nrModel?8:dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;
out << "VEYRA_CHAIN_SESSION " << version << '\n' << int(session.active) << ' ' << session.initialized[0] << ' ' << session.initialized[1];
if(version>=4)out<<' '<<bool(editor);out<<'\n';
std::vector<PresetEntry> entries;
@@ -1040,7 +1053,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
std::istringstream in(data); in.imbue(std::locale::classic());
std::string magic, body; int version = 0, active = 0, list = 0, node = 0;
if (!(in >> magic >> version >> active >> list >> node) || magic != "VEYRA_CHAIN_SESSION" ||
- (version < 1 || version > 13) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;
+ (version < 1 || version > 14) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;
int hasEditor=version>=2?1:0;
if(version>=4&&(!(in>>hasEditor)||hasEditor<0||hasEditor>1))return false;
ChainSession parsed; parsed.active = ChainMode(active); parsed.initialized = {true, node != 0};
@@ -1106,6 +1119,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
bool ChainSessionStore::load(ChainSession& session) {
+ const auto directAnySr=std::filesystem::path(path_).concat(L".dual-sr-any");
const auto directVideoAi=std::filesystem::path(path_).concat(L".video-ai");
const auto directDual=std::filesystem::path(path_).concat(L".dual-sr");
const auto directSrStage=std::filesystem::path(path_).concat(L".sr-stage");
@@ -1153,6 +1167,9 @@ bool ChainSessionStore::load(ChainSession& session) {
if(std::filesystem::exists(directDual))path_=directDual;else if(std::filesystem::exists(dualPath))path_=dualPath;
const auto videoAiPath=std::filesystem::path(path_).concat(L".video-ai");
if(std::filesystem::exists(directVideoAi))path_=directVideoAi;else if(std::filesystem::exists(videoAiPath))path_=videoAiPath;
+ // DLSS SR / FSR as the second double SR pass (library v19, session v14).
+ const auto anySrPath=std::filesystem::path(path_).concat(L".dual-sr-any");
+ if(std::filesystem::exists(directAnySr))path_=directAnySr;else if(std::filesystem::exists(anySrPath))path_=anySrPath;
const bool exists = std::filesystem::exists(path_, ec);
if (!exists && !ec) return true;
const auto size = std::filesystem::file_size(path_, ec);
@@ -1182,6 +1199,8 @@ bool ChainSessionStore::save(const ChainSession& session) {
const auto data = encode(session);
ChainSession checked;
if (!decode(data, checked)) { error_ = L"模式会话编码校验失败,未保存"; return false; }
+ if(data.starts_with("VEYRA_CHAIN_SESSION 14")&&!path_.wstring().ends_with(L".dual-sr-any"))path_=std::filesystem::path(path_).concat(L".dual-sr-any");
+ if(!path_.wstring().ends_with(L".dual-sr-any")){
if(data.starts_with("VEYRA_CHAIN_SESSION 13")&&!path_.wstring().ends_with(L".video-ai"))path_=std::filesystem::path(path_).concat(L".video-ai");
if(!path_.wstring().ends_with(L".video-ai")){
if(data.starts_with("VEYRA_CHAIN_SESSION 12")&&!path_.wstring().ends_with(L".dual-sr"))path_=std::filesystem::path(path_).concat(L".dual-sr");
@@ -1218,6 +1237,7 @@ bool ChainSessionStore::save(const ChainSession& session) {
}
}
}
+ }
std::error_code ec;
if (!path_.parent_path().empty()) std::filesystem::create_directories(path_.parent_path(), ec);
if (ec) { error_ = L"模式会话目录无法创建"; return false; }
diff --git a/src/engine/PresetStore.cpp b/src/engine/PresetStore.cpp
index 8264fe36..943ffb4f 100644
--- a/src/engine/PresetStore.cpp
+++ b/src/engine/PresetStore.cpp
@@ -53,7 +53,11 @@ std::string PresetStore::serialize()const{
// v35: RTX Video SR high bitrate / streaming values (16..23) as the base or
// second SR quality; older readers reject them. The version implies every
// earlier field, so it forces the v34 layout.
- const bool videoAi=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return vfxVideoSr(p.settings.videoSrQuality)||vfxVideoSr(p.settings.dualSrQuality);});
+ // v36: DLSS SR or FSR as the second double SR pass (2026-11-08). Readers up to
+ // v35 reject a second value outside RTX Video SR, so it gets its own version
+ // (implying the v35 layout).
+ const bool anySr=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return !rtxVideoSr(p.settings.dualSrQuality);});
+ const bool videoAi=anySr||std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return vfxVideoSr(p.settings.videoSrQuality)||vfxVideoSr(p.settings.dualSrQuality);});
const bool dual=videoAi||std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return p.settings.dualSrEnabled||p.settings.dualSrTarget!=pipeline::SrTarget::Uhd4K||p.settings.dualSrQuality!=kDefaultVideoSrQuality;});
const bool fullSchema=fsr4||higher||rendering||vfg||correction||dlss||nrModel||srStage||dual;
const bool correctionExtended=dual||srStage||nrModel||dlss||std::any_of(entries_.begin(),entries_.end(),[](const auto& p){
@@ -61,7 +65,7 @@ std::string PresetStore::serialize()const{
for(unsigned i=0;i<p.settings.nrLayerCount;++i)if(p.settings.nrLayers[i].residual.correction.extendedControls())return true;
return false;});
// v26 introduces appended resolution IDs; old readers reject this schema.
- std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS "<<(videoAi?35:dual?34:srStage?33:nrModel?32:dlss?31:correctionExtended?30:correction?29:vfg?28:rendering?27:higher?26:fsr4?25:hold?24:stack?23:multi?22:21)<<'\n'<<std::quoted(utf8(default_))<<' '<<entries_.size()<<'\n';
+ std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS "<<(anySr?36:videoAi?35:dual?34:srStage?33:nrModel?32:dlss?31:correctionExtended?30:correction?29:vfg?28:rendering?27:higher?26:fsr4?25:hold?24:stack?23:multi?22:21)<<'\n'<<std::quoted(utf8(default_))<<' '<<entries_.size()<<'\n';
for(auto& p:entries_){const auto& s=p.settings;const auto& m=s.model;const auto& r=s.residual;o<<std::quoted(utf8(p.name))<<' '<<m.intensity<<' '<<m.tone<<' '<<m.structure<<' '<<m.skin<<' '<<m.style<<' '<<m.autoMask<<' '<<m.uiCorrection<<' '<<r.total<<' '<<r.darken<<' '<<r.brighten<<' '<<r.color<<' '<<r.luminance<<' '<<s.nr<<' '<<s.sr<<' '<<s.multiplier<<' '<<int(s.nrPolicy)<<' '<<int(s.flow)<<' '<<int(s.content)<<' '<<s.protection.enabled<<' '<<s.protection.featherPixels;for(auto q:s.protection.regions)o<<' '<<q.left<<' '<<q.top<<' '<<q.right<<' '<<q.bottom;o<<' '<<s.videoSrQuality<<' '<<int(s.frameGenerationBackend)<<' '<<int(s.srTarget)<<' '<<int(s.opticalFlowBackend)<<' '<<s.amdFlowHalfResolution<<' '<<int(s.audioSync)<<' '<<s.audioOffsetMs<<' '<<int(s.nrRuntime)<<' '<<s.captureCompatible<<' '<<s.lowLatency<<' '<<s.forceSdrPreview<<' '<<int(s.captureAudio)<<' '<<s.exportBitrateMbps<<' '<<s.captureFlipVertical<<' '<<int(s.captureBuffer)<<' ';writeColorSettings(o,s.color,utf8(s.color.lutNameString()));o<<' '<<s.videoHdr.enabled<<' '<<s.videoHdr.contrast<<' '<<s.videoHdr.saturation<<' '<<s.videoHdr.middleGray<<' '<<s.videoHdr.peakNits<<' '<<s.nrTemporal;
if(multi||fullSchema){o<<' '<<s.additionalColorCount;for(unsigned i=0;i<s.additionalColorCount;++i){o<<' ';writeColorSettings(o,s.additionalColors[i],utf8(s.additionalColors[i].lutNameString()));}}
if(stack||fullSchema){
@@ -96,7 +100,7 @@ std::string PresetStore::serialize()const{
}
bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,std::wstring& def){
if(data.size()>kMaxPresetBytes)return false;std::istringstream in(data);in.imbue(std::locale::classic());std::string magic,d;int version=0;size_t count=0;
- if(!(in>>magic>>version)||magic!="VEYRA_PRESETS"||(version<1||version>35)||!(in>>std::quoted(d)>>count)||count>64)return false;def=wide(d);if(!d.empty()&&def.empty())return false;
+ if(!(in>>magic>>version)||magic!="VEYRA_PRESETS"||(version<1||version>36)||!(in>>std::quoted(d)>>count)||count>64)return false;def=wide(d);if(!d.empty()&&def.empty())return false;
for(size_t i=0;i<count;++i){UserPreset p;std::string n;int policy,flow,content,nr,sr;auto& s=p.settings;auto& m=s.model;auto& r=s.residual;
if(!(in>>std::quoted(n)>>m.intensity>>m.tone>>m.structure>>m.skin>>m.style>>m.autoMask>>m.uiCorrection>>r.total>>r.darken>>r.brighten>>r.color>>r.luminance>>nr>>sr>>s.multiplier>>policy>>flow>>content))return false;
if(version>=2){int enabled;if(!(in>>enabled>>s.protection.featherPixels)||enabled<0||enabled>1)return false;s.protection.enabled=enabled!=0;
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 27f0e0f1..c7eec6e5 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -70,19 +70,33 @@ float uintBits(uint32_t v) { return std::bit_cast<float>(v); }
// quality under double SR; the first pass (source -> first result) exists only
// there. Each pass runs its own family's runtime: NGX for the standard family,
// Video Effects VideoSuperRes for high bitrate and streaming.
-uint32_t finalVideoSrQuality(const EnhanceGraphDesc& d){return d.dualSr?d.dualSrQuality:d.videoSrQuality;}
+// Under double SR (2026-11-08) each pass picks its own backend, so DLSS SR or FSR
+// may sit beside an RTX Video SR pass.
+uint32_t finalVideoSrQuality(const EnhanceGraphDesc& d){return d.finalSrQuality();}
bool ngxVideoSrPass(const EnhanceGraphDesc& d){
- return engine::rtxVideoSr(d.videoSrQuality)&&(engine::ngxVideoSr(finalVideoSrQuality(d))||(d.dualSr&&engine::ngxVideoSr(d.videoSrQuality)));
+ return engine::ngxVideoSr(finalVideoSrQuality(d))||(d.dualSr&&engine::ngxVideoSr(d.videoSrQuality));
}
// The Video Effects families only enlarge: a first double SR result at the
// source size (source already at the base target) is the source itself.
bool vfxFirstSrPass(const EnhanceGraphDesc& d){
- return d.dualSr&&engine::vfxVideoSr(d.videoSrQuality)&&(d.firstSrWidth!=d.sourceWidth||d.firstSrHeight!=d.sourceHeight);
+ return d.dualSr&&engine::vfxVideoSr(d.videoSrQuality)&&d.firstSrEnlarges();
}
unsigned vfxVideoSrPasses(const EnhanceGraphDesc& d){
- if(!engine::rtxVideoSr(d.videoSrQuality))return 0;
return unsigned(engine::vfxVideoSr(finalVideoSrQuality(d)))+unsigned(vfxFirstSrPass(d));
}
+// DLSS SR and FSR are temporal: they read guidance motion, RTX Video SR does not.
+bool temporalSrQuality(uint32_t quality){return quality==0||quality==engine::kVideoSrFsr;}
+bool temporalSrPass(const EnhanceGraphDesc& d){
+ return temporalSrQuality(finalVideoSrQuality(d))||(d.dualSr&&temporalSrQuality(d.videoSrQuality));
+}
+// Double SR with at least one DLSS SR / FSR pass. Two RTX Video SR passes keep
+// their original path (runVideoSr) command for command.
+bool mixedDualSr(const EnhanceGraphDesc& d){
+ return d.dualSr&&(!engine::rtxVideoSr(d.videoSrQuality)||!engine::rtxVideoSr(d.dualSrQuality));
+}
+const char* srRuntimeName(uint32_t quality){
+ return quality==0?"dlss":quality==engine::kVideoSrFsr?"fsr":engine::vfxVideoSr(quality)?"video-effects":"ngx";
+}
// N1 packed capture ingress helpers. Codes match pipeline::packedInputCode:
// 1 BGR24, 2 RGB555, 3 RGB565, 4 UYVY, 5 YVYU, 6 v210, 7 RGBXLE10.
@@ -610,7 +624,7 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
if((desc.srInputWidth==0)!=(desc.srInputHeight==0)||(desc.srOutputWidth==0)!=(desc.srOutputHeight==0)){veyra::log::error("resolution","partial SR extent is invalid");return false;}
srInW_=desc.srInputWidth?desc.srInputWidth:srcW_;srInH_=desc.srInputHeight?desc.srInputHeight:srcH_;
srOutW_=desc.srOutputWidth?desc.srOutputWidth:workW_;srOutH_=desc.srOutputHeight?desc.srOutputHeight:workH_;
- if(desc.dualSr&&(!engine::rtxVideoSr(desc.videoSrQuality)||!engine::rtxVideoSr(desc.dualSrQuality)||
+ if(desc.dualSr&&(!engine::validVideoSrQuality(desc.videoSrQuality)||!engine::validVideoSrQuality(desc.dualSrQuality)||
!Extent{desc.firstSrWidth,desc.firstSrHeight}.valid()||!srPrescaleActive())){
veyra::log::error("dual-sr","invalid independent SR stages or missing reduction");return false;
}
@@ -619,7 +633,8 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
// enlarges with RTX Video SR and then shrinks into the work extent.
if(!Extent{srInW_,srInH_}.valid()||!Extent{srOutW_,srOutH_}.valid()||srInW_>(desc.dualSr?desc.firstSrWidth:srcW_)||srInH_>(desc.dualSr?desc.firstSrHeight:srcH_)||
srOutW_<workW_||srOutH_<workH_||srOutW_<=srInW_||srOutH_<=srInH_){veyra::log::error("resolution","invalid staged SR extent");return false;}
- if(!desc.enableSr||!engine::rtxVideoSr(desc.videoSrQuality)){veyra::log::error("resolution","staged SR runs on RTX Video SR only");return false;}
+ // Double SR runs any SR backend; the supersample shrink only RTX Video SR.
+ if(!desc.enableSr||(!desc.dualSr&&!engine::rtxVideoSr(desc.videoSrQuality))){veyra::log::error("resolution","supersampled SR runs on RTX Video SR only");return false;}
}
diagnostics::DiagnosticEvent initDiagnostic;initDiagnostic.stage="initialize";initDiagnostic.identity={epoch_+1,desc.settingsRevision,0};initDiagnostic.resolution.source={srcW_,srcH_};initDiagnostic.resolution.base=initDiagnostic.resolution.fg=initDiagnostic.resolution.output={workW_,workH_};initDiagnostic.resolution.nr={nrW_,nrH_};initDiagnostic.resolution.flow={nvofW_,nvofH_};initDiagnostic.flowApplied=std::to_string(unsigned(desc.flowQuality));initDiagnostic.runtimeHash="unverified-user-replaceable";Logger::diagnosticContext(initDiagnostic);
veyra::log::info("resolution",std::format("source={}x{} base={}x{} nr={}x{} flow={}x{} fg={}x{} output={}x{}",srcW_,srcH_,workW_,workH_,nrW_,nrH_,nvofW_,nvofH_,workW_,workH_,workW_,workH_));
@@ -668,12 +683,29 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
const bool vfg=fgEnabled_&&desc_.frameGenerationBackend==engine::FrameGenerationBackend::Vfg;
const uint64_t vfgSharedBytes=vfg?uint64_t((workW_*4u+255u)&~255u)*workH_*(2u+2u*(desc_.fgMultiplier-1u)):0;
const unsigned generatedTextures=fgEnabled_?(fsrEnabled()?2u:vfg?2u*(desc_.fgMultiplier-1u):10u):0;
- const uint64_t dualBytes=desc_.dualSr?uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*12u+uint64_t(srcW_)*srcH_*4u:0;
+ // Constant depth / zero motion for the temporal SR passes: the source extent
+ // for a single FSR pass, the largest DLSS SR / FSR input or motion extent of
+ // a double SR (a first DLSS pass takes motion at its result, a second DLSS
+ // pass at the work extent, a second FSR pass renders at the SR input).
+ const bool fsrSinglePass=srEnabled_&&!desc_.dualSr&&desc_.videoSrQuality==engine::kVideoSrFsr;
+ const bool temporalDual=srEnabled_&&desc_.dualSr&&(temporalSrQuality(desc_.videoSrQuality)||temporalSrQuality(desc_.dualSrQuality));
+ fsrAuxW_=fsrAuxH_=0;
+ if(fsrSinglePass||temporalDual){
+ fsrAuxW_=srcW_;fsrAuxH_=srcH_;
+ const auto grow=[this](uint32_t w,uint32_t h){fsrAuxW_=std::max(fsrAuxW_,w);fsrAuxH_=std::max(fsrAuxH_,h);};
+ if(desc_.firstSrRuns(0))grow(desc_.firstSrWidth,desc_.firstSrHeight);
+ if(desc_.dualSr&&temporalSrQuality(desc_.dualSrQuality))grow(srInW_,srInH_);
+ if(desc_.dualSr&&desc_.dualSrQuality==0)grow(workW_,workH_);
+ }
+ const bool firstVideoSr=desc_.dualSr&&engine::rtxVideoSr(desc_.videoSrQuality);
+ const uint64_t dualBytes=desc_.dualSr?uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*(firstVideoSr?12u:8u)+(firstVideoSr?uint64_t(srcW_)*srcH_*4u:0)+
+ (desc_.firstSrRuns(0)?uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*4u:0)+(desc_.dualSrQuality==engine::kVideoSrFsr?uint64_t(srInW_)*srInH_*4u:0)+
+ (temporalDual?uint64_t(fsrAuxW_)*fsrAuxH_*8u:0):0;
// Supersampling keeps the larger RGBA8 SR result beside the work textures.
const uint64_t supersampleBytes=!desc_.dualSr&&srResolveActive()?uint64_t(srOutW_)*srOutH_*4u:0;
const bool stagedSr=desc_.dualSr||supersampleBytes>0;
// Each Video Effects SR pass keeps a shared CUDA input and output buffer.
- const bool vfxFinal=srEnabled_&&engine::rtxVideoSr(desc_.videoSrQuality)&&engine::vfxVideoSr(finalVideoSrQuality(desc_));
+ const bool vfxFinal=srEnabled_&&engine::vfxVideoSr(finalVideoSrQuality(desc_));
const bool vfxFirst=srEnabled_&&vfxFirstSrPass(desc_);
const uint64_t vfxSrBytes=(vfxFinal?uint64_t(srInW_)*srInH_*4u+uint64_t(srOutW_)*srOutH_*4u:0)+
(vfxFirst?uint64_t(srcW_)*srcH_*4u+uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*4u:0);
@@ -689,9 +721,12 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
// The new reservation belongs to the staged graphs (double SR and the
// supersample shrink). Keep the existing single-pass admission policy,
// including ordinary 8K.
- // 256 MiB per loaded SR model: the NGX feature (shared by its passes) and
- // each Video Effects instance. An estimate, not a measured SDK peak.
- const uint64_t srModels=std::max(1u,unsigned(vfxFinal)+unsigned(vfxFirst)+unsigned(srEnabled_&&ngxVideoSrPass(desc_)));
+ // 256 MiB per loaded SR model: the NGX feature (shared by its passes),
+ // each Video Effects instance, and each DLSS SR feature / FSR context of a
+ // double SR. An estimate, not a measured SDK peak.
+ const unsigned temporalModels=srEnabled_?unsigned(temporalSrQuality(finalVideoSrQuality(desc_)))+
+ unsigned(desc_.firstSrRuns(0))+unsigned(desc_.firstSrRuns(engine::kVideoSrFsr)):0u;
+ const uint64_t srModels=std::max(1u,unsigned(vfxFinal)+unsigned(vfxFirst)+unsigned(srEnabled_&&ngxVideoSrPass(desc_))+temporalModels);
const uint64_t sdkReserve=stagedSr?((nrEnabled_?(1024ull<<20):0)+
(vfg?uint64_t(workW_)*workH_*128u:0)+srModels*(256ull<<20)):0;
const uint64_t required=estimate+sdkReserve;
@@ -782,27 +817,35 @@ bool EnhanceGraph::createResources()
videoHdrOutput_=makeTexture(context_.device(),workW_,workH_,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
if(!videoHdrInput_||!videoHdrOutput_)return false;
}
- if(srEnabled_&&desc_.videoSrQuality&&desc_.videoSrQuality!=engine::kVideoSrFsr){videoSrInput_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);videoSrOutput_=makeTexture(context_.device(),srOutW_,srOutH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);if(!videoSrInput_||!videoSrOutput_)return false;
- // Three-step SR: the linear SR input after the exact area shrink.
- if(srPrescaleActive()&&!(srPrescaled_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R16G16B16A16_FLOAT,true)))return false;
- if(desc_.dualSr){
+ // RTX Video SR in the final pass (the only pass without double SR) reads and
+ // writes RGBA8.
+ if(srEnabled_&&engine::rtxVideoSr(finalVideoSrQuality(desc_))){videoSrInput_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);videoSrOutput_=makeTexture(context_.device(),srOutW_,srOutH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);if(!videoSrInput_||!videoSrOutput_)return false;}
+ // Three-step SR: the linear SR input after the exact area shrink.
+ if(srEnabled_&&srPrescaleActive()&&!(srPrescaled_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R16G16B16A16_FLOAT,true)))return false;
+ if(srEnabled_&&desc_.dualSr){
+ // Every first pass leaves a linear result; RTX Video SR also needs its RGBA8 pair.
+ firstSrLinear_=makeTexture(context_.device(),desc_.firstSrWidth,desc_.firstSrHeight,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
+ if(!firstSrLinear_)return false;
+ if(engine::rtxVideoSr(desc_.videoSrQuality)){
firstSrInput_=makeTexture(context_.device(),srcW_,srcH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);
firstSrOutput_=makeTexture(context_.device(),desc_.firstSrWidth,desc_.firstSrHeight,DXGI_FORMAT_R8G8B8A8_UNORM,true);
- firstSrLinear_=makeTexture(context_.device(),desc_.firstSrWidth,desc_.firstSrHeight,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
- if(!firstSrInput_||!firstSrOutput_||!firstSrLinear_)return false;
+ if(!firstSrInput_||!firstSrOutput_)return false;
}
+ if(desc_.firstSrRuns(0)&&!(firstSrFlow_=makeTexture(context_.device(),desc_.firstSrWidth,desc_.firstSrHeight,DXGI_FORMAT_R16G16_FLOAT,true)))return false;
+ if(desc_.dualSrQuality==engine::kVideoSrFsr&&!(secondSrFlow_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R16G16_FLOAT,true)))return false;
}
// FSR upscaling needs a render-extent depth; Veyra has no source-resolution
// depth source, so this is the same explicit constant far depth the
// frame-generation path uses. It limits disocclusion quality and must not
- // be described as engine-native depth.
- if(srEnabled_&&desc_.videoSrQuality==engine::kVideoSrFsr){
- fsrSrDepth_=makeTexture(context_.device(),srcW_,srcH_,DXGI_FORMAT_R32_FLOAT,false);
- fsrSrZeroMotion_=makeTexture(context_.device(),srcW_,srcH_,DXGI_FORMAT_R16G16_FLOAT,false);
+ // be described as engine-native depth. Double SR DLSS SR passes use it too
+ // (fsrAuxW_ x fsrAuxH_, sized in initialize()).
+ if(fsrAuxW_&&fsrAuxH_){
+ fsrSrDepth_=makeTexture(context_.device(),fsrAuxW_,fsrAuxH_,DXGI_FORMAT_R32_FLOAT,false);
+ fsrSrZeroMotion_=makeTexture(context_.device(),fsrAuxW_,fsrAuxH_,DXGI_FORMAT_R16G16_FLOAT,false);
if(!fsrSrDepth_||!fsrSrZeroMotion_)return false;
- fsrSrDepthPitch_=(size_t(srcW_)*sizeof(float)+255)&~size_t(255);
- upFsrSrDepth_=makeUploadBuffer(context_.device(),fsrSrDepthPitch_*srcH_);
- upFsrSrZeroMotion_=makeUploadBuffer(context_.device(),fsrSrDepthPitch_*srcH_);
+ fsrSrDepthPitch_=(size_t(fsrAuxW_)*sizeof(float)+255)&~size_t(255);
+ upFsrSrDepth_=makeUploadBuffer(context_.device(),fsrSrDepthPitch_*fsrAuxH_);
+ upFsrSrZeroMotion_=makeUploadBuffer(context_.device(),fsrSrDepthPitch_*fsrAuxH_);
if(!upFsrSrDepth_||!upFsrSrZeroMotion_)return false;
}
const bool directBase=!srEnabled_&&srcW_==workW_&&srcH_==workH_&&!desc_.splitNrAcrossSr()&&!desc_.sourcePostActive();
@@ -974,9 +1017,9 @@ bool EnhanceGraph::initZeroAndDepthTextures()
upZeroDepth_->Unmap(0, nullptr);
upZeroMotion_->Unmap(0, nullptr);
if(upFsrSrDepth_!=nullptr){
- for(uint32_t y=0;y<srcH_;++y){
+ for(uint32_t y=0;y<fsrAuxH_;++y){
float* row=reinterpret_cast<float*>(fd+size_t(y)*fsrSrDepthPitch_);
- for(uint32_t x=0;x<srcW_;++x)row[x]=0.9f;
+ for(uint32_t x=0;x<fsrAuxW_;++x)row[x]=0.9f;
}
upFsrSrDepth_->Unmap(0,nullptr);
}
@@ -1012,7 +1055,7 @@ bool EnhanceGraph::initZeroAndDepthTextures()
uploadTex(depthTex_.Get(), upDepth_, DXGI_FORMAT_R32_FLOAT);
uploadTex(nrZeroDepth_.Get(), upZeroDepth_, DXGI_FORMAT_R32_FLOAT);
uploadTex(nrZeroMotion_.Get(), upZeroMotion_, DXGI_FORMAT_R16G16_FLOAT);
- if(fsrSrZeroMotion_){void* data=nullptr;D3D12_RANGE read{0,0};if(FAILED(upFsrSrZeroMotion_->Map(0,&read,&data))||!data)return false;std::memset(data,0,fsrSrDepthPitch_*srcH_);upFsrSrZeroMotion_->Unmap(0,nullptr);uploadTex(fsrSrZeroMotion_.Get(),upFsrSrZeroMotion_,DXGI_FORMAT_R16G16_FLOAT,srcW_,srcH_,fsrSrDepthPitch_);}
+ if(fsrSrZeroMotion_){void* data=nullptr;D3D12_RANGE read{0,0};if(FAILED(upFsrSrZeroMotion_->Map(0,&read,&data))||!data)return false;std::memset(data,0,fsrSrDepthPitch_*fsrAuxH_);upFsrSrZeroMotion_->Unmap(0,nullptr);uploadTex(fsrSrZeroMotion_.Get(),upFsrSrZeroMotion_,DXGI_FORMAT_R16G16_FLOAT,fsrAuxW_,fsrAuxH_,fsrSrDepthPitch_);}
if(fsrSrDepth_!=nullptr&&upFsrSrDepth_!=nullptr){
D3D12_RESOURCE_BARRIER b{};
b.Transition.pResource=fsrSrDepth_.Get();
@@ -1026,8 +1069,8 @@ bool EnhanceGraph::initZeroAndDepthTextures()
src.pResource=upFsrSrDepth_.Get();
src.Type=D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
src.PlacedFootprint.Footprint.Format=DXGI_FORMAT_R32_FLOAT;
- src.PlacedFootprint.Footprint.Width=srcW_;
- src.PlacedFootprint.Footprint.Height=srcH_;
+ src.PlacedFootprint.Footprint.Width=fsrAuxW_;
+ src.PlacedFootprint.Footprint.Height=fsrAuxH_;
src.PlacedFootprint.Footprint.Depth=1;
src.PlacedFootprint.Footprint.RowPitch=static_cast<UINT>(fsrSrDepthPitch_);
list->CopyTextureRegion(&dst,0,0,0,&src,nullptr);
@@ -1050,7 +1093,7 @@ bool EnhanceGraph::initNvof()
// Keep the zero-motion and VFG paths free of an unused optical-flow session.
const bool inGraphFgFlow=fgEnabled_&&desc_.fgUsesFlow()&&
(desc_.frameGenerationBackend==engine::FrameGenerationBackend::Dlss||engine::fsrFrameGeneration(desc_.frameGenerationBackend));
- if (desc_.noFeatures || !(nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || inGraphFgFlow || (srEnabled_&&desc_.srUsesFlow()&&(desc_.videoSrQuality==0||desc_.videoSrQuality==engine::kVideoSrFsr)))) {
+ if (desc_.noFeatures || !(nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || inGraphFgFlow || (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_)))) {
mvecSource_="zero motion (no external flow consumer)";
veyra::log::info("graph", "optical-flow session skipped: no external motion consumer");
return true;
@@ -1099,7 +1142,11 @@ bool EnhanceGraph::initNvof()
bool EnhanceGraph::fsrSrEnabled() const
{
- return fsrSrBackend_ != nullptr && fsrSrBackend_->created();
+ // Every requested FSR pass exists (double SR may run FSR in either pass).
+ const bool finalFsr=desc_.finalSrQuality()==engine::kVideoSrFsr,firstFsr=desc_.firstSrRuns(engine::kVideoSrFsr);
+ if(!finalFsr&&!firstFsr)return false;
+ return (!finalFsr||(fsrSrBackend_!=nullptr&&fsrSrBackend_->created()))&&
+ (!firstFsr||(firstFsrSrBackend_!=nullptr&&firstFsrSrBackend_->created()));
}
void EnhanceGraph::applyAdaMfgUnlock()
@@ -1266,19 +1313,26 @@ bool EnhanceGraph::initFsrSr()
return true;
}
failedBackend_=engine::FailedBackend::Sr;
- fsrSrBackend_=std::make_unique<gfx::FsrSrBackend>();
- if(!fsrSrBackend_->initialize(context_.device(),srcW_,srcH_,workW_,workH_,false)){
- fsrSrBackend_.reset();
- // The engine checks fsrSrRequested() && !fsrSrEnabled() after the graph
- // is created and disables the stage with a user-visible warning, so a
- // missing local runtime never blocks basic playback.
- veyra::log::error("fsr-sr", "AMD FSR upscaling unavailable; the engine will disable the stage");
- failedBackend_=engine::FailedBackend::None;
+ // Double SR may run FSR in either pass, each with its own context and history:
+ // the final pass renders the reduced first result, the first pass the source.
+ const bool finalFsr=desc_.finalSrQuality()==engine::kVideoSrFsr,firstFsr=desc_.firstSrRuns(engine::kVideoSrFsr);
+ const uint32_t renderW=desc_.dualSr?srInW_:srcW_,renderH=desc_.dualSr?srInH_:srcH_;
+ const auto create=[&](std::unique_ptr<gfx::FsrSrBackend>& backend,uint32_t inW,uint32_t inH,uint32_t outW,uint32_t outH,const char* pass){
+ backend=std::make_unique<gfx::FsrSrBackend>();
+ if(!backend->initialize(context_.device(),inW,inH,outW,outH,false)){
+ backend.reset();
+ // The engine checks fsrSrRequested() && !fsrSrEnabled() after the graph
+ // is created and disables the stage with a user-visible warning, so a
+ // missing local runtime never blocks basic playback.
+ veyra::log::error("fsr-sr", std::format("AMD FSR upscaling unavailable{}; the engine will disable the stage",pass));
+ return false;
+ }
+ veyra::log::info("fsr-sr", std::format("selected{} render={}x{} output={}x{} provider={}",pass,inW,inH,outW,outH,backend->providerVersion()));
return true;
- }
+ };
+ if(finalFsr&&!create(fsrSrBackend_,renderW,renderH,workW_,workH_,desc_.dualSr?" second pass":"")){failedBackend_=engine::FailedBackend::None;return true;}
+ if(firstFsr&&!create(firstFsrSrBackend_,srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight," first pass")){failedBackend_=engine::FailedBackend::None;return true;}
failedBackend_=engine::FailedBackend::None;
- veyra::log::info("fsr-sr", std::format("selected render={}x{} output={}x{} provider={}",srcW_,srcH_,workW_,workH_,
- fsrSrBackend_->providerVersion()));
return true;
}
@@ -1343,7 +1397,7 @@ bool EnhanceGraph::initNgxFeatures()
// FSR upscaling is a FidelityFX effect: a session whose only feature is
// FSR SR must not require (or fail on) the NGX core.
const bool needNgxCore = (nrEnabled_ && !lmxxfNr_) || (fgEnabled_ && !fsrEnabled() && !vfgBackend_) || desc_.convertVideoHdr() ||
- (srEnabled_ && (desc_.videoSrQuality==0 || ngxVideoSrPass(desc_)));
+ (srEnabled_ && (desc_.finalSrQuality()==0 || desc_.firstSrRuns(0) || ngxVideoSrPass(desc_)));
if (!needNgxCore) {
veyra::log::info("graph", "NGX core skipped: lmxxf NR / AMD FSR stages use their own runtimes");
}
@@ -1583,38 +1637,53 @@ bool EnhanceGraph::initNgxFeatures()
}
failedBackend_=engine::FailedBackend::Infrastructure;
}
- if (srEnabled_ && !desc_.noFeatures && (desc_.videoSrQuality==0||ngxVideoSrPass(desc_))) {
+ const bool dlssFinal=desc_.finalSrQuality()==0,dlssFirst=desc_.firstSrRuns(0);
+ if (srEnabled_ && !desc_.noFeatures && (dlssFinal||dlssFirst||ngxVideoSrPass(desc_))) {
+ // DLSS SR: the final pass reads the source, or under double SR the reduced
+ // first result; a first DLSS pass enlarges the source into the first result.
ngx::DlssSrBackend::CreateDesc sd{};
- sd.inputWidth = srcW_; sd.inputHeight = srcH_;
+ sd.inputWidth = desc_.dualSr?srInW_:srcW_; sd.inputHeight = desc_.dualSr?srInH_:srcH_;
sd.outputWidth = workW_; sd.outputHeight = workH_;
sd.perfQuality = 1; sd.enableOutputSubrects = false; sd.model = desc_.dlssSrModel;
ID3D12GraphicsCommandList* list = ring_.acquire(0, st);
if (list == nullptr) { failedBackend_=engine::FailedBackend::Infrastructure; return false; }
failedBackend_=engine::FailedBackend::Sr;
- if(desc_.videoSrQuality){
- if(engine::ngxVideoSr(finalVideoSrQuality(desc_))){videoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!videoSrBackend_->create(*coreHost_,list,desc_.dualSr?srInW_:0,desc_.dualSr?srInH_:0,desc_.dualSr?srOutW_:0,desc_.dualSr?srOutH_:0))return false;veyra::log::info("video-sr",std::format("selected quality={} input={}x{} output={}x{}{}",desc_.videoSrQuality,srcW_,srcH_,workW_,workH_,
- desc_.dualSr?std::format(" dual reduce={}x{} evaluate={}x{}",srInW_,srInH_,srOutW_,srOutH_):
- srResolveActive()?std::format(" supersample evaluate={}x{} output={}x{}",srOutW_,srOutH_,workW_,workH_):std::string()));}
- if(desc_.dualSr&&engine::ngxVideoSr(desc_.videoSrQuality)){firstVideoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!firstVideoSrBackend_->create(*coreHost_,list,srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight)){
- // A shared create key reuses the final pass's feature; without one there is no fallback.
- if(!videoSrBackend_||!firstVideoSrBackend_->duplicateCreation())return false;
- firstVideoSrBackend_.reset();
- veyra::log::info("dual-sr","SDK create key shared; two ordered evaluations with separate textures");
- }
- if(firstVideoSrBackend_&&videoSrBackend_&&firstVideoSrBackend_->identity()==videoSrBackend_->identity()){veyra::log::error("dual-sr","runtime aliased the independent feature handles");return false;}
+ if(engine::ngxVideoSr(finalVideoSrQuality(desc_))){videoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!videoSrBackend_->create(*coreHost_,list,desc_.dualSr?srInW_:0,desc_.dualSr?srInH_:0,desc_.dualSr?srOutW_:0,desc_.dualSr?srOutH_:0))return false;veyra::log::info("video-sr",std::format("selected quality={} input={}x{} output={}x{}{}",desc_.videoSrQuality,srcW_,srcH_,workW_,workH_,
+ desc_.dualSr?std::format(" dual reduce={}x{} evaluate={}x{}",srInW_,srInH_,srOutW_,srOutH_):
+ srResolveActive()?std::format(" supersample evaluate={}x{} output={}x{}",srOutW_,srOutH_,workW_,workH_):std::string()));}
+ if(desc_.dualSr&&engine::ngxVideoSr(desc_.videoSrQuality)){firstVideoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!firstVideoSrBackend_->create(*coreHost_,list,srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight)){
+ // A shared create key reuses the final pass's feature; without one there is no fallback.
+ if(!videoSrBackend_||!firstVideoSrBackend_->duplicateCreation())return false;
+ firstVideoSrBackend_.reset();
+ veyra::log::info("dual-sr","SDK create key shared; two ordered evaluations with separate textures");
}
+ if(firstVideoSrBackend_&&videoSrBackend_&&firstVideoSrBackend_->identity()==videoSrBackend_->identity()){veyra::log::error("dual-sr","runtime aliased the independent feature handles");return false;}
}
- else if (!srBackend_->create(*coreHost_, list, ngxParams_, sd, st) || !srBackend_->created()) {
+ if(dlssFinal&&(!srBackend_->create(*coreHost_, list, ngxParams_, sd, st) || !srBackend_->created())) {
veyra::log::error("graph", "SR create failed");
return false;
}
+ if(dlssFirst){
+ // Its own feature and history: the two DLSS SR passes differ in size.
+ ngx::DlssSrBackend::CreateDesc first=sd;
+ first.inputWidth=srcW_;first.inputHeight=srcH_;first.outputWidth=desc_.firstSrWidth;first.outputHeight=desc_.firstSrHeight;
+ firstDlssSrBackend_=std::make_unique<ngx::DlssSrBackend>();
+ if(!firstDlssSrBackend_->create(*coreHost_,list,ngxParams_,first,st)||!firstDlssSrBackend_->created()){
+ veyra::log::error("dual-sr","first DLSS SR create failed");
+ return false;
+ }
+ }
failedBackend_=engine::FailedBackend::Infrastructure;
if(!ring_.submitAndSignal(0)||!ring_.waitIdle())return false;
}
- if(srEnabled_&&!desc_.noFeatures&&desc_.dualSr&&(videoSrBackend_||vfxSrBackend_))
+ if(srEnabled_&&!desc_.noFeatures&&desc_.dualSr){
+ // At the source size a first Video Effects / DLSS SR / FSR pass is a copy;
+ // the standard family restores there too.
+ const char* first=desc_.firstSrEnlarges()||engine::ngxVideoSr(desc_.videoSrQuality)?srRuntimeName(desc_.videoSrQuality):"copy";
veyra::log::info("dual-sr",std::format("passes=2 source={}x{} first={}x{} shrink={}x{} second={}x{} output={}x{} firstQuality={} secondQuality={} firstRuntime={} secondRuntime={}",srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight,srInW_,srInH_,srOutW_,srOutH_,workW_,workH_,desc_.videoSrQuality,desc_.dualSrQuality,
- firstVfxSrBackend_?"video-effects":engine::vfxVideoSr(desc_.videoSrQuality)?"copy":"ngx",vfxSrBackend_?"video-effects":"ngx"));
+ first,srRuntimeName(desc_.dualSrQuality)));
+ }
// Still images have no temporal pair and must not depend on FG support.
// FG create + warm-up evaluate BEFORE descriptor views (the runtime
@@ -1820,7 +1889,8 @@ bool EnhanceGraph::createComputePasses()
// original base. No extra texture: the final layer owns outputFull().
if(nrInstances_.size()>1&&!stackProtectionPass_.create(context_.device(),cs,4,3,1,40))return false;
}
- if(!flowAdaptPass_.loadShader("FlowAdapt.dxil",cs)||!flowAdaptPass_.create(context_.device(),cs,3+UINT(nrInstances_.size()),1,1))return false;
+ // Sets: 0 source flow, 1 NR, 2 work, 3.. NR layers, then the double SR pass motions.
+ if(!flowAdaptPass_.loadShader("FlowAdapt.dxil",cs)||!flowAdaptPass_.create(context_.device(),cs,secondSrFlowSet()+1,1,1))return false;
if(flowRefine_){
if(!fgFlowAdaptPass_.create(context_.device(),cs,2,1,1))return false;
if(!flowRefinePass_.loadShader("FlowRefine.dxil",cs)||!flowRefinePass_.create(context_.device(),cs,6,5,1))return false;
@@ -1862,7 +1932,7 @@ bool EnhanceGraph::createComputePasses()
// Three-step SR: NrDownsample's exact area shrink before RTX Video SR, SrResolve after it.
if(srPrescaled_&&(!srPrescalePass_.loadShader("NrDownsample.dxil",cs)||!srPrescalePass_.create(context_.device(),cs,2,1,1)))return false;
if(videoSrOutput_&&srResolveActive()&&(!srResolvePass_.loadShader("SrResolve.dxil",cs)||!srResolvePass_.create(context_.device(),cs,10,3,1)))return false;
- if(desc_.dualSr&&desc_.hdrWorking()&&(!firstSrRestorePass_.loadShader("HdrVideoSrRestore.dxil",cs)||!firstSrRestorePass_.create(context_.device(),cs,4,3,1)))return false;
+ if(firstSrInput_&&desc_.hdrWorking()&&(!firstSrRestorePass_.loadShader("HdrVideoSrRestore.dxil",cs)||!firstSrRestorePass_.create(context_.device(),cs,4,3,1)))return false;
if (!stager_.initialize(context_.device(), 96)) {
veyra::log::error("graph", "descriptor stager init failed");
return false;
@@ -2000,6 +2070,8 @@ bool EnhanceGraph::createViews()
makeUav(context_.device(),baseFlow_.Get(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,2));
for(size_t i=0;i<nrInstances_.size();++i)
makeUav(context_.device(),nrInstances_[i]->motion(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,3+UINT(i)));
+ if(firstSrFlow_)makeUav(context_.device(),firstSrFlow_.Get(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,firstSrFlowSet()));
+ if(secondSrFlow_)makeUav(context_.device(),secondSrFlow_.Get(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,secondSrFlowSet()));
if(flowRefine_){
// FlowRefine: 0 raw grid vectors, 1 previous, 2 current, 3 NVOF backward grid vectors,
// 4 FidelityFX scene changes (3/4 null when unused); 5 refined. FlowClaim: 0 refined;
@@ -2047,11 +2119,15 @@ bool EnhanceGraph::createViews()
makeUav(context_.device(),srPrescaled_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,cpu(srPrescalePass_,1));
stagedSrv(srPrescaled_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,blitPass_,21);
}
- if(desc_.dualSr){
+ if(firstSrLinear_){
+ // 22 -> 25 also copies the source into the first result when a first
+ // DLSS SR / FSR / Video Effects pass has nothing to enlarge.
stagedSrv(srStageInput(),DXGI_FORMAT_R16G16B16A16_FLOAT,blitPass_,22);
+ makeUav(context_.device(),firstSrLinear_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,cpu(blitPass_,25));
+ }
+ if(firstSrInput_){
makeUav(context_.device(),firstSrInput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,cpu(blitPass_,23));
stagedSrv(firstSrOutput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,blitPass_,24);
- makeUav(context_.device(),firstSrLinear_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,cpu(blitPass_,25));
if(desc_.hdrWorking()){
stagedSrv(srStageInput(),DXGI_FORMAT_R16G16B16A16_FLOAT,firstSrRestorePass_,0);
stagedSrv(firstSrInput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,firstSrRestorePass_,1);
@@ -2672,23 +2748,24 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
cpuTrace.mark("sourcePass");
}
- auto runVideoSr=[&]()->bool{
- gpuTimer_.mark(list,GpuStage::Sr);
- // Video Effects hand-off: copy in, submit, queue signal -> CUDA run -> queue
- // wait, then copy out on the next list of this slot. No CPU wait.
- auto runVfx=[&](VfxSrBackend& vfx,ID3D12Resource* input,ID3D12Resource* output)->bool{
- tracker_.transition(list,input,D3D12_RESOURCE_STATE_COPY_SOURCE);
- if(!vfx.copyIn(list,input)){failedBackend_=engine::FailedBackend::Sr;return false;}
- tracker_.transition(list,input,D3D12_RESOURCE_STATE_COMMON);
- if(!submitGraph(slot))return false;
- if(!vfx.run(ring_.queue())){failedBackend_=engine::FailedBackend::Sr;return false;}
- list=ring_.acquireNext(slot,st);if(!list)return false;
- tracker_.transition(list,output,D3D12_RESOURCE_STATE_COPY_DEST);
- if(!vfx.copyOut(list,output)){failedBackend_=engine::FailedBackend::Sr;return false;}
- tracker_.transition(list,output,D3D12_RESOURCE_STATE_COMMON);
- return true;
- };
- if(desc_.dualSr){
+ // Video Effects hand-off: copy in, submit, queue signal -> CUDA run -> queue
+ // wait, then copy out on the next list of this slot. No CPU wait.
+ auto runVfx=[&](VfxSrBackend& vfx,ID3D12Resource* input,ID3D12Resource* output)->bool{
+ tracker_.transition(list,input,D3D12_RESOURCE_STATE_COPY_SOURCE);
+ if(!vfx.copyIn(list,input)){failedBackend_=engine::FailedBackend::Sr;return false;}
+ tracker_.transition(list,input,D3D12_RESOURCE_STATE_COMMON);
+ if(!submitGraph(slot))return false;
+ if(!vfx.run(ring_.queue())){failedBackend_=engine::FailedBackend::Sr;return false;}
+ list=ring_.acquireNext(slot,st);if(!list)return false;
+ tracker_.transition(list,output,D3D12_RESOURCE_STATE_COPY_DEST);
+ if(!vfx.copyOut(list,output)){failedBackend_=engine::FailedBackend::Sr;return false;}
+ tracker_.transition(list,output,D3D12_RESOURCE_STATE_COMMON);
+ return true;
+ };
+ // First double SR pass on RTX Video SR: encode the stage input, evaluate,
+ // then leave the linear first result (HDR restored against the source).
+ auto firstVideoSr=[&]()->bool{
+ {
tracker_.transition(list,srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
tracker_.transition(list,firstSrInput_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
const float encFirst[8]={uintBits(srcW_),uintBits(srcH_),uintBits(srcW_),uintBits(srcH_),desc_.hdrWorking()?3.f:1.f,0,0,0};
@@ -2715,16 +2792,21 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
list->Dispatch((desc_.firstSrWidth+15)/16,(desc_.firstSrHeight+15)/16,1);tracker_.uavBarrier(list,firstSrLinear_.Get());
tracker_.transition(list,firstSrLinear_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);++metrics_.srEvaluateCount;
}
- // Double SR reduces the first AI result before the second pass (exact area, linear light).
+ return true;
+ };
+ // Double SR reduces the first AI result before the second pass (exact area, linear light).
+ auto reduceFirstSr=[&]{
+ if(!srPrescaled_)return;
+ tracker_.transition(list,desc_.dualSr?firstSrLinear_.Get():srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ tracker_.transition(list,srPrescaled_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ const float down[8]={uintBits(desc_.dualSr?desc_.firstSrWidth:srcW_),uintBits(desc_.dualSr?desc_.firstSrHeight:srcH_),uintBits(srInW_),uintBits(srInH_),0,0,0,0};
+ srPrescalePass_.bind(list,down,gpuHandleOf(srPrescalePass_,0).ptr,gpuHandleOf(srPrescalePass_,1).ptr);
+ list->Dispatch((srInW_+15)/16,(srInH_+15)/16,1);tracker_.uavBarrier(list,srPrescaled_.Get());
+ tracker_.transition(list,srPrescaled_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ };
+ // RTX Video SR into the work texture: the single pass, or the second of a double SR.
+ auto finalVideoSr=[&]()->bool{
const bool prescaled=srPrescaled_!=nullptr;
- if(prescaled){
- tracker_.transition(list,desc_.dualSr?firstSrLinear_.Get():srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- tracker_.transition(list,srPrescaled_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- const float down[8]={uintBits(desc_.dualSr?desc_.firstSrWidth:srcW_),uintBits(desc_.dualSr?desc_.firstSrHeight:srcH_),uintBits(srInW_),uintBits(srInH_),0,0,0,0};
- srPrescalePass_.bind(list,down,gpuHandleOf(srPrescalePass_,0).ptr,gpuHandleOf(srPrescalePass_,1).ptr);
- list->Dispatch((srInW_+15)/16,(srInH_+15)/16,1);tracker_.uavBarrier(list,srPrescaled_.Get());
- tracker_.transition(list,srPrescaled_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- }
tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
const float enc[8]={uintBits(srInW_),uintBits(srInH_),uintBits(srInW_),uintBits(srInH_),desc_.hdrWorking()?3.0f:1.0f,0,0,0};
blitPass_.bind(list,enc,gpuHandleOf(blitPass_,prescaled?21:desc_.nrBeforeSr||sourcePostOutput_?18:0).ptr,gpuHandleOf(blitPass_,16).ptr);list->Dispatch((srInW_+15)/16,(srInH_+15)/16,1);tracker_.uavBarrier(list,videoSrInput_.Get());
@@ -2746,12 +2828,20 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
}else blitPass_.bind(list,dec,gpuHandleOf(blitPass_,17).ptr,gpuHandleOf(blitPass_,1).ptr);
}
list->Dispatch((workW_+15)/16,(workH_+15)/16,1);tracker_.uavBarrier(list,workRgba_.Get());tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- ++metrics_.srEvaluateCount;gpuTimer_.mark(list,GpuStage::Sr,true);
+ ++metrics_.srEvaluateCount;
+ return true;
+ };
+ auto runVideoSr=[&]()->bool{
+ gpuTimer_.mark(list,GpuStage::Sr);
+ if(desc_.dualSr&&!firstVideoSr())return false;
+ reduceFirstSr();
+ if(!finalVideoSr())return false;
+ gpuTimer_.mark(list,GpuStage::Sr,true);
return true;
};
// Guidance from original source-space color before SR/NR. Queue waits are GPU-side.
bool haveFlow = false;
- const bool runMotion = nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || (fgEnabled_&&desc_.fgUsesFlow()) || (srEnabled_&&desc_.srUsesFlow()&&(desc_.videoSrQuality==0||desc_.videoSrQuality==engine::kVideoSrFsr));
+ const bool runMotion = nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || (fgEnabled_&&desc_.fgUsesFlow()) || (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_));
if (runMotion && (gpuDis_ || amdOf_ || (nvof_ && nvof_->initialized()))) {
const float dims[8] = {uintBits(nvofW_),uintBits(nvofH_),uintBits(nvofW_),uintBits(nvofH_),0,0,0,0};
if (prevValid_) {
@@ -2878,6 +2968,10 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
list->Dispatch((w+15)/16,(h+15)/16,1);tracker_.uavBarrier(list,output);tracker_.transition(list,output,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
};
adapt(nrFlow_.Get(),nrW_,nrH_,1);adapt(baseFlow_.Get(),workW_,workH_,2);
+ // Double SR temporal passes: a first DLSS SR pass in first-result pixels,
+ // a second FSR pass in SR-input (render) pixels.
+ if(firstSrFlow_)adapt(firstSrFlow_.Get(),desc_.firstSrWidth,desc_.firstSrHeight,firstSrFlowSet());
+ if(secondSrFlow_)adapt(secondSrFlow_.Get(),srInW_,srInH_,secondSrFlowSet());
if(flowRefine_){
tracker_.transition(list,fgBaseFlow_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
const float c[8]={uintBits(nvofW_),uintBits(nvofH_),uintBits(workW_),uintBits(workH_),0,0,0,0};
@@ -2897,9 +2991,81 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
out.batch.batchId=realFrameIndex_+1;out.batch.identity={epoch_,desc_.settingsRevision,sourceFrameId};
out.batch.a100ns=static_cast<int64_t>(std::llround(prevPtsMs_*10000));
out.batch.b100ns=static_cast<int64_t>(std::llround(ptsMs*10000));gpuTimer_.identity(out.batch.identity);
+ // Double SR with a DLSS SR or FSR pass (user 2026-11-08). The first pass leaves
+ // the linear first result, its exact-area reduction feeds the second pass, and
+ // each temporal pass takes motion at its own extents with the constant far
+ // depth; zero motion where the user chose it or this frame has no flow.
+ auto runMixedDualSr=[&]()->bool{
+ gpuTimer_.mark(list,GpuStage::Sr);
+ const bool validMotion=desc_.srUsesFlow()&&haveFlow;
+ const bool fsrReset=reset||(desc_.srUsesFlow()&&!haveFlow);
+ const double deltaMs=(prevPtsMs_>=0.0&&ptsMs>prevPtsMs_)?(ptsMs-prevPtsMs_):16.6;
+ auto readable=[&](std::initializer_list<ID3D12Resource*> resources){for(auto* r:resources)tracker_.transition(list,r,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);};
+ auto written=[&](ID3D12Resource* output){tracker_.uavBarrier(list,output);tracker_.transition(list,output,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);};
+ auto dlss=[&](ngx::DlssSrBackend& backend,ID3D12Resource* color,ID3D12Resource* motion,ID3D12Resource* output)->bool{
+ readable({color,motion,fsrSrDepth_.Get()});tracker_.transition(list,output,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ ngx::DlssSrBackend::EvalDesc ed{};
+ ed.color=color;ed.output=output;ed.depth=fsrSrDepth_.Get();ed.motionVectors=motion;ed.reset=reset;
+ if(!backend.evaluate(list,ngxParams_,ed,st)){failedBackend_=engine::FailedBackend::Sr;veyra::log::error("dual-sr","DLSS SR evaluate failed");return false;}
+ written(output);return true;
+ };
+ auto fsr=[&](gfx::FsrSrBackend& backend,ID3D12Resource* color,ID3D12Resource* motion,ID3D12Resource* output,uint32_t inW,uint32_t inH,uint32_t outW,uint32_t outH)->bool{
+ readable({color,motion,fsrSrDepth_.Get()});tracker_.transition(list,output,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ if(!backend.evaluate(list,color,motion,fsrSrDepth_.Get(),output,inW,inH,outW,outH,fsrReset,float(deltaMs))){
+ failedBackend_=engine::FailedBackend::Sr;veyra::log::error("dual-sr","FSR evaluate failed");return false;
+ }
+ written(output);return true;
+ };
+ auto* zero=fsrSrZeroMotion_.Get();
+ // 1. Source -> linear first result.
+ if(engine::rtxVideoSr(desc_.videoSrQuality)){if(!firstVideoSr())return false;}
+ else{
+ auto* input=srStageInput();
+ if(!desc_.firstSrEnlarges()){
+ // Nothing to enlarge: the first result is the source itself.
+ readable({input});tracker_.transition(list,firstSrLinear_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ const float copy[8]={uintBits(srcW_),uintBits(srcH_),uintBits(srcW_),uintBits(srcH_),0,0,0,0};
+ blitPass_.bind(list,copy,gpuHandleOf(blitPass_,22).ptr,gpuHandleOf(blitPass_,25).ptr);
+ list->Dispatch((srcW_+15)/16,(srcH_+15)/16,1);written(firstSrLinear_.Get());
+ }else if(firstDlssSrBackend_){
+ if(!dlss(*firstDlssSrBackend_,input,validMotion?firstSrFlow_.Get():zero,firstSrLinear_.Get()))return false;
+ }else if(firstFsrSrBackend_&&firstFsrSrBackend_->created()){
+ if(!fsr(*firstFsrSrBackend_,input,validMotion?flowTex_.Get():zero,firstSrLinear_.Get(),srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight))return false;
+ }else{failedBackend_=engine::FailedBackend::Sr;veyra::log::error("dual-sr","first SR pass has no backend");return false;}
+ ++metrics_.srEvaluateCount;
+ }
+ // 2. Exact-area reduction of the first result.
+ reduceFirstSr();
+ // 3. Reduction -> work texture.
+ if(engine::rtxVideoSr(desc_.dualSrQuality)){if(!finalVideoSr())return false;}
+ else{
+ if(desc_.dualSrQuality==0&&srBackend_&&srBackend_->created()){
+ if(!dlss(*srBackend_,srPrescaled_.Get(),validMotion?baseFlow_.Get():zero,workRgba_.Get()))return false;
+ }else if(desc_.dualSrQuality==engine::kVideoSrFsr&&fsrSrBackend_&&fsrSrBackend_->created()){
+ if(!fsr(*fsrSrBackend_,srPrescaled_.Get(),validMotion?secondSrFlow_.Get():zero,workRgba_.Get(),srInW_,srInH_,workW_,workH_))return false;
+ }else{failedBackend_=engine::FailedBackend::Sr;veyra::log::error("dual-sr","second SR pass has no backend");return false;}
+ ++metrics_.srEvaluateCount;
+ }
+ gpuTimer_.mark(list,GpuStage::Sr,true);
+ return true;
+ };
+ // Each pass of a mixed double SR has its backend (none under the VEYRA_NO_*
+ // diagnostics); a first pass with nothing to enlarge is a copy.
+ auto dualPassReady=[&](uint32_t quality,bool first)->bool{
+ if(first&&!desc_.firstSrEnlarges()&&!engine::ngxVideoSr(quality))return true;
+ if(quality==0)return first?(firstDlssSrBackend_&&firstDlssSrBackend_->created()):(srBackend_&&srBackend_->created());
+ if(quality==engine::kVideoSrFsr)return first?(firstFsrSrBackend_&&firstFsrSrBackend_->created()):(fsrSrBackend_&&fsrSrBackend_->created());
+ if(engine::vfxVideoSr(quality))return first?firstVfxSrBackend_!=nullptr:vfxSrBackend_!=nullptr;
+ return first?(firstVideoSrBackend_||videoSrBackend_):videoSrBackend_!=nullptr;
+ };
auto runSr=[&]()->bool{
if(desc_.splitNrAcrossSr())tracker_.transition(list,srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- if(srEnabled_&&fsrSrEnabled()){
+ // Without its backends a mixed double SR takes the ordinary resize below,
+ // never the single-backend branches written for the other passes.
+ const bool mixed=srEnabled_&&mixedDualSr(desc_);
+ if(mixed&&dualPassReady(desc_.videoSrQuality,true)&&dualPassReady(desc_.dualSrQuality,false)){
+ if(!runMixedDualSr())return false;
+ } else if(!mixed&&srEnabled_&&fsrSrEnabled()){
// AMD FSR upscaling: FidelityFX effect, render-extent color + guidance
// motion (previous = current + motion, same convention as the frame
// generator) straight into the working texture. With no valid motion,
@@ -2924,9 +3090,9 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
++metrics_.srEvaluateCount;gpuTimer_.mark(list,GpuStage::Sr,true);
tracker_.uavBarrier(list,workRgba_.Get());
tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- } else if(srEnabled_&&(videoSrBackend_||vfxSrBackend_)){
+ } else if(!mixed&&srEnabled_&&(videoSrBackend_||vfxSrBackend_)){
if(!runVideoSr())return false;
- } else if (srEnabled_ && srBackend_ && srBackend_->created()) {
+ } else if (!mixed && srEnabled_ && srBackend_ && srBackend_->created()) {
gpuTimer_.mark(list,GpuStage::Sr);
tracker_.transition(list, workRgba_.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
ngx::DlssSrBackend::EvalDesc ed{};
@@ -3604,7 +3770,7 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){
const auto requestedFlow=context_.adapter().vendorId==0x1002&&s.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia
?engine::OpticalFlowBackend::AmdFidelityFx:s.opticalFlowBackend;
const bool usesSharedFlow=nvofStandalone_||(desc_.enableFg&&desc_.fgUsesFlow())||
- (srEnabled_&&desc_.srUsesFlow()&&(desc_.videoSrQuality==0||desc_.videoSrQuality==engine::kVideoSrFsr));
+ (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_));
if(usesSharedFlow&&(requestedFlow!=desc_.opticalFlowBackend||s.amdFlowHalfResolution!=desc_.amdFlowHalfResolution))return false;
// The XeSS motion refinement owns textures, passes and NVOF's direction.
if(presentSinkFg()&&desc_.fgUsesFlow()&&s.fgMotionRefine!=desc_.fgMotionRefine)return false;
@@ -3809,6 +3975,7 @@ void EnhanceGraph::shutdown()
amdOf_.reset();
for(auto& motion:presentMotion_)motion.Reset();
if(fsrSrBackend_){fsrSrBackend_->release();fsrSrBackend_.reset();}
+ if(firstFsrSrBackend_){firstFsrSrBackend_->release();firstFsrSrBackend_.reset();}
fsrSrDepth_.Reset();
fsrSrZeroMotion_.Reset();upFsrSrZeroMotion_.Reset();
upFsrSrDepth_.Reset();
@@ -3821,6 +3988,7 @@ void EnhanceGraph::shutdown()
if(videoHdrBackend_)featuresReleased=videoHdrBackend_->release()&&featuresReleased;
videoHdrBackend_.reset();videoHdrInput_.Reset();videoHdrOutput_.Reset();
if (srBackend_) featuresReleased=srBackend_->release()&&featuresReleased;
+ if(firstDlssSrBackend_){featuresReleased=firstDlssSrBackend_->release()&&featuresReleased;firstDlssSrBackend_.reset();}
// NVOF teardown in THREE phases (ownership rule proven by t10-L0-r2):
// a. unregisterAll() while the textures are still alive;
@@ -3943,7 +4111,7 @@ void EnhanceGraph::shutdown()
proxyTex_.Reset();
for(auto& r:sourceReferences_)r.Reset();for(auto& r:baseReferences_)r.Reset();workRgba_.Reset();
preGradeRgba_.Reset();srcRgba_.Reset();videoSrInput_.Reset();videoSrOutput_.Reset();srPrescaled_.Reset();
- firstSrInput_.Reset();firstSrOutput_.Reset();firstSrLinear_.Reset();
+ firstSrInput_.Reset();firstSrOutput_.Reset();firstSrLinear_.Reset();firstSrFlow_.Reset();secondSrFlow_.Reset();fsrAuxW_=fsrAuxH_=0;
nrHoldPass_.reset();
colorDetail_.close();
chromaTex_.Reset();
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index 5a811d21..d7d2d3c6 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -73,6 +73,17 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
// The compute GPU decides which effects exist, so it is settled before
// anything below samples the capabilities or restores the saved chain.
impl_->loadPrefs();
+ // The last volume (user 2026-11-08: it came back at 100% every launch).
+ // Mute stays per session; profiles without the key keep 100%.
+ if (impl_->prefs.contains(QStringLiteral("volume"))) {
+ bool ok = false;
+ const double saved = impl_->prefs.value(QStringLiteral("volume")).toDouble(&ok);
+ if (ok && std::isfinite(saved) && saved >= 0.0 && saved <= 1.0) {
+ impl_->engine.setVolume(float(saved), false);
+ impl_->snapshot.volume = float(saved);
+ veyra::log::info("ui-prefs", std::format("volume restored={:.3f}", saved));
+ }
+ }
applyGameHotkeys();
impl_->enumerateGpuAdapters();
impl_->resolveGpuMonitor();
@@ -319,6 +330,12 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
impl_->hdrMemorySaveTimer=new QTimer(this);
impl_->hdrMemorySaveTimer->setSingleShot(true);impl_->hdrMemorySaveTimer->setInterval(400);
connect(impl_->hdrMemorySaveTimer,&QTimer::timeout,this,[this]{flushHdrMemory();});
+ impl_->volumeSaveTimer=new QTimer(this);
+ impl_->volumeSaveTimer->setSingleShot(true);impl_->volumeSaveTimer->setInterval(500);
+ connect(impl_->volumeSaveTimer,&QTimer::timeout,this,[this]{
+ if(impl_->savePrefs())veyra::log::info("ui-prefs",std::format("volume={:.3f} saved",impl_->prefs.value(QStringLiteral("volume")).toDouble()));
+ else veyra::log::warn("ui-prefs","volume not saved");
+ });
impl_->timer = new QTimer(this);
connect(impl_->timer, &QTimer::timeout, this, [this] {
const bool had = impl_->haveSnapshot;
@@ -637,6 +654,8 @@ QmlPlayerBridge::~QmlPlayerBridge() {
flushHdrMemory();
if (qApp) qApp->removeEventFilter(this);
if (qApp) qApp->removeNativeEventFilter(&impl_->displayChangeFilter);
+ // rememberPosition(true) writes every preference, a pending volume included.
+ if (impl_->volumeSaveTimer) impl_->volumeSaveTimer->stop();
rememberPosition(true);
if (impl_->sessionSaveTimer) impl_->sessionSaveTimer->stop();
if (!impl_->persistSession())
diff --git a/src/ui/QmlPlayerBridge_p.h b/src/ui/QmlPlayerBridge_p.h
index 0310924f..f0cb0c1d 100644
--- a/src/ui/QmlPlayerBridge_p.h
+++ b/src/ui/QmlPlayerBridge_p.h
@@ -249,6 +249,8 @@ struct QmlPlayerBridge::Impl {
engine::ChainSession session;
engine::ChainSession savedSession;
QTimer* sessionSaveTimer = nullptr;
+ // 音量 is a shell preference (2026-11-08); a drag is written once it settles.
+ QTimer* volumeSaveTimer = nullptr;
int selectedNr=-1;
int nrIndex() const {
if(selectedNr>=0&&uint32_t(selectedNr)<chain.nodeCount&&
diff --git a/src/ui/bridge/Enhancement.cpp b/src/ui/bridge/Enhancement.cpp
index bfdf7e08..9b4607dc 100644
--- a/src/ui/bridge/Enhancement.cpp
+++ b/src/ui/bridge/Enhancement.cpp
@@ -42,12 +42,18 @@ void QmlPlayerBridge::setDlssSrModel(int value) {
}
int QmlPlayerBridge::srPrescale() const { return int(settings().srPrescale); }
bool QmlPlayerBridge::dualSrEnabled() const { return settings().dualSrEnabled; }
+// Double SR takes every SR backend (user 2026-11-08: DLSS SR and FSR as well).
void QmlPlayerBridge::setDualSrEnabled(bool enabled){
auto s=settings();if(s.dualSrEnabled==enabled)return;
- if(enabled&&!engine::rtxVideoSr(s.videoSrQuality))return;
s.dualSrEnabled=enabled;
- // A kept supersample shrink is inactive under double SR and returns when it is off.
- if(enabled&&s.srPrescale==pipeline::SrPrescale::Off)s.srPrescale=pipeline::SrPrescale::P1080;
+ if(enabled){
+ // A kept second algorithm this adapter cannot run follows the base
+ // (an AMD card starts FSR -> FSR instead of a dead RTX choice).
+ const auto cap=effectCapabilities().value("sr"+QString::number(s.dualSrQuality)).toMap();
+ if(!cap.value("available").toBool())s.dualSrQuality=s.videoSrQuality;
+ // A kept supersample shrink is inactive under double SR and returns when it is off.
+ if(s.srPrescale==pipeline::SrPrescale::Off)s.srPrescale=pipeline::SrPrescale::P1080;
+ }
if(impl_->commit(s))emit settingsChanged();
}
int QmlPlayerBridge::dualSrTargetIndex() const {
@@ -59,9 +65,10 @@ void QmlPlayerBridge::setDualSrTargetIndex(int index){
auto s=settings();s.dualSrTarget=targets[index-1];if(impl_->commit(s))emit settingsChanged();
}
int QmlPlayerBridge::dualSrQuality() const {return int(settings().dualSrQuality);}
-// The second pass may use any RTX Video SR family and tier, independent of the base.
+// The second pass may use any SR backend - DLSS SR, an RTX Video SR family and
+// tier, or FSR - independent of the base.
void QmlPlayerBridge::setDualSrQuality(int quality){
- if(quality<0||!engine::rtxVideoSr(unsigned(quality)))return;
+ if(quality<0||!engine::validVideoSrQuality(unsigned(quality)))return;
const auto cap=effectCapabilities().value("sr"+QString::number(quality)).toMap();
if(!cap.value("available").toBool()){emit notice(cap.value("reason").toString(),true);return;}
auto s=settings();if(int(s.dualSrQuality)==quality)return;
@@ -109,14 +116,13 @@ QString QmlPlayerBridge::srQualityLabel(int quality,bool withFamily) const {
return (family==engine::VideoSrFamily::HighBitrate?tr("高码率"):family==engine::VideoSrFamily::Streaming?tr("流媒体"):tr("标准"))+QLatin1Char(' ')+tier;
}
int QmlPlayerBridge::srOutput() const { return int(settings().srOutput); }
-// Double SR and the supersample shrink run on RTX Video SR (every family) only;
-// other backends keep the single step.
+// The double SR reduction works with every SR backend; the supersample shrink
+// runs on RTX Video SR (every family) only.
void QmlPlayerBridge::setSrPrescale(int value) {
const auto want = pipeline::SrPrescale(uint32_t(value));
if (value < 0 || !pipeline::validSrPrescale(want)) return;
auto s = settings();
if (s.srPrescale == want) return;
- if (!engine::rtxVideoSr(s.videoSrQuality)) { emit notice(tr("双重超分目前仅 RTX 视频超分支持"), true); return; }
s.srPrescale = want;
if (impl_->commit(s)) emit settingsChanged();
}
@@ -1246,7 +1252,15 @@ bool QmlPlayerBridge::applying() const { return impl_->facade.applying(); }
// the engine did, not what it asked for.
double QmlPlayerBridge::volume() const { return double(impl_->snapshot.volume); }
void QmlPlayerBridge::setVolume(double value) {
- impl_->engine.setVolume(float(std::clamp(value, 0.0, 1.0)), impl_->snapshot.muted);
+ if (!std::isfinite(value)) return;
+ const double volume = std::clamp(value, 0.0, 1.0);
+ impl_->engine.setVolume(float(volume), impl_->snapshot.muted);
+ // Kept for the next launch (user 2026-11-08). A slider drag calls this for
+ // every move, so the file is written 0.5 s after the last change and on exit.
+ const QString key = QStringLiteral("volume");
+ if (impl_->prefs.contains(key) && impl_->prefs.value(key).toDouble() == volume) return;
+ impl_->prefs[key] = volume;
+ if (impl_->volumeSaveTimer) impl_->volumeSaveTimer->start();
}
bool QmlPlayerBridge::muted() const { return impl_->snapshot.muted; }
void QmlPlayerBridge::setMuted(bool value) {
diff --git a/src/ui/bridge/Hardware.cpp b/src/ui/bridge/Hardware.cpp
index 4e0729bb..e838eda0 100644
--- a/src/ui/bridge/Hardware.cpp
+++ b/src/ui/bridge/Hardware.cpp
@@ -141,8 +141,8 @@ QString unavailableEffects(const engine::EnhancementSettings& settings) {
QStringList requested;
if (settings.nr) requested << "nr" + QString::number(int(engine::currentNrRuntime(settings.nrRuntime)));
if (settings.sr) requested << "sr" + QString::number(settings.videoSrQuality);
- // Double SR runs a second RTX Video SR pass with its own family and tier.
- if (settings.sr && settings.dualSrEnabled && engine::rtxVideoSr(settings.videoSrQuality)) requested << "sr" + QString::number(settings.dualSrQuality);
+ // Double SR runs a second pass with its own backend (any SR algorithm).
+ if (settings.sr && settings.dualSrEnabled) requested << "sr" + QString::number(settings.dualSrQuality);
if (settings.multiplier > 1) requested << fgEffectId(settings.frameGenerationBackend);
if (settings.videoHdr.enabled) requested << "hdr";
for (const auto& id : requested) {
@@ -190,6 +190,16 @@ QString disableUnavailableEffects(engine::ChainConfiguration& configuration) {
if (globals.opticalFlowBackend == engine::OpticalFlowBackend::Nvidia &&
!caps.value("flow0").toMap().value("available").toBool())
globals.opticalFlowBackend = engine::OpticalFlowBackend::AmdFidelityFx;
+ // A double SR second algorithm this card cannot run (a profile moved from
+ // an NVIDIA card) follows the base algorithm, or double SR turns off.
+ const auto runs = [&](uint32_t quality) { return caps.value("sr" + QString::number(quality)).toMap().value("available").toBool(); };
+ if (globals.dualSrEnabled && !runs(globals.dualSrQuality)) {
+ const auto saved = globals.dualSrQuality;
+ if (runs(globals.videoSrQuality)) globals.dualSrQuality = globals.videoSrQuality;
+ else globals.dualSrEnabled = false;
+ veyra::log::warn("effect-availability", std::format("double SR second quality={} unavailable; second={} enabled={}",
+ saved, globals.dualSrQuality, globals.dualSrEnabled));
+ }
};
sanitize(configuration.chain, configuration);
if (configuration.editor) {
diff --git a/tests/integration/SrQualityTests.cpp b/tests/integration/SrQualityTests.cpp
index 357e1995..84f53a49 100644
--- a/tests/integration/SrQualityTests.cpp
+++ b/tests/integration/SrQualityTests.cpp
@@ -370,6 +370,83 @@ int capabilities(const std::filesystem::path& directory){
}
ring.shutdown();ctx.shutdown();std::cout<<"DUAL_CAPABILITIES cases="<<cases<<" passed="<<ok<<std::endl;return ok?0:1;
}
+// Double SR with DLSS SR / FSR passes (user 2026-11-08). Settings for one pair;
+// unlike vsr(), quality 0 here is DLSS SR.
+engine::EnhancementSettings mixed(unsigned first,unsigned second,pipeline::SrTarget target,pipeline::SrPrescale reduce,pipeline::SrTarget secondTarget,bool flow){
+ engine::EnhancementSettings s;s.nr=false;s.sr=true;s.multiplier=1;s.videoSrQuality=first;s.srTarget=target;
+ s.dualSrEnabled=true;s.dualSrQuality=second;s.srPrescale=reduce;s.dualSrTarget=secondTarget;
+ s.srMotion=flow?engine::MotionSource::OpticalFlow:engine::MotionSource::Zero;s.hdrOutputMode=engine::HdrOutputMode::ScRgb;
+ return s;
+}
+// Mean linear value of an output (RGBA8 sRGB or FP16) and whether every texel is finite.
+std::pair<double,bool> meanLinear(const sink::RgbaImage& img){
+ const size_t texels=size_t(img.width)*img.height;if(!texels)return {0,false};
+ const bool fp16=img.pixels.size()==texels*8;double sum=0;bool finite=true;
+ for(size_t p=0;p<texels;++p)for(unsigned c=0;c<3;++c){
+ const double v=fp16?half(img,p*4+c):decode(img.pixels[p*4+c]);
+ if(!std::isfinite(v)){finite=false;continue;}sum+=v;
+ }
+ return {sum/(texels*3),finite};
+}
+// Every backend pair with real SDK evaluations of both passes, zero and optical
+// flow motion: sizes, two evaluations per frame, finite output with the source's
+// mean brightness. Then a first DLSS SR pass with nothing to enlarge (a copy of
+// the source), DLSS SR pairs on HDR, and FSR's HDR refusal reported the way the
+// engine detects it (fsrSrRequested && !fsrSrEnabled disables SR with a notice).
+int any(const std::filesystem::path& directory){
+ std::filesystem::create_directories(directory);Logger::instance().openFile((directory/L"engine.log").wstring());
+ gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;
+ if(!ctx.initialize({},status)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,status))return 2;
+ using pipeline::SrTarget;using pipeline::SrPrescale;using pipeline::Extent;
+ const auto fhdImage=pattern(1920,1080),uhdImage=pattern(3840,2160);
+ const auto fhd=sdrFrame(fhdImage),uhd=sdrFrame(uhdImage),hdr=hdrFrame(fhdImage);if(!fhd||!uhd||!hdr)return 2;
+ const double sourceMean=meanLinear(fhdImage).first;
+ bool ok=true;unsigned cases=0;
+ // runtime/experimental is the NGX directory; Video Effects sits beside it.
+ const auto vfx=std::filesystem::exists(runtime::localRuntimeDirectory().parent_path()/L"nvidia-vfg"/L"nvVFXVideoSuperRes.dll");
+ struct Pair{unsigned first,second;};
+ for(const auto pair:{Pair{0,0},Pair{0,2},Pair{2,0},Pair{0,5},Pair{5,0},Pair{5,5},Pair{5,2},Pair{2,5},Pair{17,0},Pair{0,19}}){
+ if(!vfx&&(engine::vfxVideoSr(pair.first)||engine::vfxVideoSr(pair.second))){
+ std::cout<<"DUAL_ANY first="<<pair.first<<" second="<<pair.second<<" skipped=no-video-effects-runtime"<<std::endl;continue;}
+ for(bool flow:{false,true}){
+ const auto r=run(ctx,ring,fhd.get(),false,mixed(pair.first,pair.second,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,flow),false,false,false,4,true);
+ const auto [mean,finite]=meanLinear(r.output);
+ const bool passed=r.ok&&r.enabled&&r.evaluations==8&&r.first==Extent{3840,2160}&&r.srIn==Extent{1920,1080}&&r.work==Extent{3840,2160}&&
+ r.firstLinear.width==3840&&r.output.width==3840&&finite&&std::abs(mean-sourceMean)<0.03;
+ std::cout<<"DUAL_ANY first="<<pair.first<<" second="<<pair.second<<" flow="<<flow<<" evaluations="<<r.evaluations
+ <<" mean="<<mean<<" source="<<sourceMean<<" srMs="<<r.srMs<<" passed="<<passed<<std::endl;
+ ok=ok&&passed;++cases;
+ }
+ }
+ {
+ // A 4K source at the 4K base target: the first DLSS SR pass has nothing to enlarge.
+ const auto copy=run(ctx,ring,uhd.get(),false,mixed(0,0,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,false),false,false,false,3,true);
+ double worst=0;bool sized=copy.ok&&copy.firstLinear.width==3840&&copy.firstLinear.height==2160;
+ for(size_t p=0;sized&&p<size_t(3840)*2160;++p)for(unsigned c=0;c<3;++c)
+ worst=std::max(worst,std::abs(double(half(copy.firstLinear,p*4+c))-decode(uhdImage.pixels[p*4+c])));
+ const bool passed=sized&&copy.evaluations==6&&copy.work==Extent{3840,2160}&&worst<0.002;
+ std::cout<<"DUAL_ANY copy first=0 second=0 evaluations="<<copy.evaluations<<" worst="<<worst<<" passed="<<passed<<std::endl;ok=ok&&passed;++cases;
+ }
+ for(const auto pair:{Pair{0,0},Pair{2,0},Pair{0,2}}){
+ const auto h=run(ctx,ring,hdr.get(),true,mixed(pair.first,pair.second,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,false),false,false,false,3,true);
+ const auto [mean,finite]=meanLinear(h.output);
+ const bool passed=h.ok&&h.evaluations==6&&h.firstLinear.width==3840&&h.output.width==3840&&finite&&mean>0;
+ std::cout<<"DUAL_ANY hdr first="<<pair.first<<" second="<<pair.second<<" evaluations="<<h.evaluations<<" mean="<<mean<<" passed="<<passed<<std::endl;
+ ok=ok&&passed;++cases;
+ }
+ {
+ engine::StageRequest request;request.width=1920;request.height=1080;request.sr=true;
+ auto settings=mixed(2,engine::kVideoSrFsr,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,false);
+ pipeline::EnhanceGraphDesc desc;engine::describeStages(request,settings,desc);
+ desc.hdrInput=desc.hdrOutput=true;desc.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();
+ pipeline::EnhanceGraph graph(ctx,ring);
+ const bool built=graph.initialize(desc);
+ const bool passed=desc.dualSr&&built&&graph.fsrSrRequested()&&!graph.fsrSrEnabled();
+ std::cout<<"DUAL_ANY hdr-fsr second=5 requested="<<graph.fsrSrRequested()<<" enabled="<<graph.fsrSrEnabled()<<" passed="<<passed<<std::endl;
+ ok=ok&&passed;++cases;ring.drainQueue();graph.shutdown();
+ }
+ ring.shutdown();ctx.shutdown();std::cout<<"DUAL_ANY cases="<<cases<<" passed="<<ok<<std::endl;return ok?0:1;
+}
// Supersampling: one RTX Video SR pass at 8K shrunk to 4K equals the CPU area
// average of the same graph's 8K result (SDR in sRGB; HDR after the per-texel
// restore), the exact source size and a non-integer 2K shrink run, and double
@@ -467,6 +544,7 @@ int wmain(int argc,wchar_t** argv){
if(argc==3&&std::wstring_view(argv[2])==L"dual-restore"){const int result=stage::restore(argv[1]);CoUninitialize();return result;}
if(argc==3&&std::wstring_view(argv[2])==L"dual-boundaries"){const int result=stage::boundaries(argv[1]);CoUninitialize();return result;}
if(argc==3&&std::wstring_view(argv[2])==L"dual-capabilities"){const int result=stage::capabilities(argv[1]);CoUninitialize();return result;}
+ if(argc==3&&std::wstring_view(argv[2])==L"dual-any"){const int result=stage::any(argv[1]);CoUninitialize();return result;}
if(argc==3&&std::wstring_view(argv[2])==L"supersample"){const int result=stage::supersample(argv[1]);CoUninitialize();return result;}
if(argc>=11&&std::wstring_view(argv[2])==L"sr-image"){
const int result=stage::image(argv[1],argv[3],argv[4],unsigned(std::stoi(argv[5])),argv[6],argv[7],argv[8],argv[9],unsigned(std::stoi(argv[10])),argc>11?argv[11]:L"video");
diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cpp
index 0810a420..34acc789 100644
--- a/tests/unit/EffectChainTests.cpp
+++ b/tests/unit/EffectChainTests.cpp
@@ -1485,12 +1485,16 @@ static void testThreeStepSr(){
request.exportJob=false;request.stillImage=true;describeStages(request,s,desc);
check(desc.enableSr&&desc.srInputWidth==1920&&desc.validateFixedExecutionPlan().empty(),"three-step SR: still images run it too");
request.stillImage=false;
+ // Since 2026-11-08 a DLSS SR or FSR base runs double SR as well.
for(const unsigned backend:{0u,kVideoSrFsr}){
auto other=s;other.videoSrQuality=backend;describeStages(request,other,desc);
- check(desc.srInputWidth==3840&&desc.srOutputWidth==3840&&!desc.enableSr,"three-step SR: DLSS SR and FSR keep the single step");
+ check(desc.enableSr&&desc.dualSr&&desc.srInputWidth==1920&&desc.srOutputWidth==3840&&desc.validateFixedExecutionPlan().empty(),
+ "double SR: DLSS SR and FSR bases run both steps");
}
request.nvidiaAdapter=false;describeStages(request,s,desc);
check(desc.srInputWidth==3840&&desc.srOutputWidth==desc.workWidth,"three-step SR: other adapters keep the single step");
+ auto fsrPair=s;fsrPair.videoSrQuality=kVideoSrFsr;fsrPair.dualSrQuality=kVideoSrFsr;describeStages(request,fsrPair,desc);
+ check(desc.enableSr&&desc.dualSr&&desc.srInputWidth==1920,"double SR: FSR -> FSR runs on other adapters");
request.nvidiaAdapter=true;request.width=2560;request.height=1440;
auto fit=s;fit.srPrescale=SrPrescale::P1080;fit.srTarget=SrTarget::Uhd8K;fit.srOutput=SrOutput::Uhd4K;describeStages(request,fit,desc);
check(desc.enableSr&&desc.dualSr&&desc.firstSrWidth==7680&&desc.srInputWidth==1920&&desc.srOutputWidth==3840&&desc.srOutputHeight==2160&&desc.workWidth==3840&&
@@ -1504,15 +1508,17 @@ static void testThreeStepSr(){
bad=s;bad.srOutput=SrOutput(7);check(!bad.validate().empty(),"three-step SR: an invalid output is rejected");
check(s.activeVideoSettings().srPrescale==SrPrescale::P1080,"three-step SR: RTX Video SR keeps the prescale");
auto off=s;off.sr=false;auto dlss=s;dlss.videoSrQuality=0;
- check(off.activeVideoSettings().srPrescale==SrPrescale::Off&&dlss.activeVideoSettings().srPrescale==SrPrescale::Off,
- "three-step SR: SR off and other backends normalize the fields");
+ check(off.activeVideoSettings().srPrescale==SrPrescale::Off&&dlss.activeVideoSettings().srPrescale==SrPrescale::P1080,
+ "three-step SR: SR off normalizes the fields, a DLSS SR base keeps the double SR reduction");
auto before=s;before.srPrescale=SrPrescale::Off;auto output=s;output.srOutput=SrOutput::Qhd;
check(requiresGraphRebuild(before,s)&&!requiresGraphRebuild(s,output),"double SR: reduction rebuilds, the kept shrink is inactive under double SR");
auto single=s;single.dualSrEnabled=false;auto shrunk=single;shrunk.srOutput=SrOutput::Uhd4K;
check(requiresGraphRebuild(single,shrunk)&&shrunk.activeVideoSettings().srOutput==SrOutput::Uhd4K&&
output.activeVideoSettings().srOutput==SrOutput::Target,"supersample: the shrink rebuilds a single RTX Video SR pass only");
auto dlssBefore=before;dlssBefore.videoSrQuality=0;
- check(!requiresGraphRebuild(dlssBefore,dlss),"three-step SR: inactive edits do not rebuild the graph");
+ check(requiresGraphRebuild(dlssBefore,dlss),"double SR: a DLSS SR base's reduction rebuilds the graph too");
+ auto idle=dlssBefore;idle.dualSrEnabled=false;auto idleEdit=idle;idleEdit.srPrescale=SrPrescale::P1080;
+ check(!requiresGraphRebuild(idle,idleEdit),"three-step SR: inactive edits do not rebuild the graph");
EnhancementSettings restored;ChainGlobalSettings::capture(output).apply(restored);
check(restored.srPrescale==SrPrescale::P1080&&restored.srOutput==SrOutput::Qhd,"three-step SR: chain globals carry both fields");
auto a=ChainConfiguration::capture(toChain(s),s,-1,-1);auto b=a;b.srOutput=SrOutput::Qhd;
@@ -1660,11 +1666,13 @@ int main() {
check(requiresGraphRebuild(disabled,s),"enabling the second actual SR pass rebuilds");
auto g=ChainGlobalSettings::capture(s);EnhancementSettings restored;g.apply(restored);
check(restored.dualSrEnabled&&restored.dualSrTarget==s.dualSrTarget&&restored.dualSrQuality==s.dualSrQuality,"chain globals retain independent second-stage settings");
- auto invalid=s;invalid.dualSrQuality=0;check(!invalid.validate().empty(),"reject invalid second SR quality before any GPU work");
+ auto invalid=s;invalid.dualSrQuality=6;check(!invalid.validate().empty(),"reject invalid second SR quality before any GPU work");
invalid=s;invalid.dualSrTarget=SrTarget(99);check(!invalid.validate().empty(),"reject invalid second SR target");
ChainExecutionRequest badRequest{{2560,1440},s.srTarget};badRequest.dualSrEnabled=true;badRequest.dualSrTarget=SrTarget(99);
ChainExecutionPlan rejected;check(!compileChainExecutionPlan(toChain(s),badRequest,rejected).accepted,"invalid second target returns a rejected plan rather than throwing");
- s.videoSrQuality=kVideoSrFsr;describeStages(r,s,d);check(!d.dualSr&&!s.activeVideoSettings().dualSrEnabled,"other base backends keep their existing single-stage path");
+ // Every SR backend runs double SR since 2026-11-08 (FSR base, standard second pass here).
+ s.videoSrQuality=kVideoSrFsr;describeStages(r,s,d);check(d.dualSr&&s.activeVideoSettings().dualSrEnabled&&d.videoSrQuality==kVideoSrFsr&&d.dualSrQuality==1,
+ "an FSR base runs double SR with its own second pass");
}
std::printf(failures ? "effect chain: %d FAILURES\n" : "effect chain: all checks passed\n", failures);
return failures ? 1 : 0;
diff --git a/tests/unit/VideoAiSettingsTests.cpp b/tests/unit/VideoAiSettingsTests.cpp
index baae982b..8bd9dd47 100644
--- a/tests/unit/VideoAiSettingsTests.cpp
+++ b/tests/unit/VideoAiSettingsTests.cpp
@@ -3,6 +3,9 @@
// persistence. Older readers reject the Video Effects values, so files that use
// them (as the base or the second SR) get a new version (settings presets) or a
// .video-ai sidecar (preset library, mode session); the older file stays as it was.
+// Since 2026-11-08 double SR also takes DLSS SR and FSR in either pass; a DLSS SR /
+// FSR second pass gets its own version again (v36, library v19 / session v14 in
+// a .dual-sr-any sidecar).
#include "veyra/engine/GraphDescription.h"
#include "veyra/engine/PresetStore.h"
#include "veyra/engine/PresetLibrary.h"
@@ -18,7 +21,7 @@ namespace {
unsigned checks=0,failures=0;
void check(bool ok,const char* why){++checks;if(!ok){++failures;std::cout<<"FAIL "<<why<<'\n';}}
std::string bytes(const std::filesystem::path& p){std::ifstream f(p,std::ios::binary);return {(std::istreambuf_iterator<char>(f)),{}};}
-std::filesystem::path sidecar(const std::filesystem::path& p){return std::filesystem::path(p).concat(L".video-ai");}
+std::filesystem::path sidecar(const std::filesystem::path& p,const wchar_t* suffix=L".video-ai"){return std::filesystem::path(p).concat(suffix);}
// Every file of one library: the base name plus the sidecars older versions chained onto it.
std::map<std::wstring,std::string> files(const std::filesystem::path& base){
std::map<std::wstring,std::string> out;
@@ -29,8 +32,9 @@ std::map<std::wstring,std::string> files(const std::filesystem::path& base){
bool kept(const std::map<std::wstring,std::string>& before,const std::map<std::wstring,std::string>& after){
return std::all_of(before.begin(),before.end(),[&](const auto& f){const auto it=after.find(f.first);return it!=after.end()&&it->second==f.second;});
}
-veyra::pipeline::EnhanceGraphDesc describe(const EnhancementSettings& s,uint32_t width,uint32_t height,veyra::pipeline::ResolutionPlan* plan=nullptr){
- StageRequest request;request.sr=s.sr;request.width=width;request.height=height;
+veyra::pipeline::EnhanceGraphDesc describe(const EnhancementSettings& s,uint32_t width,uint32_t height,veyra::pipeline::ResolutionPlan* plan=nullptr,
+ bool nvidia=true,bool still=false){
+ StageRequest request;request.sr=s.sr;request.width=width;request.height=height;request.nvidiaAdapter=nvidia;request.stillImage=still;
veyra::pipeline::EnhanceGraphDesc desc;const auto p=describeStages(request,s,desc);
if(plan)*plan=p;
return desc;
@@ -71,10 +75,19 @@ int wmain(int argc,wchar_t** argv){
check(s.validate().empty(),"high bitrate base with a streaming second pass");
auto active=s.activeVideoSettings();
check(active.dualSrEnabled&&active.dualSrQuality==23&&active.srPrescale==SrPrescale::P1080,"double SR stays active on high bitrate");
- for(uint32_t bad2:{0u,5u,20u,22u,24u}){auto bad=s;bad.dualSrQuality=bad2;check(!bad.validate().empty(),"second SR must be an RTX Video SR value");}
+ for(uint32_t bad2:{6u,15u,20u,22u,24u}){auto bad=s;bad.dualSrQuality=bad2;check(!bad.validate().empty(),"second SR must be a stored SR value");}
+ for(uint32_t good2:{0u,kVideoSrFsr}){auto good=s;good.dualSrQuality=good2;check(good.validate().empty(),"DLSS SR and FSR are valid second passes");}
s.videoSrQuality=4;s.dualSrQuality=17;check(s.validate().empty()&&s.activeVideoSettings().dualSrEnabled,"standard base with a high bitrate second pass");
- s.videoSrQuality=0;check(!s.activeVideoSettings().dualSrEnabled,"DLSS SR keeps its single pass");
- s.videoSrQuality=kVideoSrFsr;check(!s.activeVideoSettings().dualSrEnabled,"FSR keeps its single pass");
+ s.videoSrQuality=0;check(s.activeVideoSettings().dualSrEnabled,"a DLSS SR base runs double SR");
+ s.videoSrQuality=kVideoSrFsr;check(s.activeVideoSettings().dualSrEnabled,"an FSR base runs double SR");
+ // The DLSS SR model belongs to every DLSS SR pass, the second one too.
+ auto model=s;model.videoSrQuality=4;model.dualSrQuality=0;model.dlssSrModel=1;
+ check(model.activeVideoSettings().dlssSrModel==1,"a DLSS SR second pass keeps the DLSS SR model");
+ model.dualSrQuality=17;check(model.activeVideoSettings().dlssSrModel==0,"without a DLSS SR pass the model is inactive");
+ // DLSS SR / FSR passes read the SR motion source, RTX Video SR passes do not.
+ auto motion=s;motion.videoSrQuality=4;motion.dualSrQuality=kVideoSrFsr;
+ auto spatial=motion;spatial.dualSrQuality=17;
+ check(motion.temporalSr()&&!spatial.temporalSr(),"a temporal second pass needs the SR motion source");
EnhancementSettings ss;ss.sr=true;ss.videoSrQuality=16;ss.srOutput=SrOutput::Source;
check(ss.activeVideoSettings().srOutput==SrOutput::Source,"supersample shrink stays on high bitrate");
ss.videoSrQuality=0;check(ss.activeVideoSettings().srOutput==SrOutput::Target,"DLSS SR drops the supersample shrink");
@@ -89,7 +102,23 @@ int wmain(int argc,wchar_t** argv){
desc.srOutputWidth==3840&&desc.srOutputHeight==2160&&desc.workWidth==3840,"double SR sizes: 720p -> 4K -> 1080p -> 4K");
s.videoSrQuality=4;s.dualSrQuality=16;
check(describe(s,1280,720).dualSr,"standard base with high bitrate second pass plans two passes");
- s.videoSrQuality=0;check(!describe(s,1280,720).dualSr,"DLSS SR plans one pass");
+ // DLSS SR and FSR in either pass (2026-11-08).
+ s.videoSrQuality=0;s.dualSrQuality=0;
+ const auto dlss=describe(s,1280,720);
+ check(dlss.dualSr&&dlss.videoSrQuality==0&&dlss.dualSrQuality==0&&dlss.firstSrWidth==3840&&dlss.srInputWidth==1920&&dlss.workWidth==3840,
+ "DLSS SR -> DLSS SR plans 720p -> 4K -> 1080p -> 4K");
+ s.dualSrQuality=kVideoSrFsr;check(describe(s,1280,720).dualSr,"DLSS SR base with an FSR second pass");
+ s.videoSrQuality=kVideoSrFsr;s.dualSrQuality=19;check(describe(s,1280,720).dualSr,"FSR base with a high bitrate second pass");
+ s.videoSrQuality=17;s.dualSrQuality=0;check(describe(s,1280,720).dualSr,"high bitrate base with a DLSS SR second pass");
+ // Adapters: FSR runs everywhere, the others on NVIDIA only.
+ s.videoSrQuality=kVideoSrFsr;s.dualSrQuality=kVideoSrFsr;
+ const auto amd=describe(s,1280,720,nullptr,false);
+ check(amd.enableSr&&amd.dualSr&&amd.srInputWidth==1920,"FSR -> FSR double SR runs on a non-NVIDIA adapter");
+ s.dualSrQuality=2;const auto amdSingle=describe(s,1280,720,nullptr,false);
+ check(!amdSingle.dualSr&&amdSingle.enableSr,"a non-NVIDIA adapter keeps the single FSR pass when the second pass needs NVIDIA");
+ // FSR skips still images, so a double SR with an FSR pass keeps one pass there.
+ s.dualSrQuality=kVideoSrFsr;check(!describe(s,1280,720,nullptr,true,true).dualSr,"no double SR with FSR on a still image");
+ s.videoSrQuality=0;s.dualSrQuality=0;check(describe(s,1280,720,nullptr,true,true).dualSr,"DLSS SR double SR on a still image");
EnhancementSettings ss;ss.sr=true;ss.videoSrQuality=17;ss.srTarget=SrTarget::Uhd4K;ss.srOutput=SrOutput::Qhd;
const auto sd=describe(ss,1280,720);
check(sd.enableSr&&!sd.dualSr&&sd.srOutputWidth==3840&&sd.workWidth==2560&&sd.workHeight==1440,"high bitrate supersample: SR to 4K, shrink to 1440p");
@@ -101,6 +130,11 @@ int wmain(int argc,wchar_t** argv){
EnhancementSettings vsr;vsr.sr=true;vsr.videoSrQuality=23;vsr.srTarget=SrTarget::Qhd;
EnhancementSettings second;second.sr=true;second.videoSrQuality=4;second.dualSrEnabled=true;second.dualSrQuality=18;second.srPrescale=SrPrescale::P900;
EnhancementSettings both=vsr;both.videoSrQuality=19;both.dualSrEnabled=true;both.dualSrQuality=21;both.srPrescale=SrPrescale::P1080;
+ // DLSS SR / FSR second passes (2026-11-08).
+ EnhancementSettings dlssSecond;dlssSecond.sr=true;dlssSecond.videoSrQuality=4;dlssSecond.dualSrEnabled=true;dlssSecond.dualSrQuality=0;
+ dlssSecond.dlssSrModel=1;dlssSecond.srPrescale=SrPrescale::P1080;
+ EnhancementSettings fsrSecond;fsrSecond.sr=true;fsrSecond.videoSrQuality=0;fsrSecond.dualSrEnabled=true;fsrSecond.dualSrQuality=kVideoSrFsr;
+ fsrSecond.srPrescale=SrPrescale::P900;fsrSecond.srTarget=SrTarget::Uhd8K;
// Settings presets: v35 only when a Video Effects value is stored.
{
@@ -119,6 +153,19 @@ int wmain(int argc,wchar_t** argv){
check(a&&a->sr&&a->videoSrQuality==23&&a->srTarget==SrTarget::Qhd,"v35 restores the base family and tier");
check(b&&b->videoSrQuality==4&&b->dualSrEnabled&&b->dualSrQuality==18&&b->srPrescale==SrPrescale::P900,"v35 restores a Video Effects second pass");
check(c&&c->videoSrQuality==19&&c->dualSrQuality==21&&c->srPrescale==SrPrescale::P1080,"v35 restores both passes");
+ // A DLSS SR / FSR second pass: v36, older (v35) readers reject the file whole.
+ PresetStore anySr(root/L"any-sr.txt");
+ check(anySr.load()&&anySr.put(L"dlss",dlssSecond)&&anySr.put(L"fsr",fsrSecond),"settings presets with DLSS SR / FSR second passes");
+ check(bytes(root/L"any-sr.txt").starts_with("VEYRA_PRESETS 36"),"a DLSS SR / FSR second pass writes v36");
+ PresetStore anyReader(root/L"any-sr.txt");check(anyReader.load()&&anyReader.entries().size()==2,"v36 reload");
+ for(const auto& e:anyReader.entries()){
+ const auto& want=e.name==L"dlss"?dlssSecond:fsrSecond;
+ check(e.settings.videoSrQuality==want.videoSrQuality&&e.settings.dualSrEnabled&&e.settings.dualSrQuality==want.dualSrQuality&&
+ e.settings.srPrescale==want.srPrescale&&e.settings.dlssSrModel==want.dlssSrModel&&e.settings.srTarget==want.srTarget,"v36 restores both passes");
+ }
+ PresetStore mixed(root/L"video-ai.txt");check(mixed.load()&&mixed.put(L"dlss",dlssSecond)&&bytes(root/L"video-ai.txt").starts_with("VEYRA_PRESETS 36"),
+ "adding a DLSS SR second pass upgrades a v35 store to v36");
+ PresetStore mixedReader(root/L"video-ai.txt");check(mixedReader.load()&&mixedReader.entries().size()==4,"v36 keeps the Video Effects entries");
}
// Preset library: new entries go to a v18 .video-ai sidecar; the older files stay.
@@ -164,6 +211,40 @@ int wmain(int argc,wchar_t** argv){
check(kept(before,removed)&&removed.size()==before.size()+1,"removal writes the sidecar, not the older file");
}
+ // Preset library with DLSS SR / FSR second passes: v19 in a .dual-sr-any sidecar.
+ {
+ const auto path=root/L"any-sr.preset";
+ {
+ PresetLibrary old(path);old.setIncludeBuiltins(false);
+ auto e=std::make_unique<PresetEntry>();e->name=L"old";e->chain=toChain(vsr);e->globals=ChainGlobalSettings::capture(vsr);
+ check(old.load()&&old.put(*e),"library entry with a Video Effects value");
+ }
+ const auto before=files(path);
+ check(before.size()==1&&before.begin()->first.ends_with(L".video-ai")&&before.begin()->second.starts_with("VEYRA_PRESET_LIBRARY 18"),
+ "a Video Effects library stays v18 in its sidecar");
+ std::vector<std::unique_ptr<PresetEntry>> saved;
+ for(const auto& [name,settings]:{std::pair{L"dlss",&dlssSecond},std::pair{L"fsr",&fsrSecond}}){
+ PresetLibrary library(path);library.setIncludeBuiltins(false);check(library.load(),"library reload before save");
+ auto e=std::make_unique<PresetEntry>();e->name=name;e->chain=toChain(*settings);e->globals=ChainGlobalSettings::capture(*settings);
+ check(library.put(*e),"save an entry with a DLSS SR / FSR second pass");saved.push_back(std::move(e));
+ }
+ const auto after=files(path);
+ check(kept(before,after),"older library files untouched");
+ check(after.size()==before.size()+1&&std::any_of(after.begin(),after.end(),[&](const auto& f){
+ return !before.contains(f.first)&&f.first.ends_with(L".dual-sr-any")&&f.second.starts_with("VEYRA_PRESET_LIBRARY 19");}),
+ "library writes v19 to one new .dual-sr-any sidecar");
+ PresetLibrary reloaded(path);reloaded.setIncludeBuiltins(false);
+ check(reloaded.load()&&reloaded.entries().size()==3,"library reload reads the newest sidecar");
+ for(const auto& e:saved){
+ const auto it=std::find_if(reloaded.entries().begin(),reloaded.entries().end(),[&](const auto& r){return r.name==e->name;});
+ check(it!=reloaded.entries().end()&&*it==*e,"library restores the full DLSS SR / FSR entry");
+ if(it==reloaded.entries().end()||!e->globals)continue;
+ EnhancementSettings applied;PresetLibrary::apply(*it,applied);
+ check(applied.dualSrEnabled&&applied.dualSrQuality==e->globals->dualSrQuality&&applied.videoSrQuality==e->globals->videoSrQuality&&
+ applied.validate().empty(),"applying restores a DLSS SR / FSR second pass");
+ }
+ }
+
// Mode session (node mode, high bitrate base with a streaming second pass).
{
auto session=std::make_unique<ChainSession>(ChainSession::initial(both));check(session->select(ChainMode::Node),"node mode initializes");
@@ -178,6 +259,13 @@ int wmain(int argc,wchar_t** argv){
auto plain=std::make_unique<ChainSession>(ChainSession::initial(EnhancementSettings{}));
const auto plainPath=root/L"plain.session";ChainSessionStore plainWriter(plainPath);
check(plainWriter.save(*plain)&&std::filesystem::exists(plainPath)&&!std::filesystem::exists(sidecar(plainPath)),"plain session keeps the older file");
+ // A DLSS SR second pass: v14 in the .dual-sr-any sidecar, nothing else written.
+ auto anySession=std::make_unique<ChainSession>(ChainSession::initial(dlssSecond));
+ const auto anyPath=root/L"any-sr.session";ChainSessionStore anyWriter(anyPath);
+ check(anyWriter.save(*anySession)&&!std::filesystem::exists(anyPath)&&!std::filesystem::exists(sidecar(anyPath))&&
+ bytes(sidecar(anyPath,L".dual-sr-any")).starts_with("VEYRA_CHAIN_SESSION 14"),"session writes v14 to the .dual-sr-any sidecar only");
+ auto anyRestored=std::make_unique<ChainSession>();ChainSessionStore anyReader(anyPath);
+ check(anyReader.load(*anyRestored)&&*anySession==*anyRestored,"session restart restores the DLSS SR second pass");
}
std::cout<<"Video AI settings "<<checks<<" checks, "<<failures<<" failures\n";return failures?1:0;