mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 22:44:13 +00:00
Bug 596489 - Part 2: Expose when a device manager is removed. r=jrmuizel
This commit is contained in:
parent
ade2ddb365
commit
3b157b7a00
@ -181,6 +181,7 @@ SwapChainD3D9::Reset()
|
||||
|
||||
DeviceManagerD3D9::DeviceManagerD3D9()
|
||||
: mHasDynamicTextures(false)
|
||||
, mDeviceWasRemoved(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -492,6 +493,13 @@ DeviceManagerD3D9::VerifyReadyForRendering()
|
||||
if (SUCCEEDED(hr)) {
|
||||
if (IsD3D9Ex()) {
|
||||
hr = mDeviceEx->CheckDeviceState(mFocusWnd);
|
||||
|
||||
if (hr == D3DERR_DEVICEREMOVED) {
|
||||
mDeviceWasRemoved = true;
|
||||
LayerManagerD3D9::OnDeviceManagerDestroy(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
D3DPRESENT_PARAMETERS pp;
|
||||
memset(&pp, 0, sizeof(D3DPRESENT_PARAMETERS));
|
||||
@ -505,7 +513,6 @@ DeviceManagerD3D9::VerifyReadyForRendering()
|
||||
pp.hDeviceWindow = mFocusWnd;
|
||||
|
||||
hr = mDeviceEx->ResetEx(&pp, NULL);
|
||||
// Handle D3DERR_DEVICEREMOVED!
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
@ -514,10 +521,6 @@ DeviceManagerD3D9::VerifyReadyForRendering()
|
||||
return true;
|
||||
}
|
||||
|
||||
if (hr != D3DERR_DEVICENOTRESET) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < mLayersWithResources.Length(); i++) {
|
||||
mLayersWithResources[i]->CleanResources();
|
||||
}
|
||||
@ -538,7 +541,13 @@ DeviceManagerD3D9::VerifyReadyForRendering()
|
||||
|
||||
hr = mDevice->Reset(&pp);
|
||||
|
||||
if (hr == D3DERR_DEVICELOST) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
mDeviceWasRemoved = true;
|
||||
LayerManagerD3D9::OnDeviceManagerDestroy(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,12 @@ public:
|
||||
/**
|
||||
* Return pointer to the Nv3DVUtils instance
|
||||
*/
|
||||
Nv3DVUtils *GetNv3DVUtils() { return mNv3DVUtils; }
|
||||
Nv3DVUtils *GetNv3DVUtils() { return mNv3DVUtils; }
|
||||
|
||||
/**
|
||||
* Returns true if this device was removed.
|
||||
*/
|
||||
bool DeviceWasRemoved() { return mDeviceWasRemoved; }
|
||||
|
||||
/**
|
||||
* We keep a list of all layers here that may have hardware resource allocated
|
||||
@ -206,6 +211,9 @@ private:
|
||||
/* If this device supports dynamic textures */
|
||||
bool mHasDynamicTextures;
|
||||
|
||||
/* If this device was removed */
|
||||
bool mDeviceWasRemoved;
|
||||
|
||||
/* Nv3DVUtils instance */
|
||||
nsAutoPtr<Nv3DVUtils> mNv3DVUtils;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user