I have some vertex shader code somewhat like the following (this is a bit of simplified example):

```
attribute vec2 aPosition;
attribute vec4 aColor;

varying lowp vec4 vColor;

uniform  vec4 uViewport;
mat4 viewportScale = mat4(2.0 / uViewport.z, 0, 0, 0,    0, -2.0 / uViewport.w, 0,0,    0, 0,1,0,    -1,+1,0,1);

void main() {
  vec2 pos = aPosition;
  gl_Position = viewportScale * vec4(pos, 0, 1);
  vColor = vec4(aColor.rgb*aColor.a, aColor.a);
}

```

In particular, the `viewportScale` matrix is calculated from the `uViewport` uniform *outside of the main function*. Using this from a browser (WebGL), it seems to work fine on every machine I've tested on... in particular, the `viewportScale` matrix is correctly updated when I change the `uViewport` variable. Is there any difference between doing this, and doing the same calculation inside of the main function? I can't find any examples or discussion related to this.

I ran into a [related problem](https://stackoverflow.com/questions/27472077/windows-specific-issue-when-rendering-webgl-attribute-set-to-zero/27555733#27555733) that has made me a bit paranoid about this issue -- at the very least, I'd like to understand what's going on.