diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 009242484..b689e2dbe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,10 +26,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup Java JDK 21 + - name: Setup Java JDK 22 uses: actions/setup-java@v4.2.1 with: - java-version: 21 + java-version: 22 distribution: adopt - name: Grant gradlew execution permissions run: chmod +x gradlew diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 79ae666db..ef477049f 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup Java JDK 21 + - name: Setup Java JDK 22 uses: actions/setup-java@v4.2.1 with: - java-version: 21 + java-version: 22 distribution: adopt - name: Grant gradlew execution permissions run: chmod +x gradlew diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index a03f81b07..072272fb5 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -21,10 +21,10 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v2 - - name: Setup Java JDK 21 + - name: Setup Java JDK 22 uses: actions/setup-java@v4.2.1 with: - java-version: 21 + java-version: 22 distribution: adopt - name: Grant gradlew execution permissions run: chmod +x gradlew diff --git a/README.md b/README.md index e3de6a71e..acd3362e8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![build](https://github.com/littlektframework/littlekt/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/littlektframework/littlekt/actions/workflows/build.yml) [![Download](https://img.shields.io/maven-central/v/com.littlekt/core/0.10.1)](https://search.maven.org/artifact/com.littlekt/core/0.10.1/pom) -Requires JDK 21+ in order to use due to the usage of the new Java FFM API. +Requires JDK 22+ in order to use due to the usage of the new Java FFM API. **Currently, in development.** @@ -36,13 +36,13 @@ repositories { kotlin { jvm { compilations.all { - kotlinOptions.jvmTarget = "21" // littlekt targets jvm 21 so we must target at least 21 + kotlinOptions.jvmTarget = "22" // littlekt targets jvm 21 so we must target at least 21 } } } val littleKtVersion = "0.10.1" // get the latest release at the top -val kotlinCoroutinesVersion = "1.9.0-RC" // or whatever version you are using +val kotlinCoroutinesVersion = "1.9.0" // or whatever version you are using sourceSets { val commonMain by getting { diff --git a/build.gradle.kts b/build.gradle.kts index df49cb083..703347b51 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,10 +12,6 @@ plugins { val littleKtVersion: String by project allprojects { - repositories { - google() - mavenCentral() - } group = "com.littlekt" version = littleKtVersion extra["isReleaseVersion"] = !littleKtVersion.endsWith("SNAPSHOT") @@ -24,3 +20,11 @@ allprojects { plugins.withType { the().apply { yarnLockMismatchReport = YarnLockMismatchReport.WARNING } } + +// TODO: remove later +configurations.all { + resolutionStrategy { + cacheChangingModulesFor(0, "seconds") + cacheDynamicVersionsFor(0, "minutes") + } +} \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 1da745dbb..61d51164a 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType @@ -15,12 +17,11 @@ kotlin { env = System.getProperty("env") } systemProperty("env", env ?: "dev") - jvmArgs("--enable-preview") } jvm { - compilations.all { - kotlinOptions.jvmTarget = "11" - compileJavaTaskProvider?.get()?.options?.compilerArgs?.add("--enable-preview") + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + jvmTarget = JvmTarget.JVM_22 } } js(KotlinJsCompilerType.IR) { @@ -37,6 +38,7 @@ kotlin { sourceSets { val commonMain by getting { dependencies { + api(libs.wgpu4k) implementation(libs.kotlinx.atomicfu) implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.serialization.json) @@ -47,11 +49,13 @@ kotlin { //noinspection UseTomlInstead val jvmMain by getting { dependencies { - implementation(project(":wgpu-ffm")) - implementation(project(":wgpu-natives")) implementation(libs.mp3.decoder) + // Helper to create surface + implementation(libs.rococoa) + implementation(libs.jnaPlatform) + implementation(libs.lwjgl.core) implementation(libs.lwjgl.glfw) implementation(libs.lwjgl.openal) @@ -84,16 +88,18 @@ kotlin { all { languageSettings.apply { - progressiveMode = true optIn("kotlin.contracts.ExperimentalContracts") optIn("kotlin.time.ExperimentalTime") } } - targets.configureEach { - compilations.configureEach { - compilerOptions.configure { freeCompilerArgs.add("-Xexpect-actual-classes") } - } - } + } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + // Fix warning, then turn this on + allWarningsAsErrors = false + progressiveMode = true + freeCompilerArgs.add("-Xexpect-actual-classes") } } diff --git a/core/src/commonMain/kotlin/com/littlekt/ContextConfiguration.kt b/core/src/commonMain/kotlin/com/littlekt/ContextConfiguration.kt index b87f543cd..5ca2b8d5a 100644 --- a/core/src/commonMain/kotlin/com/littlekt/ContextConfiguration.kt +++ b/core/src/commonMain/kotlin/com/littlekt/ContextConfiguration.kt @@ -8,12 +8,3 @@ abstract class ContextConfiguration { abstract val title: String open val loadInternalResources: Boolean = true } - -/** When requesting an adapter, what is the preferred power usage. */ -enum class PowerPreference { - /** Lower power adapter. */ - LOW_POWER, - - /** High power adapter. */ - HIGH_POWER -} diff --git a/core/src/commonMain/kotlin/com/littlekt/Graphics.kt b/core/src/commonMain/kotlin/com/littlekt/Graphics.kt index 3971c0684..fca7449a2 100644 --- a/core/src/commonMain/kotlin/com/littlekt/Graphics.kt +++ b/core/src/commonMain/kotlin/com/littlekt/Graphics.kt @@ -2,7 +2,13 @@ package com.littlekt import com.littlekt.graphics.Cursor import com.littlekt.graphics.SystemCursor -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.Adapter +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.CompositeAlphaMode +import io.ygdrasil.wgpu.Surface /** * Contains graphic related properties and methods. @@ -36,18 +42,15 @@ interface Graphics { /** @return the preferred [TextureFormat] of the underlying [surface]. */ val preferredFormat: TextureFormat - /** @return the capability of the underlying [surface] */ - val surfaceCapabilities: SurfaceCapabilities - /** * Configures the underlying [surface], via [Surface.configure], which initializes the surface * for presentation. */ fun configureSurface( - usage: TextureUsage = TextureUsage.RENDER_ATTACHMENT, + usage: Set = setOf(TextureUsage.renderAttachment), format: TextureFormat = preferredFormat, - presentMode: PresentMode = PresentMode.FIFO, - alphaMode: AlphaMode = surfaceCapabilities.alphaModes[0] + presentMode: PresentMode = PresentMode.fifo, + alphaMode: CompositeAlphaMode = surface.supportedAlphaMode.first() ) /** diff --git a/core/src/commonMain/kotlin/com/littlekt/file/ldtk/-LDtkLevelLoader.kt b/core/src/commonMain/kotlin/com/littlekt/file/ldtk/-LDtkLevelLoader.kt index 4c28a44ca..ea3a9b8e9 100644 --- a/core/src/commonMain/kotlin/com/littlekt/file/ldtk/-LDtkLevelLoader.kt +++ b/core/src/commonMain/kotlin/com/littlekt/file/ldtk/-LDtkLevelLoader.kt @@ -8,7 +8,6 @@ import com.littlekt.graphics.g2d.TextureSlice import com.littlekt.graphics.g2d.tilemap.ldtk.* import com.littlekt.graphics.slice import com.littlekt.graphics.sliceWithBorderToTexture -import com.littlekt.graphics.webgpu.TextureFormat import com.littlekt.log.Logger import com.littlekt.math.geom.Point @@ -666,10 +665,7 @@ internal class LDtkLevelLoader( .readPixmap() .sliceWithBorderToTexture( device = vfs.vfs.context.graphics.device, - preferredFormat = - if (vfs.vfs.context.graphics.preferredFormat.srgb) - TextureFormat.RGBA8_UNORM_SRGB - else TextureFormat.RGBA8_UNORM, + preferredFormat = vfs.vfs.context.graphics.preferredFormat, sliceWidth = tilesetDef.tileGridSize, sliceHeight = tilesetDef.tileGridSize, border = sliceBorder diff --git a/core/src/commonMain/kotlin/com/littlekt/file/vfs/VfsLoaders.kt b/core/src/commonMain/kotlin/com/littlekt/file/vfs/VfsLoaders.kt index 813ff55d2..f8948cb13 100644 --- a/core/src/commonMain/kotlin/com/littlekt/file/vfs/VfsLoaders.kt +++ b/core/src/commonMain/kotlin/com/littlekt/file/vfs/VfsLoaders.kt @@ -16,9 +16,9 @@ import com.littlekt.graphics.g2d.TextureSlice import com.littlekt.graphics.g2d.font.* import com.littlekt.graphics.g2d.tilemap.ldtk.LDtkWorld import com.littlekt.graphics.g2d.tilemap.tiled.TiledMap -import com.littlekt.graphics.webgpu.TextureFormat import com.littlekt.math.MutableVec4i import com.littlekt.util.internal.unquote +import io.ygdrasil.wgpu.TextureFormat import kotlin.math.max /** @@ -308,9 +308,8 @@ expect suspend fun VfsFile.readPixmap(): Pixmap * @return the loaded texture */ expect suspend fun VfsFile.readTexture( - preferredFormat: TextureFormat = - if (vfs.context.graphics.preferredFormat.srgb) TextureFormat.RGBA8_UNORM_SRGB - else TextureFormat.RGBA8_UNORM + preferredFormat: TextureFormat = vfs.context.graphics.preferredFormat + ): Texture /** diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/Color.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/Color.kt index c85be3512..c756b1d97 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/Color.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/Color.kt @@ -101,6 +101,7 @@ open class Color(r: Float, g: Float, b: Float, a: Float = 1f) : Vec4f(r, g, b, a /** @return a new [MutableColor] using the color values of this color. */ fun toMutableColor(result: MutableColor = MutableColor()) = result.set(r, g, b, a) + fun toWebGPUColor() = io.ygdrasil.wgpu.Color(r.toDouble(), g.toDouble(), b.toDouble(), a.toDouble()) companion object { val CLEAR = Color(0f, 0f, 0f, 0f) diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/EmptyTexture.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/EmptyTexture.kt index 8fe1b06fa..b38806213 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/EmptyTexture.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/EmptyTexture.kt @@ -1,12 +1,23 @@ package com.littlekt.graphics import com.littlekt.graphics.Texture.Companion.nextId -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.Sampler +import io.ygdrasil.wgpu.SamplerDescriptor +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureDimension +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.TextureView +import io.ygdrasil.wgpu.TextureViewDescriptor + +import io.ygdrasil.wgpu.Texture as WebGPUTexture /** * A [Texture] that doesn't contain any underlying raw image data, but instead, is intended to be * used in a render pass as an output. By default, the [textureDescriptor] uses - * `TextureUsage.TEXTURE or TextureUsage.RENDER_ATTACHMENT` as usage. + * `TextureUsage.textureBinding or TextureUsage.renderAttachment` as usage. * * @param device the device for underlying GPU buffers creation * @param preferredFormat the preferred [TextureFormat] @@ -19,7 +30,7 @@ class EmptyTexture(val device: Device, preferredFormat: TextureFormat, width: In * The [Extent3D] size of the texture. Uses the initial width & height from the constructor and * a depth of `1`. */ - override var size: Extent3D = Extent3D(width, height, 1) + override var size: Size3D = Size3D(width, height, 1) private set override var id: Int = nextId() @@ -29,16 +40,13 @@ class EmptyTexture(val device: Device, preferredFormat: TextureFormat, width: In override var textureDescriptor: TextureDescriptor = TextureDescriptor( size, - 1, - 1, - TextureDimension.D2, preferredFormat, - TextureUsage.TEXTURE or TextureUsage.RENDER_ATTACHMENT + setOf(TextureUsage.textureBinding, TextureUsage.renderAttachment) ) set(value) { field = value val textureToDestroy = gpuTexture - textureToDestroy.release() + textureToDestroy.close() gpuTexture = device.createTexture(field) } @@ -46,7 +54,7 @@ class EmptyTexture(val device: Device, preferredFormat: TextureFormat, width: In override var gpuTexture: WebGPUTexture = device.createTexture(textureDescriptor) set(value) { field = value - view.release() + view.close() view = field.createView(textureViewDescriptor) } @@ -54,7 +62,7 @@ class EmptyTexture(val device: Device, preferredFormat: TextureFormat, width: In override var textureViewDescriptor: TextureViewDescriptor? = null set(value) { field = value - view.release() + view.close() view = gpuTexture.createView(value) } @@ -71,7 +79,7 @@ class EmptyTexture(val device: Device, preferredFormat: TextureFormat, width: In override var samplerDescriptor: SamplerDescriptor = SamplerDescriptor() set(value) { field = value - sampler.release() + sampler.close() sampler = device.createSampler(value) } @@ -89,7 +97,7 @@ class EmptyTexture(val device: Device, preferredFormat: TextureFormat, width: In * creating a whole new one. */ fun resize(width: Int, height: Int) { - size = Extent3D(width, height, 1) + size = Size3D(width, height, 1) textureDescriptor = textureDescriptor.copy(size = size) } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMesh.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMesh.kt index 466b5045c..c293cc7bd 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMesh.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMesh.kt @@ -1,8 +1,8 @@ package com.littlekt.graphics import com.littlekt.graphics.util.IndexedMeshGeometry -import com.littlekt.graphics.webgpu.BufferUsage -import com.littlekt.graphics.webgpu.Device +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.Device import kotlin.math.min /** @@ -18,11 +18,10 @@ class IndexedMesh(device: Device, geometry: T) : Mesh(device, geometry) { /** The GPU index buffer for this mesh, if created. */ - var ibo = - device.createGPUShortBuffer( + var ibo = device.createGPUShortBuffer( "ibo", geometry.indices.toArray(), - BufferUsage.INDEX or BufferUsage.COPY_DST + setOf(BufferUsage.index, BufferUsage.copydst) ) private set @@ -38,13 +37,12 @@ class IndexedMesh(device: Device, geometry: T) : logger.trace { "Destroying and creating VBO from size: ${vbo.size} to size: ${geometry.vertices.capacity}" } - vbo.destroy() - vbo.release() + vbo.close() vbo = device.createGPUFloatBuffer( "vbo", geometry.vertices.toArray(), - BufferUsage.VERTEX or BufferUsage.COPY_DST + setOf(BufferUsage.vertex,BufferUsage.copydst) ) // need to remake ibo because indices won't correspond correctly to the new // vertices @@ -54,10 +52,10 @@ class IndexedMesh(device: Device, geometry: T) : min( vbo.size / Float.SIZE_BYTES, geometry.numVertices * - geometry.layout.attributes.calculateComponents().toLong() + geometry.layout.attributes.calculateComponents().toLong() ) logger.trace { "Writing VBO to queue of size: $size" } - device.queue.writeBuffer(vbo, geometry.vertices, size = size) + device.queue.writeBuffer(vbo, 0L, geometry.vertices.toArray(), size = size) } } if (geometry.indicesDirty) { @@ -66,7 +64,7 @@ class IndexedMesh(device: Device, geometry: T) : } else { val size = min(ibo.size / Short.SIZE_BYTES, geometry.indices.limit.toLong()) logger.trace { "Writing IBO to queue of size: $size" } - device.queue.writeBuffer(ibo, geometry.indices, size = size) + device.queue.writeBuffer(ibo, 0L, geometry.indices.toArray(), size = size) } geometry.indicesDirty = false } @@ -75,8 +73,8 @@ class IndexedMesh(device: Device, geometry: T) : private fun destroyAndRecreateIbo() { logger.trace { "Destroy and recreating IBO." } - ibo.destroy() - ibo.release() + ibo.close() + ibo.close() if (geometry.indicesType == IndexedMeshGeometry.IndicesType.QUAD) { logger.trace { "Regenerating indices as quads." } geometry.indicesAsQuad() @@ -89,14 +87,13 @@ class IndexedMesh(device: Device, geometry: T) : device.createGPUShortBuffer( "ibo", geometry.indices.toArray(), - BufferUsage.INDEX or BufferUsage.COPY_DST + setOf( BufferUsage.index, BufferUsage.copydst) ) } override fun release() { - vbo.destroy() - ibo.destroy() - vbo.release() - ibo.release() + ibo.close() + vbo.close() + ibo.close() } } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMeshExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMeshExt.kt index 29435bc97..4f8a22a64 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMeshExt.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/IndexedMeshExt.kt @@ -3,22 +3,22 @@ package com.littlekt.graphics import com.littlekt.ContextListener import com.littlekt.graphics.util.CommonIndexedMeshBuilder import com.littlekt.graphics.util.CommonIndexedMeshGeometry -import com.littlekt.graphics.webgpu.Device -import com.littlekt.graphics.webgpu.VertexFormat -import com.littlekt.graphics.webgpu.VertexStepMode +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.VertexFormat +import io.ygdrasil.wgpu.VertexStepMode -/** Creates a new indexed mesh using the list of [VertexAttribute]. */ +/** Creates a new indexed mesh using the list of [VertexAttributeView]. */ inline fun indexedMesh( device: Device, - attributes: List, + attributes: List, size: Int = 1000, generate: CommonIndexedMeshGeometry.() -> Unit = {}, ): IndexedMesh { val geometry = CommonIndexedMeshGeometry( - VertexBufferLayout( + VertexBufferLayoutView( attributes.calculateStride().toLong(), - VertexStepMode.VERTEX, + VertexStepMode.vertex, attributes ), size @@ -40,10 +40,10 @@ fun colorIndexedMesh( return indexedMesh( device, listOf( - VertexAttribute(VertexFormat.FLOAT32x3, 0, 0, VertexAttrUsage.POSITION), - VertexAttribute( - VertexFormat.FLOAT32x4, - VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView(VertexFormat.float32x3, 0, 0, VertexAttrUsage.POSITION), + VertexAttributeView( + VertexFormat.float32x4, + VertexFormat.float32x3.sizeInByte.toLong(), 1, VertexAttrUsage.COLOR ) @@ -65,16 +65,16 @@ fun textureIndexedMesh( return indexedMesh( device, listOf( - VertexAttribute(VertexFormat.FLOAT32x3, 0, 0, VertexAttrUsage.POSITION), - VertexAttribute( - VertexFormat.FLOAT32x4, - VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView(VertexFormat.float32x3, 0, 0, VertexAttrUsage.POSITION), + VertexAttributeView( + VertexFormat.float32x4, + VertexFormat.float32x3.sizeInByte.toLong(), 1, VertexAttrUsage.COLOR ), - VertexAttribute( - VertexFormat.FLOAT32x2, - VertexFormat.FLOAT32x4.bytes.toLong() + VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView( + VertexFormat.float32x2, + VertexFormat.float32x4.sizeInByte.toLong() + VertexFormat.float32x3.sizeInByte.toLong(), 2, VertexAttrUsage.TEX_COORDS ) @@ -92,15 +92,15 @@ fun positionIndexedMesh( ): IndexedMesh { return indexedMesh( device, - listOf(VertexAttribute(VertexFormat.FLOAT32x3, 0, 0, VertexAttrUsage.POSITION)), + listOf(VertexAttributeView(VertexFormat.float32x3, 0, 0, VertexAttrUsage.POSITION)), size, generate ) } -/** Creates a new indexed mesh using the list of [VertexAttribute]. */ +/** Creates a new indexed mesh using the list of [VertexAttributeView]. */ fun T.indexedMesh( - attributes: List, + attributes: List, size: Int = 1000, generate: CommonIndexedMeshGeometry.() -> Unit = {}, ): IndexedMesh { diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/Mesh.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/Mesh.kt index 6f161fe0e..466803a94 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/Mesh.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/Mesh.kt @@ -2,10 +2,10 @@ package com.littlekt.graphics import com.littlekt.Releasable import com.littlekt.graphics.util.MeshGeometry -import com.littlekt.graphics.webgpu.BufferUsage -import com.littlekt.graphics.webgpu.Device -import com.littlekt.graphics.webgpu.GPUBuffer +import io.ygdrasil.wgpu.Device import com.littlekt.log.Logger +import io.ygdrasil.wgpu.Buffer +import io.ygdrasil.wgpu.BufferUsage import kotlin.jvm.JvmStatic import kotlin.math.min @@ -22,11 +22,11 @@ import kotlin.math.min open class Mesh(val device: Device, val geometry: T) : Releasable { /** The GPU Vertex buffer for this mesh. */ - var vbo: GPUBuffer = + var vbo: Buffer = device.createGPUFloatBuffer( "vbo", geometry.vertices.toArray(), - BufferUsage.VERTEX or BufferUsage.COPY_DST + setOf(BufferUsage.vertex, BufferUsage.copydst) ) protected set @@ -42,13 +42,12 @@ open class Mesh(val device: Device, val geometry: T) : Releasa logger.trace { "Destroying and creating VBO from size: ${vbo.size} to size: ${geometry.vertices.capacity}" } - vbo.destroy() - vbo.release() + vbo.close() vbo = device.createGPUFloatBuffer( "vbo", geometry.vertices.toArray(), - BufferUsage.VERTEX or BufferUsage.COPY_DST + setOf(BufferUsage.vertex, BufferUsage.copydst) ) } else { val size = @@ -58,7 +57,7 @@ open class Mesh(val device: Device, val geometry: T) : Releasa geometry.layout.attributes.calculateComponents().toLong() ) logger.trace { "Writing VBO to queue of size: $size" } - device.queue.writeBuffer(vbo, geometry.vertices, size = size) + device.queue.writeBuffer(vbo, 0L, geometry.vertices.toArray(), size = size) } } } @@ -70,8 +69,7 @@ open class Mesh(val device: Device, val geometry: T) : Releasa } override fun release() { - vbo.destroy() - vbo.release() + vbo.close() } companion object { diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/MeshExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/MeshExt.kt index bf43b2dff..96e1cb2bb 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/MeshExt.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/MeshExt.kt @@ -2,26 +2,26 @@ package com.littlekt.graphics import com.littlekt.ContextListener import com.littlekt.graphics.util.CommonMeshGeometry -import com.littlekt.graphics.webgpu.Device -import com.littlekt.graphics.webgpu.VertexFormat -import com.littlekt.graphics.webgpu.VertexStepMode +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.VertexFormat +import io.ygdrasil.wgpu.VertexStepMode /** - * Creates a new mesh using the list of [VertexAttribute]. + * Creates a new mesh using the list of [VertexAttributeView]. * * @see indexedMesh */ inline fun mesh( device: Device, - attributes: List, + attributes: List, size: Int = 1000, generate: CommonMeshGeometry.() -> Unit = {}, ): Mesh { val geometry = CommonMeshGeometry( - VertexBufferLayout( + VertexBufferLayoutView( attributes.calculateStride().toLong(), - VertexStepMode.VERTEX, + VertexStepMode.vertex, attributes ), size @@ -43,10 +43,10 @@ fun colorMesh( return mesh( device, listOf( - VertexAttribute(VertexFormat.FLOAT32x3, 0, 0, VertexAttrUsage.POSITION), - VertexAttribute( - VertexFormat.FLOAT32x4, - VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView(VertexFormat.float32x3, 0, 0, VertexAttrUsage.POSITION), + VertexAttributeView( + VertexFormat.float32x4, + VertexFormat.float32x3.sizeInByte.toLong(), 1, VertexAttrUsage.COLOR ) @@ -70,16 +70,16 @@ fun textureMesh( return mesh( device, listOf( - VertexAttribute(VertexFormat.FLOAT32x3, 0, 0, VertexAttrUsage.POSITION), - VertexAttribute( - VertexFormat.FLOAT32x4, - VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView(VertexFormat.float32x3, 0, 0, VertexAttrUsage.POSITION), + VertexAttributeView( + VertexFormat.float32x4, + VertexFormat.float32x3.sizeInByte.toLong(), 1, VertexAttrUsage.COLOR ), - VertexAttribute( - VertexFormat.FLOAT32x2, - VertexFormat.FLOAT32x4.bytes.toLong() + VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView( + VertexFormat.float32x2, + VertexFormat.float32x4.sizeInByte.toLong() + VertexFormat.float32x3.sizeInByte.toLong(), 2, VertexAttrUsage.TEX_COORDS ) @@ -101,19 +101,19 @@ fun positionMesh( ): Mesh { return mesh( device, - listOf(VertexAttribute(VertexFormat.FLOAT32x3, 0, 0, VertexAttrUsage.POSITION)), + listOf(VertexAttributeView(VertexFormat.float32x3, 0, 0, VertexAttrUsage.POSITION)), size, generate ) } /** - * Creates a new mesh using the list of [VertexAttribute]. + * Creates a new mesh using the list of [VertexAttributeView]. * * @see indexedMesh */ fun T.mesh( - attributes: List, + attributes: List, size: Int = 1000, generate: CommonMeshGeometry.() -> Unit = {}, ): Mesh { diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapExt.kt index c243f5189..14c414767 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapExt.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapExt.kt @@ -1,9 +1,9 @@ package com.littlekt.graphics import com.littlekt.graphics.g2d.TextureSlice -import com.littlekt.graphics.webgpu.Device -import com.littlekt.graphics.webgpu.TextureFormat import com.littlekt.math.nextPowerOfTwo +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.TextureFormat import kotlin.math.ceil import kotlin.math.sqrt diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapTexture.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapTexture.kt index 4232f64f6..ac33342c0 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapTexture.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/PixmapTexture.kt @@ -1,7 +1,19 @@ package com.littlekt.graphics import com.littlekt.graphics.Texture.Companion.nextId -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.Texture as WebGPUTexture +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.ImageCopyTexture +import io.ygdrasil.wgpu.Sampler +import io.ygdrasil.wgpu.SamplerDescriptor +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.TextureDataLayout +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureDimension +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.TextureView +import io.ygdrasil.wgpu.TextureViewDescriptor /** * A [Texture] that uses a [Pixmap] as the underlying data. @@ -17,25 +29,22 @@ class PixmapTexture(val device: Device, preferredFormat: TextureFormat, val pixm /** * The [Extent3D] size of the texture. Uses [Pixmap.width], [Pixmap.height] and a depth of `1`. */ - override val size: Extent3D = Extent3D(pixmap.width, pixmap.height, 1) + override val size: Size3D = Size3D(pixmap.width, pixmap.height, 1) override var id: Int = nextId() private set override var textureDescriptor: TextureDescriptor = TextureDescriptor( size, - 1, - 1, - TextureDimension.D2, preferredFormat, - TextureUsage.TEXTURE or TextureUsage.COPY_DST + setOf(TextureUsage.textureBinding, TextureUsage.copyDst) ) set(value) { field = value val textureToDestroy = gpuTexture val viewToDestroy = view - viewToDestroy.release() - textureToDestroy.release() + viewToDestroy.close() + textureToDestroy.close() gpuTexture = device.createTexture(textureDescriptor) } @@ -50,7 +59,7 @@ class PixmapTexture(val device: Device, preferredFormat: TextureFormat, val pixm override var textureViewDescriptor: TextureViewDescriptor? = null set(value) { field = value - view.release() + view.close() view = gpuTexture.createView(value) } @@ -65,7 +74,7 @@ class PixmapTexture(val device: Device, preferredFormat: TextureFormat, val pixm override var samplerDescriptor: SamplerDescriptor = SamplerDescriptor() set(value) { field = value - sampler.release() + sampler.close() sampler = device.createSampler(value) } @@ -78,9 +87,9 @@ class PixmapTexture(val device: Device, preferredFormat: TextureFormat, val pixm override fun writeDataToBuffer() { device.queue.writeTexture( + ImageCopyTexture(gpuTexture), pixmap.pixels.toArray(), - TextureCopyView(gpuTexture), - TextureDataLayout(4 * pixmap.width, pixmap.height), + TextureDataLayout(0L, 4 * pixmap.width, pixmap.height), size ) } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/Texture.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/Texture.kt index 1db73881b..9cd4abde8 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/Texture.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/Texture.kt @@ -1,7 +1,13 @@ package com.littlekt.graphics import com.littlekt.Releasable -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.Sampler +import io.ygdrasil.wgpu.SamplerDescriptor +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureView +import io.ygdrasil.wgpu.TextureViewDescriptor +import io.ygdrasil.wgpu.Texture as WebGPUTexture import kotlinx.atomicfu.atomic /** @@ -17,7 +23,7 @@ interface Texture : Releasable { * The [Extent3D] size of the texture. Usually, the width & height of the image with a depth of * `1`. */ - val size: Extent3D + val size: Size3D /** The width of the texture. */ val width: Int @@ -61,10 +67,10 @@ interface Texture : Releasable { fun writeDataToBuffer() override fun release() { - view.release() - sampler.release() + view.close() + sampler.close() // destroy after any update/postUpdate calls to ensure we aren't in the middle of a pass! - gpuTexture.release() + gpuTexture.close() } companion object { diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/TextureExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/TextureExt.kt index ddb3342a2..b9d1edfdf 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/TextureExt.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/TextureExt.kt @@ -1,7 +1,7 @@ package com.littlekt.graphics import com.littlekt.graphics.g2d.TextureSlice -import com.littlekt.graphics.webgpu.Device +import io.ygdrasil.wgpu.Device /** Creates a new [TextureSlice] that encompasses the entire [Texture]. */ fun Texture.slice(): TextureSlice = TextureSlice(this) diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeExt.kt index f4ce4a956..7a2746b08 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeExt.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeExt.kt @@ -1,19 +1,17 @@ package com.littlekt.graphics -import com.littlekt.graphics.webgpu.VertexFormat - /** - * Calculates the stride of a list [VertexAttribute] by summing up the bytes of - * [VertexAttribute.format]. + * Calculates the stride of a list [VertexAttributeView] by summing up the bytes of + * [VertexAttributeView.format]. * * @see VertexFormat.bytes */ -fun List.calculateStride(): Int = sumOf { it.format.bytes } +fun List.calculateStride(): Int = sumOf { it.format.sizeInByte } /** - * Calculates the number of components in the list of [VertexAttribute] by summing up the components - * of [VertexAttribute.format]. + * Calculates the number of components in the list of [VertexAttributeView] by summing up the components + * of [VertexAttributeView.format]. * * @see VertexFormat.components */ -fun List.calculateComponents(): Int = sumOf { it.format.components } +fun List.calculateComponents(): Int = sumOf { it.format.components } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeUsage.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeUsage.kt index c8774082d..2b7a26d1b 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeUsage.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeUsage.kt @@ -3,7 +3,7 @@ package com.littlekt.graphics import kotlin.jvm.JvmInline /** - * A value class used to designate a usage for a [VertexAttribute] in a shader. Custom attributes + * A value class used to designate a usage for a [VertexAttributeView] in a shader. Custom attributes * may be created. * * @see POSITION diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttribute.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeView.kt similarity index 69% rename from core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttribute.kt rename to core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeView.kt index 9b0058b35..2439a60d6 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttribute.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexAttributeView.kt @@ -1,11 +1,12 @@ package com.littlekt.graphics import com.littlekt.graphics.util.CommonVertexView -import com.littlekt.graphics.webgpu.VertexFormat -import com.littlekt.graphics.webgpu.WebGPUVertexAttribute +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout.VertexAttribute +import io.ygdrasil.wgpu.VertexFormat /** - * Wraps a [WebGPUVertexAttribute] and tracks a [VertexAttrUsage]. + * Wraps a [VertexAttribute] and tracks a [VertexAttrUsage]. * * @param format the format of the input * @param offset byte offset of the start of the input @@ -16,14 +17,15 @@ import com.littlekt.graphics.webgpu.WebGPUVertexAttribute * @author Colton Daily * @date 4/10/2024 */ -data class VertexAttribute( +data class VertexAttributeView( val format: VertexFormat, val offset: Long, val shaderLocation: Int, val usage: VertexAttrUsage ) { private val usageIndex = usage.usage.countTrailingZeroBits() - val gpuVertexAttribute = WebGPUVertexAttribute(format, offset, shaderLocation) + val gpuVertexAttribute = + VertexAttribute(format, offset, shaderLocation) val key: Int = (usageIndex shl 8) + (shaderLocation and 0xFF) } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexBufferLayout.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexBufferLayoutView.kt similarity index 63% rename from core/src/commonMain/kotlin/com/littlekt/graphics/VertexBufferLayout.kt rename to core/src/commonMain/kotlin/com/littlekt/graphics/VertexBufferLayoutView.kt index c35b3394a..bde36479a 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/VertexBufferLayout.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/VertexBufferLayoutView.kt @@ -1,8 +1,8 @@ package com.littlekt.graphics -import com.littlekt.graphics.webgpu.VertexState -import com.littlekt.graphics.webgpu.VertexStepMode -import com.littlekt.graphics.webgpu.WebGPUVertexBufferLayout +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.VertexStepMode + /** * A wrapper around a [WebGPUVertexBufferLayout] describes how the vertex buffer is interpreted. @@ -15,12 +15,15 @@ import com.littlekt.graphics.webgpu.WebGPUVertexBufferLayout * @author Colton Daily * @date 4/10/2024 */ -data class VertexBufferLayout( +data class VertexBufferLayoutView( val arrayStride: Long, val stepMode: VertexStepMode, - val attributes: List + val attributes: List ) { /** The underlying GPU vertex buffer layout. */ val gpuVertexBufferLayout = - WebGPUVertexBufferLayout(arrayStride, stepMode, attributes.map { it.gpuVertexAttribute }) + RenderPipelineDescriptor.VertexState.VertexBufferLayout( + arrayStride, + attributes.map { it.gpuVertexAttribute }, + stepMode) } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/WebgpuExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/WebgpuExt.kt new file mode 100644 index 000000000..069405e44 --- /dev/null +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/WebgpuExt.kt @@ -0,0 +1,199 @@ +package com.littlekt.graphics + +import io.ygdrasil.wgpu.BlendFactor +import io.ygdrasil.wgpu.BlendOperation +import io.ygdrasil.wgpu.Buffer +import io.ygdrasil.wgpu.BufferDescriptor +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState.BlendState +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState.BlendState.BlendComponent + + +fun Device.createGPUShortBuffer(label: String, data: ShortArray, usages: Set): Buffer { + val buffer = createBuffer( + BufferDescriptor( + label = label, + size = data.size.toLong() * Short.SIZE_BYTES, + usage = usages, + mappedAtCreation = true + ) + ) + buffer.mapFrom(data) + buffer.unmap() + + return buffer +} + + +fun Device.createGPUFloatBuffer(label: String, data: FloatArray, usages: Set): Buffer { + val buffer = createBuffer( + BufferDescriptor( + label = label, + size = data.size.toLong() * Float.SIZE_BYTES, + usage = usages, + mappedAtCreation = true + ) + ) + buffer.mapFrom(data) + buffer.unmap() + + return buffer +} + +fun Device.createGPUByteBuffer(label: String, data: ByteArray, usages: Set): Buffer { + val buffer = createBuffer( + BufferDescriptor( + label = label, + size = data.size.toLong() * Byte.SIZE_BYTES, + usage = usages, + mappedAtCreation = true + ) + ) + buffer.mapFrom(data) + buffer.unmap() + + return buffer +} + +object BlendStates { + /** Standard alpha blending. */ + val Alpha: BlendState + get() = BlendState( + color = BlendComponent(dstFactor = BlendFactor.oneminussrcalpha), + alpha = BlendComponent(dstFactor = BlendFactor.oneminussrcalpha) + ) + + /** Fully oqaque, no alpha, blending. */ + val Opaque: BlendState + get() = BlendState() + + + /** Non-premultiplied, alpha blending. */ + val NonPreMultiplied: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.srcalpha, + dstFactor = BlendFactor.oneminussrcalpha + ), + alpha = + BlendComponent( + srcFactor = BlendFactor.srcalpha, + dstFactor = BlendFactor.oneminussrcalpha + ) + ) + + val Add: BlendState + get() = BlendState( + color = + BlendComponent(srcFactor = BlendFactor.srcalpha, dstFactor = BlendFactor.one), + alpha = + BlendComponent(srcFactor = BlendFactor.srcalpha, dstFactor = BlendFactor.one) + ) + + val Subtract: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.srcalpha, + dstFactor = BlendFactor.one, + operation = BlendOperation.reversesubtract + ), + alpha = + BlendComponent( + srcFactor = BlendFactor.srcalpha, + dstFactor = BlendFactor.one, + operation = BlendOperation.reversesubtract + ), + ) + + val Difference: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.oneminusdst, + dstFactor = BlendFactor.oneminussrc, + operation = BlendOperation.add + ), + ) + + val Multiply: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.dst, + dstFactor = BlendFactor.zero, + operation = BlendOperation.add + ), + alpha = + BlendComponent( + srcFactor = BlendFactor.dstalpha, + dstFactor = BlendFactor.zero, + operation = BlendOperation.add + ) + ) + + val Lighten: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.one, + dstFactor = BlendFactor.one, + operation = BlendOperation.max + ), + alpha = + BlendComponent( + srcFactor = BlendFactor.one, + dstFactor = BlendFactor.one, + operation = BlendOperation.max + ), + ) + + val Darken: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.one, + dstFactor = BlendFactor.one, + operation = BlendOperation.min + ), + alpha = + BlendComponent( + srcFactor = BlendFactor.one, + dstFactor = BlendFactor.one, + operation = BlendOperation.min + ), + ) + + val Screen: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.oneminusdst, + dstFactor = BlendFactor.one, + operation = BlendOperation.add + ) + ) + + val LinearDodge: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.one, + dstFactor = BlendFactor.one, + operation = BlendOperation.add + ) + ) + + val LinearBurn: BlendState + get() = BlendState( + color = + BlendComponent( + srcFactor = BlendFactor.one, + dstFactor = BlendFactor.one, + operation = BlendOperation.reversesubtract + ) + ) + +} diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/Batch.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/Batch.kt index 02dca11ec..96b6bb008 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/Batch.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/Batch.kt @@ -4,12 +4,11 @@ import com.littlekt.Releasable import com.littlekt.graphics.Color import com.littlekt.graphics.Texture import com.littlekt.graphics.shader.Shader -import com.littlekt.graphics.webgpu.BlendState -import com.littlekt.graphics.webgpu.CommandEncoder -import com.littlekt.graphics.webgpu.Queue -import com.littlekt.graphics.webgpu.RenderPassEncoder import com.littlekt.math.Mat4 import com.littlekt.math.geom.Angle +import io.ygdrasil.wgpu.RenderPassEncoder +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState.BlendState /** * An interface for creating batch renderers. diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/BatchExt.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/BatchExt.kt index b98488b3d..05ab8865d 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/BatchExt.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/BatchExt.kt @@ -1,7 +1,7 @@ package com.littlekt.graphics.g2d -import com.littlekt.graphics.webgpu.RenderPassEncoder import com.littlekt.math.Mat4 +import io.ygdrasil.wgpu.RenderPassEncoder import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/NinePatch.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/NinePatch.kt index 58d24aef9..07a7d9ba5 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/NinePatch.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/NinePatch.kt @@ -3,11 +3,11 @@ package com.littlekt.graphics.g2d import com.littlekt.graphics.Color import com.littlekt.graphics.Texture import com.littlekt.graphics.slice -import com.littlekt.graphics.webgpu.FilterMode import com.littlekt.math.geom.Angle import com.littlekt.math.geom.cosine import com.littlekt.math.geom.sine import com.littlekt.util.datastructure.FloatArrayList +import io.ygdrasil.wgpu.FilterMode import kotlin.math.max import kotlin.math.min @@ -439,8 +439,8 @@ class NinePatch( // filtering is used for the texture. This nudges the texture coordinate to the center // of the texel where the neighboring pixel has 0% contribution in linear blending mode. if ( - slice.texture.samplerDescriptor.magFilter == FilterMode.LINEAR || - slice.texture.samplerDescriptor.minFilter == FilterMode.LINEAR + slice.texture.samplerDescriptor.magFilter == FilterMode.linear || + slice.texture.samplerDescriptor.minFilter == FilterMode.linear ) { if (stretchW) { val halfTexelWidth = 0.5f * 1f / slice.texture.width diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatch.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatch.kt index 79f7f2e42..808c4afc8 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatch.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatch.kt @@ -2,6 +2,7 @@ package com.littlekt.graphics.g2d import com.littlekt.EngineStats import com.littlekt.Graphics +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color import com.littlekt.graphics.IndexedMesh import com.littlekt.graphics.Texture @@ -9,7 +10,6 @@ import com.littlekt.graphics.shader.Shader import com.littlekt.graphics.shader.SpriteShader import com.littlekt.graphics.textureIndexedMesh import com.littlekt.graphics.util.CommonIndexedMeshGeometry -import com.littlekt.graphics.webgpu.* import com.littlekt.log.Logger import com.littlekt.math.Mat4 import com.littlekt.math.geom.Angle @@ -20,6 +20,10 @@ import com.littlekt.math.isFuzzyZero import com.littlekt.util.LazyMat4 import com.littlekt.util.datastructure.fastForEach import com.littlekt.util.datastructure.pool +import io.ygdrasil.wgpu.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState.BlendState /** * Draws batched quads using indices. @@ -101,15 +105,15 @@ class SpriteBatch( mutableMapOf() private val drawCalls: MutableList = mutableListOf() - private var blendState = BlendState.NonPreMultiplied + private var blendState = BlendStates.NonPreMultiplied private var prevBlendState = blendState private val renderPipelineByBlendState: MutableMap = mutableMapOf( RenderInfo(shader, blendState) to - device.createRenderPipeline( - createRenderPipelineDescriptor(RenderInfo(shader, blendState)) - ) + device.createRenderPipeline( + createRenderPipelineDescriptor(RenderInfo(shader, blendState)) + ) ) private val spriteIndices = mutableMapOf(lastMeshIdx to 0) @@ -566,7 +570,7 @@ class SpriteBatch( if (spriteIdx == 0) return mesh.update() - renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.UINT16) + renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.uint16) renderPassEncoder.setVertexBuffer(0, mesh.vbo) var lastPipelineSet: RenderPipeline? = null var lastCombinedMatrixSet: Mat4? = null @@ -606,8 +610,8 @@ class SpriteBatch( } if ( lastBindGroupsSet != bindGroups || - lastShader != shader || - lastCombinedMatrixSet != drawCall.combinedMatrix + lastShader != shader || + lastCombinedMatrixSet != drawCall.combinedMatrix ) { lastBindGroupsSet = bindGroups lastDynamicMeshOffsets[0] = @@ -721,27 +725,28 @@ class SpriteBatch( val (shader, blendState) = renderInfo return RenderPipelineDescriptor( layout = shader.pipelineLayout, - vertex = - VertexState( - module = shader.shaderModule, - entryPoint = shader.vertexEntryPoint, - mesh.geometry.layout.gpuVertexBufferLayout - ), + vertex = VertexState( + module = shader.shaderModule, + entryPoint = shader.vertexEntryPoint, + buffers = listOf(mesh.geometry.layout.gpuVertexBufferLayout) + ), fragment = - FragmentState( - module = shader.shaderModule, - entryPoint = shader.fragmentEntryPoint, - target = - ColorTargetState( - format = format, - blendState = blendState, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + FragmentState( + module = shader.shaderModule, + entryPoint = shader.fragmentEntryPoint, + targets = listOf + ( + ColorTargetState( + format = format, + blend = blendState, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) } @@ -755,7 +760,7 @@ class SpriteBatch( lastTexture = null mesh.release() defaultShader.release() - renderPipelineByBlendState.values.forEach { it.release() } + renderPipelineByBlendState.values.forEach { it.close() } renderPipelineByBlendState.clear() drawCalls.clear() } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatchShader.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatchShader.kt index 9d44c019a..37144f557 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatchShader.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteBatchShader.kt @@ -2,8 +2,16 @@ package com.littlekt.graphics.g2d import com.littlekt.graphics.Texture import com.littlekt.graphics.shader.SpriteShader -import com.littlekt.graphics.webgpu.* import com.littlekt.util.align +import io.ygdrasil.wgpu.BindGroup +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.* +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.RenderPassEncoder +import io.ygdrasil.wgpu.ShaderStage /** * The default [SpriteShader] that is used [SpriteBatch]. @@ -19,7 +27,7 @@ class SpriteBatchShader(device: Device, cameraDynamicSize: Int = 50) : device, // language=wgsl src = - """ + """ struct CameraUniform { view_proj: mat4x4 }; @@ -56,31 +64,37 @@ class SpriteBatchShader(device: Device, cameraDynamicSize: Int = 50) : return textureSample(my_texture, my_sampler, in.uv) * in.color; } """ - .trimIndent(), + .trimIndent(), layout = - listOf( - BindGroupLayoutDescriptor( - listOf( - BindGroupLayoutEntry( - 0, - ShaderStage.VERTEX, - BufferBindingLayout( - hasDynamicOffset = true, - minBindingSize = - (Float.SIZE_BYTES * 16) - .align(device.limits.minUniformBufferOffsetAlignment) - .toLong() - ) + listOf( + BindGroupLayoutDescriptor( + listOf( + Entry( + 0, + setOf(ShaderStage.vertex), + BufferBindingLayout( + hasDynamicOffset = true, + minBindingSize = + (Float.SIZE_BYTES * 16) + .align(device.limits.minUniformBufferOffsetAlignment) + .toLong() ) ) - ), - BindGroupLayoutDescriptor( - listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) - ) ) ), + BindGroupLayoutDescriptor( + listOf( + Entry( + 0, setOf(ShaderStage.fragment), + TextureBindingLayout() + ), + Entry( + 1, setOf(ShaderStage.fragment), + SamplerBindingLayout() + ) + ) + ) + ), cameraDynamicSize = cameraDynamicSize ) { @@ -100,7 +114,10 @@ class SpriteBatchShader(device: Device, cameraDynamicSize: Int = 50) : device.createBindGroup( BindGroupDescriptor( layouts[1], - listOf(BindGroupEntry(0, texture.view), BindGroupEntry(1, texture.sampler)) + listOf( + BindGroupEntry(0, TextureViewBinding(texture.view)), + BindGroupEntry(1, SamplerBinding(texture.sampler)) + ) ) ) ) @@ -111,7 +128,7 @@ class SpriteBatchShader(device: Device, cameraDynamicSize: Int = 50) : bindGroups: List, dynamicOffsets: List ) { - encoder.setBindGroup(0, bindGroups[0], dynamicOffsets) + encoder.setBindGroup(0, bindGroups[0], dynamicOffsets.map { it.toInt() }) encoder.setBindGroup(1, bindGroups[1]) } } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCache.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCache.kt index 54518cba5..eac1482ab 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCache.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCache.kt @@ -3,10 +3,15 @@ package com.littlekt.graphics.g2d import com.littlekt.EngineStats import com.littlekt.Releasable import com.littlekt.file.FloatBuffer -import com.littlekt.graphics.* +import com.littlekt.graphics.BlendStates +import com.littlekt.graphics.MutableColor +import com.littlekt.graphics.Texture +import com.littlekt.graphics.VertexAttrUsage +import com.littlekt.graphics.VertexAttributeView +import com.littlekt.graphics.createGPUFloatBuffer +import com.littlekt.graphics.indexedMesh import com.littlekt.graphics.shader.Shader import com.littlekt.graphics.shader.SpriteShader -import com.littlekt.graphics.webgpu.* import com.littlekt.log.Logger import com.littlekt.math.Mat4 import com.littlekt.math.MutableVec2f @@ -14,6 +19,20 @@ import com.littlekt.math.MutableVec4f import com.littlekt.math.geom.Angle import com.littlekt.math.geom.radians import com.littlekt.util.datastructure.fastForEach +import io.ygdrasil.wgpu.BindGroup +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.IndexFormat +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassEncoder +import io.ygdrasil.wgpu.RenderPipeline +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState.BlendState +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.VertexFormat import kotlinx.atomicfu.atomic import kotlinx.atomicfu.getAndUpdate @@ -38,15 +57,15 @@ class SpriteCache(val device: Device, val format: TextureFormat, size: Int = 100 indexedMesh( device, listOf( - VertexAttribute( - format = VertexFormat.FLOAT32x3, + VertexAttributeView( + format = VertexFormat.float32x3, offset = 0, shaderLocation = 0, usage = VertexAttrUsage.POSITION ), - VertexAttribute( - format = VertexFormat.FLOAT32x2, - offset = VertexFormat.FLOAT32x3.bytes.toLong(), + VertexAttributeView( + format = VertexFormat.float32x2, + offset = VertexFormat.float32x3.sizeInByte.toLong(), shaderLocation = 1, usage = VertexAttrUsage.TEX_COORDS ) @@ -82,7 +101,8 @@ class SpriteCache(val device: Device, val format: TextureFormat, size: Int = 100 private val bindGroupsByTexture: MutableMap> = mutableMapOf() private val drawCalls: MutableList = mutableListOf() - private var blendState = BlendState.NonPreMultiplied + private var blendState = + BlendStates.NonPreMultiplied private val renderPipeline = device.createRenderPipeline(createRenderPipelineDescriptor(shader, blendState)) @@ -92,7 +112,7 @@ class SpriteCache(val device: Device, val format: TextureFormat, size: Int = 100 device.createGPUFloatBuffer( "sprite buffer", staticData.toArray(), - BufferUsage.STORAGE or BufferUsage.COPY_DST + setOf(BufferUsage.storage, BufferUsage.copydst) ) private val spriteIndices = mutableMapOf() private val spriteView = SpriteView() @@ -200,7 +220,7 @@ class SpriteCache(val device: Device, val format: TextureFormat, size: Int = 100 staticDirty = false dynamicDirty = false } - encoder.setIndexBuffer(mesh.ibo, IndexFormat.UINT16) + encoder.setIndexBuffer(mesh.ibo, IndexFormat.uint16) encoder.setVertexBuffer(0, mesh.vbo) var lastPipelineSet: RenderPipeline? = null var lastCombinedMatrixSet: Mat4? = null @@ -459,26 +479,26 @@ class SpriteCache(val device: Device, val format: TextureFormat, size: Int = 100 return RenderPipelineDescriptor( layout = shader.pipelineLayout, vertex = - VertexState( - module = shader.shaderModule, - entryPoint = shader.vertexEntryPoint, - buffer = mesh.geometry.layout.gpuVertexBufferLayout - ), + VertexState( + module = shader.shaderModule, + entryPoint = shader.vertexEntryPoint, + buffers = listOf(mesh.geometry.layout.gpuVertexBufferLayout) + ), fragment = - FragmentState( - module = shader.shaderModule, - entryPoint = shader.fragmentEntryPoint, - target = - ColorTargetState( - format = format, - blendState = blendState, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + FragmentState( + module = shader.shaderModule, + entryPoint = shader.fragmentEntryPoint, + targets = listOf( + FragmentState.ColorTargetState( + format = format, + blend = blendState, + writeMask = ColorWriteMask.all + )) + ), + primitive = RenderPipelineDescriptor.PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + RenderPipelineDescriptor.MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) } @@ -493,7 +513,7 @@ class SpriteCache(val device: Device, val format: TextureFormat, size: Int = 100 } override fun release() { - spriteBuffer.release() + spriteBuffer.close() staticData.clear() spriteIndices.clear() } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCacheShader.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCacheShader.kt index e1bca9937..701463a87 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCacheShader.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/g2d/SpriteCacheShader.kt @@ -2,9 +2,13 @@ package com.littlekt.graphics.g2d import com.littlekt.file.FloatBuffer import com.littlekt.graphics.Texture +import com.littlekt.graphics.createGPUFloatBuffer import com.littlekt.graphics.shader.SpriteShader -import com.littlekt.graphics.webgpu.* import com.littlekt.log.Logger +import io.ygdrasil.wgpu.* +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.BufferBindingLayout import kotlin.math.min /** @@ -25,7 +29,7 @@ class SpriteCacheShader( device, // language=wgsl src = - """ + """ struct CameraUniform { view_proj: mat4x4 }; @@ -144,39 +148,39 @@ class SpriteCacheShader( return textureSample(my_texture, my_sampler, in.uv) * in.color; } """ - .trimIndent(), + .trimIndent(), layout = - listOf( - BindGroupLayoutDescriptor( - listOf( - BindGroupLayoutEntry( - 0, - ShaderStage.VERTEX, - BufferBindingLayout( - type = BufferBindingType.UNIFORM, - hasDynamicOffset = true, - minBindingSize = Float.SIZE_BYTES * 16L - ) - ), - BindGroupLayoutEntry( - 1, - ShaderStage.VERTEX, - BufferBindingLayout(type = BufferBindingType.READ_ONLY_STORAGE) - ), - BindGroupLayoutEntry( - 2, - ShaderStage.VERTEX, - BufferBindingLayout(type = BufferBindingType.READ_ONLY_STORAGE) + listOf( + BindGroupLayoutDescriptor( + listOf( + Entry( + 0, + setOf(ShaderStage.vertex), + BufferBindingLayout( + type = BufferBindingType.uniform, + hasDynamicOffset = true, + minBindingSize = Float.SIZE_BYTES * 16L ) + ), + Entry( + 1, + setOf(ShaderStage.vertex), + BufferBindingLayout(type = BufferBindingType.readonlystorage) + ), + Entry( + 2, + setOf(ShaderStage.vertex), + BufferBindingLayout(type = BufferBindingType.readonlystorage) ) - ), - BindGroupLayoutDescriptor( - listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) - ) + ) + ), + BindGroupLayoutDescriptor( + listOf( + Entry(0, setOf(ShaderStage.fragment), Entry.TextureBindingLayout()), + Entry(1, setOf(ShaderStage.fragment), Entry.SamplerBindingLayout()) ) ) + ) ) { /** @@ -188,7 +192,7 @@ class SpriteCacheShader( device.createGPUFloatBuffer( "static sprite storage buffer", FloatArray(staticSize), - BufferUsage.STORAGE or BufferUsage.COPY_DST + setOf(BufferUsage.storage, BufferUsage.copydst) ) private var staticSpriteStorageBufferBinding = BufferBinding(spriteStaticStorage) @@ -202,7 +206,7 @@ class SpriteCacheShader( device.createGPUFloatBuffer( "dynamic sprite storage buffer", FloatArray(dynamicSize), - BufferUsage.STORAGE or BufferUsage.COPY_DST + setOf(BufferUsage.storage, BufferUsage.copydst) ) private var dynamicSpriteStorageBufferBinding = BufferBinding(spriteDynamicStorage) @@ -227,7 +231,7 @@ class SpriteCacheShader( device.createBindGroup( BindGroupDescriptor( layouts[1], - listOf(BindGroupEntry(0, texture.view), BindGroupEntry(1, texture.sampler)) + listOf(BindGroupEntry(0, TextureViewBinding(texture.view)), BindGroupEntry(1, SamplerBinding(texture.sampler))) ) ) ) @@ -238,7 +242,7 @@ class SpriteCacheShader( bindGroups: List, dynamicOffsets: List ) { - encoder.setBindGroup(0, bindGroups[0], dynamicOffsets) + encoder.setBindGroup(0, bindGroups[0], dynamicOffsets.map { it.toInt() }) encoder.setBindGroup(1, bindGroups[1]) } @@ -253,20 +257,20 @@ class SpriteCacheShader( logger.debug { "Attempting to write data to static sprite storage buffer that exceeds its current size. Destroying and recreating the buffer..." } - spriteStaticStorage.destroy() - spriteStaticStorage.release() + spriteStaticStorage.close() spriteStaticStorage = device.createGPUFloatBuffer( "static sprite storage buffer", data.toArray(), - BufferUsage.STORAGE or BufferUsage.COPY_DST + setOf(BufferUsage.storage, BufferUsage.copydst) ) staticSpriteStorageBufferBinding = BufferBinding(spriteStaticStorage) return true } else { device.queue.writeBuffer( spriteStaticStorage, - data, + 0L, + data.toArray(), size = min(spriteStaticStorage.size / Float.SIZE_BYTES, data.limit.toLong()) ) } @@ -284,20 +288,20 @@ class SpriteCacheShader( logger.debug { "Attempting to write data to dynamic sprite storage buffer that exceeds its current size. Destroying and recreating the buffer..." } - spriteDynamicStorage.destroy() - spriteDynamicStorage.release() + spriteDynamicStorage.close() spriteDynamicStorage = device.createGPUFloatBuffer( "dynamic sprite storage buffer", data.toArray(), - BufferUsage.STORAGE or BufferUsage.COPY_DST + setOf(BufferUsage.storage, BufferUsage.copydst) ) dynamicSpriteStorageBufferBinding = BufferBinding(spriteDynamicStorage) return true } else { device.queue.writeBuffer( spriteDynamicStorage, - data, + 0L, + data.toArray(), size = min(spriteDynamicStorage.size / Float.SIZE_BYTES, data.limit.toLong()) ) } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/shader/Shader.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/shader/Shader.kt index cca6c12ce..13746c721 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/shader/Shader.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/shader/Shader.kt @@ -1,8 +1,8 @@ package com.littlekt.graphics.shader import com.littlekt.Releasable -import com.littlekt.graphics.webgpu.* import com.littlekt.util.datastructure.fastForEach +import io.ygdrasil.wgpu.* /** * A base shader class to handle creating and customizing the required bind groups without the need @@ -28,7 +28,7 @@ open class Shader( val id: Int = lastId++ /** The [ShaderModule]/ */ - val shaderModule = device.createShaderModule(src) + val shaderModule = device.createShaderModule(ShaderModuleDescriptor(src)) /** The list of [BindGroupLayout]s described by the layout */ val layouts = layout.map { device.createBindGroupLayout(it) } @@ -96,10 +96,10 @@ open class Shader( ) = Unit override fun release() { - shaderModule.release() - layouts.fastForEach { it.release() } - pipelineLayout.release() - bindGroups.forEach { it.release() } + shaderModule.close() + layouts.fastForEach { it.close() } + pipelineLayout.close() + bindGroups.forEach { it.close() } bindGroups.clear() } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/shader/SpriteShader.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/shader/SpriteShader.kt index 2b49a96b0..6fd1b100d 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/shader/SpriteShader.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/shader/SpriteShader.kt @@ -2,9 +2,14 @@ package com.littlekt.graphics.shader import com.littlekt.file.FloatBuffer import com.littlekt.graphics.Texture -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.Device import com.littlekt.math.Mat4 import com.littlekt.util.align +import io.ygdrasil.wgpu.BindGroup +import io.ygdrasil.wgpu.BindGroupDescriptor.BufferBinding +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BufferDescriptor +import io.ygdrasil.wgpu.BufferUsage /** * A base shader class to handle creating a camera uniform [GPUBuffer] and expecting a texture to @@ -37,15 +42,15 @@ abstract class SpriteShader( val buffer = device.createBuffer( BufferDescriptor( - "viewProj", - (Float.SIZE_BYTES * 16) + label = "viewProj", + size = (Float.SIZE_BYTES * 16) .align(device.limits.minUniformBufferOffsetAlignment) .toLong() * cameraDynamicSize, - BufferUsage.UNIFORM or BufferUsage.COPY_DST, - true + usage = setOf(BufferUsage.uniform, BufferUsage.copydst), + mappedAtCreation = true ) ) - buffer.getMappedRange().putFloat(camFloatBuffer.toArray()) + buffer.mapFrom(camFloatBuffer.toArray()) buffer.unmap() buffer @@ -54,11 +59,11 @@ abstract class SpriteShader( /** The [BufferBinding] for [cameraUniformBufferBinding]. */ protected val cameraUniformBufferBinding = BufferBinding( - cameraUniformBuffer, + buffer = cameraUniformBuffer, size = - (Float.SIZE_BYTES * 16) - .align(device.limits.minUniformBufferOffsetAlignment) - .toLong(), + (Float.SIZE_BYTES * 16) + .align(device.limits.minUniformBufferOffsetAlignment) + .toLong(), ) /** @see [createBindGroupsWithTexture] to override. */ @@ -113,13 +118,13 @@ abstract class SpriteShader( fun updateCameraUniform(viewProjection: Mat4, dynamicOffset: Long = 0) = device.queue.writeBuffer( cameraUniformBuffer, - viewProjection.toBuffer(camFloatBuffer), - offset = dynamicOffset * device.limits.minUniformBufferOffsetAlignment, + dynamicOffset * device.limits.minUniformBufferOffsetAlignment.toLong(), + viewProjection.toBuffer(camFloatBuffer).toArray() ) override fun release() { super.release() - cameraUniformBuffer.release() + cameraUniformBuffer.close() } companion object { diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonIndexedMeshGeometry.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonIndexedMeshGeometry.kt index 58d1f9c69..4769909ef 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonIndexedMeshGeometry.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonIndexedMeshGeometry.kt @@ -1,18 +1,18 @@ package com.littlekt.graphics.util -import com.littlekt.graphics.VertexBufferLayout +import com.littlekt.graphics.VertexBufferLayoutView import com.littlekt.math.spatial.BoundingBox /** * A [IndexedMeshGeometry] that calculates the [BoundingBox] of the geometry as well as using * [CommonVertexView] when adding a vertex. * - * @param layout a [VertexBufferLayout] describing the vertex buffer. + * @param layout a [VertexBufferLayoutView] describing the vertex buffer. * @param size the initial size of the vertices and indices buffers * @author Colton Daily * @date 4/10/2024 */ -class CommonIndexedMeshGeometry(layout: VertexBufferLayout, size: Int = INITIAL_SIZE) : +class CommonIndexedMeshGeometry(layout: VertexBufferLayoutView, size: Int = INITIAL_SIZE) : IndexedMeshGeometry(layout, size) { /** Bounds of the mesh. */ val bounds = BoundingBox() diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonMeshGeometry.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonMeshGeometry.kt index 995ddc493..a3e4b15c0 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonMeshGeometry.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonMeshGeometry.kt @@ -1,18 +1,18 @@ package com.littlekt.graphics.util -import com.littlekt.graphics.VertexBufferLayout +import com.littlekt.graphics.VertexBufferLayoutView import com.littlekt.math.spatial.BoundingBox /** * A [MeshGeometry] that calculates the [BoundingBox] of the geometry as well as using * [CommonVertexView] when adding a vertex. * - * @param layout a [VertexBufferLayout] describing the vertex buffer. + * @param layout a [VertexBufferLayoutView] describing the vertex buffer. * @param size the initial size of the vertices and indices buffers * @author Colton Daily * @date 4/10/2024 */ -class CommonMeshGeometry(layout: VertexBufferLayout, size: Int = INITIAL_SIZE) : +class CommonMeshGeometry(layout: VertexBufferLayoutView, size: Int = INITIAL_SIZE) : MeshGeometry(layout, size) { /** Bounds of the mesh. */ val bounds = BoundingBox() diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonVertexView.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonVertexView.kt index 35a9d8a30..d4eee10e9 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonVertexView.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/util/CommonVertexView.kt @@ -3,7 +3,7 @@ package com.littlekt.graphics.util import com.littlekt.file.FloatBuffer import com.littlekt.graphics.MutableColor import com.littlekt.graphics.VertexAttrUsage -import com.littlekt.graphics.VertexAttribute +import com.littlekt.graphics.VertexAttributeView import com.littlekt.log.Logger import com.littlekt.math.MutableVec2f import com.littlekt.math.MutableVec3f @@ -24,7 +24,7 @@ import com.littlekt.math.MutableVec4i class CommonVertexView( vertexSize: Int, vertices: FloatBuffer, - attributes: List, + attributes: List, index: Int ) : VertexView(vertexSize, vertices, attributes, index) { /** The position attribute vector view */ diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/util/IndexedMeshGeometry.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/util/IndexedMeshGeometry.kt index f639479a4..bf378cb30 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/util/IndexedMeshGeometry.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/util/IndexedMeshGeometry.kt @@ -1,7 +1,7 @@ package com.littlekt.graphics.util import com.littlekt.file.ShortBuffer -import com.littlekt.graphics.VertexBufferLayout +import com.littlekt.graphics.VertexBufferLayoutView import kotlin.math.floor import kotlin.math.max import kotlin.math.round @@ -9,12 +9,12 @@ import kotlin.math.round /** * Holds vertex and index data that can be used to render to a mesh. * - * @param layout a [VertexBufferLayout] describing the vertex buffer. + * @param layout a [VertexBufferLayoutView] describing the vertex buffer. * @param size the initial size of the vertices and indices buffers * @author Colton Daily * @date 12/19/2022 */ -open class IndexedMeshGeometry(layout: VertexBufferLayout, size: Int = INITIAL_SIZE) : +open class IndexedMeshGeometry(layout: VertexBufferLayoutView, size: Int = INITIAL_SIZE) : MeshGeometry(layout, size) { /** The indices buffer. */ var indices = ShortBuffer(floor(size * 1.5f).toInt()) diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/util/MeshGeometry.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/util/MeshGeometry.kt index 8d8307ed1..040dabaac 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/util/MeshGeometry.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/util/MeshGeometry.kt @@ -1,7 +1,7 @@ package com.littlekt.graphics.util import com.littlekt.file.FloatBuffer -import com.littlekt.graphics.VertexBufferLayout +import com.littlekt.graphics.VertexBufferLayoutView import com.littlekt.log.Logger import kotlin.math.max import kotlin.math.min @@ -11,12 +11,12 @@ import kotlin.math.round * Holds ONLY vertex data that can be used to render to a mesh. If indexed data is needed, see * [IndexedMeshGeometry]. * - * @param layout a [VertexBufferLayout] describing the vertex buffer. + * @param layout a [VertexBufferLayoutView] describing the vertex buffer. * @param size the initial size of the vertices and indices buffers * @author Colton Daily * @date 12/19/2022 */ -open class MeshGeometry(val layout: VertexBufferLayout, size: Int = INITIAL_SIZE) { +open class MeshGeometry(val layout: VertexBufferLayoutView, size: Int = INITIAL_SIZE) { /** The number of components in each vertex. */ val vertexSize = layout.attributes.sumOf { it.format.components } diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/util/VertexView.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/util/VertexView.kt index da21c035c..9c372159c 100644 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/util/VertexView.kt +++ b/core/src/commonMain/kotlin/com/littlekt/graphics/util/VertexView.kt @@ -2,9 +2,13 @@ package com.littlekt.graphics.util import com.littlekt.file.FloatBuffer import com.littlekt.graphics.MutableColor -import com.littlekt.graphics.VertexAttribute -import com.littlekt.graphics.webgpu.WebGPUVertexAttribute +import com.littlekt.graphics.VertexAttributeView import com.littlekt.math.* +import io.ygdrasil.wgpu.VertexFormat + +private val VertexFormat.isInt: Boolean + get() = name.lowercase().contains("int") + /** * A view of a vertex within the geometry [IndexedMeshGeometry]. If there are multiple vertex usages @@ -22,7 +26,7 @@ import com.littlekt.math.* open class VertexView( val vertexSize: Int, var vertices: FloatBuffer, - val attributes: List, + val attributes: List, index: Int, ) : MutableVec3f() { @@ -35,7 +39,7 @@ open class VertexView( private val _attributesViews = mutableMapOf() - /** A view into the vertex attribute, mapped by [WebGPUVertexAttribute.shaderLocation]. */ + /** A view into the vertex attribute, mapped by [VertexAttribute.shaderLocation]. */ val attributeViews: Map get() = _attributesViews @@ -116,32 +120,32 @@ open class VertexView( } } - /** @return a [FloatView] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getFloatAttribute(attribute: VertexAttribute): FloatView? = + /** @return a [FloatView] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getFloatAttribute(attribute: VertexAttributeView): FloatView? = attributeViews[attribute.key] as FloatView? - /** @return a [IntView] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getIntAttribute(attribute: VertexAttribute): IntView? = + /** @return a [IntView] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getIntAttribute(attribute: VertexAttributeView): IntView? = attributeViews[attribute.shaderLocation] as IntView? - /** @return a [MutableVec2f] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getVec2fAttribute(attribute: VertexAttribute): MutableVec2f? = + /** @return a [MutableVec2f] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getVec2fAttribute(attribute: VertexAttributeView): MutableVec2f? = attributeViews[attribute.key] as MutableVec2f? - /** @return a [MutableVec3f] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getVec3fAttribute(attribute: VertexAttribute): MutableVec3f? = + /** @return a [MutableVec3f] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getVec3fAttribute(attribute: VertexAttributeView): MutableVec3f? = attributeViews[attribute.key] as MutableVec3f? - /** @return a [MutableVec4f] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getVec4fAttribute(attribute: VertexAttribute): MutableVec4f? = + /** @return a [MutableVec4f] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getVec4fAttribute(attribute: VertexAttributeView): MutableVec4f? = attributeViews[attribute.key] as MutableVec4f? - /** @return a [MutableVec4i] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getVec4iAttribute(attribute: VertexAttribute): MutableVec4i? = + /** @return a [MutableVec4i] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getVec4iAttribute(attribute: VertexAttributeView): MutableVec4i? = attributeViews[attribute.key] as MutableVec4i? - /** @return a [MutableColor] of the given [VertexAttribute], if it exists; `null` otherwise. */ - fun getColorAttribute(attribute: VertexAttribute): MutableColor? = + /** @return a [MutableColor] of the given [VertexAttributeView], if it exists; `null` otherwise. */ + fun getColorAttribute(attribute: VertexAttributeView): MutableColor? = attributeViews[attribute.key]?.let { ColorWrapView(it as Vec4fView) } /** A view wrapper around a [Float]. */ diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/binding.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/binding.kt deleted file mode 100644 index 7ea563b8f..000000000 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/binding.kt +++ /dev/null @@ -1,176 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable - -/** A resource that can be bound to a pipeline. */ -expect interface IntoBindingResource - -/** - * An element of a [BindGroupDescriptor], consisting of bind-able resource and the slot to bind it - * to. - * - * @param binding slot for which binding provides resource. Corresponds to an entry of the same - * binding index in the [BindGroupLayoutDescriptor]. - * @param resource resource to attach to the binding. - */ -data class BindGroupEntry(val binding: Int, val resource: IntoBindingResource) - -/** - * Describes a group of bindings and the resources to be bound. For use with - * [Device.createBindGroup]. - * - * @param layout the [BindGroupLayout] that corresponds to this bind group. - * @param entries a list of resources to bind to this bind group. - * @param label debug label of a [BindGroup]. - */ -data class BindGroupDescriptor( - val layout: BindGroupLayout, - val entries: List, - val label: String? = null -) { - constructor( - layout: BindGroupLayout, - entry: BindGroupEntry, - label: String? = null - ) : this(layout, listOf(entry), label) -} - -/** - * Handle to a binding group. - * - * A `BindGroup` represents the set of resources bound to the bindings described by a - * [BindGroupLayout]. It can be created with [Device.createBindGroup]. A `BindGroup` can be bound to - * a particular [RenderPassEncoder] with [RenderPassEncoder.setBindGroup], or to a - * [ComputePassEncoder] with [ComputePassEncoder.setBindGroup]. - */ -expect class BindGroup : Releasable { - override fun release() -} - -/** - * Describes the segment of a buffer to bind. - * - * @param buffer the buffer to bind - * @param offset base offset of the buffer, in bytes. - * @param size size of the binding in bytes - */ -expect class BufferBinding(buffer: GPUBuffer, offset: Long = 0, size: Long = buffer.size - offset) : - IntoBindingResource - -/** Describes a generic binding layout. */ -expect abstract class BindingLayout() - -/** - * Describes the layout of a [BufferBinding]. - * - * @param type sub-type of the buffer binding. - * @param hasDynamicOffset indicates that the binding has a dynamic offset. One offset must be - * passed to [RenderPassEncoder.setBindGroup] for each dynamic binding in increasing order of - * binding number. - * @param minBindingSize the minimum size for a [BufferBinding] matching this entry, in bytes. - */ -expect class BufferBindingLayout( - type: BufferBindingType = BufferBindingType.UNIFORM, - hasDynamicOffset: Boolean = false, - minBindingSize: Long = 0, -) : BindingLayout - -/** - * Describes the layout of binding a texture. - * - * ```wgsl - * @group(0) @binding(0) - * var t: texture_2d; - * ``` - * - * @param sampleType sample type of the texture binding. - * @param viewDimension dimension of the texture view that is going to be sampled. - * @param multisampled `true` if the texture has a sample count greater than 1. If this is `true`, - * the texture must be read from shaders with `texture1DMS`, `texture2DMS`, or `texture3DMS`, - * depending on dimension. - */ -expect class TextureBindingLayout( - sampleType: TextureSampleType = TextureSampleType.FLOAT, - viewDimension: TextureViewDimension = TextureViewDimension.D2, - multisampled: Boolean = false, -) : BindingLayout - -/** - * A sampler binding layout that can be used to sample a texture. - * - * ```wgsl - * @group(0) @binding(0) - * var s: sampler; - * ``` - * - * @param type the sampler type of the sampler binding. - */ -expect class SamplerBindingLayout(type: SamplerBindingType = SamplerBindingType.FILTERING) : - BindingLayout - -/** - * Describes a single binding inside a bind group. - * - * @param binding binding index. Must match shader index and be unique inside a [BindGroupLayout]. A - * binding of index 1, would be described as layout(set = 0, binding = 1) uniform in shaders. - * @param visibility which shader stages can see this binding. - * @param bindingLayout the binding layout to be used in the [BindGroupLayout]. - */ -expect class BindGroupLayoutEntry( - binding: Int, - visibility: ShaderStage, - bindingLayout: BindingLayout -) - -/** - * Describes a [BindGroupLayout]. For use with [Device.createBindGroupLayout]. - * - * @param entries a list of entries in this [BindGroupLayout]. - * @param label debug label of a [BindGroupLayout]. - */ -data class BindGroupLayoutDescriptor( - val entries: List, - val label: String? = null -) { - constructor(entry: BindGroupLayoutEntry) : this(listOf(entry)) -} - -/** - * Handle to a binding group layout. - * - * A `BindGroupLayout` is a handle to the GPU-side layout of a binding group. It can be used to - * create a [BindGroupDescriptor] object, which in turn can be used to create a [BindGroup] object - * with [Device.createBindGroup]. A series of `BindGroupLayout`s can also be sued to create a - * [PipelineLayoutDescriptor], which can be used to create a [PipelineLayout]. - * - * It can be created with [Device.createBindGroupLayout]. - */ -expect class BindGroupLayout : Releasable { - override fun release() -} - -/** - * A handle to a pipeline layout. - * - * A `PipelineLayout` describes the available binding groups of a pipeline. It can be created with - * [Device.createPipelineLayout]. - */ -expect class PipelineLayout : Releasable { - override fun release() -} - -/** - * Describes a [PipelineLayout]. - * - * For use with [Device.createPipelineLayout]. - * - * @param bindGroupLayouts bind groups that this pipeline uses. The first entry will provide all the - * bindings for "set = 0", second entry will provide all the binding for "set = 1" etc. - * @param label debug label of a [PipelineLayout]. - */ -expect class PipelineLayoutDescriptor( - bindGroupLayouts: List = emptyList(), - label: String? = null -) { - constructor(bindGroupLayout: BindGroupLayout, label: String? = null) -} diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/command.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/command.kt deleted file mode 100644 index d4fd926da..000000000 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/command.kt +++ /dev/null @@ -1,855 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable -import com.littlekt.graphics.Color - -/** - * A handle to a command buffer on the GPU. - * - * A `CommandBuffer` represents a complete sequence of commands that may be submitted to a command - * queue with [Queue.submit]. A `CommandBuffer` is obtained by recording a series of commands to a - * [CommandEncoder] and then calling [CommandEncoder.finish]. - */ -expect class CommandBuffer : Releasable { - override fun release() -} - -/** - * View of a texture which can be used to copy to/from a buffer/texture. - * - * @param texture the texture to be copied to/from. - * @param mipLevel the target mip level of the texture. - * @param origin the base texel of the texture in the select [mipLevel]. - */ -data class TextureCopyView( - val texture: WebGPUTexture, - val mipLevel: Int = 0, - val origin: Origin3D = Origin3D(0, 0, 0) -) - -/** - * Layout of a texture in a buffer's memory. - * - * The bytes per row and rows per image can be hard to figure otu so here are some examples: - * - * |Resolution|Format|Bytes per block|Pixels per block|Bytes per row |Rows per image | - * |----------|------|---------------|----------------|--------------------------------|----------------| - * |256x256 |RGBA8 |4 |1 * 1 * 1 |256 * 4 = 1024 |None | - * |32x16x8 |RGBA8 |4 |1 * 1 * 1 |32 * 4 = 128 padded to 256 = 256|None | - * |256x256 |BC3 |16 |4 * 4 * 1 |16 * (256 / 4) = 1024 = 1024 |None | - * |64x64x8 |BC3 |16 |4 * 4 * 1 |16 * (64 / 4) = 256 = 256 |64 / 4 = 16 = 16| - * - * @param bytesPerRow Bytes per “row” in an image. A row is one row of pixels or of compressed - * blocks in the x direction. This value is required if there are multiple rows (i.e. height or - * depth is more than one pixel or pixel block for compressed textures). Must be a multiple of 256 - * for [CommandEncoder.copyBufferToTexture] and [CommandEncoder.copyTextureToBuffer]. You must - * manually pad the image such that this is a multiple of 256. It will not affect the image data. - * [Queue.writeTexture] does not have this requirement. Must be a multiple of the texture block - * size. For non-compressed textures, this is 1. - * @param rowsPerImage “Rows” that make up a single “image”. A row is one row of pixels or of - * compressed blocks in the x direction. An image is one layer in the z direction of a 3D image or - * 2DArray texture. The amount of rows per image may be larger than the actual amount of rows of - * data. Required if there are multiple images (i.e. the depth is more than one). - * @param offset Offset into the buffer that is the start of the texture. Must be a multiple of - * texture block size. For non-compressed textures, this is 1. - */ -data class TextureDataLayout(val bytesPerRow: Int, val rowsPerImage: Int, val offset: Long = 0) - -/** - * View of a buffer which can be used to copy to/from a texture. - * - * @param buffer the buffer to be copied to/from. - * @param layout the layout of the texture data in this buffer. - */ -data class BufferCopyView(val buffer: GPUBuffer, val layout: TextureDataLayout) - -/** - * Encodes a series of GPU operations. - * - * A command encoder can record [RenderPassEncoder]es, [ComputePassEncoder]es, and transfer - * operations between driver-managed resources like [GPUBuffer]s and [WebGPUTexture]s. - * - * When finished recording, call [CommandEncoder.finish] to obtain a [CommandBuffer] which may be - * submitted for execution. - */ -expect class CommandEncoder : Releasable { - - /** - * Begins recording of a [RenderPassEncoder]. - * - * @return a [RenderPassEncoder] which records a single render pass. - */ - fun beginRenderPass(desc: RenderPassDescriptor): RenderPassEncoder - - /** - * Finishes recording. - * - * @return a [CommandBuffer] that can be submitted for execution. - */ - fun finish(): CommandBuffer - - /** Copy data from a buffer to a texture. */ - fun copyBufferToTexture( - source: BufferCopyView, - destination: TextureCopyView, - copySize: Extent3D - ) - - /** - * Begins recording of a compute pass. - * - * @param label debug label for a [ComputePassEncoder] - * @return a [ComputePassEncoder] which records a single compute pass. - */ - fun beginComputePass(label: String? = null): ComputePassEncoder - - /** Copy data from one buffer to another. */ - fun copyBufferToBuffer( - source: GPUBuffer, - destination: GPUBuffer, - sourceOffset: Int = 0, - destinationOffset: Int = 0, - size: Long = destination.size - destinationOffset - ) - - /** Copy data from a texture to a buffer. */ - fun copyTextureToBuffer(source: TextureCopyView, dest: BufferCopyView, size: Extent3D) - - override fun release() -} - -/** - * Describes a programmable pipeline stage. - * - * @param module the compiled shader module for this stage - * @param entryPoint the name of the entry point in the compiled shader. There must be a function - * with this name in the shader. - */ -data class ProgrammableStage(val module: ShaderModule, val entryPoint: String) - -/** - * Describes a render (graphics) pipeline. - * - * For use with [Device.createRenderPipeline] - * - * @param layout The layout of bind groups for this pipeline. - * @param vertex The compiled vertex stage, its entry point, and the input buffers layout. - * @param fragment The compiled fragment stage, its entry point, and the color targets. - * @param primitive The properties of the pipeline at the primitive assembly and rasterization - * level. - * @param depthStencil The effect of draw calls on the depth and stencil aspects of the output - * target, if any. - * @param multisample The multi-sampling properties of the pipeline. - * @param label debug label of a buffer. - */ -data class RenderPipelineDescriptor( - val layout: PipelineLayout, - val vertex: VertexState, - val fragment: FragmentState?, - val primitive: PrimitiveState = PrimitiveState(), - val depthStencil: DepthStencilState? = null, - val multisample: MultisampleState = MultisampleState(), - val label: String? = null -) - -/** - * Describes the multi-sampling state of a render pipeline. - * - * @param count the number of samples calculated per pixel (for MSAA). For non-multisampled - * textures, this should be `1`. - * @param mask bitmask that restricts the samples of a pixel modifier by this pipeline. All samples - * can be enabled using `0xFFFFFFF` - * @param alphaToCoverageEnabled when enabled, produces another sample mask per pixel based on the - * alpha output value, that is ANDed with the [mask] and the primitive coverage to restrict the - * set of samples affected by a primitive. - * - * The implicit mask produced for alpha of zero is guaranteed to be zero, and for alpha of one is - * guaranteed to be all 1-s. - */ -data class MultisampleState( - val count: Int = 1, - val mask: Int = 0xFFFFFFF, - val alphaToCoverageEnabled: Boolean = false, -) - -/** - * Describes the depth/stencil state in a render pipeline. - * - * @param format format of the depth/stencil buffer must be special depth format. Must match the - * format of the depth/stencil attachment in [CommandEncoder.beginRenderPass]. - * @param depthWriteEnabled if disabled, depth will not be written to. - * @param depthCompare comparison function used to compare depth values in the depth test. - * @param stencil the stencil state. - * @param bias the depth bias state. - */ -data class DepthStencilState( - val format: TextureFormat, - val depthWriteEnabled: Boolean, - val depthCompare: CompareFunction, - val stencil: StencilState = - StencilState(StencilFaceState.IGNORE, StencilFaceState.IGNORE, 0xF, 0Xf), - val bias: DepthBiasState = DepthBiasState(0, 0f, 0f) -) { - companion object { - fun depthWrite(format: TextureFormat): DepthStencilState = - DepthStencilState( - format = format, - depthWriteEnabled = true, - depthCompare = CompareFunction.LESS_EQUAL - ) - - fun depthRead(format: TextureFormat): DepthStencilState = - DepthStencilState( - format = format, - depthWriteEnabled = false, - depthCompare = CompareFunction.LESS_EQUAL - ) - - fun stencilWrite(format: TextureFormat): DepthStencilState = - DepthStencilState( - format = format, - depthWriteEnabled = true, - depthCompare = CompareFunction.LESS_EQUAL, - stencil = StencilState(StencilFaceState.WRITE, StencilFaceState.WRITE, 0xF, 0xF) - ) - - fun stencilRead(format: TextureFormat): DepthStencilState = - DepthStencilState( - format = format, - depthWriteEnabled = true, - depthCompare = CompareFunction.LESS_EQUAL, - stencil = StencilState(StencilFaceState.READ, StencilFaceState.READ, 0xF, 0xF) - ) - } -} - -/** - * State of the stencil operation (fixed-pipeline stage). - * - * For use in [DepthStencilState]. - * - * @param front front face mode. - * @param back back face mode. - * @param readMask stencil values are AND'd with this mask when reading and writing from the stencil - * buffer. Only lower 8 bits are used. - * @param writeMask stencil values are AND'd with this mask when writing to the stencil buffer. Only - * lower 8 bits are used. - */ -data class StencilState( - val front: StencilFaceState, - val back: StencilFaceState, - val readMask: Int, - val writeMask: Int -) - -/** - * Describes the stencil state in a render pipeline. - * - * If you are not using a stencil state, set this to [StencilFaceState.IGNORE]. - */ -data class StencilFaceState( - /** - * Comparison function that determines if the [failOp] or [passOp] is used on the stencil - * buffer. - */ - val compare: CompareFunction, - /** Operation that is performed when stencil test fails. */ - val failOp: StencilOperation, - /** Operation that is performed when depth test fails but stencil test succeeds. */ - val depthFailOp: StencilOperation, - /** Operation that is performed when stencil test succeeds. */ - val passOp: StencilOperation -) { - companion object { - /** Ignore the stencil state for the face. */ - val IGNORE: StencilFaceState = - StencilFaceState( - compare = CompareFunction.ALWAYS, - failOp = StencilOperation.KEEP, - depthFailOp = StencilOperation.KEEP, - passOp = StencilOperation.KEEP - ) - - /** Write stencil state for the face. */ - val WRITE: StencilFaceState = - StencilFaceState( - compare = CompareFunction.ALWAYS, - failOp = StencilOperation.KEEP, - depthFailOp = StencilOperation.KEEP, - passOp = StencilOperation.REPLACE - ) - - /** Read stencil state for the face. */ - val READ: StencilFaceState = - StencilFaceState( - compare = CompareFunction.EQUAL, - failOp = StencilOperation.KEEP, - depthFailOp = StencilOperation.KEEP, - passOp = StencilOperation.KEEP - ) - } -} - -/** - * Describes the biasing setting for the depth target. - * - * For use in [DepthStencilState]. - * - * @param constant constant depth biasing factor, in basic units of the depth format - * @param slopeScale slope depth biasing factor. - * @param clamp depth bias clamp value (absolute). - */ -data class DepthBiasState(val constant: Int, val slopeScale: Float, val clamp: Float) - -/** - * Describes the vertex processing in a render pipeline. - * - * For use in [RenderPipelineDescriptor]. - * - * @param module the compiled shader module for this stage - * @param entryPoint The name of the entry point in the compiled shader. There must be a function - * with this name in the shader. - * @param buffers The format of any vertex buffers used with this pipeline. - */ -data class VertexState( - val module: ShaderModule, - val entryPoint: String, - val buffers: List = emptyList() -) { - constructor( - module: ShaderModule, - entryPoint: String, - buffer: WebGPUVertexBufferLayout - ) : this(module, entryPoint, listOf(buffer)) -} - -/** - * Describes the state of primitive assembly and rasterization in a render pipeline. - * - * @param topology the primitive topology used to interpret vertices. - * @param stripIndexFormat when drawing strip topologies with indices, this is the required format - * for the index buffer. This has no effect on non-indexed or non-strip draws. - * @param frontFace the face to consider the front for the purpose of culling and stencil - * operations. - * @param cullMode the face culling mode. - */ -data class PrimitiveState( - val topology: PrimitiveTopology = PrimitiveTopology.TRIANGLE_LIST, - val stripIndexFormat: IndexFormat? = null, - val frontFace: FrontFace = FrontFace.CCW, - val cullMode: CullMode = CullMode.NONE, -) - -/** - * Describes the fragment processing in a render pipeline. - * - * For use in [RenderPipelineDescriptor]. - * - * @param module the compiled shader module for this stage. - * @param entryPoint the name of the entry point in the compiled shader. There must be a function - * with this name in the shader. - * @param targets the color state of the render targets. - */ -data class FragmentState( - val module: ShaderModule, - val entryPoint: String, - val targets: List -) { - constructor( - module: ShaderModule, - entryPoint: String, - target: ColorTargetState - ) : this(module, entryPoint, listOf(target)) -} - -/** - * Describes the color state of a render pipeline. - * - * @param format the [TextureFormat] of the image that this pipeline will render to. Must match the - * format of the corresponding color attachment in [CommandEncoder.beginRenderPass]. - * @param blendState the blending that is used for this pipeline. - * @param writeMask mask which enables/disables writes to different color/alpha channels. - */ -data class ColorTargetState( - val format: TextureFormat, - val blendState: BlendState?, - val writeMask: ColorWriteMask -) - -/** - * Describe the blend state of a render pipeline, with [ColorTargetState]. - * - * @param color the color equation - * @param alpha the alpha equation - */ -data class BlendState( - val color: BlendComponent = BlendComponent(), - val alpha: BlendComponent = BlendComponent() -) { - companion object { - /** Standard alpha blending. */ - val Alpha: BlendState = - BlendState( - color = BlendComponent(dstFactor = BlendFactor.ONE_MINUS_SRC_ALPHA), - alpha = BlendComponent(dstFactor = BlendFactor.ONE_MINUS_SRC_ALPHA) - ) - - /** Fully oqaque, no alpha, blending. */ - val Opaque: BlendState = BlendState() - - /** Non-premultiplied, alpha blending. */ - val NonPreMultiplied: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.SRC_ALPHA, - dstFactor = BlendFactor.ONE_MINUS_SRC_ALPHA - ), - alpha = - BlendComponent( - srcFactor = BlendFactor.SRC_ALPHA, - dstFactor = BlendFactor.ONE_MINUS_SRC_ALPHA - ) - ) - - val Add: BlendState = - BlendState( - color = - BlendComponent(srcFactor = BlendFactor.SRC_ALPHA, dstFactor = BlendFactor.ONE), - alpha = - BlendComponent(srcFactor = BlendFactor.SRC_ALPHA, dstFactor = BlendFactor.ONE) - ) - - val Subtract: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.SRC_ALPHA, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.REVERSE_SUBTRACT - ), - alpha = - BlendComponent( - srcFactor = BlendFactor.SRC_ALPHA, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.REVERSE_SUBTRACT - ), - ) - - val Difference: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.ONE_MINUS_DST_COLOR, - dstFactor = BlendFactor.ONE_MINUS_SRC_COLOR, - operation = BlendOperation.ADD - ), - ) - - val Multiply: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.DST_COLOR, - dstFactor = BlendFactor.ZERO, - operation = BlendOperation.ADD - ), - alpha = - BlendComponent( - srcFactor = BlendFactor.DST_ALPHA, - dstFactor = BlendFactor.ZERO, - operation = BlendOperation.ADD - ) - ) - - val Lighten: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.ONE, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.MAX - ), - alpha = - BlendComponent( - srcFactor = BlendFactor.ONE, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.MAX - ), - ) - - val Darken: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.ONE, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.MIN - ), - alpha = - BlendComponent( - srcFactor = BlendFactor.ONE, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.MIN - ), - ) - - val Screen: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.ONE_MINUS_DST_COLOR, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.ADD - ) - ) - - val LinearDodge: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.ONE, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.ADD - ) - ) - - val LinearBurn: BlendState = - BlendState( - color = - BlendComponent( - srcFactor = BlendFactor.ONE, - dstFactor = BlendFactor.ONE, - operation = BlendOperation.REVERSE_SUBTRACT - ) - ) - } -} - -/** - * Vertex inputs (attributes) to shaders. - * - * @param format the format of the input - * @param offset byte offset of the start of the input - * @param shaderLocation location for this input. Must match the location in the shader. - */ -data class WebGPUVertexAttribute( - val format: VertexFormat, - val offset: Long, - val shaderLocation: Int -) - -/** - * Describes how the vertex buffer is interpreted. - * - * For use in [VertexState]. - * - * @param arrayStride the stride, in bytes, between elements of this buffer. - * @param stepMode how often this vertex buffer is "stepped" forward. - * @param attributes the list of attributes which comprise a single vertex. - */ -data class WebGPUVertexBufferLayout( - val arrayStride: Long, - val stepMode: VertexStepMode, - val attributes: List -) { - constructor( - arrayStride: Long, - stepMode: VertexStepMode, - attribute: WebGPUVertexAttribute - ) : this(arrayStride, stepMode, listOf(attribute)) -} - -/** - * Describes a blend component of a [BlendState]. - * - * @param srcFactor multiplier for the source, which is produced by the fragment shader. - * @param dstFactor multiplier for the destination, which is stored in the target. - * @param operation the binary operation applied to the source and destination, multiplied by their - * respective factors. - */ -data class BlendComponent( - var srcFactor: BlendFactor = BlendFactor.ONE, - var dstFactor: BlendFactor = BlendFactor.ZERO, - var operation: BlendOperation = BlendOperation.ADD -) - -/** - * Handle to a rendering (graphics) pipeline, - * - * A `RenderPipeline` object represents a graphics pipeline and its stages, bindings, vertex buffers - * and targets. It can be created with [Device.createRenderPipeline]. - */ -expect class RenderPipeline : Releasable { - override fun release() -} - -/** - * An in-progress recording of a render pass: a list of render commands in a [CommandEncoder]. - * - * It can be created with [CommandEncoder.beginRenderPass], whose [RenderPassDescriptor] specifies - * the attachments (textures) that will be rendered to. - * - * Most of the methods on `RenderPassEncoder` serve one of two purposes, identifiable by their - * names: - * * `draw*()`: drawing (that is, encoding a render command, which, when executed by the GPU, will - * rasterize something and execute shaders). - * * `set*()`: setting part of the render state for future drawing commands. - * - * A render pass may contain any number of drawing commands, and before/between each command the - * render state may be updated however you wish; each drawing command will be executed using the - * render state that has been set when the `draw*()` function is called. - */ -expect class RenderPassEncoder : Releasable { - /** A label that can be used to identify the object in error messages or warnings. */ - val label: String? - - /** - * Sets the active render pipeline. - * - * Subsequent draw calls will exhibit the behavior defined by pipeline. - */ - fun setPipeline(pipeline: RenderPipeline) - - /** - * Draws primitives using the active vertex buffers. - * - * The active vertex buffers can be set with [setVertexBuffer]. - * - * Fails if indices range is outside of the range of the vertices range of any set vertex - * buffer. - * - * This drawing command uses the current render state, as set by preceding `set*()` methods. It - * is not affected by changes to the state that are performed after it is called. - * - * @param vertexCount the amount of vertices to draw - * @param instanceCount Range of Instances to draw. Use 0..1 if instance buffers are not used. - * E.g.of how its used internally - * @param firstVertex the offset into the vertex buffers, in vertices, to begin drawing from - * @param firstInstance a number defining the first instance to draw. - */ - fun draw(vertexCount: Int, instanceCount: Int, firstVertex: Int = 0, firstInstance: Int = 0) - - /** Completes recording of the render pass commands sequence. */ - fun end() - - /** - * Assign a vertex buffer to a slot. - * - * Subsequent calls to [draw] and [drawIndexed] on this [RenderPassEncoder] will use [buffer] as - * one of the source vertex buffers. - * - * The [slot] refers to the index of the matching descriptor in [VertexState.buffers]. - */ - fun setVertexBuffer( - slot: Int, - buffer: GPUBuffer, - offset: Long = 0, - size: Long = buffer.size - offset - ) - - /** - * Draws indexed primitives using the active index buffer and the active vertex buffers. - * - * The active index buffer can be set with [setIndexBuffer] The active vertex buffers can be set - * with [setVertexBuffer]. - * - * Fails if indices range is outside of the range of the indices range of any set index buffer. - * - * This drawing command uses the current render state, as set by preceding `set*()` methods. It - * is not affected by changes to the state that are performed after it is called. - * - * @param indexCount the amount of indices to draw - * @param instanceCount Range of Instances to draw. Use 0..1 if instance buffers are not used. - * E.g.of how its used internally - * @param firstIndex the offset to of the indices to begin drawing from - * @param baseVertex value added to each index value before indexing into the vertex buffers. - * @param firstInstance a number defining the first instance to draw. - */ - fun drawIndexed( - indexCount: Int, - instanceCount: Int, - firstIndex: Int = 0, - baseVertex: Int = 0, - firstInstance: Int = 0 - ) - - /** - * Sets the active index buffer. - * - * Subsequent calls to [drawIndexed] on this [RenderPassEncoder] will use buffer as the source - * index buffer. - */ - fun setIndexBuffer( - buffer: GPUBuffer, - indexFormat: IndexFormat, - offset: Long = 0, - size: Long = buffer.size - offset - ) - - /** - * Sets the active bind group for a given bind group index. The bind group layout in the active - * pipeline when any `draw*()` method is called must match the layout of this bind group. - * - * If the bind group have dynamic offsets, provide them in binding order. - * - * Subsequent draw calls’ shader executions will be able to access data in these bind groups. - */ - fun setBindGroup(index: Int, bindGroup: BindGroup, dynamicOffsets: List = emptyList()) - - /** - * Sets the viewport used during the rasterization stage to linear map from normalized device - * coordinates to viewport coordinates. - * - * @param x min x value of the viewport in pixels - * @param y min y value of the viewport in pixels - * @param width width of the viewport in pixels - * @param height height of the viewport in pixels - * @param minDepth min depth value of the viewport - * @param maxDepth max depth value of the viewport - */ - fun setViewport( - x: Int, - y: Int, - width: Int, - height: Int, - minDepth: Float = 0f, - maxDepth: Float = 1f - ) - - /** - * Sets the scissor rectangle used during the rasterization stage. After transformation into - * viewport coordinates any fragments which fall outside the scissor rectnagle will be - * discarded. - * - * @param x min x value of the scissor rectangle in pixels - * @param y min y value of the scissor rectangle in pixels - * @param width width of the scissor rectangle in pixels - * @param height height of the scissor rectangle in pixels - */ - fun setScissorRect(x: Int, y: Int, width: Int, height: Int) - - override fun release() -} - -/** - * Describes a color attachment to a [RenderPassEncoder]. - * - * For use with a [RenderPassDescriptor]. - * - * @param view the view to use as an attachment - * @param loadOp the load operation that will be performed on this color attachment. - * @param storeOp the store operation that will be performed on this color attachment. - * @param clearColor the color to clear the view - * @param resolveTarget the view that will receive the resolved output if multisampling is used. If - * set, it is always written to, regardless of how [loadOp] or [storeOp] is configured. - */ -data class RenderPassColorAttachmentDescriptor( - val view: TextureView, - val loadOp: LoadOp, - val storeOp: StoreOp, - val clearColor: Color? = null, - val resolveTarget: TextureView? = null -) - -/** - * Describes a depth/stencil attachment to a [RenderPassEncoder]. - * - * For use with a [RenderPassDescriptor]. - * - * @param view the view to use as an attachment. - * @param depthClearValue indicates the value to clear the views depth component prior to executing - * the render pass. Ignored if [depthLoadOp] is not [LoadOp.CLEAR]. Must be between `0f` and `1f`. - * @param depthLoadOp the load operation that will be performed on the depth part of this - * attachment. - * @param depthStoreOp the store operation that will be performed on the depth part of this - * attachment. - * @param depthReadOnly Indicates that the depth component of [view] is read only. - * @param stencilClearValue indicates the value to clear the views stencil component prior to - * executing the render pass. Ignored if [stencilLoadOp] is not [LoadOp.CLEAR]. - * @param stencilLoadOp the load operation that will be performed on the stencil part of this - * attachment. - * @param stencilStoreOp the store operation that will be performed on the stencil part of this - * attachment. - * @param stencilReadOnly Indicates that the stencil component of [view] is read only. - */ -data class RenderPassDepthStencilAttachmentDescriptor( - val view: TextureView, - val depthClearValue: Float, - val depthLoadOp: LoadOp?, - val depthStoreOp: StoreOp?, - val depthReadOnly: Boolean = false, - val stencilClearValue: Int = 0, - val stencilLoadOp: LoadOp? = null, - val stencilStoreOp: StoreOp? = null, - val stencilReadOnly: Boolean = false -) - -/** - * Describes the attachments of a render pass. - * - * For use with [CommandEncoder.beginRenderPass]. - * - * @param colorAttachments the color attachments of the render pass. - * @param depthStencilAttachment the depth stencil attachment of the render pass, if any. - * @param label debug label of a [RenderPassEncoder]. - */ -data class RenderPassDescriptor( - val colorAttachments: List, - val depthStencilAttachment: RenderPassDepthStencilAttachmentDescriptor? = null, - val label: String? = null -) - -/** - * Describes a compute pipeline. For use with [Device.createComputePipeline]. - * - * @param layout the layout of bind groups for this pipeline. - * @param compute the programmable stage descriptor for this pipeline - * @param label debug label of a [ComputePipeline]. - */ -data class ComputePipelineDescriptor( - val layout: PipelineLayout, - val compute: ProgrammableStage, - val label: String? = null -) - -/** - * Handle to a compute pipeline. - * - * A `ComputePipeline` object represents a compute pipeline and its single shader stage. It can be - * created with [Device.createComputePipeline]. - */ -expect class ComputePipeline : Releasable { - override fun release() -} - -/** - * In-progress recording of a compute pass. It can be created with - * [CommandEncoder.beginComputePass]. - */ -expect class ComputePassEncoder : Releasable { - - /** Sets the active compute pipeline. */ - fun setPipeline(pipeline: ComputePipeline) - - /** - * Sets the active bind group for a given bind group index. This bind group layout in the active - * pipeline when the `[dispatchWorkgroups]` function is called must match the layout of this - * bind group. - */ - fun setBindGroup(index: Int, bindGroup: BindGroup) - - /** - * Dispatches the compute work operations. - * - * @param workgroupCountX denote number of work groups in x-dimension - * @param workgroupCountY denote number of work groups in y-dimension - * @param workgroupCountZ denote number of work groups in z-dimension - */ - fun dispatchWorkgroups(workgroupCountX: Int, workgroupCountY: Int = 1, workgroupCountZ: Int = 1) - - /** End the recording of this compute pass. */ - fun end() - - override fun release() -} diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/enums.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/enums.kt deleted file mode 100644 index 4227078b4..000000000 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/enums.kt +++ /dev/null @@ -1,1010 +0,0 @@ -package com.littlekt.graphics.webgpu - -import kotlin.jvm.JvmInline - -/** Primitive type the input mesh is composed of. */ -enum class PrimitiveTopology { - /** Vertex data is a list of points. Each vertex is a new point. */ - POINT_LIST, - - /** - * Vertex data is a list of lines. Each pair of vertices composes a new line. - * - * Vertices `0 1 2 3` create two lines `0 1` and `2 3`. - */ - LINE_LIST, - - /** - * Vertex data is a strip of lines. Each set of two adjacent vertices form a line. - * - * Vertices `0 1 2 3` create three lines `0 1`, `1 2`, and `2 3`. - */ - LINE_STRIP, - - /** - * Vertex data is a list of triangles. Each set of 3 vertices composes a new triangle. - * - * Vertices `0 1 2 3 4 5` create two triangles `0 1 2` and `3 4 5`. - */ - TRIANGLE_LIST, - - /** - * Vertex data is a triangle strip. Each set of three adjacent vertices form a triangle. - * - * Vertices `0 1 2 3 4 5` create four triangles `0 1 2`, `2 1 3`, `2 3 4`, and `4 3 5`. - */ - TRIANGLE_STRIP -} - -/** Vertex winding order which classifies the "front" face of a triangle. */ -enum class FrontFace { - /** - * Triangles with vertices in counter-clockwise order are considered the front face. - * - * This is the default with right-handed coordinate spaces. - */ - CCW, - - /** - * Triangles with vertices in clockwise order are considered the front face. - * - * This is the default with left-handed coordinate spaces. - */ - CW -} - -/** Face of a vertex. */ -enum class CullMode { - /** Neither used. */ - NONE, - - /** Front face. */ - FRONT, - - /** Back face. */ - BACK -} - -/** - * The usages determine what kind of memory the texture is allocated from and what actions the - * texture can partake in. - */ -@JvmInline -value class TextureUsage(val usageFlag: Int) { - infix fun or(other: TextureUsage): TextureUsage = TextureUsage(usageFlag or other.usageFlag) - - infix fun and(other: TextureUsage): TextureUsage = TextureUsage(usageFlag and other.usageFlag) - - companion object { - /** Allows a texture to be the source in a copy operation */ - val COPY_SRC: TextureUsage = TextureUsage(0x01) - - /** - * Allows a texture to be the destination of a copy operation such as - * [CommandEncoder.copyBufferToTexture] - */ - val COPY_DST: TextureUsage = TextureUsage(0x02) - - /** Allows a texture to be a sampled texture in a bind group */ - val TEXTURE: TextureUsage = TextureUsage(0x04) - - /** Allows a texture to be a storage texture in a bind group */ - val STORAGE: TextureUsage = TextureUsage(0x08) - - /** Allows a texture to be an output attachment of a render pass */ - val RENDER_ATTACHMENT: TextureUsage = TextureUsage(0x10) - } -} - -/** Dimensions of a particular texture view. */ -enum class TextureViewDimension { - /** A one dimensional texture. */ - D1, - - /** A two-dimensional texture. */ - D2, - - /** A two-dimensional array texture. */ - D2_ARRAY, - - /** A cubemap texture. */ - CUBE, - - /** A cubemap array texture. */ - CUBE_ARRAY, - - /** A three-dimensional texture. */ - D3 -} - -/** Type of data the texture holds. */ -enum class TextureAspect { - /** Depth, stecil, and color. */ - ALL, - - /** Stencil only. */ - STENCIL_ONLY, - - /** Depth only. */ - DEPTH_ONLY -} - -/** Dimensionality of a texture. */ -enum class TextureDimension { - /** 1D texture. */ - D1, - - /** 2D texture. */ - D2, - - /** 3D texture. */ - D3 -} - -/** - * The underlying texture data format. - * - * If there is a conversion in the format (such as srgb -> linear), the conversion listed here is - * for loading from texture in a shader. When writing to the texture, the opposite conversion takes - * place. - * - * @param bytes the number of bytes each format requires - * @param srgb if this format is an SRGB format and expects linear colors. - */ -enum class TextureFormat(val bytes: Int, val srgb: Boolean = false) { - /** 8 Bit Red channel only. `[0, 255]` converted to/from float `[0, 1]` in shader. */ - R8_UNORM(1), - - /** 8 Bit Red channel only. `[-127, 127]` converted to/from float `[-1, 1]` in shader. */ - R8_SNORM(1), - - /** Red channel only. 8 bit integer per channel. Unsigned in shader. */ - R8_UINT(1), - - /** Red channel only. 8 bit integer per channel. Signed in shader. */ - R8_SINT(1), - - /** Red channel only. 16 bit integer per channel. Unsigned in shader. */ - R16_UINT(2), - - /** Red channel only. 16 bit integer per channel. Signed in shader. */ - R16_SINT(2), - - /** Red channel only. 16 bit float per channel. Float in shader. */ - R16_FLOAT(2), - - /** - * Red and green channels. 8 bit integer per channel. `[0, 255]` converted to/from float `[0, - * 1]` in shader. - */ - RG8_UNORM(2), - - /** - * Red and green channels. 8 bit integer per channel. `[-127, 127]` converted to/from float - * `[-1, 1]` in shader. - */ - RG8_SNORM(2), - - /** Red and green channels. 8 bit integer per channel. Unsigned in shader. */ - RG8_UINT(2), - - /** Red and green channel s. 8 bit integer per channel. Signed in shader. */ - RG8_SINT(2), - - /** Red channel only. 32 bit integer per channel. Unsigned in shader. */ - R32_UINT(4), - - /** Red channel only. 32 bit integer per channel. Signed in shader. */ - R32_SINT(4), - - /** Red channel only. 32 bit float per channel. Float in shader. */ - R32_FLOAT(4), - - /** Red and green channels. 16 bit integer per channel. Unsigned in shader. */ - RG16_UINT(4), - - /** Red and green channels. 16 bit integer per channel. Signed in shader. */ - RG16_SINT(4), - - /** Red and green channels. 16 bit float per channel. Float in shader. */ - RG16_FLOAT(4), - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. `[0, 255]` converted to/from - * float `[0, 1]` in shader. - */ - RGBA8_UNORM(4), - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Srgb-color `[0, 255]` - * converted to/from linear-color float `[0, 1]` in shader. - */ - RGBA8_UNORM_SRGB(4, true), - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. `[-127, 127]` converted - * to/from float `[-1, 1]` in shader. - */ - RGBA8_SNORM(4), - - /** Red, green, blue, and alpha channels. 8 bit integer per channel. Unsigned in shader. */ - RGBA8_UINT(4), - - /** Red, green, blue, and alpha channels. 8 bit integer per channel. Signed in shader. */ - RGBA8_SINT(4), - - /** - * Blue, green, red, and alpha channels. 8 bit integer per channel. `[0, 255]` converted to/from - * float `[0, 1]` in shader. - */ - BGRA8_UNORM(4), - - /** - * Blue, green, red, and alpha channels. 8 bit integer per channel. Srgb-color `[0, 255]` - * converted to/from linear-color float `[0, 1]` in shader. - */ - BGRA8_UNORM_SRGB(4, true), - - /** - * Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer for - * alpha channel. `[0, 1023]` (`[0, 3]` for alpha) converted to/from float `[0, 1]` in shader. - */ - RGB10A2_UNORM(4), - - /** - * Red, green, and blue channels. 11 bit float with no sign bit for RG channels. 10 bit float - * with no sign bit for blue channel. Float in shader. - */ - RG11B10_FLOAT(4), - - /** Red and green channels. 32 bit integer per channel. Unsigned in shader. */ - RG32_UINT(8), - - /** Red and green channels. 32 bit integer per channel. Signed in shader. */ - RG32_SINT(8), - - /** Red and green channels. 32 bit float per channel. Float in shader. */ - RG32_FLOAT(8), - - /** Red, green, blue, and alpha channels. 16 bit integer per channel. Unsigned in shader. */ - RGBA16_UINT(8), - - /** Red, green, blue, and alpha channels. 16 bit integer per channel. Signed in shader. */ - RGBA16_SINT(8), - - /** Red, green, blue, and alpha channels. 16 bit float per channel. Float in shader. */ - RGBA16_FLOAT(8), - - /** Red, green, blue, and alpha channels. 32 bit integer per channel. Unsigned in shader. */ - RGBA32_UINT(16), - - /** Red, green, blue, and alpha channels. 32 bit integer per channel. Signed in shader. */ - RGBA32_SINT(16), - - /** Red, green, blue, and alpha channels. 32 bit float per channel. Float in shader. */ - RGBA32_FLOAT(16), - - /** Special depth format with 32 bit floating point depth. */ - DEPTH32_FLOAT(4), - - /** Special depth format with at least 24 bit integer depth. */ - DEPTH24_PLUS(3), - - /** - * Special depth/stencil format with at least 24 bit integer depth and 8 bits integer stencil. - */ - DEPTH24_PLUS_STENCIL8(4); - - companion object -} - -/** Alpha blend operation. */ -enum class BlendOperation { - /** Src + Dst */ - ADD, - - /** Src - Dst */ - SUBTRACT, - - /** Dst - Src */ - REVERSE_SUBTRACT, - - /** min(Src, Dst) */ - MIN, - - /** max(Src, Dst) */ - MAX -} - -/** Operation to perform on the stencil value. */ -enum class StencilOperation { - /** Keep stencil value unchanged. */ - KEEP, - - /** Set stencil value to zero. */ - ZERO, - - /** - * Replace stencil value with value provided in most recent call to - * [RenderPassEncoder.setStencilReference]. - */ - REPLACE, - - /** Bitwise inverts stencil value. */ - INVERT, - - /** Increments stencil value by one, clamping on overflow. */ - INCREMENT_CLAMP, - - /** Decrements stencil value by one, clamping on underflow. */ - DECREMENT_CLAMP, - /** Increments stencil value by one, wrapping on overflow. */ - INCREMENT_WRAP, - /** Decrements stencil value by one, wrapping on underflow. */ - DECREMENT_WRAP -} - -/** Alpha blend factor. */ -enum class BlendFactor { - /** 0.0 */ - ZERO, - - /** 1.0 */ - ONE, - - /** S.component */ - SRC_COLOR, - - /** 1.0 - S.component */ - ONE_MINUS_SRC_COLOR, - - /** S.alpha */ - SRC_ALPHA, - - /** 1.0 - S.alpha */ - ONE_MINUS_SRC_ALPHA, - - /** D.component */ - DST_COLOR, - - /** 1.0 - D.component */ - ONE_MINUS_DST_COLOR, - - /** D.alpha */ - DST_ALPHA, - - /** 1.0 - D.alpha */ - ONE_MINUS_DST_ALPHA, - - /** min(S.alpha, 1.0 - D.alpha) */ - SRC_ALPHA_SATURATED, - - /** Constant */ - CONSTANT_COLOR, - - /** 1.0 - Constant */ - ONE_MINUS_CONSTANT_COLOR -} - -/** Format of indices used with pipeline. */ -enum class IndexFormat { - /** Indices are 16 bit unsigned integers. */ - UINT16, - - /** Indices are 32 bit unsigned integers. */ - UINT32, -} - -/** Vertex format for a [WebGPUVertexAttribute] (input). */ -enum class VertexFormat( - /** The number of components of the format. */ - val components: Int, - /** The byte size of the format. */ - val bytes: Int, - /** If the format uses integer or float. */ - val isInt: Boolean = false -) { - /** Two unsigned bytes. uvec2 in shaders */ - UINT8x2(2, 2, true), - - /** Four unsigned bytes. uvec4 in shaders */ - UINT8x4(4, 4, true), - - /** Two signed bytes. ivec2 in shaders */ - SINT8x2(2, 2, true), - - /** Four signed bytes. ivec4 in shaders */ - SINT8x4(4, 4, true), - - /** Two unsigned bytes `[0, 255]` converted to floats `[0, 1]`. vec2 in shaders */ - UNORM8x2(2, 2), - - /** Four unsigned bytes `[0, 255]` converted to floats `[0, 1]`. vec4 in shaders */ - UNORM8x4(4, 4), - - /** two signed bytes converted to float `[-1,1]`. vec2 in shaders */ - SNORM8x2(2, 2), - - /** two signed bytes converted to float `[-1,1]`. vec2 in shaders */ - SNORM8x4(4, 4), - - /** two unsigned shorts. uvec2 in shaders */ - UINT16x2(2, 4, true), - - /** four unsigned shorts. uvec4 in shaders */ - UINT16x4(4, 8, true), - - /** two signed shorts. ivec2 in shaders */ - SINT16x2(2, 4, true), - - /** four signed shorts. ivec4 in shaders */ - SINT16x4(4, 8, true), - - /** two unsigned shorts `[0, 65525]` converted to float `[0, 1]`. vec2 in shaders */ - UNORM16x2(2, 4), - - /** four unsigned shorts `[0, 65525]` converted to float `[0, 1]`. vec4 in shaders */ - UNORM16x4(4, 8), - - /** two signed shorts `[-32767, 32767]` converted to float `[-1, 1]`. vec2 in shaders */ - SNORM16x2(2, 4), - - /** two signed shorts `[-32767, 32767]` converted to float `[-1, 1]`. vec4 in shaders */ - SNORM16x4(4, 8), - - /** two half precision floats. vec2 in shaders */ - FLOAT16x2(2, 4), - - /** four half precision floats. vec4 in shaders */ - FLOAT16x4(4, 8), - - /** one float. float in shaders */ - FLOAT32(1, 4), - - /** two floats. vec2 in shaders */ - FLOAT32x2(2, 8), - - /** three floats. vec3 in shaders */ - FLOAT32x3(3, 12), - - /** four floats. vec4 in shaders */ - FLOAT32x4(4, 16), - - /** one unsigned int. uint in shaders */ - UINT32(1, 4, true), - - /** two unsigned ints. uvec2 in shaders */ - UINT32x2(2, 8, true), - - /** three unsigned ints. uvec3 in shaders */ - UINT32x3(3, 12, true), - - /** four unsigned ints. uvec4 in shaders */ - UINT32x4(4, 16, true), - - /** one signed int. int in shaders */ - SINT32(1, 4, true), - - /** two signed ints. ivec2 in shaders */ - SINT32x2(2, 8, true), - - /** three signed ints. ivec2 in shaders */ - SINT32x3(3, 12, true), - - /** four signed ints. ivec2 in shaders */ - SINT32x4(4, 16, true) -} - -/** Whether a vertex buffer is indexed by vertex or by instance. */ -enum class VertexStepMode { - /** Vertex data is advanced every vertex. */ - VERTEX, - - /** Vertex data is advanced every instance. */ - INSTANCE -} - -/** Operation to perform to the output attachment at the start of a render pass. */ -enum class LoadOp { - /** - * Loads the specified value for this attachment into the render pass. - * - * On some GPU hardware (primarily mobile), “clear” is significantly cheaper because it avoids - * loading data from main memory into tile-local memory. - * - * On other GPU hardware, there isn’t a significant difference. - * - * As a result, it is recommended to use “clear” rather than “load” in cases where the initial - * value doesn’t matter (e.g. the render target will be cleared using a skybox). - */ - CLEAR, - - /** Loads the existing value for this attachment into the render pass. */ - LOAD -} - -/** Operation to perform to the output attachment at the end of a render pass. */ -enum class StoreOp { - /** - * Discards the resulting value of the render pass for this attachment. - * - * The attachment will be treated as uninitialized afterwards. (If only either Depth or Stencil - * texture-aspects is set to Discard, the respective other texture-aspect will be preserved.) - * - * This can be significantly faster on tile-based render hardware. - * - * Prefer this if the attachment is not read by subsequent passes. - */ - DISCARD, - - /** Stores the resulting value of the render pass for this attachment. */ - STORE -} - -/** Specific type of a buffer binding. */ -enum class BufferBindingType { - /** - * A buffer for uniform values. - * - * ```wgsl - * struct Globals { - * a_uniform: vec2, - * another_uniform: vec2, - * } - * @group(0) @binding(0) - * var globals: Globals; - * ``` - */ - UNIFORM, - - /** - * A storage buffer. - * - * ```wgsl - * @group(0) @binding(0) - * var my_element: array>; - * ``` - */ - STORAGE, - - /** - * A read only storage buffer. The buffer can only be read in the shader. - * - * ```wgsl - * @group(0) @binding(0) - * var my_element: array>; - * ``` - */ - READ_ONLY_STORAGE -} - -enum class AddressMode { - CLAMP_TO_EDGE, - REPEAT, - MIRROR_REPEAT -} - -enum class FilterMode { - NEAREST, - LINEAR -} - -/** Comparison function used for depth and stencil operations. */ -enum class CompareFunction { - /** Function never passes. */ - NEVER, - - /** Function passes if new value less than existing value. */ - LESS, - - /** - * Function passes if new value is equal to existing value. When using this compare function, - * make sure to mark your Vertex shader's `@builtin(position)` output as `@invariant` to prevent - * artifacting. - */ - EQUAL, - - /** Function passes if new value is less than or equal to existing value. */ - LESS_EQUAL, - - /** Function passes if new value is greater than existing value. */ - GREATER, - /** - * Function passes if new value is not equal to existing value. When using this compare - * function, make sure to mark your Vertex shader's `@builtin(position)` output as `@invariant` - * to prevent artifacting. - */ - NOT_EQUAL, - - /** Function passes if new value is greater than or equal existing value. */ - GREATER_EQUAL, - - /** Function always passes. */ - ALWAYS -} - -/** Specific type of a sample in a texture binding. */ -enum class TextureSampleType { - /** - * Sampling returns floats. - * - * ```wgsl - * @group(0) @binding(0) - * var t: texture_2d; - * ``` - */ - FLOAT, - - /** - * Sampling does the depth reference comparison. This is also compatible with a non-filtering - * sampler. - * - * ```wgsl - * @group(0) @binding(0) - * var t: texture_depth_2d; - * ``` - */ - DEPTH, - - /** - * Sampling returns signed integers. - * - * ```wgsl - * @group(0) @binding(0) - * var t: texture_2d; - * ``` - */ - SINT, - - /** - * Sampleing returns unsigned integers. - * - * ```wgsl - * @group(0) @binding(0) - * var t: texture_2d; - * ``` - */ - UINT -} - -/** Specific type of a sampler binding. */ -enum class SamplerBindingType { - /** - * The sampling result is produced based on more than a single color sample from a texture, e.g. - * when bilinear interpolation is enabled. - */ - FILTERING, - - /** The sampling result is produced based on a single color sample from a texture. */ - NON_FILTERING, - - /** - * Use as a comparison sampler instead of a normal sampler. For more info take a look at the - * analogous functionality in - * [OpenGL](https://www.khronos.org/opengl/wiki/Sampler_Object#Comparison_mode). - */ - COMPARISON -} - -/** A color write mask. Disabled color channels will not be written to. */ -@JvmInline -value class ColorWriteMask(val usageFlag: Int) { - - infix fun or(other: ColorWriteMask): ColorWriteMask = - ColorWriteMask(usageFlag or other.usageFlag) - - infix fun and(other: ColorWriteMask): ColorWriteMask = - ColorWriteMask(usageFlag and other.usageFlag) - - companion object { - /** Disable writes to all channels. */ - val NONE: ColorWriteMask = ColorWriteMask(0x0) - - /** Enable red channel writes. */ - val RED: ColorWriteMask = ColorWriteMask(0x1) - - /** Enable green channel writes. */ - val GREEN: ColorWriteMask = ColorWriteMask(0x2) - - /** Enable blue channel writes. */ - val BLUE: ColorWriteMask = ColorWriteMask(0x4) - - /** Enable alpha channel writes. */ - val ALPHA: ColorWriteMask = ColorWriteMask(0x8) - - /** Enable writes to all channels. */ - val ALL: ColorWriteMask = ColorWriteMask(0xF) - } -} - -/** Specifies how the alpha channel of the texture should be handled during compositing. */ -enum class AlphaMode { - /** - * Chooses either [Opaque] or [Inherit] automatically,depending on the `alphaMode` that the - * current surface can support. - */ - AUTO, - - /** - * The alpha channel, if it exists, of the textures is ignored in the compositing process. - * Instead, the textures is treated as if it has a constant alpha of 1.0. - */ - OPAQUE, - - /** - * The alpha channel, if it exists, of the textures is respected in the compositing process. The - * non-alpha channels of the textures are expected to already be multiplied by the alpha channel - * by the application. - */ - PREMULTIPLIED, - - /** - * The alpha channel, if it exists, of the textures is respected in the compositing process. The - * non-alpha channels of the textures are not expected to already be multiplied by the alpha - * channel by the application; instead, the compositor will multiply the non-alpha channels of - * the texture by the alpha channel during compositing. - */ - UNPREMULTIPLIED, - - /** - * The alpha channel, if it exists, of the textures is unknown for processing during - * compositing. Instead, the application is responsible for setting the composite alpha blending - * mode using native WSI command. If not set, then a platform-specific default will be used. - */ - INHERIT; - - companion object -} - -/** Behavior of the presentation engine based on frame rate. */ -enum class PresentMode { - /** - * Presentation frames are kept in a First-In-First-Out queue approximately 3 frames long. Every - * vertical blanking period, the presentation engine will pop a frame off the queue to display. - * If there is no frame to display, it will present the same frame again until the next vblank. - * - * When a present command is executed on the gpu, the presented image is added on the queue. - * - * No tearing will be observed. - * - * Calls to `getCurrentTexture` will block until there is a spot in the queue. - * - * Supported on all platforms. - * - * If you don’t know what mode to choose, choose this mode. This is traditionally called “Vsync - * On”. - */ - FIFO, - - /** - * Presentation frames are kept in a First-In-First-Out queue approximately 3 frames long. Every - * vertical blanking period, the presentation engine will pop a frame off the queue to display. - * If there is no frame to display, it will present the same frame until there is a frame in the - * queue. The moment there is a frame in the queue, it will immediately pop the frame off the - * queue. - * - * When a present command is executed on the gpu, the presented image is added on the queue. - * - * Tearing will be observed if frames last more than one vblank as the front buffer. - * - * Calls to `getCurrentTexture` will block until there is a spot in the queue. - * - * Supported on AMD on Vulkan. - * - * This is traditionally called “Adaptive Vsync” - */ - FIFO_RELAXED, - - /** - * Presentation frames are not queued at all. The moment a present command is executed on the - * GPU, the presented image is swapped onto the front buffer immediately. - * - * Tearing can be observed. - * - * Supported on most platforms except older DX12 and Wayland. - * - * This is traditionally called “Vsync Off”. - */ - IMMEDIATE, - - /** - * Presentation frames are kept in a single-frame queue. Every vertical blanking period, the - * presentation engine will pop a frame from the queue. If there is no frame to display, it will - * present the same frame again until the next vblank. - * - * When a present command is executed on the gpu, the frame will be put into the queue. If there - * was already a frame in the queue, the new frame will replace the old frame on the queue. - * - * No tearing will be observed. - * - * Supported on DX12 on Windows 10, NVidia on Vulkan and Wayland on Vulkan. - * - * This is traditionally called “Fast Vsync” - */ - MAILBOX -} - -/** Status of the received surface texture. */ -enum class TextureStatus { - /** No issues. */ - SUCCESS, - - /** Unable to get the next frame, timed out. */ - TIMEOUT, - - /** The surface under the swap chain has changed. */ - OUTDATED, - - /** The surface under the swap chain is lost */ - LOST, - - /** The surface under the swap chain has ran out of memory. */ - OUT_OF_MEMORY, - - /** The surface under the swap chain lost the device. */ - DEVICE_LOST; - - companion object -} - -/** - * The usages determine what kind of memory the buffer is allocated from and what actions the buffer - * can partake in. - */ -@JvmInline -value class BufferUsage(val usageFlag: Int) { - - infix fun or(other: BufferUsage): BufferUsage = BufferUsage(usageFlag or other.usageFlag) - - infix fun and(other: BufferUsage): BufferUsage = BufferUsage(usageFlag and other.usageFlag) - - companion object { - - /** - * Allow a buffer to be mapped for reading. Does not need to be enabled for - * mapped_at_creation. - */ - val MAP_READ: BufferUsage = BufferUsage(0x0001) - - /** - * Allow a buffer to be mapped for writing. Does not need to be enabled for - * mapped_at_creation. - */ - val MAP_WRITE: BufferUsage = BufferUsage(0x0002) - - /** - * Allow a buffer to be the source buffer for [CommandEncoder.copyBufferToBuffer] or - * [CommandEncoder.copyBufferToTexture] - */ - val COPY_SRC: BufferUsage = BufferUsage(0x0004) - - /** Allow a buffer to be the destination buffer for [CommandEncoder.copyBufferToBuffer] */ - val COPY_DST: BufferUsage = BufferUsage(0x0008) - - /** Allow a buffer to be used as index buffer for draw calls */ - val INDEX: BufferUsage = BufferUsage(0x0010) - - /** Allow a buffer to be used as vertex buffer for draw calls */ - val VERTEX: BufferUsage = BufferUsage(0x0020) - - /** Allow a buffer to be used as uniform buffer */ - val UNIFORM: BufferUsage = BufferUsage(0x0040) - - /** Allows a buffer to be used as a storage buffer */ - val STORAGE: BufferUsage = BufferUsage(0x0080) - - /** Allow a buffer to be the indirect buffer in an indirect draw call. */ - val INDIRECT: BufferUsage = BufferUsage(0x0100) - - /** - * Allow a buffer to be the destination buffer for a [CommandEncoder.resolveQuerySet] - * operation. - */ - val QUERY_RESOLVE: BufferUsage = BufferUsage(0x0200) - } -} - -/** Type of buffer mapping. */ -@JvmInline -value class MapMode(val usageFlag: Int) { - - infix fun or(other: MapMode): MapMode = MapMode(usageFlag or other.usageFlag) - - infix fun and(other: MapMode): MapMode = MapMode(usageFlag and other.usageFlag) - - companion object { - /** Map only for reading. */ - val READ: MapMode = MapMode(0x0001) - - /** Map only for writing. */ - val WRITE: MapMode = MapMode(0x0002) - } -} - -/** - * Describes the shader stages that a binding will be visible from. These can be combined so that - * something is visible from both vertex and fragment shaders: - * - * `ShaderStage.VERTEX or ShaderStage.FRAGMENT` - */ -@JvmInline -value class ShaderStage(val usageFlag: Int) { - infix fun or(other: ShaderStage): ShaderStage = ShaderStage(usageFlag or other.usageFlag) - - infix fun and(other: ShaderStage): ShaderStage = ShaderStage(usageFlag and other.usageFlag) - - companion object { - /** Binding visible from the vertex shader of a render pipeline. */ - val VERTEX: ShaderStage = ShaderStage(0x1) - - /** Binding visible from the fragment shader of a render pipeline. */ - val FRAGMENT: ShaderStage = ShaderStage(0x2) - - /** Binding visible from the compute shader of a compute pipeline. */ - val COMPUTE: ShaderStage = ShaderStage(0x4) - } -} - -/** - * Each Feature identifies a set of functionality which, if available, allows additional usages of - * WebGPU that would have otherwise been invalid. - */ -enum class Feature { - /** Allows depth clipping to be disabled. */ - DEPTH_CLIP_CONTROL, - - /** Allows for explicit creation of textures of format "depth32float-stencil8". */ - DEPTH32FLOAT_STENCIL18, - - /** - * Allows for explicit creation of textures of BC compressed formats. Supports both 2D and 3D - * textures. - */ - TEXTURE_COMPRESSION_BC, - - /** - * Allows for explicit creation of textures of ETC2 compressed formats. Only supports 2D - * textures. - */ - TEXTURE_COMPRESSION_ETC2, - - /** - * Allows for explicit creation of textures of ASTC compressed formats. Only supports 2D - * textures. - */ - TEXTURE_COMPRESSION_ASTC, - - /** Adds the ability to query timestamps from GPU command buffers. */ - TIMESTAMP_QUERY, - - /** - * Allows the use of non-zero firstInstance values in indirect draw parameters and indirect - * drawIndexed parameters. - */ - INDIRECT_FIRST_INSTANCE, - - /** Allows the use of the half-precision floating-point type f16 in WGSL. */ - SHADER_F16, - - /** - * Allows the RENDER_ATTACHMENT usage on textures with format "rg11b10ufloat", and also allows - * textures of that format to be blended and multisampled. - */ - RG11B10UFLOAT_RENDERABLE, - - /** Allows the STORAGE_BINDING usage on textures with format "bgra8unorm". */ - BGRA8UNORM_STORAGE, - - /** Makes textures with formats "r32float", "rg32float", and "rgba32float" filterable. */ - FLOAT32_FILTERABLE, - - /** Allows the use of clip_distances in WGSL. */ - CLIP_DISTANCES, - - /** - * Allows the use of blend_src in WGSL and simultaneously using both pixel shader outputs - * (@blend_src(0) and @blend_src(1)) as inputs to a blending operation with the single color - * attachment at location 0. - */ - DUAL_SOURCE_BLENDING -} diff --git a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/webgpu.kt b/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/webgpu.kt deleted file mode 100644 index 83978a214..000000000 --- a/core/src/commonMain/kotlin/com/littlekt/graphics/webgpu/webgpu.kt +++ /dev/null @@ -1,925 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable -import com.littlekt.file.ByteBuffer -import com.littlekt.file.FloatBuffer -import com.littlekt.file.IntBuffer -import com.littlekt.file.ShortBuffer -import com.littlekt.graphics.webgpu.* - -/** - * An open connection to a graphic and/or compute device. - * - * Responsible for the creation of most rendering and compute resources. These are then used in - * commands, which are submitted to a [Queue]. - * - * A device may be requested from an adapter with [Adapter.requestDevice] - */ -expect class Device : Releasable { - /** A [Queue] that has been ready from same adapter this device was created with. */ - val queue: Queue - - /** - * A set containing the [Feature] values of the features supported by the device (i.e. the ones - * with which it was created). - */ - val features: List - - /** - * Exposes the [Limits] supported by the device (which are exactly the ones with which it was - * created). - */ - val limits: Limits - - /** @return a newly created [ShaderModule] using WGSL source code. */ - fun createShaderModule(src: String): ShaderModule - - /** @return a newly created [RenderPipeline]. */ - fun createRenderPipeline(desc: RenderPipelineDescriptor): RenderPipeline - - /** @return a newly created [ComputePipeline] */ - fun createComputePipeline(desc: ComputePipelineDescriptor): ComputePipeline - - /** @return a newly created [PipelineLayout]. */ - fun createPipelineLayout(desc: PipelineLayoutDescriptor): PipelineLayout - - /** - * @param debug label for a [CommandEncoder]. - * @return a newly created, empty [CommandEncoder]. - */ - fun createCommandEncoder(label: String? = null): CommandEncoder - - /** @return a newly created [GPUBuffer]. */ - fun createBuffer(desc: BufferDescriptor): GPUBuffer - - /** @return a newly created [BindGroupLayout]. */ - fun createBindGroupLayout(desc: BindGroupLayoutDescriptor): BindGroupLayout - - /** @return a newly created [BindGroup]. */ - fun createBindGroup(desc: BindGroupDescriptor): BindGroup - - /** @return a newly created [Sampler]. */ - fun createSampler(desc: SamplerDescriptor): Sampler - - /** @return a newly created [WebGPUTexture]. */ - fun createTexture(desc: TextureDescriptor): WebGPUTexture - - /** - * This uses [createBuffer] internally, maps it at creation, and unmaps it immediately. - * - * @return a newly created [GPUBuffer] using an [ShortArray]. - */ - fun createGPUShortBuffer(label: String, data: ShortArray, usage: BufferUsage): GPUBuffer - - /** - * This uses [createBuffer] internally, maps it at creation, and unmaps it immediately. - * - * @return a newly created [GPUBuffer] using a [FloatArray]. - */ - fun createGPUFloatBuffer(label: String, data: FloatArray, usage: BufferUsage): GPUBuffer - - /** - * This uses [createBuffer] internally, maps it at creation, and unmaps it immediately. - * - * @return a newly created [GPUBuffer] using an [IntArray]. - */ - fun createGPUIntBuffer(label: String, data: IntArray, usage: BufferUsage): GPUBuffer - - /** - * This uses [createBuffer] internally, maps it at creation, and unmaps it immediately. - * - * @return a newly created [GPUBuffer] using a [ByteArray]. - */ - fun createGPUByteBuffer(label: String, data: ByteArray, usage: BufferUsage): GPUBuffer - - override fun release() -} - -/** A handle to a physical graphics and/or compute device. */ -expect class Adapter : Releasable { - /** The features which can be used to create devices on this adapter. */ - val features: List - - /** - * The best limits which can be used to create devices on this adapter. Each adapter limit must - * be the same or better than its default value in supported limits. - */ - val limits: Limits - - /** - * Requests a connection to a physical device, creating a logical device. - * - * @param descriptor a [DeviceDescriptor] describing the required support a [Device] should have - * @return the [Device] together with a [Queue] that executes command buffers. - */ - suspend fun requestDevice(descriptor: DeviceDescriptor? = null): Device - - /** Release the memory held by the adapter. */ - override fun release() -} - -/** - * A descriptor used when requesting a device from an adapter via [Adapter.requestDevice] - * - * @param label A debug label of a [Device]. - * @param requiredFeatures A list of [Feature] required to be supported by a [Device]. - * @param requiredLimits The [Limits] required to support by a [Device] via [RequiredLimits] - */ -data class DeviceDescriptor( - val label: String? = null, - val requiredFeatures: List? = null, - val requiredLimits: RequiredLimits? = null -) - -/** - * Each limit is a numeric limit on the usage of WebGPU on a device. - * - * Each limit has a default value. Every [Adapter] is guaranteed to support the default value or - * better. The default is used if a value is not explicitly specified in requiredLimits. - * - * One limit value may be better than another. A better limit value always relaxes validation, - * enabling strictly more programs to be valid. For each limit class, "better" is defined. - * - * Different limits have different limit classes: - * - **maximum**: The limit enforces a maximum on some value passed into the API. Higher values are - * better. May only be set to values ≥ the default. Lower values are clamped to the default. - * - **alignment**: The limit enforces a minimum alignment on some value passed into the API; that - * is, the value must be a multiple of the limit. Lower values are better. May only be set to - * powers of 2 which are ≤ the default. Values which are not powers of 2 are invalid. Higher - * powers of 2 are clamped to the default. - * - * **Note**: Setting "better" limits may not necessarily be desirable, as they may have a - * performance impact. Because of this, and to improve portability across devices and - * implementations, applications should generally request the "worst" limits that work for their - * content (ideally, the default values). - */ -data class RequiredLimits( - /** The maximum allowed value for the size.width of a texture created with dimension "1d". */ - val maxTextureDimension1D: Int? = null, - /** - * The maximum allowed value for the size.width and size.height of a texture created with - * dimension "2d". - */ - val maxTextureDimension2D: Int? = null, - /** - * The maximum allowed value for the size.width, size.height and size.depthOrArrayLayers of a - * texture created with dimension "3d". - */ - val maxTextureDimension3D: Int? = null, - /** - * The maximum allowed value for the size.depthOrArrayLayers of a texture created with dimension - * "2d". - */ - val maxTextureArrayLayers: Int? = null, - /** - * The maximum number of [BindGroupLayout] allowed in bindGroupLayouts when creating a - * [PipelineLayout]. - */ - val maxBindGroups: Int? = null, - /** - * The maximum number of bind group and vertex buffer slots used simultaneously, counting any - * empty slots below the highest index. Validated in createRenderPipeline() and in draw calls. - */ - val maxBindGroupsPlusVertexBuffers: Int? = null, - - /** - * The number of binding indices available when creating a [BindGroupLayout]. - * - * **Note**: This limit is normative, but arbitrary. With the default binding slot limits, it is - * impossible to use 1000 bindings in one bind group, but this allows - * [BindGroupLayoutEntry.binding] values up to 999. This limit allows implementations to treat - * binding space as an array, within reasonable memory space, rather than a sparse map - * structure. - */ - val maxBindingsPerBindGroup: Int? = null, - /** - * The maximum number of [BindGroupLayoutEntry] entries across a [PipelineLayout] which are - * uniform buffers with dynamic offsets. - */ - val maxDynamicUniformBuffersPerPipelineLayout: Int? = null, - /** - * The maximum number of [BindGroupLayoutEntry] entries across a [PipelineLayout] which are - * storage buffers with dynamic offset - */ - val maxDynamicStorageBuffersPerPipelineLayout: Int? = null, - /** - * For each possible [ShaderStage] stage, the maximum number of [BindGroupLayoutEntry] entries - * across a [PipelineLayout] which are sampled textures. - */ - val maxSampledTexturesPerShaderStage: Int? = null, - /** - * For each possible [ShaderStage] stage, the maximum number of [BindGroupLayoutEntry] entries - * across a [PipelineLayout] which are samplers. - */ - val maxSamplersPerShaderStage: Int? = null, - /** - * For each possible GPUShaderStage stage, the maximum number of GPUBindGroupLayoutEntry entries - * across a GPUPipelineLayout which are storage buffers. - */ - val maxStorageBuffersPerShaderStage: Int? = null, - /** - * For each possible GPUShaderStage stage, the maximum number of GPUBindGroupLayoutEntry entries - * across a GPUPipelineLayout which are storage textures. - */ - val maxStorageTexturesPerShaderStage: Int? = null, - /** - * For each possible GPUShaderStage stage, the maximum number of GPUBindGroupLayoutEntry entries - * across a GPUPipelineLayout which are uniform buffers. - */ - val maxUniformBuffersPerShaderStage: Int? = null, - /** - * The maximum GPUBufferBinding.size for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "uniform". - */ - val maxUniformBufferBindingSize: Long? = null, - /** - * The maximum GPUBufferBinding.size for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "storage" or "read-only-storage". - */ - val maxStorageBufferBindingSize: Long? = null, - /** - * The required alignment for GPUBufferBinding.offset and the dynamic offsets provided in - * setBindGroup(), for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "uniform". - */ - val minUniformBufferOffsetAlignment: Int? = null, - /** - * The required alignment for GPUBufferBinding.offset and the dynamic offsets provided in - * setBindGroup(), for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "storage" or "read-only-storage". - */ - val minStorageBufferOffsetAlignment: Int? = null, - /** The maximum number of buffers when creating a GPURenderPipeline. */ - val maxVertexBuffers: Int? = null, - /** The maximum size of size when creating a GPUBuffer. */ - val maxBufferSize: Long? = null, - /** - * The maximum number of attributes in total across buffers when creating a GPURenderPipeline. - */ - val maxVertexAttributes: Int? = null, - /** The maximum allowed arrayStride when creating a GPURenderPipeline. */ - val maxVertexBufferArrayStride: Int? = null, - /** - * The maximum allowed number of components of input or output variables for inter-stage - * communication (like vertex outputs or fragment inputs). - */ - val maxInterStageShaderComponents: Int? = null, - /** - * The maximum allowed number of input or output variables for inter-stage communication (like - * vertex outputs or fragment inputs). - */ - val maxInterStageShaderVariables: Int? = null, - /** - * The maximum allowed number of color attachments in - * GPURenderPipelineDescriptor.fragment.targets, GPURenderPassDescriptor.colorAttachments, and - * GPURenderPassLayout.colorFormats. - */ - val maxColorAttachments: Int? = null, - /** - * The maximum number of bytes necessary to hold one sample (pixel or subpixel) of render - * pipeline output data, across all color attachments. - */ - val maxColorAttachmentBytesPerSample: Int? = null, - /** - * The maximum number of bytes of workgroup storage used for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupStorageSize: Int? = null, - /** - * The maximum value of the product of the workgroup_size dimensions for a compute stage - * GPUShaderModule entry-point. - */ - val maxComputeInvocationsPerWorkgroup: Int? = null, - /** - * The maximum value of the workgroup_size X dimension for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupSizeX: Int? = null, - /** - * The maximum value of the workgroup_size Y dimensions for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupSizeY: Int? = null, - /** - * The maximum value of the workgroup_size Z dimensions for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupSizeZ: Int? = null, - /** - * The maximum value for the arguments of dispatchWorkgroups(workgroupCountX, workgroupCountY, - * workgroupCountZ). - */ - val maxComputeWorkgroupsPerDimension: Int? = null, -) - -/** - * Each limit is a numeric limit on the usage of WebGPU on a device. - * - * Each limit has a default value. Every [Adapter] is guaranteed to support the default value or - * better. The default is used if a value is not explicitly specified in requiredLimits. - * - * One limit value may be better than another. A better limit value always relaxes validation, - * enabling strictly more programs to be valid. For each limit class, "better" is defined. - * - * Different limits have different limit classes: - * - **maximum**: The limit enforces a maximum on some value passed into the API. Higher values are - * better. May only be set to values ≥ the default. Lower values are clamped to the default. - * - **alignment**: The limit enforces a minimum alignment on some value passed into the API; that - * is, the value must be a multiple of the limit. Lower values are better. May only be set to - * powers of 2 which are ≤ the default. Values which are not powers of 2 are invalid. Higher - * powers of 2 are clamped to the default. - * - * **Note**: Setting "better" limits may not necessarily be desirable, as they may have a - * performance impact. Because of this, and to improve portability across devices and - * implementations, applications should generally request the "worst" limits that work for their - * content (ideally, the default values). - */ -data class Limits( - /** The maximum allowed value for the size.width of a texture created with dimension "1d". */ - val maxTextureDimension1D: Int, - /** - * The maximum allowed value for the size.width and size.height of a texture created with - * dimension "2d". - */ - val maxTextureDimension2D: Int, - /** - * The maximum allowed value for the size.width, size.height and size.depthOrArrayLayers of a - * texture created with dimension "3d". - */ - val maxTextureDimension3D: Int, - /** - * The maximum allowed value for the size.depthOrArrayLayers of a texture created with dimension - * "2d". - */ - val maxTextureArrayLayers: Int, - /** - * The maximum number of [BindGroupLayout] allowed in bindGroupLayouts when creating a - * [PipelineLayout]. - */ - val maxBindGroups: Int, - /** - * The maximum number of bind group and vertex buffer slots used simultaneously, counting any - * empty slots below the highest index. Validated in createRenderPipeline() and in draw calls. - */ - val maxBindGroupsPlusVertexBuffers: Int, - - /** - * The number of binding indices available when creating a [BindGroupLayout]. - * - * **Note**: This limit is normative, but arbitrary. With the default binding slot limits, it is - * impossible to use 1000 bindings in one bind group, but this allows - * [BindGroupLayoutEntry.binding] values up to 999. This limit allows implementations to treat - * binding space as an array, within reasonable memory space, rather than a sparse map - * structure. - */ - val maxBindingsPerBindGroup: Int, - /** - * The maximum number of [BindGroupLayoutEntry] entries across a [PipelineLayout] which are - * uniform buffers with dynamic offsets. - */ - val maxDynamicUniformBuffersPerPipelineLayout: Int, - /** - * The maximum number of [BindGroupLayoutEntry] entries across a [PipelineLayout] which are - * storage buffers with dynamic offset - */ - val maxDynamicStorageBuffersPerPipelineLayout: Int, - /** - * For each possible [ShaderStage] stage, the maximum number of [BindGroupLayoutEntry] entries - * across a [PipelineLayout] which are sampled textures. - */ - val maxSampledTexturesPerShaderStage: Int, - /** - * For each possible [ShaderStage] stage, the maximum number of [BindGroupLayoutEntry] entries - * across a [PipelineLayout] which are samplers. - */ - val maxSamplersPerShaderStage: Int, - /** - * For each possible GPUShaderStage stage, the maximum number of GPUBindGroupLayoutEntry entries - * across a GPUPipelineLayout which are storage buffers. - */ - val maxStorageBuffersPerShaderStage: Int, - /** - * For each possible GPUShaderStage stage, the maximum number of GPUBindGroupLayoutEntry entries - * across a GPUPipelineLayout which are storage textures. - */ - val maxStorageTexturesPerShaderStage: Int, - /** - * For each possible GPUShaderStage stage, the maximum number of GPUBindGroupLayoutEntry entries - * across a GPUPipelineLayout which are uniform buffers. - */ - val maxUniformBuffersPerShaderStage: Int, - /** - * The maximum GPUBufferBinding.size for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "uniform". - */ - val maxUniformBufferBindingSize: Long, - /** - * The maximum GPUBufferBinding.size for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "storage" or "read-only-storage". - */ - val maxStorageBufferBindingSize: Long, - /** - * The required alignment for GPUBufferBinding.offset and the dynamic offsets provided in - * setBindGroup(), for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "uniform". - */ - val minUniformBufferOffsetAlignment: Int, - /** - * The required alignment for GPUBufferBinding.offset and the dynamic offsets provided in - * setBindGroup(), for bindings with a GPUBindGroupLayoutEntry entry for which - * entry.buffer?.type is "storage" or "read-only-storage". - */ - val minStorageBufferOffsetAlignment: Int, - /** The maximum number of buffers when creating a GPURenderPipeline. */ - val maxVertexBuffers: Int, - /** The maximum size of size when creating a GPUBuffer. */ - val maxBufferSize: Long, - /** - * The maximum number of attributes in total across buffers when creating a GPURenderPipeline. - */ - val maxVertexAttributes: Int, - /** The maximum allowed arrayStride when creating a GPURenderPipeline. */ - val maxVertexBufferArrayStride: Int, - /** - * The maximum allowed number of components of input or output variables for inter-stage - * communication (like vertex outputs or fragment inputs). - */ - val maxInterStageShaderComponents: Int, - /** - * The maximum allowed number of input or output variables for inter-stage communication (like - * vertex outputs or fragment inputs). - */ - val maxInterStageShaderVariables: Int, - /** - * The maximum allowed number of color attachments in - * GPURenderPipelineDescriptor.fragment.targets, GPURenderPassDescriptor.colorAttachments, and - * GPURenderPassLayout.colorFormats. - */ - val maxColorAttachments: Int, - /** - * The maximum number of bytes necessary to hold one sample (pixel or subpixel) of render - * pipeline output data, across all color attachments. - */ - val maxColorAttachmentBytesPerSample: Int, - /** - * The maximum number of bytes of workgroup storage used for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupStorageSize: Int, - /** - * The maximum value of the product of the workgroup_size dimensions for a compute stage - * GPUShaderModule entry-point. - */ - val maxComputeInvocationsPerWorkgroup: Int, - /** - * The maximum value of the workgroup_size X dimension for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupSizeX: Int, - /** - * The maximum value of the workgroup_size Y dimensions for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupSizeY: Int, - /** - * The maximum value of the workgroup_size Z dimensions for a compute stage GPUShaderModule - * entry-point. - */ - val maxComputeWorkgroupSizeZ: Int, - /** - * The maximum value for the arguments of dispatchWorkgroups(workgroupCountX, workgroupCountY, - * workgroupCountZ). - */ - val maxComputeWorkgroupsPerDimension: Int, -) - -/** - * A handle to a command queue on a [Device]. - * - * A `Queue` executes recorded [CommandBuffer] objects and provides convenience methods for writing - * to buffers and textures. It can be created along with a [Device] by calling - * [Adapter.requestDevice]. - */ -expect class Queue : Releasable { - - /** Submit a series of finished command buffers for execution. */ - fun submit(vararg cmdBuffers: CommandBuffer) - - /** - * Schedule a data write into [buffer] starting at [offset]. - * - * This method is intended to have low performance costs. As such, the write is not immediately - * submitted, and instead enqueued internally to happen at the start of the next [submit] call. - * - * This method fails if [data] overruns the size of [buffer] starting at [offset]. - * - * @param size the number of elements - */ - fun writeBuffer( - buffer: GPUBuffer, - data: ShortBuffer, - offset: Long = 0, - dataOffset: Long = 0, - size: Long = data.capacity.toLong() - ) - - /** - * Schedule a data write into [buffer] starting at [offset]. - * - * This method is intended to have low performance costs. As such, the write is not immediately - * submitted, and instead enqueued internally to happen at the start of the next [submit] call. - * - * This method fails if [data] overruns the size of [buffer] starting at [offset]. - * - * @param size the number of elements - */ - fun writeBuffer( - buffer: GPUBuffer, - data: FloatBuffer, - offset: Long = 0, - dataOffset: Long = 0, - size: Long = data.capacity.toLong() - ) - - /** - * Schedule a data write into [buffer] starting at [offset]. - * - * This method is intended to have low performance costs. As such, the write is not immediately - * submitted, and instead enqueued internally to happen at the start of the next [submit] call. - * - * This method fails if [data] overruns the size of [buffer] starting at [offset]. - * - * @param size the number of elements - */ - fun writeBuffer( - buffer: GPUBuffer, - data: IntBuffer, - offset: Long = 0, - dataOffset: Long = 0, - size: Long = data.capacity.toLong() - ) - - /** - * Schedule a data write into [buffer] starting at [offset]. - * - * This method is intended to have low performance costs. As such, the write is not immediately - * submitted, and instead enqueued internally to happen at the start of the next [submit] call. - * - * This method fails if [data] overruns the size of [buffer] starting at [offset]. - * - * @param size the number of elements - */ - fun writeBuffer( - buffer: GPUBuffer, - data: ByteBuffer, - offset: Long = 0, - dataOffset: Long = 0, - size: Long = data.capacity.toLong() - ) - - /** - * Schedule a write of some data into a texture. - * - * This method is intended to have low performance costs. As such, the write is not immediately - * submitted, and instead enqueued internally to happen at the start of the next [submit] call. - * However, [data] will be immediately copied into staging memory; so the caller may discard it - * any time after this call completes. - * - * This method fails if [size] overruns the size of [destination], or if [data] is too short. - * - * @param data contains the texels to be written, which must be in the same format as the - * texture. - * @param destination specifies the texture to write into, and the location within the texture - * (coordinate offset, mip level) that will be overwritten. - * @param layout describes the memory layout of data, which does not necessarily have to have - * tightly packed rows. - * @param size is the size, in texels, of the region to be written. - */ - fun writeTexture( - data: ByteBuffer, - destination: TextureCopyView, - layout: TextureDataLayout, - copySize: Extent3D, - size: Long = data.capacity.toLong() - ) - - /** - * Schedule a write of some data into a texture. - * - * This method is intended to have low performance costs. As such, the write is not immediately - * submitted, and instead enqueued internally to happen at the start of the next [submit] call. - * However, [data] will be immediately copied into staging memory; so the caller may discard it - * any time after this call completes. - * - * This method fails if [size] overruns the size of [destination], or if [data] is too short. - * - * @param data contains the texels to be written, which must be in the same format as the - * texture. - * @param destination specifies the texture to write into, and the location within the texture - * (coordinate offset, mip level) that will be overwritten. - * @param layout describes the memory layout of data, which does not necessarily have to have - * tightly packed rows. - * @param size is the size, in texels, of the region to be written. - */ - fun writeTexture( - data: ByteArray, - destination: TextureCopyView, - layout: TextureDataLayout, - copySize: Extent3D, - size: Long = data.size.toLong() - ) - - override fun release() -} - -/** - * Handle to a compiled shader module. - * - * A `ShaderModule` represents a compiled shader module on the GPU. It can be created by pass source - * code to [Device.createShaderModule]. Shader modules are used to define programmable stages of a - * pipeline. - */ -expect class ShaderModule : Releasable { - override fun release() -} - -/** - * Extent of a texture related operation. - * - * @param width width of the extent - * @param height height of the extent - * @param depth depth of the extent or number of array layers. - */ -data class Extent3D(val width: Int, val height: Int, val depth: Int) - -/** - * Origin of a copy to/from a texture. - * - * @param x x-position of the origin - * @param y y-position of the origin - * @param z z-position of the origin - */ -data class Origin3D(val x: Int, val y: Int, val z: Int) - -/** - * A handle to a presentable surface. - * - * A `Surface` represents a platform-specific surface (e.g. a window) onto which rendered images may - * be presented. - */ -expect class Surface : Releasable { - - /** Initializes [Surface] for presentation. */ - fun configure(configuration: SurfaceConfiguration) - - /** @return the capabilities of the surface when used with the given [adapter]. */ - fun getCapabilities(adapter: Adapter): SurfaceCapabilities - - /** @return the optimal [TextureFormat] for displaying on the given [Adapter] */ - fun getPreferredFormat(adapter: Adapter): TextureFormat - - /** - * In order to present the [SurfaceTexture] returned by this function, first a [Queue.submit] - * needs to be done with some work rendering to this texture. Then [present] needs to be called. - * - * @return the next [SurfaceTexture] to be presented by the swapchain for drawing. - */ - fun getCurrentTexture(): SurfaceTexture - - /** - * Schedule the underlying [SurfaceTexture] to be presented on this surface. - * - * Needs to be called after any work on the texture is scheduled via [Queue.submit] - */ - fun present() - - /** Release this memory held by this surface. */ - override fun release() -} - -/** Defines the capabilities of a given surface and adapter. */ -expect class SurfaceCapabilities { - /** - * List of supported formats to use with a given adapter. The first format is usually the - * preferred. - */ - val formats: List - - /** List of supported presentation modes to use with the given adapter. */ - val alphaModes: List -} - -/** - * Describes a [Surface]. For use with [Surface.configure]. - * - * @param device the device of the surface - * @param usage the usage of the swap chain. The only supported usage is - * [TextureUsage.RENDER_ATTACHMENT]. - * @param format the texture format of the swap chain. The only formats that are guaranteed are - * [TextureFormat.BGRA8_UNORM] and [TextureFormat.BGRA8_UNORM_SRGB]. - * @param presentMode Presentation mode of the swap chain. Fifo is the only mode guaranteed to be - * supported. FifoRelaxed, Imeediate, and Mailbox will crash if unsupported, while AutoVsync and - * AutoNoVsync will gracefully do a designed sets of fallbacks if their primary modes are - * unsupported. - * @param alphaMode specifies how the alpha channel of textures should be handled during - * compositing. - * @param width width of the swap chain - * @param height height of the swap chain - */ -data class SurfaceConfiguration( - val device: Device, - val usage: TextureUsage, - val format: TextureFormat, - val presentMode: PresentMode, - val alphaMode: AlphaMode, - val width: Int, - val height: Int, -) - -/** - * Describes a [TextureView]. - * - * @param format the format of the texture view. Either must be the same as the texture format or in - * the list of `viewFormats` in the texture's descriptor. - * @param dimension the dimension of the texture view. For 1D textures, this must be - * [TextureViewDimension.D1]. For 2D textures, it must be one of [TextureViewDimension.D2], - * [TextureViewDimension.D2_ARRAY], [TextureViewDimension.CUBE], and - * [TextureViewDimension.CUBE_ARRAY]. For 3D textures it must be [TextureViewDimension.D3]. - * @param aspect the aspect of the texture. Color textures must be [TextureAspect.ALL]. - * @param baseMipLevel base mip level. - * @param mipLevelCount mip level count. `baseMipLevel + mipLevelCount` must b e less or equal to - * underlying texture mip count. If `0` considered to include the rest of the mipmap levels, but - * at least 1 in total. - * @param baseArrayLayer base array layer. - * @param arrayLayerCount Layer count. `baseArrayLayer + arrayLayerCount` must be less or equal to - * the underlying array count. If `0`, considered to include the rest of the array layers, but at - * least 1 in total. - * @param label debug label of a texture view. - */ -data class TextureViewDescriptor( - val format: TextureFormat, - val dimension: TextureViewDimension, - val aspect: TextureAspect = TextureAspect.ALL, - val baseMipLevel: Int = 0, - val mipLevelCount: Int = 0, - val baseArrayLayer: Int = 0, - val arrayLayerCount: Int = 0, - val label: String? = null -) - -/** - * Describes a [WebGPUTexture]. - * - * @param size of the texture. All components must be greater than zero. For a regular 1D/2D - * texture, the unused sizes will be 1. For 2DArray textures, Z is the number of 2D textures in - * that array. - * @param mipLevelCount mip count of the texture. For a texture with no extra mips, this must be 1. - * @param sampleCount sample count ofa texture. If this is not 1, texture must have - * `TextureBindingLayout.multisampled` set to true. - * @param dimension dimensions of the texture. - * @param format format of the texture. - * @param usage allowed usages of the texture. If used in other ways, the operation will fail. - * @param label debug label of a texture. - */ -data class TextureDescriptor( - val size: Extent3D, - val mipLevelCount: Int, - val sampleCount: Int, - val dimension: TextureDimension, - val format: TextureFormat, - val usage: TextureUsage, - val label: String? = null -) - -/** A texture that can be rendered to. Result of a successful call to [Surface.getCurrentTexture] */ -expect class SurfaceTexture { - /** The accessible view of the frame. */ - val texture: WebGPUTexture? - - /** The current status of the texture */ - val status: TextureStatus -} - -/** Handle to a texture on the GPU. It can be created with [Device.createTexture]. */ -expect class WebGPUTexture : Releasable { - /** Creates a view of this texture. */ - fun createView(desc: TextureViewDescriptor? = null): TextureView - - override fun release() - - /** Destroy the associated native resources as soon as possible. */ - fun destroy() -} - -/** - * A handle to a texture view. - * - * A `TextureView` object describes a texture and associated metadata needed by a [RenderPipeline] - * or [BindGroup]. - */ -expect class TextureView : IntoBindingResource { - fun release() -} - -/** - * Describes a [GPUBuffer]. For use with [Device.createBuffer]. - * - * @param label debug label of a buffer. - * @param size size of a buffer, in bytes. - * @param usage usages of a buffer. If the buffer is used in any way that isn't specified here, the - * operation will fail. - * @param mappedAtCreation allows a buffer to be mapped immediately after they are made. It does not - * have to [BufferUsage.MAP_READ] or [BufferUsage.MAP_WRITE], all buffers are allowed to be mapped - * at creation. If this is `true`, [size] must be a multiple of `4`. - */ -data class BufferDescriptor( - val label: String, - val size: Long, - val usage: BufferUsage, - val mappedAtCreation: Boolean -) - -/** - * Handle to a GPU-accessible buffer. - * - * Create with [Device.createBuffer]. - * - * @see [Device.createGPUFloatBuffer] - * @see [Device.createGPUIntBuffer] - * @see [Device.createGPUShortBuffer] - * @see [Device.createGPUByteBuffer] - */ -expect class GPUBuffer : Releasable { - - /** The length of the buffer allocation in bytes. */ - val size: Long - - /** - * Use only a portion of this buffer for a given operation. - * - * @return the underlying [ByteBuffer] - */ - // see the empty param getMappedRange function for a reason why we aren't using default values - // here. - fun getMappedRange(offset: Long, size: Long): ByteBuffer - - /** - * Use the entire buffer as the portion for a given operation. - * - * @return the underlying [ByteBuffer] - */ - // we are using an empty parameter function here instead of a extension - // because of a JS IR compiler error throwing an IrLinkageError when referencing size as a - // default param - fun getMappedRange(): ByteBuffer - - /** Flushes any pending write operations and unmaps the buffer from host memory. */ - fun unmap() - - override fun release() - - /** Destroy the associated native resources as soon as possible. */ - fun destroy() -} - -/** - * Describes a [Sampler]. For use with [Device.createSampler]. - * - * @param compare if enabled, this is a comparison sampler using the given comparison function. - * @param addressModeU how to detail with out of bounds accesses in the u (i.e. x) direction - * @param addressModeV how to detail with out of bounds accesses in the v (i.e. y) direction - * @param addressModeW how to detail with out of bounds accesses in the w (i.e. z) direction - * @param magFilter how to filter the texture when it needs to be magnified (made larger) - * @param minFilter how to filter the texture when it needs to be minified (made smaller) - * @param mipmapFilter how to filter between mip map levels - * @param lodMinClamp minimum level of detail (i.e. mip level) to use - * @param lodMaxClamp maximum level of detail (i.e. mip level) to use - * @param maxAnisotropy must be at least 1. if this is not 1, all filter must e linear. - * @param label debug label of a sampler. - */ -data class SamplerDescriptor( - val compare: CompareFunction? = null, - val addressModeU: AddressMode = AddressMode.CLAMP_TO_EDGE, - val addressModeV: AddressMode = AddressMode.CLAMP_TO_EDGE, - val addressModeW: AddressMode = AddressMode.CLAMP_TO_EDGE, - val magFilter: FilterMode = FilterMode.NEAREST, - val minFilter: FilterMode = FilterMode.NEAREST, - val mipmapFilter: FilterMode = FilterMode.NEAREST, - val lodMinClamp: Float = 0f, - val lodMaxClamp: Float = 100000000f, - val maxAnisotropy: Short = 1, - val label: String? = null -) - -/** - * A handle to a sampler. - * - * A `Sampler` object defines how a pipeline will sample from a [TextureView]. Samplers define image - * filters (including anisotropy) and address (wrapping) modes, among other things. See - * [SamplerDescriptor]. - * - * It can be created with [Device.createSampler]. - */ -expect class Sampler : IntoBindingResource, Releasable { - override fun release() -} diff --git a/core/src/commonMain/kotlin/com/littlekt/resources/BufferResourceInfo.kt b/core/src/commonMain/kotlin/com/littlekt/resources/BufferResourceInfo.kt index 1cd85802a..aedd66b00 100644 --- a/core/src/commonMain/kotlin/com/littlekt/resources/BufferResourceInfo.kt +++ b/core/src/commonMain/kotlin/com/littlekt/resources/BufferResourceInfo.kt @@ -1,13 +1,13 @@ package com.littlekt.resources import com.littlekt.EngineStats -import com.littlekt.graphics.webgpu.GPUBuffer +import io.ygdrasil.wgpu.Buffer /** * @author Colton Daily * @date 4/14/2024 */ -class BufferResourceInfo(val buffer: GPUBuffer, val size: Long = 0L) : ResourceInfo() { +class BufferResourceInfo(val buffer: Buffer, val size: Long = 0L) : ResourceInfo() { init { EngineStats.bufferAllocated(this) } diff --git a/core/src/commonMain/kotlin/com/littlekt/resources/TextureResourceInfo.kt b/core/src/commonMain/kotlin/com/littlekt/resources/TextureResourceInfo.kt index 3561f5905..231a9740b 100644 --- a/core/src/commonMain/kotlin/com/littlekt/resources/TextureResourceInfo.kt +++ b/core/src/commonMain/kotlin/com/littlekt/resources/TextureResourceInfo.kt @@ -1,13 +1,13 @@ package com.littlekt.resources import com.littlekt.EngineStats -import com.littlekt.graphics.webgpu.WebGPUTexture +import io.ygdrasil.wgpu.Texture /** * @author Colton Daily * @date 4/14/2024 */ -class TextureResourceInfo(val texture: WebGPUTexture, val size: Long = 0L) : ResourceInfo() { +class TextureResourceInfo(val texture: Texture, val size: Long = 0L) : ResourceInfo() { init { EngineStats.textureAllocated(this) } diff --git a/core/src/commonMain/kotlin/com/littlekt/resources/internal/InternalResources.kt b/core/src/commonMain/kotlin/com/littlekt/resources/internal/InternalResources.kt index 59d1ca1d9..cb9fb61a6 100644 --- a/core/src/commonMain/kotlin/com/littlekt/resources/internal/InternalResources.kt +++ b/core/src/commonMain/kotlin/com/littlekt/resources/internal/InternalResources.kt @@ -12,7 +12,6 @@ import com.littlekt.graphics.g2d.font.BitmapFont import com.littlekt.graphics.g2d.font.FontMetrics import com.littlekt.graphics.g2d.font.Kerning import com.littlekt.graphics.slice -import com.littlekt.graphics.webgpu.TextureFormat import com.littlekt.math.MutableVec4i import com.littlekt.util.MutableTextureAtlas import com.littlekt.util.internal.SingletonBase @@ -45,14 +44,11 @@ internal class InternalResources private constructor(private val context: Contex lateinit var transparent: TextureSlice suspend fun load() { - val textureFormat = - if (context.graphics.preferredFormat.srgb) TextureFormat.RGBA8_UNORM_SRGB - else TextureFormat.RGBA8_UNORM + val textureFormat = context.graphics.preferredFormat val device = context.graphics.device - val page = - context.vfsUrl.json.decodeFromString( - defaultTilesJson.decodeFromBase64().decodeToString() - ) + val page = context.vfsUrl.json.decodeFromString( + defaultTilesJson.decodeFromBase64().decodeToString() + ) val info = AtlasInfo(page.meta, listOf(page)) val tilesTexture = PixmapTexture(device, textureFormat, defaultTilesBmp.decodeFromBase64().readPixmap()) @@ -147,11 +143,13 @@ internal class InternalResources private constructor(private val context: Contex ) } } + line.startsWith("common ") -> { lineHeight = map["lineHeight"]?.toFloatOrNull() ?: 16f base = map["base"]?.toFloatOrNull() pages = map["pages"]?.toIntOrNull() ?: 1 } + line.startsWith("char ") -> { val page = map["page"]?.toIntOrNull() ?: 0 val texture = textures[page] ?: textures.values.first() @@ -172,13 +170,13 @@ internal class InternalResources private constructor(private val context: Contex fontSize = fontSize, id = id, slice = - TextureSlice( - texture, - map["x"]?.toIntOrNull() ?: 0, - map["y"]?.toIntOrNull() ?: 0, - width, - height - ), + TextureSlice( + texture, + map["x"]?.toIntOrNull() ?: 0, + map["y"]?.toIntOrNull() ?: 0, + width, + height + ), xoffset = map["xoffset"]?.toIntOrNull() ?: 0, yoffset = -(height + (map["yoffset"]?.toIntOrNull() ?: 0)), width = width, @@ -187,6 +185,7 @@ internal class InternalResources private constructor(private val context: Contex page = page ) } + line.startsWith("kerning ") -> { kernings += Kerning( diff --git a/core/src/commonMain/kotlin/com/littlekt/util/MutableTextureAtlas.kt b/core/src/commonMain/kotlin/com/littlekt/util/MutableTextureAtlas.kt index ed34ba6bb..8363cee51 100644 --- a/core/src/commonMain/kotlin/com/littlekt/util/MutableTextureAtlas.kt +++ b/core/src/commonMain/kotlin/com/littlekt/util/MutableTextureAtlas.kt @@ -9,10 +9,10 @@ import com.littlekt.graphics.Texture import com.littlekt.graphics.drawSlice import com.littlekt.graphics.g2d.TextureAtlas import com.littlekt.graphics.g2d.TextureSlice -import com.littlekt.graphics.webgpu.TextureFormat import com.littlekt.util.packer.BinRect import com.littlekt.util.packer.MaxRectsPacker import com.littlekt.util.packer.PackingOptions +import io.ygdrasil.wgpu.TextureFormat /** * Allows building of a [TextureAtlas] by combining existing textures, texture slices, and texture @@ -65,9 +65,7 @@ class MutableTextureAtlas(val context: Context, options: PackingOptions = Packin } fun toImmutable( - format: TextureFormat = - if (context.graphics.preferredFormat.srgb) TextureFormat.RGBA8_UNORM_SRGB - else TextureFormat.RGBA8_UNORM, + format: TextureFormat = context.graphics.preferredFormat, useMiMaps: Boolean = true ): TextureAtlas { packer.add(entries) diff --git a/core/src/jsMain/kotlin/com/littlekt/LittleKtApp.js.kt b/core/src/jsMain/kotlin/com/littlekt/LittleKtApp.js.kt index 55305f5e3..bc101a219 100644 --- a/core/src/jsMain/kotlin/com/littlekt/LittleKtApp.js.kt +++ b/core/src/jsMain/kotlin/com/littlekt/LittleKtApp.js.kt @@ -1,5 +1,7 @@ package com.littlekt +import io.ygdrasil.wgpu.PowerPreference + /** Properties related to creating a [LittleKtApp] */ actual class LittleKtProps { var width: Int = 960 @@ -8,7 +10,7 @@ actual class LittleKtProps { var title: String = "LitteKt" var resourcesDir: String = "./" var applicationDir: String = "./" - var powerPreference = PowerPreference.HIGH_POWER + var powerPreference = PowerPreference.highPerformance } /** @@ -40,12 +42,6 @@ class JsConfiguration( val canvasId: String = "canvas", val resourcesPath: String = "./", val applicationPath: String = "./", - val powerPreference: PowerPreference = PowerPreference.HIGH_POWER + val powerPreference: PowerPreference = PowerPreference.highPerformance ) : ContextConfiguration() -val PowerPreference.nativeFlag: String - get() = - when (this) { - PowerPreference.LOW_POWER -> "low-power" - PowerPreference.HIGH_POWER -> "high-performance" - } diff --git a/core/src/jsMain/kotlin/com/littlekt/WebGPUContext.kt b/core/src/jsMain/kotlin/com/littlekt/WebGPUContext.kt index 1560dfbbd..1ca5680a5 100644 --- a/core/src/jsMain/kotlin/com/littlekt/WebGPUContext.kt +++ b/core/src/jsMain/kotlin/com/littlekt/WebGPUContext.kt @@ -4,18 +4,17 @@ import com.littlekt.async.KT import com.littlekt.async.KtScope import com.littlekt.file.* import com.littlekt.file.vfs.VfsFile -import com.littlekt.graphics.webgpu.Adapter -import com.littlekt.graphics.webgpu.GPURequestAdapterOptions -import com.littlekt.graphics.webgpu.navigator import com.littlekt.input.JsInput import com.littlekt.log.Logger import com.littlekt.resources.internal.InternalResources import com.littlekt.util.datastructure.fastForEach +import com.littlekt.util.internal.jsObject +import io.ygdrasil.wgpu.internal.js.GPURequestAdapterOptions +import io.ygdrasil.wgpu.requestAdapter import kotlin.time.Duration.Companion.milliseconds import kotlinx.browser.document import kotlinx.browser.window import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.await import kotlinx.coroutines.launch import org.w3c.dom.HTMLCanvasElement @@ -61,11 +60,11 @@ class WebGPUContext(override val configuration: JsConfiguration) : Context() { graphics._height = canvas.clientHeight KtScope.launch { - val adapterOptions = GPURequestAdapterOptions { - powerPreference = configuration.powerPreference.nativeFlag + val adapterOptions: GPURequestAdapterOptions = jsObject { + powerPreference = configuration.powerPreference.value } - graphics.adapter = Adapter(navigator.gpu.requestAdapter(adapterOptions).await()) - graphics.device = graphics.adapter.requestDevice() + graphics.adapter = requestAdapter(adapterOptions) ?: error("No appropriate Adapter found.") + graphics.device = graphics.adapter.requestDevice() ?: error("No appropriate Device found.") if (configuration.loadInternalResources) { InternalResources.createInstance(this@WebGPUContext) InternalResources.INSTANCE.load() diff --git a/core/src/jsMain/kotlin/com/littlekt/WebGPUGraphics.kt b/core/src/jsMain/kotlin/com/littlekt/WebGPUGraphics.kt index 3467135d2..9fa094b30 100644 --- a/core/src/jsMain/kotlin/com/littlekt/WebGPUGraphics.kt +++ b/core/src/jsMain/kotlin/com/littlekt/WebGPUGraphics.kt @@ -2,9 +2,18 @@ package com.littlekt import com.littlekt.graphics.Cursor import com.littlekt.graphics.SystemCursor -import com.littlekt.graphics.webgpu.* -import com.littlekt.util.internal.jsObject -import kotlinx.browser.window +import io.ygdrasil.wgpu.Adapter +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.Surface +import io.ygdrasil.wgpu.requestAdapter +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.CompositeAlphaMode +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.SurfaceConfiguration +import io.ygdrasil.wgpu.getSurface +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.async import org.w3c.dom.Element import org.w3c.dom.HTMLCanvasElement import org.w3c.dom.events.Event @@ -19,9 +28,10 @@ class WebGPUGraphics(val canvas: HTMLCanvasElement) : Graphics { internal var _width: Int = 0 internal var _height: Int = 0 - private val canvasContext = - canvas.getContext("webgpu").unsafeCast() - ?: error("WebGPU context required") + override lateinit var adapter: Adapter + override lateinit var device: Device + override val surface: Surface = canvas.getSurface() ?: error("fail to get context") + override val preferredFormat: TextureFormat = surface.preferredCanvasFormat ?: error("fail to get preferredCanvasFormat") init { // suppress context menu @@ -30,6 +40,11 @@ class WebGPUGraphics(val canvas: HTMLCanvasElement) : Graphics { _width = canvas.clientWidth _height = canvas.clientHeight + + GlobalScope.async { + adapter = requestAdapter() ?: error("No appropriate Adapter found.") + device = adapter.requestDevice() ?: error("No appropriate Device found.") + }.onAwait } override val width: Int @@ -44,27 +59,14 @@ class WebGPUGraphics(val canvas: HTMLCanvasElement) : Graphics { override val backBufferHeight: Int get() = height - override val surface: Surface = - Surface(window.navigator.asDynamic().gpu.unsafeCast(), canvasContext) - - override var adapter: Adapter = Adapter(jsObject().unsafeCast()) - - override var device: Device = Device(jsObject().unsafeCast()) - - override val preferredFormat: TextureFormat by lazy { surface.getPreferredFormat(adapter) } - - override val surfaceCapabilities: SurfaceCapabilities by lazy { - surface.getCapabilities(adapter) - } - override fun configureSurface( - usage: TextureUsage, + usages: Set, format: TextureFormat, presentMode: PresentMode, - alphaMode: AlphaMode + alphaMode: CompositeAlphaMode ) { surface.configure( - SurfaceConfiguration(device, usage, format, presentMode, alphaMode, width, height) + SurfaceConfiguration(device, format,usages, alphaMode = alphaMode) ) } diff --git a/core/src/jsMain/kotlin/com/littlekt/file/vfs/VfsLoaders.js.kt b/core/src/jsMain/kotlin/com/littlekt/file/vfs/VfsLoaders.js.kt index de3b527a3..fd1a71101 100644 --- a/core/src/jsMain/kotlin/com/littlekt/file/vfs/VfsLoaders.js.kt +++ b/core/src/jsMain/kotlin/com/littlekt/file/vfs/VfsLoaders.js.kt @@ -9,7 +9,7 @@ import com.littlekt.file.ByteBufferImpl import com.littlekt.graphics.Pixmap import com.littlekt.graphics.PixmapTexture import com.littlekt.graphics.Texture -import com.littlekt.graphics.webgpu.TextureFormat +import io.ygdrasil.wgpu.TextureFormat import kotlinx.browser.document import kotlinx.coroutines.CompletableDeferred import org.w3c.dom.* diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/DataToNativeExt.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/DataToNativeExt.kt deleted file mode 100644 index 62e9073e0..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/DataToNativeExt.kt +++ /dev/null @@ -1,482 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.util.internal.jsObject - -fun GPUObjectBase(init: GPUObjectBase.() -> Unit = {}): GPUObjectBase = - jsObject(init).unsafeCast() - -fun GPURequestAdapterOptions( - init: GPURequestAdapterOptions.() -> Unit = {} -): GPURequestAdapterOptions = jsObject(init).unsafeCast() - -fun GPUDeviceDescriptor(init: GPUDeviceDescriptor.() -> Unit = {}): GPUDeviceDescriptor = - jsObject(init).unsafeCast() - -fun DeviceDescriptor.toNative(): GPUDeviceDescriptor = GPUDeviceDescriptor { - val it = this@toNative - if (it.requiredFeatures != null) { - requiredFeatures = it.requiredFeatures.map { it.nativeVal }.toTypedArray() - } - if (it.requiredLimits != null) { - val requiredLimits = it.requiredLimits - val map = mutableMapOf() - requiredLimits.maxTextureDimension1D?.let { map["maxTextureDimension1D"] = it.toLong() } - requiredLimits.maxTextureDimension2D?.let { map["maxTextureDimension2D"] = it.toLong() } - requiredLimits.maxTextureDimension3D?.let { map["maxTextureDimension3D"] = it.toLong() } - requiredLimits.maxTextureArrayLayers?.let { map["maxTextureArrayLayers"] = it.toLong() } - requiredLimits.maxBindGroups?.let { map["maxBindGroups"] = it.toLong() } - requiredLimits.maxBindGroupsPlusVertexBuffers?.let { - map["maxBindGroupsPlusVertexBuffers"] = it.toLong() - } - requiredLimits.maxBindingsPerBindGroup?.let { map["maxBindingsPerBindGroup"] = it.toLong() } - requiredLimits.maxDynamicUniformBuffersPerPipelineLayout?.let { - map["maxDynamicUniformBuffersPerPipelineLayout"] = it.toLong() - } - requiredLimits.maxDynamicStorageBuffersPerPipelineLayout?.let { - map["maxDynamicStorageBuffersPerPipelineLayout"] = it.toLong() - } - requiredLimits.maxSampledTexturesPerShaderStage?.let { - map["maxSampledTexturesPerShaderStage"] = it.toLong() - } - requiredLimits.maxSamplersPerShaderStage?.let { - map["maxSamplersPerShaderStage"] = it.toLong() - } - requiredLimits.maxStorageBuffersPerShaderStage?.let { - map["maxStorageBuffersPerShaderStage"] = it.toLong() - } - requiredLimits.maxStorageTexturesPerShaderStage?.let { - map["maxStorageTexturesPerShaderStage"] = it.toLong() - } - requiredLimits.maxUniformBuffersPerShaderStage?.let { - map["maxUniformBuffersPerShaderStage"] = it.toLong() - } - requiredLimits.maxUniformBufferBindingSize?.let { map["maxUniformBufferBindingSize"] = it } - requiredLimits.maxStorageBufferBindingSize?.let { map["maxStorageBufferBindingSize"] = it } - requiredLimits.minUniformBufferOffsetAlignment?.let { - map["minUniformBufferOffsetAlignment"] = it.toLong() - } - requiredLimits.minStorageBufferOffsetAlignment?.let { - map["minStorageBufferOffsetAlignment"] = it.toLong() - } - requiredLimits.maxVertexBuffers?.let { map["maxVertexBuffers"] = it.toLong() } - requiredLimits.maxBufferSize?.let { map["maxBufferSize"] = it } - requiredLimits.maxVertexAttributes?.let { map["maxVertexAttributes"] = it.toLong() } - requiredLimits.maxVertexBufferArrayStride?.let { - map["maxVertexBufferArrayStride"] = it.toLong() - } - this.requiredLimits = map - } -} - -fun GPUCanvasConfiguration(init: GPUCanvasConfiguration.() -> Unit = {}): GPUCanvasConfiguration = - jsObject(init).unsafeCast() - -fun SurfaceConfiguration.toNative(): GPUCanvasConfiguration = GPUCanvasConfiguration { - val it = this@toNative - device = it.device.delegate - format = it.format.nativeVal - usage = it.usage.usageFlag - alphaMode = it.alphaMode.nativeVal -} - -fun GPUShaderModuleDescriptor( - init: GPUShaderModuleDescriptor.() -> Unit = {} -): GPUShaderModuleDescriptor = jsObject(init).unsafeCast() - -fun GPUPipelineLayoutDescriptor( - init: GPUPipelineLayoutDescriptor.() -> Unit = {} -): GPUPipelineLayoutDescriptor = jsObject(init).unsafeCast() - -fun PipelineLayoutDescriptor.toNative(): GPUPipelineLayoutDescriptor = GPUPipelineLayoutDescriptor { - val it = this@toNative - bindGroupLayouts = it.delegates - label = it.label -} - -fun GPURenderPipelineDescriptor( - init: GPURenderPipelineDescriptor.() -> Unit = {} -): GPURenderPipelineDescriptor = jsObject(init).unsafeCast() - -fun RenderPipelineDescriptor.toNative(): GPURenderPipelineDescriptor = GPURenderPipelineDescriptor { - val it = this@toNative - layout = it.layout.delegate - vertex = it.vertex.toNative() - primitive = it.primitive.toNative() - depthStencil = it.depthStencil?.toNative() ?: undefined - multisample = it.multisample.toNative() - fragment = it.fragment?.toNative() ?: undefined - label = it.label -} - -fun GPUVertexState(init: GPUVertexState.() -> Unit = {}): GPUVertexState = - jsObject(init).unsafeCast() - -fun VertexState.toNative(): GPUVertexState = GPUVertexState { - val it = this@toNative - module = it.module.delegate - entryPoint = it.entryPoint - buffers = it.buffers.map { it.toNative() }.toTypedArray() -} - -fun GPUVertexBufferLayout(init: GPUVertexBufferLayout.() -> Unit = {}): GPUVertexBufferLayout = - jsObject(init).unsafeCast() - -fun WebGPUVertexBufferLayout.toNative(): GPUVertexBufferLayout = GPUVertexBufferLayout { - val it = this@toNative - arrayStride = it.arrayStride - stepMode = it.stepMode.nativeVal - attributes = it.attributes.map { it.toNative() }.toTypedArray() -} - -fun GPUVertexAttribute(init: GPUVertexAttribute.() -> Unit = {}): GPUVertexAttribute = - jsObject(init).unsafeCast() - -fun WebGPUVertexAttribute.toNative(): GPUVertexAttribute = GPUVertexAttribute { - val it = this@toNative - format = it.format.nativeVal - offset = it.offset - shaderLocation = it.shaderLocation -} - -fun GPUPrimitiveState(init: GPUPrimitiveState.() -> Unit = {}): GPUPrimitiveState = - jsObject(init).unsafeCast() - -fun PrimitiveState.toNative(): GPUPrimitiveState = GPUPrimitiveState { - val it = this@toNative - topology = it.topology.nativeVal - stripIndexFormat = it.stripIndexFormat?.nativeVal ?: undefined - frontFace = it.frontFace.nativeVal - cullMode = it.cullMode.nativeVal -} - -fun GPUDepthStencilState(init: GPUDepthStencilState.() -> Unit = {}): GPUDepthStencilState = - jsObject(init).unsafeCast() - -fun DepthStencilState.toNative(): GPUDepthStencilState = GPUDepthStencilState { - val it = this@toNative - format = it.format.nativeVal - depthWriteEnabled = it.depthWriteEnabled - depthCompare = it.depthCompare.nativeVal - stencilFront = it.stencil.front.toNative() - stencilBack = it.stencil.back.toNative() - stencilReadMask = it.stencil.readMask - stencilWriteMask = it.stencil.writeMask - depthBias = it.bias.constant - depthBiasSlopeScale = it.bias.slopeScale - depthBiasClamp = it.bias.clamp -} - -fun GPUStencilFaceState(init: GPUStencilFaceState.() -> Unit = {}): GPUStencilFaceState = - jsObject(init).unsafeCast() - -fun StencilFaceState.toNative(): GPUStencilFaceState = GPUStencilFaceState { - val it = this@toNative - compare = it.compare.nativeVal - failOp = it.failOp.nativeVal - depthFailOp = it.depthFailOp.nativeVal - passOp = it.passOp.nativeVal -} - -fun GPUMultisampleState(init: GPUMultisampleState.() -> Unit = {}): GPUMultisampleState = - jsObject(init).unsafeCast() - -fun MultisampleState.toNative(): GPUMultisampleState = GPUMultisampleState { - val it = this@toNative - count = it.count - mask = it.mask - alphaToCoverageEnabled = it.alphaToCoverageEnabled -} - -fun GPUFragmentState(init: GPUFragmentState.() -> Unit = {}): GPUFragmentState = - jsObject(init).unsafeCast() - -fun FragmentState.toNative(): GPUFragmentState = GPUFragmentState { - val it = this@toNative - module = it.module.delegate - entryPoint = it.entryPoint - targets = it.targets.map { it.toNative() }.toTypedArray() -} - -fun GPUColorTargetState(init: GPUColorTargetState.() -> Unit = {}): GPUColorTargetState = - jsObject(init).unsafeCast() - -fun ColorTargetState.toNative(): GPUColorTargetState = GPUColorTargetState { - val it = this@toNative - format = it.format.nativeVal - blend = it.blendState?.toNative() ?: undefined - writeMask = it.writeMask.usageFlag -} - -fun GPUBlendState(init: GPUBlendState.() -> Unit = {}): GPUBlendState = - jsObject(init).unsafeCast() - -fun BlendState.toNative(): GPUBlendState = GPUBlendState { - val it = this@toNative - color = it.color.toNative() - alpha = it.alpha.toNative() -} - -fun GPUBlendComponent(init: GPUBlendComponent.() -> Unit = {}): GPUBlendComponent = - jsObject(init).unsafeCast() - -fun BlendComponent.toNative(): GPUBlendComponent = GPUBlendComponent { - val it = this@toNative - operation = it.operation.nativeVal - srcFactor = it.srcFactor.nativeVal - dstFactor = it.dstFactor.nativeVal -} - -fun GPUComputePipelineDescriptor( - init: GPUComputePipelineDescriptor.() -> Unit = {} -): GPUComputePipelineDescriptor = jsObject(init).unsafeCast() - -fun ComputePipelineDescriptor.toNative(): GPUComputePipelineDescriptor = - GPUComputePipelineDescriptor { - val it = this@toNative - layout = it.layout.delegate - compute = it.compute.toNative() - label = it.label - } - -fun GPUProgrammableStage(init: GPUProgrammableStage.() -> Unit = {}): GPUProgrammableStage = - jsObject(init).unsafeCast() - -fun ProgrammableStage.toNative(): GPUProgrammableStage = GPUProgrammableStage { - val it = this@toNative - module = it.module.delegate - entryPoint = it.entryPoint - // TODO constants? -} - -fun GPUBufferDescriptor(init: GPUBufferDescriptor.() -> Unit = {}): GPUBufferDescriptor = - jsObject(init).unsafeCast() - -fun BufferDescriptor.toNative(): GPUBufferDescriptor = GPUBufferDescriptor { - val it = this@toNative - size = it.size - usage = it.usage.usageFlag - mappedAtCreation = it.mappedAtCreation - label = it.label -} - -fun GPUBindGroupLayoutDescriptor( - init: GPUBindGroupLayoutDescriptor.() -> Unit = {} -): GPUBindGroupLayoutDescriptor = jsObject(init).unsafeCast() - -fun BindGroupLayoutDescriptor.toNative(): GPUBindGroupLayoutDescriptor = - GPUBindGroupLayoutDescriptor { - val it = this@toNative - entries = it.entries.map { it.toNative() }.toTypedArray() - label = it.label - } - -fun GPUBindGroupLayoutEntry( - init: GPUBindGroupLayoutEntry.() -> Unit = {} -): GPUBindGroupLayoutEntry = jsObject(init).unsafeCast() - -fun BindGroupLayoutEntry.toNative(): GPUBindGroupLayoutEntry = GPUBindGroupLayoutEntry { - val it = this@toNative - binding = it.binding - visibility = it.visibility.usageFlag - when (val layout = it.bindingLayout) { - is BufferBindingLayout -> buffer = layout.toNative() - is SamplerBindingLayout -> sampler = layout.toNative() - is TextureBindingLayout -> texture = layout.toNative() - else -> { - TODO("Implement storageTexture and externalTexture binding layouts!") - } - } -} - -fun GPUBufferBindingLayout(init: GPUBufferBindingLayout.() -> Unit = {}): GPUBufferBindingLayout = - jsObject(init).unsafeCast() - -fun BufferBindingLayout.toNative(): GPUBufferBindingLayout = GPUBufferBindingLayout { - val it = this@toNative - type = it.type.nativeVal - hasDynamicOffset = it.hasDynamicOffset - minBindingSize = it.minBindingSize -} - -fun GPUBufferSamplerBindingLayout( - init: GPUBufferSamplerBindingLayout.() -> Unit = {} -): GPUBufferSamplerBindingLayout = jsObject(init).unsafeCast() - -fun SamplerBindingLayout.toNative(): GPUBufferSamplerBindingLayout = GPUBufferSamplerBindingLayout { - val it = this@toNative - type = it.type.nativeVal -} - -fun GPUTextureBindingLayout( - init: GPUTextureBindingLayout.() -> Unit = {} -): GPUTextureBindingLayout = jsObject(init).unsafeCast() - -fun TextureBindingLayout.toNative(): GPUTextureBindingLayout = GPUTextureBindingLayout { - val it = this@toNative - sampleType = it.sampleType.nativeVal - viewDimension = it.viewDimension.nativeVal - multisampled = it.multisampled -} - -fun GPUBindGroupDescriptor(init: GPUBindGroupDescriptor.() -> Unit = {}): GPUBindGroupDescriptor = - jsObject(init).unsafeCast() - -fun BindGroupDescriptor.toNative(): GPUBindGroupDescriptor = GPUBindGroupDescriptor { - val it = this@toNative - layout = it.layout.delegate - entries = it.entries.map { it.toNative() }.toTypedArray() - label = it.label -} - -fun GPUBindGroupEntry(init: GPUBindGroupEntry.() -> Unit = {}): GPUBindGroupEntry = - jsObject(init).unsafeCast() - -fun BindGroupEntry.toNative(): GPUBindGroupEntry = GPUBindGroupEntry { - val it = this@toNative - binding = it.binding - resource = it.resource.toNative() -} - -fun GPUSamplerDescriptor(init: GPUSamplerDescriptor.() -> Unit = {}): GPUSamplerDescriptor = - jsObject(init).unsafeCast() - -fun SamplerDescriptor.toNative(): GPUSamplerDescriptor = GPUSamplerDescriptor { - val it = this@toNative - addressModeU = it.addressModeU.nativeVal - addressModeV = it.addressModeV.nativeVal - addressModeW = it.addressModeW.nativeVal - magFilter = it.magFilter.nativeVal - minFilter = it.minFilter.nativeVal - mipmapFilter = it.mipmapFilter.nativeVal - lodMinClamp = it.lodMinClamp - lodMaxClamp = it.lodMaxClamp - compare = it.compare?.nativeVal ?: undefined - maxAnisotropy = it.maxAnisotropy - label = it.label -} - -fun GPUTextureDescriptor(init: GPUTextureDescriptor.() -> Unit = {}): GPUTextureDescriptor = - jsObject(init).unsafeCast() - -fun TextureDescriptor.toNative(): GPUTextureDescriptor = GPUTextureDescriptor { - val it = this@toNative - size = it.size.toNative() - mipLevelCount = it.mipLevelCount - sampleCount = it.sampleCount - dimension = it.dimension.nativeVal - format = it.format.nativeVal - usage = it.usage.usageFlag - label = it.label - // TODO viewFormats! -} - -fun GPUExtent3D(init: GPUExtent3D.() -> Unit = {}): GPUExtent3D = - jsObject(init).unsafeCast() - -fun Extent3D.toNative(): GPUExtent3D = GPUExtent3D { - val it = this@toNative - width = it.width - height = it.height - depthOrArrayLayer = it.depth -} - -fun GPUImageDataLayout(init: GPUImageDataLayout.() -> Unit = {}): GPUImageDataLayout = - jsObject(init).unsafeCast() - -fun TextureDataLayout.toNative(): GPUImageDataLayout = GPUImageDataLayout { - val it = this@toNative - offset = it.offset - bytesPerRow = it.bytesPerRow - rowsPerImage = it.rowsPerImage -} - -fun GPUTextureViewDescriptor( - init: GPUTextureViewDescriptor.() -> Unit = {} -): GPUTextureViewDescriptor = jsObject(init).unsafeCast() - -fun TextureViewDescriptor.toNative(): GPUTextureViewDescriptor = GPUTextureViewDescriptor { - val it = this@toNative - arrayLayerCount = it.arrayLayerCount - aspect = it.aspect.nativeVal - baseArrayLayer = it.baseArrayLayer - baseMipLevel = it.baseMipLevel - dimension = it.dimension.nativeVal - format = it.format.nativeVal - mipLevelCount = it.mipLevelCount - label = it.label -} - -fun GPURenderPassDescriptor( - init: GPURenderPassDescriptor.() -> Unit = {} -): GPURenderPassDescriptor = jsObject(init).unsafeCast() - -fun RenderPassDescriptor.toNative(): GPURenderPassDescriptor = GPURenderPassDescriptor { - val it = this@toNative - colorAttachments = it.colorAttachments.map { it.toNative() }.toTypedArray() - depthStencilAttachment = it.depthStencilAttachment?.toNative() ?: undefined - label = it.label -} - -fun GPURenderPassColorAttachment( - init: GPURenderPassColorAttachment.() -> Unit = {} -): GPURenderPassColorAttachment = jsObject(init).unsafeCast() - -fun RenderPassColorAttachmentDescriptor.toNative(): GPURenderPassColorAttachment = - GPURenderPassColorAttachment { - val it = this@toNative - view = it.view.delegate - resolveTarget = it.resolveTarget?.delegate ?: undefined - clearValue = it.clearColor?.fields?.toTypedArray() ?: undefined - loadOp = it.loadOp.nativeVal - storeOp = it.storeOp.nativeVal - } - -fun GPURenderPassDepthStencilAttachment( - init: GPURenderPassDepthStencilAttachment.() -> Unit = {} -): GPURenderPassDepthStencilAttachment = - jsObject(init).unsafeCast() - -fun RenderPassDepthStencilAttachmentDescriptor.toNative(): GPURenderPassDepthStencilAttachment = - GPURenderPassDepthStencilAttachment { - val it = this@toNative - view = it.view.delegate - depthClearValue = it.depthClearValue - depthLoadOp = it.depthLoadOp?.nativeVal ?: undefined - depthStoreOp = it.depthStoreOp?.nativeVal ?: undefined - depthReadOnly = it.depthReadOnly - stencilClearValue = it.stencilClearValue - stencilLoadOp = it.stencilLoadOp?.nativeVal ?: undefined - stencilStoreOp = it.stencilStoreOp?.nativeVal ?: undefined - stencilReadOnly = it.stencilReadOnly - } - -fun GPUImageCopyTexture(init: GPUImageCopyTexture.() -> Unit = {}): GPUImageCopyTexture = - jsObject(init).unsafeCast() - -fun TextureCopyView.toNative(): GPUImageCopyTexture = GPUImageCopyTexture { - val it = this@toNative - mipLevel = it.mipLevel - origin = it.origin.toNative() - texture = it.texture.delegate -} - -fun GPUOrigin3D(init: GPUOrigin3D.() -> Unit = {}): GPUOrigin3D = - jsObject(init).unsafeCast() - -fun Origin3D.toNative(): GPUOrigin3D = GPUOrigin3D { - val it = this@toNative - x = it.x - y = it.y - z = it.z -} - -fun GPUImageCopyBuffer(init: GPUImageCopyBuffer.() -> Unit = {}): GPUImageCopyBuffer = - jsObject(init).unsafeCast() - -fun BufferCopyView.toNative(): GPUImageCopyBuffer = GPUImageCopyBuffer { - val it = this@toNative - offset = it.layout.offset - bytesPerRow = it.layout.bytesPerRow - rowsPerImage = it.layout.rowsPerImage - buffer = it.buffer.delegate -} diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/binding.js.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/binding.js.kt deleted file mode 100644 index f131b185a..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/binding.js.kt +++ /dev/null @@ -1,66 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable -import com.littlekt.util.internal.jsObject - -actual interface IntoBindingResource { - fun toNative(): GPUBindingResource -} - -actual class BindGroup(val delegate: GPUBindGroup) : Releasable { - actual override fun release() {} -} - -actual class BufferBinding -actual constructor(val buffer: GPUBuffer, val offset: Long, val size: Long) : IntoBindingResource { - private val delegate = - jsObject().unsafeCast().apply { - buffer = this@BufferBinding.buffer.delegate - offset = this@BufferBinding.offset - size = this@BufferBinding.size - } - - override fun toNative(): GPUBindingResource { - return delegate - } -} - -actual abstract class BindingLayout actual constructor() - -actual class BufferBindingLayout -actual constructor( - val type: BufferBindingType, - val hasDynamicOffset: Boolean, - val minBindingSize: Long -) : BindingLayout() - -actual class TextureBindingLayout -actual constructor( - val sampleType: TextureSampleType, - val viewDimension: TextureViewDimension, - val multisampled: Boolean -) : BindingLayout() - -actual class SamplerBindingLayout actual constructor(val type: SamplerBindingType) : - BindingLayout() - -actual class BindGroupLayoutEntry -actual constructor(val binding: Int, val visibility: ShaderStage, val bindingLayout: BindingLayout) - -actual class BindGroupLayout(val delegate: GPUBindGroupLayout) : Releasable { - actual override fun release() {} -} - -actual class PipelineLayout(val delegate: GPUPipelineLayout) : Releasable { - actual override fun release() {} -} - -actual class PipelineLayoutDescriptor -actual constructor(bindGroupLayouts: List, val label: String?) { - actual constructor( - bindGroupLayout: BindGroupLayout, - label: String? - ) : this(listOf(bindGroupLayout), label) - - val delegates = bindGroupLayouts.map { it.delegate }.toTypedArray() -} diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/command.js.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/command.js.kt deleted file mode 100644 index af4ae19aa..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/command.js.kt +++ /dev/null @@ -1,155 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.EngineStats -import com.littlekt.Releasable - -actual class CommandBuffer(val delegate: GPUCommandBuffer) : Releasable { - actual override fun release() {} -} - -actual class CommandEncoder(val delegate: GPUCommandEncoder) : Releasable { - - actual fun beginRenderPass(desc: RenderPassDescriptor): RenderPassEncoder { - return RenderPassEncoder(delegate.beginRenderPass(desc.toNative()), desc.label) - } - - actual fun finish(): CommandBuffer { - return CommandBuffer(delegate.finish()) - } - - actual fun copyBufferToTexture( - source: BufferCopyView, - destination: TextureCopyView, - copySize: Extent3D - ) { - delegate.copyBufferToTexture(source.toNative(), destination.toNative(), copySize.toNative()) - } - - actual fun beginComputePass(label: String?): ComputePassEncoder { - return ComputePassEncoder(delegate.beginComputePass(GPUObjectBase { this.label = label })) - } - - actual fun copyBufferToBuffer( - source: GPUBuffer, - destination: GPUBuffer, - sourceOffset: Int, - destinationOffset: Int, - size: Long - ) { - delegate.copyBufferToBuffer( - source.delegate, - sourceOffset, - destination.delegate, - destinationOffset, - size - ) - } - - actual fun copyTextureToBuffer(source: TextureCopyView, dest: BufferCopyView, size: Extent3D) { - delegate.copyTextureToBuffer(source.toNative(), dest.toNative(), size.toNative()) - } - - actual override fun release() {} -} - -actual class RenderPipeline(val delegate: GPURenderPipeline) : Releasable { - actual override fun release() {} -} - -actual class RenderPassEncoder( - val delegate: GPURenderPassEncoder, - actual val label: String? = null -) : Releasable { - - actual fun setPipeline(pipeline: RenderPipeline) { - delegate.setPipeline(pipeline.delegate) - } - - actual fun draw(vertexCount: Int, instanceCount: Int, firstVertex: Int, firstInstance: Int) { - EngineStats.drawCalls++ - EngineStats.triangles += (vertexCount / 3) * instanceCount - delegate.draw(vertexCount, instanceCount, firstVertex, firstInstance) - } - - actual fun end() { - delegate.end() - } - - actual fun setVertexBuffer(slot: Int, buffer: GPUBuffer, offset: Long, size: Long) { - delegate.setVertexBuffer(slot.toLong(), buffer.delegate, offset, size) - } - - actual fun drawIndexed( - indexCount: Int, - instanceCount: Int, - firstIndex: Int, - baseVertex: Int, - firstInstance: Int - ) { - EngineStats.drawCalls++ - EngineStats.triangles += (indexCount / 3) * instanceCount - delegate.drawIndexed(indexCount, instanceCount, firstIndex, baseVertex, firstInstance) - } - - actual fun setIndexBuffer( - buffer: GPUBuffer, - indexFormat: IndexFormat, - offset: Long, - size: Long - ) { - delegate.setIndexBuffer(buffer.delegate, indexFormat.nativeVal, offset, size) - } - - actual fun setBindGroup(index: Int, bindGroup: BindGroup, dynamicOffsets: List) { - delegate.setBindGroup(index, bindGroup.delegate, dynamicOffsets.toLongArray()) - } - - actual fun setViewport( - x: Int, - y: Int, - width: Int, - height: Int, - minDepth: Float, - maxDepth: Float - ) { - delegate.setViewport(x, y, width, height, minDepth, maxDepth) - } - - actual fun setScissorRect(x: Int, y: Int, width: Int, height: Int) { - delegate.setScissorRect(x, y, width, height) - } - - actual override fun release() = Unit - - override fun toString(): String { - return "RenderPassEncoder(label=$label)" - } -} - -actual class ComputePipeline(val delegate: GPUComputePipeline) : Releasable { - actual override fun release() = Unit -} - -actual class ComputePassEncoder(val delegate: GPUComputePassEncoder) : Releasable { - actual fun setPipeline(pipeline: ComputePipeline) { - delegate.setPipeline(pipeline.delegate) - } - - actual fun setBindGroup(index: Int, bindGroup: BindGroup) { - delegate.setBindGroup(index, bindGroup.delegate) - } - - actual fun dispatchWorkgroups( - workgroupCountX: Int, - workgroupCountY: Int, - workgroupCountZ: Int - ) { - delegate.dispatchWorkgroups(workgroupCountX, workgroupCountY, workgroupCountZ) - } - - actual fun end() { - delegate.end() - } - - actual override fun release() = Unit -} diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/enums.js.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/enums.js.kt deleted file mode 100644 index bcef64fc0..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/enums.js.kt +++ /dev/null @@ -1,402 +0,0 @@ -package com.littlekt.graphics.webgpu - -val AlphaMode.nativeVal: String - get() = - when (this) { - AlphaMode.OPAQUE -> "opaque" - AlphaMode.PREMULTIPLIED -> "premultiplied" - else -> error("AlphaMode.$name is unsupported on the web!") - } - -val TextureFormat.nativeVal: String - get() = - when (this) { - /** 8 Bit Red channel only. `[0, 255]` converted to/from float `[0, 1]` in shader. */ - TextureFormat.R8_UNORM -> "r8unorm" - - /** - * 8 Bit Red channel only. `[-127, 127]` converted to/from float `[-1, 1]` in shader. - */ - TextureFormat.R8_SNORM -> "r8snorm" - - /** Red channel only. 8 bit integer per channel. Unsigned in shader. */ - TextureFormat.R8_UINT -> "r8uint" - - /** Red channel only. 8 bit integer per channel. Signed in shader. */ - TextureFormat.R8_SINT -> "r8sint" - - /** Red channel only. 16 bit integer per channel. Unsigned in shader. */ - TextureFormat.R16_UINT -> "r16uint" - - /** Red channel only. 16 bit integer per channel. Signed in shader. */ - TextureFormat.R16_SINT -> "r16sint" - - /** Red channel only. 16 bit float per channel. Float in shader. */ - TextureFormat.R16_FLOAT -> "r16float" - - /** - * Red and green channels. 8 bit integer per channel. `[0, 255]` converted to/from float - * `[0, 1]` in shader. - */ - TextureFormat.RG8_UNORM -> "rg8unorm" - - /** - * Red and green channels. 8 bit integer per channel. `[-127, 127]` converted to/from - * float `[-1, 1]` in shader. - */ - TextureFormat.RG8_SNORM -> "rg8snorm" - - /** Red and green channels. 8 bit integer per channel. Unsigned in shader. */ - TextureFormat.RG8_UINT -> "rg8uint" - - /** Red and green channel s. 8 bit integer per channel. Signed in shader. */ - TextureFormat.RG8_SINT -> "rg8sint" - - /** Red channel only. 32 bit integer per channel. Unsigned in shader. */ - TextureFormat.R32_UINT -> "r32uint" - - /** Red channel only. 32 bit integer per channel. Signed in shader. */ - TextureFormat.R32_SINT -> "r32sint" - - /** Red channel only. 32 bit float per channel. Float in shader. */ - TextureFormat.R32_FLOAT -> "r32float" - - /** Red and green channels. 16 bit integer per channel. Unsigned in shader. */ - TextureFormat.RG16_UINT -> "rg16uint" - - /** Red and green channels. 16 bit integer per channel. Signed in shader. */ - TextureFormat.RG16_SINT -> "rg16sint" - - /** Red and green channels. 16 bit float per channel. Float in shader. */ - TextureFormat.RG16_FLOAT -> "rg16float" - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. `[0, 255]` converted - * to/from float `[0, 1]` in shader. - */ - TextureFormat.RGBA8_UNORM -> "rgba8unorm" - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Srgb-color `[0, - * 255]` converted to/from linear-color float `[0, 1]` in shader. - */ - TextureFormat.RGBA8_UNORM_SRGB -> "rgba8unorm-srgb" - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. `[-127, 127]` - * converted to/from float `[-1, 1]` in shader. - */ - TextureFormat.RGBA8_SNORM -> "rgba8snorm" - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Unsigned in shader. - */ - TextureFormat.RGBA8_UINT -> "rgba8uint" - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Signed in shader. - */ - TextureFormat.RGBA8_SINT -> "rgba8sint" - - /** - * Blue, green, red, and alpha channels. 8 bit integer per channel. `[0, 255]` converted - * to/from float `[0, 1]` in shader. - */ - TextureFormat.BGRA8_UNORM -> "bgra8unorm" - - /** - * Blue, green, red, and alpha channels. 8 bit integer per channel. Srgb-color `[0, - * 255]` converted to/from linear-color float `[0, 1]` in shader. - */ - TextureFormat.BGRA8_UNORM_SRGB -> "bgra8unorm-srgb" - - /** - * Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer - * for alpha channel. `[0, 1023]` (`[0, 3]` for alpha) converted to/from float `[0, 1]` - * in shader. - */ - TextureFormat.RGB10A2_UNORM -> "rgb10a2unorm" - - /** - * Red, green, and blue channels. 11 bit float with no sign bit for RG channels. 10 bit - * float with no sign bit for blue channel. Float in shader. - */ - TextureFormat.RG11B10_FLOAT -> "rg11b10ufloat" - - /** Red and green channels. 32 bit integer per channel. Unsigned in shader. */ - TextureFormat.RG32_UINT -> "rg32uint" - - /** Red and green channels. 32 bit integer per channel. Signed in shader. */ - TextureFormat.RG32_SINT -> "rg32sint" - - /** Red and green channels. 32 bit float per channel. Float in shader. */ - TextureFormat.RG32_FLOAT -> "rg32float" - - /** - * Red, green, blue, and alpha channels. 16 bit integer per channel. Unsigned in shader. - */ - TextureFormat.RGBA16_UINT -> "rgba16uint" - - /** - * Red, green, blue, and alpha channels. 16 bit integer per channel. Signed in shader. - */ - TextureFormat.RGBA16_SINT -> "rgba16sint" - - /** Red, green, blue, and alpha channels. 16 bit float per channel. Float in shader. */ - TextureFormat.RGBA16_FLOAT -> "rgba16float" - - /** - * Red, green, blue, and alpha channels. 32 bit integer per channel. Unsigned in shader. - */ - TextureFormat.RGBA32_UINT -> "rgba32uint" - - /** - * Red, green, blue, and alpha channels. 32 bit integer per channel. Signed in shader. - */ - TextureFormat.RGBA32_SINT -> "rgba32sint" - - /** Red, green, blue, and alpha channels. 32 bit float per channel. Float in shader. */ - TextureFormat.RGBA32_FLOAT -> "rgba32float" - - /** Special depth format with 32 bit floating point depth. */ - TextureFormat.DEPTH32_FLOAT -> "depth32float" - - /** Special depth format with at least 24 bit integer depth. */ - TextureFormat.DEPTH24_PLUS -> "depth24plus" - - /** - * Special depth/stencil format with at least 24 bit integer depth and 8 bits integer - * stencil. - */ - TextureFormat.DEPTH24_PLUS_STENCIL8 -> "depth24plus-stencil8" - } - -fun TextureFormat.Companion.from(nativeVal: String) = - TextureFormat.entries.firstOrNull { it.nativeVal == nativeVal } - -val IndexFormat.nativeVal: String - get() = - when (this) { - IndexFormat.UINT16 -> "uint16" - IndexFormat.UINT32 -> "uint32" - } - -val TextureDimension.nativeVal: String - get() = - when (this) { - TextureDimension.D1 -> "1d" - TextureDimension.D2 -> "2d" - TextureDimension.D3 -> "3d" - } - -val TextureViewDimension.nativeVal: String - get() = - when (this) { - TextureViewDimension.D1 -> "1d" - TextureViewDimension.D2 -> "2d" - TextureViewDimension.D2_ARRAY -> "2d-array" - TextureViewDimension.CUBE -> "cube" - TextureViewDimension.CUBE_ARRAY -> "cube-array" - TextureViewDimension.D3 -> "3d" - } - -val TextureAspect.nativeVal: String - get() = - when (this) { - TextureAspect.ALL -> "all" - TextureAspect.STENCIL_ONLY -> "stencil-only" - TextureAspect.DEPTH_ONLY -> "depth-only" - } - -val VertexStepMode.nativeVal: String - get() = - when (this) { - VertexStepMode.VERTEX -> "vertex" - VertexStepMode.INSTANCE -> "instance" - } - -val VertexFormat.nativeVal: String - get() = - when (this) { - VertexFormat.UINT8x2 -> "uint8x2" - VertexFormat.UINT8x4 -> "uint8x4" - VertexFormat.SINT8x2 -> "sint8x2" - VertexFormat.SINT8x4 -> "sint8x4" - VertexFormat.UNORM8x2 -> "unorm8x2" - VertexFormat.UNORM8x4 -> "unorm8x4" - VertexFormat.SNORM8x2 -> "snorm8x2" - VertexFormat.SNORM8x4 -> "snorm8x4" - VertexFormat.UINT16x2 -> "uint16x2" - VertexFormat.UINT16x4 -> "uint16x4" - VertexFormat.SINT16x2 -> "sint16x2" - VertexFormat.SINT16x4 -> "sint16x4" - VertexFormat.UNORM16x2 -> "unorm16x2" - VertexFormat.UNORM16x4 -> "unorm16x4" - VertexFormat.SNORM16x2 -> "snorm16x2" - VertexFormat.SNORM16x4 -> "snorm16x4" - VertexFormat.FLOAT16x2 -> "float16x2" - VertexFormat.FLOAT16x4 -> "float16x4" - VertexFormat.FLOAT32 -> "float32" - VertexFormat.FLOAT32x2 -> "float32x2" - VertexFormat.FLOAT32x3 -> "float32x3" - VertexFormat.FLOAT32x4 -> "float32x4" - VertexFormat.UINT32 -> "uint32" - VertexFormat.UINT32x2 -> "uint32x2" - VertexFormat.UINT32x3 -> "uint32x3" - VertexFormat.UINT32x4 -> "uint32x4" - VertexFormat.SINT32 -> "sint32" - VertexFormat.SINT32x2 -> "sint32x2" - VertexFormat.SINT32x3 -> "sint32x3" - VertexFormat.SINT32x4 -> "sint32x4" - } - -val PrimitiveTopology.nativeVal: String - get() = - when (this) { - PrimitiveTopology.POINT_LIST -> "point-list" - PrimitiveTopology.LINE_LIST -> "line-list" - PrimitiveTopology.LINE_STRIP -> "line-strip" - PrimitiveTopology.TRIANGLE_LIST -> "triangle-list" - PrimitiveTopology.TRIANGLE_STRIP -> "triangle-strip" - } - -val FrontFace.nativeVal: String - get() = - when (this) { - FrontFace.CCW -> "ccw" - FrontFace.CW -> "cw" - } - -val CullMode.nativeVal: String - get() = - when (this) { - CullMode.NONE -> "none" - CullMode.FRONT -> "front" - CullMode.BACK -> "back" - } - -val CompareFunction.nativeVal: String - get() = - when (this) { - CompareFunction.NEVER -> "never" - CompareFunction.LESS -> "less" - CompareFunction.EQUAL -> "equal" - CompareFunction.LESS_EQUAL -> "less-equal" - CompareFunction.GREATER -> "greater" - CompareFunction.NOT_EQUAL -> "not-equal" - CompareFunction.GREATER_EQUAL -> "greater-equal" - CompareFunction.ALWAYS -> "always" - } - -val StencilOperation.nativeVal: String - get() = - when (this) { - StencilOperation.KEEP -> "keep" - StencilOperation.ZERO -> "zero" - StencilOperation.REPLACE -> "replace" - StencilOperation.INVERT -> "invert" - StencilOperation.INCREMENT_CLAMP -> "increment-clamp" - StencilOperation.DECREMENT_CLAMP -> "decrement-clamp" - StencilOperation.INCREMENT_WRAP -> "increment-wrap" - StencilOperation.DECREMENT_WRAP -> "decrement-wrap" - } - -val BlendOperation.nativeVal: String - get() = - when (this) { - BlendOperation.ADD -> "add" - BlendOperation.SUBTRACT -> "subtract" - BlendOperation.REVERSE_SUBTRACT -> "reverse-subtract" - BlendOperation.MIN -> "min" - BlendOperation.MAX -> "max" - } - -val BlendFactor.nativeVal: String - get() = - when (this) { - BlendFactor.ZERO -> "zero" - BlendFactor.ONE -> "one" - BlendFactor.SRC_COLOR -> "src" - BlendFactor.ONE_MINUS_SRC_COLOR -> "one-minus-src" - BlendFactor.SRC_ALPHA -> "src-alpha" - BlendFactor.ONE_MINUS_SRC_ALPHA -> "one-minus-src-alpha" - BlendFactor.DST_COLOR -> "dst" - BlendFactor.ONE_MINUS_DST_COLOR -> "one-minus-dst" - BlendFactor.DST_ALPHA -> "dst-alpha" - BlendFactor.ONE_MINUS_DST_ALPHA -> "one-minus-dst-alpha" - BlendFactor.SRC_ALPHA_SATURATED -> "src-alpha-saturated" - BlendFactor.CONSTANT_COLOR -> "constant" - BlendFactor.ONE_MINUS_CONSTANT_COLOR -> "one-minus-constant" - } - -val BufferBindingType.nativeVal: String - get() = - when (this) { - BufferBindingType.UNIFORM -> "uniform" - BufferBindingType.STORAGE -> "storage" - BufferBindingType.READ_ONLY_STORAGE -> "read-only-storage" - } - -val SamplerBindingType.nativeVal: String - get() = - when (this) { - SamplerBindingType.FILTERING -> "filtering" - SamplerBindingType.NON_FILTERING -> "non-filtering" - SamplerBindingType.COMPARISON -> "comparison" - } - -val TextureSampleType.nativeVal: String - get() = - when (this) { - TextureSampleType.FLOAT -> "float" - TextureSampleType.DEPTH -> "depth" - TextureSampleType.SINT -> "sint" - TextureSampleType.UINT -> "uint" - } - -val AddressMode.nativeVal: String - get() = - when (this) { - AddressMode.CLAMP_TO_EDGE -> "clamp-to-edge" - AddressMode.REPEAT -> "repeat" - AddressMode.MIRROR_REPEAT -> "mirror-repeat" - } - -val FilterMode.nativeVal: String - get() = - when (this) { - FilterMode.NEAREST -> "nearest" - FilterMode.LINEAR -> "linear" - } - -val LoadOp.nativeVal: String - get() = - when (this) { - LoadOp.CLEAR -> "clear" - LoadOp.LOAD -> "load" - } - -val StoreOp.nativeVal: String - get() = - when (this) { - StoreOp.DISCARD -> "discard" - StoreOp.STORE -> "store" - } - -val Feature.nativeVal: String - get() = - when (this) { - Feature.DEPTH_CLIP_CONTROL -> "depth-clip-control" - Feature.DEPTH32FLOAT_STENCIL18 -> "depth32float-stencil8" - Feature.TEXTURE_COMPRESSION_BC -> "texture-compression-bc" - Feature.TEXTURE_COMPRESSION_ETC2 -> "texture-compression-etc2" - Feature.TEXTURE_COMPRESSION_ASTC -> "texture-compression-astc" - Feature.TIMESTAMP_QUERY -> "timestamp-query" - Feature.INDIRECT_FIRST_INSTANCE -> "indirect-first-instance" - Feature.SHADER_F16 -> "shader-f16" - Feature.RG11B10UFLOAT_RENDERABLE -> "rg11b10ufloat-renderable" - Feature.BGRA8UNORM_STORAGE -> "bgra8unorm-storage" - Feature.FLOAT32_FILTERABLE -> "float32-filterable" - Feature.CLIP_DISTANCES -> "clip-distances" - Feature.DUAL_SOURCE_BLENDING -> "dual-source-blending" - } diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/gpu.external.classes.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/gpu.external.classes.kt deleted file mode 100644 index f842662b0..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/gpu.external.classes.kt +++ /dev/null @@ -1,194 +0,0 @@ -package com.littlekt.graphics.webgpu - -import kotlin.js.Promise -import org.khronos.webgl.ArrayBuffer -import org.khronos.webgl.ArrayBufferView - -external val navigator: Navigator - -external class Navigator { - val gpu: GPU -} - -external class GPU { - /** - * @return A string indicating a canvas texture format. The value can be `rgba8unorm` or - * `bgra8unorm`. - */ - fun getPreferredCanvasFormat(): String - - fun requestAdapter(options: GPURequestAdapterOptions = definedExternally): Promise -} - -external class GPUCanvasContext { - fun configure(configuration: GPUCanvasConfiguration) - - fun getCurrentTexture(): GPUTexture -} - -open external class GPUAdapter { - val name: String - - val features: dynamic - - val limits: GPUSupportedLimits - - fun requestDevice(device: GPUDeviceDescriptor?): Promise -} - -external class GPUDevice { - val features: dynamic - - val limits: GPUSupportedLimits - - val queue: GPUQueue - - fun createShaderModule(desc: GPUShaderModuleDescriptor): GPUShaderModule - - fun createPipelineLayout(desc: GPUPipelineLayoutDescriptor): GPUPipelineLayout - - fun createRenderPipeline(desc: GPURenderPipelineDescriptor): GPURenderPipeline - - fun createTexture(desc: GPUTextureDescriptor): GPUTexture - - fun createCommandEncoder(desc: GPUObjectBase): GPUCommandEncoder - - fun createBuffer(desc: GPUBufferDescriptor): GPUBufferJs - - fun createBindGroupLayout(desc: GPUBindGroupLayoutDescriptor): GPUBindGroupLayout - - fun createBindGroup(desc: GPUBindGroupDescriptor): GPUBindGroup - - fun createSampler(desc: GPUSamplerDescriptor): GPUSampler - - fun createComputePipeline(desc: GPUComputePipelineDescriptor): GPUComputePipeline -} - -external class GPUQueue { - - fun submit(cmdBuffers: Array) - - fun writeBuffer( - buffer: GPUBufferJs, - offset: Long, - data: ArrayBufferView, - dataOffset: Long, - size: Long - ) - - fun writeTexture( - destination: GPUImageCopyTexture, - data: ArrayBufferView, - dataLayout: GPUImageDataLayout, - size: GPUExtent3D - ) -} - -external object GPUMapMode { - val READ: Long - val WRITE: Long -} - -external class GPUBufferJs { - - fun mapAsync(mode: Long): Promise - - fun getMappedRange(offset: Long, size: Long): ArrayBuffer - - fun unmap() - - fun destroy() -} - -external interface GPUBindingResource - -external class GPUTextureView : GPUBindingResource - -external class GPUSampler : GPUBindingResource - -external interface GPUBufferBinding : GPUBindingResource { - var buffer: GPUBufferJs - var offset: Long - var size: Long -} - -external class GPUBindGroup - -external class GPUBindGroupLayout - -external class GPUPipelineLayout - -external class GPURenderPipeline - -external class GPUComputePipeline - -external class GPUCommandBuffer - -external class GPUCommandEncoder { - - fun beginRenderPass(desc: GPURenderPassDescriptor): GPURenderPassEncoder - - fun finish(): GPUCommandBuffer - - fun copyBufferToTexture( - source: GPUImageCopyBuffer, - destination: GPUImageCopyTexture, - copySize: GPUExtent3D - ) - - fun beginComputePass(descriptor: GPUObjectBase): GPUComputePassEncoder - - fun copyBufferToBuffer( - source: GPUBufferJs, - sourceOffset: Int, - destination: GPUBufferJs, - destinationOffset: Int, - size: Long - ) - - fun copyTextureToBuffer( - source: GPUImageCopyTexture, - destination: GPUImageCopyBuffer, - copySize: GPUExtent3D - ) -} - -external class GPURenderPassEncoder { - fun setPipeline(pipeline: GPURenderPipeline) - - fun draw(vertexCount: Int, instanceCount: Int, firstVertex: Int, firstInstance: Int) - - fun end() - - fun setVertexBuffer(slot: Long, buffer: GPUBufferJs, offset: Long, size: Long) - - fun drawIndexed( - indexCount: Int, - instanceCount: Int, - firstVertex: Int, - baseVertex: Int, - firstInstance: Int - ) - - fun setIndexBuffer(buffer: GPUBufferJs, format: String?, offset: Long, size: Long) - - fun setBindGroup( - index: Int, - bindGroup: GPUBindGroup, - dynamicOffsets: LongArray = definedExternally - ) - - fun setViewport(x: Int, y: Int, width: Int, height: Int, minDepth: Float, maxDepth: Float) - - fun setScissorRect(x: Int, y: Int, width: Int, height: Int) -} - -external class GPUComputePassEncoder { - fun setPipeline(pipeline: GPUComputePipeline) - - fun setBindGroup(index: Int, bindGroup: GPUBindGroup) - - fun dispatchWorkgroups(workgroupCountX: Int, workgroupCountY: Int, workgroupCountZ: Int) - - fun end() -} diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/gpu.external.interfaces.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/gpu.external.interfaces.kt deleted file mode 100644 index e07ad07e1..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/gpu.external.interfaces.kt +++ /dev/null @@ -1,337 +0,0 @@ -package com.littlekt.graphics.webgpu - -external interface GPUObjectBase { - var label: String? -} - -external interface GPUSupportedLimits { - var maxTextureDimension1D: Int - var maxTextureDimension2D: Int - var maxTextureDimension3D: Int - var maxTextureArrayLayers: Int - var maxBindGroups: Int - var maxBindGroupsPlusVertexBuffers: Int - var maxBindingsPerBindGroup: Int - var maxDynamicUniformBuffersPerPipelineLayout: Int - var maxDynamicStorageBuffersPerPipelineLayout: Int - var maxSampledTexturesPerShaderStage: Int - var maxSamplersPerShaderStage: Int - var maxStorageBuffersPerShaderStage: Int - var maxStorageTexturesPerShaderStage: Int - var maxUniformBuffersPerShaderStage: Int - var maxUniformBufferBindingSize: Long - var maxStorageBufferBindingSize: Long - var minUniformBufferOffsetAlignment: Int - var minStorageBufferOffsetAlignment: Int - var maxVertexBuffers: Int - var maxBufferSize: Long - var maxVertexAttributes: Int - var maxVertexBufferArrayStride: Int - var maxInterStageShaderComponents: Int - var maxInterStageShaderVariables: Int - var maxColorAttachments: Int - var maxColorAttachmentBytesPerSample: Int - var maxComputeWorkgroupStorageSize: Int - var maxComputeInvocationsPerWorkgroup: Int - var maxComputeWorkgroupSizeX: Int - var maxComputeWorkgroupSizeY: Int - var maxComputeWorkgroupSizeZ: Int - var maxComputeWorkgroupsPerDimension: Int -} - -external interface GPURequestAdapterOptions { - var powerPreference: String - var forceFallbackAdapter: Boolean -} - -external interface GPUDeviceDescriptor : GPUObjectBase { - var requiredFeatures: Array - var requiredLimits: Map -} - -external interface GPUCanvasConfiguration : GPUObjectBase { - var device: GPUDevice - var format: String - var usage: Int - var colorSpace: String - var alphaMode: String - var viewFormats: Array -} - -external interface GPUShaderModuleDescriptor : GPUObjectBase { - var code: String -} - -external interface GPUPipelineLayoutDescriptor : GPUObjectBase { - var bindGroupLayouts: Array -} - -external interface GPUObjectPipelineDescriptorBase : GPUObjectBase { - var layout: GPUPipelineLayout -} - -external interface GPURenderPipelineDescriptor : GPUObjectPipelineDescriptorBase { - var vertex: GPUVertexState - var primitive: GPUPrimitiveState - var depthStencil: GPUDepthStencilState? - var multisample: GPUMultisampleState - var fragment: GPUFragmentState? -} - -external interface GPUProgrammableStage { - var module: GPUShaderModule - var entryPoint: String - var constants: Map -} - -external interface GPUVertexState : GPUProgrammableStage { - var buffers: Array -} - -external interface GPUVertexBufferLayout { - var arrayStride: Long - var stepMode: String - var attributes: Array -} - -external interface GPUVertexAttribute { - var format: String - var offset: Long - var shaderLocation: Int -} - -external interface GPUPrimitiveState { - var topology: String - var stripIndexFormat: String? - var frontFace: String - var cullMode: String - var unclippedDepth: Boolean -} - -external interface GPUDepthStencilState { - var format: String - var depthWriteEnabled: Boolean - var depthCompare: String - var stencilFront: GPUStencilFaceState - var stencilBack: GPUStencilFaceState - var stencilReadMask: Int - var stencilWriteMask: Int - var depthBias: Int - var depthBiasSlopeScale: Float - var depthBiasClamp: Float -} - -external interface GPUStencilFaceState { - var compare: String - var failOp: String - var depthFailOp: String - var passOp: String -} - -external interface GPUMultisampleState { - var count: Int - var mask: Int - var alphaToCoverageEnabled: Boolean -} - -external interface GPUFragmentState : GPUProgrammableStage { - var targets: Array -} - -external interface GPUColorTargetState { - var format: String - var blend: GPUBlendState? - var writeMask: Int -} - -external interface GPUBlendState { - var color: GPUBlendComponent - var alpha: GPUBlendComponent -} - -external interface GPUBlendComponent { - var operation: String - var srcFactor: String - var dstFactor: String -} - -external interface GPUBufferDescriptor : GPUObjectBase { - var size: Long - var usage: Int - var mappedAtCreation: Boolean -} - -external interface GPUBindGroupLayoutDescriptor : GPUObjectBase { - var entries: Array -} - -external interface GPUBindGroupLayoutEntry : GPUObjectBase { - var binding: Int - var visibility: Int - var buffer: GPUBufferBindingLayout - var sampler: GPUBufferSamplerBindingLayout - var texture: GPUTextureBindingLayout - var storageTexture: GPUStorageTextureBindingLayout - var externalTexture: GPUExternalTextureBindingLayout -} - -external interface GPUBufferBindingLayout : GPUObjectBase { - var type: String - var hasDynamicOffset: Boolean - var minBindingSize: Long -} - -external interface GPUBufferSamplerBindingLayout : GPUObjectBase { - var type: String -} - -external interface GPUTextureBindingLayout : GPUObjectBase { - var sampleType: String - var viewDimension: String - var multisampled: Boolean -} - -external interface GPUStorageTextureBindingLayout : GPUObjectBase { - var access: String - var format: String - var viewDimension: String -} - -external interface GPUExternalTextureBindingLayout : GPUObjectBase - -external interface GPUBindGroupDescriptor : GPUObjectBase { - var layout: GPUBindGroupLayout - var entries: Array -} - -external interface GPUBindGroupEntry : GPUObjectBase { - var binding: Int - - /** [GPUSampler] or [GPUTextureView] or [GPUBufferBinding] */ - var resource: GPUBindingResource -} - -external interface GPUSamplerDescriptor : GPUObjectBase { - var addressModeU: String - var addressModeV: String - var addressModeW: String - var magFilter: String - var minFilter: String - var mipmapFilter: String - var lodMinClamp: Float - var lodMaxClamp: Float - var compare: String? - var maxAnisotropy: Short -} - -external interface GPUComputePipelineDescriptor : GPUObjectPipelineDescriptorBase { - var compute: GPUProgrammableStage -} - -external interface GPUTextureDescriptor : GPUObjectBase { - var size: GPUExtent3D - var mipLevelCount: Int - var sampleCount: Int - var dimension: String - var format: String - var usage: Int - var viewFormats: Array -} - -external interface GPUExtent3D { - var width: Int - var height: Int - var depthOrArrayLayer: Int -} - -external interface GPUShaderModule : GPUObjectBase { - val compilationInfo: Any -} - -external interface GPUTexture : GPUObjectBase { - var depthOrLayers: Int - var dimension: String - var format: String - var width: Int - var height: Int - var mipLevelCount: Int - var sampleCount: Int - var usage: Int - - fun createView(desc: GPUTextureViewDescriptor?): GPUTextureView - - fun destroy() -} - -external interface GPUTextureViewDescriptor : GPUObjectBase { - var arrayLayerCount: Int - var aspect: String - var baseArrayLayer: Int - var baseMipLevel: Int - var dimension: String - var format: String - var mipLevelCount: Int -} - -external interface GPURenderPassDescriptor : GPUObjectBase { - var colorAttachments: Array - var depthStencilAttachment: GPURenderPassDepthStencilAttachment? - var occlusionQuerySet: GPUQuerySet - var timestampWrites: GPURenderPassTimestampWrites - var maxDrawCount: Long -} - -external interface GPURenderPassColorAttachment { - var view: GPUTextureView - var depthSlice: Int - var resolveTarget: GPUTextureView? - var clearValue: Array? - var loadOp: String - var storeOp: String -} - -external interface GPURenderPassDepthStencilAttachment { - var view: GPUTextureView - var depthClearValue: Float - var depthLoadOp: String? - var depthStoreOp: String? - var depthReadOnly: Boolean - var stencilClearValue: Int - var stencilLoadOp: String? - var stencilStoreOp: String? - var stencilReadOnly: Boolean -} - -external interface GPUQuerySet { - var type: String - var count: Int -} - -external interface GPURenderPassTimestampWrites { - var querySet: GPUQuerySet - var beginningOfPassWriteIndex: Int - var endOfPassWriteIndex: Int -} - -external interface GPUImageCopyTexture { - var aspect: String - var mipLevel: Int - var origin: GPUOrigin3D - var texture: GPUTexture -} - -external interface GPUOrigin3D { - var x: Int - var y: Int - var z: Int -} - -external interface GPUImageDataLayout { - var offset: Long - var bytesPerRow: Int - var rowsPerImage: Int -} - -external interface GPUImageCopyBuffer : GPUImageDataLayout { - var buffer: GPUBufferJs -} diff --git a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/webgpu.js.kt b/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/webgpu.js.kt deleted file mode 100644 index 8c06c83b4..000000000 --- a/core/src/jsMain/kotlin/com/littlekt/graphics/webgpu/webgpu.js.kt +++ /dev/null @@ -1,401 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable -import com.littlekt.file.* -import com.littlekt.resources.BufferResourceInfo -import com.littlekt.resources.TextureResourceInfo -import kotlinx.coroutines.await -import org.khronos.webgl.ArrayBuffer -import org.khronos.webgl.Uint8Array - -actual class Device(val delegate: GPUDevice) : Releasable { - actual val queue: Queue by lazy { Queue(delegate.queue) } - - actual val features: List by lazy { - val results = mutableListOf() - val jsFeatures = delegate.features - Feature.entries.forEach { feature -> - if (jsFeatures.has(feature.nativeVal) as Boolean) { - results += feature - } - } - results.toList() - } - - actual val limits: Limits by lazy { - val jsLimits = delegate.limits - Limits( - maxTextureDimension1D = jsLimits.maxTextureDimension1D, - maxTextureDimension2D = jsLimits.maxTextureDimension2D, - maxTextureDimension3D = jsLimits.maxTextureDimension3D, - maxTextureArrayLayers = jsLimits.maxTextureArrayLayers, - maxBindGroups = jsLimits.maxBindGroups, - maxBindGroupsPlusVertexBuffers = jsLimits.maxBindGroupsPlusVertexBuffers, - maxBindingsPerBindGroup = jsLimits.maxBindingsPerBindGroup, - maxDynamicUniformBuffersPerPipelineLayout = - jsLimits.maxDynamicUniformBuffersPerPipelineLayout, - maxDynamicStorageBuffersPerPipelineLayout = - jsLimits.maxDynamicStorageBuffersPerPipelineLayout, - maxSampledTexturesPerShaderStage = jsLimits.maxSampledTexturesPerShaderStage, - maxSamplersPerShaderStage = jsLimits.maxSamplersPerShaderStage, - maxStorageBuffersPerShaderStage = jsLimits.maxStorageBuffersPerShaderStage, - maxStorageTexturesPerShaderStage = jsLimits.maxStorageTexturesPerShaderStage, - maxUniformBuffersPerShaderStage = jsLimits.maxUniformBuffersPerShaderStage, - maxUniformBufferBindingSize = jsLimits.maxUniformBufferBindingSize, - maxStorageBufferBindingSize = jsLimits.maxStorageBufferBindingSize, - minUniformBufferOffsetAlignment = jsLimits.minUniformBufferOffsetAlignment, - minStorageBufferOffsetAlignment = jsLimits.minStorageBufferOffsetAlignment, - maxVertexBuffers = jsLimits.maxVertexBuffers, - maxBufferSize = jsLimits.maxBufferSize, - maxVertexAttributes = jsLimits.maxVertexAttributes, - maxVertexBufferArrayStride = jsLimits.maxVertexBufferArrayStride, - maxInterStageShaderComponents = jsLimits.maxInterStageShaderComponents, - maxInterStageShaderVariables = jsLimits.maxInterStageShaderVariables, - maxColorAttachments = jsLimits.maxColorAttachments, - maxColorAttachmentBytesPerSample = jsLimits.maxColorAttachmentBytesPerSample, - maxComputeWorkgroupStorageSize = jsLimits.maxComputeWorkgroupStorageSize, - maxComputeInvocationsPerWorkgroup = jsLimits.maxComputeInvocationsPerWorkgroup, - maxComputeWorkgroupSizeX = jsLimits.maxComputeWorkgroupSizeX, - maxComputeWorkgroupSizeY = jsLimits.maxComputeWorkgroupSizeY, - maxComputeWorkgroupSizeZ = jsLimits.maxComputeWorkgroupSizeZ, - maxComputeWorkgroupsPerDimension = jsLimits.maxComputeWorkgroupsPerDimension, - ) - } - - actual fun createShaderModule(src: String): ShaderModule { - return ShaderModule(delegate.createShaderModule(GPUShaderModuleDescriptor { code = src })) - } - - actual fun createRenderPipeline(desc: RenderPipelineDescriptor): RenderPipeline { - return RenderPipeline(delegate.createRenderPipeline(desc.toNative())) - } - - actual fun createComputePipeline(desc: ComputePipelineDescriptor): ComputePipeline { - return ComputePipeline(delegate.createComputePipeline(desc.toNative())) - } - - actual fun createPipelineLayout(desc: PipelineLayoutDescriptor): PipelineLayout { - return PipelineLayout(delegate.createPipelineLayout(desc.toNative())) - } - - actual fun createCommandEncoder(label: String?): CommandEncoder { - return CommandEncoder(delegate.createCommandEncoder(GPUObjectBase { this.label = label })) - } - - actual fun createBuffer(desc: BufferDescriptor): GPUBuffer { - return GPUBuffer(delegate.createBuffer(desc.toNative()), desc.size) - } - - actual fun createBindGroupLayout(desc: BindGroupLayoutDescriptor): BindGroupLayout { - return BindGroupLayout(delegate.createBindGroupLayout(desc.toNative())) - } - - actual fun createBindGroup(desc: BindGroupDescriptor): BindGroup { - return BindGroup(delegate.createBindGroup(desc.toNative())) - } - - actual fun createSampler(desc: SamplerDescriptor): Sampler { - return Sampler(delegate.createSampler(desc.toNative())) - } - - actual fun createTexture(desc: TextureDescriptor): WebGPUTexture { - val textureSize = - (desc.size.width * desc.size.height * desc.size.depth * desc.format.bytes).toLong() - return WebGPUTexture(delegate.createTexture(desc.toNative()), textureSize) - } - - actual fun createGPUShortBuffer( - label: String, - data: ShortArray, - usage: BufferUsage - ): GPUBuffer { - val buffer = - createBuffer( - BufferDescriptor(label, data.size.toLong() * Short.SIZE_BYTES, usage, true) - ) - buffer.getMappedRange(0, buffer.size).putShort(data) - buffer.unmap() - - return buffer - } - - actual fun createGPUFloatBuffer( - label: String, - data: FloatArray, - usage: BufferUsage - ): GPUBuffer { - val buffer = - createBuffer( - BufferDescriptor(label, data.size.toLong() * Float.SIZE_BYTES, usage, true) - ) - buffer.getMappedRange(0, buffer.size).putFloat(data) - buffer.unmap() - - return buffer - } - - actual fun createGPUIntBuffer(label: String, data: IntArray, usage: BufferUsage): GPUBuffer { - val buffer = - createBuffer(BufferDescriptor(label, data.size.toLong() * Int.SIZE_BYTES, usage, true)) - buffer.getMappedRange(0, buffer.size).putInt(data) - buffer.unmap() - - return buffer - } - - actual fun createGPUByteBuffer(label: String, data: ByteArray, usage: BufferUsage): GPUBuffer { - val buffer = createBuffer(BufferDescriptor(label, data.size.toLong(), usage, true)) - buffer.getMappedRange(0, buffer.size).putByte(data) - buffer.unmap() - - return buffer - } - - actual override fun release() {} -} - -actual class Adapter(val delegate: GPUAdapter) : Releasable { - - actual val features: List by lazy { - val results = mutableListOf() - val jsFeatures = delegate.features - Feature.entries.forEach { feature -> - if (jsFeatures.has(feature.nativeVal) as Boolean) { - results += feature - } - } - results.toList() - } - - actual val limits: Limits by lazy { - val jsLimits = delegate.limits - Limits( - maxTextureDimension1D = jsLimits.maxTextureDimension1D, - maxTextureDimension2D = jsLimits.maxTextureDimension2D, - maxTextureDimension3D = jsLimits.maxTextureDimension3D, - maxTextureArrayLayers = jsLimits.maxTextureArrayLayers, - maxBindGroups = jsLimits.maxBindGroups, - maxBindGroupsPlusVertexBuffers = jsLimits.maxBindGroupsPlusVertexBuffers, - maxBindingsPerBindGroup = jsLimits.maxBindingsPerBindGroup, - maxDynamicUniformBuffersPerPipelineLayout = - jsLimits.maxDynamicUniformBuffersPerPipelineLayout, - maxDynamicStorageBuffersPerPipelineLayout = - jsLimits.maxDynamicStorageBuffersPerPipelineLayout, - maxSampledTexturesPerShaderStage = jsLimits.maxSampledTexturesPerShaderStage, - maxSamplersPerShaderStage = jsLimits.maxSamplersPerShaderStage, - maxStorageBuffersPerShaderStage = jsLimits.maxStorageBuffersPerShaderStage, - maxStorageTexturesPerShaderStage = jsLimits.maxStorageTexturesPerShaderStage, - maxUniformBuffersPerShaderStage = jsLimits.maxUniformBuffersPerShaderStage, - maxUniformBufferBindingSize = jsLimits.maxUniformBufferBindingSize, - maxStorageBufferBindingSize = jsLimits.maxStorageBufferBindingSize, - minUniformBufferOffsetAlignment = jsLimits.minUniformBufferOffsetAlignment, - minStorageBufferOffsetAlignment = jsLimits.minStorageBufferOffsetAlignment, - maxVertexBuffers = jsLimits.maxVertexBuffers, - maxBufferSize = jsLimits.maxBufferSize, - maxVertexAttributes = jsLimits.maxVertexAttributes, - maxVertexBufferArrayStride = jsLimits.maxVertexBufferArrayStride, - maxInterStageShaderComponents = jsLimits.maxInterStageShaderComponents, - maxInterStageShaderVariables = jsLimits.maxInterStageShaderVariables, - maxColorAttachments = jsLimits.maxColorAttachments, - maxColorAttachmentBytesPerSample = jsLimits.maxColorAttachmentBytesPerSample, - maxComputeWorkgroupStorageSize = jsLimits.maxComputeWorkgroupStorageSize, - maxComputeInvocationsPerWorkgroup = jsLimits.maxComputeInvocationsPerWorkgroup, - maxComputeWorkgroupSizeX = jsLimits.maxComputeWorkgroupSizeX, - maxComputeWorkgroupSizeY = jsLimits.maxComputeWorkgroupSizeY, - maxComputeWorkgroupSizeZ = jsLimits.maxComputeWorkgroupSizeZ, - maxComputeWorkgroupsPerDimension = jsLimits.maxComputeWorkgroupsPerDimension, - ) - } - - actual suspend fun requestDevice(descriptor: DeviceDescriptor?): Device { - return Device(delegate.requestDevice(descriptor?.toNative()).await()) - } - - actual override fun release() {} -} - -actual class Queue(val delegate: GPUQueue) : Releasable { - - actual fun submit(vararg cmdBuffers: CommandBuffer) { - delegate.submit(cmdBuffers.map { it.delegate }.toTypedArray()) - } - - actual fun writeTexture( - data: ByteBuffer, - destination: TextureCopyView, - layout: TextureDataLayout, - copySize: Extent3D, - size: Long - ) { - data as GenericBuffer<*> - delegate.writeTexture( - destination.toNative(), - data.buffer, - layout.toNative(), - copySize.toNative(), - ) - } - - actual fun writeTexture( - data: ByteArray, - destination: TextureCopyView, - layout: TextureDataLayout, - copySize: Extent3D, - size: Long - ) { - val arrayBuffer = Uint8Array(ArrayBuffer(data.size)).apply { set(data.toTypedArray()) } - - delegate.writeTexture( - destination.toNative(), - arrayBuffer, - layout.toNative(), - copySize.toNative() - ) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: ShortBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as GenericBuffer<*> - delegate.writeBuffer(buffer.delegate, offset, data.buffer, dataOffset, size) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: FloatBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as GenericBuffer<*> - delegate.writeBuffer(buffer.delegate, offset, data.buffer, dataOffset, size) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: IntBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as GenericBuffer<*> - delegate.writeBuffer(buffer.delegate, offset, data.buffer, dataOffset, size) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: ByteBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as GenericBuffer<*> - delegate.writeBuffer(buffer.delegate, offset, data.buffer, dataOffset, size) - } - - actual override fun release() {} -} - -actual class ShaderModule(val delegate: GPUShaderModule) : Releasable { - actual override fun release() {} -} - -actual class Surface(val delegate: GPU, val canvas: GPUCanvasContext) : Releasable { - actual fun configure(configuration: SurfaceConfiguration) { - canvas.configure(configuration.toNative()) - } - - actual fun getCapabilities(adapter: Adapter): SurfaceCapabilities { - return SURFACE_CAPABILITIES - } - - actual fun getPreferredFormat(adapter: Adapter): TextureFormat { - val format = delegate.getPreferredCanvasFormat() - return TextureFormat.from(format) ?: error("Unsupported canvas format: $format") - } - - actual fun getCurrentTexture(): SurfaceTexture { - return SurfaceTexture(WebGPUTexture(canvas.getCurrentTexture(), 0L)) - } - - actual fun present() {} - - actual override fun release() {} - - companion object { - private val SURFACE_CAPABILITIES = SurfaceCapabilities() - } -} - -actual class SurfaceCapabilities { - actual val formats: List = - listOf(TextureFormat.BGRA8_UNORM, TextureFormat.RGBA8_UNORM, TextureFormat.RGBA16_FLOAT) - - actual val alphaModes: List = listOf(AlphaMode.OPAQUE, AlphaMode.PREMULTIPLIED) -} - -actual class SurfaceTexture(actual val texture: WebGPUTexture?) { - actual val status: TextureStatus = TextureStatus.SUCCESS -} - -actual class WebGPUTexture(val delegate: GPUTexture, size: Long) : Releasable { - - private val info = TextureResourceInfo(this, size) - - actual fun createView(desc: TextureViewDescriptor?): TextureView { - return TextureView(delegate.createView(desc?.toNative())) - } - - actual override fun release() { - destroy() - } - - actual fun destroy() { - delegate.destroy() - info.delete() - } -} - -actual class TextureView(val delegate: GPUTextureView) : IntoBindingResource { - actual fun release() {} - - override fun toNative(): GPUBindingResource { - return delegate - } -} - -actual class GPUBuffer(val delegate: GPUBufferJs, actual val size: Long) : Releasable { - - private val info = BufferResourceInfo(this, size) - - actual fun getMappedRange(offset: Long, size: Long): ByteBuffer { - return ByteBufferImpl(Uint8Array(delegate.getMappedRange(offset, size))) - } - - actual fun getMappedRange(): ByteBuffer = getMappedRange(0, size) - - actual fun unmap() { - delegate.unmap() - } - - actual override fun release() { - destroy() - } - - actual fun destroy() { - delegate.destroy() - info.delete() - } -} - -actual class Sampler(val delegate: GPUSampler) : IntoBindingResource, Releasable { - actual override fun release() {} - - override fun toNative(): GPUBindingResource { - return delegate - } -} diff --git a/core/src/jvmMain/kotlin/com/littlekt/LittleKtApp.jvm.kt b/core/src/jvmMain/kotlin/com/littlekt/LittleKtApp.jvm.kt index 01d178330..18850ae6e 100644 --- a/core/src/jvmMain/kotlin/com/littlekt/LittleKtApp.jvm.kt +++ b/core/src/jvmMain/kotlin/com/littlekt/LittleKtApp.jvm.kt @@ -1,7 +1,9 @@ package com.littlekt import com.littlekt.graphics.HdpiMode -import com.littlekt.graphics.webgpu.Backend +import io.ygdrasil.wgpu.BackendType +import io.ygdrasil.wgpu.PowerPreference +import io.ygdrasil.wgpu.WGPU internal val ktHead32x32 = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAhCAYAAAC4JqlRAAAAAXNSR0IArs4c6QAABKNJREFUWIWVl39oVWUYxz/vzgnCsFqxS2tBymKgCF6vOs3Zbu6/zHBCf5gOQnYURBKMhit/YJszZVGwFmLeIULzL8EtMIPAebOprDYnQ8sRNQldXCulH4PkHN/+OOc9e8+vu7sHLpxz7vc83+/zfZ73PecIoiFD5yIGM9tIzFkWAsmbow+wsgX/F3PzrMmtbAEpJVLKSE6lREop2fry3dgMuXwqoHo25FK6XHru4xcqEEIACF+Ap6wkAfcyzYmulI/0lJRT5S3TVXpEkVC23Vi+V95c1ir/LHuKv8oe51/xGOUjPZSP9ABg4jCVaZIPlrwhVaVxcev3c/6xGaqyaCz87mCSOMq1+6cyTQCJLf36+pv+faYCWtkCZ681RsC5fIpfmlrJaWTqeub5logQgDn5FHL7EcTRFDO1QV8FTN6/FLAt5yXq+PVtdr56l1w+5TtlZQtk5rUwMtEZSWplC2y9sQWA4wtPFHW3LOkPRT73xCcAdJ2toLGyl8bK3oCQJBG6ELn9SECElS1w5ae9gDvZclHVNla+cNAnBjwLdyOlRAhBY2VvhKBvcvOMFuvFiKO7fbxaWYlLRrc6l0/5AvomN8dWWoqI8AwBwiwGPn6hwp9kRSxHcwGsSFsR0XGbWpLIWAEq9CRhYv26SKcCGCFErIiwC5AwhMp2dVMSuS5Cx8jRHEKIxI0oVoDaA0rZkEoJJULPGdcGvwWVT9QlJoJgr4s5ouNUhCY/IMQXkJnXQi6f4uO6PNdjks7UhjhxIm0F+m5lC7T/8z6VmstlAAdWXyWXT3F49WV2DWZjk4q05f+KhY6LE105/CmTS3cAcC9jSRPAFgYHVl+l9dslgakOOCAlVQ173AuLm+FaT5R9cTPPrvkZgNvnO9zV4OVTg62KmVy6AxvbdcDBxBZGoGK9Tzq5ShxbvRDcPt8BQFXDHtRjXs+rwsHAxnQFfHBxoXAwqXl6jQ8Ir4Y7A4e4M3AIgHWddqwAdV3HKuJcPhVony1MHIzpZWhjMv7HAAB9X3wVS6AqKxZx/yviM22vA/Dj8vewMXluuEtMCxAGLS+N++D2LdlpF671sK7T5tTgQzJr2xjrrvaT3/97yj8e664ms7aNU4MPXTe8OZGjOZ9cpC1sDGzvKRBwQInYsP80i+YHd7Gx7mre3TSfse5qJvr3+eRPzp3ji5jo3xfAhR3YsP80w7UH3ZnDnbnANL1Vf0ua3nh8+E2NPzTz1rcz8cP3Lmi83z33ROjhX69Z754vWObjlIih2sMY2Cwd2isiArZnb0tT2pg4mNKm8+K0CJWU8f4IcSRCWJG2GFjRhSHd2k0caodaowLCIsJOFIukjUekLc6tOIaBwyPYGNKhfmiXzxt5HDsY3nuSe/5O/TginSxCWZtEfmblSWwct1YJMrSHxO4o27K/ScNrw2yd0Mk/f/E0j/IfhmorNq9c2RbgjH0f+Cz/jHC8pWJj4GB6ThR/DujkJ1edAXDv9/KEyWGG770kJyDZcoBjq770K1aDt/Hyxliukj44w4NpSofDFxdEcB/V5TWMi2++9FpRjll98er7hCnVdqIc0o8ddg42lJT7fz+5dOVMdmd7AAAAAElFTkSuQmCC" @@ -26,12 +28,12 @@ actual class LittleKtProps { var traceWgpu = false var enableWGPULogging = false - /** Bitmask for backends. Defaults to [Backend.ALL]. */ - var preferredBackends = Backend.ALL + /** Bitmask for backends. Defaults to [BackendType.undefined]. */ + var preferredBackends = BackendType.undefined var loadInternalResources: Boolean = true - var powerPreference = PowerPreference.HIGH_POWER + var powerPreference = PowerPreference.highPerformance } /** @@ -41,7 +43,7 @@ actual class LittleKtProps { actual fun createLittleKtApp(action: LittleKtProps.() -> Unit): LittleKtApp { val props = LittleKtProps().apply(action) System.setProperty("jextract.trace.downcalls", props.traceWgpu.toString()) - loadNativesFromClasspath() + WGPU.loadLibrary() return LittleKtApp( LwjglContext( JvmConfiguration( @@ -63,10 +65,6 @@ actual fun createLittleKtApp(action: LittleKtProps.() -> Unit): LittleKtApp { ) } -private fun loadNativesFromClasspath() { - SharedLibraryLoader().load("wgpu_native") -} - /** * @author Colton Daily * @date 11/17/2021 @@ -82,14 +80,8 @@ class JvmConfiguration( val windowPosY: Int?, val hdpiMode: HdpiMode, val enableWGPULogging: Boolean, - val preferredBackends: Backend, + val preferredBackends: BackendType, override val loadInternalResources: Boolean, - val powerPreference: PowerPreference = PowerPreference.HIGH_POWER + val powerPreference: PowerPreference = PowerPreference.highPerformance ) : ContextConfiguration() -val PowerPreference.nativeVal: Int - get() = - when (this) { - PowerPreference.LOW_POWER -> 1 - PowerPreference.HIGH_POWER -> 2 - } diff --git a/core/src/jvmMain/kotlin/com/littlekt/LwjglContext.kt b/core/src/jvmMain/kotlin/com/littlekt/LwjglContext.kt index e7a0045c0..b3360e480 100644 --- a/core/src/jvmMain/kotlin/com/littlekt/LwjglContext.kt +++ b/core/src/jvmMain/kotlin/com/littlekt/LwjglContext.kt @@ -8,14 +8,14 @@ import com.littlekt.file.* import com.littlekt.file.Base64.decodeFromBase64 import com.littlekt.file.vfs.VfsFile import com.littlekt.file.vfs.readPixmap -import com.littlekt.graphics.webgpu.WGPU_NULL import com.littlekt.input.LwjglInput import com.littlekt.log.Logger import com.littlekt.resources.internal.InternalResources import com.littlekt.util.datastructure.fastForEach import com.littlekt.util.now -import com.littlekt.wgpu.WGPU.* -import com.littlekt.wgpu.WGPULogCallback +import io.ygdrasil.wgpu.internal.jvm.panama.WGPULogCallback +import io.ygdrasil.wgpu.internal.jvm.panama.wgpu_h +import io.ygdrasil.wgpu.internal.jvm.panama.wgpu_h.* import java.lang.foreign.Arena import java.nio.ByteBuffer import java.nio.IntBuffer @@ -28,6 +28,7 @@ import org.lwjgl.glfw.GLFWErrorCallback import org.lwjgl.glfw.GLFWImage import org.lwjgl.system.MemoryStack import org.lwjgl.system.MemoryUtil +import java.lang.foreign.MemorySegment /** * @author Colton Daily @@ -118,7 +119,6 @@ class LwjglContext(override val configuration: JvmConfiguration) : Context() { if (windowHandle == MemoryUtil.NULL) throw RuntimeException("Failed to create the GLFW window") - graphics.createInstance(configuration) graphics.configureSurfaceToWindow(windowHandle) graphics.requestAdapterAndDevice(configuration.powerPreference) @@ -211,7 +211,7 @@ class LwjglContext(override val configuration: JvmConfiguration) : Context() { private fun initLogging() { val callback = WGPULogCallback.Function { level, message, _ -> - val messageJvm = message.getUtf8String(0) + val messageJvm = message.getString(0) val logLevel = when (level) { WGPULogLevel_Error() -> Logger.Level.ERROR @@ -224,8 +224,9 @@ class LwjglContext(override val configuration: JvmConfiguration) : Context() { wgpuLogger.log(logLevel) { messageJvm } } - wgpuSetLogCallback(WGPULogCallback.allocate(callback, scope), WGPU_NULL) + wgpuSetLogCallback(WGPULogCallback.allocate(callback, scope), NULL()) wgpuSetLogLevel(WGPULogLevel_Trace()) + } private fun updateFramebufferInfo() { diff --git a/core/src/jvmMain/kotlin/com/littlekt/LwjglGraphics.kt b/core/src/jvmMain/kotlin/com/littlekt/LwjglGraphics.kt index 7d6d5c5f9..dbb4cc96d 100644 --- a/core/src/jvmMain/kotlin/com/littlekt/LwjglGraphics.kt +++ b/core/src/jvmMain/kotlin/com/littlekt/LwjglGraphics.kt @@ -3,17 +3,37 @@ package com.littlekt import com.littlekt.graphics.Cursor import com.littlekt.graphics.HdpiMode import com.littlekt.graphics.SystemCursor -import com.littlekt.graphics.webgpu.* import com.littlekt.log.Logger -import com.littlekt.wgpu.* -import com.littlekt.wgpu.WGPU.* +import io.ygdrasil.wgpu.Adapter +import io.ygdrasil.wgpu.CompositeAlphaMode +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.PowerPreference +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.Surface +import io.ygdrasil.wgpu.SurfaceConfiguration +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.WGPU +import io.ygdrasil.wgpu.WGPU.Companion import java.lang.foreign.Arena import java.lang.foreign.MemorySegment import kotlinx.atomicfu.atomic import kotlinx.atomicfu.update +import kotlinx.coroutines.runBlocking import org.lwjgl.glfw.* +import org.lwjgl.glfw.GLFWNativeCocoa.glfwGetCocoaWindow +import org.lwjgl.glfw.GLFWNativeWin32.glfwGetWin32Window +import org.lwjgl.glfw.GLFWNativeX11.glfwGetX11Display +import org.lwjgl.glfw.GLFWNativeX11.glfwGetX11Window import org.lwjgl.system.JNI.* import org.lwjgl.system.macosx.ObjCRuntime.* +import java.awt.AlphaComposite +import org.rococoa.ID +import org.rococoa.Rococoa +import com.sun.jna.Pointer +import com.sun.jna.platform.win32.Kernel32 +import darwin.CAMetalLayer +import darwin.NSWindow /** * @author Colton Daily @@ -44,59 +64,35 @@ class LwjglGraphics(private val context: LwjglContext) : Graphics, Releasable { override val backBufferHeight: Int get() = _backBufferHeight - internal var instance: Instance = Instance(WGPU_NULL) + internal var instance = WGPU.createInstance() ?: error("fail to wgpu instance") - override var surface: Surface = Surface(WGPU_NULL) - override var adapter: Adapter = Adapter(WGPU_NULL) - override var device: Device = Device(WGPU_NULL) + override lateinit var surface: Surface + override lateinit var adapter: Adapter + override lateinit var device: Device - override val preferredFormat by lazy { surface.getPreferredFormat(adapter) } + + override val preferredFormat by lazy { surface.preferredCanvasFormat ?: surface.supportedFormats.first() } private var hasSurfaceCapabilities = false - override val surfaceCapabilities: SurfaceCapabilities by lazy { - hasSurfaceCapabilities = true - surface.getCapabilities(adapter) - } override fun configureSurface( - usage: TextureUsage, + usage: Set, format: TextureFormat, presentMode: PresentMode, - alphaMode: AlphaMode + alphaMode: CompositeAlphaMode ) { surface.configure( - SurfaceConfiguration(device, usage, format, presentMode, alphaMode, width, height) + SurfaceConfiguration(device, format, usage, alphaMode = alphaMode, presentMode = presentMode) //width, height ) } internal suspend fun requestAdapterAndDevice(powerPreference: PowerPreference) { - val output = atomic(WGPU_NULL) - - Arena.ofConfined().use { scope -> - val options = WGPURequestAdapterOptions.allocate(scope) - val callback = - WGPURequestAdapterCallback.allocate( - { status, adapter, message, _ -> - if (status == WGPURequestAdapterStatus_Success()) { - output.update { adapter } - } else { - logger.error { - "requestAdapter status=$status, message=${message.getUtf8String(0)}" - } - } - }, - scope - ) - WGPURequestAdapterOptions.powerPreference(options, powerPreference.nativeVal) - WGPURequestAdapterOptions.compatibleSurface(options, surface.segment) - WGPURequestAdapterOptions.nextInChain(options, WGPU_NULL) - wgpuInstanceRequestAdapter(instance.segment, options, callback, WGPU_NULL) - } - adapter = Adapter(output.value) + adapter = instance.requestAdapter(surface, powerPreference) ?: error("No adapter found.") + surface.computeSurfaceCapabilities(adapter) requestDevice() } private suspend fun requestDevice() { - device = adapter.requestDevice() + device = adapter.requestDevice() ?: error("No device found.") } override fun supportsExtension(extension: String): Boolean { @@ -128,178 +124,52 @@ class LwjglGraphics(private val context: LwjglContext) : Graphics, Releasable { GLFW.glfwSetCursor(context.windowHandle, handle) } - internal fun createInstance(configuration: JvmConfiguration) { - instance = - Arena.ofConfined().use { scope -> - val instanceDesc = WGPUInstanceDescriptor.allocate(scope) - val extras = WGPUInstanceExtras.allocate(scope) - if (configuration.preferredBackends.isInvalid()) { - logger.warn { - "Configuration.preferredBackends is invalid and will resort to the default backend. Specify at least one backend or remove the list to get rid of this warning." - } - } else { - WGPUInstanceExtras.backends(extras, configuration.preferredBackends.flag) - } - WGPUChainedStruct.sType( - WGPUInstanceExtras.chain(extras), - WGPUSType_InstanceExtras() - ) - WGPUInstanceDescriptor.nextInChain(instanceDesc, extras) - Instance(wgpuCreateInstance(instanceDesc)) - } - } - internal fun configureSurfaceToWindow(windowHandle: Long) { - val isMac = System.getProperty("os.name").lowercase().contains("mac") - val isWindows = System.getProperty("os.name").lowercase().contains("windows") - val isLinux = System.getProperty("os.name").lowercase().contains("linux") - surface = - Surface( - when { - isWindows -> { - val osHandle = GLFWNativeWin32.glfwGetWin32Window(windowHandle) - Arena.ofConfined().use { scope -> - val desc = WGPUSurfaceDescriptor.allocate(scope) - val windowsDesc = WGPUSurfaceDescriptorFromWindowsHWND.allocate(scope) - WGPUSurfaceDescriptorFromWindowsHWND.hwnd( - windowsDesc, - MemorySegment.ofAddress(osHandle) - ) - WGPUSurfaceDescriptorFromWindowsHWND.hinstance(windowsDesc, WGPU_NULL) - WGPUChainedStruct.sType( - WGPUSurfaceDescriptorFromWindowsHWND.chain(windowsDesc), - WGPUSType_SurfaceDescriptorFromWindowsHWND() - ) - WGPUSurfaceDescriptor.label(desc, WGPU_NULL) - WGPUSurfaceDescriptor.nextInChain(desc, windowsDesc) - wgpuInstanceCreateSurface(instance.segment, desc) - } - } - isLinux -> { - val platform = GLFW.glfwGetPlatform() - when (platform) { - GLFW.GLFW_PLATFORM_X11 -> { - Arena.ofConfined().use { scope -> - val display = GLFWNativeX11.glfwGetX11Display() - val osHandle = GLFWNativeX11.glfwGetX11Window(windowHandle) - val desc = WGPUSurfaceDescriptor.allocate(scope) - val windowsDesc = - WGPUSurfaceDescriptorFromXlibWindow.allocate(scope) - WGPUSurfaceDescriptorFromXlibWindow.display( - windowsDesc, - MemorySegment.ofAddress(display) - ) - WGPUSurfaceDescriptorFromXlibWindow.window( - windowsDesc, - osHandle - ) - WGPUChainedStruct.sType( - WGPUSurfaceDescriptorFromXlibWindow.chain(windowsDesc), - WGPUSType_SurfaceDescriptorFromXlibWindow() - ) - WGPUSurfaceDescriptor.label(desc, WGPU_NULL) - WGPUSurfaceDescriptor.nextInChain(desc, windowsDesc) - wgpuInstanceCreateSurface(instance.segment, desc) - } - } - GLFW.GLFW_PLATFORM_WAYLAND -> { - Arena.ofConfined().use { scope -> - val display = GLFWNativeWayland.glfwGetWaylandDisplay() - val osHandle = - GLFWNativeWayland.glfwGetWaylandWindow(windowHandle) - val desc = WGPUSurfaceDescriptor.allocate(scope) - val windowsDesc = - WGPUSurfaceDescriptorFromWaylandSurface.allocate(scope) - WGPUSurfaceDescriptorFromWaylandSurface.display( - windowsDesc, - MemorySegment.ofAddress(display) - ) - WGPUSurfaceDescriptorFromWaylandSurface.surface( - windowsDesc, - MemorySegment.ofAddress(osHandle) - ) - WGPUChainedStruct.sType( - WGPUSurfaceDescriptorFromWaylandSurface.chain(windowsDesc), - WGPUSType_SurfaceDescriptorFromWaylandSurface() - ) - WGPUSurfaceDescriptor.label(desc, WGPU_NULL) - WGPUSurfaceDescriptor.nextInChain(desc, windowsDesc) - wgpuInstanceCreateSurface(instance.segment, desc) - } - } - else -> { - logger.log(Logger.Level.ERROR) { - "Linux platform not supported. Supported backends: [X11, Wayland]" - } - WGPU_NULL - } - } - } - isMac -> { - val osHandle = GLFWNativeCocoa.glfwGetCocoaWindow(windowHandle) - Arena.ofConfined().use { scope -> - val objc_msgSend = getLibrary().getFunctionAddress("objc_msgSend") - val CAMetalLayer = objc_getClass("CAMetalLayer") - val contentView = - invokePPP(osHandle, sel_getUid("contentView"), objc_msgSend) - // [ns_window.contentView setWantsLayer:YES]; - invokePPV(contentView, sel_getUid("setWantsLayer:"), true, objc_msgSend) - // metal_layer = [CAMetalLayer layer]; - val metal_layer = - invokePPP(CAMetalLayer, sel_registerName("layer"), objc_msgSend) - // [ns_window.contentView setLayer:metal_layer]; - invokePPPP( - contentView, - sel_getUid("setLayer:"), - metal_layer, - objc_msgSend - ) - - val desc = WGPUSurfaceDescriptor.allocate(scope) - val metalDesc = WGPUSurfaceDescriptorFromMetalLayer.allocate(scope) - WGPUSurfaceDescriptorFromMetalLayer.layer( - metalDesc, - MemorySegment.ofAddress(metal_layer) - ) - WGPUChainedStruct.sType( - WGPUSurfaceDescriptorFromMetalLayer.chain(metalDesc), - WGPUSType_SurfaceDescriptorFromMetalLayer() - ) - WGPUSurfaceDescriptor.label(desc, WGPU_NULL) - WGPUSurfaceDescriptor.nextInChain(desc, metalDesc) - - wgpuInstanceCreateSurface(instance.segment, desc) - } - } - else -> { - logger.log(Logger.Level.ERROR) { "Platform not supported." } - WGPU_NULL - } - } - ) + surface = instance.getSurface(windowHandle, { width to height }) } - override fun release() { - if (device.queue.segment != WGPU_NULL) { - device.queue.release() + private fun WGPU.getSurface(window: Long, sizeProvider: () -> Pair): Surface = when (Platform.os) { + Os.Linux -> { + val display = glfwGetX11Display().let { MemorySegment.ofAddress(it) } + val x11_window = glfwGetX11Window(window) + getSurfaceFromX11Window(display, x11_window) ?: error("fail to get surface on Linux") } - if (device.segment != WGPU_NULL) { - device.release() + Os.Window -> { + val hwnd = glfwGetWin32Window(window).let { MemorySegment.ofAddress(it) } + val hinstance = Kernel32.INSTANCE.GetModuleHandle(null).pointer.toMemory() + getSurfaceFromWindows(hinstance, hwnd) ?: error("fail to get surface on Windows") } - if (adapter.segment != WGPU_NULL) { - adapter.release() + Os.MacOs -> { + val nsWindowPtr = glfwGetCocoaWindow(window) + val nswindow = Rococoa.wrap(ID.fromLong(nsWindowPtr), NSWindow::class.java) + nswindow.contentView()?.setWantsLayer(true) + val layer = CAMetalLayer.layer() + nswindow.contentView()?.setLayer(layer.id().toLong().toPointer()) + getSurfaceFromMetalLayer(MemorySegment.ofAddress(layer.id().toLong())) } + }.also { if( it == MemorySegment.NULL) error("fail to get surface") } + .let { Surface(it, sizeProvider) } - if (surface.segment != WGPU_NULL) { - surface.release() - } + override fun release() { } +} - if (instance.segment != WGPU_NULL) { - wgpuInstanceRelease(instance.segment) - } - } +private enum class Os { + Linux, + Window, + MacOs +} - companion object { - private val logger = Logger() - } +private object Platform { + val os: Os + get() = System.getProperty("os.name").let { name -> + when { + arrayOf("Linux", "SunOS", "Unit").any { name.startsWith(it) } -> Os.Linux + arrayOf("Mac OS X", "Darwin").any { name.startsWith(it) } -> Os.MacOs + arrayOf("Windows").any { name.startsWith(it) } -> Os.Window + else -> error("Unrecognized or unsupported operating system.") + } + } } + +private fun Pointer.toMemory() = MemorySegment.ofAddress(Pointer.nativeValue(this)) +private fun Long.toPointer(): Pointer = Pointer(this) \ No newline at end of file diff --git a/core/src/jvmMain/kotlin/com/littlekt/file/vfs/VfsLoaders.jvm.kt b/core/src/jvmMain/kotlin/com/littlekt/file/vfs/VfsLoaders.jvm.kt index acea617c8..bdbd9b596 100644 --- a/core/src/jvmMain/kotlin/com/littlekt/file/vfs/VfsLoaders.jvm.kt +++ b/core/src/jvmMain/kotlin/com/littlekt/file/vfs/VfsLoaders.jvm.kt @@ -11,9 +11,9 @@ import com.littlekt.file.JvmByteSequenceStream import com.littlekt.graphics.Pixmap import com.littlekt.graphics.PixmapTexture import com.littlekt.graphics.Texture -import com.littlekt.graphics.webgpu.TextureFormat import com.littlekt.log.Logger import fr.delthas.javamp3.Sound +import io.ygdrasil.wgpu.TextureFormat import java.io.ByteArrayInputStream import java.nio.ByteBuffer import java.nio.IntBuffer diff --git a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/-utils.kt b/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/-utils.kt deleted file mode 100644 index 73c2e1b65..000000000 --- a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/-utils.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.wgpu.WGPU -import java.lang.foreign.MemorySegment -import java.lang.foreign.SegmentAllocator -import java.lang.foreign.ValueLayout - -internal fun Array.mapToNativeEntries( - scope: SegmentAllocator, - nativeSize: Long, - allocator: (Long, SegmentAllocator) -> MemorySegment, - action: (entry: T, nativeEntry: MemorySegment) -> Unit -): MemorySegment { - val nativeArray = allocator(this.size.toLong(), scope) - forEachIndexed { index, jvmEntry -> - val nativeEntry = nativeArray.asSlice(nativeSize * index) - - action(jvmEntry, nativeEntry) - } - - return nativeArray -} - -internal fun Collection.mapToNativeEntries( - scope: SegmentAllocator, - nativeSize: Long, - allocator: (Long, SegmentAllocator) -> MemorySegment, - action: (entry: T, nativeEntry: MemorySegment) -> Unit -): MemorySegment { - val nativeArray = allocator(this.size.toLong(), scope) - forEachIndexed { index, jvmEntry -> - val nativeEntry = nativeArray.asSlice(nativeSize * index) - - action(jvmEntry, nativeEntry) - } - - return nativeArray -} - -internal val WGPU_NULL: MemorySegment = WGPU.NULL() - -internal fun List.toNativeArray(scope: SegmentAllocator) = - scope.allocateArray(ValueLayout.JAVA_LONG, *map { it.address() }.toLongArray()) - -internal fun String.toNativeString(scope: SegmentAllocator) = scope.allocateUtf8String(this) - -internal fun Boolean.toInt() = if (this) 1 else 0 - -/** - * Allocated WGPU [MemorySegment] may have a max size of [Long.MAX_VALUE]. This isn't helpful when - * we are trying to - */ -internal fun MemorySegment.mapFromIntUntilNull(transform: (Int) -> T): List { - val results = mutableListOf() - - for (i in 0..byteSize() step ValueLayout.JAVA_INT.byteAlignment()) { - val result = transform(this[ValueLayout.JAVA_INT, i]) - if (result != null) { - results += result - } else { - break - } - } - return results.mapNotNull { it } -} diff --git a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/binding.jvm.kt b/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/binding.jvm.kt deleted file mode 100644 index d6c98ccc8..000000000 --- a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/binding.jvm.kt +++ /dev/null @@ -1,133 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable -import com.littlekt.wgpu.WGPU.* -import com.littlekt.wgpu.WGPUBindGroupEntry -import com.littlekt.wgpu.WGPUBufferBindingLayout -import com.littlekt.wgpu.WGPUSamplerBindingLayout -import com.littlekt.wgpu.WGPUTextureBindingLayout -import java.lang.foreign.MemorySegment - -actual interface IntoBindingResource { - fun intoBindingResource(entry: MemorySegment) -} - -actual class BindGroup(val segment: MemorySegment) : Releasable { - - actual override fun release() { - wgpuBindGroupRelease(segment) - } - - override fun toString(): String { - return "BindGroup" - } -} - -actual abstract class BindingLayout actual constructor() { - abstract fun intoNative( - bufferBinding: MemorySegment, - samplerBinding: MemorySegment, - textureBinding: MemorySegment, - storageTextureBinding: MemorySegment - ) -} - -actual class BufferBinding -actual constructor(val buffer: GPUBuffer, val offset: Long, val size: Long) : IntoBindingResource { - - override fun intoBindingResource(entry: MemorySegment) { - WGPUBindGroupEntry.buffer(entry, buffer.segment) - WGPUBindGroupEntry.offset(entry, offset) - WGPUBindGroupEntry.size(entry, size) - } -} - -actual class BufferBindingLayout -actual constructor( - val type: BufferBindingType, - val hasDynamicOffset: Boolean, - val minBindingSize: Long -) : BindingLayout() { - - override fun intoNative( - bufferBinding: MemorySegment, - samplerBinding: MemorySegment, - textureBinding: MemorySegment, - storageTextureBinding: MemorySegment - ) { - WGPUBufferBindingLayout.type(bufferBinding, type.nativeVal) - WGPUBufferBindingLayout.hasDynamicOffset(bufferBinding, hasDynamicOffset.toInt()) - WGPUBufferBindingLayout.minBindingSize(bufferBinding, minBindingSize) - } -} - -actual class TextureBindingLayout -actual constructor( - val sampleType: TextureSampleType, - val viewDimension: TextureViewDimension, - val multisampled: Boolean -) : BindingLayout() { - - override fun intoNative( - bufferBinding: MemorySegment, - samplerBinding: MemorySegment, - textureBinding: MemorySegment, - storageTextureBinding: MemorySegment - ) { - WGPUTextureBindingLayout.sampleType(textureBinding, sampleType.nativeVal) - WGPUTextureBindingLayout.viewDimension(textureBinding, viewDimension.nativeVal) - WGPUTextureBindingLayout.multisampled(textureBinding, multisampled.toInt()) - } -} - -actual class SamplerBindingLayout actual constructor(val type: SamplerBindingType) : - BindingLayout() { - override fun intoNative( - bufferBinding: MemorySegment, - samplerBinding: MemorySegment, - textureBinding: MemorySegment, - storageTextureBinding: MemorySegment - ) { - WGPUSamplerBindingLayout.type(samplerBinding, type.nativeVal) - } -} - -actual class BindGroupLayoutEntry -actual constructor(val binding: Int, val visibility: ShaderStage, val bindingLayout: BindingLayout) - -actual class BindGroupLayout internal constructor(val segment: MemorySegment) : Releasable { - - actual override fun release() { - wgpuBindGroupLayoutRelease(segment) - } - - override fun toString(): String { - return "BindGroupLayout" - } -} - -actual class PipelineLayout(val segment: MemorySegment) : Releasable { - - actual override fun release() { - wgpuPipelineLayoutRelease(segment) - } - - override fun toString(): String { - return "PipelineLayout" - } -} - -class MemorySegmentList(segments: List) : List by segments - -actual class PipelineLayoutDescriptor -internal constructor(val segments: MemorySegmentList, val label: String?) { - actual constructor( - bindGroupLayouts: List, - label: String? - ) : this(MemorySegmentList(bindGroupLayouts.map { it.segment }), label) - - actual constructor( - bindGroupLayout: BindGroupLayout, - label: String? - ) : this(listOf(bindGroupLayout)) -} diff --git a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/command.jvm.kt b/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/command.jvm.kt deleted file mode 100644 index 5ec4183e0..000000000 --- a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/command.jvm.kt +++ /dev/null @@ -1,376 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.EngineStats -import com.littlekt.Releasable -import com.littlekt.wgpu.* -import com.littlekt.wgpu.WGPU.* -import java.lang.foreign.Arena -import java.lang.foreign.MemorySegment -import java.lang.foreign.SegmentAllocator -import java.lang.foreign.ValueLayout - -actual class RenderPipeline(val segment: MemorySegment) : Releasable { - - actual override fun release() { - wgpuRenderPipelineRelease(segment) - } - - override fun toString(): String { - return "RenderPipeline" - } -} - -actual class CommandBuffer(val segment: MemorySegment) : Releasable { - actual override fun release() { - wgpuCommandBufferRelease(segment) - } -} - -fun TextureCopyView.toNative(scope: SegmentAllocator): MemorySegment { - val native = WGPUImageCopyTexture.allocate(scope) - val nativeOrigin = WGPUImageCopyTexture.origin(native) - - WGPUImageCopyTexture.texture(native, texture.segment) - WGPUImageCopyTexture.mipLevel(native, mipLevel) - WGPUOrigin3D.x(nativeOrigin, origin.x) - WGPUOrigin3D.y(nativeOrigin, origin.y) - WGPUOrigin3D.z(nativeOrigin, origin.z) - - return native -} - -fun TextureDataLayout.toNative(scope: SegmentAllocator): MemorySegment { - val native = WGPUTextureDataLayout.allocate(scope) - - WGPUTextureDataLayout.bytesPerRow(native, bytesPerRow) - WGPUTextureDataLayout.rowsPerImage(native, rowsPerImage) - WGPUTextureDataLayout.offset(native, offset) - - return native -} - -fun BufferCopyView.toNative(scope: SegmentAllocator): MemorySegment { - val native = WGPUImageCopyBuffer.allocate(scope) - val layoutNative = WGPUImageCopyBuffer.layout(native) - - WGPUImageCopyBuffer.buffer(native, buffer.segment) - WGPUTextureDataLayout.bytesPerRow(layoutNative, layout.bytesPerRow) - WGPUTextureDataLayout.rowsPerImage(layoutNative, layout.rowsPerImage) - WGPUTextureDataLayout.offset(layoutNative, layout.offset) - - return native -} - -actual class CommandEncoder(val segment: MemorySegment) : Releasable { - - actual fun beginRenderPass(desc: RenderPassDescriptor): RenderPassEncoder { - return Arena.ofConfined().use { scope -> - WGPURenderPassDescriptor.allocate(scope).let { renderPassDesc -> - WGPURenderPassDescriptor.label( - renderPassDesc, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - WGPURenderPassDescriptor.colorAttachmentCount( - renderPassDesc, - desc.colorAttachments.size.toLong() - ) - WGPURenderPassDescriptor.colorAttachments( - renderPassDesc, - desc.colorAttachments.mapToNativeEntries( - scope, - WGPURenderPassColorAttachment.sizeof(), - WGPURenderPassColorAttachment::allocateArray - ) { colorAttachment, nativeColorAttachment -> - WGPURenderPassColorAttachment.view( - nativeColorAttachment, - colorAttachment.view.segment - ) - WGPURenderPassColorAttachment.loadOp( - nativeColorAttachment, - colorAttachment.loadOp.nativeVal - ) - WGPURenderPassColorAttachment.storeOp( - nativeColorAttachment, - colorAttachment.storeOp.nativeVal - ) - colorAttachment.clearColor?.let { clearColor -> - WGPUColor.allocate(scope) - .also { - WGPUColor.r(it, clearColor.r.toDouble()) - WGPUColor.g(it, clearColor.g.toDouble()) - WGPUColor.b(it, clearColor.b.toDouble()) - WGPUColor.a(it, clearColor.a.toDouble()) - } - .let { - WGPURenderPassColorAttachment.clearValue( - nativeColorAttachment, - it - ) - } - } - } - ) - - desc.depthStencilAttachment?.let { depthStencilAttachment -> - val nativeDepthStencilAttachment = - WGPURenderPassDepthStencilAttachment.allocate(scope) - - WGPURenderPassDepthStencilAttachment.view( - nativeDepthStencilAttachment, - depthStencilAttachment.view.segment - ) - WGPURenderPassDepthStencilAttachment.depthClearValue( - nativeDepthStencilAttachment, - depthStencilAttachment.depthClearValue - ) - depthStencilAttachment.depthLoadOp?.nativeVal?.let { - WGPURenderPassDepthStencilAttachment.depthLoadOp( - nativeDepthStencilAttachment, - it - ) - } - - depthStencilAttachment.depthStoreOp?.nativeVal?.let { - WGPURenderPassDepthStencilAttachment.depthStoreOp( - nativeDepthStencilAttachment, - it - ) - } - WGPURenderPassDepthStencilAttachment.depthReadOnly( - nativeDepthStencilAttachment, - depthStencilAttachment.depthReadOnly.toInt() - ) - WGPURenderPassDepthStencilAttachment.stencilClearValue( - nativeDepthStencilAttachment, - depthStencilAttachment.stencilClearValue - ) - - depthStencilAttachment.stencilLoadOp?.nativeVal?.let { - WGPURenderPassDepthStencilAttachment.stencilLoadOp( - nativeDepthStencilAttachment, - it - ) - } - - depthStencilAttachment.stencilStoreOp?.nativeVal?.let { - WGPURenderPassDepthStencilAttachment.stencilStoreOp( - nativeDepthStencilAttachment, - it - ) - } - WGPURenderPassDepthStencilAttachment.depthReadOnly( - nativeDepthStencilAttachment, - depthStencilAttachment.stencilReadOnly.toInt() - ) - - WGPURenderPassDescriptor.depthStencilAttachment( - renderPassDesc, - nativeDepthStencilAttachment - ) - } - RenderPassEncoder( - wgpuCommandEncoderBeginRenderPass(segment, renderPassDesc), - desc.label - ) - } - } - } - - actual fun finish(): CommandBuffer { - return CommandBuffer(wgpuCommandEncoderFinish(segment, NULL())) - } - - actual fun copyBufferToTexture( - source: BufferCopyView, - destination: TextureCopyView, - copySize: Extent3D - ) { - Arena.ofConfined().use { scope -> - wgpuCommandEncoderCopyBufferToTexture( - segment, - source.toNative(scope), - destination.toNative(scope), - copySize.toNative(scope) - ) - } - } - - actual fun beginComputePass(label: String?): ComputePassEncoder { - return Arena.ofConfined().use { scope -> - val desc = WGPUComputePipelineDescriptor.allocate(scope) - WGPUComputePipelineDescriptor.label(desc, label?.toNativeString(scope) ?: WGPU_NULL) - ComputePassEncoder(wgpuCommandEncoderBeginComputePass(segment, desc)) - } - } - - actual fun copyBufferToBuffer( - source: GPUBuffer, - destination: GPUBuffer, - sourceOffset: Int, - destinationOffset: Int, - size: Long - ) { - wgpuCommandEncoderCopyBufferToBuffer( - segment, - source.segment, - sourceOffset.toLong(), - destination.segment, - destinationOffset.toLong(), - size - ) - } - - actual fun copyTextureToBuffer(source: TextureCopyView, dest: BufferCopyView, size: Extent3D) { - TODO("IMPL") - } - - actual override fun release() { - wgpuCommandEncoderRelease(segment) - } -} - -actual class RenderPassEncoder(val segment: MemorySegment, actual val label: String? = null) : - Releasable { - - actual fun setPipeline(pipeline: RenderPipeline) { - wgpuRenderPassEncoderSetPipeline(segment, pipeline.segment) - } - - actual fun draw(vertexCount: Int, instanceCount: Int, firstVertex: Int, firstInstance: Int) { - EngineStats.drawCalls++ - EngineStats.triangles += (vertexCount / 3) * instanceCount - wgpuRenderPassEncoderDraw(segment, vertexCount, instanceCount, firstVertex, firstInstance) - } - - actual fun end() { - wgpuRenderPassEncoderEnd(segment) - } - - actual fun setVertexBuffer(slot: Int, buffer: GPUBuffer, offset: Long, size: Long) { - wgpuRenderPassEncoderSetVertexBuffer(segment, slot, buffer.segment, offset, size) - } - - actual fun drawIndexed( - indexCount: Int, - instanceCount: Int, - firstIndex: Int, - baseVertex: Int, - firstInstance: Int - ) { - EngineStats.drawCalls++ - EngineStats.triangles += (indexCount / 3) * instanceCount - wgpuRenderPassEncoderDrawIndexed( - segment, - indexCount, - instanceCount, - firstIndex, - baseVertex, - firstInstance - ) - } - - actual fun setIndexBuffer( - buffer: GPUBuffer, - indexFormat: IndexFormat, - offset: Long, - size: Long - ) { - wgpuRenderPassEncoderSetIndexBuffer( - segment, - buffer.segment, - indexFormat.nativeVal, - offset, - size - ) - } - - actual fun setBindGroup(index: Int, bindGroup: BindGroup, dynamicOffsets: List) { - if (dynamicOffsets.isNotEmpty()) { - Arena.ofConfined().use { scope -> - val offsets = - scope.allocateArray(ValueLayout.JAVA_LONG, *dynamicOffsets.toLongArray()) - wgpuRenderPassEncoderSetBindGroup( - segment, - index, - bindGroup.segment, - dynamicOffsets.size.toLong(), - offsets - ) - } - } else { - wgpuRenderPassEncoderSetBindGroup(segment, index, bindGroup.segment, 0, WGPU_NULL) - } - } - - actual override fun release() { - wgpuRenderPassEncoderRelease(segment) - } - - actual fun setViewport( - x: Int, - y: Int, - width: Int, - height: Int, - minDepth: Float, - maxDepth: Float - ) { - wgpuRenderPassEncoderSetViewport( - segment, - x.toFloat(), - y.toFloat(), - width.toFloat(), - height.toFloat(), - minDepth, - maxDepth - ) - } - - actual fun setScissorRect(x: Int, y: Int, width: Int, height: Int) { - wgpuRenderPassEncoderSetScissorRect(segment, x, y, width, height) - } - - override fun toString(): String { - return "RenderPassEncoder(label=$label)" - } -} - -actual class ComputePipeline(val segment: MemorySegment) : Releasable { - actual override fun release() { - wgpuComputePipelineRelease(segment) - } - - override fun toString(): String { - return "ComputePipeline" - } -} - -actual class ComputePassEncoder(val segment: MemorySegment) : Releasable { - actual fun setPipeline(pipeline: ComputePipeline) { - wgpuComputePassEncoderSetPipeline(segment, pipeline.segment) - } - - actual fun setBindGroup(index: Int, bindGroup: BindGroup) { - wgpuComputePassEncoderSetBindGroup(segment, index, bindGroup.segment, 0, WGPU_NULL) - } - - actual fun dispatchWorkgroups( - workgroupCountX: Int, - workgroupCountY: Int, - workgroupCountZ: Int - ) { - wgpuComputePassEncoderDispatchWorkgroups( - segment, - workgroupCountX, - workgroupCountY, - workgroupCountZ - ) - } - - actual fun end() { - wgpuComputePassEncoderEnd(segment) - } - - actual override fun release() { - wgpuComputePassEncoderRelease(segment) - } -} diff --git a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/enums.jvm.kt b/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/enums.jvm.kt deleted file mode 100644 index c53c22b68..000000000 --- a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/enums.jvm.kt +++ /dev/null @@ -1,458 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.wgpu.WGPU.* - -val PrimitiveTopology.nativeVal: Int - get() = - when (this) { - PrimitiveTopology.POINT_LIST -> WGPUPrimitiveTopology_PointList() - PrimitiveTopology.LINE_LIST -> WGPUPrimitiveTopology_LineList() - PrimitiveTopology.LINE_STRIP -> WGPUPrimitiveTopology_LineStrip() - PrimitiveTopology.TRIANGLE_LIST -> WGPUPrimitiveTopology_TriangleList() - PrimitiveTopology.TRIANGLE_STRIP -> WGPUPrimitiveTopology_TriangleStrip() - } - -val FrontFace.nativeVal: Int - get() = - when (this) { - FrontFace.CCW -> WGPUFrontFace_CCW() - FrontFace.CW -> WGPUFrontFace_CW() - } - -val CullMode.nativeVal: Int - get() = - when (this) { - CullMode.NONE -> WGPUCullMode_None() - CullMode.FRONT -> WGPUCullMode_Front() - CullMode.BACK -> WGPUCullMode_Back() - } - -val TextureViewDimension.nativeVal: Int - get() = - when (this) { - TextureViewDimension.D1 -> WGPUTextureViewDimension_1D() - TextureViewDimension.D2 -> WGPUTextureViewDimension_2D() - TextureViewDimension.D2_ARRAY -> WGPUTextureViewDimension_2DArray() - TextureViewDimension.CUBE -> WGPUTextureViewDimension_Cube() - TextureViewDimension.CUBE_ARRAY -> WGPUTextureViewDimension_CubeArray() - TextureViewDimension.D3 -> WGPUTextureViewDimension_3D() - } - -val TextureAspect.nativeVal: Int - get() = - when (this) { - TextureAspect.ALL -> WGPUTextureAspect_All() - TextureAspect.STENCIL_ONLY -> WGPUTextureAspect_StencilOnly() - TextureAspect.DEPTH_ONLY -> WGPUTextureAspect_DepthOnly() - } - -val TextureDimension.nativeVal: Int - get() = - when (this) { - TextureDimension.D1 -> WGPUTextureDimension_1D() - TextureDimension.D2 -> WGPUTextureDimension_2D() - TextureDimension.D3 -> WGPUTextureDimension_3D() - } - -val TextureFormat.nativeVal: Int - get() = - when (this) { - /** 8 Bit Red channel only. `[0, 255]` converted to/from float `[0, 1]` in shader. */ - TextureFormat.R8_UNORM -> WGPUTextureFormat_R8Unorm() - - /** - * 8 Bit Red channel only. `[-127, 127]` converted to/from float `[-1, 1]` in shader. - */ - TextureFormat.R8_SNORM -> WGPUTextureFormat_R8Snorm() - - /** Red channel only. 8 bit integer per channel. Unsigned in shader. */ - TextureFormat.R8_UINT -> WGPUTextureFormat_R8Uint() - - /** Red channel only. 8 bit integer per channel. Signed in shader. */ - TextureFormat.R8_SINT -> WGPUTextureFormat_R8Sint() - - /** Red channel only. 16 bit integer per channel. Unsigned in shader. */ - TextureFormat.R16_UINT -> WGPUTextureFormat_R16Uint() - - /** Red channel only. 16 bit integer per channel. Signed in shader. */ - TextureFormat.R16_SINT -> WGPUTextureFormat_R16Sint() - - /** Red channel only. 16 bit float per channel. Float in shader. */ - TextureFormat.R16_FLOAT -> WGPUTextureFormat_RG16Float() - - /** - * Red and green channels. 8 bit integer per channel. `[0, 255]` converted to/from float - * `[0, 1]` in shader. - */ - TextureFormat.RG8_UNORM -> WGPUTextureFormat_RG8Unorm() - - /** - * Red and green channels. 8 bit integer per channel. `[-127, 127]` converted to/from - * float `[-1, 1]` in shader. - */ - TextureFormat.RG8_SNORM -> WGPUTextureFormat_RG8Snorm() - - /** Red and green channels. 8 bit integer per channel. Unsigned in shader. */ - TextureFormat.RG8_UINT -> WGPUTextureFormat_RG8Uint() - - /** Red and green channel s. 8 bit integer per channel. Signed in shader. */ - TextureFormat.RG8_SINT -> WGPUTextureFormat_RG8Sint() - - /** Red channel only. 32 bit integer per channel. Unsigned in shader. */ - TextureFormat.R32_UINT -> WGPUTextureFormat_R32Uint() - - /** Red channel only. 32 bit integer per channel. Signed in shader. */ - TextureFormat.R32_SINT -> WGPUTextureFormat_R32Sint() - - /** Red channel only. 32 bit float per channel. Float in shader. */ - TextureFormat.R32_FLOAT -> WGPUTextureFormat_R32Float() - - /** Red and green channels. 16 bit integer per channel. Unsigned in shader. */ - TextureFormat.RG16_UINT -> WGPUTextureFormat_RG16Uint() - - /** Red and green channels. 16 bit integer per channel. Signed in shader. */ - TextureFormat.RG16_SINT -> WGPUTextureFormat_RG16Sint() - - /** Red and green channels. 16 bit float per channel. Float in shader. */ - TextureFormat.RG16_FLOAT -> WGPUTextureFormat_RG16Float() - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. `[0, 255]` converted - * to/from float `[0, 1]` in shader. - */ - TextureFormat.RGBA8_UNORM -> WGPUTextureFormat_RGBA8Unorm() - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Srgb-color `[0, - * 255]` converted to/from linear-color float `[0, 1]` in shader. - */ - TextureFormat.RGBA8_UNORM_SRGB -> WGPUTextureFormat_RGBA8UnormSrgb() - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. `[-127, 127]` - * converted to/from float `[-1, 1]` in shader. - */ - TextureFormat.RGBA8_SNORM -> WGPUTextureFormat_RGBA8Snorm() - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Unsigned in shader. - */ - TextureFormat.RGBA8_UINT -> WGPUTextureFormat_RGBA8Uint() - - /** - * Red, green, blue, and alpha channels. 8 bit integer per channel. Signed in shader. - */ - TextureFormat.RGBA8_SINT -> WGPUTextureFormat_RGBA8Sint() - - /** - * Blue, green, red, and alpha channels. 8 bit integer per channel. `[0, 255]` converted - * to/from float `[0, 1]` in shader. - */ - TextureFormat.BGRA8_UNORM -> WGPUTextureFormat_BGRA8Unorm() - - /** - * Blue, green, red, and alpha channels. 8 bit integer per channel. Srgb-color `[0, - * 255]` converted to/from linear-color float `[0, 1]` in shader. - */ - TextureFormat.BGRA8_UNORM_SRGB -> WGPUTextureFormat_BGRA8UnormSrgb() - - /** - * Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer - * for alpha channel. `[0, 1023]` (`[0, 3]` for alpha) converted to/from float `[0, 1]` - * in shader. - */ - TextureFormat.RGB10A2_UNORM -> WGPUTextureFormat_RGB10A2Unorm() - - /** - * Red, green, and blue channels. 11 bit float with no sign bit for RG channels. 10 bit - * float with no sign bit for blue channel. Float in shader. - */ - TextureFormat.RG11B10_FLOAT -> WGPUTextureFormat_RG11B10Ufloat() - - /** Red and green channels. 32 bit integer per channel. Unsigned in shader. */ - TextureFormat.RG32_UINT -> WGPUTextureFormat_RG32Uint() - - /** Red and green channels. 32 bit integer per channel. Signed in shader. */ - TextureFormat.RG32_SINT -> WGPUTextureFormat_RG32Sint() - - /** Red and green channels. 32 bit float per channel. Float in shader. */ - TextureFormat.RG32_FLOAT -> WGPUTextureFormat_RG32Float() - - /** - * Red, green, blue, and alpha channels. 16 bit integer per channel. Unsigned in shader. - */ - TextureFormat.RGBA16_UINT -> WGPUTextureFormat_RGBA16Uint() - - /** - * Red, green, blue, and alpha channels. 16 bit integer per channel. Signed in shader. - */ - TextureFormat.RGBA16_SINT -> WGPUTextureFormat_RGBA16Sint() - - /** Red, green, blue, and alpha channels. 16 bit float per channel. Float in shader. */ - TextureFormat.RGBA16_FLOAT -> WGPUTextureFormat_RGBA16Float() - - /** - * Red, green, blue, and alpha channels. 32 bit integer per channel. Unsigned in shader. - */ - TextureFormat.RGBA32_UINT -> WGPUTextureFormat_RGBA32Uint() - - /** - * Red, green, blue, and alpha channels. 32 bit integer per channel. Signed in shader. - */ - TextureFormat.RGBA32_SINT -> WGPUTextureFormat_RGBA32Sint() - - /** Red, green, blue, and alpha channels. 32 bit float per channel. Float in shader. */ - TextureFormat.RGBA32_FLOAT -> WGPUTextureFormat_RGBA32Float() - - /** Special depth format with 32 bit floating point depth. */ - TextureFormat.DEPTH32_FLOAT -> WGPUTextureFormat_Depth32Float() - - /** Special depth format with at least 24 bit integer depth. */ - TextureFormat.DEPTH24_PLUS -> WGPUTextureFormat_Depth24Plus() - - /** - * Special depth/stencil format with at least 24 bit integer depth and 8 bits integer - * stencil. - */ - TextureFormat.DEPTH24_PLUS_STENCIL8 -> WGPUTextureFormat_Depth24PlusStencil8() - } - -fun TextureFormat.Companion.from(nativeVal: Int) = - TextureFormat.entries.firstOrNull { it.nativeVal == nativeVal } - -val BlendOperation.nativeVal: Int - get() = - when (this) { - BlendOperation.ADD -> WGPUBlendOperation_Add() - BlendOperation.SUBTRACT -> WGPUBlendOperation_Subtract() - BlendOperation.REVERSE_SUBTRACT -> WGPUBlendOperation_ReverseSubtract() - BlendOperation.MIN -> WGPUBlendOperation_Min() - BlendOperation.MAX -> WGPUBlendOperation_Max() - } - -val StencilOperation.nativeVal: Int - get() = - when (this) { - StencilOperation.KEEP -> WGPUStencilOperation_Keep() - StencilOperation.ZERO -> WGPUStencilOperation_Zero() - StencilOperation.REPLACE -> WGPUStencilOperation_Replace() - StencilOperation.INVERT -> WGPUStencilOperation_Invert() - StencilOperation.INCREMENT_CLAMP -> WGPUStencilOperation_IncrementClamp() - StencilOperation.DECREMENT_CLAMP -> WGPUStencilOperation_DecrementClamp() - StencilOperation.INCREMENT_WRAP -> WGPUStencilOperation_IncrementWrap() - StencilOperation.DECREMENT_WRAP -> WGPUStencilOperation_DecrementWrap() - } - -val BlendFactor.nativeVal: Int - get() = - when (this) { - BlendFactor.ZERO -> WGPUBlendFactor_Zero() - BlendFactor.ONE -> WGPUBlendFactor_One() - BlendFactor.SRC_COLOR -> WGPUBlendFactor_Src() - BlendFactor.ONE_MINUS_SRC_COLOR -> WGPUBlendFactor_OneMinusSrc() - BlendFactor.SRC_ALPHA -> WGPUBlendFactor_SrcAlpha() - BlendFactor.ONE_MINUS_SRC_ALPHA -> WGPUBlendFactor_OneMinusSrcAlpha() - BlendFactor.DST_COLOR -> WGPUBlendFactor_Dst() - BlendFactor.ONE_MINUS_DST_COLOR -> WGPUBlendFactor_OneMinusDst() - BlendFactor.DST_ALPHA -> WGPUBlendFactor_DstAlpha() - BlendFactor.ONE_MINUS_DST_ALPHA -> WGPUBlendFactor_OneMinusDstAlpha() - BlendFactor.SRC_ALPHA_SATURATED -> WGPUBlendFactor_SrcAlphaSaturated() - BlendFactor.CONSTANT_COLOR -> WGPUBlendFactor_Constant() - BlendFactor.ONE_MINUS_CONSTANT_COLOR -> WGPUBlendFactor_OneMinusConstant() - } - -val IndexFormat.nativeVal: Int - get() = - when (this) { - /// Supported on Web and Desktop - IndexFormat.UINT16 -> WGPUIndexFormat_Uint16() - - /// Not supported on web for WGPU. - IndexFormat.UINT32 -> WGPUIndexFormat_Uint32() - } - -val VertexFormat.nativeVal: Int - get() = - when (this) { - VertexFormat.UINT8x2 -> WGPUVertexFormat_Uint8x2() - VertexFormat.UINT8x4 -> WGPUVertexFormat_Uint8x4() - VertexFormat.SINT8x2 -> WGPUVertexFormat_Sint8x2() - VertexFormat.SINT8x4 -> WGPUVertexFormat_Sint8x4() - VertexFormat.UNORM8x2 -> WGPUVertexFormat_Unorm8x2() - VertexFormat.UNORM8x4 -> WGPUVertexFormat_Unorm8x4() - VertexFormat.SNORM8x2 -> WGPUVertexFormat_Snorm8x2() - VertexFormat.SNORM8x4 -> WGPUVertexFormat_Snorm8x4() - VertexFormat.UINT16x2 -> WGPUVertexFormat_Uint16x2() - VertexFormat.UINT16x4 -> WGPUVertexFormat_Uint16x4() - VertexFormat.SINT16x2 -> WGPUVertexFormat_Sint16x2() - VertexFormat.SINT16x4 -> WGPUVertexFormat_Sint16x4() - VertexFormat.UNORM16x2 -> WGPUVertexFormat_Unorm16x2() - VertexFormat.UNORM16x4 -> WGPUVertexFormat_Unorm16x4() - VertexFormat.SNORM16x2 -> WGPUVertexFormat_Snorm16x2() - VertexFormat.SNORM16x4 -> WGPUVertexFormat_Snorm16x4() - VertexFormat.FLOAT16x2 -> WGPUVertexFormat_Float16x2() - VertexFormat.FLOAT16x4 -> WGPUVertexFormat_Float16x4() - VertexFormat.FLOAT32 -> WGPUVertexFormat_Float32() - VertexFormat.FLOAT32x2 -> WGPUVertexFormat_Float32x2() - VertexFormat.FLOAT32x3 -> WGPUVertexFormat_Float32x3() - VertexFormat.FLOAT32x4 -> WGPUVertexFormat_Float32x4() - VertexFormat.UINT32 -> WGPUVertexFormat_Uint32() - VertexFormat.UINT32x2 -> WGPUVertexFormat_Uint32x2() - VertexFormat.UINT32x3 -> WGPUVertexFormat_Uint32x3() - VertexFormat.UINT32x4 -> WGPUVertexFormat_Uint32x4() - VertexFormat.SINT32 -> WGPUVertexFormat_Sint32() - VertexFormat.SINT32x2 -> WGPUVertexFormat_Sint32x2() - VertexFormat.SINT32x3 -> WGPUVertexFormat_Sint32x3() - VertexFormat.SINT32x4 -> WGPUVertexFormat_Sint32x4() - } - -val VertexStepMode.nativeVal: Int - get() = - when (this) { - VertexStepMode.VERTEX -> WGPUVertexStepMode_Vertex() - VertexStepMode.INSTANCE -> WGPUVertexStepMode_Instance() - } - -val LoadOp.nativeVal: Int - get() = - when (this) { - LoadOp.CLEAR -> WGPULoadOp_Clear() - LoadOp.LOAD -> WGPULoadOp_Load() - } - -val StoreOp.nativeVal: Int - get() = - when (this) { - StoreOp.DISCARD -> WGPUStoreOp_Discard() - StoreOp.STORE -> WGPUStoreOp_Store() - } - -val BufferBindingType.nativeVal: Int - get() = - when (this) { - BufferBindingType.UNIFORM -> WGPUBufferBindingType_Uniform() - BufferBindingType.STORAGE -> WGPUBufferBindingType_Storage() - BufferBindingType.READ_ONLY_STORAGE -> WGPUBufferBindingType_ReadOnlyStorage() - } - -val AddressMode.nativeVal: Int - get() = - when (this) { - AddressMode.CLAMP_TO_EDGE -> WGPUAddressMode_ClampToEdge() - AddressMode.REPEAT -> WGPUAddressMode_Repeat() - AddressMode.MIRROR_REPEAT -> WGPUAddressMode_MirrorRepeat() - } - -val FilterMode.nativeVal: Int - get() = - when (this) { - FilterMode.NEAREST -> WGPUFilterMode_Nearest() - FilterMode.LINEAR -> WGPUFilterMode_Linear() - } - -val CompareFunction.nativeVal: Int - get() = - when (this) { - CompareFunction.NEVER -> WGPUCompareFunction_Never() - CompareFunction.LESS -> WGPUCompareFunction_Less() - CompareFunction.EQUAL -> WGPUCompareFunction_Equal() - CompareFunction.LESS_EQUAL -> WGPUCompareFunction_LessEqual() - CompareFunction.GREATER -> WGPUCompareFunction_Greater() - CompareFunction.NOT_EQUAL -> WGPUCompareFunction_NotEqual() - CompareFunction.GREATER_EQUAL -> WGPUCompareFunction_GreaterEqual() - CompareFunction.ALWAYS -> WGPUCompareFunction_Always() - } - -val TextureSampleType.nativeVal: Int - get() = - when (this) { - TextureSampleType.FLOAT -> WGPUTextureSampleType_Float() - TextureSampleType.SINT -> WGPUTextureSampleType_Sint() - TextureSampleType.UINT -> WGPUTextureSampleType_Uint() - TextureSampleType.DEPTH -> WGPUTextureSampleType_Depth() - } - -val SamplerBindingType.nativeVal: Int - get() = - when (this) { - SamplerBindingType.FILTERING -> WGPUSamplerBindingType_Filtering() - SamplerBindingType.NON_FILTERING -> WGPUSamplerBindingType_NonFiltering() - SamplerBindingType.COMPARISON -> WGPUSamplerBindingType_Comparison() - } - -val AlphaMode.nativeVal: Int - get() = - when (this) { - AlphaMode.AUTO -> WGPUCompositeAlphaMode_Auto() - AlphaMode.OPAQUE -> WGPUCompositeAlphaMode_Opaque() - AlphaMode.PREMULTIPLIED -> WGPUCompositeAlphaMode_Premultiplied() - AlphaMode.UNPREMULTIPLIED -> WGPUCompositeAlphaMode_Unpremultiplied() - AlphaMode.INHERIT -> WGPUCompositeAlphaMode_Inherit() - } - -fun AlphaMode.Companion.from(nativeVal: Int): AlphaMode? = - AlphaMode.entries.firstOrNull { it.nativeVal == nativeVal } - -val PresentMode.nativeVal: Int - get() = - when (this) { - PresentMode.FIFO -> WGPUPresentMode_Fifo() - PresentMode.FIFO_RELAXED -> WGPUPresentMode_FifoRelaxed() - PresentMode.IMMEDIATE -> WGPUPresentMode_Immediate() - PresentMode.MAILBOX -> WGPUPresentMode_Mailbox() - } - -val TextureStatus.nativeVal: Int - get() = - when (this) { - TextureStatus.SUCCESS -> WGPUSurfaceGetCurrentTextureStatus_Success() - TextureStatus.TIMEOUT -> WGPUSurfaceGetCurrentTextureStatus_Timeout() - TextureStatus.OUTDATED -> WGPUSurfaceGetCurrentTextureStatus_Outdated() - TextureStatus.LOST -> WGPUSurfaceGetCurrentTextureStatus_Lost() - TextureStatus.OUT_OF_MEMORY -> WGPUSurfaceGetCurrentTextureStatus_OutOfMemory() - TextureStatus.DEVICE_LOST -> WGPUSurfaceGetCurrentTextureStatus_DeviceLost() - } - -fun TextureStatus.Companion.from(nativeVal: Int): TextureStatus? = - TextureStatus.entries.firstOrNull { it.nativeVal == nativeVal } - -@JvmInline -value class Backend(val flag: Int) { - - infix fun or(other: Backend): Backend = Backend(flag or other.flag) - - infix fun and(other: Backend): Backend = Backend(flag and other.flag) - - fun isInvalid(): Boolean = this or all != all - - companion object { - val VULKAN: Backend = Backend(WGPUInstanceBackend_Vulkan()) - val GL: Backend = Backend(WGPUInstanceBackend_GL()) - val METAL: Backend = Backend(WGPUInstanceBackend_Metal()) - val DX11: Backend = Backend(WGPUInstanceBackend_DX11()) - val DX12: Backend = Backend(WGPUInstanceBackend_DX12()) - val ALL: Backend = Backend(WGPUInstanceBackend_All()) - - private val all = VULKAN or GL or METAL or DX11 or DX12 - } -} - -val Feature.nativeVal: Int - get() = - when (this) { - Feature.DEPTH_CLIP_CONTROL -> WGPUFeatureName_DepthClipControl() - Feature.DEPTH32FLOAT_STENCIL18 -> WGPUFeatureName_Depth32FloatStencil8() - Feature.TEXTURE_COMPRESSION_BC -> WGPUFeatureName_TextureCompressionBC() - Feature.TEXTURE_COMPRESSION_ETC2 -> WGPUFeatureName_TextureCompressionETC2() - Feature.TEXTURE_COMPRESSION_ASTC -> WGPUFeatureName_TextureCompressionASTC() - Feature.TIMESTAMP_QUERY -> WGPUFeatureName_TimestampQuery() - Feature.INDIRECT_FIRST_INSTANCE -> WGPUFeatureName_IndirectFirstInstance() - Feature.SHADER_F16 -> WGPUFeatureName_ShaderF16() - Feature.RG11B10UFLOAT_RENDERABLE -> WGPUFeatureName_RG11B10UfloatRenderable() - Feature.BGRA8UNORM_STORAGE -> WGPUFeatureName_BGRA8UnormStorage() - Feature.FLOAT32_FILTERABLE -> WGPUFeatureName_Float32Filterable() - Feature.CLIP_DISTANCES -> - WGPUFeatureName_Undefined() // TODO check if this exists in WGPU in the future - Feature.DUAL_SOURCE_BLENDING -> - WGPUFeatureName_Undefined() // TODO check if this exists in WGPU in the future - } diff --git a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/webgpu.jvm.kt b/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/webgpu.jvm.kt deleted file mode 100644 index 71b78d168..000000000 --- a/core/src/jvmMain/kotlin/com/littlekt/graphics/webgpu/webgpu.jvm.kt +++ /dev/null @@ -1,982 +0,0 @@ -package com.littlekt.graphics.webgpu - -import com.littlekt.Releasable -import com.littlekt.file.* -import com.littlekt.log.Logger -import com.littlekt.resources.BufferResourceInfo -import com.littlekt.resources.TextureResourceInfo -import com.littlekt.wgpu.* -import com.littlekt.wgpu.WGPU.* -import java.lang.foreign.Arena -import java.lang.foreign.MemorySegment -import java.lang.foreign.SegmentAllocator -import java.lang.foreign.ValueLayout -import kotlinx.atomicfu.atomic -import kotlinx.atomicfu.update - -actual class Device(val segment: MemorySegment) : Releasable { - - actual val queue: Queue by lazy { Queue(wgpuDeviceGetQueue(segment)) } - - actual val features: List by lazy { - val list = mutableListOf() - Feature.entries.forEach { - val result = wgpuDeviceHasFeature(segment, it.nativeVal) - if (result == 1) { - list += it - } - } - list.toList() - } - - actual val limits: Limits by lazy { - Arena.ofConfined().use { scope -> - val supported = WGPUSupportedLimits.allocate(scope) - wgpuDeviceGetLimits(segment, supported) - val desc = WGPUSupportedLimits.limits(supported) - Limits( - maxTextureDimension1D = WGPULimits.maxTextureDimension1D(desc), - maxTextureDimension2D = WGPULimits.maxTextureDimension2D(desc), - maxTextureDimension3D = WGPULimits.maxTextureDimension3D(desc), - maxTextureArrayLayers = WGPULimits.maxTextureArrayLayers(desc), - maxBindGroups = WGPULimits.maxBindGroups(desc), - maxBindGroupsPlusVertexBuffers = WGPULimits.maxBindGroupsPlusVertexBuffers(desc), - maxBindingsPerBindGroup = WGPULimits.maxBindingsPerBindGroup(desc), - maxDynamicUniformBuffersPerPipelineLayout = - WGPULimits.maxDynamicUniformBuffersPerPipelineLayout(desc), - maxDynamicStorageBuffersPerPipelineLayout = - WGPULimits.maxDynamicStorageBuffersPerPipelineLayout(desc), - maxSampledTexturesPerShaderStage = - WGPULimits.maxSampledTexturesPerShaderStage(desc), - maxSamplersPerShaderStage = WGPULimits.maxSamplersPerShaderStage(desc), - maxStorageBuffersPerShaderStage = WGPULimits.maxStorageBuffersPerShaderStage(desc), - maxStorageTexturesPerShaderStage = - WGPULimits.maxStorageTexturesPerShaderStage(desc), - maxUniformBuffersPerShaderStage = WGPULimits.maxUniformBuffersPerShaderStage(desc), - maxUniformBufferBindingSize = WGPULimits.maxUniformBufferBindingSize(desc), - maxStorageBufferBindingSize = WGPULimits.maxStorageBufferBindingSize(desc), - minUniformBufferOffsetAlignment = WGPULimits.minUniformBufferOffsetAlignment(desc), - minStorageBufferOffsetAlignment = WGPULimits.minStorageBufferOffsetAlignment(desc), - maxVertexBuffers = WGPULimits.maxVertexBuffers(desc), - maxBufferSize = WGPULimits.maxBufferSize(desc), - maxVertexAttributes = WGPULimits.maxVertexAttributes(desc), - maxVertexBufferArrayStride = WGPULimits.maxVertexBufferArrayStride(desc), - maxInterStageShaderComponents = WGPULimits.maxInterStageShaderComponents(desc), - maxInterStageShaderVariables = WGPULimits.maxInterStageShaderVariables(desc), - maxColorAttachments = WGPULimits.maxColorAttachments(desc), - maxColorAttachmentBytesPerSample = - WGPULimits.maxColorAttachmentBytesPerSample(desc), - maxComputeWorkgroupStorageSize = WGPULimits.maxComputeWorkgroupStorageSize(desc), - maxComputeInvocationsPerWorkgroup = - WGPULimits.maxComputeInvocationsPerWorkgroup(desc), - maxComputeWorkgroupSizeX = WGPULimits.maxComputeWorkgroupSizeX(desc), - maxComputeWorkgroupSizeY = WGPULimits.maxComputeWorkgroupSizeY(desc), - maxComputeWorkgroupSizeZ = WGPULimits.maxComputeWorkgroupSizeZ(desc), - maxComputeWorkgroupsPerDimension = WGPULimits.maxComputeWorkgroupsPerDimension(desc) - ) - } - } - - actual fun createShaderModule(src: String): ShaderModule { - return Arena.ofConfined().use { scope -> - val desc = WGPUShaderModuleDescriptor.allocate(scope) - val wgsl = WGPUShaderModuleWGSLDescriptor.allocate(scope) - val wgslChain = WGPUShaderModuleWGSLDescriptor.chain(wgsl) - - WGPUChainedStruct.next(wgslChain, WGPU_NULL) - WGPUChainedStruct.sType(wgslChain, WGPUSType_ShaderModuleWGSLDescriptor()) - WGPUShaderModuleWGSLDescriptor.code(wgsl, scope.allocateUtf8String(src)) - WGPUShaderModuleDescriptor.nextInChain(desc, wgslChain) - ShaderModule(wgpuDeviceCreateShaderModule(segment, desc)) - } - } - - actual fun createRenderPipeline(desc: RenderPipelineDescriptor): RenderPipeline { - return Arena.ofConfined().use { scope -> - val fragDesc = - if (desc.fragment != null) { - val fragDesc = WGPUFragmentState.allocate(scope) - WGPUFragmentState.module(fragDesc, desc.fragment.module.segment) - WGPUFragmentState.entryPoint( - fragDesc, - desc.fragment.entryPoint.toNativeString(scope) - ) - - val targets = - WGPUColorTargetState.allocateArray( - desc.fragment.targets.size.toLong(), - scope - ) - desc.fragment.targets.forEach { colorTargetState -> - if (colorTargetState.blendState == null) { - TODO("Null blend states aren't currently supported.") - } - val blendState = WGPUBlendState.allocate(scope) - val colorBlend = WGPUBlendState.color(blendState) - val alphaBlend = WGPUBlendState.alpha(blendState) - WGPUBlendComponent.srcFactor( - colorBlend, - colorTargetState.blendState.color.srcFactor.nativeVal - ) - WGPUBlendComponent.dstFactor( - colorBlend, - colorTargetState.blendState.color.dstFactor.nativeVal - ) - WGPUBlendComponent.operation( - colorBlend, - colorTargetState.blendState.color.operation.nativeVal - ) - WGPUBlendComponent.srcFactor( - alphaBlend, - colorTargetState.blendState.alpha.srcFactor.nativeVal - ) - WGPUBlendComponent.dstFactor( - alphaBlend, - colorTargetState.blendState.alpha.dstFactor.nativeVal - ) - WGPUBlendComponent.operation( - alphaBlend, - colorTargetState.blendState.alpha.operation.nativeVal - ) - - WGPUColorTargetState.format(targets, colorTargetState.format.nativeVal) - WGPUColorTargetState.writeMask( - targets, - colorTargetState.writeMask.usageFlag - ) - WGPUColorTargetState.blend(targets, blendState) - } - WGPUFragmentState.targets(fragDesc, targets) - WGPUFragmentState.targetCount(fragDesc, desc.fragment.targets.size.toLong()) - fragDesc - } else { - WGPU_NULL - } - - val buffers = - desc.vertex.buffers.mapToNativeEntries( - scope, - WGPUVertexBufferLayout.sizeof(), - WGPUVertexBufferLayout::allocateArray - ) { bufferLayout, nativeBufferLayout -> - val attributes = - bufferLayout.attributes.mapToNativeEntries( - scope, - WGPUVertexAttribute.sizeof(), - WGPUVertexAttribute::allocateArray - ) { attribute, nativeAttribute -> - WGPUVertexAttribute.shaderLocation( - nativeAttribute, - attribute.shaderLocation - ) - WGPUVertexAttribute.format(nativeAttribute, attribute.format.nativeVal) - WGPUVertexAttribute.offset(nativeAttribute, attribute.offset) - } - - WGPUVertexBufferLayout.arrayStride(nativeBufferLayout, bufferLayout.arrayStride) - WGPUVertexBufferLayout.stepMode( - nativeBufferLayout, - bufferLayout.stepMode.nativeVal - ) - WGPUVertexBufferLayout.attributeCount( - nativeBufferLayout, - bufferLayout.attributes.size.toLong() - ) - WGPUVertexBufferLayout.attributes(nativeBufferLayout, attributes) - } - - val descriptor = WGPURenderPipelineDescriptor.allocate(scope) - val vertexState = WGPURenderPipelineDescriptor.vertex(descriptor) - val primitiveState = WGPURenderPipelineDescriptor.primitive(descriptor) - val multisampleState = WGPURenderPipelineDescriptor.multisample(descriptor) - - WGPURenderPipelineDescriptor.label( - descriptor, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - WGPURenderPipelineDescriptor.layout(descriptor, desc.layout.segment) - - WGPUVertexState.module(vertexState, desc.vertex.module.segment) - WGPUVertexState.entryPoint(vertexState, desc.vertex.entryPoint.toNativeString(scope)) - WGPUVertexState.buffers(vertexState, buffers) - WGPUVertexState.bufferCount(vertexState, desc.vertex.buffers.size.toLong()) - - WGPUPrimitiveState.topology(primitiveState, desc.primitive.topology.nativeVal) - WGPUPrimitiveState.stripIndexFormat( - primitiveState, - desc.primitive.stripIndexFormat?.nativeVal ?: WGPUIndexFormat_Undefined() - ) - WGPUPrimitiveState.frontFace(primitiveState, desc.primitive.frontFace.nativeVal) - WGPUPrimitiveState.cullMode(primitiveState, desc.primitive.cullMode.nativeVal) - - desc.depthStencil?.let { - val depthStencilState = WGPUDepthStencilState.allocate(scope) - WGPUDepthStencilState.format(depthStencilState, it.format.nativeVal) - WGPUDepthStencilState.depthWriteEnabled( - depthStencilState, - it.depthWriteEnabled.toInt() - ) - WGPUDepthStencilState.depthCompare(depthStencilState, it.depthCompare.nativeVal) - WGPUDepthStencilState.stencilReadMask(depthStencilState, it.stencil.readMask) - WGPUDepthStencilState.stencilWriteMask(depthStencilState, it.stencil.writeMask) - WGPUDepthStencilState.depthBias(depthStencilState, it.bias.constant) - WGPUDepthStencilState.depthBiasSlopeScale(depthStencilState, it.bias.slopeScale) - WGPUDepthStencilState.depthBiasClamp(depthStencilState, it.bias.clamp) - - val stencilFront = WGPUDepthStencilState.stencilFront(depthStencilState) - WGPUStencilFaceState.compare(stencilFront, it.stencil.front.compare.nativeVal) - WGPUStencilFaceState.failOp(stencilFront, it.stencil.front.failOp.nativeVal) - WGPUStencilFaceState.depthFailOp( - stencilFront, - it.stencil.front.depthFailOp.nativeVal - ) - WGPUStencilFaceState.passOp(stencilFront, it.stencil.front.passOp.nativeVal) - - val stencilBack = WGPUDepthStencilState.stencilBack(depthStencilState) - WGPUStencilFaceState.compare(stencilBack, it.stencil.back.compare.nativeVal) - WGPUStencilFaceState.failOp(stencilBack, it.stencil.back.failOp.nativeVal) - WGPUStencilFaceState.depthFailOp(stencilBack, it.stencil.back.depthFailOp.nativeVal) - WGPUStencilFaceState.passOp(stencilBack, it.stencil.back.passOp.nativeVal) - - WGPURenderPipelineDescriptor.depthStencil(descriptor, depthStencilState) - } - - WGPUMultisampleState.count(multisampleState, desc.multisample.count) - WGPUMultisampleState.mask(multisampleState, desc.multisample.mask) - WGPUMultisampleState.alphaToCoverageEnabled( - multisampleState, - desc.multisample.alphaToCoverageEnabled.toInt() - ) - - WGPURenderPipelineDescriptor.fragment(descriptor, fragDesc) - - RenderPipeline(wgpuDeviceCreateRenderPipeline(segment, descriptor)) - } - } - - actual fun createComputePipeline(desc: ComputePipelineDescriptor): ComputePipeline { - return Arena.ofConfined().use { scope -> - val wgpuDesc = WGPUComputePipelineDescriptor.allocate(scope) - - val computeDesc = WGPUProgrammableStageDescriptor.allocate(scope) - WGPUProgrammableStageDescriptor.entryPoint( - computeDesc, - desc.compute.entryPoint.toNativeString(scope) - ) - WGPUProgrammableStageDescriptor.module(computeDesc, desc.compute.module.segment) - - WGPUComputePipelineDescriptor.layout(wgpuDesc, desc.layout.segment) - WGPUComputePipelineDescriptor.compute(wgpuDesc, computeDesc) - WGPUComputePipelineDescriptor.label( - wgpuDesc, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - - ComputePipeline(wgpuDeviceCreateComputePipeline(segment, wgpuDesc)) - } - } - - actual fun createPipelineLayout(desc: PipelineLayoutDescriptor): PipelineLayout { - return Arena.ofConfined().use { scope -> - val wgpuDesc = WGPUPipelineLayoutDescriptor.allocate(scope) - WGPUPipelineLayoutDescriptor.bindGroupLayouts( - wgpuDesc, - desc.segments.toNativeArray(scope) - ) - WGPUPipelineLayoutDescriptor.bindGroupLayoutCount(wgpuDesc, desc.segments.size.toLong()) - WGPUPipelineLayoutDescriptor.label( - wgpuDesc, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - PipelineLayout(wgpuDeviceCreatePipelineLayout(segment, wgpuDesc)) - } - } - - actual fun createCommandEncoder(label: String?): CommandEncoder { - return Arena.ofConfined().use { scope -> - val descriptor = WGPUCommandEncoderDescriptor.allocate(scope) - WGPUCommandEncoderDescriptor.label( - descriptor, - label?.toNativeString(scope) ?: WGPU_NULL - ) - CommandEncoder(wgpuDeviceCreateCommandEncoder(segment, descriptor)) - } - } - - actual fun createBuffer(desc: BufferDescriptor): GPUBuffer { - return Arena.ofConfined().use { scope -> - val descriptor = WGPUBufferDescriptor.allocate(scope) - WGPUBufferDescriptor.nextInChain(descriptor, WGPU_NULL) - WGPUBufferDescriptor.usage(descriptor, desc.usage.usageFlag) - WGPUBufferDescriptor.size(descriptor, desc.size) - WGPUBufferDescriptor.mappedAtCreation(descriptor, desc.mappedAtCreation.toInt()) - WGPUBufferDescriptor.label(descriptor, desc.label.toNativeString(scope)) - GPUBuffer(wgpuDeviceCreateBuffer(segment, descriptor).asSlice(0, desc.size), desc.size) - } - } - - actual fun createBindGroupLayout(desc: BindGroupLayoutDescriptor): BindGroupLayout { - return Arena.ofConfined().use { scope -> - val descriptor = WGPUBindGroupLayoutDescriptor.allocate(scope) - WGPUBindGroupLayoutDescriptor.label( - descriptor, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - val entries = - desc.entries.mapToNativeEntries( - scope, - WGPUBindGroupLayoutEntry.sizeof(), - WGPUBindGroupLayoutEntry::allocateArray - ) { entry, nativeEntry -> - WGPUBindGroupLayoutEntry.binding(nativeEntry, entry.binding) - WGPUBindGroupLayoutEntry.visibility(nativeEntry, entry.visibility.usageFlag) - - val bufferBinding = WGPUBindGroupLayoutEntry.buffer(nativeEntry) - val samplerBinding = WGPUBindGroupLayoutEntry.sampler(nativeEntry) - val textureBinding = WGPUBindGroupLayoutEntry.texture(nativeEntry) - val storageTextureBinding = WGPUBindGroupLayoutEntry.storageTexture(nativeEntry) - - WGPUBufferBindingLayout.type(bufferBinding, WGPUBufferBindingType_Undefined()) - WGPUSamplerBindingLayout.type( - samplerBinding, - WGPUSamplerBindingType_Undefined() - ) - WGPUTextureBindingLayout.sampleType( - textureBinding, - WGPUTextureSampleType_Undefined() - ) - WGPUStorageTextureBindingLayout.access( - storageTextureBinding, - WGPUStorageTextureAccess_Undefined() - ) - - entry.bindingLayout.intoNative( - bufferBinding, - samplerBinding, - textureBinding, - storageTextureBinding - ) - } - WGPUBindGroupLayoutDescriptor.entries(descriptor, entries) - WGPUBindGroupLayoutDescriptor.entryCount(descriptor, desc.entries.size.toLong()) - BindGroupLayout(wgpuDeviceCreateBindGroupLayout(segment, descriptor)) - } - } - - actual fun createBindGroup(desc: BindGroupDescriptor): BindGroup { - return Arena.ofConfined().use { scope -> - val descriptor = WGPUBindGroupDescriptor.allocate(scope) - val entries = - desc.entries.mapToNativeEntries( - scope, - WGPUBindGroupEntry.sizeof(), - WGPUBindGroupEntry::allocateArray - ) { entry, nativeEntry -> - WGPUBindGroupEntry.binding(nativeEntry, entry.binding) - entry.resource.intoBindingResource(nativeEntry) - } - WGPUBindGroupDescriptor.label( - descriptor, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - WGPUBindGroupDescriptor.layout(descriptor, desc.layout.segment) - WGPUBindGroupDescriptor.entries(descriptor, entries) - WGPUBindGroupDescriptor.entryCount(descriptor, desc.entries.size.toLong()) - BindGroup(wgpuDeviceCreateBindGroup(segment, descriptor)) - } - } - - actual fun createSampler(desc: SamplerDescriptor): Sampler { - return Arena.ofConfined().use { scope -> - val descriptor = WGPUSamplerDescriptor.allocate(scope) - - WGPUSamplerDescriptor.label(descriptor, desc.label?.toNativeString(scope) ?: WGPU_NULL) - WGPUSamplerDescriptor.addressModeU(descriptor, desc.addressModeU.nativeVal) - WGPUSamplerDescriptor.addressModeV(descriptor, desc.addressModeV.nativeVal) - WGPUSamplerDescriptor.addressModeW(descriptor, desc.addressModeW.nativeVal) - WGPUSamplerDescriptor.magFilter(descriptor, desc.magFilter.nativeVal) - WGPUSamplerDescriptor.minFilter(descriptor, desc.minFilter.nativeVal) - WGPUSamplerDescriptor.mipmapFilter(descriptor, desc.mipmapFilter.nativeVal) - WGPUSamplerDescriptor.lodMinClamp(descriptor, desc.lodMinClamp) - WGPUSamplerDescriptor.lodMaxClamp(descriptor, desc.lodMaxClamp) - WGPUSamplerDescriptor.compare( - descriptor, - desc.compare?.nativeVal ?: WGPUCompareFunction_Undefined() - ) - WGPUSamplerDescriptor.maxAnisotropy(descriptor, desc.maxAnisotropy) - - Sampler(wgpuDeviceCreateSampler(segment, descriptor)) - } - } - - actual fun createTexture(desc: TextureDescriptor): WebGPUTexture { - return Arena.ofConfined().use { scope -> - val descriptor = WGPUTextureDescriptor.allocate(scope) - val size = WGPUTextureDescriptor.size(descriptor) - - WGPUTextureDescriptor.label(descriptor, desc.label?.toNativeString(scope) ?: WGPU_NULL) - WGPUTextureDescriptor.usage(descriptor, desc.usage.usageFlag) - WGPUTextureDescriptor.dimension(descriptor, desc.dimension.nativeVal) - WGPUTextureDescriptor.format(descriptor, desc.format.nativeVal) - WGPUTextureDescriptor.mipLevelCount(descriptor, desc.mipLevelCount) - WGPUTextureDescriptor.sampleCount(descriptor, desc.sampleCount) - WGPUExtent3D.width(size, desc.size.width) - WGPUExtent3D.height(size, desc.size.height) - WGPUExtent3D.depthOrArrayLayers(size, desc.size.depth) - - val textureSize = - (desc.size.width * desc.size.height * desc.size.depth * desc.format.bytes).toLong() - WebGPUTexture(wgpuDeviceCreateTexture(segment, descriptor), textureSize) - } - } - - actual fun createGPUShortBuffer( - label: String, - data: ShortArray, - usage: BufferUsage - ): GPUBuffer { - val buffer = - createBuffer( - BufferDescriptor(label, data.size.toLong() * Short.SIZE_BYTES, usage, true) - ) - buffer.getMappedRange().putShort(data) - buffer.unmap() - - return buffer - } - - actual fun createGPUFloatBuffer( - label: String, - data: FloatArray, - usage: BufferUsage - ): GPUBuffer { - val buffer = - createBuffer( - BufferDescriptor(label, data.size.toLong() * Float.SIZE_BYTES, usage, true) - ) - buffer.getMappedRange().putFloat(data) - buffer.unmap() - - return buffer - } - - actual fun createGPUIntBuffer(label: String, data: IntArray, usage: BufferUsage): GPUBuffer { - val buffer = - createBuffer(BufferDescriptor(label, data.size.toLong() * Int.SIZE_BYTES, usage, true)) - buffer.getMappedRange().putInt(data) - buffer.unmap() - - return buffer - } - - actual fun createGPUByteBuffer(label: String, data: ByteArray, usage: BufferUsage): GPUBuffer { - val buffer = createBuffer(BufferDescriptor(label, data.size.toLong(), usage, true)) - buffer.getMappedRange().putByte(data) - buffer.unmap() - - return buffer - } - - actual override fun release() { - wgpuDeviceRelease(segment) - } - - override fun toString(): String { - return "Device" - } -} - -actual class Adapter(var segment: MemorySegment) : Releasable { - /** The features which can be used to create devices on this adapter. */ - actual val features: List by lazy { - val list = mutableListOf() - Feature.entries.forEach { - val result = wgpuAdapterHasFeature(segment, it.nativeVal) - if (result == 1) { - list += it - } - } - list.toList() - } - - /** - * The best limits which can be used to create devices on this adapter. Each adapter limit must - * be the same or better than its default value in supported limits. - */ - actual val limits: Limits by lazy { - Arena.ofConfined().use { scope -> - val supported = WGPUSupportedLimits.allocate(scope) - wgpuAdapterGetLimits(segment, supported) - val desc = WGPUSupportedLimits.limits(supported) - - Limits( - maxTextureDimension1D = WGPULimits.maxTextureDimension1D(desc), - maxTextureDimension2D = WGPULimits.maxTextureDimension2D(desc), - maxTextureDimension3D = WGPULimits.maxTextureDimension3D(desc), - maxTextureArrayLayers = WGPULimits.maxTextureArrayLayers(desc), - maxBindGroups = WGPULimits.maxBindGroups(desc), - maxBindGroupsPlusVertexBuffers = WGPULimits.maxBindGroupsPlusVertexBuffers(desc), - maxBindingsPerBindGroup = WGPULimits.maxBindingsPerBindGroup(desc), - maxDynamicUniformBuffersPerPipelineLayout = - WGPULimits.maxDynamicUniformBuffersPerPipelineLayout(desc), - maxDynamicStorageBuffersPerPipelineLayout = - WGPULimits.maxDynamicStorageBuffersPerPipelineLayout(desc), - maxSampledTexturesPerShaderStage = - WGPULimits.maxSampledTexturesPerShaderStage(desc), - maxSamplersPerShaderStage = WGPULimits.maxSamplersPerShaderStage(desc), - maxStorageBuffersPerShaderStage = WGPULimits.maxStorageBuffersPerShaderStage(desc), - maxStorageTexturesPerShaderStage = - WGPULimits.maxStorageTexturesPerShaderStage(desc), - maxUniformBuffersPerShaderStage = WGPULimits.maxUniformBuffersPerShaderStage(desc), - maxUniformBufferBindingSize = WGPULimits.maxUniformBufferBindingSize(desc), - maxStorageBufferBindingSize = WGPULimits.maxStorageBufferBindingSize(desc), - minUniformBufferOffsetAlignment = WGPULimits.minUniformBufferOffsetAlignment(desc), - minStorageBufferOffsetAlignment = WGPULimits.minStorageBufferOffsetAlignment(desc), - maxVertexBuffers = WGPULimits.maxVertexBuffers(desc), - maxBufferSize = WGPULimits.maxBufferSize(desc), - maxVertexAttributes = WGPULimits.maxVertexAttributes(desc), - maxVertexBufferArrayStride = WGPULimits.maxVertexBufferArrayStride(desc), - maxInterStageShaderComponents = WGPULimits.maxInterStageShaderComponents(desc), - maxInterStageShaderVariables = WGPULimits.maxInterStageShaderVariables(desc), - maxColorAttachments = WGPULimits.maxColorAttachments(desc), - maxColorAttachmentBytesPerSample = - WGPULimits.maxColorAttachmentBytesPerSample(desc), - maxComputeWorkgroupStorageSize = WGPULimits.maxComputeWorkgroupStorageSize(desc), - maxComputeInvocationsPerWorkgroup = - WGPULimits.maxComputeInvocationsPerWorkgroup(desc), - maxComputeWorkgroupSizeX = WGPULimits.maxComputeWorkgroupSizeX(desc), - maxComputeWorkgroupSizeY = WGPULimits.maxComputeWorkgroupSizeY(desc), - maxComputeWorkgroupSizeZ = WGPULimits.maxComputeWorkgroupSizeZ(desc), - maxComputeWorkgroupsPerDimension = - WGPULimits.maxComputeWorkgroupsPerDimension(desc), - ) - } - } - - actual suspend fun requestDevice(descriptor: DeviceDescriptor?): Device { - val output = atomic(WGPU_NULL) - Arena.ofConfined().use { scope -> - val desc = WGPUDeviceDescriptor.allocate(scope) - val deviceExtras = WGPUDeviceExtras.allocate(scope) - val chainedStruct = WGPUDeviceExtras.chain(deviceExtras) - val callback = - WGPURequestDeviceCallback.allocate( - { status, device, message, _ -> - if (status == WGPURequestAdapterStatus_Success()) { - output.update { device } - } else { - logger.log(Logger.Level.ERROR) { - "requestDevice status=$status, message=${message.getUtf8String(0)}" - } - } - }, - scope - ) - - WGPUChainedStruct.sType(chainedStruct, WGPUSType_DeviceExtras()) - WGPUDeviceDescriptor.nextInChain(desc, deviceExtras) - if (descriptor != null) { - descriptor.label?.let { WGPUDeviceDescriptor.label(desc, it.toNativeString(scope)) } - descriptor.requiredFeatures?.let { - val nativeArray = scope.allocateArray(ValueLayout.JAVA_INT, it.size.toLong()) - it.forEachIndexed { index, jvmEntry -> - val nativeEntry = nativeArray.asSlice((Int.SIZE_BYTES * index).toLong()) - - nativeEntry.set(ValueLayout.JAVA_INT, 0L, jvmEntry.nativeVal) - } - WGPUDeviceDescriptor.requiredFeatureCount(desc, it.size.toLong()) - WGPUDeviceDescriptor.requiredFeatures(desc, nativeArray) - } - descriptor.requiredLimits?.let { requiredLimits -> - val nativeLimits = WGPULimits.allocate(scope) - requiredLimits.maxTextureDimension1D?.let { - WGPULimits.maxTextureDimension1D(nativeLimits, it) - } - requiredLimits.maxTextureDimension2D?.let { - WGPULimits.maxTextureDimension2D(nativeLimits, it) - } - requiredLimits.maxTextureDimension3D?.let { - WGPULimits.maxTextureDimension3D(nativeLimits, it) - } - requiredLimits.maxTextureArrayLayers?.let { - WGPULimits.maxTextureArrayLayers(nativeLimits, it) - } - requiredLimits.maxBindGroups?.let { WGPULimits.maxBindGroups(nativeLimits, it) } - requiredLimits.maxBindGroupsPlusVertexBuffers?.let { - WGPULimits.maxBindGroupsPlusVertexBuffers(nativeLimits, it) - } - requiredLimits.maxBindingsPerBindGroup?.let { - WGPULimits.maxBindingsPerBindGroup(nativeLimits, it) - } - requiredLimits.maxDynamicUniformBuffersPerPipelineLayout?.let { - WGPULimits.maxDynamicUniformBuffersPerPipelineLayout(nativeLimits, it) - } - requiredLimits.maxDynamicStorageBuffersPerPipelineLayout?.let { - WGPULimits.maxDynamicStorageBuffersPerPipelineLayout(nativeLimits, it) - } - requiredLimits.maxSampledTexturesPerShaderStage?.let { - WGPULimits.maxSampledTexturesPerShaderStage(nativeLimits, it) - } - requiredLimits.maxSamplersPerShaderStage?.let { - WGPULimits.maxSamplersPerShaderStage(nativeLimits, it) - } - requiredLimits.maxStorageBuffersPerShaderStage?.let { - WGPULimits.maxStorageBuffersPerShaderStage(nativeLimits, it) - } - requiredLimits.maxStorageTexturesPerShaderStage?.let { - WGPULimits.maxStorageTexturesPerShaderStage(nativeLimits, it) - } - requiredLimits.maxUniformBuffersPerShaderStage?.let { - WGPULimits.maxUniformBuffersPerShaderStage(nativeLimits, it) - } - requiredLimits.maxUniformBufferBindingSize?.let { - WGPULimits.maxUniformBufferBindingSize(nativeLimits, it) - } - requiredLimits.maxStorageBufferBindingSize?.let { - WGPULimits.maxStorageBufferBindingSize(nativeLimits, it) - } - requiredLimits.minUniformBufferOffsetAlignment?.let { - WGPULimits.minUniformBufferOffsetAlignment(nativeLimits, it) - } - requiredLimits.minStorageBufferOffsetAlignment?.let { - WGPULimits.minStorageBufferOffsetAlignment(nativeLimits, it) - } - requiredLimits.maxVertexBuffers?.let { - WGPULimits.maxVertexBuffers(nativeLimits, it) - } - requiredLimits.maxBufferSize?.let { WGPULimits.maxBufferSize(nativeLimits, it) } - requiredLimits.maxVertexAttributes?.let { - WGPULimits.maxVertexAttributes(nativeLimits, it) - } - requiredLimits.maxVertexBufferArrayStride?.let { - WGPULimits.maxVertexBufferArrayStride(nativeLimits, it) - } - val nativeRequiredLimits = WGPURequiredLimits.allocate(scope) - WGPURequiredLimits.limits(nativeRequiredLimits, nativeLimits) - } - } - - wgpuAdapterRequestDevice(segment, desc, callback, WGPU_NULL) - } - return Device(output.value) - } - - actual override fun release() { - wgpuAdapterRelease(segment) - } - - override fun toString(): String { - return "Adapter" - } - - companion object { - private val logger = Logger() - } -} - -actual class Queue(val segment: MemorySegment) : Releasable { - - actual fun submit(vararg cmdBuffers: CommandBuffer) { - Arena.ofConfined().use { scope -> - wgpuQueueSubmit( - segment, - cmdBuffers.size.toLong(), - cmdBuffers.map { it.segment }.toNativeArray(scope) - ) - } - } - - actual fun writeTexture( - data: ByteBuffer, - destination: TextureCopyView, - layout: TextureDataLayout, - copySize: Extent3D, - size: Long, - ) { - data as ByteBufferImpl - Arena.ofConfined().use { scope -> - wgpuQueueWriteTexture( - segment, - destination.toNative(scope), - data.segment, - size, - layout.toNative(scope), - copySize.toNative(scope) - ) - } - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: ShortBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as ShortBufferImpl - wgpuQueueWriteBuffer( - segment, - buffer.segment, - offset, - if (dataOffset > 0) data.segment.asSlice(dataOffset) else data.segment, - size * Short.SIZE_BYTES - ) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: IntBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as IntBufferImpl - wgpuQueueWriteBuffer( - segment, - buffer.segment, - offset, - if (dataOffset > 0) data.segment.asSlice(dataOffset) else data.segment, - size * Int.SIZE_BYTES - ) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: FloatBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as FloatBufferImpl - wgpuQueueWriteBuffer( - segment, - buffer.segment, - offset, - if (dataOffset > 0) data.segment.asSlice(dataOffset) else data.segment, - size * Float.SIZE_BYTES - ) - } - - actual fun writeBuffer( - buffer: GPUBuffer, - data: ByteBuffer, - offset: Long, - dataOffset: Long, - size: Long - ) { - data as ByteBufferImpl - wgpuQueueWriteBuffer( - segment, - buffer.segment, - offset, - if (dataOffset > 0) data.segment.asSlice(dataOffset) else data.segment, - size - ) - } - - actual fun writeTexture( - data: ByteArray, - destination: TextureCopyView, - layout: TextureDataLayout, - copySize: Extent3D, - size: Long - ) { - Arena.ofConfined().use { scope -> - wgpuQueueWriteTexture( - segment, - destination.toNative(scope), - scope.allocateArray(ValueLayout.JAVA_BYTE, *data), - size, - layout.toNative(scope), - copySize.toNative(scope) - ) - } - } - - actual override fun release() { - wgpuQueueRelease(segment) - } - - override fun toString(): String { - return "Queue" - } -} - -actual class ShaderModule(val segment: MemorySegment) : Releasable { - actual override fun release() { - wgpuShaderModuleRelease(segment) - } - - override fun toString(): String { - return "ShaderModule" - } -} - -actual class Surface(val segment: MemorySegment) : Releasable { - - actual fun configure(configuration: SurfaceConfiguration) { - Arena.ofConfined().use { scope -> - val desc = WGPUSurfaceConfiguration.allocate(scope) - WGPUSurfaceConfiguration.device(desc, configuration.device.segment) - WGPUSurfaceConfiguration.usage(desc, configuration.usage.usageFlag) - WGPUSurfaceConfiguration.format(desc, configuration.format.nativeVal) - WGPUSurfaceConfiguration.presentMode(desc, configuration.presentMode.nativeVal) - WGPUSurfaceConfiguration.alphaMode(desc, configuration.alphaMode.nativeVal) - WGPUSurfaceConfiguration.width(desc, configuration.width) - WGPUSurfaceConfiguration.height(desc, configuration.height) - wgpuSurfaceConfigure(segment, desc) - } - } - - actual fun getCurrentTexture(): SurfaceTexture { - val surfaceTexture: MemorySegment = WGPUSurfaceTexture.allocate(Arena.ofConfined()) - wgpuSurfaceGetCurrentTexture(segment, surfaceTexture) - val texture = - WGPUSurfaceTexture.texture(surfaceTexture).let { - if (it == WGPU_NULL) null else WebGPUTexture(it, it.byteSize()) - } - val status = - WGPUSurfaceTexture.status(surfaceTexture).let { - TextureStatus.from(it) ?: error("Invalid texture status: $it") - } - return SurfaceTexture(surfaceTexture, texture, status) - } - - actual fun present() { - wgpuSurfacePresent(segment) - } - - actual fun getCapabilities(adapter: Adapter): SurfaceCapabilities { - return Arena.ofConfined().use { scope -> - val surfaceCapabilities = WGPUSurfaceCapabilities.allocate(scope) - wgpuSurfaceGetCapabilities(segment, adapter.segment, surfaceCapabilities) - val formats = - WGPUSurfaceCapabilities.formats(surfaceCapabilities).mapFromIntUntilNull { - TextureFormat.from(it) - } - val alphaModes = - WGPUSurfaceCapabilities.alphaModes(surfaceCapabilities).mapFromIntUntilNull { - AlphaMode.from(it) - } - SurfaceCapabilities(surfaceCapabilities, formats, alphaModes) - } - } - - actual fun getPreferredFormat(adapter: Adapter): TextureFormat { - return wgpuSurfaceGetPreferredFormat(segment, adapter.segment).let { - TextureFormat.from(it) ?: error("Invalid TextureFormat: $") - } - } - - actual override fun release() { - wgpuSurfaceRelease(segment) - } -} - -actual class WebGPUTexture(val segment: MemorySegment, val size: Long) : Releasable { - - private val info = TextureResourceInfo(this, size) - - actual fun createView(desc: TextureViewDescriptor?): TextureView { - val descSeg = - if (desc != null) { - Arena.ofConfined().use { scope -> - WGPUTextureViewDescriptor.allocate(scope).also { - WGPUTextureViewDescriptor.label( - it, - desc.label?.toNativeString(scope) ?: WGPU_NULL - ) - WGPUTextureViewDescriptor.format(it, desc.format.nativeVal) - WGPUTextureViewDescriptor.dimension(it, desc.dimension.nativeVal) - WGPUTextureViewDescriptor.aspect(it, desc.aspect.nativeVal) - WGPUTextureViewDescriptor.baseMipLevel(it, desc.baseMipLevel) - WGPUTextureViewDescriptor.mipLevelCount(it, desc.mipLevelCount) - WGPUTextureViewDescriptor.baseArrayLayer(it, desc.baseArrayLayer) - WGPUTextureViewDescriptor.arrayLayerCount(it, desc.arrayLayerCount) - } - } - } else { - WGPU_NULL - } - return TextureView(wgpuTextureCreateView(segment, descSeg)) - } - - actual override fun release() { - wgpuTextureRelease(segment) - info.delete() - } - - actual fun destroy() { - wgpuTextureDestroy(segment) - info.delete() - } -} - -actual class TextureView(val segment: MemorySegment) : IntoBindingResource { - - override fun intoBindingResource(entry: MemorySegment) { - WGPUBindGroupEntry.textureView(entry, segment) - } - - actual fun release() { - wgpuTextureViewRelease(segment) - } -} - -actual class GPUBuffer(val segment: MemorySegment, actual val size: Long) : Releasable { - - private val info = BufferResourceInfo(this, size) - - actual fun getMappedRange(offset: Long, size: Long): ByteBuffer { - val mappedRange = wgpuBufferGetMappedRange(segment, offset, size).asSlice(offset, size) - return ByteBufferImpl(mappedRange.byteSize().toInt(), segment = mappedRange) - } - - actual fun getMappedRange(): ByteBuffer = getMappedRange(0, size) - - actual fun unmap() { - wgpuBufferUnmap(segment) - } - - actual override fun release() { - wgpuBufferRelease(segment) - } - - actual fun destroy() { - wgpuBufferDestroy(segment) - info.delete() - } -} - -actual class Sampler(val segment: MemorySegment) : IntoBindingResource, Releasable { - - override fun intoBindingResource(entry: MemorySegment) { - WGPUBindGroupEntry.sampler(entry, segment) - } - - actual override fun release() { - wgpuSamplerRelease(segment) - } -} - -fun Extent3D.toNative(scope: SegmentAllocator): MemorySegment { - val native = WGPUExtent3D.allocate(scope) - - WGPUExtent3D.width(native, width) - WGPUExtent3D.height(native, height) - WGPUExtent3D.depthOrArrayLayers(native, depth) - - return native -} - -actual class SurfaceCapabilities( - val segment: MemorySegment, - actual val formats: List, - actual val alphaModes: List -) {} - -actual class SurfaceTexture( - val segment: MemorySegment, - actual val texture: WebGPUTexture?, - actual val status: TextureStatus -) diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 2dd2da208..9a0c401a7 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -1,14 +1,18 @@ import org.apache.tools.ant.taskdefs.condition.Os +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType plugins { alias(libs.plugins.kotlin.multiplatform) } -repositories { maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") } - kotlin { - tasks.withType { jvmArgs("--enable-preview", "--enable-native-access=ALL-UNNAMED") } + tasks.withType { jvmArgs("--enable-native-access=ALL-UNNAMED") } jvm { - compilations.all { kotlinOptions.jvmTarget = "21" } + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + jvmTarget = JvmTarget.JVM_22 + } + compilations { val main by getting val mainClassName = "com.littlekt.examples.JvmRunnerKt" @@ -40,7 +44,11 @@ kotlin { } if (Os.isFamily(Os.FAMILY_MAC)) { register("jvmRun") { - jvmArgs("-XstartOnFirstThread") + jvmArgs( + "-XstartOnFirstThread", + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--enable-native-access=ALL-UNNAMED" + ) mainClass.set(mainClassName) kotlin { val mainCompile = targets["jvm"].compilations["main"] @@ -63,8 +71,8 @@ kotlin { commonWebpackConfig { devServer = (devServer - ?: org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig - .DevServer()) + ?: org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig + .DevServer()) .copy( open = mapOf("app" to mapOf("name" to "chrome")), ) diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/AssetProviderExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/AssetProviderExample.kt index 60f5512a9..efb92aefa 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/AssetProviderExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/AssetProviderExample.kt @@ -10,9 +10,14 @@ import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.g2d.font.BitmapFont import com.littlekt.graphics.g2d.tilemap.ldtk.LDtkWorld import com.littlekt.graphics.g2d.use -import com.littlekt.graphics.webgpu.* import com.littlekt.resources.Fonts import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * @author Colton Daily @@ -31,14 +36,13 @@ class AssetProviderExample(context: Context) : ContextListener(context) { val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -48,10 +52,10 @@ class AssetProviderExample(context: Context) : ContextListener(context) { onResize { width, height -> viewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -65,13 +69,13 @@ class AssetProviderExample(context: Context) : ContextListener(context) { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -88,16 +92,13 @@ class AssetProviderExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -115,14 +116,13 @@ class AssetProviderExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { batch.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/ComputeBoidsExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/ComputeBoidsExample.kt index 15d7416ee..015bb6882 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/ComputeBoidsExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/ComputeBoidsExample.kt @@ -5,7 +5,32 @@ import com.littlekt.ContextListener import com.littlekt.file.FloatBuffer import com.littlekt.graphics.* import com.littlekt.graphics.shader.Shader -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.BindGroupEntry +import io.ygdrasil.wgpu.BindGroupDescriptor.BufferBinding +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.BufferBindingLayout +import io.ygdrasil.wgpu.BufferBindingType +import io.ygdrasil.wgpu.BufferDescriptor +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.CommandEncoderDescriptor +import io.ygdrasil.wgpu.ComputePipelineDescriptor +import io.ygdrasil.wgpu.ComputePipelineDescriptor.ProgrammableStage +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.VertexFormat +import io.ygdrasil.wgpu.VertexStepMode import kotlin.math.ceil import kotlin.random.Random @@ -22,92 +47,93 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { addCloseOnEsc() val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val spriteShader = Shader(device, SPRITE_WGSL_SRC, emptyList()) val renderPipeline = device.createRenderPipeline( - desc = RenderPipelineDescriptor( layout = spriteShader.pipelineLayout, vertex = - VertexState( - module = spriteShader.shaderModule, - entryPoint = spriteShader.vertexEntryPoint, - buffers = + VertexState( + module = spriteShader.shaderModule, + entryPoint = spriteShader.vertexEntryPoint, + buffers = + listOf( + VertexBufferLayoutView( + arrayStride = 4 * 4, + stepMode = VertexStepMode.instance, + attributes = listOf( - VertexBufferLayout( - arrayStride = 4 * 4, - stepMode = VertexStepMode.INSTANCE, - attributes = - listOf( - VertexAttribute( - format = VertexFormat.FLOAT32x2, - offset = 0L, - shaderLocation = 0, - usage = VertexAttrUsage.POSITION - ), - VertexAttribute( - format = VertexFormat.FLOAT32x2, - offset = - VertexFormat.FLOAT32x2.bytes - .toLong(), - shaderLocation = 1, - usage = VertexAttrUsage.GENERIC - ), - ) - ) - .gpuVertexBufferLayout, - VertexBufferLayout( - arrayStride = 2 * 4, - stepMode = VertexStepMode.VERTEX, - attributes = - listOf( - VertexAttribute( - format = VertexFormat.FLOAT32x2, - offset = 0, - shaderLocation = 2, - usage = VertexAttrUsage.GENERIC - ), - ) - ) - .gpuVertexBufferLayout + VertexAttributeView( + format = VertexFormat.float32x2, + offset = 0L, + shaderLocation = 0, + usage = VertexAttrUsage.POSITION + ), + VertexAttributeView( + format = VertexFormat.float32x2, + offset = + VertexFormat.float32x2.sizeInByte + .toLong(), + shaderLocation = 1, + usage = VertexAttrUsage.GENERIC + ), ) - ), - fragment = - FragmentState( - module = spriteShader.shaderModule, - entryPoint = spriteShader.fragmentEntryPoint, - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.NonPreMultiplied, - writeMask = ColorWriteMask.ALL + ) + .gpuVertexBufferLayout, + VertexBufferLayoutView( + arrayStride = 2 * 4, + stepMode = VertexStepMode.vertex, + attributes = + listOf( + VertexAttributeView( + format = VertexFormat.float32x2, + offset = 0, + shaderLocation = 2, + usage = VertexAttrUsage.GENERIC + ), ) + ) + .gpuVertexBufferLayout ) + ), + fragment = + RenderPipelineDescriptor.FragmentState( + module = spriteShader.shaderModule, + entryPoint = spriteShader.fragmentEntryPoint, + targets = listOf( + RenderPipelineDescriptor.FragmentState.ColorTargetState( + format = preferredFormat, + blend = BlendStates.NonPreMultiplied, + writeMask = ColorWriteMask.all + ) + ) + ) ) ) val computeBindGroupLayoutDesc = BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.COMPUTE, BufferBindingLayout()), - BindGroupLayoutEntry( + Entry(0, setOf(ShaderStage.compute), + BufferBindingLayout() + ), + Entry( 1, - ShaderStage.COMPUTE, - BufferBindingLayout(BufferBindingType.READ_ONLY_STORAGE) + setOf(ShaderStage.compute), + BufferBindingLayout(BufferBindingType.readonlystorage) ), - BindGroupLayoutEntry( + Entry( 2, - ShaderStage.COMPUTE, - BufferBindingLayout(BufferBindingType.STORAGE) + setOf(ShaderStage.compute), + BufferBindingLayout(BufferBindingType.storage) ) ), "compute bind group" @@ -116,16 +142,16 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { device.createBindGroupLayout( BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.COMPUTE, BufferBindingLayout()), - BindGroupLayoutEntry( + Entry(0, setOf(ShaderStage.compute), BufferBindingLayout()), + Entry( 1, - ShaderStage.COMPUTE, - BufferBindingLayout(BufferBindingType.READ_ONLY_STORAGE) + setOf(ShaderStage.compute), + BufferBindingLayout(BufferBindingType.readonlystorage) ), - BindGroupLayoutEntry( + Entry( 2, - ShaderStage.COMPUTE, - BufferBindingLayout(BufferBindingType.STORAGE) + setOf(ShaderStage.compute), + BufferBindingLayout(BufferBindingType.storage) ) ), "compute bind group" @@ -133,18 +159,17 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { ) val computePipelineLayout = device.createPipelineLayout( - PipelineLayoutDescriptor(computeBindGroupLayout, "compute pipeline layout") + PipelineLayoutDescriptor(listOf(computeBindGroupLayout), "compute pipeline layout") ) val computePipeline = device.createComputePipeline( - desc = ComputePipelineDescriptor( layout = computePipelineLayout, compute = - ProgrammableStage( - module = device.createShaderModule(UPDATE_SPRITES_WGSL_SRC), - entryPoint = "main" - ) + ProgrammableStage( + module = device.createShaderModule(ShaderModuleDescriptor(UPDATE_SPRITES_WGSL_SRC)), + entryPoint = "main" + ) ) ) @@ -153,7 +178,7 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { device.createGPUFloatBuffer( "sprite vertex buffer", vertexBufferData, - BufferUsage.VERTEX + setOf( BufferUsage.vertex) ) val simParams = SimParams( @@ -170,10 +195,10 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { val simParamBuffer = device.createBuffer( BufferDescriptor( - "sim param buffer", - simParamBufferSize, - BufferUsage.UNIFORM or BufferUsage.COPY_DST, - false + label = "sim param buffer", + size = simParamBufferSize, + usage = setOf(BufferUsage.uniform, BufferUsage.copydst), + mappedAtCreation = false ) ) val simParamBufferData = FloatBuffer(7) @@ -188,7 +213,7 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { simParams.rule3Scale ) ) - device.queue.writeBuffer(simParamBuffer, simParamBufferData) + device.queue.writeBuffer(simParamBuffer, 0L, simParamBufferData.toArray()) val numParticles = 1500 val initialParticleData = FloatArray(numParticles * 4) @@ -204,7 +229,7 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { device.createGPUFloatBuffer( "particle buffer $it", initialParticleData, - BufferUsage.VERTEX or BufferUsage.STORAGE + setOf(BufferUsage.vertex, BufferUsage.storage) ) } @@ -234,10 +259,10 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { onResize { width, height -> graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -245,13 +270,13 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { onUpdate { dt -> val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -265,17 +290,15 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() - val commandEncoder = device.createCommandEncoder("scenegraph command encoder") + val commandEncoder = device.createCommandEncoder(CommandEncoderDescriptor("scenegraph command encoder")) val renderPassDescriptor = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ), label = "Init render pass" @@ -287,7 +310,7 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { passEncoder.setBindGroup(0, particleBindGroups[fidx % 2]) passEncoder.dispatchWorkgroups(ceil(numParticles / 64f).toInt()) passEncoder.end() - passEncoder.release() + passEncoder.close() } run renderPass@{ @@ -297,20 +320,19 @@ class ComputeBoidsExample(context: Context) : ContextListener(context) { passEncoder.setVertexBuffer(1, spriteVertexBuffer) passEncoder.draw(3, numParticles, 0, 0) passEncoder.end() - passEncoder.release() } val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() fidx++ - commandBuffer.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease {} diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/FontExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/FontExample.kt index 85a83b846..819839ca5 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/FontExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/FontExample.kt @@ -7,9 +7,14 @@ import com.littlekt.graphics.Color import com.littlekt.graphics.HAlign import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.g2d.use -import com.littlekt.graphics.webgpu.* import com.littlekt.resources.Fonts import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * @author Colton Daily @@ -23,14 +28,13 @@ class FontExample(context: Context) : ContextListener(context) { val arialFont = resourcesVfs["arial_32.fnt"].readBitmapFont() val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -40,10 +44,10 @@ class FontExample(context: Context) : ContextListener(context) { onResize { width, height -> viewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -51,13 +55,13 @@ class FontExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -74,16 +78,13 @@ class FontExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -100,14 +101,13 @@ class FontExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { batch.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/GameWorldAndUIViewports.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/GameWorldAndUIViewports.kt index 3213ac010..71944e813 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/GameWorldAndUIViewports.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/GameWorldAndUIViewports.kt @@ -7,8 +7,14 @@ import com.littlekt.graph.node.ui.centerContainer import com.littlekt.graph.node.ui.label import com.littlekt.graph.sceneGraph import com.littlekt.graphics.g2d.SpriteBatch -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.CommandEncoderDescriptor +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example using a render pass for the game world and a render pass for the UI. @@ -27,23 +33,20 @@ class GameWorldAndUIViewports(context: Context) : ContextListener(context) { // we can load additional levels by doing: // mapLoader.loadLevel(levelIdx) val world = mapLoader.loadMap(0, translateMapHeight = false) - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat, size = 400) val worldViewport = ExtendViewport(270, 135) val worldCamera = worldViewport.camera addWASDMovement(worldCamera, 0.05f) - val bgColor = - if (preferredFormat.srgb) world.defaultLevelBackgroundColor.toLinear() - else world.defaultLevelBackgroundColor + val bgColor = world.defaultLevelBackgroundColor val graph = sceneGraph(this, viewport = ExtendViewport(960, 540), batch = batch) { centerContainer { @@ -60,23 +63,23 @@ class GameWorldAndUIViewports(context: Context) : ContextListener(context) { graph.resize(width, height) worldViewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } onUpdate { dt -> val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -90,18 +93,17 @@ class GameWorldAndUIViewports(context: Context) : ContextListener(context) { val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() - val commandEncoder = device.createCommandEncoder("command encoder") + val commandEncoder = device.createCommandEncoder(CommandEncoderDescriptor("command encoder")) val worldRenderPass = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = bgColor + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = bgColor.toWebGPUColor() ) ) ) @@ -111,15 +113,14 @@ class GameWorldAndUIViewports(context: Context) : ContextListener(context) { world.render(batch, worldCamera, scale = 1f) batch.flush(worldRenderPass) worldRenderPass.end() - worldRenderPass.release() val uiRenderPassDescriptor = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.LOAD, - storeOp = StoreOp.STORE + loadOp = LoadOp.load, + storeOp = StoreOp.store ) ), label = "Init render pass" @@ -131,13 +132,13 @@ class GameWorldAndUIViewports(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { batch.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/HelloSceneGraphExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/HelloSceneGraphExample.kt index a3a39e1f6..52c745d39 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/HelloSceneGraphExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/HelloSceneGraphExample.kt @@ -11,12 +11,18 @@ import com.littlekt.graph.sceneGraph import com.littlekt.graphics.Color import com.littlekt.graphics.HAlign import com.littlekt.graphics.VAlign -import com.littlekt.graphics.webgpu.* import com.littlekt.input.Key import com.littlekt.math.geom.Angle import com.littlekt.math.geom.degrees import com.littlekt.math.geom.radians import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.CommandEncoderDescriptor +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example using a [sceneGraph] @@ -32,14 +38,13 @@ class HelloSceneGraphExample(context: Context) : ContextListener(context) { val icon = resourcesVfs["icon_16x16.png"].readTexture() val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val graph = @@ -129,23 +134,23 @@ class HelloSceneGraphExample(context: Context) : ContextListener(context) { onResize { width, height -> graph.resize(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } onUpdate { dt -> val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -159,17 +164,15 @@ class HelloSceneGraphExample(context: Context) : ContextListener(context) { val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() - val commandEncoder = device.createCommandEncoder("scenegraph command encoder") + val commandEncoder = device.createCommandEncoder(CommandEncoderDescriptor("scenegraph command encoder")) val renderPassDescriptor = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ), label = "Init render pass" @@ -179,13 +182,13 @@ class HelloSceneGraphExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { graph.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapCacheExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapCacheExample.kt index 38bce87de..54fe8baf7 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapCacheExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapCacheExample.kt @@ -4,8 +4,13 @@ import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.file.vfs.readLDtkMapLoader import com.littlekt.graphics.g2d.SpriteCache -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * Load and render an entire world of LDtk. @@ -22,31 +27,28 @@ class LDtkTileMapCacheExample(context: Context) : ContextListener(context) { val mapLoader = resourcesVfs["ldtk/sample-1.0.ldtk"].readLDtkMapLoader() val world = mapLoader.loadMap() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val cache = SpriteCache(device, preferredFormat) world.addToCache(cache, scale = 1 / 8f) val viewport = ExtendViewport(30, 16) val camera = viewport.camera - val bgColor = - if (preferredFormat.srgb) world.defaultLevelBackgroundColor.toLinear() - else world.defaultLevelBackgroundColor + val bgColor = world.defaultLevelBackgroundColor onResize { width, height -> viewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -54,18 +56,18 @@ class LDtkTileMapCacheExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) logger.info { "getCurrentTexture status=$status" } return@onUpdate @@ -83,14 +85,13 @@ class LDtkTileMapCacheExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = bgColor + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = bgColor.toWebGPUColor() ) ) ) @@ -103,14 +104,13 @@ class LDtkTileMapCacheExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapExample.kt index 1b334740e..03e094668 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/LDtkTileMapExample.kt @@ -5,8 +5,13 @@ import com.littlekt.ContextListener import com.littlekt.file.vfs.readLDtkMapLoader import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.g2d.use -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * Load and render an LDtk map. @@ -26,30 +31,27 @@ class LDtkTileMapExample(context: Context) : ContextListener(context) { // we can load additional levels by doing: // mapLoader.loadLevel(levelIdx) val world = mapLoader.loadMap() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat, size = 400) val viewport = ExtendViewport(270, 135) val camera = viewport.camera - val bgColor = - if (preferredFormat.srgb) world.defaultLevelBackgroundColor.toLinear() - else world.defaultLevelBackgroundColor + val bgColor = world.defaultLevelBackgroundColor onResize { width, height -> viewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -57,13 +59,13 @@ class LDtkTileMapExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -80,14 +82,13 @@ class LDtkTileMapExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = bgColor + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = bgColor.toWebGPUColor() ) ) ) @@ -101,14 +102,13 @@ class LDtkTileMapExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/MultipleTexturesExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/MultipleTexturesExample.kt index 200779404..c3da8d11d 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/MultipleTexturesExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/MultipleTexturesExample.kt @@ -6,7 +6,12 @@ import com.littlekt.file.vfs.readTexture import com.littlekt.graphics.Color import com.littlekt.graphics.OrthographicCamera import com.littlekt.graphics.g2d.SpriteBatch -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example using a [SpriteBatch] to render multiple textures. @@ -22,14 +27,13 @@ class MultipleTexturesExample(context: Context) : ContextListener(context) { val logoTexture = resourcesVfs["logo.png"].readTexture() val pikaTexture = resourcesVfs["pika.png"].readTexture() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -41,10 +45,10 @@ class MultipleTexturesExample(context: Context) : ContextListener(context) { camera.ortho(width, height) camera.position.x = 0f graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -52,13 +56,13 @@ class MultipleTexturesExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -75,16 +79,13 @@ class MultipleTexturesExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -100,14 +101,13 @@ class MultipleTexturesExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/RenderSpriteBatchAndMultipleShadersExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/RenderSpriteBatchAndMultipleShadersExample.kt index 02bb3aa94..2f4f8096c 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/RenderSpriteBatchAndMultipleShadersExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/RenderSpriteBatchAndMultipleShadersExample.kt @@ -7,7 +7,22 @@ import com.littlekt.graphics.Color import com.littlekt.graphics.Texture import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.shader.SpriteShader -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.BindGroup +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.SamplerBindingLayout +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.TextureBindingLayout +import io.ygdrasil.wgpu.Device +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPassEncoder +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example showing a [SpriteBatch] drawing multiple textures and using different shaders to @@ -62,12 +77,16 @@ class RenderSpriteBatchAndMultipleShadersExample(context: Context) : ContextList layout = listOf( BindGroupLayoutDescriptor( - listOf(BindGroupLayoutEntry(0, ShaderStage.VERTEX, BufferBindingLayout())) + listOf(Entry(0, setOf(ShaderStage.vertex), Entry.BufferBindingLayout())) ), BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) + Entry(0, setOf(ShaderStage.fragment), + TextureBindingLayout() + ), + Entry(1, setOf(ShaderStage.fragment), + SamplerBindingLayout() + ) ) ) ) @@ -88,7 +107,10 @@ class RenderSpriteBatchAndMultipleShadersExample(context: Context) : ContextList device.createBindGroup( BindGroupDescriptor( layouts[1], - listOf(BindGroupEntry(0, texture.view), BindGroupEntry(1, texture.sampler)) + listOf( + BindGroupEntry(0, TextureViewBinding(texture.view)), + BindGroupEntry(1, SamplerBinding(texture.sampler)) + ) ) ) ) @@ -112,15 +134,14 @@ class RenderSpriteBatchAndMultipleShadersExample(context: Context) : ContextList val logoTexture = resourcesVfs["logo.png"].readTexture() val pikaTexture = resourcesVfs["pika.png"].readTexture() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat val coloredShader = ColorShader(device) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -136,23 +157,23 @@ class RenderSpriteBatchAndMultipleShadersExample(context: Context) : ContextList far = 1f ) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -163,20 +184,18 @@ class RenderSpriteBatchAndMultipleShadersExample(context: Context) : ContextList return@onUpdate } } - val swapChainTexture = checkNotNull(surfaceTexture.texture) - val frame = swapChainTexture.createView() + val frame = surfaceTexture.texture.createView() val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = Color.DARK_GRAY.toLinear() + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toLinear().toWebGPUColor() ) ) ) @@ -193,14 +212,13 @@ class RenderSpriteBatchAndMultipleShadersExample(context: Context) : ContextList val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + surfaceTexture.texture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/RenderTargetExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/RenderTargetExample.kt index 82087658e..6055c55cf 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/RenderTargetExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/RenderTargetExample.kt @@ -6,7 +6,13 @@ import com.littlekt.file.vfs.readTexture import com.littlekt.graphics.Color import com.littlekt.graphics.EmptyTexture import com.littlekt.graphics.g2d.SpriteBatch -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.CommandEncoderDescriptor +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example of rendering to a texture. @@ -22,37 +28,36 @@ class RenderTargetExample(context: Context) : ContextListener(context) { val icon = resourcesVfs["icon_16x16.png"].readTexture() val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat val target = EmptyTexture(device, preferredFormat, 256, 256) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) onResize { _, _ -> graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } onUpdate { dt -> val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -66,18 +71,16 @@ class RenderTargetExample(context: Context) : ContextListener(context) { val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() - val commandEncoder = device.createCommandEncoder("scenegraph command encoder") + val commandEncoder = device.createCommandEncoder(CommandEncoderDescriptor("scenegraph command encoder")) val renderTargetRenderPass = commandEncoder.beginRenderPass( RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = target.view, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.YELLOW.toLinear() - else Color.YELLOW + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.YELLOW.toWebGPUColor() ) ), label = "Surface render pass" @@ -93,13 +96,11 @@ class RenderTargetExample(context: Context) : ContextListener(context) { commandEncoder.beginRenderPass( RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ), label = "Surface render pass" @@ -118,15 +119,13 @@ class RenderTargetExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - renderTargetRenderPass.release() - surfaceRenderPass.release() - commandBuffer.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { batch.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/RotatingCubeExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/RotatingCubeExample.kt index ba8c92cc7..77cc61982 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/RotatingCubeExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/RotatingCubeExample.kt @@ -3,11 +3,39 @@ package com.littlekt.examples import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.file.FloatBuffer +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color -import com.littlekt.graphics.webgpu.* +import com.littlekt.graphics.createGPUFloatBuffer import com.littlekt.math.Mat4 import com.littlekt.math.geom.radians import com.littlekt.util.now +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.CompareFunction +import io.ygdrasil.wgpu.CompositeAlphaMode +import io.ygdrasil.wgpu.CullMode +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout.VertexAttribute +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceConfiguration +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureDimension +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.VertexFormat +import io.ygdrasil.wgpu.VertexStepMode import kotlin.math.cos import kotlin.math.sin @@ -427,13 +455,12 @@ class RotatingCubeExample(context: Context) : ContextListener(context) { override suspend fun Context.start() { addStatsHandler() val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - AlphaMode.OPAQUE + PresentMode.fifo, + CompositeAlphaMode.opaque ) val projMatrix = @@ -450,84 +477,93 @@ class RotatingCubeExample(context: Context) : ContextListener(context) { } val vertexBuffer = - device.createGPUFloatBuffer("cube vbo", cubeVertexArray, BufferUsage.VERTEX) + device.createGPUFloatBuffer("cube vbo", cubeVertexArray, setOf(BufferUsage.vertex)) val matrixBuffer = device.createGPUFloatBuffer( "mvp buffer", modelViewProjMatrix.data, - BufferUsage.UNIFORM or BufferUsage.COPY_DST + setOf(BufferUsage.uniform, BufferUsage.copydst) ) - val shader = device.createShaderModule(shaderSrc) + val shader = device.createShaderModule(ShaderModuleDescriptor(shaderSrc)) val bindGroupLayout = device.createBindGroupLayout( BindGroupLayoutDescriptor( - BindGroupLayoutEntry(0, ShaderStage.VERTEX, BufferBindingLayout()) + listOf( + BindGroupLayoutDescriptor.Entry( + 0, setOf(ShaderStage.vertex), + BindGroupLayoutDescriptor.Entry.BufferBindingLayout() + ) + ) ) ) val bindGroup = device.createBindGroup( - BindGroupDescriptor(bindGroupLayout, BindGroupEntry(0, BufferBinding(matrixBuffer))) + BindGroupDescriptor( + bindGroupLayout, listOf(BindGroupDescriptor.BindGroupEntry( + 0, + BindGroupDescriptor.BufferBinding(matrixBuffer) + )) + ) ) - val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(bindGroupLayout)) + val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(listOf(bindGroupLayout))) val renderPipeline = device.createRenderPipeline( RenderPipelineDescriptor( layout = pipelineLayout, vertex = - VertexState( - module = shader, - entryPoint = "vs_main", - buffer = - WebGPUVertexBufferLayout( - arrayStride = cubeVertexSize, - stepMode = VertexStepMode.VERTEX, - attributes = - listOf( - WebGPUVertexAttribute( - VertexFormat.FLOAT32x4, - cubePositionOffset, - 0 - ), - WebGPUVertexAttribute( - VertexFormat.FLOAT32x2, - cubeUVOffset, - 1 - ) - ) - ) - ), - fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - preferredFormat, - BlendState.Opaque, - ColorWriteMask.ALL + VertexState( + module = shader, + entryPoint = "vs_main", + buffers = listOf( + VertexBufferLayout( + arrayStride = cubeVertexSize, + stepMode = VertexStepMode.vertex, + attributes = + listOf( + VertexAttribute( + VertexFormat.float32x4, + cubePositionOffset, + 0 + ), + VertexAttribute( + VertexFormat.float32x2, + cubeUVOffset, + 1 ) - ), + ) + ) + ) + ), + fragment = FragmentState( + module = shader, + entryPoint = "fs_main", + targets = listOf( + FragmentState.ColorTargetState( + preferredFormat, + ColorWriteMask.all, + BlendStates.Opaque, + ) + ) + + ), primitive = - PrimitiveState(PrimitiveTopology.TRIANGLE_LIST, cullMode = CullMode.BACK), + PrimitiveState(PrimitiveTopology.triangleList, cullMode = CullMode.back), depthStencil = - DepthStencilState( - format = TextureFormat.DEPTH24_PLUS, - true, - CompareFunction.LESS - ), - multisample = MultisampleState(1, 0xFFFFFFF, false) + DepthStencilState( + format = TextureFormat.depth24plus, + true, + CompareFunction.less + ), + multisample = MultisampleState(1, 268435455u, false) ) ) var depthTexture = device.createTexture( TextureDescriptor( - Extent3D(graphics.width, graphics.height, 1), - 1, - 1, - TextureDimension.D2, - TextureFormat.DEPTH24_PLUS, - TextureUsage.RENDER_ATTACHMENT + Size3D(graphics.width, graphics.height), + TextureFormat.depth24plus, + setOf(TextureUsage.renderAttachment) ) ) var depthTextureView = depthTexture.createView() @@ -537,57 +573,49 @@ class RotatingCubeExample(context: Context) : ContextListener(context) { val surfaceTexture = graphics.surface.getCurrentTexture() val valid = surfaceTexture.isValid(context) { - depthTexture.release() - depthTextureView.release() + depthTexture.close() + depthTextureView.close() depthTexture = device.createTexture( TextureDescriptor( - Extent3D(graphics.width, graphics.height, 1), - 1, - 1, - TextureDimension.D2, - TextureFormat.DEPTH24_PLUS, - TextureUsage.RENDER_ATTACHMENT + Size3D(graphics.width, graphics.height), + TextureFormat.depth24plus, + setOf(TextureUsage.renderAttachment), ) ) depthTextureView = depthTexture.createView() SurfaceConfiguration( device, - TextureUsage.RENDER_ATTACHMENT, preferredFormat, - PresentMode.FIFO, - AlphaMode.OPAQUE, - graphics.width, - graphics.height + setOf(TextureUsage.renderAttachment), + alphaMode = CompositeAlphaMode.opaque ) } if (!valid) return@onUpdate updateMvp() - queue.writeBuffer(matrixBuffer, modelViewProjMatrix.toBuffer(matBuffer)) + queue.writeBuffer(matrixBuffer, 0L, modelViewProjMatrix.toBuffer(matBuffer).toArray()) val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = - RenderPassDescriptor( - listOf( - RenderPassColorAttachmentDescriptor( - view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = Color.BLACK - ) - ), - depthStencilAttachment = - RenderPassDepthStencilAttachmentDescriptor( - depthTextureView, - depthClearValue = 1f, - depthLoadOp = LoadOp.CLEAR, - depthStoreOp = StoreOp.STORE - ) + RenderPassDescriptor( + listOf( + RenderPassDescriptor.ColorAttachment( + view = frame, + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.BLACK.toWebGPUColor() + ) + ), + depthStencilAttachment = RenderPassDescriptor.DepthStencilAttachment( + depthTextureView, + depthClearValue = 1f, + depthLoadOp = LoadOp.clear, + depthStoreOp = StoreOp.store ) + ) ) renderPassEncoder.setPipeline(renderPipeline) renderPassEncoder.setBindGroup(0, bindGroup) @@ -597,25 +625,24 @@ class RotatingCubeExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - bindGroup.release() - bindGroupLayout.release() - matrixBuffer.release() - depthTexture.release() - depthTextureView.release() - shader.release() + renderPipeline.close() + pipelineLayout.close() + bindGroup.close() + bindGroupLayout.close() + matrixBuffer.close() + depthTexture.close() + depthTextureView.close() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/SimpleCameraExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/SimpleCameraExample.kt index 166952430..fd55e6532 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/SimpleCameraExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/SimpleCameraExample.kt @@ -5,8 +5,13 @@ import com.littlekt.ContextListener import com.littlekt.file.vfs.readTexture import com.littlekt.graphics.Color import com.littlekt.graphics.g2d.SpriteBatch -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example using a simple Orthographic camera to move around a texture. @@ -22,14 +27,13 @@ class SimpleCameraExample(context: Context) : ContextListener(context) { val device = graphics.device val logoTexture = resourcesVfs["logo.png"].readTexture() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -39,10 +43,10 @@ class SimpleCameraExample(context: Context) : ContextListener(context) { onResize { width, height -> viewport.update(width, height, true) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -50,16 +54,18 @@ class SimpleCameraExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } + else -> { // fatal logger.fatal { "getCurrentTexture status=$status" } @@ -73,19 +79,16 @@ class SimpleCameraExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = - RenderPassDescriptor( - listOf( - RenderPassColorAttachmentDescriptor( - view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY - ) + RenderPassDescriptor( + listOf( + RenderPassDescriptor.ColorAttachment( + view = frame, + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) + ) ) camera.update() batch.begin() @@ -96,14 +99,13 @@ class SimpleCameraExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteBatchMultiPassExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteBatchMultiPassExample.kt index 87c5ef6dd..db71a2eed 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteBatchMultiPassExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteBatchMultiPassExample.kt @@ -10,8 +10,13 @@ import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.g2d.font.BitmapFont import com.littlekt.graphics.g2d.tilemap.ldtk.LDtkWorld import com.littlekt.graphics.g2d.use -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * @author Colton Daily @@ -29,14 +34,13 @@ class SpriteBatchMultiPassExample(context: Context) : ContextListener(context) { val device = graphics.device - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -49,10 +53,10 @@ class SpriteBatchMultiPassExample(context: Context) : ContextListener(context) { viewport.update(width, height) uiViewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -66,13 +70,13 @@ class SpriteBatchMultiPassExample(context: Context) : ContextListener(context) { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -89,16 +93,13 @@ class SpriteBatchMultiPassExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue =Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -115,14 +116,13 @@ class SpriteBatchMultiPassExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { batch.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteCacheQuadsExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteCacheQuadsExample.kt index 8d085fe08..5618dfb6c 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteCacheQuadsExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/SpriteCacheQuadsExample.kt @@ -5,8 +5,13 @@ import com.littlekt.ContextListener import com.littlekt.graphics.Color import com.littlekt.graphics.OrthographicCamera import com.littlekt.graphics.g2d.SpriteCache -import com.littlekt.graphics.webgpu.* import com.littlekt.resources.Textures +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage import kotlin.random.Random /** @@ -22,7 +27,6 @@ class SpriteCacheQuadsExample(context: Context) : ContextListener(context) { addCloseOnEsc() val device = graphics.device val queue = device.queue - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat val camera = OrthographicCamera() @@ -41,19 +45,19 @@ class SpriteCacheQuadsExample(context: Context) : ContextListener(context) { } } graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onResize { width, height -> camera.ortho(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -61,13 +65,13 @@ class SpriteCacheQuadsExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -86,16 +90,13 @@ class SpriteCacheQuadsExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -105,14 +106,13 @@ class SpriteCacheQuadsExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { cache.release() } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureBlendsExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureBlendsExample.kt index 787c1e680..2af629dab 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureBlendsExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureBlendsExample.kt @@ -3,9 +3,15 @@ package com.littlekt.examples import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.file.vfs.readTexture +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color import com.littlekt.graphics.g2d.SpriteBatch -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example showing drawing textures with different blending. @@ -21,14 +27,13 @@ class TextureBlendsExample(context: Context) : ContextListener(context) { val logoTexture = resourcesVfs["logo.png"].readTexture() val pikaTexture = resourcesVfs["pika.png"].readTexture() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat) @@ -44,23 +49,23 @@ class TextureBlendsExample(context: Context) : ContextListener(context) { far = 1f ) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -77,14 +82,13 @@ class TextureBlendsExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -92,7 +96,7 @@ class TextureBlendsExample(context: Context) : ContextListener(context) { batch.begin() batch.draw(logoTexture, -graphics.width * 0.5f, 0f, scaleX = 0.1f, scaleY = 0.1f) batch.draw(pikaTexture, -graphics.width * 0.5f, -pikaTexture.height - 10f) - batch.setBlendState(BlendState.Darken) + batch.setBlendState(BlendStates.Darken) batch.draw(logoTexture, 0f, 0f, scaleX = 0.1f, scaleY = 0.1f) batch.draw(pikaTexture, 0f, -pikaTexture.height - 10f) batch.swapToPreviousBlendState() @@ -114,14 +118,13 @@ class TextureBlendsExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureExample.kt index 890c9fa5f..964599061 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureExample.kt @@ -5,8 +5,41 @@ import com.littlekt.ContextListener import com.littlekt.file.FloatBuffer import com.littlekt.file.ShortBuffer import com.littlekt.file.vfs.readPixmap +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color -import com.littlekt.graphics.webgpu.* +import com.littlekt.graphics.createGPUFloatBuffer +import com.littlekt.graphics.createGPUShortBuffer +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.SamplerBinding +import io.ygdrasil.wgpu.BindGroupDescriptor.TextureViewBinding +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.SamplerBindingLayout +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.TextureBindingLayout +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.ImageCopyTexture +import io.ygdrasil.wgpu.IndexFormat +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout.VertexAttribute +import io.ygdrasil.wgpu.SamplerDescriptor +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureDataLayout +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.VertexFormat +import io.ygdrasil.wgpu.VertexStepMode /** * An example showing drawing a texture with pure WebGPU. @@ -74,30 +107,25 @@ class TextureExample(context: Context) : ContextListener(context) { val indices = ShortBuffer(shortArrayOf(0, 1, 2, 0, 2, 3)) val image = resourcesVfs["logo.png"].readPixmap() val device = graphics.device - val vbo = device.createGPUFloatBuffer("vbo", vertices.toArray(), BufferUsage.VERTEX) - val ibo = device.createGPUShortBuffer("ibo", indices.toArray(), BufferUsage.INDEX) - val shader = device.createShaderModule(textureShader) - val surfaceCapabilities = graphics.surfaceCapabilities + val vbo = device.createGPUFloatBuffer("vbo", vertices.toArray(), setOf(BufferUsage.vertex)) + val ibo = device.createGPUShortBuffer("ibo", indices.toArray(), setOf(BufferUsage.index)) + val shader = device.createShaderModule(ShaderModuleDescriptor(textureShader)) val preferredFormat = graphics.preferredFormat val texture = device.createTexture( TextureDescriptor( - Extent3D(image.width, image.height, 1), - 1, - 1, - TextureDimension.D2, - if (preferredFormat.srgb) TextureFormat.RGBA8_UNORM_SRGB - else TextureFormat.RGBA8_UNORM, - TextureUsage.COPY_DST or TextureUsage.TEXTURE + Size3D(image.width, image.height), + TextureFormat.rgba8unorm, + setOf(TextureUsage.copyDst, TextureUsage.textureBinding) ) ) val queue = device.queue queue.writeTexture( data = image.pixels.toArray(), - destination = TextureCopyView(texture), - layout = TextureDataLayout(image.width * 4, image.height), - copySize = Extent3D(image.width, image.height, 1) + destination = ImageCopyTexture(texture), + dataLayout = TextureDataLayout(0L, image.width * 4, image.height), + size = Size3D(image.width, image.height) ) val sampler = device.createSampler(SamplerDescriptor()) @@ -106,83 +134,95 @@ class TextureExample(context: Context) : ContextListener(context) { device.createBindGroupLayout( BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) + BindGroupLayoutDescriptor.Entry( + 0, setOf(ShaderStage.fragment), TextureBindingLayout() + ), + BindGroupLayoutDescriptor.Entry( + 1, setOf(ShaderStage.fragment), + SamplerBindingLayout() + ) ) ) ) val bindGroup = device.createBindGroup( - desc = - BindGroupDescriptor( - bindGroupLayout, - listOf(BindGroupEntry(0, textureView), BindGroupEntry(1, sampler)) + BindGroupDescriptor( + bindGroupLayout, + listOf( + BindGroupDescriptor.BindGroupEntry(0, TextureViewBinding(textureView)), + BindGroupDescriptor.BindGroupEntry(1, SamplerBinding(sampler)) ) + ) ) - val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(bindGroupLayout)) + val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(listOf(bindGroupLayout))) val renderPipelineDesc = RenderPipelineDescriptor( layout = pipelineLayout, vertex = - VertexState( - module = shader, - entryPoint = "vs_main", - WebGPUVertexBufferLayout( + RenderPipelineDescriptor.VertexState( + module = shader, + entryPoint = "vs_main", + buffers = listOf( + VertexBufferLayout( 4L * Float.SIZE_BYTES, - VertexStepMode.VERTEX, listOf( - WebGPUVertexAttribute(VertexFormat.FLOAT32x2, 0, 0), - WebGPUVertexAttribute( - VertexFormat.FLOAT32x2, + VertexAttribute(VertexFormat.float32x2, 0, 0), + VertexAttribute( + VertexFormat.float32x2, 2L * Float.SIZE_BYTES, 1 ) - ) + ), + VertexStepMode.vertex, ) - ), + ) + ), fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.NonPreMultiplied, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + FragmentState( + module = shader, + entryPoint = "fs_main", + targets = listOf( + FragmentState.ColorTargetState( + format = preferredFormat, + blend = BlendStates.NonPreMultiplied, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = RenderPipelineDescriptor.PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + RenderPipelineDescriptor.MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) val renderPipeline = device.createRenderPipeline(renderPipelineDesc) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) logger.info { "getCurrentTexture status=$status" } return@onUpdate } + else -> { // fatal logger.fatal { "getCurrentTexture status=$status" } @@ -196,51 +236,47 @@ class TextureExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = - RenderPassDescriptor( - listOf( - RenderPassColorAttachmentDescriptor( - view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY - ) + RenderPassDescriptor( + listOf( + RenderPassDescriptor.ColorAttachment( + view = frame, + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) + ) ) renderPassEncoder.setPipeline(renderPipeline) renderPassEncoder.setBindGroup(0, bindGroup) renderPassEncoder.setVertexBuffer(0, vbo) - renderPassEncoder.setIndexBuffer(ibo, IndexFormat.UINT16) + renderPassEncoder.setIndexBuffer(ibo, IndexFormat.uint16) renderPassEncoder.drawIndexed(indices.capacity, 1) renderPassEncoder.end() val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - bindGroup.release() - bindGroupLayout.release() - sampler.release() - textureView.release() - texture.release() - ibo.release() - vbo.release() - texture.release() - shader.release() + renderPipeline.close() + pipelineLayout.close() + bindGroup.close() + bindGroupLayout.close() + sampler.close() + textureView.close() + texture.close() + ibo.close() + vbo.close() + texture.close() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshAndCameraExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshAndCameraExample.kt index 393ec7801..40ce21495 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshAndCameraExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshAndCameraExample.kt @@ -4,10 +4,31 @@ import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.file.FloatBuffer import com.littlekt.file.vfs.readTexture +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color import com.littlekt.graphics.OrthographicCamera +import com.littlekt.graphics.createGPUFloatBuffer import com.littlekt.graphics.textureIndexedMesh -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.* +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.IndexFormat +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.* +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example showing drawing a texture with a [textureIndexedMesh] and using an @@ -93,11 +114,10 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { device.createGPUFloatBuffer( "camera uniform buffer", cameraFloatBuffer.toArray(), - BufferUsage.UNIFORM or BufferUsage.COPY_DST + setOf(BufferUsage.uniform, BufferUsage.copydst) ) - val shader = device.createShaderModule(textureShader) - val surfaceCapabilities = graphics.surfaceCapabilities + val shader = device.createShaderModule(ShaderModuleDescriptor(textureShader)) val preferredFormat = graphics.preferredFormat val queue = device.queue @@ -105,7 +125,7 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { val vertexGroupLayout = device.createBindGroupLayout( BindGroupLayoutDescriptor( - listOf(BindGroupLayoutEntry(0, ShaderStage.VERTEX, BufferBindingLayout())) + listOf(Entry(0, setOf(ShaderStage.vertex), BufferBindingLayout())) ) ) val vertexBindGroup = @@ -119,17 +139,18 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { device.createBindGroupLayout( BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) + Entry(0, setOf(ShaderStage.fragment), TextureBindingLayout()), + Entry(1, setOf(ShaderStage.fragment), SamplerBindingLayout()) ) ) ) val fragmentBindGroup = device.createBindGroup( - desc = BindGroupDescriptor( fragmentGroupLayout, - listOf(BindGroupEntry(0, texture.view), BindGroupEntry(1, texture.sampler)) + listOf( + BindGroupEntry(0, TextureViewBinding(texture.view)), + BindGroupEntry(1, SamplerBinding(texture.sampler))) ) ) val pipelineLayout = @@ -139,43 +160,43 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { val renderPipelineDesc = RenderPipelineDescriptor( layout = pipelineLayout, - vertex = - VertexState( - module = shader, - entryPoint = "vs_main", - mesh.geometry.layout.gpuVertexBufferLayout - ), + vertex = VertexState( + module = shader, + entryPoint = "vs_main", + buffers = listOf(mesh.geometry.layout.gpuVertexBufferLayout) + ), fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.NonPreMultiplied, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + FragmentState( + module = shader, + entryPoint = "fs_main", + targets = + listOf( + FragmentState.ColorTargetState( + format = preferredFormat, + blend = BlendStates.NonPreMultiplied, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, - multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + multisample = MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) val renderPipeline = device.createRenderPipeline(renderPipelineDesc) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onResize { width, height -> camera.ortho(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -183,13 +204,13 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -202,7 +223,7 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { } camera.update() camera.viewProjection.toBuffer(cameraFloatBuffer) - device.queue.writeBuffer(cameraUniformBuffer, cameraFloatBuffer) + device.queue.writeBuffer(cameraUniformBuffer, 0L, cameraFloatBuffer.toArray()) val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() @@ -210,16 +231,13 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -228,31 +246,30 @@ class TextureMeshAndCameraExample(context: Context) : ContextListener(context) { renderPassEncoder.setBindGroup(0, vertexBindGroup) renderPassEncoder.setBindGroup(1, fragmentBindGroup) renderPassEncoder.setVertexBuffer(0, mesh.vbo) - renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.UINT16) + renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.uint16) renderPassEncoder.drawIndexed(6, 1) renderPassEncoder.end() val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - fragmentBindGroup.release() - fragmentGroupLayout.release() + renderPipeline.close() + pipelineLayout.close() + fragmentBindGroup.close() + fragmentGroupLayout.close() texture.release() mesh.release() texture.release() - shader.release() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshExample.kt index 67713dcf0..50aac9ca4 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureMeshExample.kt @@ -3,9 +3,36 @@ package com.littlekt.examples import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.file.vfs.readPixmap +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color import com.littlekt.graphics.textureIndexedMesh -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.SamplerBindingLayout +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.TextureBindingLayout +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.ImageCopyTexture +import io.ygdrasil.wgpu.IndexFormat +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState +import io.ygdrasil.wgpu.SamplerDescriptor +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureDataLayout +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage /** * An example showing drawing a texture with a [textureIndexedMesh]. @@ -73,28 +100,23 @@ class TextureMeshExample(context: Context) : ContextListener(context) { } } mesh.update() - val shader = device.createShaderModule(textureShader) - val surfaceCapabilities = graphics.surfaceCapabilities + val shader = device.createShaderModule(ShaderModuleDescriptor(textureShader)) val preferredFormat = graphics.preferredFormat val texture = device.createTexture( TextureDescriptor( - Extent3D(image.width, image.height, 1), - 1, - 1, - TextureDimension.D2, - if (preferredFormat.srgb) TextureFormat.RGBA8_UNORM_SRGB - else TextureFormat.RGBA8_UNORM, - TextureUsage.COPY_DST or TextureUsage.TEXTURE + Size3D(image.width, image.height), + TextureFormat.rgba8unorm, + setOf(TextureUsage.copyDst, TextureUsage.textureBinding) ) ) val queue = device.queue queue.writeTexture( data = image.pixels.toArray(), - destination = TextureCopyView(texture), - layout = TextureDataLayout(image.width * 4, image.height), - copySize = Extent3D(image.width, image.height, 1) + destination = ImageCopyTexture(texture), + dataLayout = TextureDataLayout(0L, image.width * 4, image.height), + size = Size3D(image.width, image.height, 1) ) val sampler = device.createSampler(SamplerDescriptor()) @@ -103,68 +125,72 @@ class TextureMeshExample(context: Context) : ContextListener(context) { device.createBindGroupLayout( BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) + Entry(0, setOf(ShaderStage.fragment), TextureBindingLayout()), + Entry(1, setOf(ShaderStage.fragment), SamplerBindingLayout()) ) ) ) val bindGroup = device.createBindGroup( - desc = BindGroupDescriptor( bindGroupLayout, - listOf(BindGroupEntry(0, textureView), BindGroupEntry(1, sampler)) + listOf( + BindGroupEntry(0, TextureViewBinding(textureView)), + BindGroupEntry(1, SamplerBinding(sampler)) + ) ) ) - val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(bindGroupLayout)) + val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(listOf(bindGroupLayout))) val renderPipelineDesc = RenderPipelineDescriptor( layout = pipelineLayout, vertex = - VertexState( - module = shader, - entryPoint = "vs_main", - mesh.geometry.layout.gpuVertexBufferLayout - ), + VertexState( + module = shader, + entryPoint = "vs_main", + buffers = listOf(mesh.geometry.layout.gpuVertexBufferLayout) + ), fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.NonPreMultiplied, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + FragmentState( + module = shader, + entryPoint = "fs_main", + targets = + listOf( + ColorTargetState( + format = preferredFormat, + blend = BlendStates.NonPreMultiplied, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) val renderPipeline = device.createRenderPipeline(renderPipelineDesc) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) logger.info { "getCurrentTexture status=$status" } return@onUpdate @@ -182,16 +208,13 @@ class TextureMeshExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -199,33 +222,32 @@ class TextureMeshExample(context: Context) : ContextListener(context) { renderPassEncoder.setPipeline(renderPipeline) renderPassEncoder.setBindGroup(0, bindGroup) renderPassEncoder.setVertexBuffer(0, mesh.vbo) - renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.UINT16) + renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.uint16) renderPassEncoder.drawIndexed(6, 1) renderPassEncoder.end() val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - bindGroup.release() - bindGroupLayout.release() - sampler.release() - textureView.release() - texture.release() + renderPipeline.close() + pipelineLayout.close() + bindGroup.close() + bindGroupLayout.close() + sampler.close() + textureView.close() + texture.close() mesh.release() - texture.release() - shader.release() + texture.close() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureViaCommandEncoderExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureViaCommandEncoderExample.kt index 6a6ba7bbc..1b805f290 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TextureViaCommandEncoderExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TextureViaCommandEncoderExample.kt @@ -3,8 +3,44 @@ package com.littlekt.examples import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.file.vfs.readPixmap +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color -import com.littlekt.graphics.webgpu.* +import com.littlekt.graphics.createGPUByteBuffer +import com.littlekt.graphics.createGPUFloatBuffer +import com.littlekt.graphics.createGPUShortBuffer +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.* +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.ImageCopyBuffer +import io.ygdrasil.wgpu.ImageCopyTexture +import io.ygdrasil.wgpu.IndexFormat +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout +import io.ygdrasil.wgpu.RenderPipelineDescriptor.VertexState.VertexBufferLayout.* +import io.ygdrasil.wgpu.SamplerDescriptor +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.Size3D +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureDataLayout +import io.ygdrasil.wgpu.TextureDescriptor +import io.ygdrasil.wgpu.TextureDimension +import io.ygdrasil.wgpu.TextureFormat +import io.ygdrasil.wgpu.TextureUsage +import io.ygdrasil.wgpu.VertexFormat +import io.ygdrasil.wgpu.VertexStepMode /** * An example rendering a texture using a [CommandEncoder] in pure WebGPU. @@ -72,35 +108,31 @@ class TextureViaCommandEncoderExample(context: Context) : ContextListener(contex // @formatter:on val image = resourcesVfs["pika.png"].readPixmap() val device = graphics.device - val vbo = device.createGPUFloatBuffer("vbo", vertices, BufferUsage.VERTEX) - val ibo = device.createGPUShortBuffer("ibo", indices, BufferUsage.INDEX) - val shader = device.createShaderModule(textureShader) - val surfaceCapabilities = graphics.surfaceCapabilities + val vbo = device.createGPUFloatBuffer("vbo", vertices, setOf(BufferUsage.vertex)) + val ibo = device.createGPUShortBuffer("ibo", indices, setOf(BufferUsage.index)) + val shader = device.createShaderModule(ShaderModuleDescriptor(textureShader)) val preferredFormat = graphics.preferredFormat val texture = device.createTexture( TextureDescriptor( - Extent3D(image.width, image.height, 1), - 1, - 1, - TextureDimension.D2, - TextureFormat.RGBA8_UNORM_SRGB, - TextureUsage.COPY_DST or TextureUsage.TEXTURE + Size3D(image.width, image.height), + TextureFormat.rgba8unormsrgb, + setOf(TextureUsage.copyDst, TextureUsage.textureBinding) ) ) val queue = device.queue run { val textureBuffer = - device.createGPUByteBuffer("tex temp", image.pixels.toArray(), BufferUsage.COPY_SRC) + device.createGPUByteBuffer("tex temp", image.pixels.toArray(), setOf(BufferUsage.copysrc)) val commandEncoder = device.createCommandEncoder() commandEncoder.copyBufferToTexture( - BufferCopyView(textureBuffer, TextureDataLayout(image.width * 4, image.height)), - TextureCopyView(texture), - Extent3D(image.width, image.height, 1) + ImageCopyBuffer(textureBuffer, 0L, image.width * 4, image.height), + ImageCopyTexture(texture), + Size3D(image.width, image.height) ) - queue.submit(commandEncoder.finish()) - textureBuffer.destroy() + queue.submit(listOf(commandEncoder.finish())) + textureBuffer.close() } val sampler = device.createSampler(SamplerDescriptor()) @@ -109,79 +141,85 @@ class TextureViaCommandEncoderExample(context: Context) : ContextListener(contex device.createBindGroupLayout( BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) + Entry(0, setOf(ShaderStage.fragment), TextureBindingLayout()), + Entry(1, setOf(ShaderStage.fragment), SamplerBindingLayout()) ) ) ) val bindGroup = device.createBindGroup( - desc = BindGroupDescriptor( bindGroupLayout, - listOf(BindGroupEntry(0, textureView), BindGroupEntry(1, sampler)) + listOf( + BindGroupEntry(0, TextureViewBinding(textureView)), + BindGroupEntry(1, SamplerBinding(sampler)) + ) ) ) - val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(bindGroupLayout)) + val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor(listOf(bindGroupLayout))) val renderPipelineDesc = RenderPipelineDescriptor( layout = pipelineLayout, vertex = - VertexState( - module = shader, - entryPoint = "vs_main", - WebGPUVertexBufferLayout( + VertexState( + module = shader, + entryPoint = "vs_main", + buffers = listOf( + VertexBufferLayout( 4L * Float.SIZE_BYTES, - VertexStepMode.VERTEX, listOf( - WebGPUVertexAttribute(VertexFormat.FLOAT32x2, 0, 0), - WebGPUVertexAttribute( - VertexFormat.FLOAT32x2, + VertexAttribute(VertexFormat.float32x2, 0, 0), + VertexAttribute( + VertexFormat.float32x2, 2L * Float.SIZE_BYTES, 1 ) - ) + ), + VertexStepMode.vertex, ) - ), + ) + ), fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.NonPreMultiplied, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + FragmentState( + module = shader, + entryPoint = "fs_main", + targets = + listOf( + ColorTargetState( + format = preferredFormat, + blend = BlendStates.NonPreMultiplied, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) val renderPipeline = device.createRenderPipeline(renderPipelineDesc) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) logger.info { "getCurrentTexture status=$status" } return@onUpdate @@ -199,14 +237,13 @@ class TextureViaCommandEncoderExample(context: Context) : ContextListener(contex val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = Color.CLEAR + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.CLEAR.toWebGPUColor() ) ) ) @@ -214,34 +251,33 @@ class TextureViaCommandEncoderExample(context: Context) : ContextListener(contex renderPassEncoder.setPipeline(renderPipeline) renderPassEncoder.setBindGroup(0, bindGroup) renderPassEncoder.setVertexBuffer(0, vbo) - renderPassEncoder.setIndexBuffer(ibo, IndexFormat.UINT16) + renderPassEncoder.setIndexBuffer(ibo, IndexFormat.uint16) renderPassEncoder.drawIndexed(indices.size, 1) renderPassEncoder.end() val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - bindGroup.release() - bindGroupLayout.release() - sampler.release() - textureView.release() - texture.release() - ibo.release() - vbo.release() - texture.release() - shader.release() + renderPipeline.close() + pipelineLayout.close() + bindGroup.close() + bindGroupLayout.close() + sampler.close() + textureView.close() + texture.close() + ibo.close() + vbo.close() + texture.close() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TiledMeshExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TiledMeshExample.kt index 98ad0728f..911cd6d1a 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TiledMeshExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TiledMeshExample.kt @@ -4,12 +4,35 @@ import com.littlekt.Context import com.littlekt.ContextListener import com.littlekt.EngineStats import com.littlekt.file.FloatBuffer +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color import com.littlekt.graphics.OrthographicCamera +import com.littlekt.graphics.createGPUFloatBuffer import com.littlekt.graphics.textureIndexedMesh -import com.littlekt.graphics.webgpu.* import com.littlekt.math.Vec4f import com.littlekt.resources.Textures +import io.ygdrasil.wgpu.BindGroupDescriptor +import io.ygdrasil.wgpu.BindGroupDescriptor.* +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.SamplerBindingLayout +import io.ygdrasil.wgpu.BindGroupLayoutDescriptor.Entry.TextureBindingLayout +import io.ygdrasil.wgpu.BufferUsage +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.IndexFormat +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor.* +import io.ygdrasil.wgpu.RenderPipelineDescriptor.FragmentState.ColorTargetState +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.ShaderStage +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage import kotlin.random.Random /** @@ -111,11 +134,10 @@ class TiledMeshExample(context: Context) : ContextListener(context) { device.createGPUFloatBuffer( "camera uniform buffer", cameraFloatBuffer.toArray(), - BufferUsage.UNIFORM or BufferUsage.COPY_DST + setOf(BufferUsage.uniform, BufferUsage.copydst) ) - val shader = device.createShaderModule(textureShader) - val surfaceCapabilities = graphics.surfaceCapabilities + val shader = device.createShaderModule(ShaderModuleDescriptor(textureShader)) val preferredFormat = graphics.preferredFormat val queue = device.queue @@ -123,7 +145,7 @@ class TiledMeshExample(context: Context) : ContextListener(context) { val vertexGroupLayout = device.createBindGroupLayout( BindGroupLayoutDescriptor( - listOf(BindGroupLayoutEntry(0, ShaderStage.VERTEX, BufferBindingLayout())) + listOf(Entry(0, setOf(ShaderStage.vertex), Entry.BufferBindingLayout())) ) ) val vertexBindGroup = @@ -137,19 +159,18 @@ class TiledMeshExample(context: Context) : ContextListener(context) { device.createBindGroupLayout( BindGroupLayoutDescriptor( listOf( - BindGroupLayoutEntry(0, ShaderStage.FRAGMENT, TextureBindingLayout()), - BindGroupLayoutEntry(1, ShaderStage.FRAGMENT, SamplerBindingLayout()) + Entry(0, setOf(ShaderStage.fragment), TextureBindingLayout()), + Entry(1, setOf(ShaderStage.fragment), SamplerBindingLayout()) ) ) ) val fragmentBindGroup = device.createBindGroup( - desc = BindGroupDescriptor( fragmentGroupLayout, listOf( - BindGroupEntry(0, Textures.white.texture.view), - BindGroupEntry(1, Textures.white.texture.sampler) + BindGroupEntry(0, TextureViewBinding(Textures.white.texture.view)), + BindGroupEntry(1, SamplerBinding(Textures.white.texture.sampler)) ) ) ) @@ -161,43 +182,44 @@ class TiledMeshExample(context: Context) : ContextListener(context) { RenderPipelineDescriptor( layout = pipelineLayout, vertex = - VertexState( - module = shader, - entryPoint = "vs_main", - mesh.geometry.layout.gpuVertexBufferLayout - ), + VertexState( + module = shader, + entryPoint = "vs_main", + buffers = listOf(mesh.geometry.layout.gpuVertexBufferLayout) + ), fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.NonPreMultiplied, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + RenderPipelineDescriptor.FragmentState( + module = shader, + entryPoint = "fs_main", + targets = + listOf( + ColorTargetState( + format = preferredFormat, + blend = BlendStates.NonPreMultiplied, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, - multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + multisample = MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) val renderPipeline = device.createRenderPipeline(renderPipelineDesc) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onResize { width, height -> camera.ortho(width, height) camera.translate(0f, height * 2f, 0f) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -205,13 +227,13 @@ class TiledMeshExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -224,7 +246,7 @@ class TiledMeshExample(context: Context) : ContextListener(context) { } camera.update() camera.viewProjection.toBuffer(cameraFloatBuffer) - device.queue.writeBuffer(cameraUniformBuffer, cameraFloatBuffer) + device.queue.writeBuffer(cameraUniformBuffer, 0L, cameraFloatBuffer.toArray()) val swapChainTexture = checkNotNull(surfaceTexture.texture) val frame = swapChainTexture.createView() @@ -232,16 +254,13 @@ class TiledMeshExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = - if (preferredFormat.srgb) Color.DARK_GRAY.toLinear() - else Color.DARK_GRAY + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.DARK_GRAY.toWebGPUColor() ) ) ) @@ -250,30 +269,29 @@ class TiledMeshExample(context: Context) : ContextListener(context) { renderPassEncoder.setBindGroup(0, vertexBindGroup) renderPassEncoder.setBindGroup(1, fragmentBindGroup) renderPassEncoder.setVertexBuffer(0, mesh.vbo) - renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.UINT16) + renderPassEncoder.setIndexBuffer(mesh.ibo, IndexFormat.uint16) EngineStats.extra("Quads", totalQuads) renderPassEncoder.drawIndexed(totalQuads * 6, 1) renderPassEncoder.end() val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - fragmentBindGroup.release() - fragmentGroupLayout.release() + renderPipeline.close() + pipelineLayout.close() + fragmentBindGroup.close() + fragmentGroupLayout.close() mesh.release() - shader.release() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapCacheExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapCacheExample.kt index 0789b86bd..16eae5fd2 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapCacheExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapCacheExample.kt @@ -5,8 +5,13 @@ import com.littlekt.ContextListener import com.littlekt.file.vfs.readTiledMap import com.littlekt.graphics.Color import com.littlekt.graphics.g2d.SpriteCache -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * Load and render a Tiled map using a [SpriteCache]. @@ -22,32 +27,28 @@ class TiledTileMapCacheExample(context: Context) : ContextListener(context) { val device = graphics.device val map = resourcesVfs["tiled/ortho-tiled-world.tmj"].readTiledMap() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val cache = SpriteCache(device, preferredFormat) map.addToCache(cache, 0f, 0f, 1 / 8f) val viewport = ExtendViewport(30, 16) val camera = viewport.camera - var bgColor = map.backgroundColor ?: Color.DARK_GRAY - if (preferredFormat.srgb) { - bgColor = bgColor.toLinear() - } + val bgColor = map.backgroundColor ?: Color.DARK_GRAY onResize { width, height -> viewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -55,13 +56,13 @@ class TiledTileMapCacheExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -78,14 +79,13 @@ class TiledTileMapCacheExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = bgColor + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = bgColor.toWebGPUColor() ) ) ) @@ -97,14 +97,13 @@ class TiledTileMapCacheExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapExample.kt index 1020dfce5..451b16238 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TiledTileMapExample.kt @@ -7,8 +7,13 @@ import com.littlekt.graphics.Color import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.g2d.shape.ShapeRenderer import com.littlekt.graphics.g2d.use -import com.littlekt.graphics.webgpu.* import com.littlekt.util.viewport.ExtendViewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * Load and render a Tiled map. @@ -24,32 +29,28 @@ class TiledTileMapExample(context: Context) : ContextListener(context) { val device = graphics.device val map = resourcesVfs["tiled/ortho-tiled-world.tmj"].readTiledMap() - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) val batch = SpriteBatch(device, graphics, preferredFormat, 2000) val shapeRenderer = ShapeRenderer(batch) val viewport = ExtendViewport(30, 16) val camera = viewport.camera - var bgColor = map.backgroundColor ?: Color.DARK_GRAY - if (preferredFormat.srgb) { - bgColor = bgColor.toLinear() - } + val bgColor = map.backgroundColor ?: Color.DARK_GRAY onResize { width, height -> viewport.update(width, height) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) } @@ -57,13 +58,13 @@ class TiledTileMapExample(context: Context) : ContextListener(context) { onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() logger.info { "getCurrentTexture status=$status" } return@onUpdate } @@ -80,14 +81,13 @@ class TiledTileMapExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = bgColor + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = bgColor.toWebGPUColor() ) ) ) @@ -108,14 +108,13 @@ class TiledTileMapExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - device.queue.submit(commandBuffer) + device.queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - swapChainTexture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + swapChainTexture.close() } onRelease { diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/TriangleExample.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/TriangleExample.kt index 18262c7ab..73f68ff36 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/TriangleExample.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/TriangleExample.kt @@ -2,8 +2,19 @@ package com.littlekt.examples import com.littlekt.Context import com.littlekt.ContextListener +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.Color -import com.littlekt.graphics.webgpu.* +import io.ygdrasil.wgpu.ColorWriteMask +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.PipelineLayoutDescriptor +import io.ygdrasil.wgpu.PresentMode +import io.ygdrasil.wgpu.PrimitiveTopology +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPipelineDescriptor +import io.ygdrasil.wgpu.ShaderModuleDescriptor +import io.ygdrasil.wgpu.StoreOp +import io.ygdrasil.wgpu.SurfaceTextureStatus +import io.ygdrasil.wgpu.TextureUsage /** * An example rendering a simple triangle in pure WebGPU. @@ -33,53 +44,53 @@ class TriangleExample(context: Context) : ContextListener(context) { addStatsHandler() val device = graphics.device val queue = device.queue - val shader = device.createShaderModule(shaderSrc) + val shader = device.createShaderModule(ShaderModuleDescriptor(shaderSrc)) val pipelineLayout = device.createPipelineLayout(PipelineLayoutDescriptor()) - val surfaceCapabilities = graphics.surfaceCapabilities val preferredFormat = graphics.preferredFormat val renderPipelineDesc = RenderPipelineDescriptor( layout = pipelineLayout, - vertex = VertexState(module = shader, entryPoint = "vs_main"), + vertex = RenderPipelineDescriptor.VertexState(module = shader, entryPoint = "vs_main"), fragment = - FragmentState( - module = shader, - entryPoint = "fs_main", - target = - ColorTargetState( - format = preferredFormat, - blendState = BlendState.Opaque, - writeMask = ColorWriteMask.ALL - ) - ), - primitive = PrimitiveState(topology = PrimitiveTopology.TRIANGLE_LIST), + RenderPipelineDescriptor.FragmentState( + module = shader, + entryPoint = "fs_main", + targets = listOf( + RenderPipelineDescriptor.FragmentState.ColorTargetState( + format = preferredFormat, + blend = BlendStates.Opaque, + writeMask = ColorWriteMask.all + ) + ) + ), + primitive = RenderPipelineDescriptor.PrimitiveState(topology = PrimitiveTopology.triangleList), depthStencil = null, multisample = - MultisampleState(count = 1, mask = 0xFFFFFFF, alphaToCoverageEnabled = false) + RenderPipelineDescriptor.MultisampleState(count = 1, mask = 0xFFFFFFFu, alphaToCoverageEnabled = false) ) val renderPipeline = device.createRenderPipeline(renderPipelineDesc) graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) onUpdate { val surfaceTexture = graphics.surface.getCurrentTexture() when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() graphics.configureSurface( - TextureUsage.RENDER_ATTACHMENT, + setOf(TextureUsage.renderAttachment), preferredFormat, - PresentMode.FIFO, - surfaceCapabilities.alphaModes[0] + PresentMode.fifo, + graphics.surface.supportedAlphaMode.first() ) logger.info { "getCurrentTexture status=$status" } return@onUpdate @@ -96,14 +107,13 @@ class TriangleExample(context: Context) : ContextListener(context) { val commandEncoder = device.createCommandEncoder() val renderPassEncoder = commandEncoder.beginRenderPass( - desc = RenderPassDescriptor( listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = frame, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = Color.CLEAR + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = Color.CLEAR.toWebGPUColor() ) ) ) @@ -114,20 +124,19 @@ class TriangleExample(context: Context) : ContextListener(context) { val commandBuffer = commandEncoder.finish() - queue.submit(commandBuffer) + queue.submit(listOf(commandBuffer)) graphics.surface.present() - commandBuffer.release() - renderPassEncoder.release() - commandEncoder.release() - frame.release() - texture.release() + commandBuffer.close() + commandEncoder.close() + frame.close() + texture.close() } onRelease { - renderPipeline.release() - pipelineLayout.release() - shader.release() + renderPipeline.close() + pipelineLayout.close() + shader.close() } } } diff --git a/examples/src/commonMain/kotlin/com/littlekt/examples/utils.kt b/examples/src/commonMain/kotlin/com/littlekt/examples/utils.kt index 5b78de70a..ac8dfc256 100644 --- a/examples/src/commonMain/kotlin/com/littlekt/examples/utils.kt +++ b/examples/src/commonMain/kotlin/com/littlekt/examples/utils.kt @@ -2,22 +2,22 @@ package com.littlekt.examples import com.littlekt.Context import com.littlekt.graphics.Camera -import com.littlekt.graphics.webgpu.SurfaceConfiguration -import com.littlekt.graphics.webgpu.SurfaceTexture -import com.littlekt.graphics.webgpu.TextureStatus import com.littlekt.input.Key import com.littlekt.util.milliseconds +import io.ygdrasil.wgpu.SurfaceTexture +import io.ygdrasil.wgpu.SurfaceConfiguration +import io.ygdrasil.wgpu.SurfaceTextureStatus fun SurfaceTexture.isValid(context: Context, onConfigure: () -> SurfaceConfiguration): Boolean { val surfaceTexture = this when (val status = surfaceTexture.status) { - TextureStatus.SUCCESS -> { + SurfaceTextureStatus.success -> { // all good, could check for `surfaceTexture.suboptimal` here. } - TextureStatus.TIMEOUT, - TextureStatus.OUTDATED, - TextureStatus.LOST -> { - surfaceTexture.texture?.release() + SurfaceTextureStatus.timeout, + SurfaceTextureStatus.outdated, + SurfaceTextureStatus.lost -> { + surfaceTexture.texture.close() context.graphics.surface.configure(onConfigure()) context.logger.info { "getCurrentTexture status=$status" } return false diff --git a/extensions/gradle/texturepacker/build.gradle.kts b/extensions/gradle/texturepacker/build.gradle.kts index a6769ce51..33d06734d 100644 --- a/extensions/gradle/texturepacker/build.gradle.kts +++ b/extensions/gradle/texturepacker/build.gradle.kts @@ -13,8 +13,6 @@ version = littleKtVersion java { withSourcesJar() } -repositories { gradlePluginPortal() } - dependencies { implementation(kotlin("gradle-plugin")) implementation(project(":extensions:tools")) { diff --git a/extensions/tools/build.gradle.kts b/extensions/tools/build.gradle.kts index 09cda4ae2..9cc4e9c64 100644 --- a/extensions/tools/build.gradle.kts +++ b/extensions/tools/build.gradle.kts @@ -7,8 +7,6 @@ plugins { id("module.publication") } -repositories { mavenCentral() } - kotlin { jvm { compilations.all { kotlinOptions.jvmTarget = "11" } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a484da00f..56efc9566 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,15 @@ [versions] download-gradle = "5.6.0" +wgpu4k = "0.0.0-SNAPSHOT" kotlin = "2.0.0" +rococoa = "0.0.1" kotlinxHtmlVersion = "0.11.0" kotlinx-atomicfu = "0.24.0" kotlinx-coroutines = "1.9.0-RC" kotlinx-serialization = "1.7.0" lwjgl = "3.3.3" mp3-decoder = "1.0.1" +jna = "5.14.0" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } @@ -19,6 +22,10 @@ lwjgl-glfw = { module = "org.lwjgl:lwjgl-glfw", version.ref = "lwjgl" } lwjgl-openal = { module = "org.lwjgl:lwjgl-openal", version.ref = "lwjgl" } lwjgl-stb = { module = "org.lwjgl:lwjgl-stb", version.ref = "lwjgl" } mp3-decoder = { module = "fr.delthas:javamp3", version.ref = "mp3-decoder" } +wgpu4k = { module = "io.ygdrasil:wgpu4k", version.ref = "wgpu4k" } +rococoa = { module = "io.ygdrasil:rococoa", version.ref = "rococoa" } +jnaPlatform = { module = "net.java.dev.jna:jna-platform", version.ref = "jna" } + [plugins] download = { id = "de.undercouch.download", version.ref = "download-gradle" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 20db9ad5c..171d8761b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/scene-graph/build.gradle.kts b/scene-graph/build.gradle.kts index 3d3a557dc..21c60f594 100644 --- a/scene-graph/build.gradle.kts +++ b/scene-graph/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType @@ -7,11 +9,11 @@ plugins { } kotlin { - tasks.withType { jvmArgs("--enable-preview", "--enable-native-access=ALL-UNNAMED") } + tasks.withType { jvmArgs("--enable-native-access=ALL-UNNAMED") } jvm { - compilations.all { - kotlinOptions.jvmTarget = "11" - compileJavaTaskProvider?.get()?.options?.compilerArgs?.add("--enable-preview") + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + jvmTarget = JvmTarget.JVM_22 } } js(KotlinJsCompilerType.IR) { diff --git a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/SceneGraph.kt b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/SceneGraph.kt index 13b86c95a..2a74ea4fc 100644 --- a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/SceneGraph.kt +++ b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/SceneGraph.kt @@ -7,12 +7,12 @@ import com.littlekt.graph.node.annotation.SceneGraphDslMarker import com.littlekt.graph.node.render.Material import com.littlekt.graph.node.resource.InputEvent import com.littlekt.graph.node.ui.Control +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.OrthographicCamera import com.littlekt.graphics.g2d.Batch import com.littlekt.graphics.g2d.SpriteBatch import com.littlekt.graphics.g2d.TextureSlice import com.littlekt.graphics.g2d.shape.ShapeRenderer -import com.littlekt.graphics.webgpu.* import com.littlekt.input.* import com.littlekt.math.MutableVec2f import com.littlekt.resources.Textures @@ -22,6 +22,8 @@ import com.littlekt.util.milliseconds import com.littlekt.util.seconds import com.littlekt.util.viewport.ScreenViewport import com.littlekt.util.viewport.Viewport +import io.ygdrasil.wgpu.CommandEncoder +import io.ygdrasil.wgpu.RenderPassDescriptor import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -376,7 +378,7 @@ open class SceneGraph( } protected fun flush() { - batch.setBlendState(BlendState.NonPreMultiplied) + batch.setBlendState(BlendStates.NonPreMultiplied) batch.useDefaultShader() commandEncoder = null diff --git a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/CanvasLayer.kt b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/CanvasLayer.kt index 1b58767cd..6039e0ab6 100644 --- a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/CanvasLayer.kt +++ b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/CanvasLayer.kt @@ -12,13 +12,16 @@ import com.littlekt.graphics.g2d.Batch import com.littlekt.graphics.g2d.SpriteBatchShader import com.littlekt.graphics.g2d.shape.ShapeRenderer import com.littlekt.graphics.shader.Shader -import com.littlekt.graphics.webgpu.* import com.littlekt.log.Logger import com.littlekt.math.Mat4 import com.littlekt.math.MutableVec2f import com.littlekt.math.MutableVec3f import com.littlekt.util.viewport.ScreenViewport import com.littlekt.util.viewport.Viewport +import io.ygdrasil.wgpu.LoadOp +import io.ygdrasil.wgpu.RenderPassDescriptor +import io.ygdrasil.wgpu.RenderPassEncoder +import io.ygdrasil.wgpu.StoreOp import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -266,11 +269,11 @@ open class CanvasLayer : Node() { RenderPassDescriptor( colorAttachments = listOf( - RenderPassColorAttachmentDescriptor( + RenderPassDescriptor.ColorAttachment( view = fbo.view, - loadOp = LoadOp.CLEAR, - storeOp = StoreOp.STORE, - clearColor = clearColor + loadOp = LoadOp.clear, + storeOp = StoreOp.store, + clearValue = clearColor.toWebGPUColor() ) ), label = "Canvas Layer Pass" @@ -423,7 +426,6 @@ open class CanvasLayer : Node() { } renderPasses.forEach { it.end() - it.release() } } renderPasses.clear() @@ -434,7 +436,6 @@ open class CanvasLayer : Node() { onSizeChanged.clear() fbo.release() _spriteShader?.release() - renderPasses.forEach { it.release() } } /** @@ -465,19 +466,19 @@ open class CanvasLayer : Node() { * previous render pass. This assumes multiple render passes in a single command pass. Hence, * the default descriptor will automatically default the previous render passes * [RenderPassDescriptor] while also setting the color attachments - * [RenderPassColorAttachmentDescriptor.loadOp] to [LoadOp.LOAD]. You are responsible for + * [RenderPassDescriptor.ColorAttachment.loadOp] to [LoadOp.load]. You are responsible for * calling [popAndEndRenderPass] with this new render pass, as this a helper method to create * one. * * @param label a label for the render pass - * @param descriptor the default descriptor assumes the color attachments to use [LoadOp.LOAD]. + * @param descriptor the default descriptor assumes the color attachments to use [LoadOp.load]. * @return the newly created [RenderPassEncoder]. */ fun pushRenderPass( label: String? = null, descriptor: RenderPassDescriptor = run { val initDesc = renderPassDescriptor - val colorAttachments = initDesc.colorAttachments.map { it.copy(loadOp = LoadOp.LOAD) } + val colorAttachments = initDesc.colorAttachments.map { it.copy(loadOp = LoadOp.load) } initDesc.copy(colorAttachments = colorAttachments, label = label) } ) { @@ -498,7 +499,6 @@ open class CanvasLayer : Node() { if (renderPasses.isNotEmpty()) { val removed = renderPasses.removeLast() removed.end() - removed.release() renderPassOrNull = null if (renderPasses.isNotEmpty()) { renderPassOrNull = renderPasses.last() diff --git a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/Node.kt b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/Node.kt index 4afc6c574..40d708579 100644 --- a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/Node.kt +++ b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/Node.kt @@ -10,8 +10,8 @@ import com.littlekt.graph.util.* import com.littlekt.graphics.Camera import com.littlekt.graphics.g2d.Batch import com.littlekt.graphics.g2d.shape.ShapeRenderer -import com.littlekt.graphics.webgpu.RenderPassEncoder import com.littlekt.util.datastructure.fastForEach +import io.ygdrasil.wgpu.RenderPassEncoder import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/render/Material.kt b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/render/Material.kt index a8d2d0063..f41d44d0e 100644 --- a/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/render/Material.kt +++ b/scene-graph/src/commonMain/kotlin/com/littlekt/graph/node/render/Material.kt @@ -1,8 +1,9 @@ package com.littlekt.graph.node.render import com.littlekt.Releasable +import com.littlekt.graphics.BlendStates import com.littlekt.graphics.shader.Shader -import com.littlekt.graphics.webgpu.BlendState +import io.ygdrasil.wgpu.RenderPipelineDescriptor /** * @author Colton Daily @@ -13,7 +14,7 @@ open class Material( val shader: Shader? = null, ) : Releasable { /** The [BlendState] this material uses. Defaults to [BlendState.NonPreMultiplied]. */ - var blendMode: BlendState = BlendState.NonPreMultiplied + var blendMode: RenderPipelineDescriptor.FragmentState.ColorTargetState.BlendState = BlendStates.NonPreMultiplied /** Can be used to set shader uniforms and such right before rendering. */ open fun onPreRender() = Unit diff --git a/settings.gradle.kts b/settings.gradle.kts index 8f94d61fc..22c40ac9e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -11,8 +11,12 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" dependencyResolutionManagement { repositories { + //mavenLocal() google() mavenCentral() + //wgpu4k snapshot & preview repository + maven("https://gitlab.com/api/v4/projects/25805863/packages/maven") + maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") } } @@ -20,10 +24,6 @@ rootProject.name = "littlekt" include(":core") -include("wgpu-natives") - -include("wgpu-ffm") - include("examples") include("scene-graph") diff --git a/wgpu-ffm/README.md b/wgpu-ffm/README.md deleted file mode 100644 index 1ccd242d8..000000000 --- a/wgpu-ffm/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# LittleKt WebGPU Java FFM bindings - -### Command: - -**JDK22: cmd.exe** - -`jextract -t com.littlekt.wgpu --output ./wgpuj/src/main/java --header-class-name WGPU wgpu-natives/src/main/c/wgpu.h` \ No newline at end of file diff --git a/wgpu-ffm/build.gradle.kts b/wgpu-ffm/build.gradle.kts deleted file mode 100644 index f49afb7b4..000000000 --- a/wgpu-ffm/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id("java-library") - id("module.publication") -} - -tasks.withType { jvmArgs("--enable-preview") } - -tasks.withType { options.compilerArgs.add("--enable-preview") } - -java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 - withSourcesJar() -} - -publishing { publications { create("wgpu-ffm") { from(components["java"]) } } } diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPU.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPU.java deleted file mode 100644 index 075bc68c5..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPU.java +++ /dev/null @@ -1,17145 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -public class WGPU { - - WGPU() { - // Should not be called directly - } - - static final Arena LIBRARY_ARENA = Arena.ofAuto(); - static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); - - static void traceDowncall(String name, Object... args) { - String traceArgs = Arrays.stream(args) - .map(Object::toString) - .collect(Collectors.joining(", ")); - System.out.printf("%s(%s)\n", name, traceArgs); - } - - static MemorySegment findOrThrow(String symbol) { - return SYMBOL_LOOKUP.find(symbol) - .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); - } catch (ReflectiveOperationException ex) { - throw new AssertionError(ex); - } - } - - static MemoryLayout align(MemoryLayout layout, long align) { - return switch (layout) { - case PaddingLayout p -> p; - case ValueLayout v -> v.withByteAlignment(align); - case GroupLayout g -> { - MemoryLayout[] alignedMembers = g.memberLayouts().stream() - .map(m -> align(m, align)).toArray(MemoryLayout[]::new); - yield g instanceof StructLayout ? - MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); - } - case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); - }; - } - - static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() - .or(Linker.nativeLinker().defaultLookup()); - - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; - public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; - public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; - public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; - public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; - public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; - public static final AddressLayout C_POINTER = ValueLayout.ADDRESS - .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); - public static final ValueLayout.OfInt C_LONG = ValueLayout.JAVA_INT; - public static final ValueLayout.OfDouble C_LONG_DOUBLE = ValueLayout.JAVA_DOUBLE; - private static final int _VCRT_COMPILER_PREPROCESSOR = (int)1L; - /** - * {@snippet lang=c : - * #define _VCRT_COMPILER_PREPROCESSOR 1 - * } - */ - public static int _VCRT_COMPILER_PREPROCESSOR() { - return _VCRT_COMPILER_PREPROCESSOR; - } - private static final int _SAL_VERSION = (int)20L; - /** - * {@snippet lang=c : - * #define _SAL_VERSION 20 - * } - */ - public static int _SAL_VERSION() { - return _SAL_VERSION; - } - private static final int __SAL_H_VERSION = (int)180000000L; - /** - * {@snippet lang=c : - * #define __SAL_H_VERSION 180000000 - * } - */ - public static int __SAL_H_VERSION() { - return __SAL_H_VERSION; - } - private static final int _USE_DECLSPECS_FOR_SAL = (int)0L; - /** - * {@snippet lang=c : - * #define _USE_DECLSPECS_FOR_SAL 0 - * } - */ - public static int _USE_DECLSPECS_FOR_SAL() { - return _USE_DECLSPECS_FOR_SAL; - } - private static final int _USE_ATTRIBUTES_FOR_SAL = (int)0L; - /** - * {@snippet lang=c : - * #define _USE_ATTRIBUTES_FOR_SAL 0 - * } - */ - public static int _USE_ATTRIBUTES_FOR_SAL() { - return _USE_ATTRIBUTES_FOR_SAL; - } - private static final int _CRT_PACKING = (int)8L; - /** - * {@snippet lang=c : - * #define _CRT_PACKING 8 - * } - */ - public static int _CRT_PACKING() { - return _CRT_PACKING; - } - private static final int _HAS_EXCEPTIONS = (int)1L; - /** - * {@snippet lang=c : - * #define _HAS_EXCEPTIONS 1 - * } - */ - public static int _HAS_EXCEPTIONS() { - return _HAS_EXCEPTIONS; - } - private static final int _HAS_CXX17 = (int)0L; - /** - * {@snippet lang=c : - * #define _HAS_CXX17 0 - * } - */ - public static int _HAS_CXX17() { - return _HAS_CXX17; - } - private static final int _HAS_CXX20 = (int)0L; - /** - * {@snippet lang=c : - * #define _HAS_CXX20 0 - * } - */ - public static int _HAS_CXX20() { - return _HAS_CXX20; - } - private static final int _HAS_NODISCARD = (int)0L; - /** - * {@snippet lang=c : - * #define _HAS_NODISCARD 0 - * } - */ - public static int _HAS_NODISCARD() { - return _HAS_NODISCARD; - } - private static final int WCHAR_MIN = (int)0L; - /** - * {@snippet lang=c : - * #define WCHAR_MIN 0 - * } - */ - public static int WCHAR_MIN() { - return WCHAR_MIN; - } - private static final int WCHAR_MAX = (int)65535L; - /** - * {@snippet lang=c : - * #define WCHAR_MAX 65535 - * } - */ - public static int WCHAR_MAX() { - return WCHAR_MAX; - } - private static final int WINT_MIN = (int)0L; - /** - * {@snippet lang=c : - * #define WINT_MIN 0 - * } - */ - public static int WINT_MIN() { - return WINT_MIN; - } - private static final int WINT_MAX = (int)65535L; - /** - * {@snippet lang=c : - * #define WINT_MAX 65535 - * } - */ - public static int WINT_MAX() { - return WINT_MAX; - } - /** - * {@snippet lang=c : - * typedef unsigned long long uintptr_t - * } - */ - public static final OfLong uintptr_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef char *va_list - * } - */ - public static final AddressLayout va_list = WGPU.C_POINTER; - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * void __va_start(va_list *, ...) - * } - */ - public static class __va_start { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - private static final MemorySegment ADDR = WGPU.findOrThrow("__va_start"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private __va_start(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * void __va_start(va_list *, ...) - * } - */ - public static __va_start makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new __va_start(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public void apply(MemorySegment x0, Object... x1) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__va_start", x0, x1); - } - spreader.invokeExact(x0, x1); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - /** - * {@snippet lang=c : - * typedef unsigned long long size_t - * } - */ - public static final OfLong size_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef long long ptrdiff_t - * } - */ - public static final OfLong ptrdiff_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef long long intptr_t - * } - */ - public static final OfLong intptr_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef _Bool __vcrt_bool - * } - */ - public static final OfBoolean __vcrt_bool = WGPU.C_BOOL; - /** - * {@snippet lang=c : - * typedef unsigned short wchar_t - * } - */ - public static final OfShort wchar_t = WGPU.C_SHORT; - - private static class __security_init_cookie { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("__security_init_cookie"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void __security_init_cookie() - * } - */ - public static FunctionDescriptor __security_init_cookie$descriptor() { - return __security_init_cookie.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void __security_init_cookie() - * } - */ - public static MethodHandle __security_init_cookie$handle() { - return __security_init_cookie.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void __security_init_cookie() - * } - */ - public static MemorySegment __security_init_cookie$address() { - return __security_init_cookie.ADDR; - } - - /** - * {@snippet lang=c : - * void __security_init_cookie() - * } - */ - public static void __security_init_cookie() { - var mh$ = __security_init_cookie.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__security_init_cookie"); - } - mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __security_check_cookie { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("__security_check_cookie"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void __security_check_cookie(uintptr_t _StackCookie) - * } - */ - public static FunctionDescriptor __security_check_cookie$descriptor() { - return __security_check_cookie.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void __security_check_cookie(uintptr_t _StackCookie) - * } - */ - public static MethodHandle __security_check_cookie$handle() { - return __security_check_cookie.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void __security_check_cookie(uintptr_t _StackCookie) - * } - */ - public static MemorySegment __security_check_cookie$address() { - return __security_check_cookie.ADDR; - } - - /** - * {@snippet lang=c : - * void __security_check_cookie(uintptr_t _StackCookie) - * } - */ - public static void __security_check_cookie(long _StackCookie) { - var mh$ = __security_check_cookie.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__security_check_cookie", _StackCookie); - } - mh$.invokeExact(_StackCookie); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __report_gsfailure { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("__report_gsfailure"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void __report_gsfailure(uintptr_t _StackCookie) - * } - */ - public static FunctionDescriptor __report_gsfailure$descriptor() { - return __report_gsfailure.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void __report_gsfailure(uintptr_t _StackCookie) - * } - */ - public static MethodHandle __report_gsfailure$handle() { - return __report_gsfailure.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void __report_gsfailure(uintptr_t _StackCookie) - * } - */ - public static MemorySegment __report_gsfailure$address() { - return __report_gsfailure.ADDR; - } - - /** - * {@snippet lang=c : - * void __report_gsfailure(uintptr_t _StackCookie) - * } - */ - public static void __report_gsfailure(long _StackCookie) { - var mh$ = __report_gsfailure.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__report_gsfailure", _StackCookie); - } - mh$.invokeExact(_StackCookie); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __security_cookie$constants { - public static final OfLong LAYOUT = WGPU.C_LONG_LONG; - public static final MemorySegment SEGMENT = WGPU.findOrThrow("__security_cookie").reinterpret(LAYOUT.byteSize()); - } - - /** - * Layout for variable: - * {@snippet lang=c : - * extern uintptr_t __security_cookie - * } - */ - public static OfLong __security_cookie$layout() { - return __security_cookie$constants.LAYOUT; - } - - /** - * Segment for variable: - * {@snippet lang=c : - * extern uintptr_t __security_cookie - * } - */ - public static MemorySegment __security_cookie$segment() { - return __security_cookie$constants.SEGMENT; - } - - /** - * Getter for variable: - * {@snippet lang=c : - * extern uintptr_t __security_cookie - * } - */ - public static long __security_cookie() { - return __security_cookie$constants.SEGMENT.get(__security_cookie$constants.LAYOUT, 0L); - } - - /** - * Setter for variable: - * {@snippet lang=c : - * extern uintptr_t __security_cookie - * } - */ - public static void __security_cookie(long varValue) { - __security_cookie$constants.SEGMENT.set(__security_cookie$constants.LAYOUT, 0L, varValue); - } - /** - * {@snippet lang=c : - * typedef signed char int8_t - * } - */ - public static final OfByte int8_t = WGPU.C_CHAR; - /** - * {@snippet lang=c : - * typedef short int16_t - * } - */ - public static final OfShort int16_t = WGPU.C_SHORT; - /** - * {@snippet lang=c : - * typedef int int32_t - * } - */ - public static final OfInt int32_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef long long int64_t - * } - */ - public static final OfLong int64_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned char uint8_t - * } - */ - public static final OfByte uint8_t = WGPU.C_CHAR; - /** - * {@snippet lang=c : - * typedef unsigned short uint16_t - * } - */ - public static final OfShort uint16_t = WGPU.C_SHORT; - /** - * {@snippet lang=c : - * typedef unsigned int uint32_t - * } - */ - public static final OfInt uint32_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long long uint64_t - * } - */ - public static final OfLong uint64_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef signed char int_least8_t - * } - */ - public static final OfByte int_least8_t = WGPU.C_CHAR; - /** - * {@snippet lang=c : - * typedef short int_least16_t - * } - */ - public static final OfShort int_least16_t = WGPU.C_SHORT; - /** - * {@snippet lang=c : - * typedef int int_least32_t - * } - */ - public static final OfInt int_least32_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef long long int_least64_t - * } - */ - public static final OfLong int_least64_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned char uint_least8_t - * } - */ - public static final OfByte uint_least8_t = WGPU.C_CHAR; - /** - * {@snippet lang=c : - * typedef unsigned short uint_least16_t - * } - */ - public static final OfShort uint_least16_t = WGPU.C_SHORT; - /** - * {@snippet lang=c : - * typedef unsigned int uint_least32_t - * } - */ - public static final OfInt uint_least32_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long long uint_least64_t - * } - */ - public static final OfLong uint_least64_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef signed char int_fast8_t - * } - */ - public static final OfByte int_fast8_t = WGPU.C_CHAR; - /** - * {@snippet lang=c : - * typedef int int_fast16_t - * } - */ - public static final OfInt int_fast16_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef int int_fast32_t - * } - */ - public static final OfInt int_fast32_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef long long int_fast64_t - * } - */ - public static final OfLong int_fast64_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned char uint_fast8_t - * } - */ - public static final OfByte uint_fast8_t = WGPU.C_CHAR; - /** - * {@snippet lang=c : - * typedef unsigned int uint_fast16_t - * } - */ - public static final OfInt uint_fast16_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned int uint_fast32_t - * } - */ - public static final OfInt uint_fast32_t = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long long uint_fast64_t - * } - */ - public static final OfLong uint_fast64_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef long long intmax_t - * } - */ - public static final OfLong intmax_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long long uintmax_t - * } - */ - public static final OfLong uintmax_t = WGPU.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef double max_align_t - * } - */ - public static final OfDouble max_align_t = WGPU.C_DOUBLE; - /** - * {@snippet lang=c : - * typedef uint32_t WGPUFlags - * } - */ - public static final OfInt WGPUFlags = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef uint32_t WGPUBool - * } - */ - public static final OfInt WGPUBool = WGPU.C_INT; - /** - * {@snippet lang=c : - * typedef struct WGPUAdapterImpl *WGPUAdapter - * } - */ - public static final AddressLayout WGPUAdapter = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUBindGroupImpl *WGPUBindGroup - * } - */ - public static final AddressLayout WGPUBindGroup = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUBindGroupLayoutImpl *WGPUBindGroupLayout - * } - */ - public static final AddressLayout WGPUBindGroupLayout = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUBufferImpl *WGPUBuffer - * } - */ - public static final AddressLayout WGPUBuffer = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUCommandBufferImpl *WGPUCommandBuffer - * } - */ - public static final AddressLayout WGPUCommandBuffer = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUCommandEncoderImpl *WGPUCommandEncoder - * } - */ - public static final AddressLayout WGPUCommandEncoder = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUComputePassEncoderImpl *WGPUComputePassEncoder - * } - */ - public static final AddressLayout WGPUComputePassEncoder = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUComputePipelineImpl *WGPUComputePipeline - * } - */ - public static final AddressLayout WGPUComputePipeline = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUDeviceImpl *WGPUDevice - * } - */ - public static final AddressLayout WGPUDevice = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUInstanceImpl *WGPUInstance - * } - */ - public static final AddressLayout WGPUInstance = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUPipelineLayoutImpl *WGPUPipelineLayout - * } - */ - public static final AddressLayout WGPUPipelineLayout = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUQuerySetImpl *WGPUQuerySet - * } - */ - public static final AddressLayout WGPUQuerySet = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUQueueImpl *WGPUQueue - * } - */ - public static final AddressLayout WGPUQueue = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPURenderBundleImpl *WGPURenderBundle - * } - */ - public static final AddressLayout WGPURenderBundle = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPURenderBundleEncoderImpl *WGPURenderBundleEncoder - * } - */ - public static final AddressLayout WGPURenderBundleEncoder = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPURenderPassEncoderImpl *WGPURenderPassEncoder - * } - */ - public static final AddressLayout WGPURenderPassEncoder = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPURenderPipelineImpl *WGPURenderPipeline - * } - */ - public static final AddressLayout WGPURenderPipeline = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUSamplerImpl *WGPUSampler - * } - */ - public static final AddressLayout WGPUSampler = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUShaderModuleImpl *WGPUShaderModule - * } - */ - public static final AddressLayout WGPUShaderModule = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUSurfaceImpl *WGPUSurface - * } - */ - public static final AddressLayout WGPUSurface = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUTextureImpl *WGPUTexture - * } - */ - public static final AddressLayout WGPUTexture = WGPU.C_POINTER; - /** - * {@snippet lang=c : - * typedef struct WGPUTextureViewImpl *WGPUTextureView - * } - */ - public static final AddressLayout WGPUTextureView = WGPU.C_POINTER; - private static final int WGPUAdapterType_DiscreteGPU = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUAdapterType.WGPUAdapterType_DiscreteGPU = 0 - * } - */ - public static int WGPUAdapterType_DiscreteGPU() { - return WGPUAdapterType_DiscreteGPU; - } - private static final int WGPUAdapterType_IntegratedGPU = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUAdapterType.WGPUAdapterType_IntegratedGPU = 1 - * } - */ - public static int WGPUAdapterType_IntegratedGPU() { - return WGPUAdapterType_IntegratedGPU; - } - private static final int WGPUAdapterType_CPU = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUAdapterType.WGPUAdapterType_CPU = 2 - * } - */ - public static int WGPUAdapterType_CPU() { - return WGPUAdapterType_CPU; - } - private static final int WGPUAdapterType_Unknown = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUAdapterType.WGPUAdapterType_Unknown = 3 - * } - */ - public static int WGPUAdapterType_Unknown() { - return WGPUAdapterType_Unknown; - } - private static final int WGPUAdapterType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUAdapterType.WGPUAdapterType_Force32 = 2147483647 - * } - */ - public static int WGPUAdapterType_Force32() { - return WGPUAdapterType_Force32; - } - private static final int WGPUAddressMode_Repeat = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUAddressMode.WGPUAddressMode_Repeat = 0 - * } - */ - public static int WGPUAddressMode_Repeat() { - return WGPUAddressMode_Repeat; - } - private static final int WGPUAddressMode_MirrorRepeat = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUAddressMode.WGPUAddressMode_MirrorRepeat = 1 - * } - */ - public static int WGPUAddressMode_MirrorRepeat() { - return WGPUAddressMode_MirrorRepeat; - } - private static final int WGPUAddressMode_ClampToEdge = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUAddressMode.WGPUAddressMode_ClampToEdge = 2 - * } - */ - public static int WGPUAddressMode_ClampToEdge() { - return WGPUAddressMode_ClampToEdge; - } - private static final int WGPUAddressMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUAddressMode.WGPUAddressMode_Force32 = 2147483647 - * } - */ - public static int WGPUAddressMode_Force32() { - return WGPUAddressMode_Force32; - } - private static final int WGPUBackendType_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_Undefined = 0 - * } - */ - public static int WGPUBackendType_Undefined() { - return WGPUBackendType_Undefined; - } - private static final int WGPUBackendType_Null = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_Null = 1 - * } - */ - public static int WGPUBackendType_Null() { - return WGPUBackendType_Null; - } - private static final int WGPUBackendType_WebGPU = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_WebGPU = 2 - * } - */ - public static int WGPUBackendType_WebGPU() { - return WGPUBackendType_WebGPU; - } - private static final int WGPUBackendType_D3D11 = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_D3D11 = 3 - * } - */ - public static int WGPUBackendType_D3D11() { - return WGPUBackendType_D3D11; - } - private static final int WGPUBackendType_D3D12 = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_D3D12 = 4 - * } - */ - public static int WGPUBackendType_D3D12() { - return WGPUBackendType_D3D12; - } - private static final int WGPUBackendType_Metal = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_Metal = 5 - * } - */ - public static int WGPUBackendType_Metal() { - return WGPUBackendType_Metal; - } - private static final int WGPUBackendType_Vulkan = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_Vulkan = 6 - * } - */ - public static int WGPUBackendType_Vulkan() { - return WGPUBackendType_Vulkan; - } - private static final int WGPUBackendType_OpenGL = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_OpenGL = 7 - * } - */ - public static int WGPUBackendType_OpenGL() { - return WGPUBackendType_OpenGL; - } - private static final int WGPUBackendType_OpenGLES = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_OpenGLES = 8 - * } - */ - public static int WGPUBackendType_OpenGLES() { - return WGPUBackendType_OpenGLES; - } - private static final int WGPUBackendType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBackendType.WGPUBackendType_Force32 = 2147483647 - * } - */ - public static int WGPUBackendType_Force32() { - return WGPUBackendType_Force32; - } - private static final int WGPUBlendFactor_Zero = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_Zero = 0 - * } - */ - public static int WGPUBlendFactor_Zero() { - return WGPUBlendFactor_Zero; - } - private static final int WGPUBlendFactor_One = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_One = 1 - * } - */ - public static int WGPUBlendFactor_One() { - return WGPUBlendFactor_One; - } - private static final int WGPUBlendFactor_Src = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_Src = 2 - * } - */ - public static int WGPUBlendFactor_Src() { - return WGPUBlendFactor_Src; - } - private static final int WGPUBlendFactor_OneMinusSrc = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_OneMinusSrc = 3 - * } - */ - public static int WGPUBlendFactor_OneMinusSrc() { - return WGPUBlendFactor_OneMinusSrc; - } - private static final int WGPUBlendFactor_SrcAlpha = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_SrcAlpha = 4 - * } - */ - public static int WGPUBlendFactor_SrcAlpha() { - return WGPUBlendFactor_SrcAlpha; - } - private static final int WGPUBlendFactor_OneMinusSrcAlpha = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_OneMinusSrcAlpha = 5 - * } - */ - public static int WGPUBlendFactor_OneMinusSrcAlpha() { - return WGPUBlendFactor_OneMinusSrcAlpha; - } - private static final int WGPUBlendFactor_Dst = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_Dst = 6 - * } - */ - public static int WGPUBlendFactor_Dst() { - return WGPUBlendFactor_Dst; - } - private static final int WGPUBlendFactor_OneMinusDst = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_OneMinusDst = 7 - * } - */ - public static int WGPUBlendFactor_OneMinusDst() { - return WGPUBlendFactor_OneMinusDst; - } - private static final int WGPUBlendFactor_DstAlpha = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_DstAlpha = 8 - * } - */ - public static int WGPUBlendFactor_DstAlpha() { - return WGPUBlendFactor_DstAlpha; - } - private static final int WGPUBlendFactor_OneMinusDstAlpha = (int)9L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_OneMinusDstAlpha = 9 - * } - */ - public static int WGPUBlendFactor_OneMinusDstAlpha() { - return WGPUBlendFactor_OneMinusDstAlpha; - } - private static final int WGPUBlendFactor_SrcAlphaSaturated = (int)10L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_SrcAlphaSaturated = 10 - * } - */ - public static int WGPUBlendFactor_SrcAlphaSaturated() { - return WGPUBlendFactor_SrcAlphaSaturated; - } - private static final int WGPUBlendFactor_Constant = (int)11L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_Constant = 11 - * } - */ - public static int WGPUBlendFactor_Constant() { - return WGPUBlendFactor_Constant; - } - private static final int WGPUBlendFactor_OneMinusConstant = (int)12L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_OneMinusConstant = 12 - * } - */ - public static int WGPUBlendFactor_OneMinusConstant() { - return WGPUBlendFactor_OneMinusConstant; - } - private static final int WGPUBlendFactor_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBlendFactor.WGPUBlendFactor_Force32 = 2147483647 - * } - */ - public static int WGPUBlendFactor_Force32() { - return WGPUBlendFactor_Force32; - } - private static final int WGPUBlendOperation_Add = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBlendOperation.WGPUBlendOperation_Add = 0 - * } - */ - public static int WGPUBlendOperation_Add() { - return WGPUBlendOperation_Add; - } - private static final int WGPUBlendOperation_Subtract = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBlendOperation.WGPUBlendOperation_Subtract = 1 - * } - */ - public static int WGPUBlendOperation_Subtract() { - return WGPUBlendOperation_Subtract; - } - private static final int WGPUBlendOperation_ReverseSubtract = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBlendOperation.WGPUBlendOperation_ReverseSubtract = 2 - * } - */ - public static int WGPUBlendOperation_ReverseSubtract() { - return WGPUBlendOperation_ReverseSubtract; - } - private static final int WGPUBlendOperation_Min = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUBlendOperation.WGPUBlendOperation_Min = 3 - * } - */ - public static int WGPUBlendOperation_Min() { - return WGPUBlendOperation_Min; - } - private static final int WGPUBlendOperation_Max = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUBlendOperation.WGPUBlendOperation_Max = 4 - * } - */ - public static int WGPUBlendOperation_Max() { - return WGPUBlendOperation_Max; - } - private static final int WGPUBlendOperation_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBlendOperation.WGPUBlendOperation_Force32 = 2147483647 - * } - */ - public static int WGPUBlendOperation_Force32() { - return WGPUBlendOperation_Force32; - } - private static final int WGPUBufferBindingType_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBufferBindingType.WGPUBufferBindingType_Undefined = 0 - * } - */ - public static int WGPUBufferBindingType_Undefined() { - return WGPUBufferBindingType_Undefined; - } - private static final int WGPUBufferBindingType_Uniform = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBufferBindingType.WGPUBufferBindingType_Uniform = 1 - * } - */ - public static int WGPUBufferBindingType_Uniform() { - return WGPUBufferBindingType_Uniform; - } - private static final int WGPUBufferBindingType_Storage = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBufferBindingType.WGPUBufferBindingType_Storage = 2 - * } - */ - public static int WGPUBufferBindingType_Storage() { - return WGPUBufferBindingType_Storage; - } - private static final int WGPUBufferBindingType_ReadOnlyStorage = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUBufferBindingType.WGPUBufferBindingType_ReadOnlyStorage = 3 - * } - */ - public static int WGPUBufferBindingType_ReadOnlyStorage() { - return WGPUBufferBindingType_ReadOnlyStorage; - } - private static final int WGPUBufferBindingType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBufferBindingType.WGPUBufferBindingType_Force32 = 2147483647 - * } - */ - public static int WGPUBufferBindingType_Force32() { - return WGPUBufferBindingType_Force32; - } - private static final int WGPUBufferMapAsyncStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_Success = 0 - * } - */ - public static int WGPUBufferMapAsyncStatus_Success() { - return WGPUBufferMapAsyncStatus_Success; - } - private static final int WGPUBufferMapAsyncStatus_ValidationError = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_ValidationError = 1 - * } - */ - public static int WGPUBufferMapAsyncStatus_ValidationError() { - return WGPUBufferMapAsyncStatus_ValidationError; - } - private static final int WGPUBufferMapAsyncStatus_Unknown = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_Unknown = 2 - * } - */ - public static int WGPUBufferMapAsyncStatus_Unknown() { - return WGPUBufferMapAsyncStatus_Unknown; - } - private static final int WGPUBufferMapAsyncStatus_DeviceLost = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_DeviceLost = 3 - * } - */ - public static int WGPUBufferMapAsyncStatus_DeviceLost() { - return WGPUBufferMapAsyncStatus_DeviceLost; - } - private static final int WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 4 - * } - */ - public static int WGPUBufferMapAsyncStatus_DestroyedBeforeCallback() { - return WGPUBufferMapAsyncStatus_DestroyedBeforeCallback; - } - private static final int WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 5 - * } - */ - public static int WGPUBufferMapAsyncStatus_UnmappedBeforeCallback() { - return WGPUBufferMapAsyncStatus_UnmappedBeforeCallback; - } - private static final int WGPUBufferMapAsyncStatus_MappingAlreadyPending = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_MappingAlreadyPending = 6 - * } - */ - public static int WGPUBufferMapAsyncStatus_MappingAlreadyPending() { - return WGPUBufferMapAsyncStatus_MappingAlreadyPending; - } - private static final int WGPUBufferMapAsyncStatus_OffsetOutOfRange = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_OffsetOutOfRange = 7 - * } - */ - public static int WGPUBufferMapAsyncStatus_OffsetOutOfRange() { - return WGPUBufferMapAsyncStatus_OffsetOutOfRange; - } - private static final int WGPUBufferMapAsyncStatus_SizeOutOfRange = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_SizeOutOfRange = 8 - * } - */ - public static int WGPUBufferMapAsyncStatus_SizeOutOfRange() { - return WGPUBufferMapAsyncStatus_SizeOutOfRange; - } - private static final int WGPUBufferMapAsyncStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapAsyncStatus.WGPUBufferMapAsyncStatus_Force32 = 2147483647 - * } - */ - public static int WGPUBufferMapAsyncStatus_Force32() { - return WGPUBufferMapAsyncStatus_Force32; - } - private static final int WGPUBufferMapState_Unmapped = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapState.WGPUBufferMapState_Unmapped = 0 - * } - */ - public static int WGPUBufferMapState_Unmapped() { - return WGPUBufferMapState_Unmapped; - } - private static final int WGPUBufferMapState_Pending = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapState.WGPUBufferMapState_Pending = 1 - * } - */ - public static int WGPUBufferMapState_Pending() { - return WGPUBufferMapState_Pending; - } - private static final int WGPUBufferMapState_Mapped = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapState.WGPUBufferMapState_Mapped = 2 - * } - */ - public static int WGPUBufferMapState_Mapped() { - return WGPUBufferMapState_Mapped; - } - private static final int WGPUBufferMapState_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBufferMapState.WGPUBufferMapState_Force32 = 2147483647 - * } - */ - public static int WGPUBufferMapState_Force32() { - return WGPUBufferMapState_Force32; - } - private static final int WGPUCompareFunction_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Undefined = 0 - * } - */ - public static int WGPUCompareFunction_Undefined() { - return WGPUCompareFunction_Undefined; - } - private static final int WGPUCompareFunction_Never = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Never = 1 - * } - */ - public static int WGPUCompareFunction_Never() { - return WGPUCompareFunction_Never; - } - private static final int WGPUCompareFunction_Less = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Less = 2 - * } - */ - public static int WGPUCompareFunction_Less() { - return WGPUCompareFunction_Less; - } - private static final int WGPUCompareFunction_LessEqual = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_LessEqual = 3 - * } - */ - public static int WGPUCompareFunction_LessEqual() { - return WGPUCompareFunction_LessEqual; - } - private static final int WGPUCompareFunction_Greater = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Greater = 4 - * } - */ - public static int WGPUCompareFunction_Greater() { - return WGPUCompareFunction_Greater; - } - private static final int WGPUCompareFunction_GreaterEqual = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_GreaterEqual = 5 - * } - */ - public static int WGPUCompareFunction_GreaterEqual() { - return WGPUCompareFunction_GreaterEqual; - } - private static final int WGPUCompareFunction_Equal = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Equal = 6 - * } - */ - public static int WGPUCompareFunction_Equal() { - return WGPUCompareFunction_Equal; - } - private static final int WGPUCompareFunction_NotEqual = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_NotEqual = 7 - * } - */ - public static int WGPUCompareFunction_NotEqual() { - return WGPUCompareFunction_NotEqual; - } - private static final int WGPUCompareFunction_Always = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Always = 8 - * } - */ - public static int WGPUCompareFunction_Always() { - return WGPUCompareFunction_Always; - } - private static final int WGPUCompareFunction_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUCompareFunction.WGPUCompareFunction_Force32 = 2147483647 - * } - */ - public static int WGPUCompareFunction_Force32() { - return WGPUCompareFunction_Force32; - } - private static final int WGPUCompilationInfoRequestStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUCompilationInfoRequestStatus.WGPUCompilationInfoRequestStatus_Success = 0 - * } - */ - public static int WGPUCompilationInfoRequestStatus_Success() { - return WGPUCompilationInfoRequestStatus_Success; - } - private static final int WGPUCompilationInfoRequestStatus_Error = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUCompilationInfoRequestStatus.WGPUCompilationInfoRequestStatus_Error = 1 - * } - */ - public static int WGPUCompilationInfoRequestStatus_Error() { - return WGPUCompilationInfoRequestStatus_Error; - } - private static final int WGPUCompilationInfoRequestStatus_DeviceLost = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUCompilationInfoRequestStatus.WGPUCompilationInfoRequestStatus_DeviceLost = 2 - * } - */ - public static int WGPUCompilationInfoRequestStatus_DeviceLost() { - return WGPUCompilationInfoRequestStatus_DeviceLost; - } - private static final int WGPUCompilationInfoRequestStatus_Unknown = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUCompilationInfoRequestStatus.WGPUCompilationInfoRequestStatus_Unknown = 3 - * } - */ - public static int WGPUCompilationInfoRequestStatus_Unknown() { - return WGPUCompilationInfoRequestStatus_Unknown; - } - private static final int WGPUCompilationInfoRequestStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUCompilationInfoRequestStatus.WGPUCompilationInfoRequestStatus_Force32 = 2147483647 - * } - */ - public static int WGPUCompilationInfoRequestStatus_Force32() { - return WGPUCompilationInfoRequestStatus_Force32; - } - private static final int WGPUCompilationMessageType_Error = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUCompilationMessageType.WGPUCompilationMessageType_Error = 0 - * } - */ - public static int WGPUCompilationMessageType_Error() { - return WGPUCompilationMessageType_Error; - } - private static final int WGPUCompilationMessageType_Warning = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUCompilationMessageType.WGPUCompilationMessageType_Warning = 1 - * } - */ - public static int WGPUCompilationMessageType_Warning() { - return WGPUCompilationMessageType_Warning; - } - private static final int WGPUCompilationMessageType_Info = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUCompilationMessageType.WGPUCompilationMessageType_Info = 2 - * } - */ - public static int WGPUCompilationMessageType_Info() { - return WGPUCompilationMessageType_Info; - } - private static final int WGPUCompilationMessageType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUCompilationMessageType.WGPUCompilationMessageType_Force32 = 2147483647 - * } - */ - public static int WGPUCompilationMessageType_Force32() { - return WGPUCompilationMessageType_Force32; - } - private static final int WGPUCompositeAlphaMode_Auto = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUCompositeAlphaMode.WGPUCompositeAlphaMode_Auto = 0 - * } - */ - public static int WGPUCompositeAlphaMode_Auto() { - return WGPUCompositeAlphaMode_Auto; - } - private static final int WGPUCompositeAlphaMode_Opaque = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUCompositeAlphaMode.WGPUCompositeAlphaMode_Opaque = 1 - * } - */ - public static int WGPUCompositeAlphaMode_Opaque() { - return WGPUCompositeAlphaMode_Opaque; - } - private static final int WGPUCompositeAlphaMode_Premultiplied = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUCompositeAlphaMode.WGPUCompositeAlphaMode_Premultiplied = 2 - * } - */ - public static int WGPUCompositeAlphaMode_Premultiplied() { - return WGPUCompositeAlphaMode_Premultiplied; - } - private static final int WGPUCompositeAlphaMode_Unpremultiplied = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUCompositeAlphaMode.WGPUCompositeAlphaMode_Unpremultiplied = 3 - * } - */ - public static int WGPUCompositeAlphaMode_Unpremultiplied() { - return WGPUCompositeAlphaMode_Unpremultiplied; - } - private static final int WGPUCompositeAlphaMode_Inherit = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUCompositeAlphaMode.WGPUCompositeAlphaMode_Inherit = 4 - * } - */ - public static int WGPUCompositeAlphaMode_Inherit() { - return WGPUCompositeAlphaMode_Inherit; - } - private static final int WGPUCompositeAlphaMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUCompositeAlphaMode.WGPUCompositeAlphaMode_Force32 = 2147483647 - * } - */ - public static int WGPUCompositeAlphaMode_Force32() { - return WGPUCompositeAlphaMode_Force32; - } - private static final int WGPUCreatePipelineAsyncStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_Success = 0 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_Success() { - return WGPUCreatePipelineAsyncStatus_Success; - } - private static final int WGPUCreatePipelineAsyncStatus_ValidationError = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_ValidationError = 1 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_ValidationError() { - return WGPUCreatePipelineAsyncStatus_ValidationError; - } - private static final int WGPUCreatePipelineAsyncStatus_InternalError = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_InternalError = 2 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_InternalError() { - return WGPUCreatePipelineAsyncStatus_InternalError; - } - private static final int WGPUCreatePipelineAsyncStatus_DeviceLost = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_DeviceLost = 3 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_DeviceLost() { - return WGPUCreatePipelineAsyncStatus_DeviceLost; - } - private static final int WGPUCreatePipelineAsyncStatus_DeviceDestroyed = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 4 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_DeviceDestroyed() { - return WGPUCreatePipelineAsyncStatus_DeviceDestroyed; - } - private static final int WGPUCreatePipelineAsyncStatus_Unknown = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_Unknown = 5 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_Unknown() { - return WGPUCreatePipelineAsyncStatus_Unknown; - } - private static final int WGPUCreatePipelineAsyncStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUCreatePipelineAsyncStatus.WGPUCreatePipelineAsyncStatus_Force32 = 2147483647 - * } - */ - public static int WGPUCreatePipelineAsyncStatus_Force32() { - return WGPUCreatePipelineAsyncStatus_Force32; - } - private static final int WGPUCullMode_None = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUCullMode.WGPUCullMode_None = 0 - * } - */ - public static int WGPUCullMode_None() { - return WGPUCullMode_None; - } - private static final int WGPUCullMode_Front = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUCullMode.WGPUCullMode_Front = 1 - * } - */ - public static int WGPUCullMode_Front() { - return WGPUCullMode_Front; - } - private static final int WGPUCullMode_Back = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUCullMode.WGPUCullMode_Back = 2 - * } - */ - public static int WGPUCullMode_Back() { - return WGPUCullMode_Back; - } - private static final int WGPUCullMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUCullMode.WGPUCullMode_Force32 = 2147483647 - * } - */ - public static int WGPUCullMode_Force32() { - return WGPUCullMode_Force32; - } - private static final int WGPUDeviceLostReason_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUDeviceLostReason.WGPUDeviceLostReason_Undefined = 0 - * } - */ - public static int WGPUDeviceLostReason_Undefined() { - return WGPUDeviceLostReason_Undefined; - } - private static final int WGPUDeviceLostReason_Destroyed = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUDeviceLostReason.WGPUDeviceLostReason_Destroyed = 1 - * } - */ - public static int WGPUDeviceLostReason_Destroyed() { - return WGPUDeviceLostReason_Destroyed; - } - private static final int WGPUDeviceLostReason_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUDeviceLostReason.WGPUDeviceLostReason_Force32 = 2147483647 - * } - */ - public static int WGPUDeviceLostReason_Force32() { - return WGPUDeviceLostReason_Force32; - } - private static final int WGPUErrorFilter_Validation = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUErrorFilter.WGPUErrorFilter_Validation = 0 - * } - */ - public static int WGPUErrorFilter_Validation() { - return WGPUErrorFilter_Validation; - } - private static final int WGPUErrorFilter_OutOfMemory = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUErrorFilter.WGPUErrorFilter_OutOfMemory = 1 - * } - */ - public static int WGPUErrorFilter_OutOfMemory() { - return WGPUErrorFilter_OutOfMemory; - } - private static final int WGPUErrorFilter_Internal = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUErrorFilter.WGPUErrorFilter_Internal = 2 - * } - */ - public static int WGPUErrorFilter_Internal() { - return WGPUErrorFilter_Internal; - } - private static final int WGPUErrorFilter_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUErrorFilter.WGPUErrorFilter_Force32 = 2147483647 - * } - */ - public static int WGPUErrorFilter_Force32() { - return WGPUErrorFilter_Force32; - } - private static final int WGPUErrorType_NoError = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_NoError = 0 - * } - */ - public static int WGPUErrorType_NoError() { - return WGPUErrorType_NoError; - } - private static final int WGPUErrorType_Validation = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_Validation = 1 - * } - */ - public static int WGPUErrorType_Validation() { - return WGPUErrorType_Validation; - } - private static final int WGPUErrorType_OutOfMemory = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_OutOfMemory = 2 - * } - */ - public static int WGPUErrorType_OutOfMemory() { - return WGPUErrorType_OutOfMemory; - } - private static final int WGPUErrorType_Internal = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_Internal = 3 - * } - */ - public static int WGPUErrorType_Internal() { - return WGPUErrorType_Internal; - } - private static final int WGPUErrorType_Unknown = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_Unknown = 4 - * } - */ - public static int WGPUErrorType_Unknown() { - return WGPUErrorType_Unknown; - } - private static final int WGPUErrorType_DeviceLost = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_DeviceLost = 5 - * } - */ - public static int WGPUErrorType_DeviceLost() { - return WGPUErrorType_DeviceLost; - } - private static final int WGPUErrorType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUErrorType.WGPUErrorType_Force32 = 2147483647 - * } - */ - public static int WGPUErrorType_Force32() { - return WGPUErrorType_Force32; - } - private static final int WGPUFeatureName_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_Undefined = 0 - * } - */ - public static int WGPUFeatureName_Undefined() { - return WGPUFeatureName_Undefined; - } - private static final int WGPUFeatureName_DepthClipControl = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_DepthClipControl = 1 - * } - */ - public static int WGPUFeatureName_DepthClipControl() { - return WGPUFeatureName_DepthClipControl; - } - private static final int WGPUFeatureName_Depth32FloatStencil8 = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_Depth32FloatStencil8 = 2 - * } - */ - public static int WGPUFeatureName_Depth32FloatStencil8() { - return WGPUFeatureName_Depth32FloatStencil8; - } - private static final int WGPUFeatureName_TimestampQuery = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_TimestampQuery = 3 - * } - */ - public static int WGPUFeatureName_TimestampQuery() { - return WGPUFeatureName_TimestampQuery; - } - private static final int WGPUFeatureName_TextureCompressionBC = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_TextureCompressionBC = 4 - * } - */ - public static int WGPUFeatureName_TextureCompressionBC() { - return WGPUFeatureName_TextureCompressionBC; - } - private static final int WGPUFeatureName_TextureCompressionETC2 = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_TextureCompressionETC2 = 5 - * } - */ - public static int WGPUFeatureName_TextureCompressionETC2() { - return WGPUFeatureName_TextureCompressionETC2; - } - private static final int WGPUFeatureName_TextureCompressionASTC = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_TextureCompressionASTC = 6 - * } - */ - public static int WGPUFeatureName_TextureCompressionASTC() { - return WGPUFeatureName_TextureCompressionASTC; - } - private static final int WGPUFeatureName_IndirectFirstInstance = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_IndirectFirstInstance = 7 - * } - */ - public static int WGPUFeatureName_IndirectFirstInstance() { - return WGPUFeatureName_IndirectFirstInstance; - } - private static final int WGPUFeatureName_ShaderF16 = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_ShaderF16 = 8 - * } - */ - public static int WGPUFeatureName_ShaderF16() { - return WGPUFeatureName_ShaderF16; - } - private static final int WGPUFeatureName_RG11B10UfloatRenderable = (int)9L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_RG11B10UfloatRenderable = 9 - * } - */ - public static int WGPUFeatureName_RG11B10UfloatRenderable() { - return WGPUFeatureName_RG11B10UfloatRenderable; - } - private static final int WGPUFeatureName_BGRA8UnormStorage = (int)10L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_BGRA8UnormStorage = 10 - * } - */ - public static int WGPUFeatureName_BGRA8UnormStorage() { - return WGPUFeatureName_BGRA8UnormStorage; - } - private static final int WGPUFeatureName_Float32Filterable = (int)11L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_Float32Filterable = 11 - * } - */ - public static int WGPUFeatureName_Float32Filterable() { - return WGPUFeatureName_Float32Filterable; - } - private static final int WGPUFeatureName_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUFeatureName.WGPUFeatureName_Force32 = 2147483647 - * } - */ - public static int WGPUFeatureName_Force32() { - return WGPUFeatureName_Force32; - } - private static final int WGPUFilterMode_Nearest = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUFilterMode.WGPUFilterMode_Nearest = 0 - * } - */ - public static int WGPUFilterMode_Nearest() { - return WGPUFilterMode_Nearest; - } - private static final int WGPUFilterMode_Linear = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUFilterMode.WGPUFilterMode_Linear = 1 - * } - */ - public static int WGPUFilterMode_Linear() { - return WGPUFilterMode_Linear; - } - private static final int WGPUFilterMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUFilterMode.WGPUFilterMode_Force32 = 2147483647 - * } - */ - public static int WGPUFilterMode_Force32() { - return WGPUFilterMode_Force32; - } - private static final int WGPUFrontFace_CCW = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUFrontFace.WGPUFrontFace_CCW = 0 - * } - */ - public static int WGPUFrontFace_CCW() { - return WGPUFrontFace_CCW; - } - private static final int WGPUFrontFace_CW = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUFrontFace.WGPUFrontFace_CW = 1 - * } - */ - public static int WGPUFrontFace_CW() { - return WGPUFrontFace_CW; - } - private static final int WGPUFrontFace_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUFrontFace.WGPUFrontFace_Force32 = 2147483647 - * } - */ - public static int WGPUFrontFace_Force32() { - return WGPUFrontFace_Force32; - } - private static final int WGPUIndexFormat_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUIndexFormat.WGPUIndexFormat_Undefined = 0 - * } - */ - public static int WGPUIndexFormat_Undefined() { - return WGPUIndexFormat_Undefined; - } - private static final int WGPUIndexFormat_Uint16 = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUIndexFormat.WGPUIndexFormat_Uint16 = 1 - * } - */ - public static int WGPUIndexFormat_Uint16() { - return WGPUIndexFormat_Uint16; - } - private static final int WGPUIndexFormat_Uint32 = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUIndexFormat.WGPUIndexFormat_Uint32 = 2 - * } - */ - public static int WGPUIndexFormat_Uint32() { - return WGPUIndexFormat_Uint32; - } - private static final int WGPUIndexFormat_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUIndexFormat.WGPUIndexFormat_Force32 = 2147483647 - * } - */ - public static int WGPUIndexFormat_Force32() { - return WGPUIndexFormat_Force32; - } - private static final int WGPULoadOp_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPULoadOp.WGPULoadOp_Undefined = 0 - * } - */ - public static int WGPULoadOp_Undefined() { - return WGPULoadOp_Undefined; - } - private static final int WGPULoadOp_Clear = (int)1L; - /** - * {@snippet lang=c : - * enum WGPULoadOp.WGPULoadOp_Clear = 1 - * } - */ - public static int WGPULoadOp_Clear() { - return WGPULoadOp_Clear; - } - private static final int WGPULoadOp_Load = (int)2L; - /** - * {@snippet lang=c : - * enum WGPULoadOp.WGPULoadOp_Load = 2 - * } - */ - public static int WGPULoadOp_Load() { - return WGPULoadOp_Load; - } - private static final int WGPULoadOp_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPULoadOp.WGPULoadOp_Force32 = 2147483647 - * } - */ - public static int WGPULoadOp_Force32() { - return WGPULoadOp_Force32; - } - private static final int WGPUMipmapFilterMode_Nearest = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUMipmapFilterMode.WGPUMipmapFilterMode_Nearest = 0 - * } - */ - public static int WGPUMipmapFilterMode_Nearest() { - return WGPUMipmapFilterMode_Nearest; - } - private static final int WGPUMipmapFilterMode_Linear = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUMipmapFilterMode.WGPUMipmapFilterMode_Linear = 1 - * } - */ - public static int WGPUMipmapFilterMode_Linear() { - return WGPUMipmapFilterMode_Linear; - } - private static final int WGPUMipmapFilterMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUMipmapFilterMode.WGPUMipmapFilterMode_Force32 = 2147483647 - * } - */ - public static int WGPUMipmapFilterMode_Force32() { - return WGPUMipmapFilterMode_Force32; - } - private static final int WGPUPowerPreference_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUPowerPreference.WGPUPowerPreference_Undefined = 0 - * } - */ - public static int WGPUPowerPreference_Undefined() { - return WGPUPowerPreference_Undefined; - } - private static final int WGPUPowerPreference_LowPower = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUPowerPreference.WGPUPowerPreference_LowPower = 1 - * } - */ - public static int WGPUPowerPreference_LowPower() { - return WGPUPowerPreference_LowPower; - } - private static final int WGPUPowerPreference_HighPerformance = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUPowerPreference.WGPUPowerPreference_HighPerformance = 2 - * } - */ - public static int WGPUPowerPreference_HighPerformance() { - return WGPUPowerPreference_HighPerformance; - } - private static final int WGPUPowerPreference_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUPowerPreference.WGPUPowerPreference_Force32 = 2147483647 - * } - */ - public static int WGPUPowerPreference_Force32() { - return WGPUPowerPreference_Force32; - } - private static final int WGPUPresentMode_Fifo = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUPresentMode.WGPUPresentMode_Fifo = 0 - * } - */ - public static int WGPUPresentMode_Fifo() { - return WGPUPresentMode_Fifo; - } - private static final int WGPUPresentMode_FifoRelaxed = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUPresentMode.WGPUPresentMode_FifoRelaxed = 1 - * } - */ - public static int WGPUPresentMode_FifoRelaxed() { - return WGPUPresentMode_FifoRelaxed; - } - private static final int WGPUPresentMode_Immediate = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUPresentMode.WGPUPresentMode_Immediate = 2 - * } - */ - public static int WGPUPresentMode_Immediate() { - return WGPUPresentMode_Immediate; - } - private static final int WGPUPresentMode_Mailbox = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUPresentMode.WGPUPresentMode_Mailbox = 3 - * } - */ - public static int WGPUPresentMode_Mailbox() { - return WGPUPresentMode_Mailbox; - } - private static final int WGPUPresentMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUPresentMode.WGPUPresentMode_Force32 = 2147483647 - * } - */ - public static int WGPUPresentMode_Force32() { - return WGPUPresentMode_Force32; - } - private static final int WGPUPrimitiveTopology_PointList = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUPrimitiveTopology.WGPUPrimitiveTopology_PointList = 0 - * } - */ - public static int WGPUPrimitiveTopology_PointList() { - return WGPUPrimitiveTopology_PointList; - } - private static final int WGPUPrimitiveTopology_LineList = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUPrimitiveTopology.WGPUPrimitiveTopology_LineList = 1 - * } - */ - public static int WGPUPrimitiveTopology_LineList() { - return WGPUPrimitiveTopology_LineList; - } - private static final int WGPUPrimitiveTopology_LineStrip = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUPrimitiveTopology.WGPUPrimitiveTopology_LineStrip = 2 - * } - */ - public static int WGPUPrimitiveTopology_LineStrip() { - return WGPUPrimitiveTopology_LineStrip; - } - private static final int WGPUPrimitiveTopology_TriangleList = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUPrimitiveTopology.WGPUPrimitiveTopology_TriangleList = 3 - * } - */ - public static int WGPUPrimitiveTopology_TriangleList() { - return WGPUPrimitiveTopology_TriangleList; - } - private static final int WGPUPrimitiveTopology_TriangleStrip = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUPrimitiveTopology.WGPUPrimitiveTopology_TriangleStrip = 4 - * } - */ - public static int WGPUPrimitiveTopology_TriangleStrip() { - return WGPUPrimitiveTopology_TriangleStrip; - } - private static final int WGPUPrimitiveTopology_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUPrimitiveTopology.WGPUPrimitiveTopology_Force32 = 2147483647 - * } - */ - public static int WGPUPrimitiveTopology_Force32() { - return WGPUPrimitiveTopology_Force32; - } - private static final int WGPUQueryType_Occlusion = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUQueryType.WGPUQueryType_Occlusion = 0 - * } - */ - public static int WGPUQueryType_Occlusion() { - return WGPUQueryType_Occlusion; - } - private static final int WGPUQueryType_Timestamp = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUQueryType.WGPUQueryType_Timestamp = 1 - * } - */ - public static int WGPUQueryType_Timestamp() { - return WGPUQueryType_Timestamp; - } - private static final int WGPUQueryType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUQueryType.WGPUQueryType_Force32 = 2147483647 - * } - */ - public static int WGPUQueryType_Force32() { - return WGPUQueryType_Force32; - } - private static final int WGPUQueueWorkDoneStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUQueueWorkDoneStatus.WGPUQueueWorkDoneStatus_Success = 0 - * } - */ - public static int WGPUQueueWorkDoneStatus_Success() { - return WGPUQueueWorkDoneStatus_Success; - } - private static final int WGPUQueueWorkDoneStatus_Error = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUQueueWorkDoneStatus.WGPUQueueWorkDoneStatus_Error = 1 - * } - */ - public static int WGPUQueueWorkDoneStatus_Error() { - return WGPUQueueWorkDoneStatus_Error; - } - private static final int WGPUQueueWorkDoneStatus_Unknown = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUQueueWorkDoneStatus.WGPUQueueWorkDoneStatus_Unknown = 2 - * } - */ - public static int WGPUQueueWorkDoneStatus_Unknown() { - return WGPUQueueWorkDoneStatus_Unknown; - } - private static final int WGPUQueueWorkDoneStatus_DeviceLost = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUQueueWorkDoneStatus.WGPUQueueWorkDoneStatus_DeviceLost = 3 - * } - */ - public static int WGPUQueueWorkDoneStatus_DeviceLost() { - return WGPUQueueWorkDoneStatus_DeviceLost; - } - private static final int WGPUQueueWorkDoneStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUQueueWorkDoneStatus.WGPUQueueWorkDoneStatus_Force32 = 2147483647 - * } - */ - public static int WGPUQueueWorkDoneStatus_Force32() { - return WGPUQueueWorkDoneStatus_Force32; - } - private static final int WGPURequestAdapterStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPURequestAdapterStatus.WGPURequestAdapterStatus_Success = 0 - * } - */ - public static int WGPURequestAdapterStatus_Success() { - return WGPURequestAdapterStatus_Success; - } - private static final int WGPURequestAdapterStatus_Unavailable = (int)1L; - /** - * {@snippet lang=c : - * enum WGPURequestAdapterStatus.WGPURequestAdapterStatus_Unavailable = 1 - * } - */ - public static int WGPURequestAdapterStatus_Unavailable() { - return WGPURequestAdapterStatus_Unavailable; - } - private static final int WGPURequestAdapterStatus_Error = (int)2L; - /** - * {@snippet lang=c : - * enum WGPURequestAdapterStatus.WGPURequestAdapterStatus_Error = 2 - * } - */ - public static int WGPURequestAdapterStatus_Error() { - return WGPURequestAdapterStatus_Error; - } - private static final int WGPURequestAdapterStatus_Unknown = (int)3L; - /** - * {@snippet lang=c : - * enum WGPURequestAdapterStatus.WGPURequestAdapterStatus_Unknown = 3 - * } - */ - public static int WGPURequestAdapterStatus_Unknown() { - return WGPURequestAdapterStatus_Unknown; - } - private static final int WGPURequestAdapterStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPURequestAdapterStatus.WGPURequestAdapterStatus_Force32 = 2147483647 - * } - */ - public static int WGPURequestAdapterStatus_Force32() { - return WGPURequestAdapterStatus_Force32; - } - private static final int WGPURequestDeviceStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPURequestDeviceStatus.WGPURequestDeviceStatus_Success = 0 - * } - */ - public static int WGPURequestDeviceStatus_Success() { - return WGPURequestDeviceStatus_Success; - } - private static final int WGPURequestDeviceStatus_Error = (int)1L; - /** - * {@snippet lang=c : - * enum WGPURequestDeviceStatus.WGPURequestDeviceStatus_Error = 1 - * } - */ - public static int WGPURequestDeviceStatus_Error() { - return WGPURequestDeviceStatus_Error; - } - private static final int WGPURequestDeviceStatus_Unknown = (int)2L; - /** - * {@snippet lang=c : - * enum WGPURequestDeviceStatus.WGPURequestDeviceStatus_Unknown = 2 - * } - */ - public static int WGPURequestDeviceStatus_Unknown() { - return WGPURequestDeviceStatus_Unknown; - } - private static final int WGPURequestDeviceStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPURequestDeviceStatus.WGPURequestDeviceStatus_Force32 = 2147483647 - * } - */ - public static int WGPURequestDeviceStatus_Force32() { - return WGPURequestDeviceStatus_Force32; - } - private static final int WGPUSType_Invalid = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_Invalid = 0 - * } - */ - public static int WGPUSType_Invalid() { - return WGPUSType_Invalid; - } - private static final int WGPUSType_SurfaceDescriptorFromMetalLayer = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromMetalLayer = 1 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromMetalLayer() { - return WGPUSType_SurfaceDescriptorFromMetalLayer; - } - private static final int WGPUSType_SurfaceDescriptorFromWindowsHWND = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromWindowsHWND = 2 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromWindowsHWND() { - return WGPUSType_SurfaceDescriptorFromWindowsHWND; - } - private static final int WGPUSType_SurfaceDescriptorFromXlibWindow = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromXlibWindow = 3 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromXlibWindow() { - return WGPUSType_SurfaceDescriptorFromXlibWindow; - } - private static final int WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector = 4 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector() { - return WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector; - } - private static final int WGPUSType_ShaderModuleSPIRVDescriptor = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_ShaderModuleSPIRVDescriptor = 5 - * } - */ - public static int WGPUSType_ShaderModuleSPIRVDescriptor() { - return WGPUSType_ShaderModuleSPIRVDescriptor; - } - private static final int WGPUSType_ShaderModuleWGSLDescriptor = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_ShaderModuleWGSLDescriptor = 6 - * } - */ - public static int WGPUSType_ShaderModuleWGSLDescriptor() { - return WGPUSType_ShaderModuleWGSLDescriptor; - } - private static final int WGPUSType_PrimitiveDepthClipControl = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_PrimitiveDepthClipControl = 7 - * } - */ - public static int WGPUSType_PrimitiveDepthClipControl() { - return WGPUSType_PrimitiveDepthClipControl; - } - private static final int WGPUSType_SurfaceDescriptorFromWaylandSurface = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromWaylandSurface = 8 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromWaylandSurface() { - return WGPUSType_SurfaceDescriptorFromWaylandSurface; - } - private static final int WGPUSType_SurfaceDescriptorFromAndroidNativeWindow = (int)9L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromAndroidNativeWindow = 9 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromAndroidNativeWindow() { - return WGPUSType_SurfaceDescriptorFromAndroidNativeWindow; - } - private static final int WGPUSType_SurfaceDescriptorFromXcbWindow = (int)10L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_SurfaceDescriptorFromXcbWindow = 10 - * } - */ - public static int WGPUSType_SurfaceDescriptorFromXcbWindow() { - return WGPUSType_SurfaceDescriptorFromXcbWindow; - } - private static final int WGPUSType_RenderPassDescriptorMaxDrawCount = (int)15L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_RenderPassDescriptorMaxDrawCount = 15 - * } - */ - public static int WGPUSType_RenderPassDescriptorMaxDrawCount() { - return WGPUSType_RenderPassDescriptorMaxDrawCount; - } - private static final int WGPUSType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUSType.WGPUSType_Force32 = 2147483647 - * } - */ - public static int WGPUSType_Force32() { - return WGPUSType_Force32; - } - private static final int WGPUSamplerBindingType_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUSamplerBindingType.WGPUSamplerBindingType_Undefined = 0 - * } - */ - public static int WGPUSamplerBindingType_Undefined() { - return WGPUSamplerBindingType_Undefined; - } - private static final int WGPUSamplerBindingType_Filtering = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUSamplerBindingType.WGPUSamplerBindingType_Filtering = 1 - * } - */ - public static int WGPUSamplerBindingType_Filtering() { - return WGPUSamplerBindingType_Filtering; - } - private static final int WGPUSamplerBindingType_NonFiltering = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUSamplerBindingType.WGPUSamplerBindingType_NonFiltering = 2 - * } - */ - public static int WGPUSamplerBindingType_NonFiltering() { - return WGPUSamplerBindingType_NonFiltering; - } - private static final int WGPUSamplerBindingType_Comparison = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUSamplerBindingType.WGPUSamplerBindingType_Comparison = 3 - * } - */ - public static int WGPUSamplerBindingType_Comparison() { - return WGPUSamplerBindingType_Comparison; - } - private static final int WGPUSamplerBindingType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUSamplerBindingType.WGPUSamplerBindingType_Force32 = 2147483647 - * } - */ - public static int WGPUSamplerBindingType_Force32() { - return WGPUSamplerBindingType_Force32; - } - private static final int WGPUStencilOperation_Keep = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_Keep = 0 - * } - */ - public static int WGPUStencilOperation_Keep() { - return WGPUStencilOperation_Keep; - } - private static final int WGPUStencilOperation_Zero = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_Zero = 1 - * } - */ - public static int WGPUStencilOperation_Zero() { - return WGPUStencilOperation_Zero; - } - private static final int WGPUStencilOperation_Replace = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_Replace = 2 - * } - */ - public static int WGPUStencilOperation_Replace() { - return WGPUStencilOperation_Replace; - } - private static final int WGPUStencilOperation_Invert = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_Invert = 3 - * } - */ - public static int WGPUStencilOperation_Invert() { - return WGPUStencilOperation_Invert; - } - private static final int WGPUStencilOperation_IncrementClamp = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_IncrementClamp = 4 - * } - */ - public static int WGPUStencilOperation_IncrementClamp() { - return WGPUStencilOperation_IncrementClamp; - } - private static final int WGPUStencilOperation_DecrementClamp = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_DecrementClamp = 5 - * } - */ - public static int WGPUStencilOperation_DecrementClamp() { - return WGPUStencilOperation_DecrementClamp; - } - private static final int WGPUStencilOperation_IncrementWrap = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_IncrementWrap = 6 - * } - */ - public static int WGPUStencilOperation_IncrementWrap() { - return WGPUStencilOperation_IncrementWrap; - } - private static final int WGPUStencilOperation_DecrementWrap = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_DecrementWrap = 7 - * } - */ - public static int WGPUStencilOperation_DecrementWrap() { - return WGPUStencilOperation_DecrementWrap; - } - private static final int WGPUStencilOperation_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUStencilOperation.WGPUStencilOperation_Force32 = 2147483647 - * } - */ - public static int WGPUStencilOperation_Force32() { - return WGPUStencilOperation_Force32; - } - private static final int WGPUStorageTextureAccess_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUStorageTextureAccess.WGPUStorageTextureAccess_Undefined = 0 - * } - */ - public static int WGPUStorageTextureAccess_Undefined() { - return WGPUStorageTextureAccess_Undefined; - } - private static final int WGPUStorageTextureAccess_WriteOnly = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUStorageTextureAccess.WGPUStorageTextureAccess_WriteOnly = 1 - * } - */ - public static int WGPUStorageTextureAccess_WriteOnly() { - return WGPUStorageTextureAccess_WriteOnly; - } - private static final int WGPUStorageTextureAccess_ReadOnly = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUStorageTextureAccess.WGPUStorageTextureAccess_ReadOnly = 2 - * } - */ - public static int WGPUStorageTextureAccess_ReadOnly() { - return WGPUStorageTextureAccess_ReadOnly; - } - private static final int WGPUStorageTextureAccess_ReadWrite = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUStorageTextureAccess.WGPUStorageTextureAccess_ReadWrite = 3 - * } - */ - public static int WGPUStorageTextureAccess_ReadWrite() { - return WGPUStorageTextureAccess_ReadWrite; - } - private static final int WGPUStorageTextureAccess_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUStorageTextureAccess.WGPUStorageTextureAccess_Force32 = 2147483647 - * } - */ - public static int WGPUStorageTextureAccess_Force32() { - return WGPUStorageTextureAccess_Force32; - } - private static final int WGPUStoreOp_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUStoreOp.WGPUStoreOp_Undefined = 0 - * } - */ - public static int WGPUStoreOp_Undefined() { - return WGPUStoreOp_Undefined; - } - private static final int WGPUStoreOp_Store = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUStoreOp.WGPUStoreOp_Store = 1 - * } - */ - public static int WGPUStoreOp_Store() { - return WGPUStoreOp_Store; - } - private static final int WGPUStoreOp_Discard = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUStoreOp.WGPUStoreOp_Discard = 2 - * } - */ - public static int WGPUStoreOp_Discard() { - return WGPUStoreOp_Discard; - } - private static final int WGPUStoreOp_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUStoreOp.WGPUStoreOp_Force32 = 2147483647 - * } - */ - public static int WGPUStoreOp_Force32() { - return WGPUStoreOp_Force32; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_Success = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_Success = 0 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_Success() { - return WGPUSurfaceGetCurrentTextureStatus_Success; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_Timeout = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_Timeout = 1 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_Timeout() { - return WGPUSurfaceGetCurrentTextureStatus_Timeout; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_Outdated = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_Outdated = 2 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_Outdated() { - return WGPUSurfaceGetCurrentTextureStatus_Outdated; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_Lost = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_Lost = 3 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_Lost() { - return WGPUSurfaceGetCurrentTextureStatus_Lost; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_OutOfMemory = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_OutOfMemory = 4 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_OutOfMemory() { - return WGPUSurfaceGetCurrentTextureStatus_OutOfMemory; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_DeviceLost = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_DeviceLost = 5 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_DeviceLost() { - return WGPUSurfaceGetCurrentTextureStatus_DeviceLost; - } - private static final int WGPUSurfaceGetCurrentTextureStatus_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUSurfaceGetCurrentTextureStatus.WGPUSurfaceGetCurrentTextureStatus_Force32 = 2147483647 - * } - */ - public static int WGPUSurfaceGetCurrentTextureStatus_Force32() { - return WGPUSurfaceGetCurrentTextureStatus_Force32; - } - private static final int WGPUTextureAspect_All = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUTextureAspect.WGPUTextureAspect_All = 0 - * } - */ - public static int WGPUTextureAspect_All() { - return WGPUTextureAspect_All; - } - private static final int WGPUTextureAspect_StencilOnly = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUTextureAspect.WGPUTextureAspect_StencilOnly = 1 - * } - */ - public static int WGPUTextureAspect_StencilOnly() { - return WGPUTextureAspect_StencilOnly; - } - private static final int WGPUTextureAspect_DepthOnly = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUTextureAspect.WGPUTextureAspect_DepthOnly = 2 - * } - */ - public static int WGPUTextureAspect_DepthOnly() { - return WGPUTextureAspect_DepthOnly; - } - private static final int WGPUTextureAspect_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUTextureAspect.WGPUTextureAspect_Force32 = 2147483647 - * } - */ - public static int WGPUTextureAspect_Force32() { - return WGPUTextureAspect_Force32; - } - private static final int WGPUTextureDimension_1D = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUTextureDimension.WGPUTextureDimension_1D = 0 - * } - */ - public static int WGPUTextureDimension_1D() { - return WGPUTextureDimension_1D; - } - private static final int WGPUTextureDimension_2D = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUTextureDimension.WGPUTextureDimension_2D = 1 - * } - */ - public static int WGPUTextureDimension_2D() { - return WGPUTextureDimension_2D; - } - private static final int WGPUTextureDimension_3D = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUTextureDimension.WGPUTextureDimension_3D = 2 - * } - */ - public static int WGPUTextureDimension_3D() { - return WGPUTextureDimension_3D; - } - private static final int WGPUTextureDimension_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUTextureDimension.WGPUTextureDimension_Force32 = 2147483647 - * } - */ - public static int WGPUTextureDimension_Force32() { - return WGPUTextureDimension_Force32; - } - private static final int WGPUTextureFormat_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Undefined = 0 - * } - */ - public static int WGPUTextureFormat_Undefined() { - return WGPUTextureFormat_Undefined; - } - private static final int WGPUTextureFormat_R8Unorm = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R8Unorm = 1 - * } - */ - public static int WGPUTextureFormat_R8Unorm() { - return WGPUTextureFormat_R8Unorm; - } - private static final int WGPUTextureFormat_R8Snorm = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R8Snorm = 2 - * } - */ - public static int WGPUTextureFormat_R8Snorm() { - return WGPUTextureFormat_R8Snorm; - } - private static final int WGPUTextureFormat_R8Uint = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R8Uint = 3 - * } - */ - public static int WGPUTextureFormat_R8Uint() { - return WGPUTextureFormat_R8Uint; - } - private static final int WGPUTextureFormat_R8Sint = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R8Sint = 4 - * } - */ - public static int WGPUTextureFormat_R8Sint() { - return WGPUTextureFormat_R8Sint; - } - private static final int WGPUTextureFormat_R16Uint = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R16Uint = 5 - * } - */ - public static int WGPUTextureFormat_R16Uint() { - return WGPUTextureFormat_R16Uint; - } - private static final int WGPUTextureFormat_R16Sint = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R16Sint = 6 - * } - */ - public static int WGPUTextureFormat_R16Sint() { - return WGPUTextureFormat_R16Sint; - } - private static final int WGPUTextureFormat_R16Float = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R16Float = 7 - * } - */ - public static int WGPUTextureFormat_R16Float() { - return WGPUTextureFormat_R16Float; - } - private static final int WGPUTextureFormat_RG8Unorm = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG8Unorm = 8 - * } - */ - public static int WGPUTextureFormat_RG8Unorm() { - return WGPUTextureFormat_RG8Unorm; - } - private static final int WGPUTextureFormat_RG8Snorm = (int)9L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG8Snorm = 9 - * } - */ - public static int WGPUTextureFormat_RG8Snorm() { - return WGPUTextureFormat_RG8Snorm; - } - private static final int WGPUTextureFormat_RG8Uint = (int)10L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG8Uint = 10 - * } - */ - public static int WGPUTextureFormat_RG8Uint() { - return WGPUTextureFormat_RG8Uint; - } - private static final int WGPUTextureFormat_RG8Sint = (int)11L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG8Sint = 11 - * } - */ - public static int WGPUTextureFormat_RG8Sint() { - return WGPUTextureFormat_RG8Sint; - } - private static final int WGPUTextureFormat_R32Float = (int)12L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R32Float = 12 - * } - */ - public static int WGPUTextureFormat_R32Float() { - return WGPUTextureFormat_R32Float; - } - private static final int WGPUTextureFormat_R32Uint = (int)13L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R32Uint = 13 - * } - */ - public static int WGPUTextureFormat_R32Uint() { - return WGPUTextureFormat_R32Uint; - } - private static final int WGPUTextureFormat_R32Sint = (int)14L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_R32Sint = 14 - * } - */ - public static int WGPUTextureFormat_R32Sint() { - return WGPUTextureFormat_R32Sint; - } - private static final int WGPUTextureFormat_RG16Uint = (int)15L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG16Uint = 15 - * } - */ - public static int WGPUTextureFormat_RG16Uint() { - return WGPUTextureFormat_RG16Uint; - } - private static final int WGPUTextureFormat_RG16Sint = (int)16L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG16Sint = 16 - * } - */ - public static int WGPUTextureFormat_RG16Sint() { - return WGPUTextureFormat_RG16Sint; - } - private static final int WGPUTextureFormat_RG16Float = (int)17L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG16Float = 17 - * } - */ - public static int WGPUTextureFormat_RG16Float() { - return WGPUTextureFormat_RG16Float; - } - private static final int WGPUTextureFormat_RGBA8Unorm = (int)18L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA8Unorm = 18 - * } - */ - public static int WGPUTextureFormat_RGBA8Unorm() { - return WGPUTextureFormat_RGBA8Unorm; - } - private static final int WGPUTextureFormat_RGBA8UnormSrgb = (int)19L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA8UnormSrgb = 19 - * } - */ - public static int WGPUTextureFormat_RGBA8UnormSrgb() { - return WGPUTextureFormat_RGBA8UnormSrgb; - } - private static final int WGPUTextureFormat_RGBA8Snorm = (int)20L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA8Snorm = 20 - * } - */ - public static int WGPUTextureFormat_RGBA8Snorm() { - return WGPUTextureFormat_RGBA8Snorm; - } - private static final int WGPUTextureFormat_RGBA8Uint = (int)21L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA8Uint = 21 - * } - */ - public static int WGPUTextureFormat_RGBA8Uint() { - return WGPUTextureFormat_RGBA8Uint; - } - private static final int WGPUTextureFormat_RGBA8Sint = (int)22L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA8Sint = 22 - * } - */ - public static int WGPUTextureFormat_RGBA8Sint() { - return WGPUTextureFormat_RGBA8Sint; - } - private static final int WGPUTextureFormat_BGRA8Unorm = (int)23L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BGRA8Unorm = 23 - * } - */ - public static int WGPUTextureFormat_BGRA8Unorm() { - return WGPUTextureFormat_BGRA8Unorm; - } - private static final int WGPUTextureFormat_BGRA8UnormSrgb = (int)24L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BGRA8UnormSrgb = 24 - * } - */ - public static int WGPUTextureFormat_BGRA8UnormSrgb() { - return WGPUTextureFormat_BGRA8UnormSrgb; - } - private static final int WGPUTextureFormat_RGB10A2Uint = (int)25L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGB10A2Uint = 25 - * } - */ - public static int WGPUTextureFormat_RGB10A2Uint() { - return WGPUTextureFormat_RGB10A2Uint; - } - private static final int WGPUTextureFormat_RGB10A2Unorm = (int)26L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGB10A2Unorm = 26 - * } - */ - public static int WGPUTextureFormat_RGB10A2Unorm() { - return WGPUTextureFormat_RGB10A2Unorm; - } - private static final int WGPUTextureFormat_RG11B10Ufloat = (int)27L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG11B10Ufloat = 27 - * } - */ - public static int WGPUTextureFormat_RG11B10Ufloat() { - return WGPUTextureFormat_RG11B10Ufloat; - } - private static final int WGPUTextureFormat_RGB9E5Ufloat = (int)28L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGB9E5Ufloat = 28 - * } - */ - public static int WGPUTextureFormat_RGB9E5Ufloat() { - return WGPUTextureFormat_RGB9E5Ufloat; - } - private static final int WGPUTextureFormat_RG32Float = (int)29L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG32Float = 29 - * } - */ - public static int WGPUTextureFormat_RG32Float() { - return WGPUTextureFormat_RG32Float; - } - private static final int WGPUTextureFormat_RG32Uint = (int)30L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG32Uint = 30 - * } - */ - public static int WGPUTextureFormat_RG32Uint() { - return WGPUTextureFormat_RG32Uint; - } - private static final int WGPUTextureFormat_RG32Sint = (int)31L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RG32Sint = 31 - * } - */ - public static int WGPUTextureFormat_RG32Sint() { - return WGPUTextureFormat_RG32Sint; - } - private static final int WGPUTextureFormat_RGBA16Uint = (int)32L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA16Uint = 32 - * } - */ - public static int WGPUTextureFormat_RGBA16Uint() { - return WGPUTextureFormat_RGBA16Uint; - } - private static final int WGPUTextureFormat_RGBA16Sint = (int)33L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA16Sint = 33 - * } - */ - public static int WGPUTextureFormat_RGBA16Sint() { - return WGPUTextureFormat_RGBA16Sint; - } - private static final int WGPUTextureFormat_RGBA16Float = (int)34L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA16Float = 34 - * } - */ - public static int WGPUTextureFormat_RGBA16Float() { - return WGPUTextureFormat_RGBA16Float; - } - private static final int WGPUTextureFormat_RGBA32Float = (int)35L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA32Float = 35 - * } - */ - public static int WGPUTextureFormat_RGBA32Float() { - return WGPUTextureFormat_RGBA32Float; - } - private static final int WGPUTextureFormat_RGBA32Uint = (int)36L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA32Uint = 36 - * } - */ - public static int WGPUTextureFormat_RGBA32Uint() { - return WGPUTextureFormat_RGBA32Uint; - } - private static final int WGPUTextureFormat_RGBA32Sint = (int)37L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_RGBA32Sint = 37 - * } - */ - public static int WGPUTextureFormat_RGBA32Sint() { - return WGPUTextureFormat_RGBA32Sint; - } - private static final int WGPUTextureFormat_Stencil8 = (int)38L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Stencil8 = 38 - * } - */ - public static int WGPUTextureFormat_Stencil8() { - return WGPUTextureFormat_Stencil8; - } - private static final int WGPUTextureFormat_Depth16Unorm = (int)39L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Depth16Unorm = 39 - * } - */ - public static int WGPUTextureFormat_Depth16Unorm() { - return WGPUTextureFormat_Depth16Unorm; - } - private static final int WGPUTextureFormat_Depth24Plus = (int)40L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Depth24Plus = 40 - * } - */ - public static int WGPUTextureFormat_Depth24Plus() { - return WGPUTextureFormat_Depth24Plus; - } - private static final int WGPUTextureFormat_Depth24PlusStencil8 = (int)41L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Depth24PlusStencil8 = 41 - * } - */ - public static int WGPUTextureFormat_Depth24PlusStencil8() { - return WGPUTextureFormat_Depth24PlusStencil8; - } - private static final int WGPUTextureFormat_Depth32Float = (int)42L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Depth32Float = 42 - * } - */ - public static int WGPUTextureFormat_Depth32Float() { - return WGPUTextureFormat_Depth32Float; - } - private static final int WGPUTextureFormat_Depth32FloatStencil8 = (int)43L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Depth32FloatStencil8 = 43 - * } - */ - public static int WGPUTextureFormat_Depth32FloatStencil8() { - return WGPUTextureFormat_Depth32FloatStencil8; - } - private static final int WGPUTextureFormat_BC1RGBAUnorm = (int)44L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC1RGBAUnorm = 44 - * } - */ - public static int WGPUTextureFormat_BC1RGBAUnorm() { - return WGPUTextureFormat_BC1RGBAUnorm; - } - private static final int WGPUTextureFormat_BC1RGBAUnormSrgb = (int)45L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC1RGBAUnormSrgb = 45 - * } - */ - public static int WGPUTextureFormat_BC1RGBAUnormSrgb() { - return WGPUTextureFormat_BC1RGBAUnormSrgb; - } - private static final int WGPUTextureFormat_BC2RGBAUnorm = (int)46L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC2RGBAUnorm = 46 - * } - */ - public static int WGPUTextureFormat_BC2RGBAUnorm() { - return WGPUTextureFormat_BC2RGBAUnorm; - } - private static final int WGPUTextureFormat_BC2RGBAUnormSrgb = (int)47L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC2RGBAUnormSrgb = 47 - * } - */ - public static int WGPUTextureFormat_BC2RGBAUnormSrgb() { - return WGPUTextureFormat_BC2RGBAUnormSrgb; - } - private static final int WGPUTextureFormat_BC3RGBAUnorm = (int)48L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC3RGBAUnorm = 48 - * } - */ - public static int WGPUTextureFormat_BC3RGBAUnorm() { - return WGPUTextureFormat_BC3RGBAUnorm; - } - private static final int WGPUTextureFormat_BC3RGBAUnormSrgb = (int)49L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC3RGBAUnormSrgb = 49 - * } - */ - public static int WGPUTextureFormat_BC3RGBAUnormSrgb() { - return WGPUTextureFormat_BC3RGBAUnormSrgb; - } - private static final int WGPUTextureFormat_BC4RUnorm = (int)50L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC4RUnorm = 50 - * } - */ - public static int WGPUTextureFormat_BC4RUnorm() { - return WGPUTextureFormat_BC4RUnorm; - } - private static final int WGPUTextureFormat_BC4RSnorm = (int)51L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC4RSnorm = 51 - * } - */ - public static int WGPUTextureFormat_BC4RSnorm() { - return WGPUTextureFormat_BC4RSnorm; - } - private static final int WGPUTextureFormat_BC5RGUnorm = (int)52L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC5RGUnorm = 52 - * } - */ - public static int WGPUTextureFormat_BC5RGUnorm() { - return WGPUTextureFormat_BC5RGUnorm; - } - private static final int WGPUTextureFormat_BC5RGSnorm = (int)53L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC5RGSnorm = 53 - * } - */ - public static int WGPUTextureFormat_BC5RGSnorm() { - return WGPUTextureFormat_BC5RGSnorm; - } - private static final int WGPUTextureFormat_BC6HRGBUfloat = (int)54L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC6HRGBUfloat = 54 - * } - */ - public static int WGPUTextureFormat_BC6HRGBUfloat() { - return WGPUTextureFormat_BC6HRGBUfloat; - } - private static final int WGPUTextureFormat_BC6HRGBFloat = (int)55L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC6HRGBFloat = 55 - * } - */ - public static int WGPUTextureFormat_BC6HRGBFloat() { - return WGPUTextureFormat_BC6HRGBFloat; - } - private static final int WGPUTextureFormat_BC7RGBAUnorm = (int)56L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC7RGBAUnorm = 56 - * } - */ - public static int WGPUTextureFormat_BC7RGBAUnorm() { - return WGPUTextureFormat_BC7RGBAUnorm; - } - private static final int WGPUTextureFormat_BC7RGBAUnormSrgb = (int)57L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_BC7RGBAUnormSrgb = 57 - * } - */ - public static int WGPUTextureFormat_BC7RGBAUnormSrgb() { - return WGPUTextureFormat_BC7RGBAUnormSrgb; - } - private static final int WGPUTextureFormat_ETC2RGB8Unorm = (int)58L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ETC2RGB8Unorm = 58 - * } - */ - public static int WGPUTextureFormat_ETC2RGB8Unorm() { - return WGPUTextureFormat_ETC2RGB8Unorm; - } - private static final int WGPUTextureFormat_ETC2RGB8UnormSrgb = (int)59L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ETC2RGB8UnormSrgb = 59 - * } - */ - public static int WGPUTextureFormat_ETC2RGB8UnormSrgb() { - return WGPUTextureFormat_ETC2RGB8UnormSrgb; - } - private static final int WGPUTextureFormat_ETC2RGB8A1Unorm = (int)60L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ETC2RGB8A1Unorm = 60 - * } - */ - public static int WGPUTextureFormat_ETC2RGB8A1Unorm() { - return WGPUTextureFormat_ETC2RGB8A1Unorm; - } - private static final int WGPUTextureFormat_ETC2RGB8A1UnormSrgb = (int)61L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 61 - * } - */ - public static int WGPUTextureFormat_ETC2RGB8A1UnormSrgb() { - return WGPUTextureFormat_ETC2RGB8A1UnormSrgb; - } - private static final int WGPUTextureFormat_ETC2RGBA8Unorm = (int)62L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ETC2RGBA8Unorm = 62 - * } - */ - public static int WGPUTextureFormat_ETC2RGBA8Unorm() { - return WGPUTextureFormat_ETC2RGBA8Unorm; - } - private static final int WGPUTextureFormat_ETC2RGBA8UnormSrgb = (int)63L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ETC2RGBA8UnormSrgb = 63 - * } - */ - public static int WGPUTextureFormat_ETC2RGBA8UnormSrgb() { - return WGPUTextureFormat_ETC2RGBA8UnormSrgb; - } - private static final int WGPUTextureFormat_EACR11Unorm = (int)64L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_EACR11Unorm = 64 - * } - */ - public static int WGPUTextureFormat_EACR11Unorm() { - return WGPUTextureFormat_EACR11Unorm; - } - private static final int WGPUTextureFormat_EACR11Snorm = (int)65L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_EACR11Snorm = 65 - * } - */ - public static int WGPUTextureFormat_EACR11Snorm() { - return WGPUTextureFormat_EACR11Snorm; - } - private static final int WGPUTextureFormat_EACRG11Unorm = (int)66L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_EACRG11Unorm = 66 - * } - */ - public static int WGPUTextureFormat_EACRG11Unorm() { - return WGPUTextureFormat_EACRG11Unorm; - } - private static final int WGPUTextureFormat_EACRG11Snorm = (int)67L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_EACRG11Snorm = 67 - * } - */ - public static int WGPUTextureFormat_EACRG11Snorm() { - return WGPUTextureFormat_EACRG11Snorm; - } - private static final int WGPUTextureFormat_ASTC4x4Unorm = (int)68L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC4x4Unorm = 68 - * } - */ - public static int WGPUTextureFormat_ASTC4x4Unorm() { - return WGPUTextureFormat_ASTC4x4Unorm; - } - private static final int WGPUTextureFormat_ASTC4x4UnormSrgb = (int)69L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC4x4UnormSrgb = 69 - * } - */ - public static int WGPUTextureFormat_ASTC4x4UnormSrgb() { - return WGPUTextureFormat_ASTC4x4UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC5x4Unorm = (int)70L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC5x4Unorm = 70 - * } - */ - public static int WGPUTextureFormat_ASTC5x4Unorm() { - return WGPUTextureFormat_ASTC5x4Unorm; - } - private static final int WGPUTextureFormat_ASTC5x4UnormSrgb = (int)71L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC5x4UnormSrgb = 71 - * } - */ - public static int WGPUTextureFormat_ASTC5x4UnormSrgb() { - return WGPUTextureFormat_ASTC5x4UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC5x5Unorm = (int)72L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC5x5Unorm = 72 - * } - */ - public static int WGPUTextureFormat_ASTC5x5Unorm() { - return WGPUTextureFormat_ASTC5x5Unorm; - } - private static final int WGPUTextureFormat_ASTC5x5UnormSrgb = (int)73L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC5x5UnormSrgb = 73 - * } - */ - public static int WGPUTextureFormat_ASTC5x5UnormSrgb() { - return WGPUTextureFormat_ASTC5x5UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC6x5Unorm = (int)74L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC6x5Unorm = 74 - * } - */ - public static int WGPUTextureFormat_ASTC6x5Unorm() { - return WGPUTextureFormat_ASTC6x5Unorm; - } - private static final int WGPUTextureFormat_ASTC6x5UnormSrgb = (int)75L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC6x5UnormSrgb = 75 - * } - */ - public static int WGPUTextureFormat_ASTC6x5UnormSrgb() { - return WGPUTextureFormat_ASTC6x5UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC6x6Unorm = (int)76L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC6x6Unorm = 76 - * } - */ - public static int WGPUTextureFormat_ASTC6x6Unorm() { - return WGPUTextureFormat_ASTC6x6Unorm; - } - private static final int WGPUTextureFormat_ASTC6x6UnormSrgb = (int)77L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC6x6UnormSrgb = 77 - * } - */ - public static int WGPUTextureFormat_ASTC6x6UnormSrgb() { - return WGPUTextureFormat_ASTC6x6UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC8x5Unorm = (int)78L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC8x5Unorm = 78 - * } - */ - public static int WGPUTextureFormat_ASTC8x5Unorm() { - return WGPUTextureFormat_ASTC8x5Unorm; - } - private static final int WGPUTextureFormat_ASTC8x5UnormSrgb = (int)79L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC8x5UnormSrgb = 79 - * } - */ - public static int WGPUTextureFormat_ASTC8x5UnormSrgb() { - return WGPUTextureFormat_ASTC8x5UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC8x6Unorm = (int)80L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC8x6Unorm = 80 - * } - */ - public static int WGPUTextureFormat_ASTC8x6Unorm() { - return WGPUTextureFormat_ASTC8x6Unorm; - } - private static final int WGPUTextureFormat_ASTC8x6UnormSrgb = (int)81L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC8x6UnormSrgb = 81 - * } - */ - public static int WGPUTextureFormat_ASTC8x6UnormSrgb() { - return WGPUTextureFormat_ASTC8x6UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC8x8Unorm = (int)82L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC8x8Unorm = 82 - * } - */ - public static int WGPUTextureFormat_ASTC8x8Unorm() { - return WGPUTextureFormat_ASTC8x8Unorm; - } - private static final int WGPUTextureFormat_ASTC8x8UnormSrgb = (int)83L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC8x8UnormSrgb = 83 - * } - */ - public static int WGPUTextureFormat_ASTC8x8UnormSrgb() { - return WGPUTextureFormat_ASTC8x8UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC10x5Unorm = (int)84L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x5Unorm = 84 - * } - */ - public static int WGPUTextureFormat_ASTC10x5Unorm() { - return WGPUTextureFormat_ASTC10x5Unorm; - } - private static final int WGPUTextureFormat_ASTC10x5UnormSrgb = (int)85L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x5UnormSrgb = 85 - * } - */ - public static int WGPUTextureFormat_ASTC10x5UnormSrgb() { - return WGPUTextureFormat_ASTC10x5UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC10x6Unorm = (int)86L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x6Unorm = 86 - * } - */ - public static int WGPUTextureFormat_ASTC10x6Unorm() { - return WGPUTextureFormat_ASTC10x6Unorm; - } - private static final int WGPUTextureFormat_ASTC10x6UnormSrgb = (int)87L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x6UnormSrgb = 87 - * } - */ - public static int WGPUTextureFormat_ASTC10x6UnormSrgb() { - return WGPUTextureFormat_ASTC10x6UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC10x8Unorm = (int)88L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x8Unorm = 88 - * } - */ - public static int WGPUTextureFormat_ASTC10x8Unorm() { - return WGPUTextureFormat_ASTC10x8Unorm; - } - private static final int WGPUTextureFormat_ASTC10x8UnormSrgb = (int)89L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x8UnormSrgb = 89 - * } - */ - public static int WGPUTextureFormat_ASTC10x8UnormSrgb() { - return WGPUTextureFormat_ASTC10x8UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC10x10Unorm = (int)90L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x10Unorm = 90 - * } - */ - public static int WGPUTextureFormat_ASTC10x10Unorm() { - return WGPUTextureFormat_ASTC10x10Unorm; - } - private static final int WGPUTextureFormat_ASTC10x10UnormSrgb = (int)91L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC10x10UnormSrgb = 91 - * } - */ - public static int WGPUTextureFormat_ASTC10x10UnormSrgb() { - return WGPUTextureFormat_ASTC10x10UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC12x10Unorm = (int)92L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC12x10Unorm = 92 - * } - */ - public static int WGPUTextureFormat_ASTC12x10Unorm() { - return WGPUTextureFormat_ASTC12x10Unorm; - } - private static final int WGPUTextureFormat_ASTC12x10UnormSrgb = (int)93L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC12x10UnormSrgb = 93 - * } - */ - public static int WGPUTextureFormat_ASTC12x10UnormSrgb() { - return WGPUTextureFormat_ASTC12x10UnormSrgb; - } - private static final int WGPUTextureFormat_ASTC12x12Unorm = (int)94L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC12x12Unorm = 94 - * } - */ - public static int WGPUTextureFormat_ASTC12x12Unorm() { - return WGPUTextureFormat_ASTC12x12Unorm; - } - private static final int WGPUTextureFormat_ASTC12x12UnormSrgb = (int)95L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_ASTC12x12UnormSrgb = 95 - * } - */ - public static int WGPUTextureFormat_ASTC12x12UnormSrgb() { - return WGPUTextureFormat_ASTC12x12UnormSrgb; - } - private static final int WGPUTextureFormat_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUTextureFormat.WGPUTextureFormat_Force32 = 2147483647 - * } - */ - public static int WGPUTextureFormat_Force32() { - return WGPUTextureFormat_Force32; - } - private static final int WGPUTextureSampleType_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_Undefined = 0 - * } - */ - public static int WGPUTextureSampleType_Undefined() { - return WGPUTextureSampleType_Undefined; - } - private static final int WGPUTextureSampleType_Float = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_Float = 1 - * } - */ - public static int WGPUTextureSampleType_Float() { - return WGPUTextureSampleType_Float; - } - private static final int WGPUTextureSampleType_UnfilterableFloat = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_UnfilterableFloat = 2 - * } - */ - public static int WGPUTextureSampleType_UnfilterableFloat() { - return WGPUTextureSampleType_UnfilterableFloat; - } - private static final int WGPUTextureSampleType_Depth = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_Depth = 3 - * } - */ - public static int WGPUTextureSampleType_Depth() { - return WGPUTextureSampleType_Depth; - } - private static final int WGPUTextureSampleType_Sint = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_Sint = 4 - * } - */ - public static int WGPUTextureSampleType_Sint() { - return WGPUTextureSampleType_Sint; - } - private static final int WGPUTextureSampleType_Uint = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_Uint = 5 - * } - */ - public static int WGPUTextureSampleType_Uint() { - return WGPUTextureSampleType_Uint; - } - private static final int WGPUTextureSampleType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUTextureSampleType.WGPUTextureSampleType_Force32 = 2147483647 - * } - */ - public static int WGPUTextureSampleType_Force32() { - return WGPUTextureSampleType_Force32; - } - private static final int WGPUTextureViewDimension_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_Undefined = 0 - * } - */ - public static int WGPUTextureViewDimension_Undefined() { - return WGPUTextureViewDimension_Undefined; - } - private static final int WGPUTextureViewDimension_1D = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_1D = 1 - * } - */ - public static int WGPUTextureViewDimension_1D() { - return WGPUTextureViewDimension_1D; - } - private static final int WGPUTextureViewDimension_2D = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_2D = 2 - * } - */ - public static int WGPUTextureViewDimension_2D() { - return WGPUTextureViewDimension_2D; - } - private static final int WGPUTextureViewDimension_2DArray = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_2DArray = 3 - * } - */ - public static int WGPUTextureViewDimension_2DArray() { - return WGPUTextureViewDimension_2DArray; - } - private static final int WGPUTextureViewDimension_Cube = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_Cube = 4 - * } - */ - public static int WGPUTextureViewDimension_Cube() { - return WGPUTextureViewDimension_Cube; - } - private static final int WGPUTextureViewDimension_CubeArray = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_CubeArray = 5 - * } - */ - public static int WGPUTextureViewDimension_CubeArray() { - return WGPUTextureViewDimension_CubeArray; - } - private static final int WGPUTextureViewDimension_3D = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_3D = 6 - * } - */ - public static int WGPUTextureViewDimension_3D() { - return WGPUTextureViewDimension_3D; - } - private static final int WGPUTextureViewDimension_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUTextureViewDimension.WGPUTextureViewDimension_Force32 = 2147483647 - * } - */ - public static int WGPUTextureViewDimension_Force32() { - return WGPUTextureViewDimension_Force32; - } - private static final int WGPUVertexFormat_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Undefined = 0 - * } - */ - public static int WGPUVertexFormat_Undefined() { - return WGPUVertexFormat_Undefined; - } - private static final int WGPUVertexFormat_Uint8x2 = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint8x2 = 1 - * } - */ - public static int WGPUVertexFormat_Uint8x2() { - return WGPUVertexFormat_Uint8x2; - } - private static final int WGPUVertexFormat_Uint8x4 = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint8x4 = 2 - * } - */ - public static int WGPUVertexFormat_Uint8x4() { - return WGPUVertexFormat_Uint8x4; - } - private static final int WGPUVertexFormat_Sint8x2 = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint8x2 = 3 - * } - */ - public static int WGPUVertexFormat_Sint8x2() { - return WGPUVertexFormat_Sint8x2; - } - private static final int WGPUVertexFormat_Sint8x4 = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint8x4 = 4 - * } - */ - public static int WGPUVertexFormat_Sint8x4() { - return WGPUVertexFormat_Sint8x4; - } - private static final int WGPUVertexFormat_Unorm8x2 = (int)5L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Unorm8x2 = 5 - * } - */ - public static int WGPUVertexFormat_Unorm8x2() { - return WGPUVertexFormat_Unorm8x2; - } - private static final int WGPUVertexFormat_Unorm8x4 = (int)6L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Unorm8x4 = 6 - * } - */ - public static int WGPUVertexFormat_Unorm8x4() { - return WGPUVertexFormat_Unorm8x4; - } - private static final int WGPUVertexFormat_Snorm8x2 = (int)7L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Snorm8x2 = 7 - * } - */ - public static int WGPUVertexFormat_Snorm8x2() { - return WGPUVertexFormat_Snorm8x2; - } - private static final int WGPUVertexFormat_Snorm8x4 = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Snorm8x4 = 8 - * } - */ - public static int WGPUVertexFormat_Snorm8x4() { - return WGPUVertexFormat_Snorm8x4; - } - private static final int WGPUVertexFormat_Uint16x2 = (int)9L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint16x2 = 9 - * } - */ - public static int WGPUVertexFormat_Uint16x2() { - return WGPUVertexFormat_Uint16x2; - } - private static final int WGPUVertexFormat_Uint16x4 = (int)10L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint16x4 = 10 - * } - */ - public static int WGPUVertexFormat_Uint16x4() { - return WGPUVertexFormat_Uint16x4; - } - private static final int WGPUVertexFormat_Sint16x2 = (int)11L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint16x2 = 11 - * } - */ - public static int WGPUVertexFormat_Sint16x2() { - return WGPUVertexFormat_Sint16x2; - } - private static final int WGPUVertexFormat_Sint16x4 = (int)12L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint16x4 = 12 - * } - */ - public static int WGPUVertexFormat_Sint16x4() { - return WGPUVertexFormat_Sint16x4; - } - private static final int WGPUVertexFormat_Unorm16x2 = (int)13L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Unorm16x2 = 13 - * } - */ - public static int WGPUVertexFormat_Unorm16x2() { - return WGPUVertexFormat_Unorm16x2; - } - private static final int WGPUVertexFormat_Unorm16x4 = (int)14L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Unorm16x4 = 14 - * } - */ - public static int WGPUVertexFormat_Unorm16x4() { - return WGPUVertexFormat_Unorm16x4; - } - private static final int WGPUVertexFormat_Snorm16x2 = (int)15L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Snorm16x2 = 15 - * } - */ - public static int WGPUVertexFormat_Snorm16x2() { - return WGPUVertexFormat_Snorm16x2; - } - private static final int WGPUVertexFormat_Snorm16x4 = (int)16L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Snorm16x4 = 16 - * } - */ - public static int WGPUVertexFormat_Snorm16x4() { - return WGPUVertexFormat_Snorm16x4; - } - private static final int WGPUVertexFormat_Float16x2 = (int)17L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Float16x2 = 17 - * } - */ - public static int WGPUVertexFormat_Float16x2() { - return WGPUVertexFormat_Float16x2; - } - private static final int WGPUVertexFormat_Float16x4 = (int)18L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Float16x4 = 18 - * } - */ - public static int WGPUVertexFormat_Float16x4() { - return WGPUVertexFormat_Float16x4; - } - private static final int WGPUVertexFormat_Float32 = (int)19L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Float32 = 19 - * } - */ - public static int WGPUVertexFormat_Float32() { - return WGPUVertexFormat_Float32; - } - private static final int WGPUVertexFormat_Float32x2 = (int)20L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Float32x2 = 20 - * } - */ - public static int WGPUVertexFormat_Float32x2() { - return WGPUVertexFormat_Float32x2; - } - private static final int WGPUVertexFormat_Float32x3 = (int)21L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Float32x3 = 21 - * } - */ - public static int WGPUVertexFormat_Float32x3() { - return WGPUVertexFormat_Float32x3; - } - private static final int WGPUVertexFormat_Float32x4 = (int)22L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Float32x4 = 22 - * } - */ - public static int WGPUVertexFormat_Float32x4() { - return WGPUVertexFormat_Float32x4; - } - private static final int WGPUVertexFormat_Uint32 = (int)23L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint32 = 23 - * } - */ - public static int WGPUVertexFormat_Uint32() { - return WGPUVertexFormat_Uint32; - } - private static final int WGPUVertexFormat_Uint32x2 = (int)24L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint32x2 = 24 - * } - */ - public static int WGPUVertexFormat_Uint32x2() { - return WGPUVertexFormat_Uint32x2; - } - private static final int WGPUVertexFormat_Uint32x3 = (int)25L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint32x3 = 25 - * } - */ - public static int WGPUVertexFormat_Uint32x3() { - return WGPUVertexFormat_Uint32x3; - } - private static final int WGPUVertexFormat_Uint32x4 = (int)26L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Uint32x4 = 26 - * } - */ - public static int WGPUVertexFormat_Uint32x4() { - return WGPUVertexFormat_Uint32x4; - } - private static final int WGPUVertexFormat_Sint32 = (int)27L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint32 = 27 - * } - */ - public static int WGPUVertexFormat_Sint32() { - return WGPUVertexFormat_Sint32; - } - private static final int WGPUVertexFormat_Sint32x2 = (int)28L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint32x2 = 28 - * } - */ - public static int WGPUVertexFormat_Sint32x2() { - return WGPUVertexFormat_Sint32x2; - } - private static final int WGPUVertexFormat_Sint32x3 = (int)29L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint32x3 = 29 - * } - */ - public static int WGPUVertexFormat_Sint32x3() { - return WGPUVertexFormat_Sint32x3; - } - private static final int WGPUVertexFormat_Sint32x4 = (int)30L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Sint32x4 = 30 - * } - */ - public static int WGPUVertexFormat_Sint32x4() { - return WGPUVertexFormat_Sint32x4; - } - private static final int WGPUVertexFormat_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUVertexFormat.WGPUVertexFormat_Force32 = 2147483647 - * } - */ - public static int WGPUVertexFormat_Force32() { - return WGPUVertexFormat_Force32; - } - private static final int WGPUVertexStepMode_Vertex = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUVertexStepMode.WGPUVertexStepMode_Vertex = 0 - * } - */ - public static int WGPUVertexStepMode_Vertex() { - return WGPUVertexStepMode_Vertex; - } - private static final int WGPUVertexStepMode_Instance = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUVertexStepMode.WGPUVertexStepMode_Instance = 1 - * } - */ - public static int WGPUVertexStepMode_Instance() { - return WGPUVertexStepMode_Instance; - } - private static final int WGPUVertexStepMode_VertexBufferNotUsed = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUVertexStepMode.WGPUVertexStepMode_VertexBufferNotUsed = 2 - * } - */ - public static int WGPUVertexStepMode_VertexBufferNotUsed() { - return WGPUVertexStepMode_VertexBufferNotUsed; - } - private static final int WGPUVertexStepMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUVertexStepMode.WGPUVertexStepMode_Force32 = 2147483647 - * } - */ - public static int WGPUVertexStepMode_Force32() { - return WGPUVertexStepMode_Force32; - } - private static final int WGPUBufferUsage_None = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_None = 0 - * } - */ - public static int WGPUBufferUsage_None() { - return WGPUBufferUsage_None; - } - private static final int WGPUBufferUsage_MapRead = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_MapRead = 1 - * } - */ - public static int WGPUBufferUsage_MapRead() { - return WGPUBufferUsage_MapRead; - } - private static final int WGPUBufferUsage_MapWrite = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_MapWrite = 2 - * } - */ - public static int WGPUBufferUsage_MapWrite() { - return WGPUBufferUsage_MapWrite; - } - private static final int WGPUBufferUsage_CopySrc = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_CopySrc = 4 - * } - */ - public static int WGPUBufferUsage_CopySrc() { - return WGPUBufferUsage_CopySrc; - } - private static final int WGPUBufferUsage_CopyDst = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_CopyDst = 8 - * } - */ - public static int WGPUBufferUsage_CopyDst() { - return WGPUBufferUsage_CopyDst; - } - private static final int WGPUBufferUsage_Index = (int)16L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_Index = 16 - * } - */ - public static int WGPUBufferUsage_Index() { - return WGPUBufferUsage_Index; - } - private static final int WGPUBufferUsage_Vertex = (int)32L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_Vertex = 32 - * } - */ - public static int WGPUBufferUsage_Vertex() { - return WGPUBufferUsage_Vertex; - } - private static final int WGPUBufferUsage_Uniform = (int)64L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_Uniform = 64 - * } - */ - public static int WGPUBufferUsage_Uniform() { - return WGPUBufferUsage_Uniform; - } - private static final int WGPUBufferUsage_Storage = (int)128L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_Storage = 128 - * } - */ - public static int WGPUBufferUsage_Storage() { - return WGPUBufferUsage_Storage; - } - private static final int WGPUBufferUsage_Indirect = (int)256L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_Indirect = 256 - * } - */ - public static int WGPUBufferUsage_Indirect() { - return WGPUBufferUsage_Indirect; - } - private static final int WGPUBufferUsage_QueryResolve = (int)512L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_QueryResolve = 512 - * } - */ - public static int WGPUBufferUsage_QueryResolve() { - return WGPUBufferUsage_QueryResolve; - } - private static final int WGPUBufferUsage_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUBufferUsage.WGPUBufferUsage_Force32 = 2147483647 - * } - */ - public static int WGPUBufferUsage_Force32() { - return WGPUBufferUsage_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUBufferUsageFlags - * } - */ - public static final OfInt WGPUBufferUsageFlags = WGPU.C_INT; - private static final int WGPUColorWriteMask_None = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_None = 0 - * } - */ - public static int WGPUColorWriteMask_None() { - return WGPUColorWriteMask_None; - } - private static final int WGPUColorWriteMask_Red = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_Red = 1 - * } - */ - public static int WGPUColorWriteMask_Red() { - return WGPUColorWriteMask_Red; - } - private static final int WGPUColorWriteMask_Green = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_Green = 2 - * } - */ - public static int WGPUColorWriteMask_Green() { - return WGPUColorWriteMask_Green; - } - private static final int WGPUColorWriteMask_Blue = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_Blue = 4 - * } - */ - public static int WGPUColorWriteMask_Blue() { - return WGPUColorWriteMask_Blue; - } - private static final int WGPUColorWriteMask_Alpha = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_Alpha = 8 - * } - */ - public static int WGPUColorWriteMask_Alpha() { - return WGPUColorWriteMask_Alpha; - } - private static final int WGPUColorWriteMask_All = (int)15L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_All = 15 - * } - */ - public static int WGPUColorWriteMask_All() { - return WGPUColorWriteMask_All; - } - private static final int WGPUColorWriteMask_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUColorWriteMask.WGPUColorWriteMask_Force32 = 2147483647 - * } - */ - public static int WGPUColorWriteMask_Force32() { - return WGPUColorWriteMask_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUColorWriteMaskFlags - * } - */ - public static final OfInt WGPUColorWriteMaskFlags = WGPU.C_INT; - private static final int WGPUMapMode_None = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUMapMode.WGPUMapMode_None = 0 - * } - */ - public static int WGPUMapMode_None() { - return WGPUMapMode_None; - } - private static final int WGPUMapMode_Read = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUMapMode.WGPUMapMode_Read = 1 - * } - */ - public static int WGPUMapMode_Read() { - return WGPUMapMode_Read; - } - private static final int WGPUMapMode_Write = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUMapMode.WGPUMapMode_Write = 2 - * } - */ - public static int WGPUMapMode_Write() { - return WGPUMapMode_Write; - } - private static final int WGPUMapMode_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUMapMode.WGPUMapMode_Force32 = 2147483647 - * } - */ - public static int WGPUMapMode_Force32() { - return WGPUMapMode_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUMapModeFlags - * } - */ - public static final OfInt WGPUMapModeFlags = WGPU.C_INT; - private static final int WGPUShaderStage_None = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUShaderStage.WGPUShaderStage_None = 0 - * } - */ - public static int WGPUShaderStage_None() { - return WGPUShaderStage_None; - } - private static final int WGPUShaderStage_Vertex = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUShaderStage.WGPUShaderStage_Vertex = 1 - * } - */ - public static int WGPUShaderStage_Vertex() { - return WGPUShaderStage_Vertex; - } - private static final int WGPUShaderStage_Fragment = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUShaderStage.WGPUShaderStage_Fragment = 2 - * } - */ - public static int WGPUShaderStage_Fragment() { - return WGPUShaderStage_Fragment; - } - private static final int WGPUShaderStage_Compute = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUShaderStage.WGPUShaderStage_Compute = 4 - * } - */ - public static int WGPUShaderStage_Compute() { - return WGPUShaderStage_Compute; - } - private static final int WGPUShaderStage_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUShaderStage.WGPUShaderStage_Force32 = 2147483647 - * } - */ - public static int WGPUShaderStage_Force32() { - return WGPUShaderStage_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUShaderStageFlags - * } - */ - public static final OfInt WGPUShaderStageFlags = WGPU.C_INT; - private static final int WGPUTextureUsage_None = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_None = 0 - * } - */ - public static int WGPUTextureUsage_None() { - return WGPUTextureUsage_None; - } - private static final int WGPUTextureUsage_CopySrc = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_CopySrc = 1 - * } - */ - public static int WGPUTextureUsage_CopySrc() { - return WGPUTextureUsage_CopySrc; - } - private static final int WGPUTextureUsage_CopyDst = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_CopyDst = 2 - * } - */ - public static int WGPUTextureUsage_CopyDst() { - return WGPUTextureUsage_CopyDst; - } - private static final int WGPUTextureUsage_TextureBinding = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_TextureBinding = 4 - * } - */ - public static int WGPUTextureUsage_TextureBinding() { - return WGPUTextureUsage_TextureBinding; - } - private static final int WGPUTextureUsage_StorageBinding = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_StorageBinding = 8 - * } - */ - public static int WGPUTextureUsage_StorageBinding() { - return WGPUTextureUsage_StorageBinding; - } - private static final int WGPUTextureUsage_RenderAttachment = (int)16L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_RenderAttachment = 16 - * } - */ - public static int WGPUTextureUsage_RenderAttachment() { - return WGPUTextureUsage_RenderAttachment; - } - private static final int WGPUTextureUsage_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUTextureUsage.WGPUTextureUsage_Force32 = 2147483647 - * } - */ - public static int WGPUTextureUsage_Force32() { - return WGPUTextureUsage_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUTextureUsageFlags - * } - */ - public static final OfInt WGPUTextureUsageFlags = WGPU.C_INT; - - private static class wgpuCreateInstance { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCreateInstance"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUInstance wgpuCreateInstance(const WGPUInstanceDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuCreateInstance$descriptor() { - return wgpuCreateInstance.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUInstance wgpuCreateInstance(const WGPUInstanceDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuCreateInstance$handle() { - return wgpuCreateInstance.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUInstance wgpuCreateInstance(const WGPUInstanceDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCreateInstance$address() { - return wgpuCreateInstance.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUInstance wgpuCreateInstance(const WGPUInstanceDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCreateInstance(MemorySegment descriptor) { - var mh$ = wgpuCreateInstance.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCreateInstance", descriptor); - } - return (MemorySegment)mh$.invokeExact(descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuGetProcAddress { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuGetProcAddress"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUProc wgpuGetProcAddress(WGPUDevice device, const char *procName) - * } - */ - public static FunctionDescriptor wgpuGetProcAddress$descriptor() { - return wgpuGetProcAddress.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUProc wgpuGetProcAddress(WGPUDevice device, const char *procName) - * } - */ - public static MethodHandle wgpuGetProcAddress$handle() { - return wgpuGetProcAddress.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUProc wgpuGetProcAddress(WGPUDevice device, const char *procName) - * } - */ - public static MemorySegment wgpuGetProcAddress$address() { - return wgpuGetProcAddress.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUProc wgpuGetProcAddress(WGPUDevice device, const char *procName) - * } - */ - public static MemorySegment wgpuGetProcAddress(MemorySegment device, MemorySegment procName) { - var mh$ = wgpuGetProcAddress.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuGetProcAddress", device, procName); - } - return (MemorySegment)mh$.invokeExact(device, procName); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterEnumerateFeatures { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterEnumerateFeatures"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName *features) - * } - */ - public static FunctionDescriptor wgpuAdapterEnumerateFeatures$descriptor() { - return wgpuAdapterEnumerateFeatures.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName *features) - * } - */ - public static MethodHandle wgpuAdapterEnumerateFeatures$handle() { - return wgpuAdapterEnumerateFeatures.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName *features) - * } - */ - public static MemorySegment wgpuAdapterEnumerateFeatures$address() { - return wgpuAdapterEnumerateFeatures.ADDR; - } - - /** - * {@snippet lang=c : - * size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName *features) - * } - */ - public static long wgpuAdapterEnumerateFeatures(MemorySegment adapter, MemorySegment features) { - var mh$ = wgpuAdapterEnumerateFeatures.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterEnumerateFeatures", adapter, features); - } - return (long)mh$.invokeExact(adapter, features); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterGetLimits { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterGetLimits"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits *limits) - * } - */ - public static FunctionDescriptor wgpuAdapterGetLimits$descriptor() { - return wgpuAdapterGetLimits.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits *limits) - * } - */ - public static MethodHandle wgpuAdapterGetLimits$handle() { - return wgpuAdapterGetLimits.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits *limits) - * } - */ - public static MemorySegment wgpuAdapterGetLimits$address() { - return wgpuAdapterGetLimits.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits *limits) - * } - */ - public static int wgpuAdapterGetLimits(MemorySegment adapter, MemorySegment limits) { - var mh$ = wgpuAdapterGetLimits.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterGetLimits", adapter, limits); - } - return (int)mh$.invokeExact(adapter, limits); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterGetProperties { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterGetProperties"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties *properties) - * } - */ - public static FunctionDescriptor wgpuAdapterGetProperties$descriptor() { - return wgpuAdapterGetProperties.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties *properties) - * } - */ - public static MethodHandle wgpuAdapterGetProperties$handle() { - return wgpuAdapterGetProperties.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties *properties) - * } - */ - public static MemorySegment wgpuAdapterGetProperties$address() { - return wgpuAdapterGetProperties.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties *properties) - * } - */ - public static void wgpuAdapterGetProperties(MemorySegment adapter, MemorySegment properties) { - var mh$ = wgpuAdapterGetProperties.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterGetProperties", adapter, properties); - } - mh$.invokeExact(adapter, properties); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterHasFeature { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterHasFeature"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) - * } - */ - public static FunctionDescriptor wgpuAdapterHasFeature$descriptor() { - return wgpuAdapterHasFeature.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) - * } - */ - public static MethodHandle wgpuAdapterHasFeature$handle() { - return wgpuAdapterHasFeature.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) - * } - */ - public static MemorySegment wgpuAdapterHasFeature$address() { - return wgpuAdapterHasFeature.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) - * } - */ - public static int wgpuAdapterHasFeature(MemorySegment adapter, int feature) { - var mh$ = wgpuAdapterHasFeature.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterHasFeature", adapter, feature); - } - return (int)mh$.invokeExact(adapter, feature); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterRequestDevice { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterRequestDevice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuAdapterRequestDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor *descriptor, WGPURequestDeviceCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuAdapterRequestDevice$descriptor() { - return wgpuAdapterRequestDevice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuAdapterRequestDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor *descriptor, WGPURequestDeviceCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuAdapterRequestDevice$handle() { - return wgpuAdapterRequestDevice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuAdapterRequestDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor *descriptor, WGPURequestDeviceCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuAdapterRequestDevice$address() { - return wgpuAdapterRequestDevice.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuAdapterRequestDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor *descriptor, WGPURequestDeviceCallback callback, void *userdata) - * } - */ - public static void wgpuAdapterRequestDevice(MemorySegment adapter, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuAdapterRequestDevice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterRequestDevice", adapter, descriptor, callback, userdata); - } - mh$.invokeExact(adapter, descriptor, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuAdapterReference(WGPUAdapter adapter) - * } - */ - public static FunctionDescriptor wgpuAdapterReference$descriptor() { - return wgpuAdapterReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuAdapterReference(WGPUAdapter adapter) - * } - */ - public static MethodHandle wgpuAdapterReference$handle() { - return wgpuAdapterReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuAdapterReference(WGPUAdapter adapter) - * } - */ - public static MemorySegment wgpuAdapterReference$address() { - return wgpuAdapterReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuAdapterReference(WGPUAdapter adapter) - * } - */ - public static void wgpuAdapterReference(MemorySegment adapter) { - var mh$ = wgpuAdapterReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterReference", adapter); - } - mh$.invokeExact(adapter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuAdapterRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuAdapterRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuAdapterRelease(WGPUAdapter adapter) - * } - */ - public static FunctionDescriptor wgpuAdapterRelease$descriptor() { - return wgpuAdapterRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuAdapterRelease(WGPUAdapter adapter) - * } - */ - public static MethodHandle wgpuAdapterRelease$handle() { - return wgpuAdapterRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuAdapterRelease(WGPUAdapter adapter) - * } - */ - public static MemorySegment wgpuAdapterRelease$address() { - return wgpuAdapterRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuAdapterRelease(WGPUAdapter adapter) - * } - */ - public static void wgpuAdapterRelease(MemorySegment adapter) { - var mh$ = wgpuAdapterRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuAdapterRelease", adapter); - } - mh$.invokeExact(adapter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBindGroupSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBindGroupSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, const char *label) - * } - */ - public static FunctionDescriptor wgpuBindGroupSetLabel$descriptor() { - return wgpuBindGroupSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, const char *label) - * } - */ - public static MethodHandle wgpuBindGroupSetLabel$handle() { - return wgpuBindGroupSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, const char *label) - * } - */ - public static MemorySegment wgpuBindGroupSetLabel$address() { - return wgpuBindGroupSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, const char *label) - * } - */ - public static void wgpuBindGroupSetLabel(MemorySegment bindGroup, MemorySegment label) { - var mh$ = wgpuBindGroupSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBindGroupSetLabel", bindGroup, label); - } - mh$.invokeExact(bindGroup, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBindGroupReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBindGroupReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBindGroupReference(WGPUBindGroup bindGroup) - * } - */ - public static FunctionDescriptor wgpuBindGroupReference$descriptor() { - return wgpuBindGroupReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBindGroupReference(WGPUBindGroup bindGroup) - * } - */ - public static MethodHandle wgpuBindGroupReference$handle() { - return wgpuBindGroupReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBindGroupReference(WGPUBindGroup bindGroup) - * } - */ - public static MemorySegment wgpuBindGroupReference$address() { - return wgpuBindGroupReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBindGroupReference(WGPUBindGroup bindGroup) - * } - */ - public static void wgpuBindGroupReference(MemorySegment bindGroup) { - var mh$ = wgpuBindGroupReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBindGroupReference", bindGroup); - } - mh$.invokeExact(bindGroup); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBindGroupRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBindGroupRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBindGroupRelease(WGPUBindGroup bindGroup) - * } - */ - public static FunctionDescriptor wgpuBindGroupRelease$descriptor() { - return wgpuBindGroupRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBindGroupRelease(WGPUBindGroup bindGroup) - * } - */ - public static MethodHandle wgpuBindGroupRelease$handle() { - return wgpuBindGroupRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBindGroupRelease(WGPUBindGroup bindGroup) - * } - */ - public static MemorySegment wgpuBindGroupRelease$address() { - return wgpuBindGroupRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBindGroupRelease(WGPUBindGroup bindGroup) - * } - */ - public static void wgpuBindGroupRelease(MemorySegment bindGroup) { - var mh$ = wgpuBindGroupRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBindGroupRelease", bindGroup); - } - mh$.invokeExact(bindGroup); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBindGroupLayoutSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBindGroupLayoutSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, const char *label) - * } - */ - public static FunctionDescriptor wgpuBindGroupLayoutSetLabel$descriptor() { - return wgpuBindGroupLayoutSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, const char *label) - * } - */ - public static MethodHandle wgpuBindGroupLayoutSetLabel$handle() { - return wgpuBindGroupLayoutSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, const char *label) - * } - */ - public static MemorySegment wgpuBindGroupLayoutSetLabel$address() { - return wgpuBindGroupLayoutSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, const char *label) - * } - */ - public static void wgpuBindGroupLayoutSetLabel(MemorySegment bindGroupLayout, MemorySegment label) { - var mh$ = wgpuBindGroupLayoutSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBindGroupLayoutSetLabel", bindGroupLayout, label); - } - mh$.invokeExact(bindGroupLayout, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBindGroupLayoutReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBindGroupLayoutReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static FunctionDescriptor wgpuBindGroupLayoutReference$descriptor() { - return wgpuBindGroupLayoutReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static MethodHandle wgpuBindGroupLayoutReference$handle() { - return wgpuBindGroupLayoutReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static MemorySegment wgpuBindGroupLayoutReference$address() { - return wgpuBindGroupLayoutReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static void wgpuBindGroupLayoutReference(MemorySegment bindGroupLayout) { - var mh$ = wgpuBindGroupLayoutReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBindGroupLayoutReference", bindGroupLayout); - } - mh$.invokeExact(bindGroupLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBindGroupLayoutRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBindGroupLayoutRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static FunctionDescriptor wgpuBindGroupLayoutRelease$descriptor() { - return wgpuBindGroupLayoutRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static MethodHandle wgpuBindGroupLayoutRelease$handle() { - return wgpuBindGroupLayoutRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static MemorySegment wgpuBindGroupLayoutRelease$address() { - return wgpuBindGroupLayoutRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) - * } - */ - public static void wgpuBindGroupLayoutRelease(MemorySegment bindGroupLayout) { - var mh$ = wgpuBindGroupLayoutRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBindGroupLayoutRelease", bindGroupLayout); - } - mh$.invokeExact(bindGroupLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferDestroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferDestroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBufferDestroy(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferDestroy$descriptor() { - return wgpuBufferDestroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBufferDestroy(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferDestroy$handle() { - return wgpuBufferDestroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBufferDestroy(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferDestroy$address() { - return wgpuBufferDestroy.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBufferDestroy(WGPUBuffer buffer) - * } - */ - public static void wgpuBufferDestroy(MemorySegment buffer) { - var mh$ = wgpuBufferDestroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferDestroy", buffer); - } - mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferGetConstMappedRange { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferGetConstMappedRange"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const void *wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static FunctionDescriptor wgpuBufferGetConstMappedRange$descriptor() { - return wgpuBufferGetConstMappedRange.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const void *wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static MethodHandle wgpuBufferGetConstMappedRange$handle() { - return wgpuBufferGetConstMappedRange.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const void *wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static MemorySegment wgpuBufferGetConstMappedRange$address() { - return wgpuBufferGetConstMappedRange.ADDR; - } - - /** - * {@snippet lang=c : - * const void *wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static MemorySegment wgpuBufferGetConstMappedRange(MemorySegment buffer, long offset, long size) { - var mh$ = wgpuBufferGetConstMappedRange.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferGetConstMappedRange", buffer, offset, size); - } - return (MemorySegment)mh$.invokeExact(buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferGetMapState { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferGetMapState"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferGetMapState$descriptor() { - return wgpuBufferGetMapState.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferGetMapState$handle() { - return wgpuBufferGetMapState.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferGetMapState$address() { - return wgpuBufferGetMapState.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) - * } - */ - public static int wgpuBufferGetMapState(MemorySegment buffer) { - var mh$ = wgpuBufferGetMapState.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferGetMapState", buffer); - } - return (int)mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferGetMappedRange { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferGetMappedRange"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void *wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static FunctionDescriptor wgpuBufferGetMappedRange$descriptor() { - return wgpuBufferGetMappedRange.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void *wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static MethodHandle wgpuBufferGetMappedRange$handle() { - return wgpuBufferGetMappedRange.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void *wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static MemorySegment wgpuBufferGetMappedRange$address() { - return wgpuBufferGetMappedRange.ADDR; - } - - /** - * {@snippet lang=c : - * void *wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) - * } - */ - public static MemorySegment wgpuBufferGetMappedRange(MemorySegment buffer, long offset, long size) { - var mh$ = wgpuBufferGetMappedRange.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferGetMappedRange", buffer, offset, size); - } - return (MemorySegment)mh$.invokeExact(buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferGetSize { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferGetSize"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint64_t wgpuBufferGetSize(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferGetSize$descriptor() { - return wgpuBufferGetSize.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint64_t wgpuBufferGetSize(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferGetSize$handle() { - return wgpuBufferGetSize.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint64_t wgpuBufferGetSize(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferGetSize$address() { - return wgpuBufferGetSize.ADDR; - } - - /** - * {@snippet lang=c : - * uint64_t wgpuBufferGetSize(WGPUBuffer buffer) - * } - */ - public static long wgpuBufferGetSize(MemorySegment buffer) { - var mh$ = wgpuBufferGetSize.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferGetSize", buffer); - } - return (long)mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferGetUsage { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferGetUsage"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBufferUsageFlags wgpuBufferGetUsage(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferGetUsage$descriptor() { - return wgpuBufferGetUsage.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBufferUsageFlags wgpuBufferGetUsage(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferGetUsage$handle() { - return wgpuBufferGetUsage.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBufferUsageFlags wgpuBufferGetUsage(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferGetUsage$address() { - return wgpuBufferGetUsage.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBufferUsageFlags wgpuBufferGetUsage(WGPUBuffer buffer) - * } - */ - public static int wgpuBufferGetUsage(MemorySegment buffer) { - var mh$ = wgpuBufferGetUsage.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferGetUsage", buffer); - } - return (int)mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferMapAsync { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferMapAsync"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuBufferMapAsync$descriptor() { - return wgpuBufferMapAsync.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuBufferMapAsync$handle() { - return wgpuBufferMapAsync.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuBufferMapAsync$address() { - return wgpuBufferMapAsync.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void *userdata) - * } - */ - public static void wgpuBufferMapAsync(MemorySegment buffer, int mode, long offset, long size, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuBufferMapAsync.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferMapAsync", buffer, mode, offset, size, callback, userdata); - } - mh$.invokeExact(buffer, mode, offset, size, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBufferSetLabel(WGPUBuffer buffer, const char *label) - * } - */ - public static FunctionDescriptor wgpuBufferSetLabel$descriptor() { - return wgpuBufferSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBufferSetLabel(WGPUBuffer buffer, const char *label) - * } - */ - public static MethodHandle wgpuBufferSetLabel$handle() { - return wgpuBufferSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBufferSetLabel(WGPUBuffer buffer, const char *label) - * } - */ - public static MemorySegment wgpuBufferSetLabel$address() { - return wgpuBufferSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBufferSetLabel(WGPUBuffer buffer, const char *label) - * } - */ - public static void wgpuBufferSetLabel(MemorySegment buffer, MemorySegment label) { - var mh$ = wgpuBufferSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferSetLabel", buffer, label); - } - mh$.invokeExact(buffer, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferUnmap { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferUnmap"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBufferUnmap(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferUnmap$descriptor() { - return wgpuBufferUnmap.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBufferUnmap(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferUnmap$handle() { - return wgpuBufferUnmap.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBufferUnmap(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferUnmap$address() { - return wgpuBufferUnmap.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBufferUnmap(WGPUBuffer buffer) - * } - */ - public static void wgpuBufferUnmap(MemorySegment buffer) { - var mh$ = wgpuBufferUnmap.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferUnmap", buffer); - } - mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBufferReference(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferReference$descriptor() { - return wgpuBufferReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBufferReference(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferReference$handle() { - return wgpuBufferReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBufferReference(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferReference$address() { - return wgpuBufferReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBufferReference(WGPUBuffer buffer) - * } - */ - public static void wgpuBufferReference(MemorySegment buffer) { - var mh$ = wgpuBufferReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferReference", buffer); - } - mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuBufferRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuBufferRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuBufferRelease(WGPUBuffer buffer) - * } - */ - public static FunctionDescriptor wgpuBufferRelease$descriptor() { - return wgpuBufferRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuBufferRelease(WGPUBuffer buffer) - * } - */ - public static MethodHandle wgpuBufferRelease$handle() { - return wgpuBufferRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuBufferRelease(WGPUBuffer buffer) - * } - */ - public static MemorySegment wgpuBufferRelease$address() { - return wgpuBufferRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuBufferRelease(WGPUBuffer buffer) - * } - */ - public static void wgpuBufferRelease(MemorySegment buffer) { - var mh$ = wgpuBufferRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuBufferRelease", buffer); - } - mh$.invokeExact(buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandBufferSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandBufferSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, const char *label) - * } - */ - public static FunctionDescriptor wgpuCommandBufferSetLabel$descriptor() { - return wgpuCommandBufferSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, const char *label) - * } - */ - public static MethodHandle wgpuCommandBufferSetLabel$handle() { - return wgpuCommandBufferSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, const char *label) - * } - */ - public static MemorySegment wgpuCommandBufferSetLabel$address() { - return wgpuCommandBufferSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, const char *label) - * } - */ - public static void wgpuCommandBufferSetLabel(MemorySegment commandBuffer, MemorySegment label) { - var mh$ = wgpuCommandBufferSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandBufferSetLabel", commandBuffer, label); - } - mh$.invokeExact(commandBuffer, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandBufferReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandBufferReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer) - * } - */ - public static FunctionDescriptor wgpuCommandBufferReference$descriptor() { - return wgpuCommandBufferReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer) - * } - */ - public static MethodHandle wgpuCommandBufferReference$handle() { - return wgpuCommandBufferReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer) - * } - */ - public static MemorySegment wgpuCommandBufferReference$address() { - return wgpuCommandBufferReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer) - * } - */ - public static void wgpuCommandBufferReference(MemorySegment commandBuffer) { - var mh$ = wgpuCommandBufferReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandBufferReference", commandBuffer); - } - mh$.invokeExact(commandBuffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandBufferRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandBufferRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) - * } - */ - public static FunctionDescriptor wgpuCommandBufferRelease$descriptor() { - return wgpuCommandBufferRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) - * } - */ - public static MethodHandle wgpuCommandBufferRelease$handle() { - return wgpuCommandBufferRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) - * } - */ - public static MemorySegment wgpuCommandBufferRelease$address() { - return wgpuCommandBufferRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) - * } - */ - public static void wgpuCommandBufferRelease(MemorySegment commandBuffer) { - var mh$ = wgpuCommandBufferRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandBufferRelease", commandBuffer); - } - mh$.invokeExact(commandBuffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderBeginComputePass { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderBeginComputePass"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, const WGPUComputePassDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderBeginComputePass$descriptor() { - return wgpuCommandEncoderBeginComputePass.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, const WGPUComputePassDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuCommandEncoderBeginComputePass$handle() { - return wgpuCommandEncoderBeginComputePass.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, const WGPUComputePassDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCommandEncoderBeginComputePass$address() { - return wgpuCommandEncoderBeginComputePass.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, const WGPUComputePassDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCommandEncoderBeginComputePass(MemorySegment commandEncoder, MemorySegment descriptor) { - var mh$ = wgpuCommandEncoderBeginComputePass.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderBeginComputePass", commandEncoder, descriptor); - } - return (MemorySegment)mh$.invokeExact(commandEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderBeginRenderPass { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderBeginRenderPass"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, const WGPURenderPassDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderBeginRenderPass$descriptor() { - return wgpuCommandEncoderBeginRenderPass.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, const WGPURenderPassDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuCommandEncoderBeginRenderPass$handle() { - return wgpuCommandEncoderBeginRenderPass.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, const WGPURenderPassDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCommandEncoderBeginRenderPass$address() { - return wgpuCommandEncoderBeginRenderPass.ADDR; - } - - /** - * {@snippet lang=c : - * WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, const WGPURenderPassDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCommandEncoderBeginRenderPass(MemorySegment commandEncoder, MemorySegment descriptor) { - var mh$ = wgpuCommandEncoderBeginRenderPass.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderBeginRenderPass", commandEncoder, descriptor); - } - return (MemorySegment)mh$.invokeExact(commandEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderClearBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderClearBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderClearBuffer$descriptor() { - return wgpuCommandEncoderClearBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static MethodHandle wgpuCommandEncoderClearBuffer$handle() { - return wgpuCommandEncoderClearBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static MemorySegment wgpuCommandEncoderClearBuffer$address() { - return wgpuCommandEncoderClearBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static void wgpuCommandEncoderClearBuffer(MemorySegment commandEncoder, MemorySegment buffer, long offset, long size) { - var mh$ = wgpuCommandEncoderClearBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderClearBuffer", commandEncoder, buffer, offset, size); - } - mh$.invokeExact(commandEncoder, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderCopyBufferToBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderCopyBufferToBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderCopyBufferToBuffer$descriptor() { - return wgpuCommandEncoderCopyBufferToBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) - * } - */ - public static MethodHandle wgpuCommandEncoderCopyBufferToBuffer$handle() { - return wgpuCommandEncoderCopyBufferToBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) - * } - */ - public static MemorySegment wgpuCommandEncoderCopyBufferToBuffer$address() { - return wgpuCommandEncoderCopyBufferToBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) - * } - */ - public static void wgpuCommandEncoderCopyBufferToBuffer(MemorySegment commandEncoder, MemorySegment source, long sourceOffset, MemorySegment destination, long destinationOffset, long size) { - var mh$ = wgpuCommandEncoderCopyBufferToBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderCopyBufferToBuffer", commandEncoder, source, sourceOffset, destination, destinationOffset, size); - } - mh$.invokeExact(commandEncoder, source, sourceOffset, destination, destinationOffset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderCopyBufferToTexture { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderCopyBufferToTexture"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyBuffer *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderCopyBufferToTexture$descriptor() { - return wgpuCommandEncoderCopyBufferToTexture.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyBuffer *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static MethodHandle wgpuCommandEncoderCopyBufferToTexture$handle() { - return wgpuCommandEncoderCopyBufferToTexture.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyBuffer *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static MemorySegment wgpuCommandEncoderCopyBufferToTexture$address() { - return wgpuCommandEncoderCopyBufferToTexture.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyBuffer *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static void wgpuCommandEncoderCopyBufferToTexture(MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize) { - var mh$ = wgpuCommandEncoderCopyBufferToTexture.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderCopyBufferToTexture", commandEncoder, source, destination, copySize); - } - mh$.invokeExact(commandEncoder, source, destination, copySize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderCopyTextureToBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderCopyTextureToBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyBuffer *destination, const WGPUExtent3D *copySize) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderCopyTextureToBuffer$descriptor() { - return wgpuCommandEncoderCopyTextureToBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyBuffer *destination, const WGPUExtent3D *copySize) - * } - */ - public static MethodHandle wgpuCommandEncoderCopyTextureToBuffer$handle() { - return wgpuCommandEncoderCopyTextureToBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyBuffer *destination, const WGPUExtent3D *copySize) - * } - */ - public static MemorySegment wgpuCommandEncoderCopyTextureToBuffer$address() { - return wgpuCommandEncoderCopyTextureToBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyBuffer *destination, const WGPUExtent3D *copySize) - * } - */ - public static void wgpuCommandEncoderCopyTextureToBuffer(MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize) { - var mh$ = wgpuCommandEncoderCopyTextureToBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderCopyTextureToBuffer", commandEncoder, source, destination, copySize); - } - mh$.invokeExact(commandEncoder, source, destination, copySize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderCopyTextureToTexture { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderCopyTextureToTexture"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderCopyTextureToTexture$descriptor() { - return wgpuCommandEncoderCopyTextureToTexture.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static MethodHandle wgpuCommandEncoderCopyTextureToTexture$handle() { - return wgpuCommandEncoderCopyTextureToTexture.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static MemorySegment wgpuCommandEncoderCopyTextureToTexture$address() { - return wgpuCommandEncoderCopyTextureToTexture.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, const WGPUImageCopyTexture *source, const WGPUImageCopyTexture *destination, const WGPUExtent3D *copySize) - * } - */ - public static void wgpuCommandEncoderCopyTextureToTexture(MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize) { - var mh$ = wgpuCommandEncoderCopyTextureToTexture.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderCopyTextureToTexture", commandEncoder, source, destination, copySize); - } - mh$.invokeExact(commandEncoder, source, destination, copySize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderFinish { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderFinish"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, const WGPUCommandBufferDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderFinish$descriptor() { - return wgpuCommandEncoderFinish.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, const WGPUCommandBufferDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuCommandEncoderFinish$handle() { - return wgpuCommandEncoderFinish.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, const WGPUCommandBufferDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCommandEncoderFinish$address() { - return wgpuCommandEncoderFinish.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, const WGPUCommandBufferDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuCommandEncoderFinish(MemorySegment commandEncoder, MemorySegment descriptor) { - var mh$ = wgpuCommandEncoderFinish.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderFinish", commandEncoder, descriptor); - } - return (MemorySegment)mh$.invokeExact(commandEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderInsertDebugMarker { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderInsertDebugMarker"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, const char *markerLabel) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderInsertDebugMarker$descriptor() { - return wgpuCommandEncoderInsertDebugMarker.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, const char *markerLabel) - * } - */ - public static MethodHandle wgpuCommandEncoderInsertDebugMarker$handle() { - return wgpuCommandEncoderInsertDebugMarker.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, const char *markerLabel) - * } - */ - public static MemorySegment wgpuCommandEncoderInsertDebugMarker$address() { - return wgpuCommandEncoderInsertDebugMarker.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, const char *markerLabel) - * } - */ - public static void wgpuCommandEncoderInsertDebugMarker(MemorySegment commandEncoder, MemorySegment markerLabel) { - var mh$ = wgpuCommandEncoderInsertDebugMarker.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderInsertDebugMarker", commandEncoder, markerLabel); - } - mh$.invokeExact(commandEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderPopDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderPopDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderPopDebugGroup$descriptor() { - return wgpuCommandEncoderPopDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) - * } - */ - public static MethodHandle wgpuCommandEncoderPopDebugGroup$handle() { - return wgpuCommandEncoderPopDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) - * } - */ - public static MemorySegment wgpuCommandEncoderPopDebugGroup$address() { - return wgpuCommandEncoderPopDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) - * } - */ - public static void wgpuCommandEncoderPopDebugGroup(MemorySegment commandEncoder) { - var mh$ = wgpuCommandEncoderPopDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderPopDebugGroup", commandEncoder); - } - mh$.invokeExact(commandEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderPushDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderPushDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, const char *groupLabel) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderPushDebugGroup$descriptor() { - return wgpuCommandEncoderPushDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, const char *groupLabel) - * } - */ - public static MethodHandle wgpuCommandEncoderPushDebugGroup$handle() { - return wgpuCommandEncoderPushDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, const char *groupLabel) - * } - */ - public static MemorySegment wgpuCommandEncoderPushDebugGroup$address() { - return wgpuCommandEncoderPushDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, const char *groupLabel) - * } - */ - public static void wgpuCommandEncoderPushDebugGroup(MemorySegment commandEncoder, MemorySegment groupLabel) { - var mh$ = wgpuCommandEncoderPushDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderPushDebugGroup", commandEncoder, groupLabel); - } - mh$.invokeExact(commandEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderResolveQuerySet { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderResolveQuerySet"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderResolveQuerySet$descriptor() { - return wgpuCommandEncoderResolveQuerySet.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) - * } - */ - public static MethodHandle wgpuCommandEncoderResolveQuerySet$handle() { - return wgpuCommandEncoderResolveQuerySet.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) - * } - */ - public static MemorySegment wgpuCommandEncoderResolveQuerySet$address() { - return wgpuCommandEncoderResolveQuerySet.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) - * } - */ - public static void wgpuCommandEncoderResolveQuerySet(MemorySegment commandEncoder, MemorySegment querySet, int firstQuery, int queryCount, MemorySegment destination, long destinationOffset) { - var mh$ = wgpuCommandEncoderResolveQuerySet.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderResolveQuerySet", commandEncoder, querySet, firstQuery, queryCount, destination, destinationOffset); - } - mh$.invokeExact(commandEncoder, querySet, firstQuery, queryCount, destination, destinationOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, const char *label) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderSetLabel$descriptor() { - return wgpuCommandEncoderSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, const char *label) - * } - */ - public static MethodHandle wgpuCommandEncoderSetLabel$handle() { - return wgpuCommandEncoderSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, const char *label) - * } - */ - public static MemorySegment wgpuCommandEncoderSetLabel$address() { - return wgpuCommandEncoderSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, const char *label) - * } - */ - public static void wgpuCommandEncoderSetLabel(MemorySegment commandEncoder, MemorySegment label) { - var mh$ = wgpuCommandEncoderSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderSetLabel", commandEncoder, label); - } - mh$.invokeExact(commandEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderWriteTimestamp { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderWriteTimestamp"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderWriteTimestamp$descriptor() { - return wgpuCommandEncoderWriteTimestamp.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static MethodHandle wgpuCommandEncoderWriteTimestamp$handle() { - return wgpuCommandEncoderWriteTimestamp.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static MemorySegment wgpuCommandEncoderWriteTimestamp$address() { - return wgpuCommandEncoderWriteTimestamp.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static void wgpuCommandEncoderWriteTimestamp(MemorySegment commandEncoder, MemorySegment querySet, int queryIndex) { - var mh$ = wgpuCommandEncoderWriteTimestamp.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderWriteTimestamp", commandEncoder, querySet, queryIndex); - } - mh$.invokeExact(commandEncoder, querySet, queryIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderReference$descriptor() { - return wgpuCommandEncoderReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder) - * } - */ - public static MethodHandle wgpuCommandEncoderReference$handle() { - return wgpuCommandEncoderReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder) - * } - */ - public static MemorySegment wgpuCommandEncoderReference$address() { - return wgpuCommandEncoderReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder) - * } - */ - public static void wgpuCommandEncoderReference(MemorySegment commandEncoder) { - var mh$ = wgpuCommandEncoderReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderReference", commandEncoder); - } - mh$.invokeExact(commandEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuCommandEncoderRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuCommandEncoderRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) - * } - */ - public static FunctionDescriptor wgpuCommandEncoderRelease$descriptor() { - return wgpuCommandEncoderRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) - * } - */ - public static MethodHandle wgpuCommandEncoderRelease$handle() { - return wgpuCommandEncoderRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) - * } - */ - public static MemorySegment wgpuCommandEncoderRelease$address() { - return wgpuCommandEncoderRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) - * } - */ - public static void wgpuCommandEncoderRelease(MemorySegment commandEncoder) { - var mh$ = wgpuCommandEncoderRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuCommandEncoderRelease", commandEncoder); - } - mh$.invokeExact(commandEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderDispatchWorkgroups { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderDispatchWorkgroups"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderDispatchWorkgroups$descriptor() { - return wgpuComputePassEncoderDispatchWorkgroups.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) - * } - */ - public static MethodHandle wgpuComputePassEncoderDispatchWorkgroups$handle() { - return wgpuComputePassEncoderDispatchWorkgroups.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) - * } - */ - public static MemorySegment wgpuComputePassEncoderDispatchWorkgroups$address() { - return wgpuComputePassEncoderDispatchWorkgroups.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) - * } - */ - public static void wgpuComputePassEncoderDispatchWorkgroups(MemorySegment computePassEncoder, int workgroupCountX, int workgroupCountY, int workgroupCountZ) { - var mh$ = wgpuComputePassEncoderDispatchWorkgroups.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderDispatchWorkgroups", computePassEncoder, workgroupCountX, workgroupCountY, workgroupCountZ); - } - mh$.invokeExact(computePassEncoder, workgroupCountX, workgroupCountY, workgroupCountZ); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderDispatchWorkgroupsIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderDispatchWorkgroupsIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderDispatchWorkgroupsIndirect$descriptor() { - return wgpuComputePassEncoderDispatchWorkgroupsIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MethodHandle wgpuComputePassEncoderDispatchWorkgroupsIndirect$handle() { - return wgpuComputePassEncoderDispatchWorkgroupsIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MemorySegment wgpuComputePassEncoderDispatchWorkgroupsIndirect$address() { - return wgpuComputePassEncoderDispatchWorkgroupsIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static void wgpuComputePassEncoderDispatchWorkgroupsIndirect(MemorySegment computePassEncoder, MemorySegment indirectBuffer, long indirectOffset) { - var mh$ = wgpuComputePassEncoderDispatchWorkgroupsIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderDispatchWorkgroupsIndirect", computePassEncoder, indirectBuffer, indirectOffset); - } - mh$.invokeExact(computePassEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderEnd { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderEnd"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderEnd$descriptor() { - return wgpuComputePassEncoderEnd.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MethodHandle wgpuComputePassEncoderEnd$handle() { - return wgpuComputePassEncoderEnd.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MemorySegment wgpuComputePassEncoderEnd$address() { - return wgpuComputePassEncoderEnd.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static void wgpuComputePassEncoderEnd(MemorySegment computePassEncoder) { - var mh$ = wgpuComputePassEncoderEnd.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderEnd", computePassEncoder); - } - mh$.invokeExact(computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderInsertDebugMarker { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderInsertDebugMarker"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, const char *markerLabel) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderInsertDebugMarker$descriptor() { - return wgpuComputePassEncoderInsertDebugMarker.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, const char *markerLabel) - * } - */ - public static MethodHandle wgpuComputePassEncoderInsertDebugMarker$handle() { - return wgpuComputePassEncoderInsertDebugMarker.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, const char *markerLabel) - * } - */ - public static MemorySegment wgpuComputePassEncoderInsertDebugMarker$address() { - return wgpuComputePassEncoderInsertDebugMarker.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, const char *markerLabel) - * } - */ - public static void wgpuComputePassEncoderInsertDebugMarker(MemorySegment computePassEncoder, MemorySegment markerLabel) { - var mh$ = wgpuComputePassEncoderInsertDebugMarker.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderInsertDebugMarker", computePassEncoder, markerLabel); - } - mh$.invokeExact(computePassEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderPopDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderPopDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderPopDebugGroup$descriptor() { - return wgpuComputePassEncoderPopDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MethodHandle wgpuComputePassEncoderPopDebugGroup$handle() { - return wgpuComputePassEncoderPopDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MemorySegment wgpuComputePassEncoderPopDebugGroup$address() { - return wgpuComputePassEncoderPopDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static void wgpuComputePassEncoderPopDebugGroup(MemorySegment computePassEncoder) { - var mh$ = wgpuComputePassEncoderPopDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderPopDebugGroup", computePassEncoder); - } - mh$.invokeExact(computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderPushDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderPushDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, const char *groupLabel) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderPushDebugGroup$descriptor() { - return wgpuComputePassEncoderPushDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, const char *groupLabel) - * } - */ - public static MethodHandle wgpuComputePassEncoderPushDebugGroup$handle() { - return wgpuComputePassEncoderPushDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, const char *groupLabel) - * } - */ - public static MemorySegment wgpuComputePassEncoderPushDebugGroup$address() { - return wgpuComputePassEncoderPushDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, const char *groupLabel) - * } - */ - public static void wgpuComputePassEncoderPushDebugGroup(MemorySegment computePassEncoder, MemorySegment groupLabel) { - var mh$ = wgpuComputePassEncoderPushDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderPushDebugGroup", computePassEncoder, groupLabel); - } - mh$.invokeExact(computePassEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderSetBindGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderSetBindGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderSetBindGroup$descriptor() { - return wgpuComputePassEncoderSetBindGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static MethodHandle wgpuComputePassEncoderSetBindGroup$handle() { - return wgpuComputePassEncoderSetBindGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static MemorySegment wgpuComputePassEncoderSetBindGroup$address() { - return wgpuComputePassEncoderSetBindGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static void wgpuComputePassEncoderSetBindGroup(MemorySegment computePassEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets) { - var mh$ = wgpuComputePassEncoderSetBindGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderSetBindGroup", computePassEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } - mh$.invokeExact(computePassEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, const char *label) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderSetLabel$descriptor() { - return wgpuComputePassEncoderSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, const char *label) - * } - */ - public static MethodHandle wgpuComputePassEncoderSetLabel$handle() { - return wgpuComputePassEncoderSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, const char *label) - * } - */ - public static MemorySegment wgpuComputePassEncoderSetLabel$address() { - return wgpuComputePassEncoderSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, const char *label) - * } - */ - public static void wgpuComputePassEncoderSetLabel(MemorySegment computePassEncoder, MemorySegment label) { - var mh$ = wgpuComputePassEncoderSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderSetLabel", computePassEncoder, label); - } - mh$.invokeExact(computePassEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderSetPipeline { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderSetPipeline"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderSetPipeline$descriptor() { - return wgpuComputePassEncoderSetPipeline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) - * } - */ - public static MethodHandle wgpuComputePassEncoderSetPipeline$handle() { - return wgpuComputePassEncoderSetPipeline.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) - * } - */ - public static MemorySegment wgpuComputePassEncoderSetPipeline$address() { - return wgpuComputePassEncoderSetPipeline.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) - * } - */ - public static void wgpuComputePassEncoderSetPipeline(MemorySegment computePassEncoder, MemorySegment pipeline) { - var mh$ = wgpuComputePassEncoderSetPipeline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderSetPipeline", computePassEncoder, pipeline); - } - mh$.invokeExact(computePassEncoder, pipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderReference$descriptor() { - return wgpuComputePassEncoderReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MethodHandle wgpuComputePassEncoderReference$handle() { - return wgpuComputePassEncoderReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MemorySegment wgpuComputePassEncoderReference$address() { - return wgpuComputePassEncoderReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static void wgpuComputePassEncoderReference(MemorySegment computePassEncoder) { - var mh$ = wgpuComputePassEncoderReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderReference", computePassEncoder); - } - mh$.invokeExact(computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderRelease$descriptor() { - return wgpuComputePassEncoderRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MethodHandle wgpuComputePassEncoderRelease$handle() { - return wgpuComputePassEncoderRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MemorySegment wgpuComputePassEncoderRelease$address() { - return wgpuComputePassEncoderRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static void wgpuComputePassEncoderRelease(MemorySegment computePassEncoder) { - var mh$ = wgpuComputePassEncoderRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderRelease", computePassEncoder); - } - mh$.invokeExact(computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePipelineGetBindGroupLayout { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePipelineGetBindGroupLayout"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) - * } - */ - public static FunctionDescriptor wgpuComputePipelineGetBindGroupLayout$descriptor() { - return wgpuComputePipelineGetBindGroupLayout.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) - * } - */ - public static MethodHandle wgpuComputePipelineGetBindGroupLayout$handle() { - return wgpuComputePipelineGetBindGroupLayout.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) - * } - */ - public static MemorySegment wgpuComputePipelineGetBindGroupLayout$address() { - return wgpuComputePipelineGetBindGroupLayout.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) - * } - */ - public static MemorySegment wgpuComputePipelineGetBindGroupLayout(MemorySegment computePipeline, int groupIndex) { - var mh$ = wgpuComputePipelineGetBindGroupLayout.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePipelineGetBindGroupLayout", computePipeline, groupIndex); - } - return (MemorySegment)mh$.invokeExact(computePipeline, groupIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePipelineSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePipelineSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, const char *label) - * } - */ - public static FunctionDescriptor wgpuComputePipelineSetLabel$descriptor() { - return wgpuComputePipelineSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, const char *label) - * } - */ - public static MethodHandle wgpuComputePipelineSetLabel$handle() { - return wgpuComputePipelineSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, const char *label) - * } - */ - public static MemorySegment wgpuComputePipelineSetLabel$address() { - return wgpuComputePipelineSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, const char *label) - * } - */ - public static void wgpuComputePipelineSetLabel(MemorySegment computePipeline, MemorySegment label) { - var mh$ = wgpuComputePipelineSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePipelineSetLabel", computePipeline, label); - } - mh$.invokeExact(computePipeline, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePipelineReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePipelineReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePipelineReference(WGPUComputePipeline computePipeline) - * } - */ - public static FunctionDescriptor wgpuComputePipelineReference$descriptor() { - return wgpuComputePipelineReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePipelineReference(WGPUComputePipeline computePipeline) - * } - */ - public static MethodHandle wgpuComputePipelineReference$handle() { - return wgpuComputePipelineReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePipelineReference(WGPUComputePipeline computePipeline) - * } - */ - public static MemorySegment wgpuComputePipelineReference$address() { - return wgpuComputePipelineReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePipelineReference(WGPUComputePipeline computePipeline) - * } - */ - public static void wgpuComputePipelineReference(MemorySegment computePipeline) { - var mh$ = wgpuComputePipelineReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePipelineReference", computePipeline); - } - mh$.invokeExact(computePipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePipelineRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePipelineRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) - * } - */ - public static FunctionDescriptor wgpuComputePipelineRelease$descriptor() { - return wgpuComputePipelineRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) - * } - */ - public static MethodHandle wgpuComputePipelineRelease$handle() { - return wgpuComputePipelineRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) - * } - */ - public static MemorySegment wgpuComputePipelineRelease$address() { - return wgpuComputePipelineRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) - * } - */ - public static void wgpuComputePipelineRelease(MemorySegment computePipeline) { - var mh$ = wgpuComputePipelineRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePipelineRelease", computePipeline); - } - mh$.invokeExact(computePipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateBindGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateBindGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, const WGPUBindGroupDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateBindGroup$descriptor() { - return wgpuDeviceCreateBindGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, const WGPUBindGroupDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateBindGroup$handle() { - return wgpuDeviceCreateBindGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, const WGPUBindGroupDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateBindGroup$address() { - return wgpuDeviceCreateBindGroup.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, const WGPUBindGroupDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateBindGroup(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateBindGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateBindGroup", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateBindGroupLayout { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateBindGroupLayout"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, const WGPUBindGroupLayoutDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateBindGroupLayout$descriptor() { - return wgpuDeviceCreateBindGroupLayout.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, const WGPUBindGroupLayoutDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateBindGroupLayout$handle() { - return wgpuDeviceCreateBindGroupLayout.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, const WGPUBindGroupLayoutDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateBindGroupLayout$address() { - return wgpuDeviceCreateBindGroupLayout.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, const WGPUBindGroupLayoutDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateBindGroupLayout(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateBindGroupLayout.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateBindGroupLayout", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, const WGPUBufferDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateBuffer$descriptor() { - return wgpuDeviceCreateBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, const WGPUBufferDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateBuffer$handle() { - return wgpuDeviceCreateBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, const WGPUBufferDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateBuffer$address() { - return wgpuDeviceCreateBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, const WGPUBufferDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateBuffer(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateBuffer", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateCommandEncoder { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateCommandEncoder"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, const WGPUCommandEncoderDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateCommandEncoder$descriptor() { - return wgpuDeviceCreateCommandEncoder.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, const WGPUCommandEncoderDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateCommandEncoder$handle() { - return wgpuDeviceCreateCommandEncoder.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, const WGPUCommandEncoderDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateCommandEncoder$address() { - return wgpuDeviceCreateCommandEncoder.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, const WGPUCommandEncoderDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateCommandEncoder(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateCommandEncoder.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateCommandEncoder", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateComputePipeline { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateComputePipeline"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateComputePipeline$descriptor() { - return wgpuDeviceCreateComputePipeline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateComputePipeline$handle() { - return wgpuDeviceCreateComputePipeline.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateComputePipeline$address() { - return wgpuDeviceCreateComputePipeline.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateComputePipeline(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateComputePipeline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateComputePipeline", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateComputePipelineAsync { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateComputePipelineAsync"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor, WGPUCreateComputePipelineAsyncCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateComputePipelineAsync$descriptor() { - return wgpuDeviceCreateComputePipelineAsync.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor, WGPUCreateComputePipelineAsyncCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuDeviceCreateComputePipelineAsync$handle() { - return wgpuDeviceCreateComputePipelineAsync.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor, WGPUCreateComputePipelineAsyncCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuDeviceCreateComputePipelineAsync$address() { - return wgpuDeviceCreateComputePipelineAsync.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, const WGPUComputePipelineDescriptor *descriptor, WGPUCreateComputePipelineAsyncCallback callback, void *userdata) - * } - */ - public static void wgpuDeviceCreateComputePipelineAsync(MemorySegment device, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuDeviceCreateComputePipelineAsync.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateComputePipelineAsync", device, descriptor, callback, userdata); - } - mh$.invokeExact(device, descriptor, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreatePipelineLayout { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreatePipelineLayout"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, const WGPUPipelineLayoutDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreatePipelineLayout$descriptor() { - return wgpuDeviceCreatePipelineLayout.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, const WGPUPipelineLayoutDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreatePipelineLayout$handle() { - return wgpuDeviceCreatePipelineLayout.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, const WGPUPipelineLayoutDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreatePipelineLayout$address() { - return wgpuDeviceCreatePipelineLayout.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, const WGPUPipelineLayoutDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreatePipelineLayout(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreatePipelineLayout.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreatePipelineLayout", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateQuerySet { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateQuerySet"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, const WGPUQuerySetDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateQuerySet$descriptor() { - return wgpuDeviceCreateQuerySet.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, const WGPUQuerySetDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateQuerySet$handle() { - return wgpuDeviceCreateQuerySet.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, const WGPUQuerySetDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateQuerySet$address() { - return wgpuDeviceCreateQuerySet.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, const WGPUQuerySetDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateQuerySet(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateQuerySet.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateQuerySet", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateRenderBundleEncoder { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateRenderBundleEncoder"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, const WGPURenderBundleEncoderDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateRenderBundleEncoder$descriptor() { - return wgpuDeviceCreateRenderBundleEncoder.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, const WGPURenderBundleEncoderDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateRenderBundleEncoder$handle() { - return wgpuDeviceCreateRenderBundleEncoder.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, const WGPURenderBundleEncoderDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateRenderBundleEncoder$address() { - return wgpuDeviceCreateRenderBundleEncoder.ADDR; - } - - /** - * {@snippet lang=c : - * WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, const WGPURenderBundleEncoderDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateRenderBundleEncoder(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateRenderBundleEncoder.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateRenderBundleEncoder", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateRenderPipeline { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateRenderPipeline"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateRenderPipeline$descriptor() { - return wgpuDeviceCreateRenderPipeline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateRenderPipeline$handle() { - return wgpuDeviceCreateRenderPipeline.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateRenderPipeline$address() { - return wgpuDeviceCreateRenderPipeline.ADDR; - } - - /** - * {@snippet lang=c : - * WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateRenderPipeline(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateRenderPipeline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateRenderPipeline", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateRenderPipelineAsync { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateRenderPipelineAsync"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateRenderPipelineAsync$descriptor() { - return wgpuDeviceCreateRenderPipelineAsync.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuDeviceCreateRenderPipelineAsync$handle() { - return wgpuDeviceCreateRenderPipelineAsync.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuDeviceCreateRenderPipelineAsync$address() { - return wgpuDeviceCreateRenderPipelineAsync.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, const WGPURenderPipelineDescriptor *descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void *userdata) - * } - */ - public static void wgpuDeviceCreateRenderPipelineAsync(MemorySegment device, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuDeviceCreateRenderPipelineAsync.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateRenderPipelineAsync", device, descriptor, callback, userdata); - } - mh$.invokeExact(device, descriptor, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateSampler { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateSampler"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, const WGPUSamplerDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateSampler$descriptor() { - return wgpuDeviceCreateSampler.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, const WGPUSamplerDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateSampler$handle() { - return wgpuDeviceCreateSampler.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, const WGPUSamplerDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateSampler$address() { - return wgpuDeviceCreateSampler.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, const WGPUSamplerDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateSampler(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateSampler.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateSampler", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateShaderModule { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateShaderModule"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateShaderModule$descriptor() { - return wgpuDeviceCreateShaderModule.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateShaderModule$handle() { - return wgpuDeviceCreateShaderModule.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateShaderModule$address() { - return wgpuDeviceCreateShaderModule.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateShaderModule(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateShaderModule.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateShaderModule", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceCreateTexture { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceCreateTexture"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, const WGPUTextureDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuDeviceCreateTexture$descriptor() { - return wgpuDeviceCreateTexture.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, const WGPUTextureDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuDeviceCreateTexture$handle() { - return wgpuDeviceCreateTexture.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, const WGPUTextureDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateTexture$address() { - return wgpuDeviceCreateTexture.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, const WGPUTextureDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuDeviceCreateTexture(MemorySegment device, MemorySegment descriptor) { - var mh$ = wgpuDeviceCreateTexture.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceCreateTexture", device, descriptor); - } - return (MemorySegment)mh$.invokeExact(device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceDestroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceDestroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceDestroy(WGPUDevice device) - * } - */ - public static FunctionDescriptor wgpuDeviceDestroy$descriptor() { - return wgpuDeviceDestroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceDestroy(WGPUDevice device) - * } - */ - public static MethodHandle wgpuDeviceDestroy$handle() { - return wgpuDeviceDestroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceDestroy(WGPUDevice device) - * } - */ - public static MemorySegment wgpuDeviceDestroy$address() { - return wgpuDeviceDestroy.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceDestroy(WGPUDevice device) - * } - */ - public static void wgpuDeviceDestroy(MemorySegment device) { - var mh$ = wgpuDeviceDestroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceDestroy", device); - } - mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceEnumerateFeatures { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceEnumerateFeatures"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName *features) - * } - */ - public static FunctionDescriptor wgpuDeviceEnumerateFeatures$descriptor() { - return wgpuDeviceEnumerateFeatures.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName *features) - * } - */ - public static MethodHandle wgpuDeviceEnumerateFeatures$handle() { - return wgpuDeviceEnumerateFeatures.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName *features) - * } - */ - public static MemorySegment wgpuDeviceEnumerateFeatures$address() { - return wgpuDeviceEnumerateFeatures.ADDR; - } - - /** - * {@snippet lang=c : - * size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName *features) - * } - */ - public static long wgpuDeviceEnumerateFeatures(MemorySegment device, MemorySegment features) { - var mh$ = wgpuDeviceEnumerateFeatures.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceEnumerateFeatures", device, features); - } - return (long)mh$.invokeExact(device, features); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceGetLimits { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceGetLimits"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits *limits) - * } - */ - public static FunctionDescriptor wgpuDeviceGetLimits$descriptor() { - return wgpuDeviceGetLimits.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits *limits) - * } - */ - public static MethodHandle wgpuDeviceGetLimits$handle() { - return wgpuDeviceGetLimits.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits *limits) - * } - */ - public static MemorySegment wgpuDeviceGetLimits$address() { - return wgpuDeviceGetLimits.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits *limits) - * } - */ - public static int wgpuDeviceGetLimits(MemorySegment device, MemorySegment limits) { - var mh$ = wgpuDeviceGetLimits.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceGetLimits", device, limits); - } - return (int)mh$.invokeExact(device, limits); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceGetQueue { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceGetQueue"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) - * } - */ - public static FunctionDescriptor wgpuDeviceGetQueue$descriptor() { - return wgpuDeviceGetQueue.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) - * } - */ - public static MethodHandle wgpuDeviceGetQueue$handle() { - return wgpuDeviceGetQueue.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) - * } - */ - public static MemorySegment wgpuDeviceGetQueue$address() { - return wgpuDeviceGetQueue.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) - * } - */ - public static MemorySegment wgpuDeviceGetQueue(MemorySegment device) { - var mh$ = wgpuDeviceGetQueue.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceGetQueue", device); - } - return (MemorySegment)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceHasFeature { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceHasFeature"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) - * } - */ - public static FunctionDescriptor wgpuDeviceHasFeature$descriptor() { - return wgpuDeviceHasFeature.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) - * } - */ - public static MethodHandle wgpuDeviceHasFeature$handle() { - return wgpuDeviceHasFeature.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) - * } - */ - public static MemorySegment wgpuDeviceHasFeature$address() { - return wgpuDeviceHasFeature.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) - * } - */ - public static int wgpuDeviceHasFeature(MemorySegment device, int feature) { - var mh$ = wgpuDeviceHasFeature.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceHasFeature", device, feature); - } - return (int)mh$.invokeExact(device, feature); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDevicePopErrorScope { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDevicePopErrorScope"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuDevicePopErrorScope$descriptor() { - return wgpuDevicePopErrorScope.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuDevicePopErrorScope$handle() { - return wgpuDevicePopErrorScope.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuDevicePopErrorScope$address() { - return wgpuDevicePopErrorScope.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static void wgpuDevicePopErrorScope(MemorySegment device, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuDevicePopErrorScope.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDevicePopErrorScope", device, callback, userdata); - } - mh$.invokeExact(device, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDevicePushErrorScope { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDevicePushErrorScope"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) - * } - */ - public static FunctionDescriptor wgpuDevicePushErrorScope$descriptor() { - return wgpuDevicePushErrorScope.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) - * } - */ - public static MethodHandle wgpuDevicePushErrorScope$handle() { - return wgpuDevicePushErrorScope.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) - * } - */ - public static MemorySegment wgpuDevicePushErrorScope$address() { - return wgpuDevicePushErrorScope.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) - * } - */ - public static void wgpuDevicePushErrorScope(MemorySegment device, int filter) { - var mh$ = wgpuDevicePushErrorScope.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDevicePushErrorScope", device, filter); - } - mh$.invokeExact(device, filter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceSetLabel(WGPUDevice device, const char *label) - * } - */ - public static FunctionDescriptor wgpuDeviceSetLabel$descriptor() { - return wgpuDeviceSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceSetLabel(WGPUDevice device, const char *label) - * } - */ - public static MethodHandle wgpuDeviceSetLabel$handle() { - return wgpuDeviceSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceSetLabel(WGPUDevice device, const char *label) - * } - */ - public static MemorySegment wgpuDeviceSetLabel$address() { - return wgpuDeviceSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceSetLabel(WGPUDevice device, const char *label) - * } - */ - public static void wgpuDeviceSetLabel(MemorySegment device, MemorySegment label) { - var mh$ = wgpuDeviceSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceSetLabel", device, label); - } - mh$.invokeExact(device, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceSetUncapturedErrorCallback { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceSetUncapturedErrorCallback"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuDeviceSetUncapturedErrorCallback$descriptor() { - return wgpuDeviceSetUncapturedErrorCallback.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuDeviceSetUncapturedErrorCallback$handle() { - return wgpuDeviceSetUncapturedErrorCallback.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuDeviceSetUncapturedErrorCallback$address() { - return wgpuDeviceSetUncapturedErrorCallback.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void *userdata) - * } - */ - public static void wgpuDeviceSetUncapturedErrorCallback(MemorySegment device, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuDeviceSetUncapturedErrorCallback.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceSetUncapturedErrorCallback", device, callback, userdata); - } - mh$.invokeExact(device, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceReference(WGPUDevice device) - * } - */ - public static FunctionDescriptor wgpuDeviceReference$descriptor() { - return wgpuDeviceReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceReference(WGPUDevice device) - * } - */ - public static MethodHandle wgpuDeviceReference$handle() { - return wgpuDeviceReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceReference(WGPUDevice device) - * } - */ - public static MemorySegment wgpuDeviceReference$address() { - return wgpuDeviceReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceReference(WGPUDevice device) - * } - */ - public static void wgpuDeviceReference(MemorySegment device) { - var mh$ = wgpuDeviceReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceReference", device); - } - mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDeviceRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDeviceRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuDeviceRelease(WGPUDevice device) - * } - */ - public static FunctionDescriptor wgpuDeviceRelease$descriptor() { - return wgpuDeviceRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuDeviceRelease(WGPUDevice device) - * } - */ - public static MethodHandle wgpuDeviceRelease$handle() { - return wgpuDeviceRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuDeviceRelease(WGPUDevice device) - * } - */ - public static MemorySegment wgpuDeviceRelease$address() { - return wgpuDeviceRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuDeviceRelease(WGPUDevice device) - * } - */ - public static void wgpuDeviceRelease(MemorySegment device) { - var mh$ = wgpuDeviceRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDeviceRelease", device); - } - mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuInstanceCreateSurface { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuInstanceCreateSurface"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, const WGPUSurfaceDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuInstanceCreateSurface$descriptor() { - return wgpuInstanceCreateSurface.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, const WGPUSurfaceDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuInstanceCreateSurface$handle() { - return wgpuInstanceCreateSurface.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, const WGPUSurfaceDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuInstanceCreateSurface$address() { - return wgpuInstanceCreateSurface.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, const WGPUSurfaceDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuInstanceCreateSurface(MemorySegment instance, MemorySegment descriptor) { - var mh$ = wgpuInstanceCreateSurface.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuInstanceCreateSurface", instance, descriptor); - } - return (MemorySegment)mh$.invokeExact(instance, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuInstanceProcessEvents { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuInstanceProcessEvents"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuInstanceProcessEvents(WGPUInstance instance) - * } - */ - public static FunctionDescriptor wgpuInstanceProcessEvents$descriptor() { - return wgpuInstanceProcessEvents.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuInstanceProcessEvents(WGPUInstance instance) - * } - */ - public static MethodHandle wgpuInstanceProcessEvents$handle() { - return wgpuInstanceProcessEvents.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuInstanceProcessEvents(WGPUInstance instance) - * } - */ - public static MemorySegment wgpuInstanceProcessEvents$address() { - return wgpuInstanceProcessEvents.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuInstanceProcessEvents(WGPUInstance instance) - * } - */ - public static void wgpuInstanceProcessEvents(MemorySegment instance) { - var mh$ = wgpuInstanceProcessEvents.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuInstanceProcessEvents", instance); - } - mh$.invokeExact(instance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuInstanceRequestAdapter { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuInstanceRequestAdapter"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuInstanceRequestAdapter(WGPUInstance instance, const WGPURequestAdapterOptions *options, WGPURequestAdapterCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuInstanceRequestAdapter$descriptor() { - return wgpuInstanceRequestAdapter.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuInstanceRequestAdapter(WGPUInstance instance, const WGPURequestAdapterOptions *options, WGPURequestAdapterCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuInstanceRequestAdapter$handle() { - return wgpuInstanceRequestAdapter.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuInstanceRequestAdapter(WGPUInstance instance, const WGPURequestAdapterOptions *options, WGPURequestAdapterCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuInstanceRequestAdapter$address() { - return wgpuInstanceRequestAdapter.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuInstanceRequestAdapter(WGPUInstance instance, const WGPURequestAdapterOptions *options, WGPURequestAdapterCallback callback, void *userdata) - * } - */ - public static void wgpuInstanceRequestAdapter(MemorySegment instance, MemorySegment options, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuInstanceRequestAdapter.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuInstanceRequestAdapter", instance, options, callback, userdata); - } - mh$.invokeExact(instance, options, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuInstanceReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuInstanceReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuInstanceReference(WGPUInstance instance) - * } - */ - public static FunctionDescriptor wgpuInstanceReference$descriptor() { - return wgpuInstanceReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuInstanceReference(WGPUInstance instance) - * } - */ - public static MethodHandle wgpuInstanceReference$handle() { - return wgpuInstanceReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuInstanceReference(WGPUInstance instance) - * } - */ - public static MemorySegment wgpuInstanceReference$address() { - return wgpuInstanceReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuInstanceReference(WGPUInstance instance) - * } - */ - public static void wgpuInstanceReference(MemorySegment instance) { - var mh$ = wgpuInstanceReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuInstanceReference", instance); - } - mh$.invokeExact(instance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuInstanceRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuInstanceRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuInstanceRelease(WGPUInstance instance) - * } - */ - public static FunctionDescriptor wgpuInstanceRelease$descriptor() { - return wgpuInstanceRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuInstanceRelease(WGPUInstance instance) - * } - */ - public static MethodHandle wgpuInstanceRelease$handle() { - return wgpuInstanceRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuInstanceRelease(WGPUInstance instance) - * } - */ - public static MemorySegment wgpuInstanceRelease$address() { - return wgpuInstanceRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuInstanceRelease(WGPUInstance instance) - * } - */ - public static void wgpuInstanceRelease(MemorySegment instance) { - var mh$ = wgpuInstanceRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuInstanceRelease", instance); - } - mh$.invokeExact(instance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuPipelineLayoutSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuPipelineLayoutSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, const char *label) - * } - */ - public static FunctionDescriptor wgpuPipelineLayoutSetLabel$descriptor() { - return wgpuPipelineLayoutSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, const char *label) - * } - */ - public static MethodHandle wgpuPipelineLayoutSetLabel$handle() { - return wgpuPipelineLayoutSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, const char *label) - * } - */ - public static MemorySegment wgpuPipelineLayoutSetLabel$address() { - return wgpuPipelineLayoutSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, const char *label) - * } - */ - public static void wgpuPipelineLayoutSetLabel(MemorySegment pipelineLayout, MemorySegment label) { - var mh$ = wgpuPipelineLayoutSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuPipelineLayoutSetLabel", pipelineLayout, label); - } - mh$.invokeExact(pipelineLayout, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuPipelineLayoutReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuPipelineLayoutReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout) - * } - */ - public static FunctionDescriptor wgpuPipelineLayoutReference$descriptor() { - return wgpuPipelineLayoutReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout) - * } - */ - public static MethodHandle wgpuPipelineLayoutReference$handle() { - return wgpuPipelineLayoutReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout) - * } - */ - public static MemorySegment wgpuPipelineLayoutReference$address() { - return wgpuPipelineLayoutReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout) - * } - */ - public static void wgpuPipelineLayoutReference(MemorySegment pipelineLayout) { - var mh$ = wgpuPipelineLayoutReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuPipelineLayoutReference", pipelineLayout); - } - mh$.invokeExact(pipelineLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuPipelineLayoutRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuPipelineLayoutRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) - * } - */ - public static FunctionDescriptor wgpuPipelineLayoutRelease$descriptor() { - return wgpuPipelineLayoutRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) - * } - */ - public static MethodHandle wgpuPipelineLayoutRelease$handle() { - return wgpuPipelineLayoutRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) - * } - */ - public static MemorySegment wgpuPipelineLayoutRelease$address() { - return wgpuPipelineLayoutRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) - * } - */ - public static void wgpuPipelineLayoutRelease(MemorySegment pipelineLayout) { - var mh$ = wgpuPipelineLayoutRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuPipelineLayoutRelease", pipelineLayout); - } - mh$.invokeExact(pipelineLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQuerySetDestroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQuerySetDestroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQuerySetDestroy(WGPUQuerySet querySet) - * } - */ - public static FunctionDescriptor wgpuQuerySetDestroy$descriptor() { - return wgpuQuerySetDestroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQuerySetDestroy(WGPUQuerySet querySet) - * } - */ - public static MethodHandle wgpuQuerySetDestroy$handle() { - return wgpuQuerySetDestroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQuerySetDestroy(WGPUQuerySet querySet) - * } - */ - public static MemorySegment wgpuQuerySetDestroy$address() { - return wgpuQuerySetDestroy.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQuerySetDestroy(WGPUQuerySet querySet) - * } - */ - public static void wgpuQuerySetDestroy(MemorySegment querySet) { - var mh$ = wgpuQuerySetDestroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQuerySetDestroy", querySet); - } - mh$.invokeExact(querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQuerySetGetCount { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQuerySetGetCount"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) - * } - */ - public static FunctionDescriptor wgpuQuerySetGetCount$descriptor() { - return wgpuQuerySetGetCount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) - * } - */ - public static MethodHandle wgpuQuerySetGetCount$handle() { - return wgpuQuerySetGetCount.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) - * } - */ - public static MemorySegment wgpuQuerySetGetCount$address() { - return wgpuQuerySetGetCount.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) - * } - */ - public static int wgpuQuerySetGetCount(MemorySegment querySet) { - var mh$ = wgpuQuerySetGetCount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQuerySetGetCount", querySet); - } - return (int)mh$.invokeExact(querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQuerySetGetType { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQuerySetGetType"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) - * } - */ - public static FunctionDescriptor wgpuQuerySetGetType$descriptor() { - return wgpuQuerySetGetType.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) - * } - */ - public static MethodHandle wgpuQuerySetGetType$handle() { - return wgpuQuerySetGetType.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) - * } - */ - public static MemorySegment wgpuQuerySetGetType$address() { - return wgpuQuerySetGetType.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) - * } - */ - public static int wgpuQuerySetGetType(MemorySegment querySet) { - var mh$ = wgpuQuerySetGetType.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQuerySetGetType", querySet); - } - return (int)mh$.invokeExact(querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQuerySetSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQuerySetSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQuerySetSetLabel(WGPUQuerySet querySet, const char *label) - * } - */ - public static FunctionDescriptor wgpuQuerySetSetLabel$descriptor() { - return wgpuQuerySetSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQuerySetSetLabel(WGPUQuerySet querySet, const char *label) - * } - */ - public static MethodHandle wgpuQuerySetSetLabel$handle() { - return wgpuQuerySetSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQuerySetSetLabel(WGPUQuerySet querySet, const char *label) - * } - */ - public static MemorySegment wgpuQuerySetSetLabel$address() { - return wgpuQuerySetSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQuerySetSetLabel(WGPUQuerySet querySet, const char *label) - * } - */ - public static void wgpuQuerySetSetLabel(MemorySegment querySet, MemorySegment label) { - var mh$ = wgpuQuerySetSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQuerySetSetLabel", querySet, label); - } - mh$.invokeExact(querySet, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQuerySetReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQuerySetReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQuerySetReference(WGPUQuerySet querySet) - * } - */ - public static FunctionDescriptor wgpuQuerySetReference$descriptor() { - return wgpuQuerySetReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQuerySetReference(WGPUQuerySet querySet) - * } - */ - public static MethodHandle wgpuQuerySetReference$handle() { - return wgpuQuerySetReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQuerySetReference(WGPUQuerySet querySet) - * } - */ - public static MemorySegment wgpuQuerySetReference$address() { - return wgpuQuerySetReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQuerySetReference(WGPUQuerySet querySet) - * } - */ - public static void wgpuQuerySetReference(MemorySegment querySet) { - var mh$ = wgpuQuerySetReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQuerySetReference", querySet); - } - mh$.invokeExact(querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQuerySetRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQuerySetRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQuerySetRelease(WGPUQuerySet querySet) - * } - */ - public static FunctionDescriptor wgpuQuerySetRelease$descriptor() { - return wgpuQuerySetRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQuerySetRelease(WGPUQuerySet querySet) - * } - */ - public static MethodHandle wgpuQuerySetRelease$handle() { - return wgpuQuerySetRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQuerySetRelease(WGPUQuerySet querySet) - * } - */ - public static MemorySegment wgpuQuerySetRelease$address() { - return wgpuQuerySetRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQuerySetRelease(WGPUQuerySet querySet) - * } - */ - public static void wgpuQuerySetRelease(MemorySegment querySet) { - var mh$ = wgpuQuerySetRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQuerySetRelease", querySet); - } - mh$.invokeExact(querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueOnSubmittedWorkDone { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueOnSubmittedWorkDone"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuQueueOnSubmittedWorkDone$descriptor() { - return wgpuQueueOnSubmittedWorkDone.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuQueueOnSubmittedWorkDone$handle() { - return wgpuQueueOnSubmittedWorkDone.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuQueueOnSubmittedWorkDone$address() { - return wgpuQueueOnSubmittedWorkDone.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void *userdata) - * } - */ - public static void wgpuQueueOnSubmittedWorkDone(MemorySegment queue, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuQueueOnSubmittedWorkDone.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueOnSubmittedWorkDone", queue, callback, userdata); - } - mh$.invokeExact(queue, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueSetLabel(WGPUQueue queue, const char *label) - * } - */ - public static FunctionDescriptor wgpuQueueSetLabel$descriptor() { - return wgpuQueueSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueSetLabel(WGPUQueue queue, const char *label) - * } - */ - public static MethodHandle wgpuQueueSetLabel$handle() { - return wgpuQueueSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueSetLabel(WGPUQueue queue, const char *label) - * } - */ - public static MemorySegment wgpuQueueSetLabel$address() { - return wgpuQueueSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueSetLabel(WGPUQueue queue, const char *label) - * } - */ - public static void wgpuQueueSetLabel(MemorySegment queue, MemorySegment label) { - var mh$ = wgpuQueueSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueSetLabel", queue, label); - } - mh$.invokeExact(queue, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueSubmit { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueSubmit"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static FunctionDescriptor wgpuQueueSubmit$descriptor() { - return wgpuQueueSubmit.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static MethodHandle wgpuQueueSubmit$handle() { - return wgpuQueueSubmit.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static MemorySegment wgpuQueueSubmit$address() { - return wgpuQueueSubmit.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static void wgpuQueueSubmit(MemorySegment queue, long commandCount, MemorySegment commands) { - var mh$ = wgpuQueueSubmit.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueSubmit", queue, commandCount, commands); - } - mh$.invokeExact(queue, commandCount, commands); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueWriteBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueWriteBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, const void *data, size_t size) - * } - */ - public static FunctionDescriptor wgpuQueueWriteBuffer$descriptor() { - return wgpuQueueWriteBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, const void *data, size_t size) - * } - */ - public static MethodHandle wgpuQueueWriteBuffer$handle() { - return wgpuQueueWriteBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, const void *data, size_t size) - * } - */ - public static MemorySegment wgpuQueueWriteBuffer$address() { - return wgpuQueueWriteBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, const void *data, size_t size) - * } - */ - public static void wgpuQueueWriteBuffer(MemorySegment queue, MemorySegment buffer, long bufferOffset, MemorySegment data, long size) { - var mh$ = wgpuQueueWriteBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueWriteBuffer", queue, buffer, bufferOffset, data, size); - } - mh$.invokeExact(queue, buffer, bufferOffset, data, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueWriteTexture { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueWriteTexture"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueWriteTexture(WGPUQueue queue, const WGPUImageCopyTexture *destination, const void *data, size_t dataSize, const WGPUTextureDataLayout *dataLayout, const WGPUExtent3D *writeSize) - * } - */ - public static FunctionDescriptor wgpuQueueWriteTexture$descriptor() { - return wgpuQueueWriteTexture.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueWriteTexture(WGPUQueue queue, const WGPUImageCopyTexture *destination, const void *data, size_t dataSize, const WGPUTextureDataLayout *dataLayout, const WGPUExtent3D *writeSize) - * } - */ - public static MethodHandle wgpuQueueWriteTexture$handle() { - return wgpuQueueWriteTexture.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueWriteTexture(WGPUQueue queue, const WGPUImageCopyTexture *destination, const void *data, size_t dataSize, const WGPUTextureDataLayout *dataLayout, const WGPUExtent3D *writeSize) - * } - */ - public static MemorySegment wgpuQueueWriteTexture$address() { - return wgpuQueueWriteTexture.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueWriteTexture(WGPUQueue queue, const WGPUImageCopyTexture *destination, const void *data, size_t dataSize, const WGPUTextureDataLayout *dataLayout, const WGPUExtent3D *writeSize) - * } - */ - public static void wgpuQueueWriteTexture(MemorySegment queue, MemorySegment destination, MemorySegment data, long dataSize, MemorySegment dataLayout, MemorySegment writeSize) { - var mh$ = wgpuQueueWriteTexture.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueWriteTexture", queue, destination, data, dataSize, dataLayout, writeSize); - } - mh$.invokeExact(queue, destination, data, dataSize, dataLayout, writeSize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueReference(WGPUQueue queue) - * } - */ - public static FunctionDescriptor wgpuQueueReference$descriptor() { - return wgpuQueueReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueReference(WGPUQueue queue) - * } - */ - public static MethodHandle wgpuQueueReference$handle() { - return wgpuQueueReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueReference(WGPUQueue queue) - * } - */ - public static MemorySegment wgpuQueueReference$address() { - return wgpuQueueReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueReference(WGPUQueue queue) - * } - */ - public static void wgpuQueueReference(MemorySegment queue) { - var mh$ = wgpuQueueReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueReference", queue); - } - mh$.invokeExact(queue); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuQueueRelease(WGPUQueue queue) - * } - */ - public static FunctionDescriptor wgpuQueueRelease$descriptor() { - return wgpuQueueRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuQueueRelease(WGPUQueue queue) - * } - */ - public static MethodHandle wgpuQueueRelease$handle() { - return wgpuQueueRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuQueueRelease(WGPUQueue queue) - * } - */ - public static MemorySegment wgpuQueueRelease$address() { - return wgpuQueueRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuQueueRelease(WGPUQueue queue) - * } - */ - public static void wgpuQueueRelease(MemorySegment queue) { - var mh$ = wgpuQueueRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueRelease", queue); - } - mh$.invokeExact(queue); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, const char *label) - * } - */ - public static FunctionDescriptor wgpuRenderBundleSetLabel$descriptor() { - return wgpuRenderBundleSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, const char *label) - * } - */ - public static MethodHandle wgpuRenderBundleSetLabel$handle() { - return wgpuRenderBundleSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, const char *label) - * } - */ - public static MemorySegment wgpuRenderBundleSetLabel$address() { - return wgpuRenderBundleSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, const char *label) - * } - */ - public static void wgpuRenderBundleSetLabel(MemorySegment renderBundle, MemorySegment label) { - var mh$ = wgpuRenderBundleSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleSetLabel", renderBundle, label); - } - mh$.invokeExact(renderBundle, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleReference(WGPURenderBundle renderBundle) - * } - */ - public static FunctionDescriptor wgpuRenderBundleReference$descriptor() { - return wgpuRenderBundleReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleReference(WGPURenderBundle renderBundle) - * } - */ - public static MethodHandle wgpuRenderBundleReference$handle() { - return wgpuRenderBundleReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleReference(WGPURenderBundle renderBundle) - * } - */ - public static MemorySegment wgpuRenderBundleReference$address() { - return wgpuRenderBundleReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleReference(WGPURenderBundle renderBundle) - * } - */ - public static void wgpuRenderBundleReference(MemorySegment renderBundle) { - var mh$ = wgpuRenderBundleReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleReference", renderBundle); - } - mh$.invokeExact(renderBundle); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) - * } - */ - public static FunctionDescriptor wgpuRenderBundleRelease$descriptor() { - return wgpuRenderBundleRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) - * } - */ - public static MethodHandle wgpuRenderBundleRelease$handle() { - return wgpuRenderBundleRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) - * } - */ - public static MemorySegment wgpuRenderBundleRelease$address() { - return wgpuRenderBundleRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) - * } - */ - public static void wgpuRenderBundleRelease(MemorySegment renderBundle) { - var mh$ = wgpuRenderBundleRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleRelease", renderBundle); - } - mh$.invokeExact(renderBundle); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderDraw { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderDraw"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderDraw$descriptor() { - return wgpuRenderBundleEncoderDraw.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderDraw$handle() { - return wgpuRenderBundleEncoderDraw.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderDraw$address() { - return wgpuRenderBundleEncoderDraw.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static void wgpuRenderBundleEncoderDraw(MemorySegment renderBundleEncoder, int vertexCount, int instanceCount, int firstVertex, int firstInstance) { - var mh$ = wgpuRenderBundleEncoderDraw.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderDraw", renderBundleEncoder, vertexCount, instanceCount, firstVertex, firstInstance); - } - mh$.invokeExact(renderBundleEncoder, vertexCount, instanceCount, firstVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderDrawIndexed { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderDrawIndexed"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderDrawIndexed$descriptor() { - return wgpuRenderBundleEncoderDrawIndexed.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderDrawIndexed$handle() { - return wgpuRenderBundleEncoderDrawIndexed.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderDrawIndexed$address() { - return wgpuRenderBundleEncoderDrawIndexed.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static void wgpuRenderBundleEncoderDrawIndexed(MemorySegment renderBundleEncoder, int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance) { - var mh$ = wgpuRenderBundleEncoderDrawIndexed.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderDrawIndexed", renderBundleEncoder, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } - mh$.invokeExact(renderBundleEncoder, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderDrawIndexedIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderDrawIndexedIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderDrawIndexedIndirect$descriptor() { - return wgpuRenderBundleEncoderDrawIndexedIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderDrawIndexedIndirect$handle() { - return wgpuRenderBundleEncoderDrawIndexedIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderDrawIndexedIndirect$address() { - return wgpuRenderBundleEncoderDrawIndexedIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static void wgpuRenderBundleEncoderDrawIndexedIndirect(MemorySegment renderBundleEncoder, MemorySegment indirectBuffer, long indirectOffset) { - var mh$ = wgpuRenderBundleEncoderDrawIndexedIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderDrawIndexedIndirect", renderBundleEncoder, indirectBuffer, indirectOffset); - } - mh$.invokeExact(renderBundleEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderDrawIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderDrawIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderDrawIndirect$descriptor() { - return wgpuRenderBundleEncoderDrawIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderDrawIndirect$handle() { - return wgpuRenderBundleEncoderDrawIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderDrawIndirect$address() { - return wgpuRenderBundleEncoderDrawIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static void wgpuRenderBundleEncoderDrawIndirect(MemorySegment renderBundleEncoder, MemorySegment indirectBuffer, long indirectOffset) { - var mh$ = wgpuRenderBundleEncoderDrawIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderDrawIndirect", renderBundleEncoder, indirectBuffer, indirectOffset); - } - mh$.invokeExact(renderBundleEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderFinish { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderFinish"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, const WGPURenderBundleDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderFinish$descriptor() { - return wgpuRenderBundleEncoderFinish.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, const WGPURenderBundleDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderFinish$handle() { - return wgpuRenderBundleEncoderFinish.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, const WGPURenderBundleDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderFinish$address() { - return wgpuRenderBundleEncoderFinish.ADDR; - } - - /** - * {@snippet lang=c : - * WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, const WGPURenderBundleDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderFinish(MemorySegment renderBundleEncoder, MemorySegment descriptor) { - var mh$ = wgpuRenderBundleEncoderFinish.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderFinish", renderBundleEncoder, descriptor); - } - return (MemorySegment)mh$.invokeExact(renderBundleEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderInsertDebugMarker { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderInsertDebugMarker"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, const char *markerLabel) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderInsertDebugMarker$descriptor() { - return wgpuRenderBundleEncoderInsertDebugMarker.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, const char *markerLabel) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderInsertDebugMarker$handle() { - return wgpuRenderBundleEncoderInsertDebugMarker.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, const char *markerLabel) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderInsertDebugMarker$address() { - return wgpuRenderBundleEncoderInsertDebugMarker.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, const char *markerLabel) - * } - */ - public static void wgpuRenderBundleEncoderInsertDebugMarker(MemorySegment renderBundleEncoder, MemorySegment markerLabel) { - var mh$ = wgpuRenderBundleEncoderInsertDebugMarker.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderInsertDebugMarker", renderBundleEncoder, markerLabel); - } - mh$.invokeExact(renderBundleEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderPopDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderPopDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderPopDebugGroup$descriptor() { - return wgpuRenderBundleEncoderPopDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderPopDebugGroup$handle() { - return wgpuRenderBundleEncoderPopDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderPopDebugGroup$address() { - return wgpuRenderBundleEncoderPopDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static void wgpuRenderBundleEncoderPopDebugGroup(MemorySegment renderBundleEncoder) { - var mh$ = wgpuRenderBundleEncoderPopDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderPopDebugGroup", renderBundleEncoder); - } - mh$.invokeExact(renderBundleEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderPushDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderPushDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, const char *groupLabel) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderPushDebugGroup$descriptor() { - return wgpuRenderBundleEncoderPushDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, const char *groupLabel) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderPushDebugGroup$handle() { - return wgpuRenderBundleEncoderPushDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, const char *groupLabel) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderPushDebugGroup$address() { - return wgpuRenderBundleEncoderPushDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, const char *groupLabel) - * } - */ - public static void wgpuRenderBundleEncoderPushDebugGroup(MemorySegment renderBundleEncoder, MemorySegment groupLabel) { - var mh$ = wgpuRenderBundleEncoderPushDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderPushDebugGroup", renderBundleEncoder, groupLabel); - } - mh$.invokeExact(renderBundleEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderSetBindGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderSetBindGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderSetBindGroup$descriptor() { - return wgpuRenderBundleEncoderSetBindGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderSetBindGroup$handle() { - return wgpuRenderBundleEncoderSetBindGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderSetBindGroup$address() { - return wgpuRenderBundleEncoderSetBindGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static void wgpuRenderBundleEncoderSetBindGroup(MemorySegment renderBundleEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets) { - var mh$ = wgpuRenderBundleEncoderSetBindGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderSetBindGroup", renderBundleEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } - mh$.invokeExact(renderBundleEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderSetIndexBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderSetIndexBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderSetIndexBuffer$descriptor() { - return wgpuRenderBundleEncoderSetIndexBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderSetIndexBuffer$handle() { - return wgpuRenderBundleEncoderSetIndexBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderSetIndexBuffer$address() { - return wgpuRenderBundleEncoderSetIndexBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static void wgpuRenderBundleEncoderSetIndexBuffer(MemorySegment renderBundleEncoder, MemorySegment buffer, int format, long offset, long size) { - var mh$ = wgpuRenderBundleEncoderSetIndexBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderSetIndexBuffer", renderBundleEncoder, buffer, format, offset, size); - } - mh$.invokeExact(renderBundleEncoder, buffer, format, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, const char *label) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderSetLabel$descriptor() { - return wgpuRenderBundleEncoderSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, const char *label) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderSetLabel$handle() { - return wgpuRenderBundleEncoderSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, const char *label) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderSetLabel$address() { - return wgpuRenderBundleEncoderSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, const char *label) - * } - */ - public static void wgpuRenderBundleEncoderSetLabel(MemorySegment renderBundleEncoder, MemorySegment label) { - var mh$ = wgpuRenderBundleEncoderSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderSetLabel", renderBundleEncoder, label); - } - mh$.invokeExact(renderBundleEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderSetPipeline { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderSetPipeline"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderSetPipeline$descriptor() { - return wgpuRenderBundleEncoderSetPipeline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderSetPipeline$handle() { - return wgpuRenderBundleEncoderSetPipeline.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderSetPipeline$address() { - return wgpuRenderBundleEncoderSetPipeline.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) - * } - */ - public static void wgpuRenderBundleEncoderSetPipeline(MemorySegment renderBundleEncoder, MemorySegment pipeline) { - var mh$ = wgpuRenderBundleEncoderSetPipeline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderSetPipeline", renderBundleEncoder, pipeline); - } - mh$.invokeExact(renderBundleEncoder, pipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderSetVertexBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderSetVertexBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderSetVertexBuffer$descriptor() { - return wgpuRenderBundleEncoderSetVertexBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderSetVertexBuffer$handle() { - return wgpuRenderBundleEncoderSetVertexBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderSetVertexBuffer$address() { - return wgpuRenderBundleEncoderSetVertexBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static void wgpuRenderBundleEncoderSetVertexBuffer(MemorySegment renderBundleEncoder, int slot, MemorySegment buffer, long offset, long size) { - var mh$ = wgpuRenderBundleEncoderSetVertexBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderSetVertexBuffer", renderBundleEncoder, slot, buffer, offset, size); - } - mh$.invokeExact(renderBundleEncoder, slot, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderReference$descriptor() { - return wgpuRenderBundleEncoderReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderReference$handle() { - return wgpuRenderBundleEncoderReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderReference$address() { - return wgpuRenderBundleEncoderReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static void wgpuRenderBundleEncoderReference(MemorySegment renderBundleEncoder) { - var mh$ = wgpuRenderBundleEncoderReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderReference", renderBundleEncoder); - } - mh$.invokeExact(renderBundleEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderBundleEncoderRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderBundleEncoderRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderBundleEncoderRelease$descriptor() { - return wgpuRenderBundleEncoderRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static MethodHandle wgpuRenderBundleEncoderRelease$handle() { - return wgpuRenderBundleEncoderRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static MemorySegment wgpuRenderBundleEncoderRelease$address() { - return wgpuRenderBundleEncoderRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) - * } - */ - public static void wgpuRenderBundleEncoderRelease(MemorySegment renderBundleEncoder) { - var mh$ = wgpuRenderBundleEncoderRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderBundleEncoderRelease", renderBundleEncoder); - } - mh$.invokeExact(renderBundleEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderBeginOcclusionQuery { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderBeginOcclusionQuery"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderBeginOcclusionQuery$descriptor() { - return wgpuRenderPassEncoderBeginOcclusionQuery.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) - * } - */ - public static MethodHandle wgpuRenderPassEncoderBeginOcclusionQuery$handle() { - return wgpuRenderPassEncoderBeginOcclusionQuery.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) - * } - */ - public static MemorySegment wgpuRenderPassEncoderBeginOcclusionQuery$address() { - return wgpuRenderPassEncoderBeginOcclusionQuery.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) - * } - */ - public static void wgpuRenderPassEncoderBeginOcclusionQuery(MemorySegment renderPassEncoder, int queryIndex) { - var mh$ = wgpuRenderPassEncoderBeginOcclusionQuery.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderBeginOcclusionQuery", renderPassEncoder, queryIndex); - } - mh$.invokeExact(renderPassEncoder, queryIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderDraw { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderDraw"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderDraw$descriptor() { - return wgpuRenderPassEncoderDraw.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static MethodHandle wgpuRenderPassEncoderDraw$handle() { - return wgpuRenderPassEncoderDraw.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static MemorySegment wgpuRenderPassEncoderDraw$address() { - return wgpuRenderPassEncoderDraw.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) - * } - */ - public static void wgpuRenderPassEncoderDraw(MemorySegment renderPassEncoder, int vertexCount, int instanceCount, int firstVertex, int firstInstance) { - var mh$ = wgpuRenderPassEncoderDraw.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderDraw", renderPassEncoder, vertexCount, instanceCount, firstVertex, firstInstance); - } - mh$.invokeExact(renderPassEncoder, vertexCount, instanceCount, firstVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderDrawIndexed { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderDrawIndexed"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderDrawIndexed$descriptor() { - return wgpuRenderPassEncoderDrawIndexed.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static MethodHandle wgpuRenderPassEncoderDrawIndexed$handle() { - return wgpuRenderPassEncoderDrawIndexed.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static MemorySegment wgpuRenderPassEncoderDrawIndexed$address() { - return wgpuRenderPassEncoderDrawIndexed.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) - * } - */ - public static void wgpuRenderPassEncoderDrawIndexed(MemorySegment renderPassEncoder, int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance) { - var mh$ = wgpuRenderPassEncoderDrawIndexed.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderDrawIndexed", renderPassEncoder, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } - mh$.invokeExact(renderPassEncoder, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderDrawIndexedIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderDrawIndexedIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderDrawIndexedIndirect$descriptor() { - return wgpuRenderPassEncoderDrawIndexedIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MethodHandle wgpuRenderPassEncoderDrawIndexedIndirect$handle() { - return wgpuRenderPassEncoderDrawIndexedIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MemorySegment wgpuRenderPassEncoderDrawIndexedIndirect$address() { - return wgpuRenderPassEncoderDrawIndexedIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static void wgpuRenderPassEncoderDrawIndexedIndirect(MemorySegment renderPassEncoder, MemorySegment indirectBuffer, long indirectOffset) { - var mh$ = wgpuRenderPassEncoderDrawIndexedIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderDrawIndexedIndirect", renderPassEncoder, indirectBuffer, indirectOffset); - } - mh$.invokeExact(renderPassEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderDrawIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderDrawIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderDrawIndirect$descriptor() { - return wgpuRenderPassEncoderDrawIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MethodHandle wgpuRenderPassEncoderDrawIndirect$handle() { - return wgpuRenderPassEncoderDrawIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static MemorySegment wgpuRenderPassEncoderDrawIndirect$address() { - return wgpuRenderPassEncoderDrawIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) - * } - */ - public static void wgpuRenderPassEncoderDrawIndirect(MemorySegment renderPassEncoder, MemorySegment indirectBuffer, long indirectOffset) { - var mh$ = wgpuRenderPassEncoderDrawIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderDrawIndirect", renderPassEncoder, indirectBuffer, indirectOffset); - } - mh$.invokeExact(renderPassEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderEnd { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderEnd"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderEnd$descriptor() { - return wgpuRenderPassEncoderEnd.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MethodHandle wgpuRenderPassEncoderEnd$handle() { - return wgpuRenderPassEncoderEnd.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MemorySegment wgpuRenderPassEncoderEnd$address() { - return wgpuRenderPassEncoderEnd.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static void wgpuRenderPassEncoderEnd(MemorySegment renderPassEncoder) { - var mh$ = wgpuRenderPassEncoderEnd.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderEnd", renderPassEncoder); - } - mh$.invokeExact(renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderEndOcclusionQuery { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderEndOcclusionQuery"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderEndOcclusionQuery$descriptor() { - return wgpuRenderPassEncoderEndOcclusionQuery.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MethodHandle wgpuRenderPassEncoderEndOcclusionQuery$handle() { - return wgpuRenderPassEncoderEndOcclusionQuery.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MemorySegment wgpuRenderPassEncoderEndOcclusionQuery$address() { - return wgpuRenderPassEncoderEndOcclusionQuery.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static void wgpuRenderPassEncoderEndOcclusionQuery(MemorySegment renderPassEncoder) { - var mh$ = wgpuRenderPassEncoderEndOcclusionQuery.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderEndOcclusionQuery", renderPassEncoder); - } - mh$.invokeExact(renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderExecuteBundles { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderExecuteBundles"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, const WGPURenderBundle *bundles) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderExecuteBundles$descriptor() { - return wgpuRenderPassEncoderExecuteBundles.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, const WGPURenderBundle *bundles) - * } - */ - public static MethodHandle wgpuRenderPassEncoderExecuteBundles$handle() { - return wgpuRenderPassEncoderExecuteBundles.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, const WGPURenderBundle *bundles) - * } - */ - public static MemorySegment wgpuRenderPassEncoderExecuteBundles$address() { - return wgpuRenderPassEncoderExecuteBundles.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, const WGPURenderBundle *bundles) - * } - */ - public static void wgpuRenderPassEncoderExecuteBundles(MemorySegment renderPassEncoder, long bundleCount, MemorySegment bundles) { - var mh$ = wgpuRenderPassEncoderExecuteBundles.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderExecuteBundles", renderPassEncoder, bundleCount, bundles); - } - mh$.invokeExact(renderPassEncoder, bundleCount, bundles); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderInsertDebugMarker { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderInsertDebugMarker"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, const char *markerLabel) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderInsertDebugMarker$descriptor() { - return wgpuRenderPassEncoderInsertDebugMarker.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, const char *markerLabel) - * } - */ - public static MethodHandle wgpuRenderPassEncoderInsertDebugMarker$handle() { - return wgpuRenderPassEncoderInsertDebugMarker.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, const char *markerLabel) - * } - */ - public static MemorySegment wgpuRenderPassEncoderInsertDebugMarker$address() { - return wgpuRenderPassEncoderInsertDebugMarker.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, const char *markerLabel) - * } - */ - public static void wgpuRenderPassEncoderInsertDebugMarker(MemorySegment renderPassEncoder, MemorySegment markerLabel) { - var mh$ = wgpuRenderPassEncoderInsertDebugMarker.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderInsertDebugMarker", renderPassEncoder, markerLabel); - } - mh$.invokeExact(renderPassEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderPopDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderPopDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderPopDebugGroup$descriptor() { - return wgpuRenderPassEncoderPopDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MethodHandle wgpuRenderPassEncoderPopDebugGroup$handle() { - return wgpuRenderPassEncoderPopDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MemorySegment wgpuRenderPassEncoderPopDebugGroup$address() { - return wgpuRenderPassEncoderPopDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static void wgpuRenderPassEncoderPopDebugGroup(MemorySegment renderPassEncoder) { - var mh$ = wgpuRenderPassEncoderPopDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderPopDebugGroup", renderPassEncoder); - } - mh$.invokeExact(renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderPushDebugGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderPushDebugGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, const char *groupLabel) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderPushDebugGroup$descriptor() { - return wgpuRenderPassEncoderPushDebugGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, const char *groupLabel) - * } - */ - public static MethodHandle wgpuRenderPassEncoderPushDebugGroup$handle() { - return wgpuRenderPassEncoderPushDebugGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, const char *groupLabel) - * } - */ - public static MemorySegment wgpuRenderPassEncoderPushDebugGroup$address() { - return wgpuRenderPassEncoderPushDebugGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, const char *groupLabel) - * } - */ - public static void wgpuRenderPassEncoderPushDebugGroup(MemorySegment renderPassEncoder, MemorySegment groupLabel) { - var mh$ = wgpuRenderPassEncoderPushDebugGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderPushDebugGroup", renderPassEncoder, groupLabel); - } - mh$.invokeExact(renderPassEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetBindGroup { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetBindGroup"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetBindGroup$descriptor() { - return wgpuRenderPassEncoderSetBindGroup.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetBindGroup$handle() { - return wgpuRenderPassEncoderSetBindGroup.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetBindGroup$address() { - return wgpuRenderPassEncoderSetBindGroup.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t *dynamicOffsets) - * } - */ - public static void wgpuRenderPassEncoderSetBindGroup(MemorySegment renderPassEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets) { - var mh$ = wgpuRenderPassEncoderSetBindGroup.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetBindGroup", renderPassEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } - mh$.invokeExact(renderPassEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetBlendConstant { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetBlendConstant"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, const WGPUColor *color) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetBlendConstant$descriptor() { - return wgpuRenderPassEncoderSetBlendConstant.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, const WGPUColor *color) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetBlendConstant$handle() { - return wgpuRenderPassEncoderSetBlendConstant.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, const WGPUColor *color) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetBlendConstant$address() { - return wgpuRenderPassEncoderSetBlendConstant.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, const WGPUColor *color) - * } - */ - public static void wgpuRenderPassEncoderSetBlendConstant(MemorySegment renderPassEncoder, MemorySegment color) { - var mh$ = wgpuRenderPassEncoderSetBlendConstant.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetBlendConstant", renderPassEncoder, color); - } - mh$.invokeExact(renderPassEncoder, color); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetIndexBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetIndexBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetIndexBuffer$descriptor() { - return wgpuRenderPassEncoderSetIndexBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetIndexBuffer$handle() { - return wgpuRenderPassEncoderSetIndexBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetIndexBuffer$address() { - return wgpuRenderPassEncoderSetIndexBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) - * } - */ - public static void wgpuRenderPassEncoderSetIndexBuffer(MemorySegment renderPassEncoder, MemorySegment buffer, int format, long offset, long size) { - var mh$ = wgpuRenderPassEncoderSetIndexBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetIndexBuffer", renderPassEncoder, buffer, format, offset, size); - } - mh$.invokeExact(renderPassEncoder, buffer, format, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, const char *label) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetLabel$descriptor() { - return wgpuRenderPassEncoderSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, const char *label) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetLabel$handle() { - return wgpuRenderPassEncoderSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, const char *label) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetLabel$address() { - return wgpuRenderPassEncoderSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, const char *label) - * } - */ - public static void wgpuRenderPassEncoderSetLabel(MemorySegment renderPassEncoder, MemorySegment label) { - var mh$ = wgpuRenderPassEncoderSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetLabel", renderPassEncoder, label); - } - mh$.invokeExact(renderPassEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetPipeline { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetPipeline"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetPipeline$descriptor() { - return wgpuRenderPassEncoderSetPipeline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetPipeline$handle() { - return wgpuRenderPassEncoderSetPipeline.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetPipeline$address() { - return wgpuRenderPassEncoderSetPipeline.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) - * } - */ - public static void wgpuRenderPassEncoderSetPipeline(MemorySegment renderPassEncoder, MemorySegment pipeline) { - var mh$ = wgpuRenderPassEncoderSetPipeline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetPipeline", renderPassEncoder, pipeline); - } - mh$.invokeExact(renderPassEncoder, pipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetScissorRect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetScissorRect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetScissorRect$descriptor() { - return wgpuRenderPassEncoderSetScissorRect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetScissorRect$handle() { - return wgpuRenderPassEncoderSetScissorRect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetScissorRect$address() { - return wgpuRenderPassEncoderSetScissorRect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) - * } - */ - public static void wgpuRenderPassEncoderSetScissorRect(MemorySegment renderPassEncoder, int x, int y, int width, int height) { - var mh$ = wgpuRenderPassEncoderSetScissorRect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetScissorRect", renderPassEncoder, x, y, width, height); - } - mh$.invokeExact(renderPassEncoder, x, y, width, height); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetStencilReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetStencilReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetStencilReference$descriptor() { - return wgpuRenderPassEncoderSetStencilReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetStencilReference$handle() { - return wgpuRenderPassEncoderSetStencilReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetStencilReference$address() { - return wgpuRenderPassEncoderSetStencilReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) - * } - */ - public static void wgpuRenderPassEncoderSetStencilReference(MemorySegment renderPassEncoder, int reference) { - var mh$ = wgpuRenderPassEncoderSetStencilReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetStencilReference", renderPassEncoder, reference); - } - mh$.invokeExact(renderPassEncoder, reference); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetVertexBuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetVertexBuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetVertexBuffer$descriptor() { - return wgpuRenderPassEncoderSetVertexBuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetVertexBuffer$handle() { - return wgpuRenderPassEncoderSetVertexBuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetVertexBuffer$address() { - return wgpuRenderPassEncoderSetVertexBuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) - * } - */ - public static void wgpuRenderPassEncoderSetVertexBuffer(MemorySegment renderPassEncoder, int slot, MemorySegment buffer, long offset, long size) { - var mh$ = wgpuRenderPassEncoderSetVertexBuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetVertexBuffer", renderPassEncoder, slot, buffer, offset, size); - } - mh$.invokeExact(renderPassEncoder, slot, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetViewport { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetViewport"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetViewport$descriptor() { - return wgpuRenderPassEncoderSetViewport.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetViewport$handle() { - return wgpuRenderPassEncoderSetViewport.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetViewport$address() { - return wgpuRenderPassEncoderSetViewport.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) - * } - */ - public static void wgpuRenderPassEncoderSetViewport(MemorySegment renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) { - var mh$ = wgpuRenderPassEncoderSetViewport.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetViewport", renderPassEncoder, x, y, width, height, minDepth, maxDepth); - } - mh$.invokeExact(renderPassEncoder, x, y, width, height, minDepth, maxDepth); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderReference$descriptor() { - return wgpuRenderPassEncoderReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MethodHandle wgpuRenderPassEncoderReference$handle() { - return wgpuRenderPassEncoderReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MemorySegment wgpuRenderPassEncoderReference$address() { - return wgpuRenderPassEncoderReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static void wgpuRenderPassEncoderReference(MemorySegment renderPassEncoder) { - var mh$ = wgpuRenderPassEncoderReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderReference", renderPassEncoder); - } - mh$.invokeExact(renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderRelease$descriptor() { - return wgpuRenderPassEncoderRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MethodHandle wgpuRenderPassEncoderRelease$handle() { - return wgpuRenderPassEncoderRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MemorySegment wgpuRenderPassEncoderRelease$address() { - return wgpuRenderPassEncoderRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static void wgpuRenderPassEncoderRelease(MemorySegment renderPassEncoder) { - var mh$ = wgpuRenderPassEncoderRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderRelease", renderPassEncoder); - } - mh$.invokeExact(renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPipelineGetBindGroupLayout { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPipelineGetBindGroupLayout"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) - * } - */ - public static FunctionDescriptor wgpuRenderPipelineGetBindGroupLayout$descriptor() { - return wgpuRenderPipelineGetBindGroupLayout.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) - * } - */ - public static MethodHandle wgpuRenderPipelineGetBindGroupLayout$handle() { - return wgpuRenderPipelineGetBindGroupLayout.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) - * } - */ - public static MemorySegment wgpuRenderPipelineGetBindGroupLayout$address() { - return wgpuRenderPipelineGetBindGroupLayout.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) - * } - */ - public static MemorySegment wgpuRenderPipelineGetBindGroupLayout(MemorySegment renderPipeline, int groupIndex) { - var mh$ = wgpuRenderPipelineGetBindGroupLayout.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPipelineGetBindGroupLayout", renderPipeline, groupIndex); - } - return (MemorySegment)mh$.invokeExact(renderPipeline, groupIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPipelineSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPipelineSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, const char *label) - * } - */ - public static FunctionDescriptor wgpuRenderPipelineSetLabel$descriptor() { - return wgpuRenderPipelineSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, const char *label) - * } - */ - public static MethodHandle wgpuRenderPipelineSetLabel$handle() { - return wgpuRenderPipelineSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, const char *label) - * } - */ - public static MemorySegment wgpuRenderPipelineSetLabel$address() { - return wgpuRenderPipelineSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, const char *label) - * } - */ - public static void wgpuRenderPipelineSetLabel(MemorySegment renderPipeline, MemorySegment label) { - var mh$ = wgpuRenderPipelineSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPipelineSetLabel", renderPipeline, label); - } - mh$.invokeExact(renderPipeline, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPipelineReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPipelineReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline) - * } - */ - public static FunctionDescriptor wgpuRenderPipelineReference$descriptor() { - return wgpuRenderPipelineReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline) - * } - */ - public static MethodHandle wgpuRenderPipelineReference$handle() { - return wgpuRenderPipelineReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline) - * } - */ - public static MemorySegment wgpuRenderPipelineReference$address() { - return wgpuRenderPipelineReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline) - * } - */ - public static void wgpuRenderPipelineReference(MemorySegment renderPipeline) { - var mh$ = wgpuRenderPipelineReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPipelineReference", renderPipeline); - } - mh$.invokeExact(renderPipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPipelineRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPipelineRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) - * } - */ - public static FunctionDescriptor wgpuRenderPipelineRelease$descriptor() { - return wgpuRenderPipelineRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) - * } - */ - public static MethodHandle wgpuRenderPipelineRelease$handle() { - return wgpuRenderPipelineRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) - * } - */ - public static MemorySegment wgpuRenderPipelineRelease$address() { - return wgpuRenderPipelineRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) - * } - */ - public static void wgpuRenderPipelineRelease(MemorySegment renderPipeline) { - var mh$ = wgpuRenderPipelineRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPipelineRelease", renderPipeline); - } - mh$.invokeExact(renderPipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSamplerSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSamplerSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSamplerSetLabel(WGPUSampler sampler, const char *label) - * } - */ - public static FunctionDescriptor wgpuSamplerSetLabel$descriptor() { - return wgpuSamplerSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSamplerSetLabel(WGPUSampler sampler, const char *label) - * } - */ - public static MethodHandle wgpuSamplerSetLabel$handle() { - return wgpuSamplerSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSamplerSetLabel(WGPUSampler sampler, const char *label) - * } - */ - public static MemorySegment wgpuSamplerSetLabel$address() { - return wgpuSamplerSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSamplerSetLabel(WGPUSampler sampler, const char *label) - * } - */ - public static void wgpuSamplerSetLabel(MemorySegment sampler, MemorySegment label) { - var mh$ = wgpuSamplerSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSamplerSetLabel", sampler, label); - } - mh$.invokeExact(sampler, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSamplerReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSamplerReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSamplerReference(WGPUSampler sampler) - * } - */ - public static FunctionDescriptor wgpuSamplerReference$descriptor() { - return wgpuSamplerReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSamplerReference(WGPUSampler sampler) - * } - */ - public static MethodHandle wgpuSamplerReference$handle() { - return wgpuSamplerReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSamplerReference(WGPUSampler sampler) - * } - */ - public static MemorySegment wgpuSamplerReference$address() { - return wgpuSamplerReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSamplerReference(WGPUSampler sampler) - * } - */ - public static void wgpuSamplerReference(MemorySegment sampler) { - var mh$ = wgpuSamplerReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSamplerReference", sampler); - } - mh$.invokeExact(sampler); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSamplerRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSamplerRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSamplerRelease(WGPUSampler sampler) - * } - */ - public static FunctionDescriptor wgpuSamplerRelease$descriptor() { - return wgpuSamplerRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSamplerRelease(WGPUSampler sampler) - * } - */ - public static MethodHandle wgpuSamplerRelease$handle() { - return wgpuSamplerRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSamplerRelease(WGPUSampler sampler) - * } - */ - public static MemorySegment wgpuSamplerRelease$address() { - return wgpuSamplerRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSamplerRelease(WGPUSampler sampler) - * } - */ - public static void wgpuSamplerRelease(MemorySegment sampler) { - var mh$ = wgpuSamplerRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSamplerRelease", sampler); - } - mh$.invokeExact(sampler); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuShaderModuleGetCompilationInfo { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuShaderModuleGetCompilationInfo"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuShaderModuleGetCompilationInfo$descriptor() { - return wgpuShaderModuleGetCompilationInfo.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuShaderModuleGetCompilationInfo$handle() { - return wgpuShaderModuleGetCompilationInfo.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuShaderModuleGetCompilationInfo$address() { - return wgpuShaderModuleGetCompilationInfo.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void *userdata) - * } - */ - public static void wgpuShaderModuleGetCompilationInfo(MemorySegment shaderModule, MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuShaderModuleGetCompilationInfo.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuShaderModuleGetCompilationInfo", shaderModule, callback, userdata); - } - mh$.invokeExact(shaderModule, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuShaderModuleSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuShaderModuleSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, const char *label) - * } - */ - public static FunctionDescriptor wgpuShaderModuleSetLabel$descriptor() { - return wgpuShaderModuleSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, const char *label) - * } - */ - public static MethodHandle wgpuShaderModuleSetLabel$handle() { - return wgpuShaderModuleSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, const char *label) - * } - */ - public static MemorySegment wgpuShaderModuleSetLabel$address() { - return wgpuShaderModuleSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, const char *label) - * } - */ - public static void wgpuShaderModuleSetLabel(MemorySegment shaderModule, MemorySegment label) { - var mh$ = wgpuShaderModuleSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuShaderModuleSetLabel", shaderModule, label); - } - mh$.invokeExact(shaderModule, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuShaderModuleReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuShaderModuleReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuShaderModuleReference(WGPUShaderModule shaderModule) - * } - */ - public static FunctionDescriptor wgpuShaderModuleReference$descriptor() { - return wgpuShaderModuleReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuShaderModuleReference(WGPUShaderModule shaderModule) - * } - */ - public static MethodHandle wgpuShaderModuleReference$handle() { - return wgpuShaderModuleReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuShaderModuleReference(WGPUShaderModule shaderModule) - * } - */ - public static MemorySegment wgpuShaderModuleReference$address() { - return wgpuShaderModuleReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuShaderModuleReference(WGPUShaderModule shaderModule) - * } - */ - public static void wgpuShaderModuleReference(MemorySegment shaderModule) { - var mh$ = wgpuShaderModuleReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuShaderModuleReference", shaderModule); - } - mh$.invokeExact(shaderModule); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuShaderModuleRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuShaderModuleRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) - * } - */ - public static FunctionDescriptor wgpuShaderModuleRelease$descriptor() { - return wgpuShaderModuleRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) - * } - */ - public static MethodHandle wgpuShaderModuleRelease$handle() { - return wgpuShaderModuleRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) - * } - */ - public static MemorySegment wgpuShaderModuleRelease$address() { - return wgpuShaderModuleRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) - * } - */ - public static void wgpuShaderModuleRelease(MemorySegment shaderModule) { - var mh$ = wgpuShaderModuleRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuShaderModuleRelease", shaderModule); - } - mh$.invokeExact(shaderModule); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceConfigure { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceConfigure"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceConfigure(WGPUSurface surface, const WGPUSurfaceConfiguration *config) - * } - */ - public static FunctionDescriptor wgpuSurfaceConfigure$descriptor() { - return wgpuSurfaceConfigure.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceConfigure(WGPUSurface surface, const WGPUSurfaceConfiguration *config) - * } - */ - public static MethodHandle wgpuSurfaceConfigure$handle() { - return wgpuSurfaceConfigure.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceConfigure(WGPUSurface surface, const WGPUSurfaceConfiguration *config) - * } - */ - public static MemorySegment wgpuSurfaceConfigure$address() { - return wgpuSurfaceConfigure.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceConfigure(WGPUSurface surface, const WGPUSurfaceConfiguration *config) - * } - */ - public static void wgpuSurfaceConfigure(MemorySegment surface, MemorySegment config) { - var mh$ = wgpuSurfaceConfigure.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceConfigure", surface, config); - } - mh$.invokeExact(surface, config); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceGetCapabilities { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceGetCapabilities"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities *capabilities) - * } - */ - public static FunctionDescriptor wgpuSurfaceGetCapabilities$descriptor() { - return wgpuSurfaceGetCapabilities.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities *capabilities) - * } - */ - public static MethodHandle wgpuSurfaceGetCapabilities$handle() { - return wgpuSurfaceGetCapabilities.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities *capabilities) - * } - */ - public static MemorySegment wgpuSurfaceGetCapabilities$address() { - return wgpuSurfaceGetCapabilities.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities *capabilities) - * } - */ - public static void wgpuSurfaceGetCapabilities(MemorySegment surface, MemorySegment adapter, MemorySegment capabilities) { - var mh$ = wgpuSurfaceGetCapabilities.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceGetCapabilities", surface, adapter, capabilities); - } - mh$.invokeExact(surface, adapter, capabilities); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceGetCurrentTexture { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceGetCurrentTexture"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture *surfaceTexture) - * } - */ - public static FunctionDescriptor wgpuSurfaceGetCurrentTexture$descriptor() { - return wgpuSurfaceGetCurrentTexture.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture *surfaceTexture) - * } - */ - public static MethodHandle wgpuSurfaceGetCurrentTexture$handle() { - return wgpuSurfaceGetCurrentTexture.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture *surfaceTexture) - * } - */ - public static MemorySegment wgpuSurfaceGetCurrentTexture$address() { - return wgpuSurfaceGetCurrentTexture.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture *surfaceTexture) - * } - */ - public static void wgpuSurfaceGetCurrentTexture(MemorySegment surface, MemorySegment surfaceTexture) { - var mh$ = wgpuSurfaceGetCurrentTexture.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceGetCurrentTexture", surface, surfaceTexture); - } - mh$.invokeExact(surface, surfaceTexture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceGetPreferredFormat { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceGetPreferredFormat"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) - * } - */ - public static FunctionDescriptor wgpuSurfaceGetPreferredFormat$descriptor() { - return wgpuSurfaceGetPreferredFormat.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) - * } - */ - public static MethodHandle wgpuSurfaceGetPreferredFormat$handle() { - return wgpuSurfaceGetPreferredFormat.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) - * } - */ - public static MemorySegment wgpuSurfaceGetPreferredFormat$address() { - return wgpuSurfaceGetPreferredFormat.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) - * } - */ - public static int wgpuSurfaceGetPreferredFormat(MemorySegment surface, MemorySegment adapter) { - var mh$ = wgpuSurfaceGetPreferredFormat.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceGetPreferredFormat", surface, adapter); - } - return (int)mh$.invokeExact(surface, adapter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfacePresent { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfacePresent"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfacePresent(WGPUSurface surface) - * } - */ - public static FunctionDescriptor wgpuSurfacePresent$descriptor() { - return wgpuSurfacePresent.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfacePresent(WGPUSurface surface) - * } - */ - public static MethodHandle wgpuSurfacePresent$handle() { - return wgpuSurfacePresent.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfacePresent(WGPUSurface surface) - * } - */ - public static MemorySegment wgpuSurfacePresent$address() { - return wgpuSurfacePresent.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfacePresent(WGPUSurface surface) - * } - */ - public static void wgpuSurfacePresent(MemorySegment surface) { - var mh$ = wgpuSurfacePresent.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfacePresent", surface); - } - mh$.invokeExact(surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceUnconfigure { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceUnconfigure"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceUnconfigure(WGPUSurface surface) - * } - */ - public static FunctionDescriptor wgpuSurfaceUnconfigure$descriptor() { - return wgpuSurfaceUnconfigure.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceUnconfigure(WGPUSurface surface) - * } - */ - public static MethodHandle wgpuSurfaceUnconfigure$handle() { - return wgpuSurfaceUnconfigure.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceUnconfigure(WGPUSurface surface) - * } - */ - public static MemorySegment wgpuSurfaceUnconfigure$address() { - return wgpuSurfaceUnconfigure.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceUnconfigure(WGPUSurface surface) - * } - */ - public static void wgpuSurfaceUnconfigure(MemorySegment surface) { - var mh$ = wgpuSurfaceUnconfigure.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceUnconfigure", surface); - } - mh$.invokeExact(surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceReference(WGPUSurface surface) - * } - */ - public static FunctionDescriptor wgpuSurfaceReference$descriptor() { - return wgpuSurfaceReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceReference(WGPUSurface surface) - * } - */ - public static MethodHandle wgpuSurfaceReference$handle() { - return wgpuSurfaceReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceReference(WGPUSurface surface) - * } - */ - public static MemorySegment wgpuSurfaceReference$address() { - return wgpuSurfaceReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceReference(WGPUSurface surface) - * } - */ - public static void wgpuSurfaceReference(MemorySegment surface) { - var mh$ = wgpuSurfaceReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceReference", surface); - } - mh$.invokeExact(surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceRelease(WGPUSurface surface) - * } - */ - public static FunctionDescriptor wgpuSurfaceRelease$descriptor() { - return wgpuSurfaceRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceRelease(WGPUSurface surface) - * } - */ - public static MethodHandle wgpuSurfaceRelease$handle() { - return wgpuSurfaceRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceRelease(WGPUSurface surface) - * } - */ - public static MemorySegment wgpuSurfaceRelease$address() { - return wgpuSurfaceRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceRelease(WGPUSurface surface) - * } - */ - public static void wgpuSurfaceRelease(MemorySegment surface) { - var mh$ = wgpuSurfaceRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceRelease", surface); - } - mh$.invokeExact(surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSurfaceCapabilitiesFreeMembers { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPUSurfaceCapabilities.layout() - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSurfaceCapabilitiesFreeMembers"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities capabilities) - * } - */ - public static FunctionDescriptor wgpuSurfaceCapabilitiesFreeMembers$descriptor() { - return wgpuSurfaceCapabilitiesFreeMembers.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities capabilities) - * } - */ - public static MethodHandle wgpuSurfaceCapabilitiesFreeMembers$handle() { - return wgpuSurfaceCapabilitiesFreeMembers.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities capabilities) - * } - */ - public static MemorySegment wgpuSurfaceCapabilitiesFreeMembers$address() { - return wgpuSurfaceCapabilitiesFreeMembers.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities capabilities) - * } - */ - public static void wgpuSurfaceCapabilitiesFreeMembers(MemorySegment capabilities) { - var mh$ = wgpuSurfaceCapabilitiesFreeMembers.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSurfaceCapabilitiesFreeMembers", capabilities); - } - mh$.invokeExact(capabilities); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureCreateView { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureCreateView"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, const WGPUTextureViewDescriptor *descriptor) - * } - */ - public static FunctionDescriptor wgpuTextureCreateView$descriptor() { - return wgpuTextureCreateView.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, const WGPUTextureViewDescriptor *descriptor) - * } - */ - public static MethodHandle wgpuTextureCreateView$handle() { - return wgpuTextureCreateView.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, const WGPUTextureViewDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuTextureCreateView$address() { - return wgpuTextureCreateView.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, const WGPUTextureViewDescriptor *descriptor) - * } - */ - public static MemorySegment wgpuTextureCreateView(MemorySegment texture, MemorySegment descriptor) { - var mh$ = wgpuTextureCreateView.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureCreateView", texture, descriptor); - } - return (MemorySegment)mh$.invokeExact(texture, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureDestroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureDestroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureDestroy(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureDestroy$descriptor() { - return wgpuTextureDestroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureDestroy(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureDestroy$handle() { - return wgpuTextureDestroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureDestroy(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureDestroy$address() { - return wgpuTextureDestroy.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureDestroy(WGPUTexture texture) - * } - */ - public static void wgpuTextureDestroy(MemorySegment texture) { - var mh$ = wgpuTextureDestroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureDestroy", texture); - } - mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetDepthOrArrayLayers { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetDepthOrArrayLayers"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetDepthOrArrayLayers$descriptor() { - return wgpuTextureGetDepthOrArrayLayers.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetDepthOrArrayLayers$handle() { - return wgpuTextureGetDepthOrArrayLayers.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetDepthOrArrayLayers$address() { - return wgpuTextureGetDepthOrArrayLayers.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetDepthOrArrayLayers(MemorySegment texture) { - var mh$ = wgpuTextureGetDepthOrArrayLayers.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetDepthOrArrayLayers", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetDimension { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetDimension"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetDimension$descriptor() { - return wgpuTextureGetDimension.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetDimension$handle() { - return wgpuTextureGetDimension.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetDimension$address() { - return wgpuTextureGetDimension.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetDimension(MemorySegment texture) { - var mh$ = wgpuTextureGetDimension.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetDimension", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetFormat { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetFormat"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetFormat$descriptor() { - return wgpuTextureGetFormat.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetFormat$handle() { - return wgpuTextureGetFormat.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetFormat$address() { - return wgpuTextureGetFormat.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetFormat(MemorySegment texture) { - var mh$ = wgpuTextureGetFormat.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetFormat", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetHeight { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetHeight"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetHeight(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetHeight$descriptor() { - return wgpuTextureGetHeight.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetHeight(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetHeight$handle() { - return wgpuTextureGetHeight.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetHeight(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetHeight$address() { - return wgpuTextureGetHeight.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuTextureGetHeight(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetHeight(MemorySegment texture) { - var mh$ = wgpuTextureGetHeight.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetHeight", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetMipLevelCount { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetMipLevelCount"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetMipLevelCount$descriptor() { - return wgpuTextureGetMipLevelCount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetMipLevelCount$handle() { - return wgpuTextureGetMipLevelCount.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetMipLevelCount$address() { - return wgpuTextureGetMipLevelCount.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetMipLevelCount(MemorySegment texture) { - var mh$ = wgpuTextureGetMipLevelCount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetMipLevelCount", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetSampleCount { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetSampleCount"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetSampleCount$descriptor() { - return wgpuTextureGetSampleCount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetSampleCount$handle() { - return wgpuTextureGetSampleCount.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetSampleCount$address() { - return wgpuTextureGetSampleCount.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetSampleCount(MemorySegment texture) { - var mh$ = wgpuTextureGetSampleCount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetSampleCount", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetUsage { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetUsage"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUTextureUsageFlags wgpuTextureGetUsage(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetUsage$descriptor() { - return wgpuTextureGetUsage.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUTextureUsageFlags wgpuTextureGetUsage(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetUsage$handle() { - return wgpuTextureGetUsage.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUTextureUsageFlags wgpuTextureGetUsage(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetUsage$address() { - return wgpuTextureGetUsage.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUTextureUsageFlags wgpuTextureGetUsage(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetUsage(MemorySegment texture) { - var mh$ = wgpuTextureGetUsage.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetUsage", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureGetWidth { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureGetWidth"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetWidth(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureGetWidth$descriptor() { - return wgpuTextureGetWidth.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetWidth(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureGetWidth$handle() { - return wgpuTextureGetWidth.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuTextureGetWidth(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureGetWidth$address() { - return wgpuTextureGetWidth.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuTextureGetWidth(WGPUTexture texture) - * } - */ - public static int wgpuTextureGetWidth(MemorySegment texture) { - var mh$ = wgpuTextureGetWidth.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureGetWidth", texture); - } - return (int)mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureSetLabel(WGPUTexture texture, const char *label) - * } - */ - public static FunctionDescriptor wgpuTextureSetLabel$descriptor() { - return wgpuTextureSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureSetLabel(WGPUTexture texture, const char *label) - * } - */ - public static MethodHandle wgpuTextureSetLabel$handle() { - return wgpuTextureSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureSetLabel(WGPUTexture texture, const char *label) - * } - */ - public static MemorySegment wgpuTextureSetLabel$address() { - return wgpuTextureSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureSetLabel(WGPUTexture texture, const char *label) - * } - */ - public static void wgpuTextureSetLabel(MemorySegment texture, MemorySegment label) { - var mh$ = wgpuTextureSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureSetLabel", texture, label); - } - mh$.invokeExact(texture, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureReference(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureReference$descriptor() { - return wgpuTextureReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureReference(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureReference$handle() { - return wgpuTextureReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureReference(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureReference$address() { - return wgpuTextureReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureReference(WGPUTexture texture) - * } - */ - public static void wgpuTextureReference(MemorySegment texture) { - var mh$ = wgpuTextureReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureReference", texture); - } - mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureRelease(WGPUTexture texture) - * } - */ - public static FunctionDescriptor wgpuTextureRelease$descriptor() { - return wgpuTextureRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureRelease(WGPUTexture texture) - * } - */ - public static MethodHandle wgpuTextureRelease$handle() { - return wgpuTextureRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureRelease(WGPUTexture texture) - * } - */ - public static MemorySegment wgpuTextureRelease$address() { - return wgpuTextureRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureRelease(WGPUTexture texture) - * } - */ - public static void wgpuTextureRelease(MemorySegment texture) { - var mh$ = wgpuTextureRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureRelease", texture); - } - mh$.invokeExact(texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureViewSetLabel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureViewSetLabel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureViewSetLabel(WGPUTextureView textureView, const char *label) - * } - */ - public static FunctionDescriptor wgpuTextureViewSetLabel$descriptor() { - return wgpuTextureViewSetLabel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureViewSetLabel(WGPUTextureView textureView, const char *label) - * } - */ - public static MethodHandle wgpuTextureViewSetLabel$handle() { - return wgpuTextureViewSetLabel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureViewSetLabel(WGPUTextureView textureView, const char *label) - * } - */ - public static MemorySegment wgpuTextureViewSetLabel$address() { - return wgpuTextureViewSetLabel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureViewSetLabel(WGPUTextureView textureView, const char *label) - * } - */ - public static void wgpuTextureViewSetLabel(MemorySegment textureView, MemorySegment label) { - var mh$ = wgpuTextureViewSetLabel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureViewSetLabel", textureView, label); - } - mh$.invokeExact(textureView, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureViewReference { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureViewReference"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureViewReference(WGPUTextureView textureView) - * } - */ - public static FunctionDescriptor wgpuTextureViewReference$descriptor() { - return wgpuTextureViewReference.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureViewReference(WGPUTextureView textureView) - * } - */ - public static MethodHandle wgpuTextureViewReference$handle() { - return wgpuTextureViewReference.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureViewReference(WGPUTextureView textureView) - * } - */ - public static MemorySegment wgpuTextureViewReference$address() { - return wgpuTextureViewReference.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureViewReference(WGPUTextureView textureView) - * } - */ - public static void wgpuTextureViewReference(MemorySegment textureView) { - var mh$ = wgpuTextureViewReference.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureViewReference", textureView); - } - mh$.invokeExact(textureView); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuTextureViewRelease { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuTextureViewRelease"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuTextureViewRelease(WGPUTextureView textureView) - * } - */ - public static FunctionDescriptor wgpuTextureViewRelease$descriptor() { - return wgpuTextureViewRelease.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuTextureViewRelease(WGPUTextureView textureView) - * } - */ - public static MethodHandle wgpuTextureViewRelease$handle() { - return wgpuTextureViewRelease.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuTextureViewRelease(WGPUTextureView textureView) - * } - */ - public static MemorySegment wgpuTextureViewRelease$address() { - return wgpuTextureViewRelease.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuTextureViewRelease(WGPUTextureView textureView) - * } - */ - public static void wgpuTextureViewRelease(MemorySegment textureView) { - var mh$ = wgpuTextureViewRelease.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuTextureViewRelease", textureView); - } - mh$.invokeExact(textureView); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int WGPUSType_DeviceExtras = (int)196609L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_DeviceExtras = 196609 - * } - */ - public static int WGPUSType_DeviceExtras() { - return WGPUSType_DeviceExtras; - } - private static final int WGPUSType_RequiredLimitsExtras = (int)196610L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_RequiredLimitsExtras = 196610 - * } - */ - public static int WGPUSType_RequiredLimitsExtras() { - return WGPUSType_RequiredLimitsExtras; - } - private static final int WGPUSType_PipelineLayoutExtras = (int)196611L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_PipelineLayoutExtras = 196611 - * } - */ - public static int WGPUSType_PipelineLayoutExtras() { - return WGPUSType_PipelineLayoutExtras; - } - private static final int WGPUSType_ShaderModuleGLSLDescriptor = (int)196612L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_ShaderModuleGLSLDescriptor = 196612 - * } - */ - public static int WGPUSType_ShaderModuleGLSLDescriptor() { - return WGPUSType_ShaderModuleGLSLDescriptor; - } - private static final int WGPUSType_SupportedLimitsExtras = (int)196613L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_SupportedLimitsExtras = 196613 - * } - */ - public static int WGPUSType_SupportedLimitsExtras() { - return WGPUSType_SupportedLimitsExtras; - } - private static final int WGPUSType_InstanceExtras = (int)196614L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_InstanceExtras = 196614 - * } - */ - public static int WGPUSType_InstanceExtras() { - return WGPUSType_InstanceExtras; - } - private static final int WGPUSType_BindGroupEntryExtras = (int)196615L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_BindGroupEntryExtras = 196615 - * } - */ - public static int WGPUSType_BindGroupEntryExtras() { - return WGPUSType_BindGroupEntryExtras; - } - private static final int WGPUSType_BindGroupLayoutEntryExtras = (int)196616L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_BindGroupLayoutEntryExtras = 196616 - * } - */ - public static int WGPUSType_BindGroupLayoutEntryExtras() { - return WGPUSType_BindGroupLayoutEntryExtras; - } - private static final int WGPUSType_QuerySetDescriptorExtras = (int)196617L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_QuerySetDescriptorExtras = 196617 - * } - */ - public static int WGPUSType_QuerySetDescriptorExtras() { - return WGPUSType_QuerySetDescriptorExtras; - } - private static final int WGPUSType_SurfaceConfigurationExtras = (int)196618L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUSType_SurfaceConfigurationExtras = 196618 - * } - */ - public static int WGPUSType_SurfaceConfigurationExtras() { - return WGPUSType_SurfaceConfigurationExtras; - } - private static final int WGPUNativeSType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUNativeSType.WGPUNativeSType_Force32 = 2147483647 - * } - */ - public static int WGPUNativeSType_Force32() { - return WGPUNativeSType_Force32; - } - private static final int WGPUNativeFeature_PushConstants = (int)196609L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_PushConstants = 196609 - * } - */ - public static int WGPUNativeFeature_PushConstants() { - return WGPUNativeFeature_PushConstants; - } - private static final int WGPUNativeFeature_TextureAdapterSpecificFormatFeatures = (int)196610L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_TextureAdapterSpecificFormatFeatures = 196610 - * } - */ - public static int WGPUNativeFeature_TextureAdapterSpecificFormatFeatures() { - return WGPUNativeFeature_TextureAdapterSpecificFormatFeatures; - } - private static final int WGPUNativeFeature_MultiDrawIndirect = (int)196611L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_MultiDrawIndirect = 196611 - * } - */ - public static int WGPUNativeFeature_MultiDrawIndirect() { - return WGPUNativeFeature_MultiDrawIndirect; - } - private static final int WGPUNativeFeature_MultiDrawIndirectCount = (int)196612L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_MultiDrawIndirectCount = 196612 - * } - */ - public static int WGPUNativeFeature_MultiDrawIndirectCount() { - return WGPUNativeFeature_MultiDrawIndirectCount; - } - private static final int WGPUNativeFeature_VertexWritableStorage = (int)196613L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_VertexWritableStorage = 196613 - * } - */ - public static int WGPUNativeFeature_VertexWritableStorage() { - return WGPUNativeFeature_VertexWritableStorage; - } - private static final int WGPUNativeFeature_TextureBindingArray = (int)196614L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_TextureBindingArray = 196614 - * } - */ - public static int WGPUNativeFeature_TextureBindingArray() { - return WGPUNativeFeature_TextureBindingArray; - } - private static final int WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing = (int)196615L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing = 196615 - * } - */ - public static int WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing() { - return WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing; - } - private static final int WGPUNativeFeature_PipelineStatisticsQuery = (int)196616L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_PipelineStatisticsQuery = 196616 - * } - */ - public static int WGPUNativeFeature_PipelineStatisticsQuery() { - return WGPUNativeFeature_PipelineStatisticsQuery; - } - private static final int WGPUNativeFeature_StorageResourceBindingArray = (int)196617L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_StorageResourceBindingArray = 196617 - * } - */ - public static int WGPUNativeFeature_StorageResourceBindingArray() { - return WGPUNativeFeature_StorageResourceBindingArray; - } - private static final int WGPUNativeFeature_PartiallyBoundBindingArray = (int)196618L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_PartiallyBoundBindingArray = 196618 - * } - */ - public static int WGPUNativeFeature_PartiallyBoundBindingArray() { - return WGPUNativeFeature_PartiallyBoundBindingArray; - } - private static final int WGPUNativeFeature_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUNativeFeature.WGPUNativeFeature_Force32 = 2147483647 - * } - */ - public static int WGPUNativeFeature_Force32() { - return WGPUNativeFeature_Force32; - } - private static final int WGPULogLevel_Off = (int)0L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Off = 0 - * } - */ - public static int WGPULogLevel_Off() { - return WGPULogLevel_Off; - } - private static final int WGPULogLevel_Error = (int)1L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Error = 1 - * } - */ - public static int WGPULogLevel_Error() { - return WGPULogLevel_Error; - } - private static final int WGPULogLevel_Warn = (int)2L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Warn = 2 - * } - */ - public static int WGPULogLevel_Warn() { - return WGPULogLevel_Warn; - } - private static final int WGPULogLevel_Info = (int)3L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Info = 3 - * } - */ - public static int WGPULogLevel_Info() { - return WGPULogLevel_Info; - } - private static final int WGPULogLevel_Debug = (int)4L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Debug = 4 - * } - */ - public static int WGPULogLevel_Debug() { - return WGPULogLevel_Debug; - } - private static final int WGPULogLevel_Trace = (int)5L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Trace = 5 - * } - */ - public static int WGPULogLevel_Trace() { - return WGPULogLevel_Trace; - } - private static final int WGPULogLevel_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPULogLevel.WGPULogLevel_Force32 = 2147483647 - * } - */ - public static int WGPULogLevel_Force32() { - return WGPULogLevel_Force32; - } - private static final int WGPUInstanceBackend_All = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_All = 0 - * } - */ - public static int WGPUInstanceBackend_All() { - return WGPUInstanceBackend_All; - } - private static final int WGPUInstanceBackend_Vulkan = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_Vulkan = 1 - * } - */ - public static int WGPUInstanceBackend_Vulkan() { - return WGPUInstanceBackend_Vulkan; - } - private static final int WGPUInstanceBackend_GL = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_GL = 2 - * } - */ - public static int WGPUInstanceBackend_GL() { - return WGPUInstanceBackend_GL; - } - private static final int WGPUInstanceBackend_Metal = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_Metal = 4 - * } - */ - public static int WGPUInstanceBackend_Metal() { - return WGPUInstanceBackend_Metal; - } - private static final int WGPUInstanceBackend_DX12 = (int)8L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_DX12 = 8 - * } - */ - public static int WGPUInstanceBackend_DX12() { - return WGPUInstanceBackend_DX12; - } - private static final int WGPUInstanceBackend_DX11 = (int)16L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_DX11 = 16 - * } - */ - public static int WGPUInstanceBackend_DX11() { - return WGPUInstanceBackend_DX11; - } - private static final int WGPUInstanceBackend_BrowserWebGPU = (int)32L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_BrowserWebGPU = 32 - * } - */ - public static int WGPUInstanceBackend_BrowserWebGPU() { - return WGPUInstanceBackend_BrowserWebGPU; - } - private static final int WGPUInstanceBackend_Primary = (int)45L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_Primary = 45 - * } - */ - public static int WGPUInstanceBackend_Primary() { - return WGPUInstanceBackend_Primary; - } - private static final int WGPUInstanceBackend_Secondary = (int)18L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_Secondary = 18 - * } - */ - public static int WGPUInstanceBackend_Secondary() { - return WGPUInstanceBackend_Secondary; - } - private static final int WGPUInstanceBackend_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUInstanceBackend.WGPUInstanceBackend_Force32 = 2147483647 - * } - */ - public static int WGPUInstanceBackend_Force32() { - return WGPUInstanceBackend_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUInstanceBackendFlags - * } - */ - public static final OfInt WGPUInstanceBackendFlags = WGPU.C_INT; - private static final int WGPUInstanceFlag_Default = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUInstanceFlag.WGPUInstanceFlag_Default = 0 - * } - */ - public static int WGPUInstanceFlag_Default() { - return WGPUInstanceFlag_Default; - } - private static final int WGPUInstanceFlag_Debug = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUInstanceFlag.WGPUInstanceFlag_Debug = 1 - * } - */ - public static int WGPUInstanceFlag_Debug() { - return WGPUInstanceFlag_Debug; - } - private static final int WGPUInstanceFlag_Validation = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUInstanceFlag.WGPUInstanceFlag_Validation = 2 - * } - */ - public static int WGPUInstanceFlag_Validation() { - return WGPUInstanceFlag_Validation; - } - private static final int WGPUInstanceFlag_DiscardHalLabels = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUInstanceFlag.WGPUInstanceFlag_DiscardHalLabels = 4 - * } - */ - public static int WGPUInstanceFlag_DiscardHalLabels() { - return WGPUInstanceFlag_DiscardHalLabels; - } - private static final int WGPUInstanceFlag_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUInstanceFlag.WGPUInstanceFlag_Force32 = 2147483647 - * } - */ - public static int WGPUInstanceFlag_Force32() { - return WGPUInstanceFlag_Force32; - } - /** - * {@snippet lang=c : - * typedef WGPUFlags WGPUInstanceFlags - * } - */ - public static final OfInt WGPUInstanceFlags = WGPU.C_INT; - private static final int WGPUDx12Compiler_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUDx12Compiler.WGPUDx12Compiler_Undefined = 0 - * } - */ - public static int WGPUDx12Compiler_Undefined() { - return WGPUDx12Compiler_Undefined; - } - private static final int WGPUDx12Compiler_Fxc = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUDx12Compiler.WGPUDx12Compiler_Fxc = 1 - * } - */ - public static int WGPUDx12Compiler_Fxc() { - return WGPUDx12Compiler_Fxc; - } - private static final int WGPUDx12Compiler_Dxc = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUDx12Compiler.WGPUDx12Compiler_Dxc = 2 - * } - */ - public static int WGPUDx12Compiler_Dxc() { - return WGPUDx12Compiler_Dxc; - } - private static final int WGPUDx12Compiler_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUDx12Compiler.WGPUDx12Compiler_Force32 = 2147483647 - * } - */ - public static int WGPUDx12Compiler_Force32() { - return WGPUDx12Compiler_Force32; - } - private static final int WGPUGles3MinorVersion_Automatic = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUGles3MinorVersion.WGPUGles3MinorVersion_Automatic = 0 - * } - */ - public static int WGPUGles3MinorVersion_Automatic() { - return WGPUGles3MinorVersion_Automatic; - } - private static final int WGPUGles3MinorVersion_Version0 = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUGles3MinorVersion.WGPUGles3MinorVersion_Version0 = 1 - * } - */ - public static int WGPUGles3MinorVersion_Version0() { - return WGPUGles3MinorVersion_Version0; - } - private static final int WGPUGles3MinorVersion_Version1 = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUGles3MinorVersion.WGPUGles3MinorVersion_Version1 = 2 - * } - */ - public static int WGPUGles3MinorVersion_Version1() { - return WGPUGles3MinorVersion_Version1; - } - private static final int WGPUGles3MinorVersion_Version2 = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUGles3MinorVersion.WGPUGles3MinorVersion_Version2 = 3 - * } - */ - public static int WGPUGles3MinorVersion_Version2() { - return WGPUGles3MinorVersion_Version2; - } - private static final int WGPUGles3MinorVersion_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUGles3MinorVersion.WGPUGles3MinorVersion_Force32 = 2147483647 - * } - */ - public static int WGPUGles3MinorVersion_Force32() { - return WGPUGles3MinorVersion_Force32; - } - private static final int WGPUPipelineStatisticName_VertexShaderInvocations = (int)0L; - /** - * {@snippet lang=c : - * enum WGPUPipelineStatisticName.WGPUPipelineStatisticName_VertexShaderInvocations = 0 - * } - */ - public static int WGPUPipelineStatisticName_VertexShaderInvocations() { - return WGPUPipelineStatisticName_VertexShaderInvocations; - } - private static final int WGPUPipelineStatisticName_ClipperInvocations = (int)1L; - /** - * {@snippet lang=c : - * enum WGPUPipelineStatisticName.WGPUPipelineStatisticName_ClipperInvocations = 1 - * } - */ - public static int WGPUPipelineStatisticName_ClipperInvocations() { - return WGPUPipelineStatisticName_ClipperInvocations; - } - private static final int WGPUPipelineStatisticName_ClipperPrimitivesOut = (int)2L; - /** - * {@snippet lang=c : - * enum WGPUPipelineStatisticName.WGPUPipelineStatisticName_ClipperPrimitivesOut = 2 - * } - */ - public static int WGPUPipelineStatisticName_ClipperPrimitivesOut() { - return WGPUPipelineStatisticName_ClipperPrimitivesOut; - } - private static final int WGPUPipelineStatisticName_FragmentShaderInvocations = (int)3L; - /** - * {@snippet lang=c : - * enum WGPUPipelineStatisticName.WGPUPipelineStatisticName_FragmentShaderInvocations = 3 - * } - */ - public static int WGPUPipelineStatisticName_FragmentShaderInvocations() { - return WGPUPipelineStatisticName_FragmentShaderInvocations; - } - private static final int WGPUPipelineStatisticName_ComputeShaderInvocations = (int)4L; - /** - * {@snippet lang=c : - * enum WGPUPipelineStatisticName.WGPUPipelineStatisticName_ComputeShaderInvocations = 4 - * } - */ - public static int WGPUPipelineStatisticName_ComputeShaderInvocations() { - return WGPUPipelineStatisticName_ComputeShaderInvocations; - } - private static final int WGPUPipelineStatisticName_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUPipelineStatisticName.WGPUPipelineStatisticName_Force32 = 2147483647 - * } - */ - public static int WGPUPipelineStatisticName_Force32() { - return WGPUPipelineStatisticName_Force32; - } - private static final int WGPUNativeQueryType_PipelineStatistics = (int)196608L; - /** - * {@snippet lang=c : - * enum WGPUNativeQueryType.WGPUNativeQueryType_PipelineStatistics = 196608 - * } - */ - public static int WGPUNativeQueryType_PipelineStatistics() { - return WGPUNativeQueryType_PipelineStatistics; - } - private static final int WGPUNativeQueryType_Force32 = (int)2147483647L; - /** - * {@snippet lang=c : - * enum WGPUNativeQueryType.WGPUNativeQueryType_Force32 = 2147483647 - * } - */ - public static int WGPUNativeQueryType_Force32() { - return WGPUNativeQueryType_Force32; - } - /** - * {@snippet lang=c : - * typedef uint64_t WGPUSubmissionIndex - * } - */ - public static final OfLong WGPUSubmissionIndex = WGPU.C_LONG_LONG; - - private static class wgpuGenerateReport { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuGenerateReport"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport *report) - * } - */ - public static FunctionDescriptor wgpuGenerateReport$descriptor() { - return wgpuGenerateReport.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport *report) - * } - */ - public static MethodHandle wgpuGenerateReport$handle() { - return wgpuGenerateReport.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport *report) - * } - */ - public static MemorySegment wgpuGenerateReport$address() { - return wgpuGenerateReport.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport *report) - * } - */ - public static void wgpuGenerateReport(MemorySegment instance, MemorySegment report) { - var mh$ = wgpuGenerateReport.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuGenerateReport", instance, report); - } - mh$.invokeExact(instance, report); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuInstanceEnumerateAdapters { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuInstanceEnumerateAdapters"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, const WGPUInstanceEnumerateAdapterOptions *options, WGPUAdapter *adapters) - * } - */ - public static FunctionDescriptor wgpuInstanceEnumerateAdapters$descriptor() { - return wgpuInstanceEnumerateAdapters.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, const WGPUInstanceEnumerateAdapterOptions *options, WGPUAdapter *adapters) - * } - */ - public static MethodHandle wgpuInstanceEnumerateAdapters$handle() { - return wgpuInstanceEnumerateAdapters.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, const WGPUInstanceEnumerateAdapterOptions *options, WGPUAdapter *adapters) - * } - */ - public static MemorySegment wgpuInstanceEnumerateAdapters$address() { - return wgpuInstanceEnumerateAdapters.ADDR; - } - - /** - * {@snippet lang=c : - * size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, const WGPUInstanceEnumerateAdapterOptions *options, WGPUAdapter *adapters) - * } - */ - public static long wgpuInstanceEnumerateAdapters(MemorySegment instance, MemorySegment options, MemorySegment adapters) { - var mh$ = wgpuInstanceEnumerateAdapters.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuInstanceEnumerateAdapters", instance, options, adapters); - } - return (long)mh$.invokeExact(instance, options, adapters); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuQueueSubmitForIndex { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuQueueSubmitForIndex"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static FunctionDescriptor wgpuQueueSubmitForIndex$descriptor() { - return wgpuQueueSubmitForIndex.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static MethodHandle wgpuQueueSubmitForIndex$handle() { - return wgpuQueueSubmitForIndex.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static MemorySegment wgpuQueueSubmitForIndex$address() { - return wgpuQueueSubmitForIndex.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer *commands) - * } - */ - public static long wgpuQueueSubmitForIndex(MemorySegment queue, long commandCount, MemorySegment commands) { - var mh$ = wgpuQueueSubmitForIndex.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuQueueSubmitForIndex", queue, commandCount, commands); - } - return (long)mh$.invokeExact(queue, commandCount, commands); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuDevicePoll { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuDevicePoll"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, const WGPUWrappedSubmissionIndex *wrappedSubmissionIndex) - * } - */ - public static FunctionDescriptor wgpuDevicePoll$descriptor() { - return wgpuDevicePoll.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, const WGPUWrappedSubmissionIndex *wrappedSubmissionIndex) - * } - */ - public static MethodHandle wgpuDevicePoll$handle() { - return wgpuDevicePoll.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, const WGPUWrappedSubmissionIndex *wrappedSubmissionIndex) - * } - */ - public static MemorySegment wgpuDevicePoll$address() { - return wgpuDevicePoll.ADDR; - } - - /** - * {@snippet lang=c : - * WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, const WGPUWrappedSubmissionIndex *wrappedSubmissionIndex) - * } - */ - public static int wgpuDevicePoll(MemorySegment device, int wait, MemorySegment wrappedSubmissionIndex) { - var mh$ = wgpuDevicePoll.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuDevicePoll", device, wait, wrappedSubmissionIndex); - } - return (int)mh$.invokeExact(device, wait, wrappedSubmissionIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSetLogCallback { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSetLogCallback"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSetLogCallback(WGPULogCallback callback, void *userdata) - * } - */ - public static FunctionDescriptor wgpuSetLogCallback$descriptor() { - return wgpuSetLogCallback.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSetLogCallback(WGPULogCallback callback, void *userdata) - * } - */ - public static MethodHandle wgpuSetLogCallback$handle() { - return wgpuSetLogCallback.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSetLogCallback(WGPULogCallback callback, void *userdata) - * } - */ - public static MemorySegment wgpuSetLogCallback$address() { - return wgpuSetLogCallback.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSetLogCallback(WGPULogCallback callback, void *userdata) - * } - */ - public static void wgpuSetLogCallback(MemorySegment callback, MemorySegment userdata) { - var mh$ = wgpuSetLogCallback.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSetLogCallback", callback, userdata); - } - mh$.invokeExact(callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuSetLogLevel { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuSetLogLevel"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuSetLogLevel(WGPULogLevel level) - * } - */ - public static FunctionDescriptor wgpuSetLogLevel$descriptor() { - return wgpuSetLogLevel.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuSetLogLevel(WGPULogLevel level) - * } - */ - public static MethodHandle wgpuSetLogLevel$handle() { - return wgpuSetLogLevel.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuSetLogLevel(WGPULogLevel level) - * } - */ - public static MemorySegment wgpuSetLogLevel$address() { - return wgpuSetLogLevel.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuSetLogLevel(WGPULogLevel level) - * } - */ - public static void wgpuSetLogLevel(int level) { - var mh$ = wgpuSetLogLevel.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuSetLogLevel", level); - } - mh$.invokeExact(level); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuGetVersion { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - WGPU.C_INT ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuGetVersion"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint32_t wgpuGetVersion() - * } - */ - public static FunctionDescriptor wgpuGetVersion$descriptor() { - return wgpuGetVersion.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint32_t wgpuGetVersion() - * } - */ - public static MethodHandle wgpuGetVersion$handle() { - return wgpuGetVersion.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint32_t wgpuGetVersion() - * } - */ - public static MemorySegment wgpuGetVersion$address() { - return wgpuGetVersion.ADDR; - } - - /** - * {@snippet lang=c : - * uint32_t wgpuGetVersion() - * } - */ - public static int wgpuGetVersion() { - var mh$ = wgpuGetVersion.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuGetVersion"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderSetPushConstants { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderSetPushConstants"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, const void *data) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderSetPushConstants$descriptor() { - return wgpuRenderPassEncoderSetPushConstants.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, const void *data) - * } - */ - public static MethodHandle wgpuRenderPassEncoderSetPushConstants$handle() { - return wgpuRenderPassEncoderSetPushConstants.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, const void *data) - * } - */ - public static MemorySegment wgpuRenderPassEncoderSetPushConstants$address() { - return wgpuRenderPassEncoderSetPushConstants.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, const void *data) - * } - */ - public static void wgpuRenderPassEncoderSetPushConstants(MemorySegment encoder, int stages, int offset, int sizeBytes, MemorySegment data) { - var mh$ = wgpuRenderPassEncoderSetPushConstants.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderSetPushConstants", encoder, stages, offset, sizeBytes, data); - } - mh$.invokeExact(encoder, stages, offset, sizeBytes, data); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderMultiDrawIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderMultiDrawIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderMultiDrawIndirect$descriptor() { - return wgpuRenderPassEncoderMultiDrawIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static MethodHandle wgpuRenderPassEncoderMultiDrawIndirect$handle() { - return wgpuRenderPassEncoderMultiDrawIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static MemorySegment wgpuRenderPassEncoderMultiDrawIndirect$address() { - return wgpuRenderPassEncoderMultiDrawIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static void wgpuRenderPassEncoderMultiDrawIndirect(MemorySegment encoder, MemorySegment buffer, long offset, int count) { - var mh$ = wgpuRenderPassEncoderMultiDrawIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderMultiDrawIndirect", encoder, buffer, offset, count); - } - mh$.invokeExact(encoder, buffer, offset, count); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderMultiDrawIndexedIndirect { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderMultiDrawIndexedIndirect"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderMultiDrawIndexedIndirect$descriptor() { - return wgpuRenderPassEncoderMultiDrawIndexedIndirect.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static MethodHandle wgpuRenderPassEncoderMultiDrawIndexedIndirect$handle() { - return wgpuRenderPassEncoderMultiDrawIndexedIndirect.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static MemorySegment wgpuRenderPassEncoderMultiDrawIndexedIndirect$address() { - return wgpuRenderPassEncoderMultiDrawIndexedIndirect.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count) - * } - */ - public static void wgpuRenderPassEncoderMultiDrawIndexedIndirect(MemorySegment encoder, MemorySegment buffer, long offset, int count) { - var mh$ = wgpuRenderPassEncoderMultiDrawIndexedIndirect.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderMultiDrawIndexedIndirect", encoder, buffer, offset, count); - } - mh$.invokeExact(encoder, buffer, offset, count); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderMultiDrawIndirectCount { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderMultiDrawIndirectCount"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderMultiDrawIndirectCount$descriptor() { - return wgpuRenderPassEncoderMultiDrawIndirectCount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static MethodHandle wgpuRenderPassEncoderMultiDrawIndirectCount$handle() { - return wgpuRenderPassEncoderMultiDrawIndirectCount.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static MemorySegment wgpuRenderPassEncoderMultiDrawIndirectCount$address() { - return wgpuRenderPassEncoderMultiDrawIndirectCount.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static void wgpuRenderPassEncoderMultiDrawIndirectCount(MemorySegment encoder, MemorySegment buffer, long offset, MemorySegment count_buffer, long count_buffer_offset, int max_count) { - var mh$ = wgpuRenderPassEncoderMultiDrawIndirectCount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderMultiDrawIndirectCount", encoder, buffer, offset, count_buffer, count_buffer_offset, max_count); - } - mh$.invokeExact(encoder, buffer, offset, count_buffer, count_buffer_offset, max_count); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderMultiDrawIndexedIndirectCount { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderMultiDrawIndexedIndirectCount"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderMultiDrawIndexedIndirectCount$descriptor() { - return wgpuRenderPassEncoderMultiDrawIndexedIndirectCount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static MethodHandle wgpuRenderPassEncoderMultiDrawIndexedIndirectCount$handle() { - return wgpuRenderPassEncoderMultiDrawIndexedIndirectCount.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static MemorySegment wgpuRenderPassEncoderMultiDrawIndexedIndirectCount$address() { - return wgpuRenderPassEncoderMultiDrawIndexedIndirectCount.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderMultiDrawIndexedIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count) - * } - */ - public static void wgpuRenderPassEncoderMultiDrawIndexedIndirectCount(MemorySegment encoder, MemorySegment buffer, long offset, MemorySegment count_buffer, long count_buffer_offset, int max_count) { - var mh$ = wgpuRenderPassEncoderMultiDrawIndexedIndirectCount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderMultiDrawIndexedIndirectCount", encoder, buffer, offset, count_buffer, count_buffer_offset, max_count); - } - mh$.invokeExact(encoder, buffer, offset, count_buffer, count_buffer_offset, max_count); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderBeginPipelineStatisticsQuery { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderBeginPipelineStatisticsQuery"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderBeginPipelineStatisticsQuery$descriptor() { - return wgpuComputePassEncoderBeginPipelineStatisticsQuery.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static MethodHandle wgpuComputePassEncoderBeginPipelineStatisticsQuery$handle() { - return wgpuComputePassEncoderBeginPipelineStatisticsQuery.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static MemorySegment wgpuComputePassEncoderBeginPipelineStatisticsQuery$address() { - return wgpuComputePassEncoderBeginPipelineStatisticsQuery.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static void wgpuComputePassEncoderBeginPipelineStatisticsQuery(MemorySegment computePassEncoder, MemorySegment querySet, int queryIndex) { - var mh$ = wgpuComputePassEncoderBeginPipelineStatisticsQuery.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderBeginPipelineStatisticsQuery", computePassEncoder, querySet, queryIndex); - } - mh$.invokeExact(computePassEncoder, querySet, queryIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuComputePassEncoderEndPipelineStatisticsQuery { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuComputePassEncoderEndPipelineStatisticsQuery"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuComputePassEncoderEndPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static FunctionDescriptor wgpuComputePassEncoderEndPipelineStatisticsQuery$descriptor() { - return wgpuComputePassEncoderEndPipelineStatisticsQuery.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuComputePassEncoderEndPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MethodHandle wgpuComputePassEncoderEndPipelineStatisticsQuery$handle() { - return wgpuComputePassEncoderEndPipelineStatisticsQuery.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuComputePassEncoderEndPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static MemorySegment wgpuComputePassEncoderEndPipelineStatisticsQuery$address() { - return wgpuComputePassEncoderEndPipelineStatisticsQuery.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuComputePassEncoderEndPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder) - * } - */ - public static void wgpuComputePassEncoderEndPipelineStatisticsQuery(MemorySegment computePassEncoder) { - var mh$ = wgpuComputePassEncoderEndPipelineStatisticsQuery.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuComputePassEncoderEndPipelineStatisticsQuery", computePassEncoder); - } - mh$.invokeExact(computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderBeginPipelineStatisticsQuery { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderBeginPipelineStatisticsQuery"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderBeginPipelineStatisticsQuery$descriptor() { - return wgpuRenderPassEncoderBeginPipelineStatisticsQuery.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static MethodHandle wgpuRenderPassEncoderBeginPipelineStatisticsQuery$handle() { - return wgpuRenderPassEncoderBeginPipelineStatisticsQuery.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static MemorySegment wgpuRenderPassEncoderBeginPipelineStatisticsQuery$address() { - return wgpuRenderPassEncoderBeginPipelineStatisticsQuery.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) - * } - */ - public static void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(MemorySegment renderPassEncoder, MemorySegment querySet, int queryIndex) { - var mh$ = wgpuRenderPassEncoderBeginPipelineStatisticsQuery.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderBeginPipelineStatisticsQuery", renderPassEncoder, querySet, queryIndex); - } - mh$.invokeExact(renderPassEncoder, querySet, queryIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class wgpuRenderPassEncoderEndPipelineStatisticsQuery { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - public static final MemorySegment ADDR = WGPU.findOrThrow("wgpuRenderPassEncoderEndPipelineStatisticsQuery"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static FunctionDescriptor wgpuRenderPassEncoderEndPipelineStatisticsQuery$descriptor() { - return wgpuRenderPassEncoderEndPipelineStatisticsQuery.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MethodHandle wgpuRenderPassEncoderEndPipelineStatisticsQuery$handle() { - return wgpuRenderPassEncoderEndPipelineStatisticsQuery.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static MemorySegment wgpuRenderPassEncoderEndPipelineStatisticsQuery$address() { - return wgpuRenderPassEncoderEndPipelineStatisticsQuery.ADDR; - } - - /** - * {@snippet lang=c : - * void wgpuRenderPassEncoderEndPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder) - * } - */ - public static void wgpuRenderPassEncoderEndPipelineStatisticsQuery(MemorySegment renderPassEncoder) { - var mh$ = wgpuRenderPassEncoderEndPipelineStatisticsQuery.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("wgpuRenderPassEncoderEndPipelineStatisticsQuery", renderPassEncoder); - } - mh$.invokeExact(renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int _VCRUNTIME_DISABLED_WARNINGS = (int)4514L; - /** - * {@snippet lang=c : - * #define _VCRUNTIME_DISABLED_WARNINGS 4514 - * } - */ - public static int _VCRUNTIME_DISABLED_WARNINGS() { - return _VCRUNTIME_DISABLED_WARNINGS; - } - private static final MemorySegment NULL = MemorySegment.ofAddress(0L); - /** - * {@snippet lang=c : - * #define NULL (void*) 0 - * } - */ - public static MemorySegment NULL() { - return NULL; - } - private static final int INT8_MIN = (int)-128L; - /** - * {@snippet lang=c : - * #define INT8_MIN -128 - * } - */ - public static int INT8_MIN() { - return INT8_MIN; - } - private static final int INT16_MIN = (int)-32768L; - /** - * {@snippet lang=c : - * #define INT16_MIN -32768 - * } - */ - public static int INT16_MIN() { - return INT16_MIN; - } - private static final int INT32_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT32_MIN -2147483648 - * } - */ - public static int INT32_MIN() { - return INT32_MIN; - } - private static final long INT64_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INT64_MIN -9223372036854775808 - * } - */ - public static long INT64_MIN() { - return INT64_MIN; - } - private static final byte INT8_MAX = (byte)127L; - /** - * {@snippet lang=c : - * #define INT8_MAX 127 - * } - */ - public static byte INT8_MAX() { - return INT8_MAX; - } - private static final short INT16_MAX = (short)32767L; - /** - * {@snippet lang=c : - * #define INT16_MAX 32767 - * } - */ - public static short INT16_MAX() { - return INT16_MAX; - } - private static final int INT32_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT32_MAX 2147483647 - * } - */ - public static int INT32_MAX() { - return INT32_MAX; - } - private static final long INT64_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INT64_MAX 9223372036854775807 - * } - */ - public static long INT64_MAX() { - return INT64_MAX; - } - private static final byte UINT8_MAX = (byte)255L; - /** - * {@snippet lang=c : - * #define UINT8_MAX 255 - * } - */ - public static byte UINT8_MAX() { - return UINT8_MAX; - } - private static final short UINT16_MAX = (short)65535L; - /** - * {@snippet lang=c : - * #define UINT16_MAX 65535 - * } - */ - public static short UINT16_MAX() { - return UINT16_MAX; - } - private static final int UINT32_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT32_MAX 4294967295 - * } - */ - public static int UINT32_MAX() { - return UINT32_MAX; - } - private static final long UINT64_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINT64_MAX -1 - * } - */ - public static long UINT64_MAX() { - return UINT64_MAX; - } - private static final int INT_LEAST8_MIN = (int)-128L; - /** - * {@snippet lang=c : - * #define INT_LEAST8_MIN -128 - * } - */ - public static int INT_LEAST8_MIN() { - return INT_LEAST8_MIN; - } - private static final int INT_LEAST16_MIN = (int)-32768L; - /** - * {@snippet lang=c : - * #define INT_LEAST16_MIN -32768 - * } - */ - public static int INT_LEAST16_MIN() { - return INT_LEAST16_MIN; - } - private static final int INT_LEAST32_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT_LEAST32_MIN -2147483648 - * } - */ - public static int INT_LEAST32_MIN() { - return INT_LEAST32_MIN; - } - private static final long INT_LEAST64_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INT_LEAST64_MIN -9223372036854775808 - * } - */ - public static long INT_LEAST64_MIN() { - return INT_LEAST64_MIN; - } - private static final byte INT_LEAST8_MAX = (byte)127L; - /** - * {@snippet lang=c : - * #define INT_LEAST8_MAX 127 - * } - */ - public static byte INT_LEAST8_MAX() { - return INT_LEAST8_MAX; - } - private static final short INT_LEAST16_MAX = (short)32767L; - /** - * {@snippet lang=c : - * #define INT_LEAST16_MAX 32767 - * } - */ - public static short INT_LEAST16_MAX() { - return INT_LEAST16_MAX; - } - private static final int INT_LEAST32_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT_LEAST32_MAX 2147483647 - * } - */ - public static int INT_LEAST32_MAX() { - return INT_LEAST32_MAX; - } - private static final long INT_LEAST64_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INT_LEAST64_MAX 9223372036854775807 - * } - */ - public static long INT_LEAST64_MAX() { - return INT_LEAST64_MAX; - } - private static final byte UINT_LEAST8_MAX = (byte)255L; - /** - * {@snippet lang=c : - * #define UINT_LEAST8_MAX 255 - * } - */ - public static byte UINT_LEAST8_MAX() { - return UINT_LEAST8_MAX; - } - private static final short UINT_LEAST16_MAX = (short)65535L; - /** - * {@snippet lang=c : - * #define UINT_LEAST16_MAX 65535 - * } - */ - public static short UINT_LEAST16_MAX() { - return UINT_LEAST16_MAX; - } - private static final int UINT_LEAST32_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT_LEAST32_MAX 4294967295 - * } - */ - public static int UINT_LEAST32_MAX() { - return UINT_LEAST32_MAX; - } - private static final long UINT_LEAST64_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINT_LEAST64_MAX -1 - * } - */ - public static long UINT_LEAST64_MAX() { - return UINT_LEAST64_MAX; - } - private static final int INT_FAST8_MIN = (int)-128L; - /** - * {@snippet lang=c : - * #define INT_FAST8_MIN -128 - * } - */ - public static int INT_FAST8_MIN() { - return INT_FAST8_MIN; - } - private static final int INT_FAST16_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT_FAST16_MIN -2147483648 - * } - */ - public static int INT_FAST16_MIN() { - return INT_FAST16_MIN; - } - private static final int INT_FAST32_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT_FAST32_MIN -2147483648 - * } - */ - public static int INT_FAST32_MIN() { - return INT_FAST32_MIN; - } - private static final long INT_FAST64_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INT_FAST64_MIN -9223372036854775808 - * } - */ - public static long INT_FAST64_MIN() { - return INT_FAST64_MIN; - } - private static final byte INT_FAST8_MAX = (byte)127L; - /** - * {@snippet lang=c : - * #define INT_FAST8_MAX 127 - * } - */ - public static byte INT_FAST8_MAX() { - return INT_FAST8_MAX; - } - private static final int INT_FAST16_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT_FAST16_MAX 2147483647 - * } - */ - public static int INT_FAST16_MAX() { - return INT_FAST16_MAX; - } - private static final int INT_FAST32_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT_FAST32_MAX 2147483647 - * } - */ - public static int INT_FAST32_MAX() { - return INT_FAST32_MAX; - } - private static final long INT_FAST64_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INT_FAST64_MAX 9223372036854775807 - * } - */ - public static long INT_FAST64_MAX() { - return INT_FAST64_MAX; - } - private static final byte UINT_FAST8_MAX = (byte)255L; - /** - * {@snippet lang=c : - * #define UINT_FAST8_MAX 255 - * } - */ - public static byte UINT_FAST8_MAX() { - return UINT_FAST8_MAX; - } - private static final int UINT_FAST16_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT_FAST16_MAX 4294967295 - * } - */ - public static int UINT_FAST16_MAX() { - return UINT_FAST16_MAX; - } - private static final int UINT_FAST32_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT_FAST32_MAX 4294967295 - * } - */ - public static int UINT_FAST32_MAX() { - return UINT_FAST32_MAX; - } - private static final long UINT_FAST64_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINT_FAST64_MAX -1 - * } - */ - public static long UINT_FAST64_MAX() { - return UINT_FAST64_MAX; - } - private static final long INTPTR_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INTPTR_MIN -9223372036854775808 - * } - */ - public static long INTPTR_MIN() { - return INTPTR_MIN; - } - private static final long INTPTR_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INTPTR_MAX 9223372036854775807 - * } - */ - public static long INTPTR_MAX() { - return INTPTR_MAX; - } - private static final long UINTPTR_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINTPTR_MAX -1 - * } - */ - public static long UINTPTR_MAX() { - return UINTPTR_MAX; - } - private static final long INTMAX_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INTMAX_MIN -9223372036854775808 - * } - */ - public static long INTMAX_MIN() { - return INTMAX_MIN; - } - private static final long INTMAX_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INTMAX_MAX 9223372036854775807 - * } - */ - public static long INTMAX_MAX() { - return INTMAX_MAX; - } - private static final long UINTMAX_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINTMAX_MAX -1 - * } - */ - public static long UINTMAX_MAX() { - return UINTMAX_MAX; - } - private static final long PTRDIFF_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define PTRDIFF_MIN -9223372036854775808 - * } - */ - public static long PTRDIFF_MIN() { - return PTRDIFF_MIN; - } - private static final long PTRDIFF_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define PTRDIFF_MAX 9223372036854775807 - * } - */ - public static long PTRDIFF_MAX() { - return PTRDIFF_MAX; - } - private static final long SIZE_MAX = -1L; - /** - * {@snippet lang=c : - * #define SIZE_MAX -1 - * } - */ - public static long SIZE_MAX() { - return SIZE_MAX; - } - private static final int SIG_ATOMIC_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define SIG_ATOMIC_MIN -2147483648 - * } - */ - public static int SIG_ATOMIC_MIN() { - return SIG_ATOMIC_MIN; - } - private static final int SIG_ATOMIC_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define SIG_ATOMIC_MAX 2147483647 - * } - */ - public static int SIG_ATOMIC_MAX() { - return SIG_ATOMIC_MAX; - } - private static final int WGPU_ARRAY_LAYER_COUNT_UNDEFINED = (int)4294967295L; - /** - * {@snippet lang=c : - * #define WGPU_ARRAY_LAYER_COUNT_UNDEFINED 4294967295 - * } - */ - public static int WGPU_ARRAY_LAYER_COUNT_UNDEFINED() { - return WGPU_ARRAY_LAYER_COUNT_UNDEFINED; - } - private static final int WGPU_COPY_STRIDE_UNDEFINED = (int)4294967295L; - /** - * {@snippet lang=c : - * #define WGPU_COPY_STRIDE_UNDEFINED 4294967295 - * } - */ - public static int WGPU_COPY_STRIDE_UNDEFINED() { - return WGPU_COPY_STRIDE_UNDEFINED; - } - private static final int WGPU_LIMIT_U32_UNDEFINED = (int)4294967295L; - /** - * {@snippet lang=c : - * #define WGPU_LIMIT_U32_UNDEFINED 4294967295 - * } - */ - public static int WGPU_LIMIT_U32_UNDEFINED() { - return WGPU_LIMIT_U32_UNDEFINED; - } - private static final long WGPU_LIMIT_U64_UNDEFINED = -1L; - /** - * {@snippet lang=c : - * #define WGPU_LIMIT_U64_UNDEFINED -1 - * } - */ - public static long WGPU_LIMIT_U64_UNDEFINED() { - return WGPU_LIMIT_U64_UNDEFINED; - } - private static final int WGPU_MIP_LEVEL_COUNT_UNDEFINED = (int)4294967295L; - /** - * {@snippet lang=c : - * #define WGPU_MIP_LEVEL_COUNT_UNDEFINED 4294967295 - * } - */ - public static int WGPU_MIP_LEVEL_COUNT_UNDEFINED() { - return WGPU_MIP_LEVEL_COUNT_UNDEFINED; - } - private static final int WGPU_QUERY_SET_INDEX_UNDEFINED = (int)4294967295L; - /** - * {@snippet lang=c : - * #define WGPU_QUERY_SET_INDEX_UNDEFINED 4294967295 - * } - */ - public static int WGPU_QUERY_SET_INDEX_UNDEFINED() { - return WGPU_QUERY_SET_INDEX_UNDEFINED; - } - private static final long WGPU_WHOLE_MAP_SIZE = -1L; - /** - * {@snippet lang=c : - * #define WGPU_WHOLE_MAP_SIZE -1 - * } - */ - public static long WGPU_WHOLE_MAP_SIZE() { - return WGPU_WHOLE_MAP_SIZE; - } - private static final long WGPU_WHOLE_SIZE = -1L; - /** - * {@snippet lang=c : - * #define WGPU_WHOLE_SIZE -1 - * } - */ - public static long WGPU_WHOLE_SIZE() { - return WGPU_WHOLE_SIZE; - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUAdapterProperties.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUAdapterProperties.java deleted file mode 100644 index 1926e21fe..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUAdapterProperties.java +++ /dev/null @@ -1,497 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUAdapterProperties { - * WGPUChainedStructOut *nextInChain; - * uint32_t vendorID; - * const char *vendorName; - * const char *architecture; - * uint32_t deviceID; - * const char *name; - * const char *driverDescription; - * WGPUAdapterType adapterType; - * WGPUBackendType backendType; - * } - * } - */ -public class WGPUAdapterProperties { - - WGPUAdapterProperties() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("vendorID"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("vendorName"), - WGPU.C_POINTER.withName("architecture"), - WGPU.C_INT.withName("deviceID"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("name"), - WGPU.C_POINTER.withName("driverDescription"), - WGPU.C_INT.withName("adapterType"), - WGPU.C_INT.withName("backendType") - ).withName("WGPUAdapterProperties"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt vendorID$LAYOUT = (OfInt)$LAYOUT.select(groupElement("vendorID")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t vendorID - * } - */ - public static final OfInt vendorID$layout() { - return vendorID$LAYOUT; - } - - private static final long vendorID$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t vendorID - * } - */ - public static final long vendorID$offset() { - return vendorID$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t vendorID - * } - */ - public static int vendorID(MemorySegment struct) { - return struct.get(vendorID$LAYOUT, vendorID$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t vendorID - * } - */ - public static void vendorID(MemorySegment struct, int fieldValue) { - struct.set(vendorID$LAYOUT, vendorID$OFFSET, fieldValue); - } - - private static final AddressLayout vendorName$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("vendorName")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *vendorName - * } - */ - public static final AddressLayout vendorName$layout() { - return vendorName$LAYOUT; - } - - private static final long vendorName$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *vendorName - * } - */ - public static final long vendorName$offset() { - return vendorName$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *vendorName - * } - */ - public static MemorySegment vendorName(MemorySegment struct) { - return struct.get(vendorName$LAYOUT, vendorName$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *vendorName - * } - */ - public static void vendorName(MemorySegment struct, MemorySegment fieldValue) { - struct.set(vendorName$LAYOUT, vendorName$OFFSET, fieldValue); - } - - private static final AddressLayout architecture$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("architecture")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *architecture - * } - */ - public static final AddressLayout architecture$layout() { - return architecture$LAYOUT; - } - - private static final long architecture$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *architecture - * } - */ - public static final long architecture$offset() { - return architecture$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *architecture - * } - */ - public static MemorySegment architecture(MemorySegment struct) { - return struct.get(architecture$LAYOUT, architecture$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *architecture - * } - */ - public static void architecture(MemorySegment struct, MemorySegment fieldValue) { - struct.set(architecture$LAYOUT, architecture$OFFSET, fieldValue); - } - - private static final OfInt deviceID$LAYOUT = (OfInt)$LAYOUT.select(groupElement("deviceID")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t deviceID - * } - */ - public static final OfInt deviceID$layout() { - return deviceID$LAYOUT; - } - - private static final long deviceID$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t deviceID - * } - */ - public static final long deviceID$offset() { - return deviceID$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t deviceID - * } - */ - public static int deviceID(MemorySegment struct) { - return struct.get(deviceID$LAYOUT, deviceID$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t deviceID - * } - */ - public static void deviceID(MemorySegment struct, int fieldValue) { - struct.set(deviceID$LAYOUT, deviceID$OFFSET, fieldValue); - } - - private static final AddressLayout name$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("name")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static final AddressLayout name$layout() { - return name$LAYOUT; - } - - private static final long name$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static final long name$offset() { - return name$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static MemorySegment name(MemorySegment struct) { - return struct.get(name$LAYOUT, name$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static void name(MemorySegment struct, MemorySegment fieldValue) { - struct.set(name$LAYOUT, name$OFFSET, fieldValue); - } - - private static final AddressLayout driverDescription$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("driverDescription")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *driverDescription - * } - */ - public static final AddressLayout driverDescription$layout() { - return driverDescription$LAYOUT; - } - - private static final long driverDescription$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *driverDescription - * } - */ - public static final long driverDescription$offset() { - return driverDescription$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *driverDescription - * } - */ - public static MemorySegment driverDescription(MemorySegment struct) { - return struct.get(driverDescription$LAYOUT, driverDescription$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *driverDescription - * } - */ - public static void driverDescription(MemorySegment struct, MemorySegment fieldValue) { - struct.set(driverDescription$LAYOUT, driverDescription$OFFSET, fieldValue); - } - - private static final OfInt adapterType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("adapterType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUAdapterType adapterType - * } - */ - public static final OfInt adapterType$layout() { - return adapterType$LAYOUT; - } - - private static final long adapterType$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUAdapterType adapterType - * } - */ - public static final long adapterType$offset() { - return adapterType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUAdapterType adapterType - * } - */ - public static int adapterType(MemorySegment struct) { - return struct.get(adapterType$LAYOUT, adapterType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUAdapterType adapterType - * } - */ - public static void adapterType(MemorySegment struct, int fieldValue) { - struct.set(adapterType$LAYOUT, adapterType$OFFSET, fieldValue); - } - - private static final OfInt backendType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("backendType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static final OfInt backendType$layout() { - return backendType$LAYOUT; - } - - private static final long backendType$OFFSET = 60; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static final long backendType$offset() { - return backendType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static int backendType(MemorySegment struct) { - return struct.get(backendType$LAYOUT, backendType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static void backendType(MemorySegment struct, int fieldValue) { - struct.set(backendType$LAYOUT, backendType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupDescriptor.java deleted file mode 100644 index d3cc4a718..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupDescriptor.java +++ /dev/null @@ -1,311 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBindGroupDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUBindGroupLayout layout; - * size_t entryCount; - * const WGPUBindGroupEntry *entries; - * } - * } - */ -public class WGPUBindGroupDescriptor { - - WGPUBindGroupDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_POINTER.withName("layout"), - WGPU.C_LONG_LONG.withName("entryCount"), - WGPU.C_POINTER.withName("entries") - ).withName("WGPUBindGroupDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final AddressLayout layout$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("layout")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBindGroupLayout layout - * } - */ - public static final AddressLayout layout$layout() { - return layout$LAYOUT; - } - - private static final long layout$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBindGroupLayout layout - * } - */ - public static final long layout$offset() { - return layout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBindGroupLayout layout - * } - */ - public static MemorySegment layout(MemorySegment struct) { - return struct.get(layout$LAYOUT, layout$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBindGroupLayout layout - * } - */ - public static void layout(MemorySegment struct, MemorySegment fieldValue) { - struct.set(layout$LAYOUT, layout$OFFSET, fieldValue); - } - - private static final OfLong entryCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("entryCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static final OfLong entryCount$layout() { - return entryCount$LAYOUT; - } - - private static final long entryCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static final long entryCount$offset() { - return entryCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static long entryCount(MemorySegment struct) { - return struct.get(entryCount$LAYOUT, entryCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static void entryCount(MemorySegment struct, long fieldValue) { - struct.set(entryCount$LAYOUT, entryCount$OFFSET, fieldValue); - } - - private static final AddressLayout entries$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("entries")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUBindGroupEntry *entries - * } - */ - public static final AddressLayout entries$layout() { - return entries$LAYOUT; - } - - private static final long entries$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUBindGroupEntry *entries - * } - */ - public static final long entries$offset() { - return entries$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUBindGroupEntry *entries - * } - */ - public static MemorySegment entries(MemorySegment struct) { - return struct.get(entries$LAYOUT, entries$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUBindGroupEntry *entries - * } - */ - public static void entries(MemorySegment struct, MemorySegment fieldValue) { - struct.set(entries$LAYOUT, entries$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupEntry.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupEntry.java deleted file mode 100644 index 463dbbf85..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupEntry.java +++ /dev/null @@ -1,404 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBindGroupEntry { - * const WGPUChainedStruct *nextInChain; - * uint32_t binding; - * WGPUBuffer buffer; - * uint64_t offset; - * uint64_t size; - * WGPUSampler sampler; - * WGPUTextureView textureView; - * } - * } - */ -public class WGPUBindGroupEntry { - - WGPUBindGroupEntry() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("binding"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("buffer"), - WGPU.C_LONG_LONG.withName("offset"), - WGPU.C_LONG_LONG.withName("size"), - WGPU.C_POINTER.withName("sampler"), - WGPU.C_POINTER.withName("textureView") - ).withName("WGPUBindGroupEntry"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt binding$LAYOUT = (OfInt)$LAYOUT.select(groupElement("binding")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static final OfInt binding$layout() { - return binding$LAYOUT; - } - - private static final long binding$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static final long binding$offset() { - return binding$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static int binding(MemorySegment struct) { - return struct.get(binding$LAYOUT, binding$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static void binding(MemorySegment struct, int fieldValue) { - struct.set(binding$LAYOUT, binding$OFFSET, fieldValue); - } - - private static final AddressLayout buffer$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("buffer")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static final AddressLayout buffer$layout() { - return buffer$LAYOUT; - } - - private static final long buffer$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static final long buffer$offset() { - return buffer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static MemorySegment buffer(MemorySegment struct) { - return struct.get(buffer$LAYOUT, buffer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static void buffer(MemorySegment struct, MemorySegment fieldValue) { - struct.set(buffer$LAYOUT, buffer$OFFSET, fieldValue); - } - - private static final OfLong offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("offset")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final OfLong offset$layout() { - return offset$LAYOUT; - } - - private static final long offset$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final long offset$offset() { - return offset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static long offset(MemorySegment struct) { - return struct.get(offset$LAYOUT, offset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static void offset(MemorySegment struct, long fieldValue) { - struct.set(offset$LAYOUT, offset$OFFSET, fieldValue); - } - - private static final OfLong size$LAYOUT = (OfLong)$LAYOUT.select(groupElement("size")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static final OfLong size$layout() { - return size$LAYOUT; - } - - private static final long size$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static final long size$offset() { - return size$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static long size(MemorySegment struct) { - return struct.get(size$LAYOUT, size$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static void size(MemorySegment struct, long fieldValue) { - struct.set(size$LAYOUT, size$OFFSET, fieldValue); - } - - private static final AddressLayout sampler$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("sampler")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSampler sampler - * } - */ - public static final AddressLayout sampler$layout() { - return sampler$LAYOUT; - } - - private static final long sampler$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSampler sampler - * } - */ - public static final long sampler$offset() { - return sampler$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSampler sampler - * } - */ - public static MemorySegment sampler(MemorySegment struct) { - return struct.get(sampler$LAYOUT, sampler$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSampler sampler - * } - */ - public static void sampler(MemorySegment struct, MemorySegment fieldValue) { - struct.set(sampler$LAYOUT, sampler$OFFSET, fieldValue); - } - - private static final AddressLayout textureView$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("textureView")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureView textureView - * } - */ - public static final AddressLayout textureView$layout() { - return textureView$LAYOUT; - } - - private static final long textureView$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureView textureView - * } - */ - public static final long textureView$offset() { - return textureView$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureView textureView - * } - */ - public static MemorySegment textureView(MemorySegment struct) { - return struct.get(textureView$LAYOUT, textureView$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureView textureView - * } - */ - public static void textureView(MemorySegment struct, MemorySegment fieldValue) { - struct.set(textureView$LAYOUT, textureView$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupEntryExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupEntryExtras.java deleted file mode 100644 index 55567b375..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupEntryExtras.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBindGroupEntryExtras { - * WGPUChainedStruct chain; - * const WGPUBuffer *buffers; - * size_t bufferCount; - * const WGPUSampler *samplers; - * size_t samplerCount; - * const WGPUTextureView *textureViews; - * size_t textureViewCount; - * } - * } - */ -public class WGPUBindGroupEntryExtras { - - WGPUBindGroupEntryExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("buffers"), - WGPU.C_LONG_LONG.withName("bufferCount"), - WGPU.C_POINTER.withName("samplers"), - WGPU.C_LONG_LONG.withName("samplerCount"), - WGPU.C_POINTER.withName("textureViews"), - WGPU.C_LONG_LONG.withName("textureViewCount") - ).withName("WGPUBindGroupEntryExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout buffers$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("buffers")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUBuffer *buffers - * } - */ - public static final AddressLayout buffers$layout() { - return buffers$LAYOUT; - } - - private static final long buffers$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUBuffer *buffers - * } - */ - public static final long buffers$offset() { - return buffers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUBuffer *buffers - * } - */ - public static MemorySegment buffers(MemorySegment struct) { - return struct.get(buffers$LAYOUT, buffers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUBuffer *buffers - * } - */ - public static void buffers(MemorySegment struct, MemorySegment fieldValue) { - struct.set(buffers$LAYOUT, buffers$OFFSET, fieldValue); - } - - private static final OfLong bufferCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("bufferCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static final OfLong bufferCount$layout() { - return bufferCount$LAYOUT; - } - - private static final long bufferCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static final long bufferCount$offset() { - return bufferCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static long bufferCount(MemorySegment struct) { - return struct.get(bufferCount$LAYOUT, bufferCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static void bufferCount(MemorySegment struct, long fieldValue) { - struct.set(bufferCount$LAYOUT, bufferCount$OFFSET, fieldValue); - } - - private static final AddressLayout samplers$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("samplers")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUSampler *samplers - * } - */ - public static final AddressLayout samplers$layout() { - return samplers$LAYOUT; - } - - private static final long samplers$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUSampler *samplers - * } - */ - public static final long samplers$offset() { - return samplers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUSampler *samplers - * } - */ - public static MemorySegment samplers(MemorySegment struct) { - return struct.get(samplers$LAYOUT, samplers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUSampler *samplers - * } - */ - public static void samplers(MemorySegment struct, MemorySegment fieldValue) { - struct.set(samplers$LAYOUT, samplers$OFFSET, fieldValue); - } - - private static final OfLong samplerCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("samplerCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t samplerCount - * } - */ - public static final OfLong samplerCount$layout() { - return samplerCount$LAYOUT; - } - - private static final long samplerCount$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t samplerCount - * } - */ - public static final long samplerCount$offset() { - return samplerCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t samplerCount - * } - */ - public static long samplerCount(MemorySegment struct) { - return struct.get(samplerCount$LAYOUT, samplerCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t samplerCount - * } - */ - public static void samplerCount(MemorySegment struct, long fieldValue) { - struct.set(samplerCount$LAYOUT, samplerCount$OFFSET, fieldValue); - } - - private static final AddressLayout textureViews$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("textureViews")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUTextureView *textureViews - * } - */ - public static final AddressLayout textureViews$layout() { - return textureViews$LAYOUT; - } - - private static final long textureViews$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUTextureView *textureViews - * } - */ - public static final long textureViews$offset() { - return textureViews$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUTextureView *textureViews - * } - */ - public static MemorySegment textureViews(MemorySegment struct) { - return struct.get(textureViews$LAYOUT, textureViews$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUTextureView *textureViews - * } - */ - public static void textureViews(MemorySegment struct, MemorySegment fieldValue) { - struct.set(textureViews$LAYOUT, textureViews$OFFSET, fieldValue); - } - - private static final OfLong textureViewCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("textureViewCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t textureViewCount - * } - */ - public static final OfLong textureViewCount$layout() { - return textureViewCount$LAYOUT; - } - - private static final long textureViewCount$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t textureViewCount - * } - */ - public static final long textureViewCount$offset() { - return textureViewCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t textureViewCount - * } - */ - public static long textureViewCount(MemorySegment struct) { - return struct.get(textureViewCount$LAYOUT, textureViewCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t textureViewCount - * } - */ - public static void textureViewCount(MemorySegment struct, long fieldValue) { - struct.set(textureViewCount$LAYOUT, textureViewCount$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutDescriptor.java deleted file mode 100644 index 6c3b4905c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutDescriptor.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBindGroupLayoutDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * size_t entryCount; - * const WGPUBindGroupLayoutEntry *entries; - * } - * } - */ -public class WGPUBindGroupLayoutDescriptor { - - WGPUBindGroupLayoutDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_LONG_LONG.withName("entryCount"), - WGPU.C_POINTER.withName("entries") - ).withName("WGPUBindGroupLayoutDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfLong entryCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("entryCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static final OfLong entryCount$layout() { - return entryCount$LAYOUT; - } - - private static final long entryCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static final long entryCount$offset() { - return entryCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static long entryCount(MemorySegment struct) { - return struct.get(entryCount$LAYOUT, entryCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t entryCount - * } - */ - public static void entryCount(MemorySegment struct, long fieldValue) { - struct.set(entryCount$LAYOUT, entryCount$OFFSET, fieldValue); - } - - private static final AddressLayout entries$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("entries")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUBindGroupLayoutEntry *entries - * } - */ - public static final AddressLayout entries$layout() { - return entries$LAYOUT; - } - - private static final long entries$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUBindGroupLayoutEntry *entries - * } - */ - public static final long entries$offset() { - return entries$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUBindGroupLayoutEntry *entries - * } - */ - public static MemorySegment entries(MemorySegment struct) { - return struct.get(entries$LAYOUT, entries$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUBindGroupLayoutEntry *entries - * } - */ - public static void entries(MemorySegment struct, MemorySegment fieldValue) { - struct.set(entries$LAYOUT, entries$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutEntry.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutEntry.java deleted file mode 100644 index 173a020a1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutEntry.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBindGroupLayoutEntry { - * const WGPUChainedStruct *nextInChain; - * uint32_t binding; - * WGPUShaderStageFlags visibility; - * WGPUBufferBindingLayout buffer; - * WGPUSamplerBindingLayout sampler; - * WGPUTextureBindingLayout texture; - * WGPUStorageTextureBindingLayout storageTexture; - * } - * } - */ -public class WGPUBindGroupLayoutEntry { - - WGPUBindGroupLayoutEntry() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("binding"), - WGPU.C_INT.withName("visibility"), - WGPUBufferBindingLayout.layout().withName("buffer"), - WGPUSamplerBindingLayout.layout().withName("sampler"), - WGPUTextureBindingLayout.layout().withName("texture"), - WGPUStorageTextureBindingLayout.layout().withName("storageTexture") - ).withName("WGPUBindGroupLayoutEntry"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt binding$LAYOUT = (OfInt)$LAYOUT.select(groupElement("binding")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static final OfInt binding$layout() { - return binding$LAYOUT; - } - - private static final long binding$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static final long binding$offset() { - return binding$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static int binding(MemorySegment struct) { - return struct.get(binding$LAYOUT, binding$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t binding - * } - */ - public static void binding(MemorySegment struct, int fieldValue) { - struct.set(binding$LAYOUT, binding$OFFSET, fieldValue); - } - - private static final OfInt visibility$LAYOUT = (OfInt)$LAYOUT.select(groupElement("visibility")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderStageFlags visibility - * } - */ - public static final OfInt visibility$layout() { - return visibility$LAYOUT; - } - - private static final long visibility$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderStageFlags visibility - * } - */ - public static final long visibility$offset() { - return visibility$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderStageFlags visibility - * } - */ - public static int visibility(MemorySegment struct) { - return struct.get(visibility$LAYOUT, visibility$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderStageFlags visibility - * } - */ - public static void visibility(MemorySegment struct, int fieldValue) { - struct.set(visibility$LAYOUT, visibility$OFFSET, fieldValue); - } - - private static final GroupLayout buffer$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("buffer")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBufferBindingLayout buffer - * } - */ - public static final GroupLayout buffer$layout() { - return buffer$LAYOUT; - } - - private static final long buffer$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBufferBindingLayout buffer - * } - */ - public static final long buffer$offset() { - return buffer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBufferBindingLayout buffer - * } - */ - public static MemorySegment buffer(MemorySegment struct) { - return struct.asSlice(buffer$OFFSET, buffer$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBufferBindingLayout buffer - * } - */ - public static void buffer(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, buffer$OFFSET, buffer$LAYOUT.byteSize()); - } - - private static final GroupLayout sampler$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("sampler")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSamplerBindingLayout sampler - * } - */ - public static final GroupLayout sampler$layout() { - return sampler$LAYOUT; - } - - private static final long sampler$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSamplerBindingLayout sampler - * } - */ - public static final long sampler$offset() { - return sampler$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSamplerBindingLayout sampler - * } - */ - public static MemorySegment sampler(MemorySegment struct) { - return struct.asSlice(sampler$OFFSET, sampler$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSamplerBindingLayout sampler - * } - */ - public static void sampler(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, sampler$OFFSET, sampler$LAYOUT.byteSize()); - } - - private static final GroupLayout texture$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("texture")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureBindingLayout texture - * } - */ - public static final GroupLayout texture$layout() { - return texture$LAYOUT; - } - - private static final long texture$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureBindingLayout texture - * } - */ - public static final long texture$offset() { - return texture$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureBindingLayout texture - * } - */ - public static MemorySegment texture(MemorySegment struct) { - return struct.asSlice(texture$OFFSET, texture$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureBindingLayout texture - * } - */ - public static void texture(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, texture$OFFSET, texture$LAYOUT.byteSize()); - } - - private static final GroupLayout storageTexture$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("storageTexture")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStorageTextureBindingLayout storageTexture - * } - */ - public static final GroupLayout storageTexture$layout() { - return storageTexture$LAYOUT; - } - - private static final long storageTexture$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStorageTextureBindingLayout storageTexture - * } - */ - public static final long storageTexture$offset() { - return storageTexture$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStorageTextureBindingLayout storageTexture - * } - */ - public static MemorySegment storageTexture(MemorySegment struct) { - return struct.asSlice(storageTexture$OFFSET, storageTexture$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStorageTextureBindingLayout storageTexture - * } - */ - public static void storageTexture(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, storageTexture$OFFSET, storageTexture$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutEntryExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutEntryExtras.java deleted file mode 100644 index e95ae4a04..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBindGroupLayoutEntryExtras.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBindGroupLayoutEntryExtras { - * WGPUChainedStruct chain; - * uint32_t count; - * } - * } - */ -public class WGPUBindGroupLayoutEntryExtras { - - WGPUBindGroupLayoutEntryExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_INT.withName("count"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUBindGroupLayoutEntryExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfInt count$LAYOUT = (OfInt)$LAYOUT.select(groupElement("count")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static final OfInt count$layout() { - return count$LAYOUT; - } - - private static final long count$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static final long count$offset() { - return count$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static int count(MemorySegment struct) { - return struct.get(count$LAYOUT, count$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static void count(MemorySegment struct, int fieldValue) { - struct.set(count$LAYOUT, count$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBlendComponent.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBlendComponent.java deleted file mode 100644 index 2ff8f682e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBlendComponent.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBlendComponent { - * WGPUBlendOperation operation; - * WGPUBlendFactor srcFactor; - * WGPUBlendFactor dstFactor; - * } - * } - */ -public class WGPUBlendComponent { - - WGPUBlendComponent() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("operation"), - WGPU.C_INT.withName("srcFactor"), - WGPU.C_INT.withName("dstFactor") - ).withName("WGPUBlendComponent"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt operation$LAYOUT = (OfInt)$LAYOUT.select(groupElement("operation")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBlendOperation operation - * } - */ - public static final OfInt operation$layout() { - return operation$LAYOUT; - } - - private static final long operation$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBlendOperation operation - * } - */ - public static final long operation$offset() { - return operation$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBlendOperation operation - * } - */ - public static int operation(MemorySegment struct) { - return struct.get(operation$LAYOUT, operation$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBlendOperation operation - * } - */ - public static void operation(MemorySegment struct, int fieldValue) { - struct.set(operation$LAYOUT, operation$OFFSET, fieldValue); - } - - private static final OfInt srcFactor$LAYOUT = (OfInt)$LAYOUT.select(groupElement("srcFactor")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBlendFactor srcFactor - * } - */ - public static final OfInt srcFactor$layout() { - return srcFactor$LAYOUT; - } - - private static final long srcFactor$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBlendFactor srcFactor - * } - */ - public static final long srcFactor$offset() { - return srcFactor$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBlendFactor srcFactor - * } - */ - public static int srcFactor(MemorySegment struct) { - return struct.get(srcFactor$LAYOUT, srcFactor$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBlendFactor srcFactor - * } - */ - public static void srcFactor(MemorySegment struct, int fieldValue) { - struct.set(srcFactor$LAYOUT, srcFactor$OFFSET, fieldValue); - } - - private static final OfInt dstFactor$LAYOUT = (OfInt)$LAYOUT.select(groupElement("dstFactor")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBlendFactor dstFactor - * } - */ - public static final OfInt dstFactor$layout() { - return dstFactor$LAYOUT; - } - - private static final long dstFactor$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBlendFactor dstFactor - * } - */ - public static final long dstFactor$offset() { - return dstFactor$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBlendFactor dstFactor - * } - */ - public static int dstFactor(MemorySegment struct) { - return struct.get(dstFactor$LAYOUT, dstFactor$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBlendFactor dstFactor - * } - */ - public static void dstFactor(MemorySegment struct, int fieldValue) { - struct.set(dstFactor$LAYOUT, dstFactor$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBlendState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBlendState.java deleted file mode 100644 index 0d31e11f9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBlendState.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBlendState { - * WGPUBlendComponent color; - * WGPUBlendComponent alpha; - * } - * } - */ -public class WGPUBlendState { - - WGPUBlendState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUBlendComponent.layout().withName("color"), - WGPUBlendComponent.layout().withName("alpha") - ).withName("WGPUBlendState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout color$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("color")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBlendComponent color - * } - */ - public static final GroupLayout color$layout() { - return color$LAYOUT; - } - - private static final long color$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBlendComponent color - * } - */ - public static final long color$offset() { - return color$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBlendComponent color - * } - */ - public static MemorySegment color(MemorySegment struct) { - return struct.asSlice(color$OFFSET, color$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBlendComponent color - * } - */ - public static void color(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, color$OFFSET, color$LAYOUT.byteSize()); - } - - private static final GroupLayout alpha$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("alpha")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBlendComponent alpha - * } - */ - public static final GroupLayout alpha$layout() { - return alpha$LAYOUT; - } - - private static final long alpha$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBlendComponent alpha - * } - */ - public static final long alpha$offset() { - return alpha$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBlendComponent alpha - * } - */ - public static MemorySegment alpha(MemorySegment struct) { - return struct.asSlice(alpha$OFFSET, alpha$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBlendComponent alpha - * } - */ - public static void alpha(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, alpha$OFFSET, alpha$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferBindingLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferBindingLayout.java deleted file mode 100644 index 244539723..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferBindingLayout.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBufferBindingLayout { - * const WGPUChainedStruct *nextInChain; - * WGPUBufferBindingType type; - * WGPUBool hasDynamicOffset; - * uint64_t minBindingSize; - * } - * } - */ -public class WGPUBufferBindingLayout { - - WGPUBufferBindingLayout() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("type"), - WGPU.C_INT.withName("hasDynamicOffset"), - WGPU.C_LONG_LONG.withName("minBindingSize") - ).withName("WGPUBufferBindingLayout"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("type")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBufferBindingType type - * } - */ - public static final OfInt type$layout() { - return type$LAYOUT; - } - - private static final long type$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBufferBindingType type - * } - */ - public static final long type$offset() { - return type$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBufferBindingType type - * } - */ - public static int type(MemorySegment struct) { - return struct.get(type$LAYOUT, type$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBufferBindingType type - * } - */ - public static void type(MemorySegment struct, int fieldValue) { - struct.set(type$LAYOUT, type$OFFSET, fieldValue); - } - - private static final OfInt hasDynamicOffset$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hasDynamicOffset")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool hasDynamicOffset - * } - */ - public static final OfInt hasDynamicOffset$layout() { - return hasDynamicOffset$LAYOUT; - } - - private static final long hasDynamicOffset$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool hasDynamicOffset - * } - */ - public static final long hasDynamicOffset$offset() { - return hasDynamicOffset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool hasDynamicOffset - * } - */ - public static int hasDynamicOffset(MemorySegment struct) { - return struct.get(hasDynamicOffset$LAYOUT, hasDynamicOffset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool hasDynamicOffset - * } - */ - public static void hasDynamicOffset(MemorySegment struct, int fieldValue) { - struct.set(hasDynamicOffset$LAYOUT, hasDynamicOffset$OFFSET, fieldValue); - } - - private static final OfLong minBindingSize$LAYOUT = (OfLong)$LAYOUT.select(groupElement("minBindingSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t minBindingSize - * } - */ - public static final OfLong minBindingSize$layout() { - return minBindingSize$LAYOUT; - } - - private static final long minBindingSize$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t minBindingSize - * } - */ - public static final long minBindingSize$offset() { - return minBindingSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t minBindingSize - * } - */ - public static long minBindingSize(MemorySegment struct) { - return struct.get(minBindingSize$LAYOUT, minBindingSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t minBindingSize - * } - */ - public static void minBindingSize(MemorySegment struct, long fieldValue) { - struct.set(minBindingSize$LAYOUT, minBindingSize$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferDescriptor.java deleted file mode 100644 index 7f3e6ce02..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferDescriptor.java +++ /dev/null @@ -1,313 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUBufferDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUBufferUsageFlags usage; - * uint64_t size; - * WGPUBool mappedAtCreation; - * } - * } - */ -public class WGPUBufferDescriptor { - - WGPUBufferDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_INT.withName("usage"), - MemoryLayout.paddingLayout(4), - WGPU.C_LONG_LONG.withName("size"), - WGPU.C_INT.withName("mappedAtCreation"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUBufferDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfInt usage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("usage")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBufferUsageFlags usage - * } - */ - public static final OfInt usage$layout() { - return usage$LAYOUT; - } - - private static final long usage$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBufferUsageFlags usage - * } - */ - public static final long usage$offset() { - return usage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBufferUsageFlags usage - * } - */ - public static int usage(MemorySegment struct) { - return struct.get(usage$LAYOUT, usage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBufferUsageFlags usage - * } - */ - public static void usage(MemorySegment struct, int fieldValue) { - struct.set(usage$LAYOUT, usage$OFFSET, fieldValue); - } - - private static final OfLong size$LAYOUT = (OfLong)$LAYOUT.select(groupElement("size")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static final OfLong size$layout() { - return size$LAYOUT; - } - - private static final long size$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static final long size$offset() { - return size$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static long size(MemorySegment struct) { - return struct.get(size$LAYOUT, size$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t size - * } - */ - public static void size(MemorySegment struct, long fieldValue) { - struct.set(size$LAYOUT, size$OFFSET, fieldValue); - } - - private static final OfInt mappedAtCreation$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mappedAtCreation")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool mappedAtCreation - * } - */ - public static final OfInt mappedAtCreation$layout() { - return mappedAtCreation$LAYOUT; - } - - private static final long mappedAtCreation$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool mappedAtCreation - * } - */ - public static final long mappedAtCreation$offset() { - return mappedAtCreation$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool mappedAtCreation - * } - */ - public static int mappedAtCreation(MemorySegment struct) { - return struct.get(mappedAtCreation$LAYOUT, mappedAtCreation$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool mappedAtCreation - * } - */ - public static void mappedAtCreation(MemorySegment struct, int fieldValue) { - struct.set(mappedAtCreation$LAYOUT, mappedAtCreation$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferMapCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferMapCallback.java deleted file mode 100644 index 03e2d349e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUBufferMapCallback.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUBufferMapCallback)(WGPUBufferMapAsyncStatus, void *) - * } - */ -public class WGPUBufferMapCallback { - - WGPUBufferMapCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUBufferMapCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUBufferMapCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUChainedStruct.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUChainedStruct.java deleted file mode 100644 index f6a768cd0..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUChainedStruct.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUChainedStruct { - * const struct WGPUChainedStruct *next; - * WGPUSType sType; - * } - * } - */ -public class WGPUChainedStruct { - - WGPUChainedStruct() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("next"), - WGPU.C_INT.withName("sType"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUChainedStruct"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout next$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("next")); - - /** - * Layout for field: - * {@snippet lang=c : - * const struct WGPUChainedStruct *next - * } - */ - public static final AddressLayout next$layout() { - return next$LAYOUT; - } - - private static final long next$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const struct WGPUChainedStruct *next - * } - */ - public static final long next$offset() { - return next$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const struct WGPUChainedStruct *next - * } - */ - public static MemorySegment next(MemorySegment struct) { - return struct.get(next$LAYOUT, next$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const struct WGPUChainedStruct *next - * } - */ - public static void next(MemorySegment struct, MemorySegment fieldValue) { - struct.set(next$LAYOUT, next$OFFSET, fieldValue); - } - - private static final OfInt sType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static final OfInt sType$layout() { - return sType$LAYOUT; - } - - private static final long sType$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static final long sType$offset() { - return sType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static int sType(MemorySegment struct) { - return struct.get(sType$LAYOUT, sType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static void sType(MemorySegment struct, int fieldValue) { - struct.set(sType$LAYOUT, sType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUChainedStructOut.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUChainedStructOut.java deleted file mode 100644 index e69aa8e88..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUChainedStructOut.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUChainedStructOut { - * struct WGPUChainedStructOut *next; - * WGPUSType sType; - * } - * } - */ -public class WGPUChainedStructOut { - - WGPUChainedStructOut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("next"), - WGPU.C_INT.withName("sType"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUChainedStructOut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout next$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("next")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct WGPUChainedStructOut *next - * } - */ - public static final AddressLayout next$layout() { - return next$LAYOUT; - } - - private static final long next$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * struct WGPUChainedStructOut *next - * } - */ - public static final long next$offset() { - return next$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct WGPUChainedStructOut *next - * } - */ - public static MemorySegment next(MemorySegment struct) { - return struct.get(next$LAYOUT, next$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct WGPUChainedStructOut *next - * } - */ - public static void next(MemorySegment struct, MemorySegment fieldValue) { - struct.set(next$LAYOUT, next$OFFSET, fieldValue); - } - - private static final OfInt sType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static final OfInt sType$layout() { - return sType$LAYOUT; - } - - private static final long sType$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static final long sType$offset() { - return sType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static int sType(MemorySegment struct) { - return struct.get(sType$LAYOUT, sType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSType sType - * } - */ - public static void sType(MemorySegment struct, int fieldValue) { - struct.set(sType$LAYOUT, sType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUColor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUColor.java deleted file mode 100644 index a37f615a7..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUColor.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUColor { - * double r; - * double g; - * double b; - * double a; - * } - * } - */ -public class WGPUColor { - - WGPUColor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_DOUBLE.withName("r"), - WGPU.C_DOUBLE.withName("g"), - WGPU.C_DOUBLE.withName("b"), - WGPU.C_DOUBLE.withName("a") - ).withName("WGPUColor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble r$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("r")); - - /** - * Layout for field: - * {@snippet lang=c : - * double r - * } - */ - public static final OfDouble r$layout() { - return r$LAYOUT; - } - - private static final long r$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double r - * } - */ - public static final long r$offset() { - return r$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double r - * } - */ - public static double r(MemorySegment struct) { - return struct.get(r$LAYOUT, r$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double r - * } - */ - public static void r(MemorySegment struct, double fieldValue) { - struct.set(r$LAYOUT, r$OFFSET, fieldValue); - } - - private static final OfDouble g$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("g")); - - /** - * Layout for field: - * {@snippet lang=c : - * double g - * } - */ - public static final OfDouble g$layout() { - return g$LAYOUT; - } - - private static final long g$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * double g - * } - */ - public static final long g$offset() { - return g$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double g - * } - */ - public static double g(MemorySegment struct) { - return struct.get(g$LAYOUT, g$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double g - * } - */ - public static void g(MemorySegment struct, double fieldValue) { - struct.set(g$LAYOUT, g$OFFSET, fieldValue); - } - - private static final OfDouble b$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("b")); - - /** - * Layout for field: - * {@snippet lang=c : - * double b - * } - */ - public static final OfDouble b$layout() { - return b$LAYOUT; - } - - private static final long b$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * double b - * } - */ - public static final long b$offset() { - return b$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double b - * } - */ - public static double b(MemorySegment struct) { - return struct.get(b$LAYOUT, b$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double b - * } - */ - public static void b(MemorySegment struct, double fieldValue) { - struct.set(b$LAYOUT, b$OFFSET, fieldValue); - } - - private static final OfDouble a$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("a")); - - /** - * Layout for field: - * {@snippet lang=c : - * double a - * } - */ - public static final OfDouble a$layout() { - return a$LAYOUT; - } - - private static final long a$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * double a - * } - */ - public static final long a$offset() { - return a$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double a - * } - */ - public static double a(MemorySegment struct) { - return struct.get(a$LAYOUT, a$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double a - * } - */ - public static void a(MemorySegment struct, double fieldValue) { - struct.set(a$LAYOUT, a$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUColorTargetState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUColorTargetState.java deleted file mode 100644 index 76fdbe7ca..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUColorTargetState.java +++ /dev/null @@ -1,267 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUColorTargetState { - * const WGPUChainedStruct *nextInChain; - * WGPUTextureFormat format; - * const WGPUBlendState *blend; - * WGPUColorWriteMaskFlags writeMask; - * } - * } - */ -public class WGPUColorTargetState { - - WGPUColorTargetState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("format"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("blend"), - WGPU.C_INT.withName("writeMask"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUColorTargetState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final AddressLayout blend$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("blend")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUBlendState *blend - * } - */ - public static final AddressLayout blend$layout() { - return blend$LAYOUT; - } - - private static final long blend$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUBlendState *blend - * } - */ - public static final long blend$offset() { - return blend$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUBlendState *blend - * } - */ - public static MemorySegment blend(MemorySegment struct) { - return struct.get(blend$LAYOUT, blend$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUBlendState *blend - * } - */ - public static void blend(MemorySegment struct, MemorySegment fieldValue) { - struct.set(blend$LAYOUT, blend$OFFSET, fieldValue); - } - - private static final OfInt writeMask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("writeMask")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUColorWriteMaskFlags writeMask - * } - */ - public static final OfInt writeMask$layout() { - return writeMask$LAYOUT; - } - - private static final long writeMask$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUColorWriteMaskFlags writeMask - * } - */ - public static final long writeMask$offset() { - return writeMask$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUColorWriteMaskFlags writeMask - * } - */ - public static int writeMask(MemorySegment struct) { - return struct.get(writeMask$LAYOUT, writeMask$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUColorWriteMaskFlags writeMask - * } - */ - public static void writeMask(MemorySegment struct, int fieldValue) { - struct.set(writeMask$LAYOUT, writeMask$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCommandBufferDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCommandBufferDescriptor.java deleted file mode 100644 index 61d312981..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCommandBufferDescriptor.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUCommandBufferDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * } - * } - */ -public class WGPUCommandBufferDescriptor { - - WGPUCommandBufferDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label") - ).withName("WGPUCommandBufferDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCommandEncoderDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCommandEncoderDescriptor.java deleted file mode 100644 index 1fb5caa55..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCommandEncoderDescriptor.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUCommandEncoderDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * } - * } - */ -public class WGPUCommandEncoderDescriptor { - - WGPUCommandEncoderDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label") - ).withName("WGPUCommandEncoderDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationInfo.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationInfo.java deleted file mode 100644 index 10c80fc9e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationInfo.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUCompilationInfo { - * const WGPUChainedStruct *nextInChain; - * size_t messageCount; - * const WGPUCompilationMessage *messages; - * } - * } - */ -public class WGPUCompilationInfo { - - WGPUCompilationInfo() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_LONG_LONG.withName("messageCount"), - WGPU.C_POINTER.withName("messages") - ).withName("WGPUCompilationInfo"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfLong messageCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("messageCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t messageCount - * } - */ - public static final OfLong messageCount$layout() { - return messageCount$LAYOUT; - } - - private static final long messageCount$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t messageCount - * } - */ - public static final long messageCount$offset() { - return messageCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t messageCount - * } - */ - public static long messageCount(MemorySegment struct) { - return struct.get(messageCount$LAYOUT, messageCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t messageCount - * } - */ - public static void messageCount(MemorySegment struct, long fieldValue) { - struct.set(messageCount$LAYOUT, messageCount$OFFSET, fieldValue); - } - - private static final AddressLayout messages$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("messages")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUCompilationMessage *messages - * } - */ - public static final AddressLayout messages$layout() { - return messages$LAYOUT; - } - - private static final long messages$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUCompilationMessage *messages - * } - */ - public static final long messages$offset() { - return messages$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUCompilationMessage *messages - * } - */ - public static MemorySegment messages(MemorySegment struct) { - return struct.get(messages$LAYOUT, messages$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUCompilationMessage *messages - * } - */ - public static void messages(MemorySegment struct, MemorySegment fieldValue) { - struct.set(messages$LAYOUT, messages$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationInfoCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationInfoCallback.java deleted file mode 100644 index 4e611ddbe..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationInfoCallback.java +++ /dev/null @@ -1,73 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus, const struct WGPUCompilationInfo { - * const WGPUChainedStruct *nextInChain; - * size_t messageCount; - * const WGPUCompilationMessage *messages; - * } *, void *) - * } - */ -public class WGPUCompilationInfoCallback { - - WGPUCompilationInfoCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment compilationInfo, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUCompilationInfoCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUCompilationInfoCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment compilationInfo, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, compilationInfo, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationMessage.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationMessage.java deleted file mode 100644 index 505ab8eea..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCompilationMessage.java +++ /dev/null @@ -1,542 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUCompilationMessage { - * const WGPUChainedStruct *nextInChain; - * const char *message; - * WGPUCompilationMessageType type; - * uint64_t lineNum; - * uint64_t linePos; - * uint64_t offset; - * uint64_t length; - * uint64_t utf16LinePos; - * uint64_t utf16Offset; - * uint64_t utf16Length; - * } - * } - */ -public class WGPUCompilationMessage { - - WGPUCompilationMessage() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("message"), - WGPU.C_INT.withName("type"), - MemoryLayout.paddingLayout(4), - WGPU.C_LONG_LONG.withName("lineNum"), - WGPU.C_LONG_LONG.withName("linePos"), - WGPU.C_LONG_LONG.withName("offset"), - WGPU.C_LONG_LONG.withName("length"), - WGPU.C_LONG_LONG.withName("utf16LinePos"), - WGPU.C_LONG_LONG.withName("utf16Offset"), - WGPU.C_LONG_LONG.withName("utf16Length") - ).withName("WGPUCompilationMessage"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout message$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("message")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *message - * } - */ - public static final AddressLayout message$layout() { - return message$LAYOUT; - } - - private static final long message$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *message - * } - */ - public static final long message$offset() { - return message$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *message - * } - */ - public static MemorySegment message(MemorySegment struct) { - return struct.get(message$LAYOUT, message$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *message - * } - */ - public static void message(MemorySegment struct, MemorySegment fieldValue) { - struct.set(message$LAYOUT, message$OFFSET, fieldValue); - } - - private static final OfInt type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("type")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCompilationMessageType type - * } - */ - public static final OfInt type$layout() { - return type$LAYOUT; - } - - private static final long type$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCompilationMessageType type - * } - */ - public static final long type$offset() { - return type$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCompilationMessageType type - * } - */ - public static int type(MemorySegment struct) { - return struct.get(type$LAYOUT, type$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCompilationMessageType type - * } - */ - public static void type(MemorySegment struct, int fieldValue) { - struct.set(type$LAYOUT, type$OFFSET, fieldValue); - } - - private static final OfLong lineNum$LAYOUT = (OfLong)$LAYOUT.select(groupElement("lineNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t lineNum - * } - */ - public static final OfLong lineNum$layout() { - return lineNum$LAYOUT; - } - - private static final long lineNum$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t lineNum - * } - */ - public static final long lineNum$offset() { - return lineNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t lineNum - * } - */ - public static long lineNum(MemorySegment struct) { - return struct.get(lineNum$LAYOUT, lineNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t lineNum - * } - */ - public static void lineNum(MemorySegment struct, long fieldValue) { - struct.set(lineNum$LAYOUT, lineNum$OFFSET, fieldValue); - } - - private static final OfLong linePos$LAYOUT = (OfLong)$LAYOUT.select(groupElement("linePos")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t linePos - * } - */ - public static final OfLong linePos$layout() { - return linePos$LAYOUT; - } - - private static final long linePos$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t linePos - * } - */ - public static final long linePos$offset() { - return linePos$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t linePos - * } - */ - public static long linePos(MemorySegment struct) { - return struct.get(linePos$LAYOUT, linePos$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t linePos - * } - */ - public static void linePos(MemorySegment struct, long fieldValue) { - struct.set(linePos$LAYOUT, linePos$OFFSET, fieldValue); - } - - private static final OfLong offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("offset")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final OfLong offset$layout() { - return offset$LAYOUT; - } - - private static final long offset$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final long offset$offset() { - return offset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static long offset(MemorySegment struct) { - return struct.get(offset$LAYOUT, offset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static void offset(MemorySegment struct, long fieldValue) { - struct.set(offset$LAYOUT, offset$OFFSET, fieldValue); - } - - private static final OfLong length$LAYOUT = (OfLong)$LAYOUT.select(groupElement("length")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t length - * } - */ - public static final OfLong length$layout() { - return length$LAYOUT; - } - - private static final long length$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t length - * } - */ - public static final long length$offset() { - return length$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t length - * } - */ - public static long length(MemorySegment struct) { - return struct.get(length$LAYOUT, length$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t length - * } - */ - public static void length(MemorySegment struct, long fieldValue) { - struct.set(length$LAYOUT, length$OFFSET, fieldValue); - } - - private static final OfLong utf16LinePos$LAYOUT = (OfLong)$LAYOUT.select(groupElement("utf16LinePos")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t utf16LinePos - * } - */ - public static final OfLong utf16LinePos$layout() { - return utf16LinePos$LAYOUT; - } - - private static final long utf16LinePos$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t utf16LinePos - * } - */ - public static final long utf16LinePos$offset() { - return utf16LinePos$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t utf16LinePos - * } - */ - public static long utf16LinePos(MemorySegment struct) { - return struct.get(utf16LinePos$LAYOUT, utf16LinePos$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t utf16LinePos - * } - */ - public static void utf16LinePos(MemorySegment struct, long fieldValue) { - struct.set(utf16LinePos$LAYOUT, utf16LinePos$OFFSET, fieldValue); - } - - private static final OfLong utf16Offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("utf16Offset")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t utf16Offset - * } - */ - public static final OfLong utf16Offset$layout() { - return utf16Offset$LAYOUT; - } - - private static final long utf16Offset$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t utf16Offset - * } - */ - public static final long utf16Offset$offset() { - return utf16Offset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t utf16Offset - * } - */ - public static long utf16Offset(MemorySegment struct) { - return struct.get(utf16Offset$LAYOUT, utf16Offset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t utf16Offset - * } - */ - public static void utf16Offset(MemorySegment struct, long fieldValue) { - struct.set(utf16Offset$LAYOUT, utf16Offset$OFFSET, fieldValue); - } - - private static final OfLong utf16Length$LAYOUT = (OfLong)$LAYOUT.select(groupElement("utf16Length")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t utf16Length - * } - */ - public static final OfLong utf16Length$layout() { - return utf16Length$LAYOUT; - } - - private static final long utf16Length$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t utf16Length - * } - */ - public static final long utf16Length$offset() { - return utf16Length$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t utf16Length - * } - */ - public static long utf16Length(MemorySegment struct) { - return struct.get(utf16Length$LAYOUT, utf16Length$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t utf16Length - * } - */ - public static void utf16Length(MemorySegment struct, long fieldValue) { - struct.set(utf16Length$LAYOUT, utf16Length$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePassDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePassDescriptor.java deleted file mode 100644 index c382357ac..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePassDescriptor.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUComputePassDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * const WGPUComputePassTimestampWrites *timestampWrites; - * } - * } - */ -public class WGPUComputePassDescriptor { - - WGPUComputePassDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_POINTER.withName("timestampWrites") - ).withName("WGPUComputePassDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final AddressLayout timestampWrites$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("timestampWrites")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUComputePassTimestampWrites *timestampWrites - * } - */ - public static final AddressLayout timestampWrites$layout() { - return timestampWrites$LAYOUT; - } - - private static final long timestampWrites$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUComputePassTimestampWrites *timestampWrites - * } - */ - public static final long timestampWrites$offset() { - return timestampWrites$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUComputePassTimestampWrites *timestampWrites - * } - */ - public static MemorySegment timestampWrites(MemorySegment struct) { - return struct.get(timestampWrites$LAYOUT, timestampWrites$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUComputePassTimestampWrites *timestampWrites - * } - */ - public static void timestampWrites(MemorySegment struct, MemorySegment fieldValue) { - struct.set(timestampWrites$LAYOUT, timestampWrites$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePassTimestampWrites.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePassTimestampWrites.java deleted file mode 100644 index f2bec4b13..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePassTimestampWrites.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUComputePassTimestampWrites { - * WGPUQuerySet querySet; - * uint32_t beginningOfPassWriteIndex; - * uint32_t endOfPassWriteIndex; - * } - * } - */ -public class WGPUComputePassTimestampWrites { - - WGPUComputePassTimestampWrites() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("querySet"), - WGPU.C_INT.withName("beginningOfPassWriteIndex"), - WGPU.C_INT.withName("endOfPassWriteIndex") - ).withName("WGPUComputePassTimestampWrites"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout querySet$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("querySet")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static final AddressLayout querySet$layout() { - return querySet$LAYOUT; - } - - private static final long querySet$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static final long querySet$offset() { - return querySet$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static MemorySegment querySet(MemorySegment struct) { - return struct.get(querySet$LAYOUT, querySet$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static void querySet(MemorySegment struct, MemorySegment fieldValue) { - struct.set(querySet$LAYOUT, querySet$OFFSET, fieldValue); - } - - private static final OfInt beginningOfPassWriteIndex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("beginningOfPassWriteIndex")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static final OfInt beginningOfPassWriteIndex$layout() { - return beginningOfPassWriteIndex$LAYOUT; - } - - private static final long beginningOfPassWriteIndex$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static final long beginningOfPassWriteIndex$offset() { - return beginningOfPassWriteIndex$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static int beginningOfPassWriteIndex(MemorySegment struct) { - return struct.get(beginningOfPassWriteIndex$LAYOUT, beginningOfPassWriteIndex$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static void beginningOfPassWriteIndex(MemorySegment struct, int fieldValue) { - struct.set(beginningOfPassWriteIndex$LAYOUT, beginningOfPassWriteIndex$OFFSET, fieldValue); - } - - private static final OfInt endOfPassWriteIndex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("endOfPassWriteIndex")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static final OfInt endOfPassWriteIndex$layout() { - return endOfPassWriteIndex$LAYOUT; - } - - private static final long endOfPassWriteIndex$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static final long endOfPassWriteIndex$offset() { - return endOfPassWriteIndex$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static int endOfPassWriteIndex(MemorySegment struct) { - return struct.get(endOfPassWriteIndex$LAYOUT, endOfPassWriteIndex$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static void endOfPassWriteIndex(MemorySegment struct, int fieldValue) { - struct.set(endOfPassWriteIndex$LAYOUT, endOfPassWriteIndex$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePipelineDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePipelineDescriptor.java deleted file mode 100644 index 93fe10cc1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUComputePipelineDescriptor.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUComputePipelineDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUPipelineLayout layout; - * WGPUProgrammableStageDescriptor compute; - * } - * } - */ -public class WGPUComputePipelineDescriptor { - - WGPUComputePipelineDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_POINTER.withName("layout"), - WGPUProgrammableStageDescriptor.layout().withName("compute") - ).withName("WGPUComputePipelineDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final AddressLayout layout$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("layout")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static final AddressLayout layout$layout() { - return layout$LAYOUT; - } - - private static final long layout$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static final long layout$offset() { - return layout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static MemorySegment layout(MemorySegment struct) { - return struct.get(layout$LAYOUT, layout$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static void layout(MemorySegment struct, MemorySegment fieldValue) { - struct.set(layout$LAYOUT, layout$OFFSET, fieldValue); - } - - private static final GroupLayout compute$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("compute")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUProgrammableStageDescriptor compute - * } - */ - public static final GroupLayout compute$layout() { - return compute$LAYOUT; - } - - private static final long compute$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUProgrammableStageDescriptor compute - * } - */ - public static final long compute$offset() { - return compute$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUProgrammableStageDescriptor compute - * } - */ - public static MemorySegment compute(MemorySegment struct) { - return struct.asSlice(compute$OFFSET, compute$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUProgrammableStageDescriptor compute - * } - */ - public static void compute(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, compute$OFFSET, compute$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUConstantEntry.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUConstantEntry.java deleted file mode 100644 index 8b549c56b..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUConstantEntry.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUConstantEntry { - * const WGPUChainedStruct *nextInChain; - * const char *key; - * double value; - * } - * } - */ -public class WGPUConstantEntry { - - WGPUConstantEntry() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("key"), - WGPU.C_DOUBLE.withName("value") - ).withName("WGPUConstantEntry"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout key$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("key")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *key - * } - */ - public static final AddressLayout key$layout() { - return key$LAYOUT; - } - - private static final long key$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *key - * } - */ - public static final long key$offset() { - return key$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *key - * } - */ - public static MemorySegment key(MemorySegment struct) { - return struct.get(key$LAYOUT, key$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *key - * } - */ - public static void key(MemorySegment struct, MemorySegment fieldValue) { - struct.set(key$LAYOUT, key$OFFSET, fieldValue); - } - - private static final OfDouble value$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("value")); - - /** - * Layout for field: - * {@snippet lang=c : - * double value - * } - */ - public static final OfDouble value$layout() { - return value$LAYOUT; - } - - private static final long value$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * double value - * } - */ - public static final long value$offset() { - return value$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double value - * } - */ - public static double value(MemorySegment struct) { - return struct.get(value$LAYOUT, value$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double value - * } - */ - public static void value(MemorySegment struct, double fieldValue) { - struct.set(value$LAYOUT, value$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCreateComputePipelineAsyncCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCreateComputePipelineAsyncCallback.java deleted file mode 100644 index 7f300d676..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCreateComputePipelineAsyncCallback.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus, WGPUComputePipeline, const char *, void *) - * } - */ -public class WGPUCreateComputePipelineAsyncCallback { - - WGPUCreateComputePipelineAsyncCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment pipeline, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUCreateComputePipelineAsyncCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUCreateComputePipelineAsyncCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment pipeline, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, pipeline, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCreateRenderPipelineAsyncCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCreateRenderPipelineAsyncCallback.java deleted file mode 100644 index 4788dc5fd..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUCreateRenderPipelineAsyncCallback.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus, WGPURenderPipeline, const char *, void *) - * } - */ -public class WGPUCreateRenderPipelineAsyncCallback { - - WGPUCreateRenderPipelineAsyncCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment pipeline, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUCreateRenderPipelineAsyncCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUCreateRenderPipelineAsyncCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment pipeline, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, pipeline, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDepthStencilState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDepthStencilState.java deleted file mode 100644 index e34f7184c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDepthStencilState.java +++ /dev/null @@ -1,587 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUDepthStencilState { - * const WGPUChainedStruct *nextInChain; - * WGPUTextureFormat format; - * WGPUBool depthWriteEnabled; - * WGPUCompareFunction depthCompare; - * WGPUStencilFaceState stencilFront; - * WGPUStencilFaceState stencilBack; - * uint32_t stencilReadMask; - * uint32_t stencilWriteMask; - * int32_t depthBias; - * float depthBiasSlopeScale; - * float depthBiasClamp; - * } - * } - */ -public class WGPUDepthStencilState { - - WGPUDepthStencilState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("format"), - WGPU.C_INT.withName("depthWriteEnabled"), - WGPU.C_INT.withName("depthCompare"), - WGPUStencilFaceState.layout().withName("stencilFront"), - WGPUStencilFaceState.layout().withName("stencilBack"), - WGPU.C_INT.withName("stencilReadMask"), - WGPU.C_INT.withName("stencilWriteMask"), - WGPU.C_INT.withName("depthBias"), - WGPU.C_FLOAT.withName("depthBiasSlopeScale"), - WGPU.C_FLOAT.withName("depthBiasClamp") - ).withName("WGPUDepthStencilState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final OfInt depthWriteEnabled$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthWriteEnabled")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool depthWriteEnabled - * } - */ - public static final OfInt depthWriteEnabled$layout() { - return depthWriteEnabled$LAYOUT; - } - - private static final long depthWriteEnabled$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool depthWriteEnabled - * } - */ - public static final long depthWriteEnabled$offset() { - return depthWriteEnabled$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool depthWriteEnabled - * } - */ - public static int depthWriteEnabled(MemorySegment struct) { - return struct.get(depthWriteEnabled$LAYOUT, depthWriteEnabled$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool depthWriteEnabled - * } - */ - public static void depthWriteEnabled(MemorySegment struct, int fieldValue) { - struct.set(depthWriteEnabled$LAYOUT, depthWriteEnabled$OFFSET, fieldValue); - } - - private static final OfInt depthCompare$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthCompare")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCompareFunction depthCompare - * } - */ - public static final OfInt depthCompare$layout() { - return depthCompare$LAYOUT; - } - - private static final long depthCompare$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCompareFunction depthCompare - * } - */ - public static final long depthCompare$offset() { - return depthCompare$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCompareFunction depthCompare - * } - */ - public static int depthCompare(MemorySegment struct) { - return struct.get(depthCompare$LAYOUT, depthCompare$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCompareFunction depthCompare - * } - */ - public static void depthCompare(MemorySegment struct, int fieldValue) { - struct.set(depthCompare$LAYOUT, depthCompare$OFFSET, fieldValue); - } - - private static final GroupLayout stencilFront$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("stencilFront")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilFront - * } - */ - public static final GroupLayout stencilFront$layout() { - return stencilFront$LAYOUT; - } - - private static final long stencilFront$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilFront - * } - */ - public static final long stencilFront$offset() { - return stencilFront$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilFront - * } - */ - public static MemorySegment stencilFront(MemorySegment struct) { - return struct.asSlice(stencilFront$OFFSET, stencilFront$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilFront - * } - */ - public static void stencilFront(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, stencilFront$OFFSET, stencilFront$LAYOUT.byteSize()); - } - - private static final GroupLayout stencilBack$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("stencilBack")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilBack - * } - */ - public static final GroupLayout stencilBack$layout() { - return stencilBack$LAYOUT; - } - - private static final long stencilBack$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilBack - * } - */ - public static final long stencilBack$offset() { - return stencilBack$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilBack - * } - */ - public static MemorySegment stencilBack(MemorySegment struct) { - return struct.asSlice(stencilBack$OFFSET, stencilBack$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStencilFaceState stencilBack - * } - */ - public static void stencilBack(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, stencilBack$OFFSET, stencilBack$LAYOUT.byteSize()); - } - - private static final OfInt stencilReadMask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilReadMask")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t stencilReadMask - * } - */ - public static final OfInt stencilReadMask$layout() { - return stencilReadMask$LAYOUT; - } - - private static final long stencilReadMask$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t stencilReadMask - * } - */ - public static final long stencilReadMask$offset() { - return stencilReadMask$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t stencilReadMask - * } - */ - public static int stencilReadMask(MemorySegment struct) { - return struct.get(stencilReadMask$LAYOUT, stencilReadMask$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t stencilReadMask - * } - */ - public static void stencilReadMask(MemorySegment struct, int fieldValue) { - struct.set(stencilReadMask$LAYOUT, stencilReadMask$OFFSET, fieldValue); - } - - private static final OfInt stencilWriteMask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilWriteMask")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t stencilWriteMask - * } - */ - public static final OfInt stencilWriteMask$layout() { - return stencilWriteMask$LAYOUT; - } - - private static final long stencilWriteMask$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t stencilWriteMask - * } - */ - public static final long stencilWriteMask$offset() { - return stencilWriteMask$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t stencilWriteMask - * } - */ - public static int stencilWriteMask(MemorySegment struct) { - return struct.get(stencilWriteMask$LAYOUT, stencilWriteMask$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t stencilWriteMask - * } - */ - public static void stencilWriteMask(MemorySegment struct, int fieldValue) { - struct.set(stencilWriteMask$LAYOUT, stencilWriteMask$OFFSET, fieldValue); - } - - private static final OfInt depthBias$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthBias")); - - /** - * Layout for field: - * {@snippet lang=c : - * int32_t depthBias - * } - */ - public static final OfInt depthBias$layout() { - return depthBias$LAYOUT; - } - - private static final long depthBias$OFFSET = 60; - - /** - * Offset for field: - * {@snippet lang=c : - * int32_t depthBias - * } - */ - public static final long depthBias$offset() { - return depthBias$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int32_t depthBias - * } - */ - public static int depthBias(MemorySegment struct) { - return struct.get(depthBias$LAYOUT, depthBias$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int32_t depthBias - * } - */ - public static void depthBias(MemorySegment struct, int fieldValue) { - struct.set(depthBias$LAYOUT, depthBias$OFFSET, fieldValue); - } - - private static final OfFloat depthBiasSlopeScale$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("depthBiasSlopeScale")); - - /** - * Layout for field: - * {@snippet lang=c : - * float depthBiasSlopeScale - * } - */ - public static final OfFloat depthBiasSlopeScale$layout() { - return depthBiasSlopeScale$LAYOUT; - } - - private static final long depthBiasSlopeScale$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * float depthBiasSlopeScale - * } - */ - public static final long depthBiasSlopeScale$offset() { - return depthBiasSlopeScale$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float depthBiasSlopeScale - * } - */ - public static float depthBiasSlopeScale(MemorySegment struct) { - return struct.get(depthBiasSlopeScale$LAYOUT, depthBiasSlopeScale$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float depthBiasSlopeScale - * } - */ - public static void depthBiasSlopeScale(MemorySegment struct, float fieldValue) { - struct.set(depthBiasSlopeScale$LAYOUT, depthBiasSlopeScale$OFFSET, fieldValue); - } - - private static final OfFloat depthBiasClamp$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("depthBiasClamp")); - - /** - * Layout for field: - * {@snippet lang=c : - * float depthBiasClamp - * } - */ - public static final OfFloat depthBiasClamp$layout() { - return depthBiasClamp$LAYOUT; - } - - private static final long depthBiasClamp$OFFSET = 68; - - /** - * Offset for field: - * {@snippet lang=c : - * float depthBiasClamp - * } - */ - public static final long depthBiasClamp$offset() { - return depthBiasClamp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float depthBiasClamp - * } - */ - public static float depthBiasClamp(MemorySegment struct) { - return struct.get(depthBiasClamp$LAYOUT, depthBiasClamp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float depthBiasClamp - * } - */ - public static void depthBiasClamp(MemorySegment struct, float fieldValue) { - struct.set(depthBiasClamp$LAYOUT, depthBiasClamp$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceDescriptor.java deleted file mode 100644 index e861748d8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceDescriptor.java +++ /dev/null @@ -1,449 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUDeviceDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * size_t requiredFeatureCount; - * const WGPUFeatureName *requiredFeatures; - * const WGPURequiredLimits *requiredLimits; - * WGPUQueueDescriptor defaultQueue; - * WGPUDeviceLostCallback deviceLostCallback; - * void *deviceLostUserdata; - * } - * } - */ -public class WGPUDeviceDescriptor { - - WGPUDeviceDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_LONG_LONG.withName("requiredFeatureCount"), - WGPU.C_POINTER.withName("requiredFeatures"), - WGPU.C_POINTER.withName("requiredLimits"), - WGPUQueueDescriptor.layout().withName("defaultQueue"), - WGPU.C_POINTER.withName("deviceLostCallback"), - WGPU.C_POINTER.withName("deviceLostUserdata") - ).withName("WGPUDeviceDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfLong requiredFeatureCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("requiredFeatureCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t requiredFeatureCount - * } - */ - public static final OfLong requiredFeatureCount$layout() { - return requiredFeatureCount$LAYOUT; - } - - private static final long requiredFeatureCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t requiredFeatureCount - * } - */ - public static final long requiredFeatureCount$offset() { - return requiredFeatureCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t requiredFeatureCount - * } - */ - public static long requiredFeatureCount(MemorySegment struct) { - return struct.get(requiredFeatureCount$LAYOUT, requiredFeatureCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t requiredFeatureCount - * } - */ - public static void requiredFeatureCount(MemorySegment struct, long fieldValue) { - struct.set(requiredFeatureCount$LAYOUT, requiredFeatureCount$OFFSET, fieldValue); - } - - private static final AddressLayout requiredFeatures$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("requiredFeatures")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUFeatureName *requiredFeatures - * } - */ - public static final AddressLayout requiredFeatures$layout() { - return requiredFeatures$LAYOUT; - } - - private static final long requiredFeatures$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUFeatureName *requiredFeatures - * } - */ - public static final long requiredFeatures$offset() { - return requiredFeatures$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUFeatureName *requiredFeatures - * } - */ - public static MemorySegment requiredFeatures(MemorySegment struct) { - return struct.get(requiredFeatures$LAYOUT, requiredFeatures$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUFeatureName *requiredFeatures - * } - */ - public static void requiredFeatures(MemorySegment struct, MemorySegment fieldValue) { - struct.set(requiredFeatures$LAYOUT, requiredFeatures$OFFSET, fieldValue); - } - - private static final AddressLayout requiredLimits$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("requiredLimits")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPURequiredLimits *requiredLimits - * } - */ - public static final AddressLayout requiredLimits$layout() { - return requiredLimits$LAYOUT; - } - - private static final long requiredLimits$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPURequiredLimits *requiredLimits - * } - */ - public static final long requiredLimits$offset() { - return requiredLimits$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPURequiredLimits *requiredLimits - * } - */ - public static MemorySegment requiredLimits(MemorySegment struct) { - return struct.get(requiredLimits$LAYOUT, requiredLimits$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPURequiredLimits *requiredLimits - * } - */ - public static void requiredLimits(MemorySegment struct, MemorySegment fieldValue) { - struct.set(requiredLimits$LAYOUT, requiredLimits$OFFSET, fieldValue); - } - - private static final GroupLayout defaultQueue$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("defaultQueue")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUQueueDescriptor defaultQueue - * } - */ - public static final GroupLayout defaultQueue$layout() { - return defaultQueue$LAYOUT; - } - - private static final long defaultQueue$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUQueueDescriptor defaultQueue - * } - */ - public static final long defaultQueue$offset() { - return defaultQueue$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUQueueDescriptor defaultQueue - * } - */ - public static MemorySegment defaultQueue(MemorySegment struct) { - return struct.asSlice(defaultQueue$OFFSET, defaultQueue$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUQueueDescriptor defaultQueue - * } - */ - public static void defaultQueue(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, defaultQueue$OFFSET, defaultQueue$LAYOUT.byteSize()); - } - - private static final AddressLayout deviceLostCallback$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("deviceLostCallback")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUDeviceLostCallback deviceLostCallback - * } - */ - public static final AddressLayout deviceLostCallback$layout() { - return deviceLostCallback$LAYOUT; - } - - private static final long deviceLostCallback$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUDeviceLostCallback deviceLostCallback - * } - */ - public static final long deviceLostCallback$offset() { - return deviceLostCallback$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUDeviceLostCallback deviceLostCallback - * } - */ - public static MemorySegment deviceLostCallback(MemorySegment struct) { - return struct.get(deviceLostCallback$LAYOUT, deviceLostCallback$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUDeviceLostCallback deviceLostCallback - * } - */ - public static void deviceLostCallback(MemorySegment struct, MemorySegment fieldValue) { - struct.set(deviceLostCallback$LAYOUT, deviceLostCallback$OFFSET, fieldValue); - } - - private static final AddressLayout deviceLostUserdata$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("deviceLostUserdata")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *deviceLostUserdata - * } - */ - public static final AddressLayout deviceLostUserdata$layout() { - return deviceLostUserdata$LAYOUT; - } - - private static final long deviceLostUserdata$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * void *deviceLostUserdata - * } - */ - public static final long deviceLostUserdata$offset() { - return deviceLostUserdata$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *deviceLostUserdata - * } - */ - public static MemorySegment deviceLostUserdata(MemorySegment struct) { - return struct.get(deviceLostUserdata$LAYOUT, deviceLostUserdata$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *deviceLostUserdata - * } - */ - public static void deviceLostUserdata(MemorySegment struct, MemorySegment fieldValue) { - struct.set(deviceLostUserdata$LAYOUT, deviceLostUserdata$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceExtras.java deleted file mode 100644 index 8842e97d8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceExtras.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUDeviceExtras { - * WGPUChainedStruct chain; - * const char *tracePath; - * } - * } - */ -public class WGPUDeviceExtras { - - WGPUDeviceExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("tracePath") - ).withName("WGPUDeviceExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout tracePath$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("tracePath")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *tracePath - * } - */ - public static final AddressLayout tracePath$layout() { - return tracePath$LAYOUT; - } - - private static final long tracePath$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *tracePath - * } - */ - public static final long tracePath$offset() { - return tracePath$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *tracePath - * } - */ - public static MemorySegment tracePath(MemorySegment struct) { - return struct.get(tracePath$LAYOUT, tracePath$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *tracePath - * } - */ - public static void tracePath(MemorySegment struct, MemorySegment fieldValue) { - struct.set(tracePath$LAYOUT, tracePath$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceLostCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceLostCallback.java deleted file mode 100644 index 043392f13..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUDeviceLostCallback.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUDeviceLostCallback)(WGPUDeviceLostReason, const char *, void *) - * } - */ -public class WGPUDeviceLostCallback { - - WGPUDeviceLostCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int reason, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUDeviceLostCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUDeviceLostCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int reason, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, reason, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUErrorCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUErrorCallback.java deleted file mode 100644 index 5396d37d3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUErrorCallback.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUErrorCallback)(WGPUErrorType, const char *, void *) - * } - */ -public class WGPUErrorCallback { - - WGPUErrorCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int type, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUErrorCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUErrorCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int type, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, type, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUExtent3D.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUExtent3D.java deleted file mode 100644 index dfaa4afee..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUExtent3D.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUExtent3D { - * uint32_t width; - * uint32_t height; - * uint32_t depthOrArrayLayers; - * } - * } - */ -public class WGPUExtent3D { - - WGPUExtent3D() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("width"), - WGPU.C_INT.withName("height"), - WGPU.C_INT.withName("depthOrArrayLayers") - ).withName("WGPUExtent3D"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt width$LAYOUT = (OfInt)$LAYOUT.select(groupElement("width")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static final OfInt width$layout() { - return width$LAYOUT; - } - - private static final long width$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static final long width$offset() { - return width$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static int width(MemorySegment struct) { - return struct.get(width$LAYOUT, width$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static void width(MemorySegment struct, int fieldValue) { - struct.set(width$LAYOUT, width$OFFSET, fieldValue); - } - - private static final OfInt height$LAYOUT = (OfInt)$LAYOUT.select(groupElement("height")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static final OfInt height$layout() { - return height$LAYOUT; - } - - private static final long height$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static final long height$offset() { - return height$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static int height(MemorySegment struct) { - return struct.get(height$LAYOUT, height$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static void height(MemorySegment struct, int fieldValue) { - struct.set(height$LAYOUT, height$OFFSET, fieldValue); - } - - private static final OfInt depthOrArrayLayers$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthOrArrayLayers")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t depthOrArrayLayers - * } - */ - public static final OfInt depthOrArrayLayers$layout() { - return depthOrArrayLayers$LAYOUT; - } - - private static final long depthOrArrayLayers$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t depthOrArrayLayers - * } - */ - public static final long depthOrArrayLayers$offset() { - return depthOrArrayLayers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t depthOrArrayLayers - * } - */ - public static int depthOrArrayLayers(MemorySegment struct) { - return struct.get(depthOrArrayLayers$LAYOUT, depthOrArrayLayers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t depthOrArrayLayers - * } - */ - public static void depthOrArrayLayers(MemorySegment struct, int fieldValue) { - struct.set(depthOrArrayLayers$LAYOUT, depthOrArrayLayers$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUFragmentState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUFragmentState.java deleted file mode 100644 index bd7e68367..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUFragmentState.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUFragmentState { - * const WGPUChainedStruct *nextInChain; - * WGPUShaderModule module; - * const char *entryPoint; - * size_t constantCount; - * const WGPUConstantEntry *constants; - * size_t targetCount; - * const WGPUColorTargetState *targets; - * } - * } - */ -public class WGPUFragmentState { - - WGPUFragmentState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("module"), - WGPU.C_POINTER.withName("entryPoint"), - WGPU.C_LONG_LONG.withName("constantCount"), - WGPU.C_POINTER.withName("constants"), - WGPU.C_LONG_LONG.withName("targetCount"), - WGPU.C_POINTER.withName("targets") - ).withName("WGPUFragmentState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout module$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("module")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static final AddressLayout module$layout() { - return module$LAYOUT; - } - - private static final long module$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static final long module$offset() { - return module$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static MemorySegment module(MemorySegment struct) { - return struct.get(module$LAYOUT, module$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static void module(MemorySegment struct, MemorySegment fieldValue) { - struct.set(module$LAYOUT, module$OFFSET, fieldValue); - } - - private static final AddressLayout entryPoint$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("entryPoint")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final AddressLayout entryPoint$layout() { - return entryPoint$LAYOUT; - } - - private static final long entryPoint$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final long entryPoint$offset() { - return entryPoint$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static MemorySegment entryPoint(MemorySegment struct) { - return struct.get(entryPoint$LAYOUT, entryPoint$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static void entryPoint(MemorySegment struct, MemorySegment fieldValue) { - struct.set(entryPoint$LAYOUT, entryPoint$OFFSET, fieldValue); - } - - private static final OfLong constantCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("constantCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static final OfLong constantCount$layout() { - return constantCount$LAYOUT; - } - - private static final long constantCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static final long constantCount$offset() { - return constantCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static long constantCount(MemorySegment struct) { - return struct.get(constantCount$LAYOUT, constantCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static void constantCount(MemorySegment struct, long fieldValue) { - struct.set(constantCount$LAYOUT, constantCount$OFFSET, fieldValue); - } - - private static final AddressLayout constants$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("constants")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static final AddressLayout constants$layout() { - return constants$LAYOUT; - } - - private static final long constants$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static final long constants$offset() { - return constants$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static MemorySegment constants(MemorySegment struct) { - return struct.get(constants$LAYOUT, constants$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static void constants(MemorySegment struct, MemorySegment fieldValue) { - struct.set(constants$LAYOUT, constants$OFFSET, fieldValue); - } - - private static final OfLong targetCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("targetCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t targetCount - * } - */ - public static final OfLong targetCount$layout() { - return targetCount$LAYOUT; - } - - private static final long targetCount$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t targetCount - * } - */ - public static final long targetCount$offset() { - return targetCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t targetCount - * } - */ - public static long targetCount(MemorySegment struct) { - return struct.get(targetCount$LAYOUT, targetCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t targetCount - * } - */ - public static void targetCount(MemorySegment struct, long fieldValue) { - struct.set(targetCount$LAYOUT, targetCount$OFFSET, fieldValue); - } - - private static final AddressLayout targets$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("targets")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUColorTargetState *targets - * } - */ - public static final AddressLayout targets$layout() { - return targets$LAYOUT; - } - - private static final long targets$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUColorTargetState *targets - * } - */ - public static final long targets$offset() { - return targets$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUColorTargetState *targets - * } - */ - public static MemorySegment targets(MemorySegment struct) { - return struct.get(targets$LAYOUT, targets$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUColorTargetState *targets - * } - */ - public static void targets(MemorySegment struct, MemorySegment fieldValue) { - struct.set(targets$LAYOUT, targets$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUGlobalReport.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUGlobalReport.java deleted file mode 100644 index 0971123a9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUGlobalReport.java +++ /dev/null @@ -1,358 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUGlobalReport { - * WGPURegistryReport surfaces; - * WGPUBackendType backendType; - * WGPUHubReport vulkan; - * WGPUHubReport metal; - * WGPUHubReport dx12; - * WGPUHubReport gl; - * } - * } - */ -public class WGPUGlobalReport { - - WGPUGlobalReport() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPURegistryReport.layout().withName("surfaces"), - WGPU.C_INT.withName("backendType"), - MemoryLayout.paddingLayout(4), - WGPUHubReport.layout().withName("vulkan"), - WGPUHubReport.layout().withName("metal"), - WGPUHubReport.layout().withName("dx12"), - WGPUHubReport.layout().withName("gl") - ).withName("WGPUGlobalReport"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout surfaces$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("surfaces")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport surfaces - * } - */ - public static final GroupLayout surfaces$layout() { - return surfaces$LAYOUT; - } - - private static final long surfaces$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport surfaces - * } - */ - public static final long surfaces$offset() { - return surfaces$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport surfaces - * } - */ - public static MemorySegment surfaces(MemorySegment struct) { - return struct.asSlice(surfaces$OFFSET, surfaces$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport surfaces - * } - */ - public static void surfaces(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, surfaces$OFFSET, surfaces$LAYOUT.byteSize()); - } - - private static final OfInt backendType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("backendType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static final OfInt backendType$layout() { - return backendType$LAYOUT; - } - - private static final long backendType$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static final long backendType$offset() { - return backendType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static int backendType(MemorySegment struct) { - return struct.get(backendType$LAYOUT, backendType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static void backendType(MemorySegment struct, int fieldValue) { - struct.set(backendType$LAYOUT, backendType$OFFSET, fieldValue); - } - - private static final GroupLayout vulkan$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("vulkan")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUHubReport vulkan - * } - */ - public static final GroupLayout vulkan$layout() { - return vulkan$LAYOUT; - } - - private static final long vulkan$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUHubReport vulkan - * } - */ - public static final long vulkan$offset() { - return vulkan$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUHubReport vulkan - * } - */ - public static MemorySegment vulkan(MemorySegment struct) { - return struct.asSlice(vulkan$OFFSET, vulkan$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUHubReport vulkan - * } - */ - public static void vulkan(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, vulkan$OFFSET, vulkan$LAYOUT.byteSize()); - } - - private static final GroupLayout metal$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("metal")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUHubReport metal - * } - */ - public static final GroupLayout metal$layout() { - return metal$LAYOUT; - } - - private static final long metal$OFFSET = 688; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUHubReport metal - * } - */ - public static final long metal$offset() { - return metal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUHubReport metal - * } - */ - public static MemorySegment metal(MemorySegment struct) { - return struct.asSlice(metal$OFFSET, metal$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUHubReport metal - * } - */ - public static void metal(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, metal$OFFSET, metal$LAYOUT.byteSize()); - } - - private static final GroupLayout dx12$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dx12")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUHubReport dx12 - * } - */ - public static final GroupLayout dx12$layout() { - return dx12$LAYOUT; - } - - private static final long dx12$OFFSET = 1328; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUHubReport dx12 - * } - */ - public static final long dx12$offset() { - return dx12$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUHubReport dx12 - * } - */ - public static MemorySegment dx12(MemorySegment struct) { - return struct.asSlice(dx12$OFFSET, dx12$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUHubReport dx12 - * } - */ - public static void dx12(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dx12$OFFSET, dx12$LAYOUT.byteSize()); - } - - private static final GroupLayout gl$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gl")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUHubReport gl - * } - */ - public static final GroupLayout gl$layout() { - return gl$LAYOUT; - } - - private static final long gl$OFFSET = 1968; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUHubReport gl - * } - */ - public static final long gl$offset() { - return gl$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUHubReport gl - * } - */ - public static MemorySegment gl(MemorySegment struct) { - return struct.asSlice(gl$OFFSET, gl$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUHubReport gl - * } - */ - public static void gl(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gl$OFFSET, gl$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUHubReport.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUHubReport.java deleted file mode 100644 index 1c95e4eed..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUHubReport.java +++ /dev/null @@ -1,817 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUHubReport { - * WGPURegistryReport adapters; - * WGPURegistryReport devices; - * WGPURegistryReport queues; - * WGPURegistryReport pipelineLayouts; - * WGPURegistryReport shaderModules; - * WGPURegistryReport bindGroupLayouts; - * WGPURegistryReport bindGroups; - * WGPURegistryReport commandBuffers; - * WGPURegistryReport renderBundles; - * WGPURegistryReport renderPipelines; - * WGPURegistryReport computePipelines; - * WGPURegistryReport querySets; - * WGPURegistryReport buffers; - * WGPURegistryReport textures; - * WGPURegistryReport textureViews; - * WGPURegistryReport samplers; - * } - * } - */ -public class WGPUHubReport { - - WGPUHubReport() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPURegistryReport.layout().withName("adapters"), - WGPURegistryReport.layout().withName("devices"), - WGPURegistryReport.layout().withName("queues"), - WGPURegistryReport.layout().withName("pipelineLayouts"), - WGPURegistryReport.layout().withName("shaderModules"), - WGPURegistryReport.layout().withName("bindGroupLayouts"), - WGPURegistryReport.layout().withName("bindGroups"), - WGPURegistryReport.layout().withName("commandBuffers"), - WGPURegistryReport.layout().withName("renderBundles"), - WGPURegistryReport.layout().withName("renderPipelines"), - WGPURegistryReport.layout().withName("computePipelines"), - WGPURegistryReport.layout().withName("querySets"), - WGPURegistryReport.layout().withName("buffers"), - WGPURegistryReport.layout().withName("textures"), - WGPURegistryReport.layout().withName("textureViews"), - WGPURegistryReport.layout().withName("samplers") - ).withName("WGPUHubReport"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout adapters$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("adapters")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport adapters - * } - */ - public static final GroupLayout adapters$layout() { - return adapters$LAYOUT; - } - - private static final long adapters$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport adapters - * } - */ - public static final long adapters$offset() { - return adapters$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport adapters - * } - */ - public static MemorySegment adapters(MemorySegment struct) { - return struct.asSlice(adapters$OFFSET, adapters$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport adapters - * } - */ - public static void adapters(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, adapters$OFFSET, adapters$LAYOUT.byteSize()); - } - - private static final GroupLayout devices$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("devices")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport devices - * } - */ - public static final GroupLayout devices$layout() { - return devices$LAYOUT; - } - - private static final long devices$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport devices - * } - */ - public static final long devices$offset() { - return devices$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport devices - * } - */ - public static MemorySegment devices(MemorySegment struct) { - return struct.asSlice(devices$OFFSET, devices$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport devices - * } - */ - public static void devices(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, devices$OFFSET, devices$LAYOUT.byteSize()); - } - - private static final GroupLayout queues$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("queues")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport queues - * } - */ - public static final GroupLayout queues$layout() { - return queues$LAYOUT; - } - - private static final long queues$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport queues - * } - */ - public static final long queues$offset() { - return queues$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport queues - * } - */ - public static MemorySegment queues(MemorySegment struct) { - return struct.asSlice(queues$OFFSET, queues$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport queues - * } - */ - public static void queues(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, queues$OFFSET, queues$LAYOUT.byteSize()); - } - - private static final GroupLayout pipelineLayouts$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("pipelineLayouts")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport pipelineLayouts - * } - */ - public static final GroupLayout pipelineLayouts$layout() { - return pipelineLayouts$LAYOUT; - } - - private static final long pipelineLayouts$OFFSET = 120; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport pipelineLayouts - * } - */ - public static final long pipelineLayouts$offset() { - return pipelineLayouts$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport pipelineLayouts - * } - */ - public static MemorySegment pipelineLayouts(MemorySegment struct) { - return struct.asSlice(pipelineLayouts$OFFSET, pipelineLayouts$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport pipelineLayouts - * } - */ - public static void pipelineLayouts(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, pipelineLayouts$OFFSET, pipelineLayouts$LAYOUT.byteSize()); - } - - private static final GroupLayout shaderModules$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("shaderModules")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport shaderModules - * } - */ - public static final GroupLayout shaderModules$layout() { - return shaderModules$LAYOUT; - } - - private static final long shaderModules$OFFSET = 160; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport shaderModules - * } - */ - public static final long shaderModules$offset() { - return shaderModules$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport shaderModules - * } - */ - public static MemorySegment shaderModules(MemorySegment struct) { - return struct.asSlice(shaderModules$OFFSET, shaderModules$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport shaderModules - * } - */ - public static void shaderModules(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, shaderModules$OFFSET, shaderModules$LAYOUT.byteSize()); - } - - private static final GroupLayout bindGroupLayouts$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("bindGroupLayouts")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroupLayouts - * } - */ - public static final GroupLayout bindGroupLayouts$layout() { - return bindGroupLayouts$LAYOUT; - } - - private static final long bindGroupLayouts$OFFSET = 200; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroupLayouts - * } - */ - public static final long bindGroupLayouts$offset() { - return bindGroupLayouts$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroupLayouts - * } - */ - public static MemorySegment bindGroupLayouts(MemorySegment struct) { - return struct.asSlice(bindGroupLayouts$OFFSET, bindGroupLayouts$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroupLayouts - * } - */ - public static void bindGroupLayouts(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, bindGroupLayouts$OFFSET, bindGroupLayouts$LAYOUT.byteSize()); - } - - private static final GroupLayout bindGroups$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("bindGroups")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroups - * } - */ - public static final GroupLayout bindGroups$layout() { - return bindGroups$LAYOUT; - } - - private static final long bindGroups$OFFSET = 240; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroups - * } - */ - public static final long bindGroups$offset() { - return bindGroups$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroups - * } - */ - public static MemorySegment bindGroups(MemorySegment struct) { - return struct.asSlice(bindGroups$OFFSET, bindGroups$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport bindGroups - * } - */ - public static void bindGroups(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, bindGroups$OFFSET, bindGroups$LAYOUT.byteSize()); - } - - private static final GroupLayout commandBuffers$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("commandBuffers")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport commandBuffers - * } - */ - public static final GroupLayout commandBuffers$layout() { - return commandBuffers$LAYOUT; - } - - private static final long commandBuffers$OFFSET = 280; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport commandBuffers - * } - */ - public static final long commandBuffers$offset() { - return commandBuffers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport commandBuffers - * } - */ - public static MemorySegment commandBuffers(MemorySegment struct) { - return struct.asSlice(commandBuffers$OFFSET, commandBuffers$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport commandBuffers - * } - */ - public static void commandBuffers(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, commandBuffers$OFFSET, commandBuffers$LAYOUT.byteSize()); - } - - private static final GroupLayout renderBundles$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("renderBundles")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport renderBundles - * } - */ - public static final GroupLayout renderBundles$layout() { - return renderBundles$LAYOUT; - } - - private static final long renderBundles$OFFSET = 320; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport renderBundles - * } - */ - public static final long renderBundles$offset() { - return renderBundles$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport renderBundles - * } - */ - public static MemorySegment renderBundles(MemorySegment struct) { - return struct.asSlice(renderBundles$OFFSET, renderBundles$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport renderBundles - * } - */ - public static void renderBundles(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, renderBundles$OFFSET, renderBundles$LAYOUT.byteSize()); - } - - private static final GroupLayout renderPipelines$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("renderPipelines")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport renderPipelines - * } - */ - public static final GroupLayout renderPipelines$layout() { - return renderPipelines$LAYOUT; - } - - private static final long renderPipelines$OFFSET = 360; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport renderPipelines - * } - */ - public static final long renderPipelines$offset() { - return renderPipelines$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport renderPipelines - * } - */ - public static MemorySegment renderPipelines(MemorySegment struct) { - return struct.asSlice(renderPipelines$OFFSET, renderPipelines$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport renderPipelines - * } - */ - public static void renderPipelines(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, renderPipelines$OFFSET, renderPipelines$LAYOUT.byteSize()); - } - - private static final GroupLayout computePipelines$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("computePipelines")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport computePipelines - * } - */ - public static final GroupLayout computePipelines$layout() { - return computePipelines$LAYOUT; - } - - private static final long computePipelines$OFFSET = 400; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport computePipelines - * } - */ - public static final long computePipelines$offset() { - return computePipelines$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport computePipelines - * } - */ - public static MemorySegment computePipelines(MemorySegment struct) { - return struct.asSlice(computePipelines$OFFSET, computePipelines$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport computePipelines - * } - */ - public static void computePipelines(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, computePipelines$OFFSET, computePipelines$LAYOUT.byteSize()); - } - - private static final GroupLayout querySets$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("querySets")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport querySets - * } - */ - public static final GroupLayout querySets$layout() { - return querySets$LAYOUT; - } - - private static final long querySets$OFFSET = 440; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport querySets - * } - */ - public static final long querySets$offset() { - return querySets$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport querySets - * } - */ - public static MemorySegment querySets(MemorySegment struct) { - return struct.asSlice(querySets$OFFSET, querySets$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport querySets - * } - */ - public static void querySets(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, querySets$OFFSET, querySets$LAYOUT.byteSize()); - } - - private static final GroupLayout buffers$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("buffers")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport buffers - * } - */ - public static final GroupLayout buffers$layout() { - return buffers$LAYOUT; - } - - private static final long buffers$OFFSET = 480; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport buffers - * } - */ - public static final long buffers$offset() { - return buffers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport buffers - * } - */ - public static MemorySegment buffers(MemorySegment struct) { - return struct.asSlice(buffers$OFFSET, buffers$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport buffers - * } - */ - public static void buffers(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, buffers$OFFSET, buffers$LAYOUT.byteSize()); - } - - private static final GroupLayout textures$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("textures")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport textures - * } - */ - public static final GroupLayout textures$layout() { - return textures$LAYOUT; - } - - private static final long textures$OFFSET = 520; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport textures - * } - */ - public static final long textures$offset() { - return textures$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport textures - * } - */ - public static MemorySegment textures(MemorySegment struct) { - return struct.asSlice(textures$OFFSET, textures$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport textures - * } - */ - public static void textures(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, textures$OFFSET, textures$LAYOUT.byteSize()); - } - - private static final GroupLayout textureViews$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("textureViews")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport textureViews - * } - */ - public static final GroupLayout textureViews$layout() { - return textureViews$LAYOUT; - } - - private static final long textureViews$OFFSET = 560; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport textureViews - * } - */ - public static final long textureViews$offset() { - return textureViews$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport textureViews - * } - */ - public static MemorySegment textureViews(MemorySegment struct) { - return struct.asSlice(textureViews$OFFSET, textureViews$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport textureViews - * } - */ - public static void textureViews(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, textureViews$OFFSET, textureViews$LAYOUT.byteSize()); - } - - private static final GroupLayout samplers$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("samplers")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPURegistryReport samplers - * } - */ - public static final GroupLayout samplers$layout() { - return samplers$LAYOUT; - } - - private static final long samplers$OFFSET = 600; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPURegistryReport samplers - * } - */ - public static final long samplers$offset() { - return samplers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPURegistryReport samplers - * } - */ - public static MemorySegment samplers(MemorySegment struct) { - return struct.asSlice(samplers$OFFSET, samplers$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPURegistryReport samplers - * } - */ - public static void samplers(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, samplers$OFFSET, samplers$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUImageCopyBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUImageCopyBuffer.java deleted file mode 100644 index 5c0e9bdec..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUImageCopyBuffer.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUImageCopyBuffer { - * const WGPUChainedStruct *nextInChain; - * WGPUTextureDataLayout layout; - * WGPUBuffer buffer; - * } - * } - */ -public class WGPUImageCopyBuffer { - - WGPUImageCopyBuffer() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPUTextureDataLayout.layout().withName("layout"), - WGPU.C_POINTER.withName("buffer") - ).withName("WGPUImageCopyBuffer"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final GroupLayout layout$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("layout")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureDataLayout layout - * } - */ - public static final GroupLayout layout$layout() { - return layout$LAYOUT; - } - - private static final long layout$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureDataLayout layout - * } - */ - public static final long layout$offset() { - return layout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureDataLayout layout - * } - */ - public static MemorySegment layout(MemorySegment struct) { - return struct.asSlice(layout$OFFSET, layout$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureDataLayout layout - * } - */ - public static void layout(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, layout$OFFSET, layout$LAYOUT.byteSize()); - } - - private static final AddressLayout buffer$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("buffer")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static final AddressLayout buffer$layout() { - return buffer$LAYOUT; - } - - private static final long buffer$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static final long buffer$offset() { - return buffer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static MemorySegment buffer(MemorySegment struct) { - return struct.get(buffer$LAYOUT, buffer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBuffer buffer - * } - */ - public static void buffer(MemorySegment struct, MemorySegment fieldValue) { - struct.set(buffer$LAYOUT, buffer$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUImageCopyTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUImageCopyTexture.java deleted file mode 100644 index 6708dac34..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUImageCopyTexture.java +++ /dev/null @@ -1,312 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUImageCopyTexture { - * const WGPUChainedStruct *nextInChain; - * WGPUTexture texture; - * uint32_t mipLevel; - * WGPUOrigin3D origin; - * WGPUTextureAspect aspect; - * } - * } - */ -public class WGPUImageCopyTexture { - - WGPUImageCopyTexture() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("texture"), - WGPU.C_INT.withName("mipLevel"), - WGPUOrigin3D.layout().withName("origin"), - WGPU.C_INT.withName("aspect"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUImageCopyTexture"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout texture$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("texture")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static final AddressLayout texture$layout() { - return texture$LAYOUT; - } - - private static final long texture$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static final long texture$offset() { - return texture$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static MemorySegment texture(MemorySegment struct) { - return struct.get(texture$LAYOUT, texture$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static void texture(MemorySegment struct, MemorySegment fieldValue) { - struct.set(texture$LAYOUT, texture$OFFSET, fieldValue); - } - - private static final OfInt mipLevel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mipLevel")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t mipLevel - * } - */ - public static final OfInt mipLevel$layout() { - return mipLevel$LAYOUT; - } - - private static final long mipLevel$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t mipLevel - * } - */ - public static final long mipLevel$offset() { - return mipLevel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t mipLevel - * } - */ - public static int mipLevel(MemorySegment struct) { - return struct.get(mipLevel$LAYOUT, mipLevel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t mipLevel - * } - */ - public static void mipLevel(MemorySegment struct, int fieldValue) { - struct.set(mipLevel$LAYOUT, mipLevel$OFFSET, fieldValue); - } - - private static final GroupLayout origin$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("origin")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUOrigin3D origin - * } - */ - public static final GroupLayout origin$layout() { - return origin$LAYOUT; - } - - private static final long origin$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUOrigin3D origin - * } - */ - public static final long origin$offset() { - return origin$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUOrigin3D origin - * } - */ - public static MemorySegment origin(MemorySegment struct) { - return struct.asSlice(origin$OFFSET, origin$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUOrigin3D origin - * } - */ - public static void origin(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, origin$OFFSET, origin$LAYOUT.byteSize()); - } - - private static final OfInt aspect$LAYOUT = (OfInt)$LAYOUT.select(groupElement("aspect")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static final OfInt aspect$layout() { - return aspect$LAYOUT; - } - - private static final long aspect$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static final long aspect$offset() { - return aspect$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static int aspect(MemorySegment struct) { - return struct.get(aspect$LAYOUT, aspect$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static void aspect(MemorySegment struct, int fieldValue) { - struct.set(aspect$LAYOUT, aspect$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceDescriptor.java deleted file mode 100644 index cc01447f6..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceDescriptor.java +++ /dev/null @@ -1,127 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUInstanceDescriptor { - * const WGPUChainedStruct *nextInChain; - * } - * } - */ -public class WGPUInstanceDescriptor { - - WGPUInstanceDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain") - ).withName("WGPUInstanceDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceEnumerateAdapterOptions.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceEnumerateAdapterOptions.java deleted file mode 100644 index 8371fb612..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceEnumerateAdapterOptions.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUInstanceEnumerateAdapterOptions { - * const WGPUChainedStruct *nextInChain; - * WGPUInstanceBackendFlags backends; - * } - * } - */ -public class WGPUInstanceEnumerateAdapterOptions { - - WGPUInstanceEnumerateAdapterOptions() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("backends"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUInstanceEnumerateAdapterOptions"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt backends$LAYOUT = (OfInt)$LAYOUT.select(groupElement("backends")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static final OfInt backends$layout() { - return backends$LAYOUT; - } - - private static final long backends$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static final long backends$offset() { - return backends$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static int backends(MemorySegment struct) { - return struct.get(backends$LAYOUT, backends$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static void backends(MemorySegment struct, int fieldValue) { - struct.set(backends$LAYOUT, backends$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceExtras.java deleted file mode 100644 index b085826c9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUInstanceExtras.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUInstanceExtras { - * WGPUChainedStruct chain; - * WGPUInstanceBackendFlags backends; - * WGPUInstanceFlags flags; - * WGPUDx12Compiler dx12ShaderCompiler; - * WGPUGles3MinorVersion gles3MinorVersion; - * const char *dxilPath; - * const char *dxcPath; - * } - * } - */ -public class WGPUInstanceExtras { - - WGPUInstanceExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_INT.withName("backends"), - WGPU.C_INT.withName("flags"), - WGPU.C_INT.withName("dx12ShaderCompiler"), - WGPU.C_INT.withName("gles3MinorVersion"), - WGPU.C_POINTER.withName("dxilPath"), - WGPU.C_POINTER.withName("dxcPath") - ).withName("WGPUInstanceExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfInt backends$LAYOUT = (OfInt)$LAYOUT.select(groupElement("backends")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static final OfInt backends$layout() { - return backends$LAYOUT; - } - - private static final long backends$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static final long backends$offset() { - return backends$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static int backends(MemorySegment struct) { - return struct.get(backends$LAYOUT, backends$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUInstanceBackendFlags backends - * } - */ - public static void backends(MemorySegment struct, int fieldValue) { - struct.set(backends$LAYOUT, backends$OFFSET, fieldValue); - } - - private static final OfInt flags$LAYOUT = (OfInt)$LAYOUT.select(groupElement("flags")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUInstanceFlags flags - * } - */ - public static final OfInt flags$layout() { - return flags$LAYOUT; - } - - private static final long flags$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUInstanceFlags flags - * } - */ - public static final long flags$offset() { - return flags$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUInstanceFlags flags - * } - */ - public static int flags(MemorySegment struct) { - return struct.get(flags$LAYOUT, flags$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUInstanceFlags flags - * } - */ - public static void flags(MemorySegment struct, int fieldValue) { - struct.set(flags$LAYOUT, flags$OFFSET, fieldValue); - } - - private static final OfInt dx12ShaderCompiler$LAYOUT = (OfInt)$LAYOUT.select(groupElement("dx12ShaderCompiler")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUDx12Compiler dx12ShaderCompiler - * } - */ - public static final OfInt dx12ShaderCompiler$layout() { - return dx12ShaderCompiler$LAYOUT; - } - - private static final long dx12ShaderCompiler$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUDx12Compiler dx12ShaderCompiler - * } - */ - public static final long dx12ShaderCompiler$offset() { - return dx12ShaderCompiler$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUDx12Compiler dx12ShaderCompiler - * } - */ - public static int dx12ShaderCompiler(MemorySegment struct) { - return struct.get(dx12ShaderCompiler$LAYOUT, dx12ShaderCompiler$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUDx12Compiler dx12ShaderCompiler - * } - */ - public static void dx12ShaderCompiler(MemorySegment struct, int fieldValue) { - struct.set(dx12ShaderCompiler$LAYOUT, dx12ShaderCompiler$OFFSET, fieldValue); - } - - private static final OfInt gles3MinorVersion$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gles3MinorVersion")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUGles3MinorVersion gles3MinorVersion - * } - */ - public static final OfInt gles3MinorVersion$layout() { - return gles3MinorVersion$LAYOUT; - } - - private static final long gles3MinorVersion$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUGles3MinorVersion gles3MinorVersion - * } - */ - public static final long gles3MinorVersion$offset() { - return gles3MinorVersion$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUGles3MinorVersion gles3MinorVersion - * } - */ - public static int gles3MinorVersion(MemorySegment struct) { - return struct.get(gles3MinorVersion$LAYOUT, gles3MinorVersion$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUGles3MinorVersion gles3MinorVersion - * } - */ - public static void gles3MinorVersion(MemorySegment struct, int fieldValue) { - struct.set(gles3MinorVersion$LAYOUT, gles3MinorVersion$OFFSET, fieldValue); - } - - private static final AddressLayout dxilPath$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("dxilPath")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *dxilPath - * } - */ - public static final AddressLayout dxilPath$layout() { - return dxilPath$LAYOUT; - } - - private static final long dxilPath$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *dxilPath - * } - */ - public static final long dxilPath$offset() { - return dxilPath$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *dxilPath - * } - */ - public static MemorySegment dxilPath(MemorySegment struct) { - return struct.get(dxilPath$LAYOUT, dxilPath$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *dxilPath - * } - */ - public static void dxilPath(MemorySegment struct, MemorySegment fieldValue) { - struct.set(dxilPath$LAYOUT, dxilPath$OFFSET, fieldValue); - } - - private static final AddressLayout dxcPath$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("dxcPath")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *dxcPath - * } - */ - public static final AddressLayout dxcPath$layout() { - return dxcPath$LAYOUT; - } - - private static final long dxcPath$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *dxcPath - * } - */ - public static final long dxcPath$offset() { - return dxcPath$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *dxcPath - * } - */ - public static MemorySegment dxcPath(MemorySegment struct) { - return struct.get(dxcPath$LAYOUT, dxcPath$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *dxcPath - * } - */ - public static void dxcPath(MemorySegment struct, MemorySegment fieldValue) { - struct.set(dxcPath$LAYOUT, dxcPath$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPULimits.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPULimits.java deleted file mode 100644 index 02390ea34..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPULimits.java +++ /dev/null @@ -1,1554 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPULimits { - * uint32_t maxTextureDimension1D; - * uint32_t maxTextureDimension2D; - * uint32_t maxTextureDimension3D; - * uint32_t maxTextureArrayLayers; - * uint32_t maxBindGroups; - * uint32_t maxBindGroupsPlusVertexBuffers; - * uint32_t maxBindingsPerBindGroup; - * uint32_t maxDynamicUniformBuffersPerPipelineLayout; - * uint32_t maxDynamicStorageBuffersPerPipelineLayout; - * uint32_t maxSampledTexturesPerShaderStage; - * uint32_t maxSamplersPerShaderStage; - * uint32_t maxStorageBuffersPerShaderStage; - * uint32_t maxStorageTexturesPerShaderStage; - * uint32_t maxUniformBuffersPerShaderStage; - * uint64_t maxUniformBufferBindingSize; - * uint64_t maxStorageBufferBindingSize; - * uint32_t minUniformBufferOffsetAlignment; - * uint32_t minStorageBufferOffsetAlignment; - * uint32_t maxVertexBuffers; - * uint64_t maxBufferSize; - * uint32_t maxVertexAttributes; - * uint32_t maxVertexBufferArrayStride; - * uint32_t maxInterStageShaderComponents; - * uint32_t maxInterStageShaderVariables; - * uint32_t maxColorAttachments; - * uint32_t maxColorAttachmentBytesPerSample; - * uint32_t maxComputeWorkgroupStorageSize; - * uint32_t maxComputeInvocationsPerWorkgroup; - * uint32_t maxComputeWorkgroupSizeX; - * uint32_t maxComputeWorkgroupSizeY; - * uint32_t maxComputeWorkgroupSizeZ; - * uint32_t maxComputeWorkgroupsPerDimension; - * } - * } - */ -public class WGPULimits { - - WGPULimits() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("maxTextureDimension1D"), - WGPU.C_INT.withName("maxTextureDimension2D"), - WGPU.C_INT.withName("maxTextureDimension3D"), - WGPU.C_INT.withName("maxTextureArrayLayers"), - WGPU.C_INT.withName("maxBindGroups"), - WGPU.C_INT.withName("maxBindGroupsPlusVertexBuffers"), - WGPU.C_INT.withName("maxBindingsPerBindGroup"), - WGPU.C_INT.withName("maxDynamicUniformBuffersPerPipelineLayout"), - WGPU.C_INT.withName("maxDynamicStorageBuffersPerPipelineLayout"), - WGPU.C_INT.withName("maxSampledTexturesPerShaderStage"), - WGPU.C_INT.withName("maxSamplersPerShaderStage"), - WGPU.C_INT.withName("maxStorageBuffersPerShaderStage"), - WGPU.C_INT.withName("maxStorageTexturesPerShaderStage"), - WGPU.C_INT.withName("maxUniformBuffersPerShaderStage"), - WGPU.C_LONG_LONG.withName("maxUniformBufferBindingSize"), - WGPU.C_LONG_LONG.withName("maxStorageBufferBindingSize"), - WGPU.C_INT.withName("minUniformBufferOffsetAlignment"), - WGPU.C_INT.withName("minStorageBufferOffsetAlignment"), - WGPU.C_INT.withName("maxVertexBuffers"), - MemoryLayout.paddingLayout(4), - WGPU.C_LONG_LONG.withName("maxBufferSize"), - WGPU.C_INT.withName("maxVertexAttributes"), - WGPU.C_INT.withName("maxVertexBufferArrayStride"), - WGPU.C_INT.withName("maxInterStageShaderComponents"), - WGPU.C_INT.withName("maxInterStageShaderVariables"), - WGPU.C_INT.withName("maxColorAttachments"), - WGPU.C_INT.withName("maxColorAttachmentBytesPerSample"), - WGPU.C_INT.withName("maxComputeWorkgroupStorageSize"), - WGPU.C_INT.withName("maxComputeInvocationsPerWorkgroup"), - WGPU.C_INT.withName("maxComputeWorkgroupSizeX"), - WGPU.C_INT.withName("maxComputeWorkgroupSizeY"), - WGPU.C_INT.withName("maxComputeWorkgroupSizeZ"), - WGPU.C_INT.withName("maxComputeWorkgroupsPerDimension") - ).withName("WGPULimits"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt maxTextureDimension1D$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxTextureDimension1D")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension1D - * } - */ - public static final OfInt maxTextureDimension1D$layout() { - return maxTextureDimension1D$LAYOUT; - } - - private static final long maxTextureDimension1D$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension1D - * } - */ - public static final long maxTextureDimension1D$offset() { - return maxTextureDimension1D$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension1D - * } - */ - public static int maxTextureDimension1D(MemorySegment struct) { - return struct.get(maxTextureDimension1D$LAYOUT, maxTextureDimension1D$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension1D - * } - */ - public static void maxTextureDimension1D(MemorySegment struct, int fieldValue) { - struct.set(maxTextureDimension1D$LAYOUT, maxTextureDimension1D$OFFSET, fieldValue); - } - - private static final OfInt maxTextureDimension2D$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxTextureDimension2D")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension2D - * } - */ - public static final OfInt maxTextureDimension2D$layout() { - return maxTextureDimension2D$LAYOUT; - } - - private static final long maxTextureDimension2D$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension2D - * } - */ - public static final long maxTextureDimension2D$offset() { - return maxTextureDimension2D$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension2D - * } - */ - public static int maxTextureDimension2D(MemorySegment struct) { - return struct.get(maxTextureDimension2D$LAYOUT, maxTextureDimension2D$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension2D - * } - */ - public static void maxTextureDimension2D(MemorySegment struct, int fieldValue) { - struct.set(maxTextureDimension2D$LAYOUT, maxTextureDimension2D$OFFSET, fieldValue); - } - - private static final OfInt maxTextureDimension3D$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxTextureDimension3D")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension3D - * } - */ - public static final OfInt maxTextureDimension3D$layout() { - return maxTextureDimension3D$LAYOUT; - } - - private static final long maxTextureDimension3D$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension3D - * } - */ - public static final long maxTextureDimension3D$offset() { - return maxTextureDimension3D$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension3D - * } - */ - public static int maxTextureDimension3D(MemorySegment struct) { - return struct.get(maxTextureDimension3D$LAYOUT, maxTextureDimension3D$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxTextureDimension3D - * } - */ - public static void maxTextureDimension3D(MemorySegment struct, int fieldValue) { - struct.set(maxTextureDimension3D$LAYOUT, maxTextureDimension3D$OFFSET, fieldValue); - } - - private static final OfInt maxTextureArrayLayers$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxTextureArrayLayers")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxTextureArrayLayers - * } - */ - public static final OfInt maxTextureArrayLayers$layout() { - return maxTextureArrayLayers$LAYOUT; - } - - private static final long maxTextureArrayLayers$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxTextureArrayLayers - * } - */ - public static final long maxTextureArrayLayers$offset() { - return maxTextureArrayLayers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxTextureArrayLayers - * } - */ - public static int maxTextureArrayLayers(MemorySegment struct) { - return struct.get(maxTextureArrayLayers$LAYOUT, maxTextureArrayLayers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxTextureArrayLayers - * } - */ - public static void maxTextureArrayLayers(MemorySegment struct, int fieldValue) { - struct.set(maxTextureArrayLayers$LAYOUT, maxTextureArrayLayers$OFFSET, fieldValue); - } - - private static final OfInt maxBindGroups$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxBindGroups")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxBindGroups - * } - */ - public static final OfInt maxBindGroups$layout() { - return maxBindGroups$LAYOUT; - } - - private static final long maxBindGroups$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxBindGroups - * } - */ - public static final long maxBindGroups$offset() { - return maxBindGroups$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxBindGroups - * } - */ - public static int maxBindGroups(MemorySegment struct) { - return struct.get(maxBindGroups$LAYOUT, maxBindGroups$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxBindGroups - * } - */ - public static void maxBindGroups(MemorySegment struct, int fieldValue) { - struct.set(maxBindGroups$LAYOUT, maxBindGroups$OFFSET, fieldValue); - } - - private static final OfInt maxBindGroupsPlusVertexBuffers$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxBindGroupsPlusVertexBuffers")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxBindGroupsPlusVertexBuffers - * } - */ - public static final OfInt maxBindGroupsPlusVertexBuffers$layout() { - return maxBindGroupsPlusVertexBuffers$LAYOUT; - } - - private static final long maxBindGroupsPlusVertexBuffers$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxBindGroupsPlusVertexBuffers - * } - */ - public static final long maxBindGroupsPlusVertexBuffers$offset() { - return maxBindGroupsPlusVertexBuffers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxBindGroupsPlusVertexBuffers - * } - */ - public static int maxBindGroupsPlusVertexBuffers(MemorySegment struct) { - return struct.get(maxBindGroupsPlusVertexBuffers$LAYOUT, maxBindGroupsPlusVertexBuffers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxBindGroupsPlusVertexBuffers - * } - */ - public static void maxBindGroupsPlusVertexBuffers(MemorySegment struct, int fieldValue) { - struct.set(maxBindGroupsPlusVertexBuffers$LAYOUT, maxBindGroupsPlusVertexBuffers$OFFSET, fieldValue); - } - - private static final OfInt maxBindingsPerBindGroup$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxBindingsPerBindGroup")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxBindingsPerBindGroup - * } - */ - public static final OfInt maxBindingsPerBindGroup$layout() { - return maxBindingsPerBindGroup$LAYOUT; - } - - private static final long maxBindingsPerBindGroup$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxBindingsPerBindGroup - * } - */ - public static final long maxBindingsPerBindGroup$offset() { - return maxBindingsPerBindGroup$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxBindingsPerBindGroup - * } - */ - public static int maxBindingsPerBindGroup(MemorySegment struct) { - return struct.get(maxBindingsPerBindGroup$LAYOUT, maxBindingsPerBindGroup$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxBindingsPerBindGroup - * } - */ - public static void maxBindingsPerBindGroup(MemorySegment struct, int fieldValue) { - struct.set(maxBindingsPerBindGroup$LAYOUT, maxBindingsPerBindGroup$OFFSET, fieldValue); - } - - private static final OfInt maxDynamicUniformBuffersPerPipelineLayout$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxDynamicUniformBuffersPerPipelineLayout")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxDynamicUniformBuffersPerPipelineLayout - * } - */ - public static final OfInt maxDynamicUniformBuffersPerPipelineLayout$layout() { - return maxDynamicUniformBuffersPerPipelineLayout$LAYOUT; - } - - private static final long maxDynamicUniformBuffersPerPipelineLayout$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxDynamicUniformBuffersPerPipelineLayout - * } - */ - public static final long maxDynamicUniformBuffersPerPipelineLayout$offset() { - return maxDynamicUniformBuffersPerPipelineLayout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxDynamicUniformBuffersPerPipelineLayout - * } - */ - public static int maxDynamicUniformBuffersPerPipelineLayout(MemorySegment struct) { - return struct.get(maxDynamicUniformBuffersPerPipelineLayout$LAYOUT, maxDynamicUniformBuffersPerPipelineLayout$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxDynamicUniformBuffersPerPipelineLayout - * } - */ - public static void maxDynamicUniformBuffersPerPipelineLayout(MemorySegment struct, int fieldValue) { - struct.set(maxDynamicUniformBuffersPerPipelineLayout$LAYOUT, maxDynamicUniformBuffersPerPipelineLayout$OFFSET, fieldValue); - } - - private static final OfInt maxDynamicStorageBuffersPerPipelineLayout$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxDynamicStorageBuffersPerPipelineLayout")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxDynamicStorageBuffersPerPipelineLayout - * } - */ - public static final OfInt maxDynamicStorageBuffersPerPipelineLayout$layout() { - return maxDynamicStorageBuffersPerPipelineLayout$LAYOUT; - } - - private static final long maxDynamicStorageBuffersPerPipelineLayout$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxDynamicStorageBuffersPerPipelineLayout - * } - */ - public static final long maxDynamicStorageBuffersPerPipelineLayout$offset() { - return maxDynamicStorageBuffersPerPipelineLayout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxDynamicStorageBuffersPerPipelineLayout - * } - */ - public static int maxDynamicStorageBuffersPerPipelineLayout(MemorySegment struct) { - return struct.get(maxDynamicStorageBuffersPerPipelineLayout$LAYOUT, maxDynamicStorageBuffersPerPipelineLayout$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxDynamicStorageBuffersPerPipelineLayout - * } - */ - public static void maxDynamicStorageBuffersPerPipelineLayout(MemorySegment struct, int fieldValue) { - struct.set(maxDynamicStorageBuffersPerPipelineLayout$LAYOUT, maxDynamicStorageBuffersPerPipelineLayout$OFFSET, fieldValue); - } - - private static final OfInt maxSampledTexturesPerShaderStage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxSampledTexturesPerShaderStage")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxSampledTexturesPerShaderStage - * } - */ - public static final OfInt maxSampledTexturesPerShaderStage$layout() { - return maxSampledTexturesPerShaderStage$LAYOUT; - } - - private static final long maxSampledTexturesPerShaderStage$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxSampledTexturesPerShaderStage - * } - */ - public static final long maxSampledTexturesPerShaderStage$offset() { - return maxSampledTexturesPerShaderStage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxSampledTexturesPerShaderStage - * } - */ - public static int maxSampledTexturesPerShaderStage(MemorySegment struct) { - return struct.get(maxSampledTexturesPerShaderStage$LAYOUT, maxSampledTexturesPerShaderStage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxSampledTexturesPerShaderStage - * } - */ - public static void maxSampledTexturesPerShaderStage(MemorySegment struct, int fieldValue) { - struct.set(maxSampledTexturesPerShaderStage$LAYOUT, maxSampledTexturesPerShaderStage$OFFSET, fieldValue); - } - - private static final OfInt maxSamplersPerShaderStage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxSamplersPerShaderStage")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxSamplersPerShaderStage - * } - */ - public static final OfInt maxSamplersPerShaderStage$layout() { - return maxSamplersPerShaderStage$LAYOUT; - } - - private static final long maxSamplersPerShaderStage$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxSamplersPerShaderStage - * } - */ - public static final long maxSamplersPerShaderStage$offset() { - return maxSamplersPerShaderStage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxSamplersPerShaderStage - * } - */ - public static int maxSamplersPerShaderStage(MemorySegment struct) { - return struct.get(maxSamplersPerShaderStage$LAYOUT, maxSamplersPerShaderStage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxSamplersPerShaderStage - * } - */ - public static void maxSamplersPerShaderStage(MemorySegment struct, int fieldValue) { - struct.set(maxSamplersPerShaderStage$LAYOUT, maxSamplersPerShaderStage$OFFSET, fieldValue); - } - - private static final OfInt maxStorageBuffersPerShaderStage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxStorageBuffersPerShaderStage")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxStorageBuffersPerShaderStage - * } - */ - public static final OfInt maxStorageBuffersPerShaderStage$layout() { - return maxStorageBuffersPerShaderStage$LAYOUT; - } - - private static final long maxStorageBuffersPerShaderStage$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxStorageBuffersPerShaderStage - * } - */ - public static final long maxStorageBuffersPerShaderStage$offset() { - return maxStorageBuffersPerShaderStage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxStorageBuffersPerShaderStage - * } - */ - public static int maxStorageBuffersPerShaderStage(MemorySegment struct) { - return struct.get(maxStorageBuffersPerShaderStage$LAYOUT, maxStorageBuffersPerShaderStage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxStorageBuffersPerShaderStage - * } - */ - public static void maxStorageBuffersPerShaderStage(MemorySegment struct, int fieldValue) { - struct.set(maxStorageBuffersPerShaderStage$LAYOUT, maxStorageBuffersPerShaderStage$OFFSET, fieldValue); - } - - private static final OfInt maxStorageTexturesPerShaderStage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxStorageTexturesPerShaderStage")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxStorageTexturesPerShaderStage - * } - */ - public static final OfInt maxStorageTexturesPerShaderStage$layout() { - return maxStorageTexturesPerShaderStage$LAYOUT; - } - - private static final long maxStorageTexturesPerShaderStage$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxStorageTexturesPerShaderStage - * } - */ - public static final long maxStorageTexturesPerShaderStage$offset() { - return maxStorageTexturesPerShaderStage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxStorageTexturesPerShaderStage - * } - */ - public static int maxStorageTexturesPerShaderStage(MemorySegment struct) { - return struct.get(maxStorageTexturesPerShaderStage$LAYOUT, maxStorageTexturesPerShaderStage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxStorageTexturesPerShaderStage - * } - */ - public static void maxStorageTexturesPerShaderStage(MemorySegment struct, int fieldValue) { - struct.set(maxStorageTexturesPerShaderStage$LAYOUT, maxStorageTexturesPerShaderStage$OFFSET, fieldValue); - } - - private static final OfInt maxUniformBuffersPerShaderStage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxUniformBuffersPerShaderStage")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxUniformBuffersPerShaderStage - * } - */ - public static final OfInt maxUniformBuffersPerShaderStage$layout() { - return maxUniformBuffersPerShaderStage$LAYOUT; - } - - private static final long maxUniformBuffersPerShaderStage$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxUniformBuffersPerShaderStage - * } - */ - public static final long maxUniformBuffersPerShaderStage$offset() { - return maxUniformBuffersPerShaderStage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxUniformBuffersPerShaderStage - * } - */ - public static int maxUniformBuffersPerShaderStage(MemorySegment struct) { - return struct.get(maxUniformBuffersPerShaderStage$LAYOUT, maxUniformBuffersPerShaderStage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxUniformBuffersPerShaderStage - * } - */ - public static void maxUniformBuffersPerShaderStage(MemorySegment struct, int fieldValue) { - struct.set(maxUniformBuffersPerShaderStage$LAYOUT, maxUniformBuffersPerShaderStage$OFFSET, fieldValue); - } - - private static final OfLong maxUniformBufferBindingSize$LAYOUT = (OfLong)$LAYOUT.select(groupElement("maxUniformBufferBindingSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t maxUniformBufferBindingSize - * } - */ - public static final OfLong maxUniformBufferBindingSize$layout() { - return maxUniformBufferBindingSize$LAYOUT; - } - - private static final long maxUniformBufferBindingSize$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t maxUniformBufferBindingSize - * } - */ - public static final long maxUniformBufferBindingSize$offset() { - return maxUniformBufferBindingSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t maxUniformBufferBindingSize - * } - */ - public static long maxUniformBufferBindingSize(MemorySegment struct) { - return struct.get(maxUniformBufferBindingSize$LAYOUT, maxUniformBufferBindingSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t maxUniformBufferBindingSize - * } - */ - public static void maxUniformBufferBindingSize(MemorySegment struct, long fieldValue) { - struct.set(maxUniformBufferBindingSize$LAYOUT, maxUniformBufferBindingSize$OFFSET, fieldValue); - } - - private static final OfLong maxStorageBufferBindingSize$LAYOUT = (OfLong)$LAYOUT.select(groupElement("maxStorageBufferBindingSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t maxStorageBufferBindingSize - * } - */ - public static final OfLong maxStorageBufferBindingSize$layout() { - return maxStorageBufferBindingSize$LAYOUT; - } - - private static final long maxStorageBufferBindingSize$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t maxStorageBufferBindingSize - * } - */ - public static final long maxStorageBufferBindingSize$offset() { - return maxStorageBufferBindingSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t maxStorageBufferBindingSize - * } - */ - public static long maxStorageBufferBindingSize(MemorySegment struct) { - return struct.get(maxStorageBufferBindingSize$LAYOUT, maxStorageBufferBindingSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t maxStorageBufferBindingSize - * } - */ - public static void maxStorageBufferBindingSize(MemorySegment struct, long fieldValue) { - struct.set(maxStorageBufferBindingSize$LAYOUT, maxStorageBufferBindingSize$OFFSET, fieldValue); - } - - private static final OfInt minUniformBufferOffsetAlignment$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minUniformBufferOffsetAlignment")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t minUniformBufferOffsetAlignment - * } - */ - public static final OfInt minUniformBufferOffsetAlignment$layout() { - return minUniformBufferOffsetAlignment$LAYOUT; - } - - private static final long minUniformBufferOffsetAlignment$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t minUniformBufferOffsetAlignment - * } - */ - public static final long minUniformBufferOffsetAlignment$offset() { - return minUniformBufferOffsetAlignment$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t minUniformBufferOffsetAlignment - * } - */ - public static int minUniformBufferOffsetAlignment(MemorySegment struct) { - return struct.get(minUniformBufferOffsetAlignment$LAYOUT, minUniformBufferOffsetAlignment$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t minUniformBufferOffsetAlignment - * } - */ - public static void minUniformBufferOffsetAlignment(MemorySegment struct, int fieldValue) { - struct.set(minUniformBufferOffsetAlignment$LAYOUT, minUniformBufferOffsetAlignment$OFFSET, fieldValue); - } - - private static final OfInt minStorageBufferOffsetAlignment$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minStorageBufferOffsetAlignment")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t minStorageBufferOffsetAlignment - * } - */ - public static final OfInt minStorageBufferOffsetAlignment$layout() { - return minStorageBufferOffsetAlignment$LAYOUT; - } - - private static final long minStorageBufferOffsetAlignment$OFFSET = 76; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t minStorageBufferOffsetAlignment - * } - */ - public static final long minStorageBufferOffsetAlignment$offset() { - return minStorageBufferOffsetAlignment$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t minStorageBufferOffsetAlignment - * } - */ - public static int minStorageBufferOffsetAlignment(MemorySegment struct) { - return struct.get(minStorageBufferOffsetAlignment$LAYOUT, minStorageBufferOffsetAlignment$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t minStorageBufferOffsetAlignment - * } - */ - public static void minStorageBufferOffsetAlignment(MemorySegment struct, int fieldValue) { - struct.set(minStorageBufferOffsetAlignment$LAYOUT, minStorageBufferOffsetAlignment$OFFSET, fieldValue); - } - - private static final OfInt maxVertexBuffers$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxVertexBuffers")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxVertexBuffers - * } - */ - public static final OfInt maxVertexBuffers$layout() { - return maxVertexBuffers$LAYOUT; - } - - private static final long maxVertexBuffers$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxVertexBuffers - * } - */ - public static final long maxVertexBuffers$offset() { - return maxVertexBuffers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxVertexBuffers - * } - */ - public static int maxVertexBuffers(MemorySegment struct) { - return struct.get(maxVertexBuffers$LAYOUT, maxVertexBuffers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxVertexBuffers - * } - */ - public static void maxVertexBuffers(MemorySegment struct, int fieldValue) { - struct.set(maxVertexBuffers$LAYOUT, maxVertexBuffers$OFFSET, fieldValue); - } - - private static final OfLong maxBufferSize$LAYOUT = (OfLong)$LAYOUT.select(groupElement("maxBufferSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t maxBufferSize - * } - */ - public static final OfLong maxBufferSize$layout() { - return maxBufferSize$LAYOUT; - } - - private static final long maxBufferSize$OFFSET = 88; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t maxBufferSize - * } - */ - public static final long maxBufferSize$offset() { - return maxBufferSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t maxBufferSize - * } - */ - public static long maxBufferSize(MemorySegment struct) { - return struct.get(maxBufferSize$LAYOUT, maxBufferSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t maxBufferSize - * } - */ - public static void maxBufferSize(MemorySegment struct, long fieldValue) { - struct.set(maxBufferSize$LAYOUT, maxBufferSize$OFFSET, fieldValue); - } - - private static final OfInt maxVertexAttributes$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxVertexAttributes")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxVertexAttributes - * } - */ - public static final OfInt maxVertexAttributes$layout() { - return maxVertexAttributes$LAYOUT; - } - - private static final long maxVertexAttributes$OFFSET = 96; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxVertexAttributes - * } - */ - public static final long maxVertexAttributes$offset() { - return maxVertexAttributes$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxVertexAttributes - * } - */ - public static int maxVertexAttributes(MemorySegment struct) { - return struct.get(maxVertexAttributes$LAYOUT, maxVertexAttributes$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxVertexAttributes - * } - */ - public static void maxVertexAttributes(MemorySegment struct, int fieldValue) { - struct.set(maxVertexAttributes$LAYOUT, maxVertexAttributes$OFFSET, fieldValue); - } - - private static final OfInt maxVertexBufferArrayStride$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxVertexBufferArrayStride")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxVertexBufferArrayStride - * } - */ - public static final OfInt maxVertexBufferArrayStride$layout() { - return maxVertexBufferArrayStride$LAYOUT; - } - - private static final long maxVertexBufferArrayStride$OFFSET = 100; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxVertexBufferArrayStride - * } - */ - public static final long maxVertexBufferArrayStride$offset() { - return maxVertexBufferArrayStride$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxVertexBufferArrayStride - * } - */ - public static int maxVertexBufferArrayStride(MemorySegment struct) { - return struct.get(maxVertexBufferArrayStride$LAYOUT, maxVertexBufferArrayStride$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxVertexBufferArrayStride - * } - */ - public static void maxVertexBufferArrayStride(MemorySegment struct, int fieldValue) { - struct.set(maxVertexBufferArrayStride$LAYOUT, maxVertexBufferArrayStride$OFFSET, fieldValue); - } - - private static final OfInt maxInterStageShaderComponents$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxInterStageShaderComponents")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderComponents - * } - */ - public static final OfInt maxInterStageShaderComponents$layout() { - return maxInterStageShaderComponents$LAYOUT; - } - - private static final long maxInterStageShaderComponents$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderComponents - * } - */ - public static final long maxInterStageShaderComponents$offset() { - return maxInterStageShaderComponents$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderComponents - * } - */ - public static int maxInterStageShaderComponents(MemorySegment struct) { - return struct.get(maxInterStageShaderComponents$LAYOUT, maxInterStageShaderComponents$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderComponents - * } - */ - public static void maxInterStageShaderComponents(MemorySegment struct, int fieldValue) { - struct.set(maxInterStageShaderComponents$LAYOUT, maxInterStageShaderComponents$OFFSET, fieldValue); - } - - private static final OfInt maxInterStageShaderVariables$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxInterStageShaderVariables")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderVariables - * } - */ - public static final OfInt maxInterStageShaderVariables$layout() { - return maxInterStageShaderVariables$LAYOUT; - } - - private static final long maxInterStageShaderVariables$OFFSET = 108; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderVariables - * } - */ - public static final long maxInterStageShaderVariables$offset() { - return maxInterStageShaderVariables$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderVariables - * } - */ - public static int maxInterStageShaderVariables(MemorySegment struct) { - return struct.get(maxInterStageShaderVariables$LAYOUT, maxInterStageShaderVariables$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxInterStageShaderVariables - * } - */ - public static void maxInterStageShaderVariables(MemorySegment struct, int fieldValue) { - struct.set(maxInterStageShaderVariables$LAYOUT, maxInterStageShaderVariables$OFFSET, fieldValue); - } - - private static final OfInt maxColorAttachments$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxColorAttachments")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxColorAttachments - * } - */ - public static final OfInt maxColorAttachments$layout() { - return maxColorAttachments$LAYOUT; - } - - private static final long maxColorAttachments$OFFSET = 112; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxColorAttachments - * } - */ - public static final long maxColorAttachments$offset() { - return maxColorAttachments$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxColorAttachments - * } - */ - public static int maxColorAttachments(MemorySegment struct) { - return struct.get(maxColorAttachments$LAYOUT, maxColorAttachments$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxColorAttachments - * } - */ - public static void maxColorAttachments(MemorySegment struct, int fieldValue) { - struct.set(maxColorAttachments$LAYOUT, maxColorAttachments$OFFSET, fieldValue); - } - - private static final OfInt maxColorAttachmentBytesPerSample$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxColorAttachmentBytesPerSample")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxColorAttachmentBytesPerSample - * } - */ - public static final OfInt maxColorAttachmentBytesPerSample$layout() { - return maxColorAttachmentBytesPerSample$LAYOUT; - } - - private static final long maxColorAttachmentBytesPerSample$OFFSET = 116; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxColorAttachmentBytesPerSample - * } - */ - public static final long maxColorAttachmentBytesPerSample$offset() { - return maxColorAttachmentBytesPerSample$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxColorAttachmentBytesPerSample - * } - */ - public static int maxColorAttachmentBytesPerSample(MemorySegment struct) { - return struct.get(maxColorAttachmentBytesPerSample$LAYOUT, maxColorAttachmentBytesPerSample$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxColorAttachmentBytesPerSample - * } - */ - public static void maxColorAttachmentBytesPerSample(MemorySegment struct, int fieldValue) { - struct.set(maxColorAttachmentBytesPerSample$LAYOUT, maxColorAttachmentBytesPerSample$OFFSET, fieldValue); - } - - private static final OfInt maxComputeWorkgroupStorageSize$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxComputeWorkgroupStorageSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupStorageSize - * } - */ - public static final OfInt maxComputeWorkgroupStorageSize$layout() { - return maxComputeWorkgroupStorageSize$LAYOUT; - } - - private static final long maxComputeWorkgroupStorageSize$OFFSET = 120; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupStorageSize - * } - */ - public static final long maxComputeWorkgroupStorageSize$offset() { - return maxComputeWorkgroupStorageSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupStorageSize - * } - */ - public static int maxComputeWorkgroupStorageSize(MemorySegment struct) { - return struct.get(maxComputeWorkgroupStorageSize$LAYOUT, maxComputeWorkgroupStorageSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupStorageSize - * } - */ - public static void maxComputeWorkgroupStorageSize(MemorySegment struct, int fieldValue) { - struct.set(maxComputeWorkgroupStorageSize$LAYOUT, maxComputeWorkgroupStorageSize$OFFSET, fieldValue); - } - - private static final OfInt maxComputeInvocationsPerWorkgroup$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxComputeInvocationsPerWorkgroup")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxComputeInvocationsPerWorkgroup - * } - */ - public static final OfInt maxComputeInvocationsPerWorkgroup$layout() { - return maxComputeInvocationsPerWorkgroup$LAYOUT; - } - - private static final long maxComputeInvocationsPerWorkgroup$OFFSET = 124; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxComputeInvocationsPerWorkgroup - * } - */ - public static final long maxComputeInvocationsPerWorkgroup$offset() { - return maxComputeInvocationsPerWorkgroup$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxComputeInvocationsPerWorkgroup - * } - */ - public static int maxComputeInvocationsPerWorkgroup(MemorySegment struct) { - return struct.get(maxComputeInvocationsPerWorkgroup$LAYOUT, maxComputeInvocationsPerWorkgroup$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxComputeInvocationsPerWorkgroup - * } - */ - public static void maxComputeInvocationsPerWorkgroup(MemorySegment struct, int fieldValue) { - struct.set(maxComputeInvocationsPerWorkgroup$LAYOUT, maxComputeInvocationsPerWorkgroup$OFFSET, fieldValue); - } - - private static final OfInt maxComputeWorkgroupSizeX$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxComputeWorkgroupSizeX")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeX - * } - */ - public static final OfInt maxComputeWorkgroupSizeX$layout() { - return maxComputeWorkgroupSizeX$LAYOUT; - } - - private static final long maxComputeWorkgroupSizeX$OFFSET = 128; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeX - * } - */ - public static final long maxComputeWorkgroupSizeX$offset() { - return maxComputeWorkgroupSizeX$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeX - * } - */ - public static int maxComputeWorkgroupSizeX(MemorySegment struct) { - return struct.get(maxComputeWorkgroupSizeX$LAYOUT, maxComputeWorkgroupSizeX$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeX - * } - */ - public static void maxComputeWorkgroupSizeX(MemorySegment struct, int fieldValue) { - struct.set(maxComputeWorkgroupSizeX$LAYOUT, maxComputeWorkgroupSizeX$OFFSET, fieldValue); - } - - private static final OfInt maxComputeWorkgroupSizeY$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxComputeWorkgroupSizeY")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeY - * } - */ - public static final OfInt maxComputeWorkgroupSizeY$layout() { - return maxComputeWorkgroupSizeY$LAYOUT; - } - - private static final long maxComputeWorkgroupSizeY$OFFSET = 132; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeY - * } - */ - public static final long maxComputeWorkgroupSizeY$offset() { - return maxComputeWorkgroupSizeY$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeY - * } - */ - public static int maxComputeWorkgroupSizeY(MemorySegment struct) { - return struct.get(maxComputeWorkgroupSizeY$LAYOUT, maxComputeWorkgroupSizeY$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeY - * } - */ - public static void maxComputeWorkgroupSizeY(MemorySegment struct, int fieldValue) { - struct.set(maxComputeWorkgroupSizeY$LAYOUT, maxComputeWorkgroupSizeY$OFFSET, fieldValue); - } - - private static final OfInt maxComputeWorkgroupSizeZ$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxComputeWorkgroupSizeZ")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeZ - * } - */ - public static final OfInt maxComputeWorkgroupSizeZ$layout() { - return maxComputeWorkgroupSizeZ$LAYOUT; - } - - private static final long maxComputeWorkgroupSizeZ$OFFSET = 136; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeZ - * } - */ - public static final long maxComputeWorkgroupSizeZ$offset() { - return maxComputeWorkgroupSizeZ$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeZ - * } - */ - public static int maxComputeWorkgroupSizeZ(MemorySegment struct) { - return struct.get(maxComputeWorkgroupSizeZ$LAYOUT, maxComputeWorkgroupSizeZ$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupSizeZ - * } - */ - public static void maxComputeWorkgroupSizeZ(MemorySegment struct, int fieldValue) { - struct.set(maxComputeWorkgroupSizeZ$LAYOUT, maxComputeWorkgroupSizeZ$OFFSET, fieldValue); - } - - private static final OfInt maxComputeWorkgroupsPerDimension$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxComputeWorkgroupsPerDimension")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupsPerDimension - * } - */ - public static final OfInt maxComputeWorkgroupsPerDimension$layout() { - return maxComputeWorkgroupsPerDimension$LAYOUT; - } - - private static final long maxComputeWorkgroupsPerDimension$OFFSET = 140; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupsPerDimension - * } - */ - public static final long maxComputeWorkgroupsPerDimension$offset() { - return maxComputeWorkgroupsPerDimension$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupsPerDimension - * } - */ - public static int maxComputeWorkgroupsPerDimension(MemorySegment struct) { - return struct.get(maxComputeWorkgroupsPerDimension$LAYOUT, maxComputeWorkgroupsPerDimension$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxComputeWorkgroupsPerDimension - * } - */ - public static void maxComputeWorkgroupsPerDimension(MemorySegment struct, int fieldValue) { - struct.set(maxComputeWorkgroupsPerDimension$LAYOUT, maxComputeWorkgroupsPerDimension$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPULogCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPULogCallback.java deleted file mode 100644 index e40a55a7c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPULogCallback.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPULogCallback)(WGPULogLevel, const char *, void *) - * } - */ -public class WGPULogCallback { - - WGPULogCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int level, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPULogCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPULogCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int level, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, level, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUMultisampleState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUMultisampleState.java deleted file mode 100644 index 3fa2ac2b3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUMultisampleState.java +++ /dev/null @@ -1,266 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUMultisampleState { - * const WGPUChainedStruct *nextInChain; - * uint32_t count; - * uint32_t mask; - * WGPUBool alphaToCoverageEnabled; - * } - * } - */ -public class WGPUMultisampleState { - - WGPUMultisampleState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("count"), - WGPU.C_INT.withName("mask"), - WGPU.C_INT.withName("alphaToCoverageEnabled"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUMultisampleState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt count$LAYOUT = (OfInt)$LAYOUT.select(groupElement("count")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static final OfInt count$layout() { - return count$LAYOUT; - } - - private static final long count$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static final long count$offset() { - return count$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static int count(MemorySegment struct) { - return struct.get(count$LAYOUT, count$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static void count(MemorySegment struct, int fieldValue) { - struct.set(count$LAYOUT, count$OFFSET, fieldValue); - } - - private static final OfInt mask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mask")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t mask - * } - */ - public static final OfInt mask$layout() { - return mask$LAYOUT; - } - - private static final long mask$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t mask - * } - */ - public static final long mask$offset() { - return mask$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t mask - * } - */ - public static int mask(MemorySegment struct) { - return struct.get(mask$LAYOUT, mask$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t mask - * } - */ - public static void mask(MemorySegment struct, int fieldValue) { - struct.set(mask$LAYOUT, mask$OFFSET, fieldValue); - } - - private static final OfInt alphaToCoverageEnabled$LAYOUT = (OfInt)$LAYOUT.select(groupElement("alphaToCoverageEnabled")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool alphaToCoverageEnabled - * } - */ - public static final OfInt alphaToCoverageEnabled$layout() { - return alphaToCoverageEnabled$LAYOUT; - } - - private static final long alphaToCoverageEnabled$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool alphaToCoverageEnabled - * } - */ - public static final long alphaToCoverageEnabled$offset() { - return alphaToCoverageEnabled$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool alphaToCoverageEnabled - * } - */ - public static int alphaToCoverageEnabled(MemorySegment struct) { - return struct.get(alphaToCoverageEnabled$LAYOUT, alphaToCoverageEnabled$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool alphaToCoverageEnabled - * } - */ - public static void alphaToCoverageEnabled(MemorySegment struct, int fieldValue) { - struct.set(alphaToCoverageEnabled$LAYOUT, alphaToCoverageEnabled$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUNativeLimits.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUNativeLimits.java deleted file mode 100644 index 8f89c14bf..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUNativeLimits.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUNativeLimits { - * uint32_t maxPushConstantSize; - * uint32_t maxNonSamplerBindings; - * } - * } - */ -public class WGPUNativeLimits { - - WGPUNativeLimits() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("maxPushConstantSize"), - WGPU.C_INT.withName("maxNonSamplerBindings") - ).withName("WGPUNativeLimits"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt maxPushConstantSize$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxPushConstantSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxPushConstantSize - * } - */ - public static final OfInt maxPushConstantSize$layout() { - return maxPushConstantSize$LAYOUT; - } - - private static final long maxPushConstantSize$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxPushConstantSize - * } - */ - public static final long maxPushConstantSize$offset() { - return maxPushConstantSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxPushConstantSize - * } - */ - public static int maxPushConstantSize(MemorySegment struct) { - return struct.get(maxPushConstantSize$LAYOUT, maxPushConstantSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxPushConstantSize - * } - */ - public static void maxPushConstantSize(MemorySegment struct, int fieldValue) { - struct.set(maxPushConstantSize$LAYOUT, maxPushConstantSize$OFFSET, fieldValue); - } - - private static final OfInt maxNonSamplerBindings$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maxNonSamplerBindings")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t maxNonSamplerBindings - * } - */ - public static final OfInt maxNonSamplerBindings$layout() { - return maxNonSamplerBindings$LAYOUT; - } - - private static final long maxNonSamplerBindings$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t maxNonSamplerBindings - * } - */ - public static final long maxNonSamplerBindings$offset() { - return maxNonSamplerBindings$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t maxNonSamplerBindings - * } - */ - public static int maxNonSamplerBindings(MemorySegment struct) { - return struct.get(maxNonSamplerBindings$LAYOUT, maxNonSamplerBindings$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t maxNonSamplerBindings - * } - */ - public static void maxNonSamplerBindings(MemorySegment struct, int fieldValue) { - struct.set(maxNonSamplerBindings$LAYOUT, maxNonSamplerBindings$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUOrigin3D.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUOrigin3D.java deleted file mode 100644 index 54ddff7c9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUOrigin3D.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUOrigin3D { - * uint32_t x; - * uint32_t y; - * uint32_t z; - * } - * } - */ -public class WGPUOrigin3D { - - WGPUOrigin3D() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("x"), - WGPU.C_INT.withName("y"), - WGPU.C_INT.withName("z") - ).withName("WGPUOrigin3D"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt x$LAYOUT = (OfInt)$LAYOUT.select(groupElement("x")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t x - * } - */ - public static final OfInt x$layout() { - return x$LAYOUT; - } - - private static final long x$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t x - * } - */ - public static final long x$offset() { - return x$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t x - * } - */ - public static int x(MemorySegment struct) { - return struct.get(x$LAYOUT, x$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t x - * } - */ - public static void x(MemorySegment struct, int fieldValue) { - struct.set(x$LAYOUT, x$OFFSET, fieldValue); - } - - private static final OfInt y$LAYOUT = (OfInt)$LAYOUT.select(groupElement("y")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t y - * } - */ - public static final OfInt y$layout() { - return y$LAYOUT; - } - - private static final long y$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t y - * } - */ - public static final long y$offset() { - return y$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t y - * } - */ - public static int y(MemorySegment struct) { - return struct.get(y$LAYOUT, y$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t y - * } - */ - public static void y(MemorySegment struct, int fieldValue) { - struct.set(y$LAYOUT, y$OFFSET, fieldValue); - } - - private static final OfInt z$LAYOUT = (OfInt)$LAYOUT.select(groupElement("z")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t z - * } - */ - public static final OfInt z$layout() { - return z$LAYOUT; - } - - private static final long z$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t z - * } - */ - public static final long z$offset() { - return z$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t z - * } - */ - public static int z(MemorySegment struct) { - return struct.get(z$LAYOUT, z$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t z - * } - */ - public static void z(MemorySegment struct, int fieldValue) { - struct.set(z$LAYOUT, z$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPipelineLayoutDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPipelineLayoutDescriptor.java deleted file mode 100644 index 57f9c569f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPipelineLayoutDescriptor.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUPipelineLayoutDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * size_t bindGroupLayoutCount; - * const WGPUBindGroupLayout *bindGroupLayouts; - * } - * } - */ -public class WGPUPipelineLayoutDescriptor { - - WGPUPipelineLayoutDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_LONG_LONG.withName("bindGroupLayoutCount"), - WGPU.C_POINTER.withName("bindGroupLayouts") - ).withName("WGPUPipelineLayoutDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfLong bindGroupLayoutCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("bindGroupLayoutCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t bindGroupLayoutCount - * } - */ - public static final OfLong bindGroupLayoutCount$layout() { - return bindGroupLayoutCount$LAYOUT; - } - - private static final long bindGroupLayoutCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t bindGroupLayoutCount - * } - */ - public static final long bindGroupLayoutCount$offset() { - return bindGroupLayoutCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t bindGroupLayoutCount - * } - */ - public static long bindGroupLayoutCount(MemorySegment struct) { - return struct.get(bindGroupLayoutCount$LAYOUT, bindGroupLayoutCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t bindGroupLayoutCount - * } - */ - public static void bindGroupLayoutCount(MemorySegment struct, long fieldValue) { - struct.set(bindGroupLayoutCount$LAYOUT, bindGroupLayoutCount$OFFSET, fieldValue); - } - - private static final AddressLayout bindGroupLayouts$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("bindGroupLayouts")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUBindGroupLayout *bindGroupLayouts - * } - */ - public static final AddressLayout bindGroupLayouts$layout() { - return bindGroupLayouts$LAYOUT; - } - - private static final long bindGroupLayouts$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUBindGroupLayout *bindGroupLayouts - * } - */ - public static final long bindGroupLayouts$offset() { - return bindGroupLayouts$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUBindGroupLayout *bindGroupLayouts - * } - */ - public static MemorySegment bindGroupLayouts(MemorySegment struct) { - return struct.get(bindGroupLayouts$LAYOUT, bindGroupLayouts$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUBindGroupLayout *bindGroupLayouts - * } - */ - public static void bindGroupLayouts(MemorySegment struct, MemorySegment fieldValue) { - struct.set(bindGroupLayouts$LAYOUT, bindGroupLayouts$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPipelineLayoutExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPipelineLayoutExtras.java deleted file mode 100644 index e0710a6ac..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPipelineLayoutExtras.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUPipelineLayoutExtras { - * WGPUChainedStruct chain; - * size_t pushConstantRangeCount; - * const WGPUPushConstantRange *pushConstantRanges; - * } - * } - */ -public class WGPUPipelineLayoutExtras { - - WGPUPipelineLayoutExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_LONG_LONG.withName("pushConstantRangeCount"), - WGPU.C_POINTER.withName("pushConstantRanges") - ).withName("WGPUPipelineLayoutExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfLong pushConstantRangeCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("pushConstantRangeCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t pushConstantRangeCount - * } - */ - public static final OfLong pushConstantRangeCount$layout() { - return pushConstantRangeCount$LAYOUT; - } - - private static final long pushConstantRangeCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t pushConstantRangeCount - * } - */ - public static final long pushConstantRangeCount$offset() { - return pushConstantRangeCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t pushConstantRangeCount - * } - */ - public static long pushConstantRangeCount(MemorySegment struct) { - return struct.get(pushConstantRangeCount$LAYOUT, pushConstantRangeCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t pushConstantRangeCount - * } - */ - public static void pushConstantRangeCount(MemorySegment struct, long fieldValue) { - struct.set(pushConstantRangeCount$LAYOUT, pushConstantRangeCount$OFFSET, fieldValue); - } - - private static final AddressLayout pushConstantRanges$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("pushConstantRanges")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUPushConstantRange *pushConstantRanges - * } - */ - public static final AddressLayout pushConstantRanges$layout() { - return pushConstantRanges$LAYOUT; - } - - private static final long pushConstantRanges$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUPushConstantRange *pushConstantRanges - * } - */ - public static final long pushConstantRanges$offset() { - return pushConstantRanges$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUPushConstantRange *pushConstantRanges - * } - */ - public static MemorySegment pushConstantRanges(MemorySegment struct) { - return struct.get(pushConstantRanges$LAYOUT, pushConstantRanges$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUPushConstantRange *pushConstantRanges - * } - */ - public static void pushConstantRanges(MemorySegment struct, MemorySegment fieldValue) { - struct.set(pushConstantRanges$LAYOUT, pushConstantRanges$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPrimitiveDepthClipControl.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPrimitiveDepthClipControl.java deleted file mode 100644 index 87c991c29..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPrimitiveDepthClipControl.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUPrimitiveDepthClipControl { - * WGPUChainedStruct chain; - * WGPUBool unclippedDepth; - * } - * } - */ -public class WGPUPrimitiveDepthClipControl { - - WGPUPrimitiveDepthClipControl() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_INT.withName("unclippedDepth"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUPrimitiveDepthClipControl"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfInt unclippedDepth$LAYOUT = (OfInt)$LAYOUT.select(groupElement("unclippedDepth")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool unclippedDepth - * } - */ - public static final OfInt unclippedDepth$layout() { - return unclippedDepth$LAYOUT; - } - - private static final long unclippedDepth$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool unclippedDepth - * } - */ - public static final long unclippedDepth$offset() { - return unclippedDepth$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool unclippedDepth - * } - */ - public static int unclippedDepth(MemorySegment struct) { - return struct.get(unclippedDepth$LAYOUT, unclippedDepth$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool unclippedDepth - * } - */ - public static void unclippedDepth(MemorySegment struct, int fieldValue) { - struct.set(unclippedDepth$LAYOUT, unclippedDepth$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPrimitiveState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPrimitiveState.java deleted file mode 100644 index f3a188a75..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPrimitiveState.java +++ /dev/null @@ -1,311 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUPrimitiveState { - * const WGPUChainedStruct *nextInChain; - * WGPUPrimitiveTopology topology; - * WGPUIndexFormat stripIndexFormat; - * WGPUFrontFace frontFace; - * WGPUCullMode cullMode; - * } - * } - */ -public class WGPUPrimitiveState { - - WGPUPrimitiveState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("topology"), - WGPU.C_INT.withName("stripIndexFormat"), - WGPU.C_INT.withName("frontFace"), - WGPU.C_INT.withName("cullMode") - ).withName("WGPUPrimitiveState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt topology$LAYOUT = (OfInt)$LAYOUT.select(groupElement("topology")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPrimitiveTopology topology - * } - */ - public static final OfInt topology$layout() { - return topology$LAYOUT; - } - - private static final long topology$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPrimitiveTopology topology - * } - */ - public static final long topology$offset() { - return topology$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPrimitiveTopology topology - * } - */ - public static int topology(MemorySegment struct) { - return struct.get(topology$LAYOUT, topology$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPrimitiveTopology topology - * } - */ - public static void topology(MemorySegment struct, int fieldValue) { - struct.set(topology$LAYOUT, topology$OFFSET, fieldValue); - } - - private static final OfInt stripIndexFormat$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stripIndexFormat")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUIndexFormat stripIndexFormat - * } - */ - public static final OfInt stripIndexFormat$layout() { - return stripIndexFormat$LAYOUT; - } - - private static final long stripIndexFormat$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUIndexFormat stripIndexFormat - * } - */ - public static final long stripIndexFormat$offset() { - return stripIndexFormat$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUIndexFormat stripIndexFormat - * } - */ - public static int stripIndexFormat(MemorySegment struct) { - return struct.get(stripIndexFormat$LAYOUT, stripIndexFormat$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUIndexFormat stripIndexFormat - * } - */ - public static void stripIndexFormat(MemorySegment struct, int fieldValue) { - struct.set(stripIndexFormat$LAYOUT, stripIndexFormat$OFFSET, fieldValue); - } - - private static final OfInt frontFace$LAYOUT = (OfInt)$LAYOUT.select(groupElement("frontFace")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUFrontFace frontFace - * } - */ - public static final OfInt frontFace$layout() { - return frontFace$LAYOUT; - } - - private static final long frontFace$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUFrontFace frontFace - * } - */ - public static final long frontFace$offset() { - return frontFace$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUFrontFace frontFace - * } - */ - public static int frontFace(MemorySegment struct) { - return struct.get(frontFace$LAYOUT, frontFace$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUFrontFace frontFace - * } - */ - public static void frontFace(MemorySegment struct, int fieldValue) { - struct.set(frontFace$LAYOUT, frontFace$OFFSET, fieldValue); - } - - private static final OfInt cullMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("cullMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCullMode cullMode - * } - */ - public static final OfInt cullMode$layout() { - return cullMode$LAYOUT; - } - - private static final long cullMode$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCullMode cullMode - * } - */ - public static final long cullMode$offset() { - return cullMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCullMode cullMode - * } - */ - public static int cullMode(MemorySegment struct) { - return struct.get(cullMode$LAYOUT, cullMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCullMode cullMode - * } - */ - public static void cullMode(MemorySegment struct, int fieldValue) { - struct.set(cullMode$LAYOUT, cullMode$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProc.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProc.java deleted file mode 100644 index 61c895593..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProc.java +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProc)(void) - * } - */ -public class WGPUProc { - - WGPUProc() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProc.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProc.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr) { - try { - DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterEnumerateFeatures.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterEnumerateFeatures.java deleted file mode 100644 index 55172e0b9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterEnumerateFeatures.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter, WGPUFeatureName *) - * } - */ -public class WGPUProcAdapterEnumerateFeatures { - - WGPUProcAdapterEnumerateFeatures() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - long apply(MemorySegment adapter, MemorySegment features); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterEnumerateFeatures.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterEnumerateFeatures.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static long invoke(MemorySegment funcPtr,MemorySegment adapter, MemorySegment features) { - try { - return (long) DOWN$MH.invokeExact(funcPtr, adapter, features); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterGetLimits.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterGetLimits.java deleted file mode 100644 index d2df318fd..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterGetLimits.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBool (*WGPUProcAdapterGetLimits)(WGPUAdapter, WGPUSupportedLimits *) - * } - */ -public class WGPUProcAdapterGetLimits { - - WGPUProcAdapterGetLimits() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment adapter, MemorySegment limits); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterGetLimits.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterGetLimits.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment adapter, MemorySegment limits) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, adapter, limits); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterGetProperties.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterGetProperties.java deleted file mode 100644 index 02cbd265f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterGetProperties.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter, WGPUAdapterProperties *) - * } - */ -public class WGPUProcAdapterGetProperties { - - WGPUProcAdapterGetProperties() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment adapter, MemorySegment properties); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterGetProperties.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterGetProperties.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment adapter, MemorySegment properties) { - try { - DOWN$MH.invokeExact(funcPtr, adapter, properties); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterHasFeature.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterHasFeature.java deleted file mode 100644 index a9ca266a7..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterHasFeature.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBool (*WGPUProcAdapterHasFeature)(WGPUAdapter, WGPUFeatureName) - * } - */ -public class WGPUProcAdapterHasFeature { - - WGPUProcAdapterHasFeature() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment adapter, int feature); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterHasFeature.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterHasFeature.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment adapter, int feature) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, adapter, feature); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterReference.java deleted file mode 100644 index e9170ab04..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcAdapterReference)(WGPUAdapter) - * } - */ -public class WGPUProcAdapterReference { - - WGPUProcAdapterReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment adapter); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment adapter) { - try { - DOWN$MH.invokeExact(funcPtr, adapter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterRelease.java deleted file mode 100644 index d050dcb94..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcAdapterRelease)(WGPUAdapter) - * } - */ -public class WGPUProcAdapterRelease { - - WGPUProcAdapterRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment adapter); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment adapter) { - try { - DOWN$MH.invokeExact(funcPtr, adapter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterRequestDevice.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterRequestDevice.java deleted file mode 100644 index 0f53fc25e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcAdapterRequestDevice.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcAdapterRequestDevice)(WGPUAdapter, const WGPUDeviceDescriptor *, WGPURequestDeviceCallback, void *) - * } - */ -public class WGPUProcAdapterRequestDevice { - - WGPUProcAdapterRequestDevice() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment adapter, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcAdapterRequestDevice.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcAdapterRequestDevice.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment adapter, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, adapter, descriptor, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutReference.java deleted file mode 100644 index adb4c7c7d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBindGroupLayoutReference)(WGPUBindGroupLayout) - * } - */ -public class WGPUProcBindGroupLayoutReference { - - WGPUProcBindGroupLayoutReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment bindGroupLayout); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBindGroupLayoutReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBindGroupLayoutReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment bindGroupLayout) { - try { - DOWN$MH.invokeExact(funcPtr, bindGroupLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutRelease.java deleted file mode 100644 index 07c051c6a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout) - * } - */ -public class WGPUProcBindGroupLayoutRelease { - - WGPUProcBindGroupLayoutRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment bindGroupLayout); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBindGroupLayoutRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBindGroupLayoutRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment bindGroupLayout) { - try { - DOWN$MH.invokeExact(funcPtr, bindGroupLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutSetLabel.java deleted file mode 100644 index 28be17652..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupLayoutSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBindGroupLayoutSetLabel)(WGPUBindGroupLayout, const char *) - * } - */ -public class WGPUProcBindGroupLayoutSetLabel { - - WGPUProcBindGroupLayoutSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment bindGroupLayout, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBindGroupLayoutSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBindGroupLayoutSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment bindGroupLayout, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, bindGroupLayout, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupReference.java deleted file mode 100644 index ba9293e2a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBindGroupReference)(WGPUBindGroup) - * } - */ -public class WGPUProcBindGroupReference { - - WGPUProcBindGroupReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment bindGroup); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBindGroupReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBindGroupReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment bindGroup) { - try { - DOWN$MH.invokeExact(funcPtr, bindGroup); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupRelease.java deleted file mode 100644 index d90742fd5..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup) - * } - */ -public class WGPUProcBindGroupRelease { - - WGPUProcBindGroupRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment bindGroup); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBindGroupRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBindGroupRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment bindGroup) { - try { - DOWN$MH.invokeExact(funcPtr, bindGroup); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupSetLabel.java deleted file mode 100644 index 7ab284ed7..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBindGroupSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBindGroupSetLabel)(WGPUBindGroup, const char *) - * } - */ -public class WGPUProcBindGroupSetLabel { - - WGPUProcBindGroupSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment bindGroup, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBindGroupSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBindGroupSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment bindGroup, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, bindGroup, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferDestroy.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferDestroy.java deleted file mode 100644 index f717a0d12..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferDestroy.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBufferDestroy)(WGPUBuffer) - * } - */ -public class WGPUProcBufferDestroy { - - WGPUProcBufferDestroy() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferDestroy.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferDestroy.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetConstMappedRange.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetConstMappedRange.java deleted file mode 100644 index a940f7e00..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetConstMappedRange.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef const void *(*WGPUProcBufferGetConstMappedRange)(WGPUBuffer, size_t, size_t) - * } - */ -public class WGPUProcBufferGetConstMappedRange { - - WGPUProcBufferGetConstMappedRange() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment buffer, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferGetConstMappedRange.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferGetConstMappedRange.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment buffer, long offset, long size) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetMapState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetMapState.java deleted file mode 100644 index 4bf6e7085..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetMapState.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBufferMapState (*WGPUProcBufferGetMapState)(WGPUBuffer) - * } - */ -public class WGPUProcBufferGetMapState { - - WGPUProcBufferGetMapState() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferGetMapState.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferGetMapState.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetMappedRange.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetMappedRange.java deleted file mode 100644 index 89df36dc8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetMappedRange.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void *(*WGPUProcBufferGetMappedRange)(WGPUBuffer, size_t, size_t) - * } - */ -public class WGPUProcBufferGetMappedRange { - - WGPUProcBufferGetMappedRange() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment buffer, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferGetMappedRange.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferGetMappedRange.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment buffer, long offset, long size) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetSize.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetSize.java deleted file mode 100644 index 6b53df00a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetSize.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint64_t (*WGPUProcBufferGetSize)(WGPUBuffer) - * } - */ -public class WGPUProcBufferGetSize { - - WGPUProcBufferGetSize() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - long apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferGetSize.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferGetSize.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static long invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - return (long) DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetUsage.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetUsage.java deleted file mode 100644 index 31dac55f8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferGetUsage.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBufferUsageFlags (*WGPUProcBufferGetUsage)(WGPUBuffer) - * } - */ -public class WGPUProcBufferGetUsage { - - WGPUProcBufferGetUsage() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferGetUsage.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferGetUsage.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferMapAsync.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferMapAsync.java deleted file mode 100644 index e1e170a48..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferMapAsync.java +++ /dev/null @@ -1,72 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBufferMapAsync)(WGPUBuffer, WGPUMapModeFlags, size_t, size_t, WGPUBufferMapCallback, void *) - * } - */ -public class WGPUProcBufferMapAsync { - - WGPUProcBufferMapAsync() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment buffer, int mode, long offset, long size, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferMapAsync.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferMapAsync.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment buffer, int mode, long offset, long size, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, buffer, mode, offset, size, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferReference.java deleted file mode 100644 index 622d487d8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBufferReference)(WGPUBuffer) - * } - */ -public class WGPUProcBufferReference { - - WGPUProcBufferReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferRelease.java deleted file mode 100644 index a207d6013..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBufferRelease)(WGPUBuffer) - * } - */ -public class WGPUProcBufferRelease { - - WGPUProcBufferRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferSetLabel.java deleted file mode 100644 index df6cdb964..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer, const char *) - * } - */ -public class WGPUProcBufferSetLabel { - - WGPUProcBufferSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment buffer, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment buffer, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, buffer, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferUnmap.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferUnmap.java deleted file mode 100644 index 24e98216f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcBufferUnmap.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcBufferUnmap)(WGPUBuffer) - * } - */ -public class WGPUProcBufferUnmap { - - WGPUProcBufferUnmap() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment buffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcBufferUnmap.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcBufferUnmap.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment buffer) { - try { - DOWN$MH.invokeExact(funcPtr, buffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferReference.java deleted file mode 100644 index a7ab8f5f4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandBufferReference)(WGPUCommandBuffer) - * } - */ -public class WGPUProcCommandBufferReference { - - WGPUProcCommandBufferReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandBuffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandBufferReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandBufferReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandBuffer) { - try { - DOWN$MH.invokeExact(funcPtr, commandBuffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferRelease.java deleted file mode 100644 index 02c0c57e5..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer) - * } - */ -public class WGPUProcCommandBufferRelease { - - WGPUProcCommandBufferRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandBuffer); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandBufferRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandBufferRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandBuffer) { - try { - DOWN$MH.invokeExact(funcPtr, commandBuffer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferSetLabel.java deleted file mode 100644 index de189ab8f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandBufferSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandBufferSetLabel)(WGPUCommandBuffer, const char *) - * } - */ -public class WGPUProcCommandBufferSetLabel { - - WGPUProcCommandBufferSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandBuffer, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandBufferSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandBufferSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandBuffer, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, commandBuffer, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderBeginComputePass.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderBeginComputePass.java deleted file mode 100644 index b7283b89d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderBeginComputePass.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUComputePassEncoder (*WGPUProcCommandEncoderBeginComputePass)(WGPUCommandEncoder, const WGPUComputePassDescriptor *) - * } - */ -public class WGPUProcCommandEncoderBeginComputePass { - - WGPUProcCommandEncoderBeginComputePass() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment commandEncoder, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderBeginComputePass.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderBeginComputePass.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, commandEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderBeginRenderPass.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderBeginRenderPass.java deleted file mode 100644 index 31ebfee53..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderBeginRenderPass.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPURenderPassEncoder (*WGPUProcCommandEncoderBeginRenderPass)(WGPUCommandEncoder, const WGPURenderPassDescriptor *) - * } - */ -public class WGPUProcCommandEncoderBeginRenderPass { - - WGPUProcCommandEncoderBeginRenderPass() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment commandEncoder, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderBeginRenderPass.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderBeginRenderPass.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, commandEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderClearBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderClearBuffer.java deleted file mode 100644 index 8165e9227..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderClearBuffer.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderClearBuffer)(WGPUCommandEncoder, WGPUBuffer, uint64_t, uint64_t) - * } - */ -public class WGPUProcCommandEncoderClearBuffer { - - WGPUProcCommandEncoderClearBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment buffer, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderClearBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderClearBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment buffer, long offset, long size) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyBufferToBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyBufferToBuffer.java deleted file mode 100644 index 81c252cd3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyBufferToBuffer.java +++ /dev/null @@ -1,72 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder, WGPUBuffer, uint64_t, WGPUBuffer, uint64_t, uint64_t) - * } - */ -public class WGPUProcCommandEncoderCopyBufferToBuffer { - - WGPUProcCommandEncoderCopyBufferToBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment source, long sourceOffset, MemorySegment destination, long destinationOffset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderCopyBufferToBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderCopyBufferToBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment source, long sourceOffset, MemorySegment destination, long destinationOffset, long size) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, source, sourceOffset, destination, destinationOffset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyBufferToTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyBufferToTexture.java deleted file mode 100644 index 656c4e907..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyBufferToTexture.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder, const WGPUImageCopyBuffer *, const WGPUImageCopyTexture *, const WGPUExtent3D *) - * } - */ -public class WGPUProcCommandEncoderCopyBufferToTexture { - - WGPUProcCommandEncoderCopyBufferToTexture() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderCopyBufferToTexture.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderCopyBufferToTexture.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, source, destination, copySize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyTextureToBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyTextureToBuffer.java deleted file mode 100644 index c9b20c642..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyTextureToBuffer.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder, const WGPUImageCopyTexture *, const WGPUImageCopyBuffer *, const WGPUExtent3D *) - * } - */ -public class WGPUProcCommandEncoderCopyTextureToBuffer { - - WGPUProcCommandEncoderCopyTextureToBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderCopyTextureToBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderCopyTextureToBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, source, destination, copySize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyTextureToTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyTextureToTexture.java deleted file mode 100644 index 647932fe0..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderCopyTextureToTexture.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder, const WGPUImageCopyTexture *, const WGPUImageCopyTexture *, const WGPUExtent3D *) - * } - */ -public class WGPUProcCommandEncoderCopyTextureToTexture { - - WGPUProcCommandEncoderCopyTextureToTexture() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderCopyTextureToTexture.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderCopyTextureToTexture.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment source, MemorySegment destination, MemorySegment copySize) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, source, destination, copySize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderFinish.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderFinish.java deleted file mode 100644 index a82aac63c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderFinish.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder, const WGPUCommandBufferDescriptor *) - * } - */ -public class WGPUProcCommandEncoderFinish { - - WGPUProcCommandEncoderFinish() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment commandEncoder, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderFinish.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderFinish.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, commandEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderInsertDebugMarker.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderInsertDebugMarker.java deleted file mode 100644 index 98152c3fc..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderInsertDebugMarker.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder, const char *) - * } - */ -public class WGPUProcCommandEncoderInsertDebugMarker { - - WGPUProcCommandEncoderInsertDebugMarker() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment markerLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderInsertDebugMarker.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderInsertDebugMarker.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment markerLabel) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderPopDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderPopDebugGroup.java deleted file mode 100644 index 2707b57f0..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderPopDebugGroup.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder) - * } - */ -public class WGPUProcCommandEncoderPopDebugGroup { - - WGPUProcCommandEncoderPopDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderPopDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderPopDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderPushDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderPushDebugGroup.java deleted file mode 100644 index cc3fb8a3e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderPushDebugGroup.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder, const char *) - * } - */ -public class WGPUProcCommandEncoderPushDebugGroup { - - WGPUProcCommandEncoderPushDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment groupLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderPushDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderPushDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment groupLabel) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderReference.java deleted file mode 100644 index 5ad3fea5a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderReference)(WGPUCommandEncoder) - * } - */ -public class WGPUProcCommandEncoderReference { - - WGPUProcCommandEncoderReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderRelease.java deleted file mode 100644 index f598c32af..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderRelease)(WGPUCommandEncoder) - * } - */ -public class WGPUProcCommandEncoderRelease { - - WGPUProcCommandEncoderRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderResolveQuerySet.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderResolveQuerySet.java deleted file mode 100644 index 5b112c143..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderResolveQuerySet.java +++ /dev/null @@ -1,72 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder, WGPUQuerySet, uint32_t, uint32_t, WGPUBuffer, uint64_t) - * } - */ -public class WGPUProcCommandEncoderResolveQuerySet { - - WGPUProcCommandEncoderResolveQuerySet() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment querySet, int firstQuery, int queryCount, MemorySegment destination, long destinationOffset); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderResolveQuerySet.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderResolveQuerySet.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment querySet, int firstQuery, int queryCount, MemorySegment destination, long destinationOffset) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, querySet, firstQuery, queryCount, destination, destinationOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderSetLabel.java deleted file mode 100644 index e8bae3494..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderSetLabel)(WGPUCommandEncoder, const char *) - * } - */ -public class WGPUProcCommandEncoderSetLabel { - - WGPUProcCommandEncoderSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderWriteTimestamp.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderWriteTimestamp.java deleted file mode 100644 index 7e625f908..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCommandEncoderWriteTimestamp.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder, WGPUQuerySet, uint32_t) - * } - */ -public class WGPUProcCommandEncoderWriteTimestamp { - - WGPUProcCommandEncoderWriteTimestamp() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment commandEncoder, MemorySegment querySet, int queryIndex); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCommandEncoderWriteTimestamp.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCommandEncoderWriteTimestamp.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment commandEncoder, MemorySegment querySet, int queryIndex) { - try { - DOWN$MH.invokeExact(funcPtr, commandEncoder, querySet, queryIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderDispatchWorkgroups.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderDispatchWorkgroups.java deleted file mode 100644 index 1a2391bea..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderDispatchWorkgroups.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder, uint32_t, uint32_t, uint32_t) - * } - */ -public class WGPUProcComputePassEncoderDispatchWorkgroups { - - WGPUProcComputePassEncoderDispatchWorkgroups() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, int workgroupCountX, int workgroupCountY, int workgroupCountZ); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderDispatchWorkgroups.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderDispatchWorkgroups.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, int workgroupCountX, int workgroupCountY, int workgroupCountZ) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, workgroupCountX, workgroupCountY, workgroupCountZ); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderDispatchWorkgroupsIndirect.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderDispatchWorkgroupsIndirect.java deleted file mode 100644 index ea2316398..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderDispatchWorkgroupsIndirect.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder, WGPUBuffer, uint64_t) - * } - */ -public class WGPUProcComputePassEncoderDispatchWorkgroupsIndirect { - - WGPUProcComputePassEncoderDispatchWorkgroupsIndirect() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, MemorySegment indirectBuffer, long indirectOffset); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderDispatchWorkgroupsIndirect.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderDispatchWorkgroupsIndirect.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, MemorySegment indirectBuffer, long indirectOffset) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderEnd.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderEnd.java deleted file mode 100644 index 1c7c593e8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderEnd.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder) - * } - */ -public class WGPUProcComputePassEncoderEnd { - - WGPUProcComputePassEncoderEnd() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderEnd.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderEnd.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderInsertDebugMarker.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderInsertDebugMarker.java deleted file mode 100644 index 5cef6c04a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderInsertDebugMarker.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderInsertDebugMarker)(WGPUComputePassEncoder, const char *) - * } - */ -public class WGPUProcComputePassEncoderInsertDebugMarker { - - WGPUProcComputePassEncoderInsertDebugMarker() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, MemorySegment markerLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderInsertDebugMarker.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderInsertDebugMarker.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, MemorySegment markerLabel) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderPopDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderPopDebugGroup.java deleted file mode 100644 index 2a7dc4bbf..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderPopDebugGroup.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder) - * } - */ -public class WGPUProcComputePassEncoderPopDebugGroup { - - WGPUProcComputePassEncoderPopDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderPopDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderPopDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderPushDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderPushDebugGroup.java deleted file mode 100644 index 934e9f8aa..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderPushDebugGroup.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder, const char *) - * } - */ -public class WGPUProcComputePassEncoderPushDebugGroup { - - WGPUProcComputePassEncoderPushDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, MemorySegment groupLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderPushDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderPushDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, MemorySegment groupLabel) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderReference.java deleted file mode 100644 index 1027e0fd9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderReference)(WGPUComputePassEncoder) - * } - */ -public class WGPUProcComputePassEncoderReference { - - WGPUProcComputePassEncoderReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderRelease.java deleted file mode 100644 index 6f7f0d0cb..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderRelease)(WGPUComputePassEncoder) - * } - */ -public class WGPUProcComputePassEncoderRelease { - - WGPUProcComputePassEncoderRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetBindGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetBindGroup.java deleted file mode 100644 index 8c0107eb1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetBindGroup.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder, uint32_t, WGPUBindGroup, size_t, const uint32_t *) - * } - */ -public class WGPUProcComputePassEncoderSetBindGroup { - - WGPUProcComputePassEncoderSetBindGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderSetBindGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderSetBindGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetLabel.java deleted file mode 100644 index f2b79547d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderSetLabel)(WGPUComputePassEncoder, const char *) - * } - */ -public class WGPUProcComputePassEncoderSetLabel { - - WGPUProcComputePassEncoderSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetPipeline.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetPipeline.java deleted file mode 100644 index 7104c9dfc..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePassEncoderSetPipeline.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder, WGPUComputePipeline) - * } - */ -public class WGPUProcComputePassEncoderSetPipeline { - - WGPUProcComputePassEncoderSetPipeline() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePassEncoder, MemorySegment pipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePassEncoderSetPipeline.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePassEncoderSetPipeline.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePassEncoder, MemorySegment pipeline) { - try { - DOWN$MH.invokeExact(funcPtr, computePassEncoder, pipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineGetBindGroupLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineGetBindGroupLayout.java deleted file mode 100644 index 9d603a6cd..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineGetBindGroupLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBindGroupLayout (*WGPUProcComputePipelineGetBindGroupLayout)(WGPUComputePipeline, uint32_t) - * } - */ -public class WGPUProcComputePipelineGetBindGroupLayout { - - WGPUProcComputePipelineGetBindGroupLayout() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment computePipeline, int groupIndex); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePipelineGetBindGroupLayout.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePipelineGetBindGroupLayout.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment computePipeline, int groupIndex) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, computePipeline, groupIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineReference.java deleted file mode 100644 index 3a2266a4e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePipelineReference)(WGPUComputePipeline) - * } - */ -public class WGPUProcComputePipelineReference { - - WGPUProcComputePipelineReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePipelineReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePipelineReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePipeline) { - try { - DOWN$MH.invokeExact(funcPtr, computePipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineRelease.java deleted file mode 100644 index b53d6aa69..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePipelineRelease)(WGPUComputePipeline) - * } - */ -public class WGPUProcComputePipelineRelease { - - WGPUProcComputePipelineRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePipelineRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePipelineRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePipeline) { - try { - DOWN$MH.invokeExact(funcPtr, computePipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineSetLabel.java deleted file mode 100644 index 80251573a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcComputePipelineSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcComputePipelineSetLabel)(WGPUComputePipeline, const char *) - * } - */ -public class WGPUProcComputePipelineSetLabel { - - WGPUProcComputePipelineSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment computePipeline, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcComputePipelineSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcComputePipelineSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment computePipeline, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, computePipeline, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCreateInstance.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCreateInstance.java deleted file mode 100644 index d82f74f33..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcCreateInstance.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUInstance (*WGPUProcCreateInstance)(const WGPUInstanceDescriptor *) - * } - */ -public class WGPUProcCreateInstance { - - WGPUProcCreateInstance() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcCreateInstance.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcCreateInstance.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBindGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBindGroup.java deleted file mode 100644 index e30a075c9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBindGroup.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBindGroup (*WGPUProcDeviceCreateBindGroup)(WGPUDevice, const WGPUBindGroupDescriptor *) - * } - */ -public class WGPUProcDeviceCreateBindGroup { - - WGPUProcDeviceCreateBindGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateBindGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateBindGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBindGroupLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBindGroupLayout.java deleted file mode 100644 index 0dd5255a6..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBindGroupLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBindGroupLayout (*WGPUProcDeviceCreateBindGroupLayout)(WGPUDevice, const WGPUBindGroupLayoutDescriptor *) - * } - */ -public class WGPUProcDeviceCreateBindGroupLayout { - - WGPUProcDeviceCreateBindGroupLayout() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateBindGroupLayout.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateBindGroupLayout.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBuffer.java deleted file mode 100644 index 99683a10a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateBuffer.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBuffer (*WGPUProcDeviceCreateBuffer)(WGPUDevice, const WGPUBufferDescriptor *) - * } - */ -public class WGPUProcDeviceCreateBuffer { - - WGPUProcDeviceCreateBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateCommandEncoder.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateCommandEncoder.java deleted file mode 100644 index 5702742d8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateCommandEncoder.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUCommandEncoder (*WGPUProcDeviceCreateCommandEncoder)(WGPUDevice, const WGPUCommandEncoderDescriptor *) - * } - */ -public class WGPUProcDeviceCreateCommandEncoder { - - WGPUProcDeviceCreateCommandEncoder() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateCommandEncoder.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateCommandEncoder.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateComputePipeline.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateComputePipeline.java deleted file mode 100644 index b0fc11719..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateComputePipeline.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUComputePipeline (*WGPUProcDeviceCreateComputePipeline)(WGPUDevice, const WGPUComputePipelineDescriptor *) - * } - */ -public class WGPUProcDeviceCreateComputePipeline { - - WGPUProcDeviceCreateComputePipeline() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateComputePipeline.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateComputePipeline.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateComputePipelineAsync.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateComputePipelineAsync.java deleted file mode 100644 index 9110762bd..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateComputePipelineAsync.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceCreateComputePipelineAsync)(WGPUDevice, const WGPUComputePipelineDescriptor *, WGPUCreateComputePipelineAsyncCallback, void *) - * } - */ -public class WGPUProcDeviceCreateComputePipelineAsync { - - WGPUProcDeviceCreateComputePipelineAsync() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateComputePipelineAsync.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateComputePipelineAsync.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, device, descriptor, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreatePipelineLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreatePipelineLayout.java deleted file mode 100644 index 6997220de..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreatePipelineLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUPipelineLayout (*WGPUProcDeviceCreatePipelineLayout)(WGPUDevice, const WGPUPipelineLayoutDescriptor *) - * } - */ -public class WGPUProcDeviceCreatePipelineLayout { - - WGPUProcDeviceCreatePipelineLayout() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreatePipelineLayout.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreatePipelineLayout.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateQuerySet.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateQuerySet.java deleted file mode 100644 index 5268f91d6..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateQuerySet.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUQuerySet (*WGPUProcDeviceCreateQuerySet)(WGPUDevice, const WGPUQuerySetDescriptor *) - * } - */ -public class WGPUProcDeviceCreateQuerySet { - - WGPUProcDeviceCreateQuerySet() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateQuerySet.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateQuerySet.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderBundleEncoder.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderBundleEncoder.java deleted file mode 100644 index c6410d0c9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderBundleEncoder.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPURenderBundleEncoder (*WGPUProcDeviceCreateRenderBundleEncoder)(WGPUDevice, const WGPURenderBundleEncoderDescriptor *) - * } - */ -public class WGPUProcDeviceCreateRenderBundleEncoder { - - WGPUProcDeviceCreateRenderBundleEncoder() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateRenderBundleEncoder.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateRenderBundleEncoder.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderPipeline.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderPipeline.java deleted file mode 100644 index c4b02e8d4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderPipeline.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice, const WGPURenderPipelineDescriptor *) - * } - */ -public class WGPUProcDeviceCreateRenderPipeline { - - WGPUProcDeviceCreateRenderPipeline() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateRenderPipeline.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateRenderPipeline.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderPipelineAsync.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderPipelineAsync.java deleted file mode 100644 index 4e988efed..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateRenderPipelineAsync.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceCreateRenderPipelineAsync)(WGPUDevice, const WGPURenderPipelineDescriptor *, WGPUCreateRenderPipelineAsyncCallback, void *) - * } - */ -public class WGPUProcDeviceCreateRenderPipelineAsync { - - WGPUProcDeviceCreateRenderPipelineAsync() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateRenderPipelineAsync.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateRenderPipelineAsync.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, device, descriptor, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateSampler.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateSampler.java deleted file mode 100644 index ca6c41991..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateSampler.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUSampler (*WGPUProcDeviceCreateSampler)(WGPUDevice, const WGPUSamplerDescriptor *) - * } - */ -public class WGPUProcDeviceCreateSampler { - - WGPUProcDeviceCreateSampler() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateSampler.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateSampler.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateShaderModule.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateShaderModule.java deleted file mode 100644 index 3c3ebe7cc..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateShaderModule.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice, const WGPUShaderModuleDescriptor *) - * } - */ -public class WGPUProcDeviceCreateShaderModule { - - WGPUProcDeviceCreateShaderModule() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateShaderModule.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateShaderModule.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateTexture.java deleted file mode 100644 index ddb3d7e02..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceCreateTexture.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUTexture (*WGPUProcDeviceCreateTexture)(WGPUDevice, const WGPUTextureDescriptor *) - * } - */ -public class WGPUProcDeviceCreateTexture { - - WGPUProcDeviceCreateTexture() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceCreateTexture.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceCreateTexture.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceDestroy.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceDestroy.java deleted file mode 100644 index 1dbd1bbb5..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceDestroy.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceDestroy)(WGPUDevice) - * } - */ -public class WGPUProcDeviceDestroy { - - WGPUProcDeviceDestroy() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceDestroy.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceDestroy.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device) { - try { - DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceEnumerateFeatures.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceEnumerateFeatures.java deleted file mode 100644 index 7e69c550f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceEnumerateFeatures.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef size_t (*WGPUProcDeviceEnumerateFeatures)(WGPUDevice, WGPUFeatureName *) - * } - */ -public class WGPUProcDeviceEnumerateFeatures { - - WGPUProcDeviceEnumerateFeatures() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - long apply(MemorySegment device, MemorySegment features); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceEnumerateFeatures.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceEnumerateFeatures.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static long invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment features) { - try { - return (long) DOWN$MH.invokeExact(funcPtr, device, features); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceGetLimits.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceGetLimits.java deleted file mode 100644 index c0018ccdf..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceGetLimits.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice, WGPUSupportedLimits *) - * } - */ -public class WGPUProcDeviceGetLimits { - - WGPUProcDeviceGetLimits() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device, MemorySegment limits); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceGetLimits.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceGetLimits.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment limits) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device, limits); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceGetQueue.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceGetQueue.java deleted file mode 100644 index 42e4d5d47..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceGetQueue.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice) - * } - */ -public class WGPUProcDeviceGetQueue { - - WGPUProcDeviceGetQueue() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceGetQueue.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceGetQueue.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceHasFeature.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceHasFeature.java deleted file mode 100644 index f8f73612f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceHasFeature.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice, WGPUFeatureName) - * } - */ -public class WGPUProcDeviceHasFeature { - - WGPUProcDeviceHasFeature() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device, int feature); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceHasFeature.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceHasFeature.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device, int feature) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device, feature); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDevicePopErrorScope.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDevicePopErrorScope.java deleted file mode 100644 index 8ded9d772..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDevicePopErrorScope.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDevicePopErrorScope)(WGPUDevice, WGPUErrorCallback, void *) - * } - */ -public class WGPUProcDevicePopErrorScope { - - WGPUProcDevicePopErrorScope() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDevicePopErrorScope.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDevicePopErrorScope.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, device, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDevicePushErrorScope.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDevicePushErrorScope.java deleted file mode 100644 index ed3656c74..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDevicePushErrorScope.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice, WGPUErrorFilter) - * } - */ -public class WGPUProcDevicePushErrorScope { - - WGPUProcDevicePushErrorScope() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device, int filter); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDevicePushErrorScope.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDevicePushErrorScope.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device, int filter) { - try { - DOWN$MH.invokeExact(funcPtr, device, filter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceReference.java deleted file mode 100644 index a4b5a5395..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceReference)(WGPUDevice) - * } - */ -public class WGPUProcDeviceReference { - - WGPUProcDeviceReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device) { - try { - DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceRelease.java deleted file mode 100644 index c98cd56a8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceRelease)(WGPUDevice) - * } - */ -public class WGPUProcDeviceRelease { - - WGPUProcDeviceRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device) { - try { - DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceSetLabel.java deleted file mode 100644 index 4b72c3454..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice, const char *) - * } - */ -public class WGPUProcDeviceSetLabel { - - WGPUProcDeviceSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, device, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceSetUncapturedErrorCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceSetUncapturedErrorCallback.java deleted file mode 100644 index 273551747..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcDeviceSetUncapturedErrorCallback.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice, WGPUErrorCallback, void *) - * } - */ -public class WGPUProcDeviceSetUncapturedErrorCallback { - - WGPUProcDeviceSetUncapturedErrorCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment device, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcDeviceSetUncapturedErrorCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcDeviceSetUncapturedErrorCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, device, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcGetProcAddress.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcGetProcAddress.java deleted file mode 100644 index 3a66b1efe..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcGetProcAddress.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice, const char *) - * } - */ -public class WGPUProcGetProcAddress { - - WGPUProcGetProcAddress() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, MemorySegment procName); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcGetProcAddress.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcGetProcAddress.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, MemorySegment procName) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, procName); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceCreateSurface.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceCreateSurface.java deleted file mode 100644 index f38df69a6..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceCreateSurface.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance, const WGPUSurfaceDescriptor *) - * } - */ -public class WGPUProcInstanceCreateSurface { - - WGPUProcInstanceCreateSurface() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment instance, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcInstanceCreateSurface.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcInstanceCreateSurface.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment instance, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, instance, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceProcessEvents.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceProcessEvents.java deleted file mode 100644 index 3c47acbf9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceProcessEvents.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance) - * } - */ -public class WGPUProcInstanceProcessEvents { - - WGPUProcInstanceProcessEvents() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment instance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcInstanceProcessEvents.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcInstanceProcessEvents.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment instance) { - try { - DOWN$MH.invokeExact(funcPtr, instance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceReference.java deleted file mode 100644 index 0b05c7167..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcInstanceReference)(WGPUInstance) - * } - */ -public class WGPUProcInstanceReference { - - WGPUProcInstanceReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment instance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcInstanceReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcInstanceReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment instance) { - try { - DOWN$MH.invokeExact(funcPtr, instance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceRelease.java deleted file mode 100644 index 0f405dfe4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcInstanceRelease)(WGPUInstance) - * } - */ -public class WGPUProcInstanceRelease { - - WGPUProcInstanceRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment instance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcInstanceRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcInstanceRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment instance) { - try { - DOWN$MH.invokeExact(funcPtr, instance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceRequestAdapter.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceRequestAdapter.java deleted file mode 100644 index d1250f2dc..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcInstanceRequestAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcInstanceRequestAdapter)(WGPUInstance, const WGPURequestAdapterOptions *, WGPURequestAdapterCallback, void *) - * } - */ -public class WGPUProcInstanceRequestAdapter { - - WGPUProcInstanceRequestAdapter() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment instance, MemorySegment options, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcInstanceRequestAdapter.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcInstanceRequestAdapter.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment instance, MemorySegment options, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, instance, options, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutReference.java deleted file mode 100644 index c38a9f483..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcPipelineLayoutReference)(WGPUPipelineLayout) - * } - */ -public class WGPUProcPipelineLayoutReference { - - WGPUProcPipelineLayoutReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment pipelineLayout); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcPipelineLayoutReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcPipelineLayoutReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment pipelineLayout) { - try { - DOWN$MH.invokeExact(funcPtr, pipelineLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutRelease.java deleted file mode 100644 index 40cc7fd44..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcPipelineLayoutRelease)(WGPUPipelineLayout) - * } - */ -public class WGPUProcPipelineLayoutRelease { - - WGPUProcPipelineLayoutRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment pipelineLayout); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcPipelineLayoutRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcPipelineLayoutRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment pipelineLayout) { - try { - DOWN$MH.invokeExact(funcPtr, pipelineLayout); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutSetLabel.java deleted file mode 100644 index 7bbc7d815..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcPipelineLayoutSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcPipelineLayoutSetLabel)(WGPUPipelineLayout, const char *) - * } - */ -public class WGPUProcPipelineLayoutSetLabel { - - WGPUProcPipelineLayoutSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment pipelineLayout, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcPipelineLayoutSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcPipelineLayoutSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment pipelineLayout, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, pipelineLayout, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetDestroy.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetDestroy.java deleted file mode 100644 index a61d6c0b2..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetDestroy.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQuerySetDestroy)(WGPUQuerySet) - * } - */ -public class WGPUProcQuerySetDestroy { - - WGPUProcQuerySetDestroy() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment querySet); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQuerySetDestroy.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQuerySetDestroy.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment querySet) { - try { - DOWN$MH.invokeExact(funcPtr, querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetGetCount.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetGetCount.java deleted file mode 100644 index c5aae9788..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetGetCount.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint32_t (*WGPUProcQuerySetGetCount)(WGPUQuerySet) - * } - */ -public class WGPUProcQuerySetGetCount { - - WGPUProcQuerySetGetCount() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment querySet); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQuerySetGetCount.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQuerySetGetCount.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment querySet) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetGetType.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetGetType.java deleted file mode 100644 index 5c1d09b34..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetGetType.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUQueryType (*WGPUProcQuerySetGetType)(WGPUQuerySet) - * } - */ -public class WGPUProcQuerySetGetType { - - WGPUProcQuerySetGetType() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment querySet); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQuerySetGetType.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQuerySetGetType.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment querySet) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetReference.java deleted file mode 100644 index ee039147d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQuerySetReference)(WGPUQuerySet) - * } - */ -public class WGPUProcQuerySetReference { - - WGPUProcQuerySetReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment querySet); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQuerySetReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQuerySetReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment querySet) { - try { - DOWN$MH.invokeExact(funcPtr, querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetRelease.java deleted file mode 100644 index 8c7247f2f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQuerySetRelease)(WGPUQuerySet) - * } - */ -public class WGPUProcQuerySetRelease { - - WGPUProcQuerySetRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment querySet); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQuerySetRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQuerySetRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment querySet) { - try { - DOWN$MH.invokeExact(funcPtr, querySet); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetSetLabel.java deleted file mode 100644 index ee068668b..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQuerySetSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQuerySetSetLabel)(WGPUQuerySet, const char *) - * } - */ -public class WGPUProcQuerySetSetLabel { - - WGPUProcQuerySetSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment querySet, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQuerySetSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQuerySetSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment querySet, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, querySet, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueOnSubmittedWorkDone.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueOnSubmittedWorkDone.java deleted file mode 100644 index 259a5514a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueOnSubmittedWorkDone.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue, WGPUQueueWorkDoneCallback, void *) - * } - */ -public class WGPUProcQueueOnSubmittedWorkDone { - - WGPUProcQueueOnSubmittedWorkDone() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueOnSubmittedWorkDone.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueOnSubmittedWorkDone.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, queue, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueReference.java deleted file mode 100644 index 1b4893de4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueReference)(WGPUQueue) - * } - */ -public class WGPUProcQueueReference { - - WGPUProcQueueReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue) { - try { - DOWN$MH.invokeExact(funcPtr, queue); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueRelease.java deleted file mode 100644 index c5bf33178..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueRelease)(WGPUQueue) - * } - */ -public class WGPUProcQueueRelease { - - WGPUProcQueueRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue) { - try { - DOWN$MH.invokeExact(funcPtr, queue); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueSetLabel.java deleted file mode 100644 index 5beee65e9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueSetLabel)(WGPUQueue, const char *) - * } - */ -public class WGPUProcQueueSetLabel { - - WGPUProcQueueSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, queue, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueSubmit.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueSubmit.java deleted file mode 100644 index 38cb0d938..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueSubmit.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueSubmit)(WGPUQueue, size_t, const WGPUCommandBuffer *) - * } - */ -public class WGPUProcQueueSubmit { - - WGPUProcQueueSubmit() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue, long commandCount, MemorySegment commands); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueSubmit.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueSubmit.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue, long commandCount, MemorySegment commands) { - try { - DOWN$MH.invokeExact(funcPtr, queue, commandCount, commands); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueWriteBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueWriteBuffer.java deleted file mode 100644 index 5fb21892e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueWriteBuffer.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue, WGPUBuffer, uint64_t, const void *, size_t) - * } - */ -public class WGPUProcQueueWriteBuffer { - - WGPUProcQueueWriteBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue, MemorySegment buffer, long bufferOffset, MemorySegment data, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueWriteBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueWriteBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue, MemorySegment buffer, long bufferOffset, MemorySegment data, long size) { - try { - DOWN$MH.invokeExact(funcPtr, queue, buffer, bufferOffset, data, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueWriteTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueWriteTexture.java deleted file mode 100644 index d95d7acb8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcQueueWriteTexture.java +++ /dev/null @@ -1,72 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue, const WGPUImageCopyTexture *, const void *, size_t, const WGPUTextureDataLayout *, const WGPUExtent3D *) - * } - */ -public class WGPUProcQueueWriteTexture { - - WGPUProcQueueWriteTexture() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment queue, MemorySegment destination, MemorySegment data, long dataSize, MemorySegment dataLayout, MemorySegment writeSize); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcQueueWriteTexture.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcQueueWriteTexture.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment queue, MemorySegment destination, MemorySegment data, long dataSize, MemorySegment dataLayout, MemorySegment writeSize) { - try { - DOWN$MH.invokeExact(funcPtr, queue, destination, data, dataSize, dataLayout, writeSize); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDraw.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDraw.java deleted file mode 100644 index ca962f8fb..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDraw.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderDraw)(WGPURenderBundleEncoder, uint32_t, uint32_t, uint32_t, uint32_t) - * } - */ -public class WGPUProcRenderBundleEncoderDraw { - - WGPUProcRenderBundleEncoderDraw() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, int vertexCount, int instanceCount, int firstVertex, int firstInstance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderDraw.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderDraw.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, int vertexCount, int instanceCount, int firstVertex, int firstInstance) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, vertexCount, instanceCount, firstVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndexed.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndexed.java deleted file mode 100644 index 2ae9e5f9a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndexed.java +++ /dev/null @@ -1,72 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderDrawIndexed)(WGPURenderBundleEncoder, uint32_t, uint32_t, uint32_t, int32_t, uint32_t) - * } - */ -public class WGPUProcRenderBundleEncoderDrawIndexed { - - WGPUProcRenderBundleEncoderDrawIndexed() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderDrawIndexed.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderDrawIndexed.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndexedIndirect.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndexedIndirect.java deleted file mode 100644 index f71e2e55f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndexedIndirect.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderDrawIndexedIndirect)(WGPURenderBundleEncoder, WGPUBuffer, uint64_t) - * } - */ -public class WGPUProcRenderBundleEncoderDrawIndexedIndirect { - - WGPUProcRenderBundleEncoderDrawIndexedIndirect() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment indirectBuffer, long indirectOffset); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderDrawIndexedIndirect.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderDrawIndexedIndirect.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment indirectBuffer, long indirectOffset) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndirect.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndirect.java deleted file mode 100644 index df5e89214..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderDrawIndirect.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderDrawIndirect)(WGPURenderBundleEncoder, WGPUBuffer, uint64_t) - * } - */ -public class WGPUProcRenderBundleEncoderDrawIndirect { - - WGPUProcRenderBundleEncoderDrawIndirect() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment indirectBuffer, long indirectOffset); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderDrawIndirect.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderDrawIndirect.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment indirectBuffer, long indirectOffset) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderFinish.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderFinish.java deleted file mode 100644 index 35deda027..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderFinish.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder, const WGPURenderBundleDescriptor *) - * } - */ -public class WGPUProcRenderBundleEncoderFinish { - - WGPUProcRenderBundleEncoderFinish() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment renderBundleEncoder, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderFinish.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderFinish.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderInsertDebugMarker.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderInsertDebugMarker.java deleted file mode 100644 index 5b5d24170..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderInsertDebugMarker.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderInsertDebugMarker)(WGPURenderBundleEncoder, const char *) - * } - */ -public class WGPUProcRenderBundleEncoderInsertDebugMarker { - - WGPUProcRenderBundleEncoderInsertDebugMarker() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment markerLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderInsertDebugMarker.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderInsertDebugMarker.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment markerLabel) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderPopDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderPopDebugGroup.java deleted file mode 100644 index ab2911f26..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderPopDebugGroup.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderPopDebugGroup)(WGPURenderBundleEncoder) - * } - */ -public class WGPUProcRenderBundleEncoderPopDebugGroup { - - WGPUProcRenderBundleEncoderPopDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderPopDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderPopDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderPushDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderPushDebugGroup.java deleted file mode 100644 index b993ec875..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderPushDebugGroup.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderPushDebugGroup)(WGPURenderBundleEncoder, const char *) - * } - */ -public class WGPUProcRenderBundleEncoderPushDebugGroup { - - WGPUProcRenderBundleEncoderPushDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment groupLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderPushDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderPushDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment groupLabel) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderReference.java deleted file mode 100644 index e8bcae87e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderReference)(WGPURenderBundleEncoder) - * } - */ -public class WGPUProcRenderBundleEncoderReference { - - WGPUProcRenderBundleEncoderReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderRelease.java deleted file mode 100644 index 487a111dc..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderRelease)(WGPURenderBundleEncoder) - * } - */ -public class WGPUProcRenderBundleEncoderRelease { - - WGPUProcRenderBundleEncoderRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetBindGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetBindGroup.java deleted file mode 100644 index 33413a0e2..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetBindGroup.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder, uint32_t, WGPUBindGroup, size_t, const uint32_t *) - * } - */ -public class WGPUProcRenderBundleEncoderSetBindGroup { - - WGPUProcRenderBundleEncoderSetBindGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderSetBindGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderSetBindGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetIndexBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetIndexBuffer.java deleted file mode 100644 index dce716ebf..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetIndexBuffer.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder, WGPUBuffer, WGPUIndexFormat, uint64_t, uint64_t) - * } - */ -public class WGPUProcRenderBundleEncoderSetIndexBuffer { - - WGPUProcRenderBundleEncoderSetIndexBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment buffer, int format, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderSetIndexBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderSetIndexBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment buffer, int format, long offset, long size) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, buffer, format, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetLabel.java deleted file mode 100644 index 51a815a78..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderSetLabel)(WGPURenderBundleEncoder, const char *) - * } - */ -public class WGPUProcRenderBundleEncoderSetLabel { - - WGPUProcRenderBundleEncoderSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetPipeline.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetPipeline.java deleted file mode 100644 index eb61fe998..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetPipeline.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder, WGPURenderPipeline) - * } - */ -public class WGPUProcRenderBundleEncoderSetPipeline { - - WGPUProcRenderBundleEncoderSetPipeline() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, MemorySegment pipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderSetPipeline.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderSetPipeline.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, MemorySegment pipeline) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, pipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetVertexBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetVertexBuffer.java deleted file mode 100644 index 0df16221c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleEncoderSetVertexBuffer.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder, uint32_t, WGPUBuffer, uint64_t, uint64_t) - * } - */ -public class WGPUProcRenderBundleEncoderSetVertexBuffer { - - WGPUProcRenderBundleEncoderSetVertexBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundleEncoder, int slot, MemorySegment buffer, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleEncoderSetVertexBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleEncoderSetVertexBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundleEncoder, int slot, MemorySegment buffer, long offset, long size) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundleEncoder, slot, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleReference.java deleted file mode 100644 index ec73bc6fd..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleReference)(WGPURenderBundle) - * } - */ -public class WGPUProcRenderBundleReference { - - WGPUProcRenderBundleReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundle); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundle) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundle); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleRelease.java deleted file mode 100644 index 8fa23937f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle) - * } - */ -public class WGPUProcRenderBundleRelease { - - WGPUProcRenderBundleRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundle); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundle) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundle); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleSetLabel.java deleted file mode 100644 index ab8d79e0c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderBundleSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderBundleSetLabel)(WGPURenderBundle, const char *) - * } - */ -public class WGPUProcRenderBundleSetLabel { - - WGPUProcRenderBundleSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderBundle, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderBundleSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderBundleSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderBundle, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, renderBundle, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderBeginOcclusionQuery.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderBeginOcclusionQuery.java deleted file mode 100644 index 4631ee228..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderBeginOcclusionQuery.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder, uint32_t) - * } - */ -public class WGPUProcRenderPassEncoderBeginOcclusionQuery { - - WGPUProcRenderPassEncoderBeginOcclusionQuery() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int queryIndex); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderBeginOcclusionQuery.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderBeginOcclusionQuery.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int queryIndex) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, queryIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDraw.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDraw.java deleted file mode 100644 index 450d13457..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDraw.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderDraw)(WGPURenderPassEncoder, uint32_t, uint32_t, uint32_t, uint32_t) - * } - */ -public class WGPUProcRenderPassEncoderDraw { - - WGPUProcRenderPassEncoderDraw() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int vertexCount, int instanceCount, int firstVertex, int firstInstance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderDraw.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderDraw.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int vertexCount, int instanceCount, int firstVertex, int firstInstance) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, vertexCount, instanceCount, firstVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndexed.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndexed.java deleted file mode 100644 index 95d32d224..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndexed.java +++ /dev/null @@ -1,72 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderDrawIndexed)(WGPURenderPassEncoder, uint32_t, uint32_t, uint32_t, int32_t, uint32_t) - * } - */ -public class WGPUProcRenderPassEncoderDrawIndexed { - - WGPUProcRenderPassEncoderDrawIndexed() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderDrawIndexed.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderDrawIndexed.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndexedIndirect.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndexedIndirect.java deleted file mode 100644 index e9135e11b..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndexedIndirect.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderDrawIndexedIndirect)(WGPURenderPassEncoder, WGPUBuffer, uint64_t) - * } - */ -public class WGPUProcRenderPassEncoderDrawIndexedIndirect { - - WGPUProcRenderPassEncoderDrawIndexedIndirect() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment indirectBuffer, long indirectOffset); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderDrawIndexedIndirect.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderDrawIndexedIndirect.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment indirectBuffer, long indirectOffset) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndirect.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndirect.java deleted file mode 100644 index be01da447..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderDrawIndirect.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderDrawIndirect)(WGPURenderPassEncoder, WGPUBuffer, uint64_t) - * } - */ -public class WGPUProcRenderPassEncoderDrawIndirect { - - WGPUProcRenderPassEncoderDrawIndirect() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment indirectBuffer, long indirectOffset); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderDrawIndirect.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderDrawIndirect.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment indirectBuffer, long indirectOffset) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, indirectBuffer, indirectOffset); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderEnd.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderEnd.java deleted file mode 100644 index 0c2c180b2..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderEnd.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderEnd)(WGPURenderPassEncoder) - * } - */ -public class WGPUProcRenderPassEncoderEnd { - - WGPUProcRenderPassEncoderEnd() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderEnd.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderEnd.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderEndOcclusionQuery.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderEndOcclusionQuery.java deleted file mode 100644 index 3d1cbd45e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderEndOcclusionQuery.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderEndOcclusionQuery)(WGPURenderPassEncoder) - * } - */ -public class WGPUProcRenderPassEncoderEndOcclusionQuery { - - WGPUProcRenderPassEncoderEndOcclusionQuery() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderEndOcclusionQuery.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderEndOcclusionQuery.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderExecuteBundles.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderExecuteBundles.java deleted file mode 100644 index 5b148cf0f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderExecuteBundles.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderExecuteBundles)(WGPURenderPassEncoder, size_t, const WGPURenderBundle *) - * } - */ -public class WGPUProcRenderPassEncoderExecuteBundles { - - WGPUProcRenderPassEncoderExecuteBundles() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, long bundleCount, MemorySegment bundles); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderExecuteBundles.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderExecuteBundles.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, long bundleCount, MemorySegment bundles) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, bundleCount, bundles); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderInsertDebugMarker.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderInsertDebugMarker.java deleted file mode 100644 index 78b183049..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderInsertDebugMarker.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderInsertDebugMarker)(WGPURenderPassEncoder, const char *) - * } - */ -public class WGPUProcRenderPassEncoderInsertDebugMarker { - - WGPUProcRenderPassEncoderInsertDebugMarker() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment markerLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderInsertDebugMarker.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderInsertDebugMarker.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment markerLabel) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, markerLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderPopDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderPopDebugGroup.java deleted file mode 100644 index 9fbf935c2..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderPopDebugGroup.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderPopDebugGroup)(WGPURenderPassEncoder) - * } - */ -public class WGPUProcRenderPassEncoderPopDebugGroup { - - WGPUProcRenderPassEncoderPopDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderPopDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderPopDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderPushDebugGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderPushDebugGroup.java deleted file mode 100644 index 62dc65b37..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderPushDebugGroup.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderPushDebugGroup)(WGPURenderPassEncoder, const char *) - * } - */ -public class WGPUProcRenderPassEncoderPushDebugGroup { - - WGPUProcRenderPassEncoderPushDebugGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment groupLabel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderPushDebugGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderPushDebugGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment groupLabel) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, groupLabel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderReference.java deleted file mode 100644 index 71b1a6b2a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderReference)(WGPURenderPassEncoder) - * } - */ -public class WGPUProcRenderPassEncoderReference { - - WGPUProcRenderPassEncoderReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderRelease.java deleted file mode 100644 index ad3730524..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderRelease)(WGPURenderPassEncoder) - * } - */ -public class WGPUProcRenderPassEncoderRelease { - - WGPUProcRenderPassEncoderRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetBindGroup.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetBindGroup.java deleted file mode 100644 index 7950114ef..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetBindGroup.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetBindGroup)(WGPURenderPassEncoder, uint32_t, WGPUBindGroup, size_t, const uint32_t *) - * } - */ -public class WGPUProcRenderPassEncoderSetBindGroup { - - WGPUProcRenderPassEncoderSetBindGroup() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetBindGroup.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetBindGroup.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int groupIndex, MemorySegment group, long dynamicOffsetCount, MemorySegment dynamicOffsets) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, groupIndex, group, dynamicOffsetCount, dynamicOffsets); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetBlendConstant.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetBlendConstant.java deleted file mode 100644 index 597ee5e4e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetBlendConstant.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetBlendConstant)(WGPURenderPassEncoder, const WGPUColor *) - * } - */ -public class WGPUProcRenderPassEncoderSetBlendConstant { - - WGPUProcRenderPassEncoderSetBlendConstant() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment color); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetBlendConstant.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetBlendConstant.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment color) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, color); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetIndexBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetIndexBuffer.java deleted file mode 100644 index cd6b00bfb..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetIndexBuffer.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetIndexBuffer)(WGPURenderPassEncoder, WGPUBuffer, WGPUIndexFormat, uint64_t, uint64_t) - * } - */ -public class WGPUProcRenderPassEncoderSetIndexBuffer { - - WGPUProcRenderPassEncoderSetIndexBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment buffer, int format, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetIndexBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetIndexBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment buffer, int format, long offset, long size) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, buffer, format, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetLabel.java deleted file mode 100644 index ffa80d863..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetLabel)(WGPURenderPassEncoder, const char *) - * } - */ -public class WGPUProcRenderPassEncoderSetLabel { - - WGPUProcRenderPassEncoderSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetPipeline.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetPipeline.java deleted file mode 100644 index cbc80694f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetPipeline.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetPipeline)(WGPURenderPassEncoder, WGPURenderPipeline) - * } - */ -public class WGPUProcRenderPassEncoderSetPipeline { - - WGPUProcRenderPassEncoderSetPipeline() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, MemorySegment pipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetPipeline.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetPipeline.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, MemorySegment pipeline) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, pipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetScissorRect.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetScissorRect.java deleted file mode 100644 index 9eec28af4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetScissorRect.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder, uint32_t, uint32_t, uint32_t, uint32_t) - * } - */ -public class WGPUProcRenderPassEncoderSetScissorRect { - - WGPUProcRenderPassEncoderSetScissorRect() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int x, int y, int width, int height); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetScissorRect.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetScissorRect.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int x, int y, int width, int height) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, x, y, width, height); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetStencilReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetStencilReference.java deleted file mode 100644 index 1ee463262..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetStencilReference.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder, uint32_t) - * } - */ -public class WGPUProcRenderPassEncoderSetStencilReference { - - WGPUProcRenderPassEncoderSetStencilReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int reference); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetStencilReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetStencilReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int reference) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, reference); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetVertexBuffer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetVertexBuffer.java deleted file mode 100644 index eb6dca3db..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetVertexBuffer.java +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder, uint32_t, WGPUBuffer, uint64_t, uint64_t) - * } - */ -public class WGPUProcRenderPassEncoderSetVertexBuffer { - - WGPUProcRenderPassEncoderSetVertexBuffer() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, int slot, MemorySegment buffer, long offset, long size); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_LONG_LONG, - WGPU.C_LONG_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetVertexBuffer.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetVertexBuffer.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, int slot, MemorySegment buffer, long offset, long size) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, slot, buffer, offset, size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetViewport.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetViewport.java deleted file mode 100644 index 623dac400..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPassEncoderSetViewport.java +++ /dev/null @@ -1,73 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder, float, float, float, float, float, float) - * } - */ -public class WGPUProcRenderPassEncoderSetViewport { - - WGPUProcRenderPassEncoderSetViewport() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT, - WGPU.C_FLOAT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPassEncoderSetViewport.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPassEncoderSetViewport.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) { - try { - DOWN$MH.invokeExact(funcPtr, renderPassEncoder, x, y, width, height, minDepth, maxDepth); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineGetBindGroupLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineGetBindGroupLayout.java deleted file mode 100644 index 23bd91376..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineGetBindGroupLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUBindGroupLayout (*WGPUProcRenderPipelineGetBindGroupLayout)(WGPURenderPipeline, uint32_t) - * } - */ -public class WGPUProcRenderPipelineGetBindGroupLayout { - - WGPUProcRenderPipelineGetBindGroupLayout() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment renderPipeline, int groupIndex); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPipelineGetBindGroupLayout.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPipelineGetBindGroupLayout.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment renderPipeline, int groupIndex) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, renderPipeline, groupIndex); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineReference.java deleted file mode 100644 index 107e367b1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPipelineReference)(WGPURenderPipeline) - * } - */ -public class WGPUProcRenderPipelineReference { - - WGPUProcRenderPipelineReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPipelineReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPipelineReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPipeline) { - try { - DOWN$MH.invokeExact(funcPtr, renderPipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineRelease.java deleted file mode 100644 index ffcb49d32..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPipelineRelease)(WGPURenderPipeline) - * } - */ -public class WGPUProcRenderPipelineRelease { - - WGPUProcRenderPipelineRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPipeline); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPipelineRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPipelineRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPipeline) { - try { - DOWN$MH.invokeExact(funcPtr, renderPipeline); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineSetLabel.java deleted file mode 100644 index 5d9e39d60..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcRenderPipelineSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline, const char *) - * } - */ -public class WGPUProcRenderPipelineSetLabel { - - WGPUProcRenderPipelineSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment renderPipeline, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcRenderPipelineSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcRenderPipelineSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment renderPipeline, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, renderPipeline, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerReference.java deleted file mode 100644 index 6118a21ee..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSamplerReference)(WGPUSampler) - * } - */ -public class WGPUProcSamplerReference { - - WGPUProcSamplerReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment sampler); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSamplerReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSamplerReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment sampler) { - try { - DOWN$MH.invokeExact(funcPtr, sampler); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerRelease.java deleted file mode 100644 index c4332a9af..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSamplerRelease)(WGPUSampler) - * } - */ -public class WGPUProcSamplerRelease { - - WGPUProcSamplerRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment sampler); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSamplerRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSamplerRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment sampler) { - try { - DOWN$MH.invokeExact(funcPtr, sampler); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerSetLabel.java deleted file mode 100644 index 930a98156..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSamplerSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSamplerSetLabel)(WGPUSampler, const char *) - * } - */ -public class WGPUProcSamplerSetLabel { - - WGPUProcSamplerSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment sampler, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSamplerSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSamplerSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment sampler, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, sampler, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleGetCompilationInfo.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleGetCompilationInfo.java deleted file mode 100644 index 923d50a03..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleGetCompilationInfo.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcShaderModuleGetCompilationInfo)(WGPUShaderModule, WGPUCompilationInfoCallback, void *) - * } - */ -public class WGPUProcShaderModuleGetCompilationInfo { - - WGPUProcShaderModuleGetCompilationInfo() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment shaderModule, MemorySegment callback, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcShaderModuleGetCompilationInfo.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcShaderModuleGetCompilationInfo.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment shaderModule, MemorySegment callback, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, shaderModule, callback, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleReference.java deleted file mode 100644 index 79ce5568d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcShaderModuleReference)(WGPUShaderModule) - * } - */ -public class WGPUProcShaderModuleReference { - - WGPUProcShaderModuleReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment shaderModule); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcShaderModuleReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcShaderModuleReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment shaderModule) { - try { - DOWN$MH.invokeExact(funcPtr, shaderModule); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleRelease.java deleted file mode 100644 index 37c7d851a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule) - * } - */ -public class WGPUProcShaderModuleRelease { - - WGPUProcShaderModuleRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment shaderModule); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcShaderModuleRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcShaderModuleRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment shaderModule) { - try { - DOWN$MH.invokeExact(funcPtr, shaderModule); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleSetLabel.java deleted file mode 100644 index c4cd8c1fb..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcShaderModuleSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule, const char *) - * } - */ -public class WGPUProcShaderModuleSetLabel { - - WGPUProcShaderModuleSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment shaderModule, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcShaderModuleSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcShaderModuleSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment shaderModule, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, shaderModule, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceCapabilitiesFreeMembers.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceCapabilitiesFreeMembers.java deleted file mode 100644 index 7af2d684f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceCapabilitiesFreeMembers.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceCapabilitiesFreeMembers)(WGPUSurfaceCapabilities) - * } - */ -public class WGPUProcSurfaceCapabilitiesFreeMembers { - - WGPUProcSurfaceCapabilitiesFreeMembers() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment capabilities); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPUSurfaceCapabilities.layout() - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceCapabilitiesFreeMembers.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceCapabilitiesFreeMembers.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment capabilities) { - try { - DOWN$MH.invokeExact(funcPtr, capabilities); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceConfigure.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceConfigure.java deleted file mode 100644 index f9d707e3c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceConfigure.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceConfigure)(WGPUSurface, const WGPUSurfaceConfiguration *) - * } - */ -public class WGPUProcSurfaceConfigure { - - WGPUProcSurfaceConfigure() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface, MemorySegment config); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceConfigure.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceConfigure.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface, MemorySegment config) { - try { - DOWN$MH.invokeExact(funcPtr, surface, config); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetCapabilities.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetCapabilities.java deleted file mode 100644 index ffb985b26..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetCapabilities.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceGetCapabilities)(WGPUSurface, WGPUAdapter, WGPUSurfaceCapabilities *) - * } - */ -public class WGPUProcSurfaceGetCapabilities { - - WGPUProcSurfaceGetCapabilities() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface, MemorySegment adapter, MemorySegment capabilities); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceGetCapabilities.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceGetCapabilities.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface, MemorySegment adapter, MemorySegment capabilities) { - try { - DOWN$MH.invokeExact(funcPtr, surface, adapter, capabilities); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetCurrentTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetCurrentTexture.java deleted file mode 100644 index bf66c5be2..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetCurrentTexture.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceGetCurrentTexture)(WGPUSurface, WGPUSurfaceTexture *) - * } - */ -public class WGPUProcSurfaceGetCurrentTexture { - - WGPUProcSurfaceGetCurrentTexture() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface, MemorySegment surfaceTexture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceGetCurrentTexture.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceGetCurrentTexture.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface, MemorySegment surfaceTexture) { - try { - DOWN$MH.invokeExact(funcPtr, surface, surfaceTexture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetPreferredFormat.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetPreferredFormat.java deleted file mode 100644 index 6b138efed..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceGetPreferredFormat.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface, WGPUAdapter) - * } - */ -public class WGPUProcSurfaceGetPreferredFormat { - - WGPUProcSurfaceGetPreferredFormat() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment surface, MemorySegment adapter); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceGetPreferredFormat.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceGetPreferredFormat.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment surface, MemorySegment adapter) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, surface, adapter); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfacePresent.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfacePresent.java deleted file mode 100644 index 9e125604f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfacePresent.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfacePresent)(WGPUSurface) - * } - */ -public class WGPUProcSurfacePresent { - - WGPUProcSurfacePresent() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfacePresent.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfacePresent.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface) { - try { - DOWN$MH.invokeExact(funcPtr, surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceReference.java deleted file mode 100644 index fe04b537d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceReference)(WGPUSurface) - * } - */ -public class WGPUProcSurfaceReference { - - WGPUProcSurfaceReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface) { - try { - DOWN$MH.invokeExact(funcPtr, surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceRelease.java deleted file mode 100644 index 992e03e95..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceRelease)(WGPUSurface) - * } - */ -public class WGPUProcSurfaceRelease { - - WGPUProcSurfaceRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface) { - try { - DOWN$MH.invokeExact(funcPtr, surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceUnconfigure.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceUnconfigure.java deleted file mode 100644 index ffea33cec..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcSurfaceUnconfigure.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcSurfaceUnconfigure)(WGPUSurface) - * } - */ -public class WGPUProcSurfaceUnconfigure { - - WGPUProcSurfaceUnconfigure() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment surface); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcSurfaceUnconfigure.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcSurfaceUnconfigure.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment surface) { - try { - DOWN$MH.invokeExact(funcPtr, surface); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureCreateView.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureCreateView.java deleted file mode 100644 index fe52e5e90..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureCreateView.java +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUTextureView (*WGPUProcTextureCreateView)(WGPUTexture, const WGPUTextureViewDescriptor *) - * } - */ -public class WGPUProcTextureCreateView { - - WGPUProcTextureCreateView() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment texture, MemorySegment descriptor); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureCreateView.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureCreateView.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment texture, MemorySegment descriptor) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, texture, descriptor); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureDestroy.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureDestroy.java deleted file mode 100644 index 226fdc3b6..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureDestroy.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureDestroy)(WGPUTexture) - * } - */ -public class WGPUProcTextureDestroy { - - WGPUProcTextureDestroy() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureDestroy.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureDestroy.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetDepthOrArrayLayers.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetDepthOrArrayLayers.java deleted file mode 100644 index 6c1881037..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetDepthOrArrayLayers.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint32_t (*WGPUProcTextureGetDepthOrArrayLayers)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetDepthOrArrayLayers { - - WGPUProcTextureGetDepthOrArrayLayers() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetDepthOrArrayLayers.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetDepthOrArrayLayers.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetDimension.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetDimension.java deleted file mode 100644 index 92f188ef8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetDimension.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUTextureDimension (*WGPUProcTextureGetDimension)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetDimension { - - WGPUProcTextureGetDimension() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetDimension.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetDimension.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetFormat.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetFormat.java deleted file mode 100644 index 12215f14b..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetFormat.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUTextureFormat (*WGPUProcTextureGetFormat)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetFormat { - - WGPUProcTextureGetFormat() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetFormat.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetFormat.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetHeight.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetHeight.java deleted file mode 100644 index 722fbb0e5..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetHeight.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint32_t (*WGPUProcTextureGetHeight)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetHeight { - - WGPUProcTextureGetHeight() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetHeight.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetHeight.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetMipLevelCount.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetMipLevelCount.java deleted file mode 100644 index 11308af5e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetMipLevelCount.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint32_t (*WGPUProcTextureGetMipLevelCount)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetMipLevelCount { - - WGPUProcTextureGetMipLevelCount() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetMipLevelCount.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetMipLevelCount.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetSampleCount.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetSampleCount.java deleted file mode 100644 index 3df68c5e9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetSampleCount.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint32_t (*WGPUProcTextureGetSampleCount)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetSampleCount { - - WGPUProcTextureGetSampleCount() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetSampleCount.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetSampleCount.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetUsage.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetUsage.java deleted file mode 100644 index a68c326d3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetUsage.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef WGPUTextureUsageFlags (*WGPUProcTextureGetUsage)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetUsage { - - WGPUProcTextureGetUsage() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetUsage.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetUsage.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetWidth.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetWidth.java deleted file mode 100644 index ea6b40455..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureGetWidth.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef uint32_t (*WGPUProcTextureGetWidth)(WGPUTexture) - * } - */ -public class WGPUProcTextureGetWidth { - - WGPUProcTextureGetWidth() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureGetWidth.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureGetWidth.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureReference.java deleted file mode 100644 index 282863ad1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureReference)(WGPUTexture) - * } - */ -public class WGPUProcTextureReference { - - WGPUProcTextureReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureRelease.java deleted file mode 100644 index e935a3e75..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureRelease)(WGPUTexture) - * } - */ -public class WGPUProcTextureRelease { - - WGPUProcTextureRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment texture); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment texture) { - try { - DOWN$MH.invokeExact(funcPtr, texture); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureSetLabel.java deleted file mode 100644 index d04a51e11..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureSetLabel)(WGPUTexture, const char *) - * } - */ -public class WGPUProcTextureSetLabel { - - WGPUProcTextureSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment texture, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment texture, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, texture, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewReference.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewReference.java deleted file mode 100644 index f952ec039..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewReference.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureViewReference)(WGPUTextureView) - * } - */ -public class WGPUProcTextureViewReference { - - WGPUProcTextureViewReference() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment textureView); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureViewReference.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureViewReference.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment textureView) { - try { - DOWN$MH.invokeExact(funcPtr, textureView); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewRelease.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewRelease.java deleted file mode 100644 index dff9ffb27..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewRelease.java +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView) - * } - */ -public class WGPUProcTextureViewRelease { - - WGPUProcTextureViewRelease() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment textureView); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureViewRelease.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureViewRelease.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment textureView) { - try { - DOWN$MH.invokeExact(funcPtr, textureView); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewSetLabel.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewSetLabel.java deleted file mode 100644 index 10d6a91e3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProcTextureViewSetLabel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUProcTextureViewSetLabel)(WGPUTextureView, const char *) - * } - */ -public class WGPUProcTextureViewSetLabel { - - WGPUProcTextureViewSetLabel() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment textureView, MemorySegment label); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUProcTextureViewSetLabel.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUProcTextureViewSetLabel.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment textureView, MemorySegment label) { - try { - DOWN$MH.invokeExact(funcPtr, textureView, label); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProgrammableStageDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProgrammableStageDescriptor.java deleted file mode 100644 index 43fd79b09..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUProgrammableStageDescriptor.java +++ /dev/null @@ -1,311 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUProgrammableStageDescriptor { - * const WGPUChainedStruct *nextInChain; - * WGPUShaderModule module; - * const char *entryPoint; - * size_t constantCount; - * const WGPUConstantEntry *constants; - * } - * } - */ -public class WGPUProgrammableStageDescriptor { - - WGPUProgrammableStageDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("module"), - WGPU.C_POINTER.withName("entryPoint"), - WGPU.C_LONG_LONG.withName("constantCount"), - WGPU.C_POINTER.withName("constants") - ).withName("WGPUProgrammableStageDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout module$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("module")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static final AddressLayout module$layout() { - return module$LAYOUT; - } - - private static final long module$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static final long module$offset() { - return module$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static MemorySegment module(MemorySegment struct) { - return struct.get(module$LAYOUT, module$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static void module(MemorySegment struct, MemorySegment fieldValue) { - struct.set(module$LAYOUT, module$OFFSET, fieldValue); - } - - private static final AddressLayout entryPoint$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("entryPoint")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final AddressLayout entryPoint$layout() { - return entryPoint$LAYOUT; - } - - private static final long entryPoint$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final long entryPoint$offset() { - return entryPoint$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static MemorySegment entryPoint(MemorySegment struct) { - return struct.get(entryPoint$LAYOUT, entryPoint$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static void entryPoint(MemorySegment struct, MemorySegment fieldValue) { - struct.set(entryPoint$LAYOUT, entryPoint$OFFSET, fieldValue); - } - - private static final OfLong constantCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("constantCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static final OfLong constantCount$layout() { - return constantCount$LAYOUT; - } - - private static final long constantCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static final long constantCount$offset() { - return constantCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static long constantCount(MemorySegment struct) { - return struct.get(constantCount$LAYOUT, constantCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static void constantCount(MemorySegment struct, long fieldValue) { - struct.set(constantCount$LAYOUT, constantCount$OFFSET, fieldValue); - } - - private static final AddressLayout constants$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("constants")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static final AddressLayout constants$layout() { - return constants$LAYOUT; - } - - private static final long constants$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static final long constants$offset() { - return constants$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static MemorySegment constants(MemorySegment struct) { - return struct.get(constants$LAYOUT, constants$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static void constants(MemorySegment struct, MemorySegment fieldValue) { - struct.set(constants$LAYOUT, constants$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPushConstantRange.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPushConstantRange.java deleted file mode 100644 index 74299cc9a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUPushConstantRange.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUPushConstantRange { - * WGPUShaderStageFlags stages; - * uint32_t start; - * uint32_t end; - * } - * } - */ -public class WGPUPushConstantRange { - - WGPUPushConstantRange() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("stages"), - WGPU.C_INT.withName("start"), - WGPU.C_INT.withName("end") - ).withName("WGPUPushConstantRange"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt stages$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stages")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderStageFlags stages - * } - */ - public static final OfInt stages$layout() { - return stages$LAYOUT; - } - - private static final long stages$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderStageFlags stages - * } - */ - public static final long stages$offset() { - return stages$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderStageFlags stages - * } - */ - public static int stages(MemorySegment struct) { - return struct.get(stages$LAYOUT, stages$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderStageFlags stages - * } - */ - public static void stages(MemorySegment struct, int fieldValue) { - struct.set(stages$LAYOUT, stages$OFFSET, fieldValue); - } - - private static final OfInt start$LAYOUT = (OfInt)$LAYOUT.select(groupElement("start")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t start - * } - */ - public static final OfInt start$layout() { - return start$LAYOUT; - } - - private static final long start$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t start - * } - */ - public static final long start$offset() { - return start$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t start - * } - */ - public static int start(MemorySegment struct) { - return struct.get(start$LAYOUT, start$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t start - * } - */ - public static void start(MemorySegment struct, int fieldValue) { - struct.set(start$LAYOUT, start$OFFSET, fieldValue); - } - - private static final OfInt end$LAYOUT = (OfInt)$LAYOUT.select(groupElement("end")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t end - * } - */ - public static final OfInt end$layout() { - return end$LAYOUT; - } - - private static final long end$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t end - * } - */ - public static final long end$offset() { - return end$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t end - * } - */ - public static int end(MemorySegment struct) { - return struct.get(end$LAYOUT, end$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t end - * } - */ - public static void end(MemorySegment struct, int fieldValue) { - struct.set(end$LAYOUT, end$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQuerySetDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQuerySetDescriptor.java deleted file mode 100644 index d35665ddf..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQuerySetDescriptor.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUQuerySetDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUQueryType type; - * uint32_t count; - * } - * } - */ -public class WGPUQuerySetDescriptor { - - WGPUQuerySetDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_INT.withName("type"), - WGPU.C_INT.withName("count") - ).withName("WGPUQuerySetDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfInt type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("type")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUQueryType type - * } - */ - public static final OfInt type$layout() { - return type$LAYOUT; - } - - private static final long type$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUQueryType type - * } - */ - public static final long type$offset() { - return type$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUQueryType type - * } - */ - public static int type(MemorySegment struct) { - return struct.get(type$LAYOUT, type$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUQueryType type - * } - */ - public static void type(MemorySegment struct, int fieldValue) { - struct.set(type$LAYOUT, type$OFFSET, fieldValue); - } - - private static final OfInt count$LAYOUT = (OfInt)$LAYOUT.select(groupElement("count")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static final OfInt count$layout() { - return count$LAYOUT; - } - - private static final long count$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static final long count$offset() { - return count$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static int count(MemorySegment struct) { - return struct.get(count$LAYOUT, count$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t count - * } - */ - public static void count(MemorySegment struct, int fieldValue) { - struct.set(count$LAYOUT, count$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQuerySetDescriptorExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQuerySetDescriptorExtras.java deleted file mode 100644 index ff8f94468..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQuerySetDescriptorExtras.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUQuerySetDescriptorExtras { - * WGPUChainedStruct chain; - * const WGPUPipelineStatisticName *pipelineStatistics; - * size_t pipelineStatisticCount; - * } - * } - */ -public class WGPUQuerySetDescriptorExtras { - - WGPUQuerySetDescriptorExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("pipelineStatistics"), - WGPU.C_LONG_LONG.withName("pipelineStatisticCount") - ).withName("WGPUQuerySetDescriptorExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout pipelineStatistics$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("pipelineStatistics")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUPipelineStatisticName *pipelineStatistics - * } - */ - public static final AddressLayout pipelineStatistics$layout() { - return pipelineStatistics$LAYOUT; - } - - private static final long pipelineStatistics$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUPipelineStatisticName *pipelineStatistics - * } - */ - public static final long pipelineStatistics$offset() { - return pipelineStatistics$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUPipelineStatisticName *pipelineStatistics - * } - */ - public static MemorySegment pipelineStatistics(MemorySegment struct) { - return struct.get(pipelineStatistics$LAYOUT, pipelineStatistics$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUPipelineStatisticName *pipelineStatistics - * } - */ - public static void pipelineStatistics(MemorySegment struct, MemorySegment fieldValue) { - struct.set(pipelineStatistics$LAYOUT, pipelineStatistics$OFFSET, fieldValue); - } - - private static final OfLong pipelineStatisticCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("pipelineStatisticCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t pipelineStatisticCount - * } - */ - public static final OfLong pipelineStatisticCount$layout() { - return pipelineStatisticCount$LAYOUT; - } - - private static final long pipelineStatisticCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t pipelineStatisticCount - * } - */ - public static final long pipelineStatisticCount$offset() { - return pipelineStatisticCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t pipelineStatisticCount - * } - */ - public static long pipelineStatisticCount(MemorySegment struct) { - return struct.get(pipelineStatisticCount$LAYOUT, pipelineStatisticCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t pipelineStatisticCount - * } - */ - public static void pipelineStatisticCount(MemorySegment struct, long fieldValue) { - struct.set(pipelineStatisticCount$LAYOUT, pipelineStatisticCount$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQueueDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQueueDescriptor.java deleted file mode 100644 index 84147d2d0..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQueueDescriptor.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUQueueDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * } - * } - */ -public class WGPUQueueDescriptor { - - WGPUQueueDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label") - ).withName("WGPUQueueDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQueueWorkDoneCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQueueWorkDoneCallback.java deleted file mode 100644 index ff251ed2d..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUQueueWorkDoneCallback.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus, void *) - * } - */ -public class WGPUQueueWorkDoneCallback { - - WGPUQueueWorkDoneCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPUQueueWorkDoneCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPUQueueWorkDoneCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURegistryReport.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURegistryReport.java deleted file mode 100644 index 62a2212b4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURegistryReport.java +++ /dev/null @@ -1,311 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURegistryReport { - * size_t numAllocated; - * size_t numKeptFromUser; - * size_t numReleasedFromUser; - * size_t numError; - * size_t elementSize; - * } - * } - */ -public class WGPURegistryReport { - - WGPURegistryReport() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_LONG_LONG.withName("numAllocated"), - WGPU.C_LONG_LONG.withName("numKeptFromUser"), - WGPU.C_LONG_LONG.withName("numReleasedFromUser"), - WGPU.C_LONG_LONG.withName("numError"), - WGPU.C_LONG_LONG.withName("elementSize") - ).withName("WGPURegistryReport"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong numAllocated$LAYOUT = (OfLong)$LAYOUT.select(groupElement("numAllocated")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t numAllocated - * } - */ - public static final OfLong numAllocated$layout() { - return numAllocated$LAYOUT; - } - - private static final long numAllocated$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t numAllocated - * } - */ - public static final long numAllocated$offset() { - return numAllocated$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t numAllocated - * } - */ - public static long numAllocated(MemorySegment struct) { - return struct.get(numAllocated$LAYOUT, numAllocated$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t numAllocated - * } - */ - public static void numAllocated(MemorySegment struct, long fieldValue) { - struct.set(numAllocated$LAYOUT, numAllocated$OFFSET, fieldValue); - } - - private static final OfLong numKeptFromUser$LAYOUT = (OfLong)$LAYOUT.select(groupElement("numKeptFromUser")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t numKeptFromUser - * } - */ - public static final OfLong numKeptFromUser$layout() { - return numKeptFromUser$LAYOUT; - } - - private static final long numKeptFromUser$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t numKeptFromUser - * } - */ - public static final long numKeptFromUser$offset() { - return numKeptFromUser$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t numKeptFromUser - * } - */ - public static long numKeptFromUser(MemorySegment struct) { - return struct.get(numKeptFromUser$LAYOUT, numKeptFromUser$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t numKeptFromUser - * } - */ - public static void numKeptFromUser(MemorySegment struct, long fieldValue) { - struct.set(numKeptFromUser$LAYOUT, numKeptFromUser$OFFSET, fieldValue); - } - - private static final OfLong numReleasedFromUser$LAYOUT = (OfLong)$LAYOUT.select(groupElement("numReleasedFromUser")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t numReleasedFromUser - * } - */ - public static final OfLong numReleasedFromUser$layout() { - return numReleasedFromUser$LAYOUT; - } - - private static final long numReleasedFromUser$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t numReleasedFromUser - * } - */ - public static final long numReleasedFromUser$offset() { - return numReleasedFromUser$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t numReleasedFromUser - * } - */ - public static long numReleasedFromUser(MemorySegment struct) { - return struct.get(numReleasedFromUser$LAYOUT, numReleasedFromUser$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t numReleasedFromUser - * } - */ - public static void numReleasedFromUser(MemorySegment struct, long fieldValue) { - struct.set(numReleasedFromUser$LAYOUT, numReleasedFromUser$OFFSET, fieldValue); - } - - private static final OfLong numError$LAYOUT = (OfLong)$LAYOUT.select(groupElement("numError")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t numError - * } - */ - public static final OfLong numError$layout() { - return numError$LAYOUT; - } - - private static final long numError$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t numError - * } - */ - public static final long numError$offset() { - return numError$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t numError - * } - */ - public static long numError(MemorySegment struct) { - return struct.get(numError$LAYOUT, numError$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t numError - * } - */ - public static void numError(MemorySegment struct, long fieldValue) { - struct.set(numError$LAYOUT, numError$OFFSET, fieldValue); - } - - private static final OfLong elementSize$LAYOUT = (OfLong)$LAYOUT.select(groupElement("elementSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t elementSize - * } - */ - public static final OfLong elementSize$layout() { - return elementSize$LAYOUT; - } - - private static final long elementSize$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t elementSize - * } - */ - public static final long elementSize$offset() { - return elementSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t elementSize - * } - */ - public static long elementSize(MemorySegment struct) { - return struct.get(elementSize$LAYOUT, elementSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t elementSize - * } - */ - public static void elementSize(MemorySegment struct, long fieldValue) { - struct.set(elementSize$LAYOUT, elementSize$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderBundleDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderBundleDescriptor.java deleted file mode 100644 index aad36de0c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderBundleDescriptor.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderBundleDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * } - * } - */ -public class WGPURenderBundleDescriptor { - - WGPURenderBundleDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label") - ).withName("WGPURenderBundleDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderBundleEncoderDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderBundleEncoderDescriptor.java deleted file mode 100644 index d3b7dead3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderBundleEncoderDescriptor.java +++ /dev/null @@ -1,449 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderBundleEncoderDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * size_t colorFormatCount; - * const WGPUTextureFormat *colorFormats; - * WGPUTextureFormat depthStencilFormat; - * uint32_t sampleCount; - * WGPUBool depthReadOnly; - * WGPUBool stencilReadOnly; - * } - * } - */ -public class WGPURenderBundleEncoderDescriptor { - - WGPURenderBundleEncoderDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_LONG_LONG.withName("colorFormatCount"), - WGPU.C_POINTER.withName("colorFormats"), - WGPU.C_INT.withName("depthStencilFormat"), - WGPU.C_INT.withName("sampleCount"), - WGPU.C_INT.withName("depthReadOnly"), - WGPU.C_INT.withName("stencilReadOnly") - ).withName("WGPURenderBundleEncoderDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfLong colorFormatCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("colorFormatCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t colorFormatCount - * } - */ - public static final OfLong colorFormatCount$layout() { - return colorFormatCount$LAYOUT; - } - - private static final long colorFormatCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t colorFormatCount - * } - */ - public static final long colorFormatCount$offset() { - return colorFormatCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t colorFormatCount - * } - */ - public static long colorFormatCount(MemorySegment struct) { - return struct.get(colorFormatCount$LAYOUT, colorFormatCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t colorFormatCount - * } - */ - public static void colorFormatCount(MemorySegment struct, long fieldValue) { - struct.set(colorFormatCount$LAYOUT, colorFormatCount$OFFSET, fieldValue); - } - - private static final AddressLayout colorFormats$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("colorFormats")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUTextureFormat *colorFormats - * } - */ - public static final AddressLayout colorFormats$layout() { - return colorFormats$LAYOUT; - } - - private static final long colorFormats$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUTextureFormat *colorFormats - * } - */ - public static final long colorFormats$offset() { - return colorFormats$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUTextureFormat *colorFormats - * } - */ - public static MemorySegment colorFormats(MemorySegment struct) { - return struct.get(colorFormats$LAYOUT, colorFormats$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUTextureFormat *colorFormats - * } - */ - public static void colorFormats(MemorySegment struct, MemorySegment fieldValue) { - struct.set(colorFormats$LAYOUT, colorFormats$OFFSET, fieldValue); - } - - private static final OfInt depthStencilFormat$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthStencilFormat")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat depthStencilFormat - * } - */ - public static final OfInt depthStencilFormat$layout() { - return depthStencilFormat$LAYOUT; - } - - private static final long depthStencilFormat$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat depthStencilFormat - * } - */ - public static final long depthStencilFormat$offset() { - return depthStencilFormat$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat depthStencilFormat - * } - */ - public static int depthStencilFormat(MemorySegment struct) { - return struct.get(depthStencilFormat$LAYOUT, depthStencilFormat$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat depthStencilFormat - * } - */ - public static void depthStencilFormat(MemorySegment struct, int fieldValue) { - struct.set(depthStencilFormat$LAYOUT, depthStencilFormat$OFFSET, fieldValue); - } - - private static final OfInt sampleCount$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sampleCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static final OfInt sampleCount$layout() { - return sampleCount$LAYOUT; - } - - private static final long sampleCount$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static final long sampleCount$offset() { - return sampleCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static int sampleCount(MemorySegment struct) { - return struct.get(sampleCount$LAYOUT, sampleCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static void sampleCount(MemorySegment struct, int fieldValue) { - struct.set(sampleCount$LAYOUT, sampleCount$OFFSET, fieldValue); - } - - private static final OfInt depthReadOnly$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthReadOnly")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static final OfInt depthReadOnly$layout() { - return depthReadOnly$LAYOUT; - } - - private static final long depthReadOnly$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static final long depthReadOnly$offset() { - return depthReadOnly$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static int depthReadOnly(MemorySegment struct) { - return struct.get(depthReadOnly$LAYOUT, depthReadOnly$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static void depthReadOnly(MemorySegment struct, int fieldValue) { - struct.set(depthReadOnly$LAYOUT, depthReadOnly$OFFSET, fieldValue); - } - - private static final OfInt stencilReadOnly$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilReadOnly")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static final OfInt stencilReadOnly$layout() { - return stencilReadOnly$LAYOUT; - } - - private static final long stencilReadOnly$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static final long stencilReadOnly$offset() { - return stencilReadOnly$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static int stencilReadOnly(MemorySegment struct) { - return struct.get(stencilReadOnly$LAYOUT, stencilReadOnly$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static void stencilReadOnly(MemorySegment struct, int fieldValue) { - struct.set(stencilReadOnly$LAYOUT, stencilReadOnly$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassColorAttachment.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassColorAttachment.java deleted file mode 100644 index 76a4e69c0..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassColorAttachment.java +++ /dev/null @@ -1,357 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderPassColorAttachment { - * const WGPUChainedStruct *nextInChain; - * WGPUTextureView view; - * WGPUTextureView resolveTarget; - * WGPULoadOp loadOp; - * WGPUStoreOp storeOp; - * WGPUColor clearValue; - * } - * } - */ -public class WGPURenderPassColorAttachment { - - WGPURenderPassColorAttachment() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("view"), - WGPU.C_POINTER.withName("resolveTarget"), - WGPU.C_INT.withName("loadOp"), - WGPU.C_INT.withName("storeOp"), - WGPUColor.layout().withName("clearValue") - ).withName("WGPURenderPassColorAttachment"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout view$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("view")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static final AddressLayout view$layout() { - return view$LAYOUT; - } - - private static final long view$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static final long view$offset() { - return view$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static MemorySegment view(MemorySegment struct) { - return struct.get(view$LAYOUT, view$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static void view(MemorySegment struct, MemorySegment fieldValue) { - struct.set(view$LAYOUT, view$OFFSET, fieldValue); - } - - private static final AddressLayout resolveTarget$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("resolveTarget")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureView resolveTarget - * } - */ - public static final AddressLayout resolveTarget$layout() { - return resolveTarget$LAYOUT; - } - - private static final long resolveTarget$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureView resolveTarget - * } - */ - public static final long resolveTarget$offset() { - return resolveTarget$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureView resolveTarget - * } - */ - public static MemorySegment resolveTarget(MemorySegment struct) { - return struct.get(resolveTarget$LAYOUT, resolveTarget$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureView resolveTarget - * } - */ - public static void resolveTarget(MemorySegment struct, MemorySegment fieldValue) { - struct.set(resolveTarget$LAYOUT, resolveTarget$OFFSET, fieldValue); - } - - private static final OfInt loadOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("loadOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPULoadOp loadOp - * } - */ - public static final OfInt loadOp$layout() { - return loadOp$LAYOUT; - } - - private static final long loadOp$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPULoadOp loadOp - * } - */ - public static final long loadOp$offset() { - return loadOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPULoadOp loadOp - * } - */ - public static int loadOp(MemorySegment struct) { - return struct.get(loadOp$LAYOUT, loadOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPULoadOp loadOp - * } - */ - public static void loadOp(MemorySegment struct, int fieldValue) { - struct.set(loadOp$LAYOUT, loadOp$OFFSET, fieldValue); - } - - private static final OfInt storeOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("storeOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStoreOp storeOp - * } - */ - public static final OfInt storeOp$layout() { - return storeOp$LAYOUT; - } - - private static final long storeOp$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStoreOp storeOp - * } - */ - public static final long storeOp$offset() { - return storeOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStoreOp storeOp - * } - */ - public static int storeOp(MemorySegment struct) { - return struct.get(storeOp$LAYOUT, storeOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStoreOp storeOp - * } - */ - public static void storeOp(MemorySegment struct, int fieldValue) { - struct.set(storeOp$LAYOUT, storeOp$OFFSET, fieldValue); - } - - private static final GroupLayout clearValue$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("clearValue")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUColor clearValue - * } - */ - public static final GroupLayout clearValue$layout() { - return clearValue$LAYOUT; - } - - private static final long clearValue$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUColor clearValue - * } - */ - public static final long clearValue$offset() { - return clearValue$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUColor clearValue - * } - */ - public static MemorySegment clearValue(MemorySegment struct) { - return struct.asSlice(clearValue$OFFSET, clearValue$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUColor clearValue - * } - */ - public static void clearValue(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, clearValue$OFFSET, clearValue$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDepthStencilAttachment.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDepthStencilAttachment.java deleted file mode 100644 index 9fbfd36cc..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDepthStencilAttachment.java +++ /dev/null @@ -1,495 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderPassDepthStencilAttachment { - * WGPUTextureView view; - * WGPULoadOp depthLoadOp; - * WGPUStoreOp depthStoreOp; - * float depthClearValue; - * WGPUBool depthReadOnly; - * WGPULoadOp stencilLoadOp; - * WGPUStoreOp stencilStoreOp; - * uint32_t stencilClearValue; - * WGPUBool stencilReadOnly; - * } - * } - */ -public class WGPURenderPassDepthStencilAttachment { - - WGPURenderPassDepthStencilAttachment() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("view"), - WGPU.C_INT.withName("depthLoadOp"), - WGPU.C_INT.withName("depthStoreOp"), - WGPU.C_FLOAT.withName("depthClearValue"), - WGPU.C_INT.withName("depthReadOnly"), - WGPU.C_INT.withName("stencilLoadOp"), - WGPU.C_INT.withName("stencilStoreOp"), - WGPU.C_INT.withName("stencilClearValue"), - WGPU.C_INT.withName("stencilReadOnly") - ).withName("WGPURenderPassDepthStencilAttachment"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout view$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("view")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static final AddressLayout view$layout() { - return view$LAYOUT; - } - - private static final long view$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static final long view$offset() { - return view$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static MemorySegment view(MemorySegment struct) { - return struct.get(view$LAYOUT, view$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureView view - * } - */ - public static void view(MemorySegment struct, MemorySegment fieldValue) { - struct.set(view$LAYOUT, view$OFFSET, fieldValue); - } - - private static final OfInt depthLoadOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthLoadOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPULoadOp depthLoadOp - * } - */ - public static final OfInt depthLoadOp$layout() { - return depthLoadOp$LAYOUT; - } - - private static final long depthLoadOp$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPULoadOp depthLoadOp - * } - */ - public static final long depthLoadOp$offset() { - return depthLoadOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPULoadOp depthLoadOp - * } - */ - public static int depthLoadOp(MemorySegment struct) { - return struct.get(depthLoadOp$LAYOUT, depthLoadOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPULoadOp depthLoadOp - * } - */ - public static void depthLoadOp(MemorySegment struct, int fieldValue) { - struct.set(depthLoadOp$LAYOUT, depthLoadOp$OFFSET, fieldValue); - } - - private static final OfInt depthStoreOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthStoreOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStoreOp depthStoreOp - * } - */ - public static final OfInt depthStoreOp$layout() { - return depthStoreOp$LAYOUT; - } - - private static final long depthStoreOp$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStoreOp depthStoreOp - * } - */ - public static final long depthStoreOp$offset() { - return depthStoreOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStoreOp depthStoreOp - * } - */ - public static int depthStoreOp(MemorySegment struct) { - return struct.get(depthStoreOp$LAYOUT, depthStoreOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStoreOp depthStoreOp - * } - */ - public static void depthStoreOp(MemorySegment struct, int fieldValue) { - struct.set(depthStoreOp$LAYOUT, depthStoreOp$OFFSET, fieldValue); - } - - private static final OfFloat depthClearValue$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("depthClearValue")); - - /** - * Layout for field: - * {@snippet lang=c : - * float depthClearValue - * } - */ - public static final OfFloat depthClearValue$layout() { - return depthClearValue$LAYOUT; - } - - private static final long depthClearValue$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * float depthClearValue - * } - */ - public static final long depthClearValue$offset() { - return depthClearValue$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float depthClearValue - * } - */ - public static float depthClearValue(MemorySegment struct) { - return struct.get(depthClearValue$LAYOUT, depthClearValue$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float depthClearValue - * } - */ - public static void depthClearValue(MemorySegment struct, float fieldValue) { - struct.set(depthClearValue$LAYOUT, depthClearValue$OFFSET, fieldValue); - } - - private static final OfInt depthReadOnly$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthReadOnly")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static final OfInt depthReadOnly$layout() { - return depthReadOnly$LAYOUT; - } - - private static final long depthReadOnly$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static final long depthReadOnly$offset() { - return depthReadOnly$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static int depthReadOnly(MemorySegment struct) { - return struct.get(depthReadOnly$LAYOUT, depthReadOnly$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool depthReadOnly - * } - */ - public static void depthReadOnly(MemorySegment struct, int fieldValue) { - struct.set(depthReadOnly$LAYOUT, depthReadOnly$OFFSET, fieldValue); - } - - private static final OfInt stencilLoadOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilLoadOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPULoadOp stencilLoadOp - * } - */ - public static final OfInt stencilLoadOp$layout() { - return stencilLoadOp$LAYOUT; - } - - private static final long stencilLoadOp$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPULoadOp stencilLoadOp - * } - */ - public static final long stencilLoadOp$offset() { - return stencilLoadOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPULoadOp stencilLoadOp - * } - */ - public static int stencilLoadOp(MemorySegment struct) { - return struct.get(stencilLoadOp$LAYOUT, stencilLoadOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPULoadOp stencilLoadOp - * } - */ - public static void stencilLoadOp(MemorySegment struct, int fieldValue) { - struct.set(stencilLoadOp$LAYOUT, stencilLoadOp$OFFSET, fieldValue); - } - - private static final OfInt stencilStoreOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilStoreOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStoreOp stencilStoreOp - * } - */ - public static final OfInt stencilStoreOp$layout() { - return stencilStoreOp$LAYOUT; - } - - private static final long stencilStoreOp$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStoreOp stencilStoreOp - * } - */ - public static final long stencilStoreOp$offset() { - return stencilStoreOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStoreOp stencilStoreOp - * } - */ - public static int stencilStoreOp(MemorySegment struct) { - return struct.get(stencilStoreOp$LAYOUT, stencilStoreOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStoreOp stencilStoreOp - * } - */ - public static void stencilStoreOp(MemorySegment struct, int fieldValue) { - struct.set(stencilStoreOp$LAYOUT, stencilStoreOp$OFFSET, fieldValue); - } - - private static final OfInt stencilClearValue$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilClearValue")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t stencilClearValue - * } - */ - public static final OfInt stencilClearValue$layout() { - return stencilClearValue$LAYOUT; - } - - private static final long stencilClearValue$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t stencilClearValue - * } - */ - public static final long stencilClearValue$offset() { - return stencilClearValue$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t stencilClearValue - * } - */ - public static int stencilClearValue(MemorySegment struct) { - return struct.get(stencilClearValue$LAYOUT, stencilClearValue$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t stencilClearValue - * } - */ - public static void stencilClearValue(MemorySegment struct, int fieldValue) { - struct.set(stencilClearValue$LAYOUT, stencilClearValue$OFFSET, fieldValue); - } - - private static final OfInt stencilReadOnly$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stencilReadOnly")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static final OfInt stencilReadOnly$layout() { - return stencilReadOnly$LAYOUT; - } - - private static final long stencilReadOnly$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static final long stencilReadOnly$offset() { - return stencilReadOnly$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static int stencilReadOnly(MemorySegment struct) { - return struct.get(stencilReadOnly$LAYOUT, stencilReadOnly$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool stencilReadOnly - * } - */ - public static void stencilReadOnly(MemorySegment struct, int fieldValue) { - struct.set(stencilReadOnly$LAYOUT, stencilReadOnly$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDescriptor.java deleted file mode 100644 index 00cee37f1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDescriptor.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderPassDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * size_t colorAttachmentCount; - * const WGPURenderPassColorAttachment *colorAttachments; - * const WGPURenderPassDepthStencilAttachment *depthStencilAttachment; - * WGPUQuerySet occlusionQuerySet; - * const WGPURenderPassTimestampWrites *timestampWrites; - * } - * } - */ -public class WGPURenderPassDescriptor { - - WGPURenderPassDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_LONG_LONG.withName("colorAttachmentCount"), - WGPU.C_POINTER.withName("colorAttachments"), - WGPU.C_POINTER.withName("depthStencilAttachment"), - WGPU.C_POINTER.withName("occlusionQuerySet"), - WGPU.C_POINTER.withName("timestampWrites") - ).withName("WGPURenderPassDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfLong colorAttachmentCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("colorAttachmentCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t colorAttachmentCount - * } - */ - public static final OfLong colorAttachmentCount$layout() { - return colorAttachmentCount$LAYOUT; - } - - private static final long colorAttachmentCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t colorAttachmentCount - * } - */ - public static final long colorAttachmentCount$offset() { - return colorAttachmentCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t colorAttachmentCount - * } - */ - public static long colorAttachmentCount(MemorySegment struct) { - return struct.get(colorAttachmentCount$LAYOUT, colorAttachmentCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t colorAttachmentCount - * } - */ - public static void colorAttachmentCount(MemorySegment struct, long fieldValue) { - struct.set(colorAttachmentCount$LAYOUT, colorAttachmentCount$OFFSET, fieldValue); - } - - private static final AddressLayout colorAttachments$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("colorAttachments")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPURenderPassColorAttachment *colorAttachments - * } - */ - public static final AddressLayout colorAttachments$layout() { - return colorAttachments$LAYOUT; - } - - private static final long colorAttachments$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPURenderPassColorAttachment *colorAttachments - * } - */ - public static final long colorAttachments$offset() { - return colorAttachments$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPURenderPassColorAttachment *colorAttachments - * } - */ - public static MemorySegment colorAttachments(MemorySegment struct) { - return struct.get(colorAttachments$LAYOUT, colorAttachments$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPURenderPassColorAttachment *colorAttachments - * } - */ - public static void colorAttachments(MemorySegment struct, MemorySegment fieldValue) { - struct.set(colorAttachments$LAYOUT, colorAttachments$OFFSET, fieldValue); - } - - private static final AddressLayout depthStencilAttachment$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("depthStencilAttachment")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPURenderPassDepthStencilAttachment *depthStencilAttachment - * } - */ - public static final AddressLayout depthStencilAttachment$layout() { - return depthStencilAttachment$LAYOUT; - } - - private static final long depthStencilAttachment$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPURenderPassDepthStencilAttachment *depthStencilAttachment - * } - */ - public static final long depthStencilAttachment$offset() { - return depthStencilAttachment$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPURenderPassDepthStencilAttachment *depthStencilAttachment - * } - */ - public static MemorySegment depthStencilAttachment(MemorySegment struct) { - return struct.get(depthStencilAttachment$LAYOUT, depthStencilAttachment$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPURenderPassDepthStencilAttachment *depthStencilAttachment - * } - */ - public static void depthStencilAttachment(MemorySegment struct, MemorySegment fieldValue) { - struct.set(depthStencilAttachment$LAYOUT, depthStencilAttachment$OFFSET, fieldValue); - } - - private static final AddressLayout occlusionQuerySet$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("occlusionQuerySet")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUQuerySet occlusionQuerySet - * } - */ - public static final AddressLayout occlusionQuerySet$layout() { - return occlusionQuerySet$LAYOUT; - } - - private static final long occlusionQuerySet$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUQuerySet occlusionQuerySet - * } - */ - public static final long occlusionQuerySet$offset() { - return occlusionQuerySet$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUQuerySet occlusionQuerySet - * } - */ - public static MemorySegment occlusionQuerySet(MemorySegment struct) { - return struct.get(occlusionQuerySet$LAYOUT, occlusionQuerySet$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUQuerySet occlusionQuerySet - * } - */ - public static void occlusionQuerySet(MemorySegment struct, MemorySegment fieldValue) { - struct.set(occlusionQuerySet$LAYOUT, occlusionQuerySet$OFFSET, fieldValue); - } - - private static final AddressLayout timestampWrites$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("timestampWrites")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPURenderPassTimestampWrites *timestampWrites - * } - */ - public static final AddressLayout timestampWrites$layout() { - return timestampWrites$LAYOUT; - } - - private static final long timestampWrites$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPURenderPassTimestampWrites *timestampWrites - * } - */ - public static final long timestampWrites$offset() { - return timestampWrites$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPURenderPassTimestampWrites *timestampWrites - * } - */ - public static MemorySegment timestampWrites(MemorySegment struct) { - return struct.get(timestampWrites$LAYOUT, timestampWrites$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPURenderPassTimestampWrites *timestampWrites - * } - */ - public static void timestampWrites(MemorySegment struct, MemorySegment fieldValue) { - struct.set(timestampWrites$LAYOUT, timestampWrites$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDescriptorMaxDrawCount.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDescriptorMaxDrawCount.java deleted file mode 100644 index 442631d91..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassDescriptorMaxDrawCount.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderPassDescriptorMaxDrawCount { - * WGPUChainedStruct chain; - * uint64_t maxDrawCount; - * } - * } - */ -public class WGPURenderPassDescriptorMaxDrawCount { - - WGPURenderPassDescriptorMaxDrawCount() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_LONG_LONG.withName("maxDrawCount") - ).withName("WGPURenderPassDescriptorMaxDrawCount"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfLong maxDrawCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("maxDrawCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t maxDrawCount - * } - */ - public static final OfLong maxDrawCount$layout() { - return maxDrawCount$LAYOUT; - } - - private static final long maxDrawCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t maxDrawCount - * } - */ - public static final long maxDrawCount$offset() { - return maxDrawCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t maxDrawCount - * } - */ - public static long maxDrawCount(MemorySegment struct) { - return struct.get(maxDrawCount$LAYOUT, maxDrawCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t maxDrawCount - * } - */ - public static void maxDrawCount(MemorySegment struct, long fieldValue) { - struct.set(maxDrawCount$LAYOUT, maxDrawCount$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassTimestampWrites.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassTimestampWrites.java deleted file mode 100644 index da33913f3..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPassTimestampWrites.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderPassTimestampWrites { - * WGPUQuerySet querySet; - * uint32_t beginningOfPassWriteIndex; - * uint32_t endOfPassWriteIndex; - * } - * } - */ -public class WGPURenderPassTimestampWrites { - - WGPURenderPassTimestampWrites() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("querySet"), - WGPU.C_INT.withName("beginningOfPassWriteIndex"), - WGPU.C_INT.withName("endOfPassWriteIndex") - ).withName("WGPURenderPassTimestampWrites"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout querySet$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("querySet")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static final AddressLayout querySet$layout() { - return querySet$LAYOUT; - } - - private static final long querySet$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static final long querySet$offset() { - return querySet$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static MemorySegment querySet(MemorySegment struct) { - return struct.get(querySet$LAYOUT, querySet$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUQuerySet querySet - * } - */ - public static void querySet(MemorySegment struct, MemorySegment fieldValue) { - struct.set(querySet$LAYOUT, querySet$OFFSET, fieldValue); - } - - private static final OfInt beginningOfPassWriteIndex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("beginningOfPassWriteIndex")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static final OfInt beginningOfPassWriteIndex$layout() { - return beginningOfPassWriteIndex$LAYOUT; - } - - private static final long beginningOfPassWriteIndex$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static final long beginningOfPassWriteIndex$offset() { - return beginningOfPassWriteIndex$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static int beginningOfPassWriteIndex(MemorySegment struct) { - return struct.get(beginningOfPassWriteIndex$LAYOUT, beginningOfPassWriteIndex$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t beginningOfPassWriteIndex - * } - */ - public static void beginningOfPassWriteIndex(MemorySegment struct, int fieldValue) { - struct.set(beginningOfPassWriteIndex$LAYOUT, beginningOfPassWriteIndex$OFFSET, fieldValue); - } - - private static final OfInt endOfPassWriteIndex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("endOfPassWriteIndex")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static final OfInt endOfPassWriteIndex$layout() { - return endOfPassWriteIndex$LAYOUT; - } - - private static final long endOfPassWriteIndex$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static final long endOfPassWriteIndex$offset() { - return endOfPassWriteIndex$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static int endOfPassWriteIndex(MemorySegment struct) { - return struct.get(endOfPassWriteIndex$LAYOUT, endOfPassWriteIndex$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t endOfPassWriteIndex - * } - */ - public static void endOfPassWriteIndex(MemorySegment struct, int fieldValue) { - struct.set(endOfPassWriteIndex$LAYOUT, endOfPassWriteIndex$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPipelineDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPipelineDescriptor.java deleted file mode 100644 index dfc3a5e96..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURenderPipelineDescriptor.java +++ /dev/null @@ -1,449 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURenderPipelineDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUPipelineLayout layout; - * WGPUVertexState vertex; - * WGPUPrimitiveState primitive; - * const WGPUDepthStencilState *depthStencil; - * WGPUMultisampleState multisample; - * const WGPUFragmentState *fragment; - * } - * } - */ -public class WGPURenderPipelineDescriptor { - - WGPURenderPipelineDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_POINTER.withName("layout"), - WGPUVertexState.layout().withName("vertex"), - WGPUPrimitiveState.layout().withName("primitive"), - WGPU.C_POINTER.withName("depthStencil"), - WGPUMultisampleState.layout().withName("multisample"), - WGPU.C_POINTER.withName("fragment") - ).withName("WGPURenderPipelineDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final AddressLayout layout$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("layout")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static final AddressLayout layout$layout() { - return layout$LAYOUT; - } - - private static final long layout$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static final long layout$offset() { - return layout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static MemorySegment layout(MemorySegment struct) { - return struct.get(layout$LAYOUT, layout$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static void layout(MemorySegment struct, MemorySegment fieldValue) { - struct.set(layout$LAYOUT, layout$OFFSET, fieldValue); - } - - private static final GroupLayout vertex$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("vertex")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUVertexState vertex - * } - */ - public static final GroupLayout vertex$layout() { - return vertex$LAYOUT; - } - - private static final long vertex$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUVertexState vertex - * } - */ - public static final long vertex$offset() { - return vertex$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUVertexState vertex - * } - */ - public static MemorySegment vertex(MemorySegment struct) { - return struct.asSlice(vertex$OFFSET, vertex$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUVertexState vertex - * } - */ - public static void vertex(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, vertex$OFFSET, vertex$LAYOUT.byteSize()); - } - - private static final GroupLayout primitive$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("primitive")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPrimitiveState primitive - * } - */ - public static final GroupLayout primitive$layout() { - return primitive$LAYOUT; - } - - private static final long primitive$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPrimitiveState primitive - * } - */ - public static final long primitive$offset() { - return primitive$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPrimitiveState primitive - * } - */ - public static MemorySegment primitive(MemorySegment struct) { - return struct.asSlice(primitive$OFFSET, primitive$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPrimitiveState primitive - * } - */ - public static void primitive(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, primitive$OFFSET, primitive$LAYOUT.byteSize()); - } - - private static final AddressLayout depthStencil$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("depthStencil")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUDepthStencilState *depthStencil - * } - */ - public static final AddressLayout depthStencil$layout() { - return depthStencil$LAYOUT; - } - - private static final long depthStencil$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUDepthStencilState *depthStencil - * } - */ - public static final long depthStencil$offset() { - return depthStencil$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUDepthStencilState *depthStencil - * } - */ - public static MemorySegment depthStencil(MemorySegment struct) { - return struct.get(depthStencil$LAYOUT, depthStencil$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUDepthStencilState *depthStencil - * } - */ - public static void depthStencil(MemorySegment struct, MemorySegment fieldValue) { - struct.set(depthStencil$LAYOUT, depthStencil$OFFSET, fieldValue); - } - - private static final GroupLayout multisample$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("multisample")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUMultisampleState multisample - * } - */ - public static final GroupLayout multisample$layout() { - return multisample$LAYOUT; - } - - private static final long multisample$OFFSET = 112; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUMultisampleState multisample - * } - */ - public static final long multisample$offset() { - return multisample$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUMultisampleState multisample - * } - */ - public static MemorySegment multisample(MemorySegment struct) { - return struct.asSlice(multisample$OFFSET, multisample$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUMultisampleState multisample - * } - */ - public static void multisample(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, multisample$OFFSET, multisample$LAYOUT.byteSize()); - } - - private static final AddressLayout fragment$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fragment")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUFragmentState *fragment - * } - */ - public static final AddressLayout fragment$layout() { - return fragment$LAYOUT; - } - - private static final long fragment$OFFSET = 136; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUFragmentState *fragment - * } - */ - public static final long fragment$offset() { - return fragment$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUFragmentState *fragment - * } - */ - public static MemorySegment fragment(MemorySegment struct) { - return struct.get(fragment$LAYOUT, fragment$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUFragmentState *fragment - * } - */ - public static void fragment(MemorySegment struct, MemorySegment fieldValue) { - struct.set(fragment$LAYOUT, fragment$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestAdapterCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestAdapterCallback.java deleted file mode 100644 index efe30dcc0..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestAdapterCallback.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus, WGPUAdapter, const char *, void *) - * } - */ -public class WGPURequestAdapterCallback { - - WGPURequestAdapterCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment adapter, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPURequestAdapterCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPURequestAdapterCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment adapter, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, adapter, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestAdapterOptions.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestAdapterOptions.java deleted file mode 100644 index e9cc73dc6..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestAdapterOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURequestAdapterOptions { - * const WGPUChainedStruct *nextInChain; - * WGPUSurface compatibleSurface; - * WGPUPowerPreference powerPreference; - * WGPUBackendType backendType; - * WGPUBool forceFallbackAdapter; - * } - * } - */ -public class WGPURequestAdapterOptions { - - WGPURequestAdapterOptions() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("compatibleSurface"), - WGPU.C_INT.withName("powerPreference"), - WGPU.C_INT.withName("backendType"), - WGPU.C_INT.withName("forceFallbackAdapter"), - MemoryLayout.paddingLayout(4) - ).withName("WGPURequestAdapterOptions"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout compatibleSurface$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("compatibleSurface")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSurface compatibleSurface - * } - */ - public static final AddressLayout compatibleSurface$layout() { - return compatibleSurface$LAYOUT; - } - - private static final long compatibleSurface$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSurface compatibleSurface - * } - */ - public static final long compatibleSurface$offset() { - return compatibleSurface$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSurface compatibleSurface - * } - */ - public static MemorySegment compatibleSurface(MemorySegment struct) { - return struct.get(compatibleSurface$LAYOUT, compatibleSurface$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSurface compatibleSurface - * } - */ - public static void compatibleSurface(MemorySegment struct, MemorySegment fieldValue) { - struct.set(compatibleSurface$LAYOUT, compatibleSurface$OFFSET, fieldValue); - } - - private static final OfInt powerPreference$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerPreference")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPowerPreference powerPreference - * } - */ - public static final OfInt powerPreference$layout() { - return powerPreference$LAYOUT; - } - - private static final long powerPreference$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPowerPreference powerPreference - * } - */ - public static final long powerPreference$offset() { - return powerPreference$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPowerPreference powerPreference - * } - */ - public static int powerPreference(MemorySegment struct) { - return struct.get(powerPreference$LAYOUT, powerPreference$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPowerPreference powerPreference - * } - */ - public static void powerPreference(MemorySegment struct, int fieldValue) { - struct.set(powerPreference$LAYOUT, powerPreference$OFFSET, fieldValue); - } - - private static final OfInt backendType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("backendType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static final OfInt backendType$layout() { - return backendType$LAYOUT; - } - - private static final long backendType$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static final long backendType$offset() { - return backendType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static int backendType(MemorySegment struct) { - return struct.get(backendType$LAYOUT, backendType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBackendType backendType - * } - */ - public static void backendType(MemorySegment struct, int fieldValue) { - struct.set(backendType$LAYOUT, backendType$OFFSET, fieldValue); - } - - private static final OfInt forceFallbackAdapter$LAYOUT = (OfInt)$LAYOUT.select(groupElement("forceFallbackAdapter")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool forceFallbackAdapter - * } - */ - public static final OfInt forceFallbackAdapter$layout() { - return forceFallbackAdapter$LAYOUT; - } - - private static final long forceFallbackAdapter$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool forceFallbackAdapter - * } - */ - public static final long forceFallbackAdapter$offset() { - return forceFallbackAdapter$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool forceFallbackAdapter - * } - */ - public static int forceFallbackAdapter(MemorySegment struct) { - return struct.get(forceFallbackAdapter$LAYOUT, forceFallbackAdapter$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool forceFallbackAdapter - * } - */ - public static void forceFallbackAdapter(MemorySegment struct, int fieldValue) { - struct.set(forceFallbackAdapter$LAYOUT, forceFallbackAdapter$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestDeviceCallback.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestDeviceCallback.java deleted file mode 100644 index 4dc812b04..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequestDeviceCallback.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus, WGPUDevice, const char *, void *) - * } - */ -public class WGPURequestDeviceCallback { - - WGPURequestDeviceCallback() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int status, MemorySegment device, MemorySegment message, MemorySegment userdata); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - WGPU.C_INT, - WGPU.C_POINTER, - WGPU.C_POINTER, - WGPU.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = WGPU.upcallHandle(WGPURequestDeviceCallback.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(WGPURequestDeviceCallback.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int status, MemorySegment device, MemorySegment message, MemorySegment userdata) { - try { - DOWN$MH.invokeExact(funcPtr, status, device, message, userdata); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequiredLimits.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequiredLimits.java deleted file mode 100644 index d51d78cc9..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequiredLimits.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURequiredLimits { - * const WGPUChainedStruct *nextInChain; - * WGPULimits limits; - * } - * } - */ -public class WGPURequiredLimits { - - WGPURequiredLimits() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPULimits.layout().withName("limits") - ).withName("WGPURequiredLimits"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final GroupLayout limits$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("limits")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static final GroupLayout limits$layout() { - return limits$LAYOUT; - } - - private static final long limits$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static final long limits$offset() { - return limits$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static MemorySegment limits(MemorySegment struct) { - return struct.asSlice(limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static void limits(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequiredLimitsExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequiredLimitsExtras.java deleted file mode 100644 index 63b235efd..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPURequiredLimitsExtras.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPURequiredLimitsExtras { - * WGPUChainedStruct chain; - * WGPUNativeLimits limits; - * } - * } - */ -public class WGPURequiredLimitsExtras { - - WGPURequiredLimitsExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPUNativeLimits.layout().withName("limits") - ).withName("WGPURequiredLimitsExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final GroupLayout limits$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("limits")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static final GroupLayout limits$layout() { - return limits$LAYOUT; - } - - private static final long limits$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static final long limits$offset() { - return limits$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static MemorySegment limits(MemorySegment struct) { - return struct.asSlice(limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static void limits(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSamplerBindingLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSamplerBindingLayout.java deleted file mode 100644 index 8fb94de1a..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSamplerBindingLayout.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSamplerBindingLayout { - * const WGPUChainedStruct *nextInChain; - * WGPUSamplerBindingType type; - * } - * } - */ -public class WGPUSamplerBindingLayout { - - WGPUSamplerBindingLayout() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("type"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUSamplerBindingLayout"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("type")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSamplerBindingType type - * } - */ - public static final OfInt type$layout() { - return type$LAYOUT; - } - - private static final long type$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSamplerBindingType type - * } - */ - public static final long type$offset() { - return type$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSamplerBindingType type - * } - */ - public static int type(MemorySegment struct) { - return struct.get(type$LAYOUT, type$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSamplerBindingType type - * } - */ - public static void type(MemorySegment struct, int fieldValue) { - struct.set(type$LAYOUT, type$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSamplerDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSamplerDescriptor.java deleted file mode 100644 index 402f2496e..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSamplerDescriptor.java +++ /dev/null @@ -1,634 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSamplerDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUAddressMode addressModeU; - * WGPUAddressMode addressModeV; - * WGPUAddressMode addressModeW; - * WGPUFilterMode magFilter; - * WGPUFilterMode minFilter; - * WGPUMipmapFilterMode mipmapFilter; - * float lodMinClamp; - * float lodMaxClamp; - * WGPUCompareFunction compare; - * uint16_t maxAnisotropy; - * } - * } - */ -public class WGPUSamplerDescriptor { - - WGPUSamplerDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_INT.withName("addressModeU"), - WGPU.C_INT.withName("addressModeV"), - WGPU.C_INT.withName("addressModeW"), - WGPU.C_INT.withName("magFilter"), - WGPU.C_INT.withName("minFilter"), - WGPU.C_INT.withName("mipmapFilter"), - WGPU.C_FLOAT.withName("lodMinClamp"), - WGPU.C_FLOAT.withName("lodMaxClamp"), - WGPU.C_INT.withName("compare"), - WGPU.C_SHORT.withName("maxAnisotropy"), - MemoryLayout.paddingLayout(2) - ).withName("WGPUSamplerDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfInt addressModeU$LAYOUT = (OfInt)$LAYOUT.select(groupElement("addressModeU")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeU - * } - */ - public static final OfInt addressModeU$layout() { - return addressModeU$LAYOUT; - } - - private static final long addressModeU$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeU - * } - */ - public static final long addressModeU$offset() { - return addressModeU$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeU - * } - */ - public static int addressModeU(MemorySegment struct) { - return struct.get(addressModeU$LAYOUT, addressModeU$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeU - * } - */ - public static void addressModeU(MemorySegment struct, int fieldValue) { - struct.set(addressModeU$LAYOUT, addressModeU$OFFSET, fieldValue); - } - - private static final OfInt addressModeV$LAYOUT = (OfInt)$LAYOUT.select(groupElement("addressModeV")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeV - * } - */ - public static final OfInt addressModeV$layout() { - return addressModeV$LAYOUT; - } - - private static final long addressModeV$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeV - * } - */ - public static final long addressModeV$offset() { - return addressModeV$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeV - * } - */ - public static int addressModeV(MemorySegment struct) { - return struct.get(addressModeV$LAYOUT, addressModeV$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeV - * } - */ - public static void addressModeV(MemorySegment struct, int fieldValue) { - struct.set(addressModeV$LAYOUT, addressModeV$OFFSET, fieldValue); - } - - private static final OfInt addressModeW$LAYOUT = (OfInt)$LAYOUT.select(groupElement("addressModeW")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeW - * } - */ - public static final OfInt addressModeW$layout() { - return addressModeW$LAYOUT; - } - - private static final long addressModeW$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeW - * } - */ - public static final long addressModeW$offset() { - return addressModeW$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeW - * } - */ - public static int addressModeW(MemorySegment struct) { - return struct.get(addressModeW$LAYOUT, addressModeW$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUAddressMode addressModeW - * } - */ - public static void addressModeW(MemorySegment struct, int fieldValue) { - struct.set(addressModeW$LAYOUT, addressModeW$OFFSET, fieldValue); - } - - private static final OfInt magFilter$LAYOUT = (OfInt)$LAYOUT.select(groupElement("magFilter")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUFilterMode magFilter - * } - */ - public static final OfInt magFilter$layout() { - return magFilter$LAYOUT; - } - - private static final long magFilter$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUFilterMode magFilter - * } - */ - public static final long magFilter$offset() { - return magFilter$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUFilterMode magFilter - * } - */ - public static int magFilter(MemorySegment struct) { - return struct.get(magFilter$LAYOUT, magFilter$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUFilterMode magFilter - * } - */ - public static void magFilter(MemorySegment struct, int fieldValue) { - struct.set(magFilter$LAYOUT, magFilter$OFFSET, fieldValue); - } - - private static final OfInt minFilter$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minFilter")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUFilterMode minFilter - * } - */ - public static final OfInt minFilter$layout() { - return minFilter$LAYOUT; - } - - private static final long minFilter$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUFilterMode minFilter - * } - */ - public static final long minFilter$offset() { - return minFilter$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUFilterMode minFilter - * } - */ - public static int minFilter(MemorySegment struct) { - return struct.get(minFilter$LAYOUT, minFilter$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUFilterMode minFilter - * } - */ - public static void minFilter(MemorySegment struct, int fieldValue) { - struct.set(minFilter$LAYOUT, minFilter$OFFSET, fieldValue); - } - - private static final OfInt mipmapFilter$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mipmapFilter")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUMipmapFilterMode mipmapFilter - * } - */ - public static final OfInt mipmapFilter$layout() { - return mipmapFilter$LAYOUT; - } - - private static final long mipmapFilter$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUMipmapFilterMode mipmapFilter - * } - */ - public static final long mipmapFilter$offset() { - return mipmapFilter$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUMipmapFilterMode mipmapFilter - * } - */ - public static int mipmapFilter(MemorySegment struct) { - return struct.get(mipmapFilter$LAYOUT, mipmapFilter$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUMipmapFilterMode mipmapFilter - * } - */ - public static void mipmapFilter(MemorySegment struct, int fieldValue) { - struct.set(mipmapFilter$LAYOUT, mipmapFilter$OFFSET, fieldValue); - } - - private static final OfFloat lodMinClamp$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("lodMinClamp")); - - /** - * Layout for field: - * {@snippet lang=c : - * float lodMinClamp - * } - */ - public static final OfFloat lodMinClamp$layout() { - return lodMinClamp$LAYOUT; - } - - private static final long lodMinClamp$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * float lodMinClamp - * } - */ - public static final long lodMinClamp$offset() { - return lodMinClamp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float lodMinClamp - * } - */ - public static float lodMinClamp(MemorySegment struct) { - return struct.get(lodMinClamp$LAYOUT, lodMinClamp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float lodMinClamp - * } - */ - public static void lodMinClamp(MemorySegment struct, float fieldValue) { - struct.set(lodMinClamp$LAYOUT, lodMinClamp$OFFSET, fieldValue); - } - - private static final OfFloat lodMaxClamp$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("lodMaxClamp")); - - /** - * Layout for field: - * {@snippet lang=c : - * float lodMaxClamp - * } - */ - public static final OfFloat lodMaxClamp$layout() { - return lodMaxClamp$LAYOUT; - } - - private static final long lodMaxClamp$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * float lodMaxClamp - * } - */ - public static final long lodMaxClamp$offset() { - return lodMaxClamp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float lodMaxClamp - * } - */ - public static float lodMaxClamp(MemorySegment struct) { - return struct.get(lodMaxClamp$LAYOUT, lodMaxClamp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float lodMaxClamp - * } - */ - public static void lodMaxClamp(MemorySegment struct, float fieldValue) { - struct.set(lodMaxClamp$LAYOUT, lodMaxClamp$OFFSET, fieldValue); - } - - private static final OfInt compare$LAYOUT = (OfInt)$LAYOUT.select(groupElement("compare")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static final OfInt compare$layout() { - return compare$LAYOUT; - } - - private static final long compare$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static final long compare$offset() { - return compare$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static int compare(MemorySegment struct) { - return struct.get(compare$LAYOUT, compare$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static void compare(MemorySegment struct, int fieldValue) { - struct.set(compare$LAYOUT, compare$OFFSET, fieldValue); - } - - private static final OfShort maxAnisotropy$LAYOUT = (OfShort)$LAYOUT.select(groupElement("maxAnisotropy")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint16_t maxAnisotropy - * } - */ - public static final OfShort maxAnisotropy$layout() { - return maxAnisotropy$LAYOUT; - } - - private static final long maxAnisotropy$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * uint16_t maxAnisotropy - * } - */ - public static final long maxAnisotropy$offset() { - return maxAnisotropy$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint16_t maxAnisotropy - * } - */ - public static short maxAnisotropy(MemorySegment struct) { - return struct.get(maxAnisotropy$LAYOUT, maxAnisotropy$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint16_t maxAnisotropy - * } - */ - public static void maxAnisotropy(MemorySegment struct, short fieldValue) { - struct.set(maxAnisotropy$LAYOUT, maxAnisotropy$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderDefine.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderDefine.java deleted file mode 100644 index a86026934..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderDefine.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUShaderDefine { - * const char *name; - * const char *value; - * } - * } - */ -public class WGPUShaderDefine { - - WGPUShaderDefine() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("name"), - WGPU.C_POINTER.withName("value") - ).withName("WGPUShaderDefine"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout name$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("name")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static final AddressLayout name$layout() { - return name$LAYOUT; - } - - private static final long name$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static final long name$offset() { - return name$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static MemorySegment name(MemorySegment struct) { - return struct.get(name$LAYOUT, name$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *name - * } - */ - public static void name(MemorySegment struct, MemorySegment fieldValue) { - struct.set(name$LAYOUT, name$OFFSET, fieldValue); - } - - private static final AddressLayout value$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("value")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *value - * } - */ - public static final AddressLayout value$layout() { - return value$LAYOUT; - } - - private static final long value$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *value - * } - */ - public static final long value$offset() { - return value$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *value - * } - */ - public static MemorySegment value(MemorySegment struct) { - return struct.get(value$LAYOUT, value$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *value - * } - */ - public static void value(MemorySegment struct, MemorySegment fieldValue) { - struct.set(value$LAYOUT, value$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleCompilationHint.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleCompilationHint.java deleted file mode 100644 index 8ad13f518..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleCompilationHint.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUShaderModuleCompilationHint { - * const WGPUChainedStruct *nextInChain; - * const char *entryPoint; - * WGPUPipelineLayout layout; - * } - * } - */ -public class WGPUShaderModuleCompilationHint { - - WGPUShaderModuleCompilationHint() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("entryPoint"), - WGPU.C_POINTER.withName("layout") - ).withName("WGPUShaderModuleCompilationHint"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout entryPoint$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("entryPoint")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final AddressLayout entryPoint$layout() { - return entryPoint$LAYOUT; - } - - private static final long entryPoint$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final long entryPoint$offset() { - return entryPoint$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static MemorySegment entryPoint(MemorySegment struct) { - return struct.get(entryPoint$LAYOUT, entryPoint$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static void entryPoint(MemorySegment struct, MemorySegment fieldValue) { - struct.set(entryPoint$LAYOUT, entryPoint$OFFSET, fieldValue); - } - - private static final AddressLayout layout$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("layout")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static final AddressLayout layout$layout() { - return layout$LAYOUT; - } - - private static final long layout$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static final long layout$offset() { - return layout$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static MemorySegment layout(MemorySegment struct) { - return struct.get(layout$LAYOUT, layout$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPipelineLayout layout - * } - */ - public static void layout(MemorySegment struct, MemorySegment fieldValue) { - struct.set(layout$LAYOUT, layout$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleDescriptor.java deleted file mode 100644 index c083fc63c..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleDescriptor.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUShaderModuleDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * size_t hintCount; - * const WGPUShaderModuleCompilationHint *hints; - * } - * } - */ -public class WGPUShaderModuleDescriptor { - - WGPUShaderModuleDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_LONG_LONG.withName("hintCount"), - WGPU.C_POINTER.withName("hints") - ).withName("WGPUShaderModuleDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfLong hintCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("hintCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t hintCount - * } - */ - public static final OfLong hintCount$layout() { - return hintCount$LAYOUT; - } - - private static final long hintCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t hintCount - * } - */ - public static final long hintCount$offset() { - return hintCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t hintCount - * } - */ - public static long hintCount(MemorySegment struct) { - return struct.get(hintCount$LAYOUT, hintCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t hintCount - * } - */ - public static void hintCount(MemorySegment struct, long fieldValue) { - struct.set(hintCount$LAYOUT, hintCount$OFFSET, fieldValue); - } - - private static final AddressLayout hints$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("hints")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUShaderModuleCompilationHint *hints - * } - */ - public static final AddressLayout hints$layout() { - return hints$LAYOUT; - } - - private static final long hints$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUShaderModuleCompilationHint *hints - * } - */ - public static final long hints$offset() { - return hints$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUShaderModuleCompilationHint *hints - * } - */ - public static MemorySegment hints(MemorySegment struct) { - return struct.get(hints$LAYOUT, hints$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUShaderModuleCompilationHint *hints - * } - */ - public static void hints(MemorySegment struct, MemorySegment fieldValue) { - struct.set(hints$LAYOUT, hints$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleGLSLDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleGLSLDescriptor.java deleted file mode 100644 index c26763766..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleGLSLDescriptor.java +++ /dev/null @@ -1,313 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUShaderModuleGLSLDescriptor { - * WGPUChainedStruct chain; - * WGPUShaderStage stage; - * const char *code; - * uint32_t defineCount; - * WGPUShaderDefine *defines; - * } - * } - */ -public class WGPUShaderModuleGLSLDescriptor { - - WGPUShaderModuleGLSLDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_INT.withName("stage"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("code"), - WGPU.C_INT.withName("defineCount"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("defines") - ).withName("WGPUShaderModuleGLSLDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfInt stage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stage")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderStage stage - * } - */ - public static final OfInt stage$layout() { - return stage$LAYOUT; - } - - private static final long stage$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderStage stage - * } - */ - public static final long stage$offset() { - return stage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderStage stage - * } - */ - public static int stage(MemorySegment struct) { - return struct.get(stage$LAYOUT, stage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderStage stage - * } - */ - public static void stage(MemorySegment struct, int fieldValue) { - struct.set(stage$LAYOUT, stage$OFFSET, fieldValue); - } - - private static final AddressLayout code$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("code")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static final AddressLayout code$layout() { - return code$LAYOUT; - } - - private static final long code$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static final long code$offset() { - return code$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static MemorySegment code(MemorySegment struct) { - return struct.get(code$LAYOUT, code$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static void code(MemorySegment struct, MemorySegment fieldValue) { - struct.set(code$LAYOUT, code$OFFSET, fieldValue); - } - - private static final OfInt defineCount$LAYOUT = (OfInt)$LAYOUT.select(groupElement("defineCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t defineCount - * } - */ - public static final OfInt defineCount$layout() { - return defineCount$LAYOUT; - } - - private static final long defineCount$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t defineCount - * } - */ - public static final long defineCount$offset() { - return defineCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t defineCount - * } - */ - public static int defineCount(MemorySegment struct) { - return struct.get(defineCount$LAYOUT, defineCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t defineCount - * } - */ - public static void defineCount(MemorySegment struct, int fieldValue) { - struct.set(defineCount$LAYOUT, defineCount$OFFSET, fieldValue); - } - - private static final AddressLayout defines$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("defines")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderDefine *defines - * } - */ - public static final AddressLayout defines$layout() { - return defines$LAYOUT; - } - - private static final long defines$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderDefine *defines - * } - */ - public static final long defines$offset() { - return defines$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderDefine *defines - * } - */ - public static MemorySegment defines(MemorySegment struct) { - return struct.get(defines$LAYOUT, defines$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderDefine *defines - * } - */ - public static void defines(MemorySegment struct, MemorySegment fieldValue) { - struct.set(defines$LAYOUT, defines$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleSPIRVDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleSPIRVDescriptor.java deleted file mode 100644 index 28781f9f4..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleSPIRVDescriptor.java +++ /dev/null @@ -1,220 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUShaderModuleSPIRVDescriptor { - * WGPUChainedStruct chain; - * uint32_t codeSize; - * const uint32_t *code; - * } - * } - */ -public class WGPUShaderModuleSPIRVDescriptor { - - WGPUShaderModuleSPIRVDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_INT.withName("codeSize"), - MemoryLayout.paddingLayout(4), - WGPU.C_POINTER.withName("code") - ).withName("WGPUShaderModuleSPIRVDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfInt codeSize$LAYOUT = (OfInt)$LAYOUT.select(groupElement("codeSize")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t codeSize - * } - */ - public static final OfInt codeSize$layout() { - return codeSize$LAYOUT; - } - - private static final long codeSize$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t codeSize - * } - */ - public static final long codeSize$offset() { - return codeSize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t codeSize - * } - */ - public static int codeSize(MemorySegment struct) { - return struct.get(codeSize$LAYOUT, codeSize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t codeSize - * } - */ - public static void codeSize(MemorySegment struct, int fieldValue) { - struct.set(codeSize$LAYOUT, codeSize$OFFSET, fieldValue); - } - - private static final AddressLayout code$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("code")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint32_t *code - * } - */ - public static final AddressLayout code$layout() { - return code$LAYOUT; - } - - private static final long code$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint32_t *code - * } - */ - public static final long code$offset() { - return code$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint32_t *code - * } - */ - public static MemorySegment code(MemorySegment struct) { - return struct.get(code$LAYOUT, code$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint32_t *code - * } - */ - public static void code(MemorySegment struct, MemorySegment fieldValue) { - struct.set(code$LAYOUT, code$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleWGSLDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleWGSLDescriptor.java deleted file mode 100644 index 528a8f74b..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUShaderModuleWGSLDescriptor.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUShaderModuleWGSLDescriptor { - * WGPUChainedStruct chain; - * const char *code; - * } - * } - */ -public class WGPUShaderModuleWGSLDescriptor { - - WGPUShaderModuleWGSLDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("code") - ).withName("WGPUShaderModuleWGSLDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout code$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("code")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static final AddressLayout code$layout() { - return code$LAYOUT; - } - - private static final long code$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static final long code$offset() { - return code$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static MemorySegment code(MemorySegment struct) { - return struct.get(code$LAYOUT, code$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *code - * } - */ - public static void code(MemorySegment struct, MemorySegment fieldValue) { - struct.set(code$LAYOUT, code$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUStencilFaceState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUStencilFaceState.java deleted file mode 100644 index b25a24f72..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUStencilFaceState.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUStencilFaceState { - * WGPUCompareFunction compare; - * WGPUStencilOperation failOp; - * WGPUStencilOperation depthFailOp; - * WGPUStencilOperation passOp; - * } - * } - */ -public class WGPUStencilFaceState { - - WGPUStencilFaceState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("compare"), - WGPU.C_INT.withName("failOp"), - WGPU.C_INT.withName("depthFailOp"), - WGPU.C_INT.withName("passOp") - ).withName("WGPUStencilFaceState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt compare$LAYOUT = (OfInt)$LAYOUT.select(groupElement("compare")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static final OfInt compare$layout() { - return compare$LAYOUT; - } - - private static final long compare$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static final long compare$offset() { - return compare$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static int compare(MemorySegment struct) { - return struct.get(compare$LAYOUT, compare$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCompareFunction compare - * } - */ - public static void compare(MemorySegment struct, int fieldValue) { - struct.set(compare$LAYOUT, compare$OFFSET, fieldValue); - } - - private static final OfInt failOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("failOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStencilOperation failOp - * } - */ - public static final OfInt failOp$layout() { - return failOp$LAYOUT; - } - - private static final long failOp$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStencilOperation failOp - * } - */ - public static final long failOp$offset() { - return failOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStencilOperation failOp - * } - */ - public static int failOp(MemorySegment struct) { - return struct.get(failOp$LAYOUT, failOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStencilOperation failOp - * } - */ - public static void failOp(MemorySegment struct, int fieldValue) { - struct.set(failOp$LAYOUT, failOp$OFFSET, fieldValue); - } - - private static final OfInt depthFailOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthFailOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStencilOperation depthFailOp - * } - */ - public static final OfInt depthFailOp$layout() { - return depthFailOp$LAYOUT; - } - - private static final long depthFailOp$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStencilOperation depthFailOp - * } - */ - public static final long depthFailOp$offset() { - return depthFailOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStencilOperation depthFailOp - * } - */ - public static int depthFailOp(MemorySegment struct) { - return struct.get(depthFailOp$LAYOUT, depthFailOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStencilOperation depthFailOp - * } - */ - public static void depthFailOp(MemorySegment struct, int fieldValue) { - struct.set(depthFailOp$LAYOUT, depthFailOp$OFFSET, fieldValue); - } - - private static final OfInt passOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("passOp")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStencilOperation passOp - * } - */ - public static final OfInt passOp$layout() { - return passOp$LAYOUT; - } - - private static final long passOp$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStencilOperation passOp - * } - */ - public static final long passOp$offset() { - return passOp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStencilOperation passOp - * } - */ - public static int passOp(MemorySegment struct) { - return struct.get(passOp$LAYOUT, passOp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStencilOperation passOp - * } - */ - public static void passOp(MemorySegment struct, int fieldValue) { - struct.set(passOp$LAYOUT, passOp$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUStorageTextureBindingLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUStorageTextureBindingLayout.java deleted file mode 100644 index 99a751ff7..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUStorageTextureBindingLayout.java +++ /dev/null @@ -1,266 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUStorageTextureBindingLayout { - * const WGPUChainedStruct *nextInChain; - * WGPUStorageTextureAccess access; - * WGPUTextureFormat format; - * WGPUTextureViewDimension viewDimension; - * } - * } - */ -public class WGPUStorageTextureBindingLayout { - - WGPUStorageTextureBindingLayout() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("access"), - WGPU.C_INT.withName("format"), - WGPU.C_INT.withName("viewDimension"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUStorageTextureBindingLayout"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt access$LAYOUT = (OfInt)$LAYOUT.select(groupElement("access")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUStorageTextureAccess access - * } - */ - public static final OfInt access$layout() { - return access$LAYOUT; - } - - private static final long access$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUStorageTextureAccess access - * } - */ - public static final long access$offset() { - return access$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUStorageTextureAccess access - * } - */ - public static int access(MemorySegment struct) { - return struct.get(access$LAYOUT, access$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUStorageTextureAccess access - * } - */ - public static void access(MemorySegment struct, int fieldValue) { - struct.set(access$LAYOUT, access$OFFSET, fieldValue); - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final OfInt viewDimension$LAYOUT = (OfInt)$LAYOUT.select(groupElement("viewDimension")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static final OfInt viewDimension$layout() { - return viewDimension$LAYOUT; - } - - private static final long viewDimension$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static final long viewDimension$offset() { - return viewDimension$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static int viewDimension(MemorySegment struct) { - return struct.get(viewDimension$LAYOUT, viewDimension$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static void viewDimension(MemorySegment struct, int fieldValue) { - struct.set(viewDimension$LAYOUT, viewDimension$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSupportedLimits.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSupportedLimits.java deleted file mode 100644 index de4a0f05f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSupportedLimits.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSupportedLimits { - * WGPUChainedStructOut *nextInChain; - * WGPULimits limits; - * } - * } - */ -public class WGPUSupportedLimits { - - WGPUSupportedLimits() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPULimits.layout().withName("limits") - ).withName("WGPUSupportedLimits"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final GroupLayout limits$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("limits")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static final GroupLayout limits$layout() { - return limits$LAYOUT; - } - - private static final long limits$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static final long limits$offset() { - return limits$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static MemorySegment limits(MemorySegment struct) { - return struct.asSlice(limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPULimits limits - * } - */ - public static void limits(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSupportedLimitsExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSupportedLimitsExtras.java deleted file mode 100644 index a7be9e6bf..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSupportedLimitsExtras.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSupportedLimitsExtras { - * WGPUChainedStructOut chain; - * WGPUNativeLimits limits; - * } - * } - */ -public class WGPUSupportedLimitsExtras { - - WGPUSupportedLimitsExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStructOut.layout().withName("chain"), - WGPUNativeLimits.layout().withName("limits") - ).withName("WGPUSupportedLimitsExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStructOut chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStructOut chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStructOut chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStructOut chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final GroupLayout limits$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("limits")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static final GroupLayout limits$layout() { - return limits$LAYOUT; - } - - private static final long limits$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static final long limits$offset() { - return limits$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static MemorySegment limits(MemorySegment struct) { - return struct.asSlice(limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUNativeLimits limits - * } - */ - public static void limits(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, limits$OFFSET, limits$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceCapabilities.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceCapabilities.java deleted file mode 100644 index 8c9ea10a1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceCapabilities.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceCapabilities { - * WGPUChainedStructOut *nextInChain; - * size_t formatCount; - * WGPUTextureFormat *formats; - * size_t presentModeCount; - * WGPUPresentMode *presentModes; - * size_t alphaModeCount; - * WGPUCompositeAlphaMode *alphaModes; - * } - * } - */ -public class WGPUSurfaceCapabilities { - - WGPUSurfaceCapabilities() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_LONG_LONG.withName("formatCount"), - WGPU.C_POINTER.withName("formats"), - WGPU.C_LONG_LONG.withName("presentModeCount"), - WGPU.C_POINTER.withName("presentModes"), - WGPU.C_LONG_LONG.withName("alphaModeCount"), - WGPU.C_POINTER.withName("alphaModes") - ).withName("WGPUSurfaceCapabilities"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStructOut *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfLong formatCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("formatCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t formatCount - * } - */ - public static final OfLong formatCount$layout() { - return formatCount$LAYOUT; - } - - private static final long formatCount$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t formatCount - * } - */ - public static final long formatCount$offset() { - return formatCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t formatCount - * } - */ - public static long formatCount(MemorySegment struct) { - return struct.get(formatCount$LAYOUT, formatCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t formatCount - * } - */ - public static void formatCount(MemorySegment struct, long fieldValue) { - struct.set(formatCount$LAYOUT, formatCount$OFFSET, fieldValue); - } - - private static final AddressLayout formats$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("formats")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat *formats - * } - */ - public static final AddressLayout formats$layout() { - return formats$LAYOUT; - } - - private static final long formats$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat *formats - * } - */ - public static final long formats$offset() { - return formats$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat *formats - * } - */ - public static MemorySegment formats(MemorySegment struct) { - return struct.get(formats$LAYOUT, formats$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat *formats - * } - */ - public static void formats(MemorySegment struct, MemorySegment fieldValue) { - struct.set(formats$LAYOUT, formats$OFFSET, fieldValue); - } - - private static final OfLong presentModeCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("presentModeCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t presentModeCount - * } - */ - public static final OfLong presentModeCount$layout() { - return presentModeCount$LAYOUT; - } - - private static final long presentModeCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t presentModeCount - * } - */ - public static final long presentModeCount$offset() { - return presentModeCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t presentModeCount - * } - */ - public static long presentModeCount(MemorySegment struct) { - return struct.get(presentModeCount$LAYOUT, presentModeCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t presentModeCount - * } - */ - public static void presentModeCount(MemorySegment struct, long fieldValue) { - struct.set(presentModeCount$LAYOUT, presentModeCount$OFFSET, fieldValue); - } - - private static final AddressLayout presentModes$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("presentModes")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPresentMode *presentModes - * } - */ - public static final AddressLayout presentModes$layout() { - return presentModes$LAYOUT; - } - - private static final long presentModes$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPresentMode *presentModes - * } - */ - public static final long presentModes$offset() { - return presentModes$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPresentMode *presentModes - * } - */ - public static MemorySegment presentModes(MemorySegment struct) { - return struct.get(presentModes$LAYOUT, presentModes$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPresentMode *presentModes - * } - */ - public static void presentModes(MemorySegment struct, MemorySegment fieldValue) { - struct.set(presentModes$LAYOUT, presentModes$OFFSET, fieldValue); - } - - private static final OfLong alphaModeCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("alphaModeCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t alphaModeCount - * } - */ - public static final OfLong alphaModeCount$layout() { - return alphaModeCount$LAYOUT; - } - - private static final long alphaModeCount$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t alphaModeCount - * } - */ - public static final long alphaModeCount$offset() { - return alphaModeCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t alphaModeCount - * } - */ - public static long alphaModeCount(MemorySegment struct) { - return struct.get(alphaModeCount$LAYOUT, alphaModeCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t alphaModeCount - * } - */ - public static void alphaModeCount(MemorySegment struct, long fieldValue) { - struct.set(alphaModeCount$LAYOUT, alphaModeCount$OFFSET, fieldValue); - } - - private static final AddressLayout alphaModes$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("alphaModes")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode *alphaModes - * } - */ - public static final AddressLayout alphaModes$layout() { - return alphaModes$LAYOUT; - } - - private static final long alphaModes$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode *alphaModes - * } - */ - public static final long alphaModes$offset() { - return alphaModes$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode *alphaModes - * } - */ - public static MemorySegment alphaModes(MemorySegment struct) { - return struct.get(alphaModes$LAYOUT, alphaModes$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode *alphaModes - * } - */ - public static void alphaModes(MemorySegment struct, MemorySegment fieldValue) { - struct.set(alphaModes$LAYOUT, alphaModes$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceConfiguration.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceConfiguration.java deleted file mode 100644 index a3c4290c8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceConfiguration.java +++ /dev/null @@ -1,541 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceConfiguration { - * const WGPUChainedStruct *nextInChain; - * WGPUDevice device; - * WGPUTextureFormat format; - * WGPUTextureUsageFlags usage; - * size_t viewFormatCount; - * const WGPUTextureFormat *viewFormats; - * WGPUCompositeAlphaMode alphaMode; - * uint32_t width; - * uint32_t height; - * WGPUPresentMode presentMode; - * } - * } - */ -public class WGPUSurfaceConfiguration { - - WGPUSurfaceConfiguration() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("device"), - WGPU.C_INT.withName("format"), - WGPU.C_INT.withName("usage"), - WGPU.C_LONG_LONG.withName("viewFormatCount"), - WGPU.C_POINTER.withName("viewFormats"), - WGPU.C_INT.withName("alphaMode"), - WGPU.C_INT.withName("width"), - WGPU.C_INT.withName("height"), - WGPU.C_INT.withName("presentMode") - ).withName("WGPUSurfaceConfiguration"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout device$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("device")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUDevice device - * } - */ - public static final AddressLayout device$layout() { - return device$LAYOUT; - } - - private static final long device$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUDevice device - * } - */ - public static final long device$offset() { - return device$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUDevice device - * } - */ - public static MemorySegment device(MemorySegment struct) { - return struct.get(device$LAYOUT, device$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUDevice device - * } - */ - public static void device(MemorySegment struct, MemorySegment fieldValue) { - struct.set(device$LAYOUT, device$OFFSET, fieldValue); - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final OfInt usage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("usage")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static final OfInt usage$layout() { - return usage$LAYOUT; - } - - private static final long usage$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static final long usage$offset() { - return usage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static int usage(MemorySegment struct) { - return struct.get(usage$LAYOUT, usage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static void usage(MemorySegment struct, int fieldValue) { - struct.set(usage$LAYOUT, usage$OFFSET, fieldValue); - } - - private static final OfLong viewFormatCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("viewFormatCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static final OfLong viewFormatCount$layout() { - return viewFormatCount$LAYOUT; - } - - private static final long viewFormatCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static final long viewFormatCount$offset() { - return viewFormatCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static long viewFormatCount(MemorySegment struct) { - return struct.get(viewFormatCount$LAYOUT, viewFormatCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static void viewFormatCount(MemorySegment struct, long fieldValue) { - struct.set(viewFormatCount$LAYOUT, viewFormatCount$OFFSET, fieldValue); - } - - private static final AddressLayout viewFormats$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("viewFormats")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static final AddressLayout viewFormats$layout() { - return viewFormats$LAYOUT; - } - - private static final long viewFormats$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static final long viewFormats$offset() { - return viewFormats$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static MemorySegment viewFormats(MemorySegment struct) { - return struct.get(viewFormats$LAYOUT, viewFormats$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static void viewFormats(MemorySegment struct, MemorySegment fieldValue) { - struct.set(viewFormats$LAYOUT, viewFormats$OFFSET, fieldValue); - } - - private static final OfInt alphaMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("alphaMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode alphaMode - * } - */ - public static final OfInt alphaMode$layout() { - return alphaMode$LAYOUT; - } - - private static final long alphaMode$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode alphaMode - * } - */ - public static final long alphaMode$offset() { - return alphaMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode alphaMode - * } - */ - public static int alphaMode(MemorySegment struct) { - return struct.get(alphaMode$LAYOUT, alphaMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUCompositeAlphaMode alphaMode - * } - */ - public static void alphaMode(MemorySegment struct, int fieldValue) { - struct.set(alphaMode$LAYOUT, alphaMode$OFFSET, fieldValue); - } - - private static final OfInt width$LAYOUT = (OfInt)$LAYOUT.select(groupElement("width")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static final OfInt width$layout() { - return width$LAYOUT; - } - - private static final long width$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static final long width$offset() { - return width$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static int width(MemorySegment struct) { - return struct.get(width$LAYOUT, width$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t width - * } - */ - public static void width(MemorySegment struct, int fieldValue) { - struct.set(width$LAYOUT, width$OFFSET, fieldValue); - } - - private static final OfInt height$LAYOUT = (OfInt)$LAYOUT.select(groupElement("height")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static final OfInt height$layout() { - return height$LAYOUT; - } - - private static final long height$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static final long height$offset() { - return height$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static int height(MemorySegment struct) { - return struct.get(height$LAYOUT, height$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t height - * } - */ - public static void height(MemorySegment struct, int fieldValue) { - struct.set(height$LAYOUT, height$OFFSET, fieldValue); - } - - private static final OfInt presentMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("presentMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUPresentMode presentMode - * } - */ - public static final OfInt presentMode$layout() { - return presentMode$LAYOUT; - } - - private static final long presentMode$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUPresentMode presentMode - * } - */ - public static final long presentMode$offset() { - return presentMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUPresentMode presentMode - * } - */ - public static int presentMode(MemorySegment struct) { - return struct.get(presentMode$LAYOUT, presentMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUPresentMode presentMode - * } - */ - public static void presentMode(MemorySegment struct, int fieldValue) { - struct.set(presentMode$LAYOUT, presentMode$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceConfigurationExtras.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceConfigurationExtras.java deleted file mode 100644 index 17a65567f..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceConfigurationExtras.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceConfigurationExtras { - * WGPUChainedStruct chain; - * WGPUBool desiredMaximumFrameLatency; - * } - * } - */ -public class WGPUSurfaceConfigurationExtras { - - WGPUSurfaceConfigurationExtras() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_INT.withName("desiredMaximumFrameLatency"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUSurfaceConfigurationExtras"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final OfInt desiredMaximumFrameLatency$LAYOUT = (OfInt)$LAYOUT.select(groupElement("desiredMaximumFrameLatency")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool desiredMaximumFrameLatency - * } - */ - public static final OfInt desiredMaximumFrameLatency$layout() { - return desiredMaximumFrameLatency$LAYOUT; - } - - private static final long desiredMaximumFrameLatency$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool desiredMaximumFrameLatency - * } - */ - public static final long desiredMaximumFrameLatency$offset() { - return desiredMaximumFrameLatency$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool desiredMaximumFrameLatency - * } - */ - public static int desiredMaximumFrameLatency(MemorySegment struct) { - return struct.get(desiredMaximumFrameLatency$LAYOUT, desiredMaximumFrameLatency$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool desiredMaximumFrameLatency - * } - */ - public static void desiredMaximumFrameLatency(MemorySegment struct, int fieldValue) { - struct.set(desiredMaximumFrameLatency$LAYOUT, desiredMaximumFrameLatency$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptor.java deleted file mode 100644 index 433217b77..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptor.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * } - * } - */ -public class WGPUSurfaceDescriptor { - - WGPUSurfaceDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label") - ).withName("WGPUSurfaceDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromAndroidNativeWindow.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromAndroidNativeWindow.java deleted file mode 100644 index a9c9507da..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromAndroidNativeWindow.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromAndroidNativeWindow { - * WGPUChainedStruct chain; - * void *window; - * } - * } - */ -public class WGPUSurfaceDescriptorFromAndroidNativeWindow { - - WGPUSurfaceDescriptorFromAndroidNativeWindow() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("window") - ).withName("WGPUSurfaceDescriptorFromAndroidNativeWindow"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout window$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("window")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *window - * } - */ - public static final AddressLayout window$layout() { - return window$LAYOUT; - } - - private static final long window$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * void *window - * } - */ - public static final long window$offset() { - return window$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *window - * } - */ - public static MemorySegment window(MemorySegment struct) { - return struct.get(window$LAYOUT, window$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *window - * } - */ - public static void window(MemorySegment struct, MemorySegment fieldValue) { - struct.set(window$LAYOUT, window$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromCanvasHTMLSelector.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromCanvasHTMLSelector.java deleted file mode 100644 index d587dcd87..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromCanvasHTMLSelector.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromCanvasHTMLSelector { - * WGPUChainedStruct chain; - * const char *selector; - * } - * } - */ -public class WGPUSurfaceDescriptorFromCanvasHTMLSelector { - - WGPUSurfaceDescriptorFromCanvasHTMLSelector() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("selector") - ).withName("WGPUSurfaceDescriptorFromCanvasHTMLSelector"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout selector$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("selector")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *selector - * } - */ - public static final AddressLayout selector$layout() { - return selector$LAYOUT; - } - - private static final long selector$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *selector - * } - */ - public static final long selector$offset() { - return selector$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *selector - * } - */ - public static MemorySegment selector(MemorySegment struct) { - return struct.get(selector$LAYOUT, selector$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *selector - * } - */ - public static void selector(MemorySegment struct, MemorySegment fieldValue) { - struct.set(selector$LAYOUT, selector$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromMetalLayer.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromMetalLayer.java deleted file mode 100644 index 2688d70ea..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromMetalLayer.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromMetalLayer { - * WGPUChainedStruct chain; - * void *layer; - * } - * } - */ -public class WGPUSurfaceDescriptorFromMetalLayer { - - WGPUSurfaceDescriptorFromMetalLayer() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("layer") - ).withName("WGPUSurfaceDescriptorFromMetalLayer"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout layer$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("layer")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *layer - * } - */ - public static final AddressLayout layer$layout() { - return layer$LAYOUT; - } - - private static final long layer$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * void *layer - * } - */ - public static final long layer$offset() { - return layer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *layer - * } - */ - public static MemorySegment layer(MemorySegment struct) { - return struct.get(layer$LAYOUT, layer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *layer - * } - */ - public static void layer(MemorySegment struct, MemorySegment fieldValue) { - struct.set(layer$LAYOUT, layer$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromWaylandSurface.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromWaylandSurface.java deleted file mode 100644 index 5db6268cb..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromWaylandSurface.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromWaylandSurface { - * WGPUChainedStruct chain; - * void *display; - * void *surface; - * } - * } - */ -public class WGPUSurfaceDescriptorFromWaylandSurface { - - WGPUSurfaceDescriptorFromWaylandSurface() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("display"), - WGPU.C_POINTER.withName("surface") - ).withName("WGPUSurfaceDescriptorFromWaylandSurface"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout display$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("display")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *display - * } - */ - public static final AddressLayout display$layout() { - return display$LAYOUT; - } - - private static final long display$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * void *display - * } - */ - public static final long display$offset() { - return display$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *display - * } - */ - public static MemorySegment display(MemorySegment struct) { - return struct.get(display$LAYOUT, display$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *display - * } - */ - public static void display(MemorySegment struct, MemorySegment fieldValue) { - struct.set(display$LAYOUT, display$OFFSET, fieldValue); - } - - private static final AddressLayout surface$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("surface")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *surface - * } - */ - public static final AddressLayout surface$layout() { - return surface$LAYOUT; - } - - private static final long surface$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * void *surface - * } - */ - public static final long surface$offset() { - return surface$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *surface - * } - */ - public static MemorySegment surface(MemorySegment struct) { - return struct.get(surface$LAYOUT, surface$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *surface - * } - */ - public static void surface(MemorySegment struct, MemorySegment fieldValue) { - struct.set(surface$LAYOUT, surface$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromWindowsHWND.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromWindowsHWND.java deleted file mode 100644 index 8e262cc62..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromWindowsHWND.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromWindowsHWND { - * WGPUChainedStruct chain; - * void *hinstance; - * void *hwnd; - * } - * } - */ -public class WGPUSurfaceDescriptorFromWindowsHWND { - - WGPUSurfaceDescriptorFromWindowsHWND() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("hinstance"), - WGPU.C_POINTER.withName("hwnd") - ).withName("WGPUSurfaceDescriptorFromWindowsHWND"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout hinstance$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("hinstance")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *hinstance - * } - */ - public static final AddressLayout hinstance$layout() { - return hinstance$LAYOUT; - } - - private static final long hinstance$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * void *hinstance - * } - */ - public static final long hinstance$offset() { - return hinstance$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *hinstance - * } - */ - public static MemorySegment hinstance(MemorySegment struct) { - return struct.get(hinstance$LAYOUT, hinstance$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *hinstance - * } - */ - public static void hinstance(MemorySegment struct, MemorySegment fieldValue) { - struct.set(hinstance$LAYOUT, hinstance$OFFSET, fieldValue); - } - - private static final AddressLayout hwnd$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("hwnd")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *hwnd - * } - */ - public static final AddressLayout hwnd$layout() { - return hwnd$LAYOUT; - } - - private static final long hwnd$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * void *hwnd - * } - */ - public static final long hwnd$offset() { - return hwnd$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *hwnd - * } - */ - public static MemorySegment hwnd(MemorySegment struct) { - return struct.get(hwnd$LAYOUT, hwnd$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *hwnd - * } - */ - public static void hwnd(MemorySegment struct, MemorySegment fieldValue) { - struct.set(hwnd$LAYOUT, hwnd$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromXcbWindow.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromXcbWindow.java deleted file mode 100644 index e717392b8..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromXcbWindow.java +++ /dev/null @@ -1,220 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromXcbWindow { - * WGPUChainedStruct chain; - * void *connection; - * uint32_t window; - * } - * } - */ -public class WGPUSurfaceDescriptorFromXcbWindow { - - WGPUSurfaceDescriptorFromXcbWindow() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("connection"), - WGPU.C_INT.withName("window"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUSurfaceDescriptorFromXcbWindow"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout connection$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("connection")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *connection - * } - */ - public static final AddressLayout connection$layout() { - return connection$LAYOUT; - } - - private static final long connection$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * void *connection - * } - */ - public static final long connection$offset() { - return connection$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *connection - * } - */ - public static MemorySegment connection(MemorySegment struct) { - return struct.get(connection$LAYOUT, connection$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *connection - * } - */ - public static void connection(MemorySegment struct, MemorySegment fieldValue) { - struct.set(connection$LAYOUT, connection$OFFSET, fieldValue); - } - - private static final OfInt window$LAYOUT = (OfInt)$LAYOUT.select(groupElement("window")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t window - * } - */ - public static final OfInt window$layout() { - return window$LAYOUT; - } - - private static final long window$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t window - * } - */ - public static final long window$offset() { - return window$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t window - * } - */ - public static int window(MemorySegment struct) { - return struct.get(window$LAYOUT, window$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t window - * } - */ - public static void window(MemorySegment struct, int fieldValue) { - struct.set(window$LAYOUT, window$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromXlibWindow.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromXlibWindow.java deleted file mode 100644 index 1484711e2..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceDescriptorFromXlibWindow.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceDescriptorFromXlibWindow { - * WGPUChainedStruct chain; - * void *display; - * uint64_t window; - * } - * } - */ -public class WGPUSurfaceDescriptorFromXlibWindow { - - WGPUSurfaceDescriptorFromXlibWindow() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPUChainedStruct.layout().withName("chain"), - WGPU.C_POINTER.withName("display"), - WGPU.C_LONG_LONG.withName("window") - ).withName("WGPUSurfaceDescriptorFromXlibWindow"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout chain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("chain")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final GroupLayout chain$layout() { - return chain$LAYOUT; - } - - private static final long chain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static final long chain$offset() { - return chain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static MemorySegment chain(MemorySegment struct) { - return struct.asSlice(chain$OFFSET, chain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUChainedStruct chain - * } - */ - public static void chain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, chain$OFFSET, chain$LAYOUT.byteSize()); - } - - private static final AddressLayout display$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("display")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *display - * } - */ - public static final AddressLayout display$layout() { - return display$LAYOUT; - } - - private static final long display$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * void *display - * } - */ - public static final long display$offset() { - return display$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *display - * } - */ - public static MemorySegment display(MemorySegment struct) { - return struct.get(display$LAYOUT, display$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *display - * } - */ - public static void display(MemorySegment struct, MemorySegment fieldValue) { - struct.set(display$LAYOUT, display$OFFSET, fieldValue); - } - - private static final OfLong window$LAYOUT = (OfLong)$LAYOUT.select(groupElement("window")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t window - * } - */ - public static final OfLong window$layout() { - return window$LAYOUT; - } - - private static final long window$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t window - * } - */ - public static final long window$offset() { - return window$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t window - * } - */ - public static long window(MemorySegment struct) { - return struct.get(window$LAYOUT, window$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t window - * } - */ - public static void window(MemorySegment struct, long fieldValue) { - struct.set(window$LAYOUT, window$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceTexture.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceTexture.java deleted file mode 100644 index 5db8bedb1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUSurfaceTexture.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUSurfaceTexture { - * WGPUTexture texture; - * WGPUBool suboptimal; - * WGPUSurfaceGetCurrentTextureStatus status; - * } - * } - */ -public class WGPUSurfaceTexture { - - WGPUSurfaceTexture() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("texture"), - WGPU.C_INT.withName("suboptimal"), - WGPU.C_INT.withName("status") - ).withName("WGPUSurfaceTexture"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout texture$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("texture")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static final AddressLayout texture$layout() { - return texture$LAYOUT; - } - - private static final long texture$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static final long texture$offset() { - return texture$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static MemorySegment texture(MemorySegment struct) { - return struct.get(texture$LAYOUT, texture$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTexture texture - * } - */ - public static void texture(MemorySegment struct, MemorySegment fieldValue) { - struct.set(texture$LAYOUT, texture$OFFSET, fieldValue); - } - - private static final OfInt suboptimal$LAYOUT = (OfInt)$LAYOUT.select(groupElement("suboptimal")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool suboptimal - * } - */ - public static final OfInt suboptimal$layout() { - return suboptimal$LAYOUT; - } - - private static final long suboptimal$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool suboptimal - * } - */ - public static final long suboptimal$offset() { - return suboptimal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool suboptimal - * } - */ - public static int suboptimal(MemorySegment struct) { - return struct.get(suboptimal$LAYOUT, suboptimal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool suboptimal - * } - */ - public static void suboptimal(MemorySegment struct, int fieldValue) { - struct.set(suboptimal$LAYOUT, suboptimal$OFFSET, fieldValue); - } - - private static final OfInt status$LAYOUT = (OfInt)$LAYOUT.select(groupElement("status")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSurfaceGetCurrentTextureStatus status - * } - */ - public static final OfInt status$layout() { - return status$LAYOUT; - } - - private static final long status$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSurfaceGetCurrentTextureStatus status - * } - */ - public static final long status$offset() { - return status$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSurfaceGetCurrentTextureStatus status - * } - */ - public static int status(MemorySegment struct) { - return struct.get(status$LAYOUT, status$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSurfaceGetCurrentTextureStatus status - * } - */ - public static void status(MemorySegment struct, int fieldValue) { - struct.set(status$LAYOUT, status$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureBindingLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureBindingLayout.java deleted file mode 100644 index 7fdd634fb..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureBindingLayout.java +++ /dev/null @@ -1,266 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUTextureBindingLayout { - * const WGPUChainedStruct *nextInChain; - * WGPUTextureSampleType sampleType; - * WGPUTextureViewDimension viewDimension; - * WGPUBool multisampled; - * } - * } - */ -public class WGPUTextureBindingLayout { - - WGPUTextureBindingLayout() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_INT.withName("sampleType"), - WGPU.C_INT.withName("viewDimension"), - WGPU.C_INT.withName("multisampled"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUTextureBindingLayout"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfInt sampleType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sampleType")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureSampleType sampleType - * } - */ - public static final OfInt sampleType$layout() { - return sampleType$LAYOUT; - } - - private static final long sampleType$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureSampleType sampleType - * } - */ - public static final long sampleType$offset() { - return sampleType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureSampleType sampleType - * } - */ - public static int sampleType(MemorySegment struct) { - return struct.get(sampleType$LAYOUT, sampleType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureSampleType sampleType - * } - */ - public static void sampleType(MemorySegment struct, int fieldValue) { - struct.set(sampleType$LAYOUT, sampleType$OFFSET, fieldValue); - } - - private static final OfInt viewDimension$LAYOUT = (OfInt)$LAYOUT.select(groupElement("viewDimension")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static final OfInt viewDimension$layout() { - return viewDimension$LAYOUT; - } - - private static final long viewDimension$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static final long viewDimension$offset() { - return viewDimension$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static int viewDimension(MemorySegment struct) { - return struct.get(viewDimension$LAYOUT, viewDimension$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureViewDimension viewDimension - * } - */ - public static void viewDimension(MemorySegment struct, int fieldValue) { - struct.set(viewDimension$LAYOUT, viewDimension$OFFSET, fieldValue); - } - - private static final OfInt multisampled$LAYOUT = (OfInt)$LAYOUT.select(groupElement("multisampled")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUBool multisampled - * } - */ - public static final OfInt multisampled$layout() { - return multisampled$LAYOUT; - } - - private static final long multisampled$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUBool multisampled - * } - */ - public static final long multisampled$offset() { - return multisampled$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUBool multisampled - * } - */ - public static int multisampled(MemorySegment struct) { - return struct.get(multisampled$LAYOUT, multisampled$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUBool multisampled - * } - */ - public static void multisampled(MemorySegment struct, int fieldValue) { - struct.set(multisampled$LAYOUT, multisampled$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureDataLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureDataLayout.java deleted file mode 100644 index 45d31696b..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureDataLayout.java +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUTextureDataLayout { - * const WGPUChainedStruct *nextInChain; - * uint64_t offset; - * uint32_t bytesPerRow; - * uint32_t rowsPerImage; - * } - * } - */ -public class WGPUTextureDataLayout { - - WGPUTextureDataLayout() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_LONG_LONG.withName("offset"), - WGPU.C_INT.withName("bytesPerRow"), - WGPU.C_INT.withName("rowsPerImage") - ).withName("WGPUTextureDataLayout"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final OfLong offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("offset")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final OfLong offset$layout() { - return offset$LAYOUT; - } - - private static final long offset$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final long offset$offset() { - return offset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static long offset(MemorySegment struct) { - return struct.get(offset$LAYOUT, offset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static void offset(MemorySegment struct, long fieldValue) { - struct.set(offset$LAYOUT, offset$OFFSET, fieldValue); - } - - private static final OfInt bytesPerRow$LAYOUT = (OfInt)$LAYOUT.select(groupElement("bytesPerRow")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t bytesPerRow - * } - */ - public static final OfInt bytesPerRow$layout() { - return bytesPerRow$LAYOUT; - } - - private static final long bytesPerRow$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t bytesPerRow - * } - */ - public static final long bytesPerRow$offset() { - return bytesPerRow$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t bytesPerRow - * } - */ - public static int bytesPerRow(MemorySegment struct) { - return struct.get(bytesPerRow$LAYOUT, bytesPerRow$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t bytesPerRow - * } - */ - public static void bytesPerRow(MemorySegment struct, int fieldValue) { - struct.set(bytesPerRow$LAYOUT, bytesPerRow$OFFSET, fieldValue); - } - - private static final OfInt rowsPerImage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rowsPerImage")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t rowsPerImage - * } - */ - public static final OfInt rowsPerImage$layout() { - return rowsPerImage$LAYOUT; - } - - private static final long rowsPerImage$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t rowsPerImage - * } - */ - public static final long rowsPerImage$offset() { - return rowsPerImage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t rowsPerImage - * } - */ - public static int rowsPerImage(MemorySegment struct) { - return struct.get(rowsPerImage$LAYOUT, rowsPerImage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t rowsPerImage - * } - */ - public static void rowsPerImage(MemorySegment struct, int fieldValue) { - struct.set(rowsPerImage$LAYOUT, rowsPerImage$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureDescriptor.java deleted file mode 100644 index 55db0a7ef..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureDescriptor.java +++ /dev/null @@ -1,541 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUTextureDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUTextureUsageFlags usage; - * WGPUTextureDimension dimension; - * WGPUExtent3D size; - * WGPUTextureFormat format; - * uint32_t mipLevelCount; - * uint32_t sampleCount; - * size_t viewFormatCount; - * const WGPUTextureFormat *viewFormats; - * } - * } - */ -public class WGPUTextureDescriptor { - - WGPUTextureDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_INT.withName("usage"), - WGPU.C_INT.withName("dimension"), - WGPUExtent3D.layout().withName("size"), - WGPU.C_INT.withName("format"), - WGPU.C_INT.withName("mipLevelCount"), - WGPU.C_INT.withName("sampleCount"), - WGPU.C_LONG_LONG.withName("viewFormatCount"), - WGPU.C_POINTER.withName("viewFormats") - ).withName("WGPUTextureDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfInt usage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("usage")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static final OfInt usage$layout() { - return usage$LAYOUT; - } - - private static final long usage$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static final long usage$offset() { - return usage$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static int usage(MemorySegment struct) { - return struct.get(usage$LAYOUT, usage$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureUsageFlags usage - * } - */ - public static void usage(MemorySegment struct, int fieldValue) { - struct.set(usage$LAYOUT, usage$OFFSET, fieldValue); - } - - private static final OfInt dimension$LAYOUT = (OfInt)$LAYOUT.select(groupElement("dimension")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureDimension dimension - * } - */ - public static final OfInt dimension$layout() { - return dimension$LAYOUT; - } - - private static final long dimension$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureDimension dimension - * } - */ - public static final long dimension$offset() { - return dimension$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureDimension dimension - * } - */ - public static int dimension(MemorySegment struct) { - return struct.get(dimension$LAYOUT, dimension$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureDimension dimension - * } - */ - public static void dimension(MemorySegment struct, int fieldValue) { - struct.set(dimension$LAYOUT, dimension$OFFSET, fieldValue); - } - - private static final GroupLayout size$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("size")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUExtent3D size - * } - */ - public static final GroupLayout size$layout() { - return size$LAYOUT; - } - - private static final long size$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUExtent3D size - * } - */ - public static final long size$offset() { - return size$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUExtent3D size - * } - */ - public static MemorySegment size(MemorySegment struct) { - return struct.asSlice(size$OFFSET, size$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUExtent3D size - * } - */ - public static void size(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, size$OFFSET, size$LAYOUT.byteSize()); - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final OfInt mipLevelCount$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mipLevelCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static final OfInt mipLevelCount$layout() { - return mipLevelCount$LAYOUT; - } - - private static final long mipLevelCount$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static final long mipLevelCount$offset() { - return mipLevelCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static int mipLevelCount(MemorySegment struct) { - return struct.get(mipLevelCount$LAYOUT, mipLevelCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static void mipLevelCount(MemorySegment struct, int fieldValue) { - struct.set(mipLevelCount$LAYOUT, mipLevelCount$OFFSET, fieldValue); - } - - private static final OfInt sampleCount$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sampleCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static final OfInt sampleCount$layout() { - return sampleCount$LAYOUT; - } - - private static final long sampleCount$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static final long sampleCount$offset() { - return sampleCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static int sampleCount(MemorySegment struct) { - return struct.get(sampleCount$LAYOUT, sampleCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t sampleCount - * } - */ - public static void sampleCount(MemorySegment struct, int fieldValue) { - struct.set(sampleCount$LAYOUT, sampleCount$OFFSET, fieldValue); - } - - private static final OfLong viewFormatCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("viewFormatCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static final OfLong viewFormatCount$layout() { - return viewFormatCount$LAYOUT; - } - - private static final long viewFormatCount$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static final long viewFormatCount$offset() { - return viewFormatCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static long viewFormatCount(MemorySegment struct) { - return struct.get(viewFormatCount$LAYOUT, viewFormatCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t viewFormatCount - * } - */ - public static void viewFormatCount(MemorySegment struct, long fieldValue) { - struct.set(viewFormatCount$LAYOUT, viewFormatCount$OFFSET, fieldValue); - } - - private static final AddressLayout viewFormats$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("viewFormats")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static final AddressLayout viewFormats$layout() { - return viewFormats$LAYOUT; - } - - private static final long viewFormats$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static final long viewFormats$offset() { - return viewFormats$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static MemorySegment viewFormats(MemorySegment struct) { - return struct.get(viewFormats$LAYOUT, viewFormats$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUTextureFormat *viewFormats - * } - */ - public static void viewFormats(MemorySegment struct, MemorySegment fieldValue) { - struct.set(viewFormats$LAYOUT, viewFormats$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureViewDescriptor.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureViewDescriptor.java deleted file mode 100644 index de49ef5b1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUTextureViewDescriptor.java +++ /dev/null @@ -1,496 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUTextureViewDescriptor { - * const WGPUChainedStruct *nextInChain; - * const char *label; - * WGPUTextureFormat format; - * WGPUTextureViewDimension dimension; - * uint32_t baseMipLevel; - * uint32_t mipLevelCount; - * uint32_t baseArrayLayer; - * uint32_t arrayLayerCount; - * WGPUTextureAspect aspect; - * } - * } - */ -public class WGPUTextureViewDescriptor { - - WGPUTextureViewDescriptor() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("label"), - WGPU.C_INT.withName("format"), - WGPU.C_INT.withName("dimension"), - WGPU.C_INT.withName("baseMipLevel"), - WGPU.C_INT.withName("mipLevelCount"), - WGPU.C_INT.withName("baseArrayLayer"), - WGPU.C_INT.withName("arrayLayerCount"), - WGPU.C_INT.withName("aspect"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUTextureViewDescriptor"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final AddressLayout label$layout() { - return label$LAYOUT; - } - - private static final long label$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static final long label$offset() { - return label$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static MemorySegment label(MemorySegment struct) { - return struct.get(label$LAYOUT, label$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *label - * } - */ - public static void label(MemorySegment struct, MemorySegment fieldValue) { - struct.set(label$LAYOUT, label$OFFSET, fieldValue); - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final OfInt dimension$LAYOUT = (OfInt)$LAYOUT.select(groupElement("dimension")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureViewDimension dimension - * } - */ - public static final OfInt dimension$layout() { - return dimension$LAYOUT; - } - - private static final long dimension$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureViewDimension dimension - * } - */ - public static final long dimension$offset() { - return dimension$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureViewDimension dimension - * } - */ - public static int dimension(MemorySegment struct) { - return struct.get(dimension$LAYOUT, dimension$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureViewDimension dimension - * } - */ - public static void dimension(MemorySegment struct, int fieldValue) { - struct.set(dimension$LAYOUT, dimension$OFFSET, fieldValue); - } - - private static final OfInt baseMipLevel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("baseMipLevel")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t baseMipLevel - * } - */ - public static final OfInt baseMipLevel$layout() { - return baseMipLevel$LAYOUT; - } - - private static final long baseMipLevel$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t baseMipLevel - * } - */ - public static final long baseMipLevel$offset() { - return baseMipLevel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t baseMipLevel - * } - */ - public static int baseMipLevel(MemorySegment struct) { - return struct.get(baseMipLevel$LAYOUT, baseMipLevel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t baseMipLevel - * } - */ - public static void baseMipLevel(MemorySegment struct, int fieldValue) { - struct.set(baseMipLevel$LAYOUT, baseMipLevel$OFFSET, fieldValue); - } - - private static final OfInt mipLevelCount$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mipLevelCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static final OfInt mipLevelCount$layout() { - return mipLevelCount$LAYOUT; - } - - private static final long mipLevelCount$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static final long mipLevelCount$offset() { - return mipLevelCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static int mipLevelCount(MemorySegment struct) { - return struct.get(mipLevelCount$LAYOUT, mipLevelCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t mipLevelCount - * } - */ - public static void mipLevelCount(MemorySegment struct, int fieldValue) { - struct.set(mipLevelCount$LAYOUT, mipLevelCount$OFFSET, fieldValue); - } - - private static final OfInt baseArrayLayer$LAYOUT = (OfInt)$LAYOUT.select(groupElement("baseArrayLayer")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t baseArrayLayer - * } - */ - public static final OfInt baseArrayLayer$layout() { - return baseArrayLayer$LAYOUT; - } - - private static final long baseArrayLayer$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t baseArrayLayer - * } - */ - public static final long baseArrayLayer$offset() { - return baseArrayLayer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t baseArrayLayer - * } - */ - public static int baseArrayLayer(MemorySegment struct) { - return struct.get(baseArrayLayer$LAYOUT, baseArrayLayer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t baseArrayLayer - * } - */ - public static void baseArrayLayer(MemorySegment struct, int fieldValue) { - struct.set(baseArrayLayer$LAYOUT, baseArrayLayer$OFFSET, fieldValue); - } - - private static final OfInt arrayLayerCount$LAYOUT = (OfInt)$LAYOUT.select(groupElement("arrayLayerCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t arrayLayerCount - * } - */ - public static final OfInt arrayLayerCount$layout() { - return arrayLayerCount$LAYOUT; - } - - private static final long arrayLayerCount$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t arrayLayerCount - * } - */ - public static final long arrayLayerCount$offset() { - return arrayLayerCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t arrayLayerCount - * } - */ - public static int arrayLayerCount(MemorySegment struct) { - return struct.get(arrayLayerCount$LAYOUT, arrayLayerCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t arrayLayerCount - * } - */ - public static void arrayLayerCount(MemorySegment struct, int fieldValue) { - struct.set(arrayLayerCount$LAYOUT, arrayLayerCount$OFFSET, fieldValue); - } - - private static final OfInt aspect$LAYOUT = (OfInt)$LAYOUT.select(groupElement("aspect")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static final OfInt aspect$layout() { - return aspect$LAYOUT; - } - - private static final long aspect$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static final long aspect$offset() { - return aspect$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static int aspect(MemorySegment struct) { - return struct.get(aspect$LAYOUT, aspect$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUTextureAspect aspect - * } - */ - public static void aspect(MemorySegment struct, int fieldValue) { - struct.set(aspect$LAYOUT, aspect$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexAttribute.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexAttribute.java deleted file mode 100644 index 8237616b5..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexAttribute.java +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUVertexAttribute { - * WGPUVertexFormat format; - * uint64_t offset; - * uint32_t shaderLocation; - * } - * } - */ -public class WGPUVertexAttribute { - - WGPUVertexAttribute() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_INT.withName("format"), - MemoryLayout.paddingLayout(4), - WGPU.C_LONG_LONG.withName("offset"), - WGPU.C_INT.withName("shaderLocation"), - MemoryLayout.paddingLayout(4) - ).withName("WGPUVertexAttribute"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUVertexFormat format - * } - */ - public static final OfInt format$layout() { - return format$LAYOUT; - } - - private static final long format$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUVertexFormat format - * } - */ - public static final long format$offset() { - return format$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUVertexFormat format - * } - */ - public static int format(MemorySegment struct) { - return struct.get(format$LAYOUT, format$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUVertexFormat format - * } - */ - public static void format(MemorySegment struct, int fieldValue) { - struct.set(format$LAYOUT, format$OFFSET, fieldValue); - } - - private static final OfLong offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("offset")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final OfLong offset$layout() { - return offset$LAYOUT; - } - - private static final long offset$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static final long offset$offset() { - return offset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static long offset(MemorySegment struct) { - return struct.get(offset$LAYOUT, offset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t offset - * } - */ - public static void offset(MemorySegment struct, long fieldValue) { - struct.set(offset$LAYOUT, offset$OFFSET, fieldValue); - } - - private static final OfInt shaderLocation$LAYOUT = (OfInt)$LAYOUT.select(groupElement("shaderLocation")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t shaderLocation - * } - */ - public static final OfInt shaderLocation$layout() { - return shaderLocation$LAYOUT; - } - - private static final long shaderLocation$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t shaderLocation - * } - */ - public static final long shaderLocation$offset() { - return shaderLocation$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t shaderLocation - * } - */ - public static int shaderLocation(MemorySegment struct) { - return struct.get(shaderLocation$LAYOUT, shaderLocation$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t shaderLocation - * } - */ - public static void shaderLocation(MemorySegment struct, int fieldValue) { - struct.set(shaderLocation$LAYOUT, shaderLocation$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexBufferLayout.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexBufferLayout.java deleted file mode 100644 index d72c6f2f1..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexBufferLayout.java +++ /dev/null @@ -1,266 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUVertexBufferLayout { - * uint64_t arrayStride; - * WGPUVertexStepMode stepMode; - * size_t attributeCount; - * const WGPUVertexAttribute *attributes; - * } - * } - */ -public class WGPUVertexBufferLayout { - - WGPUVertexBufferLayout() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_LONG_LONG.withName("arrayStride"), - WGPU.C_INT.withName("stepMode"), - MemoryLayout.paddingLayout(4), - WGPU.C_LONG_LONG.withName("attributeCount"), - WGPU.C_POINTER.withName("attributes") - ).withName("WGPUVertexBufferLayout"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong arrayStride$LAYOUT = (OfLong)$LAYOUT.select(groupElement("arrayStride")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t arrayStride - * } - */ - public static final OfLong arrayStride$layout() { - return arrayStride$LAYOUT; - } - - private static final long arrayStride$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t arrayStride - * } - */ - public static final long arrayStride$offset() { - return arrayStride$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t arrayStride - * } - */ - public static long arrayStride(MemorySegment struct) { - return struct.get(arrayStride$LAYOUT, arrayStride$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t arrayStride - * } - */ - public static void arrayStride(MemorySegment struct, long fieldValue) { - struct.set(arrayStride$LAYOUT, arrayStride$OFFSET, fieldValue); - } - - private static final OfInt stepMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("stepMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUVertexStepMode stepMode - * } - */ - public static final OfInt stepMode$layout() { - return stepMode$LAYOUT; - } - - private static final long stepMode$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUVertexStepMode stepMode - * } - */ - public static final long stepMode$offset() { - return stepMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUVertexStepMode stepMode - * } - */ - public static int stepMode(MemorySegment struct) { - return struct.get(stepMode$LAYOUT, stepMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUVertexStepMode stepMode - * } - */ - public static void stepMode(MemorySegment struct, int fieldValue) { - struct.set(stepMode$LAYOUT, stepMode$OFFSET, fieldValue); - } - - private static final OfLong attributeCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("attributeCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t attributeCount - * } - */ - public static final OfLong attributeCount$layout() { - return attributeCount$LAYOUT; - } - - private static final long attributeCount$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t attributeCount - * } - */ - public static final long attributeCount$offset() { - return attributeCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t attributeCount - * } - */ - public static long attributeCount(MemorySegment struct) { - return struct.get(attributeCount$LAYOUT, attributeCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t attributeCount - * } - */ - public static void attributeCount(MemorySegment struct, long fieldValue) { - struct.set(attributeCount$LAYOUT, attributeCount$OFFSET, fieldValue); - } - - private static final AddressLayout attributes$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("attributes")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUVertexAttribute *attributes - * } - */ - public static final AddressLayout attributes$layout() { - return attributes$LAYOUT; - } - - private static final long attributes$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUVertexAttribute *attributes - * } - */ - public static final long attributes$offset() { - return attributes$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUVertexAttribute *attributes - * } - */ - public static MemorySegment attributes(MemorySegment struct) { - return struct.get(attributes$LAYOUT, attributes$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUVertexAttribute *attributes - * } - */ - public static void attributes(MemorySegment struct, MemorySegment fieldValue) { - struct.set(attributes$LAYOUT, attributes$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexState.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexState.java deleted file mode 100644 index 1d53f1857..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUVertexState.java +++ /dev/null @@ -1,403 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUVertexState { - * const WGPUChainedStruct *nextInChain; - * WGPUShaderModule module; - * const char *entryPoint; - * size_t constantCount; - * const WGPUConstantEntry *constants; - * size_t bufferCount; - * const WGPUVertexBufferLayout *buffers; - * } - * } - */ -public class WGPUVertexState { - - WGPUVertexState() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("nextInChain"), - WGPU.C_POINTER.withName("module"), - WGPU.C_POINTER.withName("entryPoint"), - WGPU.C_LONG_LONG.withName("constantCount"), - WGPU.C_POINTER.withName("constants"), - WGPU.C_LONG_LONG.withName("bufferCount"), - WGPU.C_POINTER.withName("buffers") - ).withName("WGPUVertexState"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final AddressLayout nextInChain$layout() { - return nextInChain$LAYOUT; - } - - private static final long nextInChain$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static final long nextInChain$offset() { - return nextInChain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static MemorySegment nextInChain(MemorySegment struct) { - return struct.get(nextInChain$LAYOUT, nextInChain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUChainedStruct *nextInChain - * } - */ - public static void nextInChain(MemorySegment struct, MemorySegment fieldValue) { - struct.set(nextInChain$LAYOUT, nextInChain$OFFSET, fieldValue); - } - - private static final AddressLayout module$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("module")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static final AddressLayout module$layout() { - return module$LAYOUT; - } - - private static final long module$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static final long module$offset() { - return module$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static MemorySegment module(MemorySegment struct) { - return struct.get(module$LAYOUT, module$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUShaderModule module - * } - */ - public static void module(MemorySegment struct, MemorySegment fieldValue) { - struct.set(module$LAYOUT, module$OFFSET, fieldValue); - } - - private static final AddressLayout entryPoint$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("entryPoint")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final AddressLayout entryPoint$layout() { - return entryPoint$LAYOUT; - } - - private static final long entryPoint$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static final long entryPoint$offset() { - return entryPoint$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static MemorySegment entryPoint(MemorySegment struct) { - return struct.get(entryPoint$LAYOUT, entryPoint$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *entryPoint - * } - */ - public static void entryPoint(MemorySegment struct, MemorySegment fieldValue) { - struct.set(entryPoint$LAYOUT, entryPoint$OFFSET, fieldValue); - } - - private static final OfLong constantCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("constantCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static final OfLong constantCount$layout() { - return constantCount$LAYOUT; - } - - private static final long constantCount$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static final long constantCount$offset() { - return constantCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static long constantCount(MemorySegment struct) { - return struct.get(constantCount$LAYOUT, constantCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t constantCount - * } - */ - public static void constantCount(MemorySegment struct, long fieldValue) { - struct.set(constantCount$LAYOUT, constantCount$OFFSET, fieldValue); - } - - private static final AddressLayout constants$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("constants")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static final AddressLayout constants$layout() { - return constants$LAYOUT; - } - - private static final long constants$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static final long constants$offset() { - return constants$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static MemorySegment constants(MemorySegment struct) { - return struct.get(constants$LAYOUT, constants$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUConstantEntry *constants - * } - */ - public static void constants(MemorySegment struct, MemorySegment fieldValue) { - struct.set(constants$LAYOUT, constants$OFFSET, fieldValue); - } - - private static final OfLong bufferCount$LAYOUT = (OfLong)$LAYOUT.select(groupElement("bufferCount")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static final OfLong bufferCount$layout() { - return bufferCount$LAYOUT; - } - - private static final long bufferCount$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static final long bufferCount$offset() { - return bufferCount$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static long bufferCount(MemorySegment struct) { - return struct.get(bufferCount$LAYOUT, bufferCount$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t bufferCount - * } - */ - public static void bufferCount(MemorySegment struct, long fieldValue) { - struct.set(bufferCount$LAYOUT, bufferCount$OFFSET, fieldValue); - } - - private static final AddressLayout buffers$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("buffers")); - - /** - * Layout for field: - * {@snippet lang=c : - * const WGPUVertexBufferLayout *buffers - * } - */ - public static final AddressLayout buffers$layout() { - return buffers$LAYOUT; - } - - private static final long buffers$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * const WGPUVertexBufferLayout *buffers - * } - */ - public static final long buffers$offset() { - return buffers$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const WGPUVertexBufferLayout *buffers - * } - */ - public static MemorySegment buffers(MemorySegment struct) { - return struct.get(buffers$LAYOUT, buffers$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const WGPUVertexBufferLayout *buffers - * } - */ - public static void buffers(MemorySegment struct, MemorySegment fieldValue) { - struct.set(buffers$LAYOUT, buffers$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUWrappedSubmissionIndex.java b/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUWrappedSubmissionIndex.java deleted file mode 100644 index ed45aa376..000000000 --- a/wgpu-ffm/src/main/java/com/littlekt/wgpu/WGPUWrappedSubmissionIndex.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package com.littlekt.wgpu; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct WGPUWrappedSubmissionIndex { - * WGPUQueue queue; - * WGPUSubmissionIndex submissionIndex; - * } - * } - */ -public class WGPUWrappedSubmissionIndex { - - WGPUWrappedSubmissionIndex() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - WGPU.C_POINTER.withName("queue"), - WGPU.C_LONG_LONG.withName("submissionIndex") - ).withName("WGPUWrappedSubmissionIndex"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout queue$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("queue")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUQueue queue - * } - */ - public static final AddressLayout queue$layout() { - return queue$LAYOUT; - } - - private static final long queue$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUQueue queue - * } - */ - public static final long queue$offset() { - return queue$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUQueue queue - * } - */ - public static MemorySegment queue(MemorySegment struct) { - return struct.get(queue$LAYOUT, queue$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUQueue queue - * } - */ - public static void queue(MemorySegment struct, MemorySegment fieldValue) { - struct.set(queue$LAYOUT, queue$OFFSET, fieldValue); - } - - private static final OfLong submissionIndex$LAYOUT = (OfLong)$LAYOUT.select(groupElement("submissionIndex")); - - /** - * Layout for field: - * {@snippet lang=c : - * WGPUSubmissionIndex submissionIndex - * } - */ - public static final OfLong submissionIndex$layout() { - return submissionIndex$LAYOUT; - } - - private static final long submissionIndex$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * WGPUSubmissionIndex submissionIndex - * } - */ - public static final long submissionIndex$offset() { - return submissionIndex$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * WGPUSubmissionIndex submissionIndex - * } - */ - public static long submissionIndex(MemorySegment struct) { - return struct.get(submissionIndex$LAYOUT, submissionIndex$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * WGPUSubmissionIndex submissionIndex - * } - */ - public static void submissionIndex(MemorySegment struct, long fieldValue) { - struct.set(submissionIndex$LAYOUT, submissionIndex$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/wgpu-natives/build.gradle.kts b/wgpu-natives/build.gradle.kts deleted file mode 100644 index 9962ec5ed..000000000 --- a/wgpu-natives/build.gradle.kts +++ /dev/null @@ -1,79 +0,0 @@ -import de.undercouch.gradle.tasks.download.Download - -plugins { - alias(libs.plugins.kotlin.jvm) - alias(libs.plugins.download) - id("module.publication") -} - -tasks { - register("downloadWgpuNativeHeaders", Download::class) { - val webgpuHeadersSHA: String by rootProject.extra - val wgpuNativeVersion: String by rootProject.extra - val webgpuHeaderUrl = - "https://raw.githubusercontent.com/webgpu-native/webgpu-headers/$webgpuHeadersSHA/webgpu.h" - val wgpuHeaderUrl = - "https://raw.githubusercontent.com/gfx-rs/wgpu-native/v$wgpuNativeVersion/ffi/wgpu.h" - - onlyIfModified(true) - src(listOf(webgpuHeaderUrl, wgpuHeaderUrl)) - dest("${layout.buildDirectory.asFile.get().path}/wgpu_headers") - } - - register("installWgpuNativeHeaders", Copy::class) { - dependsOn("downloadWgpuNativeHeaders") - val buildDir = layout.buildDirectory.asFile.get().path - - from("$buildDir/wgpu_headers") { include("**.h") } - into("$projectDir/src/main/c") - } - - register("downloadWgpuNativeBinaries", Download::class) { - val wgpuNativeVersion: String by rootProject.extra - val baseUrl = "https://github.com/gfx-rs/wgpu-native/releases/download/v$wgpuNativeVersion" - onlyIfModified(true) - src( - listOf( - "$baseUrl/wgpu-windows-x86_64-release.zip", - "$baseUrl/wgpu-macos-x86_64-release.zip ", - "$baseUrl/wgpu-macos-aarch64-release.zip ", - "$baseUrl/wgpu-linux-x86_64-release.zip" - ) - ) - dest(layout.buildDirectory.asFile.get()) - } - - register("installWgpuNativeBinaries", Copy::class) { - dependsOn("downloadWgpuNativeBinaries") - val buildDir = layout.buildDirectory.asFile.get().path - - from(zipTree("$buildDir/wgpu-windows-x86_64-release.zip")) { include("**.dll") } - from(zipTree("$buildDir/wgpu-macos-x86_64-release.zip")) { include("**.dylib") } - from(zipTree("$buildDir/wgpu-macos-aarch64-release.zip")) { - include("**.dylib") - rename { it.replace(".dylib", "_aarch64.dylib") } - } - from(zipTree("$buildDir/wgpu-linux-x86_64-release.zip")) { include("**.so") } - - into("$projectDir/src/main/resources") - } - - register("downloadAndInstallWgpuNativeBinariesAndHeaders") { - dependsOn("installWgpuNativeHeaders") - dependsOn("installWgpuNativeBinaries") - } - - val compileJava by getting { dependsOn("downloadAndInstallWgpuNativeBinariesAndHeaders") } - - val processResources by getting { dependsOn("downloadAndInstallWgpuNativeBinariesAndHeaders") } -} - -kotlin { - dependencies { testImplementation(libs.kotlin.test) } - - tasks.test { useJUnitPlatform() } -} - -publishing { - publications { create("wgpu-natives") { from(components["java"]) } } -} diff --git a/wgpu-natives/src/main/c/webgpu.h b/wgpu-natives/src/main/c/webgpu.h deleted file mode 100644 index d25335135..000000000 --- a/wgpu-natives/src/main/c/webgpu.h +++ /dev/null @@ -1,1806 +0,0 @@ -// BSD 3-Clause License -// -// Copyright (c) 2019, "WebGPU native" developers -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef WEBGPU_H_ -#define WEBGPU_H_ - -#if defined(WGPU_SHARED_LIBRARY) -# if defined(_WIN32) -# if defined(WGPU_IMPLEMENTATION) -# define WGPU_EXPORT __declspec(dllexport) -# else -# define WGPU_EXPORT __declspec(dllimport) -# endif -# else // defined(_WIN32) -# if defined(WGPU_IMPLEMENTATION) -# define WGPU_EXPORT __attribute__((visibility("default"))) -# else -# define WGPU_EXPORT -# endif -# endif // defined(_WIN32) -#else // defined(WGPU_SHARED_LIBRARY) -# define WGPU_EXPORT -#endif // defined(WGPU_SHARED_LIBRARY) - -#if !defined(WGPU_OBJECT_ATTRIBUTE) -#define WGPU_OBJECT_ATTRIBUTE -#endif -#if !defined(WGPU_ENUM_ATTRIBUTE) -#define WGPU_ENUM_ATTRIBUTE -#endif -#if !defined(WGPU_STRUCTURE_ATTRIBUTE) -#define WGPU_STRUCTURE_ATTRIBUTE -#endif -#if !defined(WGPU_FUNCTION_ATTRIBUTE) -#define WGPU_FUNCTION_ATTRIBUTE -#endif -#if !defined(WGPU_NULLABLE) -#define WGPU_NULLABLE -#endif - -#include -#include - -#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED (0xffffffffUL) -#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL) -#define WGPU_LIMIT_U32_UNDEFINED (0xffffffffUL) -#define WGPU_LIMIT_U64_UNDEFINED (0xffffffffffffffffULL) -#define WGPU_MIP_LEVEL_COUNT_UNDEFINED (0xffffffffUL) -#define WGPU_QUERY_SET_INDEX_UNDEFINED (0xffffffffUL) -#define WGPU_WHOLE_MAP_SIZE SIZE_MAX -#define WGPU_WHOLE_SIZE (0xffffffffffffffffULL) - -typedef uint32_t WGPUFlags; -typedef uint32_t WGPUBool; - -typedef struct WGPUAdapterImpl* WGPUAdapter WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUBindGroupImpl* WGPUBindGroup WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUBindGroupLayoutImpl* WGPUBindGroupLayout WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUBufferImpl* WGPUBuffer WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUCommandBufferImpl* WGPUCommandBuffer WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUCommandEncoderImpl* WGPUCommandEncoder WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUComputePassEncoderImpl* WGPUComputePassEncoder WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUComputePipelineImpl* WGPUComputePipeline WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUDeviceImpl* WGPUDevice WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUInstanceImpl* WGPUInstance WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUQuerySetImpl* WGPUQuerySet WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUQueueImpl* WGPUQueue WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderBundleImpl* WGPURenderBundle WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderBundleEncoderImpl* WGPURenderBundleEncoder WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderPassEncoderImpl* WGPURenderPassEncoder WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderPipelineImpl* WGPURenderPipeline WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSamplerImpl* WGPUSampler WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUShaderModuleImpl* WGPUShaderModule WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSurfaceImpl* WGPUSurface WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureImpl* WGPUTexture WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE; - -// Structure forward declarations -struct WGPUAdapterProperties; -struct WGPUBindGroupEntry; -struct WGPUBlendComponent; -struct WGPUBufferBindingLayout; -struct WGPUBufferDescriptor; -struct WGPUColor; -struct WGPUCommandBufferDescriptor; -struct WGPUCommandEncoderDescriptor; -struct WGPUCompilationMessage; -struct WGPUComputePassTimestampWrites; -struct WGPUConstantEntry; -struct WGPUExtent3D; -struct WGPUInstanceDescriptor; -struct WGPULimits; -struct WGPUMultisampleState; -struct WGPUOrigin3D; -struct WGPUPipelineLayoutDescriptor; -struct WGPUPrimitiveDepthClipControl; -struct WGPUPrimitiveState; -struct WGPUQuerySetDescriptor; -struct WGPUQueueDescriptor; -struct WGPURenderBundleDescriptor; -struct WGPURenderBundleEncoderDescriptor; -struct WGPURenderPassDepthStencilAttachment; -struct WGPURenderPassDescriptorMaxDrawCount; -struct WGPURenderPassTimestampWrites; -struct WGPURequestAdapterOptions; -struct WGPUSamplerBindingLayout; -struct WGPUSamplerDescriptor; -struct WGPUShaderModuleCompilationHint; -struct WGPUShaderModuleSPIRVDescriptor; -struct WGPUShaderModuleWGSLDescriptor; -struct WGPUStencilFaceState; -struct WGPUStorageTextureBindingLayout; -struct WGPUSurfaceCapabilities; -struct WGPUSurfaceConfiguration; -struct WGPUSurfaceDescriptor; -struct WGPUSurfaceDescriptorFromAndroidNativeWindow; -struct WGPUSurfaceDescriptorFromCanvasHTMLSelector; -struct WGPUSurfaceDescriptorFromMetalLayer; -struct WGPUSurfaceDescriptorFromWaylandSurface; -struct WGPUSurfaceDescriptorFromWindowsHWND; -struct WGPUSurfaceDescriptorFromXcbWindow; -struct WGPUSurfaceDescriptorFromXlibWindow; -struct WGPUSurfaceTexture; -struct WGPUTextureBindingLayout; -struct WGPUTextureDataLayout; -struct WGPUTextureViewDescriptor; -struct WGPUVertexAttribute; -struct WGPUBindGroupDescriptor; -struct WGPUBindGroupLayoutEntry; -struct WGPUBlendState; -struct WGPUCompilationInfo; -struct WGPUComputePassDescriptor; -struct WGPUDepthStencilState; -struct WGPUImageCopyBuffer; -struct WGPUImageCopyTexture; -struct WGPUProgrammableStageDescriptor; -struct WGPURenderPassColorAttachment; -struct WGPURequiredLimits; -struct WGPUShaderModuleDescriptor; -struct WGPUSupportedLimits; -struct WGPUTextureDescriptor; -struct WGPUVertexBufferLayout; -struct WGPUBindGroupLayoutDescriptor; -struct WGPUColorTargetState; -struct WGPUComputePipelineDescriptor; -struct WGPUDeviceDescriptor; -struct WGPURenderPassDescriptor; -struct WGPUVertexState; -struct WGPUFragmentState; -struct WGPURenderPipelineDescriptor; - -typedef enum WGPUAdapterType { - WGPUAdapterType_DiscreteGPU = 0x00000000, - WGPUAdapterType_IntegratedGPU = 0x00000001, - WGPUAdapterType_CPU = 0x00000002, - WGPUAdapterType_Unknown = 0x00000003, - WGPUAdapterType_Force32 = 0x7FFFFFFF -} WGPUAdapterType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUAddressMode { - WGPUAddressMode_Repeat = 0x00000000, - WGPUAddressMode_MirrorRepeat = 0x00000001, - WGPUAddressMode_ClampToEdge = 0x00000002, - WGPUAddressMode_Force32 = 0x7FFFFFFF -} WGPUAddressMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBackendType { - WGPUBackendType_Undefined = 0x00000000, - WGPUBackendType_Null = 0x00000001, - WGPUBackendType_WebGPU = 0x00000002, - WGPUBackendType_D3D11 = 0x00000003, - WGPUBackendType_D3D12 = 0x00000004, - WGPUBackendType_Metal = 0x00000005, - WGPUBackendType_Vulkan = 0x00000006, - WGPUBackendType_OpenGL = 0x00000007, - WGPUBackendType_OpenGLES = 0x00000008, - WGPUBackendType_Force32 = 0x7FFFFFFF -} WGPUBackendType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBlendFactor { - WGPUBlendFactor_Zero = 0x00000000, - WGPUBlendFactor_One = 0x00000001, - WGPUBlendFactor_Src = 0x00000002, - WGPUBlendFactor_OneMinusSrc = 0x00000003, - WGPUBlendFactor_SrcAlpha = 0x00000004, - WGPUBlendFactor_OneMinusSrcAlpha = 0x00000005, - WGPUBlendFactor_Dst = 0x00000006, - WGPUBlendFactor_OneMinusDst = 0x00000007, - WGPUBlendFactor_DstAlpha = 0x00000008, - WGPUBlendFactor_OneMinusDstAlpha = 0x00000009, - WGPUBlendFactor_SrcAlphaSaturated = 0x0000000A, - WGPUBlendFactor_Constant = 0x0000000B, - WGPUBlendFactor_OneMinusConstant = 0x0000000C, - WGPUBlendFactor_Force32 = 0x7FFFFFFF -} WGPUBlendFactor WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBlendOperation { - WGPUBlendOperation_Add = 0x00000000, - WGPUBlendOperation_Subtract = 0x00000001, - WGPUBlendOperation_ReverseSubtract = 0x00000002, - WGPUBlendOperation_Min = 0x00000003, - WGPUBlendOperation_Max = 0x00000004, - WGPUBlendOperation_Force32 = 0x7FFFFFFF -} WGPUBlendOperation WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBufferBindingType { - WGPUBufferBindingType_Undefined = 0x00000000, - WGPUBufferBindingType_Uniform = 0x00000001, - WGPUBufferBindingType_Storage = 0x00000002, - WGPUBufferBindingType_ReadOnlyStorage = 0x00000003, - WGPUBufferBindingType_Force32 = 0x7FFFFFFF -} WGPUBufferBindingType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBufferMapAsyncStatus { - WGPUBufferMapAsyncStatus_Success = 0x00000000, - WGPUBufferMapAsyncStatus_ValidationError = 0x00000001, - WGPUBufferMapAsyncStatus_Unknown = 0x00000002, - WGPUBufferMapAsyncStatus_DeviceLost = 0x00000003, - WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 0x00000004, - WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 0x00000005, - WGPUBufferMapAsyncStatus_MappingAlreadyPending = 0x00000006, - WGPUBufferMapAsyncStatus_OffsetOutOfRange = 0x00000007, - WGPUBufferMapAsyncStatus_SizeOutOfRange = 0x00000008, - WGPUBufferMapAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUBufferMapAsyncStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBufferMapState { - WGPUBufferMapState_Unmapped = 0x00000000, - WGPUBufferMapState_Pending = 0x00000001, - WGPUBufferMapState_Mapped = 0x00000002, - WGPUBufferMapState_Force32 = 0x7FFFFFFF -} WGPUBufferMapState WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompareFunction { - WGPUCompareFunction_Undefined = 0x00000000, - WGPUCompareFunction_Never = 0x00000001, - WGPUCompareFunction_Less = 0x00000002, - WGPUCompareFunction_LessEqual = 0x00000003, - WGPUCompareFunction_Greater = 0x00000004, - WGPUCompareFunction_GreaterEqual = 0x00000005, - WGPUCompareFunction_Equal = 0x00000006, - WGPUCompareFunction_NotEqual = 0x00000007, - WGPUCompareFunction_Always = 0x00000008, - WGPUCompareFunction_Force32 = 0x7FFFFFFF -} WGPUCompareFunction WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompilationInfoRequestStatus { - WGPUCompilationInfoRequestStatus_Success = 0x00000000, - WGPUCompilationInfoRequestStatus_Error = 0x00000001, - WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000002, - WGPUCompilationInfoRequestStatus_Unknown = 0x00000003, - WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF -} WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompilationMessageType { - WGPUCompilationMessageType_Error = 0x00000000, - WGPUCompilationMessageType_Warning = 0x00000001, - WGPUCompilationMessageType_Info = 0x00000002, - WGPUCompilationMessageType_Force32 = 0x7FFFFFFF -} WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompositeAlphaMode { - WGPUCompositeAlphaMode_Auto = 0x00000000, - WGPUCompositeAlphaMode_Opaque = 0x00000001, - WGPUCompositeAlphaMode_Premultiplied = 0x00000002, - WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003, - WGPUCompositeAlphaMode_Inherit = 0x00000004, - WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF -} WGPUCompositeAlphaMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCreatePipelineAsyncStatus { - WGPUCreatePipelineAsyncStatus_Success = 0x00000000, - WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000001, - WGPUCreatePipelineAsyncStatus_InternalError = 0x00000002, - WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000003, - WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000004, - WGPUCreatePipelineAsyncStatus_Unknown = 0x00000005, - WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCullMode { - WGPUCullMode_None = 0x00000000, - WGPUCullMode_Front = 0x00000001, - WGPUCullMode_Back = 0x00000002, - WGPUCullMode_Force32 = 0x7FFFFFFF -} WGPUCullMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUDeviceLostReason { - WGPUDeviceLostReason_Undefined = 0x00000000, - WGPUDeviceLostReason_Destroyed = 0x00000001, - WGPUDeviceLostReason_Force32 = 0x7FFFFFFF -} WGPUDeviceLostReason WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUErrorFilter { - WGPUErrorFilter_Validation = 0x00000000, - WGPUErrorFilter_OutOfMemory = 0x00000001, - WGPUErrorFilter_Internal = 0x00000002, - WGPUErrorFilter_Force32 = 0x7FFFFFFF -} WGPUErrorFilter WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUErrorType { - WGPUErrorType_NoError = 0x00000000, - WGPUErrorType_Validation = 0x00000001, - WGPUErrorType_OutOfMemory = 0x00000002, - WGPUErrorType_Internal = 0x00000003, - WGPUErrorType_Unknown = 0x00000004, - WGPUErrorType_DeviceLost = 0x00000005, - WGPUErrorType_Force32 = 0x7FFFFFFF -} WGPUErrorType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUFeatureName { - WGPUFeatureName_Undefined = 0x00000000, - WGPUFeatureName_DepthClipControl = 0x00000001, - WGPUFeatureName_Depth32FloatStencil8 = 0x00000002, - WGPUFeatureName_TimestampQuery = 0x00000003, - WGPUFeatureName_TextureCompressionBC = 0x00000004, - WGPUFeatureName_TextureCompressionETC2 = 0x00000005, - WGPUFeatureName_TextureCompressionASTC = 0x00000006, - WGPUFeatureName_IndirectFirstInstance = 0x00000007, - WGPUFeatureName_ShaderF16 = 0x00000008, - WGPUFeatureName_RG11B10UfloatRenderable = 0x00000009, - WGPUFeatureName_BGRA8UnormStorage = 0x0000000A, - WGPUFeatureName_Float32Filterable = 0x0000000B, - WGPUFeatureName_Force32 = 0x7FFFFFFF -} WGPUFeatureName WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUFilterMode { - WGPUFilterMode_Nearest = 0x00000000, - WGPUFilterMode_Linear = 0x00000001, - WGPUFilterMode_Force32 = 0x7FFFFFFF -} WGPUFilterMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUFrontFace { - WGPUFrontFace_CCW = 0x00000000, - WGPUFrontFace_CW = 0x00000001, - WGPUFrontFace_Force32 = 0x7FFFFFFF -} WGPUFrontFace WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUIndexFormat { - WGPUIndexFormat_Undefined = 0x00000000, - WGPUIndexFormat_Uint16 = 0x00000001, - WGPUIndexFormat_Uint32 = 0x00000002, - WGPUIndexFormat_Force32 = 0x7FFFFFFF -} WGPUIndexFormat WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPULoadOp { - WGPULoadOp_Undefined = 0x00000000, - WGPULoadOp_Clear = 0x00000001, - WGPULoadOp_Load = 0x00000002, - WGPULoadOp_Force32 = 0x7FFFFFFF -} WGPULoadOp WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUMipmapFilterMode { - WGPUMipmapFilterMode_Nearest = 0x00000000, - WGPUMipmapFilterMode_Linear = 0x00000001, - WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF -} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPowerPreference { - WGPUPowerPreference_Undefined = 0x00000000, - WGPUPowerPreference_LowPower = 0x00000001, - WGPUPowerPreference_HighPerformance = 0x00000002, - WGPUPowerPreference_Force32 = 0x7FFFFFFF -} WGPUPowerPreference WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPresentMode { - WGPUPresentMode_Fifo = 0x00000000, - WGPUPresentMode_FifoRelaxed = 0x00000001, - WGPUPresentMode_Immediate = 0x00000002, - WGPUPresentMode_Mailbox = 0x00000003, - WGPUPresentMode_Force32 = 0x7FFFFFFF -} WGPUPresentMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPrimitiveTopology { - WGPUPrimitiveTopology_PointList = 0x00000000, - WGPUPrimitiveTopology_LineList = 0x00000001, - WGPUPrimitiveTopology_LineStrip = 0x00000002, - WGPUPrimitiveTopology_TriangleList = 0x00000003, - WGPUPrimitiveTopology_TriangleStrip = 0x00000004, - WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF -} WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUQueryType { - WGPUQueryType_Occlusion = 0x00000000, - WGPUQueryType_Timestamp = 0x00000001, - WGPUQueryType_Force32 = 0x7FFFFFFF -} WGPUQueryType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUQueueWorkDoneStatus { - WGPUQueueWorkDoneStatus_Success = 0x00000000, - WGPUQueueWorkDoneStatus_Error = 0x00000001, - WGPUQueueWorkDoneStatus_Unknown = 0x00000002, - WGPUQueueWorkDoneStatus_DeviceLost = 0x00000003, - WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF -} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPURequestAdapterStatus { - WGPURequestAdapterStatus_Success = 0x00000000, - WGPURequestAdapterStatus_Unavailable = 0x00000001, - WGPURequestAdapterStatus_Error = 0x00000002, - WGPURequestAdapterStatus_Unknown = 0x00000003, - WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF -} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPURequestDeviceStatus { - WGPURequestDeviceStatus_Success = 0x00000000, - WGPURequestDeviceStatus_Error = 0x00000001, - WGPURequestDeviceStatus_Unknown = 0x00000002, - WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF -} WGPURequestDeviceStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUSType { - WGPUSType_Invalid = 0x00000000, - WGPUSType_SurfaceDescriptorFromMetalLayer = 0x00000001, - WGPUSType_SurfaceDescriptorFromWindowsHWND = 0x00000002, - WGPUSType_SurfaceDescriptorFromXlibWindow = 0x00000003, - WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, - WGPUSType_ShaderModuleSPIRVDescriptor = 0x00000005, - WGPUSType_ShaderModuleWGSLDescriptor = 0x00000006, - WGPUSType_PrimitiveDepthClipControl = 0x00000007, - WGPUSType_SurfaceDescriptorFromWaylandSurface = 0x00000008, - WGPUSType_SurfaceDescriptorFromAndroidNativeWindow = 0x00000009, - WGPUSType_SurfaceDescriptorFromXcbWindow = 0x0000000A, - WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, - WGPUSType_Force32 = 0x7FFFFFFF -} WGPUSType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUSamplerBindingType { - WGPUSamplerBindingType_Undefined = 0x00000000, - WGPUSamplerBindingType_Filtering = 0x00000001, - WGPUSamplerBindingType_NonFiltering = 0x00000002, - WGPUSamplerBindingType_Comparison = 0x00000003, - WGPUSamplerBindingType_Force32 = 0x7FFFFFFF -} WGPUSamplerBindingType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUStencilOperation { - WGPUStencilOperation_Keep = 0x00000000, - WGPUStencilOperation_Zero = 0x00000001, - WGPUStencilOperation_Replace = 0x00000002, - WGPUStencilOperation_Invert = 0x00000003, - WGPUStencilOperation_IncrementClamp = 0x00000004, - WGPUStencilOperation_DecrementClamp = 0x00000005, - WGPUStencilOperation_IncrementWrap = 0x00000006, - WGPUStencilOperation_DecrementWrap = 0x00000007, - WGPUStencilOperation_Force32 = 0x7FFFFFFF -} WGPUStencilOperation WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUStorageTextureAccess { - WGPUStorageTextureAccess_Undefined = 0x00000000, - WGPUStorageTextureAccess_WriteOnly = 0x00000001, - WGPUStorageTextureAccess_ReadOnly = 0x00000002, - WGPUStorageTextureAccess_ReadWrite = 0x00000003, - WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF -} WGPUStorageTextureAccess WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUStoreOp { - WGPUStoreOp_Undefined = 0x00000000, - WGPUStoreOp_Store = 0x00000001, - WGPUStoreOp_Discard = 0x00000002, - WGPUStoreOp_Force32 = 0x7FFFFFFF -} WGPUStoreOp WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUSurfaceGetCurrentTextureStatus { - WGPUSurfaceGetCurrentTextureStatus_Success = 0x00000000, - WGPUSurfaceGetCurrentTextureStatus_Timeout = 0x00000001, - WGPUSurfaceGetCurrentTextureStatus_Outdated = 0x00000002, - WGPUSurfaceGetCurrentTextureStatus_Lost = 0x00000003, - WGPUSurfaceGetCurrentTextureStatus_OutOfMemory = 0x00000004, - WGPUSurfaceGetCurrentTextureStatus_DeviceLost = 0x00000005, - WGPUSurfaceGetCurrentTextureStatus_Force32 = 0x7FFFFFFF -} WGPUSurfaceGetCurrentTextureStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureAspect { - WGPUTextureAspect_All = 0x00000000, - WGPUTextureAspect_StencilOnly = 0x00000001, - WGPUTextureAspect_DepthOnly = 0x00000002, - WGPUTextureAspect_Force32 = 0x7FFFFFFF -} WGPUTextureAspect WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureDimension { - WGPUTextureDimension_1D = 0x00000000, - WGPUTextureDimension_2D = 0x00000001, - WGPUTextureDimension_3D = 0x00000002, - WGPUTextureDimension_Force32 = 0x7FFFFFFF -} WGPUTextureDimension WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureFormat { - WGPUTextureFormat_Undefined = 0x00000000, - WGPUTextureFormat_R8Unorm = 0x00000001, - WGPUTextureFormat_R8Snorm = 0x00000002, - WGPUTextureFormat_R8Uint = 0x00000003, - WGPUTextureFormat_R8Sint = 0x00000004, - WGPUTextureFormat_R16Uint = 0x00000005, - WGPUTextureFormat_R16Sint = 0x00000006, - WGPUTextureFormat_R16Float = 0x00000007, - WGPUTextureFormat_RG8Unorm = 0x00000008, - WGPUTextureFormat_RG8Snorm = 0x00000009, - WGPUTextureFormat_RG8Uint = 0x0000000A, - WGPUTextureFormat_RG8Sint = 0x0000000B, - WGPUTextureFormat_R32Float = 0x0000000C, - WGPUTextureFormat_R32Uint = 0x0000000D, - WGPUTextureFormat_R32Sint = 0x0000000E, - WGPUTextureFormat_RG16Uint = 0x0000000F, - WGPUTextureFormat_RG16Sint = 0x00000010, - WGPUTextureFormat_RG16Float = 0x00000011, - WGPUTextureFormat_RGBA8Unorm = 0x00000012, - WGPUTextureFormat_RGBA8UnormSrgb = 0x00000013, - WGPUTextureFormat_RGBA8Snorm = 0x00000014, - WGPUTextureFormat_RGBA8Uint = 0x00000015, - WGPUTextureFormat_RGBA8Sint = 0x00000016, - WGPUTextureFormat_BGRA8Unorm = 0x00000017, - WGPUTextureFormat_BGRA8UnormSrgb = 0x00000018, - WGPUTextureFormat_RGB10A2Uint = 0x00000019, - WGPUTextureFormat_RGB10A2Unorm = 0x0000001A, - WGPUTextureFormat_RG11B10Ufloat = 0x0000001B, - WGPUTextureFormat_RGB9E5Ufloat = 0x0000001C, - WGPUTextureFormat_RG32Float = 0x0000001D, - WGPUTextureFormat_RG32Uint = 0x0000001E, - WGPUTextureFormat_RG32Sint = 0x0000001F, - WGPUTextureFormat_RGBA16Uint = 0x00000020, - WGPUTextureFormat_RGBA16Sint = 0x00000021, - WGPUTextureFormat_RGBA16Float = 0x00000022, - WGPUTextureFormat_RGBA32Float = 0x00000023, - WGPUTextureFormat_RGBA32Uint = 0x00000024, - WGPUTextureFormat_RGBA32Sint = 0x00000025, - WGPUTextureFormat_Stencil8 = 0x00000026, - WGPUTextureFormat_Depth16Unorm = 0x00000027, - WGPUTextureFormat_Depth24Plus = 0x00000028, - WGPUTextureFormat_Depth24PlusStencil8 = 0x00000029, - WGPUTextureFormat_Depth32Float = 0x0000002A, - WGPUTextureFormat_Depth32FloatStencil8 = 0x0000002B, - WGPUTextureFormat_BC1RGBAUnorm = 0x0000002C, - WGPUTextureFormat_BC1RGBAUnormSrgb = 0x0000002D, - WGPUTextureFormat_BC2RGBAUnorm = 0x0000002E, - WGPUTextureFormat_BC2RGBAUnormSrgb = 0x0000002F, - WGPUTextureFormat_BC3RGBAUnorm = 0x00000030, - WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000031, - WGPUTextureFormat_BC4RUnorm = 0x00000032, - WGPUTextureFormat_BC4RSnorm = 0x00000033, - WGPUTextureFormat_BC5RGUnorm = 0x00000034, - WGPUTextureFormat_BC5RGSnorm = 0x00000035, - WGPUTextureFormat_BC6HRGBUfloat = 0x00000036, - WGPUTextureFormat_BC6HRGBFloat = 0x00000037, - WGPUTextureFormat_BC7RGBAUnorm = 0x00000038, - WGPUTextureFormat_BC7RGBAUnormSrgb = 0x00000039, - WGPUTextureFormat_ETC2RGB8Unorm = 0x0000003A, - WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x0000003B, - WGPUTextureFormat_ETC2RGB8A1Unorm = 0x0000003C, - WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x0000003D, - WGPUTextureFormat_ETC2RGBA8Unorm = 0x0000003E, - WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x0000003F, - WGPUTextureFormat_EACR11Unorm = 0x00000040, - WGPUTextureFormat_EACR11Snorm = 0x00000041, - WGPUTextureFormat_EACRG11Unorm = 0x00000042, - WGPUTextureFormat_EACRG11Snorm = 0x00000043, - WGPUTextureFormat_ASTC4x4Unorm = 0x00000044, - WGPUTextureFormat_ASTC4x4UnormSrgb = 0x00000045, - WGPUTextureFormat_ASTC5x4Unorm = 0x00000046, - WGPUTextureFormat_ASTC5x4UnormSrgb = 0x00000047, - WGPUTextureFormat_ASTC5x5Unorm = 0x00000048, - WGPUTextureFormat_ASTC5x5UnormSrgb = 0x00000049, - WGPUTextureFormat_ASTC6x5Unorm = 0x0000004A, - WGPUTextureFormat_ASTC6x5UnormSrgb = 0x0000004B, - WGPUTextureFormat_ASTC6x6Unorm = 0x0000004C, - WGPUTextureFormat_ASTC6x6UnormSrgb = 0x0000004D, - WGPUTextureFormat_ASTC8x5Unorm = 0x0000004E, - WGPUTextureFormat_ASTC8x5UnormSrgb = 0x0000004F, - WGPUTextureFormat_ASTC8x6Unorm = 0x00000050, - WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000051, - WGPUTextureFormat_ASTC8x8Unorm = 0x00000052, - WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000053, - WGPUTextureFormat_ASTC10x5Unorm = 0x00000054, - WGPUTextureFormat_ASTC10x5UnormSrgb = 0x00000055, - WGPUTextureFormat_ASTC10x6Unorm = 0x00000056, - WGPUTextureFormat_ASTC10x6UnormSrgb = 0x00000057, - WGPUTextureFormat_ASTC10x8Unorm = 0x00000058, - WGPUTextureFormat_ASTC10x8UnormSrgb = 0x00000059, - WGPUTextureFormat_ASTC10x10Unorm = 0x0000005A, - WGPUTextureFormat_ASTC10x10UnormSrgb = 0x0000005B, - WGPUTextureFormat_ASTC12x10Unorm = 0x0000005C, - WGPUTextureFormat_ASTC12x10UnormSrgb = 0x0000005D, - WGPUTextureFormat_ASTC12x12Unorm = 0x0000005E, - WGPUTextureFormat_ASTC12x12UnormSrgb = 0x0000005F, - WGPUTextureFormat_Force32 = 0x7FFFFFFF -} WGPUTextureFormat WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureSampleType { - WGPUTextureSampleType_Undefined = 0x00000000, - WGPUTextureSampleType_Float = 0x00000001, - WGPUTextureSampleType_UnfilterableFloat = 0x00000002, - WGPUTextureSampleType_Depth = 0x00000003, - WGPUTextureSampleType_Sint = 0x00000004, - WGPUTextureSampleType_Uint = 0x00000005, - WGPUTextureSampleType_Force32 = 0x7FFFFFFF -} WGPUTextureSampleType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureViewDimension { - WGPUTextureViewDimension_Undefined = 0x00000000, - WGPUTextureViewDimension_1D = 0x00000001, - WGPUTextureViewDimension_2D = 0x00000002, - WGPUTextureViewDimension_2DArray = 0x00000003, - WGPUTextureViewDimension_Cube = 0x00000004, - WGPUTextureViewDimension_CubeArray = 0x00000005, - WGPUTextureViewDimension_3D = 0x00000006, - WGPUTextureViewDimension_Force32 = 0x7FFFFFFF -} WGPUTextureViewDimension WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUVertexFormat { - WGPUVertexFormat_Undefined = 0x00000000, - WGPUVertexFormat_Uint8x2 = 0x00000001, - WGPUVertexFormat_Uint8x4 = 0x00000002, - WGPUVertexFormat_Sint8x2 = 0x00000003, - WGPUVertexFormat_Sint8x4 = 0x00000004, - WGPUVertexFormat_Unorm8x2 = 0x00000005, - WGPUVertexFormat_Unorm8x4 = 0x00000006, - WGPUVertexFormat_Snorm8x2 = 0x00000007, - WGPUVertexFormat_Snorm8x4 = 0x00000008, - WGPUVertexFormat_Uint16x2 = 0x00000009, - WGPUVertexFormat_Uint16x4 = 0x0000000A, - WGPUVertexFormat_Sint16x2 = 0x0000000B, - WGPUVertexFormat_Sint16x4 = 0x0000000C, - WGPUVertexFormat_Unorm16x2 = 0x0000000D, - WGPUVertexFormat_Unorm16x4 = 0x0000000E, - WGPUVertexFormat_Snorm16x2 = 0x0000000F, - WGPUVertexFormat_Snorm16x4 = 0x00000010, - WGPUVertexFormat_Float16x2 = 0x00000011, - WGPUVertexFormat_Float16x4 = 0x00000012, - WGPUVertexFormat_Float32 = 0x00000013, - WGPUVertexFormat_Float32x2 = 0x00000014, - WGPUVertexFormat_Float32x3 = 0x00000015, - WGPUVertexFormat_Float32x4 = 0x00000016, - WGPUVertexFormat_Uint32 = 0x00000017, - WGPUVertexFormat_Uint32x2 = 0x00000018, - WGPUVertexFormat_Uint32x3 = 0x00000019, - WGPUVertexFormat_Uint32x4 = 0x0000001A, - WGPUVertexFormat_Sint32 = 0x0000001B, - WGPUVertexFormat_Sint32x2 = 0x0000001C, - WGPUVertexFormat_Sint32x3 = 0x0000001D, - WGPUVertexFormat_Sint32x4 = 0x0000001E, - WGPUVertexFormat_Force32 = 0x7FFFFFFF -} WGPUVertexFormat WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUVertexStepMode { - WGPUVertexStepMode_Vertex = 0x00000000, - WGPUVertexStepMode_Instance = 0x00000001, - WGPUVertexStepMode_VertexBufferNotUsed = 0x00000002, - WGPUVertexStepMode_Force32 = 0x7FFFFFFF -} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBufferUsage { - WGPUBufferUsage_None = 0x00000000, - WGPUBufferUsage_MapRead = 0x00000001, - WGPUBufferUsage_MapWrite = 0x00000002, - WGPUBufferUsage_CopySrc = 0x00000004, - WGPUBufferUsage_CopyDst = 0x00000008, - WGPUBufferUsage_Index = 0x00000010, - WGPUBufferUsage_Vertex = 0x00000020, - WGPUBufferUsage_Uniform = 0x00000040, - WGPUBufferUsage_Storage = 0x00000080, - WGPUBufferUsage_Indirect = 0x00000100, - WGPUBufferUsage_QueryResolve = 0x00000200, - WGPUBufferUsage_Force32 = 0x7FFFFFFF -} WGPUBufferUsage WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUBufferUsageFlags WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUColorWriteMask { - WGPUColorWriteMask_None = 0x00000000, - WGPUColorWriteMask_Red = 0x00000001, - WGPUColorWriteMask_Green = 0x00000002, - WGPUColorWriteMask_Blue = 0x00000004, - WGPUColorWriteMask_Alpha = 0x00000008, - WGPUColorWriteMask_All = 0x0000000F, - WGPUColorWriteMask_Force32 = 0x7FFFFFFF -} WGPUColorWriteMask WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUColorWriteMaskFlags WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUMapMode { - WGPUMapMode_None = 0x00000000, - WGPUMapMode_Read = 0x00000001, - WGPUMapMode_Write = 0x00000002, - WGPUMapMode_Force32 = 0x7FFFFFFF -} WGPUMapMode WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUMapModeFlags WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUShaderStage { - WGPUShaderStage_None = 0x00000000, - WGPUShaderStage_Vertex = 0x00000001, - WGPUShaderStage_Fragment = 0x00000002, - WGPUShaderStage_Compute = 0x00000004, - WGPUShaderStage_Force32 = 0x7FFFFFFF -} WGPUShaderStage WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUShaderStageFlags WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureUsage { - WGPUTextureUsage_None = 0x00000000, - WGPUTextureUsage_CopySrc = 0x00000001, - WGPUTextureUsage_CopyDst = 0x00000002, - WGPUTextureUsage_TextureBinding = 0x00000004, - WGPUTextureUsage_StorageBinding = 0x00000008, - WGPUTextureUsage_RenderAttachment = 0x00000010, - WGPUTextureUsage_Force32 = 0x7FFFFFFF -} WGPUTextureUsage WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUTextureUsageFlags WGPU_ENUM_ATTRIBUTE; - -typedef void (*WGPUBufferMapCallback)(WGPUBufferMapAsyncStatus status, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, struct WGPUCompilationInfo const * compilationInfo, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUDeviceLostCallback)(WGPUDeviceLostReason reason, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUErrorCallback)(WGPUErrorType type, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProc)(void) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; - -typedef struct WGPUChainedStruct { - struct WGPUChainedStruct const * next; - WGPUSType sType; -} WGPUChainedStruct WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUChainedStructOut { - struct WGPUChainedStructOut * next; - WGPUSType sType; -} WGPUChainedStructOut WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUAdapterProperties { - WGPUChainedStructOut * nextInChain; - uint32_t vendorID; - char const * vendorName; - char const * architecture; - uint32_t deviceID; - char const * name; - char const * driverDescription; - WGPUAdapterType adapterType; - WGPUBackendType backendType; -} WGPUAdapterProperties WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBindGroupEntry { - WGPUChainedStruct const * nextInChain; - uint32_t binding; - WGPU_NULLABLE WGPUBuffer buffer; - uint64_t offset; - uint64_t size; - WGPU_NULLABLE WGPUSampler sampler; - WGPU_NULLABLE WGPUTextureView textureView; -} WGPUBindGroupEntry WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBlendComponent { - WGPUBlendOperation operation; - WGPUBlendFactor srcFactor; - WGPUBlendFactor dstFactor; -} WGPUBlendComponent WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBufferBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUBufferBindingType type; - WGPUBool hasDynamicOffset; - uint64_t minBindingSize; -} WGPUBufferBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBufferDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUBufferUsageFlags usage; - uint64_t size; - WGPUBool mappedAtCreation; -} WGPUBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUColor { - double r; - double g; - double b; - double a; -} WGPUColor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCommandBufferDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPUCommandBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCommandEncoderDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPUCommandEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCompilationMessage { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * message; - WGPUCompilationMessageType type; - uint64_t lineNum; - uint64_t linePos; - uint64_t offset; - uint64_t length; - uint64_t utf16LinePos; - uint64_t utf16Offset; - uint64_t utf16Length; -} WGPUCompilationMessage WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUComputePassTimestampWrites { - WGPUQuerySet querySet; - uint32_t beginningOfPassWriteIndex; - uint32_t endOfPassWriteIndex; -} WGPUComputePassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUConstantEntry { - WGPUChainedStruct const * nextInChain; - char const * key; - double value; -} WGPUConstantEntry WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUExtent3D { - uint32_t width; - uint32_t height; - uint32_t depthOrArrayLayers; -} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUInstanceDescriptor { - WGPUChainedStruct const * nextInChain; -} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPULimits { - uint32_t maxTextureDimension1D; - uint32_t maxTextureDimension2D; - uint32_t maxTextureDimension3D; - uint32_t maxTextureArrayLayers; - uint32_t maxBindGroups; - uint32_t maxBindGroupsPlusVertexBuffers; - uint32_t maxBindingsPerBindGroup; - uint32_t maxDynamicUniformBuffersPerPipelineLayout; - uint32_t maxDynamicStorageBuffersPerPipelineLayout; - uint32_t maxSampledTexturesPerShaderStage; - uint32_t maxSamplersPerShaderStage; - uint32_t maxStorageBuffersPerShaderStage; - uint32_t maxStorageTexturesPerShaderStage; - uint32_t maxUniformBuffersPerShaderStage; - uint64_t maxUniformBufferBindingSize; - uint64_t maxStorageBufferBindingSize; - uint32_t minUniformBufferOffsetAlignment; - uint32_t minStorageBufferOffsetAlignment; - uint32_t maxVertexBuffers; - uint64_t maxBufferSize; - uint32_t maxVertexAttributes; - uint32_t maxVertexBufferArrayStride; - uint32_t maxInterStageShaderComponents; - uint32_t maxInterStageShaderVariables; - uint32_t maxColorAttachments; - uint32_t maxColorAttachmentBytesPerSample; - uint32_t maxComputeWorkgroupStorageSize; - uint32_t maxComputeInvocationsPerWorkgroup; - uint32_t maxComputeWorkgroupSizeX; - uint32_t maxComputeWorkgroupSizeY; - uint32_t maxComputeWorkgroupSizeZ; - uint32_t maxComputeWorkgroupsPerDimension; -} WGPULimits WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUMultisampleState { - WGPUChainedStruct const * nextInChain; - uint32_t count; - uint32_t mask; - WGPUBool alphaToCoverageEnabled; -} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUOrigin3D { - uint32_t x; - uint32_t y; - uint32_t z; -} WGPUOrigin3D WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUPipelineLayoutDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t bindGroupLayoutCount; - WGPUBindGroupLayout const * bindGroupLayouts; -} WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUPrimitiveState -typedef struct WGPUPrimitiveDepthClipControl { - WGPUChainedStruct chain; - WGPUBool unclippedDepth; -} WGPUPrimitiveDepthClipControl WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUPrimitiveState { - WGPUChainedStruct const * nextInChain; - WGPUPrimitiveTopology topology; - WGPUIndexFormat stripIndexFormat; - WGPUFrontFace frontFace; - WGPUCullMode cullMode; -} WGPUPrimitiveState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUQuerySetDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUQueryType type; - uint32_t count; -} WGPUQuerySetDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUQueueDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPUQueueDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderBundleDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPURenderBundleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderBundleEncoderDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t colorFormatCount; - WGPUTextureFormat const * colorFormats; - WGPUTextureFormat depthStencilFormat; - uint32_t sampleCount; - WGPUBool depthReadOnly; - WGPUBool stencilReadOnly; -} WGPURenderBundleEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPassDepthStencilAttachment { - WGPUTextureView view; - WGPULoadOp depthLoadOp; - WGPUStoreOp depthStoreOp; - float depthClearValue; - WGPUBool depthReadOnly; - WGPULoadOp stencilLoadOp; - WGPUStoreOp stencilStoreOp; - uint32_t stencilClearValue; - WGPUBool stencilReadOnly; -} WGPURenderPassDepthStencilAttachment WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPURenderPassDescriptor -typedef struct WGPURenderPassDescriptorMaxDrawCount { - WGPUChainedStruct chain; - uint64_t maxDrawCount; -} WGPURenderPassDescriptorMaxDrawCount WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPassTimestampWrites { - WGPUQuerySet querySet; - uint32_t beginningOfPassWriteIndex; - uint32_t endOfPassWriteIndex; -} WGPURenderPassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURequestAdapterOptions { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE WGPUSurface compatibleSurface; - WGPUPowerPreference powerPreference; - WGPUBackendType backendType; - WGPUBool forceFallbackAdapter; -} WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSamplerBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUSamplerBindingType type; -} WGPUSamplerBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSamplerDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUAddressMode addressModeU; - WGPUAddressMode addressModeV; - WGPUAddressMode addressModeW; - WGPUFilterMode magFilter; - WGPUFilterMode minFilter; - WGPUMipmapFilterMode mipmapFilter; - float lodMinClamp; - float lodMaxClamp; - WGPUCompareFunction compare; - uint16_t maxAnisotropy; -} WGPUSamplerDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUShaderModuleCompilationHint { - WGPUChainedStruct const * nextInChain; - char const * entryPoint; - WGPUPipelineLayout layout; -} WGPUShaderModuleCompilationHint WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUShaderModuleDescriptor -typedef struct WGPUShaderModuleSPIRVDescriptor { - WGPUChainedStruct chain; - uint32_t codeSize; - uint32_t const * code; -} WGPUShaderModuleSPIRVDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUShaderModuleDescriptor -typedef struct WGPUShaderModuleWGSLDescriptor { - WGPUChainedStruct chain; - char const * code; -} WGPUShaderModuleWGSLDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUStencilFaceState { - WGPUCompareFunction compare; - WGPUStencilOperation failOp; - WGPUStencilOperation depthFailOp; - WGPUStencilOperation passOp; -} WGPUStencilFaceState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUStorageTextureBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUStorageTextureAccess access; - WGPUTextureFormat format; - WGPUTextureViewDimension viewDimension; -} WGPUStorageTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceCapabilities { - WGPUChainedStructOut * nextInChain; - size_t formatCount; - WGPUTextureFormat * formats; - size_t presentModeCount; - WGPUPresentMode * presentModes; - size_t alphaModeCount; - WGPUCompositeAlphaMode * alphaModes; -} WGPUSurfaceCapabilities WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceConfiguration { - WGPUChainedStruct const * nextInChain; - WGPUDevice device; - WGPUTextureFormat format; - WGPUTextureUsageFlags usage; - size_t viewFormatCount; - WGPUTextureFormat const * viewFormats; - WGPUCompositeAlphaMode alphaMode; - uint32_t width; - uint32_t height; - WGPUPresentMode presentMode; -} WGPUSurfaceConfiguration WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPUSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromAndroidNativeWindow { - WGPUChainedStruct chain; - void * window; -} WGPUSurfaceDescriptorFromAndroidNativeWindow WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromCanvasHTMLSelector { - WGPUChainedStruct chain; - char const * selector; -} WGPUSurfaceDescriptorFromCanvasHTMLSelector WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromMetalLayer { - WGPUChainedStruct chain; - void * layer; -} WGPUSurfaceDescriptorFromMetalLayer WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromWaylandSurface { - WGPUChainedStruct chain; - void * display; - void * surface; -} WGPUSurfaceDescriptorFromWaylandSurface WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromWindowsHWND { - WGPUChainedStruct chain; - void * hinstance; - void * hwnd; -} WGPUSurfaceDescriptorFromWindowsHWND WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromXcbWindow { - WGPUChainedStruct chain; - void * connection; - uint32_t window; -} WGPUSurfaceDescriptorFromXcbWindow WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromXlibWindow { - WGPUChainedStruct chain; - void * display; - uint64_t window; -} WGPUSurfaceDescriptorFromXlibWindow WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceTexture { - WGPUTexture texture; - WGPUBool suboptimal; - WGPUSurfaceGetCurrentTextureStatus status; -} WGPUSurfaceTexture WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUTextureBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUTextureSampleType sampleType; - WGPUTextureViewDimension viewDimension; - WGPUBool multisampled; -} WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUTextureDataLayout { - WGPUChainedStruct const * nextInChain; - uint64_t offset; - uint32_t bytesPerRow; - uint32_t rowsPerImage; -} WGPUTextureDataLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUTextureViewDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUTextureFormat format; - WGPUTextureViewDimension dimension; - uint32_t baseMipLevel; - uint32_t mipLevelCount; - uint32_t baseArrayLayer; - uint32_t arrayLayerCount; - WGPUTextureAspect aspect; -} WGPUTextureViewDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUVertexAttribute { - WGPUVertexFormat format; - uint64_t offset; - uint32_t shaderLocation; -} WGPUVertexAttribute WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBindGroupDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUBindGroupLayout layout; - size_t entryCount; - WGPUBindGroupEntry const * entries; -} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBindGroupLayoutEntry { - WGPUChainedStruct const * nextInChain; - uint32_t binding; - WGPUShaderStageFlags visibility; - WGPUBufferBindingLayout buffer; - WGPUSamplerBindingLayout sampler; - WGPUTextureBindingLayout texture; - WGPUStorageTextureBindingLayout storageTexture; -} WGPUBindGroupLayoutEntry WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBlendState { - WGPUBlendComponent color; - WGPUBlendComponent alpha; -} WGPUBlendState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCompilationInfo { - WGPUChainedStruct const * nextInChain; - size_t messageCount; - WGPUCompilationMessage const * messages; -} WGPUCompilationInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUComputePassDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPU_NULLABLE WGPUComputePassTimestampWrites const * timestampWrites; -} WGPUComputePassDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUDepthStencilState { - WGPUChainedStruct const * nextInChain; - WGPUTextureFormat format; - WGPUBool depthWriteEnabled; - WGPUCompareFunction depthCompare; - WGPUStencilFaceState stencilFront; - WGPUStencilFaceState stencilBack; - uint32_t stencilReadMask; - uint32_t stencilWriteMask; - int32_t depthBias; - float depthBiasSlopeScale; - float depthBiasClamp; -} WGPUDepthStencilState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUImageCopyBuffer { - WGPUChainedStruct const * nextInChain; - WGPUTextureDataLayout layout; - WGPUBuffer buffer; -} WGPUImageCopyBuffer WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUImageCopyTexture { - WGPUChainedStruct const * nextInChain; - WGPUTexture texture; - uint32_t mipLevel; - WGPUOrigin3D origin; - WGPUTextureAspect aspect; -} WGPUImageCopyTexture WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUProgrammableStageDescriptor { - WGPUChainedStruct const * nextInChain; - WGPUShaderModule module; - WGPU_NULLABLE char const * entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; -} WGPUProgrammableStageDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPassColorAttachment { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE WGPUTextureView view; - WGPU_NULLABLE WGPUTextureView resolveTarget; - WGPULoadOp loadOp; - WGPUStoreOp storeOp; - WGPUColor clearValue; -} WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURequiredLimits { - WGPUChainedStruct const * nextInChain; - WGPULimits limits; -} WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUShaderModuleDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t hintCount; - WGPUShaderModuleCompilationHint const * hints; -} WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSupportedLimits { - WGPUChainedStructOut * nextInChain; - WGPULimits limits; -} WGPUSupportedLimits WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUTextureDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUTextureUsageFlags usage; - WGPUTextureDimension dimension; - WGPUExtent3D size; - WGPUTextureFormat format; - uint32_t mipLevelCount; - uint32_t sampleCount; - size_t viewFormatCount; - WGPUTextureFormat const * viewFormats; -} WGPUTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUVertexBufferLayout { - uint64_t arrayStride; - WGPUVertexStepMode stepMode; - size_t attributeCount; - WGPUVertexAttribute const * attributes; -} WGPUVertexBufferLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBindGroupLayoutDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t entryCount; - WGPUBindGroupLayoutEntry const * entries; -} WGPUBindGroupLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUColorTargetState { - WGPUChainedStruct const * nextInChain; - WGPUTextureFormat format; - WGPU_NULLABLE WGPUBlendState const * blend; - WGPUColorWriteMaskFlags writeMask; -} WGPUColorTargetState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUComputePipelineDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPU_NULLABLE WGPUPipelineLayout layout; - WGPUProgrammableStageDescriptor compute; -} WGPUComputePipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUDeviceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t requiredFeatureCount; - WGPUFeatureName const * requiredFeatures; - WGPU_NULLABLE WGPURequiredLimits const * requiredLimits; - WGPUQueueDescriptor defaultQueue; - WGPUDeviceLostCallback deviceLostCallback; - void * deviceLostUserdata; -} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPassDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t colorAttachmentCount; - WGPURenderPassColorAttachment const * colorAttachments; - WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; - WGPU_NULLABLE WGPUQuerySet occlusionQuerySet; - WGPU_NULLABLE WGPURenderPassTimestampWrites const * timestampWrites; -} WGPURenderPassDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUVertexState { - WGPUChainedStruct const * nextInChain; - WGPUShaderModule module; - WGPU_NULLABLE char const * entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; - size_t bufferCount; - WGPUVertexBufferLayout const * buffers; -} WGPUVertexState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUFragmentState { - WGPUChainedStruct const * nextInChain; - WGPUShaderModule module; - WGPU_NULLABLE char const * entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; - size_t targetCount; - WGPUColorTargetState const * targets; -} WGPUFragmentState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPipelineDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPU_NULLABLE WGPUPipelineLayout layout; - WGPUVertexState vertex; - WGPUPrimitiveState primitive; - WGPU_NULLABLE WGPUDepthStencilState const * depthStencil; - WGPUMultisampleState multisample; - WGPU_NULLABLE WGPUFragmentState const * fragment; -} WGPURenderPipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(WGPU_SKIP_PROCS) - -typedef WGPUInstance (*WGPUProcCreateInstance)(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Adapter -typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter adapter, WGPUAdapterProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterRequestDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterReference)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of BindGroup -typedef void (*WGPUProcBindGroupSetLabel)(WGPUBindGroup bindGroup, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupReference)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of BindGroupLayout -typedef void (*WGPUProcBindGroupLayoutSetLabel)(WGPUBindGroupLayout bindGroupLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupLayoutReference)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Buffer -typedef void (*WGPUProcBufferDestroy)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void const * (*WGPUProcBufferGetConstMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBufferMapState (*WGPUProcBufferGetMapState)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void * (*WGPUProcBufferGetMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef uint64_t (*WGPUProcBufferGetSize)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBufferUsageFlags (*WGPUProcBufferGetUsage)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferMapAsync)(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer buffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferUnmap)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferReference)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferRelease)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of CommandBuffer -typedef void (*WGPUProcCommandBufferSetLabel)(WGPUCommandBuffer commandBuffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandBufferReference)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of CommandEncoder -typedef WGPUComputePassEncoder (*WGPUProcCommandEncoderBeginComputePass)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderPassEncoder (*WGPUProcCommandEncoderBeginRenderPass)(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderClearBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder commandEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder commandEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderSetLabel)(WGPUCommandEncoder commandEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderReference)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderRelease)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of ComputePassEncoder -typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderInsertDebugMarker)(WGPUComputePassEncoder computePassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderSetLabel)(WGPUComputePassEncoder computePassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderReference)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderRelease)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of ComputePipeline -typedef WGPUBindGroupLayout (*WGPUProcComputePipelineGetBindGroupLayout)(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePipelineSetLabel)(WGPUComputePipeline computePipeline, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePipelineReference)(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePipelineRelease)(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Device -typedef WGPUBindGroup (*WGPUProcDeviceCreateBindGroup)(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBindGroupLayout (*WGPUProcDeviceCreateBindGroupLayout)(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBuffer (*WGPUProcDeviceCreateBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUCommandEncoder (*WGPUProcDeviceCreateCommandEncoder)(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUComputePipeline (*WGPUProcDeviceCreateComputePipeline)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceCreateComputePipelineAsync)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUPipelineLayout (*WGPUProcDeviceCreatePipelineLayout)(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQuerySet (*WGPUProcDeviceCreateQuerySet)(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderBundleEncoder (*WGPUProcDeviceCreateRenderBundleEncoder)(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceCreateRenderPipelineAsync)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSampler (*WGPUProcDeviceCreateSampler)(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTexture (*WGPUProcDeviceCreateTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceDestroy)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef size_t (*WGPUProcDeviceEnumerateFeatures)(WGPUDevice device, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceReference)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Instance -typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcInstanceRequestAdapter)(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcInstanceReference)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of PipelineLayout -typedef void (*WGPUProcPipelineLayoutSetLabel)(WGPUPipelineLayout pipelineLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcPipelineLayoutReference)(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcPipelineLayoutRelease)(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of QuerySet -typedef void (*WGPUProcQuerySetDestroy)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -typedef uint32_t (*WGPUProcQuerySetGetCount)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQueryType (*WGPUProcQuerySetGetType)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQuerySetSetLabel)(WGPUQuerySet querySet, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQuerySetReference)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQuerySetRelease)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Queue -typedef void (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueSetLabel)(WGPUQueue queue, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueSubmit)(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueReference)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueRelease)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderBundle -typedef void (*WGPUProcRenderBundleSetLabel)(WGPURenderBundle renderBundle, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleReference)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderBundleEncoder -typedef void (*WGPUProcRenderBundleEncoderDraw)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderDrawIndexed)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderDrawIndexedIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderDrawIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderInsertDebugMarker)(WGPURenderBundleEncoder renderBundleEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderPopDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderPushDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetLabel)(WGPURenderBundleEncoder renderBundleEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderReference)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderRelease)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderPassEncoder -typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDraw)(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDrawIndexed)(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderEnd)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderEndOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderExecuteBundles)(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderInsertDebugMarker)(WGPURenderPassEncoder renderPassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderPopDebugGroup)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderPushDebugGroup)(WGPURenderPassEncoder renderPassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetBindGroup)(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetBlendConstant)(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetIndexBuffer)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetLabel)(WGPURenderPassEncoder renderPassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetPipeline)(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderReference)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderRelease)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderPipeline -typedef WGPUBindGroupLayout (*WGPUProcRenderPipelineGetBindGroupLayout)(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline renderPipeline, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPipelineReference)(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPipelineRelease)(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Sampler -typedef void (*WGPUProcSamplerSetLabel)(WGPUSampler sampler, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSamplerReference)(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSamplerRelease)(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of ShaderModule -typedef void (*WGPUProcShaderModuleGetCompilationInfo)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcShaderModuleReference)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Surface -typedef void (*WGPUProcSurfaceConfigure)(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceGetCapabilities)(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceGetCurrentTexture)(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfacePresent)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceUnconfigure)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of SurfaceCapabilities -typedef void (*WGPUProcSurfaceCapabilitiesFreeMembers)(WGPUSurfaceCapabilities capabilities) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Texture -typedef WGPUTextureView (*WGPUProcTextureCreateView)(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcTextureDestroy)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef uint32_t (*WGPUProcTextureGetDepthOrArrayLayers)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureDimension (*WGPUProcTextureGetDimension)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureFormat (*WGPUProcTextureGetFormat)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef uint32_t (*WGPUProcTextureGetHeight)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef uint32_t (*WGPUProcTextureGetMipLevelCount)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef uint32_t (*WGPUProcTextureGetSampleCount)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureUsageFlags (*WGPUProcTextureGetUsage)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef uint32_t (*WGPUProcTextureGetWidth)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcTextureSetLabel)(WGPUTexture texture, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcTextureReference)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcTextureRelease)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of TextureView -typedef void (*WGPUProcTextureViewSetLabel)(WGPUTextureView textureView, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcTextureViewReference)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; - -#endif // !defined(WGPU_SKIP_PROCS) - -#if !defined(WGPU_SKIP_DECLARATIONS) - -WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Adapter -WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of BindGroup -WGPU_EXPORT void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupReference(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupRelease(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of BindGroupLayout -WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Buffer -WGPU_EXPORT void wgpuBufferDestroy(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void const * wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void * wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint64_t wgpuBufferGetSize(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBufferUsageFlags wgpuBufferGetUsage(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferSetLabel(WGPUBuffer buffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferUnmap(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferReference(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferRelease(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of CommandBuffer -WGPU_EXPORT void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of CommandEncoder -WGPU_EXPORT WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of ComputePassEncoder -WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of ComputePipeline -WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePipelineReference(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Device -WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Instance -WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceProcessEvents(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceRequestAdapter(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of PipelineLayout -WGPU_EXPORT void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of QuerySet -WGPU_EXPORT void wgpuQuerySetDestroy(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQuerySetSetLabel(WGPUQuerySet querySet, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQuerySetReference(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQuerySetRelease(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Queue -WGPU_EXPORT void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueSetLabel(WGPUQueue queue, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueWriteTexture(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueReference(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueRelease(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderBundle -WGPU_EXPORT void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleReference(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderBundleEncoder -WGPU_EXPORT void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderPassEncoder -WGPU_EXPORT void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderPipeline -WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Sampler -WGPU_EXPORT void wgpuSamplerSetLabel(WGPUSampler sampler, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSamplerReference(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSamplerRelease(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of ShaderModule -WGPU_EXPORT void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuShaderModuleReference(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Surface -WGPU_EXPORT void wgpuSurfaceConfigure(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfacePresent(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceUnconfigure(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of SurfaceCapabilities -WGPU_EXPORT void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities capabilities) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Texture -WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuTextureGetHeight(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureUsageFlags wgpuTextureGetUsage(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuTextureGetWidth(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuTextureSetLabel(WGPUTexture texture, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuTextureReference(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuTextureRelease(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of TextureView -WGPU_EXPORT void wgpuTextureViewSetLabel(WGPUTextureView textureView, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuTextureViewReference(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuTextureViewRelease(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; - -#endif // !defined(WGPU_SKIP_DECLARATIONS) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBGPU_H_ diff --git a/wgpu-natives/src/main/c/wgpu.h b/wgpu-natives/src/main/c/wgpu.h deleted file mode 100644 index ce9c7589c..000000000 --- a/wgpu-natives/src/main/c/wgpu.h +++ /dev/null @@ -1,265 +0,0 @@ -#ifndef WGPU_H_ -#define WGPU_H_ - -#include "webgpu.h" - -typedef enum WGPUNativeSType { - // Start at 0003 since that's allocated range for wgpu-native - WGPUSType_DeviceExtras = 0x00030001, - WGPUSType_RequiredLimitsExtras = 0x00030002, - WGPUSType_PipelineLayoutExtras = 0x00030003, - WGPUSType_ShaderModuleGLSLDescriptor = 0x00030004, - WGPUSType_SupportedLimitsExtras = 0x00030005, - WGPUSType_InstanceExtras = 0x00030006, - WGPUSType_BindGroupEntryExtras = 0x00030007, - WGPUSType_BindGroupLayoutEntryExtras = 0x00030008, - WGPUSType_QuerySetDescriptorExtras = 0x00030009, - WGPUSType_SurfaceConfigurationExtras = 0x0003000A, - WGPUNativeSType_Force32 = 0x7FFFFFFF -} WGPUNativeSType; - -typedef enum WGPUNativeFeature { - WGPUNativeFeature_PushConstants = 0x00030001, - WGPUNativeFeature_TextureAdapterSpecificFormatFeatures = 0x00030002, - WGPUNativeFeature_MultiDrawIndirect = 0x00030003, - WGPUNativeFeature_MultiDrawIndirectCount = 0x00030004, - WGPUNativeFeature_VertexWritableStorage = 0x00030005, - WGPUNativeFeature_TextureBindingArray = 0x00030006, - WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing = 0x00030007, - WGPUNativeFeature_PipelineStatisticsQuery = 0x00030008, - WGPUNativeFeature_StorageResourceBindingArray = 0x00030009, - WGPUNativeFeature_PartiallyBoundBindingArray = 0x0003000A, - WGPUNativeFeature_Force32 = 0x7FFFFFFF -} WGPUNativeFeature; - -typedef enum WGPULogLevel { - WGPULogLevel_Off = 0x00000000, - WGPULogLevel_Error = 0x00000001, - WGPULogLevel_Warn = 0x00000002, - WGPULogLevel_Info = 0x00000003, - WGPULogLevel_Debug = 0x00000004, - WGPULogLevel_Trace = 0x00000005, - WGPULogLevel_Force32 = 0x7FFFFFFF -} WGPULogLevel; - -typedef enum WGPUInstanceBackend { - WGPUInstanceBackend_All = 0x00000000, - WGPUInstanceBackend_Vulkan = 1 << 0, - WGPUInstanceBackend_GL = 1 << 1, - WGPUInstanceBackend_Metal = 1 << 2, - WGPUInstanceBackend_DX12 = 1 << 3, - WGPUInstanceBackend_DX11 = 1 << 4, - WGPUInstanceBackend_BrowserWebGPU = 1 << 5, - WGPUInstanceBackend_Primary = WGPUInstanceBackend_Vulkan | WGPUInstanceBackend_Metal | - WGPUInstanceBackend_DX12 | - WGPUInstanceBackend_BrowserWebGPU, - WGPUInstanceBackend_Secondary = WGPUInstanceBackend_GL | WGPUInstanceBackend_DX11, - WGPUInstanceBackend_Force32 = 0x7FFFFFFF -} WGPUInstanceBackend; -typedef WGPUFlags WGPUInstanceBackendFlags; - -typedef enum WGPUInstanceFlag { - WGPUInstanceFlag_Default = 0x00000000, - WGPUInstanceFlag_Debug = 1 << 0, - WGPUInstanceFlag_Validation = 1 << 1, - WGPUInstanceFlag_DiscardHalLabels = 1 << 2, - WGPUInstanceFlag_Force32 = 0x7FFFFFFF -} WGPUInstanceFlag; -typedef WGPUFlags WGPUInstanceFlags; - -typedef enum WGPUDx12Compiler { - WGPUDx12Compiler_Undefined = 0x00000000, - WGPUDx12Compiler_Fxc = 0x00000001, - WGPUDx12Compiler_Dxc = 0x00000002, - WGPUDx12Compiler_Force32 = 0x7FFFFFFF -} WGPUDx12Compiler; - -typedef enum WGPUGles3MinorVersion { - WGPUGles3MinorVersion_Automatic = 0x00000000, - WGPUGles3MinorVersion_Version0 = 0x00000001, - WGPUGles3MinorVersion_Version1 = 0x00000002, - WGPUGles3MinorVersion_Version2 = 0x00000003, - WGPUGles3MinorVersion_Force32 = 0x7FFFFFFF -} WGPUGles3MinorVersion; - -typedef enum WGPUPipelineStatisticName { - WGPUPipelineStatisticName_VertexShaderInvocations = 0x00000000, - WGPUPipelineStatisticName_ClipperInvocations = 0x00000001, - WGPUPipelineStatisticName_ClipperPrimitivesOut = 0x00000002, - WGPUPipelineStatisticName_FragmentShaderInvocations = 0x00000003, - WGPUPipelineStatisticName_ComputeShaderInvocations = 0x00000004, - WGPUPipelineStatisticName_Force32 = 0x7FFFFFFF -} WGPUPipelineStatisticName WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUNativeQueryType { - WGPUNativeQueryType_PipelineStatistics = 0x00030000, - WGPUNativeQueryType_Force32 = 0x7FFFFFFF -} WGPUNativeQueryType WGPU_ENUM_ATTRIBUTE; - -typedef struct WGPUInstanceExtras { - WGPUChainedStruct chain; - WGPUInstanceBackendFlags backends; - WGPUInstanceFlags flags; - WGPUDx12Compiler dx12ShaderCompiler; - WGPUGles3MinorVersion gles3MinorVersion; - const char * dxilPath; - const char * dxcPath; -} WGPUInstanceExtras; - -typedef struct WGPUDeviceExtras { - WGPUChainedStruct chain; - const char * tracePath; -} WGPUDeviceExtras; - -typedef struct WGPUNativeLimits { - uint32_t maxPushConstantSize; - uint32_t maxNonSamplerBindings; -} WGPUNativeLimits; - -typedef struct WGPURequiredLimitsExtras { - WGPUChainedStruct chain; - WGPUNativeLimits limits; -} WGPURequiredLimitsExtras; - -typedef struct WGPUSupportedLimitsExtras { - WGPUChainedStructOut chain; - WGPUNativeLimits limits; -} WGPUSupportedLimitsExtras; - -typedef struct WGPUPushConstantRange { - WGPUShaderStageFlags stages; - uint32_t start; - uint32_t end; -} WGPUPushConstantRange; - -typedef struct WGPUPipelineLayoutExtras { - WGPUChainedStruct chain; - size_t pushConstantRangeCount; - WGPUPushConstantRange const * pushConstantRanges; -} WGPUPipelineLayoutExtras; - -typedef uint64_t WGPUSubmissionIndex; - -typedef struct WGPUWrappedSubmissionIndex { - WGPUQueue queue; - WGPUSubmissionIndex submissionIndex; -} WGPUWrappedSubmissionIndex; - -typedef struct WGPUShaderDefine { - char const * name; - char const * value; -} WGPUShaderDefine; - -typedef struct WGPUShaderModuleGLSLDescriptor { - WGPUChainedStruct chain; - WGPUShaderStage stage; - char const * code; - uint32_t defineCount; - WGPUShaderDefine * defines; -} WGPUShaderModuleGLSLDescriptor; - -typedef struct WGPURegistryReport { - size_t numAllocated; - size_t numKeptFromUser; - size_t numReleasedFromUser; - size_t numError; - size_t elementSize; -} WGPURegistryReport; - -typedef struct WGPUHubReport { - WGPURegistryReport adapters; - WGPURegistryReport devices; - WGPURegistryReport queues; - WGPURegistryReport pipelineLayouts; - WGPURegistryReport shaderModules; - WGPURegistryReport bindGroupLayouts; - WGPURegistryReport bindGroups; - WGPURegistryReport commandBuffers; - WGPURegistryReport renderBundles; - WGPURegistryReport renderPipelines; - WGPURegistryReport computePipelines; - WGPURegistryReport querySets; - WGPURegistryReport buffers; - WGPURegistryReport textures; - WGPURegistryReport textureViews; - WGPURegistryReport samplers; -} WGPUHubReport; - -typedef struct WGPUGlobalReport { - WGPURegistryReport surfaces; - WGPUBackendType backendType; - WGPUHubReport vulkan; - WGPUHubReport metal; - WGPUHubReport dx12; - WGPUHubReport gl; -} WGPUGlobalReport; - -typedef struct WGPUInstanceEnumerateAdapterOptions { - WGPUChainedStruct const * nextInChain; - WGPUInstanceBackendFlags backends; -} WGPUInstanceEnumerateAdapterOptions; - -typedef struct WGPUBindGroupEntryExtras { - WGPUChainedStruct chain; - WGPUBuffer const * buffers; - size_t bufferCount; - WGPUSampler const * samplers; - size_t samplerCount; - WGPUTextureView const * textureViews; - size_t textureViewCount; -} WGPUBindGroupEntryExtras; - -typedef struct WGPUBindGroupLayoutEntryExtras { - WGPUChainedStruct chain; - uint32_t count; -} WGPUBindGroupLayoutEntryExtras; - -typedef struct WGPUQuerySetDescriptorExtras { - WGPUChainedStruct chain; - WGPUPipelineStatisticName const * pipelineStatistics; - size_t pipelineStatisticCount; -} WGPUQuerySetDescriptorExtras WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceConfigurationExtras { - WGPUChainedStruct chain; - WGPUBool desiredMaximumFrameLatency; -} WGPUSurfaceConfigurationExtras WGPU_STRUCTURE_ATTRIBUTE; - -typedef void (*WGPULogCallback)(WGPULogLevel level, char const * message, void * userdata); - -#ifdef __cplusplus -extern "C" { -#endif - -void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport * report); -size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, WGPU_NULLABLE WGPUInstanceEnumerateAdapterOptions const * options, WGPUAdapter * adapters); - -WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands); - -// Returns true if the queue is empty, or false if there are more queue submissions still in flight. -WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, WGPU_NULLABLE WGPUWrappedSubmissionIndex const * wrappedSubmissionIndex); - -void wgpuSetLogCallback(WGPULogCallback callback, void * userdata); - -void wgpuSetLogLevel(WGPULogLevel level); - -uint32_t wgpuGetVersion(void); - -void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void const * data); - -void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count); -void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count); - -void wgpuRenderPassEncoderMultiDrawIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count); -void wgpuRenderPassEncoderMultiDrawIndexedIndirectCount(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, WGPUBuffer count_buffer, uint64_t count_buffer_offset, uint32_t max_count); - -void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -void wgpuComputePassEncoderEndPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder); -void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -void wgpuRenderPassEncoderEndPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/wgpu-natives/src/main/resources/libwgpu_native.dylib b/wgpu-natives/src/main/resources/libwgpu_native.dylib deleted file mode 100644 index c6fe48c11..000000000 Binary files a/wgpu-natives/src/main/resources/libwgpu_native.dylib and /dev/null differ diff --git a/wgpu-natives/src/main/resources/libwgpu_native.so b/wgpu-natives/src/main/resources/libwgpu_native.so deleted file mode 100644 index 49a057d15..000000000 Binary files a/wgpu-natives/src/main/resources/libwgpu_native.so and /dev/null differ diff --git a/wgpu-natives/src/main/resources/libwgpu_native_aarch64.dylib b/wgpu-natives/src/main/resources/libwgpu_native_aarch64.dylib deleted file mode 100644 index 04b8ac183..000000000 Binary files a/wgpu-natives/src/main/resources/libwgpu_native_aarch64.dylib and /dev/null differ diff --git a/wgpu-natives/src/main/resources/wgpu_native.dll b/wgpu-natives/src/main/resources/wgpu_native.dll deleted file mode 100644 index 650260bfc..000000000 Binary files a/wgpu-natives/src/main/resources/wgpu_native.dll and /dev/null differ