hlsl register

来源:互联网 发布:淘宝号怎么升级快 编辑:程序博客网 时间:2024/06/03 07:08

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:

    TypeRegister DescriptionbConstant buffertTexture and texture buffercBuffer offsetsSampleruUnordered 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] );

0 0