mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
MaterialSystem: don't sample imgui frames if window is occluded
Check if the window is occluded first before sampling. Massive runtime load reduction when application minimized in full-screen mode. This also fixes the issue where the console would scroll all the way to the top when the application is minimized in full screen mode, as we can't calculate the window sizes properly causing SetScrollPos to set the pos to a large negative value.
This commit is contained in:
parent
7febdde3d4
commit
bae7df37ae
@ -15,6 +15,7 @@
|
||||
#include "geforce/reflex.h"
|
||||
#include "radeon/antilag.h"
|
||||
#ifndef MATERIALSYSTEM_NODX
|
||||
#include "windows/id3dx.h"
|
||||
#include "gameui/imgui_system.h"
|
||||
#include "materialsystem/cmaterialglue.h"
|
||||
#endif // !MATERIALSYSTEM_NODX
|
||||
@ -152,7 +153,10 @@ void* CMaterialSystem::SwapBuffers(CMaterialSystem* pMatSys)
|
||||
{
|
||||
CImguiSystem* const imguiSystem = ImguiSystem();
|
||||
|
||||
if (imguiSystem->IsInitialized())
|
||||
// See https://github.com/ocornut/imgui/issues/7615, looking for status msg
|
||||
// DXGI_STATUS_OCCLUDED isn't compatible with DXGI_SWAP_EFFECT_FLIP_DISCARD.
|
||||
// This engine however does not use the flip model.
|
||||
if (imguiSystem->IsInitialized() && D3D11SwapChain()->Present(0, DXGI_PRESENT_TEST) != DXGI_STATUS_OCCLUDED)
|
||||
{
|
||||
imguiSystem->SampleFrame();
|
||||
imguiSystem->SwapBuffers();
|
||||
|
Loading…
x
Reference in New Issue
Block a user