Open einarf opened 6 years ago
We should possibly also try to make the default dtype
of matrix types ti be a 32 bit float as these can be converted directly into uniforms with tobytes
.
Numpy:
The default depends on your system. On a 64-bit system, default types will be 64-bit. On a 32-bit system, default types will be 32-bit. There is no way to change the default short of re-compiling numpy with a different system C header.
This could mean we have to do something about pyrr
.
A branch matrix-performance
was crated for this. Managed to boost performance by 10% ish by doing some simple tweaks with a local branch of pyrr. It's unlikely that using pyrr will ever be efficient when drawing complex scenes. Might want to turn a solution in ModernGL for this.
This looks like the solution: https://github.com/cprogrammer1994/miniglm
From #18
We are currently using
pyrr
for matrix operations. The main problem withpyrr
is that it crates new instances for every calculation allocating a newndarray
. This is very expensive.As an example: https://github.com/adamlwgriffiths/Pyrr/blob/a86968b7ed242017247e27ac8a0e7b84bca0c333/pyrr/matrix44.py#L223-L236
numpy.dot
has anout
parameter to store the result in an existingndarray
. This avoids memory allocation.