Use separate render and decode D3D11Devices

See #1424
This commit is contained in:
Cameron Gutman
2026-01-19 14:25:08 -06:00
parent 218ffc2d55
commit f6e08f8a43
2 changed files with 339 additions and 143 deletions
+12 -4
View File
@@ -52,6 +52,12 @@ private:
void renderVideo(AVFrame* frame);
bool checkDecoderSupport(IDXGIAdapter* adapter);
bool createDeviceByAdapterIndex(int adapterIndex, bool* adapterNotFound = nullptr);
bool setupSharedDevice(IDXGIAdapter1* adapter);
static bool createSharedFencePair(UINT64 initialValue,
ID3D11Device5* dev1, ID3D11Device5* dev2,
Microsoft::WRL::ComPtr<ID3D11Fence>& dev1Fence,
Microsoft::WRL::ComPtr<ID3D11Fence>& dev2Fence);
int m_DecoderSelectionPass;
int m_DevicesWithFL11Support;
@@ -65,9 +71,10 @@ private:
Microsoft::WRL::ComPtr<IDXGIFactory5> m_Factory;
int m_AdapterIndex;
Microsoft::WRL::ComPtr<ID3D11Device> m_Device;
Microsoft::WRL::ComPtr<ID3D11Device5> m_RenderDevice, m_DecodeDevice;
Microsoft::WRL::ComPtr<ID3D11DeviceContext4> m_RenderDeviceContext, m_DecodeDeviceContext;
Microsoft::WRL::ComPtr<ID3D11Texture2D> m_RenderSharedTextureArray;
Microsoft::WRL::ComPtr<IDXGISwapChain4> m_SwapChain;
Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_DeviceContext;
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_RenderTargetView;
Microsoft::WRL::ComPtr<ID3D11BlendState> m_VideoBlendState;
Microsoft::WRL::ComPtr<ID3D11BlendState> m_OverlayBlendState;
@@ -76,8 +83,9 @@ private:
Microsoft::WRL::ComPtr<ID3D11Fence> m_PreviousFrameRenderedFence;
Microsoft::WRL::Wrappers::Event m_PreviousFrameRenderedEvent;
UINT64 m_PreviousFrameRenderedFenceValue;
Microsoft::WRL::ComPtr<ID3D11Fence> m_DecoderShaderBindFence;
UINT64 m_DecoderShaderBindFenceValue;
Microsoft::WRL::ComPtr<ID3D11Fence> m_DecodeD2RFence, m_RenderD2RFence;
Microsoft::WRL::ComPtr<ID3D11Fence> m_DecodeR2DFence, m_RenderR2DFence;
UINT64 m_DecodeRenderSyncFenceValue;
SDL_mutex* m_ContextLock;
bool m_BindDecoderOutputTextures;