I have an array of a data which wouldn't change once initialized; Which I'd like to use inside the shaders. I am having trouble defining exactly how can I do that.
All I am trying to do is to try to derive from ShaderType, which for the most part works pretty well.
The data itself is a cubic representation, meaning that for a size of 4 the buffer would need to have a maximum of 444 elements.
So far the solution I came up with involves a generic size:
#[derive(ShaderType)]
struct SizedItem<T: ShaderType + ShaderSize, const S: usize> {
root_node: u32,
root_size: u32,
nodes: [T; S],
}
but with that I have trouble using it, because the size of the Item is not known at compile time:
pub fn create_item(&self, viewport: &Viewport) -> ???{
}
I know knowing the data size at the start of the pipeline would have to be enough, there should be no need to know it at compile time. I know something like this is possible, partly because the textures themselves work like this. What am I missing?