Reference for HLSL

The HLSL reference documentation specifies the language characteristics. It is broken into several sections.

  • Language Syntax (DirectX HLSL) - Programming shaders in HLSL requires that you understand the language syntax, that is, how you write HLSL code. This includes code to declare and initialize variables, write user-defined shader functions, and add flow control statements to make your functions more powerful.
  • Shader Models vs Shader Profiles - The HLSL compiler implements rules and restrictions based on shader models. The code in each vertex shader, geometry shader (if you are using Direct3D 10) and pixel shader are validated against a shader model, which you supply at compile time.
  • Intrinsic Functions (DirectX HLSL) - HLSL has many intrinsic functions. These are implemented and tested so that you can use them knowing that they are already debugged and they perform well. If you choose to write your own functions, see the language syntax section for writing user-defined functions.
  • Asm Shader Reference - Assembly instructions that you can use to program and debug shaders.
  • D3DCompiler Reference - Compiles raw HLSL source.
  • Inline Format Conversion Reference - The D3DX_DXGIFormatConvert.inl file contains inline format conversion functions that you can use in the compute shader or pixel shader on Direct3D 11 hardware. You can use these functions in your application to simultaneously both read from and write to a texture. That is, you can perform in-place image editing. To use these inline format conversion functions, include the D3DX_DXGIFormatConvert.inl file in your application.
  • Appendix (DirectX HLSL) - The appendix is included for completeness. It includes a listing of the keywords and reserved words; these words cannot be used as identifiers in your programs. It also includes a listing of the language grammar for reference.
  • HLSL errors and warnings - Provides error and warning codes that a shader can return.


Programming Guide for HLSL