crest icon indicating copy to clipboard operation
crest copied to clipboard

URP >=10.2.2 not working with Crest on Nintendo Switch

Open woistjadefox opened this issue 4 years ago • 16 comments

I was just about to test the main scene of the URP 4.8 version on the Nintendo Switch. Back in August 20 I tested the URP 4.5 version on the Switch and got some decent results. Unfortunately with 4.8 the Switch crashes when building / starting the main scene unless I disabled some feature on the ocean-underwater material. After disabling some features (hard to say which features make the difference, looks like it's rather working with less features on. Transparency always breaks it) the Switch manages to start the build but I get like 4fps. I joggled with every possible option in the player settings, Crest and the URP settings without success. When I disable the graphics jobs I could analyze the GPU usage in the profiler. Looks like the switch is spending a lot of time with transparent instanced meshes if I get it right? On the other consoles (XB1 & PS4) the 4.8 URP version runs fine (quite fast on XB1, rather slow on PS4).

The OceanFramework_Generated.shader (v4.8) works with ok frame rate on the Switch (but looks quite different).

I also tried to run URP v4.5 with Unity 2020.2 and URP 10, Had to fix this compatibility issue (https://github.com/wave-harmonic/crest/issues/667) but the Switch build has the same issue as described above. So I guess it is more related to URP 10 in a way? I also just tried Unity 2020.2.4f1 with URP 10.3.1, same issue.

image

woistjadefox avatar Feb 17 '21 18:02 woistjadefox

Just want to add that I advised also contacting Unity to get the ball rolling there since it appears to be bound to Unity versions rather than Crest versions.

Have you tried testing in a new scene with just the ocean (and basics like camera and light) and all features (underwater, simulations and material toggles) disabled?

daleeidd avatar Feb 18 '21 21:02 daleeidd

Ok I tried to test a new scene with the basics you mentioned. Same problem, the build crashes. Looks like as soon as a mesh with an Ocean URP shader material is getting rendered, the Switch starts to mess up and to crash.

I now also tried Crest URP 4.8 with Unity 2019.4.20f (URP version 7.5.3). Works like a charm with 30fps with all default features enabled.

Regarding contacting Unity: how should I approach this? They mostly want people to attach a project to be able to reproduce a behavior. Unfortunately I guess I'm not allowed to attach the URP Crest version and to create a bug report on https://unity3d.com/unity/qa/bug-reporting?

I also don't fully see why this should be a concern for Unity. When I deactivate the ocean in our game (disable ocean renderer and all inputs) the game runs fine with the current URP version of Unity 2020.2.4f1? So I guess it must have something to do how the Crest URP shader is calculating accessing things which were ok in URP 7.x and not anymore in URP 10.x?

woistjadefox avatar Feb 22 '21 13:02 woistjadefox

Yes it's fine to upload it to the bug reporter, that's the best way to go I think.

I've lost track of the issue here. It's a build crash on URP 10 / switch when transparency is enabled, is that right? That's very odd.

Is there any log? I assume you have depth texture enabled in the URP settings?

huwb avatar Feb 22 '21 14:02 huwb

I tried every URP & Crest setting option. If I reduce all features and set everything to be low I can build and the game starts but super slow (4fps). Otherwise it crashes because I get a GPU timeout.

woistjadefox avatar Feb 22 '21 15:02 woistjadefox

Ah interesting. Are you able to see where the time is going using a profiler?

huwb avatar Feb 22 '21 15:02 huwb

Btw we are going to move to OceanFramework_Generated.shader sooner or later. Maybe this is the reason we need to finally do it. It may be worth moving onto that and tweaking to try to get the same look and let us know how it goes?

huwb avatar Feb 22 '21 15:02 huwb

Ah interesting. Are you able to see where the time is going using a profiler?

Jup check the profiler screenshot in the initial post.

Btw we are going to move to OceanFramework_Generated.shader sooner or later. Maybe this is the reason we need to finally do it. It may be worth moving onto that and tweaking to try to get the same look and let us know how it goes?

There are just too many features missing if I got it right? At least I have not the same options / properties on the framework shader. But I will have a check later what is missing when I compare the two.

Btw I posted the issue on the internal Nintendo Forum and they responded that they don't support third party plugins (I was suspecting this) and I guess the same will happen if I post a third-party plugin via the Unity bug tracker.

woistjadefox avatar Feb 23 '21 07:02 woistjadefox

If you remove "DisableBatching"="True" from the tags block, does that being back performance? (long shot)

daleeidd avatar Feb 23 '21 15:02 daleeidd

If you remove "DisableBatching"="True" from the tags block, does that being back performance? (long shot)

Just tried this but unfortunately it didn't solve the problem. Is there something else that would help to debug the problem? Results from the graphics debugger evtl.?

I guess these warnings don't relay on this problem: image

woistjadefox avatar Feb 24 '21 08:02 woistjadefox

There are just too many features missing if I got it right?

This shader is equivalent to what we use in Crest HDRP and works well there. It does have less features because it works within the constraints of URP (it is generated from a SG, so will have all the correct state and etc), in order to not have bugs like this issue :).

huwb avatar Feb 24 '21 08:02 huwb

So to summarise there's a ton of time going into instancing-related code, but instancing is disabled for our shader? Hmmmm 🙃

huwb avatar Feb 24 '21 08:02 huwb

I think I found the error. I went through the entire Ocean URP shader and deactivated stuff to see what cause the frame drop / crash.

It are these lines: #if _COMPILESHADERWITHDEBUGINFO_ON #pragma enable_d3d11_debug_symbols #endif

No idea why, because the "Compile Shader With Debug Info" toggle is definitely not enabled on the material. Does that make any sense? :)

woistjadefox avatar Feb 24 '21 10:02 woistjadefox

Well found..

Does that make any sense?

Nope, not really. Even if it was being turned on, debug symbols should not trash the perf like that. I reckon this should be reported to Unity if you didnt already.

Not sure about the fix. I suppose if we need to we could remove that option, so turning on the pragma goes back to being a code change.

huwb avatar Feb 24 '21 11:02 huwb

I will report it to the Nintendo Unity forum, since it only happens with the Switch.

woistjadefox avatar Feb 24 '21 12:02 woistjadefox

Ok sure. We rarely get traction with bugs unless we use the bug reporter, but maybe the Nintendo Unity forum is a more helpful place than the general forums :)

Let us know.

huwb avatar Feb 24 '21 12:02 huwb

Unfortunately I still didn't get an answer on the Nintendo Forum.

OkoGoran avatar Mar 19 '21 10:03 OkoGoran