mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
D3D11: Re-read the device and context on DeviceRestore
The restored draw context can be a new device, so the cached pointers could go stale. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
ba37f327b0
commit
035c98d14f
4 files changed
+24
-1
No files matched your search
@@ -128,10 +128,19 @@ void DrawEngineD3D11::DestroyDeviceObjects() {
|
||||
void DrawEngineD3D11::DeviceLost() {
|
||||
DestroyDeviceObjects();
|
||||
draw_ = nullptr;
|
||||
device_ = nullptr;
|
||||
context_ = nullptr;
|
||||
device1_ = nullptr;
|
||||
context1_ = nullptr;
|
||||
}
|
||||
|
||||
void DrawEngineD3D11::DeviceRestore(Draw::DrawContext *draw) {
|
||||
// The restored context can be a new device, so don't keep the old pointers.
|
||||
draw_ = draw;
|
||||
device_ = (ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE);
|
||||
context_ = (ID3D11DeviceContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
device1_ = (ID3D11Device1 *)draw->GetNativeObject(Draw::NativeObject::DEVICE_EX);
|
||||
context1_ = (ID3D11DeviceContext1 *)draw->GetNativeObject(Draw::NativeObject::CONTEXT_EX);
|
||||
InitDeviceObjects();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ void GPU_D3D11::DeviceLost() {
|
||||
}
|
||||
|
||||
void GPU_D3D11::DeviceRestore(Draw::DrawContext *draw) {
|
||||
// The restored context can be a new device, so don't keep the old pointers.
|
||||
device_ = (ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE);
|
||||
context_ = (ID3D11DeviceContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
GPUCommonHW::DeviceRestore(draw);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,10 +111,16 @@ void ShaderManagerD3D11::DestroyDeviceObjects() {
|
||||
void ShaderManagerD3D11::DeviceLost() {
|
||||
DestroyDeviceObjects();
|
||||
draw_ = nullptr;
|
||||
device_ = nullptr;
|
||||
context_ = nullptr;
|
||||
}
|
||||
|
||||
void ShaderManagerD3D11::DeviceRestore(Draw::DrawContext *draw) {
|
||||
// The restored context can be a new device, so don't keep the old pointers.
|
||||
draw_ = draw;
|
||||
device_ = (ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE);
|
||||
context_ = (ID3D11DeviceContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
featureLevel_ = (D3D_FEATURE_LEVEL)draw->GetNativeObject(Draw::NativeObject::FEATURE_LEVEL);
|
||||
InitDeviceObjects();
|
||||
}
|
||||
|
||||
|
||||
@@ -178,9 +178,14 @@ void TextureCacheD3D11::DeviceLost() {
|
||||
TextureCacheCommon::DeviceLost();
|
||||
DestroyDeviceObjects();
|
||||
draw_ = nullptr;
|
||||
device_ = nullptr;
|
||||
context_ = nullptr;
|
||||
}
|
||||
|
||||
void TextureCacheD3D11::DeviceRestore(Draw::DrawContext *draw) {
|
||||
void TextureCacheD3D11::DeviceRestore(Draw::DrawContext *draw) {
|
||||
// The restored context can be a new device, so don't keep the old pointers.
|
||||
device_ = (ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE);
|
||||
context_ = (ID3D11DeviceContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
TextureCacheCommon::DeviceRestore(draw);
|
||||
InitDeviceObjects();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user