In the new Render Moduel, i notify there are tow functions is class :
Direct3D9Render , Direct3D9Texture and Direct3D9TextureTarget
In preD3DReset() the class do some d3d release operation , and is postD3DReset() the class do some initialize and allocate operation.
Such as
void Direct3D9Renderer::preD3DReset()
{
// perform pre-reset on texture targets
TextureTargetList::iterator target_iterator = d_textureTargets.begin();
for (; target_iterator != d_textureTargets.end(); ++target_iterator)
static_cast<Direct3D9TextureTarget*>(*target_iterator)->preD3DReset();
// perform pre-reset on textures
TextureList::iterator texture_iterator = d_textures.begin();
for (; texture_iterator != d_textures.end(); ++texture_iterator)
(*texture_iterator)->preD3DReset();
}
void Direct3D9Texture::preD3DReset()
{
// if already saved surface info, or we have no texture, do nothing
if (d_savedSurfaceDescValid || !d_texture)
return;
// get info about our texture
d_texture->GetLevelDesc(0, &d_savedSurfaceDesc);
// if texture is managed, we have nothing more to do
if (d_savedSurfaceDesc.Pool == D3DPOOL_MANAGED)
return;
// otherwise release texture.
d_texture->Release();
d_texture = 0;
d_savedSurfaceDescValid = true;
}
I guess when reset D3D i should first call preD3DReset() , when D3D is reset completely I should call postD3DReset()
the question is , where these function to be used? and when i should use them, i think may be the D3DDevice is lost?
thanks for your attention and bear my so pool English, thanks a lot~
What is preD3DReset() and postD3DReset() to do?
Moderators: CEGUI MVP, CEGUI Team
Re: What is preD3DReset() and postD3DReset() to do?
// handle D3D lost device stuff
coop = pimpl->d_3DDevice->TestCooperativeLevel();
if (coop == D3DERR_DEVICELOST)
{
Sleep(500);
continue;
}
else if (coop == D3DERR_DEVICENOTRESET)
{
if (!resetDirect3D())
{
continue;
}
}
I found it , in CEGuiD3D9BaseApplication.cpp, as i guess when the device is lost these two function are called.
Thanks all the same~~
coop = pimpl->d_3DDevice->TestCooperativeLevel();
if (coop == D3DERR_DEVICELOST)
{
Sleep(500);
continue;
}
else if (coop == D3DERR_DEVICENOTRESET)
{
if (!resetDirect3D())
{
continue;
}
}
I found it , in CEGuiD3D9BaseApplication.cpp, as i guess when the device is lost these two function are called.
Thanks all the same~~
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 2 guests