SPIRV-Cross/reference/shaders-msl/asm/frag/sample-and-compare.asm.frag
Hans-Kristian Arntzen a4ac27546a MSL: Fix textures which are sampled and compared against.
depth2d in MSL only returns float, not float4, even for normal sampling.
We need to conditionally remap-swizzle back to float4.
2019-02-22 12:27:40 +01:00

23 lines
587 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float out_var_SV_Target [[color(0)]];
};
struct main0_in
{
float2 in_var_TEXCOORD0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> g_Texture [[texture(0)]], sampler g_Sampler [[sampler(0)]], sampler g_CompareSampler [[sampler(1)]])
{
main0_out out = {};
out.out_var_SV_Target = float4(g_Texture.sample(g_Sampler, in.in_var_TEXCOORD0)).x + g_Texture.sample_compare(g_CompareSampler, in.in_var_TEXCOORD0, 0.5, level(0.0));
return out;
}