Skip to content

Sharing vertex arrays with multiple index buffers (each with a different pipeline/shader)? #940

Discussion options

You must be logged in to vote

I found that using the VertexIndexDraw objects with GraphicsPipelineConfigurator::assignArray() and ref_ptr's to arrays always transfers the data and does not attempt to use an already-bound vertex buffer. You can see this by looking at VertexIndexDraw::record() which calls vkCmdBindVertexBuffers without checking to see if the data has already been bound.

To share the vertex array between two different sets of indices and pipelines, I had to break out the VertexIndexDraw into the BindIndexBuffer and DrawIndexed objects:

vsg::DataList vertexArrays{{vertices, colors}};
auto vertexBuffer = vsg::BindVertexBuffers::create(shadeGPC->baseAttributeBinding, vertexArrays);

auto shadeDrawCommands =…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@timoore
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by theodoregoetz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants