It is currently November 30th, 2022, 8:06 am

Get total VRAM value

Tips and Tricks from the Rainmeter Community
User avatar
StArL0rd84
Posts: 398
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Get total VRAM value

Post by StArL0rd84 »

Back in 2017 i needed to know the total video memory available for a monitoring skin.
Proved to be impossible with a wmic command becasue the Windows utilities have not been updated to 64-bit so can't show more than 4GB.

But i have recently learned that there's a Registry key that contains the value called HardwareInformation.qwMemorySize.
Inside the key there's other goodies too like GPU name and such.

Code: Select all

[mVramTotal1]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000
RegValue=HardwareInformation.qwMemorySize
UpdateDivider=-1
[mVramTotal2]
Measure=Calc
Formula=mVramTotal1/1073741824
UpdateDivider=-1

[mVRAMUsed1]
Measure=Plugin
Plugin=UsageMonitor
Alias=VRAM
Index=0
MinValue=0
MaxValue=(#VRAM#*1073741824)
[mVRAMUsed2]
Measure=Calc
Formula=mVRAMUsed1

[mVramFree]
Measure=Calc
Formula=(mVramTotal2-(mVRAMUsed2/1073741824))
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
SilverAzide
Rainmeter Sage
Posts: 2174
Joined: March 23rd, 2015, 5:26 pm

Re: Get total VRAM value

Post by SilverAzide »

Nice find! What make of video card are you using? Wondering if there is a difference between AMD and nVidia. I'm using an nVidia GPU and my registry matches yours exactly.
Gadgets Wiki GitHub More Gadgets...
User avatar
StArL0rd84
Posts: 398
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Get total VRAM value

Post by StArL0rd84 »

I have a GTX 1080 8GB
*cries in 60fps* :-(

But yeah, would be nice to test on an AMD card.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
CrimsnShadow
Posts: 1
Joined: April 25th, 2022, 8:47 pm

Re: Get total VRAM value

Post by CrimsnShadow »

As of the time of this post, it works for AMD cards as well. Thanks for this btw.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2174
Joined: March 23rd, 2015, 5:26 pm

Re: Get total VRAM value

Post by SilverAzide »

Well, since this thread has been dug up from the grave... It's nice that someone finally confirmed it applies to AMD, but this trick doesn't necessarily work. The last part of the registry key (...\0000) seems to depend on how many video cards are present (including the GPUs built into most Intel/AMD CPUs). One of my machines has (for some bizarre reason) 0000, 0001, and 0002 keys, with the HardwareInformation.qwMemorySize registry value present on only one of them (and it's not the 0000 key). This trick does work another machine I have. So this doesn't seem like a reliable way to get the total VRAM for all scenarios.
Gadgets Wiki GitHub More Gadgets...