dcl_input_sv (sm4 - asm)

声明要求从上一阶段提供 系统值的 着色器输入寄存器。

dcl_input_sv vN[.mask], systemValueName[, interpolationMode]
说明
vN
[in]顶点数据寄存器。
  • N 是标识寄存器号的整数。
  • [.mask] 是可选的组件掩码 (.xyzw) ,用于指定要使用的寄存器组件。
systemValueName
[in]系统值名称是字符串, (不带“SV_”前缀) 查看 系统值语义
interpolationMode
[in] 可选。 影响光栅化期间计算值的内插模式;模式仅由像素着色器使用。 可以为下列值之一:
  • constant - 不在寄存器值之间内插。
  • linear - 在寄存器值之间线性内插。
  • linearCentroid - 与线性相同,但在多重采样时夹紧质心。
  • linearNoperspective - 与线性相同,但没有透视更正。
  • linearNoperspectiveCentroid - 与线性相同,但没有透视校正,在多重采样时夹住质心。

系统值声明的组件掩码可以是 [xyzw] 的任何适当子集;声明不能重叠, (每个声明都必须遵循 xyzw) 序列。 (剪裁距离和剔除距离(例如) )声明标量系统值时,可以在单个寄存器中声明多个系统值。 如果这样做,请确保其他修饰符(如内插模式)匹配。

此指令适用于以下着色器阶段:

顶点着色器 几何着色器 像素着色器
x x x

包含此指令以帮助调试程序集中的着色器;无法使用着色器模型 4 以汇编语言创作着色器。

示例

下面是一些示例:

// valid
dcl_input v0.y, linear
dcl_input_sv v0.w, clipDistance
dcl_input_sv v0.z, cullDistance
// invalid declarations
dcl_input v0.y, linear
dcl_input_sv v0.x, clipDistance  // the y component was previously declared, this declaration must use 
                                 // either the z or w component

dcl_input v0.y, linearNoPerspective                  // the interpolation mode is linear-no-perspective
dcl_input_sv v0.z, renderTargetArrayIndex, constant  // the interpolation modes is constant
                                                     // the interpolation modes must match

最小着色器模型

以下着色器模型中支持此函数。

着色器模型 支持
着色器模型 5
着色器模型 4.1
着色器模型 4
着色器模型 3 (DirectX HLSL)
着色器模型 2 (DirectX HLSL)
着色器模型 1 (DirectX HLSL)

着色器模型 4 程序集 (DirectX HLSL)