Relative addressing (HLSL PS reference)
The [ ] syntax can be used only in register types that can be relatively addressed in certain shader models. The supported forms of [ ] syntax are listed as follows:
Where:
- "R" denotes any register type that can be relatively addressed.
- "A" denotes any register that can be used as an index to relatively address other registers.
- n0 - ni, m0 - mj, and k are integers >= 0.
[ ] syntax | Effective index | Examples |
---|---|---|
R[ A + m0 + ... + mj ] | A + m0 + ... + mj | c[ a0.x + 3 + 7 ] |
R[ k ] ( = Rk ) | k | c[ 10 ] ( = c10 ) |
R[ A ] | A | c[ a0.y ] |
Rk[ n0 + ... + ni + A + m0 + ... + mj ] | A + k + n0 + ... + ni + m0 + ... + mj | c8[ 3 + 2 + a0.w + 5 + 6 + 1 ] |
R[ n0 + ... + ni + A + m0 + ... + mj ] | A + n0 + ... + ni + m0 + ... + mj | c[ 2 + 1 + aL + 3 + 4 + 5 ] |
Rk[ A ] | A + k | c12[ aL ], c0[ a0.z ] |
Rk[ A + m0 + ... + mj ] | A + k + m0 + ... + mj | v1[ aL + 4 + 8 ] |
R[ n0 + ... + ni + A ] | A + n0 + ... + ni | o[ 3 + 1 + aL ] |
Rk[ n0 + ... + ni + A ] | A + k + n0 + ... + ni | o1[ 2 + 1 + 3 + aL ] |
The registers are available in the following versions:
Register type | Pixel Shader Versions |
---|---|
loop counter: aL on input registers | ps_3_0 and higher |
Related topics
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for