gather4_po (sm5 - asm)

A variant of gather4, but instead of supporting an immediate offset [-8..7], the offset comes as a parameter to the instruction, and also has larger range of [-32..31].

gather4_po dest[.mask], srcAddress[.swizzle], srcOffset[.swizzle], srcResource[.swizzle], srcSampler[.select_component]




[in] The address of the result of the operation.


[in] A set of texture coordinates.


[in] The offset.


[in] A texture register.


[in] A sampler register.



The first two components of the 4-vector offset parameter supply 32-bit integer offsets. The other components of this parameter are ignored.

The 6 least significant bits of each offset value is honored as a signed value, yielding [-32..31] range.

This instruction only works with 2D textures, unlike gather4, which also works with TextureCubes.

The only modes honored in the sampler are the addressing modes. Only the most detailed mip in the resource view is used.

If the address falls on a texel center, this does not mean the other texels can be zeroed out.

The srcSampler parameter includes [.select_component], allowing any single component of a texture to be retrieved, including returning defaults for missing components.

For formats with float32 components, if the value being fetched is normalized, denormalized, +-0 or +-INF, it is returned to the shader unaltered. NaN is returned as NaN, but the exact bit representation of the NaN may be changed. For TextureCubes, some synthesis of the missing 4th texel must occur at corners, so the notion of returning bits unchanged for the synthesized texel does not apply, and denorms could be flushed.

Use this instruction to extend offset range of gather4 to be larger and programmable. The "po" suffix on the name means "programmable offset".

This instruction applies to the following shader stages:



Minimum Shader Model

This instruction is supported in the following shader models:

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


Related topics

Shader Model 5 Assembly (DirectX HLSL)