Hey everyone,
since I updated my Catalyst Driver for my 6950, my code sopped working.
The following code works fine on several machines with both NVidia and AMD Graphics, but not on my main machine.
My compiler returns uniform location -1 for "worldTexture" and "shadowMap" even though these variables are used to calculate the result!
Is it a bug, or did I miss something?
[source lang="cpp"]
#version 330 core
in vec2 passCoord;
out vec3 outDiffuse;
uniform sampler2D diffuseTexture;
uniform sampler2D worldTexture;
uniform sampler2D normalTexture;
uniform sampler2D shadowMap;
layout(std140) uniform Sun {
vec3 sunPosition;
vec3 sunDirection;
vec3 sunDiffuse;
};
layout(std140) uniform Camera {
mat4 camViewProj;
mat4 sunViewProj;
mat4 sunViewCoordProj;
};
void main()
{
vec3 diffuse = texture2D(diffuseTexture, passCoord).rgb;
vec3 normal = texture2D(normalTexture, passCoord).rgb;
vec3 worldPos = texture2D(worldTexture, passCoord).rgb;
float intensity = diffuse.x + diffuse.y + diffuse.z;
vec4 sunSpacePos = sunViewCoordProj * vec4(worldPos, 1.0f);
vec2 shadowMapCoord = vec2(sunSpacePos);
float curSunSpaceDepth = texture2D(shadowMap, shadowMapCoord).x;
float sunSpaceDepth = sunSpacePos.z - 0.0001f;
float shadowFactor = (curSunSpaceDepth < sunSpaceDepth) ? 1.0f : 1.0f;
outDiffuse = (diffuse * shadowFactor + intensity * sunDiffuse) * max(dot(normal, sunDirection), 0.0f);
}
[/source]