Harbor

branch main
showing the latest snapshot on main
varying_test.msl 961 B · Plain text
shader/tests/golden/varying_test.msl 0644 Raw
#include <metal_stdlib>
using namespace metal;

struct Uniforms {
	float4x4 mvp;
};

struct VertexInput {
	float3 position [[attribute(0)]];
	float2 uv [[attribute(1)]];
};

struct Interpolated {
	float4 position [[position]];
	float2 uv [[user(locn0)]];
	float3 normal [[user(locn1)]];
};

struct Interpolated_In {
	float2 uv [[user(locn0)]];
	float3 normal [[user(locn1)]];
};

struct FragmentOutput {
	float4 color [[user(locn0)]];
};

vertex Interpolated_In vs_main(VertexInput input [[stage_in]],
	constant Uniforms& uniforms [[buffer(0)]]) {
	Interpolated_In __luma_output;
	float4 clip_pos = (uniforms.mvp * float4(input.position, 1.0));
	__luma_output.position = clip_pos;
	__luma_output.uv = input.uv;
	__luma_output.normal = float3(0.0, 1.0, 0.0);
	return __luma_output;
}

fragment FragmentOutput fs_main(Interpolated_In input [[stage_in]]) {
	FragmentOutput __luma_output;
	__luma_output.color = float4(input.uv, 0.0, 1.0);
	return __luma_output;
}