Skip to content
Merged
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
50 changes: 21 additions & 29 deletions src/Features/Upscaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ void Upscaling::DrawSettings()
else
currentUpscaleMode = &settings.upscaleMethodNoDLSS;

// Slider for method selection
// Clamp the index used to read from the built label vector to avoid OOB if the stored value is stale
uint32_t modeLabelIndex = std::min(*currentUpscaleMode, static_cast<uint32_t>(upscaleModes.size() - 1));
std::string currentLabel = upscaleModes[modeLabelIndex];
ImGui::SliderInt("Method", (int*)currentUpscaleMode, 0, availableModes, currentLabel.c_str());
// Dropdown for method selection
std::vector<const char*> modeLabels;
for (uint32_t i = 0; i <= availableModes; ++i)
modeLabels.push_back(upscaleModes[i].c_str());
ImGui::Combo("Method", (int*)currentUpscaleMode, modeLabels.data(), (int)modeLabels.size());

*currentUpscaleMode = std::min(availableModes, *currentUpscaleMode);

Expand Down Expand Up @@ -312,22 +312,24 @@ void Upscaling::DrawSettings()
ImGui::PopStyleColor();
}

std::string enabledLabel = "Enabled";
const char* toggleModes[] = { "Disabled", "Enabled" };
const char* toggleModesFG[] = { "Disabled", enabledLabel.c_str() };

ImGui::SliderInt("Frame Generation", (int*)&settings.frameGenerationMode, 0, 1, toggleModesFG[settings.frameGenerationMode]);
bool fgEnabled = settings.frameGenerationMode != 0;
if (ImGui::Checkbox("Frame Generation", &fgEnabled))
settings.frameGenerationMode = fgEnabled ? 1 : 0;

if (!frameGenerationDx12PathActive)
ImGui::BeginDisabled();

ImGui::SliderInt("Frame Limit (Variable Refresh Rate)", (int*)&settings.frameLimitMode, 0, 1, std::format("{}", toggleModes[settings.frameLimitMode]).c_str());
bool flEnabled = settings.frameLimitMode != 0;
if (ImGui::Checkbox("Frame Limit (Variable Refresh Rate)", &flEnabled))
settings.frameLimitMode = flEnabled ? 1 : 0;

if (!frameGenerationDx12PathActive)
ImGui::EndDisabled();

ImGui::TextWrapped("Allows frame generation to function on low refresh rate monitors. Detected: %.2f Hz", refreshRate);
ImGui::SliderInt("Force Enable Frame Generation", (int*)&settings.frameGenerationForceEnable, 0, 1, std::format("{}", toggleModes[settings.frameGenerationForceEnable]).c_str());
bool fgForce = settings.frameGenerationForceEnable != 0;
if (ImGui::Checkbox("Force Enable Frame Generation", &fgForce))
settings.frameGenerationForceEnable = fgForce ? 1 : 0;

ImGui::Checkbox("Frame Generation in Menus", &settings.frameGenerationAllowInMenus);
if (auto _tt = Util::HoverTooltipWrapper()) {
Expand All @@ -344,8 +346,6 @@ void Upscaling::DrawSettings()
const bool reflexAvailable = streamline.initialized && streamline.featureReflex;
const bool reflexControlsAvailable = reflexAvailable && !reflexBlockedByFrameGeneration;
const bool markerOptimizationAvailable = reflexControlsAvailable && streamline.featurePCL;
const char* toggleModes[] = { "Disabled", "Enabled" };

if (reflexBlockedByFrameGeneration) {
ImGui::TextDisabled("Reflex is unavailable while the DX12 frame-generation swapchain is active.");
}
Expand All @@ -357,38 +357,29 @@ void Upscaling::DrawSettings()
if (!reflexControlsAvailable)
ImGui::BeginDisabled();

int lowLatencyMode = settings.reflexLowLatencyMode ? 1 : 0;
ImGui::SliderInt("Low Latency Mode", &lowLatencyMode, 0, 1, toggleModes[lowLatencyMode]);
ImGui::Checkbox("Low Latency Mode", &settings.reflexLowLatencyMode);
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::TextUnformatted("Cuts input delay by syncing CPU work closer to the GPU.");
ImGui::TextUnformatted("Can reduce max FPS a little, but usually feels more responsive.");
}
settings.reflexLowLatencyMode = lowLatencyMode > 0;

if (!settings.reflexLowLatencyMode)
ImGui::BeginDisabled();

int lowLatencyBoost = settings.reflexLowLatencyBoost ? 1 : 0;
ImGui::SliderInt("Low Latency Boost", &lowLatencyBoost, 0, 1, toggleModes[lowLatencyBoost]);
ImGui::Checkbox("Low Latency Boost", &settings.reflexLowLatencyBoost);
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::TextUnformatted("Keeps GPU clocks higher to avoid latency spikes at low GPU load.");
ImGui::TextUnformatted("Useful if frametime jumps; costs extra power and heat.");
}
settings.reflexLowLatencyBoost = lowLatencyBoost > 0;

if (!settings.reflexLowLatencyMode)
ImGui::EndDisabled();

if (!markerOptimizationAvailable)
ImGui::BeginDisabled();

int markersToOptimize = settings.reflexUseMarkersToOptimize ? 1 : 0;
ImGui::SliderInt("Use Markers To Optimize", &markersToOptimize, 0, 1, toggleModes[markersToOptimize]);
ImGui::Checkbox("Use Markers To Optimize", &settings.reflexUseMarkersToOptimize);
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::TextUnformatted("Uses frame markers for tighter Reflex timing.");
ImGui::TextUnformatted("Try On first; turn Off if it causes stutter on your setup.");
}
settings.reflexUseMarkersToOptimize = markersToOptimize > 0;

if (!markerOptimizationAvailable)
ImGui::EndDisabled();
Expand All @@ -397,13 +388,14 @@ void Upscaling::DrawSettings()
ImGui::TextDisabled("Marker optimization unavailable (PCL not loaded).");
}

int useFPSLimit = settings.reflexUseFPSLimit ? 1 : 0;
ImGui::SliderInt("Use FPS Limit", &useFPSLimit, 0, 1, toggleModes[useFPSLimit]);
ImGui::Checkbox("Use FPS Limit", &settings.reflexUseFPSLimit);
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::TextUnformatted("Uses Reflex's internal FPS cap for steadier frametimes.");
ImGui::TextUnformatted("Can lower latency versus uncapped rendering.");
}
settings.reflexUseFPSLimit = useFPSLimit > 0;

if (!settings.reflexLowLatencyMode)
ImGui::EndDisabled();

if (!settings.reflexUseFPSLimit)
ImGui::BeginDisabled();
Expand Down
Loading