aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'render/vulkan/shaders')
-rw-r--r--render/vulkan/shaders/meson.build1
-rw-r--r--render/vulkan/shaders/output.frag21
2 files changed, 22 insertions, 0 deletions
diff --git a/render/vulkan/shaders/meson.build b/render/vulkan/shaders/meson.build
index 906618c2..50f4a1f0 100644
--- a/render/vulkan/shaders/meson.build
+++ b/render/vulkan/shaders/meson.build
@@ -2,6 +2,7 @@ vulkan_shaders_src = [
'common.vert',
'texture.frag',
'quad.frag',
+ 'output.frag',
]
vulkan_shaders = []
diff --git a/render/vulkan/shaders/output.frag b/render/vulkan/shaders/output.frag
new file mode 100644
index 00000000..28a8cdc5
--- /dev/null
+++ b/render/vulkan/shaders/output.frag
@@ -0,0 +1,21 @@
+#version 450
+
+layout (input_attachment_index = 0, binding = 0) uniform subpassInput in_color;
+
+layout(location = 0) in vec2 uv;
+layout(location = 0) out vec4 out_color;
+
+float linear_to_srgb(float x) {
+ return max(min(x * 12.92, 0.04045), 1.055 * pow(x, 1. / 2.4) - 0.055);
+}
+
+void main() {
+ vec4 val = subpassLoad(in_color).rgba;
+ out_color = vec4(
+ linear_to_srgb(val.r),
+ linear_to_srgb(val.g),
+ linear_to_srgb(val.b),
+ val.a
+ );
+}
+