aboutsummaryrefslogtreecommitdiffstats
path: root/shaders/compute.comp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2020-12-29 19:18:09 +0100
committerladevieq <ladevie.quentin@gmail.com>2020-12-29 19:18:09 +0100
commite22af9e7d0633c8237ed802404c6ccab472eb458 (patch)
treefc09a1c5b790f3c04343df4a2c873a2d41d6e7fb /shaders/compute.comp
parent5768c16bd01900d1eb34873a44d231011d0b744b (diff)
Gradient clear color
Diffstat (limited to 'shaders/compute.comp')
-rw-r--r--shaders/compute.comp8
1 files changed, 7 insertions, 1 deletions
diff --git a/shaders/compute.comp b/shaders/compute.comp
index 10123dc..8126536 100644
--- a/shaders/compute.comp
+++ b/shaders/compute.comp
@@ -1,6 +1,9 @@
layout(set = 0, binding = 0) buffer Inputs {
vec3 sky_color;
vec3 ground_color;
+ float viewport_width;
+ float viewport_height;
+ vec2 padding;
vec3 [1920 * 1080] image;
};
@@ -10,5 +13,8 @@ void main() {
uint width = gl_NumWorkGroups.x;
uint height = gl_NumWorkGroups.y;
- image[y * width + x] = vec3(float (x) / width, float (y) / height, 0.0);
+ vec2 uv = vec2(float(x) / width, 1.0 - float(y) / height);
+ vec2 ndc = vec2(uv * 2.0 - 1.0);
+
+ image[y * width + x] = mix(ground_color, sky_color, uv.y);
}