From 41b2af66d56e81faa771d891b0c1be1d47658c5d Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 6 Mar 2011 18:19:31 +0100 Subject: [PATCH] Add settings. --- config.def.h | 6 ++++++ general.h | 6 ++++++ settings.c | 12 ++++++++++++ ssnes.cfg | 14 ++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/config.def.h b/config.def.h index 6d7255619e..e5e3f2e135 100644 --- a/config.def.h +++ b/config.def.h @@ -113,6 +113,12 @@ static const unsigned font_size = 48; static const float message_pos_offset_x = 0.05; static const float message_pos_offset_y = 0.05; +// Render-to-texture before rendering to screen (multi-pass shaders) +static const bool render_to_texture = false; +static const float fbo_scale_x = 2.0; +static const float fbo_scale_y = 2.0; +static const bool second_pass_smooth = true; + #define SNES_ASPECT_RATIO (4.0/3) //////////////// diff --git a/general.h b/general.h index a5a7c0383b..651763e556 100644 --- a/general.h +++ b/general.h @@ -72,6 +72,12 @@ struct settings unsigned filter; enum ssnes_shader_type shader_type; + bool render_to_texture; + double fbo_scale_x; + double fbo_scale_y; + char second_pass_shader[256]; + bool second_pass_smooth; + char font_path[256]; unsigned font_size; float msg_pos_x; diff --git a/settings.c b/settings.c index d933baa897..047a754847 100644 --- a/settings.c +++ b/settings.c @@ -115,6 +115,13 @@ static void set_defaults(void) g_settings.video.msg_pos_y = message_pos_offset_y; #endif +#if defined(HAVE_CG) || defined(HAVE_XML) + g_settings.video.render_to_texture = render_to_texture; + g_settings.video.fbo_scale_x = fbo_scale_x; + g_settings.video.fbo_scale_y = fbo_scale_y; + g_settings.video.second_pass_smooth = second_pass_smooth; +#endif + g_settings.audio.enable = audio_enable; g_settings.audio.out_rate = out_rate; g_settings.audio.in_rate = in_rate; @@ -280,6 +287,11 @@ static void parse_config_file(void) CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader"); CONFIG_GET_STRING(video.bsnes_shader_path, "video_bsnes_shader"); + CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader"); + CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture"); + CONFIG_GET_DOUBLE(video.fbo_scale_x, "video_fbo_scale_x"); + CONFIG_GET_DOUBLE(video.fbo_scale_x, "video_fbo_scale_y"); + CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth"); #ifdef HAVE_FREETYPE CONFIG_GET_STRING(video.font_path, "video_font_path"); diff --git a/ssnes.cfg b/ssnes.cfg index 715b4ecf6d..1919bf0680 100644 --- a/ssnes.cfg +++ b/ssnes.cfg @@ -38,6 +38,20 @@ # Which shader type to use. Valid values are "cg", "bsnes", "none" and "auto" # video_shader_type = auto +# Render to texture first. Useful when doing multi-pass shaders or control the output of shaders better. +# video_render_to_texture = false + +# Defines the video scale of render-to-texture. +# The output FBO size is scaled by these amounts against the input size (typically 256 * 224 for SNES). +# video_fbo_scale_x = 2.0 +# video_fbo_scale_y = 2.0 + +# Define shader to use for second pass (needs render-to-texture). +# video_second_pass_shader = "/path/to/second/shader.{cg,shader}" + +# Defines if bilinear filtering is used during second pass (needs render-to-texture). +# video_second_pass_smooth = true + # CPU-based filter. Valid ones are: hq2x, hq4x, grayscale, bleed, ntsc. # video_filter = ntsc