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 6 of 6

Thread: Texture memory allocation

  1. #1
    Junior Member Newbie
    Join Date
    May 2013
    Posts
    24

    Texture memory allocation

    Hi,

    I'm using a GeForce GTX 580 with driver 327.23, and I've noticed that some of my textures use a lot of memory !

    After some GPU-Z memory monitoring, it seems that all my textures allocations are rounded-up to the next POT size.

    For example, I allocate a 1024*1025*RGBA32F texture using glTextureStorage2D(). (no mipmap, no anisotropic filtering)

    It should takes 1024*1025*4*4 = 16793600 octets = 16.015 Mo

    But according to GPU-Z, it takes 32 Mo ! (next POT after 16)

    I've done some tests with various sizes, and it seems to always be the case... is it the expected behaviour or did I missed something ?

    Thanks

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,183
    There's no expected behaviour; GL implementations are free to handle this whatever way they want.

    In this case, and it's totally a guess, but I'd bet that the NVIDIA guys profiled their driver and determined that using the extra memory was a useful tradeoff and gave them higher performance.

    It's also a possibility that GPU-Z is reporting the memory usage incorrectly, of course...

  3. #3
    Junior Member Newbie
    Join Date
    May 2013
    Posts
    24
    In this case, and it's totally a guess, but I'd bet that the NVIDIA guys profiled their driver and determined that using the extra memory was a useful tradeoff and gave them higher performance.
    I've thought about that, but if it is really the reason, it's a brute force optimization, because I have some 3D textures which should take 130 Mo and they take 256 Mo !

    It's also a possibility that GPU-Z is reporting the memory usage incorrectly, of course...
    Do you know anoher/better way to monitor OpenGL memory ?

    Thanks.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,183
    Quote Originally Posted by Aurelien View Post
    Do you know anoher/better way to monitor OpenGL memory ?Thanks.
    My standard advice is to not bother. Instead you should have a good idea of how much memory your program needs, and you set that as your minimum requirement. That's perfectly OK - it's totally unrealistic to expect to be able to target "all hardware" as there is just such a wide variety of hardware out there.

  5. #5
    Junior Member Newbie
    Join Date
    May 2013
    Posts
    24
    My problem is that my application should use "in theory" less than 1Go of GPU ram, but it uses about 2Go "in real", so I can't just don't bother, because it should run without problem on a GPU with 1.5Go and it can't....

  6. #6
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    315
    If that is the case, then you should at least recommend 2G. If your textures are larger than the installed VRAM, it'll still work, just slower. There is nothing you can do about how the driver allocates memory for your textures, other than perhaps resampling to a lower power of 2 if it's close (but that's really implementation specific).

Posting Permissions

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