Vulkan:单独的顶点缓冲区或动态顶点缓冲区?
Vulkan: Separate vertex buffers or dynamic vertex buffers?
所以我开始学习 Vulkan,但我还没有对多个对象做任何事情,事情是,如果我正在制作游戏引擎,并且我正在实现某种“拖放” drop" 东西,例如,从面板中拖动一个立方体,然后将其放入场景中,是否更好...?
- 有单独的顶点缓冲区。
- 只有一个,让它长得有点像
std::vector
class 之类的,但这听起来真的很慢,因为每次需要调整大小时我都必须使用命令缓冲区执行传输操作发生(每次将新对象添加到场景中)。
增加顶点缓冲区通常是可行的方法,请记住 Vulkan 对每种类型的缓冲区句柄都非常有限,并且专为子分配而设计(就像在旧式 C 中一样)。摘自NVIDIA's Vulkan recommendations:
Use memory sub-allocation. vkAllocateMemory() is an expensive operation on the CPU. Cost can be reduced by suballocating from a large memory object. Memory is allocated in pages which have a fixed size; sub-allocation helps to decrease the memory footprint.
这里唯一的注意事项是积极地分配你的缓冲区,只要你相信它会增长。该页面上的另一点警告您不要将内存推到极限,如果您失败了,OS 将放弃并终止您的程序:
When memory is over-committed on Windows, the OS may temporarily suspend a process from the GPU runlist in order to page out its allocations to make room for a different process’ allocations. There is no OS memory manager on Linux that mitigates over-commitment by automatically performing paging operations on memory objects.
所以我开始学习 Vulkan,但我还没有对多个对象做任何事情,事情是,如果我正在制作游戏引擎,并且我正在实现某种“拖放” drop" 东西,例如,从面板中拖动一个立方体,然后将其放入场景中,是否更好...?
- 有单独的顶点缓冲区。
- 只有一个,让它长得有点像
std::vector
class 之类的,但这听起来真的很慢,因为每次需要调整大小时我都必须使用命令缓冲区执行传输操作发生(每次将新对象添加到场景中)。
增加顶点缓冲区通常是可行的方法,请记住 Vulkan 对每种类型的缓冲区句柄都非常有限,并且专为子分配而设计(就像在旧式 C 中一样)。摘自NVIDIA's Vulkan recommendations:
Use memory sub-allocation. vkAllocateMemory() is an expensive operation on the CPU. Cost can be reduced by suballocating from a large memory object. Memory is allocated in pages which have a fixed size; sub-allocation helps to decrease the memory footprint.
这里唯一的注意事项是积极地分配你的缓冲区,只要你相信它会增长。该页面上的另一点警告您不要将内存推到极限,如果您失败了,OS 将放弃并终止您的程序:
When memory is over-committed on Windows, the OS may temporarily suspend a process from the GPU runlist in order to page out its allocations to make room for a different process’ allocations. There is no OS memory manager on Linux that mitigates over-commitment by automatically performing paging operations on memory objects.