Harbor

branch main
showing the latest snapshot on main
discard_select.msl 611 B · Plain text
gpu/shader/tests/golden/discard_select.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);
	if ((color.a < 0.1)) {
		discard_fragment();
	}
	float bright = select(0.0, 1.0, (color.r > 0.5));
	__luma_output._value = float4((color.rgb * bright), color.a);
	return __luma_output;
}