dcl_sampler (sm4 - asm)

Declares a sampler register.

dcl_sampler sN, mode
Item Description
sN
[in] A sampler register, where N is an integer that denotes the register number.
mode
[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.
Mode Sampler States Honored
default Filter (may not use the _COMPARISON or _TEXT values), AddressU/V/W, MinLOD/MaxLOD, MipLODBias, MaxAnisotropy, BorderColor[4]
comparison Filter, ComparisonFunction, AddressU/V/W, MinLOD,MaxLOD, MipLODBias, MaxAnisotropy, BorderColor[4]
mono Filter (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 Mode Can Use these Texture-Object Methods
default Sample, SampleLevel, SampleGrad
comparison SampleCmp, SampleCmpLevelZero
mono SampleLevel

This instruction applies to the following shader stages:

Vertex Shader Geometry Shader Pixel Shader
x x x*

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

Example

Here is an example.

dcl_sampler s3, default

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
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

Shader Model 4 Assembly (DirectX HLSL)