Click or drag to resize
SamplerCoordinateMapping Enumeration
Describes what texture coordinates the shader will use when sampling an input texture.

Namespace:  Microsoft.Graphics.Canvas.Effects
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version:
public enum SamplerCoordinateMapping
  Member nameValueDescription
Unknown0 Indicates that the texture coordinate mapping is complex or unknown. This is the default for shaders that specify D2D_INPUT{N}_COMPLEX.
OneToOne1 Indicates that the texture coordinate mapping is 1:1 between the source image and pixel being shaded. This is the default for shaders that specify D2D_INPUT{N}_SIMPLE, which should only be used when the shader calls D2DGetInput rather than D2DSampleInputAtOffset or D2DSampleInputAtPosition.

Indicates that there is a correlation between the texture coordinates at which the input is sampled and the pixel being shaded, but this is not exactly 1:1. For instance this is the mode to use when a filter kernel calls D2DSampleInputAtOffset to take a number of samples from a region around the pixel itself.

Offset mode is never selected by default. To use it, set one of the Source{N}Mapping properties on PixelShaderEffect, and set MaxSamplerOffset to indicate the maximum number of pixels by which a texture coordinate will be displaced.

Beware: specifying this mode incorrectly (for instance if your shader actually samples further away from the current pixel than the current MaxSamplerOffset) can give unpredictably wrong results.


When a PixelShaderEffect source image is set to Unknown coordinate mapping mode, the effect runtime must make the entire source image available as a pixel shader input texture. This is different from OneToOne or Offset mapping modes, in which the neccessary region of the source image can be determined from what output region is being drawn.

Requesting the entire source image is fine as long as this is reasonably sized (eg. a bitmap) but will fail if the source image is very large or infinite in size (eg. ColorSourceEffect or the output of a BorderEffect).

If you get an exception the graph could not be rendered with the context's current tiling settings, consider switching from Unknown to Offset mapping mode (if that is suitable for your shader) or wrapping the source with a CropEffect to reduce its size.

See Also