- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We need to know the amount of video memory on the graphics card. That allows us to calibrate the cumulative size of all device objects (vertex buffers, index buffers, frame buffers and textures) that we cansafely allocating before we run into stability and performance issues. We have some code that does it on XP, but need to come up with something for vista. An ATI developer guy recommended using the opengl command,
glgetintegerv(GL_VBO_FREE_MEMORY_ATI)Is that supported on Intel express chipsets? Can it be trusted? If not (on either question), what alternatives are available? Is there anything that can be pulled out of the windows registry?Thanks,Travis
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We can't (yet) assume that dx10 will be available, so IDXGIAdapter::GetDesc() is out, and
IDirect3DDevice9::GetAvailableTextureMem() lumps system memory in as well, making it less than useful.
If it were available somewhere in the windows registry (as it is on XP), that would be ideal.
We can switch back and forth from ogl and d3d at our users' option, so we need a solution for both.
-Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since when Intel IGP supports DX10 API? By the way, that is a horrible way to find out the amount of video memory — it takes a lot of time to initialize DirectX and they are clearly using OpenGL so why should they require two APIs for the application to work?
If this is a Windows application perhaps this would work:
#include#include const char *str_key1 = { "HARDWAREDEVICEMAPVIDEO" }; const char *str_key2 = { "DeviceVideo0" }; const char *str_key3 = { "systemcurrentcontrolset" }; const char *str_key4 = { "HardwareInformation.MemorySize" }; DWORD GetVideoMemorySizeBytes(void) { LONG s; HKEY key; DWORD type, buf_size, rv = 0; LPBYTE buf; char *ptr; s = RegOpenKeyEx(HKEY_LOCAL_MACHINE, str_key1, 0, KEY_READ, &key); if (s != ERROR_SUCCESS) { goto bail_out; } type = REG_SZ; s = RegQueryValueEx(key, str_key2, NULL, &type, NULL, &buf_size); if (s != ERROR_SUCCESS) { goto bail_out; } buf = (LPBYTE)malloc(buf_size); if (buf == NULL) { goto bail_out; } s = RegQueryValueEx(key, str_key2, NULL, &type, buf, &buf_size); if (s != ERROR_SUCCESS) { goto bail_out; } RegCloseKey(key); ptr = strstr(strlwr((char*)buf), str_key3); s = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ptr, 0, KEY_READ, &key); if (s != ERROR_SUCCESS) { goto bail_out; } type = REG_BINARY; buf_size = 4; s = RegQueryValueEx(key, str_key4, NULL, &type, (LPBYTE)&rv, &buf_size); bail_out: if (buf != NULL) { free(buf); } if (key != NULL) { RegCloseKey(key); } return rv; } int main(int argc, char *argv[]) { printf("Video memory size : %ld bytes ", GetVideoMemorySizeBytes()); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IgorLevicki:
Since when Intel IGP supports DX10 API?
Since 15.9 (v7.15.10.1472) released 04/25/2008 or the former non-public 15.9 beta.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see, nice to know that.
Still, using DX10 API just to query video memory size would limit the application use only to those systems running Vista, so it is a pretty senseless suggestion anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to OpenGL, we also support dx9 and plan to start a dx10 (or perhaps dx11) implementation soon. When dx9 or dx10 is already in use, we can use such calls. Pulling in another API (dx10, or even dx9 for that matter) just to query video memory size is not a good solution. We'll hardcode a budget for ourselves rather than do something like that.
Of course, if we can get a solution within OpenGL, that would be the best solution of all.
-Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since when Intel IGP supports DX10 API? By the way, that is a horrible way to find out the amount of video memory - it takes a lot of time to initialize DirectX and they are clearly using OpenGL so why should they require two APIs for the application to work?
If this is a Windows application perhaps this would work:
#include#include const char *str_key1 = { "HARDWAREDEVICEMAPVIDEO" }; const char *str_key2 = { "DeviceVideo0" }; const char *str_key3 = { "systemcurrentcontrolset" }; const char *str_key4 = { "HardwareInformation.MemorySize" }; DWORD GetVideoMemorySizeBytes(void) { LONG s; HKEY key; DWORD type, buf_size, rv = 0; LPBYTE buf; char *ptr; ......
......
......
Thanks for the post first of all. My goal was to gain performance improvement & stability, by making system specific resource caching decisions in our game. Above code snippet turned out really helpful. However, I had to modify it a little to get working since there could be more than one REG_DWORDs that you need to iterate through to get the location of hardware information section. I posting the modified version of above code snippet that has been tested to work with vista as welll as with XP.
#include
#include
const char *strConstHwDeviceMapVideo = { "HARDWARE\DEVICEMAP\VIDEO" };
const char *strConstMaxObjectNumber = { "MaxObjectNumber" };
const char *strConstSystemCurrentControlSet = { "system\currentcontrolset" };
const char *strConstHwInfoMemSize = { "HardwareInformation.MemorySize" };
DWORD GetVideoMemorySizeBytes(void)
{
LONG s;
HKEY key, key2 = NULL;
DWORD type, buf_size, rv = 0, iMaxObjectNumber = 0;
LPBYTE buf = NULL;
char *ptr = NULL;
char strDeviceVideo[20] = { "\Device\Video0" };
s = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strConstHwDeviceMapVideo, 0, KEY_READ, &key);
if (s != ERROR_SUCCESS) {
goto bail_out;
}
// Find total number of obects to be queried
type = REG_DWORD;
buf_size = 4;
s = RegQueryValueEx(key, strConstMaxObjectNumber, NULL, &type, ( LPBYTE )&iMaxObjectNumber, &buf_size );
if (s != ERROR_SUCCESS) {
goto bail_out;
}
for( int i = 0; i <= (int)iMaxObjectNumber; i++ )
{
strDeviceVideo[ 13 ] = '0' + i;
type = REG_SZ;
s = RegQueryValueEx(key, strDeviceVideo, NULL, &type, NULL, &buf_size);
if (s != ERROR_SUCCESS) {
goto bail_out;
}
if( NULL != buf ) {
free( buf );
}
buf = (LPBYTE)malloc(buf_size);
if (buf == NULL) {
goto bail_out;
}
s = RegQueryValueEx(key, strDeviceVideo, NULL, &type, buf, &buf_size);
if (s != ERROR_SUCCESS) {
goto bail_out;
}
ptr = strstr( _strlwr((char*)buf), strConstSystemCurrentControlSet );
if( NULL == ptr )
continue;
s = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ptr, 0, KEY_READ, &key2);
if (s != ERROR_SUCCESS) {
goto bail_out;
}
type = REG_BINARY;
buf_size = 4;
s = RegQueryValueEx(key2, strConstHwInfoMemSize, NULL, &type, (LPBYTE)&rv, &buf_size);
if ( ERROR_SUCCESS == s ) {
break;
}
if (key != NULL) {
RegCloseKey(key2);
}
}
bail_out:
if (buf != NULL) {
free(buf);
}
if (key != NULL) {
RegCloseKey(key);
}
if (key != NULL) {
RegCloseKey(key2);
}
return rv;
}
int _tmain(int argc, _TCHAR* argv[])
{
printf("Video memory size : %ld bytes", GetVideoMemorySizeBytes());
return 0;
}
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page