System.Windows.Media.RenderCapability.Tier返回而不是渲染模式 [英] System.Windows.Media.RenderCapability.Tier returns not the render mode

查看:282
本文介绍了System.Windows.Media.RenderCapability.Tier返回而不是渲染模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 System.Windows.Media.RenderCapability.Tier 显示我的应用程序的诊断面板中的当前渲染模式。 如果我强迫应用程序(3.5SP1)来改变渲染模式通过以下code

I use System.Windows.Media.RenderCapability.Tier to show the current render mode within a diagnostics panel of my app. If I force the app (3.5sp1) to change the render-mode through the following code

HwndSource hwndSource = PresentationSource.FromVisual(visual) as System.Windows.Interop.HwndSource;
HwndTarget hwndTarget = hwndSource.CompositionTarget;
hwndTarget.RenderMode = renderMode;

既不System.Windows.Media.RenderCapability.TierChanged火灾,也没有了System.Windows.Media.RenderCapability.Tier属性更改。但是,更改应用到应用程序。如果我期待与穿孔,渲染模式有被更改为所需的模式。

neither System.Windows.Media.RenderCapability.TierChanged fires, nor has the System.Windows.Media.RenderCapability.Tier property changed. However the changes are applied to the app. If I look with Perforator, the render mode has been changed to the desired mode.

虽然我在那个System.Windows.Media.RenderCapability.Tier可用于检测当前的状态呈现许多地方已经发现(也MSDN,看到的这个),看来,System.Windows.Media.RenderCapability只提供了有关能力,而不是有关当前信息模式。这使得也有道理,如果我看一下类的名称。

Although I’ve found at many locations that System.Windows.Media.RenderCapability.Tier can be used to detect the current render state (also msdn, see this), it seems, System.Windows.Media.RenderCapability only gives information about the capabilities and not about the current mode. That makes also sense if I look at the name of the class.

有另一种来源,知道如何在实际WPF的内容呈现还是我做错了什么?

Is there another source to know how an actual wpf-content is rendered or am I doing something wrong?

推荐答案

只是将 RenderCapability.Tier HwndTarget.RenderMode 在一起,你会得到你在找什么:

Just combine RenderCapability.Tier and HwndTarget.RenderMode together and you'll get what you're looking for:

  • RenderCapability.Tier告诉您当前的图形卡支持
  • HwndTarget.RenderMode告诉你WPF​​是否会真正使用GPU与否

RenderCapability.Tier变化和火灾TierChanged Direct3D的表面切换到新的视频卡(如窗口显示器或显示切换到一个新的显示器之间拖动)任何时候。

RenderCapability.Tier changes and fires TierChanged any time the Direct3D surface switches to a new video card (such as a window being dragged between monitors or switching the display to a new monitor).

HwndTarget.RenderMode只由用户code改变,但没有通知机制,当它改变了。如果只设置它在一个地方,你可以从那里简单的通知,否则,你可能需要使用一个定时器来定期检查。

HwndTarget.RenderMode is only changed by user code but has no notification mechanism for when it changes. If you only set it in one place you can simply notify from there, otherwise you might need to use a timer to check it periodically.

基本上,如果HwndTarget.RenderMode == RenderMode.Default和RenderCapability.Tier够高,你有硬件加速。

Basically if HwndTarget.RenderMode==RenderMode.Default and RenderCapability.Tier is high enough you have hardware acceleration.

这篇关于System.Windows.Media.RenderCapability.Tier返回而不是渲染模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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