aboutsummaryrefslogtreecommitdiffstats
path: root/shaders/compute.comp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-01-10 23:22:26 +0100
committerladevieq <ladevie.quentin@gmail.com>2021-01-10 23:22:26 +0100
commit843dbf7d8dca95883e563d3ba5c20d6b1ee7fd90 (patch)
tree9fe40a19409a3e30f8187acc27d9344400912b4a /shaders/compute.comp
parent94c1b2d414055f9a4ea203fb210666aa769d0096 (diff)
Attempt to write to swapchain image
Diffstat (limited to 'shaders/compute.comp')
-rw-r--r--shaders/compute.comp10
1 files changed, 6 insertions, 4 deletions
diff --git a/shaders/compute.comp b/shaders/compute.comp
index f179b63..2b08c5c 100644
--- a/shaders/compute.comp
+++ b/shaders/compute.comp
@@ -46,7 +46,7 @@ struct camera {
float[3] padding;
};
-layout(set = 0, binding = 0) buffer Inputs {
+layout(set = 0, binding = 0) uniform Inputs {
vec4 sky_color;
vec4 ground_color;
camera cam;
@@ -61,10 +61,10 @@ layout(set = 0, binding = 0) buffer Inputs {
uint samples_per_pixel;
uint width;
uint height;
-
- vec4[] image;
};
+layout(set = 0, binding = 1, rgba8) uniform writeonly image2D output_image;
+
vec3 at(ray r, float t) {
return r.origin + r.direction * t;
}
@@ -223,5 +223,7 @@ void main() {
}
float spp_scale = (1.0 / samples_per_pixel);
- image[y * width + x] = sqrt(out_color * spp_scale);
+ out_color = sqrt(out_color * spp_scale);
+ // image[y * width + x] = sqrt(out_color * spp_scale);
+ imageStore(output_image, ivec2(x, y), out_color);
}