Skip to content

Creating ID3D11Texture2D from Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface #1699

Answered by Perksey
triandco asked this question in General
Discussion options

You must be logged in to vote

I've had a look at this, and will add IDirect3DDxgiInterfaceAccess in 2.18. However, I won't add any other WinRT APIs like GraphicsCapture primarily because 2.X isn't currently in a fit state for WinRT. I recommend using those APIs through CsWinRT for now.

Your error is here:

      var t = new ID3D11Texture2D((void**)pUnknown.ToPointer());
      return &t;

You should do

new ComPtr<ID3D11Texture2D>((ID3D11Texture2D*)access.GetInterface(ID3D11Texture2D.Guid)); 

instead. ID3D11Texture2D in Silk.NET is a structure wrapping a void**.

Note that this will also add a ref so watch out for memory leaks!

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@triandco
Comment options

@Perksey
Comment options

Answer selected by triandco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants