leadedge / Spout2

A video frame sharing system for Microsoft Windows
BSD 2-Clause "Simplified" License
748 stars 137 forks source link

Recommended API and method #108

Closed bylee20 closed 6 months ago

bylee20 commented 7 months ago

I am working with Qt and it provides various graphics backends including OpenGL and Direct3D 11/12. As a starter, which graphics backend do you recommend? Also, I found that I can send not only texture but also fbo or backbuffer directly. Is there benefitto use those instead of texture?

Thank you for great project.

leadedge commented 7 months ago

Fundamentally, sharing between processes is by way of DirectX 11 shared textures. OpenGL uses a driver interop to transfer from OpenGL. DirectX 12 uses D3D11on12 to transfer from D3D12. If you can use DirectX 11 directly, it is the most efficient way.

OpenGL uses an fbo blit to copy from the user texture to the interop linked, shared texture. There is negligible performance difference between send fbo or texture. SendBackbuffer gets the texture resource from the render target view. Again the time difference is negligible. The benefit is convenience if no texture resource is immediately available.

PLEXtream commented 7 months ago

Thank you for detailed answer!

whiteeat commented 2 months ago

Is it possible to use DirectX 12 API to share textures between processes without relying on D3D11on12 in the future update of this repo?

leadedge commented 2 months ago

Not without replacing the DirectX 11 shared textures and the OpenGL/DirectX interop. There might be a way using external memory but I have had no success.