1#version 450
2
3layout(push_constant) uniform Push
4{
5	vec4 SourceSize;
6	vec4 OriginalSize;
7	vec4 OutputSize;
8	uint FrameCount;
9} params;
10
11layout(std140, set = 0, binding = 0) uniform UBO
12{
13	mat4 MVP;
14} global;
15
16/////////////////////////////////  MIT LICENSE  ////////////////////////////////
17
18//  Copyright (C) 2014 TroggleMonkey
19//
20//  Permission is hereby granted, free of charge, to any person obtaining a copy
21//  of this software and associated documentation files (the "Software"), to
22//  deal in the Software without restriction, including without limitation the
23//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
24//  sell copies of the Software, and to permit persons to whom the Software is
25//  furnished to do so, subject to the following conditions:
26//
27//  The above copyright notice and this permission notice shall be included in
28//  all copies or substantial portions of the Software.
29//
30//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
36//  IN THE SOFTWARE.
37
38
39/////////////////////////////  SETTINGS MANAGEMENT  ////////////////////////////
40
41//  PASS SETTINGS:
42//  gamma-management.h needs to know what kind of pipeline we're using and
43//  what pass this is in that pipeline.  This will become obsolete if/when we
44//  can #define things like this in the .cgp preset file.
45//#define GAMMA_ENCODE_EVERY_FBO
46//#define FIRST_PASS
47//#define LAST_PASS
48//#define SIMULATE_CRT_ON_LCD
49//#define SIMULATE_GBA_ON_LCD
50//#define SIMULATE_LCD_ON_CRT
51//#define SIMULATE_GBA_ON_CRT
52
53///////////////////////////////  VERTEX INCLUDES  ///////////////////////////////
54
55#include "../include/compat_macros.inc"
56#pragma stage vertex
57#include "vertex-shader-blur-one-pass.h"
58
59///////////////////////////////  FRAGMENT SHADER  //////////////////////////////
60
61#pragma stage fragment
62layout(location = 0) in vec2 tex_uv;
63layout(location = 1) in vec2 blur_dxdy;
64layout(location = 0) out vec4 FragColor;
65layout(set = 0, binding = 2) uniform sampler2D Source;
66#define input_texture Source
67
68/////////////////////////////  FRAGMENT INCLUDES  /////////////////////////////
69#include "../include/gamma-management.h"
70#include "../include/blur-functions.h"
71
72void main()
73{
74	vec3 color = tex2Dblur3x3(Source, tex_uv, blur_dxdy);
75    //  Encode and output the blurred image:
76   FragColor = encode_output(vec4(color, 1.0));
77}