This post is very old. Please bear in mind that information here might be incorrect or obsolete, and links can be broken. If something seems wrong, please feel free to comment or contact me and I'll update the post.
If you’re debugging a shader, and the wrong pixels come grouped into (screen-aligned) 2×2 blocks, don’t look too long at the code at hand — it might be that your gradients are wrong. Recently, I had a shader aliasing problem, which I couldn’t track down properly. Even after hours of debugging with PIX, the shader output was still wrong for some reason. It was not a float-point precision problem, because even with Load (which uses integer coordinates and does no sampling), things wouldn’t change.
I went so far that I computed the texture lookups on paper and performed filtering by hand, just to check that the UVs and so were right. Well, everything was right, except the gradients, which were way off and resulting in some blurred pixels – always grouped into 2×2, and aligned with the screen. As I didn’t have them computed explicitly, there way no easy way to visualize them, and hence I missed them for several hours straight.
Related posts: