rendering – How can a Windows graphics component be implemented through DXGI without DirectX or GDI?

DXGI is described as separating out low-level graphics operations from the rendering APIs so that APIs other than DirectX and GDI can use graphics through DXGI, labeled as “Future Graphics Components” in this diagram from Microsoft documentation:

Diagram of DXGI role between application and hardware on Windows operating system.

However, there appears to be no way to write or copy data into a DXGI swap chain back buffer without using DirectX or GDI.

We can create a swap chain and get the back buffer as a DXGI surface from the swap chain with IDXGISwapChain::GetBuffer(). However, this surface cannot be written to directly. Attempting to map the surface results in an error that the buffer was created with no CPU access flags:

/* swapchain = previously created swapchain pointer */
IDXGISurface* surface;
IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, &surface);
DXGI_MAPPED_RECT rect;
IDXGISurface_Map(surface, &rect, DXGI_MAP_WRITE); /* error */

We can create another surface with IDXGIDevice::CreateSurface(), even though it is discouraged to call this function from an application, and map it using IDXGISurface::Map(), but DXGI provides no API for copying from that surface to the swap chain’s back buffer surface.

Read more here: Source link