Skip to content

Dyamic shader uniform layouts? #896

Closed
@DiThi

Description

Similar to #893, is there a way to set the amount and type of uniforms at run time? Is it easier considering I do something like this?

let uniform_buffer = vulkano::buffer::cpu_pool::CpuBufferPool::<[f32; 16]>::new(
    device.clone(),
    vulkano::buffer::BufferUsage::all(),
);
[...]
// p is a pointer of a slice, l is its length
assert!(l == 16 * 4);
let uniform_buffer_subbuffer = {
    let uniform_data = unsafe { *(p as *mut [f32; 16]) };
    uniform_buffer.next(uniform_data).unwrap()
};

Looks like the data is fed as-is to vulkan (and buffer type doesn't matter as long as it's the same size), so all I would have to do is being able to create uniform buffers of different byte sizes.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions