Skip to content

Commit d0cfd0c

Browse files
committed
up
1 parent 3230b68 commit d0cfd0c

File tree

10 files changed

+32
-66
lines changed

10 files changed

+32
-66
lines changed

.idea/modules/vkk.main.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/vkk.test.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/vkk/identifiers/Device.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ class UniqueDevice(handle: Ptr, physicalDevice: PhysicalDevice, ci: DeviceCreate
2424
Device(handle, physicalDevice, ci, apiVersion) {
2525

2626
init {
27+
val address = adr
28+
val function = capabilities.vkDestroyDevice
2729
vk.cleaner.register(this) {
28-
destroy()
30+
callPPV(address, NULL, function)
2931
println("device gc'ed")
3032
}
3133
}

src/main/kotlin/vkk/identifiers/Instance.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ import vkk._11.structs.PhysicalDeviceGroupProperties
1919
import vkk.extensions.Instance_KHR_surface
2020
import java.util.*
2121

22-
class UniqueInstance internal constructor(createInfo: InstanceCreateInfo) : Instance(createInfo), VkCleanable
22+
class UniqueInstance(createInfo: InstanceCreateInfo) : Instance(createInfo) {
23+
init {
24+
// break object reference
25+
val address = adr
26+
val function = capabilities.vkDestroyInstance
27+
vk.cleaner.register(this) {
28+
callPPV(address, NULL, function)
29+
println("instance gc'ed")
30+
}
31+
}
32+
}
2333

2434
/** Wraps a Vulkan instance handle. */
2535
open class Instance

0 commit comments

Comments
 (0)