• Igor Demin's avatar
    Fix crash on Windows machines without OpenGL (#811) · 2fac6861
    Igor Demin authored
    * Fix crash on Windows machines without OpenGL
    
    Some Windows CI machines don't contain OpenGL, so Skiko/Compose will crash on them. It shouldn't crash, it should fallback to Software rendering
    
    To properly fallback, we need to load opengl32.dll dynamically in runtime.
    
    Fixes https://github.com/JetBrains/compose-multiplatform/issues/3243
    
    # Test 1
    - `gradlew publishToMavenLocal` is successful (if we use functions directly, it fails with "error LNK2019: unresolved external symbol")
    - `SkiaLayerTest` is successful (it tests OpenGL as well)
    
    # Test 2
    1. Remove `C:\Windows\System32\opengl32.dll`
    2. `SkiaLayerTest` still should be successful, but logs should contain that it fallbacks to Software rendering.
    
    # Test 3
    1. Compile local skiko
    2. Run Compose run1 and tests
    
    * Refactor
    
    * Discussions
    
    * Discussions
    
    * Split throwJavaRenderException
    
    It isn't valid to use FormatMessage for code from GetLastError
    2fac6861
directXRedrawer.cc 17.4 KB