From 039ac93bebcf7f51e23c70094415f9a5c936bacd Mon Sep 17 00:00:00 2001 From: Bahaa Zaid Date: Thu, 9 Apr 2026 10:54:15 +0200 Subject: [PATCH 1/5] Update wgpu-native to v27.0.4.1 --- pom.xml | 2 +- wgpu-native/wgpu-native-ffm/pom.xml | 2 +- wgpu-native/wgpu-native-macos-aarch64/pom.xml | 2 +- wgpu-native/wgpu-native-windows-amd64/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 30b02cd..4453ebe 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ UTF-8 - v27.0.4.0 + v27.0.4.1 4.4.0 1.0.0 diff --git a/wgpu-native/wgpu-native-ffm/pom.xml b/wgpu-native/wgpu-native-ffm/pom.xml index ad7ad6d..ea51aad 100644 --- a/wgpu-native/wgpu-native-ffm/pom.xml +++ b/wgpu-native/wgpu-native-ffm/pom.xml @@ -55,7 +55,7 @@ ${wgpu.native.download.base.url}/wgpu-macos-aarch64-release.zip include/** ${project.build.directory}/ - 15367c26fdbe6892db35007d39f3883593384e777360b70e6bd704cb5dedde53 + sha256:214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 diff --git a/wgpu-native/wgpu-native-macos-aarch64/pom.xml b/wgpu-native/wgpu-native-macos-aarch64/pom.xml index ff85e15..2352256 100644 --- a/wgpu-native/wgpu-native-macos-aarch64/pom.xml +++ b/wgpu-native/wgpu-native-macos-aarch64/pom.xml @@ -39,7 +39,7 @@ ${wgpu.native.download.base.url}/wgpu-macos-aarch64-release.zip lib/libwgpu_native.dylib ${project.build.directory}/classes/foreign/macos-aarch64 - 15367c26fdbe6892db35007d39f3883593384e777360b70e6bd704cb5dedde53 + sha256:214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 diff --git a/wgpu-native/wgpu-native-windows-amd64/pom.xml b/wgpu-native/wgpu-native-windows-amd64/pom.xml index 5928ac9..a02d379 100644 --- a/wgpu-native/wgpu-native-windows-amd64/pom.xml +++ b/wgpu-native/wgpu-native-windows-amd64/pom.xml @@ -39,7 +39,7 @@ ${wgpu.native.download.base.url}/wgpu-windows-x86_64-msvc-release.zip lib/wgpu_native.dll ${project.build.directory}/classes/foreign/windows-amd64 - f14ca334b4d253881bde2605bd147f332178d705f56fbd74f81458797c77fce1 + sha256:cbb15ac6499476bd555190922142a466ba91ec9032cc6bef5e59063e829425ea From d51910968957d24d7fc144785ff774d4121389fc Mon Sep 17 00:00:00 2001 From: Bahaa Zaid Date: Thu, 9 Apr 2026 11:17:54 +0200 Subject: [PATCH 2/5] Fix SHA string --- wgpu-native/wgpu-native-ffm/pom.xml | 2 +- wgpu-native/wgpu-native-macos-aarch64/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpu-native/wgpu-native-ffm/pom.xml b/wgpu-native/wgpu-native-ffm/pom.xml index ea51aad..4b9fa3d 100644 --- a/wgpu-native/wgpu-native-ffm/pom.xml +++ b/wgpu-native/wgpu-native-ffm/pom.xml @@ -55,7 +55,7 @@ ${wgpu.native.download.base.url}/wgpu-macos-aarch64-release.zip include/** ${project.build.directory}/ - sha256:214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 + 214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 diff --git a/wgpu-native/wgpu-native-macos-aarch64/pom.xml b/wgpu-native/wgpu-native-macos-aarch64/pom.xml index 2352256..6018075 100644 --- a/wgpu-native/wgpu-native-macos-aarch64/pom.xml +++ b/wgpu-native/wgpu-native-macos-aarch64/pom.xml @@ -39,7 +39,7 @@ ${wgpu.native.download.base.url}/wgpu-macos-aarch64-release.zip lib/libwgpu_native.dylib ${project.build.directory}/classes/foreign/macos-aarch64 - sha256:214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 + 214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 From 141703e0f7b7c5f32f855d936f94534df98cb20d Mon Sep 17 00:00:00 2001 From: Bahaa Zaid Date: Thu, 9 Apr 2026 11:31:41 +0200 Subject: [PATCH 3/5] Fix SHA string --- wgpu-native/wgpu-native-windows-amd64/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-native/wgpu-native-windows-amd64/pom.xml b/wgpu-native/wgpu-native-windows-amd64/pom.xml index a02d379..abe1bfa 100644 --- a/wgpu-native/wgpu-native-windows-amd64/pom.xml +++ b/wgpu-native/wgpu-native-windows-amd64/pom.xml @@ -39,7 +39,7 @@ ${wgpu.native.download.base.url}/wgpu-windows-x86_64-msvc-release.zip lib/wgpu_native.dll ${project.build.directory}/classes/foreign/windows-amd64 - sha256:cbb15ac6499476bd555190922142a466ba91ec9032cc6bef5e59063e829425ea + cbb15ac6499476bd555190922142a466ba91ec9032cc6bef5e59063e829425ea From 1450a898fa0b25c4bddade56e398a3c1516a819c Mon Sep 17 00:00:00 2001 From: Bahaa Zaid Date: Wed, 27 May 2026 18:01:30 +0300 Subject: [PATCH 4/5] Upgrade to wgpu-native 29 --- pom.xml | 2 +- .../bahaa/webgpu/samples/ComputeBoids.java | 3 +- .../bahaa/webgpu/samples/GameOfLife.java | 2 +- .../model/ComputePassDescriptorBlueprint.java | 2 +- .../ComputePassTimestampWritesBlueprint.java | 31 ---- .../ComputePipelineDescriptorBlueprint.java | 2 +- ...eprint.java => ComputeStateBlueprint.java} | 12 +- .../model/InstanceCapabilitiesBlueprint.java | 28 ---- .../model/InstanceDescriptorBlueprint.java | 17 ++- .../webgpu/api/model/InstanceFeatureName.java | 18 +++ ...java => PassTimestampWritesBlueprint.java} | 13 +- .../model/RenderPassDescriptorBlueprint.java | 2 +- .../api/model/TextureDescriptorBlueprint.java | 1 + .../bahaa/webgpu/api/model/TextureFormat.java | 138 ++++++------------ .../webgpu/api/model/VertexStepMode.java | 6 +- wgpu-native/wgpu-native-ffm/pom.xml | 2 +- wgpu-native/wgpu-native-macos-aarch64/pom.xml | 2 +- wgpu-native/wgpu-native-windows-amd64/pom.xml | 2 +- 18 files changed, 103 insertions(+), 180 deletions(-) delete mode 100644 webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassTimestampWritesBlueprint.java rename webgpu/src/main/java/io/github/bahaa/webgpu/api/model/{ProgrammableStageDescriptorBlueprint.java => ComputeStateBlueprint.java} (63%) delete mode 100644 webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceCapabilitiesBlueprint.java create mode 100644 webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceFeatureName.java rename webgpu/src/main/java/io/github/bahaa/webgpu/api/model/{RenderPassTimestampWritesBlueprint.java => PassTimestampWritesBlueprint.java} (53%) diff --git a/pom.xml b/pom.xml index 4453ebe..f0bd4a6 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ UTF-8 - v27.0.4.1 + v29.0.0.0 4.4.0 1.0.0 diff --git a/samples/src/main/java/io/github/bahaa/webgpu/samples/ComputeBoids.java b/samples/src/main/java/io/github/bahaa/webgpu/samples/ComputeBoids.java index 15f9947..6825403 100644 --- a/samples/src/main/java/io/github/bahaa/webgpu/samples/ComputeBoids.java +++ b/samples/src/main/java/io/github/bahaa/webgpu/samples/ComputeBoids.java @@ -71,9 +71,10 @@ protected void setup(final Device device, final Queue queue) { .build()); this.computePipeline = device.createComputePipeline(ComputePipelineDescriptor.builder() - .compute(builder -> builder + .compute(ComputeState.builder() .module(loadShader(device, "wgsl/compute-boids-compute.wgsl")) .entryPoint("main") + .build() ) .build()); diff --git a/samples/src/main/java/io/github/bahaa/webgpu/samples/GameOfLife.java b/samples/src/main/java/io/github/bahaa/webgpu/samples/GameOfLife.java index 47f8d1b..fe3532d 100644 --- a/samples/src/main/java/io/github/bahaa/webgpu/samples/GameOfLife.java +++ b/samples/src/main/java/io/github/bahaa/webgpu/samples/GameOfLife.java @@ -158,7 +158,7 @@ protected void setup(final Device device, final Queue queue) { this.computePipeline = device.createComputePipeline(ComputePipelineDescriptor.builder() .label("Simulation pipeline") .layout(pipelineLayout) - .compute(ProgrammableStageDescriptor.builder() + .compute(ComputeState.builder() .module(computeShaderModule) .entryPoint("computeMain") .build()) diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassDescriptorBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassDescriptorBlueprint.java index fc02ebc..8c5ab69 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassDescriptorBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassDescriptorBlueprint.java @@ -12,7 +12,7 @@ interface ComputePassDescriptorBlueprint extends StructBlueprint { Optional label(); - Optional timestampWrites(); + Optional timestampWrites(); @Override default MemorySegment toSegment(final Arena arena) { diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassTimestampWritesBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassTimestampWritesBlueprint.java deleted file mode 100644 index ce6ffe5..0000000 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePassTimestampWritesBlueprint.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.github.bahaa.webgpu.api.model; - -import io.github.bahaa.webgpu.api.QuerySet; -import io.github.bahaa.webgpu.ffm.WGPUComputePassTimestampWrites; -import io.helidon.builder.api.Prototype; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -@Prototype.Blueprint -interface ComputePassTimestampWritesBlueprint extends StructBlueprint { - QuerySet querySet(); - - int beginningOfPassWriteIndex(); - - int endOfPassWriteIndex(); - - @Override - default MemorySegment toSegment(final Arena arena) { - final var struct = WGPUComputePassTimestampWrites.allocate(arena); - updateSegment(arena, struct); - return struct; - } - - @Override - default void updateSegment(final Arena arena, final MemorySegment struct) { - WGPUComputePassTimestampWrites.querySet(struct, this.querySet().pointer()); - WGPUComputePassTimestampWrites.beginningOfPassWriteIndex(struct, this.beginningOfPassWriteIndex()); - WGPUComputePassTimestampWrites.endOfPassWriteIndex(struct, this.endOfPassWriteIndex()); - } -} diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePipelineDescriptorBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePipelineDescriptorBlueprint.java index eb8905b..a6cb2ef 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePipelineDescriptorBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputePipelineDescriptorBlueprint.java @@ -16,7 +16,7 @@ interface ComputePipelineDescriptorBlueprint extends StructBlueprint { Optional layout(); - ProgrammableStageDescriptor compute(); + ComputeStateBlueprint compute(); @Override default MemorySegment toSegment(final Arena arena) { diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ProgrammableStageDescriptorBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputeStateBlueprint.java similarity index 63% rename from webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ProgrammableStageDescriptorBlueprint.java rename to webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputeStateBlueprint.java index 3bd3286..d37bd5d 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ProgrammableStageDescriptorBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/ComputeStateBlueprint.java @@ -1,8 +1,8 @@ package io.github.bahaa.webgpu.api.model; import io.github.bahaa.webgpu.api.ShaderModule; +import io.github.bahaa.webgpu.ffm.WGPUComputeState; import io.github.bahaa.webgpu.ffm.WGPUConstantEntry; -import io.github.bahaa.webgpu.ffm.WGPUProgrammableStageDescriptor; import io.helidon.builder.api.Prototype; import java.lang.foreign.Arena; @@ -11,7 +11,7 @@ import java.util.Optional; @Prototype.Blueprint -interface ProgrammableStageDescriptorBlueprint extends StructBlueprint { +interface ComputeStateBlueprint extends StructBlueprint { ShaderModule module(); @@ -21,19 +21,19 @@ interface ProgrammableStageDescriptorBlueprint extends StructBlueprint { @Override default MemorySegment toSegment(final Arena arena) { - final var struct = WGPUProgrammableStageDescriptor.allocate(arena); + final var struct = WGPUComputeState.allocate(arena); updateSegment(arena, struct); return struct; } @Override default void updateSegment(final Arena arena, final MemorySegment struct) { - WGPUProgrammableStageDescriptor.module(struct, this.module().pointer()); + WGPUComputeState.module(struct, this.module().pointer()); entryPoint().ifPresent(entryPoint -> - WGPUProgrammableStageDescriptor.entryPoint(struct, StringView.from(entryPoint).toSegment(arena))); + WGPUComputeState.entryPoint(struct, StringView.from(entryPoint).toSegment(arena))); - WGPUProgrammableStageDescriptor.constants(struct, + WGPUComputeState.constants(struct, StructBlueprint.structArray(arena, WGPUConstantEntry.layout(), this.constants())); } } diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceCapabilitiesBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceCapabilitiesBlueprint.java deleted file mode 100644 index 3065663..0000000 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceCapabilitiesBlueprint.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.github.bahaa.webgpu.api.model; - -import io.github.bahaa.webgpu.ffm.WGPUInstanceCapabilities; -import io.helidon.builder.api.Prototype; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -@Prototype.Blueprint -interface InstanceCapabilitiesBlueprint extends StructBlueprint { - - boolean timedWaitAnyEnable(); - - int timedWaitAnyMaxCount(); - - @Override - default MemorySegment toSegment(final Arena arena) { - final var struct = WGPUInstanceCapabilities.allocate(arena); - updateSegment(arena, struct); - return struct; - } - - @Override - default void updateSegment(final Arena arena, final MemorySegment struct) { - WGPUInstanceCapabilities.timedWaitAnyEnable(struct, timedWaitAnyEnable() ? 1 : 0); - WGPUInstanceCapabilities.timedWaitAnyMaxCount(struct, timedWaitAnyMaxCount()); - } -} diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceDescriptorBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceDescriptorBlueprint.java index ae7f2c0..b1ac32f 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceDescriptorBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceDescriptorBlueprint.java @@ -6,7 +6,8 @@ import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; -import java.util.Optional; +import java.lang.foreign.ValueLayout; +import java.util.Set; @Prototype.Blueprint interface InstanceDescriptorBlueprint extends StructBlueprint { @@ -14,8 +15,9 @@ interface InstanceDescriptorBlueprint extends StructBlueprint { /** * Instance features to enable */ - @Option.DefaultCode("InstanceCapabilities.builder().build()") - Optional features(); + @Option.Singular("requiredFeature") + @Option.DefaultCode("java.util.EnumSet.noneOf(InstanceFeatureName.class)") + Set requiredFeatures(); @Override default MemorySegment toSegment(final Arena arena) { @@ -26,6 +28,13 @@ default MemorySegment toSegment(final Arena arena) { @Override default void updateSegment(final Arena arena, final MemorySegment struct) { - features().ifPresent(features -> WGPUInstanceDescriptor.features(struct, features.toSegment(arena))); + final var segment = arena.allocate(ValueLayout.JAVA_INT, this.requiredFeatures().size()); + var index = 0; + for (final var feature : this.requiredFeatures()) { + segment.setAtIndex(ValueLayout.JAVA_INT, index, feature.value()); + index++; + } + WGPUInstanceDescriptor.requiredFeatures(struct, segment); + WGPUInstanceDescriptor.requiredFeatureCount(struct, requiredFeatures().size()); } } diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceFeatureName.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceFeatureName.java new file mode 100644 index 0000000..14d3861 --- /dev/null +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/InstanceFeatureName.java @@ -0,0 +1,18 @@ +package io.github.bahaa.webgpu.api.model; + +public enum InstanceFeatureName { + TIMED_WAIT_ANY(0x00000001), + SHADER_SOURCE_SPIRV(0x00000002), + MULTIPLE_DEVICES_PER_ADAPTER(0x00000003); + + private final int value; + + + InstanceFeatureName(final int value) { + this.value = value; + } + + public int value() { + return this.value; + } +} diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassTimestampWritesBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/PassTimestampWritesBlueprint.java similarity index 53% rename from webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassTimestampWritesBlueprint.java rename to webgpu/src/main/java/io/github/bahaa/webgpu/api/model/PassTimestampWritesBlueprint.java index f5dc4a9..9edbc85 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassTimestampWritesBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/PassTimestampWritesBlueprint.java @@ -1,15 +1,14 @@ package io.github.bahaa.webgpu.api.model; import io.github.bahaa.webgpu.api.QuerySet; -import io.github.bahaa.webgpu.ffm.WGPURenderPassTimestampWrites; +import io.github.bahaa.webgpu.ffm.WGPUPassTimestampWrites; import io.helidon.builder.api.Prototype; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; @Prototype.Blueprint -interface RenderPassTimestampWritesBlueprint extends StructBlueprint { - +interface PassTimestampWritesBlueprint extends StructBlueprint { QuerySet querySet(); int beginningOfPassWriteIndex(); @@ -18,15 +17,15 @@ interface RenderPassTimestampWritesBlueprint extends StructBlueprint { @Override default MemorySegment toSegment(final Arena arena) { - final var struct = WGPURenderPassTimestampWrites.allocate(arena); + final var struct = WGPUPassTimestampWrites.allocate(arena); updateSegment(arena, struct); return struct; } @Override default void updateSegment(final Arena arena, final MemorySegment struct) { - WGPURenderPassTimestampWrites.querySet(struct, this.querySet().pointer()); - WGPURenderPassTimestampWrites.beginningOfPassWriteIndex(struct, this.beginningOfPassWriteIndex()); - WGPURenderPassTimestampWrites.endOfPassWriteIndex(struct, this.endOfPassWriteIndex()); + WGPUPassTimestampWrites.querySet(struct, this.querySet().pointer()); + WGPUPassTimestampWrites.beginningOfPassWriteIndex(struct, this.beginningOfPassWriteIndex()); + WGPUPassTimestampWrites.endOfPassWriteIndex(struct, this.endOfPassWriteIndex()); } } diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassDescriptorBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassDescriptorBlueprint.java index b699b89..0ec1766 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassDescriptorBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/RenderPassDescriptorBlueprint.java @@ -23,7 +23,7 @@ interface RenderPassDescriptorBlueprint extends StructBlueprint { Optional occlusionQuerySet(); - Optional timestampWrites(); + Optional timestampWrites(); @Override default MemorySegment toSegment(final Arena arena) { diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureDescriptorBlueprint.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureDescriptorBlueprint.java index 8f881c9..537eb89 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureDescriptorBlueprint.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureDescriptorBlueprint.java @@ -63,5 +63,6 @@ default void updateSegment(final Arena arena, final MemorySegment struct) { index++; } WGPUTextureDescriptor.viewFormats(struct, segment); + WGPUTextureDescriptor.viewFormatCount(struct, this.viewFormats().size()); } } diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureFormat.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureFormat.java index 3c22c8a..b4e2b26 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureFormat.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureFormat.java @@ -6,98 +6,52 @@ public enum TextureFormat { R8_SNORM(0x00000002), R8_UINT(0x00000003), R8_SINT(0x00000004), - R16_UINT(0x00000005), - R16_SINT(0x00000006), - R16_FLOAT(0x00000007), - RG8_UNORM(0x00000008), - RG8_SNORM(0x00000009), - RG8_UINT(0x0000000A), - RG8_SINT(0x0000000B), - R32_FLOAT(0x0000000C), - R32_UINT(0x0000000D), - R32_SINT(0x0000000E), - RG16_UINT(0x0000000F), - RG16_SINT(0x00000010), - RG16_FLOAT(0x00000011), - RGBA8_UNORM(0x00000012), - RGBA8_UNORM_SRGB(0x00000013), - RGBA8_SNORM(0x00000014), - RGBA8_UINT(0x00000015), - RGBA8_SINT(0x00000016), - BGRA8_UNORM(0x00000017), - BGRA8_UNORM_SRGB(0x00000018), - RGB10A2_UINT(0x00000019), - RGB10A2_UNORM(0x0000001A), - RG11B10_UFLOAT(0x0000001B), - RGB9E5_UFLOAT(0x0000001C), - RG32_FLOAT(0x0000001D), - RG32_UINT(0x0000001E), - RG32_SINT(0x0000001F), - RGBA16_UINT(0x00000020), - RGBA16_SINT(0x00000021), - RGBA16_FLOAT(0x00000022), - RGBA32_FLOAT(0x00000023), - RGBA32_UINT(0x00000024), - RGBA32_SINT(0x00000025), - STENCIL8(0x00000026), - DEPTH16_UNORM(0x00000027), - DEPTH24_PLUS(0x00000028), - DEPTH24_PLUS_STENCIL8(0x00000029), - DEPTH32_FLOAT(0x0000002A), - DEPTH32_FLOAT_STENCIL8(0x0000002B), - BC1_RGBA_UNORM(0x0000002C), - BC1_RGBA_UNORM_SRGB(0x0000002D), - BC2_RGBA_UNORM(0x0000002E), - BC2_RGBA_UNORM_SRGB(0x0000002F), - BC3_RGBA_UNORM(0x00000030), - BC3_RGBA_UNORM_SRGB(0x00000031), - BC4_R_UNORM(0x00000032), - BC4_R_SNORM(0x00000033), - BC5_RG_UNORM(0x00000034), - BC5_RG_SNORM(0x00000035), - BC6H_RGB_UFLOAT(0x00000036), - BC6H_RGB_FLOAT(0x00000037), - BC7_RGBA_UNORM(0x00000038), - BC7_RGBA_UNORM_SRGB(0x00000039), - ETC2_RGB8_UNORM(0x0000003A), - ETC2_RGB8_UNORM_SRGB(0x0000003B), - ETC2_RGB8A1_UNORM(0x0000003C), - ETC2_RGB8A1_UNORM_SRGB(0x0000003D), - ETC2_RGBA8_UNORM(0x0000003E), - ETC2_RGBA8_UNORM_SRGB(0x0000003F), - EAC_R11_UNORM(0x00000040), - EAC_R11_SNORM(0x00000041), - EAC_RG11_UNORM(0x00000042), - EAC_RG11_SNORM(0x00000043), - ASTC4X4_UNORM(0x00000044), - ASTC4X4_UNORM_SRGB(0x00000045), - ASTC5X4_UNORM(0x00000046), - ASTC5X4_UNORM_SRGB(0x00000047), - ASTC5X5_UNORM(0x00000048), - ASTC5X5_UNORM_SRGB(0x00000049), - ASTC6X5_UNORM(0x0000004A), - ASTC6X5_UNORM_SRGB(0x0000004B), - ASTC6X6_UNORM(0x0000004C), - ASTC6X6_UNORM_SRGB(0x0000004D), - ASTC8X5_UNORM(0x0000004E), - ASTC8X5_UNORM_SRGB(0x0000004F), - ASTC8X6_UNORM(0x00000050), - ASTC8X6_UNORM_SRGB(0x00000051), - ASTC8X8_UNORM(0x00000052), - ASTC8X8_UNORM_SRGB(0x00000053), - ASTC10X5_UNORM(0x00000054), - ASTC10X5_UNORM_SRGB(0x00000055), - ASTC10X6_UNORM(0x00000056), - ASTC10X6_UNORM_SRGB(0x00000057), - ASTC10X8_UNORM(0x00000058), - ASTC10X8_UNORM_SRGB(0x00000059), - ASTC10X10_UNORM(0x0000005A), - ASTC10X10_UNORM_SRGB(0x0000005B), - ASTC12X10_UNORM(0x0000005C), - ASTC12X10_UNORM_SRGB(0x0000005D), - ASTC12X12_UNORM(0x0000005E), - ASTC12X12_UNORM_SRGB(0x0000005F), - ; + R16_UNORM(0x00000005), + R16_SNORM(0x00000006), + R16_UINT(0x00000007), + R16_SINT(0x00000008), + R16_FLOAT(0x00000009), + RG8_UNORM(0x0000000A), + RG8_SNORM(0x0000000B), + RG8_UINT(0x0000000C), + RG8_SINT(0x0000000D), + R32_FLOAT(0x0000000E), + R32_UINT(0x0000000F), + R32_SINT(0x00000010), + RG16_UNORM(0x00000011), + RG16_SNORM(0x00000012), + RG16_UINT(0x00000013), + RG16_SINT(0x00000014), + RG16_FLOAT(0x00000015), + RGBA8_UNORM(0x00000016), + RGBA8_UNORM_SRGB(0x00000017), + RGBA8_SNORM(0x00000018), + RGBA8_UINT(0x00000019), + RGBA8_SINT(0x0000001A), + BGRA8_UNORM(0x0000001B), + BGRA8_UNORM_SRGB(0x0000001C), + RGB10A2_UINT(0x0000001D), + RGB10A2_UNORM(0x0000001E), + RG11B10_UFLOAT(0x0000001F), + RGB9E5_UFLOAT(0x00000020), + RG32_FLOAT(0x00000021), + RG32_UINT(0x00000022), + RG32_SINT(0x00000023), + RGBA16_UNORM(0x00000024), + RGBA16_SNORM(0x00000025), + RGBA16_UINT(0x00000026), + RGBA16_SINT(0x00000027), + RGBA16_FLOAT(0x00000028), + RGBA32_FLOAT(0x00000029), + RGBA32_UINT(0x0000002A), + RGBA32_SINT(0x0000002B), + STENCIL8(0x0000002C), + DEPTH16_UNORM(0x0000002D), + DEPTH24_PLUS(0x0000002E), + DEPTH24_PLUS_STENCIL8(0x0000002F), + DEPTH32_FLOAT(0x00000030), + DEPTH32_FLOAT_STENCIL8(0x00000031), + FORCE32(0x7FFFFFFF); private final int value; diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/VertexStepMode.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/VertexStepMode.java index 3caf317..02902d4 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/VertexStepMode.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/VertexStepMode.java @@ -11,11 +11,11 @@ public enum VertexStepMode { * 0x00000001. * Indicates no value is passed for this argument. */ - UNDEFINED(0x00000001), + UNDEFINED(0x00000000), - VERTEX(0x00000002), + VERTEX(0x00000001), - INSTANCE(0x00000003), + INSTANCE(0x00000002), FORCE32(0x7FFFFFFF); diff --git a/wgpu-native/wgpu-native-ffm/pom.xml b/wgpu-native/wgpu-native-ffm/pom.xml index 4b9fa3d..c1636b5 100644 --- a/wgpu-native/wgpu-native-ffm/pom.xml +++ b/wgpu-native/wgpu-native-ffm/pom.xml @@ -55,7 +55,7 @@ ${wgpu.native.download.base.url}/wgpu-macos-aarch64-release.zip include/** ${project.build.directory}/ - 214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 + e3e3f6144f9b197b8199681e956391631cfc6d1cef057a1e8c5a1c6aedef5054 diff --git a/wgpu-native/wgpu-native-macos-aarch64/pom.xml b/wgpu-native/wgpu-native-macos-aarch64/pom.xml index 6018075..b678a03 100644 --- a/wgpu-native/wgpu-native-macos-aarch64/pom.xml +++ b/wgpu-native/wgpu-native-macos-aarch64/pom.xml @@ -39,7 +39,7 @@ ${wgpu.native.download.base.url}/wgpu-macos-aarch64-release.zip lib/libwgpu_native.dylib ${project.build.directory}/classes/foreign/macos-aarch64 - 214fa6aa3a6d011643f1dcbc5a971db6f9d110f97f94a4c0b7e1e31271ef3b00 + e3e3f6144f9b197b8199681e956391631cfc6d1cef057a1e8c5a1c6aedef5054 diff --git a/wgpu-native/wgpu-native-windows-amd64/pom.xml b/wgpu-native/wgpu-native-windows-amd64/pom.xml index abe1bfa..ab002f0 100644 --- a/wgpu-native/wgpu-native-windows-amd64/pom.xml +++ b/wgpu-native/wgpu-native-windows-amd64/pom.xml @@ -39,7 +39,7 @@ ${wgpu.native.download.base.url}/wgpu-windows-x86_64-msvc-release.zip lib/wgpu_native.dll ${project.build.directory}/classes/foreign/windows-amd64 - cbb15ac6499476bd555190922142a466ba91ec9032cc6bef5e59063e829425ea + 6ec736b6e7c7259ee5d13cdd06eac4407d1f38539b2e555cbe7040e6098f9dd9 From 151d388235540e1b8e36293ad73ba5be41faa0df Mon Sep 17 00:00:00 2001 From: Bahaa Zaid Date: Sat, 30 May 2026 00:38:18 +0300 Subject: [PATCH 5/5] Update enum values --- .sdkmanrc | 2 +- .../bahaa/webgpu/samples/SampleBase.java | 19 ++++++++++------ .../model/SurfaceGetCurrentTextureStatus.java | 22 ++++++------------- .../bahaa/webgpu/api/model/TextureUsage.java | 13 ++++++----- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.sdkmanrc b/.sdkmanrc index 936bd46..3a95715 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,3 +1,3 @@ # Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below -java=25.0.2-librca +java=25.0.3-librca diff --git a/samples/src/main/java/io/github/bahaa/webgpu/samples/SampleBase.java b/samples/src/main/java/io/github/bahaa/webgpu/samples/SampleBase.java index 70ab46e..19cc01e 100644 --- a/samples/src/main/java/io/github/bahaa/webgpu/samples/SampleBase.java +++ b/samples/src/main/java/io/github/bahaa/webgpu/samples/SampleBase.java @@ -116,7 +116,10 @@ protected void run(final String[] args) { final var texture = surfaceTexture.texture(); switch (surfaceTexture.status()) { - case OUT_OF_MEMORY, DEVICE_LOST, FORCE32 -> throw new OutOfMemoryError("Out of memory"); + case ERROR -> { + IO.println("Error getting surface texture: %s!".formatted(surfaceTexture.status())); + continue; + } case TIMEOUT, OUTDATED, LOST -> { if (texture != null) { texture.close(); @@ -134,13 +137,13 @@ protected void run(final String[] args) { } continue; } + case SUCCESS_OPTIMAL, SUCCESS_SUBOPTIMAL -> { + render(device, queue, surface, texture); + // All WebGPU objects are auto-closable, but if you forgot to close them, they will be closed when + // the object being garbage collected. + texture.close(); + } } - - render(device, queue, surface, texture); - - // All WebGPU objects are auto-closable, but if you forgot to close them, they will be closed when - // the object being garbage collected. - texture.close(); } surface.close(); @@ -164,6 +167,8 @@ private void configureSurface(final Surface surface, final Device device, .format(getPreferredFormat()) .width(width) .height(height) + .presentMode(PresentMode.FIFO) + .alphaMode(this.capabilities.getAlphaModes().getFirst()) .usage(EnumSet.of(TextureUsage.RENDER_ATTACHMENT)) .build()); } diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/SurfaceGetCurrentTextureStatus.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/SurfaceGetCurrentTextureStatus.java index ac75bf9..399f7c9 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/SurfaceGetCurrentTextureStatus.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/SurfaceGetCurrentTextureStatus.java @@ -10,7 +10,7 @@ public enum SurfaceGetCurrentTextureStatus { SUCCESS_OPTIMAL(0x00000001), /** - * The surface can present the frame, but may need reconfiguration. + * Still OK - the surface can present the frame, but in a suboptimal way. The surface may need reconfiguration. */ SUCCESS_SUBOPTIMAL(0x00000002), @@ -25,24 +25,16 @@ public enum SurfaceGetCurrentTextureStatus { OUTDATED(0x00000004), /** - * The connection to the surface owner was lost. + * The connection to whatever owns the surface was lost, or generally needs to be fully reinitialized. */ LOST(0x00000005), /** - * The system ran out of memory. + * There was some deterministic error (for example, the surface is not configured, or there was an + * + * @ref OutStructChainError). Should produce @ref ImplementationDefinedLogging containing details. */ - OUT_OF_MEMORY(0x00000006), - - /** - * The WGPUDevice configured on the WGPUSurface was lost. - */ - DEVICE_LOST(0x00000007), - - /** - * The surface is not configured, or there was an error. - */ - ERROR(0x00000008), + ERROR(0x00000006), FORCE32(0x7FFFFFFF); @@ -61,7 +53,7 @@ public static SurfaceGetCurrentTextureStatus fromValue(final int value) { return status; } } - return ERROR; + throw new IllegalArgumentException("invalid value %d".formatted(value)); } public int getValue() { diff --git a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureUsage.java b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureUsage.java index 93b7447..abbb855 100644 --- a/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureUsage.java +++ b/webgpu/src/main/java/io/github/bahaa/webgpu/api/model/TextureUsage.java @@ -5,12 +5,13 @@ import java.util.stream.Collectors; public enum TextureUsage { - NONE(0X0000000000000000), - COPY_SRC(0X0000000000000001), - COPY_DST(0X0000000000000002), - TEXTURE_BINDING(0X0000000000000004), - STORAGE_BINDING(0X0000000000000008), - RENDER_ATTACHMENT(0X0000000000000010), + NONE(0x0000000000000000), + COPY_SRC(0x0000000000000001), + COPY_DST(0x0000000000000002), + TEXTURE_BINDING(0x0000000000000004), + STORAGE_BINDING(0x0000000000000008), + RENDER_ATTACHMENT(0x0000000000000010), + TRANSIENT_ATTACHMENT(0x0000000000000020), ; private final long value;