Can someone give me some explanation on when to use uniform and extern with global variables in my effects/hlsl shaders?
As I understand, they mean:
- Uniform: input to be both initalized and updated from outside the effect, i.e. from my application
- Extern: input to be updated/ changed from outside the effect, i.e. from my application
Which gives me the feeling that I could say that all my globals for matrices, lightsources, directions, colors etc, can be uniform or extern, or even both. But I'm curious what would be the reason to use either one of them or both.
For now I've set all non array globals to 'uniform extern' (world/worldinvtransp/viewproj matrices, ambient lighting, material parameters).
And all directional and point light parameters (vars) and my texture, to 'extern' (even though they're initialized from outside the shader, in my application).
I hope someone can clarify this.