title: Uniform and const in GLSL; Unity Shader
body: <p>I'm writing shaders in GLSL for Unity and I've come across a quirk that I can't find an explanation for:</p>
  
  <p>In a ShaderLab SubShader Pass, I have declared vec3s within GLSLPROGAM ENDPROGRAM and outside the main function</p>
  
  <pre><code>const vec3 binomial_offsets = vec3(0.0, 1.3846153846, 3.2307692308);
  const vec3 binomial_weights = vec3(0.2270270270, 0.3162162162, 0.0702702703);
  </code></pre>
  
  <p>This compiles fine.
  However, when I replace const with uniform, for example: </p>
  
  <pre><code>uniform vec3 binomial_offsets = vec3(0.0, 1.3846153846, 3.2307692308);
  uniform vec3 binomial_weights = vec3(0.2270270270, 0.3162162162, 0.0702702703);
  </code></pre>
  
  <p>Unity complains with:</p>
  
  <pre><code>GLSL shader load error (stage 1 shader 40):
  ERROR: 0.40: Initializer not allowed
  </code></pre>
  
  <p>Can someone please tell me what the difference between uniform and const are in the context of GLSL (I'm familiar with the const qualifier in C/C++)</p>
  
  <p>I'm trying to implement a gaussian blur by the way, if anyone is interested</p>