How to get VRAM size of current GPU?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By monnef

I am implementing quality levels (texture resolutions) and I need to know the VRAM size (in GDScript). So during first launch of the game I can select a appropriate quality level as a default (e.g. 6+GB use high, 4k textures; but for Steam Deck only medium to not overfill the VRAM which leads to stuttery mess).

:bust_in_silhouette: Reply From: Skipperro

That’s difficult. I know how to do it from C#, but it’s not guaranteed to work on every platform.

Many games just default to low settings on first start and player can change it anytime in settings. This seems like easiest solution.

If your goal is to detect specifically Steam Deck, then I assume every one of them have same GPU. You could just look for this specific GPU name and lower texture resolution if it’s detected.

To get GPU name you can use this command:
https://docs.godotengine.org/en/stable/classes/class_visualserver.html#class-visualserver-method-get-video-adapter-name