View Full Version : how to query graphics memory size?
08-21-2003, 04:24 AM
I would like to make separate paths dependent on memory size. Is there a way to query the amount of graphics memory?
08-21-2003, 05:20 AM
Not in OpenGL.
Unluckly there are not however some people proposed an alternative way.
1- SDL has a dedicated query. Looks like it already cuts away the size of the framebuffer.
2- Maybe calling some OS specific functions or parsing something in win32's registry or a file about graphic in linux (x11?)
Some people in the past also proposed to use proxy textures and stuff like that but I have some doubts this method works. A similar way may be to try out allocating memory on HW using vertex buffers or VAR. I guess this would probably work better but I wouldn't rely on it anyway.
The question is much about how you should interpret the result of a mem query.. if the user starts another application then you share the gfxmem with that app and you end up with swapping in either case.. a Quality setting in the applilcation might be better, since it lets the user decide how much memory your application will use, vs how good it looks..
And what about shared mem chips? there the AGP mem is as fast as the shared Videomem ( but both are slower than real videomem.. should you take agp mem in account as texture mem then? or just the shared memory.. Or cards that can texture direct from the agp memory.. to limit those to use just videomem as texturemem is not nice. But then you have the other cards that must have the texture in videomem in order to use it, but can upload a new pretty fast from AGP mem, but slower from normal system mem.
what kind of scheme will solve all this? i bet the driver makes a better job of sorting that out, and you can just give the user a posibility to affect it.
08-22-2003, 03:55 AM
a simple way to kwow the video memory size is to create a lot of textures and ask opengl if they are resident.
GLuint id = create_256x256_texture();
if (glIsResident(id)) size+=256*256;
you can adjust granularity by creating smaller or bigger textures.
http://www.opengl.org/discussion_boards/ubb/biggrin.gif DON'T FORGET TO DELETE CREATED TEXTURES http://www.opengl.org/discussion_boards/ubb/biggrin.gif
08-22-2003, 05:36 AM
You don't take into account space taken by the framebuffer/zbuffer/stencil buffer/aux buffers/pbuffers/other things that might be running on the system.
This has already been discussed extensively on this forum. There is no reliable way to query available graphics memory in OpenGL. Period.
Little 'search' button (top right) is your friend : http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/001455.html (mcraighead was writting drivers at NVIDIA at this time, believe him when he says "you shouldn't need to know") http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/005742.html http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/011776.html http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/006599.html
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.