ShaderEffect.DdxUvDdyUvRegisterIndex Property

Gets or sets a value that indicates the shader register to use for the partial derivatives of the texture coordinates with respect to screen space.

Namespace:  System.Windows.Media.Effects
Assembly:  PresentationCore (in PresentationCore.dll)

protected int DdxUvDdyUvRegisterIndex { get; set; }

Property Value

Type: System.Int32
The index of the register that contains the partial derivatives.

ExceptionCondition
InvalidOperationException

An attempt was made to set the DdxUvDdyUvRegisterIndex property more than one time or after initial processing of the effect.

Use the DdxUvDdyUvRegisterIndex property to specify the shader register that contains the partial derivatives of the texture coordinates with respect to screen space. For example, if DdxUvDdyUvRegisterIndex is set to 4, the shader register c4 is used. Register c4 contains four float fields. The following High Level Shading Language (HLSL) code shows how this register is used. The nextPixelUV value represents the next pixel to the right.

float4 ddxUvDdyUv : register(c4);
SamplerState  sampler : register(S0);
...
float2 nextPixelUV;
nextPixelUV.u = ddxUvDdyUv.x + u;
nextPixelUV.v = ddxUvDdyUv.y + v;

tex2D(sampler, nextPixelUV);

The following table shows how the register specified for DdxUvDdyUvRegisterIndex is filled.

Register Constant

Derivative Value

x component

ddx(u)

y component

ddx(v)

z component

ddy(u)

w component

ddy(v)

Texture coordinates are denoted as (u, v). ddx(u) is the constant partial derivative of the texture coordinate component u with respect to the screen-space x-coordinate. ddy(u) is the partial derivative of the texture coordinate u with respect to the screen-space y-coordinate. Similarly, ddx(v) and ddy(v) are the corresponding screen-space derivatives for the texture coordinate component v.

NoteNote

HLSL has the ddx and ddy instructions to calculate these values, but these instructions are not available on all PixelShader 2.0 hardware.

You may think of these constants in the following way. If you step 1 pixel to the right in screen space (in the x direction), then ddx(u) is the amount that u changes in texture space, and ddx(v) is the amount that v changes in texture space. If the effect is axis-aligned when it is rendered, then ddx(v) is 0. If the effect is rotated when it is rendered, then ddx(v) is non-zero.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5 SP1, 3.0 SP2

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft