Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions OptiScaler/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ bool Config::Reload(std::filesystem::path iniPath)
DlssNrUseProxy.set_from_config(readBool("DlssNr", "UseProxy"));
DlssNrScanExposure.set_from_config(readBool("DlssNr", "ScanExposure"));
DlssNrWhitePointSource.set_from_config(readUInt("DlssNr", "WhitePointSource"));
DlssNrAutoExposureTrim.set_from_config(readFloat("DlssNr", "AutoExposureTrim"));
DlssNrAutoExposureShadowProtection.set_from_config(
readFloat("DlssNr", "AutoExposureShadowProtection"));
DlssNrGameExposureTrimAnchors.set_from_config(readString("DlssNr", "GameExposureTrimAnchors"));
DlssNrAutoExposureTrimAnchors.set_from_config(readString("DlssNr", "AutoExposureTrimAnchors"));

// Migrate the retired flag only when the new key was genuinely absent, which is why this
// has to run AFTER the read above -- set_from_config assigns only into an empty optional,
Expand Down Expand Up @@ -1240,6 +1245,14 @@ bool Config::SaveIni()
// restart -- the white-point source, both trims, the anchor, the pass count and the rest all
// reset to default on the next run.
ini.SetValue("DlssNr", "WhitePointSource", GetIntValue(Instance()->DlssNrWhitePointSource.value_for_config()).c_str());
ini.SetValue("DlssNr", "AutoExposureTrim",
GetFloatValue(Instance()->DlssNrAutoExposureTrim.value_for_config()).c_str());
ini.SetValue("DlssNr", "AutoExposureShadowProtection",
GetFloatValue(Instance()->DlssNrAutoExposureShadowProtection.value_for_config()).c_str());
ini.SetValue("DlssNr", "GameExposureTrimAnchors",
Instance()->DlssNrGameExposureTrimAnchors.value_for_config_or("").c_str());
ini.SetValue("DlssNr", "AutoExposureTrimAnchors",
Instance()->DlssNrAutoExposureTrimAnchors.value_for_config_or("").c_str());
ini.SetValue("DlssNr", "WhitePointTrim", GetFloatValue(Instance()->DlssNrWhitePointTrim.value_for_config()).c_str());
ini.SetValue("DlssNr", "ScanTrim", GetFloatValue(Instance()->DlssNrScanTrim.value_for_config()).c_str());
ini.SetValue("DlssNr", "ScanAnchorValue", GetFloatValue(Instance()->DlssNrScanAnchorValue.value_for_config()).c_str());
Expand Down
21 changes: 18 additions & 3 deletions OptiScaler/Config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include "SysUtils.h"
#include "State.h"
Expand Down Expand Up @@ -427,8 +427,9 @@ class Config
// Where the white point comes from. One control, because there is one answer.
//
// 0 the paper white slider, and nothing else
// 1 the exposure the game hands the upscaler
// 2 a buffer the scan found, anchored to a white point the user chose once
// 1 the exposure the game hands the upscaler (game only; no automatic fallback)
// 2 OptiScaler automatic exposure, calculated from the original linear-HDR frame
// 3 a buffer the scan found, anchored to a white point the user chose once
//
// This replaces two independent checkboxes that could both be on. They were made exclusive by
// greying, which deadlocked -- each disabled the other, so once both were set the only way out
Expand All @@ -437,6 +438,20 @@ class Config
// choice cannot reach it: there is nothing to keep consistent, because there is only one value.
CustomOptional<uint32_t> DlssNrWhitePointSource { 1 };

// Separate trim for OptiScaler's own GPU-calculated exposure (WhitePointSource == 2).
CustomOptional<float> DlssNrAutoExposureTrim { 5.0f };
CustomOptional<float> DlssNrAutoExposureShadowProtection { 100.0f };

// Base-white-point-dependent Trim calibration tables, serialized as baseWhitePoint:trim pairs.
// The two sources are intentionally separate because their white-point scales need not match.
CustomOptional<std::string> DlssNrGameExposureTrimAnchors { std::string() };
CustomOptional<std::string> DlssNrAutoExposureTrimAnchors { std::string() };

// Calibration aid only. These are deliberately not persisted: after a restart anchors are
// active again, rather than a forgotten preview checkbox silently bypassing them.
CustomOptional<bool> DlssNrGameExposureTrimPreview { false };
CustomOptional<bool> DlssNrAutoExposureTrimPreview { false };

CustomOptional<bool> DlssNrScanMeter { false };

CustomOptional<float> DlssNrScanAnchorValue { 0.0f }; // legacy single anchor, migrated then unused
Expand Down
1 change: 1 addition & 0 deletions OptiScaler/dlssnr/DlssNrFeature_Dx12.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ struct ExposureStatus
};

ExposureStatus GameExposureStatus();
ExposureStatus AutoExposureStatus();

// The white point the exposure meter has settled on, or 0 if it has not taken a reading yet. For the
// overlay, so the number in use is visible rather than inferred.
Expand Down
Loading