Ever since I installed the latest drivers for my graphics card (AMD Radeon 7870) my shadow mapping hasn't been working as it used to.
I've tried installing older drivers, but oddly that didn't help, so I'm unsure whether this actually has anything to do with the drivers or not.

I've tried to revert to the simplest case of shadow mapping, with a single texture, with these shaders:
Vertex Shader:
Code :
#version 330 core
 
layout(std140) uniform ViewProjection
{
	mat4 M;
	mat4 V;
	mat4 P;
	mat4 MVP;
};
 
layout(location = 0) in vec4 vertPos;
layout(location = 1) in vec2 vertexUV;
 
out vec2 UV;
out vec4 shadowCoord;
 
uniform mat4 depthMVP;
 
void main()
{
	gl_Position = MVP *vertPos;
	UV = vertexUV;
	shadowCoord = depthMVP *(M *vertPos);
}

Fragment Shader:
Code :
#version 330 core
 
uniform sampler2D diffuseMap;
uniform sampler2D shadowMap;
 
in vec2 UV;
in vec4 shadowCoord;
 
out vec4 color;
 
void main()
{
	color = texture2D(diffuseMap,UV);
 
	float visibility = 1.0;
	float z = texture2D(shadowMap,shadowCoord.xy /shadowCoord.w).z;
	if(z > 0 && z < 1 && z < (shadowCoord.z /shadowCoord.w))
		visibility = 0.0;
	color.rgb *= visibility;
}

Generating the shadow map:
Code :
unsigned int size = 4096;
unsigned int frameBuffer;
glGenFramebuffers(1,&frameBuffer);
glBindFramebuffer(GL_FRAMEBUFFER,frameBuffer);
 
unsigned int texture;
glGenTextures(1,&texture);
glBindTexture(GL_TEXTURE_2D,texture);
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT,size,size,0,GL_DEPTH_COMPONENT,GL_FLOAT,0);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D,texture,0);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_R,GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_FUNC,GL_LEQUAL);
 
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

The depth MVP is simply calculated with: biasMatrix *(lightProjection *lightView *lightModel);

My bias matrix looks like this:
Code :
static const glm::mat4 BIASMATRIX(
	0.5f,0.0f,0.0f,0.0f,
	0.0f,0.5f,0.0f,0.0f,
	0.0f,0.0f,0.5f,0.0f,
	0.5f,0.5f,0.5f,1.0f
);


Without the bias matrix this is the result:
Click image for larger version. 

Name:	shadowmapping_01.jpg 
Views:	205 
Size:	56.8 KB 
ID:	1490

The shadow is rendered correctly, just at the wrong position. Oddly enough the size of the shadow is correct. (Shouldn't it be smaller when the bias matrix is not applied?)

If I do, however, apply the bias matrix, this is the result:
Click image for larger version. 

Name:	shadowmapping_02.jpg 
Views:	189 
Size:	73.8 KB 
ID:	1489

This doesn't actually seem like a driver problem, but I don't recall changing anything that could cause this, so I assume I'm missing something obvious?