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.