Lines 53-58
Link Here
|
53 |
#include <canvas/debug.hxx> |
53 |
#include <canvas/debug.hxx> |
54 |
#include <canvas/verbosetrace.hxx> |
54 |
#include <canvas/verbosetrace.hxx> |
55 |
#include <tools/diagnose_ex.h> |
55 |
#include <tools/diagnose_ex.h> |
|
|
56 |
#include <osl/thread.h> |
56 |
|
57 |
|
57 |
#include <canvas/elapsedtime.hxx> |
58 |
#include <canvas/elapsedtime.hxx> |
58 |
#include <canvas/canvastools.hxx> |
59 |
#include <canvas/canvastools.hxx> |
Lines 956-966
namespace dxcanvas
Link Here
|
956 |
{ |
957 |
{ |
957 |
if(hr != D3DERR_DEVICELOST) |
958 |
if(hr != D3DERR_DEVICELOST) |
958 |
return false; |
959 |
return false; |
959 |
hr = mpDevice->Reset(&mad3dpp); |
960 |
|
960 |
if(SUCCEEDED(hr)) |
961 |
// interestingly enough, sometimes the Reset() below |
961 |
return true; |
962 |
// *still* causes DeviceLost errors. So, cycle until |
962 |
if(hr == D3DERR_DEVICELOST) |
963 |
// DX was kind enough to really reset the device... |
963 |
return true; |
964 |
do |
|
|
965 |
{ |
966 |
mpVertexBuffer.reset(); |
967 |
hr = mpDevice->Reset(&mad3dpp); |
968 |
if(SUCCEEDED(hr)) |
969 |
{ |
970 |
IDirect3DVertexBuffer9 *pVB(NULL); |
971 |
DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); |
972 |
if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, |
973 |
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, |
974 |
aFVF, |
975 |
D3DPOOL_DEFAULT, |
976 |
&pVB, |
977 |
NULL)) ) |
978 |
{ |
979 |
throw lang::NoSupportException( |
980 |
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( |
981 |
"Could not create DirectX device - out of memory!")),NULL); |
982 |
} |
983 |
mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB); |
984 |
|
985 |
// retry after the restore |
986 |
if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0))) |
987 |
return true; |
988 |
} |
989 |
|
990 |
TimeValue aTimeout; |
991 |
aTimeout.Seconds=1; |
992 |
aTimeout.Nanosec=0; |
993 |
osl_waitThread(&aTimeout); |
994 |
} |
995 |
while(hr == D3DERR_DEVICELOST); |
996 |
|
964 |
return false; |
997 |
return false; |
965 |
} |
998 |
} |
966 |
|
999 |
|