From 125e1a2bb433b3416653a91518bda0bba5ee97bb Mon Sep 17 00:00:00 2001 From: hunterk Date: Wed, 15 Jan 2020 16:00:30 -0600 Subject: [PATCH] add blur43fast shaders --- ...st-horizontal-gamma-encode-every-fbo.slang | 77 +++++++++++++++++++ ...tal-last-pass-gamma-encode-every-fbo.slang | 77 +++++++++++++++++++ blurs/blur43fast-horizontal-last-pass.slang | 77 +++++++++++++++++++ blurs/blur43fast-horizontal.slang | 77 +++++++++++++++++++ ...fast-vertical-gamma-encode-every-fbo.slang | 77 +++++++++++++++++++ blurs/blur43fast-vertical.slang | 77 +++++++++++++++++++ 6 files changed, 462 insertions(+) create mode 100644 blurs/blur43fast-horizontal-gamma-encode-every-fbo.slang create mode 100644 blurs/blur43fast-horizontal-last-pass-gamma-encode-every-fbo.slang create mode 100644 blurs/blur43fast-horizontal-last-pass.slang create mode 100644 blurs/blur43fast-horizontal.slang create mode 100644 blurs/blur43fast-vertical-gamma-encode-every-fbo.slang create mode 100644 blurs/blur43fast-vertical.slang diff --git a/blurs/blur43fast-horizontal-gamma-encode-every-fbo.slang b/blurs/blur43fast-horizontal-gamma-encode-every-fbo.slang new file mode 100644 index 0000000..6baa161 --- /dev/null +++ b/blurs/blur43fast-horizontal-gamma-encode-every-fbo.slang @@ -0,0 +1,77 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +///////////////////////////////// MIT LICENSE //////////////////////////////// + +// Copyright (C) 2014 TroggleMonkey +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + + +///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// + +// PASS SETTINGS: +// gamma-management.h needs to know what kind of pipeline we're using and +// what pass this is in that pipeline. This will become obsolete if/when we +// can #define things like this in the .cgp preset file. +#define GAMMA_ENCODE_EVERY_FBO +//#define FIRST_PASS +//#define LAST_PASS +//#define SIMULATE_CRT_ON_LCD +//#define SIMULATE_GBA_ON_LCD +//#define SIMULATE_LCD_ON_CRT +//#define SIMULATE_GBA_ON_CRT + +/////////////////////////////// VERTEX INCLUDES /////////////////////////////// + +#include "../include/compat_macros.inc" +#pragma stage vertex +#include "vertex-shader-blur-fast-horizontal.h" + +/////////////////////////////// FRAGMENT SHADER ////////////////////////////// + +#pragma stage fragment +layout(location = 0) in vec2 tex_uv; +layout(location = 1) in vec2 blur_dxdy; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +#define input_texture Source + +///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// +#include "../include/gamma-management.h" +#include "../include/blur-functions.h" + +void main() +{ + vec3 color = tex2Dblur43fast(Source, tex_uv, blur_dxdy); + // Encode and output the blurred image: + FragColor = encode_output(vec4(color, 1.0)); +} \ No newline at end of file diff --git a/blurs/blur43fast-horizontal-last-pass-gamma-encode-every-fbo.slang b/blurs/blur43fast-horizontal-last-pass-gamma-encode-every-fbo.slang new file mode 100644 index 0000000..8acc03b --- /dev/null +++ b/blurs/blur43fast-horizontal-last-pass-gamma-encode-every-fbo.slang @@ -0,0 +1,77 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +///////////////////////////////// MIT LICENSE //////////////////////////////// + +// Copyright (C) 2014 TroggleMonkey +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + + +///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// + +// PASS SETTINGS: +// gamma-management.h needs to know what kind of pipeline we're using and +// what pass this is in that pipeline. This will become obsolete if/when we +// can #define things like this in the .cgp preset file. +#define GAMMA_ENCODE_EVERY_FBO +//#define FIRST_PASS +#define LAST_PASS +//#define SIMULATE_CRT_ON_LCD +//#define SIMULATE_GBA_ON_LCD +//#define SIMULATE_LCD_ON_CRT +//#define SIMULATE_GBA_ON_CRT + +/////////////////////////////// VERTEX INCLUDES /////////////////////////////// + +#include "../include/compat_macros.inc" +#pragma stage vertex +#include "vertex-shader-blur-fast-horizontal.h" + +/////////////////////////////// FRAGMENT SHADER ////////////////////////////// + +#pragma stage fragment +layout(location = 0) in vec2 tex_uv; +layout(location = 1) in vec2 blur_dxdy; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +#define input_texture Source + +///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// +#include "../include/gamma-management.h" +#include "../include/blur-functions.h" + +void main() +{ + vec3 color = tex2Dblur43fast(Source, tex_uv, blur_dxdy); + // Encode and output the blurred image: + FragColor = encode_output(vec4(color, 1.0)); +} \ No newline at end of file diff --git a/blurs/blur43fast-horizontal-last-pass.slang b/blurs/blur43fast-horizontal-last-pass.slang new file mode 100644 index 0000000..eae1ff5 --- /dev/null +++ b/blurs/blur43fast-horizontal-last-pass.slang @@ -0,0 +1,77 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +///////////////////////////////// MIT LICENSE //////////////////////////////// + +// Copyright (C) 2014 TroggleMonkey +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + + +///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// + +// PASS SETTINGS: +// gamma-management.h needs to know what kind of pipeline we're using and +// what pass this is in that pipeline. This will become obsolete if/when we +// can #define things like this in the .cgp preset file. +//#define GAMMA_ENCODE_EVERY_FBO +//#define FIRST_PASS +#define LAST_PASS +//#define SIMULATE_CRT_ON_LCD +//#define SIMULATE_GBA_ON_LCD +//#define SIMULATE_LCD_ON_CRT +//#define SIMULATE_GBA_ON_CRT + +/////////////////////////////// VERTEX INCLUDES /////////////////////////////// + +#include "../include/compat_macros.inc" +#pragma stage vertex +#include "vertex-shader-blur-fast-horizontal.h" + +/////////////////////////////// FRAGMENT SHADER ////////////////////////////// + +#pragma stage fragment +layout(location = 0) in vec2 tex_uv; +layout(location = 1) in vec2 blur_dxdy; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +#define input_texture Source + +///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// +#include "../include/gamma-management.h" +#include "../include/blur-functions.h" + +void main() +{ + vec3 color = tex2Dblur43fast(Source, tex_uv, blur_dxdy); + // Encode and output the blurred image: + FragColor = encode_output(vec4(color, 1.0)); +} \ No newline at end of file diff --git a/blurs/blur43fast-horizontal.slang b/blurs/blur43fast-horizontal.slang new file mode 100644 index 0000000..dc9a31e --- /dev/null +++ b/blurs/blur43fast-horizontal.slang @@ -0,0 +1,77 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +///////////////////////////////// MIT LICENSE //////////////////////////////// + +// Copyright (C) 2014 TroggleMonkey +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + + +///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// + +// PASS SETTINGS: +// gamma-management.h needs to know what kind of pipeline we're using and +// what pass this is in that pipeline. This will become obsolete if/when we +// can #define things like this in the .cgp preset file. +//#define GAMMA_ENCODE_EVERY_FBO +//#define FIRST_PASS +//#define LAST_PASS +//#define SIMULATE_CRT_ON_LCD +//#define SIMULATE_GBA_ON_LCD +//#define SIMULATE_LCD_ON_CRT +//#define SIMULATE_GBA_ON_CRT + +/////////////////////////////// VERTEX INCLUDES /////////////////////////////// + +#include "../include/compat_macros.inc" +#pragma stage vertex +#include "vertex-shader-blur-fast-horizontal.h" + +/////////////////////////////// FRAGMENT SHADER ////////////////////////////// + +#pragma stage fragment +layout(location = 0) in vec2 tex_uv; +layout(location = 1) in vec2 blur_dxdy; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +#define input_texture Source + +///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// +#include "../include/gamma-management.h" +#include "../include/blur-functions.h" + +void main() +{ + vec3 color = tex2Dblur43fast(Source, tex_uv, blur_dxdy); + // Encode and output the blurred image: + FragColor = encode_output(vec4(color, 1.0)); +} \ No newline at end of file diff --git a/blurs/blur43fast-vertical-gamma-encode-every-fbo.slang b/blurs/blur43fast-vertical-gamma-encode-every-fbo.slang new file mode 100644 index 0000000..909c58f --- /dev/null +++ b/blurs/blur43fast-vertical-gamma-encode-every-fbo.slang @@ -0,0 +1,77 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +///////////////////////////////// MIT LICENSE //////////////////////////////// + +// Copyright (C) 2014 TroggleMonkey +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + + +///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// + +// PASS SETTINGS: +// gamma-management.h needs to know what kind of pipeline we're using and +// what pass this is in that pipeline. This will become obsolete if/when we +// can #define things like this in the .cgp preset file. +#define GAMMA_ENCODE_EVERY_FBO +//#define FIRST_PASS +//#define LAST_PASS +//#define SIMULATE_CRT_ON_LCD +//#define SIMULATE_GBA_ON_LCD +//#define SIMULATE_LCD_ON_CRT +//#define SIMULATE_GBA_ON_CRT + +/////////////////////////////// VERTEX INCLUDES /////////////////////////////// + +#include "../include/compat_macros.inc" +#pragma stage vertex +#include "vertex-shader-blur-fast-vertical.h" + +/////////////////////////////// FRAGMENT SHADER ////////////////////////////// + +#pragma stage fragment +layout(location = 0) in vec2 tex_uv; +layout(location = 1) in vec2 blur_dxdy; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +#define input_texture Source + +///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// +#include "../include/gamma-management.h" +#include "../include/blur-functions.h" + +void main() +{ + vec3 color = tex2Dblur43fast(Source, tex_uv, blur_dxdy); + // Encode and output the blurred image: + FragColor = encode_output(vec4(color, 1.0)); +} \ No newline at end of file diff --git a/blurs/blur43fast-vertical.slang b/blurs/blur43fast-vertical.slang new file mode 100644 index 0000000..25d9c3a --- /dev/null +++ b/blurs/blur43fast-vertical.slang @@ -0,0 +1,77 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +///////////////////////////////// MIT LICENSE //////////////////////////////// + +// Copyright (C) 2014 TroggleMonkey +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + + +///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// + +// PASS SETTINGS: +// gamma-management.h needs to know what kind of pipeline we're using and +// what pass this is in that pipeline. This will become obsolete if/when we +// can #define things like this in the .cgp preset file. +//#define GAMMA_ENCODE_EVERY_FBO +//#define FIRST_PASS +//#define LAST_PASS +//#define SIMULATE_CRT_ON_LCD +//#define SIMULATE_GBA_ON_LCD +//#define SIMULATE_LCD_ON_CRT +//#define SIMULATE_GBA_ON_CRT + +/////////////////////////////// VERTEX INCLUDES /////////////////////////////// + +#include "../include/compat_macros.inc" +#pragma stage vertex +#include "vertex-shader-blur-fast-vertical.h" + +/////////////////////////////// FRAGMENT SHADER ////////////////////////////// + +#pragma stage fragment +layout(location = 0) in vec2 tex_uv; +layout(location = 1) in vec2 blur_dxdy; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; +#define input_texture Source + +///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// +#include "../include/gamma-management.h" +#include "../include/blur-functions.h" + +void main() +{ + vec3 color = tex2Dblur43fast(Source, tex_uv, blur_dxdy); + // Encode and output the blurred image: + FragColor = encode_output(vec4(color, 1.0)); +} \ No newline at end of file