ImGui.NET
ImGui.NET copied to clipboard
Update sample to be able use NativeAOT
rd.xml file is workaround to SharpDx limitations.
Hey @kant2002, thanks for the submission here. In newer versions of Veldrid (of which there are only beta releases...), SharpDX has actually been replaced by Vortice. I think a better approach here would be to update the sample projects to reference Veldrid 4.9.0-beta2 and see if NativeAOT works out of the box. If it doesn't, we will probably need a slightly different rd.xml file, but chances are much higher that it will work.
I did update to beta, and problem just move to Vortice. Actual root cause is missing trimming annotations for SharpGen.Runtime, so I will try to fix issue there.
sigh, https://github.com/SharpGenTools/SharpGenTools/blob/7917a51b8203bcdd3e3fc0750b7f93f1888838ea/SharpGen.Runtime/MarshallingHelpers.cs#L18-L20 we already have annotations, but they are not part of latest release and Jeremy is overworked. Probably have to live with this for now.
Let's see how it goes with https://github.com/SharpGenTools/SharpGenTools/issues/229
good news: https://github.com/amerkoleci/Vortice.Windows/discussions/379#discussioncomment-4731623
I think Veldrid should be recompiled, since If I manually bump version by adding <PackageReference Include="Vortice.Direct3D11" Version="2.3.0" /> then app brokes in NativeAOT and in runtime.
Unhandled Exception: System.MissingMethodException: Method not found: 'Vortice.Direct3D11.Texture2DDescription.CpuAccessFlags'.
at Internal.Runtime.TypeLoaderExceptionHelper.CreateMissingMethodException(ExceptionStringID, String) + 0x40
at Internal.Runtime.CompilerHelpers.ThrowHelpers.ThrowMissingMethodException(ExceptionStringID, String) + 0x9
at Veldrid.D3D11.D3D11Texture..ctor(ID3D11Texture2D, TextureType, PixelFormat) + 0x15
at Veldrid.D3D11.D3D11Swapchain.Resize(UInt32, UInt32) + 0x22b
at Veldrid.D3D11.D3D11Swapchain..ctor(D3D11GraphicsDevice, SwapchainDescription&) + 0x511
at Veldrid.D3D11.D3D11GraphicsDevice..ctor(D3D11DeviceOptions, Nullable`1) + 0x445
at Veldrid.GraphicsDevice.CreateD3D11(GraphicsDeviceOptions, SwapchainDescription) + 0xf8
at Veldrid.StartupUtilities.VeldridStartup.CreateDefaultD3D11GraphicsDevice(GraphicsDeviceOptions, Sdl2Window) + 0xa6
at Veldrid.StartupUtilities.VeldridStartup.CreateGraphicsDevice(Sdl2Window, GraphicsDeviceOptions, GraphicsBackend) + 0x4a
at Veldrid.StartupUtilities.VeldridStartup.CreateWindowAndGraphicsDevice(WindowCreateInfo, GraphicsDeviceOptions, GraphicsBackend, Sdl2Window&, GraphicsDevice&) + 0x79
at ImGuiNET.Program.Main(String[]) + 0x152
at ImGui.NET.SampleProgram!<BaseAddress>+0x2ef85b
I would suggest to update vortice to latest 2.3.0 in veldrid and then use that veldrid build for imgui.
I'll try to keep method names backward compatible in future.
that's what I plan to do. Thankfully in my case Veldrid and ImGui.Net have same maintainer, so things would be easiers to handle. I just let you know that renamig in minor version cause problems. I understand that if you are alone, it's hard to keep track of everything.
that's what I plan to do. Thankfully in my case Veldrid and ImGui.Net have same maintainer, so things would be easiers to handle. I just let you know that renamig in minor version cause problems. I understand that if you are alone, it's hard to keep track of everything.
PR ready: https://github.com/mellinoe/veldrid/pull/478
After updating to latest Veldrid ImgUI.Net works with NativeAOT out of the box! Thank you guys!