English 中文(简体)
Determine VRAM size on windows
原标题:

I need to determine roughly how much VRAM a system s graphics card has. I know all the reasons why I shouldn t but I do. It doesn t need to be perfect (some cards lie etc.) but I need a ballpark. On mac it s fairly easy through core graphics and IOKit to just politely ask how much VRAM is attached to a display, but I haven t a clue on windows. I suspect DirectX can tell me somehow since DxDiag has a fair guess...

And again, I know I shouldn t need to know, but I do.

Any help would be GREATLY appreciated.

问题回答

Short answer: There is no reliable way to get this information.

Long answer:

There are numerous, deprecated ways to get this information. Like opening an old DirectDraw interface and query the available video memory. That number however may include AGP memory, unified memory or it may not include it. Or you may even get a dummy value hard-coded into the driver.

I know you already know that querying this number is a bad idea, but let me summarize it again for the other readers:

What do you want to do with the number at the first place? As an application programmer you have very limited control how the video-memory is used. You don t allocate or manage memory in any way. The driver is doing this for you. Making your code aware of the "faked" available memory will lead to serious problems.

You may think you can use the available memory to decide how many textures will fit into the video memory, but that s a false assumption. Some cards have very strange requirements how the memory is used. One particular card that I know some details off has a minimal size for any mipmap of 4kb.

So if you would load a 8x8 8-bit texture into memory you may expect it to take 85 bytes (8*8+4+4+2+2+1). After the driver did the upload job it ll be 12kb in size however (4 * 4kb). Your estimate would be off by more than a factor of hundred.

The same applies to vertex and index-buffers, render-targets, shaders and so on.

That s the reason why this information does not get exposed to applications anymore. It made to many problems in the past.





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签