D3D11: Fix constant position code for good
I had forgotten how constants worked when compiled; constants are uploaded as constant registers. When constants are used with shaders, multiple constants are often packed in to a single register when possible to reduce constant register count. For example, one 'float' constant and one 'float3' constant will be packed in to a single register (c0.x for constant 1, c0.yzw for constant 2), but two 'float' constants and one 'float3' constant must inhabit two registers (c0.xy for constant 1, c1.xyz for constant 2), so it must start on a new register boundry (every 16 bytes). I had first instinctively thought it was just a simple case of alignment like it is on the CPU, but then I realized that it didn't sound right, so I went back and did some more tests and then ultimately remembered how constants actually are uploaded.
Showing
想要评论请 注册 或 登录