add option for SSAA (#843)

This commit is contained in:
Logan McNaughton 2026-05-06 11:52:13 +02:00 committed by GitHub
parent 323e8cf1f0
commit 172867527b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 38 additions and 1 deletions

View File

@ -298,6 +298,8 @@ void rdp_new_processor(GFX_INFO _gfx_info) {
} else if (gfx_info.upscale == 8) {
flags |= RDP::COMMAND_PROCESSOR_FLAG_SUPER_SAMPLED_DITHER_BIT;
flags |= RDP::COMMAND_PROCESSOR_FLAG_UPSCALING_8X_BIT;
} else {
gfx_info.upscale = 1;
}
processor = new RDP::CommandProcessor(wsi->get_device(), gfx_info.RDRAM, 0,
@ -519,6 +521,22 @@ static void render_frame(Vulkan::Device &device) {
options.persist_frame_on_invalid_input = true;
options.blend_previous_frame = true;
options.upscale_deinterlacing = false;
if (gfx_info.ssaa) {
switch (gfx_info.upscale) {
case 2:
options.downscale_steps = 1;
break;
case 4:
options.downscale_steps = 2;
break;
case 8:
options.downscale_steps = 3;
break;
default:
options.downscale_steps = 0;
break;
}
}
if (crop_letterbox && gfx_info.widescreen) {
options.crop_rect.enable = true;

View File

@ -21,6 +21,7 @@ typedef struct {
bool vsync;
bool integer_scaling;
uint32_t upscale;
bool ssaa;
bool crt;
} GFX_INFO;

View File

@ -47,6 +47,7 @@ pub struct Input {
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Video {
pub upscale: u32,
pub ssaa: bool,
pub integer_scaling: bool,
pub fullscreen: bool,
pub widescreen: bool,
@ -156,6 +157,7 @@ impl Config {
},
video: Video {
upscale: 1,
ssaa: false,
integer_scaling: false,
fullscreen: false,
widescreen: false,

View File

@ -153,6 +153,7 @@ fn input_profiles(config: &ui::config::Config) -> Vec<String> {
fn settings_window(app: &AppWindow, config: &ui::config::Config) {
app.set_integer_scaling(config.video.integer_scaling);
app.set_ssaa(config.video.ssaa);
app.set_fullscreen(config.video.fullscreen);
app.set_widescreen(config.video.widescreen);
app.set_vsync(config.video.vsync);
@ -418,6 +419,7 @@ fn controller_window(app: &AppWindow, config: &ui::config::Config) {
pub fn save_settings(app: &AppWindow) {
let mut config = ui::config::Config::new();
config.video.integer_scaling = app.get_integer_scaling();
config.video.ssaa = app.get_ssaa();
config.video.fullscreen = app.get_fullscreen();
config.video.widescreen = app.get_widescreen();
config.video.vsync = app.get_vsync();

View File

@ -55,6 +55,7 @@ export component AppWindow inherits Window {
in-out property ra_leaderboard <=> RAData.leaderboard;
in-out property ra_softcore_only <=> RAData.ra_softcore_only;
in-out property integer_scaling <=> SettingsData.integer_scaling;
in-out property ssaa <=> SettingsData.ssaa;
in-out property fullscreen <=> SettingsData.fullscreen;
in-out property widescreen <=> SettingsData.widescreen;
in-out property vsync <=> SettingsData.vsync;

View File

@ -6,6 +6,7 @@ import { Page } from "page.slint";
export global SettingsData {
in-out property <bool> integer_scaling;
in-out property <bool> ssaa;
in-out property <bool> fullscreen;
in-out property <bool> widescreen;
in-out property <bool> vsync;
@ -38,6 +39,17 @@ export component Settings inherits Page {
}
}
HorizontalBox {
alignment: start;
Switch {
text: @tr("SSAA downscaling");
checked: SettingsData.ssaa;
toggled => {
SettingsData.ssaa = self.checked;
}
}
}
HorizontalBox {
alignment: start;
Switch {

View File

@ -29,6 +29,7 @@ fn build_gfx_info(device: &mut device::Device) -> GFX_INFO {
},
integer_scaling: device.ui.config.video.integer_scaling,
upscale: device.ui.config.video.upscale,
ssaa: device.ui.config.video.ssaa,
crt: device.ui.config.video.crt,
}
}
@ -49,7 +50,7 @@ pub fn init(device: &mut device::Device) {
let window_width;
let window_height;
let scale = if device.ui.config.video.upscale > 1 {
let scale = if device.ui.config.video.upscale > 1 && !device.ui.config.video.ssaa {
device.ui.config.video.upscale as i32
} else {
2