Skip to main content

Windows Dev Center

Specifying Compiler Targets

You need to specify the shader target — set of shader features — to compile against when you call the D3DCompile, D3DCompile2, or D3DCompileFromFile function. Here we list the targets for various profiles that the D3DCompile* functions and the HLSL compiler support.

Direct3D 11.0 and 11.1 feature levels

Here are the shader targets that Direct3D 11.0 and 11.1 feature levels support.

TargetDescription
cs_5_0DirectCompute 5.0 ( compute shader)
ds_5_0 Domain shader
gs_5_0 Geometry shader
hs_5_0 Hull shader
ps_5_0 Pixel shader
vs_5_0 Vertex shader

 

Direct3D 10.1 feature level

Here are the shader targets that the Direct3D 10.1 feature level supports.

TargetDescription
cs_4_1DirectCompute 4.1 ( compute shader
gs_4_1 Geometry shader
ps_4_1 Pixel shader
vs_4_1 Vertex shader

 

Direct3D 10.0 feature level

Here are the shader targets that the Direct3D 10.0 feature level supports.

TargetDescription
cs_4_0DirectCompute 4.0 ( compute shader
gs_4_0 Geometry shader
ps_4_0 Pixel shader
vs_4_0 Vertex shader

 

Direct3D 9.1, 9.2, and 9.3 feature levels

Here are the shader targets that Direct3D 9.1, 9.2 and 9.3 feature levels support.

Note  When you use the *_4_0_level_9_x HLSL shader profiles, you implicitly use of the Shader Model 2.x profiles to support Direct3D 9 capable hardware. Shader Model 2.x profiles support more limited flow control behavior than the Shader Model 4.x and later profiles.
TargetDescription
ps_4_0_level_9_1 Pixel shader for 9.1 and 9.2 (similar limits to ps_2_0)
  • 64 arithmetic and 32 texture instructions
  • 12 temporary registers
  • 4 levels of dependent reads
ps_4_0_level_9_3 Pixel shader for 9.3 (similar limits to ps_2_x² with additional shader features)
  • 512 instructions
  • 32 temporary registers
  • Static flow control (max depth of 4)
  • Dynamic flow control (max depth of 24)
  • D3DPS20CAPS_ARBITRARYSWIZZLE
  • D3DPS20CAPS_GRADIENTINSTRUCTIONS
  • D3DPS20CAPS_PREDICATION
  • D3DPS20CAPS_NODEPENDENTREADLIMIT
  • D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
vs_4_0_level_9_1 Vertex shader for 9.1 and 9.2 (similar to vs_2_0)
  • 256 instructions
  • 12 temporary registers
  • Static flow control (max depth of 1)
vs_4_0_level_9_3 Vertex shader for 9.3 (similar to vs_2_a² with additional shader features and instancing)
  • 256 instructions
  • 32 temporary registers
  • Static flow control (max depth of 4)
  • D3DVS20CAPS_PREDICATION

 

Legacy Direct3D 9 Shader Model 3.0

Here are the shader targets for legacy Direct3D 9 shader model 3.0³.

TargetDescription
ps_3_0 Pixel shader 3.0
ps_3_sw Pixel shader 3.0 (software)
vs_3_0 Vertex shader 3.0
vs_3_sw Vertex shader 3.0 (software)

 

Legacy Direct3D 9 Shader Model 2.0

Here are the shader targets for legacy Direct3D 9 shader model 2.0³.

TargetDescription
ps_2_0 Pixel shader 2.0
ps_2_a Pixel shader 2a
ps_2_b Pixel shader 2b
ps_2_sw Pixel shader 2.0 software
vs_2_0 Vertex shader 2.0
vs_2_a Vertex shader 2a
vs_2_sw Vertex shader 2.0 software

 

Legacy Direct3D 9 Shader Model 1.x

Here are the shader targets for legacy Direct3D 9 shader model 1.x⁴.

TargetDescription
tx_1_0Texture shader profile that legacy D3DX9⁵ functions D3DXCreateTextureShader and D3DXFillTextureTX use
vs_1_1 Vertex shader 1.1

 

Legacy Effects

Here are the effect targets for legacy effects.

TargetDescription
fx_2_0Effects (FX) for Direct3D 9 in D3DX9⁵
fx_4_0Effects (FX) for Direct3D 10.0 in D3DX10⁵
fx_4_1Effects (FX) for Direct3D 10.1 in D3DX10⁵
fx_5_0Effects (FX) for Direct3D 11⁵

 

Notes

Here are some notes that the preceding sections refer to:

  1. Feature level 10.0 and 10.1 devices can optionally support DirectCompute. To verify support, use ID3D11Device::CheckFeatureSupport with D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS.
  2. Feature level 9.3 effectively requires hardware that complies with the requirements for legacy Direct3D 9 shader model 3.0, but this feature level does not make use of vs_3_0 or ps_3_0 targets.
  3. Only use legacy Direct3D 9 shader models with the Direct3D 9 API. Instead, use the 9.x profiles with the Direct3D 10.x and 11.x API.
  4. The current HLSL shader D3DCompile* functions don't support legacy 1.x pixel shaders. The last version of HLSL to support these targets was D3DX9 in the October 2006 release of the DirectX SDK.
  5. All versions of D3DX and the DirectX SDK are deprecated. For more info, see Where is the DirectX SDK?.