DirectX HLSL Shader versions and resource limits(DX Shader 寄存器等资源限制)

Version Instruction slots Constant count
vs 1.1 96 (4)
vs 2.0 256 (4)
vs 2.a 256 (4)
vs 3.0 (1) (4)
ps 1.1 - ps 1.3 8 - 12 8
ps 1.4 28 (two phases) 8
ps 2.0 96 32
ps 2.a (2) 32
ps 2.b (2) 32
ps 3.0 (3) 224

(1): D3DCAPS9.MaxVertexShader30InstructionSlots
(2): D3DCAPS9.D3DPSHADERCAPS2_0.NumInstructionSlots
(3): D3DCAPS9.MaxPixelShader30InstructionSlots
(4): D3DCAPS9.MaxVertexShaderConst

如果编译shader报错: error X5589: Invalid const register num: 35. Max allowed is 31

那就是版本过低导致的。

更多信息详见: https://en.wikipedia.org/wiki/User:MaxDZ8/Shader_model_Proto

猜你喜欢

转载自blog.csdn.net/vily_lei/article/details/87276094