HLSL intrinsic functions

 

function description minimum shader model
abs(value) Absolute value (per component). 1.1
acos(x) Returns the arccosine of each component of x. 1.1
all(x) Test if all components of x are nonzero. 1.1
any(x) Test if any component of x is nonzero. 1.1
asin(x) Returns the arcsine of each component of x. 1.1
atan(x) Returns the arctangent of x. 1.1
atan2(x, y) Returns the arctangent of of two values (x,y). 1.1
ceil(x) Returns the smallest integer which is greater than or equal to x. 1.1
clamp(x, min, man) Clamps x to the range [min, max]. 1.1
clip(x) Discards the current pixel, if any component of x is less than zero. 1.1
cos(x) Returns the cosine of x. 1.1
cosh(x) Returns the hyperbolic cosine of x. 1.1
cross(I, J) Returns the cross product of two 3D vectors I and J. 1.1
D3DCOLORtoUBYTE4(x) Swizzles and scales components of the 4D vector x to compensate for the lack of UBYTE4 support in some hardware. 1.1
ddx(x) Returns the partial derivative of x with respect to the screen-space x-coordinate. 2.1
ddy(x) Returns the partial derivative of x with respect to the screen-space y-coordinate. 2.1
degrees(x) Converts x from radians to degrees. 1.1
determinant(m) Returns the determinant of the square matrix m. 1.1
distance(x, y) Returns the distance between two points x and y. 1.1
dot(I, J) Returns the dot product of two vectors I and J. 1
exp(x) Returns the base-e exponent. 1.1
exp2(value) Base 2 exponent (per component). 1.1
faceforward(n, i, ng) Returns -n * sign(•(i, ng)). 1.1
floor(x) Returns the greatest integer which is less than or equal to x. 1.1
fmod(x, y) Returns the floating point remainder of x/y. 1.1
frac(x) Returns the fractional part of x. 1.1
frexp(x, exp) Returns the mantissa and exponent of x. 2.1
fwidth(x) Returns abs(ddx(x)) + abs(ddy(x)) 2.1
isfinite(x) Returns true if x is finite, false otherwise. 1.1
isinf(x) Returns true if x is +INF or -INF, false otherwise. 1.1
isnan(x) Returns true if x is NAN or QNAN, false otherwise. 1.1
ldexp(x, exp) Returns x * 2exp 1.1
length(I) Returns the length of the vector I. 1.1
lerp(x, y, s) Returns x + s(y - x). 1.1
lit(a, d, s, 1) Returns a lighting vector (ambient, diffuse, specular, 1) 1.1
log(x) Returns the base-e logarithm of x. 1.1
log10(x) Returns the base-10 logarithm of x. 1.1
log2(x) Returns the base-2 logarithm of x. 1.1
max(x, y) Selects the greater of x and y. 1.1
min(x, y) Selects the lesser of x and y. 1.1
modf(x, ip) Splits the value x into fractional and integer parts. 1.1
mul(x, y) Performs matrix multiplication using x and y. 1
noise(x) Generates a random value using the Perlin-noise algorithm. 1.1
normalize(I) Returns a normalized vector I. 1.1
pow(x, y) Returns x pow y. 1.1
radians(x) Converts x from degrees to radians. 1
reflect Returns a reflection vector. 1
refract Returns the refraction vector. 1.1
round Rounds x to the nearest integer 1.1
rsqrt(x) Returns 1 / sqrt(x) 1.1
saturate(x) Clamps x to the range [0, 1] 1
sign(x) Computes the sign of x. 1.1
sin(x) Returns the sine of x 1.1
sincos(x) Returns the sine and cosine of x. 1.1
sinh(x) Returns the hyperbolic sine of x 1.1
smoothstep Returns a smooth Hermite interpolation between 0 and 1. 1.1
sqrt(value) Square root (per component) 1.1
step(a, x) Returns (x >= a) ? 1 : 0 1.1
tan(x) Returns the tangent of x 1.1
tanh(x) Returns the hyperbolic tangent of x 1.1
tex1D(s, t) 1D texture lookup. 1
tex1D(s, t, ddx, ddy) 1D texture lookup. 2.1
tex1Dbias 1D texture lookup with bias. 2.1
tex1Dgrad 1D texture lookup with a gradient. 2.1
tex1Dlod 1D texture lookup with LOD. 3.1
tex1Dproj 1D texture lookup with projective divide. 2.1
tex2D(s, t) 2D texture lookup. 1.1
tex2D(s, t, ddx, ddy) 2D texture lookup. 2.1
tex2Dbias 2D texture lookup with bias. 2.1
tex2Dgrad 2D texture lookup with a gradient. 2.1
tex2Dlod 2D texture lookup with LOD. 3
tex2Dproj 2D texture lookup with projective divide. 2.1
tex3D(s, t) 3D texture lookup. 1.1
tex3D(s, t, ddx, ddy) 3D texture lookup. 2.1
tex3Dbias 3D texture lookup with bias. 2.1
tex3Dgrad 3D texture lookup with a gradient. 2.1
tex3Dlod 3D texture lookup with LOD. 3.1
tex3Dproj 3D texture lookup with projective divide. 2.1
texCUBE(s, t) Cube texture lookup. 1.1
texCUBE(s, t, ddx, ddy) Cube texture lookup. 2.1
texCUBEbias Cube texture lookup with bias. 2.1
texCUBEgrad Cube texture lookup with a gradient. 2.1
texCUBElod Cube texture lookup with LOD. 3.1
texCUBEproj Cube texture lookup with projective divide. 2.1
transpose(m) Returns the transpose of the matrix m. 1
trunc Truncates floating-point value(s) to integer value(s) 1

back...