在vulkan中可以接受多少次抽奖?

问题描述

我一直在研究vulkan渲染器,并且有点咸菜。目前,我正在使用vulkan渲染2d精灵,并且刚刚导入了整个地图以进行绘制。地图为40x40,含1600个图块。我无法实例化/批处理这些对象,因为场景中存在移动的对象,并且可能需要在它们之间插入绘制调用(某些对象需要在其他对象之前渲染)。但是,当我分别渲染这1600个精灵时,我的cpu占用了大约20ms的时间来完成精灵。这是在单独的线程中发生的,并且执行以下操作:

Start command buffer & render pass 
 For every sprite to draw
   Set up translation matrix.
   Fetch the material if its not cached
   If this command buffer is not bound to the pipeline bind it.
   Bind the descriptor set given by the material if not already bound.
   Push translation matrix to pipeline using push constant.
   Draw.
End command buffer & render pass & submit.

我想我的问题是,1600太多了吗?我是否应该尝试找到批处理此方法方法?只花这些时钟周期在gpu上建立一个大缓冲区而只绘制一次会更有意义吗?我发现这样做效率不高,因为我实际上只为给定的所有命令提交一次。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)