From 540fa91c62a320e92433d476edecdc46fe14d505 Mon Sep 17 00:00:00 2001 From: Monroe88 Date: Sun, 15 Apr 2018 16:15:26 -0500 Subject: [PATCH 1/4] Add Slang ports of the auto-box shaders --- auto-box/box-center.slang | 44 +++++++++++++++++++++++++++++++ auto-box/box-max.slang | 54 +++++++++++++++++++++++++++++++++++++++ auto-box/box.slang | 50 ++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 auto-box/box-center.slang create mode 100644 auto-box/box-max.slang create mode 100644 auto-box/box.slang diff --git a/auto-box/box-center.slang b/auto-box/box-center.slang new file mode 100644 index 0000000..a79f323 --- /dev/null +++ b/auto-box/box-center.slang @@ -0,0 +1,44 @@ +#version 450 + +/* + Box Center Shader + Centers pre-scaled output into the viewport, to prevent unintentional non-integer scaling. Maintains 1x scale of the input. + Author: Themaister + License: Public domain +*/ + +layout(std140, set = 0, binding = 0) uniform UBO +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + mat4 MVP; +} global; + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 box_scale = vec2(1.0); + + vec2 scale = (global.OutputSize.xy / global.SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5); + vec2 diff = TexCoord - middle; + vTexCoord = middle + diff * scale; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file diff --git a/auto-box/box-max.slang b/auto-box/box-max.slang new file mode 100644 index 0000000..7ac3290 --- /dev/null +++ b/auto-box/box-max.slang @@ -0,0 +1,54 @@ +#version 450 + +/* + Box Max Shader + Automatically scales output to the maximum integer scale possible. + Author: Themaister + License: Public domain +*/ + +layout(std140, set = 0, binding = 0) uniform UBO +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + mat4 MVP; +} global; + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; + + +float min(vec2 x) +{ + if (x.x > x.y) + return x.y; + else + return x.x; +} + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 box_scale = floor(global.OutputSize.xy / global.SourceSize.xy); + box_scale = vec2(min(box_scale), min(box_scale)); + + vec2 scale = (global.OutputSize.xy / global.SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5); + vec2 diff = TexCoord - middle; + vTexCoord = middle + diff * scale; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file diff --git a/auto-box/box.slang b/auto-box/box.slang new file mode 100644 index 0000000..939be8d --- /dev/null +++ b/auto-box/box.slang @@ -0,0 +1,50 @@ +#version 450 + +/* + Box Shader + Scales output according to the scale factor parameters. + Author: Themaister + License: Public domain +*/ + + +layout(std140, set = 0, binding = 0) uniform UBO +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + mat4 MVP; + float x_scale; + float y_scale; +} global; + +#pragma parameter x_scale "X Scale" 3.0 1.0 100.0 1.0 +#pragma parameter y_scale "Y Scale" 3.0 1.0 100.0 1.0 + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 box_scale = vec2(global.x_scale, global.y_scale); + + vec2 scale = (global.OutputSize.xy / global.SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5); + vec2 diff = TexCoord - middle; + vTexCoord = middle + diff * scale; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file From 337f7a7b94c04201d0570c3e479594c15d410b2e Mon Sep 17 00:00:00 2001 From: Monroe88 Date: Sun, 15 Apr 2018 16:29:01 -0500 Subject: [PATCH 2/4] Update SGB/SGBA/GBP tvout presets --- border/gameboy-player/README.txt | 16 +++-- .../gameboy-player-tvout+interlacing.slangp | 53 +++++++------- ...-player-tvout-gba-color+interlacing.slangp | 72 ++++++++++--------- .../gameboy-player-tvout-gba-color.slangp | 63 ++++++++-------- .../gameboy-player-tvout.slangp | 48 +++++++------ border/sgb/README.txt | 12 ++-- .../sgb-gbc-color-tvout+interlacing.slangp | 54 +++++++------- border/sgb/sgb-tvout+interlacing.slangp | 52 ++++++++------ border/sgba/README.txt | 6 +- border/sgba/sgba-tvout+interlacing.slangp | 52 ++++++++------ .../sgba-tvout-gba-color+interlacing.slangp | 58 ++++++++------- 11 files changed, 269 insertions(+), 217 deletions(-) diff --git a/border/gameboy-player/README.txt b/border/gameboy-player/README.txt index 06439f5..0827b0a 100644 --- a/border/gameboy-player/README.txt +++ b/border/gameboy-player/README.txt @@ -1,7 +1,11 @@ -These shader presets will allow you to apply a 608x448 Game Boy Player border around a 240x160 input image from a Game Boy Advance core, with the input being scaled 2x to fit the border. - -Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 608x448 resolution. You will need to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. - -An example border is included, you can swap it out with another 608x448 Game Boy Player border in png format with the center 240x160 transparent. The borders included with this shader were ripped from a Game Boy Player disc by a kind anonymous user and were edited to appear correct with a GBA image fully shown. - +These shader presets will allow you to apply a 608x448 Game Boy Player border around a 240x160 input image from a Game Boy Advance core, with the input being scaled 2x to fit the border. + +Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 608x448 resolution. + +One option to display it integer scaled is to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. + +The other option is to use one of the auto-box shaders in the last pass of the shader chain to integer scale or center the output of the border shader within the viewport. You may need to disable RetroArch's Integer Scaling and set the Aspect Ratio equal to your screen aspect ratio to see the whole image. + +An example border is included, you can swap it out with another 608x448 Game Boy Player border in png format with the center 240x160 transparent. The borders included with this shader were ripped from a Game Boy Player disc by a kind anonymous user and were edited to appear correct with a GBA image fully shown. + Using CRT-Royale with this border shader may result in flickering. This is due to it displaying the border shader as 480i, due to the output image being greater than 400px vertically. Disable interlacing detection in CRT Royale's user-settings.h if want 480p instead. \ No newline at end of file diff --git a/border/gameboy-player/gameboy-player-tvout+interlacing.slangp b/border/gameboy-player/gameboy-player-tvout+interlacing.slangp index ab54072..c376b67 100644 --- a/border/gameboy-player/gameboy-player-tvout+interlacing.slangp +++ b/border/gameboy-player/gameboy-player-tvout+interlacing.slangp @@ -1,29 +1,32 @@ -shaders = "4" -shader0 = "../shaders/imgborder-gbp.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" -shader3 = "../../misc/interlacing.slang" +shaders = 5 +shader0 = ../shaders/imgborder-gbp.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../misc/interlacing.slang +shader4 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "608" -scale_type_y0 = "absolute" -scale_y0 = "448" +scale_type_x0 = absolute +scale_x0 = 608 +scale_type_y0 = absolute +scale_y0 = 448 -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "1.000000" -enable_480i = "0.000000" -top_field_first = "1.000000" +filter_linear4 = false -textures = "BORDER" -BORDER = "gameboy-player.png" +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 1.000000 +enable_480i = 0.000000 +top_field_first = 1.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp b/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp index 78ac3a9..9df3a81 100644 --- a/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp +++ b/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp @@ -1,33 +1,39 @@ -shaders = "5" -shader0 = "../../handheld/shaders/color/gba-color.slang" -shader1 = "../shaders/imgborder-gbp.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" -shader4 = "../../misc/interlacing.slang" - -scale_type0 = "source" -scale0 = "1.0" - -scale_type_x1 = "absolute" -scale_x1 = "608" -scale_type_y1 = "absolute" -scale_y1 = "448" - -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" - -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" -enable_480i = "0.000000" -top_field_first = "1.000000" - -textures = "BORDER" -BORDER = "gameboy-player.png" +shaders = 6 +shader0 = ../../handheld/shaders/color/gba-color.slang +shader1 = ../shaders/imgborder-gbp.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../misc/interlacing.slang +shader5 = ../../auto-box/box-center.slang + +scale_type0 = source +scale0 = 1.0 + +scale_type_x1 = absolute +scale_x1 = 608 +scale_type_y1 = absolute +scale_y1 = 448 + +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 + +scale_type_y4 = source +scale_y4 = 1.000000 + +filter_linear5 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 +enable_480i = 1.000000 +top_field_first = 1.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/gameboy-player/gameboy-player-tvout-gba-color.slangp b/border/gameboy-player/gameboy-player-tvout-gba-color.slangp index e153103..5e9854c 100644 --- a/border/gameboy-player/gameboy-player-tvout-gba-color.slangp +++ b/border/gameboy-player/gameboy-player-tvout-gba-color.slangp @@ -1,30 +1,33 @@ -shaders = "4" -shader0 = "../../handheld/shaders/color/gba-color.slang" -shader1 = "../shaders/imgborder-gbp.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" - -scale_type0 = "source" -scale0 = "1.0" - -scale_type_x1 = "absolute" -scale_x1 = "608" -scale_type_y1 = "absolute" -scale_y1 = "448" - -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" - -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" - -textures = "BORDER" -BORDER = "gameboy-player.png" +shaders = 5 +shader0 = ../../handheld/shaders/color/gba-color.slang +shader1 = ../shaders/imgborder-gbp.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../auto-box/box-center.slang + +scale_type0 = source +scale0 = 1.0 + +scale_type_x1 = absolute +scale_x1 = 608 +scale_type_y1 = absolute +scale_y1 = 448 + +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 + +filter_linear4 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/gameboy-player/gameboy-player-tvout.slangp b/border/gameboy-player/gameboy-player-tvout.slangp index e30e44f..34d7558 100644 --- a/border/gameboy-player/gameboy-player-tvout.slangp +++ b/border/gameboy-player/gameboy-player-tvout.slangp @@ -1,26 +1,30 @@ -shaders = "3" -shader0 = "../shaders/imgborder-gbp.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" +shaders = 4 +shader0 = ../shaders/imgborder-gbp.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "608" -scale_type_y0 = "absolute" -scale_y0 = "448" -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x0 = absolute +scale_x0 = 608 +scale_type_y0 = absolute +scale_y0 = 448 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "480.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -textures = "BORDER" -BORDER = "gameboy-player.png" +filter_linear3 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 480.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/sgb/README.txt b/border/sgb/README.txt index 597bfd5..b437b68 100644 --- a/border/sgb/README.txt +++ b/border/sgb/README.txt @@ -1,5 +1,9 @@ -These shader presets will allow you to apply a 256x224 Super Game Boy border around a 160x144 input image from a Game Boy core. - -Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy core's reported resolution of 160x144 into account, and not the output image's 256x224 resolution. You will need to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. - +These shader presets will allow you to apply a 256x224 Super Game Boy border around a 160x144 input image from a Game Boy core. + +Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy core's reported resolution of 160x144 into account, and not the output image's 256x224 resolution. + +One option to display it integer scaled is to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. + +The other option is to use one of the auto-box shaders in the last pass of the shader chain to integer scale or center the output of the border shader within the viewport. You may need to disable RetroArch's Integer Scaling and set the Aspect Ratio equal to your screen aspect ratio to see the whole image. + An example border is included, you can swap it out with another 256x224 Super Game Boy border in png format with the center 160x144 transparent. Borders derived from an emulator screenshot may be shifted up one pixel and off center, so you would need to shift it down one pixel to center it. The "Super Game Boy Color" borders were created by BLUEamnesiac. \ No newline at end of file diff --git a/border/sgb/sgb-gbc-color-tvout+interlacing.slangp b/border/sgb/sgb-gbc-color-tvout+interlacing.slangp index 69d430f..54cd8c0 100644 --- a/border/sgb/sgb-gbc-color-tvout+interlacing.slangp +++ b/border/sgb/sgb-gbc-color-tvout+interlacing.slangp @@ -1,32 +1,38 @@ -shaders = "5" -shader0 = "../../handheld/shaders/color/gbc-color.slang" -shader1 = "../shaders/imgborder-sgb.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" -shader4 = "../../misc/interlacing.slang" +shaders = 6 +shader0 = ../../handheld/shaders/color/gbc-color.slang +shader1 = ../shaders/imgborder-sgb.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../misc/interlacing.slang +shader5 = ../../auto-box/box-center.slang filter_linear0 = false scale_type_0 = source scale0 = 1.0 -scale_type_x1 = "absolute" -scale_x1 = "256" -scale_type_y1 = "absolute" -scale_y1 = "224" +scale_type_x1 = absolute +scale_x1 = 256 +scale_type_y1 = absolute +scale_y1 = 224 -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "160.000000" -in_res_y = "144.000000" -TVOUT_RESOLUTION = "320.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" +scale_type_y4 = source +scale_y4 = 2.000000 -textures = "BORDER" -BORDER = "sgb.png" +filter_linear5 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 160.000000 +in_res_y = 144.000000 +TVOUT_RESOLUTION = 320.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = sgb.png diff --git a/border/sgb/sgb-tvout+interlacing.slangp b/border/sgb/sgb-tvout+interlacing.slangp index e793fab..7007aa3 100644 --- a/border/sgb/sgb-tvout+interlacing.slangp +++ b/border/sgb/sgb-tvout+interlacing.slangp @@ -1,27 +1,33 @@ -shaders = "4" -shader0 = "../shaders/imgborder-sgb.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" -shader3 = "../../misc/interlacing.slang" +shaders = 5 +shader0 = ../shaders/imgborder-sgb.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../misc/interlacing.slang +shader4 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "256" -scale_type_y0 = "absolute" -scale_y0 = "224" +scale_type_x0 = absolute +scale_x0 = 256 +scale_type_y0 = absolute +scale_y0 = 224 -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "160.000000" -in_res_y = "144.000000" -TVOUT_RESOLUTION = "320.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" +scale_type_y3 = source +scale_y3 = 2.000000 -textures = "BORDER" -BORDER = "sgb.png" +filter_linear4 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 160.000000 +in_res_y = 144.000000 +TVOUT_RESOLUTION = 320.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = sgb.png diff --git a/border/sgba/README.txt b/border/sgba/README.txt index 2e262bf..97e2fd7 100644 --- a/border/sgba/README.txt +++ b/border/sgba/README.txt @@ -1,5 +1,9 @@ These shader presets will allow you to apply a 320x240 Super Game Boy Advance border around a 240x160 input image from a Game Boy Advance core. -Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 320x240 resolution. You will need to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. +Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 320x240 resolution. + +One option to display it integer scaled is to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. + +The other option is to use one of the auto-box shaders in the last pass of the shader chain to integer scale or center the output of the border shader within the viewport. You may need to disable RetroArch's Integer Scaling and set the Aspect Ratio equal to your screen aspect ratio to see the whole image. An example border is included, you can swap it out with another 320x240 Super Game Boy Advance border in png format with the center 240x160 transparent. The borders included with this shader were created by EndUser based on a concept by BLUEamnesiac. \ No newline at end of file diff --git a/border/sgba/sgba-tvout+interlacing.slangp b/border/sgba/sgba-tvout+interlacing.slangp index 2ec7f00..ef89b9e 100644 --- a/border/sgba/sgba-tvout+interlacing.slangp +++ b/border/sgba/sgba-tvout+interlacing.slangp @@ -1,27 +1,33 @@ -shaders = "4" -shader0 = "../shaders/imgborder-sgba.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" -shader3 = "../../misc/interlacing.slang" +shaders = 5 +shader0 = ../shaders/imgborder-sgba.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../misc/interlacing.slang +shader4 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "320" -scale_type_y0 = "absolute" -scale_y0 = "240" +scale_type_x0 = absolute +scale_x0 = 320 +scale_type_y0 = absolute +scale_y0 = 240 -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "1.000000" +scale_type_y3 = source +scale_y3 = 2.000000 -textures = "BORDER" -BORDER = "sgba.png" +filter_linear4 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 1.000000 + +textures = BORDER +BORDER = sgba.png diff --git a/border/sgba/sgba-tvout-gba-color+interlacing.slangp b/border/sgba/sgba-tvout-gba-color+interlacing.slangp index dcbfdcb..eeb6368 100644 --- a/border/sgba/sgba-tvout-gba-color+interlacing.slangp +++ b/border/sgba/sgba-tvout-gba-color+interlacing.slangp @@ -1,31 +1,37 @@ -shaders = "5" -shader0 = "../../handheld/shaders/color/gba-color.slang" -shader1 = "../shaders/imgborder-sgba.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" -shader4 = "../../misc/interlacing.slang" +shaders = 6 +shader0 = ../../handheld/shaders/color/gba-color.slang +shader1 = ../shaders/imgborder-sgba.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../misc/interlacing.slang +shader5 = ../../auto-box/box-center.slang -scale_type0 = "source" -scale0 = "1.0" +scale_type0 = source +scale0 = 1.0 -scale_type_x1 = "absolute" -scale_x1 = "320" -scale_type_y1 = "absolute" -scale_y1 = "240" +scale_type_x1 = absolute +scale_x1 = 320 +scale_type_y1 = absolute +scale_y1 = 240 -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "1.000000" +scale_type_y4 = source +scale_y4 = 2.000000 -textures = "BORDER" -BORDER = "sgba.png" +filter_linear5 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 1.000000 + +textures = BORDER +BORDER = sgba.png From ed6bcc3242cf7db0fc3e2b83fa0a54aef4f3b0b5 Mon Sep 17 00:00:00 2001 From: Monroe88 Date: Sun, 15 Apr 2018 16:38:30 -0500 Subject: [PATCH 3/4] Convert these README files to markdown --- border/gameboy-player/{README.txt => README.md} | 2 ++ border/sgb/{README.txt => README.md} | 2 ++ border/sgba/{README.txt => README.md} | 2 ++ 3 files changed, 6 insertions(+) rename border/gameboy-player/{README.txt => README.md} (98%) rename border/sgb/{README.txt => README.md} (97%) rename border/sgba/{README.txt => README.md} (96%) diff --git a/border/gameboy-player/README.txt b/border/gameboy-player/README.md similarity index 98% rename from border/gameboy-player/README.txt rename to border/gameboy-player/README.md index 0827b0a..99d5309 100644 --- a/border/gameboy-player/README.txt +++ b/border/gameboy-player/README.md @@ -1,3 +1,5 @@ +# Game Boy Player border shader + These shader presets will allow you to apply a 608x448 Game Boy Player border around a 240x160 input image from a Game Boy Advance core, with the input being scaled 2x to fit the border. Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 608x448 resolution. diff --git a/border/sgb/README.txt b/border/sgb/README.md similarity index 97% rename from border/sgb/README.txt rename to border/sgb/README.md index b437b68..09be7ad 100644 --- a/border/sgb/README.txt +++ b/border/sgb/README.md @@ -1,3 +1,5 @@ +# Super Game Boy border shader + These shader presets will allow you to apply a 256x224 Super Game Boy border around a 160x144 input image from a Game Boy core. Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy core's reported resolution of 160x144 into account, and not the output image's 256x224 resolution. diff --git a/border/sgba/README.txt b/border/sgba/README.md similarity index 96% rename from border/sgba/README.txt rename to border/sgba/README.md index 97e2fd7..0e6b699 100644 --- a/border/sgba/README.txt +++ b/border/sgba/README.md @@ -1,3 +1,5 @@ +# Super Game Boy Advance border shader + These shader presets will allow you to apply a 320x240 Super Game Boy Advance border around a 240x160 input image from a Game Boy Advance core. Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 320x240 resolution. From baf586d641f72e6a1a5da1245154c13f1d1256e5 Mon Sep 17 00:00:00 2001 From: Monroe88 Date: Sun, 15 Apr 2018 16:41:10 -0500 Subject: [PATCH 4/4] Enable 480i on Game Boy Player tvout shader preset --- border/gameboy-player/gameboy-player-tvout+interlacing.slangp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/border/gameboy-player/gameboy-player-tvout+interlacing.slangp b/border/gameboy-player/gameboy-player-tvout+interlacing.slangp index c376b67..532ca1e 100644 --- a/border/gameboy-player/gameboy-player-tvout+interlacing.slangp +++ b/border/gameboy-player/gameboy-player-tvout+interlacing.slangp @@ -25,7 +25,7 @@ in_res_y = 160.000000 TVOUT_RESOLUTION = 512.000000 TVOUT_COMPOSITE_CONNECTION = 0.000000 TVOUT_TV_COLOR_LEVELS = 1.000000 -enable_480i = 0.000000 +enable_480i = 1.000000 top_field_first = 1.000000 textures = BORDER