Restore behavioral render preset override coverage
This commit is contained in:
1 parent
bd343a7be1
commit
56e1b76622
4 files changed
+117
-7
No files matched your search
@@ -74,6 +74,7 @@
|
||||
#include <vector>
|
||||
#include "d4r_event_wait.h"
|
||||
#include "d4r_frame_completion.h"
|
||||
#include "d4r_render_presets.h"
|
||||
#include "d4r_win32_wait.h"
|
||||
#include "d4r_vkd3d_interop.h"
|
||||
#include "../engine/game.h"
|
||||
@@ -7109,18 +7110,18 @@ static NgxResult create_feature(unsigned int featureId, void* parameters, NgxHan
|
||||
unsigned int presets[6];
|
||||
for (int index = 0; index < 6; ++index)
|
||||
presets[index] = get_uint_or(parameters, presetNames[index], 0);
|
||||
const std::string forced = env_string(rayReconstruction ? "D4R_RR_PRESET" : "D4R_DLSS_PRESET");
|
||||
if (!forced.empty())
|
||||
const std::string forced = env_string(d4r_render_preset_variable(rayReconstruction));
|
||||
const auto presetOverride = d4r_parse_render_preset_override(forced.c_str());
|
||||
if (presetOverride.enabled)
|
||||
{
|
||||
const unsigned int value = static_cast<unsigned int>(strtoul(forced.c_str(), nullptr, 0));
|
||||
const unsigned int value = presetOverride.value;
|
||||
const char* model = value == 5 ? "E" : value == 11 ? "K" : value == 12 ? "L" : value == 13 ? "M" : "custom";
|
||||
logf("DLSS model override: D4R_DLSS_PRESET=%s (model %s) overrides game/OptiScaler presets "
|
||||
"[DLAA=%u Quality=%u Balanced=%u Performance=%u UltraPerformance=%u UltraQuality=%u]; "
|
||||
"using preset=%u for all quality modes",
|
||||
forced.c_str(), model, presets[0], presets[1], presets[2], presets[3], presets[4], presets[5], value);
|
||||
for (unsigned int& preset : presets)
|
||||
preset = value;
|
||||
}
|
||||
presetOverride.apply(presets);
|
||||
feature->preset = presets[1];
|
||||
// Direct output needs the native output kernel of the preset in use (verified: K = 11 through
|
||||
// hiluma_engine_output, M = 13 through rrlite_downsample_kernel, its last kernel). Only a forced
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
// Platform-specific environment reads stay in the caller. SR and RR deliberately
|
||||
// use separate settings, even when both are configured for the same feature call.
|
||||
inline constexpr const char* d4r_render_preset_variable(bool rayReconstruction)
|
||||
{
|
||||
return rayReconstruction ? "D4R_RR_PRESET" : "D4R_DLSS_PRESET";
|
||||
}
|
||||
|
||||
// An absent/empty override leaves every game-selected quality preset unchanged.
|
||||
// An explicit zero is an override too: it requests NGX's default preset.
|
||||
struct D4rRenderPresetOverride
|
||||
{
|
||||
bool enabled;
|
||||
unsigned int value;
|
||||
|
||||
void apply(unsigned int (&presets)[6]) const
|
||||
{
|
||||
if (enabled)
|
||||
for (unsigned int& preset : presets)
|
||||
preset = value;
|
||||
}
|
||||
};
|
||||
|
||||
inline D4rRenderPresetOverride d4r_parse_render_preset_override(const char* overrideValue)
|
||||
{
|
||||
if (overrideValue == nullptr || *overrideValue == '\0')
|
||||
return {false, 0};
|
||||
return {true, static_cast<unsigned int>(std::strtoul(overrideValue, nullptr, 0))};
|
||||
}
|
||||
Reference in new issue
Block a user