Let’s say a render target was created via ID2D1Factory::CreateDxgiSurfaceRenderTarget.
Then the render target was passed to my function. I only have the target and not the IDXGISurface.
Is there a way to access IDXGISurface from the target?
QueryInterface doesn’t retrieve it.
DirectX 10. Windows 7.
Thank you.
Unfortunately, this is not available. The render target and the DXGI surface are different objects and thus
QueryInterfacewill not work. Internally, the render target holds a pointer to the underlying DXGI surface.This is more explicit and manageable in Direct2D 1.1 (DirectX 11.1) where you can wrap the DXGI surface in a Direct2D bitmap (
CreateBitmapFromDxgiSurface), which is then set as the target (SetTarget) of a Direct2D 1.1 render target (ID2D1DeviceContext). You can then ask the target for the bitmap (GetTarget) and ask the bitmap for the underlying DXGI surface (ID2D1Bitmap1::GetSurface).