If you’re debugging a shader, and the wrong pixels come grouped into (screen-aligned) 2x2 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 2x2, 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.