From ae5b71f64715468d62ed889788969697a24cd794 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Mon, 28 Dec 2020 19:32:29 +0100 Subject: Compute shader write to image --- shaders/compute.comp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'shaders/compute.comp') diff --git a/shaders/compute.comp b/shaders/compute.comp index b1f8fef..f0bb220 100644 --- a/shaders/compute.comp +++ b/shaders/compute.comp @@ -1,7 +1,15 @@ layout(set = 0, binding = 0) buffer Inputs { - vec3 [] positions; -} spheres_positions; + vec3 sky_color; + vec3 ground_color; + vec3 [1920 * 1080] image; +}; void main() { - spheres_positions.positions[0] = vec3(0.0); + uint x = gl_GlobalInvocationID.x; + uint y = gl_GlobalInvocationID.y; + uint width = gl_NumWorkGroups.x; + uint height = gl_NumWorkGroups.y; + + // image[y * width + x] = vec3(x / width, y / height, 0.0); + image[y * width + x] = vec3(255.0, 255.0, 0.0); } -- cgit v1.3