Directx 11 With C++: Difference between using constant buffers and SetRawValue()?

大憨熊 提交于 2019-12-11 09:06:31

问题


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().


回答1:


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.



来源:https://stackoverflow.com/questions/23534564/directx-11-with-c-difference-between-using-constant-buffers-and-setrawvalue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!