DirectX 11 With C ++:使用常量缓冲区和SetRawValue()之间的区别? [英] Directx 11 With C++: Difference between using constant buffers and SetRawValue()?

查看:452
本文介绍了DirectX 11 With C ++:使用常量缓冲区和SetRawValue()之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用SetRawValue()来更改着色器代码中的值,以及仅更新常量缓冲区有什么区别?我的书中的示例代码使用SetRawValue()更新常量缓冲区的每个变量,但我不明白为什么作者不仅使用UpdateSubresource()更新常量缓冲区。

是效果(.fx)支持的一部分,因为DX11现在位于主代码之外,并且作为源包装器提供,其可以用于代替直接编码到常数缓冲器等。它提供了与较旧代码的一定程度的向后兼容性,并且给出较高级别的抽象,但是在其下面 无论如何更新常量缓冲区。



GameDev上的类似问题中有讨论提供更多详细信息。


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()之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆