Can we estimate VRAM usage when certain OpenGL function is called (based on arguments passed) without testing on actual device?

Hi team,

I just wanted to know whether we can estimate the amount of VRAM used (it is ok even if it is rough estimate) without measuring it on actual device.
It is known that memory allocation in VRAM typically happens when we create objects like textures, buffers etc. to store relevant graphic information. Function calls like gITexImage2D, instruct GPU to allocate memory in VRAM. OpenGL doesn’t provide standard way to estimate VRAM directly, generally vendor specific extensions like NVX_gpu_memory_info (For Nvidia cards), ATI_meminfo (For ATI cards) are used to get info about memory usage.

Below are some of my online findings related to VRAM estimation.

Calculating the exact amount of VRAM (Video RAM) used during an OpenGL function call can be quite complex, as it depends on various factors such as the specific function being called, the data being processed, and the hardware specifications of the system. To estimate VRAM usage, we would typically consider the size of the resources you are using, such as textures, buffers, and render targets. Here’s a simplified formula to calculate the VRAM used by a texture:
VRAMused=width×height×colorDepth×mipMapFactor

  • width and height are the dimensions of the texture.
  • colorDepth is the amount of memory each pixel uses (e.g., 32 bits for RGBA8 textures).
  • mipMapFactor accounts for additional memory used by mipmaps (if any). It’s typically around 1.33 for full mipmap chains.
    For example, if we have a texture that is 1024x1024 pixels, with a 32-bit color depth and full mipmaps, the calculation would be:
    VRAMused=1024×1024×32×1.33bits
    To convert this to bytes, divide by 8 (since there are 8 bits in a byte):
    VRAMused=81024×1024×32×1.33bytes
    Keep in mind that this is a simplified calculation and actual VRAM usage may vary based on the GPU’s architecture and the way OpenGL is implemented on your system. Additionally, some GPUs may use compression techniques or shared memory, which can also affect the calculation.

Can you please share your suggestions or any relevant information regarding this VRAM usage estimation.

Regards,
Swathi.

Hi Swathi,

Thanks for your message, and welcome to the PowerVR Developer Forum!

Unfortunately there is not a PowerVR OpenGL ES extension providing available dedicated video memory. The approach you are following to manually estimate the GPU memory size of each OpenGL ES object is a possible workaround.

As explained in this thread Query total & available GPU memory there is also another way: You can work with the NDA version of our profiling tool PVRTune, PVRTuneComplete, taking a recording with the extra options Client API OpenGL ES and Client Memory Tracking:

image

This way you will be provided with a GPU counter GLES Device Memory Usage which plots the amount of memory allocated by the driver:

This option will limit you to work directly with a single device but at least you will get the information needed. You can request PVRTuneComplete by sending an email to devtech.portal@imgtec.com

Please let me know if you have any other questions.

Best regards,
Alejandro