@group(0) @binding(0) var<storage, read> viewProjection : array<f32>;

struct VertexOutput {
	@builtin(position) position : vec4<f32>,
	@location(0) color : vec3<f32>,
};

fn loadViewProjection( ) -> mat4x4<f32> {

	return mat4x4<f32>(
		vec4<f32>( viewProjection[ 0 ],  viewProjection[ 1 ],  viewProjection[ 2 ],  viewProjection[ 3 ] ),
		vec4<f32>( viewProjection[ 4 ],  viewProjection[ 5 ],  viewProjection[ 6 ],  viewProjection[ 7 ] ),
		vec4<f32>( viewProjection[ 8 ],  viewProjection[ 9 ],  viewProjection[ 10 ], viewProjection[ 11 ] ),
		vec4<f32>( viewProjection[ 12 ], viewProjection[ 13 ], viewProjection[ 14 ], viewProjection[ 15 ] )
	);

}

@vertex
fn v_main(
	@location(0) position : vec3<f32>,
	@location(1) color    : vec3<f32>
) -> VertexOutput {

	var output : VertexOutput;

	let vp : mat4x4<f32> = loadViewProjection();

	output.position = vp * vec4<f32>( position, 1.0 );

	output.color = color;

	return output;

}

@fragment
fn f_main( input : VertexOutput ) -> @location(0) vec4<f32> {

	return vec4<f32>( input.color, 1.0 );

}
