問題描述
如何使用 SlimDX 設置 HLSL 統一變量的值? (How do I set the value of a HLSL uniform variable with SlimDX?)
I haven't been able to find the documentation for this, but it's probably pretty simple. I have a pixel shader which needs variables to be updated. The only thing I've come close with is the ConstantTable, but it's under Direct3D9 and not Direct3D11 which is what I'm using.
Using DirectX11 with SlimDX, how would I set the value of uniform variables I have in the shader?
參考解法
方法 1:
Direct3D 10 and 11 use the idea of constant buffers. The SlimDX Buffer class is the type you're looking for. Alternatively, if you're using effects, you can use one of the GetVariableBy* methods to get and set its values.