Prevent shader compilation stutters with PSO Tracing in Unity 6

I am interested to know if there is any benefit to playing through a scene as it appears in final content vs simply spawning all of the render elements separately and rendering them 1 by 1.

I would have thought that instanced materials can share PSO’s so there wouldn’t be a benefit to observe them all in the same frame? I’m probably not understanding something though :slight_smile:

REALLY loving this feature.

The driver-managed cache should indeed grow the more shaders and PSOs are compiled (and cached to disk).

As of Unity 6.1, the GraphicsStateCollection API can be used with older APIs like OpenGLES and DX11. But make sure you trace a collection for these APIs as well. To your second question, the legacy warmup is not jobified.

It is usually simplest to just play through the scene. As you may trigger new graphics states while playing the game, by enabling certain effects or renderer settings. Which may result in compiling additional PSOs.

Scripting a “PSO capture scene” like you describe is definitely viable! And if done right, could be very efficient. For this, make sure you draw all the needed materials and effects, using the relevant rendering settings etc… This is something we hope to simplify and automate in the future :slight_smile:

3 Likes

yes please make it simple for people who are just designing levels and no need to program anything

thanks!

To be clear and super straight: what we are saying is that there is no benefit at all in using this new API over the old one for old GFX drivers (OGL, DX11 etc)

Hello, thanks for the detailed info about PSO warmup - however on Android build with Development mode using the GraphicStateCollectionManager that you had mentioned, I can see in logcat that in fact I’m trying to send Graphic State to Editor, but the file is never created. It even returns true from m_GraphicsStateCollection.SendToEditor(m_OutputCollectionName) function.
Is there any way to debug it further to tell what’s wrong? Is it being created in different path?
Used code:

m_GraphicsStateCollection.EndTrace();
Debug.Log("Focus changed. Sending collection to Editor with " + m_GraphicsStateCollection.totalGraphicsStateCount + " GraphicsState entries, file: " + m_OutputCollectionName);
Debug.Log("Sending: " +  m_GraphicsStateCollection.SendToEditor(m_OutputCollectionName));

Received logs on device:

Sending collection to Editor with 7 GraphicsState entries, file: Settings/GraphicsStateCollections/GfxState_Android_Vulkan_Mobile_Low
Sending: True

However nothing is present in Assets/Settings/GraphicsStateCollections.

Regards!