#version 450 /* * Kiyo data * - WORKGROUP_SIZE and NUM_IMAGES are provided by the engine */ layout ( local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1 ) in; layout( binding = 0, rgba8 ) uniform image2D images[NUM_IMAGES]; layout( push_constant ) uniform PushConstants { float time; int in_image; int out_image; } constants; /* * User data */ void main() { ivec2 p = ivec2( gl_GlobalInvocationID.xy ); ivec2 screenSize = imageSize( images[ constants.out_image ] ); if( p.x > screenSize.x || p.y > screenSize.y ) { return; } // Generate a grid vec3 pos = vec3( float( p.x ) / float( screenSize.x ), float( p.y ) / float( screenSize.y ), 0.0f ) - 0.5f; vec3 color = vec3( round( sin( pos.x * 500.0f ) ), round( sin( pos.y * 500.0f ) ), 0.0f ); imageStore( images[ constants.out_image ], p, vec4( color, 1 ) ); }