Skip to content

Commit

Permalink
Option to not throw RenderException when use OpenGL on macOS
Browse files Browse the repository at this point in the history
To allow using OpenGL on macOs, call:
```
System.setProperty("skiko.macos.opengl.enabled", "true")
```

By request from user in DM who uses LWJGL+Skiko on macOS.
  • Loading branch information
igordmn committed Apr 18, 2024
1 parent 4f22664 commit 548077e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ internal actual fun loadOpenGLLibrary() {
Library.staticLoad()
loadOpenGLLibraryWindows()
}
// it was deprecated in macOS 10.14 and isn't supported in Skiko
// it was deprecated in macOS 10.14
// see https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_intro/opengl_intro.html
hostOs.isMacOS -> throw RenderException("OpenGL on macOS isn't supported")
hostOs.isMacOS -> {
if (!SkikoProperties.macOsOpenGLEnabled) {
throw RenderException("OpenGL on macOS is deprecated. To enable its support, call System.setProperty(\"skiko.macos.opengl.enabled\", \"true\")")
}
}
// Do nothing as we don't know for sure which OS supports OpenGL.
// If there is support, we assume that it is already linked.
// If there is no support, there will be a native crash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ object SkikoProperties {
return value?.let(GpuPriority::parseOrNull) ?: GpuPriority.Auto
}

val macOsOpenGLEnabled: Boolean get() = getProperty("skiko.macos.opengl.enabled")?.toBoolean() ?: false

internal fun parseRenderApi(text: String?): GraphicsApi {
when(text) {
"SOFTWARE_COMPAT" -> return GraphicsApi.SOFTWARE_COMPAT
Expand Down

0 comments on commit 548077e

Please sign in to comment.