Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome WebGL Shader Compile Linker Error, Uniforms with the same name but different type/precision

Uniforms with the same name but different type/precision

This is what i am getting when compiling the shaders, with only the latest Chrome on Windows. nothing else

Looking at the

http://www.cocos2d-x.org/forums/19/topics/39063?r=39258 and https://code.google.com/p/chromium/issues/detail?id=309527

I tried to add both highp for both of the following, and it doesnt help either.

VShader :

  "attribute vec3 a_position;                  \n"
  "attribute vec3 a_normal;                    \n"
  "attribute vec2 a_texture;                   \n"

  "uniform mat4 u_mvpMatrix;                   \n"
  "uniform mat3 u_normalMatrix;                \n"
  "uniform vec4 u_lightDir;                    \n"
  "uniform lowp int u_eT;           \n"
  "uniform lowp int u_eL;             \n"
  "uniform vec4 u_colormul;                    \n"

  "varying float v_cf;                \n"
  "varying vec2 v_t;                          \n"

F Shader

  "precision mediump float;                                     \n"
  "uniform vec4 u_color;                                        \n"
  "uniform lowp int u_eT;                            \n"
  "uniform sampler2D u_texture0;                                \n"
  "uniform vec4 u_colormul;                                     \n"

  "varying float v_cf;                                 \n"
  "varying vec2 v_t;                                           \n"

Early response is highly appreciated

Thank you

like image 804
ideerge Avatar asked Nov 20 '13 00:11

ideerge


1 Answers

I resolved this by adding precision mediump float; to my vertex shaders to match the precision defined for their fragment counterparts.

like image 155
Chase Avatar answered Nov 03 '22 13:11

Chase