dcl_sampler (sm4 - asm)

Declares a sampler register.

dcl_sampler sN, mode




[in] A sampler register, where N is an integer that denotes the register number.


[in] A sampler mode, which constrains which sampler states (listed in the members of D3D10_SAMPLER_DESC) are honored. The modes and states are listed in the following table.

ModeSampler States Honored
defaultFilter (may not use the _COMPARISON or _TEXT values), AddressU/V/W, MinLOD/MaxLOD, MipLODBias, MaxAnisotropy, BorderColor[4]
comparisonFilter, ComparisonFunction, AddressU/V/W, MinLOD,MaxLOD, MipLODBias, MaxAnisotropy, BorderColor[4]
monoFilter (must be one of the _TEXT values), MonoFilterWidth, MonoFilterHeight (these two states are global device state), MinLOD, MipLODBias, MaxAnisotropy



The mode restricts the sample instructions that can be used; this table lists the texture-object methods that are supported for each mode.

A Sampler Operating in this ModeCan Use these Texture-Object Methods
default Sample, SampleLevel, SampleGrad
comparison SampleCmp, SampleCmpLevelZero
mono SampleLevel


This instruction applies to the following shader stages:

Vertex ShaderGeometry ShaderPixel Shader


* - Using a sampler in mono mode is supported only in a pixel shader.

This instruction is included to aid in debugging a shader in assembly; you cannot author a shader in assembly language using Shader Model 4.


Here is an example.

dcl_sampler s3, default

Minimum Shader Model

This function is supported in the following shader models.

Shader ModelSupported
Shader Model 5 yes
Shader Model 4.1 yes
Shader Model 4 yes
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no


Related topics

Shader Model 4 Assembly (DirectX HLSL)