2 Replies Latest reply on Mar 7, 2012 1:12 PM by Byron

    VSync, oh VSync, please just VSync!

    dexfx

      So, I'm in the middle of this XNA 4.0 project and I've hit this problem that I can't get rid of. It is very strange and I suspect it has something to do with the ATI hardware. I have seen others mention similar issues but I have yet to find anything that solves it.

       

      Basically what is happening is that I am getting this terrible tearing or shearing artifact. VSync is ON. The top about 1/3 of the screen seems to lag at least one frame behind the rest of the screen, and it terribly "jumpy" (as if it's not doing it every frame). The tear line seems to stay in roughly the same place all the time (not like typical VSync-off tearing, which happens all up and down the screen).

       

      I am not rendering anything too complex - I'm using SM2.0, XNA Reach profile (DX 9.0c) - drawing a skybox, some terrain, and a few other objects, with some standard kind of normal mapping (also some skinning). It seems to be an intermittent problem, mostly occurring in fullscreen mode. One second it could be fine, the next it's happening again.

       

      But the problem doesn't end there - when this problem is in the process of happening, it throws off all the timing of my game, which causes the physics to stutter really bad. Actually the physics themselves are running smoothly (since it has internal fixed timestep), but it just seems to be the rendering of the moving objects... The timing is so "all over the place", that I even set a breakpoint in my code if the elapsed frame time drops below 1/100th of a second, which it regularly hits when doing this. Which is preposterous, since the VSync should be limiting it to 60fps.....

       

      On the timing note, I have a counter displayed which is showing the elapsed time since the last frame, and the fps. When it's not doing this tearing thing, the elapsed time is rock solid and I can't see it changing at all. But when it is tearing, the elapsed frame time is jumping all over the place!

       

      The processing time for one frame is quite negligible. Without VSync on, it renders many thousands of frames per second. It should be keeping up with the VSync with no problems at all.

       

      I tried to capture this effect with Fraps, but even while the tearing is happening, it can't be seen in the Fraps recording. Which makes me think that maybe it has something to do with the GPU and monitor sync?

       

      I have noticed the same issue when playing commercial games, too, eg. Skyrim, SWTOR, Assasin's Creed (the only games I've really played lately, I always have VSync on in them). But somehow this issue doesn't seem to affect their animation like it does in my game. I tried using QueryPerformanceCounter method to base my timing off (thinking that maybe the timing issue is with XNA), but I had the exact same issue with that. The update and draw methods really are being called at crazy times.

       

      The specs of this machine are:

      i7920, HD5870x2, 6GB RAM, Win7 x64

       

      And in case anyone was wondering, yes I did try disabling crossfire. Same problem, timings going crazy and everything.

       

      I really hope someone has some bright idea about what might be going wrong here, this is driving me nuts!

      Thanks!

       

      [Edit]:

      I just found this post from 2010 that seems to describe almost the exact same issue but in a completely different context: http://devgurus.amd.com/message/1175825

        • Re: VSync, oh VSync, please just VSync!
          dexfx

          So, I've figured how to stop the crazy timings in XNA, I had to use IsFixedTimeStep=true on the Game class. It shouldn't be necessary though, since all my code uses delta times for animation..!

           

          But the tearing issue is still present. Most noticeably when in fullscreen mode. It's really quite bad, as it seems like the top part of the screen is missing every 2nd frame or more...

           

          Should I be submitting a bug report on this? I have no idea how to reproduce the issue or indeed what is causing it. I suspect it's a driver or hardware-related problem.