Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High-resolution images display abnormally in Software rendering mode #10139

Open
JerryJian opened this issue Dec 4, 2024 · 1 comment
Open
Labels
Investigate Requires further investigation by the WPF team.

Comments

@JerryJian
Copy link

Description

I have a png image with a height of more than 40,000 pixels, which is displayed in a WPF interface. When scrolling to the back part, the display is abnormal.

When I set the render mode to software, the image will be blue on the screen when scrolling down.
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

When I set the render mode to default, the program crashed with exception thrown:

System.Runtime.InteropServices.COMException
  HResult=0x88980406
  Message=UCEERR_RENDERTHREADFAILURE (异常来自 HRESULT:0x88980406)
  Source=PresentationCore
  StackTrace:
   在 System.Windows.Media.Composition.DUCE.Channel.SyncFlush() 在 System.Windows.Media.Composition\DUCE.cs 中: 第 241 行
   在 System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet) 在 System.Windows.Interop\HwndTarget.cs 中: 第 1386 行
   在 System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam) 在 System.Windows.Interop\HwndTarget.cs 中: 第 1278 行
   在 System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam) 在 System.Windows.Interop\HwndTarget.cs 中: 第 800 行
   在 System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 System.Windows.Interop\HwndSource.cs 中: 第 1018 行
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Reproduction Steps

The source code is here: JerryJian/LargeImageTest

  1. Change App.xaml.cs: RenderOptions.ProcessRenderMode = RenderMode.Software;

  2. Compile the program, launch it

  3. Scroll down, the screen become blue

  4. Change App.xaml.cs: RenderOptions.ProcessRenderMode = RenderMode.Default;

  5. Compile the program, launch it

  6. Exception thrown on my computer

My system information:

Operating System: Windows Pro 11 24H2,
Version: 26100.2454,
Experience pack: 1000.26100.36.0

Graphics Card: NVIDIA GeForce GTX 1650
Driver version: 32.0.15.6094
DirectX version: 12 (FL 12.1)

Expected behavior

The large image display well when render mode is software.

Actual behavior

The large image displays abnormally.

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

@miloush
Copy link
Contributor

miloush commented Dec 4, 2024

Initial notes: 32768 offset works, 32769 breaks for me. That is very suspiciously close to short.MaxValue. Not related to scrolling, translate render transform exhibits the same, and since there is no overflow exception I am guessing there is some short offset in the native code. CroppedBitmap works as expected.

@himgoyalmicro himgoyalmicro added the Investigate Requires further investigation by the WPF team. label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Requires further investigation by the WPF team.
Projects
None yet
Development

No branches or pull requests

3 participants