diff --git a/OptiScaler/inputs/NVNGX_DLSS_Dx11.cpp b/OptiScaler/inputs/NVNGX_DLSS_Dx11.cpp index c150c88f..683c0d08 100644 --- a/OptiScaler/inputs/NVNGX_DLSS_Dx11.cpp +++ b/OptiScaler/inputs/NVNGX_DLSS_Dx11.cpp @@ -652,7 +652,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceConte if (!upscaleResult) { - ImGui::InsertNotification({ ImGuiToastType::Warning, 10000, "Upscaler failed to run!" }); + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Upscaler failed to run!" }); } if (!upscaleResult && !deviceContext->IsInited() && diff --git a/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp b/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp index 0454c314..21805048 100644 --- a/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp +++ b/OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp @@ -799,6 +799,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom if (!deviceContext->feature->IsInited() && Config::Instance()->Dx12Upscaler.value_or_default() != "fsr21") { LOG_WARN("InCmdList {0} is not inited, falling back to FSR 2.1.2", deviceContext->feature->Name()); + ImGui::InsertNotification({ ImGuiToastType::Warning, 10000, "Falling back to FSR 2.1.2" }); State::Instance().newBackend = "fsr21"; State::Instance().changeBackend[handleId] = true; return NVSDK_NGX_Result_Success; @@ -842,7 +843,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom } else { - ImGui::InsertNotification({ ImGuiToastType::Warning, 10000, "Upscaler failed to run!" }); + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Upscaler failed to run!" }); } // Root signature restore diff --git a/OptiScaler/inputs/NVNGX_DLSS_Vk.cpp b/OptiScaler/inputs/NVNGX_DLSS_Vk.cpp index 6708b12d..e536af79 100644 --- a/OptiScaler/inputs/NVNGX_DLSS_Vk.cpp +++ b/OptiScaler/inputs/NVNGX_DLSS_Vk.cpp @@ -916,7 +916,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer auto upscaleResult = deviceContext->Evaluate(InCmdList, InParameters); if (!upscaleResult) - ImGui::InsertNotification({ ImGuiToastType::Warning, 10000, "Upscaler failed to run!" }); + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Upscaler failed to run!" }); if ((!upscaleResult || !deviceContext->IsInited()) && Config::Instance()->VulkanUpscaler.value_or_default() != "fsr22") diff --git a/OptiScaler/menu/menu_common.cpp b/OptiScaler/menu/menu_common.cpp index 14d3725b..ee826832 100644 --- a/OptiScaler/menu/menu_common.cpp +++ b/OptiScaler/menu/menu_common.cpp @@ -1390,13 +1390,13 @@ static void MenuSizeCheck(ImGuiIO io) { if (!Config::Instance()->MenuScale.has_value()) { - float y = State::Instance().screenHeight; + float screenHeight = State::Instance().screenHeight; if (io.DisplaySize.y != 0) - y = (float) io.DisplaySize.y; + screenHeight = io.DisplaySize.y; // 1000p is minimum for 1.0 menu ratio - Config::Instance()->MenuScale = (float) ((int) (y / 100.0f)) / 10.0f; + Config::Instance()->MenuScale = (float) ((int) (screenHeight / 100.0f)) / 10.0f; if (Config::Instance()->MenuScale.value() > 1.0f || Config::Instance()->MenuScale.value() <= 0.0f) Config::Instance()->MenuScale.value() = 1.0f; @@ -1776,11 +1776,19 @@ bool MenuCommon::RenderMenu() (!Config::Instance()->OverlayMenu.value_or_default() && State::Instance().currentFeature != nullptr && State::Instance().currentFeature->IsHdr()); - float notificationScale = 2.0f; + float screenHeight = State::Instance().screenHeight; + if (io.DisplaySize.y != 0) + screenHeight = io.DisplaySize.y; + + // Map resolution height to scale, 0.5 for 480p, 2.0 for 1440p + constexpr float slope = (2.0f - 0.5f) / (1440.f - 480.f); + float notificationScale = 0.5f + slope * (screenHeight - 480.f); + notificationScale = std::clamp(notificationScale, 0.5f, 2.0f); + if (config->UseHQFont.value_or_default()) ImGui::PushFontSize(std::round(notificationScale * fontSize)); - else - ImGui::SetWindowFontScale(notificationScale); + + // No fallback font, SetWindowFontScale needs to be called after Begin() ImGui::RenderNotifications(ImGuiToastPos::TopCenter, notificationScale, tonemapRequired); @@ -4408,10 +4416,12 @@ bool MenuCommon::RenderMenu() } if (ImGui::Button("S")) - ImGui::InsertNotification({ ImGuiToastType::Success, 10000, "Test Success Test Success Test Success Test Success" }); + ImGui::InsertNotification( + { ImGuiToastType::Success, 10000, "Test Success Test Success Test Success Test Success" }); ImGui::SameLine(0.0f, 16.0f); if (ImGui::Button("W")) - ImGui::InsertNotification({ ImGuiToastType::Warning, 10000, "Test warning Test warning Test warning" }); + ImGui::InsertNotification( + { ImGuiToastType::Warning, 10000, "Test warning Test warning Test warning" }); ImGui::SameLine(0.0f, 16.0f); if (ImGui::Button("E")) ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Test error Test error" }); diff --git a/OptiScaler/proxies/FfxApi_Proxy.h b/OptiScaler/proxies/FfxApi_Proxy.h index ce54fe86..7a236818 100644 --- a/OptiScaler/proxies/FfxApi_Proxy.h +++ b/OptiScaler/proxies/FfxApi_Proxy.h @@ -33,6 +33,7 @@ #define FFX_API_CONFIGURE_FG_SWAPCHAIN_KEY_FRAMEPACINGTUNING FFX_API_CONFIGURE_FG_SWAPCHAIN_KEY_FRAMEPACINGTUNING_VK #include +#include #undef FFX_API_CONFIGURE_FG_SWAPCHAIN_KEY_WAITCALLBACK #undef FFX_API_CONFIGURE_FG_SWAPCHAIN_KEY_FRAMEPACINGTUNING @@ -112,8 +113,27 @@ class FfxApiProxy static HMODULE Dx12Module_SR() { return upscaling_dx12.dll; } static HMODULE Dx12Module_FG() { return fg_dx12.dll; } - static bool IsFGReady() { return (main_dx12.dll && !main_dx12.isLoader) || fg_dx12.dll != nullptr; } - static bool IsSRReady() { return (main_dx12.dll && !main_dx12.isLoader) || upscaling_dx12.dll != nullptr; } + static bool IsFGReady() + { + bool result = (main_dx12.dll && !main_dx12.isLoader) || fg_dx12.dll != nullptr; + + if (!result) + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, + "Can't load amd_fidelityfx_dx12\nDid you forget to extract that dll?" }); + + return result; + } + + static bool IsSRReady() + { + bool result = (main_dx12.dll && !main_dx12.isLoader) || upscaling_dx12.dll != nullptr; + + if (!result) + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, + "Can't load amd_fidelityfx_dx12\nDid you forget to extract that dll?" }); + + return result; + } static FFXStructType GetType(ffxStructType_t type) { diff --git a/OptiScaler/upscalers/FeatureProvider_Dx11.cpp b/OptiScaler/upscalers/FeatureProvider_Dx11.cpp index caa50321..befa15b2 100644 --- a/OptiScaler/upscalers/FeatureProvider_Dx11.cpp +++ b/OptiScaler/upscalers/FeatureProvider_Dx11.cpp @@ -199,6 +199,7 @@ bool FeatureProvider_Dx11::ChangeFeature(std::string upscalerName, ID3D11Device* { State::Instance().newBackend = "fsr22"; State::Instance().changeBackend[handleId] = true; + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Falling back to FSR 2.2" }); } else { diff --git a/OptiScaler/upscalers/FeatureProvider_Dx12.cpp b/OptiScaler/upscalers/FeatureProvider_Dx12.cpp index 49d65114..7d7a9bd0 100644 --- a/OptiScaler/upscalers/FeatureProvider_Dx12.cpp +++ b/OptiScaler/upscalers/FeatureProvider_Dx12.cpp @@ -200,10 +200,16 @@ bool FeatureProvider_Dx12::ChangeFeature(std::string upscalerName, ID3D12Device* if (State::Instance().newBackend != "dlssd") { - if (Config::Instance()->Dx12Upscaler == "dlss") + if (Config::Instance()->VulkanUpscaler == "dlss") + { State::Instance().newBackend = "xess"; + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Falling back to XeSS" }); + } else + { State::Instance().newBackend = "fsr21"; + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Falling back to FSR 2.1" }); + } } else { diff --git a/OptiScaler/upscalers/FeatureProvider_Vk.cpp b/OptiScaler/upscalers/FeatureProvider_Vk.cpp index 44b58aaf..626f19c5 100644 --- a/OptiScaler/upscalers/FeatureProvider_Vk.cpp +++ b/OptiScaler/upscalers/FeatureProvider_Vk.cpp @@ -200,10 +200,12 @@ bool FeatureProvider_Vk::ChangeFeature(std::string upscalerName, VkInstance inst if (Config::Instance()->VulkanUpscaler == "dlss") { State::Instance().newBackend = "xess"; + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Falling back to XeSS" }); } else { State::Instance().newBackend = "fsr21"; + ImGui::InsertNotification({ ImGuiToastType::Error, 10000, "Falling back to FSR 2.1" }); } } else diff --git a/OptiScaler/upscalers/IFeature_VkwDx12.cpp b/OptiScaler/upscalers/IFeature_VkwDx12.cpp index b30640f6..c91eedaf 100644 --- a/OptiScaler/upscalers/IFeature_VkwDx12.cpp +++ b/OptiScaler/upscalers/IFeature_VkwDx12.cpp @@ -13,6 +13,7 @@ #include #include +#include // Used Nukem's VKToDX as a base // https://github.com/Nukem9/dlssg-to-fsr3/blob/eca4a79b4d23339a1dcf02e30b9f3bafe7901513/source/maindll/FFFrameInterpolatorVKToDX.cpp @@ -691,6 +692,11 @@ bool IFeature_VkwDx12::CopyTextureFromVkToDx12(VkCommandBuffer InCmdBuffer, NVSD if (!CreateSharedTexture(imageCreateInfo, OutResource->VkSharedImage, OutResource->VkSharedMemory, OutResource->Dx12Resource, !InCopy)) { + if (State::Instance().isRunningOnLinux) + ImGui::InsertNotification( + { ImGuiToastType::Warning, 10000, + "Failed to create a shared texture\nMake sure you are using at least Wine/Proton 11" }); + LOG_ERROR("Failed to create shared texture!"); return false; } diff --git a/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp b/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp index a4a57075..69cd27c0 100644 --- a/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp +++ b/OptiScaler/upscalers/fsr31/FSR31Feature_Dx11On12.cpp @@ -102,7 +102,7 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_ if (!InitFSR3(InParameters)) { - LOG_ERROR("InitFSR2 fail!"); + LOG_ERROR("InitFSR3 fail!"); return false; } diff --git a/OptiScaler/upscalers/xess/XeSSFeature.cpp b/OptiScaler/upscalers/xess/XeSSFeature.cpp index eaf53c50..9ee02fda 100644 --- a/OptiScaler/upscalers/xess/XeSSFeature.cpp +++ b/OptiScaler/upscalers/xess/XeSSFeature.cpp @@ -6,6 +6,7 @@ #include #include +#include inline void XeSSLogCallback(const char* Message, xess_logging_level_t Level) { @@ -19,6 +20,8 @@ bool XeSSFeature::InitXeSS(ID3D12Device* device, const NVSDK_NGX_Parameter* InPa if (!_moduleLoaded) { + ImGui::InsertNotification( + { ImGuiToastType::Warning, 10000, "Couldn't load libxess.dll\nCheck if the dll is present" }); LOG_ERROR("libxess.dll not loaded!"); return false; } @@ -39,7 +42,10 @@ bool XeSSFeature::InitXeSS(ID3D12Device* device, const NVSDK_NGX_Parameter* InPa if (ret != XESS_RESULT_SUCCESS) { - LOG_ERROR("xessD3D12CreateContext error: {0}", ResultToString(ret)); + auto str = ResultToString(ret); + ImGui::InsertNotification( + { ImGuiToastType::Error, 10000, std::format("Couldn't create XeSS context\n{}", str).c_str() }); + LOG_ERROR("xessD3D12CreateContext error: {0}", str); return false; } diff --git a/OptiScaler/upscalers/xess/XeSSFeature_Dx11.cpp b/OptiScaler/upscalers/xess/XeSSFeature_Dx11.cpp index deb5bc05..9c64dd11 100644 --- a/OptiScaler/upscalers/xess/XeSSFeature_Dx11.cpp +++ b/OptiScaler/upscalers/xess/XeSSFeature_Dx11.cpp @@ -1,5 +1,6 @@ #include #include "XeSSFeature_Dx11.h" +#include static std::string ResultToString(xess_result_t result) { @@ -51,7 +52,9 @@ bool XeSSFeature_Dx11::Init(ID3D11Device* InDevice, ID3D11DeviceContext* InConte if (!_moduleLoaded) { - LOG_ERROR("libxess.dll not loaded!"); + ImGui::InsertNotification( + { ImGuiToastType::Warning, 10000, "Couldn't load libxess_dx11.dll\nCheck if the dll is present" }); + LOG_ERROR("libxess_dx11.dll not loaded!"); return false; } @@ -80,7 +83,10 @@ bool XeSSFeature_Dx11::Init(ID3D11Device* InDevice, ID3D11DeviceContext* InConte if (ret != XESS_RESULT_SUCCESS) { - LOG_ERROR("xessD3D12CreateContext error: {0}", ResultToString(ret)); + auto str = ResultToString(ret); + ImGui::InsertNotification( + { ImGuiToastType::Error, 10000, std::format("Couldn't create XeSS context\n{}", str).c_str() }); + LOG_ERROR("xessD3D11CreateContext error: {0}", str); return false; } diff --git a/OptiScaler/upscalers/xess/XeSSFeature_Vk.cpp b/OptiScaler/upscalers/xess/XeSSFeature_Vk.cpp index 783fcbb8..53ec70ce 100644 --- a/OptiScaler/upscalers/xess/XeSSFeature_Vk.cpp +++ b/OptiScaler/upscalers/xess/XeSSFeature_Vk.cpp @@ -1,6 +1,7 @@ #include #include "XeSSFeature_Vk.h" #include +#include static std::string ResultToString(xess_result_t result) { @@ -70,6 +71,8 @@ bool XeSSFeature_Vk::Init(VkInstance InInstance, VkPhysicalDevice InPD, VkDevice if (!_moduleLoaded) { + ImGui::InsertNotification( + { ImGuiToastType::Warning, 10000, "Couldn't load libxess.dll\nCheck if the dll is present" }); LOG_ERROR("libxess.dll not loaded!"); return false; }