简体   繁体   English

OpenGL 生成多个 vao 缓冲区

[英]OpenGL generating multiple vao buffer

Are there critical performance differences between之间是否存在关键的性能差异

GLuint vao[2];
glGenVertexArrays(2, &vao);

// and

GLuint vao1[1], vao2[1];
glGenVertexArrays(1, &vao1);
glGenVertexArrays(1, &vao2);

I think of course latter one would have bad performance but due to my shallow understanding, I don't know how much would it be and why it's bad.我当然认为后一种性能会很差,但由于我的理解很浅,我不知道它会是多少以及为什么会不好。

Not knowing how much vao the program will hold and be generating, is the latter one proper way to generate new VAO, keep generating size-one buffer?不知道程序将保存和生成多少 vao,后一种生成新 VAO 的正确方法是继续生成大小为 1 的缓冲区吗? (ex: in the constructer of class) (例如:在类的构造函数中)

You shound't imply those GLuint handles are stored in linear memory, and even if they are it doesn't mean the memory for objects those represent is continuous.您不应该暗示这些 GLuint 句柄存储在线性 memory 中,即使它们是,也不意味着代表对象的 memory 是连续的。 It can be, or can be not during runtime, and it also depends on the access patterns you hint OpenGL when creating buffers.它可以在运行时,也可以不在,它还取决于您在创建缓冲区时提示 OpenGL 的访问模式。 Graphic drivers do all that book keeping for you, including memory layout optimization.图形驱动程序为您完成所有工作,包括 memory 布局优化。 If you want to get an idea how drivers could potentially manage OpenGL objects and video memory, take a look at Vulkan API and best practices related to memory management . If you want to get an idea how drivers could potentially manage OpenGL objects and video memory, take a look at Vulkan API and best practices related to memory management . But again, in OpenGL you don't have that level of control.但同样,在 OpenGL 中,您没有那种程度的控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM