GPU: Move "if (resized_)" to BeginHostFrame to avoid desynchronized settings.

Also wipe the input layout cache on D3D11 on resize.

Fixes #9438.
This commit is contained in:
Henrik Rydgård 2017-03-17 11:26:11 +01:00
parent 20f9ae3114
commit 94f16e3b7c
6 changed files with 38 additions and 24 deletions

View file

@ -58,7 +58,7 @@ public:
std::vector<std::string> DebugGetVertexLoaderIDs();
std::string DebugGetVertexLoaderString(std::string id, DebugShaderStringType stringType);
void Resized();
virtual void Resized();
protected:
virtual void ClearTrackedVertexArrays() {}

View file

@ -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();
}

View file

@ -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();

View file

@ -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();

View file

@ -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))

View file

@ -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;