lunedì 4 gennaio 2016

Day 114: Killing bugs

Today I noticed that I was sending uniforms to the shader through their pointers. Which is quite a bad practice for two reasons:
1) If the data is the same but somehow it got 2 different pointers to it, the uniforms are not batched
2) I cannot pass lvalue to the function (set_uniform(3) is undefined behaviour because the reference to the number 3 will be immediatly lost)

So i decided to copy those values instead, and this lead to 3 different bugs, each of which seemed completely unrelated to the thing I changed.
After quite a lot of work I fixed them all, and one of them was actually a bug of the new batch that I would have probably discovered sooner or later.

Then I wanted to remove some atrributes from the light classes, to make them more versatile, but I noticed that they actually use all those info, colors included, to generate stuff like bounding box radiuses and so on...so i guess i'll leave it like that.
However it is absolutely possible to add extra uniforms in the game scene, and they will be automatically sent.

Nessun commento:

Posta un commento