Hi I would like to reduce my memory footprint for my rendering pipeline.
A straightforward solution should be the use of 4x3 arrays to encode the modelmatrix, that is accessed indirectly.
My question is: does that work or is it prevented by some alignment or packing requirement that I am not aware of.
My problem is that as soon as I use 4x3 matrices, the transformation is wrong.
layout(std430, binding = 1) buffer TransformBuffer
{
mat4x3 transformBuffer[];
};
...
mat4 M= mat4(transformBuffer[i]);
On CPU, I create the array, using glm constuctors:
for (auto & t : transforms) // glm::mat4
{
smallerTransforms.push_back(glm::mat4x3(t));
}
Interestingly, If I bind the mat4 array and declare with mat4x3 in glsl, all is fine. So it appears to be some alignment problem, that I have no clue of.
GTX1070 btw.
Alignment works,
but the conversion is unexpected:
mat4 M = mat4( t.p[0], t.p[1], t.p[2], 0,
t.p[3], t.p[4], t.p[5], 0,
t.p[6], t.p[7], t.p[8], 0,
t.p[9], t.p[10], t.p[11], 1);