//	GGVRStereoscopicVisionTest.metal
//
//	© 2026 by Jeff Weeks
//	See TermsOfUse.txt

#include <metal_stdlib>
using namespace metal;

#include "GGVR_GPU_Definitions.h"


struct SVTVertexInput
{
	float3	pos [[ attribute(0) ]];	//	in bridge-of-nose space
};

struct SVTVertexOutput
{
	float4	position	[[ position ]];
};


vertex SVTVertexOutput SVTVertexFunction(
			 SVTVertexInput	in				[[ stage_in						]],
			 ushort			amp_id			[[ amplification_id				]],	//	strange name!
	constant float4x4		*viewProjection	[[ buffer(SVTViewProjection)	]])
{
	SVTVertexOutput	out;
	float4			positionInBridgeOfNoseSpace,
					positionInClipSpace;

	positionInBridgeOfNoseSpace = float4(in.pos, 1.0);

	positionInClipSpace
		= viewProjection[amp_id]
		* positionInBridgeOfNoseSpace;

	out.position = positionInClipSpace;

	return out;
}

fragment half4 SVTFragmentFunction(
	constant half3	& color	[[ buffer(SVTColor) ]])
{
	return half4(color, 1.0h);
}
