此着色器程序在 Radeon 3450M、GT 550Ti、GT430 等上运行良好,但在 Intel HD4000 上失败。有什么想法可能是错误的,或者建议让着色器对英特尔更友好?
顶点着色器:
uniform mat4 uniform_Projection;
attribute vec4 attribute_Position;
attribute vec4 attribute_Color;
varying vec4 varying_Color;
vec4 varying_Color_Bak;
void main(void)
{
varying_Color.x = clamp(abs((attribute_Position.x + 3.0f) / 5.0f), 0.1f, 1.0f);
varying_Color.y = clamp(abs((attribute_Position.y + 3.0f) / 5.0f), 0.1f, 1.0f);
varying_Color.z = 0.0f;//clamp(abs((attribute_Position.x + attribute_Position.y + 4.0f) / 7.0f), 0.1f, 1.0f);
varying_Color.w = 0.9f;
gl_Position = uniform_Projection * attribute_Position;
}
片段着色器:
uniform mat4 uniform_Projection;
varying vec4 varying_Color;
vec4 varying_Color_Bak;
void main (void)
{
varying_Color_Bak = varying_Color;
varying_Color = uniform_Projection * varying_Color;
for (int i = 0; i < 3; i++) {
varying_Color = sin(varying_Color);
varying_Color = inversesqrt(abs(varying_Color));
varying_Color = abs(log(varying_Color));
}
varying_Color = clamp(varying_Color, 0.1f, 1.0f);
varying_Color = mix(varying_Color, varying_Color_Bak, 0.9f);
gl_FragColor = sin(varying_Color);
}