Cannot use GraphicsPipelineAbstract
in draw_indexed
function if using a tuple as VertexSource #1433
Closed
Description
The response in #676 implies that one can use a Arc<GraphicsPipelineAbstract + Send + Sync>
instead of a Arc<GraphicsPipelineAbstract>
for a pipeline in a struct in order to issue a call to draw_indexed
. However, this only works if sending a Vec<Box<dyn BufferAccess + Send + Sync>>
as the VertexSource
. Attempting to use a tuple as a VertexSource
gives the following:
error[E0277]: the size for values of type `dyn vulkano::pipeline::GraphicsPipelineAbstract + std::marker::Send + std::marker::Sync` cannot be known at compilation time
--> keeshond/src/renderer/vulkan.rs:295:29
|
295 | builder.draw_indexed::<(BufferSlice<[Vertex], &Arc<ImmutableBuffer<[Vertex]>>>, BufferSlice<[&VertexInstance], &Arc<CpuAccessibleBuffer<[&VertexInstance]>>>), _, _, _, _, _>
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn vulkano::pipeline::GraphicsPipelineAbstract + std::marker::Send + std::marker::Sync`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because of the requirements on the impl of `vulkano::pipeline::vertex::VertexSource<(vulkano::buffer::BufferSlice<[renderer::vulkan::Vertex], &std::sync::Arc<vulkano::buffer::ImmutableBuffer<[renderer::vulkan::Vertex]>>>, vulkano::buffer::BufferSlice<[&renderer::vulkan::VertexInstance], &std::sync::Arc<vulkano::buffer::CpuAccessibleBuffer<[&renderer::vulkan::VertexInstance]>>>)>` for `dyn vulkano::pipeline::GraphicsPipelineAbstract + std::marker::Send + std::marker::Sync`
= note: required because of the requirements on the impl of `vulkano::pipeline::vertex::VertexSource<(vulkano::buffer::BufferSlice<[renderer::vulkan::Vertex], &std::sync::Arc<vulkano::buffer::ImmutableBuffer<[renderer::vulkan::Vertex]>>>, vulkano::buffer::BufferSlice<[&renderer::vulkan::VertexInstance], &std::sync::Arc<vulkano::buffer::CpuAccessibleBuffer<[&renderer::vulkan::VertexInstance]>>>)>` for `std::sync::Arc<dyn vulkano::pipeline::GraphicsPipelineAbstract + std::marker::Send + std::marker::Sync>`
How do I make the call to draw_indexed
in this scenario, where I need to pass a Vertex and Instance buffer, and the pipeline needs to be stored in a struct?