Rendering a ID3D11Texture2D into a SkImage (SkiaSharp/Avalonia)

I’m currently trying to create an interop layer to render my render target texture into a Skia SkImage. This is being done to facilitate rendering from my graphics API into Avalonia.

I’ve managed to piece together enough code to get everything running without any errors (at least, none that I can see), but when I draw the SkImage I see nothing but a black image.

Of course, these things are easier to describe with code:

private EglPlatformOpenGlInterface _platform; private AngleWin32EglDisplay _angleDisplay; private readonly int[] _glTexHandle = new int[1];  IDrawingContextImpl context // <-- From Avalonia  _platform = (EglPlatformOpenGlInterface)platform; _angleDisplay = (AngleWin32EglDisplay)_platform.Display;  IntPtr d3dDevicePtr = _angleDisplay.GetDirect3DDevice();  // Device5 is from SharpDX. _d3dDevice = new Device5(d3dDevicePtr);    // Texture.GetSharedHandle() is the shared handle of my render target. _eglTarget = _d3dDevice.OpenSharedResource<Texture2D>(_target.Texture.GetSharedHandle());  // WrapDirect3D11Texture calls eglCreatePbufferFromClientBuffer. _glSurface = _angleDisplay.WrapDirect3D11Texture(_platform, _eglTarget.NativePointer);  using (_platform.PrimaryEglContext.MakeCurrent()) {                    _platform.PrimaryEglContext.GlInterface.GenTextures(1, _glTexHandle); }  var fbInfo = new GRGlTextureInfo(GlConsts.GL_TEXTURE_2D, (uint)_glTexHandle[0], GlConsts.GL_RGBA8); _backendTarget = new GRBackendTexture(_target.Width, _target.Height, false, fbInfo);              using (_platform.PrimaryEglContext.MakeCurrent()) {                    // Here's where we find the gl surface to our texture object apparently.    _platform.PrimaryEglContext.GlInterface.BindTexture(GlConsts.GL_TEXTURE_2D, _glTexHandle[0]);     EglBindTexImage(_angleDisplay.Handle, _glSurface.DangerousGetHandle(), EglConsts.EGL_BACK_BUFFER);     _platform.PrimaryEglContext.GlInterface.BindTexture(GlConsts.GL_TEXTURE_2D, 0); }  // context is a GRContext _skiaSurface = SKImage.FromTexture(context, _backendTarget, GRSurfaceOrigin.BottomLeft, SKColorType.Rgba8888, SKAlphaType.Premul);  // This clears my render target (obviously). I should be seeing this when I draw the image right? _target.Clear(GorgonColor.CornFlowerBlue);  canvas.DrawImage(_skiaSurface, new SKPoint(320, 240)); 

So, as far as I can tell, this should be working. But as I said before, it’s only showing me a black image. It’s supposed to be cornflower blue. I’ve tried calling Flush on the ID3D11DeviceContext, but I’m still getting the black image.

Anyone have any idea what I could be doing wrong?