From 7bcc21b0e3549b9b63abe0c5377563c19c470bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 25 Feb 2023 16:27:00 +0100 Subject: [PATCH] Move msaaLevel_ to GPUCommonHW --- GPU/GPUCommon.cpp | 19 ------------------- GPU/GPUCommon.h | 10 ++-------- GPU/GPUCommonHW.cpp | 18 ++++++++++++++++++ GPU/GPUCommonHW.h | 5 +++++ 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index f48661000f..a59e348d4c 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -79,8 +79,6 @@ GPUCommon::GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : ResetMatrices(); PPGeSetDrawContext(draw); - - UpdateMSAALevel(draw); } GPUCommon::~GPUCommon() { @@ -267,13 +265,6 @@ void GPUCommon::CheckDisplayResized() { } } -void GPUCommon::CheckRenderResized() { - if (renderResized_) { - framebufferManager_->NotifyRenderResized(msaaLevel_); - renderResized_ = false; - } -} - void GPUCommon::DumpNextFrame() { dumpNextFrame_ = true; } @@ -3104,16 +3095,6 @@ u32 GPUCommon::CheckGPUFeaturesLate(u32 features) const { return features; } -void GPUCommon::UpdateMSAALevel(Draw::DrawContext *draw) { - int level = g_Config.iMultiSampleLevel; - if (draw && draw->GetDeviceCaps().multiSampleLevelsMask & (1 << level)) { - msaaLevel_ = level; - } else { - // Didn't support the configured level, so revert to 0. - msaaLevel_ = 0; - } -} - void GPUCommon::CheckFlushOp(int cmd, u32 diff) { const u8 cmdFlags = cmdInfo_[cmd].flags; if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) { diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 636cf00baf..facc94da07 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -264,17 +264,13 @@ public: fullInfo = reportingFullInfo_; } - int MSAALevel() const { - return msaaLevel_; - } - protected: void DeviceLost() override; void DeviceRestore() override; void ClearCacheNextFrame() override {} - virtual void CheckRenderResized(); + virtual void CheckRenderResized() {} // Add additional common features dependent on other features, which may be backend-determined. u32 CheckGPUFeaturesLate(u32 features) const; @@ -328,7 +324,7 @@ protected: virtual void BuildReportingInfo() = 0; - void UpdateMSAALevel(Draw::DrawContext *draw); + virtual void UpdateMSAALevel(Draw::DrawContext *draw) {} DrawEngineCommon *drawEngineCommon_ = nullptr; @@ -419,8 +415,6 @@ protected: std::string reportingPrimaryInfo_; std::string reportingFullInfo_; - int msaaLevel_ = 0; - private: void CheckDepthUsage(VirtualFramebuffer *vfb); void DoExecuteCall(u32 target); diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 1b251f5f57..2943a80cc5 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -360,6 +360,7 @@ GPUCommonHW::GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPU } UpdateCmdInfo(); + UpdateMSAALevel(draw); } GPUCommonHW::~GPUCommonHW() { @@ -374,6 +375,13 @@ GPUCommonHW::~GPUCommonHW() { delete shaderManager_; } +void GPUCommonHW::CheckRenderResized() { + if (renderResized_) { + framebufferManager_->NotifyRenderResized(msaaLevel_); + renderResized_ = false; + } +} + void GPUCommonHW::DeviceLost() { textureCache_->Clear(false); framebufferManager_->DeviceLost(); @@ -528,3 +536,13 @@ u32 GPUCommonHW::CheckGPUFeatures() const { return features; } + +void GPUCommonHW::UpdateMSAALevel(Draw::DrawContext *draw) { + int level = g_Config.iMultiSampleLevel; + if (draw && draw->GetDeviceCaps().multiSampleLevelsMask & (1 << level)) { + msaaLevel_ = level; + } else { + // Didn't support the configured level, so revert to 0. + msaaLevel_ = 0; + } +} diff --git a/GPU/GPUCommonHW.h b/GPU/GPUCommonHW.h index 0e2dc59f05..fea544911e 100644 --- a/GPU/GPUCommonHW.h +++ b/GPU/GPUCommonHW.h @@ -23,5 +23,10 @@ protected: // Needs to be called on GPU thread, not reporting thread. void BuildReportingInfo() override; + void UpdateMSAALevel(Draw::DrawContext *draw) override; + + void CheckRenderResized() override; + + int msaaLevel_ = 0; };