Pretty self-explanatory. The problem is that the in-memory layout is driver-specific, and the std140 layout does not match the alignment rules of Nim objects, which makes sending data to the graphics card quite inconvenient.
This could probably be solved using macros and generics, but I'm not sure about the API. The current uniforms macro could play well with this, for example:
type
MyData = object
a, b, c: Vec3f
let
ubo = win.newUniformBuffer(MyData())
u = uniforms {
MyUniformBlock: ubo,
}
The problem I'm facing is that alignment problem; I would have to read the spec (which is not a problem) but generating all the code to align everything properly would be quite a challenge.
Another thing is that uniform blocks support dynamic arrays. That's fine and dandy, but how would we solve this syntactically? Use a seq or some special storage type?
These are all things for extra consideration, and I will take care of that when I need it or somebody asks for it.
Pretty self-explanatory. The problem is that the in-memory layout is driver-specific, and the
std140
layout does not match the alignment rules of Nim objects, which makes sending data to the graphics card quite inconvenient. This could probably be solved using macros and generics, but I'm not sure about the API. The currentuniforms
macro could play well with this, for example:The problem I'm facing is that alignment problem; I would have to read the spec (which is not a problem) but generating all the code to align everything properly would be quite a challenge. Another thing is that uniform blocks support dynamic arrays. That's fine and dandy, but how would we solve this syntactically? Use a
seq
or some special storage type?These are all things for extra consideration, and I will take care of that when I need it or somebody asks for it.