Porting code from Microsoft's old managed DirectX interfaces to SharpDX.
The documentation for Microsoft's ID2D1RenderTarget::EndDraw says that it should return an HRESULT
:
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to the tags that were active when the error occurred.
Especially important is that this is the place I would usually detect the need to recreate the target (D2DERR_RECREATE_TARGET
). Indeed, Microsoft shows this in their example:
hr = m_pRenderTarget->EndDraw();
if (hr == D2DERR_RECREATE_TARGET) ...
SharpDX's implementation is a subroutine - no return value. As seen in github source:
/// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to the tags that were active when the error occurred. </returns>
public void EndDraw()
The comment still mentions the HRESULT, but this is void
-returning.
How do I see the HRESULT?