Based on the MSDN for Direct 3D 11 Graphics the documentation section "How to create an immediate context" shows the following code:
ID3D11Texture2D* pBackBuffer;
// Get a pointer to the back buffer
hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ),
( LPVOID* )&pBackBuffer );
The here called pBackBuffer is of Type ID3D11Texture2D.
The documentation for the GetBuffer method (https://docs.microsoft.com/en-gb/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-getbuffer)
describes the second Parameter as Type REFIID (The type of interface used to manipulate the buffer) and the third as void** A pointer to a back-buffer interface.
Now a different section in the documentation about Direct2d shows the following snippet to write Direct2d content to a Direct3d buffer:
hr = m_pSwapChain->GetBuffer(
0,
IID_PPV_ARGS(&pBackBuffer)
);
Here the BackBuffer is used in CreateDxgiSurfaceRenderTarget as first parameter which is a IDXGISurface which means the Backbuffer that I got is an IDXGISurface.
How do I know that I can pass in ID3D11Texture2D and IDXGISurface to that GetBuffer method when the MSDN only describes the parameter as REFIID (see above) ? And how can I figure out what elese I can pass in there?
IID_PPV_ARGS(&pBackBuffer)is just a preprocessor macro wrapper that resolves to__uuidof(*pBackBuffer), ( LPVOID* )&pBackBuffer. See COM Coding Practices: The IID_PPV_ARGS Macro - Remy LebeauIIDargument is being compared to. This is a sort of last resort, but sometimes if what's indeed being done. - Roman R.