Reply To: Frame rate issues in a client with Unity Syphon server

Home Forums Syphon Syphon Implementations – User Frame rate issues in a client with Unity Syphon server Reply To: Frame rate issues in a client with Unity Syphon server


Im honestly not as familiar with Unity internals as Brian is (much much less so), so I’m a bit hesitant to comment on the Unity side of things. I do know from working with Brian on the initial Plugin is that, indeed, uUnity bounces contexts around too and fro, which means the Plugin can not be guaranteed to have the same context active as when it was initialized, thus those checks.

Might I suggest compiling a debug version of the Syphon Unity plugin and ensuring that its not re-creating resources due to context switches during the hiccups?

I am personally not very satisfied with the state of the Unity plugin, only because Unity is such a closed black box, that its next to impossible to know what state assumptions and areas in the pipeline are the most suitable to ‘abuse’.

As far as a ‘serving’ issue is concerned, know this:

Syphon, internally, has to add an additional render to texture phase *if* it is publishing a texture from a pre-existing texture (an alternative is to bind, then unbind and publish which renders directly to Syphons texture, however this is only useful in some scenarios)

This additional render to texture pass copies the incoming texture to the IOSurface backed texture for display. This is usually quite fast, fully hardware accelerated, and, judging form your bench-marks seems uniquely to be a cause for concern.

However, *making a new internal IOSurface backed texture* is *non trivial* and *quite slow*. One early optimization we did in Syphon was to ensure we only rarely create new internal IOSurfaces when needed. If your context is changing behind the scenes from time to time, and you init a new server, you will init a new internal IOSurface backed texture, which might account for some slowdowns and grinding, as I understand it also has to init resources on the GPU, *and* the OS kernel.

Run a debug build of the Unity plugin. Put logs in places where checks are done (check if contexts match, check if servers are being re-created, etc), and see what internally is happening. It might be revealing and help narrow it down.

Sorry I cannot be of more immediate help! I wish Unity was not quite as black box’ed as it is…