AnsweredAssumed Answered

Get GPU total memory in OpenGL under Linux

Question asked by tolunoide on Jun 18, 2014

Hi guys,

 

I'm going back to OpenGL for some demo project.

I simply want to know the total amount of memory of the GPU using OpenGL.

 

I get this sample code :

 

 

UINT n = wglGetGPUIDsAMD(0, 0);
UINT *ids = new UINT[n];
size_t total_mem_mb = 0;
wglGetGPUIDsAMD(n, ids);
wglGetGPUInfoAMD(ids[0], 
  WGL_GPU_RAM_AMD, 
  GL_UNSIGNED_INT, 
  sizeof(size_t),
  &total_mem_mb);

 

But it required wglext.h which is Microsoft only plateform.

I don't find anything like this in glxext.h for Linux. Did I miss something?

And for compatibility, if you have also infos for OSX.

 

N.B.: I already get the available RAM for GPU with TEXTURE_FREE_MEMORY_ATI but I would like to know the percentage of RAM consumed.

 

Best regards

Outcomes