mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 05:26:24 +02:00
Some DeviceLost/DeviceRestore cleanup
This commit is contained in:
1 parent
231f4efbbb
commit
72bed6f2b5
16 files changed
+42
-25
No files matched your search
@@ -74,6 +74,8 @@ public:
|
||||
virtual ~DrawEngineCommon();
|
||||
|
||||
void Init();
|
||||
virtual void DeviceLost() = 0;
|
||||
virtual void DeviceRestore(Draw::DrawContext *draw) = 0;
|
||||
|
||||
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices);
|
||||
|
||||
|
||||
@@ -119,6 +119,9 @@ public:
|
||||
DrawEngineD3D11(Draw::DrawContext *draw, ID3D11Device *device, ID3D11DeviceContext *context);
|
||||
~DrawEngineD3D11();
|
||||
|
||||
void DeviceLost() override { draw_ = nullptr; }
|
||||
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
|
||||
|
||||
void SetShaderManager(ShaderManagerD3D11 *shaderManager) {
|
||||
shaderManager_ = shaderManager;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
void ClearShaders() override;
|
||||
void DirtyLastShader() override;
|
||||
|
||||
void DeviceLost() override {}
|
||||
void DeviceLost() override { draw_ = nullptr; }
|
||||
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
|
||||
int GetNumVertexShaders() const { return (int)vsCache_.size(); }
|
||||
int GetNumFragmentShaders() const { return (int)fsCache_.size(); }
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
|
||||
|
||||
void DeviceLost() override {}
|
||||
void DeviceLost() override { draw_ = nullptr; }
|
||||
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -107,6 +107,9 @@ public:
|
||||
DrawEngineDX9(Draw::DrawContext *draw);
|
||||
~DrawEngineDX9();
|
||||
|
||||
void DeviceLost() override { draw_ = nullptr; }
|
||||
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
|
||||
|
||||
void SetShaderManager(ShaderManagerDX9 *shaderManager) {
|
||||
shaderManager_ = shaderManager;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,14 @@ u32 GPU_DX9::CheckGPUFeatures() const {
|
||||
return CheckGPUFeaturesLate(features);
|
||||
}
|
||||
|
||||
void GPU_DX9::DeviceLost() {
|
||||
GPUCommonHW::DeviceLost();
|
||||
}
|
||||
|
||||
void GPU_DX9::DeviceRestore(Draw::DrawContext *draw) {
|
||||
GPUCommonHW::DeviceRestore(draw);
|
||||
}
|
||||
|
||||
void GPU_DX9::ReapplyGfxState() {
|
||||
dxstate.Restore();
|
||||
GPUCommonHW::ReapplyGfxState();
|
||||
|
||||
@@ -36,6 +36,9 @@ public:
|
||||
|
||||
u32 CheckGPUFeatures() const override;
|
||||
|
||||
void DeviceLost() override;
|
||||
void DeviceRestore(Draw::DrawContext *draw) override;
|
||||
|
||||
void ReapplyGfxState() override;
|
||||
void GetStats(char *buffer, size_t bufsize) override;
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
int GetNumVertexShaders() const { return (int)vsCache_.size(); }
|
||||
int GetNumFragmentShaders() const { return (int)fsCache_.size(); }
|
||||
|
||||
void DeviceLost() override {}
|
||||
void DeviceLost() override { draw_ = nullptr; }
|
||||
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
|
||||
|
||||
std::vector<std::string> DebugGetShaderIDs(DebugShaderType type);
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
|
||||
|
||||
void DeviceLost() override {}
|
||||
void DeviceLost() override { draw_ = nullptr; }
|
||||
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
fragmentTestCache_ = testCache;
|
||||
}
|
||||
|
||||
void DeviceLost();
|
||||
void DeviceRestore(Draw::DrawContext *draw);
|
||||
void DeviceLost() override;
|
||||
void DeviceRestore(Draw::DrawContext *draw) override;
|
||||
|
||||
void ClearTrackedVertexArrays() override {}
|
||||
|
||||
|
||||
@@ -239,7 +239,6 @@ void GPU_GLES::DeviceLost() {
|
||||
// TransformDraw has registered as a GfxResourceHolder.
|
||||
CancelReady();
|
||||
fragmentTestCache_.DeviceLost();
|
||||
drawEngine_.DeviceLost();
|
||||
|
||||
GPUCommonHW::DeviceLost();
|
||||
}
|
||||
@@ -247,13 +246,8 @@ void GPU_GLES::DeviceLost() {
|
||||
void GPU_GLES::DeviceRestore(Draw::DrawContext *draw) {
|
||||
GPUCommonHW::DeviceRestore(draw);
|
||||
|
||||
UpdateCmdInfo();
|
||||
UpdateVsyncInterval(true);
|
||||
|
||||
shaderManager_->DeviceRestore(draw_);
|
||||
textureCache_->DeviceRestore(draw_);
|
||||
drawEngine_.DeviceRestore(draw_);
|
||||
fragmentTestCache_.DeviceRestore(draw_);
|
||||
UpdateVsyncInterval(true);
|
||||
}
|
||||
|
||||
void GPU_GLES::BeginHostFrame() {
|
||||
|
||||
@@ -417,13 +417,22 @@ void GPUCommonHW::DeviceLost() {
|
||||
textureCache_->Clear(false);
|
||||
textureCache_->DeviceLost();
|
||||
shaderManager_->DeviceLost();
|
||||
drawEngineCommon_->DeviceLost();
|
||||
}
|
||||
|
||||
// Call at the start of the GPU implementation's DeviceRestore
|
||||
void GPUCommonHW::DeviceRestore(Draw::DrawContext *draw) {
|
||||
draw_ = draw;
|
||||
framebufferManager_->DeviceRestore(draw_);
|
||||
textureCache_->DeviceRestore(draw_);
|
||||
shaderManager_->DeviceRestore(draw_);
|
||||
drawEngineCommon_->DeviceRestore(draw_);
|
||||
|
||||
PPGeSetDrawContext(draw_);
|
||||
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
BuildReportingInfo();
|
||||
UpdateCmdInfo();
|
||||
}
|
||||
|
||||
void GPUCommonHW::UpdateCmdInfo() {
|
||||
|
||||
@@ -173,6 +173,9 @@ public:
|
||||
SoftwareDrawEngine();
|
||||
~SoftwareDrawEngine();
|
||||
|
||||
void DeviceLost() override {}
|
||||
void DeviceRestore(Draw::DrawContext *draw) override {}
|
||||
|
||||
void NotifyConfigChanged() override;
|
||||
void DispatchFlush() override;
|
||||
void DispatchSubmitPrim(const void *verts, const void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int cullMode, int *bytesRead) override;
|
||||
|
||||
@@ -287,7 +287,6 @@ void DrawEngineVulkan::DeviceLost() {
|
||||
|
||||
void DrawEngineVulkan::DeviceRestore(Draw::DrawContext *draw) {
|
||||
draw_ = draw;
|
||||
|
||||
InitDeviceObjects();
|
||||
}
|
||||
|
||||
|
||||
@@ -158,8 +158,8 @@ public:
|
||||
framebufferManager_ = fbManager;
|
||||
}
|
||||
|
||||
void DeviceLost();
|
||||
void DeviceRestore(Draw::DrawContext *draw);
|
||||
void DeviceLost() override;
|
||||
void DeviceRestore(Draw::DrawContext *draw) override;
|
||||
|
||||
// So that this can be inlined
|
||||
void Flush() {
|
||||
|
||||
@@ -454,7 +454,6 @@ void GPU_Vulkan::DeviceLost() {
|
||||
SaveCache(shaderCachePath_);
|
||||
}
|
||||
DestroyDeviceObjects();
|
||||
drawEngine_.DeviceLost();
|
||||
pipelineManager_->DeviceLost();
|
||||
|
||||
GPUCommonHW::DeviceLost();
|
||||
@@ -462,17 +461,11 @@ void GPU_Vulkan::DeviceLost() {
|
||||
|
||||
void GPU_Vulkan::DeviceRestore(Draw::DrawContext *draw) {
|
||||
GPUCommonHW::DeviceRestore(draw);
|
||||
InitDeviceObjects();
|
||||
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
BuildReportingInfo();
|
||||
UpdateCmdInfo();
|
||||
|
||||
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
drawEngine_.DeviceRestore(draw_);
|
||||
pipelineManager_->DeviceRestore(vulkan);
|
||||
textureCacheVulkan_->DeviceRestore(draw_);
|
||||
shaderManagerVulkan_->DeviceRestore(draw_);
|
||||
|
||||
InitDeviceObjects();
|
||||
}
|
||||
|
||||
void GPU_Vulkan::GetStats(char *buffer, size_t bufsize) {
|
||||
|
||||
Reference in new issue
Block a user