Merge pull request #578 from RachelBryk/IR

Cleanup Renderer::CalculateTargetSize(), and allow IRs higher than 4x to be set via INI.
This commit is contained in:
Tony Wasserka 2014-09-30 19:21:21 +02:00
commit 13fc8e7df1
7 changed files with 65 additions and 43 deletions

View File

@ -359,10 +359,15 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
const wxString efbscale_choices[] = { _("Auto (Window Size)"), _("Auto (Multiple of 640x528)"),
_("1x Native (640x528)"), _("1.5x Native (960x792)"), _("2x Native (1280x1056)"),
_("2.5x Native (1600x1320)"), _("3x Native (1920x1584)"), _("4x Native (2560x2112)") };
_("2.5x Native (1600x1320)"), _("3x Native (1920x1584)"), _("4x Native (2560x2112)"), _("Custom") };
wxChoice *const choice_efbscale = CreateChoice(page_enh,
vconfig.iEFBScale, wxGetTranslation(internal_res_desc), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices);
vconfig.iEFBScale, wxGetTranslation(internal_res_desc), (vconfig.iEFBScale > 7) ?
ArraySize(efbscale_choices) : ArraySize(efbscale_choices) - 1, efbscale_choices);
if (vconfig.iEFBScale > 7)
choice_efbscale->SetSelection(8);
szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Internal Resolution:")), 1, wxALIGN_CENTER_VERTICAL, 0);
szr_enh->Add(choice_efbscale);

View File

@ -1370,4 +1370,9 @@ void Renderer::SetInterlacingMode()
// TODO
}
int Renderer::GetMaxTextureSize()
{
return DX11::D3D::GetMaxTextureSize();
}
} // namespace DX11

View File

@ -49,6 +49,8 @@ public:
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) override;
static bool CheckForResize();
int GetMaxTextureSize() override;
};
}

View File

@ -1904,4 +1904,11 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
}
int Renderer::GetMaxTextureSize()
{
int max_size;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);
return max_size;
}
}

View File

@ -84,6 +84,8 @@ public:
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) override;
int GetMaxTextureSize() override;
private:
void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc, const TargetRectangle& targetPixelRc, const u32* data);
};

View File

@ -173,48 +173,12 @@ bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int
// TODO: Ugly. Clean up
switch (s_LastEFBScale)
{
case 2: // 1x
efb_scale_numeratorX = efb_scale_numeratorY = 1;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case 3: // 1.5x
efb_scale_numeratorX = efb_scale_numeratorY = 3;
efb_scale_denominatorX = efb_scale_denominatorY = 2;
break;
case 4: // 2x
efb_scale_numeratorX = efb_scale_numeratorY = 2;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case 5: // 2.5x
efb_scale_numeratorX = efb_scale_numeratorY = 5;
efb_scale_denominatorX = efb_scale_denominatorY = 2;
break;
case 6: // 3x
efb_scale_numeratorX = efb_scale_numeratorY = 3;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case 7: // 4x
efb_scale_numeratorX = efb_scale_numeratorY = 4;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
default: // fractional & integral handled later
break;
}
switch (s_LastEFBScale)
{
case 0: // fractional
case 1: // integral
case SCALE_AUTO:
case SCALE_AUTO_INTEGRAL:
newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, framebuffer_width);
newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, framebuffer_height);
if (s_LastEFBScale == 1)
if (s_LastEFBScale == SCALE_AUTO_INTEGRAL)
{
newEFBWidth = ((newEFBWidth-1) / EFB_WIDTH + 1) * EFB_WIDTH;
newEFBHeight = ((newEFBHeight-1) / EFB_HEIGHT + 1) * EFB_HEIGHT;
@ -225,10 +189,45 @@ bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int
efb_scale_denominatorY = EFB_HEIGHT;
break;
case SCALE_1X:
efb_scale_numeratorX = efb_scale_numeratorY = 1;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case SCALE_1_5X:
efb_scale_numeratorX = efb_scale_numeratorY = 3;
efb_scale_denominatorX = efb_scale_denominatorY = 2;
break;
case SCALE_2X:
efb_scale_numeratorX = efb_scale_numeratorY = 2;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case SCALE_2_5X:
efb_scale_numeratorX = efb_scale_numeratorY = 5;
efb_scale_denominatorX = efb_scale_denominatorY = 2;
break;
case SCALE_3X:
case SCALE_4X:
default:
CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight);
efb_scale_numeratorX = efb_scale_numeratorY = s_LastEFBScale - 3;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
int maxSize;
maxSize = GetMaxTextureSize();
if ((unsigned)maxSize < EFB_WIDTH * efb_scale_numeratorX / efb_scale_denominatorX)
{
efb_scale_numeratorX = efb_scale_numeratorY = (maxSize / EFB_WIDTH);
efb_scale_denominatorX = efb_scale_denominatorY = 1;
}
break;
}
if (s_LastEFBScale > SCALE_AUTO_INTEGRAL)
CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight);
if (newEFBWidth != s_target_width || newEFBHeight != s_target_height)
{

View File

@ -118,11 +118,13 @@ public:
static void StorePixelFormat(PEControl::PixelFormat new_format) { prev_efb_format = new_format; }
PostProcessingShaderImplementation* GetPostProcessor() { return m_post_processor; }
// Max height/width
virtual int GetMaxTextureSize() = 0;
protected:
static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY);
static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height);
bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height);
static void CheckFifoRecording();
static void RecordVideoMemory();