This question bothers me since the first time I got to know about derivatives in pixel shader. Suppose we have a 2d texture:
5 10 20 30
6 11 50 100
If I correctly understand, the derivatives for the pixel [0, 0] will be:
- dx = pixel[1, 0] - pixel[0, 0] = 10 - 5 = 5
- dy = pixel[0, 1] - pixel[0, 0] = 6 - 5 = 1
And this will be 100% guaranteed because gpu executes pixels in 2x2 block. But what is the dx-derivative for the pixel[1, 0]? The pixel right to it is from another block which maybe not executed yet? And what about pixel[3, 0]? It doesn't have a right neighbor at all!