Possible OSX driver issue with shaders?


I’m a developer for an open source project which runs on Windows, Linux and Mac OS X. However, some people using Mac OS X with Nvidia hardware (other GPUs are not affected, and Nvidia hardware on Win/Lin is not affected either) have been reporting issues with our lighting shaders giving the wrong result.

This does not seem to come from our project: capturing an OpenGL trace (using apitrace) on Linux and running it on an affected OS X computer reproduces the issue, which means the behavior difference is only driver-side. This is either us hitting an undefined behavior somewhere or the driver messing up something.

Here is the trace: http://delroth.net/dolphin-bug.trace On Windows/Linux/{OSX with AMD hardware} the cube faces are shiny. On OSX with Nvidia hardware the cube faces have a flat color without lighting.

You may notice the trace is a bit… messy. The open source project I’m part of emulates a video game console, so our GL calls may seem a bit strange at some point. Sorry for not trying to reduce the test case - I couldn’t manage to reproduce the bug in a smaller test case when I tried.

Could someone tell us whether we are hitting an undefined behavior or a driver bug, and how we could fix this?

Thanks in advance,

Some more infos I got from debugging shaders: one of our uniforms (let’s call it X) is set to float4(0.0, 0.0, 0.0, 0.0), but dot(Y, X) >= 0.0 is false on Nvidia OSX (true everywhere else).

… and apparently the uniform is set to 0 (see glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 17, [0, 0, 0, 0]) in the trace) but the shader does not read it as 0. I’ve no idea where that could come from, could someone enlighten me?