https://msdn.microsoft.com/en-us/library/dd607359(v=VS.85).aspx
register
Optional keyword for assigning a shader variable to a particular register, which uses the following syntax:
| : register ( [shader_profile], Type#[subcomponent] ) |
|---|
Parameters
-
register
-
Required keyword.
[shader_profile]
-
Optional shader profile, which can be a shader target or simply ps or vs.
Type#[subcomponent]
-
Register type, number, and subcomponent declaration.
-
Type is one of the following:
Type Register Description b Constant buffer t Texture and texture buffer c Buffer offset s Sampler u Unordered Access View - # is the register number, which is an integer number.
- The subcomponent is an optional integer number.
-
Remarks
You may add one or more register assignments to the same variable declaration, separated by spaces.
For Direct3D 10 variables in global scope, the register keyword acts the same as the packoffset (DirectX HLSL) keyword.
Examples
Here are some examples:
sampler myVar : register( ps_5_0, s );
sampler myVar : register( vs, s[8] );
sampler myVar : register( ps, s[2] )
: register( ps_5_0, s[0] )
: register( vs, s[8] );
本文介绍如何使用register关键字将着色器变量指定到特定寄存器中,包括不同类型的寄存器如常量缓冲区、纹理和采样器等,并提供了多个示例。
2679

被折叠的 条评论
为什么被折叠?



