This time I caught it early.
46450c1f3f93bf4dc96696fc7e0f0eb808d9c08a is first bad commit
commit 46450c1f3f93bf4dc96696fc7e0f0eb808d9c08a
Author: Eric Anholt e...@anholt.net
Date: Wed Mar 10 17:38:33 2010 -0800
i965: Do FS SLT, SGT, and friends using CMP, SEL instead of CMP, MOV, MOV.
:04 04 d6abcec74652e20faf81feac8486cfb8ef979494
d5b5c11b472e463525965d9673c0170b0eb206f1 M src
(Revert helps restore correct behaviour)
This breaks several shaders in my examples folder, that I downloaded from GLSL
tutorial site.
(http://www.lighthouse3d.com/opengl/glsl/)
Attached two example shaders.
Best regards,
Maxim Levitsky
//
// Fragment shader for testing the discard command
//
// Author: Randi Rost
//
// Copyright (c) 2002-2004 3Dlabs Inc. Ltd.
//
// See 3Dlabs-License.txt for license information
//
varying vec3 DiffuseColor;
varying vec3 SpecularColor;
uniform vec2 Scale;
uniform vec2 Threshold;
uniform vec3 SurfaceColor;
void main (void)
{
float ss = fract(gl_TexCoord[0].s * Scale.s);
float tt = fract(gl_TexCoord[0].t * Scale.t);
if ((ss Threshold.s) (tt Threshold.t)) discard;
vec3 finalColor = SurfaceColor * DiffuseColor + SpecularColor;
gl_FragColor = vec4 (finalColor, 1.0);
}
//
// Vertex shader for testing the discard command
//
// Author: OGLSL implementation by Ian Nurse
//
// Copyright (C) 2002-2004 LightWork Design Ltd.
// www.lightworkdesign.com
//
// See LightworkDesign-License.txt for license information
//
uniform vec3 LightPosition;
uniform vec3 LightColor;
uniform vec3 EyePosition;
uniform vec3 Specular;
uniform vec3 Ambient;
uniform float Kd;
varying vec3 DiffuseColor;
varying vec3 SpecularColor;
void main(void)
{
vec3 ecPosition = vec3 (gl_ModelViewMatrix * gl_Vertex);
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
vec3 lightVec = normalize(LightPosition - ecPosition);
vec3 viewVec= normalize(EyePosition - ecPosition);
vec3 Hvec = normalize(viewVec + lightVec);
float spec = abs(dot(Hvec, tnorm));
spec = pow(spec, 16.0);
DiffuseColor= LightColor * vec3 (Kd * abs(dot(lightVec, tnorm)));
DiffuseColor= clamp(Ambient + DiffuseColor, 0.0, 1.0);
SpecularColor = clamp((LightColor * Specular * spec), 0.0, 1.0);
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
//
// Fragment shader for drawing Julia sets
//
// Authors: Dave Baldwin, Steve Koren, Randi Rost
// based on a shader by Michael Rivero
//
// Copyright (c) 2002-2004 3Dlabs Inc. Ltd.
//
// See 3Dlabs-License.txt for license information
//
varying vec3 Position;
varying float LightIntensity;
uniform float MaxIterations;
uniform int TIME_FROM_INIT;
uniform float AnimSpeed;
uniform float AnimLenght;
uniform float Xcenter;
uniform float Ycenter;
uniform vec3 InnerColor;
uniform vec3 OuterColor1;
uniform vec3 OuterColor2;
uniform float Creal;
uniform float Cimag;
uniform sampler1D ramp;
void main(void)
{
float tmp = -float(TIME_FROM_INIT)*AnimSpeed;
float zoom = tmp - AnimLenght* floor(tmp/AnimLenght);
zoom = 1.0;
float real = Position.x * zoom + Xcenter;
float imag = Position.y * zoom + Ycenter;
//float Creal = real; // Change this line...
//float Cimag = imag; // ...and this one to get a Julia set
float r2 = 0.0;
float iter;
for (iter = 0.0; iter MaxIterations r2 4.0; ++iter)
{
float tempreal = real;
real = (tempreal * tempreal) - (imag * imag) + Creal;
imag = 2.0 * tempreal * imag + Cimag;
r2 = (real * real) + (imag * imag);
}
// Base the color on the number of iterations
vec3 color;
if (r2 4.0)
color = InnerColor;
else
{
color = texture1D(ramp,iter/MaxIterations).rgb;
//color = mix(OuterColor1, OuterColor2, fract(iter * 0.05));
}
color *= LightIntensity;
gl_FragColor = vec4 (clamp(color, 0.0, 1.0), 1.0);
//gl_FragColor = vec4 (color, 1.0);
}
//
// Vertex shader for drawing Julia sets
//
// Authors: Dave Baldwin, Steve Koren, Randi Rost
// based on a shader by Michael Rivero
//
// Copyright (c) 2002-2004 3Dlabs Inc. Ltd.
//
// See 3Dlabs-License.txt for license information
//
uniform vec3 LightPosition;
uniform float SpecularContribution;
uniform float DiffuseContribution;
uniform float Shininess;
varying float LightIntensity;
varying vec3 Position;
void main(void)
{
vec3 ecPosition = vec3 (gl_ModelViewMatrix * gl_Vertex);
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
vec3 lightVec = normalize(LightPosition - ecPosition);
vec3 reflectVec = reflect(-lightVec, tnorm);
vec3 viewVec= normalize(-ecPosition);
float spec = max(dot(reflectVec, viewVec), 0.0);
spec= pow(spec, Shininess);
LightIntensity = DiffuseContribution *
max(dot(lightVec, tnorm), 0.0) +