Difference between revisions of "Cg functions"

From Wikiid
Jump to: navigation, search
(Functions)
 
Line 5: Line 5:
 
! Function !! Description
 
! Function !! Description
 
|-
 
|-
| abs( x )
+
| abs( x ) || Absolute value of x .
| Absolute value of x .
+
 
|-
 
|-
| acos( x )
+
| acos( x ) || Arccos of x in range [0, pi], x in [-1, 1].
| Arccosine of x in range [0, <font face="symbol">p</font>], x in [1, 1].
+
 
|-
 
|-
| all( x )
+
| all( x ) || true if '''all''' components of x != 0 - false otherwise.
| Returns true if every component of x is not equal to 0. Returns false otherwise.
+
 
|-
 
|-
| any( x )
+
| any( x ) || true if '''any''' component of x != 0 - false otherwise.
| Returns true if any component of x is not equal to 0. Returns false otherwise.
+
 
|-
 
|-
| asin( x )
+
| asin( x ) || Arcsin of x in range [-pi/2,pi/2]; x in [-1, 1].
| Arcsine of x in range [<font face="symbol">p</font>/2, <font face="symbol">p</font>/2]; x should be in [1, 1].
+
 
|-
 
|-
| atan( x )
+
| atan( x ) ||| Arctan of x in range [-pi/2, pi/2].
| Arctangent of x in range [<font face="symbol">p</font>/2, <font face="symbol">p</font>/2].
+
 
|-
 
|-
| atan2( y , x )
+
| atan2( y , x ) || Arctan y/x in range [-pi,pi].
| Arctangent of y / x in range [<font face="symbol">p</font>, <font face="symbol">p</font>].
+
 
|-
 
|-
| ceil( x )
+
| ceil( x ) || Smallest integer not less than x .
| Smallest integer not less than x .
+
 
|-
 
|-
| clamp( x , a , b )
+
| clamp( x , a , b ) || x clamped to the range [a,b]: a if x<ab if x>b else returns x.
| x clamped to the range [ a , b ] as follows: Returns a if x is less than a . Returns b if x is greater than b . Returns x otherwise.
+
 
|-
 
|-
| cos( x )
+
| cos( x ) || Cos of x.
| Cosine of x .
+
 
|-
 
|-
| cosh( x )
+
| cosh( x ) || Hyperbolic cos of x .
| Hyperbolic cosine of x .
+
 
|-
 
|-
| cross( A , B )
+
| cross( A , B ) || Cross product of vectors A and B (A and B must be three-component).
| Cross product of vectors A and B <nowiki>;</nowiki> A and B must be three-component vectors.
+
 
|-
 
|-
| ddx( a )
+
| ddx( a ) || Partial derivative of a with respect to screen-space x coordinate
| Approximate partial derivative of a with respect to screen-space x coordinate
+
 
|-
 
|-
| ddy( a )
+
| ddy( a ) || Partial derivative of a with respect to screen-space y coordinate
| Approximate partial derivative of a with respect to screen-space y coordinate
+
 
|-
 
|-
| void debug(float4 x )
+
| debug(float4 x) || If compiler DEBUG option is enabled, causes shader to halt with x copied to the COLOR output - otherwise it does nothing.
| If the compiler's DEBUG option is enabled, calling this function causes the value x to be copied to the COLOR output of the program, and execution of the program is terminated. If the compiler's DEBUG option is not enabled, this function does nothing.
+
 
|-
 
|-
| degrees( x )
+
| degrees( x ) || convert radians to degrees.
| Radian-to-degree conversion.
+
 
|-
 
|-
| determinant( M )
+
| determinant( x ) || Determinant of matrix x.
| Determinant of matrix M .
+
 
|-
 
|-
| distance( pt1 , pt2 )
+
| distance( p1 , p2 ) || Pythagorean distance between p1 and p2.
| Euclidean distance between points pt1 and pt2 .
+
 
|-
 
|-
| dot( A , B )
+
| dot( A, B ) || Dot product of A and B.
| Dot product of vectors A and B .
+
 
|-
 
|-
| exp( x )
+
| exp( x ) || Exponential func: e<sup>x</sup>.
| Exponential function e <sup>x</sup> .
+
 
|-
 
|-
| exp2( x )
+
| exp2( x ) || Exponential function 2<sup>x</sup>.
| Exponential function 2 <sup>x</sup> .
+
 
|-
 
|-
| faceforward( N , I , Ng )
+
| faceforward( N, I, Ng ) || N if dot( Ng , I ) < 0 otherwise (-N).
| N if dot( Ng , I ) < 0; - N otherwise.
+
 
|-
 
|-
| floor( x )
+
| floor( x ) || Largest integer not greater than x.
| Largest integer not greater than x .
+
 
|-
 
|-
| fmod( x , y )
+
| fmod( x , y ) || Remainder of x/y (with the same sign as x). If y==0, result is undefined.
| Remainder of x / y , with the same sign as x . If y is 0, the result is implementation-defined.
+
 
|-
 
|-
| frac( x )
+
| frac( x ) || Fractional part of x.
| Fractional part of x .
+
 
|-
 
|-
| frexp( x , out exp )
+
| frexp( x , out exp ) || Splits x into normalized fraction in the interval [, 1), which is returned, and a power of 2, which is stored in exp . If x==0, both parts of the result are 0.
| Splits x into a normalized fraction in the interval [, 1), which is returned, and a power of 2, which is stored in exp . If x is 0, both parts of the result are 0.
+
 
|-
 
|-
| isfinite( x )
+
| isfinite( x ) || Returns true if x is finite.
| Returns true if x is finite.
+
 
|-
 
|-
| isinf( x )
+
| isinf( x ) || Returns true if x is infinite.
| Returns true if x is infinite.
+
 
|-
 
|-
| isnan( x )
+
| isnan( x ) || Returns true if x is NaN.
| Returns true if x is NaN (Not a Number).
+
 
|-
 
|-
| ldexp( x , n )
+
| ldexp( x , n ) || x * 2<sup>n</sup>.
| x x 2 <sup>n</sup> .
+
 
|-
 
|-
| length( v )
+
| length( v ) || Pythagorean length of vector.
| Euclidean length of a vector.
+
 
|-
 
|-
| lerp( a , b , f )
+
| lerp( a , b , f ) || Linear interpolation: (1 - f)* a + b * f. f can be a vector of same length as a & b.
| Linear interpolation: (1 f )* a + b <nowiki>*</nowiki> f where a and b are matching vector or scalar types. f can be either a scalar or a vector of the same type as a and b .
+
 
|-
 
|-
| lit( NdotL , NdotH , m )
+
| lit( NdotL , NdotH , m ) || Computes lighting coefficients (m is the shininess). Returns: float4: .x=ambient (always 1), .y=diffuse (0 if N.L < 0), .z=specular (0 if N.L<0 or N.H<0); .w==1.0.
| Computes lighting coefficients for ambient, diffuse, and specular light contributions. Expects the NdotL parameter to contain N L and the NdotH parameter to contain N H . Returns a four-component vector as follows: The x component of the result vector contains the ambient coefficient, which is always 1.0. The y component contains the di
+
ffuse coefficient, which is 0 if ( N L ) < 0; otherwise ( N L ). The z component contains the specular coefficient, which is 0 if either ( N L ) < 0 or ( N H ) < 0; ( N H ) <sup>m</sup> otherwise. The w component is 1.0. There is no vectorized version of this function.
+
 
|-
 
|-
| log( x )
+
| log( x ) || Natural logarithm (x>0).
| Natural logarithm ln( x ) <nowiki>; </nowiki> x must be greater than 0.
+
 
|-
 
|-
| log2( x )
+
| log2( x ) || Log Base 2 (x>0).
| Base 2 logarithm of x <nowiki>; </nowiki> x must be greater than 0.
+
 
|-
 
|-
| log10( x )
+
| log10( x ) || Log Base 10 (x>0).
| Base 10 logarithm of x <nowiki>; </nowiki> x must be greater than 0.
+
 
|-
 
|-
| max( a , b )
+
| max( a , b ) || Maximum of a and b .
| Maximum of a and b .
+
 
|-
 
|-
| min( a , b )
+
| min( a , b ) || Minimum of a and b .
| Minimum of a and b .
+
 
|-
 
|-
| modf( x , out ip )
+
| modf( x , out ip ) || Splits x into int and frac parts (each with the same sign as x). Stores the int part in ip and returns the fractional part.
| Splits x into integral and fractional parts, each with the same sign as x . Stores the integral part in ip and returns the fractional part.
+
 
|-
 
|-
| mul( M , N )
+
| mul( M , N ) || Matrix product of matrix M and matrix N: If M has size AxB, and N has size BxC, returns an AxC.
| Matrix product of matrix M and matrix N , as shown below: If M has size A x B , and N has size B x C , returns a matrix of size A x C .
+
 
|-
 
|-
| mul( M , v )
+
| mul( M , v ) || Product of matrix M and column vector v: If M has size AxB, and v is Bx1, returns an Ax1.
| Product of matrix M and column vector v , as shown below: If M is an A x B matrix and v is a B x 1 vector, returns an A x 1 vector.
+
 
|-
 
|-
| mul( v , M )
+
| mul( v , M ) || Product of row vector v and matrix M: If v is a 1xA and M is AxB, returns a 1xB.
| Product of row vector v and matrix M , as shown below: If v is a 1 x A vector and M is an A x B matrix, returns a 1 x B vector.
+
 
|-
 
|-
| noise( x )
+
| noise( x ) || Noise function. The returned value is between 0 and 1, and is always the same for a given input value.
| Either a one-, two-, or three-dimensional noise function, depending on the type of its argument. The returned value is between 0 and 1, and is always the same for a given input value.
+
 
|-
 
|-
| normalize( v )
+
| normalize( v ) || Normalize v.
| Returns a vector of length 1 that points in the same direction as vector v .
+
 
|-
 
|-
| pow( x , y )
+
| pow( x , y ) || x<sup>y</sup>
| x<sup>y</sup> .
+
 
|-
 
|-
| radians( x )
+
| radians( x ) || Converts degrees to radians.
| Degree-to-radian conversion.
+
 
|-
 
|-
| reflect( I , N )
+
| reflect( I , N ) || Computes reflection of I in a plane with surface normal N. (three-component vectors only).
| Computes reflection vector from entering ray direction I and surface normal N . Valid only for three-component vectors.
+
 
|-
 
|-
| refract( I , N , eta )
+
| refract( I , N , eta ) || Computes refraction of I in a plane with surface normal N and refractive index eta. Returns (0,0,0) for total internal reflection. (three-component vectors only).
| Given entering ray direction I , surface normal N , and relative index of refraction eta , computes refraction vector. If the angle between I and N is too large for a given eta , returns (0, 0, 0). Valid only for three-component vectors.
+
 
|-
 
|-
| round( x )
+
| round( x ) || Closest integer to x.
| Closest integer to x .
+
 
|-
 
|-
| rsqrt( x )
+
| rsqrt( x ) || Reciprocal square root of x (x>0).
| Reciprocal square root of x <nowiki>; </nowiki> x must be greater than 0.
+
 
|-
 
|-
| saturate( x )
+
| saturate( x ) || Clamps x to [0, 1].
| Clamps x to the [0, 1] range.
+
 
|-
 
|-
| sign( x )
+
| sign( x ) || Sign of x (returns -1, 0 or +1)
| 1 if x > 0; 1 if x < 0; 0 otherwise.
+
 
|-
 
|-
| sin( x )
+
| sin( x ) || Sin of x.
| Sine of x .
+
 
|-
 
|-
| sincos(float x , out s , out c )
+
| sincos(float x , out s , out c ) || s is set to sin(x), and c to cos(x).
| s is set to the sine of x , and c is set to the cosine of x . If both sin( x ) and cos( x ) are needed, this function is more efficient than calculating each individually.
+
 
|-
 
|-
| sinh( x )
+
| sinh( x ) || Hyperbolic sine of x.
| Hyperbolic sine of x .
+
 
|-
 
|-
| smoothstep( min , max , x )
+
| smoothstep( min , max , x ) || For values of x between min and max , returns a smoothly varying value that ranges from 0 at x==min to 1 at x==max. x is clamped to the range [min,max] and then returns 2*((x-min)/(max-min))<sup>3</sup>+3*((x-min)/(max-min))<sup>2</sup>
| For values of x between min and max , returns a smoothly varying value that ranges from 0 at x <nowiki>=</nowiki> min to 1 at x <nowiki>=</nowiki> max . x is clamped to the range [ min , max ] and then the interpolation formula is evaluated: 2*(( x min )/( max min ))<sup>3</sup> + 3*(( x min )/( max min ))<sup>2</sup>
+
 
|-
 
|-
| step( a , x )
+
| step( a , x ) || 0 if x<a, 1 if x>=a
| 0 if x < a <nowiki>;</nowiki> 1 if x >= a .
+
 
|-
 
|-
| sqrt( x )
+
| sqrt( x ) || Square root of x (x>0)
| Square root of x <nowiki>;</nowiki> x must be greater than 0.
+
 
|-
 
|-
| tan( x )
+
| tan( x ) || Tan of x.
| Tangent of x .
+
 
|-
 
|-
| tanh( x )
+
| tanh( x ) || Hyperbolic tan of x.
| Hyperbolic tangent of x .
+
 
|-
 
|-
| tex1D(sampler1D tex , float s )
+
| tex1D(sampler1D tex , float s ) || 1D nonprojective texture lookup
| 1D nonprojective texture query
+
 
|-
 
|-
| tex1D(sampler1D tex , float s , float dsdx , float dsdy )
+
| tex1D(sampler1D tex , float s , float dsdx , float dsdy ) || 1D nonprojective texture lookup with derivatives
| 1D nonprojective texture query with derivatives
+
 
|-
 
|-
| tex1D(sampler1D tex , float2 sz )
+
| tex1D(sampler1D tex , float2 sz ) || 1D nonprojective depth compare texture lookup
| 1D nonprojective depth compare texture query
+
 
|-
 
|-
| tex1D(sampler1D tex , float2 sz , float dsdx , float dsdy )
+
| tex1D(sampler1D tex , float2 sz , float dsdx , float dsdy ) || 1D nonprojective depth compare texture lookup with derivatives
| 1D nonprojective depth compare texture query with derivatives
+
 
|-
 
|-
| tex1Dproj(sampler1D tex , float2 sq )
+
| tex1Dproj(sampler1D tex , float2 sq ) || 1D projective texture lookup
| 1D projective texture query
+
 
|-
 
|-
| tex1Dproj(sampler1D tex , float3 szq )
+
| tex1Dproj(sampler1D tex , float3 szq ) || 1D projective depth compare texture lookup
| 1D projective depth compare texture query
+
 
|-
 
|-
| tex2D(sampler2D tex , float2 s )
+
| tex2D(sampler2D tex , float2 s ) || 2D nonprojective texture lookup
| 2D nonprojective texture query
+
 
|-
 
|-
| tex2D(sampler2D tex , float2 s , float2 dsdx , float2 dsdy )
+
| tex2D(sampler2D tex , float2 s , float2 dsdx , float2 dsdy ) || 2D nonprojective texture lookup with derivatives
| 2D nonprojective texture query with derivatives
+
 
|-
 
|-
| tex2D(sampler2D tex , float3 sz )
+
| tex2D(sampler2D tex , float3 sz ) || 2D nonprojective depth compare texture lookup
| 2D nonprojective depth compare texture query
+
 
|-
 
|-
| tex2D(sampler2D tex , float3 sz , float2 dsdx , float2 dsdy )
+
| tex2D(sampler2D tex , float3 sz , float2 dsdx , float2 dsdy ) || 2D nonprojective depth compare texture lookup with derivatives
| 2D nonprojective depth compare texture query with derivatives
+
 
|-
 
|-
| tex2Dproj(sampler2D tex , float3 sq )
+
| tex2Dproj(sampler2D tex , float3 sq ) || 2D projective texture lookup
| 2D projective texture query
+
 
|-
 
|-
| tex2Dproj(sampler2D tex , float4 szq )
+
| tex2Dproj(sampler2D tex , float4 szq ) || 2D projective depth compare texture lookup
| 2D projective depth compare texture query
+
 
|-
 
|-
| texRECT(samplerRECT tex , float2 s )
+
| texRECT(samplerRECT tex , float2 s ) || 2D nonprojective texture rectangle texture lookup (OpenGL)
| 2D nonprojective texture rectangle texture query (OpenGL only)
+
 
|-
 
|-
| texRECT(samplerRECT tex , float2 s , float2 dsdx , float2 dsdy )
+
| texRECT(samplerRECT tex , float2 s , float2 dsdx , float2 dsdy ) || 2D nonprojective texture rectangle texture lookup with derivatives (OpenGL)
| 2D nonprojective texture rectangle texture query with derivatives (OpenGL only)
+
 
|-
 
|-
| texRECT(samplerRECT tex , float3 sz )
+
| texRECT(samplerRECT tex , float3 sz ) || 2D nonprojective texture rectangle depth compare texture lookup (OpenGL)
| 2D nonprojective texture rectangle depth compare texture query (OpenGL only)
+
 
|-
 
|-
| texRECT(samplerRECT tex , float3 sz , float2 dsdx , float2 dsdy )
+
| texRECT(samplerRECT tex , float3 sz , float2 dsdx , float2 dsdy ) || 2D nonprojective depth compare texture lookup with derivatives (OpenGL)
| 2D nonprojective depth compare texture query with derivatives (OpenGL only)
+
 
|-
 
|-
| texRECTproj(samplerRECT tex , float3 sq )
+
| texRECTproj(samplerRECT tex , float3 sq ) || 2D texture rectangle projective texture lookup (OpenGL)
| 2D texture rectangle projective texture query (OpenGL only)
+
 
|-
 
|-
| texRECTproj(samplerRECT tex , float3 szq )
+
| texRECTproj(samplerRECT tex , float3 szq ) || 2D texture rectangle projective depth compare texture lookup (OpenGL)
| 2D texture rectangle projective depth compare texture query (OpenGL only)
+
 
|-
 
|-
| tex3D(sampler3D tex , float3 s )
+
| tex3D(sampler3D tex , float3 s ) || 3D nonprojective texture lookup
| 3D nonprojective texture query
+
 
|-
 
|-
| tex3D(sampler3D tex , float3 s , float3 dsdx , float3 dsdy )
+
| tex3D(sampler3D tex , float3 s , float3 dsdx , float3 dsdy ) || 3D nonprojective texture lookup with derivatives
| 3D nonprojective texture query with derivatives
+
 
|-
 
|-
| tex3Dproj(sampler3D tex , float4 sq )
+
| tex3Dproj(sampler3D tex , float4 sq ) || 3D projective texture lookup
| 3D projective texture query
+
 
|-
 
|-
| texCUBE(samplerCUBE tex , float3 s )
+
| texCUBE(samplerCUBE tex , float3 s ) || Cubemap nonprojective texture lookup
| Cube map nonprojective texture query
+
 
|-
 
|-
| texCUBE(samplerCUBE tex , float3 s , float3 dsdx , float3 dsdy )
+
| texCUBE(samplerCUBE tex , float3 s , float3 dsdx , float3 dsdy ) || Cubemap nonprojective texture lookup with derivatives
| Cube map nonprojective texture query with derivatives
+
 
|-
 
|-
| texCUBEproj(samplerCUBE tex , float4 sq )
+
| texCUBEproj(samplerCUBE tex , float4 sq ) || Cube map projective texture lookup (ignores q)
| Cube map projective texture query (ignores q)
+
 
|-
 
|-
| transpose( M )
+
| transpose( M ) || transpose of matrix M
| Matrix transpose of matrix M . If M is an A x B matrix, the transpose of M is a B x A matrix whose first column is the first row of M , whose second column is the second row of M , whose third column is the third row of M , and so on.
+
 
|}
 
|}
  

Latest revision as of 10:23, 6 October 2009

The Cg function table:

Functions

Function Description
abs( x ) Absolute value of x .
acos( x ) Arccos of x in range [0, pi], x in [-1, 1].
all( x ) true if all components of x != 0 - false otherwise.
any( x ) true if any component of x != 0 - false otherwise.
asin( x ) Arcsin of x in range [-pi/2,pi/2]; x in [-1, 1].
atan( x ) Arctan of x in range [-pi/2, pi/2].
atan2( y , x ) Arctan y/x in range [-pi,pi].
ceil( x ) Smallest integer not less than x .
clamp( x , a , b ) x clamped to the range [a,b]: a if x<a, b if x>b else returns x.
cos( x ) Cos of x.
cosh( x ) Hyperbolic cos of x .
cross( A , B ) Cross product of vectors A and B (A and B must be three-component).
ddx( a ) Partial derivative of a with respect to screen-space x coordinate
ddy( a ) Partial derivative of a with respect to screen-space y coordinate
debug(float4 x) If compiler DEBUG option is enabled, causes shader to halt with x copied to the COLOR output - otherwise it does nothing.
degrees( x ) convert radians to degrees.
determinant( x ) Determinant of matrix x.
distance( p1 , p2 ) Pythagorean distance between p1 and p2.
dot( A, B ) Dot product of A and B.
exp( x ) Exponential func: ex.
exp2( x ) Exponential function 2x.
faceforward( N, I, Ng ) N if dot( Ng , I ) < 0 otherwise (-N).
floor( x ) Largest integer not greater than x.
fmod( x , y ) Remainder of x/y (with the same sign as x). If y==0, result is undefined.
frac( x ) Fractional part of x.
frexp( x , out exp ) Splits x into normalized fraction in the interval [, 1), which is returned, and a power of 2, which is stored in exp . If x==0, both parts of the result are 0.
isfinite( x ) Returns true if x is finite.
isinf( x ) Returns true if x is infinite.
isnan( x ) Returns true if x is NaN.
ldexp( x , n ) x * 2n.
length( v ) Pythagorean length of vector.
lerp( a , b , f ) Linear interpolation: (1 - f)* a + b * f. f can be a vector of same length as a & b.
lit( NdotL , NdotH , m ) Computes lighting coefficients (m is the shininess). Returns: float4: .x=ambient (always 1), .y=diffuse (0 if N.L < 0), .z=specular (0 if N.L<0 or N.H<0); .w==1.0.
log( x ) Natural logarithm (x>0).
log2( x ) Log Base 2 (x>0).
log10( x ) Log Base 10 (x>0).
max( a , b ) Maximum of a and b .
min( a , b ) Minimum of a and b .
modf( x , out ip ) Splits x into int and frac parts (each with the same sign as x). Stores the int part in ip and returns the fractional part.
mul( M , N ) Matrix product of matrix M and matrix N: If M has size AxB, and N has size BxC, returns an AxC.
mul( M , v ) Product of matrix M and column vector v: If M has size AxB, and v is Bx1, returns an Ax1.
mul( v , M ) Product of row vector v and matrix M: If v is a 1xA and M is AxB, returns a 1xB.
noise( x ) Noise function. The returned value is between 0 and 1, and is always the same for a given input value.
normalize( v ) Normalize v.
pow( x , y ) xy
radians( x ) Converts degrees to radians.
reflect( I , N ) Computes reflection of I in a plane with surface normal N. (three-component vectors only).
refract( I , N , eta ) Computes refraction of I in a plane with surface normal N and refractive index eta. Returns (0,0,0) for total internal reflection. (three-component vectors only).
round( x ) Closest integer to x.
rsqrt( x ) Reciprocal square root of x (x>0).
saturate( x ) Clamps x to [0, 1].
sign( x ) Sign of x (returns -1, 0 or +1)
sin( x ) Sin of x.
sincos(float x , out s , out c ) s is set to sin(x), and c to cos(x).
sinh( x ) Hyperbolic sine of x.
smoothstep( min , max , x ) For values of x between min and max , returns a smoothly varying value that ranges from 0 at x==min to 1 at x==max. x is clamped to the range [min,max] and then returns 2*((x-min)/(max-min))3+3*((x-min)/(max-min))2
step( a , x ) 0 if x<a, 1 if x>=a
sqrt( x ) Square root of x (x>0)
tan( x ) Tan of x.
tanh( x ) Hyperbolic tan of x.
tex1D(sampler1D tex , float s ) 1D nonprojective texture lookup
tex1D(sampler1D tex , float s , float dsdx , float dsdy ) 1D nonprojective texture lookup with derivatives
tex1D(sampler1D tex , float2 sz ) 1D nonprojective depth compare texture lookup
tex1D(sampler1D tex , float2 sz , float dsdx , float dsdy ) 1D nonprojective depth compare texture lookup with derivatives
tex1Dproj(sampler1D tex , float2 sq ) 1D projective texture lookup
tex1Dproj(sampler1D tex , float3 szq ) 1D projective depth compare texture lookup
tex2D(sampler2D tex , float2 s ) 2D nonprojective texture lookup
tex2D(sampler2D tex , float2 s , float2 dsdx , float2 dsdy ) 2D nonprojective texture lookup with derivatives
tex2D(sampler2D tex , float3 sz ) 2D nonprojective depth compare texture lookup
tex2D(sampler2D tex , float3 sz , float2 dsdx , float2 dsdy ) 2D nonprojective depth compare texture lookup with derivatives
tex2Dproj(sampler2D tex , float3 sq ) 2D projective texture lookup
tex2Dproj(sampler2D tex , float4 szq ) 2D projective depth compare texture lookup
texRECT(samplerRECT tex , float2 s ) 2D nonprojective texture rectangle texture lookup (OpenGL)
texRECT(samplerRECT tex , float2 s , float2 dsdx , float2 dsdy ) 2D nonprojective texture rectangle texture lookup with derivatives (OpenGL)
texRECT(samplerRECT tex , float3 sz ) 2D nonprojective texture rectangle depth compare texture lookup (OpenGL)
texRECT(samplerRECT tex , float3 sz , float2 dsdx , float2 dsdy ) 2D nonprojective depth compare texture lookup with derivatives (OpenGL)
texRECTproj(samplerRECT tex , float3 sq ) 2D texture rectangle projective texture lookup (OpenGL)
texRECTproj(samplerRECT tex , float3 szq ) 2D texture rectangle projective depth compare texture lookup (OpenGL)
tex3D(sampler3D tex , float3 s ) 3D nonprojective texture lookup
tex3D(sampler3D tex , float3 s , float3 dsdx , float3 dsdy ) 3D nonprojective texture lookup with derivatives
tex3Dproj(sampler3D tex , float4 sq ) 3D projective texture lookup
texCUBE(samplerCUBE tex , float3 s ) Cubemap nonprojective texture lookup
texCUBE(samplerCUBE tex , float3 s , float3 dsdx , float3 dsdy ) Cubemap nonprojective texture lookup with derivatives
texCUBEproj(samplerCUBE tex , float4 sq ) Cube map projective texture lookup (ignores q)
transpose( M ) transpose of matrix M

NOTES:

  • s indicates a one-, two-, or three-component texture coordinate.
  • z indicates a depth comparison value for shadow map lookups.
  • q indicates a perspective value, and is used to divide the texture coordinate ( s ) before the texture lookup is performed.

When you use the texture functions that allow specifying a depth comparison value, the associated texture unit must be configured for depth-compare texturing. Otherwise, no depth comparison will actually be performed.