Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: GPU memory check utility functions?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    28

    GPU memory check utility functions?

    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.

  2. #2
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    250

    Re: GPU memory check utility functions?


  3. #3
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    28

    Re: GPU memory check utility functions?

    Thanks! That was fast .. I will try to use this.

  4. #4
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    250

    Re: GPU memory check utility functions?


    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

  5. #5
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: GPU memory check utility functions?

    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  6. #6
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    250

    Re: GPU memory check utility functions?

    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

  7. #7
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    28

    Re: GPU memory check utility functions?

    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,&nCur AvailMemoryInKB ) 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

  8. #8
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: GPU memory check utility functions?

    It says wglGetGPUInfoAMD returns value in MB.
    glGetIntegerv returns in KB.

    Header files are at http://www.opengl.org/registry/
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  9. #9
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    28

    Re: GPU memory check utility functions?

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •