diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index f458b6d0e8..84e6ed2748 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -58,7 +58,7 @@ public: std::vector DebugGetVertexLoaderIDs(); std::string DebugGetVertexLoaderString(std::string id, DebugShaderStringType stringType); - void Resized(); + virtual void Resized(); protected: virtual void ClearTrackedVertexArrays() {} diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index 81ce139bda..15f2d18bdf 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -133,15 +133,24 @@ void DrawEngineD3D11::ClearTrackedVertexArrays() { vai_.clear(); } -void DrawEngineD3D11::DestroyDeviceObjects() { - ClearTrackedVertexArrays(); - delete tessDataTransfer; - delete pushVerts_; - delete pushInds_; - +void DrawEngineD3D11::ClearInputLayoutMap() { for (auto &decl : inputLayoutMap_) { decl.second->Release(); } + inputLayoutMap_.clear(); +} + +void DrawEngineD3D11::Resized() { + DrawEngineCommon::Resized(); + ClearInputLayoutMap(); +} + +void DrawEngineD3D11::DestroyDeviceObjects() { + ClearTrackedVertexArrays(); + ClearInputLayoutMap(); + delete tessDataTransfer; + delete pushVerts_; + delete pushInds_; for (auto &depth : depthStencilCache_) { depth.second->Release(); } diff --git a/GPU/D3D11/DrawEngineD3D11.h b/GPU/D3D11/DrawEngineD3D11.h index b317b7a7b7..e11ec98f18 100644 --- a/GPU/D3D11/DrawEngineD3D11.h +++ b/GPU/D3D11/DrawEngineD3D11.h @@ -155,6 +155,8 @@ public: void ClearTrackedVertexArrays() override; + void Resized() override; + private: void DecodeVerts(); void DecodeVertsStep(); @@ -164,6 +166,8 @@ private: void ApplyDrawStateLate(bool applyStencilRef, uint8_t stencilRef); void ResetShaderBlending(); + void ClearInputLayoutMap(); + ID3D11InputLayout *SetupDecFmtForDraw(D3D11VertexShader *vshader, const DecVtxFormat &decFmt, u32 pspFmt); u32 ComputeMiniHash(); diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 8b621155e9..7cb27d8349 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -300,6 +300,12 @@ void GPU_D3D11::DumpNextFrame() { void GPU_D3D11::BeginHostFrame() { GPUCommon::BeginHostFrame(); UpdateCmdInfo(); + if (resized_) { + drawEngine_.Resized(); + textureCacheD3D11_->NotifyConfigChanged(); + shaderManagerD3D11_->DirtyShader(); + resized_ = false; + } } void GPU_D3D11::BeginFrame() { @@ -319,12 +325,6 @@ void GPU_D3D11::EndHostFrame() { } void GPU_D3D11::BeginFrameInternal() { - if (resized_) { - drawEngine_.Resized(); - textureCacheD3D11_->NotifyConfigChanged(); - resized_ = false; - } - textureCacheD3D11_->StartFrame(); drawEngine_.BeginFrame(); depalShaderCache_->Decimate(); diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 2d9eb36eca..03a4b256a8 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -267,6 +267,12 @@ void GPU_DX9::DumpNextFrame() { void GPU_DX9::BeginHostFrame() { GPUCommon::BeginHostFrame(); UpdateCmdInfo(); + if (resized_) { + drawEngine_.Resized(); + shaderManagerDX9_->DirtyShader(); + textureCacheDX9_->NotifyConfigChanged(); + resized_ = false; + } } void GPU_DX9::BeginFrame() { @@ -279,12 +285,6 @@ void GPU_DX9::ReapplyGfxStateInternal() { } void GPU_DX9::BeginFrameInternal() { - if (resized_) { - drawEngine_.Resized(); - textureCacheDX9_->NotifyConfigChanged(); - resized_ = false; - } - // Turn off vsync when unthrottled int desiredVSyncInterval = g_Config.bVSync ? 1 : 0; if ((PSP_CoreParameter().unthrottle) || (PSP_CoreParameter().fpsLimit == 1)) diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index b6fbf69963..9a49212f6a 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -426,6 +426,12 @@ void GPU_GLES::DumpNextFrame() { void GPU_GLES::BeginHostFrame() { GPUCommon::BeginHostFrame(); UpdateCmdInfo(); + if (resized_) { + CheckGPUFeatures(); + drawEngine_.Resized(); + shaderManagerGL_->DirtyShader(); + textureCacheGL_->NotifyConfigChanged(); + } } void GPU_GLES::BeginFrame() { @@ -476,11 +482,6 @@ void GPU_GLES::ReapplyGfxStateInternal() { } void GPU_GLES::BeginFrameInternal() { - if (resized_) { - CheckGPUFeatures(); - drawEngine_.Resized(); - textureCacheGL_->NotifyConfigChanged(); - } UpdateVsyncInterval(resized_); resized_ = false;