Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive registry access when window is minimized (due to swap chain creation fail) #91

Closed
tigrouind opened this issue Apr 30, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@tigrouind
Copy link

tigrouind commented Apr 30, 2023

I noticed that the PsyDoom process does a lot of registry accesses once minimized. It quickly reach hundred thousands hits after a few seconds. Here is the output of ProcessMonitor :
image

Looking at the screenshot, it seems to be related to the video card/GPU.

EDIT : this is triggered by those methods, called every frame :

VRenderer::beginFrame()
VRenderer::ensureValidSwapchainAndFramebuffers()
	Swapchain::init()
		DeviceSurfaceCaps::query()
			vkGetPhysicalDeviceSurfaceFormatsKHR()       // registry access
			vkGetPhysicalDeviceSurfaceFormatsKHR()       //
			vkGetPhysicalDeviceSurfacePresentModesKHR()  //

There is an attempt to create a swap chain every frame but it fails :

// Swapchain creation can fail validly if the window is zero sized and cannot currently be presented to
if (mDeviceSurfaceCaps.isZeroSizedMaxImageExtent())
	return false;

While having the game minimized is not how PsyDoom is supposed to be played, this should not perform so many accesses to the registry.

Some ideas to prevent this :

  • delay swap chain creation after it fails (eg: by one second).
  • detect if window is minimized and skip rendering (and thus creation of swap chain).
  • pause/sleep the game if window is minimized.
@tigrouind tigrouind changed the title Possible excessive registry access during gameplay Excessive registry access during gameplay (due to swap chain fail?) May 12, 2023
@tigrouind tigrouind changed the title Excessive registry access during gameplay (due to swap chain fail?) Excessive registry access due to swap chain fail May 12, 2023
@tigrouind tigrouind changed the title Excessive registry access due to swap chain fail Excessive registry access when window is minimized (due to swap chain creation fail) May 12, 2023
@BodbDearg BodbDearg added the enhancement New feature or request label Jun 7, 2023
@BodbDearg
Copy link
Owner

The fix for this issue is now available in 1.1.1, registry access should be greatly reduced now in the minimized state. Closing ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants