mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GPU: Move calculating render res to presentation.
Since it best understands what the first postshader wants.
This commit is contained in:
parent
477e988a68
commit
d9195c68b3
4 changed files with 58 additions and 35 deletions
|
@ -1669,41 +1669,13 @@ void FramebufferManagerCommon::SetSafeSize(u16 w, u16 h) {
|
|||
}
|
||||
|
||||
void FramebufferManagerCommon::Resized() {
|
||||
// Check if postprocessing shader is doing upscaling as it requires native resolution
|
||||
const ShaderInfo *shaderInfo = nullptr;
|
||||
if (g_Config.sPostShaderName != "Off") {
|
||||
shaderInfo = GetPostShaderInfo(g_Config.sPostShaderName);
|
||||
}
|
||||
|
||||
postShaderIsUpscalingFilter_ = shaderInfo ? shaderInfo->isUpscalingFilter : false;
|
||||
postShaderSSAAFilterLevel_ = shaderInfo ? shaderInfo->SSAAFilterLevel : 0;
|
||||
|
||||
// Actually, auto mode should be more granular...
|
||||
// Round up to a zoom factor for the render size.
|
||||
int zoom = g_Config.iInternalResolution;
|
||||
if (zoom == 0 || postShaderSSAAFilterLevel_ >= 2) {
|
||||
// auto mode, use the longest dimension
|
||||
if (!g_Config.IsPortrait()) {
|
||||
zoom = (PSP_CoreParameter().pixelWidth + 479) / 480;
|
||||
} else {
|
||||
zoom = (PSP_CoreParameter().pixelHeight + 479) / 480;
|
||||
}
|
||||
if (postShaderSSAAFilterLevel_ >= 2)
|
||||
zoom *= postShaderSSAAFilterLevel_;
|
||||
}
|
||||
if (zoom <= 1 || postShaderIsUpscalingFilter_)
|
||||
zoom = 1;
|
||||
|
||||
if (g_Config.IsPortrait()) {
|
||||
PSP_CoreParameter().renderWidth = 272 * zoom;
|
||||
PSP_CoreParameter().renderHeight = 480 * zoom;
|
||||
} else {
|
||||
PSP_CoreParameter().renderWidth = 480 * zoom;
|
||||
PSP_CoreParameter().renderHeight = 272 * zoom;
|
||||
}
|
||||
|
||||
gstate_c.skipDrawReason &= ~SKIPDRAW_NON_DISPLAYED_FB;
|
||||
|
||||
int w, h;
|
||||
presentation_->CalculateRenderResolution(&w, &h, &postShaderIsUpscalingFilter_, &postShaderIsSupersampling_);
|
||||
PSP_CoreParameter().renderWidth = w;
|
||||
PSP_CoreParameter().renderHeight = h;
|
||||
|
||||
if (UpdateSize()) {
|
||||
DestroyAllFBOs();
|
||||
}
|
||||
|
@ -1785,7 +1757,7 @@ void FramebufferManagerCommon::ShowScreenResolution() {
|
|||
messageStream << PSP_CoreParameter().renderWidth << "x" << PSP_CoreParameter().renderHeight << " ";
|
||||
if (postShaderIsUpscalingFilter_) {
|
||||
messageStream << gr->T("(upscaling)") << " ";
|
||||
} else if (postShaderSSAAFilterLevel_ >= 2) {
|
||||
} else if (postShaderIsSupersampling_) {
|
||||
messageStream << gr->T("(supersampling)") << " ";
|
||||
}
|
||||
messageStream << gr->T("Window Size") << ": ";
|
||||
|
|
|
@ -383,7 +383,7 @@ protected:
|
|||
|
||||
bool useBufferedRendering_ = false;
|
||||
bool postShaderIsUpscalingFilter_ = false;
|
||||
int postShaderSSAAFilterLevel_ = 0;
|
||||
bool postShaderIsSupersampling_ = false;
|
||||
|
||||
std::vector<VirtualFramebuffer *> vfbs_;
|
||||
std::vector<VirtualFramebuffer *> bvfbs_; // blitting framebuffers (for download)
|
||||
|
|
|
@ -676,3 +676,52 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
|||
|
||||
draw_->BindPipeline(nullptr);
|
||||
}
|
||||
|
||||
void PresentationCommon::CalculateRenderResolution(int *width, int *height, bool *upscaling, bool *ssaa) {
|
||||
// Check if postprocessing shader is doing upscaling as it requires native resolution
|
||||
std::vector<const ShaderInfo *> shaderInfo;
|
||||
if (g_Config.sPostShaderName != "Off") {
|
||||
ReloadAllPostShaderInfo();
|
||||
shaderInfo = GetPostShaderChain(g_Config.sPostShaderName);
|
||||
}
|
||||
|
||||
bool firstIsUpscalingFilter = shaderInfo.empty() ? false : shaderInfo.front()->isUpscalingFilter;
|
||||
int firstSSAAFilterLevel = shaderInfo.empty() ? 0 : shaderInfo.front()->SSAAFilterLevel;
|
||||
|
||||
// Actually, auto mode should be more granular...
|
||||
// Round up to a zoom factor for the render size.
|
||||
int zoom = g_Config.iInternalResolution;
|
||||
if (zoom == 0 || firstSSAAFilterLevel >= 2) {
|
||||
// auto mode, use the longest dimension
|
||||
if (!g_Config.IsPortrait()) {
|
||||
zoom = (PSP_CoreParameter().pixelWidth + 479) / 480;
|
||||
} else {
|
||||
zoom = (PSP_CoreParameter().pixelHeight + 479) / 480;
|
||||
}
|
||||
if (firstSSAAFilterLevel >= 2)
|
||||
zoom *= firstSSAAFilterLevel;
|
||||
}
|
||||
if (zoom <= 1 || firstIsUpscalingFilter)
|
||||
zoom = 1;
|
||||
|
||||
if (upscaling) {
|
||||
*upscaling = firstIsUpscalingFilter;
|
||||
for (auto &info : shaderInfo) {
|
||||
*upscaling = *upscaling || info->isUpscalingFilter;
|
||||
}
|
||||
}
|
||||
if (ssaa) {
|
||||
*ssaa = firstSSAAFilterLevel >= 2;
|
||||
for (auto &info : shaderInfo) {
|
||||
*ssaa = *ssaa || info->SSAAFilterLevel >= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Config.IsPortrait()) {
|
||||
*width = 272 * zoom;
|
||||
*height = 480 * zoom;
|
||||
} else {
|
||||
*width = 480 * zoom;
|
||||
*height = 272 * zoom;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ public:
|
|||
void SourceFramebuffer(Draw::Framebuffer *fb, int bufferWidth, int bufferHeight);
|
||||
void CopyToOutput(OutputFlags flags, int uvRotation, float u0, float v0, float u1, float v1);
|
||||
|
||||
void CalculateRenderResolution(int *width, int *height, bool *upscaling, bool *ssaa);
|
||||
|
||||
protected:
|
||||
void CreateDeviceObjects();
|
||||
void DestroyDeviceObjects();
|
||||
|
|
Loading…
Add table
Reference in a new issue