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

**URL:** <https://forums.imgtec.com/t/can-we-estimate-vram-usage-when-certain-opengl-function-is-called-based-on-arguments-passed-without-testing-on-actual-device/3938>\
**Category:** Uncategorized\
**Created:** [May 29, 2024, 2:59pm UTC](https://forums.imgtec.com/t/can-we-estimate-vram-usage-when-certain-opengl-function-is-called-based-on-arguments-passed-without-testing-on-actual-device/3938 "2024-05-29T14:59:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swathi](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@Swathi](https://forums.imgtec.com/u/Swathi)\
**Post date:** [May 29, 2024, 2:59pm UTC](https://forums.imgtec.com/t/can-we-estimate-vram-usage-when-certain-opengl-function-is-called-based-on-arguments-passed-without-testing-on-actual-device/3938/1 "2024-05-29T14:59:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AlejandroC](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@AlejandroC](https://forums.imgtec.com/u/AlejandroC)\
**Post date:** [May 30, 2024, 10:01am UTC](https://forums.imgtec.com/t/can-we-estimate-vram-usage-when-certain-opengl-function-is-called-based-on-arguments-passed-without-testing-on-actual-device/3938/2 "2024-05-30T10:01:51Z")

</div>

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](https://forums.imgtec.com/t/query-total-available-gpu-memory/2341) 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](https://us1.discourse-cdn.com/flex015/uploads/imagination1/original/1X/80a767bad351a4ca49c7c7f7c2c6da5aa96d84e6.png)

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/imagination1/original/1X/a8ccc0f568f908ee3abc5c66ce2e336f6d69135b.png)

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](mailto:devtech.portal@imgtec.com)

Please let me know if you have any other questions.

Best regards,  
Alejandro
