From cd7ea5f0ac49d9f35b0c1ecab9873ecb4bab0c38 Mon Sep 17 00:00:00 2001 From: ygdrasil-io Date: Mon, 4 Mar 2024 01:41:54 +0100 Subject: [PATCH] Update wgpu bindings with shader and pipeline layout creation Implemented createShaderModule and createPipelineLayout functions in Device.jvm and Device.js classes under wgpu module. These updates will enhance rendering functionalities by enabling creation of shader modules and pipeline layouts. Mappings for these new functions were also added in ShaderModuleDescriptor for consistency across different platforms. --- .../SimpleTriangleScene.kt | 10 +- .../wgpu/examples/src/jvmMain/kotlin/main.kt | 4 +- .../kotlin/io.ygdrasil.wgpu/Device.kt | 9 +- .../kotlin/io.ygdrasil.wgpu/Pipeline.kt | 30 +++ .../jsMain/kotlin/io.ygdrasil.wgpu/Device.kt | 52 ++++- .../kotlin/io.ygdrasil.wgpu/Pipeline.js.kt | 7 + .../io.ygdrasil.wgpu/RenderingContext.kt | 2 +- .../io.ygdrasil.wgpu/internal.js/lib.dom.kt | 120 ---------- .../internal.js/lib.es5.Intl.module_dukat.kt | 208 ------------------ .../io.ygdrasil.wgpu/internal.js/lib.es5.kt | 178 --------------- .../internal.js/webgpu_types.kt | 2 +- .../kotlin/io.ygdrasil.wgpu/Device.jvm.kt | 27 ++- .../kotlin/io.ygdrasil.wgpu/Pipeline.jvm.kt | 7 + .../io.ygdrasil.wgpu/ShaderModule.jvm.kt | 6 +- .../internal/jvm/Structures.kt | 2 +- 15 files changed, 130 insertions(+), 534 deletions(-) create mode 100644 bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Pipeline.kt create mode 100644 bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Pipeline.js.kt delete mode 100644 bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.Intl.module_dukat.kt create mode 100644 bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Pipeline.jvm.kt diff --git a/bindings/wgpu/examples/src/commonMain/kotlin/io.ygdrasil.wgpu.examples/SimpleTriangleScene.kt b/bindings/wgpu/examples/src/commonMain/kotlin/io.ygdrasil.wgpu.examples/SimpleTriangleScene.kt index c6111349..f1e331c8 100644 --- a/bindings/wgpu/examples/src/commonMain/kotlin/io.ygdrasil.wgpu.examples/SimpleTriangleScene.kt +++ b/bindings/wgpu/examples/src/commonMain/kotlin/io.ygdrasil.wgpu.examples/SimpleTriangleScene.kt @@ -1,5 +1,7 @@ package io.ygdrasil.wgpu.examples +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor import io.ygdrasil.wgpu.ShaderModuleDescriptor class SimpleTriangleScene : Application.Scene() { @@ -10,7 +12,13 @@ class SimpleTriangleScene : Application.Scene() { ) ) - val pipeline = device.createPipelineLayout() + val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor()) + + val renderPipeline = device.createRenderPipeline( + RenderPipelineDescriptor().apply { + layout = pipelineLayout + } + ) TODO("Not yet implemented") } diff --git a/bindings/wgpu/examples/src/jvmMain/kotlin/main.kt b/bindings/wgpu/examples/src/jvmMain/kotlin/main.kt index 1731b59d..1e21074a 100644 --- a/bindings/wgpu/examples/src/jvmMain/kotlin/main.kt +++ b/bindings/wgpu/examples/src/jvmMain/kotlin/main.kt @@ -5,10 +5,8 @@ import io.ygdrasil.wgpu.internal.jvm.wgpuGetVersion import kotlinx.coroutines.runBlocking fun main() { - printVersion() initSDL() - runBlocking { jvmApplication() } @@ -26,4 +24,4 @@ fun printVersion() { SDL_GetVersion(this) println("SDL version $major.$minor.$patch") } -} +} \ No newline at end of file diff --git a/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Device.kt b/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Device.kt index ed02ac60..5f1c62a2 100644 --- a/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Device.kt +++ b/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Device.kt @@ -3,10 +3,15 @@ package io.ygdrasil.wgpu @OptIn(ExperimentalStdlibApi::class) expect class Device: AutoCloseable { + val queue: Queue + fun createCommandEncoder(descriptor: CommandEncoderDescriptor? = null): CommandEncoder - fun createShaderModule(descriptor: ShaderModuleDescriptor) - fun createPipelineLayout(): Any + fun createShaderModule(descriptor: ShaderModuleDescriptor): ShaderModule + + fun createPipelineLayout(descriptor: PipelineLayoutDescriptor): PipelineLayout + + fun createRenderPipeline(descriptor: RenderPipelineDescriptor): RenderPipeline } // TODO diff --git a/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Pipeline.kt b/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Pipeline.kt new file mode 100644 index 00000000..928cb9ec --- /dev/null +++ b/bindings/wgpu/wgpu4k/src/commonMain/kotlin/io.ygdrasil.wgpu/Pipeline.kt @@ -0,0 +1,30 @@ +package io.ygdrasil.wgpu + +expect class PipelineLayout + +expect class RenderPipeline + +class PipelineLayoutDescriptor +data class RenderPipelineDescriptor( + var fragment: FragmentState? = null, + var layout: PipelineLayout? = null +) { + data class FragmentState( + var module: ShaderModule, + var targets: Array = arrayOf(), + var entryPoint: String? = null + ) { + + class ColorTargetState( + /* + var format: String /* "r8unorm" | "r8snorm" | "r8uint" | "r8sint" | "r16uint" | "r16sint" | "r16float" | "rg8unorm" | "rg8snorm" | "rg8uint" | "rg8sint" | "r32uint" | "r32sint" | "r32float" | "rg16uint" | "rg16sint" | "rg16float" | "rgba8unorm" | "rgba8unorm-srgb" | "rgba8snorm" | "rgba8uint" | "rgba8sint" | "bgra8unorm" | "bgra8unorm-srgb" | "rgb9e5ufloat" | "rgb10a2uint" | "rgb10a2unorm" | "rg11b10ufloat" | "rg32uint" | "rg32sint" | "rg32float" | "rgba16uint" | "rgba16sint" | "rgba16float" | "rgba32uint" | "rgba32sint" | "rgba32float" | "stencil8" | "depth16unorm" | "depth24plus" | "depth24plus-stencil8" | "depth32float" | "depth32float-stencil8" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-unorm" | "bc4-r-snorm" | "bc5-rg-unorm" | "bc5-rg-snorm" | "bc6h-rgb-ufloat" | "bc6h-rgb-float" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "eac-r11unorm" | "eac-r11snorm" | "eac-rg11unorm" | "eac-rg11snorm" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb" */ + var blend: GPUBlendState? + get() = definedExternally + set(value) = definedExternally + var writeMask: GPUColorWriteFlags? + get() = definedExternally + set(value) = definedExternally + */ + ) + } +} diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Device.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Device.kt index 1b562271..66e92d86 100644 --- a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Device.kt +++ b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Device.kt @@ -2,13 +2,11 @@ package io.ygdrasil.wgpu -import io.ygdrasil.wgpu.internal.js.GPUCommandEncoderDescriptor -import io.ygdrasil.wgpu.internal.js.GPUDevice +import io.ygdrasil.wgpu.internal.js.* -actual class Device(val handler: GPUDevice): AutoCloseable { - - val queue: Queue by lazy { Queue(handler.queue) } +actual class Device(val handler: GPUDevice) : AutoCloseable { + actual val queue: Queue by lazy { Queue(handler.queue) } actual fun createCommandEncoder(descriptor: CommandEncoderDescriptor?): CommandEncoder { return CommandEncoder( @@ -24,18 +22,52 @@ actual class Device(val handler: GPUDevice): AutoCloseable { return ShaderModule(handler.createShaderModule(descriptor.convert())) } - actual fun createPipelineLayout(): Any { - handler.createPipelineLayout( + actual fun createPipelineLayout(descriptor: PipelineLayoutDescriptor): PipelineLayout = handler + .createPipelineLayout(descriptor.convert()) + .let(::PipelineLayout) + + actual fun createRenderPipeline(descriptor: RenderPipelineDescriptor): RenderPipeline = handler + .createRenderPipeline(descriptor.convert()) + .let(::RenderPipeline) - ) - } override fun close() { // Nothing on JS } } -private fun CommandEncoderDescriptor.convert(): GPUCommandEncoderDescriptor = object : GPUCommandEncoderDescriptor { +private fun RenderPipelineDescriptor.convert(): GPURenderPipelineDescriptor = object : GPURenderPipelineDescriptor { + + override var vertex: GPUVertexState = TODO("Not yet implemented") + override var primitive: GPUPrimitiveState? = TODO("Not yet implemented") + override var depthStencil: GPUDepthStencilState? = TODO("Not yet implemented") + override var multisample: GPUMultisampleState? = TODO("Not yet implemented") + override var fragment: GPUFragmentState? = this@convert.fragment?.convert() ?: undefined + override var layout: dynamic = this@convert.layout ?: "auto" +} + +private fun RenderPipelineDescriptor.FragmentState.convert(): GPUFragmentState = object : GPUFragmentState { + override var targets: Array = this@convert.targets.map { it?.convert() }.toTypedArray() + override var module: GPUShaderModule = this@convert.module.handler + override var entryPoint: String? = this@convert.entryPoint ?: undefined + // TODO not sure how to map this + //override var constants: Record? = TODO("Not yet implemented") +} + +private fun RenderPipelineDescriptor.FragmentState.ColorTargetState.convert(): GPUColorTargetState = + object : GPUColorTargetState { + override var format: String = TODO("Not yet implemented") + override var blend: GPUBlendState? = TODO("Not yet implemented") + override var writeMask: GPUColorWriteFlags? = TODO("Not yet implemented") + } + +private fun PipelineLayoutDescriptor.convert(): GPUPipelineLayoutDescriptor = object : GPUPipelineLayoutDescriptor { + override var label: String? = TODO("Not yet implemented") + override var bindGroupLayouts: Iterable = TODO("Not yet implemented") +} + +private fun CommandEncoderDescriptor.convert(): GPUCommandEncoderDescriptor = object : GPUCommandEncoderDescriptor { + //TODO } diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Pipeline.js.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Pipeline.js.kt new file mode 100644 index 00000000..9495ffd9 --- /dev/null +++ b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/Pipeline.js.kt @@ -0,0 +1,7 @@ +package io.ygdrasil.wgpu + +import io.ygdrasil.wgpu.internal.js.GPUPipelineLayout +import io.ygdrasil.wgpu.internal.js.GPURenderPipeline + +actual class PipelineLayout(internal var handler: GPUPipelineLayout) +actual class RenderPipeline(internal var handler: GPURenderPipeline) \ No newline at end of file diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/RenderingContext.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/RenderingContext.kt index b4ba4768..206a4e61 100644 --- a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/RenderingContext.kt +++ b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/RenderingContext.kt @@ -17,7 +17,7 @@ actual class RenderingContext(private val handler: GPUCanvasContext) : AutoClose } actual fun present() { - // Nothing to do + // Nothing to do on js } fun configure(canvasConfiguration: CanvasConfiguration) { diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.dom.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.dom.kt index 67694225..83a24fa5 100644 --- a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.dom.kt +++ b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.dom.kt @@ -371,24 +371,6 @@ external interface DoubleRange { set(value) = definedExternally } -external interface EcKeyGenParams : Algorithm { - var namedCurve: NamedCurve -} - -external interface EcKeyImportParams : Algorithm { - var namedCurve: NamedCurve -} - -external interface EcdhKeyDeriveParams : Algorithm { - var public: CryptoKey -} - -external interface EcdsaParams : Algorithm { - var hash: dynamic /* typealias HashAlgorithmIdentifier = dynamic */ - get() = definedExternally - set(value) = definedExternally -} - external interface EffectTiming { var delay: Number? get() = definedExternally @@ -2454,11 +2436,6 @@ external interface CredentialsContainer { fun store(credential: Credential): Promise } -external interface Crypto { - var subtle: SubtleCrypto - fun getRandomValues(array: T): T -} - external interface CryptoKey { var algorithm: KeyAlgorithm var extractable: Boolean @@ -2466,11 +2443,6 @@ external interface CryptoKey { var usages: Array } -external interface CryptoKeyPair { - var privateKey: CryptoKey - var publicKey: CryptoKey -} - external interface CustomEvent__0 : CustomEvent external interface DOMException { @@ -5665,98 +5637,6 @@ external interface StyleSheetList { operator fun set(index: Number, value: CSSStyleSheet) } -external interface SubtleCrypto { - fun decrypt(algorithm: String, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: Algorithm, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: RsaOaepParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: AesCtrParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: AesCbcParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: AesCmacParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: AesGcmParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun decrypt(algorithm: AesCfbParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun deriveBits(algorithm: String, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveBits(algorithm: DhKeyDeriveParams, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveBits(algorithm: ConcatParams, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveBits(algorithm: HkdfCtrParams, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveBits(algorithm: Pbkdf2Params, baseKey: CryptoKey, length: Number): PromiseLike - fun deriveKey(algorithm: String, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun deriveKey(algorithm: Algorithm, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun deriveKey(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun deriveKey(algorithm: DhKeyDeriveParams, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun deriveKey(algorithm: ConcatParams, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun deriveKey(algorithm: HkdfCtrParams, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun deriveKey(algorithm: Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: Any /* String | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params */, extractable: Boolean, keyUsages: Array): PromiseLike - fun digest(algorithm: String, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun digest(algorithm: Algorithm, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: String, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: Algorithm, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: RsaOaepParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: AesCtrParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: AesCbcParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: AesCmacParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: AesGcmParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun encrypt(algorithm: AesCfbParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun exportKey(format: String /* "jwk" | "raw" | "pkcs8" | "spki" */, key: CryptoKey): dynamic /* PromiseLike */ - fun generateKey(algorithm: String, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: Algorithm, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: RsaHashedKeyGenParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: EcKeyGenParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: DhKeyGenParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: AesKeyGenParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: HmacKeyGenParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun generateKey(algorithm: Pbkdf2Params, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: String, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: Algorithm, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: RsaHashedImportParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: EcKeyImportParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: HmacImportParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: DhImportKeyParams, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "jwk" */, keyData: JsonWebKey, algorithm: AesKeyAlgorithm, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Int8Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Int16Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Int32Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Uint8Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Uint16Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Uint32Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Uint8ClampedArray, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Float32Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: Float64Array, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: DataView, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String /* "raw" | "pkcs8" | "spki" */, keyData: ArrayBuffer, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun importKey(format: String, keyData: JsonWebKey, algorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun sign(algorithm: String, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun sign(algorithm: Algorithm, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun sign(algorithm: RsaPssParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun sign(algorithm: EcdsaParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun sign(algorithm: AesCmacParams, key: CryptoKey, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Int8Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Int16Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Int32Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Uint8Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Uint16Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Uint32Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Uint8ClampedArray, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Float32Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: Float64Array, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: DataView, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun unwrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, wrappedKey: ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: Any /* String | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams */, unwrappedKeyAlgorithm: Any /* String | Algorithm | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm */, extractable: Boolean, keyUsages: Array): PromiseLike - fun verify(algorithm: String, key: CryptoKey, signature: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun verify(algorithm: Algorithm, key: CryptoKey, signature: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun verify(algorithm: RsaPssParams, key: CryptoKey, signature: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun verify(algorithm: EcdsaParams, key: CryptoKey, signature: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun verify(algorithm: AesCmacParams, key: CryptoKey, signature: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */, data: Any /* Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer */): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: String): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: Algorithm): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: RsaOaepParams): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AesCtrParams): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AesCbcParams): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AesCmacParams): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AesGcmParams): PromiseLike - fun wrapKey(format: String /* "raw" | "pkcs8" | "spki" | "jwk" | String */, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AesCfbParams): PromiseLike -} - external interface SyncManager { fun getTags(): Promise> fun register(tag: String): Promise diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.Intl.module_dukat.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.Intl.module_dukat.kt deleted file mode 100644 index 2e1ac3b3..00000000 --- a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.Intl.module_dukat.kt +++ /dev/null @@ -1,208 +0,0 @@ -@file:JsQualifier("tsstdlib.Intl") -@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS") -package io.ygdrasil.wgpu.internal.js - -import kotlin.js.Date - -external interface CollatorOptions { - var usage: String? - get() = definedExternally - set(value) = definedExternally - var localeMatcher: String? - get() = definedExternally - set(value) = definedExternally - var numeric: Boolean? - get() = definedExternally - set(value) = definedExternally - var caseFirst: String? - get() = definedExternally - set(value) = definedExternally - var sensitivity: String? - get() = definedExternally - set(value) = definedExternally - var ignorePunctuation: Boolean? - get() = definedExternally - set(value) = definedExternally -} - -external interface ResolvedCollatorOptions { - var locale: String - var usage: String - var sensitivity: String - var ignorePunctuation: Boolean - var collation: String - var caseFirst: String - var numeric: Boolean -} - -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -external interface Collator { - fun compare(x: String, y: String): Number - fun resolvedOptions(): ResolvedCollatorOptions - - companion object { - @nativeInvoke - operator fun invoke(locales: Any /* String | Array */ = definedExternally, options: CollatorOptions = definedExternally): Collator - fun supportedLocalesOf(locales: Any /* String | Array */, options: CollatorOptions = definedExternally): Array - } -} - -external interface NumberFormatOptions { - var localeMatcher: String? - get() = definedExternally - set(value) = definedExternally - var style: String? - get() = definedExternally - set(value) = definedExternally - var currency: String? - get() = definedExternally - set(value) = definedExternally - var currencyDisplay: String? - get() = definedExternally - set(value) = definedExternally - var useGrouping: Boolean? - get() = definedExternally - set(value) = definedExternally - var minimumIntegerDigits: Number? - get() = definedExternally - set(value) = definedExternally - var minimumFractionDigits: Number? - get() = definedExternally - set(value) = definedExternally - var maximumFractionDigits: Number? - get() = definedExternally - set(value) = definedExternally - var minimumSignificantDigits: Number? - get() = definedExternally - set(value) = definedExternally - var maximumSignificantDigits: Number? - get() = definedExternally - set(value) = definedExternally -} - -external interface ResolvedNumberFormatOptions { - var locale: String - var numberingSystem: String - var style: String - var currency: String? - get() = definedExternally - set(value) = definedExternally - var currencyDisplay: String? - get() = definedExternally - set(value) = definedExternally - var minimumIntegerDigits: Number - var minimumFractionDigits: Number - var maximumFractionDigits: Number - var minimumSignificantDigits: Number? - get() = definedExternally - set(value) = definedExternally - var maximumSignificantDigits: Number? - get() = definedExternally - set(value) = definedExternally - var useGrouping: Boolean -} - -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -external interface NumberFormat { - fun format(value: Number): String - fun resolvedOptions(): ResolvedNumberFormatOptions - - companion object { - @nativeInvoke - operator fun invoke(locales: Any /* String | Array */ = definedExternally, options: NumberFormatOptions = definedExternally): NumberFormat - fun supportedLocalesOf(locales: Any /* String | Array */, options: NumberFormatOptions = definedExternally): Array - } -} - -external interface DateTimeFormatOptions { - var localeMatcher: String? - get() = definedExternally - set(value) = definedExternally - var weekday: String? - get() = definedExternally - set(value) = definedExternally - var era: String? - get() = definedExternally - set(value) = definedExternally - var year: String? - get() = definedExternally - set(value) = definedExternally - var month: String? - get() = definedExternally - set(value) = definedExternally - var day: String? - get() = definedExternally - set(value) = definedExternally - var hour: String? - get() = definedExternally - set(value) = definedExternally - var minute: String? - get() = definedExternally - set(value) = definedExternally - var second: String? - get() = definedExternally - set(value) = definedExternally - var timeZoneName: String? - get() = definedExternally - set(value) = definedExternally - var formatMatcher: String? - get() = definedExternally - set(value) = definedExternally - var hour12: Boolean? - get() = definedExternally - set(value) = definedExternally - var timeZone: String? - get() = definedExternally - set(value) = definedExternally -} - -external interface ResolvedDateTimeFormatOptions { - var locale: String - var calendar: String - var numberingSystem: String - var timeZone: String - var hour12: Boolean? - get() = definedExternally - set(value) = definedExternally - var weekday: String? - get() = definedExternally - set(value) = definedExternally - var era: String? - get() = definedExternally - set(value) = definedExternally - var year: String? - get() = definedExternally - set(value) = definedExternally - var month: String? - get() = definedExternally - set(value) = definedExternally - var day: String? - get() = definedExternally - set(value) = definedExternally - var hour: String? - get() = definedExternally - set(value) = definedExternally - var minute: String? - get() = definedExternally - set(value) = definedExternally - var second: String? - get() = definedExternally - set(value) = definedExternally - var timeZoneName: String? - get() = definedExternally - set(value) = definedExternally -} - -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -external interface DateTimeFormat { - fun format(date: Date = definedExternally): String - fun format(): String - fun format(date: Number = definedExternally): String - fun resolvedOptions(): ResolvedDateTimeFormatOptions - - companion object { - @nativeInvoke - operator fun invoke(locales: Any /* String | Array */ = definedExternally, options: DateTimeFormatOptions = definedExternally): DateTimeFormat - fun supportedLocalesOf(locales: Any /* String | Array */, options: DateTimeFormatOptions = definedExternally): Array - } -} \ No newline at end of file diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.kt index 31172b52..5b6ade0b 100644 --- a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.kt +++ b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/lib.es5.kt @@ -1,189 +1,11 @@ @file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS") package io.ygdrasil.wgpu.internal.js -import org.khronos.webgl.* -import kotlin.js.Date - -external interface FunctionConstructor { - @nativeInvoke - operator fun invoke(vararg args: String): Function<*> - var prototype: Function<*> -} - -external interface DateConstructor { - @nativeInvoke - operator fun invoke(): String - var prototype: Date - fun parse(s: String): Number - fun UTC(year: Number, month: Number, date: Number = definedExternally, hours: Number = definedExternally, minutes: Number = definedExternally, seconds: Number = definedExternally, ms: Number = definedExternally): Number - fun now(): Number -} - -external interface ErrorConstructor { - @nativeInvoke - operator fun invoke(message: String = definedExternally): Error - var prototype: Error -} - -external interface ConcatArray { - var length: Number - @nativeGetter - operator fun get(n: Number): T? - @nativeSetter - operator fun set(n: Number, value: T) - fun join(separator: String = definedExternally): String - fun slice(start: Number = definedExternally, end: Number = definedExternally): Array -} - -external interface ArrayConstructor { - fun from(iterable: Iterable): Array - fun from(iterable: ArrayLike): Array - fun from(iterable: Iterable, mapfn: (v: T, k: Number) -> U, thisArg: Any = definedExternally): Array - fun from(iterable: Iterable, mapfn: (v: T, k: Number) -> U): Array - fun from(iterable: ArrayLike, mapfn: (v: T, k: Number) -> U, thisArg: Any = definedExternally): Array - fun from(iterable: ArrayLike, mapfn: (v: T, k: Number) -> U): Array - fun of(vararg items: T): Array - @nativeInvoke - operator fun invoke(arrayLength: Number = definedExternally): Array - @nativeInvoke - operator fun invoke(): Array - @nativeInvoke - operator fun invoke(arrayLength: Number): Array - @nativeInvoke - operator fun invoke(vararg items: T): Array - fun isArray(arg: Any): Boolean - var prototype: Array -} - external interface PromiseLike { fun then(onfulfilled: ((value: T) -> Any?)? = definedExternally, onrejected: ((reason: Any) -> Any?)? = definedExternally): PromiseLike } -external interface ArrayLike { - var length: Number - @nativeGetter - operator fun get(n: Number): T? - @nativeSetter - operator fun set(n: Number, value: T) -} - typealias Record = Any -external interface ArrayBufferTypes { - var ArrayBuffer: ArrayBuffer -} - -external interface ArrayBufferConstructor { - var prototype: ArrayBuffer - fun isView(arg: Any): Boolean -} - -external interface DataViewConstructor - -external interface Int8ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Int8Array - fun from(arrayLike: Iterable): Int8Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Int8Array - var prototype: Int8Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Int8Array - fun from(arrayLike: ArrayLike): Int8Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Int8Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Int8Array -} - -external interface Uint8ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Uint8Array - fun from(arrayLike: Iterable): Uint8Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Uint8Array - var prototype: Uint8Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Uint8Array - fun from(arrayLike: ArrayLike): Uint8Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Uint8Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Uint8Array -} - -external interface Uint8ClampedArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Uint8ClampedArray - fun from(arrayLike: Iterable): Uint8ClampedArray - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Uint8ClampedArray - var prototype: Uint8ClampedArray - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Uint8ClampedArray - fun from(arrayLike: ArrayLike): Uint8ClampedArray - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Uint8ClampedArray - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Uint8ClampedArray -} - -external interface Int16ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Int16Array - fun from(arrayLike: Iterable): Int16Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Int16Array - var prototype: Int16Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Int16Array - fun from(arrayLike: ArrayLike): Int16Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Int16Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Int16Array -} - -external interface Uint16ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Uint16Array - fun from(arrayLike: Iterable): Uint16Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Uint16Array - var prototype: Uint16Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Uint16Array - fun from(arrayLike: ArrayLike): Uint16Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Uint16Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Uint16Array -} - -external interface Int32ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Int32Array - fun from(arrayLike: Iterable): Int32Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Int32Array - var prototype: Int32Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Int32Array - fun from(arrayLike: ArrayLike): Int32Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Int32Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Int32Array -} - -external interface Uint32ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Uint32Array - fun from(arrayLike: Iterable): Uint32Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Uint32Array - var prototype: Uint32Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Uint32Array - fun from(arrayLike: ArrayLike): Uint32Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Uint32Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Uint32Array -} -external interface Float32ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Float32Array - fun from(arrayLike: Iterable): Float32Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Float32Array - var prototype: Float32Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Float32Array - fun from(arrayLike: ArrayLike): Float32Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Float32Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Float32Array -} -external interface Float64ArrayConstructor { - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally, thisArg: Any = definedExternally): Float64Array - fun from(arrayLike: Iterable): Float64Array - fun from(arrayLike: Iterable, mapfn: (v: Number, k: Number) -> Number = definedExternally): Float64Array - var prototype: Float64Array - var BYTES_PER_ELEMENT: Number - fun of(vararg items: Number): Float64Array - fun from(arrayLike: ArrayLike): Float64Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number, thisArg: Any = definedExternally): Float64Array - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Number) -> Number): Float64Array -} \ No newline at end of file diff --git a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/webgpu_types.kt b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/webgpu_types.kt index 61e986bd..a072309e 100644 --- a/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/webgpu_types.kt +++ b/bindings/wgpu/wgpu4k/src/jsMain/kotlin/io.ygdrasil.wgpu/internal.js/webgpu_types.kt @@ -258,7 +258,7 @@ external interface GPUExternalTextureDescriptor : GPUObjectDescriptorBase { } external interface GPUFragmentState : GPUProgrammableStage { - var targets: Iterable + var targets: Array } external interface GPUImageCopyBuffer : GPUImageDataLayout { diff --git a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Device.jvm.kt b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Device.jvm.kt index e15b9c05..c3a9551d 100644 --- a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Device.jvm.kt +++ b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Device.jvm.kt @@ -4,7 +4,7 @@ import io.ygdrasil.wgpu.internal.jvm.* actual class Device(internal val handler: WGPUDeviceImpl) : AutoCloseable { - val queue: Queue by lazy { Queue(wgpuDeviceGetQueue(handler) ?: error("fail to get device queue")) } + actual val queue: Queue by lazy { Queue(wgpuDeviceGetQueue(handler) ?: error("fail to get device queue")) } actual fun createCommandEncoder(descriptor: CommandEncoderDescriptor?): CommandEncoder { return CommandEncoder( @@ -13,12 +13,18 @@ actual class Device(internal val handler: WGPUDeviceImpl) : AutoCloseable { ) } - actual fun createShaderModule(descriptor: ShaderModuleDescriptor): ShaderModule { - return ShaderModule( - wgpuDeviceCreateShaderModule(handler, descriptor.convert()) - ) - } + actual fun createShaderModule(descriptor: ShaderModuleDescriptor): ShaderModule = + wgpuDeviceCreateShaderModule(handler, descriptor.convert()) + ?.let(::ShaderModule) ?: error("fail to create pipeline layout") + + actual fun createPipelineLayout(descriptor: PipelineLayoutDescriptor): PipelineLayout = + wgpuDeviceCreatePipelineLayout(handler, descriptor.convert()) + ?.let(::PipelineLayout) ?: error("fail to create pipeline layout") + + actual fun createRenderPipeline(descriptor: RenderPipelineDescriptor): RenderPipeline = + wgpuDeviceCreateRenderPipeline(handler, descriptor.convert()) + ?.let(::RenderPipeline) ?: error("fail to create pipeline layout") override fun close() { wgpuDeviceRelease(handler) @@ -26,6 +32,15 @@ actual class Device(internal val handler: WGPUDeviceImpl) : AutoCloseable { } +private fun RenderPipelineDescriptor.convert(): WGPURenderPipelineDescriptor { + TODO("Not yet implemented") + +} + +private fun PipelineLayoutDescriptor.convert(): WGPUPipelineLayoutDescriptor { + TODO("Not yet implemented") +} + private fun CommandEncoderDescriptor.convert(): WGPUCommandEncoderDescriptor = WGPUCommandEncoderDescriptor().also { it.label = label } diff --git a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Pipeline.jvm.kt b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Pipeline.jvm.kt new file mode 100644 index 00000000..55ac6c7c --- /dev/null +++ b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/Pipeline.jvm.kt @@ -0,0 +1,7 @@ +package io.ygdrasil.wgpu + +import io.ygdrasil.wgpu.internal.jvm.WGPUPipelineLayout +import io.ygdrasil.wgpu.internal.jvm.WGPURenderPipeline + +actual class PipelineLayout(internal val handler: WGPUPipelineLayout) +actual class RenderPipeline(internal val handler: WGPURenderPipeline) \ No newline at end of file diff --git a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/ShaderModule.jvm.kt b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/ShaderModule.jvm.kt index 89dbb2d0..bd3eae80 100644 --- a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/ShaderModule.jvm.kt +++ b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/ShaderModule.jvm.kt @@ -3,7 +3,7 @@ package io.ygdrasil.wgpu import com.sun.jna.NativeLong import io.ygdrasil.wgpu.internal.jvm.* -actual class ShaderModule(internal val handler: WGPUShaderModule?) : AutoCloseable { +actual class ShaderModule(internal val handler: WGPUShaderModule) : AutoCloseable { override fun close() { wgpuShaderModuleRelease(handler) } @@ -18,8 +18,8 @@ internal fun ShaderModuleDescriptor.convert(): WGPUShaderModuleDescriptor = WGPU sType = WGPUSType.WGPUSType_ShaderModuleWGSLDescriptor.value } } - it.hintCount = NativeLong(compilationHints.size) - it.hints = compilationHints.map { it.convert() } + it.hintCount = compilationHints?.let { NativeLong(it.size.toLong()) } ?: NativeLong(0) + it.hints = compilationHints?.map { it.convert() }?.toTypedArray() } diff --git a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/internal/jvm/Structures.kt b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/internal/jvm/Structures.kt index 2866f3f3..6f98895c 100644 --- a/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/internal/jvm/Structures.kt +++ b/bindings/wgpu/wgpu4k/src/jvmMain/kotlin/io.ygdrasil.wgpu/internal/jvm/Structures.kt @@ -3040,7 +3040,7 @@ public open class WGPUShaderModuleDescriptor : Structure { * Declared([a8(nextInChain):[*:b1]a8(entryPoint):[*:b1]a8(layout):[*:b1]](WGPUShaderModuleCompilationHint)))* */ @JvmField - public var hints: Pointer? = null + public var hints: Array? = null public constructor(pointer: Pointer?) : super(pointer)