Harbor

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

struct _fs_main_Input {
	float2 uv [[user(locn0)]];
};

struct _fs_main_Output {
	float4 _value [[user(locn0)]];
};

fragment _fs_main_Output fs_main(_fs_main_Input input [[stage_in]],
	texture2d<float> albedo_tex_tex [[texture(0)]],
	sampler albedo_tex_samp [[sampler(0)]]) {
	_fs_main_Output __luma_output;
	float4 color = albedo_tex_tex.sample(albedo_tex_samp, input.uv);
	float dx = dfdx(color.r);
	float dy = dfdy(color.r);
	float fw = fwidth(color.r);
	float edge = step(0.1, fw);
	__luma_output._value = float4((color.rgb * (1.0 - edge)), color.a);
	return __luma_output;
}