How to get full memory in bytes used by OpenGL in C ++?

How to get shared memory in bytes used by OpenGL in C ++?

I am creating an OpenGL application, and the shared memory used seems to be growing, I can get information about the shared memory used by the variables and objects created by me, but I can not guarantee how much memory OpenGL uses for its variables and objects and textures, etc. . So, is it possible to get shared memory in bytes used by OpenGL in C ++?

+8
c ++ windows memory visual-c ++ opengl
source share
1 answer

In general, you do not. OpenGL is ultimately a hardware abstraction. And OpenGL just doesn't provide a way to get such information.

There are extensions for suppliers that will give you the opportunity to ask, although what you get depends on the architecture. AMD hardware provides the ATI_meminfo extension. It breaks the memory into types of objects: buffer objects, textures, and rendering buffers.

NVIDIA provides the experimental extension NVX_gpu_memory_info. There is no information in the registry on how to use it, so I can’t connect you with anything.

In any case, the most effective way to find out what the GPU is using is to simply track it yourself. Always use internal image formats with dimensions ; this means that you can calculate a pretty good estimate of how much memory the texture takes. The same applies to buffer objects, etc.

You will not get exact numbers, as indentation, alignment, etc. may confuse you. But you get something pretty decent.

+7
source share

All Articles