DirectX/Direct2D VirtualSurfaceImageSource render incorrectly draws Horizontal Pixels offset of refreshed area's height on new version of Windows 10 and Windows11

Sacha B 116 Reputation points
2022-04-11T05:22:50.32+00:00

Hello, and thanks in advance. The graphics engine I wrote is written in C++ Direct2D using VirtualSurfaceImageSource mainly to work in conjunction with XAML. The app has always worked perfect until the latest versions of Windows 10 and Windows 11.

I noticed that on newer versions of Windows 10 and on Windows 11, the DIrect2D graphics have a slight glitch. This never happened on older versions of Windows 10. I have even compiled versions of the app from 7+ years ago that worked just a perfectly on older versions of Windows. I compiled these and they had the same glitch on newer versions of Windows.

The issue is: when the texture is updated and renders a small, updated part of the image it for some reason Redraws all the pixels horizontally to the updated rectangle.

Even when BeginDraw(updateSize); only updates a small rectangle, still the entire set of pixels to the left and right of the updated area are strangely redrawn with an offset by 1 to 4 pixels. Sometimes strangely anti-aliased. This strange effect only lasts until the next small rectangle is updated and then the pixels return to normal but the same effect happens next to the newly updated rectangle. Those pixels that are being offset are definitely not in the "Updated" area. I have verified this on several older version of the app as well and the same thing happens going back to Windows 8.

Any help with solving this issue is greatly appreciated.

You may view the strange un-updated Pixel shift in the image below.

Thanks,
Sacha

191609-image.png

Here the Green drawn line is the refreshed area. See how the pixels to the left and right are offset. They are not in the BeginDraw rectangle:
191689-image.png

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,957 questions
Universal Windows Platform (UWP)
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,630 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sacha B 116 Reputation points
    2022-05-29T15:23:50.307+00:00

    Thanks to @Nico Zhu (Shanghai Wicresoft Co,.Ltd.) and for the valuable time that everyone at Microsoft put in for helping find this issue.

    Fix/Workaround:

    The fix for this issue: Change all VirtualSurfaceImageSource to SurfaceImageSource.

    The app is now working great!

    Thanks,
    Sacha

    2 people found this answer helpful.
    0 comments No comments