GLSL错误:"类型应为float或int"

Mat*_*Mut 0 opengl shader glsl vertex-shader

我正在尝试编译一个着色器,它正在一台PC上的Intel HD上进行编译,而不是在另一台PC上的AMD驱动程序上进行编译.

顶点着色器:

#version 330
precision mediump float;
precision lowp sampler2D;

uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 WorldViewMatrix;
in vec3 position;
in vec2 TexCoord;
out vec2 texCoord;

void main() {
    texCoord = TexCoord;
    gl_Position = ProjectionMatrix * ModelViewMatrix * WorldViewMatrix * vec4(position, 1);
}
Run Code Online (Sandbox Code Playgroud)

片段着色器:

#version 330
precision mediump float;
precision lowp sampler2D;

uniform vec4 TextureHueColor;
uniform sampler2D TextureUnit;
in vec2 texCoord;
out vec4 gl_FragColor;

void main() {
    gl_FragColor = texture(TextureUnit, texCoord) * TextureHueColor;
}
Run Code Online (Sandbox Code Playgroud)

在AMD驱动程序上,我得到:

Vertex shader failed to compile with the following errors:
ERROR: 0:3: error(#228) Type should be float or int
ERROR: error(#273) 1 compilation errors.  No code generated
Run Code Online (Sandbox Code Playgroud)

我是初学者,不知道这个着色器有什么问题,对我来说看起来很好.有谁发现了什么问题?

Nic*_*las 5

precisionGLSL 3.30中的默认限定符不能应用于采样器类型.或者除了int或以外的任何类型float.

另外,仅供参考:当使用桌面GLSL(而不是GLSL ES)时,precision限定符无效.他们被忽略了; 它们仅用于与GLSL ES着色器兼容.