Crashes on Nvidia hardware

A few people have told me that my past two samples (Bokeh and RadiosityDX11) were crashing on Nvidia GPU’s, which I verified myself on my coworker’s GTX 470. The crash appears to be a driver bug, since it happens deep in the Nvidia runtime DLL on a worker thread and also because it works fine on AMD hardware and the REF device. This morning we managed to narrow it down to the shadow map filtering shader code (shader code can crash drivers apparently, who knew?), and I suspect that it’s the the fact that shader makes use of a SampleCmp with an integer offset. Commenting out the filtering and replacing it with a single SampleCmp seems to work, but I think using a regular texture coordinate offset might work as well. Anyone want to try putting this into “SampleShadowCascade” in Mesh.hlsl, and let me know if it works?

 

[unroll(NumSamples)]
for (int y = -Radius; y <= Radius; y++)
{
    [unroll(NumSamples)]
    for (int x = -Radius; x <= Radius; x++)
    {
        float2 offset = float2(x, y) * (1.0f / ShadowMapSize);
        float2 sampleCoord = shadowTexCoord + offset;
        float sample = ShadowMap.SampleCmp(ShadowSampler, sampleCoord, shadowDepth).x;
        ...
    }
}

Comments:

rake -

Yes, this fixes the crash in the Bokeh demo on my GTX 480. Finally, I can enjoy your demos. Thanks for the effort!


#### [MJP](http://mynameismjp.wordpress.com/ "mpettineo@gmail.com") -

Thanks rake, really appreciate it! I’ll update the old samples with the new shader code.