I'm trying to make tile effect from example on shadertoy (https://www.shadertoy.com/view/3llcRN) . Here is code on GLSL:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = (2.*fragCoord.xy - iResolution.xy)/iResolution.y;
fragColor = vec4( texture(iChannel0, uv ).rgba );
}
Here is my code on Metal:
kernel vec4 colorKernel(sampler source, float w, float h)
{
vec2 d = vec2(w, h);
vec2 uv = (2.*destCoord().xy - d.xy)/h;
return vec4( sample(source, uv).rgba );
}
And result:
What is missing? I need same result as on shadertoy
The problem is that when UV's coordinates bigger than 1 it returns just empty color