I have a compute shader that samples a depth sampler2D, however when using texture() the result is weird with some jagged edges. If I use texelFetch() then it works fine, so I would guess its an issue with getting the correct texture coordinates? FYI the sampler uses nearest filtering and has no mips.
This is how the result looks when using texelFetch:


