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_0Domain shader
gs_5_0Geometry shader
hs_5_0Hull shader
ps_5_0Pixel shader
vs_5_0Vertex 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)1
gs_4_1Geometry shader
ps_4_1Pixel shader
vs_4_1Vertex 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)1
gs_4_0Geometry shader
ps_4_0Pixel shader
vs_4_0Vertex 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_1Pixel 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_3Pixel shader for 9.3 (similar limits to ps_2_x2 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_1Vertex 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_3Vertex shader for 9.3 (similar to vs_2_a2 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.03.

TargetDescription
ps_3_0Pixel shader 3.0
ps_3_swPixel shader 3.0 (software)
vs_3_0Vertex shader 3.0
vs_3_swVertex shader 3.0 (software)

 

Legacy Direct3D 9 Shader Model 2.0

Here are the shader targets for legacy Direct3D 9 shader model 2.03.

TargetDescription
ps_2_0Pixel shader 2.0
ps_2_aPixel shader 2a
ps_2_bPixel shader 2b
ps_2_swPixel shader 2.0 software
vs_2_0Vertex shader 2.0
vs_2_aVertex shader 2a
vs_2_swVertex shader 2.0 software

 

Legacy Direct3D 9 Shader Model 1.x

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

TargetDescription
tx_1_0Texture shader profile that legacy D3DX95 functions D3DXCreateTextureShader and D3DXFillTextureTX use
vs_1_1Vertex shader 1.1

 

Legacy Effects

Here are the effect targets for legacy effects.

TargetDescription
fx_2_0Effects (FX) for Direct3D 9 in D3DX95
fx_4_0Effects (FX) for Direct3D 10.0 in D3DX105
fx_4_1Effects (FX) for Direct3D 10.1 in D3DX105
fx_5_0Effects (FX) for Direct3D 115

 

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?.

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.