From a0a4c1ea834ba95ae951ca1f30d9c42c8f2cd888 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 19 Jan 2026 16:46:50 -0600 Subject: [PATCH] Use decoder texture binding by default when using separate devices This significantly improves performance on Ryzen 3300U and should generally perform equal or better everywhere. This decoder->SRV path has been prone to driver bugs, so we may need to adjust this logic if driver issues crop up. --- .../video/ffmpeg-renderers/d3d11va.cpp | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp index 40c58db3..edcd827d 100644 --- a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp +++ b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp @@ -364,17 +364,6 @@ bool D3D11VARenderer::createDeviceByAdapterIndex(int adapterIndex, bool* adapter } } - if (Utils::getEnvironmentVariableOverride("D3D11VA_FORCE_BIND", &m_BindDecoderOutputTextures)) { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "Using D3D11VA_FORCE_BIND to override default bind/copy logic"); - } - else { - // Skip copying to our own internal texture on Intel GPUs due to - // significant performance impact of the extra copy. See: - // https://github.com/moonlight-stream/moonlight-qt/issues/1304 - m_BindDecoderOutputTextures = adapterDesc.VendorId == 0x8086; - } - bool separateDevices; if (Utils::getEnvironmentVariableOverride("D3D11VA_FORCE_SEPARATE_DEVICES", &separateDevices)) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, @@ -406,6 +395,23 @@ bool D3D11VARenderer::createDeviceByAdapterIndex(int adapterIndex, bool* adapter separateDevices = false; } + if (Utils::getEnvironmentVariableOverride("D3D11VA_FORCE_BIND", &m_BindDecoderOutputTextures)) { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "Using D3D11VA_FORCE_BIND to override default bind/copy logic"); + } + else { + // Skip copying to our own internal texture on Intel GPUs due to + // significant performance impact of the extra copy. See: + // https://github.com/moonlight-stream/moonlight-qt/issues/1304 + // + // Also bind SRVs when using separate decoding and rendering + // devices as this improves render times by about 2x on my + // Ryzen 3300U system. The fences we use between decoding + // and rendering contexts should hopefully avoid any of the + // synchronization issues we've seen between decoder and SRVs. + m_BindDecoderOutputTextures = adapterDesc.VendorId == 0x8086 || separateDevices; + } + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Decoder texture access: %s (fence: %s)", m_BindDecoderOutputTextures ? "bind" : "copy",