sampler2d

Here is the syntax for a sampler in Direct3D 9.

sampler Name = SamplerType{   Texture = <texture_variable>;   [state_name = state_value;]   ... };
 
hlsl里面
sampler  XXXsampler= sampler2D{
 
 texture=.....;
AddressU=
AddressV=
AddressW=
BorderColor=
Filter=
MaxAnisotropy=
MaxLOD=
MinLOD=
MipLODBias=
 
}
 
sampler MeshTextureSampler = 
sampler_state
{
    Texture = <g_MeshTexture>;
    MipFilter = LINEAR;
    MinFilter = LINEAR;
    MagFilter = LINEAR;
};
 
DX10
SamplerState MeshTextureSampler
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};
SamplerComparisonState ShadowSampler
{
   // sampler state
   Filter = COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
   AddressU = MIRROR;
   AddressV = MIRROR;

   // sampler comparison state
   ComparisonFunc = LESS;
};
float3 vModProjUV;
  ...
float fShadow = g_ShadowMap.SampleCmpLevelZero( ShadowSampler, vModProjUV.xy, vModProjUV.z);

http://msdn.microsoft.com/en-us/library/windows/desktop/bb509644(v=vs.85).aspx
原文地址:https://www.cnblogs.com/minggoddess/p/3673713.html