com.unity.webrtc
com.unity.webrtc copied to clipboard
[BUG]: Custom rendering is adversely by the order and presence of the graphics APIs in Windows, even when forcing the graphics device
Package version
2.4.0-exp.8
Environment
* OS: Windows 11
* Unity version: 2021.3.6f1
Steps To Reproduce
-
Application.targetFrameRate = 999
. - Render the streamed texture using
Camera.render
. - Set the editor to DirectX 12.
- Observe the following frame rates under different configurations:
PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneWindows64,
new[] {GraphicsDeviceType.Direct3D12, GraphicsDeviceType.Direct3D11, GraphicsDeviceType.Vulkan});
Flags FPS
-force-gfx-jobs native --force-d3d12 65
-force-gfx-jobs native --force-d3d11 68
PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneWindows64,
new[] {GraphicsDeviceType.Direct3D11, GraphicsDeviceType.Direct3D12});
Flags FPS
-force-gfx-jobs native --force-d3d12 38
-force-gfx-jobs native --force-d3d11 20
Current Behavior
Unusually poor performance affected by the order and presence of graphics APIs for Windows.
Expected Behavior
Performance should not be affected.
Anything else?
Nothing unusual changes in the profiler. The HDRP scripting and rendering thread work is both longer, the GPU work appears to stay the same.
@doctorpangloss Can I ask you how you measure the FPS?
When Application.targetFramerate is -1, the framerate depends on the platrofm. And the encoding framerate is 60 by default. But I am not sure these framerate relates on the issue.
@doctorpangloss Can I ask you how you measure the FPS?
an ancient script I didn't author, which renders the measured FPS to a canvas text
void Update()
{
m_Timeleft -= Time.deltaTime;
m_DeltaFps += Time.timeScale / Time.deltaTime;
++m_Frames;
// Interval ended - update GUI text and start new interval
if (m_Timeleft <= 0f)
{
// display two fractional digits (f2 format)
text.text = "" + (m_DeltaFps / m_Frames).ToString("f2") + " FPS";
if ((m_DeltaFps / m_Frames) < 1)
{
text.text = "";
}
m_Timeleft = updateInterval;
m_DeltaFps = 0f;
m_Frames = 0;
}
}
this is consistent with what the profiler reported. I still need to profile on my test Windows machines
I have explored the issue more and believe there might be something severely glitched with the editor or plugin interacting with the graphics APIs order.
@doctorpangloss I am curious that this issue occurs only when using the WebRTC package.
It's a huge puzzle! This order shouldn't impact anything. I can reproduce it 100% though. I can share the repo and binaries if you need.
@doctorpangloss Hi, can I close this issue?
yes i will update it and reopen if I have some insights into why this occurs.