Skip to content

CBuffer

zilch edited this page Feb 25, 2021 · 2 revisions

Constant Buffer 是GPU中的一处常量缓冲区。 Unity Shader中使用CBUFFER_START和CBUFFER_END来定义缓冲区变量。

当前Unity内部使用的缓冲区有

  • UnityPerCamera
  • UnityLighting
  • UnityShadows
  • UnityPerDraw
  • UnityPerFrame
  • UnityPerMaterial
  • UnityPerObject

这些缓冲区是根据各自数据的刷新频率来定义的。 例如UnityPerCamera中的数据,仅在渲染的Camera发生变化时刷新。里面存的即是与Camera相关的数据。UnityPerMaterial则在材质球发生变化的时候刷新。

参考:

https://blogs.unity3d.com/2019/02/28/srp-batcher-speed-up-your-rendering/

https://zhuanlan.zhihu.com/p/35830868

https://zhuanlan.zhihu.com/p/137455866

Clone this wiki locally