From 843dbf7d8dca95883e563d3ba5c20d6b1ee7fd90 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sun, 10 Jan 2021 23:22:26 +0100 Subject: Attempt to write to swapchain image --- shaders/compute.comp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'shaders') 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); } -- cgit v1.3