1X and 4X Software Up-Rendering Feature Added (#43)

* 2X and 4X Software Up-Rendering Feature Added

What this change includes:
 - 2X software uprender
 - 4X software uprender (mostly untested, but yolo)
 - significant perf improvements to all SW rendering, including native res
 - config setting '[GPU].SoftwareUprender'

What this change is missing:
 - UI integration. It can only be enabled from the settings.ini file at the moment
 - Testing. I only checked four games so far

* SW Uprender 2x Fixed.

Mainly two typos, one in SetPixel, and one in a template parameter, caused the problems.
I did a bunch of var renaming and cleanup along the way.

* Add preliminary support for on-the-fly resolution change, rename and refactor some vars

* SW uprender: simplified so HW/SW share same setting.

* Fixed crash caused by bad malloc from on-the-fly res change refactor

* Fixed another crash. Bad math typo.

* Fix mode bad math in ReadVRAM

* Fix 4x rendering (mostly) - gradients are off, but could be SW integer precision issue.

hooks up proper software display buffer texture allocation.

* Fix FMVs rendering on host 16bpp display buffers

This bug varies by user's PC hardware and OS. Hard to verify and reproduce. >_<

* Fix hardcoded upscale factor

* Reduce diff size a bit

Co-authored-by: Jean-André Santoni <jean.andre.santoni@gmail.com>
This commit is contained in:
Jake Stine 2021-05-19 20:40:49 -07:00 • committed by Jean-André Santoni
commit 6566e665df
16 changed files with 1130 additions and 444 deletions

View file

@ -33,7 +33,6 @@ ALWAYS_INLINE static bool ShouldUseUVLimits()
GPU_HW::GPU_HW() : GPU()
{
m_vram_ptr = m_vram_shadow.data();
}
GPU_HW::~GPU_HW()
@ -1119,7 +1118,7 @@ void GPU_HW::UpdateSoftwareRenderer(bool copy_vram_from_hw)
if (current_enabled == new_enabled)
return;
m_vram_ptr = m_vram_shadow.data();
auto m_vram_ptr = GetVRAMshadowPtr();
if (!new_enabled)
{
@ -1138,7 +1137,7 @@ void GPU_HW::UpdateSoftwareRenderer(bool copy_vram_from_hw)
{
FlushRender();
ReadVRAM(0, 0, VRAM_WIDTH, VRAM_HEIGHT);
std::memcpy(sw_renderer->GetVRAM(), m_vram_ptr, sizeof(u16) * VRAM_WIDTH * VRAM_HEIGHT);
std::memcpy(sw_renderer->GetVRAMshadowPtr(), m_vram_ptr, sizeof(u16) * VRAM_WIDTH * VRAM_HEIGHT);
// Sync the drawing area.
GPUBackendSetDrawingAreaCommand* cmd = sw_renderer->NewSetDrawingAreaCommand();
@ -1147,7 +1146,6 @@ void GPU_HW::UpdateSoftwareRenderer(bool copy_vram_from_hw)
}
m_sw_renderer = std::move(sw_renderer);
m_vram_ptr = m_sw_renderer->GetVRAM();
}
void GPU_HW::FillBackendCommandParameters(GPUBackendCommand* cmd) const