cbuffer CameraTransform : register(b0) {
	float4x4 View;
	float4x4 Projection;
	float4x4 ViewProj;			// Precomputed on a per-frame basis
};

// A special StructuredBuffer bound to register t24 is used to identify per-instance indexable transform matrices
struct sInstanceTransform {
	float4x4 World;
	float4x4 WorldViewProjection;
};
StructuredBuffer<sInstanceTransform> Transform : register(t24);


// Input / output structures
struct vs_in {
	float4		pos			: POSITION;
	uint		iID			: SV_InstanceId;
};

struct vs_out {
	float4 pos		: SV_POSITION;
};

/**
 * Standard vertex shader; this is used by both shader passes
 **/
vs_out MainVS(vs_in IN) {
	vs_out OUT;

	OUT.pos	= mul(IN.pos, mul(Transform[IN.iID].World, ViewProj));
	return OUT;
}

/**
 * Pixel shader for the first pass; draws the rendered mesh as a solid red.
 **/
float4 RedPS(vs_out IN) : SV_Target {
	return float4(1, 0, 0, 1);
}

/**
 * Pixel shader for the second pass; draws the rendered mesh as a solid medium green.
 **/
float4 GreenPS(vs_out IN) : SV_Target {
	return float4(0, 0.5, 0, 1);
}
