Sign in to follow this  
utilae

Alt Tab + Restoring Textures

Recommended Posts

I am using C++ and Direct3D9. My textures load fine, etc. But when I alt tab (minimize) and the go back into my game, I get an error (program not responding as well). my restore code is like this:
////RECOVER FROM ALT TAB
HRESULT hr;
hr=g_pD3DDevice9->TestCooperativeLevel();

if(hr == D3DERR_DEVICELOST) 
{ //Device is lost and cannot be reset yet

    Sleep(500); //Wait a bit so we don't burn through cycles for no reason
    FreeVolatileResources();

}
else if(hr == D3DERR_DEVICENOTRESET)
{ //Lost but we can reset it now

    hr=g_pD3DDevice9->Reset(&g_d3dpp);
    if(SUCCEEDED(hr))
        InitVolatileResources();
}	

So how do you restore textures?

Share this post


Link to post
Share on other sites
What exactly is your error? Does the debug runtime give you anything?

I use the SDK framework atm - OnLostDevice( ) SAFE_RELEASE()'s all my volatile resources and OnResetDevice( ) creates all of the textures by loading back from the disk as if they were brand-new.

Jack

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
release all textues an meshes with SAFE_RELEASE(pointer) then you need to reload them all when you get the device back. from what i understand of DX.

Share this post


Link to post
Share on other sites
everything [smile].

Resources in D3DPOOL_SYSMEM and D3DPOOL_MANAGED will be looked after for you; All resources of any type in D3DPOOL_DEFAULT should be released when you minimize and re-created again when you get focus (recreate the device) again.

hth
Jack

Share this post


Link to post
Share on other sites
There is an excellent article in Wolfgang Engel's ShaderX 3 book about managing Resources for exactly this purpose... Definitely worth every buck!

Amazon.com:
http://www.amazon.com/exec/obidos/tg/detail/-/1584503572/qid=1108417751/sr=8-1/ref=sr_8_xs_ap_i1_xgl14/102-0480439-8120967?v=glance&s=books&n=507846

ISBN: 1584503572

Share this post


Link to post
Share on other sites
Quote:
Original post by mattayers
http://www.amazon.com/exec/obidos/tg/detail/-/1584503572/qid=1108417751/sr=8-1/ref=sr_8_xs_ap_i1_xgl14/102-0480439-8120967?v=glance&s=books&n=507846

I don't think I've seen a URL that ugly in years [smile].
Clicky for the lazy..

Cheers,
Jack

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
jollyjeffers:

So what would be the purpose of ever using D3DPOOL_DEFAULT, if D3DPOOL_SYSMEM and D3DPOOL_MANAGED take care of all the resource releasing/reaquiring for you? Is there some advantage (speed?) by releasing and restoring by yourself?

Share this post


Link to post
Share on other sites
Quote:
So what would be the purpose of ever using D3DPOOL_DEFAULT, if D3DPOOL_SYSMEM and D3DPOOL_MANAGED take care of all the resource releasing/reaquiring for you?

Theres a better discussion of this in the SDK helpfiles somewhere...

But it comes down to who (and how) you control resources. D3DPOOL_MANAGED is swapped between memory as D3D sees fit (if you don't use it for a while it might get paged out of VRAM back to AGP/RAM). This can work fine - but obviously, if you know more about the problem-space and can optimally control when it gets paged-in/out you can (at least try to) avoid delays when D3D has it stored in the wrong place and has to page it back into VRAM before the draw call can be honoured...

hth
Jack

Share this post


Link to post
Share on other sites
My textures and vertex buffer are D3DPOOL_MANAGED.

Looking around I couldn't see anything that is D3DPOOL_DEFAULT.

Creating D3D9 object, presentation parameters and d3d9 device, they don't seem to have any 'pool' setting.

My 2d ortho matrix doesn't have any 'pool' setting.

I don't know why it's not working. Tell me about this safe release thing. Am I mean't to release direct3d9 device and then reload it when you alt tab?

Share this post


Link to post
Share on other sites
I'm using visual studio .net 2003.

When I try debug->start, my app crashes. I can build it and run it from the debug directory. The app runs fine, but when I alt tab, then put focus back on the app, then it crashes (application error-memory could not be written) and asks if I want to debug. I try that but it says the Just In Time Debugging Failed (unspecified error). So I can't really go to the exact line.

I'll post more code (showing how i set everything up, so maybe there's something in D3DPOOL_DEFAULT that I have not picked up):

////setup d3d9 stuff
//Create an IDirect3D9 Object
g_pD3D9 = Direct3DCreate9(D3D_SDK_VERSION);

//set the presentation parameters
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
g_d3dpp.BackBufferWidth = 1024;
g_d3dpp.BackBufferHeight = 768;
g_d3dpp.BackBufferCount = 1;
g_d3dpp.BackBufferFormat = D3DFMT_R5G6B5;
g_d3dpp.MultiSampleType=D3DMULTISAMPLE_NONE; //No multi-sampling
g_d3dpp.MultiSampleQuality=0;
g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
g_d3dpp.hDeviceWindow = hWndMain;
g_d3dpp.Windowed = false;
g_d3dpp.EnableAutoDepthStencil = true;//z buffer
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;//z buffer
g_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

//create an IDirect3DDevice9 object, try hardware/hardware
g_pD3D9->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWndMain,D3DCREATE_HARDWARE_VERTEXPROCESSING,&g_d3dpp,&g_pD3DDevice9);




//setup matrix
D3DXMATRIX Ortho2D;
D3DXMATRIX Identity;

//1024x768 2d perspective (0 is near, 1 is far)
D3DXMatrixOrthoLH(&Ortho2D,-1024,768,0.0f,1.0f);
D3DXMatrixIdentity(&Identity);

g_pD3DDevice9->SetTransform(D3DTS_PROJECTION,&Ortho2D);
g_pD3DDevice9->SetTransform(D3DTS_WORLD,&Identity);
g_pD3DDevice9->SetTransform(D3DTS_VIEW,&Identity);




//render states
g_pD3DDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE,true);//alpha
g_pD3DDevice9->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);//alpha
g_pD3DDevice9->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);//alpha

g_pD3DDevice9->SetRenderState(D3DRS_LIGHTING,false);//lighting off
g_pD3DDevice9->SetRenderState(D3DRS_CULLMODE,D3DCULL_NONE);//turn off culling

g_pD3DDevice9->SetRenderState(D3DRS_ZENABLE,D3DZB_TRUE);//z buffer
g_pD3DDevice9->SetRenderState(D3DRS_ZWRITEENABLE,true);//z buffer
g_pD3DDevice9->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);//z buffer




////VERTEX BUFFER
//create d3d9 vertex buffer
g_pD3DDevice9->CreateVertexBuffer(byte_count,D3DUSAGE_WRITEONLY,g_dwFVF,D3DPOOL_MANAGED,&g_pVertexBuffer,NULL);

//lock vertex buffer
void *vb_vertices;
g_pVertexBuffer->Lock(0,0,&vb_vertices,0);

//fill the Vertex Buffer
memcpy(vb_vertices,data,byte_count);
g_pVertexBuffer->Unlock();




//texture is not already loaded, so now a texture can be loaded
D3DSURFACE_DESC surfaceDesc;
LOADEDTEXTURE *newTexture= new LOADEDTEXTURE;

//load texture
D3DXCreateTextureFromFileEx(g_pD3DDevice9,sFilename.c_str(),D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,
D3DX_DEFAULT,D3DX_DEFAULT,0,0,0,&newTexture->m_texture);
newTexture->m_texture->GetLevelDesc(0, &surfaceDesc);

//store textures filename, height and width
newTexture->m_sFilename=sFilename;
newTexture->m_nHeight=surfaceDesc.Height;
newTexture->m_nWidth=surfaceDesc.Width;

//put texture into list
m_lstMainTextureList.push_back(newTexture);




//freeing and loading of volatile resources when app looses or gains focus
//see 1st post for that bit of code
void InitVolatileResources()
{
//Init internal resources
g_pFont->OnResetDevice();
}

void FreeVolatileResources()
{
//Free up some internal resources
g_pFont->OnLostDevice();
}

Share this post


Link to post
Share on other sites
Right, I can't see anything glaringly obvious from your source code snippets. The only thing that could be suspect (and this is as much from it being a black box as anything else) is your LOADEDTEXTURE pointer that you store in an STL container...

Are you sure this isn't just a standard memory r/w error? are these pointers at any point getting invalidated?

Some better trace information would be very useful here - Isolating a function/line will probably throw this problem wide open [smile].

You say you can't run it through VStudio's debugger - is it a general crash (i.e. a bug in vstudio/bad config) or is the debugger telling you, from the outset, that your program doesn't make the world happy..?

Do you have any trace-file information? can you do a "cout" or "printf" style statement to any logger so as to try and gain an idea of what line is failing?

Have you got the debug runtimes set to maximum output, and run it's monitoring application in the console (so you can see the debug spew without VStudio)?

Sorry I can't be more specific!
Jack

Share this post


Link to post
Share on other sites
When I run the app from the debug directory after building it it runs fine (except the alt tab thing).

When I go debug->start, the app just locks up and I have to end task it, I then break in the debugger and I get this:

'RTS Project.exe': Loaded 'D:\Chris\Programming\My Visual Studio Projects\RTS Project\Debug\RTS Project.exe', Symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\Program Files\Messenger Plus! 3\MsgPlusH.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\comdlg32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\SHLWAPI.DLL', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.1612_x-ww_7c379b08\comctl32.dll', No symbols loaded.
'RTS Project.exe': Loaded 'C:\WINDOWS\system32\d3d9d.dll', No symbols loaded.
Direct3D9: :====> ENTER: DLLMAIN(00d816f0): Process Attach: 00000e40, tid=000008f0
Direct3D9: :====> EXIT: DLLMAIN(00d816f0): Process Attach: 00000e40
Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.
D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO
Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver style 9

Direct3D9: :Subclassing window 0007057c
Direct3D9: :StartExclusiveMode
Direct3D9: :WM_DISPLAYCHANGE: 1024x768x16
Direct3D9: (WARN) :Ignoring redundant SetRenderState - 7

Direct3D9: (WARN) :Ignoring redundant SetRenderState - 14

Direct3D9: (WARN) :Ignoring redundant SetRenderState - 23

First-chance exception at 0x004bc16e in RTS Project.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
Unhandled exception at 0x004bc16e in RTS Project.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
The program '[3648] RTS Project.exe: Native' has exited with code 0 (0x0).

Anything useful there.

Here's my full texture code:

//the loadedtexture structure
struct LOADEDTEXTURE
{
IDirect3DTexture9 *m_texture; //The texture
string m_sFilename; //The filename of the texture
int m_nWidth; //Width of the texture
int m_nHeight; //Height of the texture
};


//Load texture from file
void CTextureManager::LoadTexture(string sFilename)
{
//iterate through texture list
list<LOADEDTEXTURE*>::iterator itTextures=m_lstMainTextureList.begin();
while(itTextures!=m_lstMainTextureList.end())
{
if((*itTextures)->m_sFilename==sFilename)
//texture already loaded, so return
g_Log<<"LoadTexture("<<sFilename<<") ALREADY LOADED"<<endl;
}

//texture is not already loaded, so now a texture can be loaded
D3DSURFACE_DESC surfaceDesc;
LOADEDTEXTURE *newTexture= new LOADEDTEXTURE;

//load texture
D3DXCreateTextureFromFileEx(g_pD3DDevice9,sFilename.c_str(),D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,
D3DX_DEFAULT,D3DX_DEFAULT,0,0,0,&newTexture->m_texture);
newTexture->m_texture->GetLevelDesc(0, &surfaceDesc);

//store textures filename, height and width
newTexture->m_sFilename=sFilename;
newTexture->m_nHeight=surfaceDesc.Height;
newTexture->m_nWidth=surfaceDesc.Width;

//put texture into list
m_lstMainTextureList.push_back(newTexture);

//texture now loaded
g_Log<<"LoadTexture("<<sFilename<<") SUCCEEDED"<<endl;
return;
}

//Clear all textures
void CTextureManager::ClearTextures(void)
{
list<LOADEDTEXTURE*>::iterator itTextures;

//iterate through texture list
for(itTextures=m_lstMainTextureList.begin();itTextures!=m_lstMainTextureList.end();itTextures++)
{
//Release texture
if ((*itTextures)->m_texture)
(*itTextures)->m_texture->Release();
(*itTextures)->m_texture=NULL;

//delete loadedtexture object
delete (*itTextures);
}

//Clear entire list
m_lstMainTextureList.clear();
g_Log<<endl<<"ClearTextures SUCCEEDED"<<endl;
}

//Set texture
void CTextureManager::SetTexture(string sFilename)
{
//set iterator
list<LOADEDTEXTURE*>::iterator itTextures=m_lstMainTextureList.begin();

while(itTextures!=m_lstMainTextureList.end())
{
//found texture
if((*itTextures)->m_sFilename==sFilename)
{
//set active texture
g_pD3DDevice9->SetTexture(0,(*itTextures)->m_texture);
g_Log<<"SetTexture("<<sFilename<<") SUCCEEDED"<<endl;
return;
}
}
}




Quote:

Have you got the debug runtimes set to maximum output, and run it's monitoring application in the console (so you can see the debug spew without VStudio)?

Debug runtimes are set to max output. How do I set debugging up porperly (any hints)? Also how do I set up this "monitoring application"?

Share this post


Link to post
Share on other sites
Quote:
First-chance exception at 0x004bc16e in RTS Project.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
Unhandled exception at 0x004bc16e in RTS Project.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
The program '[3648] RTS Project.exe: Native' has exited with code 0 (0x0).

and
Quote:
The app runs fine, but when I alt tab, then put focus back on the app, then it crashes (application error-memory could not be written)

I think you've just provided yourself a lead [smile].

It's useful to note that both the debug runtimes (for general C++/Win32) as well as the DX-Debug libraries are mostly slow because they validate/verify everything that happens. Retail releases of both assume either everything is okay, or that you (the programmer) know what is happening thus don't validate your code.

So, the fact that the debug runtimes are picking something up early on is a good indication that there is a bigger bug (or just another, hopefully similar, one) in your program that you've just been lucky not to see in a retail build...

I vaguely remember 0xcdcdcdcd being a special code - so I looked it up on google and found this page. About 1/3rd the way down there is this entry:
Quote:
0xCDCDCDCD
Allocated in heap, but not initialized


So you've basically got some screwy pointers in your program that you're either not initializing at all - or by some case of flow-control you're skipping the code that does initialize them. You could, quite simply, test all pointers and addresses against 0xCDCDCDCD whenever they are used, referenced, declared - bit messy, but it'll work.

hth [grin]
Jack

[Edited by - jollyjeffers on February 15, 2005 1:23:19 PM]

Share this post


Link to post
Share on other sites
Just looking through your code:


//void CTextureManager::LoadTexture(string sFilename)
while(itTextures!=m_lstMainTextureList.end())
{
if((*itTextures)->m_sFilename==sFilename)
//texture already loaded, so return
g_Log<<"LoadTexture("<<sFilename<<") ALREADY LOADED"<<endl;
}



hmm, unless I'm being stupid (possible!) that loop doesn't iterate - you never move the itTextures pointer forwards..? and it won't return when it finds an existing resource, just spit out a message.

Same thing again with:

//void CTextureManager::SetTexture(string sFilename)
while(itTextures!=m_lstMainTextureList.end())
{
//found texture
if((*itTextures)->m_sFilename==sFilename)
{
//set active texture
g_pD3DDevice9->SetTexture(0,(*itTextures)->m_texture);
g_Log<<"SetTexture("<<sFilename<<") SUCCEEDED"<<endl;
return;
}
}


Share this post


Link to post
Share on other sites
Quote:

hmm, unless I'm being stupid (possible!) that loop doesn't iterate - you never move the itTextures pointer forwards..? and it won't return when it finds an existing resource, just spit out a message.


Thanks for that. I kinda forgot to add the ++iterator bit, because I am so use to for loops, heh. I have fixed that problem now.

The main problem is still there though. The post below gives a more useful error message.

[Edited by - utilae on February 15, 2005 3:07:58 PM]

Share this post


Link to post
Share on other sites
I have done the debug again:

First-chance exception at 0x004bc177 in RTS Project.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x004bc177 in RTS Project.exe: 0xC0000005: Access violation reading location 0x00000000.
The program '[1964] RTS Project.exe: Native' has exited with code 0 (0x0).

I have found that it stops at this line:
newTexture->m_texture->GetLevelDesc(0,&surfaceDesc);//stops at this line

//Load texture from file
void CTextureManager::LoadTexture(string sFilename)
{
//iterate through texture list
list<LOADEDTEXTURE*>::iterator itTextures=m_lstMainTextureList.begin();

while(itTextures!=m_lstMainTextureList.end())
{
if((*itTextures)->m_sFilename==sFilename)
{
//texture already loaded, so return
g_Log<<"LoadTexture("<<sFilename<<") ALREADY LOADED"<<endl;
return;
}
else ++itTextures;
}

//texture is not already loaded, so now a texture can be loaded
D3DSURFACE_DESC surfaceDesc;
LOADEDTEXTURE *newTexture=new LOADEDTEXTURE;

//load texture
D3DXCreateTextureFromFileEx(g_pD3DDevice9,sFilename.c_str(),D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,0,0,0,&newTexture->m_texture);
newTexture->m_texture->GetLevelDesc(0,&surfaceDesc);//stops at this line

//store textures filename, height and width
newTexture->m_sFilename=sFilename;
newTexture->m_nHeight=surfaceDesc.Height;
newTexture->m_nWidth=surfaceDesc.Width;

//put texture into list
m_lstMainTextureList.push_back(newTexture);

//texture now loaded
g_Log<<"LoadTexture("<<sFilename<<") SUCCEEDED"<<endl;
return;
}



For that line I also get this error:

An unhandled exception of type 'System.NullReferenceException' occured.
Object reference not set to an instance of an object.

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
everything [smile].

Resources in D3DPOOL_SYSMEM and D3DPOOL_MANAGED will be looked after for you; All resources of any type in D3DPOOL_DEFAULT should be released when you minimize and re-created again when you get focus (recreate the device) again.

hth
Jack


Hi -

I've found it a lot easier to do *nothing* until your app gets focus again - that is, once you get focus again (Present returns DEVICELOST, TestCooperativeLevel returns DEVICENOTRESET), only then do you release resources, Reset the device, then recreate resources. While you're minimized, all DX calls will silently fail. If you release everything as soon as you're minimized, you'll have to check every bloody thing for lost or whatever, very tedious.

joe
image space

Share this post


Link to post
Share on other sites
You never check the return value of D3DXCreateTextureFromFileEx(). The call is failing, and giving you an invalid pointer. So newTexture->m_texture isn't set to a valid value.
Always always always check your return values.

Share this post


Link to post
Share on other sites
Ok, I'll look into that "Evil Steve".

If this:

D3DXCreateTextureFromFileEx(g_pD3DDevice9,sFilename.c_str(),D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,
D3DX_DEFAULT,D3DX_DEFAULT,0,0,0,&newTexture->m_texture);

s failing, then how can I stop it from failing. The only thing I am not sure about is this part of it(the last parameter):
&newTexture->m_texture

Cause newTexture is a struct LOADEDTEXTURE, eg
struct LOADEDTEXTURE
{
IDirect3DTexture9 *m_texture; //The texture
string m_sFilename; //The filename of the texture
int m_nWidth; //Width of the texture
int m_nHeight; //Height of the texture
};




Share this post


Link to post
Share on other sites
This page lists the following return codes:

Quote:
D3DERR_INVALIDCALL
The method call is invalid. For example, a method's parameter may have an invalid value.
D3DERR_NOTAVAILABLE
This device does not support the queried technique.
D3DERR_OUTOFVIDEOMEMORY
Direct3D does not have enough display memory to perform the operation.
D3DXERR_INVALIDDATA
The data is invalid.
E_OUTOFMEMORY
Direct3D could not allocate sufficient memory to complete the call.


Test for these as return values from your call - presuming it is D3DXCreateTextureFromFileEx that is tripping up, then it will be one of the values on that list. Matching them up against the descriptions should reveal the next step in the puzzla: why.

Only when you know the why can you give serious thought to a work-around and/or bug fix.

hth
Jack

Share this post


Link to post
Share on other sites
D3DXCreateTextureFromFileEx returns S_OK.

I only get this error when I run debug->start. I'm wondering if the debug is too sensitive or something, whether it's detecting errors that are not there.

When I run from the debug directory it works fine. I alt tab to minimize app and them give app focus again, and it all runs smoothly. Only issue now is that the textures that were being rendered to screen, no longer appear.


Here's what my log says(the bit about alt tab):

TestCooperativeLevel() S_OK
TestCooperativeLevel() S_OK //alt tab pressed somewhere around here
TestCooperativeLevel() D3DERR_DEVICELOST
TestCooperativeLevel() D3DERR_DEVICELOST
TestCooperativeLevel() D3DERR_DEVICELOST
TestCooperativeLevel() D3DERR_DEVICELOST
TestCooperativeLevel() D3DERR_DEVICELOST
TestCooperativeLevel() D3DERR_DEVICELOST
TestCooperativeLevel() D3DERR_DEVICENOTRESET
DeviceReset() S_OK
TestCooperativeLevel() S_OK //focus regained here, but textures not showing
TestCooperativeLevel() S_OK

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this