检查是否支持Shader Model 2.0

这个例子示范了如何确定一块显卡是否支持Shader Model 2.0。

检查是否支持 Shader Model 2.0

检查是否支持Shader Model 2.0

  1. 使用GraphicsDevice.GraphicsDeviceCapabilities静态属性来查阅某一个特殊图形适配器的性能。

  2. ShaderProfile列表代表ps_2_0版本,将GraphicsDeviceCapabilities.MaxPixelShaderProfile和该列表中的成员作比较。

    在这个例子中,如果显卡不支持这种shader model,当游戏在调试模式下运行时,将会在窗口显示一条消息。

// Check the graphics device used by the game for the necessary shader support.
GraphicsDeviceCapabilities caps = graphics.GraphicsDevice.GraphicsDeviceCapabilities;
if (caps.MaxPixelShaderProfile < ShaderProfile.PS_2_0)
{
    // This device does not support Shader Model 2.0.
    System.Diagnostics.Debug.WriteLine("This adapter does not support Shader Model 2.0.");
}

发布时间:2009/3/2 7:39:42  阅读次数:14594

2006 - 2024,推荐分辨率1024*768以上,推荐浏览器Chrome、Edge等现代浏览器,截止2021年12月5日的访问次数:1872万9823 站长邮箱

沪ICP备18037240号-1

沪公网安备 31011002002865号