﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-cngamedev-文章分类-Shader</title><link>http://www.cppblog.com/cngamedev/category/11947.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 15 Oct 2009 18:50:27 GMT</lastBuildDate><pubDate>Thu, 15 Oct 2009 18:50:27 GMT</pubDate><ttl>60</ttl><item><title>Intrinsic Functions (DirectX HLSL)</title><link>http://www.cppblog.com/cngamedev/articles/98603.html</link><dc:creator>cngamedev</dc:creator><author>cngamedev</author><pubDate>Wed, 14 Oct 2009 09:03:00 GMT</pubDate><guid>http://www.cppblog.com/cngamedev/articles/98603.html</guid><wfw:comment>http://www.cppblog.com/cngamedev/comments/98603.html</wfw:comment><comments>http://www.cppblog.com/cngamedev/articles/98603.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/cngamedev/comments/commentRss/98603.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/cngamedev/services/trackbacks/98603.html</trackback:ping><description><![CDATA[<h1>Intrinsic Functions (DirectX HLSL)</h1>
<p>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.</p>
<table>
    <tbody>
        <tr>
            <th>Name</th>
            <th>Syntax</th>
            <th>Description</th>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_abs.htm"><u><font color=#0000ff>abs</font></u></a></td>
            <td>abs(x)</td>
            <td>Absolute value (per component).</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_acos.htm"><u><font color=#0000ff>acos</font></u></a></td>
            <td>acos(x)</td>
            <td>Returns the arccosine of each component of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_all.htm"><u><font color=#0000ff>all</font></u></a></td>
            <td>all(x)</td>
            <td>Test if all components of x are nonzero.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_any.htm"><u><font color=#0000ff>any</font></u></a></td>
            <td>any(x)</td>
            <td>Test if any component of x is nonzero.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_asfloat.htm"><u><font color=#0000ff>asfloat</font></u></a></td>
            <td>asfloat(x)</td>
            <td>Convert the input type to a float.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_asin.htm"><u><font color=#0000ff>asin</font></u></a></td>
            <td>asin(x)</td>
            <td>Returns the arcsine of each component of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_asint.htm"><u><font color=#0000ff>asint</font></u></a></td>
            <td>asint(x)</td>
            <td>Convert the input type to an integer.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_asuint.htm"><u><font color=#0000ff>asuint</font></u></a></td>
            <td>asuint(x)</td>
            <td>Convert the input type to an unsigned integer.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_atan.htm"><u><font color=#0000ff>atan</font></u></a></td>
            <td>atan(x)</td>
            <td>Returns the arctangent of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_atan2.htm"><u><font color=#0000ff>atan2</font></u></a></td>
            <td>atan2(y, x)</td>
            <td>Returns the arctangent of of two values (x,y).</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_ceil.htm"><u><font color=#0000ff>ceil</font></u></a></td>
            <td>ceil(x)</td>
            <td>Returns the smallest integer which is greater than or equal to x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_clamp.htm"><u><font color=#0000ff>clamp</font></u></a></td>
            <td>clamp(x, min, max)</td>
            <td>Clamps x to the range [min, max].</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_clip.htm"><u><font color=#0000ff>clip</font></u></a></td>
            <td>clip(x)</td>
            <td>Discards the current pixel, if any component of x is less than zero.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_cos.htm"><u><font color=#0000ff>cos</font></u></a></td>
            <td>cos(x)</td>
            <td>Returns the cosine of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_cosh.htm"><u><font color=#0000ff>cosh</font></u></a></td>
            <td>cosh(x)</td>
            <td>Returns the hyperbolic cosine of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_cross.htm"><u><font color=#0000ff>cross</font></u></a></td>
            <td>cross(x, y)</td>
            <td>Returns the cross product of two 3D vectors.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_D3DCOLORtoUBYTE4.htm"><u><font color=#0000ff>D3DCOLORtoUBYTE4</font></u></a></td>
            <td>D3DCOLORtoUBYTE4(x)</td>
            <td>Swizzles and scales components of the 4D vector x to compensate for the lack of UBYTE4 support in some hardware.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_ddx.htm"><u><font color=#0000ff>ddx</font></u></a></td>
            <td>ddx(x)</td>
            <td>Returns the partial derivative of x with respect to the screen-space x-coordinate.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_ddy.htm"><u><font color=#0000ff>ddy</font></u></a></td>
            <td>ddy(x)</td>
            <td>Returns the partial derivative of x with respect to the screen-space y-coordinate.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_degrees.htm"><u><font color=#0000ff>degrees</font></u></a></td>
            <td>degrees(x)</td>
            <td>Converts x from radians to degrees.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_determinant.htm"><u><font color=#0000ff>determinant</font></u></a></td>
            <td>determinant(m)</td>
            <td>Returns the determinant of the square matrix m.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_distance.htm"><u><font color=#0000ff>distance</font></u></a></td>
            <td>distance(x, y)</td>
            <td>Returns the distance between two points.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_dot.htm"><u><font color=#0000ff>dot</font></u></a></td>
            <td>dot(x, y)</td>
            <td>Returns the dot product of two vectors.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_exp.htm"><u><font color=#0000ff>exp</font></u></a></td>
            <td>exp(x)</td>
            <td>Returns the base-e exponent.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_exp2.htm"><u><font color=#0000ff>exp2</font></u></a></td>
            <td>exp2(x)</td>
            <td>Base 2 exponent (per component).</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_faceforward.htm"><u><font color=#0000ff>faceforward</font></u></a></td>
            <td>faceforward(n, i, ng)</td>
            <td>Returns -n * sign(&#8226;(i, ng)).</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_floor.htm"><u><font color=#0000ff>floor</font></u></a></td>
            <td>floor(x)</td>
            <td>Returns the greatest integer which is less than or equal to x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_fmod.htm"><u><font color=#0000ff>fmod</font></u></a></td>
            <td>fmod(x, y)</td>
            <td>Returns the floating point remainder of x/y.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_frac.htm"><u><font color=#0000ff>frac</font></u></a></td>
            <td>frac(x)</td>
            <td>Returns the fractional part of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_frexp.htm"><u><font color=#0000ff>frexp</font></u></a></td>
            <td>frexp(x, exp)</td>
            <td>Returns the mantissa and exponent of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_fwidth.htm"><u><font color=#0000ff>fwidth</font></u></a></td>
            <td>fwidth(x)</td>
            <td>Returns abs(ddx(x)) + abs(ddy(x))</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_GetRenderTargetSampleCount.htm"><u><font color=#0000ff>GetRenderTargetSampleCount</font></u></a></td>
            <td>GetRenderTargetSampleCount()</td>
            <td>Returns the number of render-target samples.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_GetRenderTargetSamplePosition.htm"><u><font color=#0000ff>GetRenderTargetSamplePosition</font></u></a></td>
            <td>GetRenderTargetSamplePosition(x)</td>
            <td>Returns a sample position (x,y) for a given sample index.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_isfinite.htm"><u><font color=#0000ff>isfinite</font></u></a></td>
            <td>isfinite(x)</td>
            <td>Returns true if x is finite, false otherwise.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_isinf.htm"><u><font color=#0000ff>isinf</font></u></a></td>
            <td>isinf(x)</td>
            <td>Returns true if x is +INF or -INF, false otherwise.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_isnan.htm"><u><font color=#0000ff>isnan</font></u></a></td>
            <td>isnan(x)</td>
            <td>Returns true if x is NAN or QNAN, false otherwise.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_ldexp.htm"><u><font color=#0000ff>ldexp</font></u></a></td>
            <td>ldexp(x, exp)</td>
            <td>Returns x * 2exp</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_length.htm"><u><font color=#0000ff>length</font></u></a></td>
            <td>length(v)</td>
            <td>Returns the length of the vector v.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_lerp.htm"><u><font color=#0000ff>lerp</font></u></a></td>
            <td>lerp(x, y, s)</td>
            <td>Returns x + s(y - x).</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_lit.htm"><u><font color=#0000ff>lit</font></u></a></td>
            <td>lit(n &#8226; l, n &#8226; h, m)</td>
            <td>Returns a lighting vector (ambient, diffuse, specular, 1)</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_log.htm"><u><font color=#0000ff>log</font></u></a></td>
            <td>log(x)</td>
            <td>Returns the base-e logarithm of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_log10.htm"><u><font color=#0000ff>log10</font></u></a></td>
            <td>log10(x)</td>
            <td>Returns the base-10 logarithm of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_log2.htm"><u><font color=#0000ff>log2</font></u></a></td>
            <td>log2(x)</td>
            <td>Returns the base-2 logarithm of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_max.htm"><u><font color=#0000ff>max</font></u></a></td>
            <td>max(x, y)</td>
            <td>Selects the greater of x and y.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_min.htm"><u><font color=#0000ff>min</font></u></a></td>
            <td>min(x, y)</td>
            <td>Selects the lesser of x and y.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_modf.htm"><u><font color=#0000ff>modf</font></u></a></td>
            <td>modf(x, out ip)</td>
            <td>Splits the value x into fractional and integer parts.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_mul.htm"><u><font color=#0000ff>mul</font></u></a></td>
            <td>mul(x, y)</td>
            <td>Performs matrix multiplication using x and y.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_noise.htm"><u><font color=#0000ff>noise</font></u></a></td>
            <td>noise(x)</td>
            <td>Generates a random value using the Perlin-noise algorithm.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_normalize.htm"><u><font color=#0000ff>normalize</font></u></a></td>
            <td>normalize(x)</td>
            <td>Returns a normalized vector.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_pow.htm"><u><font color=#0000ff>pow</font></u></a></td>
            <td>pow(x, y)</td>
            <td>Returns x<sup>y</sup>.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_radians.htm"><u><font color=#0000ff>radians</font></u></a></td>
            <td>radians(x)</td>
            <td>Converts x from degrees to radians.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_reflect.htm"><u><font color=#0000ff>reflect</font></u></a></td>
            <td>reflect(i, n)</td>
            <td>Returns a reflection vector.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_refract.htm"><u><font color=#0000ff>refract</font></u></a></td>
            <td>refract(i, n, R)</td>
            <td>Returns the refraction vector.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_round.htm"><u><font color=#0000ff>round</font></u></a></td>
            <td>round(x)</td>
            <td>Rounds x to the nearest integer</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_rsqrt.htm"><u><font color=#0000ff>rsqrt</font></u></a></td>
            <td>rsqrt(x)</td>
            <td>Returns 1 / sqrt(x)</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_saturate.htm"><u><font color=#800080>saturate</font></u></a></td>
            <td>saturate(x)</td>
            <td>Clamps x to the range [0, 1]</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_sign.htm"><u><font color=#0000ff>sign</font></u></a></td>
            <td>sign(x)</td>
            <td>Computes the sign of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_sin.htm"><u><font color=#0000ff>sin</font></u></a></td>
            <td>sin(x)</td>
            <td>Returns the sine of x</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_sincos.htm"><u><font color=#0000ff>sincos</font></u></a></td>
            <td>sincos(x, out s, out c)</td>
            <td>Returns the sine and cosine of x.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_sinh.htm"><u><font color=#0000ff>sinh</font></u></a></td>
            <td>sinh(x)</td>
            <td>Returns the hyperbolic sine of x</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_smoothstep.htm"><u><font color=#0000ff>smoothstep</font></u></a></td>
            <td>smoothstep(min, max, x)</td>
            <td>Returns a smooth Hermite interpolation between 0 and 1.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_sqrt.htm"><u><font color=#0000ff>sqrt</font></u></a></td>
            <td>sqrt(x)</td>
            <td>Square root (per component)</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_step.htm"><u><font color=#0000ff>step</font></u></a></td>
            <td>step(a, x)</td>
            <td>Returns (x &gt;= a) ? 1 : 0</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tan.htm"><u><font color=#0000ff>tan</font></u></a></td>
            <td>tan(x) </td>
            <td>Returns the tangent of x</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tanh.htm"><u><font color=#0000ff>tanh</font></u></a></td>
            <td>tanh(x)</td>
            <td>Returns the hyperbolic tangent of x</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex1D.htm"><u><font color=#0000ff>tex1D</font></u></a></td>
            <td>tex1D(s, t)</td>
            <td>1D texture lookup.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex1Dbias.htm"><u><font color=#0000ff>tex1Dbias</font></u></a></td>
            <td>tex1Dbias(s, t)</td>
            <td>1D texture lookup with bias.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex1Dgrad.htm"><u><font color=#0000ff>tex1Dgrad</font></u></a></td>
            <td>tex1Dgrad(s, t, ddx, ddy)</td>
            <td>1D texture lookup with a gradient.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex1Dlod.htm"><u><font color=#0000ff>tex1Dlod</font></u></a></td>
            <td>tex1Dlod(s, t)</td>
            <td>1D texture lookup with LOD.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex1Dproj.htm"><u><font color=#0000ff>tex1Dproj</font></u></a></td>
            <td>tex1Dproj(s, t)</td>
            <td>1D texture lookup with projective divide.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex2D.htm"><u><font color=#0000ff>tex2D</font></u></a></td>
            <td>tex2D(s, t)</td>
            <td>2D texture lookup.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex2Dbias.htm"><u><font color=#0000ff>tex2Dbias</font></u></a></td>
            <td>tex2Dbias(s, t)</td>
            <td>2D texture lookup with bias.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex2Dgrad.htm"><u><font color=#0000ff>tex2Dgrad</font></u></a></td>
            <td>tex2Dgrad(s, t, ddx, ddy)</td>
            <td>2D texture lookup with a gradient.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex2Dlod.htm"><u><font color=#0000ff>tex2Dlod</font></u></a></td>
            <td>tex2Dlod(s, t)</td>
            <td>2D texture lookup with LOD.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex2Dproj.htm"><u><font color=#0000ff>tex2Dproj</font></u></a></td>
            <td>tex2Dproj(s, t)</td>
            <td>2D texture lookup with projective divide.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex3D.htm"><u><font color=#0000ff>tex3D</font></u></a></td>
            <td>tex3D(s, t)</td>
            <td>3D texture lookup.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex3Dbias.htm"><u><font color=#0000ff>tex3Dbias</font></u></a></td>
            <td>tex3Dbias(s, t)</td>
            <td>3D texture lookup with bias.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex3Dgrad.htm"><u><font color=#0000ff>tex3Dgrad</font></u></a></td>
            <td>tex3Dgrad(s, t, ddx, ddy)</td>
            <td>3D texture lookup with a gradient.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex3Dlod.htm"><u><font color=#0000ff>tex3Dlod</font></u></a></td>
            <td>tex3Dlod(s, t)</td>
            <td>3D texture lookup with LOD.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_tex3Dproj.htm"><u><font color=#0000ff>tex3Dproj</font></u></a></td>
            <td>tex3Dproj(s, t)</td>
            <td>3D texture lookup with projective divide.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_texCUBE.htm"><u><font color=#800080>texCUBE</font></u></a></td>
            <td>texCUBE(s, t)</td>
            <td>Cube texture lookup.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_texCUBEbias.htm"><u><font color=#0000ff>texCUBEbias</font></u></a></td>
            <td>texCUBEbias(s, t)</td>
            <td>Cube texture lookup with bias.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_texCUBEgrad.htm"><u><font color=#0000ff>texCUBEgrad</font></u></a></td>
            <td>texCUBEgrad(s, t, ddx, ddy)</td>
            <td>Cube texture lookup with a gradient.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_texCUBElod.htm"><u><font color=#0000ff>texCUBElod</font></u></a></td>
            <td>tex3Dlod(s, t)</td>
            <td>Cube texture lookup with LOD.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_texCUBEproj.htm"><u><font color=#0000ff>texCUBEproj</font></u></a></td>
            <td>texCUBEproj(s, t)</td>
            <td>Cube texture lookup with projective divide.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_transpose.htm"><u><font color=#0000ff>transpose</font></u></a></td>
            <td>transpose(m)</td>
            <td>Returns the transpose of the matrix m.</td>
        </tr>
        <tr>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_trunc.htm"><u><font color=#0000ff>trunc</font></u></a></td>
            <td>trunc(x)</td>
            <td>Truncates floating-point value(s) to integer value(s)</td>
        </tr>
    </tbody>
</table>
<h2><a name=Component_Type></a>Component and Template Types</h2>
<p>The HLSL intrinsic function declarations use component types and template types for input paramter arguments and return values. The available types are listed in the following table.</p>
<table>
    <tbody>
        <tr>
            <th>These Template Types</th>
            <th>Description</th>
            <th>Support These Data Types</th>
        </tr>
        <tr>
            <td>matrix</td>
            <td>up to 16 components depending on the declaration</td>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_data_types.htm"><u><font color=#0000ff>Basic HLSL Types</font></u></a></td>
        </tr>
        <tr>
            <td>object</td>
            <td>sampler object</td>
            <td><em>sampler</em>, <em>sampler1D</em>, <em>sampler2D</em>, <em>sampler3D</em>, <em>samplerCUBE</em></td>
        </tr>
        <tr>
            <td>scalar</td>
            <td>1 component</td>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_data_types.htm"><u><font color=#0000ff>Basic HLSL Types</font></u></a></td>
        </tr>
        <tr>
            <td>vector</td>
            <td>1 component minimum, 4 components maximum (inclusive)</td>
            <td><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_data_types.htm"><u><font color=#0000ff>Basic HLSL Types</font></u></a></td>
        </tr>
    </tbody>
</table>
<h4><a name=seealso></a>See Also</h4>
<p><a href="mk:@MSITStore:D:\Program%20Files\Microsoft%20DirectX%20SDK%20(August%202008)\Documentation\DirectX9\directx_sdk.chm::/dx_graphics_hlsl_reference.htm"><u><font color=#0000ff>Reference for HLSL</font></u></a> </p>
<img src ="http://www.cppblog.com/cngamedev/aggbug/98603.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/cngamedev/" target="_blank">cngamedev</a> 2009-10-14 17:03 <a href="http://www.cppblog.com/cngamedev/articles/98603.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Keywords (DirectX HLSL)</title><link>http://www.cppblog.com/cngamedev/articles/98604.html</link><dc:creator>cngamedev</dc:creator><author>cngamedev</author><pubDate>Wed, 14 Oct 2009 09:03:00 GMT</pubDate><guid>http://www.cppblog.com/cngamedev/articles/98604.html</guid><wfw:comment>http://www.cppblog.com/cngamedev/comments/98604.html</wfw:comment><comments>http://www.cppblog.com/cngamedev/articles/98604.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/cngamedev/comments/commentRss/98604.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/cngamedev/services/trackbacks/98604.html</trackback:ping><description><![CDATA[<p>The following words are recognized as keywords by the HLSL language. Keywords are predefined reserved identifiers that have special meanings. They cannot be used as identifiers in your program.</p>
<p>Keywords are not case sensitive, they are displayed in camel casing (first letter of each word capitalized) for ease of readability.</p>
<table>
    <tbody>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">BlendState, Bool, Break, Buffer</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">CBuffer, Compile, Const, Continue</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">DepthStencilState, DepthStencilView, Discard, Do, Double</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Else, Extern</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">False, Float, For</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">GeometryShader</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Half</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">If, In, Inline</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Inout, Int</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Matrix</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Namespace, Nointerpolation</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Out</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Pass, PixelShader</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">RasterizerState, RenderTargetView, Return, Register</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Sampler, Sampler1D, Sampler2D, Sampler3D, <font style="BACKGROUND-COLOR: #1f6587" color=#ffffff>SamplerCUBE</font>, Sampler_State, SamplerComparisonState, Shared, Stateblock, Stateblock_state, Static, String, Struct, Switch</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">TBuffer, Technique, Technique10, texture<sup>1</sup>, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture2DMS, Texture2DMSArray, Texture3D, TextureCube, TextureCubeArray, True, Typedef</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Uniform</td>
        </tr>
        <tr>
            <td style="FONT-SIZE: 14pt; COLOR: #800000; FONT-FAMILY: Verdana">Vector, VertexShader, Void, Volatile, While</td>
        </tr>
    </tbody>
</table>
<ol>
    <li>The only keyword that is case sensitive is <em>texture</em>, which is all lower case, and is used for backward compatibility with older shaders. </li>
</ol>
<img src ="http://www.cppblog.com/cngamedev/aggbug/98604.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/cngamedev/" target="_blank">cngamedev</a> 2009-10-14 17:03 <a href="http://www.cppblog.com/cngamedev/articles/98604.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HLSL debugging</title><link>http://www.cppblog.com/cngamedev/articles/97592.html</link><dc:creator>cngamedev</dc:creator><author>cngamedev</author><pubDate>Tue, 29 Sep 2009 15:55:00 GMT</pubDate><guid>http://www.cppblog.com/cngamedev/articles/97592.html</guid><wfw:comment>http://www.cppblog.com/cngamedev/comments/97592.html</wfw:comment><comments>http://www.cppblog.com/cngamedev/articles/97592.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/cngamedev/comments/commentRss/97592.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/cngamedev/services/trackbacks/97592.html</trackback:ping><description><![CDATA[<img height=563 alt="" src="http://www.cppblog.com/images/cppblog_com/cngamedev/shader_debug_set-doosika-lsksh.gif" width=588 border=0> 
<img src ="http://www.cppblog.com/cngamedev/aggbug/97592.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/cngamedev/" target="_blank">cngamedev</a> 2009-09-29 23:55 <a href="http://www.cppblog.com/cngamedev/articles/97592.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>