diff --git a/border/gameboy-player/README.txt b/border/gameboy-player/README.txt new file mode 100644 index 0000000..06439f5 --- /dev/null +++ b/border/gameboy-player/README.txt @@ -0,0 +1,7 @@ +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. + +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-gba-color.slangp b/border/gameboy-player/gameboy-player-gba-color.slangp new file mode 100644 index 0000000..05b29d6 --- /dev/null +++ b/border/gameboy-player/gameboy-player-gba-color.slangp @@ -0,0 +1,20 @@ +shaders = "2" +shader0 = "../../handheld/shaders/color/gba-color.slang" +shader1 = "../shaders/imgborder-gbp.slang" + +scale_type0 = "source" +scale0 = "1.0000" +filter_linear0 = "false" + +scale_type_x1 = "absolute" +scale_x1 = "608" +scale_type_y1 = "absolute" +scale_y1 = "448" + +parameters = "box_scale;in_res_x;in_res_y" +box_scale = "2.000000" +in_res_x = "240.000000" +in_res_y = "160.000000" + +textures = "BORDER" +BORDER = "gameboy-player.png" diff --git a/border/gameboy-player/gameboy-player.png b/border/gameboy-player/gameboy-player.png new file mode 100644 index 0000000..56bdda2 Binary files /dev/null and b/border/gameboy-player/gameboy-player.png differ diff --git a/border/gameboy-player/gameboy-player.slangp b/border/gameboy-player/gameboy-player.slangp new file mode 100644 index 0000000..7b78e86 --- /dev/null +++ b/border/gameboy-player/gameboy-player.slangp @@ -0,0 +1,15 @@ +shaders = "1" +shader0 = "../shaders/imgborder-gbp.slang" + +scale_type_x0 = "absolute" +scale_x0 = "608" +scale_type_y0 = "absolute" +scale_y0 = "448" + +parameters = "box_scale;in_res_x;in_res_y" +box_scale = "2.000000" +in_res_x = "240.000000" +in_res_y = "160.000000" + +textures = "BORDER" +BORDER = "gameboy-player.png" diff --git a/border/gameboy-player/sample-borders/agb-pepper.png b/border/gameboy-player/sample-borders/agb-pepper.png new file mode 100644 index 0000000..61e1ec8 Binary files /dev/null and b/border/gameboy-player/sample-borders/agb-pepper.png differ diff --git a/border/gameboy-player/sample-borders/agb.png b/border/gameboy-player/sample-borders/agb.png new file mode 100644 index 0000000..56bdda2 Binary files /dev/null and b/border/gameboy-player/sample-borders/agb.png differ diff --git a/border/gameboy-player/sample-borders/exotic.png b/border/gameboy-player/sample-borders/exotic.png new file mode 100644 index 0000000..9bc274c Binary files /dev/null and b/border/gameboy-player/sample-borders/exotic.png differ diff --git a/border/gameboy-player/sample-borders/gbpblack.png b/border/gameboy-player/sample-borders/gbpblack.png new file mode 100644 index 0000000..ebedf44 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpblack.png differ diff --git a/border/gameboy-player/sample-borders/gbpblocks.png b/border/gameboy-player/sample-borders/gbpblocks.png new file mode 100644 index 0000000..7f99a78 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpblocks.png differ diff --git a/border/gameboy-player/sample-borders/gbpcamo.png b/border/gameboy-player/sample-borders/gbpcamo.png new file mode 100644 index 0000000..d4ef8f7 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpcamo.png differ diff --git a/border/gameboy-player/sample-borders/gbpcube.png b/border/gameboy-player/sample-borders/gbpcube.png new file mode 100644 index 0000000..27aa9b3 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpcube.png differ diff --git a/border/gameboy-player/sample-borders/gbpcube2.png b/border/gameboy-player/sample-borders/gbpcube2.png new file mode 100644 index 0000000..a847982 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpcube2.png differ diff --git a/border/gameboy-player/sample-borders/gbpknit.png b/border/gameboy-player/sample-borders/gbpknit.png new file mode 100644 index 0000000..d96a4dc Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpknit.png differ diff --git a/border/gameboy-player/sample-borders/gbpmachine.png b/border/gameboy-player/sample-borders/gbpmachine.png new file mode 100644 index 0000000..6ed0996 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpmachine.png differ diff --git a/border/gameboy-player/sample-borders/gbpplanets.png b/border/gameboy-player/sample-borders/gbpplanets.png new file mode 100644 index 0000000..ae4043f Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpplanets.png differ diff --git a/border/gameboy-player/sample-borders/gbppokemon.png b/border/gameboy-player/sample-borders/gbppokemon.png new file mode 100644 index 0000000..f811b77 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbppokemon.png differ diff --git a/border/gameboy-player/sample-borders/gbpstone.png b/border/gameboy-player/sample-borders/gbpstone.png new file mode 100644 index 0000000..773b1c7 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpstone.png differ diff --git a/border/gameboy-player/sample-borders/gbpwood.png b/border/gameboy-player/sample-borders/gbpwood.png new file mode 100644 index 0000000..a06b2d9 Binary files /dev/null and b/border/gameboy-player/sample-borders/gbpwood.png differ diff --git a/border/gameboy-player/sample-borders/pkmnblue.png b/border/gameboy-player/sample-borders/pkmnblue.png new file mode 100644 index 0000000..30b4889 Binary files /dev/null and b/border/gameboy-player/sample-borders/pkmnblue.png differ diff --git a/border/sgb/README.txt b/border/sgb/README.txt new file mode 100644 index 0000000..597bfd5 --- /dev/null +++ b/border/sgb/README.txt @@ -0,0 +1,5 @@ +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. + +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/sample-borders/Mega Man.png b/border/sgb/sample-borders/Mega Man.png new file mode 100644 index 0000000..032f089 Binary files /dev/null and b/border/sgb/sample-borders/Mega Man.png differ diff --git a/border/sgb/sample-borders/Pokemon2.png b/border/sgb/sample-borders/Pokemon2.png new file mode 100644 index 0000000..551a2d1 Binary files /dev/null and b/border/sgb/sample-borders/Pokemon2.png differ diff --git a/border/sgb/sample-borders/bomberman.png b/border/sgb/sample-borders/bomberman.png new file mode 100644 index 0000000..7cee798 Binary files /dev/null and b/border/sgb/sample-borders/bomberman.png differ diff --git a/border/sgb/sample-borders/castlevania.png b/border/sgb/sample-borders/castlevania.png new file mode 100644 index 0000000..23cecff Binary files /dev/null and b/border/sgb/sample-borders/castlevania.png differ diff --git a/border/sgb/sample-borders/cinema.png b/border/sgb/sample-borders/cinema.png new file mode 100644 index 0000000..e7a0a4d Binary files /dev/null and b/border/sgb/sample-borders/cinema.png differ diff --git a/border/sgb/sample-borders/donkey-kong-country.png b/border/sgb/sample-borders/donkey-kong-country.png new file mode 100644 index 0000000..6fd36b1 Binary files /dev/null and b/border/sgb/sample-borders/donkey-kong-country.png differ diff --git a/border/sgb/sample-borders/donkey-kong.png b/border/sgb/sample-borders/donkey-kong.png new file mode 100644 index 0000000..a1f36c2 Binary files /dev/null and b/border/sgb/sample-borders/donkey-kong.png differ diff --git a/border/sgb/sample-borders/game-and-watch.png b/border/sgb/sample-borders/game-and-watch.png new file mode 100644 index 0000000..8cd0b0b Binary files /dev/null and b/border/sgb/sample-borders/game-and-watch.png differ diff --git a/border/sgb/sample-borders/gbc-berry.png b/border/sgb/sample-borders/gbc-berry.png new file mode 100644 index 0000000..9292bbc Binary files /dev/null and b/border/sgb/sample-borders/gbc-berry.png differ diff --git a/border/sgb/sample-borders/gbc-dandelion.png b/border/sgb/sample-borders/gbc-dandelion.png new file mode 100644 index 0000000..a9100d0 Binary files /dev/null and b/border/sgb/sample-borders/gbc-dandelion.png differ diff --git a/border/sgb/sample-borders/gbc-grape.png b/border/sgb/sample-borders/gbc-grape.png new file mode 100644 index 0000000..150f16c Binary files /dev/null and b/border/sgb/sample-borders/gbc-grape.png differ diff --git a/border/sgb/sample-borders/gbc-kiwi.png b/border/sgb/sample-borders/gbc-kiwi.png new file mode 100644 index 0000000..fa1c078 Binary files /dev/null and b/border/sgb/sample-borders/gbc-kiwi.png differ diff --git a/border/sgb/sample-borders/gbc-red.png b/border/sgb/sample-borders/gbc-red.png new file mode 100644 index 0000000..c573d3f Binary files /dev/null and b/border/sgb/sample-borders/gbc-red.png differ diff --git a/border/sgb/sample-borders/gbc-teal.png b/border/sgb/sample-borders/gbc-teal.png new file mode 100644 index 0000000..59542eb Binary files /dev/null and b/border/sgb/sample-borders/gbc-teal.png differ diff --git a/border/sgb/sample-borders/gblight.png b/border/sgb/sample-borders/gblight.png new file mode 100644 index 0000000..cf07467 Binary files /dev/null and b/border/sgb/sample-borders/gblight.png differ diff --git a/border/sgb/sample-borders/gbpocket.png b/border/sgb/sample-borders/gbpocket.png new file mode 100644 index 0000000..b63ce40 Binary files /dev/null and b/border/sgb/sample-borders/gbpocket.png differ diff --git a/border/sgb/sample-borders/kirby-2.png b/border/sgb/sample-borders/kirby-2.png new file mode 100644 index 0000000..cd73b53 Binary files /dev/null and b/border/sgb/sample-borders/kirby-2.png differ diff --git a/border/sgb/sample-borders/libretro-arcade.png b/border/sgb/sample-borders/libretro-arcade.png new file mode 100644 index 0000000..615df89 Binary files /dev/null and b/border/sgb/sample-borders/libretro-arcade.png differ diff --git a/border/sgb/sample-borders/pokemon-blue.png b/border/sgb/sample-borders/pokemon-blue.png new file mode 100644 index 0000000..ddc48a5 Binary files /dev/null and b/border/sgb/sample-borders/pokemon-blue.png differ diff --git a/border/sgb/sample-borders/pokemon-crystal.png b/border/sgb/sample-borders/pokemon-crystal.png new file mode 100644 index 0000000..8fc7414 Binary files /dev/null and b/border/sgb/sample-borders/pokemon-crystal.png differ diff --git a/border/sgb/sample-borders/pokemon-gold.png b/border/sgb/sample-borders/pokemon-gold.png new file mode 100644 index 0000000..89d6429 Binary files /dev/null and b/border/sgb/sample-borders/pokemon-gold.png differ diff --git a/border/sgb/sample-borders/pokemon-green.png b/border/sgb/sample-borders/pokemon-green.png new file mode 100644 index 0000000..39c19ea Binary files /dev/null and b/border/sgb/sample-borders/pokemon-green.png differ diff --git a/border/sgb/sample-borders/pokemon-red.png b/border/sgb/sample-borders/pokemon-red.png new file mode 100644 index 0000000..5d8fdd5 Binary files /dev/null and b/border/sgb/sample-borders/pokemon-red.png differ diff --git a/border/sgb/sample-borders/pokemon-silver.png b/border/sgb/sample-borders/pokemon-silver.png new file mode 100644 index 0000000..1543e56 Binary files /dev/null and b/border/sgb/sample-borders/pokemon-silver.png differ diff --git a/border/sgb/sample-borders/pokemon-yellow.png b/border/sgb/sample-borders/pokemon-yellow.png new file mode 100644 index 0000000..c7241dc Binary files /dev/null and b/border/sgb/sample-borders/pokemon-yellow.png differ diff --git a/border/sgb/sample-borders/sgb-default.png b/border/sgb/sample-borders/sgb-default.png new file mode 100644 index 0000000..06c8de9 Binary files /dev/null and b/border/sgb/sample-borders/sgb-default.png differ diff --git a/border/sgb/sample-borders/sgb2-circuitboard.png b/border/sgb/sample-borders/sgb2-circuitboard.png new file mode 100644 index 0000000..2b335fc Binary files /dev/null and b/border/sgb/sample-borders/sgb2-circuitboard.png differ diff --git a/border/sgb/sample-borders/sgb2-default.png b/border/sgb/sample-borders/sgb2-default.png new file mode 100644 index 0000000..97318ec Binary files /dev/null and b/border/sgb/sample-borders/sgb2-default.png differ diff --git a/border/sgb/sample-borders/space-invaders.png b/border/sgb/sample-borders/space-invaders.png new file mode 100644 index 0000000..62af951 Binary files /dev/null and b/border/sgb/sample-borders/space-invaders.png differ diff --git a/border/sgb/sample-borders/street-fighter-2.png b/border/sgb/sample-borders/street-fighter-2.png new file mode 100644 index 0000000..739fd28 Binary files /dev/null and b/border/sgb/sample-borders/street-fighter-2.png differ diff --git a/border/sgb/sample-borders/tetris.png b/border/sgb/sample-borders/tetris.png new file mode 100644 index 0000000..7c5f0ae Binary files /dev/null and b/border/sgb/sample-borders/tetris.png differ diff --git a/border/sgb/sample-borders/wario-land.png b/border/sgb/sample-borders/wario-land.png new file mode 100644 index 0000000..95d719d Binary files /dev/null and b/border/sgb/sample-borders/wario-land.png differ diff --git a/border/sgb/sample-borders/zelda.png b/border/sgb/sample-borders/zelda.png new file mode 100644 index 0000000..e43f97b Binary files /dev/null and b/border/sgb/sample-borders/zelda.png differ diff --git a/border/sgb/sgb.png b/border/sgb/sgb.png new file mode 100644 index 0000000..06c8de9 Binary files /dev/null and b/border/sgb/sgb.png differ diff --git a/border/sgb/sgb.slangp b/border/sgb/sgb.slangp new file mode 100644 index 0000000..b720e1e --- /dev/null +++ b/border/sgb/sgb.slangp @@ -0,0 +1,16 @@ +shaders = "1" +shader0 = "../shaders/imgborder-sgb.slang" + +scale_type_x0 = "absolute" +scale_x0 = "256" +scale_type_y0 = "absolute" +scale_y0 = "224" + +parameters = "box_scale;location;in_res_x;in_res_y" +box_scale = "1.000000" +location = "0.500000" +in_res_x = "160.000000" +in_res_y = "144.000000" + +textures = "BORDER" +BORDER = "sgb.png" diff --git a/border/sgba/README.txt b/border/sgba/README.txt new file mode 100644 index 0000000..77bf097 --- /dev/null +++ b/border/sgba/README.txt @@ -0,0 +1,5 @@ +These shader presets will allow you to apply a 304x224 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 304x224 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 302x224 Super Game Boy Advance border in png format with the center 240x160 transparent. The borders included with this shader were created by BLUEamnesiac. \ No newline at end of file diff --git a/border/sgba/sample-borders/sgba-black.png b/border/sgba/sample-borders/sgba-black.png new file mode 100644 index 0000000..2352b77 Binary files /dev/null and b/border/sgba/sample-borders/sgba-black.png differ diff --git a/border/sgba/sample-borders/sgba-indigo.png b/border/sgba/sample-borders/sgba-indigo.png new file mode 100644 index 0000000..98afa68 Binary files /dev/null and b/border/sgba/sample-borders/sgba-indigo.png differ diff --git a/border/sgba/sample-borders/sgba-platinum.png b/border/sgba/sample-borders/sgba-platinum.png new file mode 100644 index 0000000..840ca39 Binary files /dev/null and b/border/sgba/sample-borders/sgba-platinum.png differ diff --git a/border/sgba/sample-borders/sgba-spice.png b/border/sgba/sample-borders/sgba-spice.png new file mode 100644 index 0000000..dc91685 Binary files /dev/null and b/border/sgba/sample-borders/sgba-spice.png differ diff --git a/border/sgba/sgba-gba-color.slangp b/border/sgba/sgba-gba-color.slangp new file mode 100644 index 0000000..7e3fc57 --- /dev/null +++ b/border/sgba/sgba-gba-color.slangp @@ -0,0 +1,20 @@ +shaders = "2" +shader0 = "../../handheld/shaders/color/gba-color.slang" +shader1 = "../shaders/imgborder-sgba.slang" + +scale_type0 = "source" +scale0 = "1.0000" +filter_linear0 = "false" + +scale_type_x1 = "absolute" +scale_x1 = "304" +scale_type_y1 = "absolute" +scale_y1 = "224" + +parameters = "box_scale;in_res_x;in_res_y" +box_scale = "1.000000" +in_res_x = "240.000000" +in_res_y = "160.000000" + +textures = "BORDER" +BORDER = "sgba.png" diff --git a/border/sgba/sgba.png b/border/sgba/sgba.png new file mode 100644 index 0000000..98afa68 Binary files /dev/null and b/border/sgba/sgba.png differ diff --git a/border/sgba/sgba.slangp b/border/sgba/sgba.slangp new file mode 100644 index 0000000..0a1a5cd --- /dev/null +++ b/border/sgba/sgba.slangp @@ -0,0 +1,15 @@ +shaders = "1" +shader0 = "../shaders/imgborder-sgba.slang" + +scale_type_x0 = "absolute" +scale_x0 = "304" +scale_type_y0 = "absolute" +scale_y0 = "224" + +parameters = "box_scale;in_res_x;in_res_y" +box_scale = "1.000000" +in_res_x = "240.000000" +in_res_y = "160.000000" + +textures = "BORDER" +BORDER = "sgba.png" diff --git a/border/shaders/imgborder-gbp.slang b/border/shaders/imgborder-gbp.slang new file mode 100644 index 0000000..dd1a061 --- /dev/null +++ b/border/shaders/imgborder-gbp.slang @@ -0,0 +1,12 @@ +#version 450 + +#pragma parameter box_scale "Image Scale" 2.0 1.0 10.0 1.0 +#pragma parameter location_x "Viewport X Pos." 0.5 0.0 1.0 0.05 +#pragma parameter location_y "Viewport Y Pos." 0.5 0.0 1.0 0.05 +#pragma parameter in_res_x "Viewport Size X" 240.0 100.0 600.0 1.0 +#pragma parameter in_res_y "Viewport Size Y" 160.0 64.0 512.0 1.0 +#pragma parameter border_on_top "Show Viewport" 1.0 0.0 1.0 1.0 +#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 +#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 + +#include "imgborder.inc" \ No newline at end of file diff --git a/border/shaders/imgborder-sgb.slang b/border/shaders/imgborder-sgb.slang new file mode 100644 index 0000000..bdc56cd --- /dev/null +++ b/border/shaders/imgborder-sgb.slang @@ -0,0 +1,12 @@ +#version 450 + +#pragma parameter box_scale "Image Scale" 1.0 1.0 10.0 1.0 +#pragma parameter location_x "Viewport X Pos." 0.5 0.0 1.0 0.05 +#pragma parameter location_y "Viewport Y Pos." 0.5 0.0 1.0 0.05 +#pragma parameter in_res_x "Viewport Size X" 160.0 100.0 600.0 1.0 +#pragma parameter in_res_y "Viewport Size Y" 144.0 64.0 512.0 1.0 +#pragma parameter border_on_top "Show Viewport" 1.0 0.0 1.0 1.0 +#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 +#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 + +#include "imgborder.inc" \ No newline at end of file diff --git a/border/shaders/imgborder-sgba.slang b/border/shaders/imgborder-sgba.slang new file mode 100644 index 0000000..eac4ca9 --- /dev/null +++ b/border/shaders/imgborder-sgba.slang @@ -0,0 +1,12 @@ +#version 450 + +#pragma parameter box_scale "Image Scale" 1.0 1.0 10.0 1.0 +#pragma parameter location_x "Viewport X Pos." 0.5 0.0 1.0 0.05 +#pragma parameter location_y "Viewport Y Pos." 0.5 0.0 1.0 0.05 +#pragma parameter in_res_x "Viewport Size X" 240.0 100.0 600.0 1.0 +#pragma parameter in_res_y "Viewport Size Y" 160.0 64.0 512.0 1.0 +#pragma parameter border_on_top "Show Viewport" 1.0 0.0 1.0 1.0 +#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 +#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 + +#include "imgborder.inc" \ No newline at end of file diff --git a/border/shaders/imgborder.inc b/border/shaders/imgborder.inc new file mode 100644 index 0000000..9ec37a6 --- /dev/null +++ b/border/shaders/imgborder.inc @@ -0,0 +1,59 @@ +// Created by inigo quilez - iq/2014 +// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +// modified for slang border shader by hunterk + +layout(push_constant) uniform Push +{ + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + uint FrameCount; + float box_scale; + float location_x; + float location_y; + float in_res_x; + float in_res_y; + float border_on_top; + float border_zoom_x; + float border_zoom_y; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec2 screen_coord; + +void main() +{ + gl_Position = global.MVP * Position; + vec2 corrected_size = vec2(params.in_res_x, params.in_res_y); + vec2 scale = (params.OutputSize.xy / corrected_size) / params.box_scale; + vec2 middle = vec2(params.location_x, params.location_y); + vec2 diff = TexCoord.xy - middle; + screen_coord = middle + diff * scale; + middle = vec2(0.4999, 0.4999); + vTexCoord = middle + diff * vec2(params.border_zoom_x, params.border_zoom_y); +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec2 screen_coord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +layout(set = 0, binding = 3) uniform sampler2D Original; +layout(set = 0, binding = 4) uniform sampler2D BORDER; + +void main() +{ +vec4 screen = texture(Source, screen_coord); //the main video screen +vec4 background = vec4(texture(BORDER, vTexCoord)); //put your background function's output here +if ( screen_coord.x < 0.9999 && screen_coord.x > 0.0001 && screen_coord.y < 0.9999 && screen_coord.y > 0.0001 && params.border_on_top > 0.5 ) +background.a *= 0.0; + FragColor = vec4(mix(screen, background, background.a)); +} \ No newline at end of file diff --git a/border/shaders/imgborder.slang b/border/shaders/imgborder.slang new file mode 100644 index 0000000..e1d5f34 --- /dev/null +++ b/border/shaders/imgborder.slang @@ -0,0 +1,12 @@ +#version 450 + +#pragma parameter box_scale "Image Scale" 4.0 1.0 10.0 1.0 +#pragma parameter location_x "Viewport X Pos." 0.5 0.0 1.0 0.05 +#pragma parameter location_y "Viewport Y Pos." 0.5 0.0 1.0 0.05 +#pragma parameter in_res_x "Viewport Size X" 320.0 100.0 600.0 1.0 +#pragma parameter in_res_y "Viewport Size Y" 240.0 64.0 512.0 1.0 +#pragma parameter border_on_top "Show Viewport" 1.0 0.0 1.0 1.0 +#pragma parameter border_zoom_x "Border Zoom X" 1.0 0.0 4.0 0.01 +#pragma parameter border_zoom_y "Border Zoom Y" 1.0 0.0 4.0 0.01 + +#include "imgborder.inc" \ No newline at end of file