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

Enhancement of RenderTargetBitmap to Support Hardware Rendering #9024

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DearVa
Copy link

@DearVa DearVa commented Apr 13, 2024

Fixes #9021

Description

In WPF, RenderTargetBitmap (also RTB) currently only supports software rendering. This limitation leads to performance bottlenecks and causes ShaderEffect implementations to become ineffective. Enhancing RTB to support hardware rendering would provide significant performance improvements and enable high-quality rendering features that are currently restricted. This limitation has been extensively discussed in the past (#144, Add optional hardware acceleration to RenderTargetBitmap and some website was lost: RenderTargetBitmap and Hardware WPF Rendering).

As a developer who is proficient in graphics and C#, one of my requirements is to export WPF-rendered UI as video efficiently. Current methods such as using BitmapCache (which cannot retrieve content back to memory) and hooking DirectX APIs (which is complex and unstable) are not feasible solutions.

Customer Impact

RenderTargetBitmap will only support software rendering and may experience performance bottlenecks as well as ShaderEffect not working as expected.

Regression

No

Testing

Additional tests may need to be added to verify that it behaves correctly with different drivers (no graphics, integrated graphics, discrete graphics) and in the event of missing devices, etc. May also need to check for potential memory leaks.

Risk

Due to API changes, PixelFormats.Prgba128Float will no longer be supported when creating a RenderTargetBitmap.

Although code can fall back to software when no hardware device context is acquired, this needs to be extensively verified. May also need to check for potential memory leaks.

This is a huge change, but I think it deserves to be discussed in depth and considered carefully!

Microsoft Reviewers: Open in CodeFlow

@DearVa DearVa requested a review from a team as a code owner April 13, 2024 03:51
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Apr 13, 2024
@DearVa
Copy link
Author

DearVa commented Apr 13, 2024

@dotnet-policy-service agree

@lindexi
Copy link
Contributor

lindexi commented Apr 13, 2024

Awesome! 666

@RCUTANF
Copy link

RCUTANF commented Apr 14, 2024

incredible performance improve! I will test in my device later.

@DearVa
Copy link
Author

DearVa commented May 12, 2024

Hello every reviewers, I was wondering if there's any update on this PR? @singhashish-wpf @dipeshmsft
I tagged you as you seem to be the expert in this area and I'm a bit lost on how to proceed. My apologies if I'm out of line.

@hez2010
Copy link

hez2010 commented May 17, 2024

Hello every reviewers, I was wondering if there's any update on this PR? @singhashish-wpf @dipeshmsft I tagged you as you seem to be the expert in this area and I'm a bit lost on how to proceed. My apologies if I'm out of line.

Pretty sure this PR will be on hold for yet another several months before it finally gets reviewed and merged just like any other community PR which touches some fundamental things.

@DearVa
Copy link
Author

DearVa commented May 17, 2024

Hello every reviewers, I was wondering if there's any update on this PR? @singhashish-wpf @dipeshmsft I tagged you as you seem to be the expert in this area and I'm a bit lost on how to proceed. My apologies if I'm out of line.

Pretty sure this PR will be on hold for yet another several months before it finally gets reviewed and merged just like any other community PR which touches some fundamental things.

Thanks for your reply, waiting for good news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement of RenderTargetBitmap to Support Hardware Rendering
4 participants