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.

AppendStructuredBuffer, asm, asm_fragment
BlendState, bool, break, Buffer, ByteAddressBuffer
case, cbuffer, centroid, class, column_major, compile, compile_fragment, CompileShader, const, continue, ComputeShader, ConsumeStructuredBuffer
default, DepthStencilState, DepthStencilView, discard, do, double, DomainShader, dword
else, export, extern
false, float, for, fxgroup
GeometryShader, groupshared
half, Hullshader
if, in, inline, inout, InputPatch, int, interface
line, lineadj, linear, LineStream
matrix, min16float, min10float, min16int, min12int, min16uint
namespace, nointerpolation, noperspective, NULL
out, OutputPatch
packoffset, pass, pixelfragment, PixelShader, point, PointStream, precise
RasterizerState, RenderTargetView, return, register, row_major, RWBuffer, RWByteAddressBuffer, RWStructuredBuffer, RWTexture1D, RWTexture1DArray, RWTexture2D, RWTexture2DArray, RWTexture3D
sample, sampler, SamplerState, SamplerComparisonState, shared, snorm, stateblock, stateblock_state, static, string, struct, switch, StructuredBuffer
tbuffer, technique, technique10, technique11, texture, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture2DMS, Texture2DMSArray, Texture3D, TextureCube, TextureCubeArray, true, typedef, triangle, triangleadj, TriangleStream
uint, uniform, unorm, unsigned
vector, vertexfragment, VertexShader, void, volatile
while

 

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.

Related topics

Appendix (DirectX HLSL)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft