I have found that old and new version GLvalidate can’t compile my vertex shader right, if you interesting then shader is:
uniform vec3 GUN_LightSource0;
uniform vec3 GUN_ViewPosition;
#ifdef USE_SKINBONES
uniform mat4 GUN_BonesMatrix[20];
#endif
varying vec2 uv;
#ifdef USE_MAT_DIFF_COLOR
varying vec4 diffuseColor;
#endif
#ifdef USE_LIGHT0_POINT
varying vec3 lightPosition;
#else
#ifdef USE_LIGHT0_DIRECT
varying vec3 lightDirection;
#endif
#endif
#ifdef USE_SPECULAR
varying vec3 eyePosition;
#else
#ifdef USE_PARALAX
varying vec3 eyePosition;
#endif
#endif
#ifndef USE_BUMPMAP
varying vec3 vertexNormal;
#endif
void main()
{
#ifdef USE_SKINBONES
vec4 weight = gl_MultiTexCoord2;
vec4 index = gl_MultiTexCoord3;
vec3 new_normal = vec3(0,0,0);
vec3 new_tangent = vec3(0,0,0);
vec4 posObj = vec4(0,0,0,1);
ivec4 curIndex = ivec4(index);
vec4 curWeight = weight;
posObj += (GUN_BonesMatrix[curIndex.x] * gl_Vertex) * curWeight.x;
posObj += (GUN_BonesMatrix[curIndex.y] * gl_Vertex) * curWeight.y;
posObj += (GUN_BonesMatrix[curIndex.z] * gl_Vertex) * curWeight.z;
posObj += (GUN_BonesMatrix[curIndex.w] * gl_Vertex) * curWeight.w;
#ifdef USE_BEST_SKINLIGHTING
// [0]
mat3 m1 = mat3(GUN_BonesMatrix[curIndex.x][0].xyz, GUN_BonesMatrix[curIndex.x][1].xyz, GUN_BonesMatrix[curIndex.x][2].xyz);
new_normal += (m1 * gl_Normal) * curWeight.x;
new_tangent += (m1 * gl_MultiTexCoord1.xyz) * curWeight.x;
// [1]
mat3 m2 = mat3(GUN_BonesMatrix[curIndex.y][0].xyz, GUN_BonesMatrix[curIndex.y][1].xyz, GUN_BonesMatrix[curIndex.y][2].xyz);
new_normal += (m2 * gl_Normal) * curWeight.y;
new_tangent += (m2 * gl_MultiTexCoord1.xyz) * curWeight.y;
// [2]
mat3 m3 = mat3(GUN_BonesMatrix[curIndex.z][0].xyz, GUN_BonesMatrix[curIndex.z][1].xyz, GUN_BonesMatrix[curIndex.z][2].xyz);
new_normal += (m3 * gl_Normal) * curWeight.z;
new_tangent += (m3 * gl_MultiTexCoord1.xyz) * curWeight.z;
// [3]
mat3 m4 = mat3(GUN_BonesMatrix[curIndex.w][0].xyz, GUN_BonesMatrix[curIndex.w][1].xyz, GUN_BonesMatrix[curIndex.w][2].xyz);
new_normal += (m4 * gl_Normal) * curWeight.w;
new_tangent += (m4 * gl_MultiTexCoord1.xyz) * curWeight.w;
#else
mat3 m1 = mat3(GUN_BonesMatrix[curIndex.x][0].xyz, GUN_BonesMatrix[curIndex.x][1].xyz, GUN_BonesMatrix[curIndex.x][2].xyz);
new_normal += (m1 * gl_Normal);
new_tangent += (m1 * gl_MultiTexCoord1.xyz);
#endif
// output vertex position
gl_Position = gl_ModelViewProjectionMatrix * vec4(posObj.xyz, 1);
#else
vec3 new_normal = gl_Normal.xyz;
vec3 new_tangent = gl_MultiTexCoord1.xyz;
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = ftransform();
#endif
// output texture coordinates for decal and normal maps
uv = gl_MultiTexCoord0.xy;
#ifdef USE_MAT_DIFF_COLOR
// output color
diffuseColor = gl_Color;
#endif
// compute tangent space
mat3 objToTangentSpace;
vec3 new_binormal = cross(new_normal.xyz, new_tangent.xyz) * gl_MultiTexCoord1.w;
objToTangentSpace[0] = vec3(new_tangent.x, new_binormal.x, new_normal.x);
objToTangentSpace[1] = vec3(new_tangent.y, new_binormal.y, new_normal.y);
objToTangentSpace[2] = vec3(new_tangent.z, new_binormal.z, new_normal.z);
#ifndef USE_BUMPMAP
vertexNormal = new_normal * objToTangentSpace;
#endif
#ifdef USE_LIGHT0_POINT
// Convert light position to obj space
vec4 LocalLight = gl_ModelViewMatrixInverse * vec4(GUN_LightSource0, 1.0);
// Convert light position to tangent space
lightPosition = objToTangentSpace * (LocalLight.xyz - gl_Vertex.xyz);
#else
#ifdef USE_LIGHT0_DIRECT
// Convert light direction to obj space
mat3 invObj3 = mat3(gl_ModelViewMatrixInverse[0].xyz, gl_ModelViewMatrixInverse[1].xyz, gl_ModelViewMatrixInverse[2].xyz);
vec3 LocalLight = invObj3 * normalize(GUN_LightSource0);
// Convert light position to tangent space
lightDirection = objToTangentSpace * LocalLight.xyz;
#endif
#endif
#ifdef USE_SPECULAR
// Convert eye position to obj space
vec4 LocalEye = gl_ModelViewMatrixInverse * vec4(GUN_ViewPosition, 1.0);
// Convert eye position to tangent space
eyePosition = objToTangentSpace * (LocalEye.xyz - gl_Vertex.xyz);
#else
#ifdef USE_PARALAX
// Convert eye position to obj space
vec4 LocalEye = gl_ModelViewMatrixInverse * vec4(GUN_ViewPosition, 1.0);
// Convert eye position to tangent space
eyePosition = objToTangentSpace * (LocalEye.xyz - gl_Vertex.xyz);
#endif
#endif
}
the error messages:
Parsing vertex shader 'ObjectLighting_VS.glsl'....
Failure.
ERROR: 0:75: 'posObj' : undeclared identifier
ERROR: 0:75: 'xyz' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:75: 'constructor' : not enough data provided for construction
ERROR: 0:92: 'new_normal' : undeclared identifier
ERROR: 0:92: 'xyz' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:92: 'new_tangent' : undeclared identifier
ERROR: 0:92: 'xyz' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:92: 'cross' : no matching overloaded function found
ERROR: 0:92: '=' : cannot convert from 'float' to '3-component vector of float'
ERROR: 0:93: 'x' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:93: 'x' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:94: 'y' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:94: 'y' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:95: 'z' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:95: 'z' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:98: 'assign' : cannot convert from '3X3 matrix of float' to 'varying 3-component vector of float'
ERROR: 16 compilation errors. No code generated.
this shader also can’t run in hardware mode on Radeons, i think it’s bug of ati drivers, because i have similar shader in Cg that work on Radeons.