Add instance feature for reusable adapters (#540)
The default behavior is as specced in JS (single-use adapters). This
setting changes all adapters on the instance.
Fixes #535
diff --git a/webgpu.h b/webgpu.h
index e79f4ed..1aff1ab 100644
--- a/webgpu.h
+++ b/webgpu.h
@@ -657,6 +657,13 @@
* via @ref WGPUShaderSourceSPIRV.
*/
WGPUInstanceFeatureName_ShaderSourceSPIRV = 0x00000002,
+ /**
+ * Normally, a @ref WGPUAdapter can only create a single device. If this is
+ * available and enabled, then adapters won't immediately expire when they
+ * create a device, so can be reused to make multiple devices. They may
+ * still expire for other reasons.
+ */
+ WGPUInstanceFeatureName_MultipleDevicesPerAdapter = 0x00000003,
WGPUInstanceFeatureName_Force32 = 0x7FFFFFFF
} WGPUInstanceFeatureName WGPU_ENUM_ATTRIBUTE;
diff --git a/webgpu.yml b/webgpu.yml
index edca599..688ba13 100644
--- a/webgpu.yml
+++ b/webgpu.yml
@@ -541,6 +541,12 @@
doc: |
Enable passing SPIR-V shaders to @ref wgpuDeviceCreateShaderModule,
via @ref WGPUShaderSourceSPIRV.
+ - name: multiple_devices_per_adapter
+ doc: |
+ Normally, a @ref WGPUAdapter can only create a single device. If this is
+ available and enabled, then adapters won't immediately expire when they
+ create a device, so can be reused to make multiple devices. They may
+ still expire for other reasons.
- name: load_op
doc: |
TODO