I'm currently working on external plugin in Unity3d which uses NVAPI & 3D Vision. In NVAPI there are two API calls to turn on/off active stereo.
NvAPI_Stereo_Deactivate
NvAPI_Stereo_Activate
So whenever I try to toggle on/off stereo it crashes at random time with following exception:
Unity Player [version: Unity 2017.1.0f3 (472613c02cf7)]
nvwgf2umx.dll caused an Access Violation (0xc0000005) in module nvwgf2umx.dll at 0033:6f9981d8.
The crash can happen at third try or any try later sometimes. What I'm assuming currently is it has to do something with some value accessed by the dll. Problem is since its NVIDIA internal I have no access to it.
I have already tried other simple methods such as Vsync off, Change Quality settings to max in Manage 3d settings but all failing.
I did come across similer issue in NVDIA dev forums but there is not answer to it seems. Any suggestions or help regarding this would be greatly appreciated.
Also here is the link to error log
I have managed to fix this above issue using a roundabout way. Instead of using
NvAPI_Stereo_Deactivate
NvAPI_Stereo_Activate
functions to turn on & off 3d vision I'm passing the render texture to mono eye in NvAPI_Stereo_SetActiveEye to mono camera while in active mode I pass it to Left Eye & Right Eye respectively. Toggling seems to work properly although I have also noted using NvAPI_Stereo_IsActivated
in a loop seems to cause also same access violation so rather only user NvAPI_Stereo_SetActiveEye
function to set eye and not to mess around with NVAPI native functions. One downside of using this is 3d emitter will be kept on unitil the exit of application(for my project this seems ok). Hope this helps anyone in future coming across this problem. Do update the answer if anyone has a better solution. That would be nice.