libretro: Add MSAA options

This commit is contained in:
Connor McLaughlin 2020-10-31 14:39:38 +10:00
parent f39b3006f2
commit 95dba59826
3 changed files with 29 additions and 1 deletions

View File

@ -13,6 +13,7 @@ A "BIOS" ROM image is required to to start the emulator and to play games. You c
## Latest News
- 2020/10/31: Multisample antialiasing added as an enhancement.
- 2020/10/30: Option to use analog stick as d-pad for analog controller added.
- 2020/10/20: New cheat manager with memory scanning added. More features will be added over time.
- 2020/10/05: CD-ROM read speedup enhancement added.

View File

@ -112,6 +112,11 @@ ALWAYS_INLINE static bool StartsWith(const std::string_view& str, const char* pr
{
return (str.compare(0, std::strlen(prefix), prefix) == 0);
}
ALWAYS_INLINE static bool EndsWith(const std::string_view& str, const char* suffix)
{
const std::size_t suffix_length = std::strlen(suffix);
return (str.length() >= suffix_length && str.compare(str.length() - suffix_length, suffix_length, suffix) == 0);
}
#ifdef WIN32

View File

@ -457,7 +457,7 @@ void LibretroHostInterface::OnSystemDestroyed()
m_using_hardware_renderer = false;
}
static std::array<retro_core_option_definition, 40> s_option_definitions = {{
static std::array<retro_core_option_definition, 41> s_option_definitions = {{
{"duckstation_Console.Region",
"Console Region",
"Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.",
@ -559,6 +559,23 @@ static std::array<retro_core_option_definition, 40> s_option_definitions = {{
{"15", "15x"},
{"16", "16x"}},
"1"},
{"duckstation_GPU.MSAA",
"Multisample Antialiasing",
"Uses multisample antialiasing for rendering 3D objects. Can smooth out jagged edges on polygons at a lower "
"cost to performance compared to increasing the resolution scale, but may be more likely to cause rendering "
"errors in some games.",
{{"1", "Disabled"},
{"2", "2x MSAA"},
{"4", "4x MSAA"},
{"8", "8x MSAA"},
{"16", "16x MSAA"},
{"32", "32x MSAA"},
{"2-ssaa", "2x SSAA"},
{"4-ssaa", "4x SSAA"},
{"8-ssaa", "8x SSAA"},
{"16-ssaa", "16x SSAA"},
{"32-ssaa", "32x SSAA"}},
"1"},
{"duckstation_GPU.TrueColor",
"True Color Rendering",
"Disables dithering and uses the full 8 bits per channel of color information. May break rendering in some games.",
@ -781,6 +798,11 @@ void LibretroHostInterface::LoadSettings()
g_settings.cpu_overclock_enable = (overclock_percent != 100);
g_settings.UpdateOverclockActive();
// convert msaa settings
const std::string msaa = si.GetStringValue("GPU", "MSAA", "1");
g_settings.gpu_multisamples = StringUtil::FromChars<u32>(msaa).value_or(1);
g_settings.gpu_per_sample_shading = StringUtil::EndsWith(msaa, "-ssaa");
// Ensure we don't use the standalone memcard directory in shared mode.
for (u32 i = 0; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
g_settings.memory_card_paths[i] = GetSharedMemoryCardPath(i);