|  |  | 
2D gradient texture lookup.
| ret tex2Dgrad(s, t, ddx, ddy) | 
|---|
Where:
| Name | In/Out | Template Type | Component Type | Size | 
|---|---|---|---|---|
| s | in | object | sampler1D | 1 | 
| t | in | vector | float | 2 | 
| ddx | in | vector | float | 2 | 
| ddy | in | vector | float | 2 | 
| ret | out | vector | float | 4 | 
This function samples a texture using the sampler specified by s, the texture coordinates in t, the x gradient in ddx, and the y gradient in ddy. The gradient values select the appropriate mipmap level of the texture for sampling.
When compiling code to ps_3_0, significant code reordering is done to move gradient computations outside of flow control.
This intrinsic function is supported in the following (or later) shader versions:
| Vertex Shader | Pixel Shader | 
|---|---|
| n/a | ps_2_0 * | 
* - If the D3DPSHADERCAPS2_0 cap is set with D3DD3DPSHADERCAPS2_0_GRADIENTINSTRUCTIONS, the compiler maps this statement to texldd - ps.