vulkan-kotlin
1.4.350-1indexedVulkan API bindings adding type safety, RAII-based resource management, exception handling and ecosystem integration; streamlines instance creation, error handling and graphics resource lifetime.
Vulkan API bindings adding type safety, RAII-based resource management, exception handling and ecosystem integration; streamlines instance creation, error handling and graphics resource lifetime.
Kotlin Multiplatform bindings for Vulkan API, which add features like type safety, RAII, exceptions and integration with the Kotlin ecosystem.
Add entries to the version catalog:
[versions]
vulkan-kotlin = "1.4.350-1"
[libraries]
vulkan-kotlin = { module = "io.technoirlab.vulkan:vulkan-kotlin", version.ref = "vulkan-kotlin" }
Add vulkan-kotlin dependency to a Kotlin Multiplatform project:
kotlin {
sourceSets.commonMain {
dependencies {
implementation(libs.vulkan.kotlin)
}
}
}
Load Vulkan API and create an instance:
val vulkan = Vulkan()
val instance = vulkan.createInstance()
For more information, please see the API reference and the sample project.
On Android, add the following as a direct child of the <manifest> element in AndroidManifest.xml:
<uses-feature
android:name="android.hardware.vulkan.version"
android:version="0x00404000"
android:required="true" />
Kotlin wrappers use assertions to check for invalid API usage. By default, assertions are disabled and get stripped by the Kotlin compiler. To enable assertions for debug binaries, add the following to the application module:
kotlin {
targets.withType<KotlinNativeTarget>().configureEach {
binaries.configureEach {
if (buildType == NativeBuildType.DEBUG) {
freeCompilerArgs += "-ea"
}
}
}
}
Surfaced from shared tags and platforms — no rankings paid for.