Marshalling “EGLRenderResolutionScaleProperty” to ANGLE from C# using P/Invoke

前端 未结 2 1457
日久生厌
日久生厌 2021-01-24 03:59

I am trying to get ANGLE working in C# using P/Invoke. Basically, I am creating a simple 2D surface, and then passing that off to skia (using SkiaSharp). Everything is working a

2条回答
  •  北海茫月
    2021-01-24 04:51

    I'm not answering your question directly.

    But a proven-working alternative way is to create a C++ WindowsRuntime Component wrapper project, aka, use C++/CLI(or CXX, should I say?)to do the interop.

    You can expose methods like below, expose APIs depending on your needs.

    void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
    void InitializeEGL(Windows::UI::Xaml::Controls::SwapChainPanel ^ window);
    

    or, if you want to have finer granularity, declare something like below in the C++ WinRT component,

    void EglCreateWindowSurface(Platform::IntPtr display, Platform::IntPtr config, Windows::Foundation::Collections::PropertySet^ propertySet);
    

    This little trick will enable you to get around the C# marshaling issue, and I have verfied it to work.

    And I'll continue to investigate the C# interop approach.

提交回复
热议问题