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

1

8

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

Wardieu answered 20/11, 2013 at 0:7 Comment(0)
W
11

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

Weihs answered 20/11, 2013 at 16:38 Comment(1)
@Wardieu in one of my cases I needed to define the precision for int too. pretty frustrating - went back to my old code and suddenly half the shaders didn't link.Hesitate

© 2022 - 2024 — McMap. All rights reserved.