From b88758e5bdc397a9dae9a044797bb054a11105cb Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sat, 15 Dec 2018 17:34:59 +0100 Subject: [PATCH] Add MSAA option. --- libretro.cpp | 1 + rsx/rsx_lib_vulkan.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libretro.cpp b/libretro.cpp index 447f0fa4..2a2bb263 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -3926,6 +3926,7 @@ void retro_set_environment(retro_environment_t cb) #ifdef HAVE_VULKAN { BEETLE_OPT(adaptive_smoothing), "Adaptive smoothing; enabled|disabled" }, { BEETLE_OPT(super_sampling), "Super sampling (downsample from internal upscale); disabled|enabled" }, + { BEETLE_OPT(msaa), "MSAA; 1x|2x|4x|8x|16x" }, { BEETLE_OPT(mdec_yuv), "MDEC YUV Chroma filter; disabled|enabled" }, #endif { BEETLE_OPT(internal_resolution), "Internal GPU resolution; 1x(native)|2x|4x|8x|16x" }, diff --git a/rsx/rsx_lib_vulkan.cpp b/rsx/rsx_lib_vulkan.cpp index 09b6f69f..ccb6bcc2 100644 --- a/rsx/rsx_lib_vulkan.cpp +++ b/rsx/rsx_lib_vulkan.cpp @@ -32,6 +32,7 @@ static bool inside_frame; static bool has_software_fb; static bool adaptive_smoothing; static bool super_sampling; +static unsigned msaa = 1; static bool mdec_yuv; static vector> defer; static dither_mode dither_mode = DITHER_NATIVE; @@ -73,7 +74,7 @@ static void context_reset(void) device = new Device; device->set_context(*context); - renderer = new Renderer(*device, scaling, 4, save_state.vram.empty() ? nullptr : &save_state); + renderer = new Renderer(*device, scaling, msaa, save_state.vram.empty() ? nullptr : &save_state); for (auto &func : defer) func(); @@ -182,6 +183,7 @@ void rsx_vulkan_refresh_variables(void) } unsigned old_scaling = scaling; + unsigned old_msaa = msaa; bool old_super_sampling = super_sampling; var.key = BEETLE_OPT(internal_resolution); @@ -214,6 +216,12 @@ void rsx_vulkan_refresh_variables(void) super_sampling = false; } + var.key = BEETLE_OPT(msaa); + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + msaa = strtoul(var.value, nullptr, 0); + } + var.key = BEETLE_OPT(mdec_yuv); if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { @@ -246,7 +254,7 @@ void rsx_vulkan_refresh_variables(void) if (super_sampling && scaling > 8) scaling = 8; - if ((old_scaling != scaling || old_super_sampling != super_sampling) && renderer) + if ((old_scaling != scaling || old_super_sampling != super_sampling || old_msaa != msaa) && renderer) { retro_system_av_info info; rsx_vulkan_get_system_av_info(&info);