检查是否支持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  阅读次数:14627

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

沪 ICP 备 18037240 号-1

沪公网安备 31011002002865 号