Share via


How to: Check for Shader Model 2.0 Support

This example demonstrates how to determine if a graphics card supports Shader Model 2.0.

To check for Shader Model 2.0 support

  1. Use the static property GraphicsAdapter.Adapters to obtain a collection of the available adapters on the system.
  2. Find the capabilities of a specific graphics adapter by using the GraphicsAdapter.GetCapabilities method.
  3. Compare GraphicsDeviceCapabilities.MaxPixelShaderProfile to the member of the ShaderProfile enumeration that represents pixel shader version ps_2_0. In this example, if the card does not support this shader model, a message is written to the output window when the game is run in debug mode.
// Check all available adapters on the system.
foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters)
{
    // Get the capabilities of the hardware device.
    GraphicsDeviceCapabilities caps = adapter.GetCapabilities( DeviceType.Hardware );
    if (caps.MaxPixelShaderProfile < ShaderProfile.PS_2_0)
    {
        // This adapter does not support Shader Model 2.0.
        System.Diagnostics.Debug.WriteLine( "This adapter does not support Shader Model 2.0." );
    }
}