fix: 窗口模式缩放支持 1.0x(不缩放),让同分辨率滤镜真正 1:1 - #3
Merged
SAOG0721 merged 1 commit intoAug 31, 2026
Conversation
窗口模式缩放此前无法真正做到 1.0x。UI 中「初始缩放倍数 → 自定义」的 NumberBox 下限是 1.1;而即使绕过 UI,_CalcWindowedScalingWindowSize 仍以「源窗口包含窗口 框架的矩形 + WINDOWED_MODE_MIN_SPACE_AROUND」作为最小渲染尺寸,会把实际倍率顶到 1.05x 以上(源窗口有标题栏时更高),配置中的值被静默覆盖。 AppSettings 读取配置时把 customInitialWindowedScaleFactor clamp 到 1.0,也就是 配置层本来就认为 1.0 是合法值,三者的下限并不一致。 现在用户显式指定 1.0x 时,最小渲染尺寸以被缩放区域为准且不额外留出空间,使渲染 窗口和源内容逐像素对应,不引入重采样。其他倍率(含「自动」)的行为不变,仍然遮挡 源窗口和它的阴影,WINDOWED_MODE_MIN_SPACE_AROUND 常量也未改动。 initialWindowedScaleFactor 用小于 1.0 表示「自动」,1.0 是未被占用的合法值, 因此不会和现有语义冲突。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
SAOG0721
added a commit
that referenced
this pull request
Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
让窗口模式缩放可以真正设为 1.0x(不缩放),这样同分辨率滤镜(DLSSNR AI Filter、RTX Video 的降噪模式一类不负责放大的效果)可以在画面与源窗口逐像素对应、完全不经过重采样的前提下叠加。这条效果链原本必须先被放大至少 1.05x~1.1x,滤镜实际是在重采样后的画面上工作的。
同一改动已提给上游:Blinue#1446 —— 这段代码本身来自上游,如果上游合并了,这个 PR 可以直接关掉。这里单独提一份是为了实验分支不用等上游。
问题
三处的下限并不一致:
ProfilePage.xaml中「初始缩放倍数 → 自定义」的NumberBoxMinimum="1.1"。_CalcWindowedScalingWindowSize的最小渲染尺寸是「源窗口包含窗口框架的矩形 +WINDOWED_MODE_MIN_SPACE_AROUND(100dip)」,会把实际倍率顶到 1.05x 以上(源窗口带标题栏时更高),即使手改配置文件也会被静默覆盖。AppSettings::_LoadProfile读取配置时是把customInitialWindowedScaleFactorclamp 到 1.0 的,配置层本来就认为 1.0 合法。改动
ProfilePage.xaml:NumberBox的Minimum由 1.1 改为 1。ScalingWindow.cpp/_CalcWindowedScalingWindowSize:仅当用户显式指定 1.0x 时,最小渲染尺寸以被缩放区域(SrcRect)为准且不额外留出空间。其他倍率(含「自动」)行为不变,
WINDOWED_MODE_MIN_SPACE_AROUND常量未改动,noUpscaling为false时这段代码与改动前等价。测试
Release/x64/ MSVC v145(VS 2026),EnableDLSSSR+EnableDLSSFrameGeneration+EnableDLSSNR打开,编译通过无警告。FrameRate_Filter+DLSSNR\DLSSNR_AI_Filter效果链实际使用过 1.0x:渲染窗口与被缩放区域尺寸一致,DLSSNR STATUS正常,画面无重采样。已知取舍
1.0x 下渲染窗口只和被缩放区域一样大,缩放窗口靠自身的标题栏和边框遮挡源窗口。对标准窗口框架的源窗口基本刚好覆盖;源窗口自绘非客户区且尺寸差异较大时理论上可能露出边缘,这是选择「不缩放」可预期的结果。