I'm developping a screensaver using DirectX8.1a SDK.
Everything is working fine except one thing: Sometimes when my
screensaver starts, the call to CreateDevice fails returning
D3DERR_OUTOFVIDEOMEMORY error.
The specific thing with my screensaver is that I use the same
resolution of the desktop to initialize DirectX.
After some tests I can say that when I start the computer, the few
first launch of the screensaver are working, but after a while I start
to receive systematically D3DERR_OUTOFVIDEOMEMORY errors. If I launch
another DirectX application that is changing the resolution of the
screen, it works. And after that my screensaver works again for a few
times.
The issue seems to be a memory leak, but I'm sure I release everything
in my application, and since the process is killed then restarted
everytime i'm assuming the memory is cleaned by windows XP.
Someone here knows this problem? Is this a problem with the matrox
card ?(I use the latest drivers) Any idea for a workaround?
The test machine is a Pentium 4 with Windows XP and DirectX9. The
Video board is a matrox millenium G550 (32MB Video RAM).
Here follows the initilaization code:
if( NULL == ( m_pD3D = Direct3DCreate8( D3D_SDK_VERSION ) ) )
{
PRINT_LOG("CScreen::InitD3D => Unable to create m_pD3D\n");
return E_FAIL;
}
// Get the current desktop display mode
D3DDISPLAYMODE d3ddm;
if( FAILED( m_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm
) ) )
{
return E_FAIL;
}
ZeroMemory( &m_d3dpp, sizeof(m_d3dpp) );
m_d3dpp.Windowed = FALSE;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
m_d3dpp.BackBufferFormat = d3ddm.Format;
m_d3dpp.BackBufferWidth = d3ddm.Width;
m_d3dpp.BackBufferHeight = d3ddm.Height;
m_d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
m_d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
m_d3dpp.EnableAutoDepthStencil = TRUE;
m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
DWORD behavior;
behavior = D3DCREATE_MIXED_VERTEXPROCESSING;
if( FAILED( m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
hWnd,
behavior,
&m_d3dpp, &m_pd3dDevice ) ) )
{
//this call fails sometimes
}
thanks for any help.
regards
Alain / www.devsoft.ch
al...@devils.ch (alain) spake the secret code
<ebdcd6f3.04060...@posting.google.com> thusly:
>Everything is working fine except one thing: Sometimes when my
>screensaver starts, the call to CreateDevice fails returning
>D3DERR_OUTOFVIDEOMEMORY error.
Does this ever happen with the Moire screen saver in the SDK?
If not, compare what that sample is doing to what you are doing.
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
<http://www.xmission.com/~legalize/book/>
Pilgrimage: Utah's annual demoparty
<http://pilgrimage.scene.org>