2020-11-18 18:11:30 +00:00
|
|
|
/* clang-format off */
|
2021-11-16 15:25:42 +00:00
|
|
|
#[modes]
|
|
|
|
|
2022-05-18 15:04:41 +00:00
|
|
|
mode_default = #define MODE_SIMPLE_COPY
|
2022-10-13 00:55:01 +00:00
|
|
|
mode_copy_section = #define USE_COPY_SECTION \n#define MODE_SIMPLE_COPY
|
2022-05-18 15:04:41 +00:00
|
|
|
mode_gaussian_blur = #define MODE_GAUSSIAN_BLUR
|
|
|
|
mode_mipmap = #define MODE_MIPMAP
|
|
|
|
mode_simple_color = #define MODE_SIMPLE_COLOR \n#define USE_COPY_SECTION
|
2021-11-16 15:25:42 +00:00
|
|
|
|
|
|
|
#[specializations]
|
|
|
|
|
|
|
|
#[vertex]
|
2020-11-18 18:11:30 +00:00
|
|
|
|
2022-05-18 15:04:41 +00:00
|
|
|
layout(location = 0) in vec2 vertex_attrib;
|
2020-11-18 18:11:30 +00:00
|
|
|
|
2021-10-26 15:18:39 +00:00
|
|
|
out vec2 uv_interp;
|
2022-05-18 15:04:41 +00:00
|
|
|
/* clang-format on */
|
2020-11-18 18:11:30 +00:00
|
|
|
|
|
|
|
#ifdef USE_COPY_SECTION
|
|
|
|
uniform highp vec4 copy_section;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void main() {
|
2022-05-18 15:04:41 +00:00
|
|
|
uv_interp = vertex_attrib * 0.5 + 0.5;
|
|
|
|
gl_Position = vec4(vertex_attrib, 1.0, 1.0);
|
2020-11-18 18:11:30 +00:00
|
|
|
|
|
|
|
#ifdef USE_COPY_SECTION
|
2022-10-13 00:55:01 +00:00
|
|
|
gl_Position.xy = (copy_section.xy + uv_interp.xy * copy_section.zw) * 2.0 - 1.0;
|
2020-11-18 18:11:30 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clang-format off */
|
2021-11-16 15:25:42 +00:00
|
|
|
#[fragment]
|
2020-11-18 18:11:30 +00:00
|
|
|
|
2021-10-26 15:18:39 +00:00
|
|
|
in vec2 uv_interp;
|
2020-11-18 18:11:30 +00:00
|
|
|
/* clang-format on */
|
2022-05-18 15:04:41 +00:00
|
|
|
#ifdef MODE_SIMPLE_COLOR
|
|
|
|
uniform vec4 color_in;
|
2020-11-18 18:11:30 +00:00
|
|
|
#endif
|
|
|
|
|
2022-05-18 15:04:41 +00:00
|
|
|
#ifdef MODE_GAUSSIAN_BLUR
|
|
|
|
uniform highp vec2 pixel_size;
|
2020-11-18 18:11:30 +00:00
|
|
|
#endif
|
|
|
|
|
2022-05-18 15:04:41 +00:00
|
|
|
uniform sampler2D source; // texunit:0
|
2020-11-18 18:11:30 +00:00
|
|
|
|
2021-10-26 15:18:39 +00:00
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
|
|
|
2020-11-18 18:11:30 +00:00
|
|
|
void main() {
|
2022-05-18 15:04:41 +00:00
|
|
|
#ifdef MODE_SIMPLE_COPY
|
2021-10-26 15:18:39 +00:00
|
|
|
vec4 color = texture(source, uv_interp);
|
2022-05-18 15:04:41 +00:00
|
|
|
frag_color = color;
|
2020-11-18 18:11:30 +00:00
|
|
|
#endif
|
|
|
|
|
2022-05-18 15:04:41 +00:00
|
|
|
#ifdef MODE_SIMPLE_COLOR
|
|
|
|
frag_color = color_in;
|
2020-11-18 18:11:30 +00:00
|
|
|
#endif
|
|
|
|
}
|