Skip to content

Extract skiko platform code into separate module - #1292

Open
Hubert Błaszczyk (hub-bla) wants to merge 14 commits into
masterfrom
hub.bla/skiko-rendering-module
Open

Hubert Błaszczyk (hub-bla) wants to merge 14 commits into
masterfrom
hub.bla/skiko-rendering-module

Conversation

@hub-bla

@hub-bla Hubert Błaszczyk (hub-bla) commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

This branch introduces a new skiko-rendering module that separates platform rendering integration from the core skiko library.

The new module owns the higher-level rendering infrastructure, including SkiaLayer, frame dispatching, render delegates, AWT/Swing integration, platform renderers, ANGLE support.

Fixes SKIKO-1189

@hub-bla
Hubert Błaszczyk (hub-bla) force-pushed the hub.bla/skiko-rendering-module branch 3 times, most recently from ca727bc to 660f7ae Compare September 7, 2026 12:10
@hub-bla
Hubert Błaszczyk (hub-bla) force-pushed the hub.bla/skiko-rendering-module branch 2 times, most recently from 098c342 to 03108b0 Compare September 7, 2026 13:07
Base automatically changed from hub.bla/decouple-ganesh-from-platform-redrawers to master September 9, 2026 09:36
@hub-bla
Hubert Błaszczyk (hub-bla) force-pushed the hub.bla/skiko-rendering-module branch 5 times, most recently from 94198bd to 9218f96 Compare September 11, 2026 11:15
@hub-bla
Hubert Błaszczyk (hub-bla) marked this pull request as ready for review September 14, 2026 08:54
Comment thread skiko/settings.gradle.kts
Comment thread skiko/settings.gradle.kts Outdated
@hub-bla Hubert Błaszczyk (hub-bla) changed the title Extract skiko rendering code into separate module Extract skiko platform code into separate module Sep 21, 2026

@igordmn Igor Demin (igordmn) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only skiko/README.md needs to be updated

@igordmn

Igor Demin (igordmn) commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Please adopt the new changes from master

Comment thread skiko/skiko-platform/src/jvmMain/kotlin/org/jetbrains/skiko/Setup.kt Outdated
Comment thread samples/SkiaAwtSample/build.gradle.kts

@igordmn Igor Demin (igordmn) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found new issues with AI help. Some are not trivial, but they might cause Major/Critical regressions, so it is better to check.

@@ -115,9 +115,8 @@ + (instancetype)sharedCache {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains MetalOffscreenContext related functions. We should either move them back to the core library, where the Kotlin class lives, or move the Kotlin class to the skiko-platform (probably we should do this, as we did with DirectXOffscreenContext).

The same for OpenGLOffscreenContext.

#include <dxgi1_6.h>

// Set in JNI_OnLoad (jvmMain/cpp/common/impl/Library.cc).
extern "C" JavaVM *jvm;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After moving this into a new dll, all extern variables may stop working. Can you check this?

You can check it resizing a window on Windows with System.setProperty("skiko.rendering.windows.direct3DSynchronousLiveResize", "true")

If it crashes, we should find all moved extern's and fix it somehow.

Comment thread skiko/ci/build.gradle.kts
Comment on lines 39 to 40
skikoArtifacts.jvmAdditionalRuntimeArtifactIdFor("angle", OS.Windows, Arch.X64),
skikoArtifacts.jvmAdditionalRuntimeArtifactIdFor("angle", OS.Windows, Arch.Arm64),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skikoArtifacts.jvmAdditionalRuntimeArtifactIdFor("angle", OS.Windows, Arch.X64),

They seem no longer exist? If so, we should remove these lines

val commonMain by getting {
dependencies {
implementation(libs.skiko)
implementation(libs.skiko.platform)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we need to add it to benchmarks too. Desktop compilation may fail because it imports DirectXOffscreenContext

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test uses Library.load(), we should probably replace it by PlatformLibrary.load()

val coreProject = project(":")

val platformDependencies: SkikoDependencyScope.() -> Unit = {
dependsOnCore()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a hypothetical issue for an important Desktop use-case (it might exists in real plugins right now). Not sure if it is real, but worth to check (see an old IntelliJ plugin example)

IntelliJ plugin A uses Skiko 0.100.0
IntelliJ plugin B uses Skiko 0.102.0

skiko-platform 0.100.0, directXRenderer.cc calls throwJavaRenderExceptionByExceptionCode, which is inside skiko 0.100.0

skiko-platform 0.102.0, directXRenderer.cc calls renamed throwJavaRenderExceptionByException, which is inside skiko 0.102.0

But skiko-platform 0.102.0 is linked against a name skiko-windows-x64, and if we have an old Skiko already loaded, it might be linked against 0.100.0 and we have a crash.

We have a fix for it for System.load, but it probably doesn't work for build-time linking

implementation("org.jetbrains.runtime:jbr-api:1.5.0")
if (System.getProperty("os.name").startsWith("Win")) {
implementation("org.jetbrains.skiko:skiko-awt-runtime-angle-$target:$version")
implementation("org.jetbrains.skiko:skiko-platform-awt-runtime-angle-$target:$version")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the doc for val renderingAngleEnabled: Boolean


private val platformLoader = LibraryLoader(
name = "skiko-platform-$hostId",
init = { Setup.init() },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
init = { Setup.init() },
init = { Setup.init() },
cls = PlatformLibrary::class.java,

should we pass it and use here?

    private fun getModuleResourceAsStream(resourceName: String) =
        Library::class.java.classLoader.getResourceAsStream(resourceName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We move classes into another module, but don't change its package to org.jetbrains.skiko.platform, so both modules use name org.jetbrains.skiko.

For compatibility reasons, I would keep it this way, but can it cause issues with JPMS? Can it cause issues with planned work in #1323 (comment)?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants