Sign in to follow this  
Mr_Fox

Monitor GPU memory usage

Recommended Posts

I have been thinking awhile to write a GPU memory monitor for my 3d application (basically it tracked how much gpu memory my application committed). The most straight forward way I can think of is tracking the API calls to CreateCommitedResource, and for every call to that function, I added the buffer size to a global variable (of course decrease as resource been released). The problem with this method is that it's hard to calculated the right buffer size, since there are so called subresources (especially for texture buffer), so we cannot just do the calculation based on width, height and format.... (also for pure gpu buffer resource, can we trust the buffersize we provided as real GPU mem usage?) 

 

So how do you guys track the gpu memory usage? How could we calculate the right buffer size from GPU point of view? do you guys use such functions like GetRequiredIntermediateSize to help calculate the actual needed memory?

 

Thanks

Share this post


Link to post
Share on other sites

Sounds like you want to call IDXGIAdapter3::QueryVideoMemoryInfo and look at the CurrentUsage across both the LOCAL and NON_LOCAL pools.

 

ID3D12Device::GetResourceAllocationInfo will tell you how much memory a particular resource uses after all hardware specific padding / alignment has been taken into account.

 

Thanks Adam, that exactly what I want (my bad, should have looked through APIs before asking...) 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this