aardvark-platform / aardvark.rendering

Aardvark.Rendering is a high-performance, dependency-aware rendering engine. It is part of the open-source Aardvark Platform for visual computing, real-time graphics, and visualization.
https://aardvarkians.com/
Other
131 stars 13 forks source link

Improve error reporting when library function cannot be loaded #64

Open luithefirst opened 4 years ago

luithefirst commented 4 years ago

I received a Hilite log with the following error:

 0:   initializing OpenGL runtime ................................................................
 0:     WARNING: System.Exception: could not get native function (maybe some opengl-driver problem?)
   at Aardvark.Base.UnmanagedFunctions.wrap@78-2.Invoke(Object[] _arg1) in C:\- Data\aardvark-base\src\Aardvark.Base.FSharp\Reflection\UnmanagedFunctions.fs:line 78
   at <StartupCode$FSharp-Core>.$Reflect.Invoke@814-4.Invoke(T1 inp)
   at <StartupCode$Aardvark-Application-WinForms-GL>.$Application.-ctor@46-17.Invoke(IDisposable _arg1) in C:\Users\Schorsch\Development\aardvark.rendering\src\Application\Aardvark.Application.WinForms.GL\Application.fs:line 55
   at Microsoft.FSharp.Core.Operators.Using[T,TResult](T resource, FSharpFunc`2 action)
   at HiliteRender.HiliteCore..ctor(Settings settings, String shaderCachePath, ISplashScreen splash) in C:\GitLab-Runner\builds\ykmHiqGX\0\lds\Hilite.Render\src\Project HILITE\HiliteRender\HiliteCore.cs:line 147
   at HiliteApp.Viewer..ctor(ISplashScreen splash) in C:\GitLab-Runner\builds\ykmHiqGX\0\lds\Hilite.Render\src\Project HILITE\HiliteApp\Viewer.cs:line 442
   at HiliteViewer.Program.Init(String[] args) in C:\GitLab-Runner\builds\ykmHiqGX\0\lds\Hilite.Render\src\Project HILITE\HiliteViewer\Program.cs:line 116
 0:   initializing OpenGL runtimeInitialization finished ................................. 6.279 s
 0:   WARNING: Hilite not initialized properly!

It was generated with Aardvark.Rendering 4.8.11. At the moment there is no need to change this old version, but as the current master still uses the same code and error handling the error reporting should be improved and at least include the function name. As UnmanagedFunctions.wrap only gets a function pointer, this needs to be handled earlier, maybe in getProcAddress, but I assume some functions are allowed to fail and maybe do not need to log an error. Please review for possible improvements.

luithefirst commented 2 years ago

Module Unsafe https://github.com/aardvark-platform/aardvark.rendering/blob/bb0a5f01a0753474733f2835e9f408063ce1a8c9/src/Aardvark.Rendering.GL/Instructions/OpenGL.fs#L829 only seems to be used during the initialization -> remove/replace call during init? remove module?