Keywords

The Microsoft High Level Shader Language (HLSL) recognizes the words in this section as keywords. Keywords are predefined reserved identifiers that have special meanings. You can't use them as identifiers in your app.

Remarks

These numeric types have scalar, vector, and matrix keyword expansions:

  • float, int, uint, bool
  • min10float, min16float
  • min12int, min16int
  • min16uint

The expansions of these numeric types follow this pattern, which uses float as an example:

  • Scalar

    float
  • Vector

    float1, float2, float3, float4
  • Matrix

    float1x1, float1x2, float1x3, float1x4 float2x1, float2x2, float2x3, float2x4 float3x1, float3x2, float3x3, float3x4 float4x1, float4x2, float4x3, float4x4

HLSL supports lower-case texture and sampler for legacy reasons. Instead, for your new apps, we recommend that you use HLSL's new texture objects (Texture2D, Texture3D, and so on) and sampler objects (SamplerState and SamplerComparisonState).

export

Use export to mark functions that you package into a library.

Here is an example:

export float identity(float x)
{
    return x;
}

By marking the identity function with the export keyword, you make the identity function available from a library for later linking. Without the export marking, the identity function isn't available for later linking.

The compiler ignores the export keyword for non-library compilation.

Note

The export keyword requires the D3dcompiler_47.dll or a later version of the DLL.

 

Appendix (DirectX HLSL)