Chris Howard
Chris Howard

Reputation: 253

GLSL vertex shader crashes computer

I've been trying to pinpoint the exact cause of a GLSL shader that crashes my computer. I'm running Mac OS X 10.8.2 with a NVIDIA GeForce 9400M. The shader renders correctly but will occasionally crash my computer, drawing regions of black over the display (including outside of the rendering window) until the computer becomes unresponsive.

I receive no errors from glGetError and no errors during shader compilation. It appears that the crash no longer occurs when I remove a uniform mat4 from the vertex shader, such as the model-view matrix, or one of the shadow matrices. Yet according to GL_MAX_VERTEX_UNIFORM_COMPONENTS my graphics card supports 4096 vertex uniform components.

Here is the vertex shader:

#version 120

attribute vec3 position;
attribute vec2 texcoord;
attribute vec3 normal;

varying vec2 v_texcoord;
varying vec3 v_normal;
varying vec3 v_halfVec;
varying vec4 v_shadowcoord0;
varying vec4 v_shadowcoord1;
varying vec4 v_shadowcoord2;
varying vec4 v_shadowcoord3;

uniform mat4 mv;
uniform mat3 nmv;
uniform mat4 mvp;
uniform mat4 shadowMatrix0;
uniform mat4 shadowMatrix1;
uniform mat4 shadowMatrix2;
uniform mat4 shadowMatrix3;
uniform vec3 lightDir;

void main()
{
    vec4 p4 = vec4(position, 1.0);

    v_texcoord = texcoord;
    v_normal = normalize(nmv * normal);

    vec3 vertexPos = vec3(mv * p4);
    vec3 eyeDir = normalize(-vertexPos);
    v_halfVec = normalize(eyeDir + lightDir);

    v_shadowcoord0 = shadowMatrix0 * p4;
    v_shadowcoord1 = shadowMatrix1 * p4;
    v_shadowcoord2 = shadowMatrix2 * p4;
    v_shadowcoord3 = shadowMatrix3 * p4;

    gl_Position = mvp * p4;
}

I would greatly appreciate any help in tracking down the cause of this bug. Thanks!

Upvotes: 1

Views: 1548

Answers (1)

Crog
Crog

Reputation: 1170

It sounds like an issue in 10.8.2 that has also been seen here: http://news.softpedia.com/news/OS-X-10-8-2-Broken-NVIDIA-Drivers-Causing-Pixelmator-to-Crash-312907.shtml There should be a Max OS 10.8.3 that will hopefully fix this.

UPDATES: http://www.cultofmac.com/214775/apple-releases-yet-another-10-8-3-os-x-beta-to-developers/

Upvotes: 1

Related Questions