GLSL ES shader based camera question

Started by
10 comments, last by DividedByZero 8 years, 2 months ago

I expect what is going on is that the shader has decided to compile the entire expression (identity * world * view * projection), and all of the calculations that go into it, into a single constant matrix.

This is a pretty normal compiler optimisation, since all of your inputs are constant at that point. And then the rest of the shader boils down to a single matrix<->vector multiply, and storing a couple of values.

I wouldn't rely on every shader compiler to get this right, and if you make any of those input non-constant (say, to move the camera around), then you will see a massive performance hit.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement

I expect what is going on is that the shader has decided to compile the entire expression (identity * world * view * projection), and all of the calculations that go into it, into a single constant matrix.

This is a pretty normal compiler optimisation, since all of your inputs are constant at that point. And then the rest of the shader boils down to a single matrix<->vector multiply, and storing a couple of values.

I wouldn't rely on every shader compiler to get this right, and if you make any of those input non-constant (say, to move the camera around), then you will see a massive performance hit.


It is interesting, because I am now moving the object (120K poly) and camera around via their own uniforms and the performance is still the same.

Having said that, the camera system isn't complete yet (fixed look at, no rotations etc..). So, maybe the performance will dive when it becomes more functional.

This topic is closed to new replies.

Advertisement