One more refactoring step

This commit is contained in:
Henrik Rydgård 2022-11-21 14:54:48 +01:00
parent 7596713059
commit eff4118769
7 changed files with 24 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ public:
FramebufferManagerGLES(Draw::DrawContext *draw);
~FramebufferManagerGLES();
void Resized() override;
void NotifyDisplayResized() override;
void DeviceLost() override;
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;

View File

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

View File

@ -84,8 +84,7 @@ public:
bool IsReady() override {
return true;
}
void CancelReady() override {
}
void CancelReady() override {}
void Reinitialize() override;
void BeginHostFrame() override;