Driver bug ( 441.41 )

I am the author of the supermodel emulator. Our users have informed us that the latest nvidia driver breaks our rendering engine. Previous driver versions all worked fine. The code also runs fine on AMD cards and intel cards.

Artifacts are appearing all over the place (water and road)

I am emulating completing custom bilinear filtering in shader. The part which is breaking is the LOD mipmap calculation. I was using this code

float mip_map_level(in vec2 texture_coordinate) // in texel units
    vec2  dx_vtc        = dFdx(texture_coordinate);
    vec2  dy_vtc        = dFdy(texture_coordinate);
    float delta_max_sqr = max(dot(dx_vtc, dx_vtc), dot(dy_vtc, dy_vtc));
    float mml = 0.5 * log2(delta_max_sqr);
    return max( 0, mml );

Which is standard code to calculate the LOD. I thought there could have been a problem with the partial derivative calculation so I swapped to the internal method of textureQueryLod(texSampler,texCoord)

But the results were identical.

If i force the lowest texture value by returning 0 everything looks as expected. Ie there is no problem with the texture coordinates themselves.

I actually have 2 shader paths for this code. One which renders triangles and this one works fine. And a second version that natively draws quads by passing gl_line_adjancy to a geometry shader and then outputting 2 triangles. The texture coordinates and other attributes are calculated in the fragment shader, rather than doing normal interpolation. Anyway it’s this second version which fails with the new drivers.

The triangle shader is here

The quad shader (which fails with new drivers only) is here