deriv_rtx (sm4 - asm)

Rate of change of contents of each float32 component of src0 (post-swizzle), with regard to RenderTarget x direction (rtx) or RenderTarget y direction.

deriv_rtx[_sat] dest[.mask], [-]src0[_abs][.swizzle],
Item Description
dest
[in] The address of the result of the operation.
src0
[in] The component in the operation.

Remarks

Only a single x,y derivative pair is computed for each 2x2 stamp of pixels.

This operation is hardware dependent.

Reference rasterizer implementation for triangles:

  • Pixel Shader always runs Shader over 2x2 quad of pixels in lockstep (even through flow control, masking disabled pixels).
  • Quads always have even numbered pixel coordinates (both x and y) for top-left pixel.
  • Dummy pixels run off primitive if primitive is too small to fill a 2x2 quad.
  • deriv_rtx is computed by first choosing 2 pixels: the current pixel and the other pixel with the same y coordinate from the quad. Then, the result is calculated as: src0(odd x pixel) - src0(even x pixel) [per-component]
  • deriv_rty is computed by first choosing 2 pixels: the current pixel and the other pixel with the same x coordinate from the quad. Then, the result is calculated as: src0(odd y pixel) - src0(even y pixel) [per-component]

This instruction applies to the following shader stages:

Vertex Shader Geometry Shader Pixel Shader
x

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)