Skip to content

Interop with Direct3D 11 #5432

Answered by kekekeks
Tape-Worm asked this question in Q&A
Feb 6, 2021 · 1 comments · 17 replies
Discussion options

You must be logged in to vote

Can I interop Direct3D 11.x with Avalonia?

Short answer: yes, that's possible, but requires tinkering with Skia and ANGLE
Long answer:

  1. configure Win32PlatformOptions to always enable GPU and AngleOptions to use DirectX11
  2. implement ICustomDrawingOperation, that will give you access to Skia on the render thread, see CustomSkiaPage.cs example. Note that the following steps can be ONLY done from ICustomDrawingOperation::Draw callback.
  3. import your Direct3D content from DXGI share handle, wrap it into EGLSurface, bind EGLSurface to a texture, import said texture to Skia
  4. draw imported image on SKCanvas
  5. cleanup

Obviously the 3rd step is the hardest one.

var egl = (EglPlatformOpenGlInterface)A…

Replies: 1 comment 17 replies

Comment options

You must be logged in to vote
17 replies
@kekekeks
Comment options

@Tape-Worm
Comment options

@Tape-Worm
Comment options

@amerkoleci
Comment options

@Tape-Worm
Comment options

Answer selected by Tape-Worm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants