SPIRV-Cross/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag
Hans-Kristian Arntzen 8066d13599 MSL: Rewrite propagated depth comparison state handling.
Far cleaner, and more correct to run the traversal twice.
Fixes a case where we propagate depth state through multiple functions.
2019-10-26 16:10:11 +02:00

30 lines
623 B
GLSL

#version 450
layout(set = 0, binding = 0) uniform texture2D uTexture;
layout(set = 0, binding = 1) uniform sampler uSampler;
layout(set = 0, binding = 2) uniform samplerShadow uSamplerShadow;
layout(location = 0) out float FragColor;
layout(location = 0) in vec3 vUV;
float sample_normal2(texture2D tex)
{
return texture(sampler2D(tex, uSampler), vUV.xy).x;
}
float sample_normal(texture2D tex)
{
return sample_normal2(tex);
}
float sample_comp(texture2D tex)
{
return texture(sampler2DShadow(tex, uSamplerShadow), vUV);
}
void main()
{
FragColor = sample_normal(uTexture);
FragColor += sample_comp(uTexture);
}