diff --git a/Common/VR/VRRenderer.cpp b/Common/VR/VRRenderer.cpp index 4d89618c17..5de7cb4055 100644 --- a/Common/VR/VRRenderer.cpp +++ b/Common/VR/VRRenderer.cpp @@ -317,7 +317,7 @@ void VR_EndFrame( engine_t* engine ) { int x = vrConfig[VR_CONFIG_MOUSE_X]; int y = vrConfig[VR_CONFIG_MOUSE_Y]; int sx = vrConfig[VR_CONFIG_MOUSE_SIZE]; - int sy = sx * VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT); + int sy = (int)((float)sx * VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT)); ovrRenderer_MouseCursor(&engine->appState.Renderer, x, y, sx, sy); } diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index da70dc5750..7a104bc515 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -83,7 +83,8 @@ FramebufferManagerCommon::~FramebufferManagerCommon() { void FramebufferManagerCommon::Init() { // We may need to override the render size if the shader is upscaling or SSAA. - Resized(); + NotifyDisplayResized(); + NotifyRenderResized(); } bool FramebufferManagerCommon::UpdateRenderSize() { @@ -2330,7 +2331,17 @@ void FramebufferManagerCommon::SetSafeSize(u16 w, u16 h) { } } -void FramebufferManagerCommon::Resized() { +void FramebufferManagerCommon::NotifyDisplayResized() { + pixelWidth_ = PSP_CoreParameter().pixelWidth; + pixelHeight_ = PSP_CoreParameter().pixelHeight; + presentation_->UpdateDisplaySize(pixelWidth_, pixelHeight_); + + // No drawing is allowed here. This includes anything that might potentially touch a command buffer, like creating images! + // So we need to defer the post processing initialization. + updatePostShaders_ = true; +} + +void FramebufferManagerCommon::NotifyRenderResized() { gstate_c.skipDrawReason &= ~SKIPDRAW_NON_DISPLAYED_FB; int w, h, scaleFactor; @@ -2339,10 +2350,6 @@ void FramebufferManagerCommon::Resized() { PSP_CoreParameter().renderHeight = h; PSP_CoreParameter().renderScaleFactor = scaleFactor; - pixelWidth_ = PSP_CoreParameter().pixelWidth; - pixelHeight_ = PSP_CoreParameter().pixelHeight; - presentation_->UpdateDisplaySize(pixelWidth_, pixelHeight_); - if (UpdateRenderSize()) { DestroyAllFBOs(); } diff --git a/GPU/Common/FramebufferManagerCommon.h b/GPU/Common/FramebufferManagerCommon.h index 58a5e81630..fa41e1c272 100644 --- a/GPU/Common/FramebufferManagerCommon.h +++ b/GPU/Common/FramebufferManagerCommon.h @@ -398,7 +398,9 @@ public: } void SetSafeSize(u16 w, u16 h); - virtual void Resized(); + virtual void NotifyRenderResized(); + virtual void NotifyDisplayResized(); + virtual void DestroyAllFBOs(); virtual void DeviceLost(); diff --git a/GPU/GLES/FramebufferManagerGLES.cpp b/GPU/GLES/FramebufferManagerGLES.cpp index 9d1dc8d3dd..a5a46ca52d 100644 --- a/GPU/GLES/FramebufferManagerGLES.cpp +++ b/GPU/GLES/FramebufferManagerGLES.cpp @@ -70,8 +70,9 @@ void FramebufferManagerGLES::DeviceLost() { } } -void FramebufferManagerGLES::Resized() { - FramebufferManagerCommon::Resized(); +void FramebufferManagerGLES::NotifyDisplayResized() { + FramebufferManagerCommon::NotifyDisplayResized(); + GLRenderManager *render = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); render->Resize(PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight); } diff --git a/GPU/GLES/FramebufferManagerGLES.h b/GPU/GLES/FramebufferManagerGLES.h index 7bbfa1a510..f67ab65434 100644 --- a/GPU/GLES/FramebufferManagerGLES.h +++ b/GPU/GLES/FramebufferManagerGLES.h @@ -31,7 +31,7 @@ public: FramebufferManagerGLES(Draw::DrawContext *draw); ~FramebufferManagerGLES(); - void Resized() override; + void NotifyDisplayResized() override; void DeviceLost() override; bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 6794e0611e..b263b72131 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -617,7 +617,8 @@ void GPUCommon::CheckResized() { if (resized_) { gstate_c.useFlags = CheckGPUFeatures(); BuildReportingInfo(); - framebufferManager_->Resized(); + framebufferManager_->NotifyDisplayResized(); + framebufferManager_->NotifyRenderResized(); drawEngineCommon_->NotifyConfigChanged(); textureCache_->NotifyConfigChanged(); shaderManager_->DirtyLastShader(); diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 39aca24454..4c9a5d323f 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -84,8 +84,7 @@ public: bool IsReady() override { return true; } - void CancelReady() override { - } + void CancelReady() override {} void Reinitialize() override; void BeginHostFrame() override;