hdr工作面适配 - #24
Open
konodiodaaaaa1 wants to merge 9 commits into
Open
Conversation
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.
关联关系
这次 PR 的定位
这是一条完整的 HDR 工作面适配分支。实现以本地 0.6.5 已经完成的效果、native backend、DLSSNR 残差、Frame Guidance、FG 发布和参数会话为基础,加入官方 0.6.6 的会话生命周期、NGX 异常保护、捕获关闭保护、实时参数队列、inputRevision history 管理、窗口 owner 和 overlay 状态恢复。
HDR 适配采用显式全局开关:
关闭 HDR compatibility 时,HDR boundary 清空,HDR-only 参数进入 inactive/default,HDR capture pool、normalization、HDR compiler variant、HDR presenter 和 HDR terminal 均退出处理链。外部显示器或系统处于 HDR 状态时,关闭这个选项仍然选择线上 U8/LDR 路由;本地 0.6.5 的 DLSSNR residual、Frame Guidance、ZeroMV、FG failure recovery 和原有参数行为保持原逻辑。
Canonical FP16 与 route boundary
inter-effect canonical storage 为 DXGI_FORMAT_R16G16B16A16_FLOAT,并由 HdrFrameMetadata 与 ColorDescription 携带 transfer、primaries、range、reference white、SDR white、display peak、scene/display referred、pre-exposure 和 HDR metadata。
每个效果通过结构化 HdrFormatRoute 描述 input/output format、transfer、range、alpha mode、evidence level、HDR-native、adapter profile、HDR/SDR 默认值和 normalization scale。route 选择使用结构化字段,effect 名称只用于 catalog 分组和诊断。
已落地的 adapter profile:
Native backend 适配
DLSSNR
保留本地 DLSSNR 的颜色、depth、motion、exposure、残差、输入分辨率和 history 逻辑。HDR 状态使用 canonical FP16 -> bounded HDR normalization -> DLSSNR color/depth/motion/exposure -> inverse normalization -> canonical FP16。
inputRevision 由 Renderer 传入;上游实时参数或输入 route 变化时刷新 history,避免旧静帧缓存与新输入混合。所有 NGX create/evaluate/release/shutdown、参数访问和 signed snippet 调用统一进入 NgxRuntimeGuard。
DLSS SR / DLSS FG
DLSS SR 使用 route-compatible float 输入和既有 guidance contract。DLSSFG 增加 _dlssFgNormalizedInput、_dlssFgCanonicalGenerated 和 _dlssFgHdrNormalizationScale,在 evaluate 前后完成 bounded/canonical 转换,并在 publication 前检查 canonical FP16 descriptor。原有 CPU Fence、D3D11/D3D12 共享资源、history reset、一次重建和当前会话禁用策略继续保留。
XeSS SR / XeSSFG
XeSS SR 的 HDR FP16 初始化和 SDR U8 初始化分开;XESS_INIT_FLAG_LDR_INPUT_COLOR 只用于 SDR 路由,HDR 浮点输入保留自己的 contract。XeSSZeroMVUpscaler 继续作为独立的线上 ZeroMV backend。
XeSSFG 作为 presentation terminal 使用 canonical FP16 -> Rec.709 to Rec.2020 -> PQ/BT.2100 -> R10G10B10A2_UNORM -> DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 -> XeSSFG proxy swap chain。backbuffer、HUD-less、UI surface 和 proxy swap chain 使用同一 HDR10 contract;HDR off 恢复线上 LDR terminal。
FSR2/FSR3/FSR4、RTX Video、光流
FSR2/3/4 保留本地 ZeroMV、motion、depth、exposure、reactive/transparency mask 和 FG/optical-flow 辅助资源,HDR 只在 boundary 增加 canonical/route conversion。RTX Video 使用显式 normalized-D3D/U8 bridge,inputScale 按实际 float/U8 输入选择。AMD OF 与 NVOF 在 HDR 状态从 canonical frame 做 provider-local conversion,SDR 状态优先线上 B8G8R8A8/U8 contract。
PassThrough 和普通 shader
PassThrough 分为 REFERENCE_HDR_HLSL 与 REFERENCE_LDR_HLSL。Effect compiler 的 MP_HDR_SATURATE、MP_HDR_ALPHA、MP_HDR_COMPATIBILITY 只注入 HDR variant。Group A 效果使用结构化 R8 SDR fallback;CAS 额外保留条件 FP16/linear route 和独立编译 gate。alpha 由 route 显式声明 Preserve、ForceOpaque 或 Premultiplied,publication 和 overlay 边界保持一致。
官方 0.6.6 流程合入
本地 9c2309a 保留官方 0.6.6 的核心设计:
官方 0.6.6 的用户可见设计和 HDR boundary 是两层职责:0.6.6 负责会话与资源生命周期,HDR 层负责 canonical FP16、色彩 metadata、格式适配和 terminal presentation。
配置与回退重点
重点审查入口:
HDR off 的强制合同:
验证
已在 E:\Magpie-0.6.5-build 完成 Release x64 全量重建,版本为 0.6.6-hdr-fp16compat。
Review focus
请按下面顺序审阅:
本 PR 提交源码、资源和已构建版本相关变更;详细交接稿留在本地工作树,作为本 PR 描述和后续上游审阅的依据,文件本身保持未加入本次推送。