I just wonder, if it's possible to initialize and use DX11 or DX9 for offscreen rendering only - meaning with no attached window. My intention is to do some GPU benchmarking before opening actual window. In this benchmarking some test scene is rendered, but should not be visible. (Actually depending on the benchmark score different windows are opened)
Yes. You can initialize the Direct3D device using
D3D11CreateDevice, which requires no window. You simply do not create a swap chain at all. You can still create offscreen render targets and draw to them in the usual way. Instead of calling
Present on the swap chain, you can call
ID3D11DeviceContext::Flush to kick the GPU with the work you've queued up.
If you later want to create a window, you can destroy the device and recreate it with
D3D11CreateDeviceAndSwapChain, or you can create a swap chain and attach it to the existing device with
IDXGIFactory is a separate COM object that needs to be created with