5

I know about DXGI_ADAPTER_DESC, but in 32-bit builds Direct3D’s SIZE_T type is 4 bytes long, so I’m getting 3GB instead of 11.

Is there a way to get the correct value even in a 32 bit build?

P.S. I need the value to calculate upper size for a large 2D texture array. While it’s not likely for a user to have 32-bit Windows with 11GB VRAM GPU, it’s quite possible to have 4GB VRAM with a 32-bit OS, e.g. as a result of upgrade. And I don’t want to limit my array to 0 in this case.

3
  • Using AdapterRam from WMI might be what you're after Commented Jan 24, 2018 at 4:48
  • @Tas it's uint32, i.e. won't work even in a 64-bit build. Commented Jan 24, 2018 at 4:52
  • Really the only way to figure out the maximum size is to try to create it... Commented Jan 24, 2018 at 6:31

1 Answer 1

2

According to my research, there is no easy way to achieve this.

Instead, there are (Microsoft-style) multiple completely different ways to achieve this, each of it more complicated than the other.

There used to be the handy pd3dDevice->GetAvailableTextureMem() in DX9, but that's gone in DX11.

In this MSDN code example you can find multiple ways to query the available video RAM (with source). I hope one of it fits for you.

Sign up to request clarification or add additional context in comments.

16 Comments

A 32-bit application cannot access all 4 GB+ of VRAM which is why for 32-bit apps it returns a lower value. You need a 64-bit native app to see it all. See this article
BTW the most recent version of that sample is on GitHub. The code is basically the same as the MSDN Code Gallery version, but it's been updated for newer versions of Visual C++.
@ChuckWalbourn: VRAM isn't ordinarily mapped into virtual address spaces, let alone all of it.
Actually it is, although in modern WDDM they utilize windowing to try to keep the overall VA space utilization down. See Why Your Windows Game Won't Run In 2,147,352,576 Bytes from Gamefest 2007. You can try to use LargeAddressAware in 32-bit apps while running on an x64 OS, but if you want to use large amounts of VRAM, you need to use x64 native code.
You are making a lot of assumptions that the created textures all have committed VRAM. Try actually uploading 14 GB of texture data. Then try rendering with it.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.