From fc7d957e502aade6d21e79a0ba634da41ee44c7a Mon Sep 17 00:00:00 2001 From: Nikos Chantziaras Date: Sun, 16 Jan 2022 08:11:45 +0200 Subject: [PATCH] zfast-crt: add preset for the coarse mask, suitable for HD displays To avoid duplicating the whole shader implementation, the needed define has been split into its own file, and the shader implementation is now in an include file. --- crt/shaders/zfast_crt/zfast_crt_coarsemask.slang | 3 +++ crt/shaders/zfast_crt/zfast_crt_finemask.slang | 8 ++++++++ .../{zfast_crt.slang => zfast_crt/zfast_crt_impl.inc} | 6 ------ crt/zfast-crt-hdmask.slangp | 4 ++++ crt/zfast-crt.slangp | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 crt/shaders/zfast_crt/zfast_crt_coarsemask.slang create mode 100644 crt/shaders/zfast_crt/zfast_crt_finemask.slang rename crt/shaders/{zfast_crt.slang => zfast_crt/zfast_crt_impl.inc} (94%) create mode 100644 crt/zfast-crt-hdmask.slangp diff --git a/crt/shaders/zfast_crt/zfast_crt_coarsemask.slang b/crt/shaders/zfast_crt/zfast_crt_coarsemask.slang new file mode 100644 index 0000000..612aa06 --- /dev/null +++ b/crt/shaders/zfast_crt/zfast_crt_coarsemask.slang @@ -0,0 +1,3 @@ +#version 450 + +#include "zfast_crt_impl.inc" diff --git a/crt/shaders/zfast_crt/zfast_crt_finemask.slang b/crt/shaders/zfast_crt/zfast_crt_finemask.slang new file mode 100644 index 0000000..7241cc0 --- /dev/null +++ b/crt/shaders/zfast_crt/zfast_crt_finemask.slang @@ -0,0 +1,8 @@ +#version 450 + +// This can't be an option without slowing the shader down. +// Note that only the fine mask works on SNES Classic Edition +// due to Mali 400 gpu precision. +#define FINEMASK + +#include "zfast_crt_impl.inc" diff --git a/crt/shaders/zfast_crt.slang b/crt/shaders/zfast_crt/zfast_crt_impl.inc similarity index 94% rename from crt/shaders/zfast_crt.slang rename to crt/shaders/zfast_crt/zfast_crt_impl.inc index bc66cea..66131b4 100644 --- a/crt/shaders/zfast_crt.slang +++ b/crt/shaders/zfast_crt/zfast_crt_impl.inc @@ -1,5 +1,3 @@ -#version 450 - /* zfast_crt_standard - A simple, fast CRT shader. @@ -52,10 +50,6 @@ layout(std140, set = 0, binding = 0) uniform UBO //#define FRAGMENT //#define VERTEX -//This can't be an option without slowing the shader down -//Comment this out for a coarser 3 pixel mask...which is currently broken -//on SNES Classic Edition due to Mali 400 gpu precision -#define FINEMASK //Some drivers don't return black with texture coordinates out of bounds //SNES Classic is too slow to black these areas out when using fullscreen //overlays. But you can uncomment the below to black them out if necessary diff --git a/crt/zfast-crt-hdmask.slangp b/crt/zfast-crt-hdmask.slangp new file mode 100644 index 0000000..acbc181 --- /dev/null +++ b/crt/zfast-crt-hdmask.slangp @@ -0,0 +1,4 @@ +shaders = 1 + +shader0 = shaders/zfast_crt/zfast_crt_coarsemask.slang +filter_linear0 = true diff --git a/crt/zfast-crt.slangp b/crt/zfast-crt.slangp index dd4afc3..e428734 100644 --- a/crt/zfast-crt.slangp +++ b/crt/zfast-crt.slangp @@ -1,4 +1,4 @@ shaders = 1 -shader0 = shaders/zfast_crt.slang +shader0 = shaders/zfast_crt/zfast_crt_finemask.slang filter_linear0 = true \ No newline at end of file