mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-24 07:06:33 +00:00
added a simple mechanism to check is upscaling is active
This commit is contained in:
@@ -97,6 +97,7 @@ public:
|
||||
NVNGX_Api Api = NVNGX_NOT_SELECTED;
|
||||
NVSDK_NGX_LoggingInfo NVSDK_Logger{ nullptr, NVSDK_NGX_LOGGING_LEVEL_OFF, false };
|
||||
IFeature* CurrentFeature = nullptr;
|
||||
int ActiveFeatureCount = 0;
|
||||
|
||||
// for realtime changes
|
||||
bool changeBackend = false;
|
||||
|
||||
@@ -91,6 +91,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_Shutdown(void)
|
||||
|
||||
Dx11Contexts.clear();
|
||||
D3D11Device = nullptr;
|
||||
Config::Instance()->ActiveFeatureCount = 0;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
@@ -240,7 +241,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext
|
||||
}
|
||||
|
||||
if (deviceContext->Init(D3D11Device, InDevCtx, InParameters))
|
||||
{
|
||||
Config::Instance()->ActiveFeatureCount++;
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
spdlog::error("NVSDK_NGX_D3D11_CreateFeature: CreateFeature failed");
|
||||
return NVSDK_NGX_Result_Fail;
|
||||
@@ -264,6 +268,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
Dx11Contexts.erase(it);
|
||||
}
|
||||
|
||||
Config::Instance()->ActiveFeatureCount--;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -296,9 +296,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Shutdown(void)
|
||||
NVSDK_NGX_D3D12_ReleaseFeature(val->Handle());
|
||||
|
||||
Dx12Contexts.clear();
|
||||
|
||||
D3D12Device = nullptr;
|
||||
|
||||
Config::Instance()->ActiveFeatureCount = 0;
|
||||
|
||||
UnhookAll();
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
@@ -475,6 +476,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma
|
||||
|
||||
if (deviceContext->Init(D3D12Device, InParameters))
|
||||
{
|
||||
Config::Instance()->ActiveFeatureCount++;
|
||||
HookToCommandList(InCmdList);
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
@@ -500,6 +502,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
else
|
||||
spdlog::error("NVSDK_NGX_D3D12_ReleaseFeature can't release feature with id {0}!", handleId);
|
||||
|
||||
Config::Instance()->ActiveFeatureCount--;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,10 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice
|
||||
*OutHandle = deviceContext->Handle();
|
||||
|
||||
if (deviceContext->Init(vkInstance, vkPD, InDevice, InCmdList, vkGIPA, vkGDPA, InParameters))
|
||||
{
|
||||
Config::Instance()->ActiveFeatureCount++;
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
spdlog::error("NVSDK_NGX_VULKAN_CreateFeature1 CreateFeature failed");
|
||||
return NVSDK_NGX_Result_FAIL_PlatformError;
|
||||
@@ -232,6 +235,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_ReleaseFeature(NVSDK_NGX_Handle*
|
||||
VkContexts.erase(it);
|
||||
}
|
||||
|
||||
Config::Instance()->ActiveFeatureCount--;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
@@ -344,6 +349,8 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_VULKAN_Shutdown(void)
|
||||
vkPD = nullptr;
|
||||
vkDevice = nullptr;
|
||||
|
||||
Config::Instance()->ActiveFeatureCount = 0;
|
||||
|
||||
return NVSDK_NGX_Result_Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,9 +144,12 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg
|
||||
//Win32 message handler
|
||||
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if(Config::Instance()->ActiveFeatureCount == 0)
|
||||
return CallWindowProc(_oWndProc, hWnd, msg, wParam, lParam);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
|
||||
// CTRL + HOME
|
||||
// HOME
|
||||
if (msg == WM_KEYDOWN && wParam == VK_HOME) // && (GetKeyState(VK_SHIFT) & 0x8000))
|
||||
{
|
||||
_isVisible = !_isVisible;
|
||||
|
||||
Reference in New Issue
Block a user