Merge pull request #17513 from hrydgard/fix-post-proc-stretch

Post-processing: Fix using limited UV ranges when there's a single upscaling filter in the chain.
This commit is contained in:
Henrik Rydgård 2023-05-26 17:46:25 +02:00 committed by GitHub
commit 6f380a7a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 34 deletions

View File

@ -287,6 +287,8 @@ public:
}
GLRFramebuffer *CreateFramebuffer(int width, int height, bool z_stencil, const char *tag) {
_dbg_assert_(width > 0 && height > 0 && tag != nullptr);
GLRInitStep &step = initSteps_.push_uninitialized();
step.stepType = GLRInitStepType::CREATE_FRAMEBUFFER;
step.create_framebuffer.framebuffer = new GLRFramebuffer(caps_, width, height, z_stencil, tag);

View File

@ -293,6 +293,8 @@ bool PresentationCommon::UpdatePostShader() {
int w = usePreviousAtOutputResolution ? pixelWidth_ : renderWidth_;
int h = usePreviousAtOutputResolution ? pixelHeight_ : renderHeight_;
_dbg_assert_(w > 0 && h > 0);
static constexpr int FRAMES = 2;
previousFramebuffers_.resize(FRAMES);
previousIndex_ = 0;
@ -668,7 +670,7 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
float finalU0 = u0, finalU1 = u1, finalV0 = v0, finalV1 = v1;
if (usePostShader) {
if (usePostShader && !(isFinalAtOutputResolution && postShaderPipelines_.size() == 1)) {
// The final blit will thus use the full texture.
finalU0 = 0.0f;
finalV0 = 0.0f;

View File

@ -212,32 +212,6 @@ void GPUCommon::NotifyDisplayResized() {
displayResized_ = true;
}
// Called once per frame. Might also get called during the pause screen
// if "transparent".
void GPUCommon::CheckConfigChanged() {
if (configChanged_) {
ClearCacheNextFrame();
gstate_c.SetUseFlags(CheckGPUFeatures());
drawEngineCommon_->NotifyConfigChanged();
textureCache_->NotifyConfigChanged();
framebufferManager_->NotifyConfigChanged();
BuildReportingInfo();
configChanged_ = false;
}
// Check needed when running tests.
if (framebufferManager_) {
framebufferManager_->CheckPostShaders();
}
}
void GPUCommon::CheckDisplayResized() {
if (displayResized_) {
framebufferManager_->NotifyDisplayResized();
displayResized_ = false;
}
}
void GPUCommon::DumpNextFrame() {
dumpNextFrame_ = true;
}

View File

@ -76,9 +76,6 @@ public:
}
virtual u32 CheckGPUFeatures() const = 0;
void CheckDisplayResized() override;
void CheckConfigChanged() override;
virtual void UpdateCmdInfo() = 0;
bool IsReady() override {

View File

@ -401,6 +401,32 @@ GPUCommonHW::~GPUCommonHW() {
delete shaderManager_;
}
// Called once per frame. Might also get called during the pause screen
// if "transparent".
void GPUCommonHW::CheckConfigChanged() {
if (configChanged_) {
ClearCacheNextFrame();
gstate_c.SetUseFlags(CheckGPUFeatures());
drawEngineCommon_->NotifyConfigChanged();
textureCache_->NotifyConfigChanged();
framebufferManager_->NotifyConfigChanged();
BuildReportingInfo();
configChanged_ = false;
}
// Check needed when running tests.
if (framebufferManager_) {
framebufferManager_->CheckPostShaders();
}
}
void GPUCommonHW::CheckDisplayResized() {
if (displayResized_) {
framebufferManager_->NotifyDisplayResized();
displayResized_ = false;
}
}
void GPUCommonHW::CheckRenderResized() {
if (renderResized_) {
framebufferManager_->NotifyRenderResized(msaaLevel_);

View File

@ -83,7 +83,10 @@ protected:
void BuildReportingInfo() override;
void UpdateMSAALevel(Draw::DrawContext *draw) override;
void CheckDisplayResized() override;
void CheckRenderResized() override;
void CheckConfigChanged() override;
u32 CheckGPUFeaturesLate(u32 features) const;
int msaaLevel_ = 0;

View File

@ -449,11 +449,13 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
if (gfxCtx && draw) {
presentation_ = new PresentationCommon(draw_);
presentation_->SetLanguage(draw_->GetShaderLanguageDesc().shaderLanguage);
presentation_->UpdateDisplaySize(PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
presentation_->UpdateRenderSize(PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight);
}
NotifyConfigChanged();
NotifyRenderResized();
NotifyDisplayResized();
NotifyRenderResized();
}
void SoftGPU::DeviceLost() {
@ -723,14 +725,28 @@ void SoftGPU::NotifyRenderResized() {
}
void SoftGPU::NotifyDisplayResized() {
if (presentation_) {
displayResized_ = true;
}
void SoftGPU::CheckDisplayResized() {
if (displayResized_ && presentation_) {
presentation_->UpdateDisplaySize(PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
presentation_->UpdateRenderSize(PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight);
presentation_->UpdatePostShader();
displayResized_ = false;
}
}
void SoftGPU::NotifyConfigChanged() {}
void SoftGPU::CheckConfigChanged() {
if (configChanged_) {
drawEngineCommon_->NotifyConfigChanged();
BuildReportingInfo();
if (presentation_) {
presentation_->UpdatePostShader();
}
configChanged_ = false;
}
}
void SoftGPU::FastRunLoop(DisplayList &list) {
PROFILE_THIS_SCOPE("soft_runloop");

View File

@ -152,7 +152,9 @@ public:
void NotifyRenderResized() override;
void NotifyDisplayResized() override;
void NotifyConfigChanged() override;
void CheckDisplayResized() override;
void CheckConfigChanged() override;
void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override {
primaryInfo = "Software";