硬件加速如何与 WPF 配合使用? [英] How does hardware acceleration work with WPF?

查看:62
本文介绍了硬件加速如何与 WPF 配合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

互联网上有很多文章,但仍然不清楚,所以我需要清楚地解释一下硬件加速如何与 WPF 一起工作?

There are a lot of article on internet but still not clear, so i need a clear explanation of How Hardware acceleration work with WPF ?

推荐答案

您的问题没有具体说明您在阅读 Internet 上的文章时有哪些困惑,或者您想了解的有关硬件加速的具体内容在 WPF 中.因此,我将尝试向您简要介绍其工作原理.

Your question doesn't give any specifics on what you're confused about in reading the articles on the Internet, or what exactly you want to know about hardware acceleration in WPF. So, I'll try and give you a general, though simplified, summary of how it works.

为了获得 GPU 加速渲染,Windows Presentation Foundation (WPF) 通过 DirectX 管道渲染和呈现图形.GPU 或图形处理单元是为您的视频卡供电的芯片.本质上,硬件加速将在 WPF 应用程序中渲染图形的工作从计算机的主处理器 (CPU) 卸载到显卡的处理器 (GPU).通过在显卡上使用专为渲染图形而设计的硬件,而不是由 CPU 运行的软件功能,可以提高或加速应用程序图形和用户界面的性能.最终目标是复杂的图形例程成为渲染绑定(即受 GPU 能力限制),而不是处理器绑定(即受计算机 CPU 的功能和速度).这可以释放 CPU 来做其他工作,充分利用您的显卡独特的图形功能,并在每次用户升级到更新、更快、更先进的显卡(随着它们变得可用).

In order to obtain GPU-accelerated rendering, Windows Presentation Foundation (WPF) renders and presents graphics through the DirectX pipeline. The GPU, or Graphics Processing Unit, is the chip that powers your video card. Essentially, hardware acceleration offloads the work of rendering graphics in your WPF application from your computer's main processor (CPU) to the video card's processor (GPU). By using hardware on your video card that is specifically designed for rendering graphics instead of software functions run by the CPU, the performance of your application's graphics and user interface is increased, or accelerated. The ultimate goal is that complex graphics routines become render-bound (that is, limited by the capabilities of the GPU), rather than processor-bound (that is, limited by the capabilities and speed of your computer's CPU). This frees up the CPU to do other work, makes the best use of your video card's unique graphics capabilities, and speeds up the performance of your app each time the user upgrades to a newer, faster, and more advanced video card (as they become available).

当然,这假设您的显卡支持硬件加速.事实上,并非所有人都这样做,WPF 使用三层方法来适应这一点:

This, of course, assumes that your video card supports hardware acceleration. In fact, not all of them do, and WPF accommodates this with a three-tiered approach:

  1. 如果您的视频卡提供任何级别的硬件加速,例如如果您运行的是低于 7.0 的 DirectX 版本,WPF 将回退到第 0 层渲染模式,或软件加速.

  1. If your video card does not provide any level of hardware acceleration, such as if you're running a version of DirectX less than 7.0, WPF falls back to Tier 0 rendering mode, or software acceleration.

如果您的视频卡支持部分硬件加速,例如如果您运行的是 7.0 到 9.0 之间的 DirectX 版本,则 WPF 使用第 1 层渲染模式.

If your video card supports partial hardware acceleration, such as if you're running a version of DirectX between 7.0 and 9.0, then WPF uses Tier 1 rendering mode.

如果您的显卡支持所有图形输出的完整硬件加速,对应于等于或大于 9.0 的 DirectX 版本,则 WPF 使用第 2 层渲染模式.

If your video card supports full hardware acceleration for all graphics output, corresponding to a version of DirectX equal or greater than 9.0, then WPF uses Tier 2 rendering mode.

此 MSDN 页面提供了有关这些的更多信息图形渲染层以及支持硬件加速的确切特性和功能.

This MSDN page provides more information about these graphics rendering tiers and exactly what features and capabilities support hardware acceleration.

我不知道你是否已经看过这篇博文,但对我刚刚解释的内容有了更好的理解,现在再次阅读它可能对您更有意义.

And I don't know if you've already seen this blog post, but with a better understanding of what I've just explained, it may make more sense to you when reading it again now.

但是请记住,与 WPF 打交道的部分是您不必担心此过程的细节和特性.该技术足够智能,可以尽可能使用硬件优化,同时在必要时回退到基于软件的渲染.您的 WPF 应用程序甚至可以在带有旧显卡的旧计算机上运行,​​尽管比在较新的客户端上慢.因此,除了偶然的好奇心之外,这可能是您无需担心的事情.

Remember, however, that part of the deal with WPF is that you don't have to worry about the details and idiosyncrasies of this process. The technology is intelligent enough to use hardware optimizations wherever possible, while falling back to software-based rendering when necessary. Your WPF applications will work even on older computers with legacy video cards, albeit slower than on a newer client. So this is probably something you don't need to worry about beyond casual curiosity.

这篇关于硬件加速如何与 WPF 配合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆