PDA

View Full Version : GPU memory check utility functions?



pixelita
03-13-2011, 06:57 AM
Hi

I wonder if OpenGL supports any functions to test GPU memory status which we could use before allocating memory space for buffers?
If I see weird results while drawing using VBOs - how can I know if it's caused by not enough GPU memory?

P.S. I'm using ATI HD Mobility Radeon card

TIA.

dukey
03-13-2011, 07:00 AM
http://nasutechtips.blogspot.com/2011/02/how-to-get-gpu-memory-size-and-usage-in.html

pixelita
03-13-2011, 07:05 AM
Thanks! That was fast :).. I will try to use this.

dukey
03-13-2011, 07:09 AM
:)
You can also use glGetError to check for out of memory errors. In my current project I was allocating a lot of space for some massive offscreen render targets. And it was becoming unpredictable. Nvidia would give me an out of memory message, ATI would just die with style :p

V-man
03-13-2011, 11:57 AM
http://www.opengl.org/wiki/Common_Mistakes#glAreTexturesResident_and_Video_Me mory

dukey
03-13-2011, 03:34 PM
I just gave up with it. Various graphics cards become unpredictable when u ask for too much memory. My nvidia 9800gt would often give out of memory messages, then it was like russian roulette if it worked or not. In the end I rewrote my renderer as a tile based engine ;p

pixelita
03-17-2011, 10:16 AM
Hi

Does someone know if these 2 functions are connected?

wglGetGPUInfoAMD( uGPUIDs[0],
WGL_GPU_RAM_AMD,
GL_UNSIGNED_INT,
sizeof( GLuint ),
&uTotalMemoryInMB );


GLint nCurAvailMemoryInKB = 0;
glGetIntegerv( GL_TEXTURE_FREE_MEMORY_ATI,
&nCurAvailMemoryInKB );



Do I need to call wglGetGPUInfoAMD first in order to get free memory info ,or simply glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI,&nCurAvai lMemoryInKB ) is enough?

I tried to call only the last one ,but returned value does'nt seem logical to me .
I can't call the first function since I don't know yet how to update my header files the way that wglGetGPUInfoAMD is recognized...I 'm in big delay so I don't have a time for it.

Thanks in advance

V-man
03-17-2011, 03:24 PM
It says wglGetGPUInfoAMD returns value in MB.
glGetIntegerv returns in KB.

Header files are at http://www.opengl.org/registry/

pixelita
03-17-2011, 03:53 PM
Thanks, my mistake, it returns more less correct values , these functions are not connected, glGetIntegerv(..) is enough.
This ATI HD Mobility Radeon card is driving me nuts.