HLSL Intrinsic Functions

//Cg 3.1 Toolkit Documentation  补充

 

bitCount - return the number of bits set in a bitfield.

bitfieldExtract - return an extracted range of bits from a bitfield.

bitfieldInsert - returns an extracted range of bits from a bitfield.

bitfieldReverse - return the reversed bitfield.

findLSB - return the number of the least significant set bit.

findMSB - return the number of the most significant bit.

floatToIntBits - returns the 32-bit integer representation of an IEEE 754 floating-point scalar or vector

floatToRawIntBits - returns the raw 32-bit integer representation of an IEEE 754 floating-point scalar or vector

intBitsToFloat - returns the float value corresponding to a given bit represention.of a scalar int value or vector of int values

inverse - return the inverse matrix of a matrix

pack - packs mutiple values into a single 32-bit result

tex1DARRAYbias - performs a texture lookup with bias in a given sampler array.

tex1DARRAYcmpbias - performs a texture lookup with shadow compare and bias in a given sampler array.

tex1DARRAYcmplod - performs a texture lookup with shadow compare and a level of detail in a given sampler array.

tex1DARRAYfetch - performs an unfiltered texture lookup in a given sampler array.

tex1DARRAYlod - 1D texture array lookup with specified level of detail and optional texel offset.

tex1DARRAY - performs a texture lookup in a given sampler array may use pre computed derivatives and, in some cases, perform a shadow comparison.

tex1DARRAYproj - performs a texture lookup with projection in a given sampler array. May perform a shadow comparison if argument for shadow comparison is provided.

tex1DARRAYsize - returns the size of a given texture array image for a given level of detail.

tex1Dcmpbias - performs a texture lookup with bias and shadow compare in a given sampler.

tex1Dcmplod - performs a texture lookup with a specified level of detail and a shadow compare in a given sampler.

tex1Dfetch - performs an unfiltered texture lookup in a given sampler.

tex1D - performs a texture lookup in a given 1D sampler and, in some cases, a shadow comparison. May also use pre computed derivatives if those are provided.

tex1Dsize - returns the size of a given texture image for a given level of detail.

tex2DARRAYbias - performs a texture lookup with bias in a given sampler array.

tex2DARRAYfetch - performs an unfiltered texture lookup in a given sampler array.

tex2DARRAYlod - 2D texture array lookup with specified level of detail.

tex2DARRAY - performs a texture lookup in a given sampler array may use pre computed derivatives and, in some cases, perform a shadow comparison.

tex2DARRAYproj - performs a texture lookup with projection in a given sampler array.

tex2DARRAYsize - returns the size of a given texture array image for a given level of detail.

tex2Dcmpbias - performs a texture lookup with bias and shadow compare in a given sampler.

tex2Dcmplod - performs a texture lookup with a specified level of detail and a shadow compare in a given sampler.

tex2Dfetch - performs an unfiltered texture lookup in a given sampler.

tex2DMSARRAYfetch - performs an unfiltered texture lookup in a given multisample texture sampler.

tex2DMSARRAYsize - returns the size of a given multisample texture image for a given level of detail.

tex2DMSfetch - performs an unfiltered texture lookup in a given multisample texture sampler.

tex2DMSsize - returns the size of a given multisample texture image for a given level of detail.

tex2D - performs a texture lookup in a given 2D sampler and, in some cases, a shadow comparison. May also use pre computed derivatives if those are provided.

tex2Dsize - returns the size of a given texture image for a given level of detail.

tex3Dfetch - performs an unfiltered texture lookup in a given sampler.

tex3D - performs a texture lookup in a given 3D sampler. May also use pre computed derivatives if those are provided.

tex3Dsize - returns the size of a given texture image for a given level of detail.

unpack - unpacks a single values into different formatted values

texRECTsize - returns the size of a given texture image for a given level of detail.

texRECTproj - performs a texture lookup with projection in a given sampler. May perform a shadow comparison if argument for shadow comparison is provided.

texRECT - performs a texture lookup in a given RECT sampler and, in some cases, a shadow comparison. May also use pre computed derivatives if those are provided.

texRECTlod - rectangle texture lookup with specified level of detail and optional texel offset.

texRECTfetch - unfiltered rectangle texture lookup.

texRECTbias - rectangle texture lookup with bias and optional texel offset.

texRBUFsize - returns the size of a given renderbuffer texture.

texRBUF - performs an unfiltered multisample texture lookup in a given renderbuffer sampler.

texBUF - performs an unfiltered texture lookup in a given texture buffer sampler.

texBUFsize - returns the size of a given texture image for a given level of detail.

texCUBEARRAYbias - cube array texture lookup with bias.

texCUBEARRAYlod - cube array texture lookup with specified level of detail.

texCUBEARRAY - cube array texture lookup with optional pre-computed derivatives.

texCUBEARRAYsize - returns the size of a given texture array image for a given level of detail.

texCUBE - performs a texture lookup in a given CUBE sampler and, in some cases, a shadow comparison. May also use pre computed derivatives if those are provided.

texCUBEsize - returns the size of a given texture image for a given level of detail.

 

 

  • 2018/05/31
  • 7 分钟阅读时长

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.

NameDescriptionMinimum shader model
abortTerminates the current draw or dispatch call being executed.4
absAbsolute value (per component).
acosReturns the arccosine of each component of x.
allTest if all components of x are nonzero.
AllMemoryBarrierBlocks execution of all threads in a group until all memory accesses have been completed.5
AllMemoryBarrierWithGroupSyncBlocks execution of all threads in a group until all memory accesses have been completed and all threads in the group have reached this call.5
anyTest if any component of x is nonzero.
asdoubleReinterprets a cast value into a double.5
asfloatConvert the input type to a float.4
asinReturns the arcsine of each component of x.
asintConvert the input type to an integer.4
asuintReinterprets the bit pattern of a 64-bit type to a uint.5
asuintConvert the input type to an unsigned integer.4
atanReturns the arctangent of x.
atan2Returns the arctangent of of two values (x,y).
ceilReturns the smallest integer which is greater than or equal to x.
CheckAccessFullyMappedDetermines whether all values from a Sample or Load operation accessed mapped tiles in a tiled resource.5
clampClamps x to the range [min, max].
clipDiscards the current pixel, if any component of x is less than zero.
cosReturns the cosine of x.
coshReturns the hyperbolic cosine of x.
countbitsCounts the number of bits (per component) in the input integer.5
crossReturns the cross product of two 3D vectors.
D3DCOLORtoUBYTE4Swizzles and scales components of the 4D vector xto compensate for the lack of UBYTE4 support in some hardware.
ddxReturns the partial derivative of x with respect to the screen-space x-coordinate.
ddx_coarseComputes a low precision partial derivative with respect to the screen-space x-coordinate.5
ddx_fineComputes a high precision partial derivative with respect to the screen-space x-coordinate.5
ddyReturns the partial derivative of x with respect to the screen-space y-coordinate.
ddy_coarseComputes a low precision partial derivative with respect to the screen-space y-coordinate.5
ddy_fineComputes a high precision partial derivative with respect to the screen-space y-coordinate.5
degreesConverts x from radians to degrees.
determinantReturns the determinant of the square matrix m.
DeviceMemoryBarrierBlocks execution of all threads in a group until all device memory accesses have been completed.5
DeviceMemoryBarrierWithGroupSyncBlocks execution of all threads in a group until all device memory accesses have been completed and all threads in the group have reached this call.5
distanceReturns the distance between two points.
dotReturns the dot product of two vectors.1
dstCalculates a distance vector.5
errorfSubmits an error message to the information queue.4
EvaluateAttributeAtCentroidEvaluates at the pixel centroid.5
EvaluateAttributeAtSampleEvaluates at the indexed sample location.5
EvaluateAttributeSnappedEvaluates at the pixel centroid with an offset.5
expReturns the base-e exponent.
exp2Base 2 exponent (per component).
f16tof32Converts the float16 stored in the low-half of the uint to a float.5
f32tof16Converts an input into a float16 type.5
faceforwardReturns -n * sign(dot(i, ng)).
firstbithighGets the location of the first set bit starting from the highest order bit and working downward, per component.5
firstbitlowReturns the location of the first set bit starting from the lowest order bit and working upward, per component.5
floorReturns the greatest integer which is less than or equal to x.
fmaReturns the double-precision fused multiply-addition of a * b + c.5
fmodReturns the floating point remainder of x/y.
fracReturns the fractional part of x.
frexpReturns the mantissa and exponent of x.
fwidthReturns abs(ddx(x)) + abs(ddy(x))
GetRenderTargetSampleCountReturns the number of render-target samples.4
GetRenderTargetSamplePositionReturns a sample position (x,y) for a given sample index.4
GroupMemoryBarrierBlocks execution of all threads in a group until all group shared accesses have been completed.5
GroupMemoryBarrierWithGroupSyncBlocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call.5
InterlockedAddPerforms a guaranteed atomic add of value to the dest resource variable.5
InterlockedAndPerforms a guaranteed atomic and.5
InterlockedCompareExchangeAtomically compares the input to the comparison value and exchanges the result.5
InterlockedCompareStoreAtomically compares the input to the comparison value.5
InterlockedExchangeAssigns value to dest and returns the original value.5
InterlockedMaxPerforms a guaranteed atomic max.5
InterlockedMinPerforms a guaranteed atomic min.5
InterlockedOrPerforms a guaranteed atomic or.5
InterlockedXorPerforms a guaranteed atomic xor.5
isfiniteReturns true if x is finite, false otherwise.
isinfReturns true if x is +INF or -INF, false otherwise.
isnanReturns true if x is NAN or QNAN, false otherwise.
ldexpReturns x * 2exp
lengthReturns the length of the vector v.
lerpReturns x + s(y - x).
litReturns a lighting vector (ambient, diffuse, specular, 1)
logReturns the base-e logarithm of x.
log10Returns the base-10 logarithm of x.
log2Returns the base-2 logarithm of x.
madPerforms an arithmetic multiply/add operation on three values.5
maxSelects the greater of x and y.
minSelects the lesser of x and y.
modfSplits the value x into fractional and integer parts.
msad4Compares a 4-byte reference value and an 8-byte source value and accumulates a vector of 4 sums.5
mulPerforms matrix multiplication using x and y.1
noiseGenerates a random value using the Perlin-noise algorithm.
normalizeReturns a normalized vector.
pow

returns x to the y-th power of scalars and vectors

printfSubmits a custom shader message to the information queue.4
Process2DQuadTessFactorsAvgGenerates the corrected tessellation factors for a quad patch.5
Process2DQuadTessFactorsMaxGenerates the corrected tessellation factors for a quad patch.5
Process2DQuadTessFactorsMinGenerates the corrected tessellation factors for a quad patch.5
ProcessIsolineTessFactorsGenerates the rounded tessellation factors for an isoline.5
ProcessQuadTessFactorsAvgGenerates the corrected tessellation factors for a quad patch.5
ProcessQuadTessFactorsMaxGenerates the corrected tessellation factors for a quad patch.5
ProcessQuadTessFactorsMinGenerates the corrected tessellation factors for a quad patch.5
ProcessTriTessFactorsAvgGenerates the corrected tessellation factors for a tri patch.5
ProcessTriTessFactorsMaxGenerates the corrected tessellation factors for a tri patch.5
ProcessTriTessFactorsMinGenerates the corrected tessellation factors for a tri patch.5
radiansConverts x from degrees to radians.1
rcpCalculates a fast, approximate, per-component reciprocal.5
reflectReturns a reflection vector.1
refractReturns the refraction vector.
reversebitsReverses the order of the bits, per component.5
roundRounds x to the nearest integer
rsqrtReturns 1 / sqrt(x)
saturateClamps x to the range [0, 1]1
signComputes the sign of x.
sinReturns the sine of x
sincosReturns the sine and cosine of x.
sinhReturns the hyperbolic sine of x
smoothstepReturns a smooth Hermite interpolation between 0 and 1.
sqrtSquare root (per component)
stepReturns (x >= a) ? 1 : 0
tanReturns the tangent of x
tanhReturns the hyperbolic tangent of x
tex1D(s, t)1D texture lookup.1
tex1D(s, t, ddx, ddy)1D texture lookup.
tex1Dbias1D texture lookup with bias.
tex1Dgrad1D texture lookup with a gradient.
tex1Dlod1D texture lookup with LOD.
tex1Dproj1D texture lookup with projective divide.
tex2D(s, t)2D texture lookup.
tex2D(s, t, ddx, ddy)2D texture lookup.
tex2Dbias2D texture lookup with bias.
tex2Dgrad2D texture lookup with a gradient.
tex2Dlod2D texture lookup with LOD.3
tex2Dproj2D texture lookup with projective divide.
tex3D(s, t)3D texture lookup.
tex3D(s, t, ddx, ddy)3D texture lookup.
tex3Dbias3D texture lookup with bias.
tex3Dgrad3D texture lookup with a gradient.
tex3Dlod3D texture lookup with LOD.
tex3Dproj3D texture lookup with projective divide.
texCUBE(s, t)Cube texture lookup.
texCUBE(s, t, ddx, ddy)Cube texture lookup.
texCUBEbiasCube texture lookup with bias.
texCUBEgradCube texture lookup with a gradient.
texCUBElodCube texture lookup with LOD.
texCUBEprojCube texture lookup with projective divide.
transposeReturns the transpose of the matrix m.1
truncTruncates floating-point value(s) to integer value(s)1
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值