HandleD3DDeviceLost

Hi All,

We’re seeing the following error when running our game on OSX machines running Windows 7 (BootCamp):

HandleD3DDeviceLost
HandleD3DDeviceLost: still lost
Skipped rendering frame because GfxDevice is in invalid state (device lost)

Graphics info for the machines is:

Direct3D:
Version: Direct3D 9.0c [nvd3dum.dll 8.16.11.8861]
Renderer: NVIDIA GeForce 9400
Vendor: NVIDIA
VRAM: 241 MB (via DXGI)
Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 DF24=0 INTZ=1 RAWZ=0 NULL=1 RESZ=0 SlowINTZ=0
desktop: 1920x1080 59Hz; virtual: 1920x1080 at 0,0

The game is apparently freezing after some amount of play time and then spamming the log file with these errors. Anyone have any ideas or seen this before? The game is a standalone build created with 3.5.0f5. We’re thinking it’s a graphics driver issue right now, but haven’t been able to reproduce this due to a lack of similar machines to test on (this is from a client machine). Any help would be much appreciated.

Thanks!

  • Josh

Hi, I have the same issue (not bootcamp):

Version: Direct3D 9.0c [nvd3dum.dll 8.17.12.8538]
Renderer: NVIDIA GeForce GTX 570
Vendor: NVIDIA
VRAM: 1248 MB (via DXGI)
Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 DF24=0 INTZ=1 RAWZ=0 NULL=1 RESZ=0 SlowINTZ=0
desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0

At Windows 7 x64

/Johan

I have the same issue (not bootcamp).

Yes, same here. Standalone build on 3.5 unity win7 64bit bootcamp. Spamming exactly same thing into log. Game freezes after few ALT+TABs usually. Easy to repro. What is it?? Anyone know? We are in trouble because we can’t pass our distributors QA :frowning: (they can repro this on Win7 64b machines without bootcamp as well) Someone help.

I don’t want to be inpatient but I would like to get some kind of answer. Why is this happening? When will this be fixed? Are “Unity guys” aware of this problem? This is completely reproducible on a lot of Win 7 64b machines. Just ALT+TABing few times (around 10) and the Unity freeze for some reason. This is definitely 3.5 ONLY bug. 3.4 was ok. We are stuck now. We can’t go back to 3.4 and we can’t fix this on 3.5. Our parter don’t want to take our program because it simply freezes too often and we can’t do anything about it. Any solution? Any ETA? Anything.

Did you file a bug report with your project? (or one that reproduces the problem)

The main difference between 3.4 and 3.5 renderer is that we introduced multithreading, so there might be some incompatibilities we didn’t see on our hardware. You can run single-threaded by using a command line switch: -force-gfx-st

Let us know if using the switch helps, that gets us closer to a solution.

Wow! you made my day! This command helped 100%. Not a single crash or freeze! Thanks a lot! We are having headaches over a week now and this one command fixed it all.
I have one question. Can I run Unity with this command switch by default? Because I don’t want to create any kind of .bat file or something like this. Is it possible to run Unit in this “single-threaded” mode everytime when player runs my app?

Good to know! Although sad that it was causing problems in the first place… There is no way to force single-threaded mode other than the switch right now, but we may be able to sneak it in for a hotfix release. It depends on how close you are to shipping if this is useful to you.

Cheers,
Kaspar

For now, our distributors QA has only this freeze problem on a list. As soon as it is fixed they can release our game. So this is a VERY actual problem for us. I don’t know how long does it take to release a hotfix for Unity but we would be very grateful if Unity allows us to run as single-threaded by default somehow. Do you have any idea how long it takes to release a hofix for this?

Any news on this issue? We are getting reports of random freezes in addition to ALT+tabbing also. Any news when the hotfix will come out to enable sigle threaded rendering as a default?

Have you reported this issue? Do you have a case number?

That’s very interesting to know.

I wish Unity would publish all the command line parameters, i’ve often found them useful in the past, but the webpage dealing with them is very limited in scope.

What would be even more helpful was if there was a way to set up these parameters from within Unity as its not always possible to set up command line for end users. I mean on windows the only way I know to achieve it is to use a shortcut and add the parameters to the end of the target field. This works, but obviously if you run the project from the exe and not the shortcut everything breaks.

I’m slightly confused as I was informed recently that -force-gfx-direct would also force single threading on the renderer as a fix to getting some old opengl code working in 3.5. It did work ( using a combination of ‘-force-opengl -force-gfx-direct’) though i’m wondering what gfx-direct actually means now, since gfx-st from the name sounds more likely to switch to single threaded.

Yes I have reported the bug using the Editor “Report Bug”. Dunno what the case number is.

maybe this ? : 457721_6nroe3giurg7uhhn

http://fogbugz.unity3d.com/default.asp?457721_6nroe3giurg7uhhn

That works, thanks.

For those of you looking to get through certification before this issue is fixed, Kaspar pointed me to PlayerSettings.MTRendering, which you can set to false in an editor script before you build in order to force single-threaded rendering without any command line options.

Hi, as Daniel mentioned you can disable multithreading from script via player settings. For example put this C# script in a folder called Editor:

using UnityEditor;

class ExtraSettings
{
	[MenuItem("Extra Settings/Enable MT Rendering")]
	static void EnableMTRendering()
	{
		UnityEditor.PlayerSettings.MTRendering = true;
	}

	[MenuItem("Extra Settings/Disable MT Rendering")]
	static void DisableMTRendering()
	{
		UnityEditor.PlayerSettings.MTRendering = false;
	}
}

Thanks a lot!!! I am going to try this immediately!

Tried to build a game with your script and now everything works without any freeze. Thanks!!

//EDIT: This was meant to be in reply to Kaspar Daugaard’s post above - hit reply, thought it would add as a comment (sorry!)

This is excellent (same issue here - on a high-spec windows box) - I also added the method as follows:

[MenuItem("Extra Settings/Show MT Rendering Status")]
    static void ShowMTRenderingStatus()
    {
        UnityEditor.EditorUtility.DisplayDialog("MT Rendering Status", 
			(UnityEditor.PlayerSettings.MTRendering) 
			? "Multi-Threading Rendering is currently ON" 
			: "Multi-Threading Rendering is currently OFF"
			, "OK");			    
    }