JUCE 8 Direct2D + High refresh rates problem

The new Direct2D stuff seems to be working really nicely for me so far. However, I’ve found a condition where it doesn’t work well.

If I set Windows’ refresh rate to 240 Hz and use my laptop’s internal graphics card (Intel Iris Xe) then things do not render correctly, even in the Projucer. Changing to 60 Hz and everything works fine, as far as I can tell. Here is what it looks like when I scroll down and back up:

It seems like something isn’t getting cleared correctly. I also see simple sliders being very buggy when getting dragged, jumping back to previous positions temporarily.

In my own plugins this only happens with Direct2D. Using the software renderer things are smooth, like in JUCE 7.

Using NVIDEA GForce RTX 3060 things work fine, regardless of whether refresh rate is set to 60 Hz or 240 Hz in Windows settings (I’m not sure if this uses 240 Hz refresh rate, though).

I don’t know how many people use such high refresh rates but if there is a solution to this that would be great :slight_smile:

We have similar problems. If the current paint takes longer than one vblank, anything that moves doesn’t get painted correctly.

I’ve used the repaint ( rect ) function, and it seems that this dirty rect is forgotten if the vblank is missed.

2 Likes

Thanks for reporting, both of you. I wasn’t able to reproduce the issue exactly as stated (I don’t have a Windows machine with a high-refresh-rate screen), but I did find that graphically-intensive apps encountered similar issues over remote desktop.

As far as I can tell, there were a couple of subtle edge-cases in the code that handled offscreen buffers before their content was copied to the D2D backbuffer, which occasionally resulted in the dirty regions and content from frames being discarded or used out-of-order.

There’s a potential fix here, which resolves the issues I was seeing with apps rendered over RDP:

Please try this out and let us know how you get on.

Much smoother for me! Now no difference between refresh rates. Thanks so much for this fix :slight_smile:

2 Likes

Works fine now. No more “left-overs” on the screen.

3 Likes