multisample render target ddx ddy bug in texture sampling

On iphoneX and iphone8, we use multisample rendertarget and the texture sample result has some error.


We set the sample count to 2. In PS shader, all ps_input struct variables' attributes are set to be sample_perspective. Then we find that the ddx and ddy on the edge of triangle rasterazation is wrong, which leads to mip computation error and texture sample result error. When forcing the sample mip level to 0, no such bug occurs. We use dfdx and dfdy to test the ddx and ddy value. The ddx and ddy error occurs on the edge of neighbor triangles and the edge of two triangles which one overlaps the other partially.


We try to change sample_perspective to center_perspective, and no bug occurs. So we think that when using multisample rendertarget and using sample_perspective attribute in ps shader, the ddx and ddy on edge of triangle rasterazation is wrong. Does Any one know how to solve this bug?


Our development software version:

xcode : version10.1

iphonex: ios 12.1

iphone8: ios 12


On iphone6s, ipad air2, ipad pro10.5 and ipad pro13, there is no such bug and everything is ok.