) HLSL Function

Source: Internet
Author: User
Tags acos asin cos cos mul

Intrinsic functions (DirectX HLSL)
The following table lists the intrinsic functions available in HLSL. Each function has a brief description, and a link to a reference page that has more detail about the input argument and return type.

Name syntax description
ABS (x) absolute value (per component ).
ACOs (x) returns the arccosine of each component of X.
All all (x) test if all components of X are nonzero.
Any any (x) test if any component of X is nonzero.
Asfloat (x) convert the input type to a float.
Asin asin (x) returns the arcsine of each component of X.
Asint (x) convert the input type to an integer.
Asuint (x) convert the input type to an unsigned integer.
Atan (x) returns the arctangent of X.
Atan2 atan2 (Y, x) returns the arctangent of two values (x, y ).
Ceil (x) returns the smallest integer which is greater than or equal to X.
Clamp clamp (x, Min, max) Clamps X to the range [min, Max].
Clip (x) discards the current pixel, if any component of X is less than zero.
Cos cos (x) returns the cosine of X.
Cosh cosh (x) returns the hyperbolic cosine of X.
Cross cross (x, y) returns the cross product of two 3D vectors.
D3dcolortoubyte4 d3dcolortoubyte4 (x) swizzles and scales components of the 4D vector X to compensate for the lack of ubyte4 support in some hardware.
DDX (x) returns the partial derivative of X with respect to the screen-space X-coordinate.
Ddy (x) returns the partial derivative of X with respect to the screen-Space Y-coordinate.
Degrees degrees (x) converts X from radians to degrees.
Determinant determinant (m) returns the determinant of the square matrix m.
Distance distance (x, y) returns the distance between two points.
Dot dot (x, y) returns the dot product of two vectors.
Exp exp (x) returns the base-e exponent.
Exp2 exp2 (x) base 2 exponent (per component ).
Faceforward (n, I, NG) returns-N * sign (• (I, NG )).
Floor floor (x) returns the greatest integer which is less than or equal to X.
Fmod (x, y) returns the floating point remainder of x/y.
Frac frac (x) returns the fractional part of X.
Frexp (x, exp) returns the mantissa and exponent of X.
Fwidth (x) returns ABS (DDX (x) + ABS (ddy (x ))
Getrendertargetsamplecount () returns the number of render-target samples.
Getrendertargetsampleposition (x) returns a sample position (x, y) for a given sample index.
Isfinite (x) returns true if X is finite, false otherwise.
Isinf (x) returns true if X is + inf or-INF, false otherwise.
Isnan (x) returns true if X is Nan or qnan, false otherwise.
Ldexp (x, exp) returns x * 2exp
Length length (v) returns the length of the vector v.
Lerp (X, Y, S) returns x + S (Y-x ).
Linearregression (n • L, n • H, m) returns a lighting vector (ambient, diffuse, specular, 1)
Log (x) returns the base-e logarithm of X.
Log10 log10 (x) returns the base-10 logarithm of X.
Log2 log2 (x) returns the base-2 logarithm of X.
Max (x, y) selects the greater of X and Y.
Min (x, y) selects the lesser of X and Y.
MODF (x, out IP) splits the value x into fractional and integer parts.
Mul MUL (x, y) performs matrix multiplication using X and Y.
Noise noise (x) generates a random value using the Perlin-noise algorithm.
Normalize normalize (x) returns a normalized vector.
Pow pow (x, y) returns XY.
Radians radians (x) converts X from degrees to radians.
Reflect reflect (I, n) returns a reflection vector.
Refract (I, n, R) returns the refraction vector.
Round round (x) rounds X to the nearest integer
Rsqrt (x) returns 1/SQRT (X)
Saturate saturate (x) Clamps X to the range [0, 1]
Sign sign (x) computes the sign of X.
Sin (x) returns the sine of X
Sincos (x, out S, out c) returns the sine and cosine of X.
Sinh sinh (x) returns the hyperbolic sine of X
Smoothstep (Min, Max, x) returns a smooth Hermite interpolation between 0 and 1.
SQRT (x) square root (per component)
Step step (a, x) returns (x> = )? 1: 0
Tan (x) returns the tangent of X
Tanh (x) returns the hyperbolic tangent of X
Tex1d tex1d (S, T) 1d texture lookup.
Tex1dbias tex1dbias (S, T) 1d texture lookup with bias.
Tex1dgrad tex1dgrad (S, T, DDX, ddy) 1d texture lookup with a gradient.
Tex1dlevels tex1dlevels (S, T) 1d texture lookup with dlevels.
Tex1dproj tex1dproj (S, T) 1d texture lookup with projective divide.
Tex2d tex2d (S, T) 2D Texture lookup.
Tex2dbias tex2dbias (S, T) 2D Texture lookup with bias.
Tex2dgrad tex2dgrad (S, T, DDX, ddy) 2D Texture lookup with a gradient.
Tex2dlevels tex2dlevels (S, T) 2D Texture lookup with dlevels.
Tex2dproj tex2dproj (S, T) 2D Texture lookup with projective divide.
Tex3d tex3d (S, T) 3D texture lookup.
Tex3dbias tex3dbias (S, T) 3D texture lookup with bias.
Tex3dgrad tex3dgrad (S, T, DDX, ddy) 3D texture lookup with a gradient.
Tex3dlooss tex3dlooss (S, T) 3D texture lookup with looss.
Tex3dproj tex3dproj (S, T) 3D texture lookup with projective divide.
Texcube (S, T) Cube Texture lookup.
Texcubebias (S, T) Cube Texture lookup with bias.
Texcubegrad (S, T, DDX, ddy) Cube Texture lookup with a gradient.
Texcubelod tex3dlevels (S, T) Cube Texture lookup with levels.
Texcubeproj (S, T) Cube Texture lookup with projective divide.
Transpose transpose (m) returns the transpose of the matrix m.
Trunc (x) truncates floating-point value (s) to integer value (s)

 

Table 3-1 HLSL built-in functions

Function Name usage
 

ABS calculates the absolute value of the input value.

ACOs returns the inverse cosine of the input value.

The value of all is not 0.

Any tests any non-zero value in the input value.

Asin returns the arc sine of the input value.

Atan returns the arc tangent of the input value.

Atan2 returns the arc tangent value of Y/X.

Ceil returns the smallest integer greater than or equal to the input value.

Clamp limits the input value to the range of [min, Max.

Clip drops the current pixel if any element in the input vector is less than 0.

Cos returns the cosine of the input value.

Cosh returns the hyperbolic cosine of the input value.

Cross returns the cross product of two 3D vectors.

DDX returns the partial derivative of the X axis of the screen coordinate.

Ddy returns the partial derivative of the Y axis of the screen coordinate.

Degrees to degrees

Determinant returns the value of the input matrix.

Distance returns the distance between two input points.

Dot returns the dot product of two vectors.

Exp returns the base number of E, and the input value is the exponential value.

Exp2 returns an exponential function value that uses 2 as the base and the input value as the index.

Faceforward checks whether a polygon is located on the front.

Floor returns the largest integer less than or equal to X.

Fmod returns the floating point remainder of A/B.

Frac returns the fractional part of the input value.

Frexp returns the ending and exponent of the input value

Fwidth returns ABS (DDX (x) + ABS (ddy (x )).

Isfinite returns true if the input value is finite; otherwise, false.

If the input value of isinf is infinite, true is returned.

Isnan returns true if the input value is Nan or qnan.

Returns x * 2 ^ exp for the inverse operation of ldexp frexp.

Len/lenth returns the length of the input vector.

Lerp performs Interpolation on input values.

Returns the illumination vector (Environment light, diffuse reflection light, mirror highlight, 1 ).

Log returns the base-e logarithm.

Log10 returns the base-10 logarithm.

Log2 returns the base 2 logarithm.

Max returns one of the two input values.

Min returns a smaller value of the two input values.

MODF splits the input values into integers and decimals.

Mul returns the product of the input matrix.

Normalize returns the normalized vector, defined as X/length (X ).

Pow returns the specified power of the input value.

The conversion from radians angle to radians.

Reflect returns the reflected light from the incident light I to the surface normal n.

Refract returns the X-ray V of the incident light I, the surface normal N, and the refractive index ETA.

Round returns an integer closest to the input value.

Rsqrt returns the reciprocal of the square root of the input value.

Saturate limits the input value to [0, 1.

Sign calculates the sign of the input value.

Sin calculates the sine of the input value.

Sincos returns the sine and cosine of the input value.

Sinh returns the hyperbolic sine of X.

Smoothstep returns an interpolation that changes smoothly between input values.

SQRT returns the square root of the input value.

Step return (x> = )? 1: 0.

Tan returns the tangent of the input value.

Fanh returns the hyperbolic tangent of the input value.

Transpose returns the transpose of the input matrix.

Tex1d * 1D texture query.

Tex2d * 2D Texture query.

Tex3d * 3D texture query.

Texcube *CubeTexture query.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/duduliao/archive/2008/12/30/3646100.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.