terrafx / terrafx.interop.windows

Interop bindings for Windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUESTION] Offscreen graphics? (No attached Application window)

DeXtmL opened this issue · comments

Need a console program sample for offscreen graphics/compute, where no Window is involved.
Currently no idea how to create a device from GraphicsAdapter without a window.

There are a couple options.

You could use IDXGIFactory2.CreateSwapChainForComposition, which allows a swapchain that effectively "renders offscreen" so you can perform normal ops and compose an output separately. This works well for DComp, WinUI, WPF, UWP, XAML, etc.

You could also just create your RTV (RenderTargetView) over an independent 2D Texture reosurce you allocate and just copy the result out when you're done. This works well for completely headless setups.

Ah, unless by GraphicsAdapter you're referring to the code in https://github.com/terrafx/terrafx, in which case its not a supported scenario yet.

I'm in the middle of refactoring some of the logic here before I move to support new scenarios like headless rendering.