问题描述
使用SetRawValue()来更改着色器代码中的值,以及仅更新常量缓冲区有什么区别?我的书中的示例代码使用SetRawValue()更新常量缓冲区的每个变量,但我不明白为什么作者不仅使用UpdateSubresource()更新常量缓冲区。
中有讨论提供更多详细信息。
What is the difference between using SetRawValue() to change values in the shader code, and just updating constant buffers? The example code in my book updates each variable of a constant buffer using SetRawValue(), but I don't see why the author didn't just update the constant buffer with UpdateSubresource().
SetRawValue
is part of the effects (.fx) support that since DX11 now sits outside of the main code and is supplied as source wrappers that can be used instead of coding directly to constant buffers etc. It offers some degree of backward compatibility with older code and gives a higher level of abstraction but, underneath it all, it is updating constant buffers anyway.
There is a discussion under a similar question on GameDev that gives more details.
这篇关于DirectX 11 With C ++:使用常量缓冲区和SetRawValue()之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!