HLSL 统一变量与常量缓冲区
统一缓冲区和常量缓冲区有什么区别?
它们是完全独立的还是可以将制服视为在恒定缓冲区中?换句话说,如果你想设置一个uniform,你需要一个常量缓冲区还是有其他方法?
我问这个问题是因为我有四个变量(float2
pan、float
scale 和 float
rotation),它们很可能不会同时改变。我是否需要一个恒定的缓冲区来一次设置它们,或者如果可能的话,单独设置它们是否更好?
What is the difference between uniforms and constant buffers?
Are they completely separate or can the uniforms be seen as in a constant buffer? In other words, if you want to set a uniform, do you need a constant buffer or is there another way?
I ask because I have four variables (float2
pan, float
scale and float
rotation) that will in all likelihood not be changing at the same time. Do I need a constant buffer to set them all at once or is it better to set them individually, if possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您有一个将从函数外部的外部源分配的变量时,将使用制服。就您而言,制服声明会更好,因为您说过您不会同时更换。 const 声明使变量不可更改。查看此页面的资源..http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/uniform.php
Uniforms are used when you have a variable that will be assigned from a external source from outside the function. In your case of the uniforms declaration will be better because you said that you will not be changing at the same time. The const declaration makes the variable unchangeable. Check out this page for resources..http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/uniform.php