nothing works
This commit is contained in:
BIN
src/shaders/frag-color.spv
Normal file
BIN
src/shaders/frag-color.spv
Normal file
Binary file not shown.
BIN
src/shaders/frag-glyph.spv
Normal file
BIN
src/shaders/frag-glyph.spv
Normal file
Binary file not shown.
BIN
src/shaders/frag-sprite.spv
Normal file
BIN
src/shaders/frag-sprite.spv
Normal file
Binary file not shown.
BIN
src/shaders/frag-srgb.spv
Normal file
BIN
src/shaders/frag-srgb.spv
Normal file
Binary file not shown.
108
src/shaders/mod.rs
Normal file
108
src/shaders/mod.rs
Normal file
@@ -0,0 +1,108 @@
|
||||
pub mod vert_common {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "vertex",
|
||||
src: r"#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_pos;
|
||||
layout (location = 1) in vec2 in_uv;
|
||||
layout (location = 0) out vec2 out_uv;
|
||||
|
||||
void main() {
|
||||
out_uv = in_uv;
|
||||
gl_Position = vec4(in_pos * 2. - 1., 0., 1.);
|
||||
}
|
||||
",
|
||||
}
|
||||
}
|
||||
|
||||
pub mod frag_color {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "fragment",
|
||||
src: r"#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform ColorBlock {
|
||||
uniform vec4 in_color;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
out_color = in_color;
|
||||
}
|
||||
",
|
||||
}
|
||||
}
|
||||
|
||||
pub mod frag_glyph {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "fragment",
|
||||
src: r"#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D in_texture;
|
||||
|
||||
layout (set = 1, binding = 0) uniform ColorBlock {
|
||||
uniform vec4 in_color;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
float r = texture(in_texture, in_uv).r;
|
||||
out_color = vec4(r,r,r,r) * in_color;
|
||||
}
|
||||
",
|
||||
}
|
||||
}
|
||||
|
||||
pub mod frag_sprite {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "fragment",
|
||||
src: r"#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D in_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 c = texture(in_texture, in_uv);
|
||||
out_color.rgb = c.rgb;
|
||||
out_color.a = min((c.r + c.g + c.b)*100.0, 1.0);
|
||||
}
|
||||
",
|
||||
}
|
||||
}
|
||||
|
||||
pub mod frag_srgb {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "fragment",
|
||||
src: r"#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D in_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_color = texture(in_texture, in_uv);
|
||||
|
||||
bvec4 cutoff = lessThan(out_color, vec4(0.04045));
|
||||
vec4 higher = pow((out_color + vec4(0.055))/vec4(1.055), vec4(2.4));
|
||||
vec4 lower = out_color/vec4(12.92);
|
||||
|
||||
out_color = mix(higher, lower, cutoff);
|
||||
}
|
||||
",
|
||||
}
|
||||
}
|
||||
15
src/shaders/src/color.frag
Normal file
15
src/shaders/src/color.frag
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform ColorBlock {
|
||||
uniform vec4 in_color;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
out_color = in_color;
|
||||
}
|
||||
|
||||
12
src/shaders/src/common.vert
Normal file
12
src/shaders/src/common.vert
Normal file
@@ -0,0 +1,12 @@
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_pos;
|
||||
layout (location = 1) in vec2 in_uv;
|
||||
layout (location = 0) out vec2 out_uv;
|
||||
|
||||
void main() {
|
||||
out_uv = in_uv;
|
||||
gl_Position = vec4(in_pos * 2. - 1., 0., 1.);
|
||||
}
|
||||
|
||||
18
src/shaders/src/glyph.frag
Normal file
18
src/shaders/src/glyph.frag
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D in_texture;
|
||||
|
||||
layout (set = 0, binding = 1) uniform ColorBlock {
|
||||
uniform vec4 in_color;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
float r = texture(in_texture, in_uv).r;
|
||||
out_color = vec4(r,r,r,r) * in_color;
|
||||
}
|
||||
|
||||
14
src/shaders/src/sprite.frag
Normal file
14
src/shaders/src/sprite.frag
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D in_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_color = texture(in_texture, in_uv);
|
||||
out_color.a = 1.;
|
||||
}
|
||||
|
||||
19
src/shaders/src/srgb.frag
Normal file
19
src/shaders/src/srgb.frag
Normal file
@@ -0,0 +1,19 @@
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D in_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_color = texture(in_texture, in_uv);
|
||||
|
||||
bvec4 cutoff = lessThan(out_color, vec4(0.04045));
|
||||
vec4 higher = pow((out_color + vec4(0.055))/vec4(1.055), vec4(2.4));
|
||||
vec4 lower = out_color/vec4(12.92);
|
||||
|
||||
out_color = mix(higher, lower, cutoff);
|
||||
}
|
||||
|
||||
BIN
src/shaders/vert-common.spv
Normal file
BIN
src/shaders/vert-common.spv
Normal file
Binary file not shown.
Reference in New Issue
Block a user