From 0dc1ec4b3415d440017ba4cff947d988450cef10 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 30 Apr 2024 08:22:17 +0200 Subject: [PATCH 01/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 12 ++++------ package/cpp/wgpu/JsiRenderPassEncoder.h | 21 ++++++++++++++++- scripts/generator/model.ts | 27 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index e53d1ee12f..edd2f37f3e 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -124,8 +124,6 @@ const uniformBuffer = device.createBuffer({ mappedAtCreation: false }); -console.log(pipeline.getBindGroupLayout(0)) - const uniformBindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ @@ -159,8 +157,6 @@ const renderPassDescriptor: GPURenderPassDescriptor = { }, }; -console.log(renderPassDescriptor) - const aspect = width / height; const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); const modelViewProjectionMatrix = mat4.create(); @@ -177,7 +173,6 @@ function getTransformationMatrix() { ); mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); - return modelViewProjectionMatrix as Float32Array; } @@ -203,8 +198,11 @@ function frame() { passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - requestAnimationFrame(frame); + + console.log("RENDER"); + context.present(); + //requestAnimationFrame(frame); } -requestAnimationFrame(frame); +frame(); }; \ No newline at end of file diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index fd51f40556..a179256fbf 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -7,6 +7,8 @@ #include +#include "JsiBindGroup.h" +#include "JsiBuffer.h" #include "JsiEnums.h" #include "JsiHostObject.h" #include "JsiPromises.h" @@ -59,12 +61,29 @@ class JsiRenderPassEncoder return jsi::Value::undefined(); } + JSI_HOST_FUNCTION(setBindGroup) { + auto index = static_cast(arguments[0].getNumber()); + auto bindGroup = JsiBindGroup::fromValue(runtime, arguments[1]); + // auto dynamicOffsetCount = static_cast(arguments[2].getNumber()); + getObject()->setBindGroup(index, *bindGroup, 0, nullptr); + return jsi::Value::undefined(); + } + + JSI_HOST_FUNCTION(setVertexBuffer) { + auto slot = static_cast(arguments[0].getNumber()); + auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); + getObject()->setVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); + return jsi::Value::undefined(); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiRenderPassEncoder, RenderPassEncoder) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiRenderPassEncoder, setPipeline), JSI_EXPORT_FUNC(JsiRenderPassEncoder, draw), - JSI_EXPORT_FUNC(JsiRenderPassEncoder, end)) + JSI_EXPORT_FUNC(JsiRenderPassEncoder, end), + JSI_EXPORT_FUNC(JsiRenderPassEncoder, setBindGroup), + JSI_EXPORT_FUNC(JsiRenderPassEncoder, setVertexBuffer)) /** * Returns the underlying object from a host object of this type diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 75450b211a..a7628b155f 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -268,6 +268,33 @@ object->multisample.alphaToCoverageEnabled = false; { name: "end", args: [], + }, + { + name: "setBindGroup", + args: [ + { name: "index", type: "uint32_t" }, + { name: "bindGroup", type: "BindGroup" }, + { name: "dynamicOffsetCount", "type": "size_t", "defaultAtomicValue": "0"}, + // { name: "dynamicOffsets", "type": "uint32_t*", "defaultAtomicValue": "nullptr"} + ], + implementation: `auto index = static_cast(arguments[0].getNumber()); + auto bindGroup = JsiBindGroup::fromValue(runtime, arguments[1]); + //auto dynamicOffsetCount = static_cast(arguments[2].getNumber()); + getObject()->setBindGroup(index, *bindGroup, 0, nullptr); + return jsi::Value::undefined();` + }, + { + name: "setVertexBuffer", + args: [ + { name: "slot", type: "uint32_t" }, + { name: "buffer", type: "Buffer" }, + {name: "offset", "type": "uint64_t", "defaultAtomicValue": "0"}, + {name: "size", "type": "uint64_t", "defaultAtomicValue": "0xFFFFFFFFFFFFFFFF"} + ], + implementation: `auto slot = static_cast(arguments[0].getNumber()); + auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); + getObject()->setVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); + return jsi::Value::undefined();` } ] }, From 1db9cf5546154f9da90fc3439642807b2b18d6ff Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 30 Apr 2024 11:39:07 +0200 Subject: [PATCH 02/63] :wrench: --- package/.vscode/settings.json | 69 +++++++++++++++++++ package/cpp/wgpu/JsiVertexAttribute.h | 75 +++++++++++++++++++++ package/cpp/wgpu/JsiVertexBufferLayout.h | 85 ++++++++++++++++++++++++ package/cpp/wgpu/JsiVertexState.h | 16 +++++ scripts/generator/model.ts | 19 +++++- 5 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 package/.vscode/settings.json create mode 100644 package/cpp/wgpu/JsiVertexAttribute.h create mode 100644 package/cpp/wgpu/JsiVertexBufferLayout.h diff --git a/package/.vscode/settings.json b/package/.vscode/settings.json new file mode 100644 index 0000000000..9bc61e6971 --- /dev/null +++ b/package/.vscode/settings.json @@ -0,0 +1,69 @@ +{ + "files.associations": { + "utility": "cpp", + "__bit_reference": "cpp", + "__config": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__node_handle": "cpp", + "__split_buffer": "cpp", + "__threading_support": "cpp", + "__tree": "cpp", + "__verbose_abort": "cpp", + "array": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "cfenv": "cpp", + "charconv": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "execution": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "mutex": "cpp", + "new": "cpp", + "optional": "cpp", + "ostream": "cpp", + "queue": "cpp", + "ratio": "cpp", + "regex": "cpp", + "set": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "tuple": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "variant": "cpp", + "vector": "cpp", + "algorithm": "cpp" + } +} \ No newline at end of file diff --git a/package/cpp/wgpu/JsiVertexAttribute.h b/package/cpp/wgpu/JsiVertexAttribute.h new file mode 100644 index 0000000000..ad987d075e --- /dev/null +++ b/package/cpp/wgpu/JsiVertexAttribute.h @@ -0,0 +1,75 @@ +#pragma once +#include +#include +#include + +#include "webgpu.hpp" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiVertexAttribute + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiVertexAttribute(std::shared_ptr context, + wgpu::VertexAttribute m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiVertexAttribute, VertexAttribute) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::VertexAttribute *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + auto object = new wgpu::VertexAttribute(); + object->setDefault(); + + if (obj.hasProperty(runtime, "shaderLocation")) { + auto shaderLocation = obj.getProperty(runtime, "shaderLocation"); + + object->shaderLocation = + static_cast(shaderLocation.getNumber()); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop shaderLocation in VertexAttribute"); + } + if (obj.hasProperty(runtime, "format")) { + auto format = obj.getProperty(runtime, "format"); + + object->format = + getVertexFormat(format.getString(runtime).utf8(runtime).c_str()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop format in VertexAttribute"); + } + if (obj.hasProperty(runtime, "offset")) { + auto offset = obj.getProperty(runtime, "offset"); + + object->offset = static_cast(offset.getNumber()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop offset in VertexAttribute"); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiVertexBufferLayout.h b/package/cpp/wgpu/JsiVertexBufferLayout.h new file mode 100644 index 0000000000..5a7fd49e99 --- /dev/null +++ b/package/cpp/wgpu/JsiVertexBufferLayout.h @@ -0,0 +1,85 @@ +#pragma once +#include +#include +#include + +#include "webgpu.hpp" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiVertexAttribute.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiVertexBufferLayout + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiVertexBufferLayout(std::shared_ptr context, + wgpu::VertexBufferLayout m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) { + } + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiVertexBufferLayout, VertexBufferLayout) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::VertexBufferLayout *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + auto object = new wgpu::VertexBufferLayout(); + object->setDefault(); + + if (obj.hasProperty(runtime, "arrayStride")) { + auto arrayStride = obj.getProperty(runtime, "arrayStride"); + + object->arrayStride = static_cast(arrayStride.getNumber()); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop arrayStride in VertexBufferLayout"); + } + if (obj.hasProperty(runtime, "stepMode")) { + auto stepMode = obj.getProperty(runtime, "stepMode"); + + object->stepMode = getVertexStepMode( + stepMode.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "attributes")) { + auto attributes = obj.getProperty(runtime, "attributes"); + auto jsiArray2 = attributes.asObject(runtime).asArray(runtime); + auto jsiArray2Size = static_cast(jsiArray2.size(runtime)); + auto array2 = new std::vector(); + array2->reserve(jsiArray2Size); + for (int i = 0; i < jsiArray2Size; i++) { + auto element = JsiVertexAttribute::fromValue( + runtime, jsiArray2.getValueAtIndex(runtime, i)); + array2->push_back(*element); + } + + object->attributeCount = jsiArray2Size; + object->attributes = array2->data(); + } else { + throw jsi::JSError( + runtime, "Missing mandatory prop attributes in VertexBufferLayout"); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiVertexState.h b/package/cpp/wgpu/JsiVertexState.h index c1ba822605..523c303591 100644 --- a/package/cpp/wgpu/JsiVertexState.h +++ b/package/cpp/wgpu/JsiVertexState.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiShaderModule.h" #include "JsiSkHostObjects.h" +#include "JsiVertexBufferLayout.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" @@ -59,6 +60,21 @@ class JsiVertexState throw jsi::JSError(runtime, "Missing mandatory prop entryPoint in VertexState"); } + if (obj.hasProperty(runtime, "buffers")) { + auto buffers = obj.getProperty(runtime, "buffers"); + auto jsiArray2 = buffers.asObject(runtime).asArray(runtime); + auto jsiArray2Size = static_cast(jsiArray2.size(runtime)); + auto array2 = new std::vector(); + array2->reserve(jsiArray2Size); + for (int i = 0; i < jsiArray2Size; i++) { + auto element = JsiVertexBufferLayout::fromValue( + runtime, jsiArray2.getValueAtIndex(runtime, i)); + array2->push_back(*element); + } + + object->bufferCount = jsiArray2Size; + object->buffers = array2->data(); + } return object; } } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index a7628b155f..492b870361 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -391,7 +391,24 @@ object->chain.sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, name: "VertexState", properties: [ {"name": "module", "type": "ShaderModule"}, - {"name": "entryPoint", "type": "string" } + {"name": "entryPoint", "type": "string" }, + {"name": "buffers", "type": "VertexBufferLayout[]", "optional": true } + ] + }, + { + name: "VertexBufferLayout", + properties: [ + { name: "arrayStride", type: "uint64_t" }, + { name: "stepMode", type: "VertexStepMode", optional: true }, + { name: "attributes", type: "VertexAttribute[]"} + ] + }, + { + name: "VertexAttribute", + properties: [ + {"name": "shaderLocation", "type": "uint32_t"}, + {"name": "format", "type": "VertexFormat"}, + {"name": "offset", "type": "uint32_t"} ] }, { From f5d723dcd12bce7af738fc726259dc5de391ffe0 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 15:01:35 +0200 Subject: [PATCH 03/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 2 +- package/android/CMakeLists.txt | 1 + .../RNSkAndroidPlatformContext.h | 14 +- .../cpp/rnskia-android/WebGPUTriangle.cpp | 132 +- .../rnskia-android/dawn/EnumClassBitmasks.h | 52 + .../cpp/rnskia-android/{ => dawn}/webgpu.h | 2 +- .../cpp/rnskia-android/dawn/webgpu_cpp.h | 2748 ++++++++++++ .../dawn/webgpu_cpp_chained_struct.h | 31 + package/android/cpp/rnskia-android/webgpu.hpp | 3872 ----------------- package/cpp/rnskia/RNSkPlatformContext.h | 3 +- package/cpp/wgpu/JsiAdapter.h | 20 +- package/cpp/wgpu/JsiBindGroup.h | 2 +- package/cpp/wgpu/JsiBindGroupDescriptor.h | 3 +- package/cpp/wgpu/JsiBindGroupEntry.h | 3 +- package/cpp/wgpu/JsiBindGroupLayout.h | 2 +- package/cpp/wgpu/JsiBlendComponent.h | 3 +- package/cpp/wgpu/JsiBlendState.h | 3 +- package/cpp/wgpu/JsiBuffer.h | 6 +- package/cpp/wgpu/JsiBufferDescriptor.h | 5 +- package/cpp/wgpu/JsiColor.h | 3 +- package/cpp/wgpu/JsiColorTargetState.h | 8 +- package/cpp/wgpu/JsiCommandBuffer.h | 2 +- package/cpp/wgpu/JsiCommandEncoder.h | 6 +- .../cpp/wgpu/JsiCommandEncoderDescriptor.h | 2 +- package/cpp/wgpu/JsiContext.h | 3 +- package/cpp/wgpu/JsiDepthStencilState.h | 3 +- package/cpp/wgpu/JsiDevice.h | 20 +- package/cpp/wgpu/JsiDeviceDescriptor.h | 2 +- package/cpp/wgpu/JsiEnums.h | 16 +- package/cpp/wgpu/JsiExtent3D.h | 3 +- package/cpp/wgpu/JsiFragmentState.h | 3 +- package/cpp/wgpu/JsiGPU.h | 20 +- package/cpp/wgpu/JsiMultisampleState.h | 3 +- package/cpp/wgpu/JsiPrimitiveState.h | 3 +- package/cpp/wgpu/JsiQueue.h | 8 +- .../cpp/wgpu/JsiRenderPassColorAttachment.h | 6 +- .../JsiRenderPassDepthStencilAttachment.h | 91 + package/cpp/wgpu/JsiRenderPassDescriptor.h | 12 +- package/cpp/wgpu/JsiRenderPassEncoder.h | 12 +- package/cpp/wgpu/JsiRenderPipeline.h | 4 +- .../cpp/wgpu/JsiRenderPipelineDescriptor.h | 6 +- package/cpp/wgpu/JsiRequestAdapterOptions.h | 3 +- package/cpp/wgpu/JsiShaderModule.h | 2 +- .../cpp/wgpu/JsiShaderModuleWGSLDescriptor.h | 7 +- package/cpp/wgpu/JsiStencilFaceState.h | 3 +- package/cpp/wgpu/JsiTexture.h | 4 +- package/cpp/wgpu/JsiTextureDescriptor.h | 5 +- package/cpp/wgpu/JsiTextureView.h | 2 +- package/cpp/wgpu/JsiVertexAttribute.h | 3 +- package/cpp/wgpu/JsiVertexBufferLayout.h | 3 +- package/cpp/wgpu/JsiVertexState.h | 3 +- package/cpp/wgpu/JsiWGPUContext.h | 78 +- scripts/generator/common.ts | 8 +- scripts/generator/enums.ts | 10 +- scripts/generator/generateObject.ts | 13 +- scripts/generator/model.ts | 124 +- 56 files changed, 3246 insertions(+), 4162 deletions(-) create mode 100644 package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h rename package/android/cpp/rnskia-android/{ => dawn}/webgpu.h (99%) create mode 100644 package/android/cpp/rnskia-android/dawn/webgpu_cpp.h create mode 100644 package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h delete mode 100644 package/android/cpp/rnskia-android/webgpu.hpp create mode 100644 package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index edd2f37f3e..c0370fd306 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -141,7 +141,7 @@ const renderPassDescriptor: GPURenderPassDescriptor = { { view: context .getCurrentTexture() - .createView(), // Assigned later + .createView(), clearValue: [0.5, 0.5, 0.5, 1.0], loadOp: 'clear', diff --git a/package/android/CMakeLists.txt b/package/android/CMakeLists.txt index 1c4b87ca6e..d8381099fa 100644 --- a/package/android/CMakeLists.txt +++ b/package/android/CMakeLists.txt @@ -91,6 +91,7 @@ target_include_directories( ../cpp/wgpu ../cpp/jsi ../cpp/rnskia + ../cpp/rnskia/dawn ../cpp/rnskia/values ../cpp/rnskia/dom ../cpp/rnskia/dom/base diff --git a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h index f0e505284d..1929208657 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h @@ -66,17 +66,15 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { void registerSurfaceDescriptor(int nativeId, void *window, int width, int height) override { - WGPUSurfaceDescriptorFromAndroidNativeWindow androidSurfaceDesc = {}; - androidSurfaceDesc.chain.sType = - WGPUSType_SurfaceDescriptorFromAndroidNativeWindow; + + wgpu::SurfaceDescriptorFromAndroidNativeWindow androidSurfaceDesc = {}; androidSurfaceDesc.window = window; - WGPUSurfaceDescriptor surfaceDesc = {}; - surfaceDesc.nextInChain = - reinterpret_cast(&androidSurfaceDesc); + wgpu::SurfaceDescriptor surfaceDesc = {}; + surfaceDesc.nextInChain = &androidSurfaceDesc; - wgpu::Instance instance = wgpuCreateInstance(nullptr); - wgpu::Surface surface = wgpuInstanceCreateSurface(instance, &surfaceDesc); + auto instance = wgpu::CreateInstance(nullptr); + auto surface = instance.CreateSurface(&surfaceDesc); _descriptors[nativeId] = std::make_tuple( std::make_shared(surface), width, height); diff --git a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp index 6730384215..7b832a1f6e 100644 --- a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp +++ b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp @@ -5,62 +5,82 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" using namespace wgpu; void runTriangleDemo(void *window, int width, int height) { RNSkia::RNSkLogger::logToConsole("width: %d, height: %d", width, height); - Instance instance = wgpuCreateInstance(nullptr); + auto instance = CreateInstance(nullptr); if (!instance) { RNSkia::RNSkLogger::logToConsole("Failed to create WebGPU instance"); return; } - WGPUSurfaceDescriptorFromAndroidNativeWindow androidSurfaceDesc = {}; - androidSurfaceDesc.chain.sType = - WGPUSType_SurfaceDescriptorFromAndroidNativeWindow; + SurfaceDescriptorFromAndroidNativeWindow androidSurfaceDesc = {}; androidSurfaceDesc.window = window; // Set up the generic surface descriptor to use the platform-specific one - WGPUSurfaceDescriptor surfaceDesc = {}; + SurfaceDescriptor surfaceDesc = {}; surfaceDesc.nextInChain = - reinterpret_cast(&androidSurfaceDesc); - Surface surface = wgpuInstanceCreateSurface(instance, &surfaceDesc); + reinterpret_cast(&androidSurfaceDesc); + Surface surface = instance.CreateSurface(&surfaceDesc); RNSkia::RNSkLogger::logToConsole("Requesting adapter..."); RequestAdapterOptions adapterOpts; - // adapterOpts.compatibleSurface = surface; - Adapter adapter = instance.requestAdapter(adapterOpts); - std::cout << "Got adapter: " << adapter << std::endl; - std::cout << "Requesting device..." << std::endl; + wgpu::Adapter adapter = nullptr; + instance.RequestAdapter( + nullptr, + [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, const char *message, + void *userdata) { + if (message != nullptr) { + fprintf(stderr, "%s", message); + return; + } + *static_cast(userdata) = + wgpu::Adapter::Acquire(cAdapter); + }, + &adapter); + + wgpu::Device device = nullptr; + adapter.RequestDevice( + nullptr, + [](WGPURequestDeviceStatus, WGPUDevice cDevice, const char *message, + void *userdata) { + if (message != nullptr) { + fprintf(stderr, "%s", message); + return; + } + *static_cast(userdata) = wgpu::Device::Acquire(cDevice); + }, + &device); + DeviceDescriptor deviceDesc; deviceDesc.label = "My Device"; // deviceDesc.requiredFeaturesCount = 0; deviceDesc.requiredLimits = nullptr; deviceDesc.defaultQueue.label = "The default queue"; - Device device = adapter.requestDevice(deviceDesc); - RNSkia::RNSkLogger::logToConsole("GOT DEVICE"); // Add an error callback for more debug info - auto h = device.setUncapturedErrorCallback( - [](ErrorType type, char const *message) { - RNSkia::RNSkLogger::logToConsole("error: %s", message); - }); - - Queue queue = device.getQueue(); + // auto h = device.SetUncapturedErrorCallback( + // [=](ErrorType type, char const *message, void *userData) { + // RNSkia::RNSkLogger::logToConsole("error: %s", message); + // RNSkia::RNSkLogger::logToConsole("GOT DEVICE"); + // }, + // nullptr); + Queue queue = device.GetQueue(); RNSkia::RNSkLogger::logToConsole("Creating swap chain..."); - TextureFormat swapChainFormat = - surface.getPreferredFormat(adapter); // TextureFormat swapChainFormat = - // TextureFormat::BGRA8Unorm; + // TextureFormat swapChainFormat = surface.GetPreferredFormat( + // adapter); // TextureFormat swapChainFormat = + // TextureFormat::BGRA8Unorm; SwapChainDescriptor swapChainDesc; swapChainDesc.width = width; swapChainDesc.height = height; swapChainDesc.usage = TextureUsage::RenderAttachment; - swapChainDesc.format = swapChainFormat; + swapChainDesc.format = TextureFormat::RGBA8Unorm; swapChainDesc.presentMode = PresentMode::Fifo; - SwapChain swapChain = device.createSwapChain(surface, swapChainDesc); + SwapChain swapChain = device.CreateSwapChain(surface, &swapChainDesc); RNSkia::RNSkLogger::logToConsole("Creating shader module."); const char *shaderSource = R"( @@ -89,15 +109,13 @@ fn fs_main() -> @location(0) vec4f { // Use the extension mechanism to load a WGSL shader source code ShaderModuleWGSLDescriptor shaderCodeDesc; // Set the chained struct's header - shaderCodeDesc.chain.next = nullptr; - shaderCodeDesc.chain.sType = SType::ShaderModuleWGSLDescriptor; // Connect the chain - shaderDesc.nextInChain = &shaderCodeDesc.chain; + shaderDesc.nextInChain = &shaderCodeDesc; // Setup the actual payload of the shader code descriptor shaderCodeDesc.code = shaderSource; - ShaderModule shaderModule = device.createShaderModule(shaderDesc); + auto shaderModule = device.CreateShaderModule(&shaderDesc); RNSkia::RNSkLogger::logToConsole("Creating rendering pipeline."); RenderPipelineDescriptor pipelineDesc; @@ -115,8 +133,9 @@ fn fs_main() -> @location(0) vec4f { // Primitive assembly and rasterization // Each sequence of 3 vertices is considered as a triangle pipelineDesc.primitive.topology = PrimitiveTopology::TriangleList; - // We'll see later how to specify the order in which vertices should be - // connected. When not specified, vertices are considered sequentially. + // We'll see later how to specify the order in which vertices should + // be connected. When not specified, vertices are considered + // sequentially. pipelineDesc.primitive.stripIndexFormat = IndexFormat::Undefined; // The face orientation is defined by assuming that when looking // from the front of the face, its corner vertices are enumerated @@ -147,13 +166,13 @@ fn fs_main() -> @location(0) vec4f { blendState.alpha.operation = BlendOperation::Add; ColorTargetState colorTarget; - colorTarget.format = swapChainFormat; + colorTarget.format = TextureFormat::RGBA8Unorm; colorTarget.blend = &blendState; - colorTarget.writeMask = - ColorWriteMask::All; // We could write to only some of the color channels. + colorTarget.writeMask = ColorWriteMask::All; // We could write to only some + // of the color channels. - // We have only one target because our render pass has only one output color - // attachment. + // We have only one target because our render pass has only one output + // color attachment. fragmentState.targetCount = 1; fragmentState.targets = &colorTarget; @@ -171,21 +190,20 @@ fn fs_main() -> @location(0) vec4f { // Pipeline layout pipelineDesc.layout = nullptr; - RenderPipeline pipeline = device.createRenderPipeline(pipelineDesc); - std::cout << "Render pipeline: " << pipeline << std::endl; + RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc); // while (true) { // wgpuInstanceProcessEvents(instance); - TextureView nextTexture = swapChain.getCurrentTextureView(); + TextureView nextTexture = swapChain.GetCurrentTextureView(); if (!nextTexture) { RNSkia::RNSkLogger::logToConsole("Cannot acquire next swap chain texture"); - return; + // return; } CommandEncoderDescriptor commandEncoderDesc; commandEncoderDesc.label = "Command Encoder"; - CommandEncoder encoder = device.createCommandEncoder(commandEncoderDesc); + CommandEncoder encoder = device.CreateCommandEncoder(&commandEncoderDesc); RenderPassDescriptor renderPassDesc; @@ -202,37 +220,25 @@ fn fs_main() -> @location(0) vec4f { renderPassDesc.depthStencilAttachment = nullptr; // renderPassDesc.timestampWriteCount = 0; renderPassDesc.timestampWrites = nullptr; - RenderPassEncoder renderPass = encoder.beginRenderPass(renderPassDesc); + RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDesc); // In its overall outline, drawing a triangle is as simple as this: // Select which render pipeline to use - renderPass.setPipeline(pipeline); + renderPass.SetPipeline(pipeline); // Draw 1 instance of a 3-vertices shape - renderPass.draw(3, 1, 0, 0); + renderPass.Draw(3, 1, 0, 0); - renderPass.end(); - renderPass.release(); - - nextTexture.release(); + renderPass.End(); CommandBufferDescriptor cmdBufferDescriptor; cmdBufferDescriptor.label = "Command buffer"; - CommandBuffer command = encoder.finish(cmdBufferDescriptor); - encoder.release(); - std::vector commands; + CommandBuffer command = encoder.Finish(&cmdBufferDescriptor); + std::vector commands; commands.push_back(command); - queue.submit(command); - command.release(); - - swapChain.present(); - // } - - pipeline.release(); - shaderModule.release(); - swapChain.release(); - device.release(); - adapter.release(); - instance.release(); + queue.Submit(commands.size(), commands.data()); + + swapChain.Present(); + // surface.release(); // glfwDestroyWindow(window); // glfwTerminate(); diff --git a/package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h b/package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h new file mode 100644 index 0000000000..b469135130 --- /dev/null +++ b/package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h @@ -0,0 +1,52 @@ +// Copyright 2020 The Dawn & Tint Authors +// +// 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 SRC_DAWN_NATIVE_ENUMCLASSBITMASKS_H_ +#define SRC_DAWN_NATIVE_ENUMCLASSBITMASKS_H_ + +#include "dawn/EnumClassBitmasks.h" + +namespace dawn::native { + +// EnumClassBitmmasks is a helper in the dawn:: namespace. +// Re-export it in the dawn_native namespace. +// DAWN_IMPORT_BITMASK_OPERATORS + +// Specify this for usage with EnumMaskIterator +template struct EnumBitmaskSize { + static constexpr unsigned value = 0; +}; + +template constexpr bool HasOneBit(T value) { + return HasZeroOrOneBits(value) && value != T(0); +} + +} // namespace dawn::native + +#endif // SRC_DAWN_NATIVE_ENUMCLASSBITMASKS_H_ diff --git a/package/android/cpp/rnskia-android/webgpu.h b/package/android/cpp/rnskia-android/dawn/webgpu.h similarity index 99% rename from package/android/cpp/rnskia-android/webgpu.h rename to package/android/cpp/rnskia-android/dawn/webgpu.h index 92fb1248e2..5c748268d6 100644 --- a/package/android/cpp/rnskia-android/webgpu.h +++ b/package/android/cpp/rnskia-android/dawn/webgpu.h @@ -3631,4 +3631,4 @@ wgpuTextureViewRelease(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; } // extern "C" #endif -#endif // WEBGPU_H_ +#endif // WEBGPU_H_ \ No newline at end of file diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h new file mode 100644 index 0000000000..ddf755bd8b --- /dev/null +++ b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h @@ -0,0 +1,2748 @@ +#ifdef __EMSCRIPTEN__ +#error \ + "Do not include this header. Emscripten already provides headers needed for WebGPU." +#endif +#ifndef WEBGPU_CPP_H_ +#define WEBGPU_CPP_H_ + +#include "dawn/EnumClassBitmasks.h" +#include "dawn/webgpu.h" +#include "dawn/webgpu_cpp_chained_struct.h" +#include +#include +#include +#include + +namespace wgpu { + +namespace detail { +constexpr size_t ConstexprMax(size_t a, size_t b) { return a > b ? a : b; } +} // namespace detail + +static constexpr uint32_t kArrayLayerCountUndefined = + WGPU_ARRAY_LAYER_COUNT_UNDEFINED; +static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED; +static constexpr uint32_t kDepthSliceUndefined = WGPU_DEPTH_SLICE_UNDEFINED; +static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED; +static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED; +static constexpr uint32_t kMipLevelCountUndefined = + WGPU_MIP_LEVEL_COUNT_UNDEFINED; +static constexpr uint32_t kQuerySetIndexUndefined = + WGPU_QUERY_SET_INDEX_UNDEFINED; +static constexpr size_t kWholeMapSize = WGPU_WHOLE_MAP_SIZE; +static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE; + +enum class WGSLFeatureName : uint32_t { + Undefined = 0x00000000, + ReadonlyAndReadwriteStorageTextures = 0x00000001, + Packed4x8IntegerDotProduct = 0x00000002, + UnrestrictedPointerParameters = 0x00000003, + PointerCompositeAccess = 0x00000004, + ChromiumTestingUnimplemented = 0x000003E8, + ChromiumTestingUnsafeExperimental = 0x000003E9, + ChromiumTestingExperimental = 0x000003EA, + ChromiumTestingShippedWithKillswitch = 0x000003EB, + ChromiumTestingShipped = 0x000003EC, +}; + +enum class AdapterType : uint32_t { + DiscreteGPU = 0x00000000, + IntegratedGPU = 0x00000001, + CPU = 0x00000002, + Unknown = 0x00000003, +}; + +enum class AddressMode : uint32_t { + Repeat = 0x00000000, + MirrorRepeat = 0x00000001, + ClampToEdge = 0x00000002, +}; + +enum class AlphaMode : uint32_t { + Premultiplied = 0x00000000, + Unpremultiplied = 0x00000001, + Opaque = 0x00000002, +}; + +enum class BackendType : uint32_t { + Undefined = 0x00000000, + Null = 0x00000001, + WebGPU = 0x00000002, + D3D11 = 0x00000003, + D3D12 = 0x00000004, + Metal = 0x00000005, + Vulkan = 0x00000006, + OpenGL = 0x00000007, + OpenGLES = 0x00000008, +}; + +enum class BlendFactor : uint32_t { + Zero = 0x00000000, + One = 0x00000001, + Src = 0x00000002, + OneMinusSrc = 0x00000003, + SrcAlpha = 0x00000004, + OneMinusSrcAlpha = 0x00000005, + Dst = 0x00000006, + OneMinusDst = 0x00000007, + DstAlpha = 0x00000008, + OneMinusDstAlpha = 0x00000009, + SrcAlphaSaturated = 0x0000000A, + Constant = 0x0000000B, + OneMinusConstant = 0x0000000C, + Src1 = 0x0000000D, + OneMinusSrc1 = 0x0000000E, + Src1Alpha = 0x0000000F, + OneMinusSrc1Alpha = 0x00000010, +}; + +enum class BlendOperation : uint32_t { + Add = 0x00000000, + Subtract = 0x00000001, + ReverseSubtract = 0x00000002, + Min = 0x00000003, + Max = 0x00000004, +}; + +enum class BufferBindingType : uint32_t { + Undefined = 0x00000000, + Uniform = 0x00000001, + Storage = 0x00000002, + ReadOnlyStorage = 0x00000003, +}; + +enum class BufferMapAsyncStatus : uint32_t { + Success = 0x00000000, + ValidationError = 0x00000001, + Unknown = 0x00000002, + DeviceLost = 0x00000003, + DestroyedBeforeCallback = 0x00000004, + UnmappedBeforeCallback = 0x00000005, + MappingAlreadyPending = 0x00000006, + OffsetOutOfRange = 0x00000007, + SizeOutOfRange = 0x00000008, +}; + +enum class BufferMapState : uint32_t { + Unmapped = 0x00000000, + Pending = 0x00000001, + Mapped = 0x00000002, +}; + +enum class CallbackMode : uint32_t { + WaitAnyOnly = 0x00000000, + AllowProcessEvents = 0x00000001, + AllowSpontaneous = 0x00000002, +}; + +enum class CompareFunction : uint32_t { + Undefined = 0x00000000, + Never = 0x00000001, + Less = 0x00000002, + LessEqual = 0x00000003, + Greater = 0x00000004, + GreaterEqual = 0x00000005, + Equal = 0x00000006, + NotEqual = 0x00000007, + Always = 0x00000008, +}; + +enum class CompilationInfoRequestStatus : uint32_t { + Success = 0x00000000, + Error = 0x00000001, + DeviceLost = 0x00000002, + Unknown = 0x00000003, +}; + +enum class CompilationMessageType : uint32_t { + Error = 0x00000000, + Warning = 0x00000001, + Info = 0x00000002, +}; + +enum class CreatePipelineAsyncStatus : uint32_t { + Success = 0x00000000, + ValidationError = 0x00000001, + InternalError = 0x00000002, + DeviceLost = 0x00000003, + DeviceDestroyed = 0x00000004, + Unknown = 0x00000005, +}; + +enum class CullMode : uint32_t { + None = 0x00000000, + Front = 0x00000001, + Back = 0x00000002, +}; + +enum class DeviceLostReason : uint32_t { + Undefined = 0x00000000, + Destroyed = 0x00000001, +}; + +enum class ErrorFilter : uint32_t { + Validation = 0x00000000, + OutOfMemory = 0x00000001, + Internal = 0x00000002, +}; + +enum class ErrorType : uint32_t { + NoError = 0x00000000, + Validation = 0x00000001, + OutOfMemory = 0x00000002, + Internal = 0x00000003, + Unknown = 0x00000004, + DeviceLost = 0x00000005, +}; + +enum class ExternalTextureRotation : uint32_t { + Rotate0Degrees = 0x00000000, + Rotate90Degrees = 0x00000001, + Rotate180Degrees = 0x00000002, + Rotate270Degrees = 0x00000003, +}; + +enum class FeatureName : uint32_t { + Undefined = 0x00000000, + DepthClipControl = 0x00000001, + Depth32FloatStencil8 = 0x00000002, + TimestampQuery = 0x00000003, + TextureCompressionBC = 0x00000004, + TextureCompressionETC2 = 0x00000005, + TextureCompressionASTC = 0x00000006, + IndirectFirstInstance = 0x00000007, + ShaderF16 = 0x00000008, + RG11B10UfloatRenderable = 0x00000009, + BGRA8UnormStorage = 0x0000000A, + Float32Filterable = 0x0000000B, + DawnInternalUsages = 0x000003EA, + DawnMultiPlanarFormats = 0x000003EB, + DawnNative = 0x000003EC, + ChromiumExperimentalDp4a = 0x000003ED, + ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, + ImplicitDeviceSynchronization = 0x000003EF, + SurfaceCapabilities = 0x000003F0, + TransientAttachments = 0x000003F1, + MSAARenderToSingleSampled = 0x000003F2, + DualSourceBlending = 0x000003F3, + D3D11MultithreadProtected = 0x000003F4, + ANGLETextureSharing = 0x000003F5, + ChromiumExperimentalSubgroups = 0x000003F6, + ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, + PixelLocalStorageCoherent = 0x000003F9, + PixelLocalStorageNonCoherent = 0x000003FA, + Norm16TextureFormats = 0x000003FB, + MultiPlanarFormatExtendedUsages = 0x000003FC, + MultiPlanarFormatP010 = 0x000003FD, + HostMappedPointer = 0x000003FE, + MultiPlanarRenderTargets = 0x000003FF, + MultiPlanarFormatNv12a = 0x00000400, + FramebufferFetch = 0x00000401, + BufferMapExtendedUsages = 0x00000402, + AdapterPropertiesMemoryHeaps = 0x00000403, + SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, + SharedTextureMemoryAHardwareBuffer = 0x0000044D, + SharedTextureMemoryDmaBuf = 0x0000044E, + SharedTextureMemoryOpaqueFD = 0x0000044F, + SharedTextureMemoryZirconHandle = 0x00000450, + SharedTextureMemoryDXGISharedHandle = 0x00000451, + SharedTextureMemoryD3D11Texture2D = 0x00000452, + SharedTextureMemoryIOSurface = 0x00000453, + SharedTextureMemoryEGLImage = 0x00000454, + SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, + SharedFenceVkSemaphoreSyncFD = 0x000004B1, + SharedFenceVkSemaphoreZirconHandle = 0x000004B2, + SharedFenceDXGISharedHandle = 0x000004B3, + SharedFenceMTLSharedEvent = 0x000004B4, +}; + +enum class FilterMode : uint32_t { + Nearest = 0x00000000, + Linear = 0x00000001, +}; + +enum class FrontFace : uint32_t { + CCW = 0x00000000, + CW = 0x00000001, +}; + +enum class IndexFormat : uint32_t { + Undefined = 0x00000000, + Uint16 = 0x00000001, + Uint32 = 0x00000002, +}; + +enum class LoadOp : uint32_t { + Undefined = 0x00000000, + Clear = 0x00000001, + Load = 0x00000002, +}; + +enum class LoggingType : uint32_t { + Verbose = 0x00000000, + Info = 0x00000001, + Warning = 0x00000002, + Error = 0x00000003, +}; + +enum class MipmapFilterMode : uint32_t { + Nearest = 0x00000000, + Linear = 0x00000001, +}; + +enum class PowerPreference : uint32_t { + Undefined = 0x00000000, + LowPower = 0x00000001, + HighPerformance = 0x00000002, +}; + +enum class PresentMode : uint32_t { + Fifo = 0x00000000, + Immediate = 0x00000002, + Mailbox = 0x00000003, +}; + +enum class PrimitiveTopology : uint32_t { + PointList = 0x00000000, + LineList = 0x00000001, + LineStrip = 0x00000002, + TriangleList = 0x00000003, + TriangleStrip = 0x00000004, +}; + +enum class QueryType : uint32_t { + Occlusion = 0x00000000, + Timestamp = 0x00000001, +}; + +enum class QueueWorkDoneStatus : uint32_t { + Success = 0x00000000, + Error = 0x00000001, + Unknown = 0x00000002, + DeviceLost = 0x00000003, +}; + +enum class RequestAdapterStatus : uint32_t { + Success = 0x00000000, + Unavailable = 0x00000001, + Error = 0x00000002, + Unknown = 0x00000003, +}; + +enum class RequestDeviceStatus : uint32_t { + Success = 0x00000000, + Error = 0x00000001, + Unknown = 0x00000002, +}; + +enum class SType : uint32_t { + Invalid = 0x00000000, + SurfaceDescriptorFromMetalLayer = 0x00000001, + SurfaceDescriptorFromWindowsHWND = 0x00000002, + SurfaceDescriptorFromXlibWindow = 0x00000003, + SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, + ShaderModuleSPIRVDescriptor = 0x00000005, + ShaderModuleWGSLDescriptor = 0x00000006, + PrimitiveDepthClipControl = 0x00000007, + SurfaceDescriptorFromWaylandSurface = 0x00000008, + SurfaceDescriptorFromAndroidNativeWindow = 0x00000009, + SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, + ExternalTextureBindingEntry = 0x0000000C, + ExternalTextureBindingLayout = 0x0000000D, + SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, + RenderPassDescriptorMaxDrawCount = 0x0000000F, + DepthStencilStateDepthWriteDefinedDawn = 0x00000010, + TextureBindingViewDimensionDescriptor = 0x00000011, + DawnTextureInternalUsageDescriptor = 0x000003E8, + DawnEncoderInternalUsageDescriptor = 0x000003EB, + DawnInstanceDescriptor = 0x000003EC, + DawnCacheDeviceDescriptor = 0x000003ED, + DawnAdapterPropertiesPowerPreference = 0x000003EE, + DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, + DawnTogglesDescriptor = 0x000003F0, + DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, + RequestAdapterOptionsLUID = 0x000003F2, + RequestAdapterOptionsGetGLProc = 0x000003F3, + RequestAdapterOptionsD3D11Device = 0x000003F4, + DawnMultisampleStateRenderToSingleSampled = 0x000003F5, + DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, + RenderPassPixelLocalStorage = 0x000003F7, + PipelineLayoutPixelLocalStorage = 0x000003F8, + BufferHostMappedPointer = 0x000003F9, + DawnExperimentalSubgroupLimits = 0x000003FA, + AdapterPropertiesMemoryHeaps = 0x000003FB, + DawnComputePipelineFullSubgroups = 0x000003FC, + SharedTextureMemoryVkImageDescriptor = 0x0000044C, + SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, + SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, + SharedTextureMemoryDmaBufDescriptor = 0x0000044F, + SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, + SharedTextureMemoryZirconHandleDescriptor = 0x00000451, + SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, + SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, + SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, + SharedTextureMemoryEGLImageDescriptor = 0x00000455, + SharedTextureMemoryInitializedBeginState = 0x000004B0, + SharedTextureMemoryInitializedEndState = 0x000004B1, + SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, + SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, + SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, + SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, + SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, + SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, + SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, + SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, + SharedFenceDXGISharedHandleDescriptor = 0x000004BA, + SharedFenceDXGISharedHandleExportInfo = 0x000004BB, + SharedFenceMTLSharedEventDescriptor = 0x000004BC, + SharedFenceMTLSharedEventExportInfo = 0x000004BD, +}; + +enum class SamplerBindingType : uint32_t { + Undefined = 0x00000000, + Filtering = 0x00000001, + NonFiltering = 0x00000002, + Comparison = 0x00000003, +}; + +enum class SharedFenceType : uint32_t { + Undefined = 0x00000000, + VkSemaphoreOpaqueFD = 0x00000001, + VkSemaphoreSyncFD = 0x00000002, + VkSemaphoreZirconHandle = 0x00000003, + DXGISharedHandle = 0x00000004, + MTLSharedEvent = 0x00000005, +}; + +enum class StencilOperation : uint32_t { + Keep = 0x00000000, + Zero = 0x00000001, + Replace = 0x00000002, + Invert = 0x00000003, + IncrementClamp = 0x00000004, + DecrementClamp = 0x00000005, + IncrementWrap = 0x00000006, + DecrementWrap = 0x00000007, +}; + +enum class StorageTextureAccess : uint32_t { + Undefined = 0x00000000, + WriteOnly = 0x00000001, + ReadOnly = 0x00000002, + ReadWrite = 0x00000003, +}; + +enum class StoreOp : uint32_t { + Undefined = 0x00000000, + Store = 0x00000001, + Discard = 0x00000002, +}; + +enum class TextureAspect : uint32_t { + All = 0x00000000, + StencilOnly = 0x00000001, + DepthOnly = 0x00000002, + Plane0Only = 0x00000003, + Plane1Only = 0x00000004, + Plane2Only = 0x00000005, +}; + +enum class TextureDimension : uint32_t { + e1D = 0x00000000, + e2D = 0x00000001, + e3D = 0x00000002, +}; + +enum class TextureFormat : uint32_t { + Undefined = 0x00000000, + R8Unorm = 0x00000001, + R8Snorm = 0x00000002, + R8Uint = 0x00000003, + R8Sint = 0x00000004, + R16Uint = 0x00000005, + R16Sint = 0x00000006, + R16Float = 0x00000007, + RG8Unorm = 0x00000008, + RG8Snorm = 0x00000009, + RG8Uint = 0x0000000A, + RG8Sint = 0x0000000B, + R32Float = 0x0000000C, + R32Uint = 0x0000000D, + R32Sint = 0x0000000E, + RG16Uint = 0x0000000F, + RG16Sint = 0x00000010, + RG16Float = 0x00000011, + RGBA8Unorm = 0x00000012, + RGBA8UnormSrgb = 0x00000013, + RGBA8Snorm = 0x00000014, + RGBA8Uint = 0x00000015, + RGBA8Sint = 0x00000016, + BGRA8Unorm = 0x00000017, + BGRA8UnormSrgb = 0x00000018, + RGB10A2Uint = 0x00000019, + RGB10A2Unorm = 0x0000001A, + RG11B10Ufloat = 0x0000001B, + RGB9E5Ufloat = 0x0000001C, + RG32Float = 0x0000001D, + RG32Uint = 0x0000001E, + RG32Sint = 0x0000001F, + RGBA16Uint = 0x00000020, + RGBA16Sint = 0x00000021, + RGBA16Float = 0x00000022, + RGBA32Float = 0x00000023, + RGBA32Uint = 0x00000024, + RGBA32Sint = 0x00000025, + Stencil8 = 0x00000026, + Depth16Unorm = 0x00000027, + Depth24Plus = 0x00000028, + Depth24PlusStencil8 = 0x00000029, + Depth32Float = 0x0000002A, + Depth32FloatStencil8 = 0x0000002B, + BC1RGBAUnorm = 0x0000002C, + BC1RGBAUnormSrgb = 0x0000002D, + BC2RGBAUnorm = 0x0000002E, + BC2RGBAUnormSrgb = 0x0000002F, + BC3RGBAUnorm = 0x00000030, + BC3RGBAUnormSrgb = 0x00000031, + BC4RUnorm = 0x00000032, + BC4RSnorm = 0x00000033, + BC5RGUnorm = 0x00000034, + BC5RGSnorm = 0x00000035, + BC6HRGBUfloat = 0x00000036, + BC6HRGBFloat = 0x00000037, + BC7RGBAUnorm = 0x00000038, + BC7RGBAUnormSrgb = 0x00000039, + ETC2RGB8Unorm = 0x0000003A, + ETC2RGB8UnormSrgb = 0x0000003B, + ETC2RGB8A1Unorm = 0x0000003C, + ETC2RGB8A1UnormSrgb = 0x0000003D, + ETC2RGBA8Unorm = 0x0000003E, + ETC2RGBA8UnormSrgb = 0x0000003F, + EACR11Unorm = 0x00000040, + EACR11Snorm = 0x00000041, + EACRG11Unorm = 0x00000042, + EACRG11Snorm = 0x00000043, + ASTC4x4Unorm = 0x00000044, + ASTC4x4UnormSrgb = 0x00000045, + ASTC5x4Unorm = 0x00000046, + ASTC5x4UnormSrgb = 0x00000047, + ASTC5x5Unorm = 0x00000048, + ASTC5x5UnormSrgb = 0x00000049, + ASTC6x5Unorm = 0x0000004A, + ASTC6x5UnormSrgb = 0x0000004B, + ASTC6x6Unorm = 0x0000004C, + ASTC6x6UnormSrgb = 0x0000004D, + ASTC8x5Unorm = 0x0000004E, + ASTC8x5UnormSrgb = 0x0000004F, + ASTC8x6Unorm = 0x00000050, + ASTC8x6UnormSrgb = 0x00000051, + ASTC8x8Unorm = 0x00000052, + ASTC8x8UnormSrgb = 0x00000053, + ASTC10x5Unorm = 0x00000054, + ASTC10x5UnormSrgb = 0x00000055, + ASTC10x6Unorm = 0x00000056, + ASTC10x6UnormSrgb = 0x00000057, + ASTC10x8Unorm = 0x00000058, + ASTC10x8UnormSrgb = 0x00000059, + ASTC10x10Unorm = 0x0000005A, + ASTC10x10UnormSrgb = 0x0000005B, + ASTC12x10Unorm = 0x0000005C, + ASTC12x10UnormSrgb = 0x0000005D, + ASTC12x12Unorm = 0x0000005E, + ASTC12x12UnormSrgb = 0x0000005F, + R16Unorm = 0x00000060, + RG16Unorm = 0x00000061, + RGBA16Unorm = 0x00000062, + R16Snorm = 0x00000063, + RG16Snorm = 0x00000064, + RGBA16Snorm = 0x00000065, + R8BG8Biplanar420Unorm = 0x00000066, + R10X6BG10X6Biplanar420Unorm = 0x00000067, + R8BG8A8Triplanar420Unorm = 0x00000068, +}; + +enum class TextureSampleType : uint32_t { + Undefined = 0x00000000, + Float = 0x00000001, + UnfilterableFloat = 0x00000002, + Depth = 0x00000003, + Sint = 0x00000004, + Uint = 0x00000005, +}; + +enum class TextureViewDimension : uint32_t { + Undefined = 0x00000000, + e1D = 0x00000001, + e2D = 0x00000002, + e2DArray = 0x00000003, + Cube = 0x00000004, + CubeArray = 0x00000005, + e3D = 0x00000006, +}; + +enum class VertexFormat : uint32_t { + Undefined = 0x00000000, + Uint8x2 = 0x00000001, + Uint8x4 = 0x00000002, + Sint8x2 = 0x00000003, + Sint8x4 = 0x00000004, + Unorm8x2 = 0x00000005, + Unorm8x4 = 0x00000006, + Snorm8x2 = 0x00000007, + Snorm8x4 = 0x00000008, + Uint16x2 = 0x00000009, + Uint16x4 = 0x0000000A, + Sint16x2 = 0x0000000B, + Sint16x4 = 0x0000000C, + Unorm16x2 = 0x0000000D, + Unorm16x4 = 0x0000000E, + Snorm16x2 = 0x0000000F, + Snorm16x4 = 0x00000010, + Float16x2 = 0x00000011, + Float16x4 = 0x00000012, + Float32 = 0x00000013, + Float32x2 = 0x00000014, + Float32x3 = 0x00000015, + Float32x4 = 0x00000016, + Uint32 = 0x00000017, + Uint32x2 = 0x00000018, + Uint32x3 = 0x00000019, + Uint32x4 = 0x0000001A, + Sint32 = 0x0000001B, + Sint32x2 = 0x0000001C, + Sint32x3 = 0x0000001D, + Sint32x4 = 0x0000001E, + Unorm10_10_10_2 = 0x0000001F, +}; + +enum class VertexStepMode : uint32_t { + Vertex = 0x00000000, + Instance = 0x00000001, + VertexBufferNotUsed = 0x00000002, +}; + +enum class WaitStatus : uint32_t { + Success = 0x00000000, + TimedOut = 0x00000001, + UnsupportedTimeout = 0x00000002, + UnsupportedCount = 0x00000003, + UnsupportedMixedSources = 0x00000004, + Unknown = 0x00000005, +}; + +enum class BufferUsage : uint32_t { + None = 0x00000000, + MapRead = 0x00000001, + MapWrite = 0x00000002, + CopySrc = 0x00000004, + CopyDst = 0x00000008, + Index = 0x00000010, + Vertex = 0x00000020, + Uniform = 0x00000040, + Storage = 0x00000080, + Indirect = 0x00000100, + QueryResolve = 0x00000200, +}; + +enum class ColorWriteMask : uint32_t { + None = 0x00000000, + Red = 0x00000001, + Green = 0x00000002, + Blue = 0x00000004, + Alpha = 0x00000008, + All = 0x0000000F, +}; + +enum class HeapProperty : uint32_t { + Undefined = 0x00000000, + DeviceLocal = 0x00000001, + HostVisible = 0x00000002, + HostCoherent = 0x00000004, + HostUncached = 0x00000008, + HostCached = 0x00000010, +}; + +enum class MapMode : uint32_t { + None = 0x00000000, + Read = 0x00000001, + Write = 0x00000002, +}; + +enum class ShaderStage : uint32_t { + None = 0x00000000, + Vertex = 0x00000001, + Fragment = 0x00000002, + Compute = 0x00000004, +}; + +enum class TextureUsage : uint32_t { + None = 0x00000000, + CopySrc = 0x00000001, + CopyDst = 0x00000002, + TextureBinding = 0x00000004, + StorageBinding = 0x00000008, + RenderAttachment = 0x00000010, + TransientAttachment = 0x00000020, + StorageAttachment = 0x00000040, +}; + +using BufferMapCallback = WGPUBufferMapCallback; +using Callback = WGPUCallback; +using CompilationInfoCallback = WGPUCompilationInfoCallback; +using CreateComputePipelineAsyncCallback = + WGPUCreateComputePipelineAsyncCallback; +using CreateRenderPipelineAsyncCallback = WGPUCreateRenderPipelineAsyncCallback; +using DeviceLostCallback = WGPUDeviceLostCallback; +using ErrorCallback = WGPUErrorCallback; +using LoggingCallback = WGPULoggingCallback; +using Proc = WGPUProc; +using QueueWorkDoneCallback = WGPUQueueWorkDoneCallback; +using RequestAdapterCallback = WGPURequestAdapterCallback; +using RequestDeviceCallback = WGPURequestDeviceCallback; + +class Adapter; +class BindGroup; +class BindGroupLayout; +class Buffer; +class CommandBuffer; +class CommandEncoder; +class ComputePassEncoder; +class ComputePipeline; +class Device; +class ExternalTexture; +class Instance; +class PipelineLayout; +class QuerySet; +class Queue; +class RenderBundle; +class RenderBundleEncoder; +class RenderPassEncoder; +class RenderPipeline; +class Sampler; +class ShaderModule; +class SharedFence; +class SharedTextureMemory; +class Surface; +class SwapChain; +class Texture; +class TextureView; + +struct AdapterProperties; +struct BindGroupEntry; +struct BlendComponent; +struct BufferBindingLayout; +struct BufferDescriptor; +struct BufferHostMappedPointer; +struct BufferMapCallbackInfo; +struct Color; +struct CommandBufferDescriptor; +struct CommandEncoderDescriptor; +struct CompilationMessage; +struct ComputePassTimestampWrites; +struct ConstantEntry; +struct CopyTextureForBrowserOptions; +struct DawnAdapterPropertiesPowerPreference; +struct DawnBufferDescriptorErrorInfoFromWireClient; +struct DawnCacheDeviceDescriptor; +struct DawnComputePipelineFullSubgroups; +struct DawnEncoderInternalUsageDescriptor; +struct DawnExperimentalSubgroupLimits; +struct DawnMultisampleStateRenderToSingleSampled; +struct DawnRenderPassColorAttachmentRenderToSingleSampled; +struct DawnShaderModuleSPIRVOptionsDescriptor; +struct DawnTextureInternalUsageDescriptor; +struct DawnTogglesDescriptor; +struct DepthStencilStateDepthWriteDefinedDawn; +struct Extent2D; +struct Extent3D; +struct ExternalTextureBindingEntry; +struct ExternalTextureBindingLayout; +struct Future; +struct InstanceFeatures; +struct Limits; +struct MemoryHeapInfo; +struct MultisampleState; +struct Origin2D; +struct Origin3D; +struct PipelineLayoutDescriptor; +struct PipelineLayoutStorageAttachment; +struct PrimitiveDepthClipControl; +struct PrimitiveState; +struct QuerySetDescriptor; +struct QueueDescriptor; +struct QueueWorkDoneCallbackInfo; +struct RenderBundleDescriptor; +struct RenderBundleEncoderDescriptor; +struct RenderPassDepthStencilAttachment; +struct RenderPassDescriptorMaxDrawCount; +struct RenderPassTimestampWrites; +struct RequestAdapterCallbackInfo; +struct RequestAdapterOptions; +struct SamplerBindingLayout; +struct SamplerDescriptor; +struct ShaderModuleSPIRVDescriptor; +struct ShaderModuleWGSLDescriptor; +struct ShaderModuleDescriptor; +struct SharedFenceDXGISharedHandleDescriptor; +struct SharedFenceDXGISharedHandleExportInfo; +struct SharedFenceMTLSharedEventDescriptor; +struct SharedFenceMTLSharedEventExportInfo; +struct SharedFenceDescriptor; +struct SharedFenceExportInfo; +struct SharedFenceVkSemaphoreOpaqueFDDescriptor; +struct SharedFenceVkSemaphoreOpaqueFDExportInfo; +struct SharedFenceVkSemaphoreSyncFDDescriptor; +struct SharedFenceVkSemaphoreSyncFDExportInfo; +struct SharedFenceVkSemaphoreZirconHandleDescriptor; +struct SharedFenceVkSemaphoreZirconHandleExportInfo; +struct SharedTextureMemoryDXGISharedHandleDescriptor; +struct SharedTextureMemoryEGLImageDescriptor; +struct SharedTextureMemoryIOSurfaceDescriptor; +struct SharedTextureMemoryAHardwareBufferDescriptor; +struct SharedTextureMemoryBeginAccessDescriptor; +struct SharedTextureMemoryDescriptor; +struct SharedTextureMemoryDmaBufPlane; +struct SharedTextureMemoryEndAccessState; +struct SharedTextureMemoryOpaqueFDDescriptor; +struct SharedTextureMemoryVkDedicatedAllocationDescriptor; +struct SharedTextureMemoryVkImageLayoutBeginState; +struct SharedTextureMemoryVkImageLayoutEndState; +struct SharedTextureMemoryZirconHandleDescriptor; +struct StencilFaceState; +struct StorageTextureBindingLayout; +struct SurfaceDescriptor; +struct SurfaceDescriptorFromAndroidNativeWindow; +struct SurfaceDescriptorFromCanvasHTMLSelector; +struct SurfaceDescriptorFromMetalLayer; +struct SurfaceDescriptorFromWaylandSurface; +struct SurfaceDescriptorFromWindowsHWND; +struct SurfaceDescriptorFromWindowsCoreWindow; +struct SurfaceDescriptorFromWindowsSwapChainPanel; +struct SurfaceDescriptorFromXlibWindow; +struct SwapChainDescriptor; +struct TextureBindingLayout; +struct TextureBindingViewDimensionDescriptor; +struct TextureDataLayout; +struct TextureViewDescriptor; +struct VertexAttribute; +struct AdapterPropertiesMemoryHeaps; +struct BindGroupDescriptor; +struct BindGroupLayoutEntry; +struct BlendState; +struct CompilationInfo; +struct ComputePassDescriptor; +struct DepthStencilState; +struct ExternalTextureDescriptor; +struct FutureWaitInfo; +struct ImageCopyBuffer; +struct ImageCopyExternalTexture; +struct ImageCopyTexture; +struct InstanceDescriptor; +struct PipelineLayoutPixelLocalStorage; +struct ProgrammableStageDescriptor; +struct RenderPassColorAttachment; +struct RenderPassStorageAttachment; +struct RequiredLimits; +struct SharedTextureMemoryDmaBufDescriptor; +struct SharedTextureMemoryProperties; +struct SharedTextureMemoryVkImageDescriptor; +struct SupportedLimits; +struct TextureDescriptor; +struct VertexBufferLayout; +struct BindGroupLayoutDescriptor; +struct ColorTargetState; +struct ComputePipelineDescriptor; +struct DeviceDescriptor; +struct RenderPassDescriptor; +struct RenderPassPixelLocalStorage; +struct VertexState; +struct FragmentState; +struct RenderPipelineDescriptor; + +// Special class for booleans in order to allow implicit conversions. +class Bool { +public: + constexpr Bool() = default; + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction + constexpr Bool(bool value) : mValue(static_cast(value)) {} + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction + Bool(WGPUBool value) : mValue(value) {} + + constexpr operator bool() const { return static_cast(mValue); } + +private: + friend struct std::hash; + // Default to false. + WGPUBool mValue = static_cast(false); +}; + +template class ObjectBase { +public: + ObjectBase() = default; + ObjectBase(CType handle) : mHandle(handle) { + if (mHandle) + Derived::WGPUReference(mHandle); + } + ~ObjectBase() { + if (mHandle) + Derived::WGPURelease(mHandle); + } + + ObjectBase(ObjectBase const &other) : ObjectBase(other.Get()) {} + Derived &operator=(ObjectBase const &other) { + if (&other != this) { + if (mHandle) + Derived::WGPURelease(mHandle); + mHandle = other.mHandle; + if (mHandle) + Derived::WGPUReference(mHandle); + } + + return static_cast(*this); + } + + ObjectBase(ObjectBase &&other) { + mHandle = other.mHandle; + other.mHandle = 0; + } + Derived &operator=(ObjectBase &&other) { + if (&other != this) { + if (mHandle) + Derived::WGPURelease(mHandle); + mHandle = other.mHandle; + other.mHandle = 0; + } + + return static_cast(*this); + } + + ObjectBase(std::nullptr_t) {} + Derived &operator=(std::nullptr_t) { + if (mHandle != nullptr) { + Derived::WGPURelease(mHandle); + mHandle = nullptr; + } + return static_cast(*this); + } + + bool operator==(std::nullptr_t) const { return mHandle == nullptr; } + bool operator!=(std::nullptr_t) const { return mHandle != nullptr; } + + explicit operator bool() const { return mHandle != nullptr; } + CType Get() const { return mHandle; } + CType MoveToCHandle() { + CType result = mHandle; + mHandle = 0; + return result; + } + static Derived Acquire(CType handle) { + Derived result; + result.mHandle = handle; + return result; + } + +protected: + CType mHandle = nullptr; +}; + +class Adapter : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Device CreateDevice(DeviceDescriptor const *descriptor = nullptr) const; + size_t EnumerateFeatures(FeatureName *features) const; + Instance GetInstance() const; + Bool GetLimits(SupportedLimits *limits) const; + void GetProperties(AdapterProperties *properties) const; + Bool HasFeature(FeatureName feature) const; + void RequestDevice(DeviceDescriptor const *descriptor, + RequestDeviceCallback callback, void *userdata) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUAdapter handle); + static void WGPURelease(WGPUAdapter handle); +}; + +class BindGroup : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUBindGroup handle); + static void WGPURelease(WGPUBindGroup handle); +}; + +class BindGroupLayout + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUBindGroupLayout handle); + static void WGPURelease(WGPUBindGroupLayout handle); +}; + +class Buffer : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + void const *GetConstMappedRange(size_t offset = 0, + size_t size = WGPU_WHOLE_MAP_SIZE) const; + BufferMapState GetMapState() const; + void *GetMappedRange(size_t offset = 0, + size_t size = WGPU_WHOLE_MAP_SIZE) const; + uint64_t GetSize() const; + BufferUsage GetUsage() const; + void MapAsync(MapMode mode, size_t offset, size_t size, + BufferMapCallback callback, void *userdata) const; + Future MapAsyncF(MapMode mode, size_t offset, size_t size, + BufferMapCallbackInfo callbackInfo) const; + void SetLabel(char const *label) const; + void Unmap() const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUBuffer handle); + static void WGPURelease(WGPUBuffer handle); +}; + +class CommandBuffer : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUCommandBuffer handle); + static void WGPURelease(WGPUCommandBuffer handle); +}; + +class CommandEncoder : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + ComputePassEncoder + BeginComputePass(ComputePassDescriptor const *descriptor = nullptr) const; + RenderPassEncoder + BeginRenderPass(RenderPassDescriptor const *descriptor) const; + void ClearBuffer(Buffer const &buffer, uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void CopyBufferToBuffer(Buffer const &source, uint64_t sourceOffset, + Buffer const &destination, uint64_t destinationOffset, + uint64_t size) const; + void CopyBufferToTexture(ImageCopyBuffer const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize) const; + void CopyTextureToBuffer(ImageCopyTexture const *source, + ImageCopyBuffer const *destination, + Extent3D const *copySize) const; + void CopyTextureToTexture(ImageCopyTexture const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize) const; + CommandBuffer + Finish(CommandBufferDescriptor const *descriptor = nullptr) const; + void InjectValidationError(char const *message) const; + void InsertDebugMarker(char const *markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void ResolveQuerySet(QuerySet const &querySet, uint32_t firstQuery, + uint32_t queryCount, Buffer const &destination, + uint64_t destinationOffset) const; + void SetLabel(char const *label) const; + void WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, + uint8_t const *data, uint64_t size) const; + void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUCommandEncoder handle); + static void WGPURelease(WGPUCommandEncoder handle); +}; + +class ComputePassEncoder + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void DispatchWorkgroups(uint32_t workgroupCountX, + uint32_t workgroupCountY = 1, + uint32_t workgroupCountZ = 1) const; + void DispatchWorkgroupsIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void End() const; + void InsertDebugMarker(char const *markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const &group, + size_t dynamicOffsetCount = 0, + uint32_t const *dynamicOffsets = nullptr) const; + void SetLabel(char const *label) const; + void SetPipeline(ComputePipeline const &pipeline) const; + void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUComputePassEncoder handle); + static void WGPURelease(WGPUComputePassEncoder handle); +}; + +class ComputePipeline + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUComputePipeline handle); + static void WGPURelease(WGPUComputePipeline handle); +}; + +class Device : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroup CreateBindGroup(BindGroupDescriptor const *descriptor) const; + BindGroupLayout + CreateBindGroupLayout(BindGroupLayoutDescriptor const *descriptor) const; + Buffer CreateBuffer(BufferDescriptor const *descriptor) const; + CommandEncoder CreateCommandEncoder( + CommandEncoderDescriptor const *descriptor = nullptr) const; + ComputePipeline + CreateComputePipeline(ComputePipelineDescriptor const *descriptor) const; + void CreateComputePipelineAsync(ComputePipelineDescriptor const *descriptor, + CreateComputePipelineAsyncCallback callback, + void *userdata) const; + Buffer CreateErrorBuffer(BufferDescriptor const *descriptor) const; + ExternalTexture CreateErrorExternalTexture() const; + ShaderModule CreateErrorShaderModule(ShaderModuleDescriptor const *descriptor, + char const *errorMessage) const; + Texture CreateErrorTexture(TextureDescriptor const *descriptor) const; + ExternalTexture CreateExternalTexture( + ExternalTextureDescriptor const *externalTextureDescriptor) const; + PipelineLayout + CreatePipelineLayout(PipelineLayoutDescriptor const *descriptor) const; + QuerySet CreateQuerySet(QuerySetDescriptor const *descriptor) const; + RenderBundleEncoder CreateRenderBundleEncoder( + RenderBundleEncoderDescriptor const *descriptor) const; + RenderPipeline + CreateRenderPipeline(RenderPipelineDescriptor const *descriptor) const; + void CreateRenderPipelineAsync(RenderPipelineDescriptor const *descriptor, + CreateRenderPipelineAsyncCallback callback, + void *userdata) const; + Sampler CreateSampler(SamplerDescriptor const *descriptor = nullptr) const; + ShaderModule + CreateShaderModule(ShaderModuleDescriptor const *descriptor) const; + SwapChain CreateSwapChain(Surface const &surface, + SwapChainDescriptor const *descriptor) const; + Texture CreateTexture(TextureDescriptor const *descriptor) const; + void Destroy() const; + size_t EnumerateFeatures(FeatureName *features) const; + void ForceLoss(DeviceLostReason type, char const *message) const; + Adapter GetAdapter() const; + Bool GetLimits(SupportedLimits *limits) const; + Queue GetQueue() const; + TextureUsage GetSupportedSurfaceUsage(Surface const &surface) const; + Bool HasFeature(FeatureName feature) const; + SharedFence ImportSharedFence(SharedFenceDescriptor const *descriptor) const; + SharedTextureMemory ImportSharedTextureMemory( + SharedTextureMemoryDescriptor const *descriptor) const; + void InjectError(ErrorType type, char const *message) const; + void PopErrorScope(ErrorCallback callback, void *userdata) const; + void PushErrorScope(ErrorFilter filter) const; + void SetDeviceLostCallback(DeviceLostCallback callback, void *userdata) const; + void SetLabel(char const *label) const; + void SetLoggingCallback(LoggingCallback callback, void *userdata) const; + void SetUncapturedErrorCallback(ErrorCallback callback, void *userdata) const; + void Tick() const; + void ValidateTextureDescriptor(TextureDescriptor const *descriptor) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUDevice handle); + static void WGPURelease(WGPUDevice handle); +}; + +class ExternalTexture + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + void Expire() const; + void Refresh() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUExternalTexture handle); + static void WGPURelease(WGPUExternalTexture handle); +}; + +class Instance : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Surface CreateSurface(SurfaceDescriptor const *descriptor) const; + size_t EnumerateWGSLLanguageFeatures(WGSLFeatureName *features) const; + Bool HasWGSLLanguageFeature(WGSLFeatureName feature) const; + void ProcessEvents() const; + void RequestAdapter(RequestAdapterOptions const *options, + RequestAdapterCallback callback, void *userdata) const; + Future RequestAdapterF(RequestAdapterOptions const *options, + RequestAdapterCallbackInfo callbackInfo) const; + WaitStatus WaitAny(size_t futureCount, FutureWaitInfo *futures, + uint64_t timeoutNS) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUInstance handle); + static void WGPURelease(WGPUInstance handle); +}; + +class PipelineLayout : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUPipelineLayout handle); + static void WGPURelease(WGPUPipelineLayout handle); +}; + +class QuerySet : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + uint32_t GetCount() const; + QueryType GetType() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUQuerySet handle); + static void WGPURelease(WGPUQuerySet handle); +}; + +class Queue : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void CopyExternalTextureForBrowser( + ImageCopyExternalTexture const *source, + ImageCopyTexture const *destination, Extent3D const *copySize, + CopyTextureForBrowserOptions const *options) const; + void CopyTextureForBrowser(ImageCopyTexture const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize, + CopyTextureForBrowserOptions const *options) const; + void OnSubmittedWorkDone(QueueWorkDoneCallback callback, + void *userdata) const; + Future OnSubmittedWorkDoneF(QueueWorkDoneCallbackInfo callbackInfo) const; + void SetLabel(char const *label) const; + void Submit(size_t commandCount, CommandBuffer const *commands) const; + void WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, + void const *data, size_t size) const; + void WriteTexture(ImageCopyTexture const *destination, void const *data, + size_t dataSize, TextureDataLayout const *dataLayout, + Extent3D const *writeSize) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUQueue handle); + static void WGPURelease(WGPUQueue handle); +}; + +class RenderBundle : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderBundle handle); + static void WGPURelease(WGPURenderBundle handle); +}; + +class RenderBundleEncoder + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, + uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, + uint32_t firstIndex = 0, int32_t baseVertex = 0, + uint32_t firstInstance = 0) const; + void DrawIndexedIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void DrawIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + RenderBundle Finish(RenderBundleDescriptor const *descriptor = nullptr) const; + void InsertDebugMarker(char const *markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const &group, + size_t dynamicOffsetCount = 0, + uint32_t const *dynamicOffsets = nullptr) const; + void SetIndexBuffer(Buffer const &buffer, IndexFormat format, + uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void SetLabel(char const *label) const; + void SetPipeline(RenderPipeline const &pipeline) const; + void SetVertexBuffer(uint32_t slot, Buffer const &buffer, uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderBundleEncoder handle); + static void WGPURelease(WGPURenderBundleEncoder handle); +}; + +class RenderPassEncoder + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void BeginOcclusionQuery(uint32_t queryIndex) const; + void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, + uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, + uint32_t firstIndex = 0, int32_t baseVertex = 0, + uint32_t firstInstance = 0) const; + void DrawIndexedIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void DrawIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void End() const; + void EndOcclusionQuery() const; + void ExecuteBundles(size_t bundleCount, RenderBundle const *bundles) const; + void InsertDebugMarker(char const *markerLabel) const; + void PixelLocalStorageBarrier() const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const &group, + size_t dynamicOffsetCount = 0, + uint32_t const *dynamicOffsets = nullptr) const; + void SetBlendConstant(Color const *color) const; + void SetIndexBuffer(Buffer const &buffer, IndexFormat format, + uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void SetLabel(char const *label) const; + void SetPipeline(RenderPipeline const &pipeline) const; + void SetScissorRect(uint32_t x, uint32_t y, uint32_t width, + uint32_t height) const; + void SetStencilReference(uint32_t reference) const; + void SetVertexBuffer(uint32_t slot, Buffer const &buffer, uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void SetViewport(float x, float y, float width, float height, float minDepth, + float maxDepth) const; + void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderPassEncoder handle); + static void WGPURelease(WGPURenderPassEncoder handle); +}; + +class RenderPipeline : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderPipeline handle); + static void WGPURelease(WGPURenderPipeline handle); +}; + +class Sampler : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSampler handle); + static void WGPURelease(WGPUSampler handle); +}; + +class ShaderModule : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void GetCompilationInfo(CompilationInfoCallback callback, + void *userdata) const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUShaderModule handle); + static void WGPURelease(WGPUShaderModule handle); +}; + +class SharedFence : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void ExportInfo(SharedFenceExportInfo *info) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSharedFence handle); + static void WGPURelease(WGPUSharedFence handle); +}; + +class SharedTextureMemory + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Bool + BeginAccess(Texture const &texture, + SharedTextureMemoryBeginAccessDescriptor const *descriptor) const; + Texture CreateTexture(TextureDescriptor const *descriptor = nullptr) const; + Bool EndAccess(Texture const &texture, + SharedTextureMemoryEndAccessState *descriptor) const; + void GetProperties(SharedTextureMemoryProperties *properties) const; + Bool IsDeviceLost() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSharedTextureMemory handle); + static void WGPURelease(WGPUSharedTextureMemory handle); +}; + +class Surface : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSurface handle); + static void WGPURelease(WGPUSurface handle); +}; + +class SwapChain : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Texture GetCurrentTexture() const; + TextureView GetCurrentTextureView() const; + void Present() const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSwapChain handle); + static void WGPURelease(WGPUSwapChain handle); +}; + +class Texture : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + TextureView + CreateView(TextureViewDescriptor const *descriptor = nullptr) const; + void Destroy() const; + uint32_t GetDepthOrArrayLayers() const; + TextureDimension GetDimension() const; + TextureFormat GetFormat() const; + uint32_t GetHeight() const; + uint32_t GetMipLevelCount() const; + uint32_t GetSampleCount() const; + TextureUsage GetUsage() const; + uint32_t GetWidth() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUTexture handle); + static void WGPURelease(WGPUTexture handle); +}; + +class TextureView : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUTextureView handle); + static void WGPURelease(WGPUTextureView handle); +}; + +Instance CreateInstance(InstanceDescriptor const *descriptor = nullptr); +Bool GetInstanceFeatures(InstanceFeatures *features); +Proc GetProcAddress(Device device, char const *procName); + +struct AdapterProperties { + AdapterProperties() = default; + ~AdapterProperties(); + AdapterProperties(const AdapterProperties &) = delete; + AdapterProperties &operator=(const AdapterProperties &) = delete; + AdapterProperties(AdapterProperties &&); + AdapterProperties &operator=(AdapterProperties &&); + ChainedStructOut *nextInChain = nullptr; + uint32_t const vendorID = {}; + char const *const vendorName = nullptr; + char const *const architecture = nullptr; + uint32_t const deviceID = {}; + char const *const name = nullptr; + char const *const driverDescription = nullptr; + AdapterType const adapterType = {}; + BackendType const backendType = {}; + Bool const compatibilityMode = false; +}; + +struct BindGroupEntry { + ChainedStruct const *nextInChain = nullptr; + uint32_t binding; + Buffer buffer; + uint64_t offset = 0; + uint64_t size = WGPU_WHOLE_SIZE; + Sampler sampler; + TextureView textureView; +}; + +struct BlendComponent { + BlendOperation operation = BlendOperation::Add; + BlendFactor srcFactor = BlendFactor::One; + BlendFactor dstFactor = BlendFactor::Zero; +}; + +struct BufferBindingLayout { + ChainedStruct const *nextInChain = nullptr; + BufferBindingType type = BufferBindingType::Undefined; + Bool hasDynamicOffset = false; + uint64_t minBindingSize = 0; +}; + +struct BufferDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + BufferUsage usage; + uint64_t size; + Bool mappedAtCreation = false; +}; + +// Can be chained in BufferDescriptor +struct BufferHostMappedPointer : ChainedStruct { + BufferHostMappedPointer() { sType = SType::BufferHostMappedPointer; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *pointer; + Callback disposeCallback; + void *userdata; +}; + +struct BufferMapCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + BufferMapCallback callback; + void *userdata; +}; + +struct Color { + double r; + double g; + double b; + double a; +}; + +struct CommandBufferDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct CommandEncoderDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct CompilationMessage { + ChainedStruct const *nextInChain = nullptr; + char const *message = nullptr; + CompilationMessageType type; + uint64_t lineNum; + uint64_t linePos; + uint64_t offset; + uint64_t length; + uint64_t utf16LinePos; + uint64_t utf16Offset; + uint64_t utf16Length; +}; + +struct ComputePassTimestampWrites { + QuerySet querySet; + uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; +}; + +struct ConstantEntry { + ChainedStruct const *nextInChain = nullptr; + char const *key; + double value; +}; + +struct CopyTextureForBrowserOptions { + ChainedStruct const *nextInChain = nullptr; + Bool flipY = false; + Bool needsColorSpaceConversion = false; + AlphaMode srcAlphaMode = AlphaMode::Unpremultiplied; + float const *srcTransferFunctionParameters = nullptr; + float const *conversionMatrix = nullptr; + float const *dstTransferFunctionParameters = nullptr; + AlphaMode dstAlphaMode = AlphaMode::Unpremultiplied; + Bool internalUsage = false; +}; + +// Can be chained in AdapterProperties +struct DawnAdapterPropertiesPowerPreference : ChainedStructOut { + DawnAdapterPropertiesPowerPreference() { + sType = SType::DawnAdapterPropertiesPowerPreference; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(PowerPreference)); + alignas(kFirstMemberAlignment) + PowerPreference powerPreference = PowerPreference::Undefined; +}; + +// Can be chained in BufferDescriptor +struct DawnBufferDescriptorErrorInfoFromWireClient : ChainedStruct { + DawnBufferDescriptorErrorInfoFromWireClient() { + sType = SType::DawnBufferDescriptorErrorInfoFromWireClient; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool outOfMemory = false; +}; + +// Can be chained in DeviceDescriptor +struct DawnCacheDeviceDescriptor : ChainedStruct { + DawnCacheDeviceDescriptor() { sType = SType::DawnCacheDeviceDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); + alignas(kFirstMemberAlignment) char const *isolationKey = ""; +}; + +// Can be chained in ComputePipelineDescriptor +struct DawnComputePipelineFullSubgroups : ChainedStruct { + DawnComputePipelineFullSubgroups() { + sType = SType::DawnComputePipelineFullSubgroups; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool requiresFullSubgroups = false; +}; + +// Can be chained in CommandEncoderDescriptor +struct DawnEncoderInternalUsageDescriptor : ChainedStruct { + DawnEncoderInternalUsageDescriptor() { + sType = SType::DawnEncoderInternalUsageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool useInternalUsages = false; +}; + +// Can be chained in SupportedLimits +struct DawnExperimentalSubgroupLimits : ChainedStructOut { + DawnExperimentalSubgroupLimits() { + sType = SType::DawnExperimentalSubgroupLimits; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t minSubgroupSize = + WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; +}; + +// Can be chained in MultisampleState +struct DawnMultisampleStateRenderToSingleSampled : ChainedStruct { + DawnMultisampleStateRenderToSingleSampled() { + sType = SType::DawnMultisampleStateRenderToSingleSampled; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool enabled = false; +}; + +// Can be chained in RenderPassColorAttachment +struct DawnRenderPassColorAttachmentRenderToSingleSampled : ChainedStruct { + DawnRenderPassColorAttachmentRenderToSingleSampled() { + sType = SType::DawnRenderPassColorAttachmentRenderToSingleSampled; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t implicitSampleCount = 1; +}; + +// Can be chained in ShaderModuleDescriptor +struct DawnShaderModuleSPIRVOptionsDescriptor : ChainedStruct { + DawnShaderModuleSPIRVOptionsDescriptor() { + sType = SType::DawnShaderModuleSPIRVOptionsDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool allowNonUniformDerivatives = false; +}; + +// Can be chained in TextureDescriptor +struct DawnTextureInternalUsageDescriptor : ChainedStruct { + DawnTextureInternalUsageDescriptor() { + sType = SType::DawnTextureInternalUsageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureUsage)); + alignas(kFirstMemberAlignment) + TextureUsage internalUsage = TextureUsage::None; +}; + +// Can be chained in InstanceDescriptor +// Can be chained in RequestAdapterOptions +// Can be chained in DeviceDescriptor +struct DawnTogglesDescriptor : ChainedStruct { + DawnTogglesDescriptor() { sType = SType::DawnTogglesDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); + alignas(kFirstMemberAlignment) size_t enabledToggleCount = 0; + const char *const *enabledToggles; + size_t disabledToggleCount = 0; + const char *const *disabledToggles; +}; + +// Can be chained in DepthStencilState +struct DepthStencilStateDepthWriteDefinedDawn : ChainedStruct { + DepthStencilStateDepthWriteDefinedDawn() { + sType = SType::DepthStencilStateDepthWriteDefinedDawn; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool depthWriteDefined; +}; + +struct Extent2D { + uint32_t width; + uint32_t height; +}; + +struct Extent3D { + uint32_t width; + uint32_t height = 1; + uint32_t depthOrArrayLayers = 1; +}; + +// Can be chained in BindGroupEntry +struct ExternalTextureBindingEntry : ChainedStruct { + ExternalTextureBindingEntry() { sType = SType::ExternalTextureBindingEntry; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(ExternalTexture)); + alignas(kFirstMemberAlignment) ExternalTexture externalTexture; +}; + +// Can be chained in BindGroupLayoutEntry +struct ExternalTextureBindingLayout : ChainedStruct { + ExternalTextureBindingLayout() { + sType = SType::ExternalTextureBindingLayout; + } +}; + +struct Future { + uint64_t id; +}; + +struct InstanceFeatures { + ChainedStruct const *nextInChain = nullptr; + Bool timedWaitAnyEnable = false; + size_t timedWaitAnyMaxCount = 0; +}; + +struct Limits { + uint32_t maxTextureDimension1D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureDimension3D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureArrayLayers = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindGroups = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindGroupsPlusVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindingsPerBindGroup = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxDynamicUniformBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxDynamicStorageBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSampledTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSamplersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxStorageBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxStorageTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxUniformBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint64_t maxUniformBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; + uint64_t maxStorageBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; + uint32_t minUniformBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; + uint32_t minStorageBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; + uint64_t maxBufferSize = WGPU_LIMIT_U64_UNDEFINED; + uint32_t maxVertexAttributes = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxVertexBufferArrayStride = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxInterStageShaderComponents = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxInterStageShaderVariables = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxColorAttachments = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxColorAttachmentBytesPerSample = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupStorageSize = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeInvocationsPerWorkgroup = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeX = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeY = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeZ = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupsPerDimension = WGPU_LIMIT_U32_UNDEFINED; +}; + +struct MemoryHeapInfo { + HeapProperty properties; + uint64_t size; +}; + +struct MultisampleState { + ChainedStruct const *nextInChain = nullptr; + uint32_t count = 1; + uint32_t mask = 0xFFFFFFFF; + Bool alphaToCoverageEnabled = false; +}; + +struct Origin2D { + uint32_t x = 0; + uint32_t y = 0; +}; + +struct Origin3D { + uint32_t x = 0; + uint32_t y = 0; + uint32_t z = 0; +}; + +struct PipelineLayoutDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t bindGroupLayoutCount; + BindGroupLayout const *bindGroupLayouts; +}; + +struct PipelineLayoutStorageAttachment { + ChainedStruct const *nextInChain = nullptr; + uint64_t offset = 0; + TextureFormat format; +}; + +// Can be chained in PrimitiveState +struct PrimitiveDepthClipControl : ChainedStruct { + PrimitiveDepthClipControl() { sType = SType::PrimitiveDepthClipControl; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool unclippedDepth = false; +}; + +struct PrimitiveState { + ChainedStruct const *nextInChain = nullptr; + PrimitiveTopology topology = PrimitiveTopology::TriangleList; + IndexFormat stripIndexFormat = IndexFormat::Undefined; + FrontFace frontFace = FrontFace::CCW; + CullMode cullMode = CullMode::None; +}; + +struct QuerySetDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + QueryType type; + uint32_t count; +}; + +struct QueueDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct QueueWorkDoneCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + QueueWorkDoneCallback callback; + void *userdata; +}; + +struct RenderBundleDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct RenderBundleEncoderDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t colorFormatCount; + TextureFormat const *colorFormats; + TextureFormat depthStencilFormat = TextureFormat::Undefined; + uint32_t sampleCount = 1; + Bool depthReadOnly = false; + Bool stencilReadOnly = false; +}; + +struct RenderPassDepthStencilAttachment { + TextureView view; + LoadOp depthLoadOp = LoadOp::Undefined; + StoreOp depthStoreOp = StoreOp::Undefined; + float depthClearValue = NAN; + Bool depthReadOnly = false; + LoadOp stencilLoadOp = LoadOp::Undefined; + StoreOp stencilStoreOp = StoreOp::Undefined; + uint32_t stencilClearValue = 0; + Bool stencilReadOnly = false; +}; + +// Can be chained in RenderPassDescriptor +struct RenderPassDescriptorMaxDrawCount : ChainedStruct { + RenderPassDescriptorMaxDrawCount() { + sType = SType::RenderPassDescriptorMaxDrawCount; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); + alignas(kFirstMemberAlignment) uint64_t maxDrawCount = 50000000; +}; + +struct RenderPassTimestampWrites { + QuerySet querySet; + uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; +}; + +struct RequestAdapterCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + RequestAdapterCallback callback; + void *userdata; +}; + +struct RequestAdapterOptions { + ChainedStruct const *nextInChain = nullptr; + Surface compatibleSurface; + PowerPreference powerPreference = PowerPreference::Undefined; + BackendType backendType = BackendType::Undefined; + Bool forceFallbackAdapter = false; + Bool compatibilityMode = false; +}; + +struct SamplerBindingLayout { + ChainedStruct const *nextInChain = nullptr; + SamplerBindingType type = SamplerBindingType::Undefined; +}; + +struct SamplerDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + AddressMode addressModeU = AddressMode::ClampToEdge; + AddressMode addressModeV = AddressMode::ClampToEdge; + AddressMode addressModeW = AddressMode::ClampToEdge; + FilterMode magFilter = FilterMode::Nearest; + FilterMode minFilter = FilterMode::Nearest; + MipmapFilterMode mipmapFilter = MipmapFilterMode::Nearest; + float lodMinClamp = 0.0f; + float lodMaxClamp = 32.0f; + CompareFunction compare = CompareFunction::Undefined; + uint16_t maxAnisotropy = 1; +}; + +// Can be chained in ShaderModuleDescriptor +struct ShaderModuleSPIRVDescriptor : ChainedStruct { + ShaderModuleSPIRVDescriptor() { sType = SType::ShaderModuleSPIRVDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t codeSize; + uint32_t const *code; +}; + +// Can be chained in ShaderModuleDescriptor +struct ShaderModuleWGSLDescriptor : ChainedStruct { + ShaderModuleWGSLDescriptor() { sType = SType::ShaderModuleWGSLDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); + alignas(kFirstMemberAlignment) char const *code; +}; + +struct ShaderModuleDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceDXGISharedHandleDescriptor : ChainedStruct { + SharedFenceDXGISharedHandleDescriptor() { + sType = SType::SharedFenceDXGISharedHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceDXGISharedHandleExportInfo : ChainedStructOut { + SharedFenceDXGISharedHandleExportInfo() { + sType = SType::SharedFenceDXGISharedHandleExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceMTLSharedEventDescriptor : ChainedStruct { + SharedFenceMTLSharedEventDescriptor() { + sType = SType::SharedFenceMTLSharedEventDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *sharedEvent; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceMTLSharedEventExportInfo : ChainedStructOut { + SharedFenceMTLSharedEventExportInfo() { + sType = SType::SharedFenceMTLSharedEventExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *sharedEvent; +}; + +struct SharedFenceDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct SharedFenceExportInfo { + ChainedStructOut *nextInChain = nullptr; + SharedFenceType type; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceVkSemaphoreOpaqueFDDescriptor : ChainedStruct { + SharedFenceVkSemaphoreOpaqueFDDescriptor() { + sType = SType::SharedFenceVkSemaphoreOpaqueFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceVkSemaphoreOpaqueFDExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreOpaqueFDExportInfo() { + sType = SType::SharedFenceVkSemaphoreOpaqueFDExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceVkSemaphoreSyncFDDescriptor : ChainedStruct { + SharedFenceVkSemaphoreSyncFDDescriptor() { + sType = SType::SharedFenceVkSemaphoreSyncFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceVkSemaphoreSyncFDExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreSyncFDExportInfo() { + sType = SType::SharedFenceVkSemaphoreSyncFDExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceVkSemaphoreZirconHandleDescriptor : ChainedStruct { + SharedFenceVkSemaphoreZirconHandleDescriptor() { + sType = SType::SharedFenceVkSemaphoreZirconHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceVkSemaphoreZirconHandleExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreZirconHandleExportInfo() { + sType = SType::SharedFenceVkSemaphoreZirconHandleExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t handle; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryDXGISharedHandleDescriptor : ChainedStruct { + SharedTextureMemoryDXGISharedHandleDescriptor() { + sType = SType::SharedTextureMemoryDXGISharedHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryEGLImageDescriptor : ChainedStruct { + SharedTextureMemoryEGLImageDescriptor() { + sType = SType::SharedTextureMemoryEGLImageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *image; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryIOSurfaceDescriptor : ChainedStruct { + SharedTextureMemoryIOSurfaceDescriptor() { + sType = SType::SharedTextureMemoryIOSurfaceDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *ioSurface; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryAHardwareBufferDescriptor : ChainedStruct { + SharedTextureMemoryAHardwareBufferDescriptor() { + sType = SType::SharedTextureMemoryAHardwareBufferDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +struct SharedTextureMemoryBeginAccessDescriptor { + ChainedStruct const *nextInChain = nullptr; + Bool initialized; + size_t fenceCount; + SharedFence const *fences; + uint64_t const *signaledValues; +}; + +struct SharedTextureMemoryDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct SharedTextureMemoryDmaBufPlane { + int fd; + uint64_t offset; + uint32_t stride; +}; + +struct SharedTextureMemoryEndAccessState { + SharedTextureMemoryEndAccessState() = default; + ~SharedTextureMemoryEndAccessState(); + SharedTextureMemoryEndAccessState(const SharedTextureMemoryEndAccessState &) = + delete; + SharedTextureMemoryEndAccessState & + operator=(const SharedTextureMemoryEndAccessState &) = delete; + SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState &&); + SharedTextureMemoryEndAccessState & + operator=(SharedTextureMemoryEndAccessState &&); + ChainedStructOut *nextInChain = nullptr; + Bool const initialized = {}; + size_t const fenceCount = {}; + SharedFence const *const fences = {}; + uint64_t const *const signaledValues = {}; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryOpaqueFDDescriptor : ChainedStruct { + SharedTextureMemoryOpaqueFDDescriptor() { + sType = SType::SharedTextureMemoryOpaqueFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int memoryFD; + uint64_t allocationSize; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryVkDedicatedAllocationDescriptor : ChainedStruct { + SharedTextureMemoryVkDedicatedAllocationDescriptor() { + sType = SType::SharedTextureMemoryVkDedicatedAllocationDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool dedicatedAllocation; +}; + +// Can be chained in SharedTextureMemoryBeginAccessDescriptor +struct SharedTextureMemoryVkImageLayoutBeginState : ChainedStruct { + SharedTextureMemoryVkImageLayoutBeginState() { + sType = SType::SharedTextureMemoryVkImageLayoutBeginState; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); + alignas(kFirstMemberAlignment) int32_t oldLayout; + int32_t newLayout; +}; + +// Can be chained in SharedTextureMemoryEndAccessState +struct SharedTextureMemoryVkImageLayoutEndState : ChainedStructOut { + SharedTextureMemoryVkImageLayoutEndState() { + sType = SType::SharedTextureMemoryVkImageLayoutEndState; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); + alignas(kFirstMemberAlignment) int32_t oldLayout; + int32_t newLayout; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryZirconHandleDescriptor : ChainedStruct { + SharedTextureMemoryZirconHandleDescriptor() { + sType = SType::SharedTextureMemoryZirconHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t memoryFD; + uint64_t allocationSize; +}; + +struct StencilFaceState { + CompareFunction compare = CompareFunction::Always; + StencilOperation failOp = StencilOperation::Keep; + StencilOperation depthFailOp = StencilOperation::Keep; + StencilOperation passOp = StencilOperation::Keep; +}; + +struct StorageTextureBindingLayout { + ChainedStruct const *nextInChain = nullptr; + StorageTextureAccess access = StorageTextureAccess::Undefined; + TextureFormat format = TextureFormat::Undefined; + TextureViewDimension viewDimension = TextureViewDimension::Undefined; +}; + +struct SurfaceDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromAndroidNativeWindow : ChainedStruct { + SurfaceDescriptorFromAndroidNativeWindow() { + sType = SType::SurfaceDescriptorFromAndroidNativeWindow; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *window; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromCanvasHTMLSelector : ChainedStruct { + SurfaceDescriptorFromCanvasHTMLSelector() { + sType = SType::SurfaceDescriptorFromCanvasHTMLSelector; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); + alignas(kFirstMemberAlignment) char const *selector; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromMetalLayer : ChainedStruct { + SurfaceDescriptorFromMetalLayer() { + sType = SType::SurfaceDescriptorFromMetalLayer; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *layer; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWaylandSurface : ChainedStruct { + SurfaceDescriptorFromWaylandSurface() { + sType = SType::SurfaceDescriptorFromWaylandSurface; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *display; + void *surface; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWindowsHWND : ChainedStruct { + SurfaceDescriptorFromWindowsHWND() { + sType = SType::SurfaceDescriptorFromWindowsHWND; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *hinstance; + void *hwnd; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWindowsCoreWindow : ChainedStruct { + SurfaceDescriptorFromWindowsCoreWindow() { + sType = SType::SurfaceDescriptorFromWindowsCoreWindow; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *coreWindow; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWindowsSwapChainPanel : ChainedStruct { + SurfaceDescriptorFromWindowsSwapChainPanel() { + sType = SType::SurfaceDescriptorFromWindowsSwapChainPanel; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *swapChainPanel; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromXlibWindow : ChainedStruct { + SurfaceDescriptorFromXlibWindow() { + sType = SType::SurfaceDescriptorFromXlibWindow; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *display; + uint64_t window; +}; + +struct SwapChainDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureUsage usage; + TextureFormat format; + uint32_t width; + uint32_t height; + PresentMode presentMode; +}; + +struct TextureBindingLayout { + ChainedStruct const *nextInChain = nullptr; + TextureSampleType sampleType = TextureSampleType::Undefined; + TextureViewDimension viewDimension = TextureViewDimension::Undefined; + Bool multisampled = false; +}; + +// Can be chained in TextureDescriptor +struct TextureBindingViewDimensionDescriptor : ChainedStruct { + TextureBindingViewDimensionDescriptor() { + sType = SType::TextureBindingViewDimensionDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax( + alignof(ChainedStruct), alignof(TextureViewDimension)); + alignas(kFirstMemberAlignment) TextureViewDimension + textureBindingViewDimension = TextureViewDimension::Undefined; +}; + +struct TextureDataLayout { + ChainedStruct const *nextInChain = nullptr; + uint64_t offset = 0; + uint32_t bytesPerRow = WGPU_COPY_STRIDE_UNDEFINED; + uint32_t rowsPerImage = WGPU_COPY_STRIDE_UNDEFINED; +}; + +struct TextureViewDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureFormat format = TextureFormat::Undefined; + TextureViewDimension dimension = TextureViewDimension::Undefined; + uint32_t baseMipLevel = 0; + uint32_t mipLevelCount = WGPU_MIP_LEVEL_COUNT_UNDEFINED; + uint32_t baseArrayLayer = 0; + uint32_t arrayLayerCount = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; + TextureAspect aspect = TextureAspect::All; +}; + +struct VertexAttribute { + VertexFormat format; + uint64_t offset; + uint32_t shaderLocation; +}; + +// Can be chained in AdapterProperties +struct AdapterPropertiesMemoryHeaps : ChainedStructOut { + AdapterPropertiesMemoryHeaps() { + sType = SType::AdapterPropertiesMemoryHeaps; + } + ~AdapterPropertiesMemoryHeaps(); + AdapterPropertiesMemoryHeaps(const AdapterPropertiesMemoryHeaps &) = delete; + AdapterPropertiesMemoryHeaps & + operator=(const AdapterPropertiesMemoryHeaps &) = delete; + AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps &&); + AdapterPropertiesMemoryHeaps &operator=(AdapterPropertiesMemoryHeaps &&); + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); + alignas(kFirstMemberAlignment) size_t const heapCount = {}; + MemoryHeapInfo const *const heapInfo = {}; +}; + +struct BindGroupDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + BindGroupLayout layout; + size_t entryCount; + BindGroupEntry const *entries; +}; + +struct BindGroupLayoutEntry { + ChainedStruct const *nextInChain = nullptr; + uint32_t binding; + ShaderStage visibility; + BufferBindingLayout buffer; + SamplerBindingLayout sampler; + TextureBindingLayout texture; + StorageTextureBindingLayout storageTexture; +}; + +struct BlendState { + BlendComponent color; + BlendComponent alpha; +}; + +struct CompilationInfo { + ChainedStruct const *nextInChain = nullptr; + size_t messageCount; + CompilationMessage const *messages; +}; + +struct ComputePassDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + ComputePassTimestampWrites const *timestampWrites = nullptr; +}; + +struct DepthStencilState { + ChainedStruct const *nextInChain = nullptr; + TextureFormat format; + Bool depthWriteEnabled = false; + CompareFunction depthCompare = CompareFunction::Undefined; + StencilFaceState stencilFront; + StencilFaceState stencilBack; + uint32_t stencilReadMask = 0xFFFFFFFF; + uint32_t stencilWriteMask = 0xFFFFFFFF; + int32_t depthBias = 0; + float depthBiasSlopeScale = 0.0f; + float depthBiasClamp = 0.0f; +}; + +struct ExternalTextureDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureView plane0; + TextureView plane1; + Origin2D visibleOrigin; + Extent2D visibleSize; + Bool doYuvToRgbConversionOnly = false; + float const *yuvToRgbConversionMatrix = nullptr; + float const *srcTransferFunctionParameters; + float const *dstTransferFunctionParameters; + float const *gamutConversionMatrix; + Bool flipY = false; + ExternalTextureRotation rotation = ExternalTextureRotation::Rotate0Degrees; +}; + +struct FutureWaitInfo { + Future future; + Bool completed = false; +}; + +struct ImageCopyBuffer { + ChainedStruct const *nextInChain = nullptr; + TextureDataLayout layout; + Buffer buffer; +}; + +struct ImageCopyExternalTexture { + ChainedStruct const *nextInChain = nullptr; + ExternalTexture externalTexture; + Origin3D origin; + Extent2D naturalSize; +}; + +struct ImageCopyTexture { + ChainedStruct const *nextInChain = nullptr; + Texture texture; + uint32_t mipLevel = 0; + Origin3D origin; + TextureAspect aspect = TextureAspect::All; +}; + +struct InstanceDescriptor { + ChainedStruct const *nextInChain = nullptr; + InstanceFeatures features; +}; + +// Can be chained in PipelineLayoutDescriptor +struct PipelineLayoutPixelLocalStorage : ChainedStruct { + PipelineLayoutPixelLocalStorage() { + sType = SType::PipelineLayoutPixelLocalStorage; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); + alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount = 0; + PipelineLayoutStorageAttachment const *storageAttachments; +}; + +struct ProgrammableStageDescriptor { + ChainedStruct const *nextInChain = nullptr; + ShaderModule module; + char const *entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const *constants; +}; + +struct RenderPassColorAttachment { + ChainedStruct const *nextInChain = nullptr; + TextureView view; + uint32_t depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; + TextureView resolveTarget; + LoadOp loadOp; + StoreOp storeOp; + Color clearValue; +}; + +struct RenderPassStorageAttachment { + ChainedStruct const *nextInChain = nullptr; + uint64_t offset = 0; + TextureView storage; + LoadOp loadOp; + StoreOp storeOp; + Color clearValue; +}; + +struct RequiredLimits { + ChainedStruct const *nextInChain = nullptr; + Limits limits; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryDmaBufDescriptor : ChainedStruct { + SharedTextureMemoryDmaBufDescriptor() { + sType = SType::SharedTextureMemoryDmaBufDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Extent3D)); + alignas(kFirstMemberAlignment) Extent3D size; + uint32_t drmFormat; + uint64_t drmModifier; + size_t planeCount; + SharedTextureMemoryDmaBufPlane const *planes; +}; + +struct SharedTextureMemoryProperties { + ChainedStructOut *nextInChain = nullptr; + TextureUsage usage; + Extent3D size; + TextureFormat format; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryVkImageDescriptor : ChainedStruct { + SharedTextureMemoryVkImageDescriptor() { + sType = SType::SharedTextureMemoryVkImageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); + alignas(kFirstMemberAlignment) int32_t vkFormat; + int32_t vkUsageFlags; + Extent3D vkExtent3D; +}; + +struct SupportedLimits { + ChainedStructOut *nextInChain = nullptr; + Limits limits; +}; + +struct TextureDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureUsage usage; + TextureDimension dimension = TextureDimension::e2D; + Extent3D size; + TextureFormat format; + uint32_t mipLevelCount = 1; + uint32_t sampleCount = 1; + size_t viewFormatCount = 0; + TextureFormat const *viewFormats; +}; + +struct VertexBufferLayout { + uint64_t arrayStride; + VertexStepMode stepMode = VertexStepMode::Vertex; + size_t attributeCount; + VertexAttribute const *attributes; +}; + +struct BindGroupLayoutDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t entryCount; + BindGroupLayoutEntry const *entries; +}; + +struct ColorTargetState { + ChainedStruct const *nextInChain = nullptr; + TextureFormat format; + BlendState const *blend = nullptr; + ColorWriteMask writeMask = ColorWriteMask::All; +}; + +struct ComputePipelineDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + PipelineLayout layout; + ProgrammableStageDescriptor compute; +}; + +struct DeviceDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t requiredFeatureCount = 0; + FeatureName const *requiredFeatures = nullptr; + RequiredLimits const *requiredLimits = nullptr; + QueueDescriptor defaultQueue; + DeviceLostCallback deviceLostCallback = nullptr; + void *deviceLostUserdata = nullptr; +}; + +struct RenderPassDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t colorAttachmentCount; + RenderPassColorAttachment const *colorAttachments; + RenderPassDepthStencilAttachment const *depthStencilAttachment = nullptr; + QuerySet occlusionQuerySet; + RenderPassTimestampWrites const *timestampWrites = nullptr; +}; + +// Can be chained in RenderPassDescriptor +struct RenderPassPixelLocalStorage : ChainedStruct { + RenderPassPixelLocalStorage() { sType = SType::RenderPassPixelLocalStorage; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); + alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount = 0; + RenderPassStorageAttachment const *storageAttachments; +}; + +struct VertexState { + ChainedStruct const *nextInChain = nullptr; + ShaderModule module; + char const *entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const *constants; + size_t bufferCount = 0; + VertexBufferLayout const *buffers; +}; + +struct FragmentState { + ChainedStruct const *nextInChain = nullptr; + ShaderModule module; + char const *entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const *constants; + size_t targetCount; + ColorTargetState const *targets; +}; + +struct RenderPipelineDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + PipelineLayout layout; + VertexState vertex; + PrimitiveState primitive; + DepthStencilState const *depthStencil = nullptr; + MultisampleState multisample; + FragmentState const *fragment = nullptr; +}; + +// The operators of EnumClassBitmmasks in the dawn:: namespace need to be +// imported in the wgpu namespace for Argument Dependent Lookup. +// DAWN_IMPORT_BITMASK_OPERATORS +} // namespace wgpu + +namespace dawn { +// template <> struct IsDawnBitmask { +// static constexpr bool enable = true; +// }; + +// template <> struct IsDawnBitmask { +// static constexpr bool enable = true; +// }; + +// template <> struct IsDawnBitmask { +// static constexpr bool enable = true; +// }; + +// template <> struct IsDawnBitmask { +// static constexpr bool enable = true; +// }; + +// template <> struct IsDawnBitmask { +// static constexpr bool enable = true; +// }; + +// template <> struct IsDawnBitmask { +// static constexpr bool enable = true; +// }; + +} // namespace dawn + +namespace std { +// Custom boolean class needs corresponding hash function so that it appears as +// a transparent bool. +template <> struct hash { +public: + size_t operator()(const wgpu::Bool &v) const { return hash()(v); } +}; +} // namespace std + +#endif // WEBGPU_CPP_H_ diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h b/package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h new file mode 100644 index 0000000000..49340c3afb --- /dev/null +++ b/package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h @@ -0,0 +1,31 @@ +#ifdef __EMSCRIPTEN__ +#error \ + "Do not include this header. Emscripten already provides headers needed for WebGPU." +#endif +#ifndef WEBGPU_CPP_CHAINED_STRUCT_H_ +#define WEBGPU_CPP_CHAINED_STRUCT_H_ + +#include +#include + +// This header file declares the ChainedStruct structures separately from the +// WebGPU headers so that dependencies can directly extend structures without +// including the larger header which exposes capabilities that may require +// correctly set proc tables. +namespace wgpu { + +enum class SType : uint32_t; + +struct ChainedStruct { + ChainedStruct const *nextInChain = nullptr; + SType sType = SType(0u); +}; + +struct ChainedStructOut { + ChainedStructOut *nextInChain = nullptr; + SType sType = SType(0u); +}; + +} // namespace wgpu + +#endif // WEBGPU_CPP_CHAINED_STRUCT_H_ diff --git a/package/android/cpp/rnskia-android/webgpu.hpp b/package/android/cpp/rnskia-android/webgpu.hpp deleted file mode 100644 index 89c3fb0c9d..0000000000 --- a/package/android/cpp/rnskia-android/webgpu.hpp +++ /dev/null @@ -1,3872 +0,0 @@ -/** - * This file is part of the "Learn WebGPU for C++" book. - * https://github.com/eliemichel/LearnWebGPU - * - * MIT License - * Copyright (c) 2022 Elie Michel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * Exactly one of your source files must #define WEBGPU_CPP_IMPLEMENTATION - * before including this header. - * - * NB: This file has been generated by the webgpu-cpp generator - * (see https://github.com/eliemichel/webgpu-cpp ) - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include - -#if __EMSCRIPTEN__ -#include -#endif - -/** - * A namespace providing a more C++ idiomatic API to WebGPU. - */ -namespace wgpu { - -struct DefaultFlag {}; -constexpr DefaultFlag Default; - -#define HANDLE(Type) \ -class Type { \ -public: \ - typedef Type S; /* S == Self */ \ - typedef WGPU ## Type W; /* W == WGPU Type */ \ - Type(const W& w) : m_raw(w) {} \ - operator W&() { return m_raw; } \ - operator const W&() const { return m_raw; } \ - operator bool() const { return m_raw != nullptr; } \ - bool operator==(const Type& other) const { return m_raw == other.m_raw; } \ - bool operator!=(const Type& other) const { return m_raw != other.m_raw; } \ - bool operator==(const W& other) const { return m_raw == other; } \ - bool operator!=(const W& other) const { return m_raw != other; } \ - friend auto operator<<(std::ostream &stream, const S& self) -> std::ostream & { \ - return stream << ""; \ - } \ -private: \ - W m_raw; \ -public: - -#define DESCRIPTOR(Type) \ -struct Type : public WGPU ## Type { \ -public: \ - typedef Type S; /* S == Self */ \ - typedef WGPU ## Type W; /* W == WGPU Type */ \ - Type() : W() { nextInChain = nullptr; } \ - Type(const W &other) : W(other) { nextInChain = nullptr; } \ - Type(const DefaultFlag &) : W() { setDefault(); } \ - Type& operator=(const DefaultFlag &) { setDefault(); return *this; } \ - friend auto operator<<(std::ostream &stream, const S&) -> std::ostream & { \ - return stream << ""; \ - } \ -public: - -#define STRUCT(Type) \ -struct Type : public WGPU ## Type { \ -public: \ - typedef Type S; /* S == Self */ \ - typedef WGPU ## Type W; /* W == WGPU Type */ \ - Type() : W() {} \ - Type(const W &other) : W(other) {} \ - Type(const DefaultFlag &) : W() { setDefault(); } \ - Type& operator=(const DefaultFlag &) { setDefault(); return *this; } \ - friend auto operator<<(std::ostream &stream, const S&) -> std::ostream & { \ - return stream << ""; \ - } \ -public: - -#define ENUM(Type) \ -class Type { \ -public: \ - typedef Type S; /* S == Self */ \ - typedef WGPU ## Type W; /* W == WGPU Type */ \ - Type(const W& w) : m_raw(w) {} \ - operator W() const { return m_raw; } \ -private: \ - W m_raw; \ -public: - -#define ENUM_ENTRY(Name, Value) \ - static constexpr W Name = (W)Value; - -#define END }; - - - -// Other type aliases -using Flags = uint32_t; -using Bool = uint32_t; -using BufferUsageFlags = WGPUFlags; -using ColorWriteMaskFlags = WGPUFlags; -using HeapPropertyFlags = WGPUFlags; -using MapModeFlags = WGPUFlags; -using ShaderStageFlags = WGPUFlags; -using TextureUsageFlags = WGPUFlags; - -// Enumerations -ENUM(WGSLFeatureName) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(ReadonlyAndReadwriteStorageTextures, 0x00000001) - ENUM_ENTRY(Packed4x8IntegerDotProduct, 0x00000002) - ENUM_ENTRY(UnrestrictedPointerParameters, 0x00000003) - ENUM_ENTRY(PointerCompositeAccess, 0x00000004) - ENUM_ENTRY(ChromiumTestingUnimplemented, 0x000003E8) - ENUM_ENTRY(ChromiumTestingUnsafeExperimental, 0x000003E9) - ENUM_ENTRY(ChromiumTestingExperimental, 0x000003EA) - ENUM_ENTRY(ChromiumTestingShippedWithKillswitch, 0x000003EB) - ENUM_ENTRY(ChromiumTestingShipped, 0x000003EC) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(AdapterType) - ENUM_ENTRY(DiscreteGPU, 0x00000001) - ENUM_ENTRY(IntegratedGPU, 0x00000002) - ENUM_ENTRY(CPU, 0x00000003) - ENUM_ENTRY(Unknown, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(AddressMode) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(ClampToEdge, 0x00000001) - ENUM_ENTRY(Repeat, 0x00000002) - ENUM_ENTRY(MirrorRepeat, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(AlphaMode) - ENUM_ENTRY(Opaque, 0x00000001) - ENUM_ENTRY(Premultiplied, 0x00000002) - ENUM_ENTRY(Unpremultiplied, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BackendType) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Null, 0x00000001) - ENUM_ENTRY(WebGPU, 0x00000002) - ENUM_ENTRY(D3D11, 0x00000003) - ENUM_ENTRY(D3D12, 0x00000004) - ENUM_ENTRY(Metal, 0x00000005) - ENUM_ENTRY(Vulkan, 0x00000006) - ENUM_ENTRY(OpenGL, 0x00000007) - ENUM_ENTRY(OpenGLES, 0x00000008) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BlendFactor) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Zero, 0x00000001) - ENUM_ENTRY(One, 0x00000002) - ENUM_ENTRY(Src, 0x00000003) - ENUM_ENTRY(OneMinusSrc, 0x00000004) - ENUM_ENTRY(SrcAlpha, 0x00000005) - ENUM_ENTRY(OneMinusSrcAlpha, 0x00000006) - ENUM_ENTRY(Dst, 0x00000007) - ENUM_ENTRY(OneMinusDst, 0x00000008) - ENUM_ENTRY(DstAlpha, 0x00000009) - ENUM_ENTRY(OneMinusDstAlpha, 0x0000000A) - ENUM_ENTRY(SrcAlphaSaturated, 0x0000000B) - ENUM_ENTRY(Constant, 0x0000000C) - ENUM_ENTRY(OneMinusConstant, 0x0000000D) - ENUM_ENTRY(Src1, 0x0000000E) - ENUM_ENTRY(OneMinusSrc1, 0x0000000F) - ENUM_ENTRY(Src1Alpha, 0x00000010) - ENUM_ENTRY(OneMinusSrc1Alpha, 0x00000011) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BlendOperation) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Add, 0x00000001) - ENUM_ENTRY(Subtract, 0x00000002) - ENUM_ENTRY(ReverseSubtract, 0x00000003) - ENUM_ENTRY(Min, 0x00000004) - ENUM_ENTRY(Max, 0x00000005) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BufferBindingType) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Uniform, 0x00000001) - ENUM_ENTRY(Storage, 0x00000002) - ENUM_ENTRY(ReadOnlyStorage, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BufferMapAsyncStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(ValidationError, 0x00000002) - ENUM_ENTRY(Unknown, 0x00000003) - ENUM_ENTRY(DeviceLost, 0x00000004) - ENUM_ENTRY(DestroyedBeforeCallback, 0x00000005) - ENUM_ENTRY(UnmappedBeforeCallback, 0x00000006) - ENUM_ENTRY(MappingAlreadyPending, 0x00000007) - ENUM_ENTRY(OffsetOutOfRange, 0x00000008) - ENUM_ENTRY(SizeOutOfRange, 0x00000009) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BufferMapState) - ENUM_ENTRY(Unmapped, 0x00000001) - ENUM_ENTRY(Pending, 0x00000002) - ENUM_ENTRY(Mapped, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(CallbackMode) - ENUM_ENTRY(WaitAnyOnly, 0x00000000) - ENUM_ENTRY(AllowProcessEvents, 0x00000001) - ENUM_ENTRY(AllowSpontaneous, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(CompareFunction) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Never, 0x00000001) - ENUM_ENTRY(Less, 0x00000002) - ENUM_ENTRY(Equal, 0x00000003) - ENUM_ENTRY(LessEqual, 0x00000004) - ENUM_ENTRY(Greater, 0x00000005) - ENUM_ENTRY(NotEqual, 0x00000006) - ENUM_ENTRY(GreaterEqual, 0x00000007) - ENUM_ENTRY(Always, 0x00000008) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(CompilationInfoRequestStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(Error, 0x00000002) - ENUM_ENTRY(DeviceLost, 0x00000003) - ENUM_ENTRY(Unknown, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(CompilationMessageType) - ENUM_ENTRY(Error, 0x00000001) - ENUM_ENTRY(Warning, 0x00000002) - ENUM_ENTRY(Info, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(CreatePipelineAsyncStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(ValidationError, 0x00000002) - ENUM_ENTRY(InternalError, 0x00000003) - ENUM_ENTRY(DeviceLost, 0x00000004) - ENUM_ENTRY(DeviceDestroyed, 0x00000005) - ENUM_ENTRY(Unknown, 0x00000006) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(CullMode) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(None, 0x00000001) - ENUM_ENTRY(Front, 0x00000002) - ENUM_ENTRY(Back, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(DeviceLostReason) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Destroyed, 0x00000001) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(ErrorFilter) - ENUM_ENTRY(Validation, 0x00000001) - ENUM_ENTRY(OutOfMemory, 0x00000002) - ENUM_ENTRY(Internal, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(ErrorType) - ENUM_ENTRY(NoError, 0x00000000) - ENUM_ENTRY(Validation, 0x00000001) - ENUM_ENTRY(OutOfMemory, 0x00000002) - ENUM_ENTRY(Internal, 0x00000003) - ENUM_ENTRY(Unknown, 0x00000004) - ENUM_ENTRY(DeviceLost, 0x00000005) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(ExternalTextureRotation) - ENUM_ENTRY(Rotate0Degrees, 0x00000000) - ENUM_ENTRY(Rotate90Degrees, 0x00000001) - ENUM_ENTRY(Rotate180Degrees, 0x00000002) - ENUM_ENTRY(Rotate270Degrees, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(FeatureName) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(DepthClipControl, 0x00000001) - ENUM_ENTRY(Depth32FloatStencil8, 0x00000002) - ENUM_ENTRY(TimestampQuery, 0x00000003) - ENUM_ENTRY(TextureCompressionBC, 0x00000004) - ENUM_ENTRY(TextureCompressionETC2, 0x00000005) - ENUM_ENTRY(TextureCompressionASTC, 0x00000006) - ENUM_ENTRY(IndirectFirstInstance, 0x00000007) - ENUM_ENTRY(ShaderF16, 0x00000008) - ENUM_ENTRY(RG11B10UfloatRenderable, 0x00000009) - ENUM_ENTRY(BGRA8UnormStorage, 0x0000000A) - ENUM_ENTRY(Float32Filterable, 0x0000000B) - ENUM_ENTRY(DawnInternalUsages, 0x000003EA) - ENUM_ENTRY(DawnMultiPlanarFormats, 0x000003EB) - ENUM_ENTRY(DawnNative, 0x000003EC) - ENUM_ENTRY(ChromiumExperimentalTimestampQueryInsidePasses, 0x000003EE) - ENUM_ENTRY(ImplicitDeviceSynchronization, 0x000003EF) - ENUM_ENTRY(SurfaceCapabilities, 0x000003F0) - ENUM_ENTRY(TransientAttachments, 0x000003F1) - ENUM_ENTRY(MSAARenderToSingleSampled, 0x000003F2) - ENUM_ENTRY(DualSourceBlending, 0x000003F3) - ENUM_ENTRY(D3D11MultithreadProtected, 0x000003F4) - ENUM_ENTRY(ANGLETextureSharing, 0x000003F5) - ENUM_ENTRY(ChromiumExperimentalSubgroups, 0x000003F6) - ENUM_ENTRY(ChromiumExperimentalSubgroupUniformControlFlow, 0x000003F7) - ENUM_ENTRY(PixelLocalStorageCoherent, 0x000003F9) - ENUM_ENTRY(PixelLocalStorageNonCoherent, 0x000003FA) - ENUM_ENTRY(Unorm16TextureFormats, 0x000003FB) - ENUM_ENTRY(Snorm16TextureFormats, 0x000003FC) - ENUM_ENTRY(MultiPlanarFormatExtendedUsages, 0x000003FD) - ENUM_ENTRY(MultiPlanarFormatP010, 0x000003FE) - ENUM_ENTRY(HostMappedPointer, 0x000003FF) - ENUM_ENTRY(MultiPlanarRenderTargets, 0x00000400) - ENUM_ENTRY(MultiPlanarFormatNv12a, 0x00000401) - ENUM_ENTRY(FramebufferFetch, 0x00000402) - ENUM_ENTRY(BufferMapExtendedUsages, 0x00000403) - ENUM_ENTRY(AdapterPropertiesMemoryHeaps, 0x00000404) - ENUM_ENTRY(AdapterPropertiesD3D, 0x00000405) - ENUM_ENTRY(AdapterPropertiesVk, 0x00000406) - ENUM_ENTRY(R8UnormStorage, 0x00000407) - ENUM_ENTRY(FormatCapabilities, 0x00000408) - ENUM_ENTRY(DrmFormatCapabilities, 0x00000409) - ENUM_ENTRY(Norm16TextureFormats, 0x0000040A) - ENUM_ENTRY(SharedTextureMemoryVkDedicatedAllocation, 0x0000044C) - ENUM_ENTRY(SharedTextureMemoryAHardwareBuffer, 0x0000044D) - ENUM_ENTRY(SharedTextureMemoryDmaBuf, 0x0000044E) - ENUM_ENTRY(SharedTextureMemoryOpaqueFD, 0x0000044F) - ENUM_ENTRY(SharedTextureMemoryZirconHandle, 0x00000450) - ENUM_ENTRY(SharedTextureMemoryDXGISharedHandle, 0x00000451) - ENUM_ENTRY(SharedTextureMemoryD3D11Texture2D, 0x00000452) - ENUM_ENTRY(SharedTextureMemoryIOSurface, 0x00000453) - ENUM_ENTRY(SharedTextureMemoryEGLImage, 0x00000454) - ENUM_ENTRY(SharedFenceVkSemaphoreOpaqueFD, 0x000004B0) - ENUM_ENTRY(SharedFenceVkSemaphoreSyncFD, 0x000004B1) - ENUM_ENTRY(SharedFenceVkSemaphoreZirconHandle, 0x000004B2) - ENUM_ENTRY(SharedFenceDXGISharedHandle, 0x000004B3) - ENUM_ENTRY(SharedFenceMTLSharedEvent, 0x000004B4) - ENUM_ENTRY(SharedBufferMemoryD3D12Resource, 0x000004B5) - ENUM_ENTRY(StaticSamplers, 0x000004B6) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(FilterMode) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Nearest, 0x00000001) - ENUM_ENTRY(Linear, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(FrontFace) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(CCW, 0x00000001) - ENUM_ENTRY(CW, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(IndexFormat) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Uint16, 0x00000001) - ENUM_ENTRY(Uint32, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(LoadOp) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Clear, 0x00000001) - ENUM_ENTRY(Load, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(LoggingType) - ENUM_ENTRY(Verbose, 0x00000001) - ENUM_ENTRY(Info, 0x00000002) - ENUM_ENTRY(Warning, 0x00000003) - ENUM_ENTRY(Error, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(MipmapFilterMode) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Nearest, 0x00000001) - ENUM_ENTRY(Linear, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(PopErrorScopeStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(PowerPreference) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(LowPower, 0x00000001) - ENUM_ENTRY(HighPerformance, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(PresentMode) - ENUM_ENTRY(Fifo, 0x00000001) - ENUM_ENTRY(Immediate, 0x00000003) - ENUM_ENTRY(Mailbox, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(PrimitiveTopology) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(PointList, 0x00000001) - ENUM_ENTRY(LineList, 0x00000002) - ENUM_ENTRY(LineStrip, 0x00000003) - ENUM_ENTRY(TriangleList, 0x00000004) - ENUM_ENTRY(TriangleStrip, 0x00000005) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(QueryType) - ENUM_ENTRY(Occlusion, 0x00000001) - ENUM_ENTRY(Timestamp, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(QueueWorkDoneStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(Error, 0x00000002) - ENUM_ENTRY(Unknown, 0x00000003) - ENUM_ENTRY(DeviceLost, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(RequestAdapterStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(Unavailable, 0x00000002) - ENUM_ENTRY(Error, 0x00000003) - ENUM_ENTRY(Unknown, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(RequestDeviceStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(InstanceDropped, 0x00000001) - ENUM_ENTRY(Error, 0x00000002) - ENUM_ENTRY(Unknown, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(SType) - ENUM_ENTRY(Invalid, 0x00000000) - ENUM_ENTRY(SurfaceDescriptorFromMetalLayer, 0x00000001) - ENUM_ENTRY(SurfaceDescriptorFromWindowsHWND, 0x00000002) - ENUM_ENTRY(SurfaceDescriptorFromXlibWindow, 0x00000003) - ENUM_ENTRY(SurfaceDescriptorFromCanvasHTMLSelector, 0x00000004) - ENUM_ENTRY(ShaderModuleSPIRVDescriptor, 0x00000005) - ENUM_ENTRY(ShaderModuleWGSLDescriptor, 0x00000006) - ENUM_ENTRY(PrimitiveDepthClipControl, 0x00000007) - ENUM_ENTRY(SurfaceDescriptorFromWaylandSurface, 0x00000008) - ENUM_ENTRY(SurfaceDescriptorFromAndroidNativeWindow, 0x00000009) - ENUM_ENTRY(SurfaceDescriptorFromWindowsCoreWindow, 0x0000000B) - ENUM_ENTRY(ExternalTextureBindingEntry, 0x0000000C) - ENUM_ENTRY(ExternalTextureBindingLayout, 0x0000000D) - ENUM_ENTRY(SurfaceDescriptorFromWindowsSwapChainPanel, 0x0000000E) - ENUM_ENTRY(RenderPassDescriptorMaxDrawCount, 0x0000000F) - ENUM_ENTRY(DepthStencilStateDepthWriteDefinedDawn, 0x00000010) - ENUM_ENTRY(TextureBindingViewDimensionDescriptor, 0x00000011) - ENUM_ENTRY(DawnTextureInternalUsageDescriptor, 0x000003E8) - ENUM_ENTRY(DawnEncoderInternalUsageDescriptor, 0x000003EB) - ENUM_ENTRY(DawnInstanceDescriptor, 0x000003EC) - ENUM_ENTRY(DawnCacheDeviceDescriptor, 0x000003ED) - ENUM_ENTRY(DawnAdapterPropertiesPowerPreference, 0x000003EE) - ENUM_ENTRY(DawnBufferDescriptorErrorInfoFromWireClient, 0x000003EF) - ENUM_ENTRY(DawnTogglesDescriptor, 0x000003F0) - ENUM_ENTRY(DawnShaderModuleSPIRVOptionsDescriptor, 0x000003F1) - ENUM_ENTRY(RequestAdapterOptionsLUID, 0x000003F2) - ENUM_ENTRY(RequestAdapterOptionsGetGLProc, 0x000003F3) - ENUM_ENTRY(RequestAdapterOptionsD3D11Device, 0x000003F4) - ENUM_ENTRY(DawnMultisampleStateRenderToSingleSampled, 0x000003F5) - ENUM_ENTRY(DawnRenderPassColorAttachmentRenderToSingleSampled, 0x000003F6) - ENUM_ENTRY(RenderPassPixelLocalStorage, 0x000003F7) - ENUM_ENTRY(PipelineLayoutPixelLocalStorage, 0x000003F8) - ENUM_ENTRY(BufferHostMappedPointer, 0x000003F9) - ENUM_ENTRY(DawnExperimentalSubgroupLimits, 0x000003FA) - ENUM_ENTRY(AdapterPropertiesMemoryHeaps, 0x000003FB) - ENUM_ENTRY(AdapterPropertiesD3D, 0x000003FC) - ENUM_ENTRY(AdapterPropertiesVk, 0x000003FD) - ENUM_ENTRY(DawnComputePipelineFullSubgroups, 0x000003FE) - ENUM_ENTRY(DawnWireWGSLControl, 0x000003FF) - ENUM_ENTRY(DawnWGSLBlocklist, 0x00000400) - ENUM_ENTRY(DrmFormatCapabilities, 0x00000401) - ENUM_ENTRY(SharedTextureMemoryVkImageDescriptor, 0x0000044C) - ENUM_ENTRY(SharedTextureMemoryVkDedicatedAllocationDescriptor, 0x0000044D) - ENUM_ENTRY(SharedTextureMemoryAHardwareBufferDescriptor, 0x0000044E) - ENUM_ENTRY(SharedTextureMemoryDmaBufDescriptor, 0x0000044F) - ENUM_ENTRY(SharedTextureMemoryOpaqueFDDescriptor, 0x00000450) - ENUM_ENTRY(SharedTextureMemoryZirconHandleDescriptor, 0x00000451) - ENUM_ENTRY(SharedTextureMemoryDXGISharedHandleDescriptor, 0x00000452) - ENUM_ENTRY(SharedTextureMemoryD3D11Texture2DDescriptor, 0x00000453) - ENUM_ENTRY(SharedTextureMemoryIOSurfaceDescriptor, 0x00000454) - ENUM_ENTRY(SharedTextureMemoryEGLImageDescriptor, 0x00000455) - ENUM_ENTRY(SharedTextureMemoryInitializedBeginState, 0x000004B0) - ENUM_ENTRY(SharedTextureMemoryInitializedEndState, 0x000004B1) - ENUM_ENTRY(SharedTextureMemoryVkImageLayoutBeginState, 0x000004B2) - ENUM_ENTRY(SharedTextureMemoryVkImageLayoutEndState, 0x000004B3) - ENUM_ENTRY(SharedFenceVkSemaphoreOpaqueFDDescriptor, 0x000004B4) - ENUM_ENTRY(SharedFenceVkSemaphoreOpaqueFDExportInfo, 0x000004B5) - ENUM_ENTRY(SharedFenceVkSemaphoreSyncFDDescriptor, 0x000004B6) - ENUM_ENTRY(SharedFenceVkSemaphoreSyncFDExportInfo, 0x000004B7) - ENUM_ENTRY(SharedFenceVkSemaphoreZirconHandleDescriptor, 0x000004B8) - ENUM_ENTRY(SharedFenceVkSemaphoreZirconHandleExportInfo, 0x000004B9) - ENUM_ENTRY(SharedFenceDXGISharedHandleDescriptor, 0x000004BA) - ENUM_ENTRY(SharedFenceDXGISharedHandleExportInfo, 0x000004BB) - ENUM_ENTRY(SharedFenceMTLSharedEventDescriptor, 0x000004BC) - ENUM_ENTRY(SharedFenceMTLSharedEventExportInfo, 0x000004BD) - ENUM_ENTRY(SharedBufferMemoryD3D12ResourceDescriptor, 0x000004BE) - ENUM_ENTRY(StaticSamplerBindingLayout, 0x000004BF) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(SamplerBindingType) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Filtering, 0x00000001) - ENUM_ENTRY(NonFiltering, 0x00000002) - ENUM_ENTRY(Comparison, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(SharedFenceType) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(VkSemaphoreOpaqueFD, 0x00000001) - ENUM_ENTRY(VkSemaphoreSyncFD, 0x00000002) - ENUM_ENTRY(VkSemaphoreZirconHandle, 0x00000003) - ENUM_ENTRY(DXGISharedHandle, 0x00000004) - ENUM_ENTRY(MTLSharedEvent, 0x00000005) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(StencilOperation) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Keep, 0x00000001) - ENUM_ENTRY(Zero, 0x00000002) - ENUM_ENTRY(Replace, 0x00000003) - ENUM_ENTRY(Invert, 0x00000004) - ENUM_ENTRY(IncrementClamp, 0x00000005) - ENUM_ENTRY(DecrementClamp, 0x00000006) - ENUM_ENTRY(IncrementWrap, 0x00000007) - ENUM_ENTRY(DecrementWrap, 0x00000008) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(StorageTextureAccess) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(WriteOnly, 0x00000001) - ENUM_ENTRY(ReadOnly, 0x00000002) - ENUM_ENTRY(ReadWrite, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(StoreOp) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Store, 0x00000001) - ENUM_ENTRY(Discard, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(TextureAspect) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(All, 0x00000001) - ENUM_ENTRY(StencilOnly, 0x00000002) - ENUM_ENTRY(DepthOnly, 0x00000003) - ENUM_ENTRY(Plane0Only, 0x00000004) - ENUM_ENTRY(Plane1Only, 0x00000005) - ENUM_ENTRY(Plane2Only, 0x00000006) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(TextureDimension) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(_1D, 0x00000001) - ENUM_ENTRY(_2D, 0x00000002) - ENUM_ENTRY(_3D, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(TextureFormat) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(R8Unorm, 0x00000001) - ENUM_ENTRY(R8Snorm, 0x00000002) - ENUM_ENTRY(R8Uint, 0x00000003) - ENUM_ENTRY(R8Sint, 0x00000004) - ENUM_ENTRY(R16Uint, 0x00000005) - ENUM_ENTRY(R16Sint, 0x00000006) - ENUM_ENTRY(R16Float, 0x00000007) - ENUM_ENTRY(RG8Unorm, 0x00000008) - ENUM_ENTRY(RG8Snorm, 0x00000009) - ENUM_ENTRY(RG8Uint, 0x0000000A) - ENUM_ENTRY(RG8Sint, 0x0000000B) - ENUM_ENTRY(R32Float, 0x0000000C) - ENUM_ENTRY(R32Uint, 0x0000000D) - ENUM_ENTRY(R32Sint, 0x0000000E) - ENUM_ENTRY(RG16Uint, 0x0000000F) - ENUM_ENTRY(RG16Sint, 0x00000010) - ENUM_ENTRY(RG16Float, 0x00000011) - ENUM_ENTRY(RGBA8Unorm, 0x00000012) - ENUM_ENTRY(RGBA8UnormSrgb, 0x00000013) - ENUM_ENTRY(RGBA8Snorm, 0x00000014) - ENUM_ENTRY(RGBA8Uint, 0x00000015) - ENUM_ENTRY(RGBA8Sint, 0x00000016) - ENUM_ENTRY(BGRA8Unorm, 0x00000017) - ENUM_ENTRY(BGRA8UnormSrgb, 0x00000018) - ENUM_ENTRY(RGB10A2Uint, 0x00000019) - ENUM_ENTRY(RGB10A2Unorm, 0x0000001A) - ENUM_ENTRY(RG11B10Ufloat, 0x0000001B) - ENUM_ENTRY(RGB9E5Ufloat, 0x0000001C) - ENUM_ENTRY(RG32Float, 0x0000001D) - ENUM_ENTRY(RG32Uint, 0x0000001E) - ENUM_ENTRY(RG32Sint, 0x0000001F) - ENUM_ENTRY(RGBA16Uint, 0x00000020) - ENUM_ENTRY(RGBA16Sint, 0x00000021) - ENUM_ENTRY(RGBA16Float, 0x00000022) - ENUM_ENTRY(RGBA32Float, 0x00000023) - ENUM_ENTRY(RGBA32Uint, 0x00000024) - ENUM_ENTRY(RGBA32Sint, 0x00000025) - ENUM_ENTRY(Stencil8, 0x00000026) - ENUM_ENTRY(Depth16Unorm, 0x00000027) - ENUM_ENTRY(Depth24Plus, 0x00000028) - ENUM_ENTRY(Depth24PlusStencil8, 0x00000029) - ENUM_ENTRY(Depth32Float, 0x0000002A) - ENUM_ENTRY(Depth32FloatStencil8, 0x0000002B) - ENUM_ENTRY(BC1RGBAUnorm, 0x0000002C) - ENUM_ENTRY(BC1RGBAUnormSrgb, 0x0000002D) - ENUM_ENTRY(BC2RGBAUnorm, 0x0000002E) - ENUM_ENTRY(BC2RGBAUnormSrgb, 0x0000002F) - ENUM_ENTRY(BC3RGBAUnorm, 0x00000030) - ENUM_ENTRY(BC3RGBAUnormSrgb, 0x00000031) - ENUM_ENTRY(BC4RUnorm, 0x00000032) - ENUM_ENTRY(BC4RSnorm, 0x00000033) - ENUM_ENTRY(BC5RGUnorm, 0x00000034) - ENUM_ENTRY(BC5RGSnorm, 0x00000035) - ENUM_ENTRY(BC6HRGBUfloat, 0x00000036) - ENUM_ENTRY(BC6HRGBFloat, 0x00000037) - ENUM_ENTRY(BC7RGBAUnorm, 0x00000038) - ENUM_ENTRY(BC7RGBAUnormSrgb, 0x00000039) - ENUM_ENTRY(ETC2RGB8Unorm, 0x0000003A) - ENUM_ENTRY(ETC2RGB8UnormSrgb, 0x0000003B) - ENUM_ENTRY(ETC2RGB8A1Unorm, 0x0000003C) - ENUM_ENTRY(ETC2RGB8A1UnormSrgb, 0x0000003D) - ENUM_ENTRY(ETC2RGBA8Unorm, 0x0000003E) - ENUM_ENTRY(ETC2RGBA8UnormSrgb, 0x0000003F) - ENUM_ENTRY(EACR11Unorm, 0x00000040) - ENUM_ENTRY(EACR11Snorm, 0x00000041) - ENUM_ENTRY(EACRG11Unorm, 0x00000042) - ENUM_ENTRY(EACRG11Snorm, 0x00000043) - ENUM_ENTRY(ASTC4x4Unorm, 0x00000044) - ENUM_ENTRY(ASTC4x4UnormSrgb, 0x00000045) - ENUM_ENTRY(ASTC5x4Unorm, 0x00000046) - ENUM_ENTRY(ASTC5x4UnormSrgb, 0x00000047) - ENUM_ENTRY(ASTC5x5Unorm, 0x00000048) - ENUM_ENTRY(ASTC5x5UnormSrgb, 0x00000049) - ENUM_ENTRY(ASTC6x5Unorm, 0x0000004A) - ENUM_ENTRY(ASTC6x5UnormSrgb, 0x0000004B) - ENUM_ENTRY(ASTC6x6Unorm, 0x0000004C) - ENUM_ENTRY(ASTC6x6UnormSrgb, 0x0000004D) - ENUM_ENTRY(ASTC8x5Unorm, 0x0000004E) - ENUM_ENTRY(ASTC8x5UnormSrgb, 0x0000004F) - ENUM_ENTRY(ASTC8x6Unorm, 0x00000050) - ENUM_ENTRY(ASTC8x6UnormSrgb, 0x00000051) - ENUM_ENTRY(ASTC8x8Unorm, 0x00000052) - ENUM_ENTRY(ASTC8x8UnormSrgb, 0x00000053) - ENUM_ENTRY(ASTC10x5Unorm, 0x00000054) - ENUM_ENTRY(ASTC10x5UnormSrgb, 0x00000055) - ENUM_ENTRY(ASTC10x6Unorm, 0x00000056) - ENUM_ENTRY(ASTC10x6UnormSrgb, 0x00000057) - ENUM_ENTRY(ASTC10x8Unorm, 0x00000058) - ENUM_ENTRY(ASTC10x8UnormSrgb, 0x00000059) - ENUM_ENTRY(ASTC10x10Unorm, 0x0000005A) - ENUM_ENTRY(ASTC10x10UnormSrgb, 0x0000005B) - ENUM_ENTRY(ASTC12x10Unorm, 0x0000005C) - ENUM_ENTRY(ASTC12x10UnormSrgb, 0x0000005D) - ENUM_ENTRY(ASTC12x12Unorm, 0x0000005E) - ENUM_ENTRY(ASTC12x12UnormSrgb, 0x0000005F) - ENUM_ENTRY(R16Unorm, 0x00000060) - ENUM_ENTRY(RG16Unorm, 0x00000061) - ENUM_ENTRY(RGBA16Unorm, 0x00000062) - ENUM_ENTRY(R16Snorm, 0x00000063) - ENUM_ENTRY(RG16Snorm, 0x00000064) - ENUM_ENTRY(RGBA16Snorm, 0x00000065) - ENUM_ENTRY(R8BG8Biplanar420Unorm, 0x00000066) - ENUM_ENTRY(R10X6BG10X6Biplanar420Unorm, 0x00000067) - ENUM_ENTRY(R8BG8A8Triplanar420Unorm, 0x00000068) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(TextureSampleType) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Float, 0x00000001) - ENUM_ENTRY(UnfilterableFloat, 0x00000002) - ENUM_ENTRY(Depth, 0x00000003) - ENUM_ENTRY(Sint, 0x00000004) - ENUM_ENTRY(Uint, 0x00000005) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(TextureViewDimension) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(_1D, 0x00000001) - ENUM_ENTRY(_2D, 0x00000002) - ENUM_ENTRY(_2DArray, 0x00000003) - ENUM_ENTRY(Cube, 0x00000004) - ENUM_ENTRY(CubeArray, 0x00000005) - ENUM_ENTRY(_3D, 0x00000006) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(VertexFormat) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(Uint8x2, 0x00000001) - ENUM_ENTRY(Uint8x4, 0x00000002) - ENUM_ENTRY(Sint8x2, 0x00000003) - ENUM_ENTRY(Sint8x4, 0x00000004) - ENUM_ENTRY(Unorm8x2, 0x00000005) - ENUM_ENTRY(Unorm8x4, 0x00000006) - ENUM_ENTRY(Snorm8x2, 0x00000007) - ENUM_ENTRY(Snorm8x4, 0x00000008) - ENUM_ENTRY(Uint16x2, 0x00000009) - ENUM_ENTRY(Uint16x4, 0x0000000A) - ENUM_ENTRY(Sint16x2, 0x0000000B) - ENUM_ENTRY(Sint16x4, 0x0000000C) - ENUM_ENTRY(Unorm16x2, 0x0000000D) - ENUM_ENTRY(Unorm16x4, 0x0000000E) - ENUM_ENTRY(Snorm16x2, 0x0000000F) - ENUM_ENTRY(Snorm16x4, 0x00000010) - ENUM_ENTRY(Float16x2, 0x00000011) - ENUM_ENTRY(Float16x4, 0x00000012) - ENUM_ENTRY(Float32, 0x00000013) - ENUM_ENTRY(Float32x2, 0x00000014) - ENUM_ENTRY(Float32x3, 0x00000015) - ENUM_ENTRY(Float32x4, 0x00000016) - ENUM_ENTRY(Uint32, 0x00000017) - ENUM_ENTRY(Uint32x2, 0x00000018) - ENUM_ENTRY(Uint32x3, 0x00000019) - ENUM_ENTRY(Uint32x4, 0x0000001A) - ENUM_ENTRY(Sint32, 0x0000001B) - ENUM_ENTRY(Sint32x2, 0x0000001C) - ENUM_ENTRY(Sint32x3, 0x0000001D) - ENUM_ENTRY(Sint32x4, 0x0000001E) - ENUM_ENTRY(Unorm10_10_10_2, 0x0000001F) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(VertexStepMode) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(VertexBufferNotUsed, 0x00000001) - ENUM_ENTRY(Vertex, 0x00000002) - ENUM_ENTRY(Instance, 0x00000003) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(WaitStatus) - ENUM_ENTRY(Success, 0x00000000) - ENUM_ENTRY(TimedOut, 0x00000001) - ENUM_ENTRY(UnsupportedTimeout, 0x00000002) - ENUM_ENTRY(UnsupportedCount, 0x00000003) - ENUM_ENTRY(UnsupportedMixedSources, 0x00000004) - ENUM_ENTRY(Unknown, 0x00000005) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(BufferUsage) - ENUM_ENTRY(None, 0x00000000) - ENUM_ENTRY(MapRead, 0x00000001) - ENUM_ENTRY(MapWrite, 0x00000002) - ENUM_ENTRY(CopySrc, 0x00000004) - ENUM_ENTRY(CopyDst, 0x00000008) - ENUM_ENTRY(Index, 0x00000010) - ENUM_ENTRY(Vertex, 0x00000020) - ENUM_ENTRY(Uniform, 0x00000040) - ENUM_ENTRY(Storage, 0x00000080) - ENUM_ENTRY(Indirect, 0x00000100) - ENUM_ENTRY(QueryResolve, 0x00000200) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(ColorWriteMask) - ENUM_ENTRY(None, 0x00000000) - ENUM_ENTRY(Red, 0x00000001) - ENUM_ENTRY(Green, 0x00000002) - ENUM_ENTRY(Blue, 0x00000004) - ENUM_ENTRY(Alpha, 0x00000008) - ENUM_ENTRY(All, 0x0000000F) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(HeapProperty) - ENUM_ENTRY(Undefined, 0x00000000) - ENUM_ENTRY(DeviceLocal, 0x00000001) - ENUM_ENTRY(HostVisible, 0x00000002) - ENUM_ENTRY(HostCoherent, 0x00000004) - ENUM_ENTRY(HostUncached, 0x00000008) - ENUM_ENTRY(HostCached, 0x00000010) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(MapMode) - ENUM_ENTRY(None, 0x00000000) - ENUM_ENTRY(Read, 0x00000001) - ENUM_ENTRY(Write, 0x00000002) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(ShaderStage) - ENUM_ENTRY(None, 0x00000000) - ENUM_ENTRY(Vertex, 0x00000001) - ENUM_ENTRY(Fragment, 0x00000002) - ENUM_ENTRY(Compute, 0x00000004) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END -ENUM(TextureUsage) - ENUM_ENTRY(None, 0x00000000) - ENUM_ENTRY(CopySrc, 0x00000001) - ENUM_ENTRY(CopyDst, 0x00000002) - ENUM_ENTRY(TextureBinding, 0x00000004) - ENUM_ENTRY(StorageBinding, 0x00000008) - ENUM_ENTRY(RenderAttachment, 0x00000010) - ENUM_ENTRY(TransientAttachment, 0x00000020) - ENUM_ENTRY(StorageAttachment, 0x00000040) - ENUM_ENTRY(Force32, 0x7FFFFFFF) -END - -// Structs -STRUCT(ChainedStruct) - void setDefault(); -END - -STRUCT(ChainedStructOut) - void setDefault(); -END - -STRUCT(AdapterPropertiesD3D) - void setDefault(); -END - -STRUCT(AdapterPropertiesVk) - void setDefault(); -END - -STRUCT(BlendComponent) - void setDefault(); -END - -STRUCT(BufferHostMappedPointer) - void setDefault(); -END - -STRUCT(Color) - void setDefault(); - Color(double r, double g, double b, double a) : WGPUColor{ r, g, b, a } {} -END - -STRUCT(ComputePassTimestampWrites) - void setDefault(); -END - -STRUCT(DawnWGSLBlocklist) - void setDefault(); -END - -STRUCT(DawnAdapterPropertiesPowerPreference) - void setDefault(); -END - -STRUCT(DawnBufferDescriptorErrorInfoFromWireClient) - void setDefault(); -END - -STRUCT(DawnCacheDeviceDescriptor) - void setDefault(); -END - -STRUCT(DawnComputePipelineFullSubgroups) - void setDefault(); -END - -STRUCT(DawnEncoderInternalUsageDescriptor) - void setDefault(); -END - -STRUCT(DawnExperimentalSubgroupLimits) - void setDefault(); -END - -STRUCT(DawnMultisampleStateRenderToSingleSampled) - void setDefault(); -END - -STRUCT(DawnRenderPassColorAttachmentRenderToSingleSampled) - void setDefault(); -END - -STRUCT(DawnShaderModuleSPIRVOptionsDescriptor) - void setDefault(); -END - -STRUCT(DawnTextureInternalUsageDescriptor) - void setDefault(); -END - -STRUCT(DawnTogglesDescriptor) - void setDefault(); -END - -STRUCT(DawnWireWGSLControl) - void setDefault(); -END - -STRUCT(DepthStencilStateDepthWriteDefinedDawn) - void setDefault(); -END - -STRUCT(DrmFormatProperties) - void setDefault(); -END - -STRUCT(Extent2D) - void setDefault(); -END - -STRUCT(Extent3D) - void setDefault(); - Extent3D(uint32_t width, uint32_t height, uint32_t depthOrArrayLayers) : WGPUExtent3D{ width, height, depthOrArrayLayers } {} -END - -STRUCT(ExternalTextureBindingEntry) - void setDefault(); -END - -STRUCT(ExternalTextureBindingLayout) - void setDefault(); -END - -STRUCT(Future) - void setDefault(); -END - -STRUCT(Limits) - void setDefault(); -END - -STRUCT(MemoryHeapInfo) - void setDefault(); -END - -STRUCT(Origin2D) - void setDefault(); -END - -STRUCT(Origin3D) - void setDefault(); - Origin3D(uint32_t x, uint32_t y, uint32_t z) : WGPUOrigin3D{ x, y, z } {} -END - -STRUCT(PrimitiveDepthClipControl) - void setDefault(); -END - -STRUCT(RenderPassDepthStencilAttachment) - void setDefault(); -END - -STRUCT(RenderPassDescriptorMaxDrawCount) - void setDefault(); -END - -STRUCT(RenderPassTimestampWrites) - void setDefault(); -END - -STRUCT(ShaderModuleSPIRVDescriptor) - void setDefault(); -END - -STRUCT(ShaderModuleWGSLDescriptor) - void setDefault(); -END - -STRUCT(SharedFenceDXGISharedHandleDescriptor) - void setDefault(); -END - -STRUCT(SharedFenceDXGISharedHandleExportInfo) - void setDefault(); -END - -STRUCT(SharedFenceMTLSharedEventDescriptor) - void setDefault(); -END - -STRUCT(SharedFenceMTLSharedEventExportInfo) - void setDefault(); -END - -STRUCT(SharedFenceVkSemaphoreOpaqueFDDescriptor) - void setDefault(); -END - -STRUCT(SharedFenceVkSemaphoreOpaqueFDExportInfo) - void setDefault(); -END - -STRUCT(SharedFenceVkSemaphoreSyncFDDescriptor) - void setDefault(); -END - -STRUCT(SharedFenceVkSemaphoreSyncFDExportInfo) - void setDefault(); -END - -STRUCT(SharedFenceVkSemaphoreZirconHandleDescriptor) - void setDefault(); -END - -STRUCT(SharedFenceVkSemaphoreZirconHandleExportInfo) - void setDefault(); -END - -STRUCT(SharedTextureMemoryDXGISharedHandleDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryEGLImageDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryIOSurfaceDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryAHardwareBufferDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryDmaBufPlane) - void setDefault(); -END - -STRUCT(SharedTextureMemoryOpaqueFDDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryVkDedicatedAllocationDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryVkImageLayoutBeginState) - void setDefault(); -END - -STRUCT(SharedTextureMemoryVkImageLayoutEndState) - void setDefault(); -END - -STRUCT(SharedTextureMemoryZirconHandleDescriptor) - void setDefault(); -END - -STRUCT(StaticSamplerBindingLayout) - void setDefault(); -END - -STRUCT(StencilFaceState) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromAndroidNativeWindow) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromCanvasHTMLSelector) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromMetalLayer) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromWaylandSurface) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromWindowsHWND) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromWindowsCoreWindow) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromWindowsSwapChainPanel) - void setDefault(); -END - -STRUCT(SurfaceDescriptorFromXlibWindow) - void setDefault(); -END - -STRUCT(TextureBindingViewDimensionDescriptor) - void setDefault(); -END - -STRUCT(VertexAttribute) - void setDefault(); -END - -STRUCT(AdapterPropertiesMemoryHeaps) - void setDefault(); - void freeMembers(); -END - -STRUCT(BlendState) - void setDefault(); -END - -STRUCT(DrmFormatCapabilities) - void setDefault(); - void freeMembers(); -END - -STRUCT(FutureWaitInfo) - void setDefault(); -END - -STRUCT(PipelineLayoutPixelLocalStorage) - void setDefault(); -END - -STRUCT(SharedTextureMemoryDmaBufDescriptor) - void setDefault(); -END - -STRUCT(SharedTextureMemoryVkImageDescriptor) - void setDefault(); -END - -STRUCT(VertexBufferLayout) - void setDefault(); -END - -STRUCT(RenderPassPixelLocalStorage) - void setDefault(); -END - - -// Descriptors -DESCRIPTOR(AdapterProperties) - void setDefault(); - void freeMembers(); -END - -DESCRIPTOR(BindGroupEntry) - void setDefault(); -END - -DESCRIPTOR(BufferBindingLayout) - void setDefault(); -END - -DESCRIPTOR(BufferDescriptor) - void setDefault(); -END - -DESCRIPTOR(BufferMapCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(CommandBufferDescriptor) - void setDefault(); -END - -DESCRIPTOR(CommandEncoderDescriptor) - void setDefault(); -END - -DESCRIPTOR(CompilationInfoCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(CompilationMessage) - void setDefault(); -END - -DESCRIPTOR(ConstantEntry) - void setDefault(); -END - -DESCRIPTOR(CopyTextureForBrowserOptions) - void setDefault(); -END - -DESCRIPTOR(CreateComputePipelineAsyncCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(CreateRenderPipelineAsyncCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(FormatCapabilities) - void setDefault(); -END - -DESCRIPTOR(InstanceFeatures) - void setDefault(); -END - -DESCRIPTOR(MultisampleState) - void setDefault(); -END - -DESCRIPTOR(PipelineLayoutDescriptor) - void setDefault(); -END - -DESCRIPTOR(PipelineLayoutStorageAttachment) - void setDefault(); -END - -DESCRIPTOR(PopErrorScopeCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(PrimitiveState) - void setDefault(); -END - -DESCRIPTOR(QuerySetDescriptor) - void setDefault(); -END - -DESCRIPTOR(QueueDescriptor) - void setDefault(); -END - -DESCRIPTOR(QueueWorkDoneCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(RenderBundleDescriptor) - void setDefault(); -END - -DESCRIPTOR(RenderBundleEncoderDescriptor) - void setDefault(); -END - -DESCRIPTOR(RequestAdapterCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(RequestAdapterOptions) - void setDefault(); -END - -DESCRIPTOR(RequestDeviceCallbackInfo) - void setDefault(); -END - -DESCRIPTOR(SamplerBindingLayout) - void setDefault(); -END - -DESCRIPTOR(SamplerDescriptor) - void setDefault(); -END - -DESCRIPTOR(ShaderModuleDescriptor) - void setDefault(); -END - -DESCRIPTOR(SharedBufferMemoryBeginAccessDescriptor) - void setDefault(); -END - -DESCRIPTOR(SharedBufferMemoryDescriptor) - void setDefault(); -END - -DESCRIPTOR(SharedBufferMemoryEndAccessState) - void setDefault(); - void freeMembers(); -END - -DESCRIPTOR(SharedBufferMemoryProperties) - void setDefault(); -END - -DESCRIPTOR(SharedFenceDescriptor) - void setDefault(); -END - -DESCRIPTOR(SharedFenceExportInfo) - void setDefault(); -END - -DESCRIPTOR(SharedTextureMemoryBeginAccessDescriptor) - void setDefault(); -END - -DESCRIPTOR(SharedTextureMemoryDescriptor) - void setDefault(); -END - -DESCRIPTOR(SharedTextureMemoryEndAccessState) - void setDefault(); - void freeMembers(); -END - -DESCRIPTOR(StorageTextureBindingLayout) - void setDefault(); -END - -DESCRIPTOR(SurfaceDescriptor) - void setDefault(); -END - -DESCRIPTOR(SwapChainDescriptor) - void setDefault(); -END - -DESCRIPTOR(TextureBindingLayout) - void setDefault(); -END - -DESCRIPTOR(TextureDataLayout) - void setDefault(); -END - -DESCRIPTOR(TextureViewDescriptor) - void setDefault(); -END - -DESCRIPTOR(BindGroupDescriptor) - void setDefault(); -END - -DESCRIPTOR(BindGroupLayoutEntry) - void setDefault(); -END - -DESCRIPTOR(CompilationInfo) - void setDefault(); -END - -DESCRIPTOR(ComputePassDescriptor) - void setDefault(); -END - -DESCRIPTOR(DepthStencilState) - void setDefault(); -END - -DESCRIPTOR(ExternalTextureDescriptor) - void setDefault(); -END - -DESCRIPTOR(ImageCopyBuffer) - void setDefault(); -END - -DESCRIPTOR(ImageCopyExternalTexture) - void setDefault(); -END - -DESCRIPTOR(ImageCopyTexture) - void setDefault(); -END - -DESCRIPTOR(InstanceDescriptor) - void setDefault(); -END - -DESCRIPTOR(ProgrammableStageDescriptor) - void setDefault(); -END - -DESCRIPTOR(RenderPassColorAttachment) - void setDefault(); -END - -DESCRIPTOR(RenderPassStorageAttachment) - void setDefault(); -END - -DESCRIPTOR(RequiredLimits) - void setDefault(); -END - -DESCRIPTOR(SharedTextureMemoryProperties) - void setDefault(); -END - -DESCRIPTOR(SupportedLimits) - void setDefault(); -END - -DESCRIPTOR(TextureDescriptor) - void setDefault(); -END - -DESCRIPTOR(BindGroupLayoutDescriptor) - void setDefault(); -END - -DESCRIPTOR(ColorTargetState) - void setDefault(); -END - -DESCRIPTOR(ComputePipelineDescriptor) - void setDefault(); -END - -DESCRIPTOR(DeviceDescriptor) - void setDefault(); -END - -DESCRIPTOR(RenderPassDescriptor) - void setDefault(); -END - -DESCRIPTOR(VertexState) - void setDefault(); -END - -DESCRIPTOR(FragmentState) - void setDefault(); -END - -DESCRIPTOR(RenderPipelineDescriptor) - void setDefault(); -END - - -// Handles forward declarations -class Adapter; -class BindGroup; -class BindGroupLayout; -class Buffer; -class CommandBuffer; -class CommandEncoder; -class ComputePassEncoder; -class ComputePipeline; -class Device; -class ExternalTexture; -class Instance; -class PipelineLayout; -class QuerySet; -class Queue; -class RenderBundle; -class RenderBundleEncoder; -class RenderPassEncoder; -class RenderPipeline; -class Sampler; -class ShaderModule; -class SharedBufferMemory; -class SharedFence; -class SharedTextureMemory; -class Surface; -class SwapChain; -class Texture; -class TextureView; - -// Callback types -using BufferMapCallback = std::function; -using CompilationInfoCallback = std::function; -using CreateComputePipelineAsyncCallback = std::function; -using CreateRenderPipelineAsyncCallback = std::function; -using DeviceLostCallback = std::function; -using ErrorCallback = std::function; -using LoggingCallback = std::function; -using PopErrorScopeCallback = std::function; -using QueueWorkDoneCallback = std::function; -using RequestAdapterCallback = std::function; -using RequestDeviceCallback = std::function; -using ProcDeviceSetDeviceLostCallback = std::function; -using ProcDeviceSetLoggingCallback = std::function; -using ProcDeviceSetUncapturedErrorCallback = std::function; - -// Handles detailed declarations -HANDLE(Adapter) - Device createDevice(const DeviceDescriptor& descriptor); - Device createDevice(); - size_t enumerateFeatures(FeatureName * features); - Bool getFormatCapabilities(TextureFormat format, FormatCapabilities * capabilities); - Instance getInstance(); - Bool getLimits(SupportedLimits * limits); - void getProperties(AdapterProperties * properties); - Bool hasFeature(FeatureName feature); - std::unique_ptr requestDevice(const DeviceDescriptor& descriptor, RequestDeviceCallback&& callback); - Future requestDeviceF(const DeviceDescriptor& options, RequestDeviceCallbackInfo callbackInfo); - void reference(); - void release(); - Device requestDevice(const DeviceDescriptor& descriptor); -END - -HANDLE(BindGroup) - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(BindGroupLayout) - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(Buffer) - void destroy(); - void const * getConstMappedRange(size_t offset, size_t size); - BufferMapState getMapState(); - void * getMappedRange(size_t offset, size_t size); - uint64_t getSize(); - BufferUsageFlags getUsage(); - std::unique_ptr mapAsync(MapModeFlags mode, size_t offset, size_t size, BufferMapCallback&& callback); - Future mapAsyncF(MapModeFlags mode, size_t offset, size_t size, BufferMapCallbackInfo callbackInfo); - void setLabel(char const * label); - void unmap(); - void reference(); - void release(); -END - -HANDLE(CommandBuffer) - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(CommandEncoder) - ComputePassEncoder beginComputePass(const ComputePassDescriptor& descriptor); - ComputePassEncoder beginComputePass(); - RenderPassEncoder beginRenderPass(const RenderPassDescriptor& descriptor); - void clearBuffer(Buffer buffer, uint64_t offset, uint64_t size); - void copyBufferToBuffer(Buffer source, uint64_t sourceOffset, Buffer destination, uint64_t destinationOffset, uint64_t size); - void copyBufferToTexture(const ImageCopyBuffer& source, const ImageCopyTexture& destination, const Extent3D& copySize); - void copyTextureToBuffer(const ImageCopyTexture& source, const ImageCopyBuffer& destination, const Extent3D& copySize); - void copyTextureToTexture(const ImageCopyTexture& source, const ImageCopyTexture& destination, const Extent3D& copySize); - CommandBuffer finish(const CommandBufferDescriptor& descriptor); - CommandBuffer finish(); - void injectValidationError(char const * message); - void insertDebugMarker(char const * markerLabel); - void popDebugGroup(); - void pushDebugGroup(char const * groupLabel); - void resolveQuerySet(QuerySet querySet, uint32_t firstQuery, uint32_t queryCount, Buffer destination, uint64_t destinationOffset); - void setLabel(char const * label); - void writeBuffer(Buffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size); - void writeTimestamp(QuerySet querySet, uint32_t queryIndex); - void reference(); - void release(); -END - -HANDLE(ComputePassEncoder) - void dispatchWorkgroups(uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ); - void dispatchWorkgroupsIndirect(Buffer indirectBuffer, uint64_t indirectOffset); - void end(); - void insertDebugMarker(char const * markerLabel); - void popDebugGroup(); - void pushDebugGroup(char const * groupLabel); - void setBindGroup(uint32_t groupIndex, BindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets); - void setBindGroup(uint32_t groupIndex, BindGroup group, const std::vector& dynamicOffsets); - void setBindGroup(uint32_t groupIndex, BindGroup group, const uint32_t& dynamicOffsets); - void setLabel(char const * label); - void setPipeline(ComputePipeline pipeline); - void writeTimestamp(QuerySet querySet, uint32_t queryIndex); - void reference(); - void release(); -END - -HANDLE(ComputePipeline) - BindGroupLayout getBindGroupLayout(uint32_t groupIndex); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(Device) - BindGroup createBindGroup(const BindGroupDescriptor& descriptor); - BindGroupLayout createBindGroupLayout(const BindGroupLayoutDescriptor& descriptor); - Buffer createBuffer(const BufferDescriptor& descriptor); - CommandEncoder createCommandEncoder(const CommandEncoderDescriptor& descriptor); - CommandEncoder createCommandEncoder(); - ComputePipeline createComputePipeline(const ComputePipelineDescriptor& descriptor); - std::unique_ptr createComputePipelineAsync(const ComputePipelineDescriptor& descriptor, CreateComputePipelineAsyncCallback&& callback); - Future createComputePipelineAsyncF(const ComputePipelineDescriptor& descriptor, CreateComputePipelineAsyncCallbackInfo callbackInfo); - Buffer createErrorBuffer(const BufferDescriptor& descriptor); - ExternalTexture createErrorExternalTexture(); - ShaderModule createErrorShaderModule(const ShaderModuleDescriptor& descriptor, char const * errorMessage); - Texture createErrorTexture(const TextureDescriptor& descriptor); - ExternalTexture createExternalTexture(const ExternalTextureDescriptor& externalTextureDescriptor); - PipelineLayout createPipelineLayout(const PipelineLayoutDescriptor& descriptor); - QuerySet createQuerySet(const QuerySetDescriptor& descriptor); - RenderBundleEncoder createRenderBundleEncoder(const RenderBundleEncoderDescriptor& descriptor); - RenderPipeline createRenderPipeline(const RenderPipelineDescriptor& descriptor); - std::unique_ptr createRenderPipelineAsync(const RenderPipelineDescriptor& descriptor, CreateRenderPipelineAsyncCallback&& callback); - Future createRenderPipelineAsyncF(const RenderPipelineDescriptor& descriptor, CreateRenderPipelineAsyncCallbackInfo callbackInfo); - Sampler createSampler(const SamplerDescriptor& descriptor); - Sampler createSampler(); - ShaderModule createShaderModule(const ShaderModuleDescriptor& descriptor); - SwapChain createSwapChain(Surface surface, const SwapChainDescriptor& descriptor); - Texture createTexture(const TextureDescriptor& descriptor); - void destroy(); - size_t enumerateFeatures(FeatureName * features); - void forceLoss(DeviceLostReason type, char const * message); - Adapter getAdapter(); - Bool getLimits(SupportedLimits * limits); - Queue getQueue(); - TextureUsageFlags getSupportedSurfaceUsage(Surface surface); - Bool hasFeature(FeatureName feature); - SharedBufferMemory importSharedBufferMemory(const SharedBufferMemoryDescriptor& descriptor); - SharedFence importSharedFence(const SharedFenceDescriptor& descriptor); - SharedTextureMemory importSharedTextureMemory(const SharedTextureMemoryDescriptor& descriptor); - void injectError(ErrorType type, char const * message); - std::unique_ptr popErrorScope(ErrorCallback&& oldCallback); - Future popErrorScopeF(PopErrorScopeCallbackInfo callbackInfo); - void pushErrorScope(ErrorFilter filter); - std::unique_ptr setDeviceLostCallback(DeviceLostCallback&& callback); - void setLabel(char const * label); - std::unique_ptr setLoggingCallback(LoggingCallback&& callback); - std::unique_ptr setUncapturedErrorCallback(ErrorCallback&& callback); - void tick(); - void validateTextureDescriptor(const TextureDescriptor& descriptor); - void reference(); - void release(); -END - -HANDLE(ExternalTexture) - void destroy(); - void expire(); - void refresh(); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(Instance) - Surface createSurface(const SurfaceDescriptor& descriptor); - size_t enumerateWGSLLanguageFeatures(WGSLFeatureName * features); - Bool hasWGSLLanguageFeature(WGSLFeatureName feature); - void processEvents(); - std::unique_ptr requestAdapter(const RequestAdapterOptions& options, RequestAdapterCallback&& callback); - Future requestAdapterF(const RequestAdapterOptions& options, RequestAdapterCallbackInfo callbackInfo); - WaitStatus waitAny(size_t futureCount, FutureWaitInfo * futures, uint64_t timeoutNS); - void reference(); - void release(); - Adapter requestAdapter(const RequestAdapterOptions& options); -END - -HANDLE(PipelineLayout) - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(QuerySet) - void destroy(); - uint32_t getCount(); - QueryType getType(); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(Queue) - void copyExternalTextureForBrowser(const ImageCopyExternalTexture& source, const ImageCopyTexture& destination, const Extent3D& copySize, const CopyTextureForBrowserOptions& options); - void copyTextureForBrowser(const ImageCopyTexture& source, const ImageCopyTexture& destination, const Extent3D& copySize, const CopyTextureForBrowserOptions& options); - std::unique_ptr onSubmittedWorkDone(QueueWorkDoneCallback&& callback); - Future onSubmittedWorkDoneF(QueueWorkDoneCallbackInfo callbackInfo); - void setLabel(char const * label); - void submit(size_t commandCount, CommandBuffer const * commands); - void submit(const std::vector& commands); - void submit(const WGPUCommandBuffer& commands); - void writeBuffer(Buffer buffer, uint64_t bufferOffset, void const * data, size_t size); - void writeTexture(const ImageCopyTexture& destination, void const * data, size_t dataSize, const TextureDataLayout& dataLayout, const Extent3D& writeSize); - void reference(); - void release(); -END - -HANDLE(RenderBundle) - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(RenderBundleEncoder) - void draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); - void drawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance); - void drawIndexedIndirect(Buffer indirectBuffer, uint64_t indirectOffset); - void drawIndirect(Buffer indirectBuffer, uint64_t indirectOffset); - RenderBundle finish(const RenderBundleDescriptor& descriptor); - RenderBundle finish(); - void insertDebugMarker(char const * markerLabel); - void popDebugGroup(); - void pushDebugGroup(char const * groupLabel); - void setBindGroup(uint32_t groupIndex, BindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets); - void setBindGroup(uint32_t groupIndex, BindGroup group, const std::vector& dynamicOffsets); - void setBindGroup(uint32_t groupIndex, BindGroup group, const uint32_t& dynamicOffsets); - void setIndexBuffer(Buffer buffer, IndexFormat format, uint64_t offset, uint64_t size); - void setLabel(char const * label); - void setPipeline(RenderPipeline pipeline); - void setVertexBuffer(uint32_t slot, Buffer buffer, uint64_t offset, uint64_t size); - void reference(); - void release(); -END - -HANDLE(RenderPassEncoder) - void beginOcclusionQuery(uint32_t queryIndex); - void draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); - void drawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance); - void drawIndexedIndirect(Buffer indirectBuffer, uint64_t indirectOffset); - void drawIndirect(Buffer indirectBuffer, uint64_t indirectOffset); - void end(); - void endOcclusionQuery(); - void executeBundles(size_t bundleCount, RenderBundle const * bundles); - void executeBundles(const std::vector& bundles); - void executeBundles(const WGPURenderBundle& bundles); - void insertDebugMarker(char const * markerLabel); - void pixelLocalStorageBarrier(); - void popDebugGroup(); - void pushDebugGroup(char const * groupLabel); - void setBindGroup(uint32_t groupIndex, BindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets); - void setBindGroup(uint32_t groupIndex, BindGroup group, const std::vector& dynamicOffsets); - void setBindGroup(uint32_t groupIndex, BindGroup group, const uint32_t& dynamicOffsets); - void setBlendConstant(const Color& color); - void setIndexBuffer(Buffer buffer, IndexFormat format, uint64_t offset, uint64_t size); - void setLabel(char const * label); - void setPipeline(RenderPipeline pipeline); - void setScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height); - void setStencilReference(uint32_t reference); - void setVertexBuffer(uint32_t slot, Buffer buffer, uint64_t offset, uint64_t size); - void setViewport(float x, float y, float width, float height, float minDepth, float maxDepth); - void writeTimestamp(QuerySet querySet, uint32_t queryIndex); - void reference(); - void release(); -END - -HANDLE(RenderPipeline) - BindGroupLayout getBindGroupLayout(uint32_t groupIndex); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(Sampler) - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(ShaderModule) - std::unique_ptr getCompilationInfo(CompilationInfoCallback&& callback); - Future getCompilationInfoF(CompilationInfoCallbackInfo callbackInfo); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(SharedBufferMemory) - Bool beginAccess(Buffer buffer, const SharedBufferMemoryBeginAccessDescriptor& descriptor); - Buffer createBuffer(const BufferDescriptor& descriptor); - Buffer createBuffer(); - Bool endAccess(Buffer buffer, SharedBufferMemoryEndAccessState * descriptor); - void getProperties(SharedBufferMemoryProperties * properties); - Bool isDeviceLost(); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(SharedFence) - void exportInfo(SharedFenceExportInfo * info); - void reference(); - void release(); -END - -HANDLE(SharedTextureMemory) - Bool beginAccess(Texture texture, const SharedTextureMemoryBeginAccessDescriptor& descriptor); - Texture createTexture(const TextureDescriptor& descriptor); - Texture createTexture(); - Bool endAccess(Texture texture, SharedTextureMemoryEndAccessState * descriptor); - void getProperties(SharedTextureMemoryProperties * properties); - Bool isDeviceLost(); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(Surface) - TextureFormat getPreferredFormat(Adapter adapter); - void reference(); - void release(); -END - -HANDLE(SwapChain) - Texture getCurrentTexture(); - TextureView getCurrentTextureView(); - void present(); - void reference(); - void release(); -END - -HANDLE(Texture) - TextureView createErrorView(const TextureViewDescriptor& descriptor); - TextureView createErrorView(); - TextureView createView(const TextureViewDescriptor& descriptor); - TextureView createView(); - void destroy(); - uint32_t getDepthOrArrayLayers(); - TextureDimension getDimension(); - TextureFormat getFormat(); - uint32_t getHeight(); - uint32_t getMipLevelCount(); - uint32_t getSampleCount(); - TextureUsageFlags getUsage(); - uint32_t getWidth(); - void setLabel(char const * label); - void reference(); - void release(); -END - -HANDLE(TextureView) - void setLabel(char const * label); - void reference(); - void release(); -END - - -// Non-member procedures - - -Instance createInstance(const InstanceDescriptor& descriptor); - -#ifdef WEBGPU_CPP_IMPLEMENTATION - -Instance createInstance(const InstanceDescriptor& descriptor) { - return wgpuCreateInstance(&descriptor); -} - -// Handles members implementation -// Methods of ChainedStruct -void ChainedStruct::setDefault() { -} - - -// Methods of ChainedStructOut -void ChainedStructOut::setDefault() { -} - - -// Methods of AdapterProperties -void AdapterProperties::setDefault() { - backendType = BackendType::Undefined; -} -void AdapterProperties::freeMembers() { - return wgpuAdapterPropertiesFreeMembers(*this); -} - - -// Methods of AdapterPropertiesD3D -void AdapterPropertiesD3D::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::AdapterPropertiesD3D; -} - - -// Methods of AdapterPropertiesVk -void AdapterPropertiesVk::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::AdapterPropertiesVk; -} - - -// Methods of BindGroupEntry -void BindGroupEntry::setDefault() { - offset = 0; -} - - -// Methods of BlendComponent -void BlendComponent::setDefault() { - operation = BlendOperation::Add; - srcFactor = BlendFactor::One; - dstFactor = BlendFactor::Zero; -} - - -// Methods of BufferBindingLayout -void BufferBindingLayout::setDefault() { - type = BufferBindingType::Uniform; - hasDynamicOffset = false; - minBindingSize = 0; -} - - -// Methods of BufferDescriptor -void BufferDescriptor::setDefault() { - mappedAtCreation = false; -} - - -// Methods of BufferHostMappedPointer -void BufferHostMappedPointer::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::BufferHostMappedPointer; -} - - -// Methods of BufferMapCallbackInfo -void BufferMapCallbackInfo::setDefault() { -} - - -// Methods of Color -void Color::setDefault() { -} - - -// Methods of CommandBufferDescriptor -void CommandBufferDescriptor::setDefault() { -} - - -// Methods of CommandEncoderDescriptor -void CommandEncoderDescriptor::setDefault() { -} - - -// Methods of CompilationInfoCallbackInfo -void CompilationInfoCallbackInfo::setDefault() { -} - - -// Methods of CompilationMessage -void CompilationMessage::setDefault() { -} - - -// Methods of ComputePassTimestampWrites -void ComputePassTimestampWrites::setDefault() { -} - - -// Methods of ConstantEntry -void ConstantEntry::setDefault() { -} - - -// Methods of CopyTextureForBrowserOptions -void CopyTextureForBrowserOptions::setDefault() { -} - - -// Methods of CreateComputePipelineAsyncCallbackInfo -void CreateComputePipelineAsyncCallbackInfo::setDefault() { -} - - -// Methods of CreateRenderPipelineAsyncCallbackInfo -void CreateRenderPipelineAsyncCallbackInfo::setDefault() { -} - - -// Methods of DawnWGSLBlocklist -void DawnWGSLBlocklist::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnWGSLBlocklist; -} - - -// Methods of DawnAdapterPropertiesPowerPreference -void DawnAdapterPropertiesPowerPreference::setDefault() { - powerPreference = PowerPreference::Undefined; - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::DawnAdapterPropertiesPowerPreference; -} - - -// Methods of DawnBufferDescriptorErrorInfoFromWireClient -void DawnBufferDescriptorErrorInfoFromWireClient::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnBufferDescriptorErrorInfoFromWireClient; -} - - -// Methods of DawnCacheDeviceDescriptor -void DawnCacheDeviceDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnCacheDeviceDescriptor; -} - - -// Methods of DawnComputePipelineFullSubgroups -void DawnComputePipelineFullSubgroups::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnComputePipelineFullSubgroups; -} - - -// Methods of DawnEncoderInternalUsageDescriptor -void DawnEncoderInternalUsageDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnEncoderInternalUsageDescriptor; -} - - -// Methods of DawnExperimentalSubgroupLimits -void DawnExperimentalSubgroupLimits::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::DawnExperimentalSubgroupLimits; -} - - -// Methods of DawnMultisampleStateRenderToSingleSampled -void DawnMultisampleStateRenderToSingleSampled::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnMultisampleStateRenderToSingleSampled; -} - - -// Methods of DawnRenderPassColorAttachmentRenderToSingleSampled -void DawnRenderPassColorAttachmentRenderToSingleSampled::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnRenderPassColorAttachmentRenderToSingleSampled; -} - - -// Methods of DawnShaderModuleSPIRVOptionsDescriptor -void DawnShaderModuleSPIRVOptionsDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnShaderModuleSPIRVOptionsDescriptor; -} - - -// Methods of DawnTextureInternalUsageDescriptor -void DawnTextureInternalUsageDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnTextureInternalUsageDescriptor; -} - - -// Methods of DawnTogglesDescriptor -void DawnTogglesDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnTogglesDescriptor; -} - - -// Methods of DawnWireWGSLControl -void DawnWireWGSLControl::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DawnWireWGSLControl; -} - - -// Methods of DepthStencilStateDepthWriteDefinedDawn -void DepthStencilStateDepthWriteDefinedDawn::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::DepthStencilStateDepthWriteDefinedDawn; -} - - -// Methods of DrmFormatProperties -void DrmFormatProperties::setDefault() { -} - - -// Methods of Extent2D -void Extent2D::setDefault() { -} - - -// Methods of Extent3D -void Extent3D::setDefault() { - height = 1; - depthOrArrayLayers = 1; -} - - -// Methods of ExternalTextureBindingEntry -void ExternalTextureBindingEntry::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::ExternalTextureBindingEntry; -} - - -// Methods of ExternalTextureBindingLayout -void ExternalTextureBindingLayout::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::ExternalTextureBindingLayout; -} - - -// Methods of FormatCapabilities -void FormatCapabilities::setDefault() { -} - - -// Methods of Future -void Future::setDefault() { -} - - -// Methods of InstanceFeatures -void InstanceFeatures::setDefault() { -} - - -// Methods of Limits -void Limits::setDefault() { - maxTextureDimension1D = 0; - maxTextureDimension2D = 0; - maxTextureDimension3D = 0; - maxTextureArrayLayers = 0; - maxBindGroups = 0; - maxBindingsPerBindGroup = 0; - maxDynamicUniformBuffersPerPipelineLayout = 0; - maxDynamicStorageBuffersPerPipelineLayout = 0; - maxSampledTexturesPerShaderStage = 0; - maxSamplersPerShaderStage = 0; - maxStorageBuffersPerShaderStage = 0; - maxStorageTexturesPerShaderStage = 0; - maxUniformBuffersPerShaderStage = 0; - maxUniformBufferBindingSize = 0; - maxStorageBufferBindingSize = 0; - minUniformBufferOffsetAlignment = 64; - minStorageBufferOffsetAlignment = 16; - maxVertexBuffers = 0; - maxBufferSize = 0; - maxVertexAttributes = 0; - maxVertexBufferArrayStride = 0; - maxInterStageShaderComponents = 0; - maxInterStageShaderVariables = 0; - maxColorAttachments = 0; - maxColorAttachmentBytesPerSample = 0; - maxComputeWorkgroupStorageSize = 0; - maxComputeInvocationsPerWorkgroup = 0; - maxComputeWorkgroupSizeX = 0; - maxComputeWorkgroupSizeY = 0; - maxComputeWorkgroupSizeZ = 0; - maxComputeWorkgroupsPerDimension = 0; -} - - -// Methods of MemoryHeapInfo -void MemoryHeapInfo::setDefault() { -} - - -// Methods of MultisampleState -void MultisampleState::setDefault() { - count = 1; - mask = 0xFFFFFFFF; - alphaToCoverageEnabled = false; -} - - -// Methods of Origin2D -void Origin2D::setDefault() { -} - - -// Methods of Origin3D -void Origin3D::setDefault() { - x = 0; - y = 0; - z = 0; -} - - -// Methods of PipelineLayoutDescriptor -void PipelineLayoutDescriptor::setDefault() { -} - - -// Methods of PipelineLayoutStorageAttachment -void PipelineLayoutStorageAttachment::setDefault() { - format = TextureFormat::Undefined; -} - - -// Methods of PopErrorScopeCallbackInfo -void PopErrorScopeCallbackInfo::setDefault() { -} - - -// Methods of PrimitiveDepthClipControl -void PrimitiveDepthClipControl::setDefault() { - unclippedDepth = false; - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::PrimitiveDepthClipControl; -} - - -// Methods of PrimitiveState -void PrimitiveState::setDefault() { - topology = PrimitiveTopology::TriangleList; - stripIndexFormat = IndexFormat::Undefined; - frontFace = FrontFace::CCW; - cullMode = CullMode::None; -} - - -// Methods of QuerySetDescriptor -void QuerySetDescriptor::setDefault() { -} - - -// Methods of QueueDescriptor -void QueueDescriptor::setDefault() { -} - - -// Methods of QueueWorkDoneCallbackInfo -void QueueWorkDoneCallbackInfo::setDefault() { -} - - -// Methods of RenderBundleDescriptor -void RenderBundleDescriptor::setDefault() { -} - - -// Methods of RenderBundleEncoderDescriptor -void RenderBundleEncoderDescriptor::setDefault() { - depthStencilFormat = TextureFormat::Undefined; - depthReadOnly = false; - stencilReadOnly = false; - sampleCount = 1; -} - - -// Methods of RenderPassDepthStencilAttachment -void RenderPassDepthStencilAttachment::setDefault() { - depthLoadOp = LoadOp::Undefined; - depthStoreOp = StoreOp::Undefined; - depthReadOnly = false; - stencilLoadOp = LoadOp::Undefined; - stencilStoreOp = StoreOp::Undefined; - stencilClearValue = 0; - stencilReadOnly = false; -} - - -// Methods of RenderPassDescriptorMaxDrawCount -void RenderPassDescriptorMaxDrawCount::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::RenderPassDescriptorMaxDrawCount; -} - - -// Methods of RenderPassTimestampWrites -void RenderPassTimestampWrites::setDefault() { -} - - -// Methods of RequestAdapterCallbackInfo -void RequestAdapterCallbackInfo::setDefault() { -} - - -// Methods of RequestAdapterOptions -void RequestAdapterOptions::setDefault() { - powerPreference = PowerPreference::Undefined; - backendType = BackendType::Undefined; - forceFallbackAdapter = false; -} - - -// Methods of RequestDeviceCallbackInfo -void RequestDeviceCallbackInfo::setDefault() { -} - - -// Methods of SamplerBindingLayout -void SamplerBindingLayout::setDefault() { - type = SamplerBindingType::Filtering; -} - - -// Methods of SamplerDescriptor -void SamplerDescriptor::setDefault() { - addressModeU = AddressMode::ClampToEdge; - addressModeV = AddressMode::ClampToEdge; - addressModeW = AddressMode::ClampToEdge; - magFilter = FilterMode::Nearest; - minFilter = FilterMode::Nearest; - mipmapFilter = MipmapFilterMode::Nearest; - lodMinClamp = 0; - lodMaxClamp = 32; - compare = CompareFunction::Undefined; -} - - -// Methods of ShaderModuleSPIRVDescriptor -void ShaderModuleSPIRVDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::ShaderModuleSPIRVDescriptor; -} - - -// Methods of ShaderModuleWGSLDescriptor -void ShaderModuleWGSLDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::ShaderModuleWGSLDescriptor; -} - - -// Methods of ShaderModuleDescriptor -void ShaderModuleDescriptor::setDefault() { -} - - -// Methods of SharedBufferMemoryBeginAccessDescriptor -void SharedBufferMemoryBeginAccessDescriptor::setDefault() { -} - - -// Methods of SharedBufferMemoryDescriptor -void SharedBufferMemoryDescriptor::setDefault() { -} - - -// Methods of SharedBufferMemoryEndAccessState -void SharedBufferMemoryEndAccessState::setDefault() { -} -void SharedBufferMemoryEndAccessState::freeMembers() { - return wgpuSharedBufferMemoryEndAccessStateFreeMembers(*this); -} - - -// Methods of SharedBufferMemoryProperties -void SharedBufferMemoryProperties::setDefault() { -} - - -// Methods of SharedFenceDXGISharedHandleDescriptor -void SharedFenceDXGISharedHandleDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedFenceDXGISharedHandleDescriptor; -} - - -// Methods of SharedFenceDXGISharedHandleExportInfo -void SharedFenceDXGISharedHandleExportInfo::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::SharedFenceDXGISharedHandleExportInfo; -} - - -// Methods of SharedFenceMTLSharedEventDescriptor -void SharedFenceMTLSharedEventDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedFenceMTLSharedEventDescriptor; -} - - -// Methods of SharedFenceMTLSharedEventExportInfo -void SharedFenceMTLSharedEventExportInfo::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::SharedFenceMTLSharedEventExportInfo; -} - - -// Methods of SharedFenceDescriptor -void SharedFenceDescriptor::setDefault() { -} - - -// Methods of SharedFenceExportInfo -void SharedFenceExportInfo::setDefault() { - type = SharedFenceType::Undefined; -} - - -// Methods of SharedFenceVkSemaphoreOpaqueFDDescriptor -void SharedFenceVkSemaphoreOpaqueFDDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedFenceVkSemaphoreOpaqueFDDescriptor; -} - - -// Methods of SharedFenceVkSemaphoreOpaqueFDExportInfo -void SharedFenceVkSemaphoreOpaqueFDExportInfo::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::SharedFenceVkSemaphoreOpaqueFDExportInfo; -} - - -// Methods of SharedFenceVkSemaphoreSyncFDDescriptor -void SharedFenceVkSemaphoreSyncFDDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedFenceVkSemaphoreSyncFDDescriptor; -} - - -// Methods of SharedFenceVkSemaphoreSyncFDExportInfo -void SharedFenceVkSemaphoreSyncFDExportInfo::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::SharedFenceVkSemaphoreSyncFDExportInfo; -} - - -// Methods of SharedFenceVkSemaphoreZirconHandleDescriptor -void SharedFenceVkSemaphoreZirconHandleDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedFenceVkSemaphoreZirconHandleDescriptor; -} - - -// Methods of SharedFenceVkSemaphoreZirconHandleExportInfo -void SharedFenceVkSemaphoreZirconHandleExportInfo::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::SharedFenceVkSemaphoreZirconHandleExportInfo; -} - - -// Methods of SharedTextureMemoryDXGISharedHandleDescriptor -void SharedTextureMemoryDXGISharedHandleDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryDXGISharedHandleDescriptor; -} - - -// Methods of SharedTextureMemoryEGLImageDescriptor -void SharedTextureMemoryEGLImageDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryEGLImageDescriptor; -} - - -// Methods of SharedTextureMemoryIOSurfaceDescriptor -void SharedTextureMemoryIOSurfaceDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryIOSurfaceDescriptor; -} - - -// Methods of SharedTextureMemoryAHardwareBufferDescriptor -void SharedTextureMemoryAHardwareBufferDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryAHardwareBufferDescriptor; -} - - -// Methods of SharedTextureMemoryBeginAccessDescriptor -void SharedTextureMemoryBeginAccessDescriptor::setDefault() { -} - - -// Methods of SharedTextureMemoryDescriptor -void SharedTextureMemoryDescriptor::setDefault() { -} - - -// Methods of SharedTextureMemoryDmaBufPlane -void SharedTextureMemoryDmaBufPlane::setDefault() { -} - - -// Methods of SharedTextureMemoryEndAccessState -void SharedTextureMemoryEndAccessState::setDefault() { -} -void SharedTextureMemoryEndAccessState::freeMembers() { - return wgpuSharedTextureMemoryEndAccessStateFreeMembers(*this); -} - - -// Methods of SharedTextureMemoryOpaqueFDDescriptor -void SharedTextureMemoryOpaqueFDDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryOpaqueFDDescriptor; -} - - -// Methods of SharedTextureMemoryVkDedicatedAllocationDescriptor -void SharedTextureMemoryVkDedicatedAllocationDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryVkDedicatedAllocationDescriptor; -} - - -// Methods of SharedTextureMemoryVkImageLayoutBeginState -void SharedTextureMemoryVkImageLayoutBeginState::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryVkImageLayoutBeginState; -} - - -// Methods of SharedTextureMemoryVkImageLayoutEndState -void SharedTextureMemoryVkImageLayoutEndState::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryVkImageLayoutEndState; -} - - -// Methods of SharedTextureMemoryZirconHandleDescriptor -void SharedTextureMemoryZirconHandleDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SharedTextureMemoryZirconHandleDescriptor; -} - - -// Methods of StaticSamplerBindingLayout -void StaticSamplerBindingLayout::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::StaticSamplerBindingLayout; -} - - -// Methods of StencilFaceState -void StencilFaceState::setDefault() { - compare = CompareFunction::Always; - failOp = StencilOperation::Keep; - depthFailOp = StencilOperation::Keep; - passOp = StencilOperation::Keep; -} - - -// Methods of StorageTextureBindingLayout -void StorageTextureBindingLayout::setDefault() { - access = StorageTextureAccess::WriteOnly; - format = TextureFormat::Undefined; - viewDimension = TextureViewDimension::_2D; -} - - -// Methods of SurfaceDescriptor -void SurfaceDescriptor::setDefault() { -} - - -// Methods of SurfaceDescriptorFromAndroidNativeWindow -void SurfaceDescriptorFromAndroidNativeWindow::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromAndroidNativeWindow; -} - - -// Methods of SurfaceDescriptorFromCanvasHTMLSelector -void SurfaceDescriptorFromCanvasHTMLSelector::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromCanvasHTMLSelector; -} - - -// Methods of SurfaceDescriptorFromMetalLayer -void SurfaceDescriptorFromMetalLayer::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromMetalLayer; -} - - -// Methods of SurfaceDescriptorFromWaylandSurface -void SurfaceDescriptorFromWaylandSurface::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromWaylandSurface; -} - - -// Methods of SurfaceDescriptorFromWindowsHWND -void SurfaceDescriptorFromWindowsHWND::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromWindowsHWND; -} - - -// Methods of SurfaceDescriptorFromWindowsCoreWindow -void SurfaceDescriptorFromWindowsCoreWindow::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromWindowsCoreWindow; -} - - -// Methods of SurfaceDescriptorFromWindowsSwapChainPanel -void SurfaceDescriptorFromWindowsSwapChainPanel::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromWindowsSwapChainPanel; -} - - -// Methods of SurfaceDescriptorFromXlibWindow -void SurfaceDescriptorFromXlibWindow::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::SurfaceDescriptorFromXlibWindow; -} - - -// Methods of SwapChainDescriptor -void SwapChainDescriptor::setDefault() { - format = TextureFormat::Undefined; -} - - -// Methods of TextureBindingLayout -void TextureBindingLayout::setDefault() { - sampleType = TextureSampleType::Float; - viewDimension = TextureViewDimension::_2D; - multisampled = false; -} - - -// Methods of TextureBindingViewDimensionDescriptor -void TextureBindingViewDimensionDescriptor::setDefault() { - textureBindingViewDimension = TextureViewDimension::Undefined; - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::TextureBindingViewDimensionDescriptor; -} - - -// Methods of TextureDataLayout -void TextureDataLayout::setDefault() { -} - - -// Methods of TextureViewDescriptor -void TextureViewDescriptor::setDefault() { - format = TextureFormat::Undefined; - dimension = TextureViewDimension::Undefined; - baseMipLevel = 0; - baseArrayLayer = 0; - aspect = TextureAspect::All; -} - - -// Methods of VertexAttribute -void VertexAttribute::setDefault() { - format = VertexFormat::Undefined; -} - - -// Methods of AdapterPropertiesMemoryHeaps -void AdapterPropertiesMemoryHeaps::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::AdapterPropertiesMemoryHeaps; -} -void AdapterPropertiesMemoryHeaps::freeMembers() { - return wgpuAdapterPropertiesMemoryHeapsFreeMembers(*this); -} - - -// Methods of BindGroupDescriptor -void BindGroupDescriptor::setDefault() { -} - - -// Methods of BindGroupLayoutEntry -void BindGroupLayoutEntry::setDefault() { - ((BufferBindingLayout*)&buffer)->setDefault(); - ((SamplerBindingLayout*)&sampler)->setDefault(); - ((TextureBindingLayout*)&texture)->setDefault(); - ((StorageTextureBindingLayout*)&storageTexture)->setDefault(); - buffer.type = BufferBindingType::Undefined; - sampler.type = SamplerBindingType::Undefined; - storageTexture.access = StorageTextureAccess::Undefined; - texture.sampleType = TextureSampleType::Undefined; -} - - -// Methods of BlendState -void BlendState::setDefault() { - ((BlendComponent*)&color)->setDefault(); - ((BlendComponent*)&alpha)->setDefault(); -} - - -// Methods of CompilationInfo -void CompilationInfo::setDefault() { -} - - -// Methods of ComputePassDescriptor -void ComputePassDescriptor::setDefault() { -} - - -// Methods of DepthStencilState -void DepthStencilState::setDefault() { - format = TextureFormat::Undefined; - depthCompare = CompareFunction::Undefined; - stencilReadMask = 0xFFFFFFFF; - stencilWriteMask = 0xFFFFFFFF; - depthBias = 0; - depthBiasSlopeScale = 0; - depthBiasClamp = 0; - ((StencilFaceState*)&stencilFront)->setDefault(); - ((StencilFaceState*)&stencilBack)->setDefault(); -} - - -// Methods of DrmFormatCapabilities -void DrmFormatCapabilities::setDefault() { - ((ChainedStructOut*)&chain)->setDefault(); - chain.sType = SType::DrmFormatCapabilities; -} -void DrmFormatCapabilities::freeMembers() { - return wgpuDrmFormatCapabilitiesFreeMembers(*this); -} - - -// Methods of ExternalTextureDescriptor -void ExternalTextureDescriptor::setDefault() { - ((Origin2D*)&visibleOrigin)->setDefault(); - ((Extent2D*)&visibleSize)->setDefault(); -} - - -// Methods of FutureWaitInfo -void FutureWaitInfo::setDefault() { - ((Future*)&future)->setDefault(); -} - - -// Methods of ImageCopyBuffer -void ImageCopyBuffer::setDefault() { - ((TextureDataLayout*)&layout)->setDefault(); -} - - -// Methods of ImageCopyExternalTexture -void ImageCopyExternalTexture::setDefault() { - ((Origin3D*)&origin)->setDefault(); - ((Extent2D*)&naturalSize)->setDefault(); -} - - -// Methods of ImageCopyTexture -void ImageCopyTexture::setDefault() { - mipLevel = 0; - aspect = TextureAspect::All; - ((Origin3D*)&origin)->setDefault(); -} - - -// Methods of InstanceDescriptor -void InstanceDescriptor::setDefault() { - ((InstanceFeatures*)&features)->setDefault(); -} - - -// Methods of PipelineLayoutPixelLocalStorage -void PipelineLayoutPixelLocalStorage::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::PipelineLayoutPixelLocalStorage; -} - - -// Methods of ProgrammableStageDescriptor -void ProgrammableStageDescriptor::setDefault() { -} - - -// Methods of RenderPassColorAttachment -void RenderPassColorAttachment::setDefault() { - loadOp = LoadOp::Undefined; - storeOp = StoreOp::Undefined; - ((Color*)&clearValue)->setDefault(); -} - - -// Methods of RenderPassStorageAttachment -void RenderPassStorageAttachment::setDefault() { - loadOp = LoadOp::Undefined; - storeOp = StoreOp::Undefined; - ((Color*)&clearValue)->setDefault(); -} - - -// Methods of RequiredLimits -void RequiredLimits::setDefault() { - ((Limits*)&limits)->setDefault(); -} - - -// Methods of SharedTextureMemoryDmaBufDescriptor -void SharedTextureMemoryDmaBufDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - ((Extent3D*)&size)->setDefault(); - chain.sType = SType::SharedTextureMemoryDmaBufDescriptor; -} - - -// Methods of SharedTextureMemoryProperties -void SharedTextureMemoryProperties::setDefault() { - format = TextureFormat::Undefined; - ((Extent3D*)&size)->setDefault(); -} - - -// Methods of SharedTextureMemoryVkImageDescriptor -void SharedTextureMemoryVkImageDescriptor::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - ((Extent3D*)&vkExtent3D)->setDefault(); - chain.sType = SType::SharedTextureMemoryVkImageDescriptor; -} - - -// Methods of SupportedLimits -void SupportedLimits::setDefault() { - ((Limits*)&limits)->setDefault(); -} - - -// Methods of TextureDescriptor -void TextureDescriptor::setDefault() { - dimension = TextureDimension::_2D; - format = TextureFormat::Undefined; - mipLevelCount = 1; - sampleCount = 1; - ((Extent3D*)&size)->setDefault(); -} - - -// Methods of VertexBufferLayout -void VertexBufferLayout::setDefault() { - stepMode = VertexStepMode::Vertex; -} - - -// Methods of BindGroupLayoutDescriptor -void BindGroupLayoutDescriptor::setDefault() { -} - - -// Methods of ColorTargetState -void ColorTargetState::setDefault() { - format = TextureFormat::Undefined; -} - - -// Methods of ComputePipelineDescriptor -void ComputePipelineDescriptor::setDefault() { - ((ProgrammableStageDescriptor*)&compute)->setDefault(); -} - - -// Methods of DeviceDescriptor -void DeviceDescriptor::setDefault() { - ((QueueDescriptor*)&defaultQueue)->setDefault(); -} - - -// Methods of RenderPassDescriptor -void RenderPassDescriptor::setDefault() { -} - - -// Methods of RenderPassPixelLocalStorage -void RenderPassPixelLocalStorage::setDefault() { - ((ChainedStruct*)&chain)->setDefault(); - chain.sType = SType::RenderPassPixelLocalStorage; -} - - -// Methods of VertexState -void VertexState::setDefault() { -} - - -// Methods of FragmentState -void FragmentState::setDefault() { -} - - -// Methods of RenderPipelineDescriptor -void RenderPipelineDescriptor::setDefault() { - ((VertexState*)&vertex)->setDefault(); - ((PrimitiveState*)&primitive)->setDefault(); - ((MultisampleState*)&multisample)->setDefault(); -} - - -// Methods of Adapter -Device Adapter::createDevice(const DeviceDescriptor& descriptor) { - return wgpuAdapterCreateDevice(m_raw, &descriptor); -} -Device Adapter::createDevice() { - return wgpuAdapterCreateDevice(m_raw, nullptr); -} -size_t Adapter::enumerateFeatures(FeatureName * features) { - return wgpuAdapterEnumerateFeatures(m_raw, reinterpret_cast(features)); -} -Bool Adapter::getFormatCapabilities(TextureFormat format, FormatCapabilities * capabilities) { - return wgpuAdapterGetFormatCapabilities(m_raw, static_cast(format), capabilities); -} -Instance Adapter::getInstance() { - return wgpuAdapterGetInstance(m_raw); -} -Bool Adapter::getLimits(SupportedLimits * limits) { - return wgpuAdapterGetLimits(m_raw, limits); -} -void Adapter::getProperties(AdapterProperties * properties) { - return wgpuAdapterGetProperties(m_raw, properties); -} -Bool Adapter::hasFeature(FeatureName feature) { - return wgpuAdapterHasFeature(m_raw, static_cast(feature)); -} -std::unique_ptr Adapter::requestDevice(const DeviceDescriptor& descriptor, RequestDeviceCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata) -> void { - RequestDeviceCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status), device, message); - }; - wgpuAdapterRequestDevice(m_raw, &descriptor, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Adapter::requestDeviceF(const DeviceDescriptor& options, RequestDeviceCallbackInfo callbackInfo) { - return wgpuAdapterRequestDeviceF(m_raw, &options, callbackInfo); -} -void Adapter::reference() { - return wgpuAdapterReference(m_raw); -} -void Adapter::release() { - return wgpuAdapterRelease(m_raw); -} - - -// Methods of BindGroup -void BindGroup::setLabel(char const * label) { - return wgpuBindGroupSetLabel(m_raw, label); -} -void BindGroup::reference() { - return wgpuBindGroupReference(m_raw); -} -void BindGroup::release() { - return wgpuBindGroupRelease(m_raw); -} - - -// Methods of BindGroupLayout -void BindGroupLayout::setLabel(char const * label) { - return wgpuBindGroupLayoutSetLabel(m_raw, label); -} -void BindGroupLayout::reference() { - return wgpuBindGroupLayoutReference(m_raw); -} -void BindGroupLayout::release() { - return wgpuBindGroupLayoutRelease(m_raw); -} - - -// Methods of Buffer -void Buffer::destroy() { - return wgpuBufferDestroy(m_raw); -} -void const * Buffer::getConstMappedRange(size_t offset, size_t size) { - return wgpuBufferGetConstMappedRange(m_raw, offset, size); -} -BufferMapState Buffer::getMapState() { - return static_cast(wgpuBufferGetMapState(m_raw)); -} -void * Buffer::getMappedRange(size_t offset, size_t size) { - return wgpuBufferGetMappedRange(m_raw, offset, size); -} -uint64_t Buffer::getSize() { - return wgpuBufferGetSize(m_raw); -} -BufferUsageFlags Buffer::getUsage() { - return wgpuBufferGetUsage(m_raw); -} -std::unique_ptr Buffer::mapAsync(MapModeFlags mode, size_t offset, size_t size, BufferMapCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUBufferMapAsyncStatus status, void * userdata) -> void { - BufferMapCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status)); - }; - wgpuBufferMapAsync(m_raw, mode, offset, size, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Buffer::mapAsyncF(MapModeFlags mode, size_t offset, size_t size, BufferMapCallbackInfo callbackInfo) { - return wgpuBufferMapAsyncF(m_raw, mode, offset, size, callbackInfo); -} -void Buffer::setLabel(char const * label) { - return wgpuBufferSetLabel(m_raw, label); -} -void Buffer::unmap() { - return wgpuBufferUnmap(m_raw); -} -void Buffer::reference() { - return wgpuBufferReference(m_raw); -} -void Buffer::release() { - return wgpuBufferRelease(m_raw); -} - - -// Methods of CommandBuffer -void CommandBuffer::setLabel(char const * label) { - return wgpuCommandBufferSetLabel(m_raw, label); -} -void CommandBuffer::reference() { - return wgpuCommandBufferReference(m_raw); -} -void CommandBuffer::release() { - return wgpuCommandBufferRelease(m_raw); -} - - -// Methods of CommandEncoder -ComputePassEncoder CommandEncoder::beginComputePass(const ComputePassDescriptor& descriptor) { - return wgpuCommandEncoderBeginComputePass(m_raw, &descriptor); -} -ComputePassEncoder CommandEncoder::beginComputePass() { - return wgpuCommandEncoderBeginComputePass(m_raw, nullptr); -} -RenderPassEncoder CommandEncoder::beginRenderPass(const RenderPassDescriptor& descriptor) { - return wgpuCommandEncoderBeginRenderPass(m_raw, &descriptor); -} -void CommandEncoder::clearBuffer(Buffer buffer, uint64_t offset, uint64_t size) { - return wgpuCommandEncoderClearBuffer(m_raw, buffer, offset, size); -} -void CommandEncoder::copyBufferToBuffer(Buffer source, uint64_t sourceOffset, Buffer destination, uint64_t destinationOffset, uint64_t size) { - return wgpuCommandEncoderCopyBufferToBuffer(m_raw, source, sourceOffset, destination, destinationOffset, size); -} -void CommandEncoder::copyBufferToTexture(const ImageCopyBuffer& source, const ImageCopyTexture& destination, const Extent3D& copySize) { - return wgpuCommandEncoderCopyBufferToTexture(m_raw, &source, &destination, ©Size); -} -void CommandEncoder::copyTextureToBuffer(const ImageCopyTexture& source, const ImageCopyBuffer& destination, const Extent3D& copySize) { - return wgpuCommandEncoderCopyTextureToBuffer(m_raw, &source, &destination, ©Size); -} -void CommandEncoder::copyTextureToTexture(const ImageCopyTexture& source, const ImageCopyTexture& destination, const Extent3D& copySize) { - return wgpuCommandEncoderCopyTextureToTexture(m_raw, &source, &destination, ©Size); -} -CommandBuffer CommandEncoder::finish(const CommandBufferDescriptor& descriptor) { - return wgpuCommandEncoderFinish(m_raw, &descriptor); -} -CommandBuffer CommandEncoder::finish() { - return wgpuCommandEncoderFinish(m_raw, nullptr); -} -void CommandEncoder::injectValidationError(char const * message) { - return wgpuCommandEncoderInjectValidationError(m_raw, message); -} -void CommandEncoder::insertDebugMarker(char const * markerLabel) { - return wgpuCommandEncoderInsertDebugMarker(m_raw, markerLabel); -} -void CommandEncoder::popDebugGroup() { - return wgpuCommandEncoderPopDebugGroup(m_raw); -} -void CommandEncoder::pushDebugGroup(char const * groupLabel) { - return wgpuCommandEncoderPushDebugGroup(m_raw, groupLabel); -} -void CommandEncoder::resolveQuerySet(QuerySet querySet, uint32_t firstQuery, uint32_t queryCount, Buffer destination, uint64_t destinationOffset) { - return wgpuCommandEncoderResolveQuerySet(m_raw, querySet, firstQuery, queryCount, destination, destinationOffset); -} -void CommandEncoder::setLabel(char const * label) { - return wgpuCommandEncoderSetLabel(m_raw, label); -} -void CommandEncoder::writeBuffer(Buffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) { - return wgpuCommandEncoderWriteBuffer(m_raw, buffer, bufferOffset, data, size); -} -void CommandEncoder::writeTimestamp(QuerySet querySet, uint32_t queryIndex) { - return wgpuCommandEncoderWriteTimestamp(m_raw, querySet, queryIndex); -} -void CommandEncoder::reference() { - return wgpuCommandEncoderReference(m_raw); -} -void CommandEncoder::release() { - return wgpuCommandEncoderRelease(m_raw); -} - - -// Methods of ComputePassEncoder -void ComputePassEncoder::dispatchWorkgroups(uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) { - return wgpuComputePassEncoderDispatchWorkgroups(m_raw, workgroupCountX, workgroupCountY, workgroupCountZ); -} -void ComputePassEncoder::dispatchWorkgroupsIndirect(Buffer indirectBuffer, uint64_t indirectOffset) { - return wgpuComputePassEncoderDispatchWorkgroupsIndirect(m_raw, indirectBuffer, indirectOffset); -} -void ComputePassEncoder::end() { - return wgpuComputePassEncoderEnd(m_raw); -} -void ComputePassEncoder::insertDebugMarker(char const * markerLabel) { - return wgpuComputePassEncoderInsertDebugMarker(m_raw, markerLabel); -} -void ComputePassEncoder::popDebugGroup() { - return wgpuComputePassEncoderPopDebugGroup(m_raw); -} -void ComputePassEncoder::pushDebugGroup(char const * groupLabel) { - return wgpuComputePassEncoderPushDebugGroup(m_raw, groupLabel); -} -void ComputePassEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) { - return wgpuComputePassEncoderSetBindGroup(m_raw, groupIndex, group, dynamicOffsetCount, dynamicOffsets); -} -void ComputePassEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, const std::vector& dynamicOffsets) { - return wgpuComputePassEncoderSetBindGroup(m_raw, groupIndex, group, static_cast(dynamicOffsets.size()), dynamicOffsets.data()); -} -void ComputePassEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, const uint32_t& dynamicOffsets) { - return wgpuComputePassEncoderSetBindGroup(m_raw, groupIndex, group, 1, &dynamicOffsets); -} -void ComputePassEncoder::setLabel(char const * label) { - return wgpuComputePassEncoderSetLabel(m_raw, label); -} -void ComputePassEncoder::setPipeline(ComputePipeline pipeline) { - return wgpuComputePassEncoderSetPipeline(m_raw, pipeline); -} -void ComputePassEncoder::writeTimestamp(QuerySet querySet, uint32_t queryIndex) { - return wgpuComputePassEncoderWriteTimestamp(m_raw, querySet, queryIndex); -} -void ComputePassEncoder::reference() { - return wgpuComputePassEncoderReference(m_raw); -} -void ComputePassEncoder::release() { - return wgpuComputePassEncoderRelease(m_raw); -} - - -// Methods of ComputePipeline -BindGroupLayout ComputePipeline::getBindGroupLayout(uint32_t groupIndex) { - return wgpuComputePipelineGetBindGroupLayout(m_raw, groupIndex); -} -void ComputePipeline::setLabel(char const * label) { - return wgpuComputePipelineSetLabel(m_raw, label); -} -void ComputePipeline::reference() { - return wgpuComputePipelineReference(m_raw); -} -void ComputePipeline::release() { - return wgpuComputePipelineRelease(m_raw); -} - - -// Methods of Device -BindGroup Device::createBindGroup(const BindGroupDescriptor& descriptor) { - return wgpuDeviceCreateBindGroup(m_raw, &descriptor); -} -BindGroupLayout Device::createBindGroupLayout(const BindGroupLayoutDescriptor& descriptor) { - return wgpuDeviceCreateBindGroupLayout(m_raw, &descriptor); -} -Buffer Device::createBuffer(const BufferDescriptor& descriptor) { - return wgpuDeviceCreateBuffer(m_raw, &descriptor); -} -CommandEncoder Device::createCommandEncoder(const CommandEncoderDescriptor& descriptor) { - return wgpuDeviceCreateCommandEncoder(m_raw, &descriptor); -} -CommandEncoder Device::createCommandEncoder() { - return wgpuDeviceCreateCommandEncoder(m_raw, nullptr); -} -ComputePipeline Device::createComputePipeline(const ComputePipelineDescriptor& descriptor) { - return wgpuDeviceCreateComputePipeline(m_raw, &descriptor); -} -std::unique_ptr Device::createComputePipelineAsync(const ComputePipelineDescriptor& descriptor, CreateComputePipelineAsyncCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, char const * message, void * userdata) -> void { - CreateComputePipelineAsyncCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status), pipeline, message); - }; - wgpuDeviceCreateComputePipelineAsync(m_raw, &descriptor, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Device::createComputePipelineAsyncF(const ComputePipelineDescriptor& descriptor, CreateComputePipelineAsyncCallbackInfo callbackInfo) { - return wgpuDeviceCreateComputePipelineAsyncF(m_raw, &descriptor, callbackInfo); -} -Buffer Device::createErrorBuffer(const BufferDescriptor& descriptor) { - return wgpuDeviceCreateErrorBuffer(m_raw, &descriptor); -} -ExternalTexture Device::createErrorExternalTexture() { - return wgpuDeviceCreateErrorExternalTexture(m_raw); -} -ShaderModule Device::createErrorShaderModule(const ShaderModuleDescriptor& descriptor, char const * errorMessage) { - return wgpuDeviceCreateErrorShaderModule(m_raw, &descriptor, errorMessage); -} -Texture Device::createErrorTexture(const TextureDescriptor& descriptor) { - return wgpuDeviceCreateErrorTexture(m_raw, &descriptor); -} -ExternalTexture Device::createExternalTexture(const ExternalTextureDescriptor& externalTextureDescriptor) { - return wgpuDeviceCreateExternalTexture(m_raw, &externalTextureDescriptor); -} -PipelineLayout Device::createPipelineLayout(const PipelineLayoutDescriptor& descriptor) { - return wgpuDeviceCreatePipelineLayout(m_raw, &descriptor); -} -QuerySet Device::createQuerySet(const QuerySetDescriptor& descriptor) { - return wgpuDeviceCreateQuerySet(m_raw, &descriptor); -} -RenderBundleEncoder Device::createRenderBundleEncoder(const RenderBundleEncoderDescriptor& descriptor) { - return wgpuDeviceCreateRenderBundleEncoder(m_raw, &descriptor); -} -RenderPipeline Device::createRenderPipeline(const RenderPipelineDescriptor& descriptor) { - return wgpuDeviceCreateRenderPipeline(m_raw, &descriptor); -} -std::unique_ptr Device::createRenderPipelineAsync(const RenderPipelineDescriptor& descriptor, CreateRenderPipelineAsyncCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, char const * message, void * userdata) -> void { - CreateRenderPipelineAsyncCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status), pipeline, message); - }; - wgpuDeviceCreateRenderPipelineAsync(m_raw, &descriptor, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Device::createRenderPipelineAsyncF(const RenderPipelineDescriptor& descriptor, CreateRenderPipelineAsyncCallbackInfo callbackInfo) { - return wgpuDeviceCreateRenderPipelineAsyncF(m_raw, &descriptor, callbackInfo); -} -Sampler Device::createSampler(const SamplerDescriptor& descriptor) { - return wgpuDeviceCreateSampler(m_raw, &descriptor); -} -Sampler Device::createSampler() { - return wgpuDeviceCreateSampler(m_raw, nullptr); -} -ShaderModule Device::createShaderModule(const ShaderModuleDescriptor& descriptor) { - return wgpuDeviceCreateShaderModule(m_raw, &descriptor); -} -SwapChain Device::createSwapChain(Surface surface, const SwapChainDescriptor& descriptor) { - return wgpuDeviceCreateSwapChain(m_raw, surface, &descriptor); -} -Texture Device::createTexture(const TextureDescriptor& descriptor) { - return wgpuDeviceCreateTexture(m_raw, &descriptor); -} -void Device::destroy() { - return wgpuDeviceDestroy(m_raw); -} -size_t Device::enumerateFeatures(FeatureName * features) { - return wgpuDeviceEnumerateFeatures(m_raw, reinterpret_cast(features)); -} -void Device::forceLoss(DeviceLostReason type, char const * message) { - return wgpuDeviceForceLoss(m_raw, static_cast(type), message); -} -Adapter Device::getAdapter() { - return wgpuDeviceGetAdapter(m_raw); -} -Bool Device::getLimits(SupportedLimits * limits) { - return wgpuDeviceGetLimits(m_raw, limits); -} -Queue Device::getQueue() { - return wgpuDeviceGetQueue(m_raw); -} -TextureUsageFlags Device::getSupportedSurfaceUsage(Surface surface) { - return wgpuDeviceGetSupportedSurfaceUsage(m_raw, surface); -} -Bool Device::hasFeature(FeatureName feature) { - return wgpuDeviceHasFeature(m_raw, static_cast(feature)); -} -SharedBufferMemory Device::importSharedBufferMemory(const SharedBufferMemoryDescriptor& descriptor) { - return wgpuDeviceImportSharedBufferMemory(m_raw, &descriptor); -} -SharedFence Device::importSharedFence(const SharedFenceDescriptor& descriptor) { - return wgpuDeviceImportSharedFence(m_raw, &descriptor); -} -SharedTextureMemory Device::importSharedTextureMemory(const SharedTextureMemoryDescriptor& descriptor) { - return wgpuDeviceImportSharedTextureMemory(m_raw, &descriptor); -} -void Device::injectError(ErrorType type, char const * message) { - return wgpuDeviceInjectError(m_raw, static_cast(type), message); -} -std::unique_ptr Device::popErrorScope(ErrorCallback&& oldCallback) { - auto handle = std::make_unique(oldCallback);//callback - static auto cCallback = [](WGPUErrorType type, char const * message, void * userdata) -> void { - ErrorCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(type), message); - }; - wgpuDevicePopErrorScope(m_raw, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Device::popErrorScopeF(PopErrorScopeCallbackInfo callbackInfo) { - return wgpuDevicePopErrorScopeF(m_raw, callbackInfo); -} -void Device::pushErrorScope(ErrorFilter filter) { - return wgpuDevicePushErrorScope(m_raw, static_cast(filter)); -} -std::unique_ptr Device::setDeviceLostCallback(DeviceLostCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUDeviceLostReason reason, char const * message, void * userdata) -> void { - DeviceLostCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(reason), message); - }; - wgpuDeviceSetDeviceLostCallback(m_raw, cCallback, reinterpret_cast(handle.get())); - return handle; -} -void Device::setLabel(char const * label) { - return wgpuDeviceSetLabel(m_raw, label); -} -std::unique_ptr Device::setLoggingCallback(LoggingCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPULoggingType type, char const * message, void * userdata) -> void { - LoggingCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(type), message); - }; - wgpuDeviceSetLoggingCallback(m_raw, cCallback, reinterpret_cast(handle.get())); - return handle; -} -std::unique_ptr Device::setUncapturedErrorCallback(ErrorCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUErrorType type, char const * message, void * userdata) -> void { - ErrorCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(type), message); - }; - wgpuDeviceSetUncapturedErrorCallback(m_raw, cCallback, reinterpret_cast(handle.get())); - return handle; -} -void Device::tick() { - return wgpuDeviceTick(m_raw); -} -void Device::validateTextureDescriptor(const TextureDescriptor& descriptor) { - return wgpuDeviceValidateTextureDescriptor(m_raw, &descriptor); -} -void Device::reference() { - return wgpuDeviceReference(m_raw); -} -void Device::release() { - return wgpuDeviceRelease(m_raw); -} - - -// Methods of ExternalTexture -void ExternalTexture::destroy() { - return wgpuExternalTextureDestroy(m_raw); -} -void ExternalTexture::expire() { - return wgpuExternalTextureExpire(m_raw); -} -void ExternalTexture::refresh() { - return wgpuExternalTextureRefresh(m_raw); -} -void ExternalTexture::setLabel(char const * label) { - return wgpuExternalTextureSetLabel(m_raw, label); -} -void ExternalTexture::reference() { - return wgpuExternalTextureReference(m_raw); -} -void ExternalTexture::release() { - return wgpuExternalTextureRelease(m_raw); -} - - -// Methods of Instance -Surface Instance::createSurface(const SurfaceDescriptor& descriptor) { - return wgpuInstanceCreateSurface(m_raw, &descriptor); -} -size_t Instance::enumerateWGSLLanguageFeatures(WGSLFeatureName * features) { - return wgpuInstanceEnumerateWGSLLanguageFeatures(m_raw, reinterpret_cast(features)); -} -Bool Instance::hasWGSLLanguageFeature(WGSLFeatureName feature) { - return wgpuInstanceHasWGSLLanguageFeature(m_raw, static_cast(feature)); -} -void Instance::processEvents() { - return wgpuInstanceProcessEvents(m_raw); -} -std::unique_ptr Instance::requestAdapter(const RequestAdapterOptions& options, RequestAdapterCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPURequestAdapterStatus status, WGPUAdapter adapter, char const * message, void * userdata) -> void { - RequestAdapterCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status), adapter, message); - }; - wgpuInstanceRequestAdapter(m_raw, &options, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Instance::requestAdapterF(const RequestAdapterOptions& options, RequestAdapterCallbackInfo callbackInfo) { - return wgpuInstanceRequestAdapterF(m_raw, &options, callbackInfo); -} -WaitStatus Instance::waitAny(size_t futureCount, FutureWaitInfo * futures, uint64_t timeoutNS) { - return static_cast(wgpuInstanceWaitAny(m_raw, futureCount, futures, timeoutNS)); -} -void Instance::reference() { - return wgpuInstanceReference(m_raw); -} -void Instance::release() { - return wgpuInstanceRelease(m_raw); -} - - -// Methods of PipelineLayout -void PipelineLayout::setLabel(char const * label) { - return wgpuPipelineLayoutSetLabel(m_raw, label); -} -void PipelineLayout::reference() { - return wgpuPipelineLayoutReference(m_raw); -} -void PipelineLayout::release() { - return wgpuPipelineLayoutRelease(m_raw); -} - - -// Methods of QuerySet -void QuerySet::destroy() { - return wgpuQuerySetDestroy(m_raw); -} -uint32_t QuerySet::getCount() { - return wgpuQuerySetGetCount(m_raw); -} -QueryType QuerySet::getType() { - return static_cast(wgpuQuerySetGetType(m_raw)); -} -void QuerySet::setLabel(char const * label) { - return wgpuQuerySetSetLabel(m_raw, label); -} -void QuerySet::reference() { - return wgpuQuerySetReference(m_raw); -} -void QuerySet::release() { - return wgpuQuerySetRelease(m_raw); -} - - -// Methods of Queue -void Queue::copyExternalTextureForBrowser(const ImageCopyExternalTexture& source, const ImageCopyTexture& destination, const Extent3D& copySize, const CopyTextureForBrowserOptions& options) { - return wgpuQueueCopyExternalTextureForBrowser(m_raw, &source, &destination, ©Size, &options); -} -void Queue::copyTextureForBrowser(const ImageCopyTexture& source, const ImageCopyTexture& destination, const Extent3D& copySize, const CopyTextureForBrowserOptions& options) { - return wgpuQueueCopyTextureForBrowser(m_raw, &source, &destination, ©Size, &options); -} -std::unique_ptr Queue::onSubmittedWorkDone(QueueWorkDoneCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUQueueWorkDoneStatus status, void * userdata) -> void { - QueueWorkDoneCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status)); - }; - wgpuQueueOnSubmittedWorkDone(m_raw, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future Queue::onSubmittedWorkDoneF(QueueWorkDoneCallbackInfo callbackInfo) { - return wgpuQueueOnSubmittedWorkDoneF(m_raw, callbackInfo); -} -void Queue::setLabel(char const * label) { - return wgpuQueueSetLabel(m_raw, label); -} -void Queue::submit(size_t commandCount, CommandBuffer const * commands) { - return wgpuQueueSubmit(m_raw, commandCount, reinterpret_cast(commands)); -} -void Queue::submit(const std::vector& commands) { - return wgpuQueueSubmit(m_raw, static_cast(commands.size()), commands.data()); -} -void Queue::submit(const WGPUCommandBuffer& commands) { - return wgpuQueueSubmit(m_raw, 1, &commands); -} -void Queue::writeBuffer(Buffer buffer, uint64_t bufferOffset, void const * data, size_t size) { - return wgpuQueueWriteBuffer(m_raw, buffer, bufferOffset, data, size); -} -void Queue::writeTexture(const ImageCopyTexture& destination, void const * data, size_t dataSize, const TextureDataLayout& dataLayout, const Extent3D& writeSize) { - return wgpuQueueWriteTexture(m_raw, &destination, data, dataSize, &dataLayout, &writeSize); -} -void Queue::reference() { - return wgpuQueueReference(m_raw); -} -void Queue::release() { - return wgpuQueueRelease(m_raw); -} - - -// Methods of RenderBundle -void RenderBundle::setLabel(char const * label) { - return wgpuRenderBundleSetLabel(m_raw, label); -} -void RenderBundle::reference() { - return wgpuRenderBundleReference(m_raw); -} -void RenderBundle::release() { - return wgpuRenderBundleRelease(m_raw); -} - - -// Methods of RenderBundleEncoder -void RenderBundleEncoder::draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { - return wgpuRenderBundleEncoderDraw(m_raw, vertexCount, instanceCount, firstVertex, firstInstance); -} -void RenderBundleEncoder::drawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) { - return wgpuRenderBundleEncoderDrawIndexed(m_raw, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); -} -void RenderBundleEncoder::drawIndexedIndirect(Buffer indirectBuffer, uint64_t indirectOffset) { - return wgpuRenderBundleEncoderDrawIndexedIndirect(m_raw, indirectBuffer, indirectOffset); -} -void RenderBundleEncoder::drawIndirect(Buffer indirectBuffer, uint64_t indirectOffset) { - return wgpuRenderBundleEncoderDrawIndirect(m_raw, indirectBuffer, indirectOffset); -} -RenderBundle RenderBundleEncoder::finish(const RenderBundleDescriptor& descriptor) { - return wgpuRenderBundleEncoderFinish(m_raw, &descriptor); -} -RenderBundle RenderBundleEncoder::finish() { - return wgpuRenderBundleEncoderFinish(m_raw, nullptr); -} -void RenderBundleEncoder::insertDebugMarker(char const * markerLabel) { - return wgpuRenderBundleEncoderInsertDebugMarker(m_raw, markerLabel); -} -void RenderBundleEncoder::popDebugGroup() { - return wgpuRenderBundleEncoderPopDebugGroup(m_raw); -} -void RenderBundleEncoder::pushDebugGroup(char const * groupLabel) { - return wgpuRenderBundleEncoderPushDebugGroup(m_raw, groupLabel); -} -void RenderBundleEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) { - return wgpuRenderBundleEncoderSetBindGroup(m_raw, groupIndex, group, dynamicOffsetCount, dynamicOffsets); -} -void RenderBundleEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, const std::vector& dynamicOffsets) { - return wgpuRenderBundleEncoderSetBindGroup(m_raw, groupIndex, group, static_cast(dynamicOffsets.size()), dynamicOffsets.data()); -} -void RenderBundleEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, const uint32_t& dynamicOffsets) { - return wgpuRenderBundleEncoderSetBindGroup(m_raw, groupIndex, group, 1, &dynamicOffsets); -} -void RenderBundleEncoder::setIndexBuffer(Buffer buffer, IndexFormat format, uint64_t offset, uint64_t size) { - return wgpuRenderBundleEncoderSetIndexBuffer(m_raw, buffer, static_cast(format), offset, size); -} -void RenderBundleEncoder::setLabel(char const * label) { - return wgpuRenderBundleEncoderSetLabel(m_raw, label); -} -void RenderBundleEncoder::setPipeline(RenderPipeline pipeline) { - return wgpuRenderBundleEncoderSetPipeline(m_raw, pipeline); -} -void RenderBundleEncoder::setVertexBuffer(uint32_t slot, Buffer buffer, uint64_t offset, uint64_t size) { - return wgpuRenderBundleEncoderSetVertexBuffer(m_raw, slot, buffer, offset, size); -} -void RenderBundleEncoder::reference() { - return wgpuRenderBundleEncoderReference(m_raw); -} -void RenderBundleEncoder::release() { - return wgpuRenderBundleEncoderRelease(m_raw); -} - - -// Methods of RenderPassEncoder -void RenderPassEncoder::beginOcclusionQuery(uint32_t queryIndex) { - return wgpuRenderPassEncoderBeginOcclusionQuery(m_raw, queryIndex); -} -void RenderPassEncoder::draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { - return wgpuRenderPassEncoderDraw(m_raw, vertexCount, instanceCount, firstVertex, firstInstance); -} -void RenderPassEncoder::drawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) { - return wgpuRenderPassEncoderDrawIndexed(m_raw, indexCount, instanceCount, firstIndex, baseVertex, firstInstance); -} -void RenderPassEncoder::drawIndexedIndirect(Buffer indirectBuffer, uint64_t indirectOffset) { - return wgpuRenderPassEncoderDrawIndexedIndirect(m_raw, indirectBuffer, indirectOffset); -} -void RenderPassEncoder::drawIndirect(Buffer indirectBuffer, uint64_t indirectOffset) { - return wgpuRenderPassEncoderDrawIndirect(m_raw, indirectBuffer, indirectOffset); -} -void RenderPassEncoder::end() { - return wgpuRenderPassEncoderEnd(m_raw); -} -void RenderPassEncoder::endOcclusionQuery() { - return wgpuRenderPassEncoderEndOcclusionQuery(m_raw); -} -void RenderPassEncoder::executeBundles(size_t bundleCount, RenderBundle const * bundles) { - return wgpuRenderPassEncoderExecuteBundles(m_raw, bundleCount, reinterpret_cast(bundles)); -} -void RenderPassEncoder::executeBundles(const std::vector& bundles) { - return wgpuRenderPassEncoderExecuteBundles(m_raw, static_cast(bundles.size()), bundles.data()); -} -void RenderPassEncoder::executeBundles(const WGPURenderBundle& bundles) { - return wgpuRenderPassEncoderExecuteBundles(m_raw, 1, &bundles); -} -void RenderPassEncoder::insertDebugMarker(char const * markerLabel) { - return wgpuRenderPassEncoderInsertDebugMarker(m_raw, markerLabel); -} -void RenderPassEncoder::pixelLocalStorageBarrier() { - return wgpuRenderPassEncoderPixelLocalStorageBarrier(m_raw); -} -void RenderPassEncoder::popDebugGroup() { - return wgpuRenderPassEncoderPopDebugGroup(m_raw); -} -void RenderPassEncoder::pushDebugGroup(char const * groupLabel) { - return wgpuRenderPassEncoderPushDebugGroup(m_raw, groupLabel); -} -void RenderPassEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) { - return wgpuRenderPassEncoderSetBindGroup(m_raw, groupIndex, group, dynamicOffsetCount, dynamicOffsets); -} -void RenderPassEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, const std::vector& dynamicOffsets) { - return wgpuRenderPassEncoderSetBindGroup(m_raw, groupIndex, group, static_cast(dynamicOffsets.size()), dynamicOffsets.data()); -} -void RenderPassEncoder::setBindGroup(uint32_t groupIndex, BindGroup group, const uint32_t& dynamicOffsets) { - return wgpuRenderPassEncoderSetBindGroup(m_raw, groupIndex, group, 1, &dynamicOffsets); -} -void RenderPassEncoder::setBlendConstant(const Color& color) { - return wgpuRenderPassEncoderSetBlendConstant(m_raw, &color); -} -void RenderPassEncoder::setIndexBuffer(Buffer buffer, IndexFormat format, uint64_t offset, uint64_t size) { - return wgpuRenderPassEncoderSetIndexBuffer(m_raw, buffer, static_cast(format), offset, size); -} -void RenderPassEncoder::setLabel(char const * label) { - return wgpuRenderPassEncoderSetLabel(m_raw, label); -} -void RenderPassEncoder::setPipeline(RenderPipeline pipeline) { - return wgpuRenderPassEncoderSetPipeline(m_raw, pipeline); -} -void RenderPassEncoder::setScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height) { - return wgpuRenderPassEncoderSetScissorRect(m_raw, x, y, width, height); -} -void RenderPassEncoder::setStencilReference(uint32_t reference) { - return wgpuRenderPassEncoderSetStencilReference(m_raw, reference); -} -void RenderPassEncoder::setVertexBuffer(uint32_t slot, Buffer buffer, uint64_t offset, uint64_t size) { - return wgpuRenderPassEncoderSetVertexBuffer(m_raw, slot, buffer, offset, size); -} -void RenderPassEncoder::setViewport(float x, float y, float width, float height, float minDepth, float maxDepth) { - return wgpuRenderPassEncoderSetViewport(m_raw, x, y, width, height, minDepth, maxDepth); -} -void RenderPassEncoder::writeTimestamp(QuerySet querySet, uint32_t queryIndex) { - return wgpuRenderPassEncoderWriteTimestamp(m_raw, querySet, queryIndex); -} -void RenderPassEncoder::reference() { - return wgpuRenderPassEncoderReference(m_raw); -} -void RenderPassEncoder::release() { - return wgpuRenderPassEncoderRelease(m_raw); -} - - -// Methods of RenderPipeline -BindGroupLayout RenderPipeline::getBindGroupLayout(uint32_t groupIndex) { - return wgpuRenderPipelineGetBindGroupLayout(m_raw, groupIndex); -} -void RenderPipeline::setLabel(char const * label) { - return wgpuRenderPipelineSetLabel(m_raw, label); -} -void RenderPipeline::reference() { - return wgpuRenderPipelineReference(m_raw); -} -void RenderPipeline::release() { - return wgpuRenderPipelineRelease(m_raw); -} - - -// Methods of Sampler -void Sampler::setLabel(char const * label) { - return wgpuSamplerSetLabel(m_raw, label); -} -void Sampler::reference() { - return wgpuSamplerReference(m_raw); -} -void Sampler::release() { - return wgpuSamplerRelease(m_raw); -} - - -// Methods of ShaderModule -std::unique_ptr ShaderModule::getCompilationInfo(CompilationInfoCallback&& callback) { - auto handle = std::make_unique(callback); - static auto cCallback = [](WGPUCompilationInfoRequestStatus status, struct WGPUCompilationInfo const * compilationInfo, void * userdata) -> void { - CompilationInfoCallback& callback = *reinterpret_cast(userdata); - callback(static_cast(status), *reinterpret_cast(compilationInfo)); - }; - wgpuShaderModuleGetCompilationInfo(m_raw, cCallback, reinterpret_cast(handle.get())); - return handle; -} -Future ShaderModule::getCompilationInfoF(CompilationInfoCallbackInfo callbackInfo) { - return wgpuShaderModuleGetCompilationInfoF(m_raw, callbackInfo); -} -void ShaderModule::setLabel(char const * label) { - return wgpuShaderModuleSetLabel(m_raw, label); -} -void ShaderModule::reference() { - return wgpuShaderModuleReference(m_raw); -} -void ShaderModule::release() { - return wgpuShaderModuleRelease(m_raw); -} - - -// Methods of SharedBufferMemory -Bool SharedBufferMemory::beginAccess(Buffer buffer, const SharedBufferMemoryBeginAccessDescriptor& descriptor) { - return wgpuSharedBufferMemoryBeginAccess(m_raw, buffer, &descriptor); -} -Buffer SharedBufferMemory::createBuffer(const BufferDescriptor& descriptor) { - return wgpuSharedBufferMemoryCreateBuffer(m_raw, &descriptor); -} -Buffer SharedBufferMemory::createBuffer() { - return wgpuSharedBufferMemoryCreateBuffer(m_raw, nullptr); -} -Bool SharedBufferMemory::endAccess(Buffer buffer, SharedBufferMemoryEndAccessState * descriptor) { - return wgpuSharedBufferMemoryEndAccess(m_raw, buffer, descriptor); -} -void SharedBufferMemory::getProperties(SharedBufferMemoryProperties * properties) { - return wgpuSharedBufferMemoryGetProperties(m_raw, properties); -} -Bool SharedBufferMemory::isDeviceLost() { - return wgpuSharedBufferMemoryIsDeviceLost(m_raw); -} -void SharedBufferMemory::setLabel(char const * label) { - return wgpuSharedBufferMemorySetLabel(m_raw, label); -} -void SharedBufferMemory::reference() { - return wgpuSharedBufferMemoryReference(m_raw); -} -void SharedBufferMemory::release() { - return wgpuSharedBufferMemoryRelease(m_raw); -} - - -// Methods of SharedFence -void SharedFence::exportInfo(SharedFenceExportInfo * info) { - return wgpuSharedFenceExportInfo(m_raw, info); -} -void SharedFence::reference() { - return wgpuSharedFenceReference(m_raw); -} -void SharedFence::release() { - return wgpuSharedFenceRelease(m_raw); -} - - -// Methods of SharedTextureMemory -Bool SharedTextureMemory::beginAccess(Texture texture, const SharedTextureMemoryBeginAccessDescriptor& descriptor) { - return wgpuSharedTextureMemoryBeginAccess(m_raw, texture, &descriptor); -} -Texture SharedTextureMemory::createTexture(const TextureDescriptor& descriptor) { - return wgpuSharedTextureMemoryCreateTexture(m_raw, &descriptor); -} -Texture SharedTextureMemory::createTexture() { - return wgpuSharedTextureMemoryCreateTexture(m_raw, nullptr); -} -Bool SharedTextureMemory::endAccess(Texture texture, SharedTextureMemoryEndAccessState * descriptor) { - return wgpuSharedTextureMemoryEndAccess(m_raw, texture, descriptor); -} -void SharedTextureMemory::getProperties(SharedTextureMemoryProperties * properties) { - return wgpuSharedTextureMemoryGetProperties(m_raw, properties); -} -Bool SharedTextureMemory::isDeviceLost() { - return wgpuSharedTextureMemoryIsDeviceLost(m_raw); -} -void SharedTextureMemory::setLabel(char const * label) { - return wgpuSharedTextureMemorySetLabel(m_raw, label); -} -void SharedTextureMemory::reference() { - return wgpuSharedTextureMemoryReference(m_raw); -} -void SharedTextureMemory::release() { - return wgpuSharedTextureMemoryRelease(m_raw); -} - - -// Methods of Surface -TextureFormat Surface::getPreferredFormat(Adapter adapter) { - return static_cast(wgpuSurfaceGetPreferredFormat(m_raw, adapter)); -} -void Surface::reference() { - return wgpuSurfaceReference(m_raw); -} -void Surface::release() { - return wgpuSurfaceRelease(m_raw); -} - - -// Methods of SwapChain -Texture SwapChain::getCurrentTexture() { - return wgpuSwapChainGetCurrentTexture(m_raw); -} -TextureView SwapChain::getCurrentTextureView() { - return wgpuSwapChainGetCurrentTextureView(m_raw); -} -void SwapChain::present() { - return wgpuSwapChainPresent(m_raw); -} -void SwapChain::reference() { - return wgpuSwapChainReference(m_raw); -} -void SwapChain::release() { - return wgpuSwapChainRelease(m_raw); -} - - -// Methods of Texture -TextureView Texture::createErrorView(const TextureViewDescriptor& descriptor) { - return wgpuTextureCreateErrorView(m_raw, &descriptor); -} -TextureView Texture::createErrorView() { - return wgpuTextureCreateErrorView(m_raw, nullptr); -} -TextureView Texture::createView(const TextureViewDescriptor& descriptor) { - return wgpuTextureCreateView(m_raw, &descriptor); -} -TextureView Texture::createView() { - return wgpuTextureCreateView(m_raw, nullptr); -} -void Texture::destroy() { - return wgpuTextureDestroy(m_raw); -} -uint32_t Texture::getDepthOrArrayLayers() { - return wgpuTextureGetDepthOrArrayLayers(m_raw); -} -TextureDimension Texture::getDimension() { - return static_cast(wgpuTextureGetDimension(m_raw)); -} -TextureFormat Texture::getFormat() { - return static_cast(wgpuTextureGetFormat(m_raw)); -} -uint32_t Texture::getHeight() { - return wgpuTextureGetHeight(m_raw); -} -uint32_t Texture::getMipLevelCount() { - return wgpuTextureGetMipLevelCount(m_raw); -} -uint32_t Texture::getSampleCount() { - return wgpuTextureGetSampleCount(m_raw); -} -TextureUsageFlags Texture::getUsage() { - return wgpuTextureGetUsage(m_raw); -} -uint32_t Texture::getWidth() { - return wgpuTextureGetWidth(m_raw); -} -void Texture::setLabel(char const * label) { - return wgpuTextureSetLabel(m_raw, label); -} -void Texture::reference() { - return wgpuTextureReference(m_raw); -} -void Texture::release() { - return wgpuTextureRelease(m_raw); -} - - -// Methods of TextureView -void TextureView::setLabel(char const * label) { - return wgpuTextureViewSetLabel(m_raw, label); -} -void TextureView::reference() { - return wgpuTextureViewReference(m_raw); -} -void TextureView::release() { - return wgpuTextureViewRelease(m_raw); -} - - - -// Extra implementations -Adapter Instance::requestAdapter(const RequestAdapterOptions& options) { - Adapter adapter = nullptr; - bool requestEnded = false; - - auto onAdapterRequestEnded = [&adapter, &requestEnded](RequestAdapterStatus status, Adapter _adapter, char const * message) { - if (status == RequestAdapterStatus::Success) { - adapter = _adapter; - } else { - std::cout << "Could not get WebGPU adapter: " << message << std::endl; - } - requestEnded = true; - }; - - auto h = requestAdapter(options, onAdapterRequestEnded); - -#if __EMSCRIPTEN__ - while (!requestEnded) { - emscripten_sleep(100); - } -#endif - - assert(requestEnded); - return adapter; -} - -Device Adapter::requestDevice(const DeviceDescriptor& descriptor) { - WGPUDevice device = nullptr; - bool requestEnded = false; - - auto onDeviceRequestEnded = [&device, &requestEnded](RequestDeviceStatus status, Device _device, char const * message) { - if (status == RequestDeviceStatus::Success) { - device = _device; - } else { - std::cout << "Could not get WebGPU adapter: " << message << std::endl; - } - requestEnded = true; - }; - - auto h = requestDevice(descriptor, onDeviceRequestEnded); - -#if __EMSCRIPTEN__ - while (!requestEnded) { - emscripten_sleep(100); - } -#endif - - assert(requestEnded); - return device; -} - -#endif // WEBGPU_CPP_IMPLEMENTATION - -#undef HANDLE -#undef DESCRIPTOR -#undef ENUM -#undef ENUM_ENTRY -#undef END - -} // namespace wgpu diff --git a/package/cpp/rnskia/RNSkPlatformContext.h b/package/cpp/rnskia/RNSkPlatformContext.h index 1ee4c50b38..cf57fa1cfb 100644 --- a/package/cpp/rnskia/RNSkPlatformContext.h +++ b/package/cpp/rnskia/RNSkPlatformContext.h @@ -9,8 +9,7 @@ #include #include -#include "webgpu.h" -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include "RNSkDispatchQueue.h" diff --git a/package/cpp/wgpu/JsiAdapter.h b/package/cpp/wgpu/JsiAdapter.h index 4698cbf816..fab6d26c20 100644 --- a/package/cpp/wgpu/JsiAdapter.h +++ b/package/cpp/wgpu/JsiAdapter.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,13 +39,25 @@ class JsiAdapter : public JsiSkWrappingSharedPtrHostObject { descriptor = std::move(descriptor)]( jsi::Runtime &runtime, std::shared_ptr promise) -> void { - auto ret = object->requestDevice(*descriptor); - if (ret == nullptr) { + wgpu::Device device = nullptr; + object->RequestDevice( + nullptr, + [](WGPURequestDeviceStatus, WGPUDevice cDevice, + const char *message, void *userdata) { + if (message != nullptr) { + fprintf(stderr, "%s", message); + return; + } + *static_cast(userdata) = + wgpu::Device::Acquire(cDevice); + }, + &device); + if (device == nullptr) { promise->resolve(jsi::Value::null()); } else { promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), - std::move(ret)))); + std::move(device)))); } }); } diff --git a/package/cpp/wgpu/JsiBindGroup.h b/package/cpp/wgpu/JsiBindGroup.h index cb89b788df..37db693610 100644 --- a/package/cpp/wgpu/JsiBindGroup.h +++ b/package/cpp/wgpu/JsiBindGroup.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiBindGroupDescriptor.h b/package/cpp/wgpu/JsiBindGroupDescriptor.h index 7c1e1cd419..41fdf0dff7 100644 --- a/package/cpp/wgpu/JsiBindGroupDescriptor.h +++ b/package/cpp/wgpu/JsiBindGroupDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -44,7 +44,6 @@ class JsiBindGroupDescriptor .get(); } else { auto object = new wgpu::BindGroupDescriptor(); - object->setDefault(); if (obj.hasProperty(runtime, "layout")) { auto layout = obj.getProperty(runtime, "layout"); diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index cfe822a5fa..42e92d845d 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -40,7 +40,6 @@ class JsiBindGroupEntry return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::BindGroupEntry(); - object->setDefault(); if (obj.hasProperty(runtime, "binding")) { auto binding = obj.getProperty(runtime, "binding"); diff --git a/package/cpp/wgpu/JsiBindGroupLayout.h b/package/cpp/wgpu/JsiBindGroupLayout.h index b3a4fbee6d..da74b486c3 100644 --- a/package/cpp/wgpu/JsiBindGroupLayout.h +++ b/package/cpp/wgpu/JsiBindGroupLayout.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiBlendComponent.h b/package/cpp/wgpu/JsiBlendComponent.h index 70670663b8..09bafb4d91 100644 --- a/package/cpp/wgpu/JsiBlendComponent.h +++ b/package/cpp/wgpu/JsiBlendComponent.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,6 @@ class JsiBlendComponent return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::BlendComponent(); - object->setDefault(); if (obj.hasProperty(runtime, "operation")) { auto operation = obj.getProperty(runtime, "operation"); diff --git a/package/cpp/wgpu/JsiBlendState.h b/package/cpp/wgpu/JsiBlendState.h index ec006e3efe..fb2e6ee5a3 100644 --- a/package/cpp/wgpu/JsiBlendState.h +++ b/package/cpp/wgpu/JsiBlendState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -40,7 +40,6 @@ class JsiBlendState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::BlendState(); - object->setDefault(); if (obj.hasProperty(runtime, "color")) { auto color = obj.getProperty(runtime, "color"); diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index 22ed18b39e..dffca0c3ce 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -26,7 +26,7 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(unmap) { - getObject()->unmap(); + getObject()->Unmap(); return jsi::Value::undefined(); } @@ -34,7 +34,7 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); - auto data = getObject()->getMappedRange(offset, size); + auto data = getObject()->GetMappedRange(offset, size); auto arrayBufferCtor = runtime.global().getPropertyAsFunction(runtime, "ArrayBuffer"); auto o = diff --git a/package/cpp/wgpu/JsiBufferDescriptor.h b/package/cpp/wgpu/JsiBufferDescriptor.h index 0186a04524..5cc589fc3d 100644 --- a/package/cpp/wgpu/JsiBufferDescriptor.h +++ b/package/cpp/wgpu/JsiBufferDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,6 @@ class JsiBufferDescriptor return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::BufferDescriptor(); - object->setDefault(); if (obj.hasProperty(runtime, "size")) { auto size = obj.getProperty(runtime, "size"); @@ -52,7 +51,7 @@ class JsiBufferDescriptor if (obj.hasProperty(runtime, "usage")) { auto usage = obj.getProperty(runtime, "usage"); - object->usage = static_cast(usage.getNumber()); + object->usage = static_cast(usage.getNumber()); } else { throw jsi::JSError(runtime, "Missing mandatory prop usage in BufferDescriptor"); diff --git a/package/cpp/wgpu/JsiColor.h b/package/cpp/wgpu/JsiColor.h index 192d9a6ac4..bd35f8efb7 100644 --- a/package/cpp/wgpu/JsiColor.h +++ b/package/cpp/wgpu/JsiColor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -47,7 +47,6 @@ class JsiColor : public JsiSkWrappingSharedPtrHostObject { return object; } auto object = new wgpu::Color(); - object->setDefault(); if (obj.hasProperty(runtime, "r")) { auto r = obj.getProperty(runtime, "r"); diff --git a/package/cpp/wgpu/JsiColorTargetState.h b/package/cpp/wgpu/JsiColorTargetState.h index 19b09f31f0..3f826c126a 100644 --- a/package/cpp/wgpu/JsiColorTargetState.h +++ b/package/cpp/wgpu/JsiColorTargetState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -40,8 +40,7 @@ class JsiColorTargetState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::ColorTargetState(); - object->setDefault(); - object->writeMask = wgpu::ColorWriteMask::All; + if (obj.hasProperty(runtime, "format")) { auto format = obj.getProperty(runtime, "format"); @@ -59,7 +58,8 @@ class JsiColorTargetState if (obj.hasProperty(runtime, "writeMask")) { auto writeMask = obj.getProperty(runtime, "writeMask"); - object->writeMask = static_cast(writeMask.getNumber()); + object->writeMask = + static_cast(writeMask.getNumber()); } return object; } diff --git a/package/cpp/wgpu/JsiCommandBuffer.h b/package/cpp/wgpu/JsiCommandBuffer.h index 6830b26b87..9e02da6381 100644 --- a/package/cpp/wgpu/JsiCommandBuffer.h +++ b/package/cpp/wgpu/JsiCommandBuffer.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index 6fa7322ebe..53ad3ac43b 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -32,14 +32,14 @@ class JsiCommandEncoder JSI_HOST_FUNCTION(beginRenderPass) { auto descriptor = JsiRenderPassDescriptor::fromValue(runtime, arguments[0]); - auto ret = getObject()->beginRenderPass(*descriptor); + auto ret = getObject()->BeginRenderPass(descriptor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } JSI_HOST_FUNCTION(finish) { - auto ret = getObject()->finish(); + auto ret = getObject()->Finish(); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/package/cpp/wgpu/JsiCommandEncoderDescriptor.h b/package/cpp/wgpu/JsiCommandEncoderDescriptor.h index cf0c4e5d00..441d240378 100644 --- a/package/cpp/wgpu/JsiCommandEncoderDescriptor.h +++ b/package/cpp/wgpu/JsiCommandEncoderDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiContext.h b/package/cpp/wgpu/JsiContext.h index 0ead11308a..121ad43efe 100644 --- a/package/cpp/wgpu/JsiContext.h +++ b/package/cpp/wgpu/JsiContext.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -38,7 +38,6 @@ class JsiContext : public JsiSkWrappingSharedPtrHostObject { return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::Context(); - object->setDefault(); if (obj.hasProperty(runtime, "gpu")) { auto gpu = obj.getProperty(runtime, "gpu"); diff --git a/package/cpp/wgpu/JsiDepthStencilState.h b/package/cpp/wgpu/JsiDepthStencilState.h index 39a19a91f1..dd71230e03 100644 --- a/package/cpp/wgpu/JsiDepthStencilState.h +++ b/package/cpp/wgpu/JsiDepthStencilState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -40,7 +40,6 @@ class JsiDepthStencilState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::DepthStencilState(); - object->setDefault(); if (obj.hasProperty(runtime, "format")) { auto format = obj.getProperty(runtime, "format"); diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index 5724e92b36..3597e31641 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,7 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_PROPERTY_GET(queue) { - auto ret = getObject()->getQueue(); + auto ret = getObject()->GetQueue(); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -47,7 +47,7 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(createBindGroup) { auto descriptor = JsiBindGroupDescriptor::fromValue(runtime, arguments[0]); - auto ret = getObject()->createBindGroup(*descriptor); + auto ret = getObject()->CreateBindGroup(descriptor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -56,7 +56,7 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { auto descriptor = JsiRenderPipelineDescriptor::fromValue(runtime, arguments[0]); - auto ret = getObject()->createRenderPipeline(*descriptor); + auto ret = getObject()->CreateRenderPipeline(descriptor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -66,9 +66,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JsiShaderModuleWGSLDescriptor::fromValue(runtime, arguments[0]); auto moduleDescriptorNext = *moduleDescriptor; - wgpu::ShaderModuleDescriptor baseModuleDescriptor; - baseModuleDescriptor.nextInChain = &moduleDescriptorNext.chain; - auto ret = getObject()->createShaderModule(baseModuleDescriptor); + auto baseModuleDescriptor = new wgpu::ShaderModuleDescriptor(); + baseModuleDescriptor->nextInChain = &moduleDescriptorNext; + auto ret = getObject()->CreateShaderModule(baseModuleDescriptor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -80,7 +80,7 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { ? JsiCommandEncoderDescriptor::fromValue(runtime, arguments[0]) : defaultDescriptor; - auto ret = getObject()->createCommandEncoder(*descriptor); + auto ret = getObject()->CreateCommandEncoder(descriptor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -88,7 +88,7 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(createBuffer) { auto descritor = JsiBufferDescriptor::fromValue(runtime, arguments[0]); - auto ret = getObject()->createBuffer(*descritor); + auto ret = getObject()->CreateBuffer(descritor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -96,7 +96,7 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(createTexture) { auto descriptor = JsiTextureDescriptor::fromValue(runtime, arguments[0]); - auto ret = getObject()->createTexture(*descriptor); + auto ret = getObject()->CreateTexture(descriptor); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/package/cpp/wgpu/JsiDeviceDescriptor.h b/package/cpp/wgpu/JsiDeviceDescriptor.h index fe48be9409..62385308cf 100644 --- a/package/cpp/wgpu/JsiDeviceDescriptor.h +++ b/package/cpp/wgpu/JsiDeviceDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiEnums.h b/package/cpp/wgpu/JsiEnums.h index 37fe0c486e..409ddc0be6 100644 --- a/package/cpp/wgpu/JsiEnums.h +++ b/package/cpp/wgpu/JsiEnums.h @@ -2,7 +2,7 @@ #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" namespace RNSkia { wgpu::AddressMode getAddressMode(const char *value) { @@ -391,13 +391,13 @@ wgpu::TextureAspect getTextureAspect(const char *value) { wgpu::TextureDimension getTextureDimension(const char *value) { if (strcmp(value, "1d") == 0) { - return wgpu::TextureDimension::_1D; + return wgpu::TextureDimension::e1D; } if (strcmp(value, "2d") == 0) { - return wgpu::TextureDimension::_2D; + return wgpu::TextureDimension::e2D; } if (strcmp(value, "3d") == 0) { - return wgpu::TextureDimension::_3D; + return wgpu::TextureDimension::e3D; } throw std::invalid_argument("Invalid value " + std::string(value) + " for enum TextureDimension"); @@ -712,13 +712,13 @@ wgpu::TextureSampleType getTextureSampleType(const char *value) { wgpu::TextureViewDimension getTextureViewDimension(const char *value) { if (strcmp(value, "1d") == 0) { - return wgpu::TextureViewDimension::_1D; + return wgpu::TextureViewDimension::e1D; } if (strcmp(value, "2d") == 0) { - return wgpu::TextureViewDimension::_2D; + return wgpu::TextureViewDimension::e2D; } if (strcmp(value, "2d-array") == 0) { - return wgpu::TextureViewDimension::_2DArray; + return wgpu::TextureViewDimension::e2DArray; } if (strcmp(value, "cube") == 0) { return wgpu::TextureViewDimension::Cube; @@ -727,7 +727,7 @@ wgpu::TextureViewDimension getTextureViewDimension(const char *value) { return wgpu::TextureViewDimension::CubeArray; } if (strcmp(value, "3d") == 0) { - return wgpu::TextureViewDimension::_3D; + return wgpu::TextureViewDimension::e3D; } throw std::invalid_argument("Invalid value " + std::string(value) + " for enum TextureViewDimension"); diff --git a/package/cpp/wgpu/JsiExtent3D.h b/package/cpp/wgpu/JsiExtent3D.h index 1418e516c2..dfa20e4855 100644 --- a/package/cpp/wgpu/JsiExtent3D.h +++ b/package/cpp/wgpu/JsiExtent3D.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -37,7 +37,6 @@ class JsiExtent3D : public JsiSkWrappingSharedPtrHostObject { return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::Extent3D(); - object->setDefault(); if (obj.hasProperty(runtime, "width")) { auto width = obj.getProperty(runtime, "width"); diff --git a/package/cpp/wgpu/JsiFragmentState.h b/package/cpp/wgpu/JsiFragmentState.h index 2588206445..a9bcd470a6 100644 --- a/package/cpp/wgpu/JsiFragmentState.h +++ b/package/cpp/wgpu/JsiFragmentState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -41,7 +41,6 @@ class JsiFragmentState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::FragmentState(); - object->setDefault(); if (obj.hasProperty(runtime, "module")) { auto module = obj.getProperty(runtime, "module"); diff --git a/package/cpp/wgpu/JsiGPU.h b/package/cpp/wgpu/JsiGPU.h index 30bf9adb2e..4816bd702b 100644 --- a/package/cpp/wgpu/JsiGPU.h +++ b/package/cpp/wgpu/JsiGPU.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -43,13 +43,25 @@ class JsiGPU : public JsiSkWrappingSharedPtrHostObject { options = std::move(options)]( jsi::Runtime &runtime, std::shared_ptr promise) -> void { - auto ret = object->requestAdapter(*options); - if (ret == nullptr) { + wgpu::Adapter adapter = nullptr; + object->RequestAdapter( + nullptr, + [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, const char *message, + void *userdata) { + if (message != nullptr) { + fprintf(stderr, "%s", message); + return; + } + *static_cast(userdata) = + wgpu::Adapter::Acquire(cAdapter); + }, + &adapter); + if (adapter == nullptr) { promise->resolve(jsi::Value::null()); } else { promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), - std::move(ret)))); + std::move(adapter)))); } }); } diff --git a/package/cpp/wgpu/JsiMultisampleState.h b/package/cpp/wgpu/JsiMultisampleState.h index 468f554630..5bbe814f2f 100644 --- a/package/cpp/wgpu/JsiMultisampleState.h +++ b/package/cpp/wgpu/JsiMultisampleState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,6 @@ class JsiMultisampleState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::MultisampleState(); - object->setDefault(); if (obj.hasProperty(runtime, "count")) { auto count = obj.getProperty(runtime, "count"); diff --git a/package/cpp/wgpu/JsiPrimitiveState.h b/package/cpp/wgpu/JsiPrimitiveState.h index cb797baf6c..94f497072d 100644 --- a/package/cpp/wgpu/JsiPrimitiveState.h +++ b/package/cpp/wgpu/JsiPrimitiveState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,6 @@ class JsiPrimitiveState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::PrimitiveState(); - object->setDefault(); if (obj.hasProperty(runtime, "topology")) { auto topology = obj.getProperty(runtime, "topology"); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 52f678746a..2032276c25 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -26,7 +26,7 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { context, std::make_shared(std::move(m))) {} JSI_HOST_FUNCTION(submit) { - std::vector commandBuffers; + std::vector commandBuffers; auto jsiArray = arguments[0].asObject(runtime).asArray(runtime); auto jsiArraySize = static_cast(jsiArray.size(runtime)); for (int i = 0; i < jsiArraySize; i++) { @@ -34,7 +34,7 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { commandBuffers.push_back(*JsiCommandBuffer::fromValue(runtime, val)); } - getObject()->submit(commandBuffers); + getObject()->Submit(commandBuffers.size(), commandBuffers.data()); return jsi::Value::undefined(); } @@ -44,7 +44,7 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); auto size = static_cast(arguments[3].getNumber()); - getObject()->writeBuffer(*buffer, offset, data.data(runtime), size); + getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); } diff --git a/package/cpp/wgpu/JsiRenderPassColorAttachment.h b/package/cpp/wgpu/JsiRenderPassColorAttachment.h index 282c048156..d46e68974f 100644 --- a/package/cpp/wgpu/JsiRenderPassColorAttachment.h +++ b/package/cpp/wgpu/JsiRenderPassColorAttachment.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -45,9 +45,7 @@ class JsiRenderPassColorAttachment .get(); } else { auto object = new wgpu::RenderPassColorAttachment(); - object->setDefault(); - object->resolveTarget = nullptr; - object->depthSlice = UINT32_MAX; + if (obj.hasProperty(runtime, "view")) { auto view = obj.getProperty(runtime, "view"); diff --git a/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h b/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h new file mode 100644 index 0000000000..d6b863130b --- /dev/null +++ b/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h @@ -0,0 +1,91 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiRenderPassDepthStencilAttachment + : public JsiSkWrappingSharedPtrHostObject< + wgpu::RenderPassDepthStencilAttachment> { +public: + JsiRenderPassDepthStencilAttachment( + std::shared_ptr context, + wgpu::RenderPassDepthStencilAttachment m) + : JsiSkWrappingSharedPtrHostObject< + wgpu::RenderPassDepthStencilAttachment>( + context, std::make_shared( + std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiRenderPassDepthStencilAttachment, + RenderPassDepthStencilAttachment) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::RenderPassDepthStencilAttachment * + fromValue(jsi::Runtime &runtime, const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + auto object = new wgpu::RenderPassDepthStencilAttachment(); + + if (obj.hasProperty(runtime, "view")) { + auto view = obj.getProperty(runtime, "view"); + + object->view = *JsiTextureView::fromValue(runtime, view); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop view in RenderPassDepthStencilAttachment"); + } + if (obj.hasProperty(runtime, "depthClearValue")) { + auto depthClearValue = obj.getProperty(runtime, "depthClearValue"); + + object->depthClearValue = + static_cast(depthClearValue.getNumber()); + } else { + throw jsi::JSError(runtime, "Missing mandatory prop depthClearValue in " + "RenderPassDepthStencilAttachment"); + } + if (obj.hasProperty(runtime, "depthLoadOp")) { + auto depthLoadOp = obj.getProperty(runtime, "depthLoadOp"); + + object->depthLoadOp = + getLoadOp(depthLoadOp.getString(runtime).utf8(runtime).c_str()); + } else { + throw jsi::JSError(runtime, "Missing mandatory prop depthLoadOp in " + "RenderPassDepthStencilAttachment"); + } + if (obj.hasProperty(runtime, "depthStoreOp")) { + auto depthStoreOp = obj.getProperty(runtime, "depthStoreOp"); + + object->depthStoreOp = + getStoreOp(depthStoreOp.getString(runtime).utf8(runtime).c_str()); + } else { + throw jsi::JSError(runtime, "Missing mandatory prop depthStoreOp in " + "RenderPassDepthStencilAttachment"); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiRenderPassDescriptor.h b/package/cpp/wgpu/JsiRenderPassDescriptor.h index 5fe24183b2..1eb756f490 100644 --- a/package/cpp/wgpu/JsiRenderPassDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPassDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiRenderPassColorAttachment.h" +#include "JsiRenderPassDepthStencilAttachment.h" #include "JsiSkHostObjects.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" @@ -43,7 +44,6 @@ class JsiRenderPassDescriptor .get(); } else { auto object = new wgpu::RenderPassDescriptor(); - object->setDefault(); if (obj.hasProperty(runtime, "colorAttachments")) { auto colorAttachments = obj.getProperty(runtime, "colorAttachments"); @@ -64,6 +64,14 @@ class JsiRenderPassDescriptor runtime, "Missing mandatory prop colorAttachments in RenderPassDescriptor"); } + if (obj.hasProperty(runtime, "depthStencilAttachment")) { + auto depthStencilAttachment = + obj.getProperty(runtime, "depthStencilAttachment"); + + object->depthStencilAttachment = + JsiRenderPassDepthStencilAttachment::fromValue( + runtime, depthStencilAttachment); + } return object; } } diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index a179256fbf..df83e45b8e 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -32,7 +32,7 @@ class JsiRenderPassEncoder JSI_HOST_FUNCTION(setPipeline) { auto pipeline = JsiRenderPipeline::fromValue(runtime, arguments[0]); - getObject()->setPipeline(*pipeline); + getObject()->SetPipeline(*pipeline); return jsi::Value::undefined(); } @@ -51,13 +51,13 @@ class JsiRenderPassEncoder ? static_cast(arguments[3].getNumber()) : defaultFirstInstance; - getObject()->draw(vertexCount, instanceCount, firstVertex, firstInstance); + getObject()->Draw(vertexCount, instanceCount, firstVertex, firstInstance); return jsi::Value::undefined(); } JSI_HOST_FUNCTION(end) { - getObject()->end(); + getObject()->End(); return jsi::Value::undefined(); } @@ -65,14 +65,14 @@ class JsiRenderPassEncoder auto index = static_cast(arguments[0].getNumber()); auto bindGroup = JsiBindGroup::fromValue(runtime, arguments[1]); // auto dynamicOffsetCount = static_cast(arguments[2].getNumber()); - getObject()->setBindGroup(index, *bindGroup, 0, nullptr); + getObject()->SetBindGroup(index, *bindGroup, 0, nullptr); return jsi::Value::undefined(); } JSI_HOST_FUNCTION(setVertexBuffer) { auto slot = static_cast(arguments[0].getNumber()); auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); - getObject()->setVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); + getObject()->SetVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); return jsi::Value::undefined(); } diff --git a/package/cpp/wgpu/JsiRenderPipeline.h b/package/cpp/wgpu/JsiRenderPipeline.h index a5c2df751a..0a31d484a0 100644 --- a/package/cpp/wgpu/JsiRenderPipeline.h +++ b/package/cpp/wgpu/JsiRenderPipeline.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -30,7 +30,7 @@ class JsiRenderPipeline JSI_HOST_FUNCTION(getBindGroupLayout) { auto index = static_cast(arguments[0].getNumber()); - auto ret = getObject()->getBindGroupLayout(index); + auto ret = getObject()->GetBindGroupLayout(index); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h index d595d10549..2db8a2e3b4 100644 --- a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -48,10 +48,6 @@ class JsiRenderPipelineDescriptor .get(); } else { auto object = new wgpu::RenderPipelineDescriptor(); - object->setDefault(); - object->multisample.count = 1; - object->multisample.mask = ~0u; - object->multisample.alphaToCoverageEnabled = false; if (obj.hasProperty(runtime, "vertex")) { auto vertex = obj.getProperty(runtime, "vertex"); diff --git a/package/cpp/wgpu/JsiRequestAdapterOptions.h b/package/cpp/wgpu/JsiRequestAdapterOptions.h index 49a2e1443a..1a81544928 100644 --- a/package/cpp/wgpu/JsiRequestAdapterOptions.h +++ b/package/cpp/wgpu/JsiRequestAdapterOptions.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -42,7 +42,6 @@ class JsiRequestAdapterOptions .get(); } else { auto object = new wgpu::RequestAdapterOptions(); - object->setDefault(); if (obj.hasProperty(runtime, "powerPreference")) { auto powerPreference = obj.getProperty(runtime, "powerPreference"); diff --git a/package/cpp/wgpu/JsiShaderModule.h b/package/cpp/wgpu/JsiShaderModule.h index 8ff9549113..007a43580a 100644 --- a/package/cpp/wgpu/JsiShaderModule.h +++ b/package/cpp/wgpu/JsiShaderModule.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h b/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h index f771a60ed1..47214b0f98 100644 --- a/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h +++ b/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -43,9 +43,8 @@ class JsiShaderModuleWGSLDescriptor : public JsiSkWrappingSharedPtrHostObject< .get(); } else { auto object = new wgpu::ShaderModuleWGSLDescriptor(); - object->setDefault(); - object->chain.next = nullptr; - object->chain.sType = wgpu::SType::ShaderModuleWGSLDescriptor; + + object->sType = wgpu::SType::ShaderModuleWGSLDescriptor; if (obj.hasProperty(runtime, "code")) { auto code = obj.getProperty(runtime, "code"); diff --git a/package/cpp/wgpu/JsiStencilFaceState.h b/package/cpp/wgpu/JsiStencilFaceState.h index 33d5812431..f8845317a8 100644 --- a/package/cpp/wgpu/JsiStencilFaceState.h +++ b/package/cpp/wgpu/JsiStencilFaceState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,6 @@ class JsiStencilFaceState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::StencilFaceState(); - object->setDefault(); if (obj.hasProperty(runtime, "compare")) { auto compare = obj.getProperty(runtime, "compare"); diff --git a/package/cpp/wgpu/JsiTexture.h b/package/cpp/wgpu/JsiTexture.h index 8e9974f7ed..a04e278f30 100644 --- a/package/cpp/wgpu/JsiTexture.h +++ b/package/cpp/wgpu/JsiTexture.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -27,7 +27,7 @@ class JsiTexture : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(createView) { - auto ret = getObject()->createView(); + auto ret = getObject()->CreateView(); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/package/cpp/wgpu/JsiTextureDescriptor.h b/package/cpp/wgpu/JsiTextureDescriptor.h index c7333d3af5..f92ec6514d 100644 --- a/package/cpp/wgpu/JsiTextureDescriptor.h +++ b/package/cpp/wgpu/JsiTextureDescriptor.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -40,7 +40,6 @@ class JsiTextureDescriptor return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::TextureDescriptor(); - object->setDefault(); if (obj.hasProperty(runtime, "size")) { auto size = obj.getProperty(runtime, "size"); @@ -62,7 +61,7 @@ class JsiTextureDescriptor if (obj.hasProperty(runtime, "usage")) { auto usage = obj.getProperty(runtime, "usage"); - object->usage = static_cast(usage.getNumber()); + object->usage = static_cast(usage.getNumber()); } else { throw jsi::JSError(runtime, "Missing mandatory prop usage in TextureDescriptor"); diff --git a/package/cpp/wgpu/JsiTextureView.h b/package/cpp/wgpu/JsiTextureView.h index 1b50e5699f..7e12eb5500 100644 --- a/package/cpp/wgpu/JsiTextureView.h +++ b/package/cpp/wgpu/JsiTextureView.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/package/cpp/wgpu/JsiVertexAttribute.h b/package/cpp/wgpu/JsiVertexAttribute.h index ad987d075e..7b661714e0 100644 --- a/package/cpp/wgpu/JsiVertexAttribute.h +++ b/package/cpp/wgpu/JsiVertexAttribute.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -39,7 +39,6 @@ class JsiVertexAttribute return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::VertexAttribute(); - object->setDefault(); if (obj.hasProperty(runtime, "shaderLocation")) { auto shaderLocation = obj.getProperty(runtime, "shaderLocation"); diff --git a/package/cpp/wgpu/JsiVertexBufferLayout.h b/package/cpp/wgpu/JsiVertexBufferLayout.h index 5a7fd49e99..c57666ba62 100644 --- a/package/cpp/wgpu/JsiVertexBufferLayout.h +++ b/package/cpp/wgpu/JsiVertexBufferLayout.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -43,7 +43,6 @@ class JsiVertexBufferLayout .get(); } else { auto object = new wgpu::VertexBufferLayout(); - object->setDefault(); if (obj.hasProperty(runtime, "arrayStride")) { auto arrayStride = obj.getProperty(runtime, "arrayStride"); diff --git a/package/cpp/wgpu/JsiVertexState.h b/package/cpp/wgpu/JsiVertexState.h index 523c303591..b05de0b85d 100644 --- a/package/cpp/wgpu/JsiVertexState.h +++ b/package/cpp/wgpu/JsiVertexState.h @@ -3,7 +3,7 @@ #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -41,7 +41,6 @@ class JsiVertexState return obj.asHostObject(runtime)->getObject().get(); } else { auto object = new wgpu::VertexState(); - object->setDefault(); if (obj.hasProperty(runtime, "module")) { auto module = obj.getProperty(runtime, "module"); diff --git a/package/cpp/wgpu/JsiWGPUContext.h b/package/cpp/wgpu/JsiWGPUContext.h index 335ef94cc8..199ac8b8b5 100644 --- a/package/cpp/wgpu/JsiWGPUContext.h +++ b/package/cpp/wgpu/JsiWGPUContext.h @@ -1,6 +1,6 @@ #pragma once -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include @@ -32,17 +32,17 @@ class JsiWGPUContext : public JsiSkWrappingSharedPtrHostObject { auto device = JsiDevice::fromValue( runtime, arguments[0].asObject(runtime).getPropertyAsObject(runtime, "device")); - auto adapter = device->getAdapter(); + auto adapter = device->GetAdapter(); wgpu::Surface surface = *getObject().get(); wgpu::SwapChainDescriptor swapChainDesc; swapChainDesc.width = _width; swapChainDesc.height = _height; swapChainDesc.usage = wgpu::TextureUsage::RenderAttachment; - swapChainDesc.format = surface.getPreferredFormat(adapter); + swapChainDesc.format = wgpu::TextureFormat::RGBA8Unorm; //surface.GetPreferredFormat(adapter); swapChainDesc.presentMode = wgpu::PresentMode::Fifo; _surface = std::make_shared(surface); _swapChain = std::make_shared( - device->createSwapChain(surface, swapChainDesc)); + device->CreateSwapChain(surface, &swapChainDesc)); return jsi::Value::undefined(); } @@ -50,7 +50,7 @@ class JsiWGPUContext : public JsiSkWrappingSharedPtrHostObject { if (!_swapChain) { throw jsi::JSError(runtime, "WGPU Context is not configured"); } - wgpu::Texture texture = _swapChain->getCurrentTexture(); + wgpu::Texture texture = _swapChain->GetCurrentTexture(); return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), texture)); } @@ -59,78 +59,14 @@ class JsiWGPUContext : public JsiSkWrappingSharedPtrHostObject { if (!_swapChain) { throw jsi::JSError(runtime, "WGPU Context is not configured"); } - _swapChain->present(); + _swapChain->Present(); return jsi::Value::undefined(); } - JSI_HOST_FUNCTION(runDemo) { - auto device = JsiDevice::fromValue(runtime, arguments[0].asObject(runtime)); - // auto pipeline2 = - // JsiRenderPipeline::fromValue(runtime, - // arguments[1].asObject(runtime)); - auto commandEncoder = - JsiCommandEncoder::fromValue(runtime, arguments[2].asObject(runtime)); - auto vertexState = - JsiVertexState::fromValue(runtime, arguments[3].asObject(runtime)); - auto fragState = - JsiFragmentState::fromValue(runtime, arguments[4].asObject(runtime)); - - wgpu::RenderPipelineDescriptor pipelineDesc; - - // Vertex fetch - // (We don't use any input buffer so far) - pipelineDesc.vertex = *vertexState; - - // Primitive assembly and rasterization - // Each sequence of 3 vertices is considered as a triangle - pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList; - // We'll see later how to specify the order in which vertices should be - // connected. When not specified, vertices are considered sequentially. - pipelineDesc.primitive.stripIndexFormat = wgpu::IndexFormat::Undefined; - // The face orientation is defined by assuming that when looking - // from the front of the face, its corner vertices are enumerated - // in the counter-clockwise (CCW) order. - pipelineDesc.primitive.frontFace = wgpu::FrontFace::CCW; - // But the face orientation does not matter much because we do not - // cull (i.e. "hide") the faces pointing away from us (which is often - // used for optimization). - pipelineDesc.primitive.cullMode = wgpu::CullMode::None; - - // Fragment shader - pipelineDesc.fragment = fragState; - - // wgpu::ColorTargetState colorTarget; - // colorTarget.format = fragState->targets[0].format; - // colorTarget.writeMask = fragState->targets[0].writeMask; - // fragState->targetCount = 1; - // fragState->targets = &colorTarget; - - // Depth and stencil tests are not used here - pipelineDesc.depthStencil = nullptr; - - // Multi-sampling - // Samples per pixel - pipelineDesc.multisample.count = 1; - // Default value for the mask, meaning "all bits on" - pipelineDesc.multisample.mask = ~0u; - // Default value as well (irrelevant for count = 1 anyways) - pipelineDesc.multisample.alphaToCoverageEnabled = false; - - // Pipeline layout - pipelineDesc.layout = nullptr; - - wgpu::RenderPipeline pipeline = device->createRenderPipeline(pipelineDesc); - std::cout << "Render pipeline: " << pipeline << std::endl; - - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), pipeline)); - } - EXPORT_JSI_API_TYPENAME(JsiWGPUContext, WGPUContext) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiWGPUContext, configure), JSI_EXPORT_FUNC(JsiWGPUContext, getCurrentTexture), - JSI_EXPORT_FUNC(JsiWGPUContext, present), - JSI_EXPORT_FUNC(JsiWGPUContext, runDemo)) + JSI_EXPORT_FUNC(JsiWGPUContext, present)) }; } // namespace RNSkia \ No newline at end of file diff --git a/scripts/generator/common.ts b/scripts/generator/common.ts index 66bbfd3d0e..13d3812be5 100644 --- a/scripts/generator/common.ts +++ b/scripts/generator/common.ts @@ -2,9 +2,10 @@ import _ from "lodash"; import { JSIObject } from "./model"; import { isEnum } from "./enums"; -export const objectName = (name: string) => _.upperFirst(_.camelCase(name)).replace(/Wgsl/g, 'WGSL'); +const enums = ["BufferUsage", "TextureUsage", "ColorWriteMask"]; -export const isNumberType = (type: string) => type === "uint64_t" || type === "uint32_t" || type === "float" || type === "int32_t" || type === "size_t"; +export const objectName = (name: string) => _.upperFirst(_.camelCase(name)).replace(/Wgsl/g, 'WGSL'); +export const isNumberType = (type: string) => type === "uint64_t" || type === "uint32_t" || type === "float" || type === "int32_t" || type === "size_t" || enums.indexOf(type) > -1; export const isDouble = (type: string) => type === "double"; export const isAtomicType = (type: string) => type === "bool" || isDouble(type) || isNumberType(type) || type === "string"; @@ -14,6 +15,9 @@ export const unWrapType = (obj: string, type: string, pointer: boolean) => { } else if (isDouble(type)) { return `${obj}.getNumber()`; } else if (isNumberType(type)) { + if (enums.indexOf(type) > -1) { + return `static_cast(${obj}.getNumber())`; + } return `static_cast<${type}>(${obj}.getNumber())`; } else if (type === "string") { // TODO: the copy needs to be freed diff --git a/scripts/generator/enums.ts b/scripts/generator/enums.ts index 529333b5d4..bb681e45bb 100644 --- a/scripts/generator/enums.ts +++ b/scripts/generator/enums.ts @@ -6,10 +6,10 @@ export const isEnum = (type: string) => enums[type] !== undefined; const convertString = (input: string) => { const map: Record = { - "1d": "_1D", - "2d": "_2D", - "3d": "_3D", - "2d-array": "_2DArray", + "1d": "e1D", + "2d": "e2D", + "3d": "e3D", + "2d-array": "e2DArray", } if (map[input] !== undefined) { return map[input]; @@ -48,7 +48,7 @@ export const generateEnums = (enums: Record) => { #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" namespace RNSkia { ${Object.keys(enums).map(name => { diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index 0a80291ee2..ade249cc92 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -81,13 +81,13 @@ export const wrapReturnValue = (returns: string | undefined) => { } }; -const argList = (args: Arg[]) => args.map(arg => arg.baseType ? `base${_.upperFirst(arg.name)}`: (isAtomicType(arg.type) || arg.type.endsWith("[]")) ? `${arg.name}` : `*${arg.name}`).join(", "); +const argList = (args: Arg[]) => args.map(arg => arg.baseType ? `base${_.upperFirst(arg.name)}`: (isAtomicType(arg.type) || arg.type.endsWith("[]") || arg.type.endsWith("Descriptor")) ? `${arg.name}` : `*${arg.name}`).join(", "); const baseType = (arg: Arg) => { return ` auto ${arg.name}Next = *moduleDescriptor; -wgpu::${arg.baseType} base${_.upperFirst(arg.name)}; -base${_.upperFirst(arg.name)}.nextInChain = &${arg.name}Next.chain;` +auto base${_.upperFirst(arg.name)} = new wgpu::${arg.baseType}(); +base${_.upperFirst(arg.name)}->nextInChain = &${arg.name}Next;` }; const generatorMethod = (method: Method) => { @@ -107,7 +107,7 @@ const generatorMethod = (method: Method) => { ${ args.filter(arg => arg.baseType).map(arg => baseType(arg)) } - ${returns ? 'auto ret = ' : ''}getObject()->${_.camelCase(method.name)}(${argList(args)}); + ${returns ? 'auto ret = ' : ''}getObject()->${_.upperFirst(_.camelCase(method.name))}(${argList(args)}); return ${wrapReturnValue(returns)}; } `; @@ -125,7 +125,7 @@ const generatorAsyncMethod = (method: Method) => { [context = std::move(context), object = std::move(object) ${depList}]( jsi::Runtime &runtime, std::shared_ptr promise) -> void { - auto ret = object->${method.name}(${argList(args)}); + auto ret = object->${_.upperFirst(method.name)}(${argList(args)}); if (ret == nullptr) { promise->resolve(jsi::Value::null()); } else { @@ -140,7 +140,6 @@ const generatorAsyncMethod = (method: Method) => { const unpackProperties = (name: string, properties: Property[], defaultProperties: string) => { return `auto object = new wgpu::${name}(); -object->setDefault(); ${defaultProperties} ${properties.map((property, index) => { const propName = _.camelCase(property.name); @@ -180,7 +179,7 @@ export const generateObject = (object: JSIObject) => { #include #include -#include "webgpu.hpp" +#include "dawn/webgpu_cpp.h" #include diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 492b870361..8a5151adc1 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -45,7 +45,39 @@ export const model: JSIObject[] = [ { name: "options", optional: true, type: "RequestAdapterOptions", defaultValue: true } ], returns: "Adapter", - async: true + implementation: ` auto defaultOptions = new wgpu::RequestAdapterOptions(); + auto options = + count > 0 ? JsiRequestAdapterOptions::fromValue(runtime, arguments[0]) + : defaultOptions; + auto context = getContext(); + auto object = getObject(); + return RNJsi::JsiPromises::createPromiseAsJSIValue( + runtime, + [context = std::move(context), object = std::move(object), + options = std::move(options)]( + jsi::Runtime &runtime, + std::shared_ptr promise) -> void { + wgpu::Adapter adapter = nullptr; + object->RequestAdapter( + nullptr, + [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, const char *message, + void *userdata) { + if (message != nullptr) { + fprintf(stderr, "%s", message); + return; + } + *static_cast(userdata) = + wgpu::Adapter::Acquire(cAdapter); + }, + &adapter); + if (adapter == nullptr) { + promise->resolve(jsi::Value::null()); + } else { + promise->resolve(jsi::Object::createFromHostObject( + runtime, std::make_shared(std::move(context), + std::move(adapter)))); + } + });` }, { name: "getPreferredCanvasFormat", @@ -70,7 +102,39 @@ export const model: JSIObject[] = [ { name: "descriptor", type: "DeviceDescriptor", optional: true, defaultValue: true } ], returns: "Device", - async: true + // async: true, + implementation: ` auto defaultDescriptor = new wgpu::DeviceDescriptor(); + auto descriptor = + count > 0 ? JsiDeviceDescriptor::fromValue(runtime, arguments[0]) + : defaultDescriptor; + auto context = getContext(); + auto object = getObject(); + return RNJsi::JsiPromises::createPromiseAsJSIValue( + runtime, + [context = std::move(context), object = std::move(object), + descriptor = std::move(descriptor)]( + jsi::Runtime &runtime, + std::shared_ptr promise) -> void { + wgpu::Device device = nullptr; + adapter->RequestDevice( + nullptr, + [](WGPURequestDeviceStatus, WGPUDevice cDevice, const char *message, + void *userdata) { + if (message != nullptr) { + fprintf(stderr, "%s", message); + return; + } + *static_cast(userdata) = wgpu::Device::Acquire(cDevice); + }, + &device); + if (device == nullptr) { + promise->resolve(jsi::Value::null()); + } else { + promise->resolve(jsi::Object::createFromHostObject( + runtime, std::make_shared(std::move(context), + std::move(device)))); + } + });` } ] }, @@ -163,14 +227,14 @@ export const model: JSIObject[] = [ properties: [ { name: "size", type: "Extent3D" }, { name: "format", type: "TextureFormat" }, - { name: "usage", type: "uint32_t" } // TextureUsage + { name: "usage", type: "TextureUsage" } ] }, { "name": "BufferDescriptor", properties: [ { name: "size", type: "uint64_t" }, - {"name": "usage", "type": "uint32_t"}, //BufferUsage + {"name": "usage", "type": "BufferUsage"}, {"name": "mappedAtCreation", "type": "bool", "default": "false"} ] }, @@ -187,7 +251,7 @@ export const model: JSIObject[] = [ implementation: ` size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); - auto data = getObject()->getMappedRange(offset, size); + auto data = getObject()->GetMappedRange(offset, size); auto arrayBufferCtor = runtime.global().getPropertyAsFunction(runtime, "ArrayBuffer"); auto o = arrayBufferCtor.callAsConstructor(runtime, static_cast(size)).getObject(runtime); @@ -216,7 +280,17 @@ export const model: JSIObject[] = [ name: "commandBuffers", type: "CommandBuffer[]", ctype: true - }] + }], + implementation: `std::vector commandBuffers; + auto jsiArray = arguments[0].asObject(runtime).asArray(runtime); + auto jsiArraySize = static_cast(jsiArray.size(runtime)); + for (int i = 0; i < jsiArraySize; i++) { + auto val = jsiArray.getValueAtIndex(runtime, i); + commandBuffers.push_back(*JsiCommandBuffer::fromValue(runtime, val)); + } + + getObject()->Submit(commandBuffers.size(), commandBuffers.data()); + return jsi::Value::undefined();` }, { name: "writeBuffer", @@ -231,7 +305,7 @@ export const model: JSIObject[] = [ auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); auto size = static_cast(arguments[3].getNumber()); - getObject()->writeBuffer(*buffer, offset, data.data(runtime), size); + getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); `, } @@ -242,10 +316,10 @@ export const model: JSIObject[] = [ }, { name: "RenderPipelineDescriptor", - defaultProperties: `object->multisample.count = 1; -object->multisample.mask = ~0u; -object->multisample.alphaToCoverageEnabled = false; -`, +// defaultProperties: `object->multisample.count = 1; +// object->multisample.mask = ~0u; +// object->multisample.alphaToCoverageEnabled = false; +// `, properties: [ {"name": "vertex", "type": "VertexState"}, {"name": "primitive", "type": "PrimitiveState"}, @@ -280,7 +354,7 @@ object->multisample.alphaToCoverageEnabled = false; implementation: `auto index = static_cast(arguments[0].getNumber()); auto bindGroup = JsiBindGroup::fromValue(runtime, arguments[1]); //auto dynamicOffsetCount = static_cast(arguments[2].getNumber()); - getObject()->setBindGroup(index, *bindGroup, 0, nullptr); + getObject()->SetBindGroup(index, *bindGroup, 0, nullptr); return jsi::Value::undefined();` }, { @@ -293,7 +367,7 @@ object->multisample.alphaToCoverageEnabled = false; ], implementation: `auto slot = static_cast(arguments[0].getNumber()); auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); - getObject()->setVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); + getObject()->SetVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); return jsi::Value::undefined();` } ] @@ -301,13 +375,23 @@ object->multisample.alphaToCoverageEnabled = false; { name: "RenderPassDescriptor", properties: [ - {"name": "colorAttachments", "type": "RenderPassColorAttachment[]"} + {"name": "colorAttachments", "type": "RenderPassColorAttachment[]"}, + {"name": "depthStencilAttachment", "type": "RenderPassDepthStencilAttachment", "optional": true, pointer: true} + ] + }, + { + name: "RenderPassDepthStencilAttachment", + properties: [ + {"name": "view", "type": "TextureView"}, + {"name": "depthClearValue", "type": "uint32_t"}, + {"name": "depthLoadOp", "type": "LoadOp"}, + {"name": "depthStoreOp", "type": "StoreOp"} ] }, { name: "RenderPassColorAttachment", - defaultProperties: `object->resolveTarget = nullptr; -object->depthSlice = UINT32_MAX;`, +// defaultProperties: `object->resolveTarget = nullptr; +//object->depthSlice = UINT32_MAX;`, properties: [ {"name": "view", "type": "TextureView"}, {"name": "clearValue", "type": "Color"}, @@ -336,8 +420,8 @@ object->depthSlice = UINT32_MAX;`, }, { name: "ShaderModuleWGSLDescriptor", - defaultProperties: `object->chain.next = nullptr; -object->chain.sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, + defaultProperties: ` +object->sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, properties: [ {"name": "code", "type": "string"} ] @@ -365,11 +449,11 @@ object->chain.sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, }, { name: "ColorTargetState", - defaultProperties: `object->writeMask = wgpu::ColorWriteMask::All;`, + // defaultProperties: `object->writeMask = wgpu::ColorWriteMask::All;`, properties: [ {"name": "format", "type": "TextureFormat"}, {"name": "blend", "type": "BlendState", "optional": true, pointer: true}, - {"name": "writeMask", "type": "uint32_t", "optional": true} + {"name": "writeMask", "type": "ColorWriteMask", "optional": true} ] }, { From fdc0e597886b5eabc4f1863ef84aaee53e291770 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 16:03:41 +0200 Subject: [PATCH 04/63] :wrench: --- package/android/CMakeLists.txt | 2 + .../rnskia-android/dawn/EnumClassBitmasks.h | 52 - .../android/cpp/rnskia-android/dawn/webgpu.h | 3634 ----------- .../cpp/rnskia-android/dawn/webgpu_cpp.cpp | 4129 ++++++++++++ .../cpp/rnskia-android/dawn/webgpu_cpp.h | 5577 +++++++++-------- .../dawn/webgpu_cpp_chained_struct.h | 31 - .../cpp/rnskia-android/webgpu/webgpu.h | 2762 ++++++++ .../webgpu/webgpu_cpp_chained_struct.h | 29 + .../rnskia-android/webgpu/webgpu_cpp_print.h | 2301 +++++++ .../webgpu/webgpu_enum_class_bitmasks.h | 161 + scripts/generator/dawn.json | 734 ++- scripts/generator/generateObject.ts | 2 +- 12 files changed, 12806 insertions(+), 6608 deletions(-) delete mode 100644 package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h delete mode 100644 package/android/cpp/rnskia-android/dawn/webgpu.h create mode 100644 package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp delete mode 100644 package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h create mode 100644 package/android/cpp/rnskia-android/webgpu/webgpu.h create mode 100644 package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h create mode 100644 package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h create mode 100644 package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h diff --git a/package/android/CMakeLists.txt b/package/android/CMakeLists.txt index d8381099fa..d475c79fd6 100644 --- a/package/android/CMakeLists.txt +++ b/package/android/CMakeLists.txt @@ -48,6 +48,7 @@ add_library( "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp" "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/GrAHardwareBufferUtils.cpp" "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/WebGPUTriangle.cpp" + "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/dawn/webgpu_cpp.cpp" "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiHostObject.cpp" "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiValue.cpp" @@ -91,6 +92,7 @@ target_include_directories( ../cpp/wgpu ../cpp/jsi ../cpp/rnskia + ../cpp/rnskia/webgpu ../cpp/rnskia/dawn ../cpp/rnskia/values ../cpp/rnskia/dom diff --git a/package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h b/package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h deleted file mode 100644 index b469135130..0000000000 --- a/package/android/cpp/rnskia-android/dawn/EnumClassBitmasks.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 The Dawn & Tint Authors -// -// 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 SRC_DAWN_NATIVE_ENUMCLASSBITMASKS_H_ -#define SRC_DAWN_NATIVE_ENUMCLASSBITMASKS_H_ - -#include "dawn/EnumClassBitmasks.h" - -namespace dawn::native { - -// EnumClassBitmmasks is a helper in the dawn:: namespace. -// Re-export it in the dawn_native namespace. -// DAWN_IMPORT_BITMASK_OPERATORS - -// Specify this for usage with EnumMaskIterator -template struct EnumBitmaskSize { - static constexpr unsigned value = 0; -}; - -template constexpr bool HasOneBit(T value) { - return HasZeroOrOneBits(value) && value != T(0); -} - -} // namespace dawn::native - -#endif // SRC_DAWN_NATIVE_ENUMCLASSBITMASKS_H_ diff --git a/package/android/cpp/rnskia-android/dawn/webgpu.h b/package/android/cpp/rnskia-android/dawn/webgpu.h deleted file mode 100644 index 5c748268d6..0000000000 --- a/package/android/cpp/rnskia-android/dawn/webgpu.h +++ /dev/null @@ -1,3634 +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. -#ifdef __EMSCRIPTEN__ -#error \ - "Do not include this header. Emscripten already provides headers needed for WebGPU." -#endif -#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 UINT32_MAX -#define WGPU_COPY_STRIDE_UNDEFINED UINT32_MAX -#define WGPU_DEPTH_SLICE_UNDEFINED UINT32_MAX -#define WGPU_LIMIT_U32_UNDEFINED UINT32_MAX -#define WGPU_LIMIT_U64_UNDEFINED UINT64_MAX -#define WGPU_MIP_LEVEL_COUNT_UNDEFINED UINT32_MAX -#define WGPU_QUERY_SET_INDEX_UNDEFINED UINT32_MAX -#define WGPU_WHOLE_MAP_SIZE SIZE_MAX -#define WGPU_WHOLE_SIZE UINT64_MAX - -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 WGPUExternalTextureImpl *WGPUExternalTexture - 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 WGPUSharedBufferMemoryImpl *WGPUSharedBufferMemory - WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSharedFenceImpl *WGPUSharedFence WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSharedTextureMemoryImpl *WGPUSharedTextureMemory - WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSurfaceImpl *WGPUSurface WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSwapChainImpl *WGPUSwapChain WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureImpl *WGPUTexture WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureViewImpl *WGPUTextureView WGPU_OBJECT_ATTRIBUTE; - -// Structure forward declarations -struct WGPUAdapterProperties; -struct WGPUAdapterPropertiesD3D; -struct WGPUAdapterPropertiesVk; -struct WGPUBindGroupEntry; -struct WGPUBlendComponent; -struct WGPUBufferBindingLayout; -struct WGPUBufferDescriptor; -struct WGPUBufferHostMappedPointer; -struct WGPUBufferMapCallbackInfo; -struct WGPUColor; -struct WGPUCommandBufferDescriptor; -struct WGPUCommandEncoderDescriptor; -struct WGPUCompilationInfoCallbackInfo; -struct WGPUCompilationMessage; -struct WGPUComputePassTimestampWrites; -struct WGPUConstantEntry; -struct WGPUCopyTextureForBrowserOptions; -struct WGPUCreateComputePipelineAsyncCallbackInfo; -struct WGPUCreateRenderPipelineAsyncCallbackInfo; -struct WGPUDawnWGSLBlocklist; -struct WGPUDawnAdapterPropertiesPowerPreference; -struct WGPUDawnBufferDescriptorErrorInfoFromWireClient; -struct WGPUDawnCacheDeviceDescriptor; -struct WGPUDawnComputePipelineFullSubgroups; -struct WGPUDawnEncoderInternalUsageDescriptor; -struct WGPUDawnExperimentalSubgroupLimits; -struct WGPUDawnMultisampleStateRenderToSingleSampled; -struct WGPUDawnRenderPassColorAttachmentRenderToSingleSampled; -struct WGPUDawnShaderModuleSPIRVOptionsDescriptor; -struct WGPUDawnTextureInternalUsageDescriptor; -struct WGPUDawnTogglesDescriptor; -struct WGPUDawnWireWGSLControl; -struct WGPUDepthStencilStateDepthWriteDefinedDawn; -struct WGPUDrmFormatProperties; -struct WGPUExtent2D; -struct WGPUExtent3D; -struct WGPUExternalTextureBindingEntry; -struct WGPUExternalTextureBindingLayout; -struct WGPUFormatCapabilities; -struct WGPUFuture; -struct WGPUInstanceFeatures; -struct WGPULimits; -struct WGPUMemoryHeapInfo; -struct WGPUMultisampleState; -struct WGPUOrigin2D; -struct WGPUOrigin3D; -struct WGPUPipelineLayoutDescriptor; -struct WGPUPipelineLayoutStorageAttachment; -struct WGPUPopErrorScopeCallbackInfo; -struct WGPUPrimitiveDepthClipControl; -struct WGPUPrimitiveState; -struct WGPUQuerySetDescriptor; -struct WGPUQueueDescriptor; -struct WGPUQueueWorkDoneCallbackInfo; -struct WGPURenderBundleDescriptor; -struct WGPURenderBundleEncoderDescriptor; -struct WGPURenderPassDepthStencilAttachment; -struct WGPURenderPassDescriptorMaxDrawCount; -struct WGPURenderPassTimestampWrites; -struct WGPURequestAdapterCallbackInfo; -struct WGPURequestAdapterOptions; -struct WGPURequestDeviceCallbackInfo; -struct WGPUSamplerBindingLayout; -struct WGPUSamplerDescriptor; -struct WGPUShaderModuleSPIRVDescriptor; -struct WGPUShaderModuleWGSLDescriptor; -struct WGPUShaderModuleDescriptor; -struct WGPUSharedBufferMemoryBeginAccessDescriptor; -struct WGPUSharedBufferMemoryDescriptor; -struct WGPUSharedBufferMemoryEndAccessState; -struct WGPUSharedBufferMemoryProperties; -struct WGPUSharedFenceDXGISharedHandleDescriptor; -struct WGPUSharedFenceDXGISharedHandleExportInfo; -struct WGPUSharedFenceMTLSharedEventDescriptor; -struct WGPUSharedFenceMTLSharedEventExportInfo; -struct WGPUSharedFenceDescriptor; -struct WGPUSharedFenceExportInfo; -struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor; -struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo; -struct WGPUSharedFenceVkSemaphoreSyncFDDescriptor; -struct WGPUSharedFenceVkSemaphoreSyncFDExportInfo; -struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor; -struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo; -struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor; -struct WGPUSharedTextureMemoryEGLImageDescriptor; -struct WGPUSharedTextureMemoryIOSurfaceDescriptor; -struct WGPUSharedTextureMemoryAHardwareBufferDescriptor; -struct WGPUSharedTextureMemoryBeginAccessDescriptor; -struct WGPUSharedTextureMemoryDescriptor; -struct WGPUSharedTextureMemoryDmaBufPlane; -struct WGPUSharedTextureMemoryEndAccessState; -struct WGPUSharedTextureMemoryOpaqueFDDescriptor; -struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor; -struct WGPUSharedTextureMemoryVkImageLayoutBeginState; -struct WGPUSharedTextureMemoryVkImageLayoutEndState; -struct WGPUSharedTextureMemoryZirconHandleDescriptor; -struct WGPUStaticSamplerBindingLayout; -struct WGPUStencilFaceState; -struct WGPUStorageTextureBindingLayout; -struct WGPUSurfaceDescriptor; -struct WGPUSurfaceDescriptorFromAndroidNativeWindow; -struct WGPUSurfaceDescriptorFromCanvasHTMLSelector; -struct WGPUSurfaceDescriptorFromMetalLayer; -struct WGPUSurfaceDescriptorFromWaylandSurface; -struct WGPUSurfaceDescriptorFromWindowsHWND; -struct WGPUSurfaceDescriptorFromWindowsCoreWindow; -struct WGPUSurfaceDescriptorFromWindowsSwapChainPanel; -struct WGPUSurfaceDescriptorFromXlibWindow; -struct WGPUSwapChainDescriptor; -struct WGPUTextureBindingLayout; -struct WGPUTextureBindingViewDimensionDescriptor; -struct WGPUTextureDataLayout; -struct WGPUTextureViewDescriptor; -struct WGPUVertexAttribute; -struct WGPUAdapterPropertiesMemoryHeaps; -struct WGPUBindGroupDescriptor; -struct WGPUBindGroupLayoutEntry; -struct WGPUBlendState; -struct WGPUCompilationInfo; -struct WGPUComputePassDescriptor; -struct WGPUDepthStencilState; -struct WGPUDrmFormatCapabilities; -struct WGPUExternalTextureDescriptor; -struct WGPUFutureWaitInfo; -struct WGPUImageCopyBuffer; -struct WGPUImageCopyExternalTexture; -struct WGPUImageCopyTexture; -struct WGPUInstanceDescriptor; -struct WGPUPipelineLayoutPixelLocalStorage; -struct WGPUProgrammableStageDescriptor; -struct WGPURenderPassColorAttachment; -struct WGPURenderPassStorageAttachment; -struct WGPURequiredLimits; -struct WGPUSharedTextureMemoryDmaBufDescriptor; -struct WGPUSharedTextureMemoryProperties; -struct WGPUSharedTextureMemoryVkImageDescriptor; -struct WGPUSupportedLimits; -struct WGPUTextureDescriptor; -struct WGPUVertexBufferLayout; -struct WGPUBindGroupLayoutDescriptor; -struct WGPUColorTargetState; -struct WGPUComputePipelineDescriptor; -struct WGPUDeviceDescriptor; -struct WGPURenderPassDescriptor; -struct WGPURenderPassPixelLocalStorage; -struct WGPUVertexState; -struct WGPUFragmentState; -struct WGPURenderPipelineDescriptor; - -typedef enum WGPUWGSLFeatureName { - WGPUWGSLFeatureName_Undefined = 0x00000000, - WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures = 0x00000001, - WGPUWGSLFeatureName_Packed4x8IntegerDotProduct = 0x00000002, - WGPUWGSLFeatureName_UnrestrictedPointerParameters = 0x00000003, - WGPUWGSLFeatureName_PointerCompositeAccess = 0x00000004, - WGPUWGSLFeatureName_ChromiumTestingUnimplemented = 0x000003E8, - WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental = 0x000003E9, - WGPUWGSLFeatureName_ChromiumTestingExperimental = 0x000003EA, - WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch = 0x000003EB, - WGPUWGSLFeatureName_ChromiumTestingShipped = 0x000003EC, - WGPUWGSLFeatureName_Force32 = 0x7FFFFFFF -} WGPUWGSLFeatureName WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUAdapterType { - WGPUAdapterType_DiscreteGPU = 0x00000001, - WGPUAdapterType_IntegratedGPU = 0x00000002, - WGPUAdapterType_CPU = 0x00000003, - WGPUAdapterType_Unknown = 0x00000004, - WGPUAdapterType_Force32 = 0x7FFFFFFF -} WGPUAdapterType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUAddressMode { - WGPUAddressMode_Undefined = 0x00000000, - WGPUAddressMode_ClampToEdge = 0x00000001, - WGPUAddressMode_Repeat = 0x00000002, - WGPUAddressMode_MirrorRepeat = 0x00000003, - WGPUAddressMode_Force32 = 0x7FFFFFFF -} WGPUAddressMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUAlphaMode { - WGPUAlphaMode_Opaque = 0x00000001, - WGPUAlphaMode_Premultiplied = 0x00000002, - WGPUAlphaMode_Unpremultiplied = 0x00000003, - WGPUAlphaMode_Force32 = 0x7FFFFFFF -} WGPUAlphaMode 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_Undefined = 0x00000000, - WGPUBlendFactor_Zero = 0x00000001, - WGPUBlendFactor_One = 0x00000002, - WGPUBlendFactor_Src = 0x00000003, - WGPUBlendFactor_OneMinusSrc = 0x00000004, - WGPUBlendFactor_SrcAlpha = 0x00000005, - WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, - WGPUBlendFactor_Dst = 0x00000007, - WGPUBlendFactor_OneMinusDst = 0x00000008, - WGPUBlendFactor_DstAlpha = 0x00000009, - WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, - WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, - WGPUBlendFactor_Constant = 0x0000000C, - WGPUBlendFactor_OneMinusConstant = 0x0000000D, - WGPUBlendFactor_Src1 = 0x0000000E, - WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, - WGPUBlendFactor_Src1Alpha = 0x00000010, - WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, - WGPUBlendFactor_Force32 = 0x7FFFFFFF -} WGPUBlendFactor WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBlendOperation { - WGPUBlendOperation_Undefined = 0x00000000, - WGPUBlendOperation_Add = 0x00000001, - WGPUBlendOperation_Subtract = 0x00000002, - WGPUBlendOperation_ReverseSubtract = 0x00000003, - WGPUBlendOperation_Min = 0x00000004, - WGPUBlendOperation_Max = 0x00000005, - 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_InstanceDropped = 0x00000001, - WGPUBufferMapAsyncStatus_ValidationError = 0x00000002, - WGPUBufferMapAsyncStatus_Unknown = 0x00000003, - WGPUBufferMapAsyncStatus_DeviceLost = 0x00000004, - WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 0x00000005, - WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 0x00000006, - WGPUBufferMapAsyncStatus_MappingAlreadyPending = 0x00000007, - WGPUBufferMapAsyncStatus_OffsetOutOfRange = 0x00000008, - WGPUBufferMapAsyncStatus_SizeOutOfRange = 0x00000009, - WGPUBufferMapAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUBufferMapAsyncStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBufferMapState { - WGPUBufferMapState_Unmapped = 0x00000001, - WGPUBufferMapState_Pending = 0x00000002, - WGPUBufferMapState_Mapped = 0x00000003, - WGPUBufferMapState_Force32 = 0x7FFFFFFF -} WGPUBufferMapState WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCallbackMode { - WGPUCallbackMode_WaitAnyOnly = 0x00000000, - WGPUCallbackMode_AllowProcessEvents = 0x00000001, - WGPUCallbackMode_AllowSpontaneous = 0x00000002, - WGPUCallbackMode_Force32 = 0x7FFFFFFF -} WGPUCallbackMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompareFunction { - WGPUCompareFunction_Undefined = 0x00000000, - WGPUCompareFunction_Never = 0x00000001, - WGPUCompareFunction_Less = 0x00000002, - WGPUCompareFunction_Equal = 0x00000003, - WGPUCompareFunction_LessEqual = 0x00000004, - WGPUCompareFunction_Greater = 0x00000005, - WGPUCompareFunction_NotEqual = 0x00000006, - WGPUCompareFunction_GreaterEqual = 0x00000007, - WGPUCompareFunction_Always = 0x00000008, - WGPUCompareFunction_Force32 = 0x7FFFFFFF -} WGPUCompareFunction WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompilationInfoRequestStatus { - WGPUCompilationInfoRequestStatus_Success = 0x00000000, - WGPUCompilationInfoRequestStatus_InstanceDropped = 0x00000001, - WGPUCompilationInfoRequestStatus_Error = 0x00000002, - WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000003, - WGPUCompilationInfoRequestStatus_Unknown = 0x00000004, - WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF -} WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCompilationMessageType { - WGPUCompilationMessageType_Error = 0x00000001, - WGPUCompilationMessageType_Warning = 0x00000002, - WGPUCompilationMessageType_Info = 0x00000003, - WGPUCompilationMessageType_Force32 = 0x7FFFFFFF -} WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCreatePipelineAsyncStatus { - WGPUCreatePipelineAsyncStatus_Success = 0x00000000, - WGPUCreatePipelineAsyncStatus_InstanceDropped = 0x00000001, - WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000002, - WGPUCreatePipelineAsyncStatus_InternalError = 0x00000003, - WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000004, - WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000005, - WGPUCreatePipelineAsyncStatus_Unknown = 0x00000006, - WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCullMode { - WGPUCullMode_Undefined = 0x00000000, - WGPUCullMode_None = 0x00000001, - WGPUCullMode_Front = 0x00000002, - WGPUCullMode_Back = 0x00000003, - 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 = 0x00000001, - WGPUErrorFilter_OutOfMemory = 0x00000002, - WGPUErrorFilter_Internal = 0x00000003, - 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 WGPUExternalTextureRotation { - WGPUExternalTextureRotation_Rotate0Degrees = 0x00000000, - WGPUExternalTextureRotation_Rotate90Degrees = 0x00000001, - WGPUExternalTextureRotation_Rotate180Degrees = 0x00000002, - WGPUExternalTextureRotation_Rotate270Degrees = 0x00000003, - WGPUExternalTextureRotation_Force32 = 0x7FFFFFFF -} WGPUExternalTextureRotation 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_DawnInternalUsages = 0x000003EA, - WGPUFeatureName_DawnMultiPlanarFormats = 0x000003EB, - WGPUFeatureName_DawnNative = 0x000003EC, - WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, - WGPUFeatureName_ImplicitDeviceSynchronization = 0x000003EF, - WGPUFeatureName_SurfaceCapabilities = 0x000003F0, - WGPUFeatureName_TransientAttachments = 0x000003F1, - WGPUFeatureName_MSAARenderToSingleSampled = 0x000003F2, - WGPUFeatureName_DualSourceBlending = 0x000003F3, - WGPUFeatureName_D3D11MultithreadProtected = 0x000003F4, - WGPUFeatureName_ANGLETextureSharing = 0x000003F5, - WGPUFeatureName_ChromiumExperimentalSubgroups = 0x000003F6, - WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, - WGPUFeatureName_PixelLocalStorageCoherent = 0x000003F9, - WGPUFeatureName_PixelLocalStorageNonCoherent = 0x000003FA, - WGPUFeatureName_Unorm16TextureFormats = 0x000003FB, - WGPUFeatureName_Snorm16TextureFormats = 0x000003FC, - WGPUFeatureName_MultiPlanarFormatExtendedUsages = 0x000003FD, - WGPUFeatureName_MultiPlanarFormatP010 = 0x000003FE, - WGPUFeatureName_HostMappedPointer = 0x000003FF, - WGPUFeatureName_MultiPlanarRenderTargets = 0x00000400, - WGPUFeatureName_MultiPlanarFormatNv12a = 0x00000401, - WGPUFeatureName_FramebufferFetch = 0x00000402, - WGPUFeatureName_BufferMapExtendedUsages = 0x00000403, - WGPUFeatureName_AdapterPropertiesMemoryHeaps = 0x00000404, - WGPUFeatureName_AdapterPropertiesD3D = 0x00000405, - WGPUFeatureName_AdapterPropertiesVk = 0x00000406, - WGPUFeatureName_R8UnormStorage = 0x00000407, - WGPUFeatureName_FormatCapabilities = 0x00000408, - WGPUFeatureName_DrmFormatCapabilities = 0x00000409, - WGPUFeatureName_Norm16TextureFormats = 0x0000040A, - WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, - WGPUFeatureName_SharedTextureMemoryAHardwareBuffer = 0x0000044D, - WGPUFeatureName_SharedTextureMemoryDmaBuf = 0x0000044E, - WGPUFeatureName_SharedTextureMemoryOpaqueFD = 0x0000044F, - WGPUFeatureName_SharedTextureMemoryZirconHandle = 0x00000450, - WGPUFeatureName_SharedTextureMemoryDXGISharedHandle = 0x00000451, - WGPUFeatureName_SharedTextureMemoryD3D11Texture2D = 0x00000452, - WGPUFeatureName_SharedTextureMemoryIOSurface = 0x00000453, - WGPUFeatureName_SharedTextureMemoryEGLImage = 0x00000454, - WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, - WGPUFeatureName_SharedFenceVkSemaphoreSyncFD = 0x000004B1, - WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle = 0x000004B2, - WGPUFeatureName_SharedFenceDXGISharedHandle = 0x000004B3, - WGPUFeatureName_SharedFenceMTLSharedEvent = 0x000004B4, - WGPUFeatureName_SharedBufferMemoryD3D12Resource = 0x000004B5, - WGPUFeatureName_StaticSamplers = 0x000004B6, - WGPUFeatureName_Force32 = 0x7FFFFFFF -} WGPUFeatureName WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUFilterMode { - WGPUFilterMode_Undefined = 0x00000000, - WGPUFilterMode_Nearest = 0x00000001, - WGPUFilterMode_Linear = 0x00000002, - WGPUFilterMode_Force32 = 0x7FFFFFFF -} WGPUFilterMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUFrontFace { - WGPUFrontFace_Undefined = 0x00000000, - WGPUFrontFace_CCW = 0x00000001, - WGPUFrontFace_CW = 0x00000002, - 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 WGPULoggingType { - WGPULoggingType_Verbose = 0x00000001, - WGPULoggingType_Info = 0x00000002, - WGPULoggingType_Warning = 0x00000003, - WGPULoggingType_Error = 0x00000004, - WGPULoggingType_Force32 = 0x7FFFFFFF -} WGPULoggingType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUMipmapFilterMode { - WGPUMipmapFilterMode_Undefined = 0x00000000, - WGPUMipmapFilterMode_Nearest = 0x00000001, - WGPUMipmapFilterMode_Linear = 0x00000002, - WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF -} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPopErrorScopeStatus { - WGPUPopErrorScopeStatus_Success = 0x00000000, - WGPUPopErrorScopeStatus_InstanceDropped = 0x00000001, - WGPUPopErrorScopeStatus_Force32 = 0x7FFFFFFF -} WGPUPopErrorScopeStatus 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 = 0x00000001, - WGPUPresentMode_Immediate = 0x00000003, - WGPUPresentMode_Mailbox = 0x00000004, - WGPUPresentMode_Force32 = 0x7FFFFFFF -} WGPUPresentMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPrimitiveTopology { - WGPUPrimitiveTopology_Undefined = 0x00000000, - WGPUPrimitiveTopology_PointList = 0x00000001, - WGPUPrimitiveTopology_LineList = 0x00000002, - WGPUPrimitiveTopology_LineStrip = 0x00000003, - WGPUPrimitiveTopology_TriangleList = 0x00000004, - WGPUPrimitiveTopology_TriangleStrip = 0x00000005, - WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF -} WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUQueryType { - WGPUQueryType_Occlusion = 0x00000001, - WGPUQueryType_Timestamp = 0x00000002, - WGPUQueryType_Force32 = 0x7FFFFFFF -} WGPUQueryType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUQueueWorkDoneStatus { - WGPUQueueWorkDoneStatus_Success = 0x00000000, - WGPUQueueWorkDoneStatus_InstanceDropped = 0x00000001, - WGPUQueueWorkDoneStatus_Error = 0x00000002, - WGPUQueueWorkDoneStatus_Unknown = 0x00000003, - WGPUQueueWorkDoneStatus_DeviceLost = 0x00000004, - WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF -} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPURequestAdapterStatus { - WGPURequestAdapterStatus_Success = 0x00000000, - WGPURequestAdapterStatus_InstanceDropped = 0x00000001, - WGPURequestAdapterStatus_Unavailable = 0x00000002, - WGPURequestAdapterStatus_Error = 0x00000003, - WGPURequestAdapterStatus_Unknown = 0x00000004, - WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF -} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPURequestDeviceStatus { - WGPURequestDeviceStatus_Success = 0x00000000, - WGPURequestDeviceStatus_InstanceDropped = 0x00000001, - WGPURequestDeviceStatus_Error = 0x00000002, - WGPURequestDeviceStatus_Unknown = 0x00000003, - 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_SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, - WGPUSType_ExternalTextureBindingEntry = 0x0000000C, - WGPUSType_ExternalTextureBindingLayout = 0x0000000D, - WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, - WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, - WGPUSType_DepthStencilStateDepthWriteDefinedDawn = 0x00000010, - WGPUSType_TextureBindingViewDimensionDescriptor = 0x00000011, - WGPUSType_DawnTextureInternalUsageDescriptor = 0x000003E8, - WGPUSType_DawnEncoderInternalUsageDescriptor = 0x000003EB, - WGPUSType_DawnInstanceDescriptor = 0x000003EC, - WGPUSType_DawnCacheDeviceDescriptor = 0x000003ED, - WGPUSType_DawnAdapterPropertiesPowerPreference = 0x000003EE, - WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, - WGPUSType_DawnTogglesDescriptor = 0x000003F0, - WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, - WGPUSType_RequestAdapterOptionsLUID = 0x000003F2, - WGPUSType_RequestAdapterOptionsGetGLProc = 0x000003F3, - WGPUSType_RequestAdapterOptionsD3D11Device = 0x000003F4, - WGPUSType_DawnMultisampleStateRenderToSingleSampled = 0x000003F5, - WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, - WGPUSType_RenderPassPixelLocalStorage = 0x000003F7, - WGPUSType_PipelineLayoutPixelLocalStorage = 0x000003F8, - WGPUSType_BufferHostMappedPointer = 0x000003F9, - WGPUSType_DawnExperimentalSubgroupLimits = 0x000003FA, - WGPUSType_AdapterPropertiesMemoryHeaps = 0x000003FB, - WGPUSType_AdapterPropertiesD3D = 0x000003FC, - WGPUSType_AdapterPropertiesVk = 0x000003FD, - WGPUSType_DawnComputePipelineFullSubgroups = 0x000003FE, - WGPUSType_DawnWireWGSLControl = 0x000003FF, - WGPUSType_DawnWGSLBlocklist = 0x00000400, - WGPUSType_DrmFormatCapabilities = 0x00000401, - WGPUSType_SharedTextureMemoryVkImageDescriptor = 0x0000044C, - WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, - WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, - WGPUSType_SharedTextureMemoryDmaBufDescriptor = 0x0000044F, - WGPUSType_SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, - WGPUSType_SharedTextureMemoryZirconHandleDescriptor = 0x00000451, - WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, - WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, - WGPUSType_SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, - WGPUSType_SharedTextureMemoryEGLImageDescriptor = 0x00000455, - WGPUSType_SharedTextureMemoryInitializedBeginState = 0x000004B0, - WGPUSType_SharedTextureMemoryInitializedEndState = 0x000004B1, - WGPUSType_SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, - WGPUSType_SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, - WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, - WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, - WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, - WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, - WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, - WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, - WGPUSType_SharedFenceDXGISharedHandleDescriptor = 0x000004BA, - WGPUSType_SharedFenceDXGISharedHandleExportInfo = 0x000004BB, - WGPUSType_SharedFenceMTLSharedEventDescriptor = 0x000004BC, - WGPUSType_SharedFenceMTLSharedEventExportInfo = 0x000004BD, - WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, - WGPUSType_StaticSamplerBindingLayout = 0x000004BF, - 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 WGPUSharedFenceType { - WGPUSharedFenceType_Undefined = 0x00000000, - WGPUSharedFenceType_VkSemaphoreOpaqueFD = 0x00000001, - WGPUSharedFenceType_VkSemaphoreSyncFD = 0x00000002, - WGPUSharedFenceType_VkSemaphoreZirconHandle = 0x00000003, - WGPUSharedFenceType_DXGISharedHandle = 0x00000004, - WGPUSharedFenceType_MTLSharedEvent = 0x00000005, - WGPUSharedFenceType_Force32 = 0x7FFFFFFF -} WGPUSharedFenceType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUStencilOperation { - WGPUStencilOperation_Undefined = 0x00000000, - WGPUStencilOperation_Keep = 0x00000001, - WGPUStencilOperation_Zero = 0x00000002, - WGPUStencilOperation_Replace = 0x00000003, - WGPUStencilOperation_Invert = 0x00000004, - WGPUStencilOperation_IncrementClamp = 0x00000005, - WGPUStencilOperation_DecrementClamp = 0x00000006, - WGPUStencilOperation_IncrementWrap = 0x00000007, - WGPUStencilOperation_DecrementWrap = 0x00000008, - 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 WGPUTextureAspect { - WGPUTextureAspect_Undefined = 0x00000000, - WGPUTextureAspect_All = 0x00000001, - WGPUTextureAspect_StencilOnly = 0x00000002, - WGPUTextureAspect_DepthOnly = 0x00000003, - WGPUTextureAspect_Plane0Only = 0x00000004, - WGPUTextureAspect_Plane1Only = 0x00000005, - WGPUTextureAspect_Plane2Only = 0x00000006, - WGPUTextureAspect_Force32 = 0x7FFFFFFF -} WGPUTextureAspect WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureDimension { - WGPUTextureDimension_Undefined = 0x00000000, - WGPUTextureDimension_1D = 0x00000001, - WGPUTextureDimension_2D = 0x00000002, - WGPUTextureDimension_3D = 0x00000003, - 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_R16Unorm = 0x00000060, - WGPUTextureFormat_RG16Unorm = 0x00000061, - WGPUTextureFormat_RGBA16Unorm = 0x00000062, - WGPUTextureFormat_R16Snorm = 0x00000063, - WGPUTextureFormat_RG16Snorm = 0x00000064, - WGPUTextureFormat_RGBA16Snorm = 0x00000065, - WGPUTextureFormat_R8BG8Biplanar420Unorm = 0x00000066, - WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm = 0x00000067, - WGPUTextureFormat_R8BG8A8Triplanar420Unorm = 0x00000068, - 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_Unorm10_10_10_2 = 0x0000001F, - WGPUVertexFormat_Force32 = 0x7FFFFFFF -} WGPUVertexFormat WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUVertexStepMode { - WGPUVertexStepMode_Undefined = 0x00000000, - WGPUVertexStepMode_VertexBufferNotUsed = 0x00000001, - WGPUVertexStepMode_Vertex = 0x00000002, - WGPUVertexStepMode_Instance = 0x00000003, - WGPUVertexStepMode_Force32 = 0x7FFFFFFF -} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUWaitStatus { - WGPUWaitStatus_Success = 0x00000000, - WGPUWaitStatus_TimedOut = 0x00000001, - WGPUWaitStatus_UnsupportedTimeout = 0x00000002, - WGPUWaitStatus_UnsupportedCount = 0x00000003, - WGPUWaitStatus_UnsupportedMixedSources = 0x00000004, - WGPUWaitStatus_Unknown = 0x00000005, - WGPUWaitStatus_Force32 = 0x7FFFFFFF -} WGPUWaitStatus 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 WGPUHeapProperty { - WGPUHeapProperty_Undefined = 0x00000000, - WGPUHeapProperty_DeviceLocal = 0x00000001, - WGPUHeapProperty_HostVisible = 0x00000002, - WGPUHeapProperty_HostCoherent = 0x00000004, - WGPUHeapProperty_HostUncached = 0x00000008, - WGPUHeapProperty_HostCached = 0x00000010, - WGPUHeapProperty_Force32 = 0x7FFFFFFF -} WGPUHeapProperty WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUHeapPropertyFlags 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_TransientAttachment = 0x00000020, - WGPUTextureUsage_StorageAttachment = 0x00000040, - 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 (*WGPUCallback)(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 size_t (*WGPUDawnLoadCacheDataFunction)( - void const *key, size_t keySize, void *value, size_t valueSize, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUDawnStoreCacheDataFunction)( - void const *key, size_t keySize, void const *value, size_t valueSize, - 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 (*WGPULoggingCallback)(WGPULoggingType type, char const *message, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUPopErrorScopeCallback)( - WGPUPopErrorScopeStatus status, 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; - WGPUBool compatibilityMode; -} WGPUAdapterProperties WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUAdapterProperties -typedef struct WGPUAdapterPropertiesD3D { - WGPUChainedStructOut chain; - uint32_t shaderModel; -} WGPUAdapterPropertiesD3D WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUAdapterProperties -typedef struct WGPUAdapterPropertiesVk { - WGPUChainedStructOut chain; - uint32_t driverVersion; -} WGPUAdapterPropertiesVk 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; - -// Can be chained in WGPUBufferDescriptor -typedef struct WGPUBufferHostMappedPointer { - WGPUChainedStruct chain; - void *pointer; - WGPUCallback disposeCallback; - void *userdata; -} WGPUBufferHostMappedPointer WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBufferMapCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPUBufferMapCallback callback; - void *userdata; -} WGPUBufferMapCallbackInfo 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 WGPUCompilationInfoCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPUCompilationInfoCallback callback; - void *userdata; -} WGPUCompilationInfoCallbackInfo 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 WGPUCopyTextureForBrowserOptions { - WGPUChainedStruct const *nextInChain; - WGPUBool flipY; - WGPUBool needsColorSpaceConversion; - WGPUAlphaMode srcAlphaMode; - WGPU_NULLABLE float const *srcTransferFunctionParameters; - WGPU_NULLABLE float const *conversionMatrix; - WGPU_NULLABLE float const *dstTransferFunctionParameters; - WGPUAlphaMode dstAlphaMode; - WGPUBool internalUsage; -} WGPUCopyTextureForBrowserOptions WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCreateComputePipelineAsyncCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPUCreateComputePipelineAsyncCallback callback; - void *userdata; -} WGPUCreateComputePipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCreateRenderPipelineAsyncCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPUCreateRenderPipelineAsyncCallback callback; - void *userdata; -} WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUInstanceDescriptor -typedef struct WGPUDawnWGSLBlocklist { - WGPUChainedStruct chain; - size_t blocklistedFeatureCount; - const char *const *blocklistedFeatures; -} WGPUDawnWGSLBlocklist WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUAdapterProperties -typedef struct WGPUDawnAdapterPropertiesPowerPreference { - WGPUChainedStructOut chain; - WGPUPowerPreference powerPreference; -} WGPUDawnAdapterPropertiesPowerPreference WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUBufferDescriptor -typedef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient { - WGPUChainedStruct chain; - WGPUBool outOfMemory; -} WGPUDawnBufferDescriptorErrorInfoFromWireClient WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUDeviceDescriptor -typedef struct WGPUDawnCacheDeviceDescriptor { - WGPUChainedStruct chain; - char const *isolationKey; - WGPUDawnLoadCacheDataFunction loadDataFunction; - WGPUDawnStoreCacheDataFunction storeDataFunction; - void *functionUserdata; -} WGPUDawnCacheDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUComputePipelineDescriptor -typedef struct WGPUDawnComputePipelineFullSubgroups { - WGPUChainedStruct chain; - WGPUBool requiresFullSubgroups; -} WGPUDawnComputePipelineFullSubgroups WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUCommandEncoderDescriptor -typedef struct WGPUDawnEncoderInternalUsageDescriptor { - WGPUChainedStruct chain; - WGPUBool useInternalUsages; -} WGPUDawnEncoderInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSupportedLimits -typedef struct WGPUDawnExperimentalSubgroupLimits { - WGPUChainedStructOut chain; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; -} WGPUDawnExperimentalSubgroupLimits WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUMultisampleState -typedef struct WGPUDawnMultisampleStateRenderToSingleSampled { - WGPUChainedStruct chain; - WGPUBool enabled; -} WGPUDawnMultisampleStateRenderToSingleSampled WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPURenderPassColorAttachment -typedef struct WGPUDawnRenderPassColorAttachmentRenderToSingleSampled { - WGPUChainedStruct chain; - uint32_t implicitSampleCount; -} WGPUDawnRenderPassColorAttachmentRenderToSingleSampled - WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUShaderModuleDescriptor -typedef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor { - WGPUChainedStruct chain; - WGPUBool allowNonUniformDerivatives; -} WGPUDawnShaderModuleSPIRVOptionsDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUTextureDescriptor -typedef struct WGPUDawnTextureInternalUsageDescriptor { - WGPUChainedStruct chain; - WGPUTextureUsageFlags internalUsage; -} WGPUDawnTextureInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUInstanceDescriptor -// Can be chained in WGPURequestAdapterOptions -// Can be chained in WGPUDeviceDescriptor -typedef struct WGPUDawnTogglesDescriptor { - WGPUChainedStruct chain; - size_t enabledToggleCount; - const char *const *enabledToggles; - size_t disabledToggleCount; - const char *const *disabledToggles; -} WGPUDawnTogglesDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUInstanceDescriptor -typedef struct WGPUDawnWireWGSLControl { - WGPUChainedStruct chain; - WGPUBool enableExperimental; - WGPUBool enableUnsafe; - WGPUBool enableTesting; -} WGPUDawnWireWGSLControl WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUDepthStencilState -typedef struct WGPUDepthStencilStateDepthWriteDefinedDawn { - WGPUChainedStruct chain; - WGPUBool depthWriteDefined; -} WGPUDepthStencilStateDepthWriteDefinedDawn WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUDrmFormatProperties { - uint64_t modifier; - uint32_t modifierPlaneCount; -} WGPUDrmFormatProperties WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUExtent2D { - uint32_t width; - uint32_t height; -} WGPUExtent2D WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUExtent3D { - uint32_t width; - uint32_t height; - uint32_t depthOrArrayLayers; -} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUBindGroupEntry -typedef struct WGPUExternalTextureBindingEntry { - WGPUChainedStruct chain; - WGPUExternalTexture externalTexture; -} WGPUExternalTextureBindingEntry WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUBindGroupLayoutEntry -typedef struct WGPUExternalTextureBindingLayout { - WGPUChainedStruct chain; -} WGPUExternalTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUFormatCapabilities { - WGPUChainedStructOut *nextInChain; -} WGPUFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUFuture { - uint64_t id; -} WGPUFuture WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUInstanceFeatures { - WGPUChainedStruct const *nextInChain; - WGPUBool timedWaitAnyEnable; - size_t timedWaitAnyMaxCount; -} WGPUInstanceFeatures 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 WGPUMemoryHeapInfo { - WGPUHeapPropertyFlags properties; - uint64_t size; -} WGPUMemoryHeapInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUMultisampleState { - WGPUChainedStruct const *nextInChain; - uint32_t count; - uint32_t mask; - WGPUBool alphaToCoverageEnabled; -} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUOrigin2D { - uint32_t x; - uint32_t y; -} WGPUOrigin2D 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; - -typedef struct WGPUPipelineLayoutStorageAttachment { - WGPUChainedStruct const *nextInChain; - uint64_t offset; - WGPUTextureFormat format; -} WGPUPipelineLayoutStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUPopErrorScopeCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPUPopErrorScopeCallback callback; - WGPUErrorCallback oldCallback; - void *userdata; -} WGPUPopErrorScopeCallbackInfo 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 WGPUQueueWorkDoneCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPUQueueWorkDoneCallback callback; - void *userdata; -} WGPUQueueWorkDoneCallbackInfo 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 WGPURequestAdapterCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPURequestAdapterCallback callback; - void *userdata; -} WGPURequestAdapterCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURequestAdapterOptions { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE WGPUSurface compatibleSurface; - WGPUPowerPreference powerPreference; - WGPUBackendType backendType; - WGPUBool forceFallbackAdapter; - WGPUBool compatibilityMode; -} WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURequestDeviceCallbackInfo { - WGPUChainedStruct const *nextInChain; - WGPUCallbackMode mode; - WGPURequestDeviceCallback callback; - void *userdata; -} WGPURequestDeviceCallbackInfo 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; - -// 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 WGPUShaderModuleDescriptor { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE char const *label; -} WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedBufferMemoryBeginAccessDescriptor { - WGPUChainedStruct const *nextInChain; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const *fences; - uint64_t const *signaledValues; -} WGPUSharedBufferMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedBufferMemoryDescriptor { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE char const *label; -} WGPUSharedBufferMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedBufferMemoryEndAccessState { - WGPUChainedStructOut *nextInChain; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const *fences; - uint64_t const *signaledValues; -} WGPUSharedBufferMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedBufferMemoryProperties { - WGPUChainedStructOut *nextInChain; - WGPUBufferUsageFlags usage; - uint64_t size; -} WGPUSharedBufferMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceDescriptor -typedef struct WGPUSharedFenceDXGISharedHandleDescriptor { - WGPUChainedStruct chain; - void *handle; -} WGPUSharedFenceDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceExportInfo -typedef struct WGPUSharedFenceDXGISharedHandleExportInfo { - WGPUChainedStructOut chain; - void *handle; -} WGPUSharedFenceDXGISharedHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceDescriptor -typedef struct WGPUSharedFenceMTLSharedEventDescriptor { - WGPUChainedStruct chain; - void *sharedEvent; -} WGPUSharedFenceMTLSharedEventDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceExportInfo -typedef struct WGPUSharedFenceMTLSharedEventExportInfo { - WGPUChainedStructOut chain; - void *sharedEvent; -} WGPUSharedFenceMTLSharedEventExportInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedFenceDescriptor { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE char const *label; -} WGPUSharedFenceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedFenceExportInfo { - WGPUChainedStructOut *nextInChain; - WGPUSharedFenceType type; -} WGPUSharedFenceExportInfo WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceDescriptor -typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor { - WGPUChainedStruct chain; - int handle; -} WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceExportInfo -typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo { - WGPUChainedStructOut chain; - int handle; -} WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceDescriptor -typedef struct WGPUSharedFenceVkSemaphoreSyncFDDescriptor { - WGPUChainedStruct chain; - int handle; -} WGPUSharedFenceVkSemaphoreSyncFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceExportInfo -typedef struct WGPUSharedFenceVkSemaphoreSyncFDExportInfo { - WGPUChainedStructOut chain; - int handle; -} WGPUSharedFenceVkSemaphoreSyncFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceDescriptor -typedef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor { - WGPUChainedStruct chain; - uint32_t handle; -} WGPUSharedFenceVkSemaphoreZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedFenceExportInfo -typedef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo { - WGPUChainedStructOut chain; - uint32_t handle; -} WGPUSharedFenceVkSemaphoreZirconHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor { - WGPUChainedStruct chain; - void *handle; - WGPUBool useKeyedMutex; -} WGPUSharedTextureMemoryDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryEGLImageDescriptor { - WGPUChainedStruct chain; - void *image; -} WGPUSharedTextureMemoryEGLImageDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryIOSurfaceDescriptor { - WGPUChainedStruct chain; - void *ioSurface; -} WGPUSharedTextureMemoryIOSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor { - WGPUChainedStruct chain; - void *handle; -} WGPUSharedTextureMemoryAHardwareBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedTextureMemoryBeginAccessDescriptor { - WGPUChainedStruct const *nextInChain; - WGPUBool concurrentRead; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const *fences; - uint64_t const *signaledValues; -} WGPUSharedTextureMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedTextureMemoryDescriptor { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE char const *label; -} WGPUSharedTextureMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedTextureMemoryDmaBufPlane { - int fd; - uint64_t offset; - uint32_t stride; -} WGPUSharedTextureMemoryDmaBufPlane WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedTextureMemoryEndAccessState { - WGPUChainedStructOut *nextInChain; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const *fences; - uint64_t const *signaledValues; -} WGPUSharedTextureMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryOpaqueFDDescriptor { - WGPUChainedStruct chain; - void const *vkImageCreateInfo; - int memoryFD; - uint32_t memoryTypeIndex; - uint64_t allocationSize; - WGPUBool dedicatedAllocation; -} WGPUSharedTextureMemoryOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor { - WGPUChainedStruct chain; - WGPUBool dedicatedAllocation; -} WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor - WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryBeginAccessDescriptor -typedef struct WGPUSharedTextureMemoryVkImageLayoutBeginState { - WGPUChainedStruct chain; - int32_t oldLayout; - int32_t newLayout; -} WGPUSharedTextureMemoryVkImageLayoutBeginState WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryEndAccessState -typedef struct WGPUSharedTextureMemoryVkImageLayoutEndState { - WGPUChainedStructOut chain; - int32_t oldLayout; - int32_t newLayout; -} WGPUSharedTextureMemoryVkImageLayoutEndState WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryZirconHandleDescriptor { - WGPUChainedStruct chain; - uint32_t memoryFD; - uint64_t allocationSize; -} WGPUSharedTextureMemoryZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUBindGroupLayoutEntry -typedef struct WGPUStaticSamplerBindingLayout { - WGPUChainedStruct chain; - WGPUSampler sampler; -} WGPUStaticSamplerBindingLayout 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 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 WGPUSurfaceDescriptorFromWindowsCoreWindow { - WGPUChainedStruct chain; - void *coreWindow; -} WGPUSurfaceDescriptorFromWindowsCoreWindow WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromWindowsSwapChainPanel { - WGPUChainedStruct chain; - void *swapChainPanel; -} WGPUSurfaceDescriptorFromWindowsSwapChainPanel WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromXlibWindow { - WGPUChainedStruct chain; - void *display; - uint64_t window; -} WGPUSurfaceDescriptorFromXlibWindow WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSwapChainDescriptor { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE char const *label; - WGPUTextureUsageFlags usage; - WGPUTextureFormat format; - uint32_t width; - uint32_t height; - WGPUPresentMode presentMode; -} WGPUSwapChainDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUTextureBindingLayout { - WGPUChainedStruct const *nextInChain; - WGPUTextureSampleType sampleType; - WGPUTextureViewDimension viewDimension; - WGPUBool multisampled; -} WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUTextureDescriptor -typedef struct WGPUTextureBindingViewDimensionDescriptor { - WGPUChainedStruct chain; - WGPUTextureViewDimension textureBindingViewDimension; -} WGPUTextureBindingViewDimensionDescriptor 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; - -// Can be chained in WGPUAdapterProperties -typedef struct WGPUAdapterPropertiesMemoryHeaps { - WGPUChainedStructOut chain; - size_t heapCount; - WGPUMemoryHeapInfo const *heapInfo; -} WGPUAdapterPropertiesMemoryHeaps 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; - -// Can be chained in WGPUFormatCapabilities -typedef struct WGPUDrmFormatCapabilities { - WGPUChainedStructOut chain; - size_t propertiesCount; - WGPUDrmFormatProperties const *properties; -} WGPUDrmFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUExternalTextureDescriptor { - WGPUChainedStruct const *nextInChain; - WGPU_NULLABLE char const *label; - WGPUTextureView plane0; - WGPU_NULLABLE WGPUTextureView plane1; - WGPUOrigin2D visibleOrigin; - WGPUExtent2D visibleSize; - WGPUBool doYuvToRgbConversionOnly; - WGPU_NULLABLE float const *yuvToRgbConversionMatrix; - float const *srcTransferFunctionParameters; - float const *dstTransferFunctionParameters; - float const *gamutConversionMatrix; - WGPUBool flipY; - WGPUBool mirrored; - WGPUExternalTextureRotation rotation; -} WGPUExternalTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUFutureWaitInfo { - WGPUFuture future; - WGPUBool completed; -} WGPUFutureWaitInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUImageCopyBuffer { - WGPUChainedStruct const *nextInChain; - WGPUTextureDataLayout layout; - WGPUBuffer buffer; -} WGPUImageCopyBuffer WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUImageCopyExternalTexture { - WGPUChainedStruct const *nextInChain; - WGPUExternalTexture externalTexture; - WGPUOrigin3D origin; - WGPUExtent2D naturalSize; -} WGPUImageCopyExternalTexture WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUImageCopyTexture { - WGPUChainedStruct const *nextInChain; - WGPUTexture texture; - uint32_t mipLevel; - WGPUOrigin3D origin; - WGPUTextureAspect aspect; -} WGPUImageCopyTexture WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUInstanceDescriptor { - WGPUChainedStruct const *nextInChain; - WGPUInstanceFeatures features; -} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUPipelineLayoutDescriptor -typedef struct WGPUPipelineLayoutPixelLocalStorage { - WGPUChainedStruct chain; - uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount; - WGPUPipelineLayoutStorageAttachment const *storageAttachments; -} WGPUPipelineLayoutPixelLocalStorage 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; - uint32_t depthSlice; - WGPU_NULLABLE WGPUTextureView resolveTarget; - WGPULoadOp loadOp; - WGPUStoreOp storeOp; - WGPUColor clearValue; -} WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPassStorageAttachment { - WGPUChainedStruct const *nextInChain; - uint64_t offset; - WGPUTextureView storage; - WGPULoadOp loadOp; - WGPUStoreOp storeOp; - WGPUColor clearValue; -} WGPURenderPassStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURequiredLimits { - WGPUChainedStruct const *nextInChain; - WGPULimits limits; -} WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryDmaBufDescriptor { - WGPUChainedStruct chain; - WGPUExtent3D size; - uint32_t drmFormat; - uint64_t drmModifier; - size_t planeCount; - WGPUSharedTextureMemoryDmaBufPlane const *planes; -} WGPUSharedTextureMemoryDmaBufDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSharedTextureMemoryProperties { - WGPUChainedStructOut *nextInChain; - WGPUTextureUsageFlags usage; - WGPUExtent3D size; - WGPUTextureFormat format; -} WGPUSharedTextureMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSharedTextureMemoryDescriptor -typedef struct WGPUSharedTextureMemoryVkImageDescriptor { - WGPUChainedStruct chain; - int32_t vkFormat; - int32_t vkUsageFlags; - WGPUExtent3D vkExtent3D; -} WGPUSharedTextureMemoryVkImageDescriptor 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; - -// Can be chained in WGPURenderPassDescriptor -typedef struct WGPURenderPassPixelLocalStorage { - WGPUChainedStruct chain; - uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount; - WGPURenderPassStorageAttachment const *storageAttachments; -} WGPURenderPassPixelLocalStorage 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 void (*WGPUProcAdapterPropertiesFreeMembers)( - WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterPropertiesMemoryHeapsFreeMembers)( - WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUInstance (*WGPUProcCreateInstance)( - WGPUInstanceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDrmFormatCapabilitiesFreeMembers)( - WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcGetInstanceFeatures)(WGPUInstanceFeatures *features) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUProc (*WGPUProcGetProcAddress)( - WGPUDevice device, char const *procName) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryEndAccessStateFreeMembers)( - WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryEndAccessStateFreeMembers)( - WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Adapter -typedef WGPUDevice (*WGPUProcAdapterCreateDevice)( - WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -typedef size_t (*WGPUProcAdapterEnumerateFeatures)( - WGPUAdapter adapter, WGPUFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcAdapterGetFormatCapabilities)( - WGPUAdapter adapter, WGPUTextureFormat format, - WGPUFormatCapabilities *capabilities) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUInstance (*WGPUProcAdapterGetInstance)(WGPUAdapter adapter) - 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 WGPUFuture (*WGPUProcAdapterRequestDeviceF)( - WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *options, - WGPURequestDeviceCallbackInfo callbackInfo) 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 WGPUFuture (*WGPUProcBufferMapAsyncF)( - WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, - WGPUBufferMapCallbackInfo callbackInfo) 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 (*WGPUProcCommandEncoderInjectValidationError)( - WGPUCommandEncoder commandEncoder, - char const *message) 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 (*WGPUProcCommandEncoderWriteBuffer)( - WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, - uint8_t const *data, uint64_t size) 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 (*WGPUProcComputePassEncoderWriteTimestamp)( - WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, - uint32_t queryIndex) 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 WGPUFuture (*WGPUProcDeviceCreateComputePipelineAsyncF)( - WGPUDevice device, WGPUComputePipelineDescriptor const *descriptor, - WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBuffer (*WGPUProcDeviceCreateErrorBuffer)( - WGPUDevice device, - WGPUBufferDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUExternalTexture (*WGPUProcDeviceCreateErrorExternalTexture)( - WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUShaderModule (*WGPUProcDeviceCreateErrorShaderModule)( - WGPUDevice device, WGPUShaderModuleDescriptor const *descriptor, - char const *errorMessage) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTexture (*WGPUProcDeviceCreateErrorTexture)( - WGPUDevice device, - WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUExternalTexture (*WGPUProcDeviceCreateExternalTexture)( - WGPUDevice device, - WGPUExternalTextureDescriptor const *externalTextureDescriptor) - 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 WGPUFuture (*WGPUProcDeviceCreateRenderPipelineAsyncF)( - WGPUDevice device, WGPURenderPipelineDescriptor const *descriptor, - WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) - 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 WGPUSwapChain (*WGPUProcDeviceCreateSwapChain)( - WGPUDevice device, WGPUSurface surface, - WGPUSwapChainDescriptor 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 void (*WGPUProcDeviceForceLoss)( - WGPUDevice device, WGPUDeviceLostReason type, - char const *message) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUAdapter (*WGPUProcDeviceGetAdapter)(WGPUDevice device) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceGetLimits)( - WGPUDevice device, WGPUSupportedLimits *limits) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureUsageFlags (*WGPUProcDeviceGetSupportedSurfaceUsage)( - WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceHasFeature)( - WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSharedBufferMemory (*WGPUProcDeviceImportSharedBufferMemory)( - WGPUDevice device, - WGPUSharedBufferMemoryDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSharedFence (*WGPUProcDeviceImportSharedFence)( - WGPUDevice device, - WGPUSharedFenceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSharedTextureMemory (*WGPUProcDeviceImportSharedTextureMemory)( - WGPUDevice device, WGPUSharedTextureMemoryDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceInjectError)(WGPUDevice device, WGPUErrorType type, - char const *message) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePopErrorScope)( - WGPUDevice device, WGPUErrorCallback oldCallback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUFuture (*WGPUProcDevicePopErrorScopeF)( - WGPUDevice device, - WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePushErrorScope)( - WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetDeviceLostCallback)( - WGPUDevice device, WGPUDeviceLostCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const *label) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetLoggingCallback)( - WGPUDevice device, WGPULoggingCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)( - WGPUDevice device, WGPUErrorCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceTick)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceValidateTextureDescriptor)( - WGPUDevice device, - WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceReference)(WGPUDevice device) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) - WGPU_FUNCTION_ATTRIBUTE; - -// Procs of ExternalTexture -typedef void (*WGPUProcExternalTextureDestroy)( - WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureExpire)( - WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureRefresh)( - WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureSetLabel)( - WGPUExternalTexture externalTexture, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureReference)( - WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureRelease)( - WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Instance -typedef WGPUSurface (*WGPUProcInstanceCreateSurface)( - WGPUInstance instance, - WGPUSurfaceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef size_t (*WGPUProcInstanceEnumerateWGSLLanguageFeatures)( - WGPUInstance instance, - WGPUWGSLFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcInstanceHasWGSLLanguageFeature)( - WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture (*WGPUProcInstanceRequestAdapterF)( - WGPUInstance instance, - WGPU_NULLABLE WGPURequestAdapterOptions const *options, - WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUWaitStatus (*WGPUProcInstanceWaitAny)( - WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo *futures, - uint64_t timeoutNS) 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 (*WGPUProcQueueCopyExternalTextureForBrowser)( - WGPUQueue queue, WGPUImageCopyExternalTexture const *source, - WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, - WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueCopyTextureForBrowser)( - WGPUQueue queue, WGPUImageCopyTexture const *source, - WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, - WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueOnSubmittedWorkDone)( - WGPUQueue queue, WGPUQueueWorkDoneCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUFuture (*WGPUProcQueueOnSubmittedWorkDoneF)( - WGPUQueue queue, - WGPUQueueWorkDoneCallbackInfo callbackInfo) 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 (*WGPUProcRenderPassEncoderPixelLocalStorageBarrier)( - WGPURenderPassEncoder renderPassEncoder) 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 (*WGPUProcRenderPassEncoderWriteTimestamp)( - WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, - uint32_t queryIndex) 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 WGPUFuture (*WGPUProcShaderModuleGetCompilationInfoF)( - WGPUShaderModule shaderModule, - WGPUCompilationInfoCallbackInfo callbackInfo) 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 SharedBufferMemory -typedef WGPUBool (*WGPUProcSharedBufferMemoryBeginAccess)( - WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, - WGPUSharedBufferMemoryBeginAccessDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBuffer (*WGPUProcSharedBufferMemoryCreateBuffer)( - WGPUSharedBufferMemory sharedBufferMemory, - WGPU_NULLABLE WGPUBufferDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedBufferMemoryEndAccess)( - WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, - WGPUSharedBufferMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryGetProperties)( - WGPUSharedBufferMemory sharedBufferMemory, - WGPUSharedBufferMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedBufferMemoryIsDeviceLost)( - WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemorySetLabel)( - WGPUSharedBufferMemory sharedBufferMemory, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryReference)( - WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryRelease)( - WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of SharedFence -typedef void (*WGPUProcSharedFenceExportInfo)(WGPUSharedFence sharedFence, - WGPUSharedFenceExportInfo *info) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedFenceReference)(WGPUSharedFence sharedFence) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedFenceRelease)(WGPUSharedFence sharedFence) - WGPU_FUNCTION_ATTRIBUTE; - -// Procs of SharedTextureMemory -typedef WGPUBool (*WGPUProcSharedTextureMemoryBeginAccess)( - WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, - WGPUSharedTextureMemoryBeginAccessDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTexture (*WGPUProcSharedTextureMemoryCreateTexture)( - WGPUSharedTextureMemory sharedTextureMemory, - WGPU_NULLABLE WGPUTextureDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedTextureMemoryEndAccess)( - WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, - WGPUSharedTextureMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryGetProperties)( - WGPUSharedTextureMemory sharedTextureMemory, - WGPUSharedTextureMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedTextureMemoryIsDeviceLost)( - WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemorySetLabel)( - WGPUSharedTextureMemory sharedTextureMemory, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryReference)( - WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryRelease)( - WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Surface -typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)( - WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) - WGPU_FUNCTION_ATTRIBUTE; - -// Procs of SwapChain -typedef WGPUTexture (*WGPUProcSwapChainGetCurrentTexture)( - WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureView (*WGPUProcSwapChainGetCurrentTextureView)( - WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSwapChainPresent)(WGPUSwapChain swapChain) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSwapChainReference)(WGPUSwapChain swapChain) - WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSwapChainRelease)(WGPUSwapChain swapChain) - WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Texture -typedef WGPUTextureView (*WGPUProcTextureCreateErrorView)( - WGPUTexture texture, - WGPU_NULLABLE WGPUTextureViewDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -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 void wgpuAdapterPropertiesFreeMembers(WGPUAdapterProperties value) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterPropertiesMemoryHeapsFreeMembers( - WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUInstance -wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDrmFormatCapabilitiesFreeMembers( - WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuGetInstanceFeatures(WGPUInstanceFeatures *features) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPU_NULLABLE WGPUDevice device, - char const *procName) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryEndAccessStateFreeMembers( - WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryEndAccessStateFreeMembers( - WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Adapter -WGPU_EXPORT WGPUDevice wgpuAdapterCreateDevice( - WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures( - WGPUAdapter adapter, WGPUFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterGetFormatCapabilities( - WGPUAdapter adapter, WGPUTextureFormat format, - WGPUFormatCapabilities *capabilities) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter) - 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 WGPUFuture wgpuAdapterRequestDeviceF( - WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *options, - WGPURequestDeviceCallbackInfo callbackInfo) 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 WGPUFuture wgpuBufferMapAsyncF( - WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, - WGPUBufferMapCallbackInfo callbackInfo) 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 wgpuCommandEncoderInjectValidationError( - WGPUCommandEncoder commandEncoder, - char const *message) 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 wgpuCommandEncoderWriteBuffer( - WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, - uint8_t const *data, uint64_t size) 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 wgpuComputePassEncoderWriteTimestamp( - WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, - uint32_t queryIndex) 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 WGPUFuture wgpuDeviceCreateComputePipelineAsyncF( - WGPUDevice device, WGPUComputePipelineDescriptor const *descriptor, - WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer( - WGPUDevice device, - WGPUBufferDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUExternalTexture -wgpuDeviceCreateErrorExternalTexture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateErrorShaderModule( - WGPUDevice device, WGPUShaderModuleDescriptor const *descriptor, - char const *errorMessage) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTexture wgpuDeviceCreateErrorTexture( - WGPUDevice device, - WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture( - WGPUDevice device, - WGPUExternalTextureDescriptor const *externalTextureDescriptor) - 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 WGPUFuture wgpuDeviceCreateRenderPipelineAsyncF( - WGPUDevice device, WGPURenderPipelineDescriptor const *descriptor, - WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) - 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 WGPUSwapChain wgpuDeviceCreateSwapChain( - WGPUDevice device, WGPUSurface surface, - WGPUSwapChainDescriptor 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 void -wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, - char const *message) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device) - 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 WGPUTextureUsageFlags wgpuDeviceGetSupportedSurfaceUsage( - WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuDeviceHasFeature( - WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory( - WGPUDevice device, - WGPUSharedBufferMemoryDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSharedFence wgpuDeviceImportSharedFence( - WGPUDevice device, - WGPUSharedFenceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory( - WGPUDevice device, WGPUSharedTextureMemoryDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, - char const *message) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback oldCallback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScopeF( - WGPUDevice device, - WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuDevicePushErrorScope(WGPUDevice device, - WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuDeviceSetDeviceLostCallback(WGPUDevice device, - WGPUDeviceLostCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, - WGPUErrorCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceTick(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceValidateTextureDescriptor( - WGPUDevice device, - WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of ExternalTexture -WGPU_EXPORT void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureReference( - WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) - WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Instance -WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface( - WGPUInstance instance, - WGPUSurfaceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT size_t wgpuInstanceEnumerateWGSLLanguageFeatures( - WGPUInstance instance, - WGPUWGSLFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuInstanceHasWGSLLanguageFeature( - WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture wgpuInstanceRequestAdapterF( - WGPUInstance instance, - WGPU_NULLABLE WGPURequestAdapterOptions const *options, - WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUWaitStatus wgpuInstanceWaitAny( - WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo *futures, - uint64_t timeoutNS) 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 wgpuQueueCopyExternalTextureForBrowser( - WGPUQueue queue, WGPUImageCopyExternalTexture const *source, - WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, - WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueCopyTextureForBrowser( - WGPUQueue queue, WGPUImageCopyTexture const *source, - WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, - WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, - WGPUQueueWorkDoneCallback callback, - void *userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUFuture wgpuQueueOnSubmittedWorkDoneF( - WGPUQueue queue, - WGPUQueueWorkDoneCallbackInfo callbackInfo) 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 wgpuRenderPassEncoderPixelLocalStorageBarrier( - WGPURenderPassEncoder renderPassEncoder) 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 wgpuRenderPassEncoderWriteTimestamp( - WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, - uint32_t queryIndex) 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 WGPUFuture wgpuShaderModuleGetCompilationInfoF( - WGPUShaderModule shaderModule, - WGPUCompilationInfoCallbackInfo callbackInfo) 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 SharedBufferMemory -WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryBeginAccess( - WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, - WGPUSharedBufferMemoryBeginAccessDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBuffer wgpuSharedBufferMemoryCreateBuffer( - WGPUSharedBufferMemory sharedBufferMemory, - WGPU_NULLABLE WGPUBufferDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryEndAccess( - WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, - WGPUSharedBufferMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryGetProperties( - WGPUSharedBufferMemory sharedBufferMemory, - WGPUSharedBufferMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryIsDeviceLost( - WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryReference( - WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryRelease( - WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of SharedFence -WGPU_EXPORT void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, - WGPUSharedFenceExportInfo *info) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSharedFenceReference(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSharedFenceRelease(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of SharedTextureMemory -WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryBeginAccess( - WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, - WGPUSharedTextureMemoryBeginAccessDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTexture wgpuSharedTextureMemoryCreateTexture( - WGPUSharedTextureMemory sharedTextureMemory, - WGPU_NULLABLE WGPUTextureDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryEndAccess( - WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, - WGPUSharedTextureMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryGetProperties( - WGPUSharedTextureMemory sharedTextureMemory, - WGPUSharedTextureMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryIsDeviceLost( - WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, - char const *label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryReference( - WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryRelease( - WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Surface -WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat( - WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of SwapChain -WGPU_EXPORT WGPUTexture wgpuSwapChainGetCurrentTexture(WGPUSwapChain swapChain) - WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView( - WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSwapChainPresent(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSwapChainReference(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void -wgpuSwapChainRelease(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Texture -WGPU_EXPORT WGPUTextureView wgpuTextureCreateErrorView( - WGPUTexture texture, - WGPU_NULLABLE WGPUTextureViewDescriptor const *descriptor) - WGPU_FUNCTION_ATTRIBUTE; -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_ \ No newline at end of file diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp new file mode 100644 index 0000000000..9f9abf83bc --- /dev/null +++ b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp @@ -0,0 +1,4129 @@ + +#include + +#include "dawn/webgpu_cpp.h" + +#if defined(__GNUC__) || defined(__clang__) +// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + +namespace wgpu { + + // WGSLFeatureName + + static_assert(sizeof(WGSLFeatureName) == sizeof(WGPUWGSLFeatureName), "sizeof mismatch for WGSLFeatureName"); + static_assert(alignof(WGSLFeatureName) == alignof(WGPUWGSLFeatureName), "alignof mismatch for WGSLFeatureName"); + + static_assert(static_cast(WGSLFeatureName::Undefined) == WGPUWGSLFeatureName_Undefined, "value mismatch for WGSLFeatureName::Undefined"); + static_assert(static_cast(WGSLFeatureName::ReadonlyAndReadwriteStorageTextures) == WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures, "value mismatch for WGSLFeatureName::ReadonlyAndReadwriteStorageTextures"); + static_assert(static_cast(WGSLFeatureName::Packed4x8IntegerDotProduct) == WGPUWGSLFeatureName_Packed4x8IntegerDotProduct, "value mismatch for WGSLFeatureName::Packed4x8IntegerDotProduct"); + static_assert(static_cast(WGSLFeatureName::UnrestrictedPointerParameters) == WGPUWGSLFeatureName_UnrestrictedPointerParameters, "value mismatch for WGSLFeatureName::UnrestrictedPointerParameters"); + static_assert(static_cast(WGSLFeatureName::PointerCompositeAccess) == WGPUWGSLFeatureName_PointerCompositeAccess, "value mismatch for WGSLFeatureName::PointerCompositeAccess"); + static_assert(static_cast(WGSLFeatureName::ChromiumTestingUnimplemented) == WGPUWGSLFeatureName_ChromiumTestingUnimplemented, "value mismatch for WGSLFeatureName::ChromiumTestingUnimplemented"); + static_assert(static_cast(WGSLFeatureName::ChromiumTestingUnsafeExperimental) == WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental, "value mismatch for WGSLFeatureName::ChromiumTestingUnsafeExperimental"); + static_assert(static_cast(WGSLFeatureName::ChromiumTestingExperimental) == WGPUWGSLFeatureName_ChromiumTestingExperimental, "value mismatch for WGSLFeatureName::ChromiumTestingExperimental"); + static_assert(static_cast(WGSLFeatureName::ChromiumTestingShippedWithKillswitch) == WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch, "value mismatch for WGSLFeatureName::ChromiumTestingShippedWithKillswitch"); + static_assert(static_cast(WGSLFeatureName::ChromiumTestingShipped) == WGPUWGSLFeatureName_ChromiumTestingShipped, "value mismatch for WGSLFeatureName::ChromiumTestingShipped"); + + // AdapterType + + static_assert(sizeof(AdapterType) == sizeof(WGPUAdapterType), "sizeof mismatch for AdapterType"); + static_assert(alignof(AdapterType) == alignof(WGPUAdapterType), "alignof mismatch for AdapterType"); + + static_assert(static_cast(AdapterType::DiscreteGPU) == WGPUAdapterType_DiscreteGPU, "value mismatch for AdapterType::DiscreteGPU"); + static_assert(static_cast(AdapterType::IntegratedGPU) == WGPUAdapterType_IntegratedGPU, "value mismatch for AdapterType::IntegratedGPU"); + static_assert(static_cast(AdapterType::CPU) == WGPUAdapterType_CPU, "value mismatch for AdapterType::CPU"); + static_assert(static_cast(AdapterType::Unknown) == WGPUAdapterType_Unknown, "value mismatch for AdapterType::Unknown"); + + // AddressMode + + static_assert(sizeof(AddressMode) == sizeof(WGPUAddressMode), "sizeof mismatch for AddressMode"); + static_assert(alignof(AddressMode) == alignof(WGPUAddressMode), "alignof mismatch for AddressMode"); + + static_assert(static_cast(AddressMode::Undefined) == WGPUAddressMode_Undefined, "value mismatch for AddressMode::Undefined"); + static_assert(static_cast(AddressMode::ClampToEdge) == WGPUAddressMode_ClampToEdge, "value mismatch for AddressMode::ClampToEdge"); + static_assert(static_cast(AddressMode::Repeat) == WGPUAddressMode_Repeat, "value mismatch for AddressMode::Repeat"); + static_assert(static_cast(AddressMode::MirrorRepeat) == WGPUAddressMode_MirrorRepeat, "value mismatch for AddressMode::MirrorRepeat"); + + // AlphaMode + + static_assert(sizeof(AlphaMode) == sizeof(WGPUAlphaMode), "sizeof mismatch for AlphaMode"); + static_assert(alignof(AlphaMode) == alignof(WGPUAlphaMode), "alignof mismatch for AlphaMode"); + + static_assert(static_cast(AlphaMode::Opaque) == WGPUAlphaMode_Opaque, "value mismatch for AlphaMode::Opaque"); + static_assert(static_cast(AlphaMode::Premultiplied) == WGPUAlphaMode_Premultiplied, "value mismatch for AlphaMode::Premultiplied"); + static_assert(static_cast(AlphaMode::Unpremultiplied) == WGPUAlphaMode_Unpremultiplied, "value mismatch for AlphaMode::Unpremultiplied"); + + // BackendType + + static_assert(sizeof(BackendType) == sizeof(WGPUBackendType), "sizeof mismatch for BackendType"); + static_assert(alignof(BackendType) == alignof(WGPUBackendType), "alignof mismatch for BackendType"); + + static_assert(static_cast(BackendType::Undefined) == WGPUBackendType_Undefined, "value mismatch for BackendType::Undefined"); + static_assert(static_cast(BackendType::Null) == WGPUBackendType_Null, "value mismatch for BackendType::Null"); + static_assert(static_cast(BackendType::WebGPU) == WGPUBackendType_WebGPU, "value mismatch for BackendType::WebGPU"); + static_assert(static_cast(BackendType::D3D11) == WGPUBackendType_D3D11, "value mismatch for BackendType::D3D11"); + static_assert(static_cast(BackendType::D3D12) == WGPUBackendType_D3D12, "value mismatch for BackendType::D3D12"); + static_assert(static_cast(BackendType::Metal) == WGPUBackendType_Metal, "value mismatch for BackendType::Metal"); + static_assert(static_cast(BackendType::Vulkan) == WGPUBackendType_Vulkan, "value mismatch for BackendType::Vulkan"); + static_assert(static_cast(BackendType::OpenGL) == WGPUBackendType_OpenGL, "value mismatch for BackendType::OpenGL"); + static_assert(static_cast(BackendType::OpenGLES) == WGPUBackendType_OpenGLES, "value mismatch for BackendType::OpenGLES"); + + // BlendFactor + + static_assert(sizeof(BlendFactor) == sizeof(WGPUBlendFactor), "sizeof mismatch for BlendFactor"); + static_assert(alignof(BlendFactor) == alignof(WGPUBlendFactor), "alignof mismatch for BlendFactor"); + + static_assert(static_cast(BlendFactor::Undefined) == WGPUBlendFactor_Undefined, "value mismatch for BlendFactor::Undefined"); + static_assert(static_cast(BlendFactor::Zero) == WGPUBlendFactor_Zero, "value mismatch for BlendFactor::Zero"); + static_assert(static_cast(BlendFactor::One) == WGPUBlendFactor_One, "value mismatch for BlendFactor::One"); + static_assert(static_cast(BlendFactor::Src) == WGPUBlendFactor_Src, "value mismatch for BlendFactor::Src"); + static_assert(static_cast(BlendFactor::OneMinusSrc) == WGPUBlendFactor_OneMinusSrc, "value mismatch for BlendFactor::OneMinusSrc"); + static_assert(static_cast(BlendFactor::SrcAlpha) == WGPUBlendFactor_SrcAlpha, "value mismatch for BlendFactor::SrcAlpha"); + static_assert(static_cast(BlendFactor::OneMinusSrcAlpha) == WGPUBlendFactor_OneMinusSrcAlpha, "value mismatch for BlendFactor::OneMinusSrcAlpha"); + static_assert(static_cast(BlendFactor::Dst) == WGPUBlendFactor_Dst, "value mismatch for BlendFactor::Dst"); + static_assert(static_cast(BlendFactor::OneMinusDst) == WGPUBlendFactor_OneMinusDst, "value mismatch for BlendFactor::OneMinusDst"); + static_assert(static_cast(BlendFactor::DstAlpha) == WGPUBlendFactor_DstAlpha, "value mismatch for BlendFactor::DstAlpha"); + static_assert(static_cast(BlendFactor::OneMinusDstAlpha) == WGPUBlendFactor_OneMinusDstAlpha, "value mismatch for BlendFactor::OneMinusDstAlpha"); + static_assert(static_cast(BlendFactor::SrcAlphaSaturated) == WGPUBlendFactor_SrcAlphaSaturated, "value mismatch for BlendFactor::SrcAlphaSaturated"); + static_assert(static_cast(BlendFactor::Constant) == WGPUBlendFactor_Constant, "value mismatch for BlendFactor::Constant"); + static_assert(static_cast(BlendFactor::OneMinusConstant) == WGPUBlendFactor_OneMinusConstant, "value mismatch for BlendFactor::OneMinusConstant"); + static_assert(static_cast(BlendFactor::Src1) == WGPUBlendFactor_Src1, "value mismatch for BlendFactor::Src1"); + static_assert(static_cast(BlendFactor::OneMinusSrc1) == WGPUBlendFactor_OneMinusSrc1, "value mismatch for BlendFactor::OneMinusSrc1"); + static_assert(static_cast(BlendFactor::Src1Alpha) == WGPUBlendFactor_Src1Alpha, "value mismatch for BlendFactor::Src1Alpha"); + static_assert(static_cast(BlendFactor::OneMinusSrc1Alpha) == WGPUBlendFactor_OneMinusSrc1Alpha, "value mismatch for BlendFactor::OneMinusSrc1Alpha"); + + // BlendOperation + + static_assert(sizeof(BlendOperation) == sizeof(WGPUBlendOperation), "sizeof mismatch for BlendOperation"); + static_assert(alignof(BlendOperation) == alignof(WGPUBlendOperation), "alignof mismatch for BlendOperation"); + + static_assert(static_cast(BlendOperation::Undefined) == WGPUBlendOperation_Undefined, "value mismatch for BlendOperation::Undefined"); + static_assert(static_cast(BlendOperation::Add) == WGPUBlendOperation_Add, "value mismatch for BlendOperation::Add"); + static_assert(static_cast(BlendOperation::Subtract) == WGPUBlendOperation_Subtract, "value mismatch for BlendOperation::Subtract"); + static_assert(static_cast(BlendOperation::ReverseSubtract) == WGPUBlendOperation_ReverseSubtract, "value mismatch for BlendOperation::ReverseSubtract"); + static_assert(static_cast(BlendOperation::Min) == WGPUBlendOperation_Min, "value mismatch for BlendOperation::Min"); + static_assert(static_cast(BlendOperation::Max) == WGPUBlendOperation_Max, "value mismatch for BlendOperation::Max"); + + // BufferBindingType + + static_assert(sizeof(BufferBindingType) == sizeof(WGPUBufferBindingType), "sizeof mismatch for BufferBindingType"); + static_assert(alignof(BufferBindingType) == alignof(WGPUBufferBindingType), "alignof mismatch for BufferBindingType"); + + static_assert(static_cast(BufferBindingType::Undefined) == WGPUBufferBindingType_Undefined, "value mismatch for BufferBindingType::Undefined"); + static_assert(static_cast(BufferBindingType::Uniform) == WGPUBufferBindingType_Uniform, "value mismatch for BufferBindingType::Uniform"); + static_assert(static_cast(BufferBindingType::Storage) == WGPUBufferBindingType_Storage, "value mismatch for BufferBindingType::Storage"); + static_assert(static_cast(BufferBindingType::ReadOnlyStorage) == WGPUBufferBindingType_ReadOnlyStorage, "value mismatch for BufferBindingType::ReadOnlyStorage"); + + // BufferMapAsyncStatus + + static_assert(sizeof(BufferMapAsyncStatus) == sizeof(WGPUBufferMapAsyncStatus), "sizeof mismatch for BufferMapAsyncStatus"); + static_assert(alignof(BufferMapAsyncStatus) == alignof(WGPUBufferMapAsyncStatus), "alignof mismatch for BufferMapAsyncStatus"); + + static_assert(static_cast(BufferMapAsyncStatus::Success) == WGPUBufferMapAsyncStatus_Success, "value mismatch for BufferMapAsyncStatus::Success"); + static_assert(static_cast(BufferMapAsyncStatus::InstanceDropped) == WGPUBufferMapAsyncStatus_InstanceDropped, "value mismatch for BufferMapAsyncStatus::InstanceDropped"); + static_assert(static_cast(BufferMapAsyncStatus::ValidationError) == WGPUBufferMapAsyncStatus_ValidationError, "value mismatch for BufferMapAsyncStatus::ValidationError"); + static_assert(static_cast(BufferMapAsyncStatus::Unknown) == WGPUBufferMapAsyncStatus_Unknown, "value mismatch for BufferMapAsyncStatus::Unknown"); + static_assert(static_cast(BufferMapAsyncStatus::DeviceLost) == WGPUBufferMapAsyncStatus_DeviceLost, "value mismatch for BufferMapAsyncStatus::DeviceLost"); + static_assert(static_cast(BufferMapAsyncStatus::DestroyedBeforeCallback) == WGPUBufferMapAsyncStatus_DestroyedBeforeCallback, "value mismatch for BufferMapAsyncStatus::DestroyedBeforeCallback"); + static_assert(static_cast(BufferMapAsyncStatus::UnmappedBeforeCallback) == WGPUBufferMapAsyncStatus_UnmappedBeforeCallback, "value mismatch for BufferMapAsyncStatus::UnmappedBeforeCallback"); + static_assert(static_cast(BufferMapAsyncStatus::MappingAlreadyPending) == WGPUBufferMapAsyncStatus_MappingAlreadyPending, "value mismatch for BufferMapAsyncStatus::MappingAlreadyPending"); + static_assert(static_cast(BufferMapAsyncStatus::OffsetOutOfRange) == WGPUBufferMapAsyncStatus_OffsetOutOfRange, "value mismatch for BufferMapAsyncStatus::OffsetOutOfRange"); + static_assert(static_cast(BufferMapAsyncStatus::SizeOutOfRange) == WGPUBufferMapAsyncStatus_SizeOutOfRange, "value mismatch for BufferMapAsyncStatus::SizeOutOfRange"); + + // BufferMapState + + static_assert(sizeof(BufferMapState) == sizeof(WGPUBufferMapState), "sizeof mismatch for BufferMapState"); + static_assert(alignof(BufferMapState) == alignof(WGPUBufferMapState), "alignof mismatch for BufferMapState"); + + static_assert(static_cast(BufferMapState::Unmapped) == WGPUBufferMapState_Unmapped, "value mismatch for BufferMapState::Unmapped"); + static_assert(static_cast(BufferMapState::Pending) == WGPUBufferMapState_Pending, "value mismatch for BufferMapState::Pending"); + static_assert(static_cast(BufferMapState::Mapped) == WGPUBufferMapState_Mapped, "value mismatch for BufferMapState::Mapped"); + + // CallbackMode + + static_assert(sizeof(CallbackMode) == sizeof(WGPUCallbackMode), "sizeof mismatch for CallbackMode"); + static_assert(alignof(CallbackMode) == alignof(WGPUCallbackMode), "alignof mismatch for CallbackMode"); + + static_assert(static_cast(CallbackMode::WaitAnyOnly) == WGPUCallbackMode_WaitAnyOnly, "value mismatch for CallbackMode::WaitAnyOnly"); + static_assert(static_cast(CallbackMode::AllowProcessEvents) == WGPUCallbackMode_AllowProcessEvents, "value mismatch for CallbackMode::AllowProcessEvents"); + static_assert(static_cast(CallbackMode::AllowSpontaneous) == WGPUCallbackMode_AllowSpontaneous, "value mismatch for CallbackMode::AllowSpontaneous"); + + // CompareFunction + + static_assert(sizeof(CompareFunction) == sizeof(WGPUCompareFunction), "sizeof mismatch for CompareFunction"); + static_assert(alignof(CompareFunction) == alignof(WGPUCompareFunction), "alignof mismatch for CompareFunction"); + + static_assert(static_cast(CompareFunction::Undefined) == WGPUCompareFunction_Undefined, "value mismatch for CompareFunction::Undefined"); + static_assert(static_cast(CompareFunction::Never) == WGPUCompareFunction_Never, "value mismatch for CompareFunction::Never"); + static_assert(static_cast(CompareFunction::Less) == WGPUCompareFunction_Less, "value mismatch for CompareFunction::Less"); + static_assert(static_cast(CompareFunction::Equal) == WGPUCompareFunction_Equal, "value mismatch for CompareFunction::Equal"); + static_assert(static_cast(CompareFunction::LessEqual) == WGPUCompareFunction_LessEqual, "value mismatch for CompareFunction::LessEqual"); + static_assert(static_cast(CompareFunction::Greater) == WGPUCompareFunction_Greater, "value mismatch for CompareFunction::Greater"); + static_assert(static_cast(CompareFunction::NotEqual) == WGPUCompareFunction_NotEqual, "value mismatch for CompareFunction::NotEqual"); + static_assert(static_cast(CompareFunction::GreaterEqual) == WGPUCompareFunction_GreaterEqual, "value mismatch for CompareFunction::GreaterEqual"); + static_assert(static_cast(CompareFunction::Always) == WGPUCompareFunction_Always, "value mismatch for CompareFunction::Always"); + + // CompilationInfoRequestStatus + + static_assert(sizeof(CompilationInfoRequestStatus) == sizeof(WGPUCompilationInfoRequestStatus), "sizeof mismatch for CompilationInfoRequestStatus"); + static_assert(alignof(CompilationInfoRequestStatus) == alignof(WGPUCompilationInfoRequestStatus), "alignof mismatch for CompilationInfoRequestStatus"); + + static_assert(static_cast(CompilationInfoRequestStatus::Success) == WGPUCompilationInfoRequestStatus_Success, "value mismatch for CompilationInfoRequestStatus::Success"); + static_assert(static_cast(CompilationInfoRequestStatus::InstanceDropped) == WGPUCompilationInfoRequestStatus_InstanceDropped, "value mismatch for CompilationInfoRequestStatus::InstanceDropped"); + static_assert(static_cast(CompilationInfoRequestStatus::Error) == WGPUCompilationInfoRequestStatus_Error, "value mismatch for CompilationInfoRequestStatus::Error"); + static_assert(static_cast(CompilationInfoRequestStatus::DeviceLost) == WGPUCompilationInfoRequestStatus_DeviceLost, "value mismatch for CompilationInfoRequestStatus::DeviceLost"); + static_assert(static_cast(CompilationInfoRequestStatus::Unknown) == WGPUCompilationInfoRequestStatus_Unknown, "value mismatch for CompilationInfoRequestStatus::Unknown"); + + // CompilationMessageType + + static_assert(sizeof(CompilationMessageType) == sizeof(WGPUCompilationMessageType), "sizeof mismatch for CompilationMessageType"); + static_assert(alignof(CompilationMessageType) == alignof(WGPUCompilationMessageType), "alignof mismatch for CompilationMessageType"); + + static_assert(static_cast(CompilationMessageType::Error) == WGPUCompilationMessageType_Error, "value mismatch for CompilationMessageType::Error"); + static_assert(static_cast(CompilationMessageType::Warning) == WGPUCompilationMessageType_Warning, "value mismatch for CompilationMessageType::Warning"); + static_assert(static_cast(CompilationMessageType::Info) == WGPUCompilationMessageType_Info, "value mismatch for CompilationMessageType::Info"); + + // CreatePipelineAsyncStatus + + static_assert(sizeof(CreatePipelineAsyncStatus) == sizeof(WGPUCreatePipelineAsyncStatus), "sizeof mismatch for CreatePipelineAsyncStatus"); + static_assert(alignof(CreatePipelineAsyncStatus) == alignof(WGPUCreatePipelineAsyncStatus), "alignof mismatch for CreatePipelineAsyncStatus"); + + static_assert(static_cast(CreatePipelineAsyncStatus::Success) == WGPUCreatePipelineAsyncStatus_Success, "value mismatch for CreatePipelineAsyncStatus::Success"); + static_assert(static_cast(CreatePipelineAsyncStatus::InstanceDropped) == WGPUCreatePipelineAsyncStatus_InstanceDropped, "value mismatch for CreatePipelineAsyncStatus::InstanceDropped"); + static_assert(static_cast(CreatePipelineAsyncStatus::ValidationError) == WGPUCreatePipelineAsyncStatus_ValidationError, "value mismatch for CreatePipelineAsyncStatus::ValidationError"); + static_assert(static_cast(CreatePipelineAsyncStatus::InternalError) == WGPUCreatePipelineAsyncStatus_InternalError, "value mismatch for CreatePipelineAsyncStatus::InternalError"); + static_assert(static_cast(CreatePipelineAsyncStatus::DeviceLost) == WGPUCreatePipelineAsyncStatus_DeviceLost, "value mismatch for CreatePipelineAsyncStatus::DeviceLost"); + static_assert(static_cast(CreatePipelineAsyncStatus::DeviceDestroyed) == WGPUCreatePipelineAsyncStatus_DeviceDestroyed, "value mismatch for CreatePipelineAsyncStatus::DeviceDestroyed"); + static_assert(static_cast(CreatePipelineAsyncStatus::Unknown) == WGPUCreatePipelineAsyncStatus_Unknown, "value mismatch for CreatePipelineAsyncStatus::Unknown"); + + // CullMode + + static_assert(sizeof(CullMode) == sizeof(WGPUCullMode), "sizeof mismatch for CullMode"); + static_assert(alignof(CullMode) == alignof(WGPUCullMode), "alignof mismatch for CullMode"); + + static_assert(static_cast(CullMode::Undefined) == WGPUCullMode_Undefined, "value mismatch for CullMode::Undefined"); + static_assert(static_cast(CullMode::None) == WGPUCullMode_None, "value mismatch for CullMode::None"); + static_assert(static_cast(CullMode::Front) == WGPUCullMode_Front, "value mismatch for CullMode::Front"); + static_assert(static_cast(CullMode::Back) == WGPUCullMode_Back, "value mismatch for CullMode::Back"); + + // DeviceLostReason + + static_assert(sizeof(DeviceLostReason) == sizeof(WGPUDeviceLostReason), "sizeof mismatch for DeviceLostReason"); + static_assert(alignof(DeviceLostReason) == alignof(WGPUDeviceLostReason), "alignof mismatch for DeviceLostReason"); + + static_assert(static_cast(DeviceLostReason::Undefined) == WGPUDeviceLostReason_Undefined, "value mismatch for DeviceLostReason::Undefined"); + static_assert(static_cast(DeviceLostReason::Destroyed) == WGPUDeviceLostReason_Destroyed, "value mismatch for DeviceLostReason::Destroyed"); + + // ErrorFilter + + static_assert(sizeof(ErrorFilter) == sizeof(WGPUErrorFilter), "sizeof mismatch for ErrorFilter"); + static_assert(alignof(ErrorFilter) == alignof(WGPUErrorFilter), "alignof mismatch for ErrorFilter"); + + static_assert(static_cast(ErrorFilter::Validation) == WGPUErrorFilter_Validation, "value mismatch for ErrorFilter::Validation"); + static_assert(static_cast(ErrorFilter::OutOfMemory) == WGPUErrorFilter_OutOfMemory, "value mismatch for ErrorFilter::OutOfMemory"); + static_assert(static_cast(ErrorFilter::Internal) == WGPUErrorFilter_Internal, "value mismatch for ErrorFilter::Internal"); + + // ErrorType + + static_assert(sizeof(ErrorType) == sizeof(WGPUErrorType), "sizeof mismatch for ErrorType"); + static_assert(alignof(ErrorType) == alignof(WGPUErrorType), "alignof mismatch for ErrorType"); + + static_assert(static_cast(ErrorType::NoError) == WGPUErrorType_NoError, "value mismatch for ErrorType::NoError"); + static_assert(static_cast(ErrorType::Validation) == WGPUErrorType_Validation, "value mismatch for ErrorType::Validation"); + static_assert(static_cast(ErrorType::OutOfMemory) == WGPUErrorType_OutOfMemory, "value mismatch for ErrorType::OutOfMemory"); + static_assert(static_cast(ErrorType::Internal) == WGPUErrorType_Internal, "value mismatch for ErrorType::Internal"); + static_assert(static_cast(ErrorType::Unknown) == WGPUErrorType_Unknown, "value mismatch for ErrorType::Unknown"); + static_assert(static_cast(ErrorType::DeviceLost) == WGPUErrorType_DeviceLost, "value mismatch for ErrorType::DeviceLost"); + + // ExternalTextureRotation + + static_assert(sizeof(ExternalTextureRotation) == sizeof(WGPUExternalTextureRotation), "sizeof mismatch for ExternalTextureRotation"); + static_assert(alignof(ExternalTextureRotation) == alignof(WGPUExternalTextureRotation), "alignof mismatch for ExternalTextureRotation"); + + static_assert(static_cast(ExternalTextureRotation::Rotate0Degrees) == WGPUExternalTextureRotation_Rotate0Degrees, "value mismatch for ExternalTextureRotation::Rotate0Degrees"); + static_assert(static_cast(ExternalTextureRotation::Rotate90Degrees) == WGPUExternalTextureRotation_Rotate90Degrees, "value mismatch for ExternalTextureRotation::Rotate90Degrees"); + static_assert(static_cast(ExternalTextureRotation::Rotate180Degrees) == WGPUExternalTextureRotation_Rotate180Degrees, "value mismatch for ExternalTextureRotation::Rotate180Degrees"); + static_assert(static_cast(ExternalTextureRotation::Rotate270Degrees) == WGPUExternalTextureRotation_Rotate270Degrees, "value mismatch for ExternalTextureRotation::Rotate270Degrees"); + + // FeatureName + + static_assert(sizeof(FeatureName) == sizeof(WGPUFeatureName), "sizeof mismatch for FeatureName"); + static_assert(alignof(FeatureName) == alignof(WGPUFeatureName), "alignof mismatch for FeatureName"); + + static_assert(static_cast(FeatureName::Undefined) == WGPUFeatureName_Undefined, "value mismatch for FeatureName::Undefined"); + static_assert(static_cast(FeatureName::DepthClipControl) == WGPUFeatureName_DepthClipControl, "value mismatch for FeatureName::DepthClipControl"); + static_assert(static_cast(FeatureName::Depth32FloatStencil8) == WGPUFeatureName_Depth32FloatStencil8, "value mismatch for FeatureName::Depth32FloatStencil8"); + static_assert(static_cast(FeatureName::TimestampQuery) == WGPUFeatureName_TimestampQuery, "value mismatch for FeatureName::TimestampQuery"); + static_assert(static_cast(FeatureName::TextureCompressionBC) == WGPUFeatureName_TextureCompressionBC, "value mismatch for FeatureName::TextureCompressionBC"); + static_assert(static_cast(FeatureName::TextureCompressionETC2) == WGPUFeatureName_TextureCompressionETC2, "value mismatch for FeatureName::TextureCompressionETC2"); + static_assert(static_cast(FeatureName::TextureCompressionASTC) == WGPUFeatureName_TextureCompressionASTC, "value mismatch for FeatureName::TextureCompressionASTC"); + static_assert(static_cast(FeatureName::IndirectFirstInstance) == WGPUFeatureName_IndirectFirstInstance, "value mismatch for FeatureName::IndirectFirstInstance"); + static_assert(static_cast(FeatureName::ShaderF16) == WGPUFeatureName_ShaderF16, "value mismatch for FeatureName::ShaderF16"); + static_assert(static_cast(FeatureName::RG11B10UfloatRenderable) == WGPUFeatureName_RG11B10UfloatRenderable, "value mismatch for FeatureName::RG11B10UfloatRenderable"); + static_assert(static_cast(FeatureName::BGRA8UnormStorage) == WGPUFeatureName_BGRA8UnormStorage, "value mismatch for FeatureName::BGRA8UnormStorage"); + static_assert(static_cast(FeatureName::Float32Filterable) == WGPUFeatureName_Float32Filterable, "value mismatch for FeatureName::Float32Filterable"); + static_assert(static_cast(FeatureName::DawnInternalUsages) == WGPUFeatureName_DawnInternalUsages, "value mismatch for FeatureName::DawnInternalUsages"); + static_assert(static_cast(FeatureName::DawnMultiPlanarFormats) == WGPUFeatureName_DawnMultiPlanarFormats, "value mismatch for FeatureName::DawnMultiPlanarFormats"); + static_assert(static_cast(FeatureName::DawnNative) == WGPUFeatureName_DawnNative, "value mismatch for FeatureName::DawnNative"); + static_assert(static_cast(FeatureName::ChromiumExperimentalTimestampQueryInsidePasses) == WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses, "value mismatch for FeatureName::ChromiumExperimentalTimestampQueryInsidePasses"); + static_assert(static_cast(FeatureName::ImplicitDeviceSynchronization) == WGPUFeatureName_ImplicitDeviceSynchronization, "value mismatch for FeatureName::ImplicitDeviceSynchronization"); + static_assert(static_cast(FeatureName::SurfaceCapabilities) == WGPUFeatureName_SurfaceCapabilities, "value mismatch for FeatureName::SurfaceCapabilities"); + static_assert(static_cast(FeatureName::TransientAttachments) == WGPUFeatureName_TransientAttachments, "value mismatch for FeatureName::TransientAttachments"); + static_assert(static_cast(FeatureName::MSAARenderToSingleSampled) == WGPUFeatureName_MSAARenderToSingleSampled, "value mismatch for FeatureName::MSAARenderToSingleSampled"); + static_assert(static_cast(FeatureName::DualSourceBlending) == WGPUFeatureName_DualSourceBlending, "value mismatch for FeatureName::DualSourceBlending"); + static_assert(static_cast(FeatureName::D3D11MultithreadProtected) == WGPUFeatureName_D3D11MultithreadProtected, "value mismatch for FeatureName::D3D11MultithreadProtected"); + static_assert(static_cast(FeatureName::ANGLETextureSharing) == WGPUFeatureName_ANGLETextureSharing, "value mismatch for FeatureName::ANGLETextureSharing"); + static_assert(static_cast(FeatureName::ChromiumExperimentalSubgroups) == WGPUFeatureName_ChromiumExperimentalSubgroups, "value mismatch for FeatureName::ChromiumExperimentalSubgroups"); + static_assert(static_cast(FeatureName::ChromiumExperimentalSubgroupUniformControlFlow) == WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow, "value mismatch for FeatureName::ChromiumExperimentalSubgroupUniformControlFlow"); + static_assert(static_cast(FeatureName::PixelLocalStorageCoherent) == WGPUFeatureName_PixelLocalStorageCoherent, "value mismatch for FeatureName::PixelLocalStorageCoherent"); + static_assert(static_cast(FeatureName::PixelLocalStorageNonCoherent) == WGPUFeatureName_PixelLocalStorageNonCoherent, "value mismatch for FeatureName::PixelLocalStorageNonCoherent"); + static_assert(static_cast(FeatureName::Unorm16TextureFormats) == WGPUFeatureName_Unorm16TextureFormats, "value mismatch for FeatureName::Unorm16TextureFormats"); + static_assert(static_cast(FeatureName::Snorm16TextureFormats) == WGPUFeatureName_Snorm16TextureFormats, "value mismatch for FeatureName::Snorm16TextureFormats"); + static_assert(static_cast(FeatureName::MultiPlanarFormatExtendedUsages) == WGPUFeatureName_MultiPlanarFormatExtendedUsages, "value mismatch for FeatureName::MultiPlanarFormatExtendedUsages"); + static_assert(static_cast(FeatureName::MultiPlanarFormatP010) == WGPUFeatureName_MultiPlanarFormatP010, "value mismatch for FeatureName::MultiPlanarFormatP010"); + static_assert(static_cast(FeatureName::HostMappedPointer) == WGPUFeatureName_HostMappedPointer, "value mismatch for FeatureName::HostMappedPointer"); + static_assert(static_cast(FeatureName::MultiPlanarRenderTargets) == WGPUFeatureName_MultiPlanarRenderTargets, "value mismatch for FeatureName::MultiPlanarRenderTargets"); + static_assert(static_cast(FeatureName::MultiPlanarFormatNv12a) == WGPUFeatureName_MultiPlanarFormatNv12a, "value mismatch for FeatureName::MultiPlanarFormatNv12a"); + static_assert(static_cast(FeatureName::FramebufferFetch) == WGPUFeatureName_FramebufferFetch, "value mismatch for FeatureName::FramebufferFetch"); + static_assert(static_cast(FeatureName::BufferMapExtendedUsages) == WGPUFeatureName_BufferMapExtendedUsages, "value mismatch for FeatureName::BufferMapExtendedUsages"); + static_assert(static_cast(FeatureName::AdapterPropertiesMemoryHeaps) == WGPUFeatureName_AdapterPropertiesMemoryHeaps, "value mismatch for FeatureName::AdapterPropertiesMemoryHeaps"); + static_assert(static_cast(FeatureName::AdapterPropertiesD3D) == WGPUFeatureName_AdapterPropertiesD3D, "value mismatch for FeatureName::AdapterPropertiesD3D"); + static_assert(static_cast(FeatureName::AdapterPropertiesVk) == WGPUFeatureName_AdapterPropertiesVk, "value mismatch for FeatureName::AdapterPropertiesVk"); + static_assert(static_cast(FeatureName::R8UnormStorage) == WGPUFeatureName_R8UnormStorage, "value mismatch for FeatureName::R8UnormStorage"); + static_assert(static_cast(FeatureName::FormatCapabilities) == WGPUFeatureName_FormatCapabilities, "value mismatch for FeatureName::FormatCapabilities"); + static_assert(static_cast(FeatureName::DrmFormatCapabilities) == WGPUFeatureName_DrmFormatCapabilities, "value mismatch for FeatureName::DrmFormatCapabilities"); + static_assert(static_cast(FeatureName::Norm16TextureFormats) == WGPUFeatureName_Norm16TextureFormats, "value mismatch for FeatureName::Norm16TextureFormats"); + static_assert(static_cast(FeatureName::SharedTextureMemoryVkDedicatedAllocation) == WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation, "value mismatch for FeatureName::SharedTextureMemoryVkDedicatedAllocation"); + static_assert(static_cast(FeatureName::SharedTextureMemoryAHardwareBuffer) == WGPUFeatureName_SharedTextureMemoryAHardwareBuffer, "value mismatch for FeatureName::SharedTextureMemoryAHardwareBuffer"); + static_assert(static_cast(FeatureName::SharedTextureMemoryDmaBuf) == WGPUFeatureName_SharedTextureMemoryDmaBuf, "value mismatch for FeatureName::SharedTextureMemoryDmaBuf"); + static_assert(static_cast(FeatureName::SharedTextureMemoryOpaqueFD) == WGPUFeatureName_SharedTextureMemoryOpaqueFD, "value mismatch for FeatureName::SharedTextureMemoryOpaqueFD"); + static_assert(static_cast(FeatureName::SharedTextureMemoryZirconHandle) == WGPUFeatureName_SharedTextureMemoryZirconHandle, "value mismatch for FeatureName::SharedTextureMemoryZirconHandle"); + static_assert(static_cast(FeatureName::SharedTextureMemoryDXGISharedHandle) == WGPUFeatureName_SharedTextureMemoryDXGISharedHandle, "value mismatch for FeatureName::SharedTextureMemoryDXGISharedHandle"); + static_assert(static_cast(FeatureName::SharedTextureMemoryD3D11Texture2D) == WGPUFeatureName_SharedTextureMemoryD3D11Texture2D, "value mismatch for FeatureName::SharedTextureMemoryD3D11Texture2D"); + static_assert(static_cast(FeatureName::SharedTextureMemoryIOSurface) == WGPUFeatureName_SharedTextureMemoryIOSurface, "value mismatch for FeatureName::SharedTextureMemoryIOSurface"); + static_assert(static_cast(FeatureName::SharedTextureMemoryEGLImage) == WGPUFeatureName_SharedTextureMemoryEGLImage, "value mismatch for FeatureName::SharedTextureMemoryEGLImage"); + static_assert(static_cast(FeatureName::SharedFenceVkSemaphoreOpaqueFD) == WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD, "value mismatch for FeatureName::SharedFenceVkSemaphoreOpaqueFD"); + static_assert(static_cast(FeatureName::SharedFenceVkSemaphoreSyncFD) == WGPUFeatureName_SharedFenceVkSemaphoreSyncFD, "value mismatch for FeatureName::SharedFenceVkSemaphoreSyncFD"); + static_assert(static_cast(FeatureName::SharedFenceVkSemaphoreZirconHandle) == WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle, "value mismatch for FeatureName::SharedFenceVkSemaphoreZirconHandle"); + static_assert(static_cast(FeatureName::SharedFenceDXGISharedHandle) == WGPUFeatureName_SharedFenceDXGISharedHandle, "value mismatch for FeatureName::SharedFenceDXGISharedHandle"); + static_assert(static_cast(FeatureName::SharedFenceMTLSharedEvent) == WGPUFeatureName_SharedFenceMTLSharedEvent, "value mismatch for FeatureName::SharedFenceMTLSharedEvent"); + static_assert(static_cast(FeatureName::SharedBufferMemoryD3D12Resource) == WGPUFeatureName_SharedBufferMemoryD3D12Resource, "value mismatch for FeatureName::SharedBufferMemoryD3D12Resource"); + static_assert(static_cast(FeatureName::StaticSamplers) == WGPUFeatureName_StaticSamplers, "value mismatch for FeatureName::StaticSamplers"); + + // FilterMode + + static_assert(sizeof(FilterMode) == sizeof(WGPUFilterMode), "sizeof mismatch for FilterMode"); + static_assert(alignof(FilterMode) == alignof(WGPUFilterMode), "alignof mismatch for FilterMode"); + + static_assert(static_cast(FilterMode::Undefined) == WGPUFilterMode_Undefined, "value mismatch for FilterMode::Undefined"); + static_assert(static_cast(FilterMode::Nearest) == WGPUFilterMode_Nearest, "value mismatch for FilterMode::Nearest"); + static_assert(static_cast(FilterMode::Linear) == WGPUFilterMode_Linear, "value mismatch for FilterMode::Linear"); + + // FrontFace + + static_assert(sizeof(FrontFace) == sizeof(WGPUFrontFace), "sizeof mismatch for FrontFace"); + static_assert(alignof(FrontFace) == alignof(WGPUFrontFace), "alignof mismatch for FrontFace"); + + static_assert(static_cast(FrontFace::Undefined) == WGPUFrontFace_Undefined, "value mismatch for FrontFace::Undefined"); + static_assert(static_cast(FrontFace::CCW) == WGPUFrontFace_CCW, "value mismatch for FrontFace::CCW"); + static_assert(static_cast(FrontFace::CW) == WGPUFrontFace_CW, "value mismatch for FrontFace::CW"); + + // IndexFormat + + static_assert(sizeof(IndexFormat) == sizeof(WGPUIndexFormat), "sizeof mismatch for IndexFormat"); + static_assert(alignof(IndexFormat) == alignof(WGPUIndexFormat), "alignof mismatch for IndexFormat"); + + static_assert(static_cast(IndexFormat::Undefined) == WGPUIndexFormat_Undefined, "value mismatch for IndexFormat::Undefined"); + static_assert(static_cast(IndexFormat::Uint16) == WGPUIndexFormat_Uint16, "value mismatch for IndexFormat::Uint16"); + static_assert(static_cast(IndexFormat::Uint32) == WGPUIndexFormat_Uint32, "value mismatch for IndexFormat::Uint32"); + + // LoadOp + + static_assert(sizeof(LoadOp) == sizeof(WGPULoadOp), "sizeof mismatch for LoadOp"); + static_assert(alignof(LoadOp) == alignof(WGPULoadOp), "alignof mismatch for LoadOp"); + + static_assert(static_cast(LoadOp::Undefined) == WGPULoadOp_Undefined, "value mismatch for LoadOp::Undefined"); + static_assert(static_cast(LoadOp::Clear) == WGPULoadOp_Clear, "value mismatch for LoadOp::Clear"); + static_assert(static_cast(LoadOp::Load) == WGPULoadOp_Load, "value mismatch for LoadOp::Load"); + + // LoggingType + + static_assert(sizeof(LoggingType) == sizeof(WGPULoggingType), "sizeof mismatch for LoggingType"); + static_assert(alignof(LoggingType) == alignof(WGPULoggingType), "alignof mismatch for LoggingType"); + + static_assert(static_cast(LoggingType::Verbose) == WGPULoggingType_Verbose, "value mismatch for LoggingType::Verbose"); + static_assert(static_cast(LoggingType::Info) == WGPULoggingType_Info, "value mismatch for LoggingType::Info"); + static_assert(static_cast(LoggingType::Warning) == WGPULoggingType_Warning, "value mismatch for LoggingType::Warning"); + static_assert(static_cast(LoggingType::Error) == WGPULoggingType_Error, "value mismatch for LoggingType::Error"); + + // MipmapFilterMode + + static_assert(sizeof(MipmapFilterMode) == sizeof(WGPUMipmapFilterMode), "sizeof mismatch for MipmapFilterMode"); + static_assert(alignof(MipmapFilterMode) == alignof(WGPUMipmapFilterMode), "alignof mismatch for MipmapFilterMode"); + + static_assert(static_cast(MipmapFilterMode::Undefined) == WGPUMipmapFilterMode_Undefined, "value mismatch for MipmapFilterMode::Undefined"); + static_assert(static_cast(MipmapFilterMode::Nearest) == WGPUMipmapFilterMode_Nearest, "value mismatch for MipmapFilterMode::Nearest"); + static_assert(static_cast(MipmapFilterMode::Linear) == WGPUMipmapFilterMode_Linear, "value mismatch for MipmapFilterMode::Linear"); + + // PopErrorScopeStatus + + static_assert(sizeof(PopErrorScopeStatus) == sizeof(WGPUPopErrorScopeStatus), "sizeof mismatch for PopErrorScopeStatus"); + static_assert(alignof(PopErrorScopeStatus) == alignof(WGPUPopErrorScopeStatus), "alignof mismatch for PopErrorScopeStatus"); + + static_assert(static_cast(PopErrorScopeStatus::Success) == WGPUPopErrorScopeStatus_Success, "value mismatch for PopErrorScopeStatus::Success"); + static_assert(static_cast(PopErrorScopeStatus::InstanceDropped) == WGPUPopErrorScopeStatus_InstanceDropped, "value mismatch for PopErrorScopeStatus::InstanceDropped"); + + // PowerPreference + + static_assert(sizeof(PowerPreference) == sizeof(WGPUPowerPreference), "sizeof mismatch for PowerPreference"); + static_assert(alignof(PowerPreference) == alignof(WGPUPowerPreference), "alignof mismatch for PowerPreference"); + + static_assert(static_cast(PowerPreference::Undefined) == WGPUPowerPreference_Undefined, "value mismatch for PowerPreference::Undefined"); + static_assert(static_cast(PowerPreference::LowPower) == WGPUPowerPreference_LowPower, "value mismatch for PowerPreference::LowPower"); + static_assert(static_cast(PowerPreference::HighPerformance) == WGPUPowerPreference_HighPerformance, "value mismatch for PowerPreference::HighPerformance"); + + // PresentMode + + static_assert(sizeof(PresentMode) == sizeof(WGPUPresentMode), "sizeof mismatch for PresentMode"); + static_assert(alignof(PresentMode) == alignof(WGPUPresentMode), "alignof mismatch for PresentMode"); + + static_assert(static_cast(PresentMode::Fifo) == WGPUPresentMode_Fifo, "value mismatch for PresentMode::Fifo"); + static_assert(static_cast(PresentMode::Immediate) == WGPUPresentMode_Immediate, "value mismatch for PresentMode::Immediate"); + static_assert(static_cast(PresentMode::Mailbox) == WGPUPresentMode_Mailbox, "value mismatch for PresentMode::Mailbox"); + + // PrimitiveTopology + + static_assert(sizeof(PrimitiveTopology) == sizeof(WGPUPrimitiveTopology), "sizeof mismatch for PrimitiveTopology"); + static_assert(alignof(PrimitiveTopology) == alignof(WGPUPrimitiveTopology), "alignof mismatch for PrimitiveTopology"); + + static_assert(static_cast(PrimitiveTopology::Undefined) == WGPUPrimitiveTopology_Undefined, "value mismatch for PrimitiveTopology::Undefined"); + static_assert(static_cast(PrimitiveTopology::PointList) == WGPUPrimitiveTopology_PointList, "value mismatch for PrimitiveTopology::PointList"); + static_assert(static_cast(PrimitiveTopology::LineList) == WGPUPrimitiveTopology_LineList, "value mismatch for PrimitiveTopology::LineList"); + static_assert(static_cast(PrimitiveTopology::LineStrip) == WGPUPrimitiveTopology_LineStrip, "value mismatch for PrimitiveTopology::LineStrip"); + static_assert(static_cast(PrimitiveTopology::TriangleList) == WGPUPrimitiveTopology_TriangleList, "value mismatch for PrimitiveTopology::TriangleList"); + static_assert(static_cast(PrimitiveTopology::TriangleStrip) == WGPUPrimitiveTopology_TriangleStrip, "value mismatch for PrimitiveTopology::TriangleStrip"); + + // QueryType + + static_assert(sizeof(QueryType) == sizeof(WGPUQueryType), "sizeof mismatch for QueryType"); + static_assert(alignof(QueryType) == alignof(WGPUQueryType), "alignof mismatch for QueryType"); + + static_assert(static_cast(QueryType::Occlusion) == WGPUQueryType_Occlusion, "value mismatch for QueryType::Occlusion"); + static_assert(static_cast(QueryType::Timestamp) == WGPUQueryType_Timestamp, "value mismatch for QueryType::Timestamp"); + + // QueueWorkDoneStatus + + static_assert(sizeof(QueueWorkDoneStatus) == sizeof(WGPUQueueWorkDoneStatus), "sizeof mismatch for QueueWorkDoneStatus"); + static_assert(alignof(QueueWorkDoneStatus) == alignof(WGPUQueueWorkDoneStatus), "alignof mismatch for QueueWorkDoneStatus"); + + static_assert(static_cast(QueueWorkDoneStatus::Success) == WGPUQueueWorkDoneStatus_Success, "value mismatch for QueueWorkDoneStatus::Success"); + static_assert(static_cast(QueueWorkDoneStatus::InstanceDropped) == WGPUQueueWorkDoneStatus_InstanceDropped, "value mismatch for QueueWorkDoneStatus::InstanceDropped"); + static_assert(static_cast(QueueWorkDoneStatus::Error) == WGPUQueueWorkDoneStatus_Error, "value mismatch for QueueWorkDoneStatus::Error"); + static_assert(static_cast(QueueWorkDoneStatus::Unknown) == WGPUQueueWorkDoneStatus_Unknown, "value mismatch for QueueWorkDoneStatus::Unknown"); + static_assert(static_cast(QueueWorkDoneStatus::DeviceLost) == WGPUQueueWorkDoneStatus_DeviceLost, "value mismatch for QueueWorkDoneStatus::DeviceLost"); + + // RequestAdapterStatus + + static_assert(sizeof(RequestAdapterStatus) == sizeof(WGPURequestAdapterStatus), "sizeof mismatch for RequestAdapterStatus"); + static_assert(alignof(RequestAdapterStatus) == alignof(WGPURequestAdapterStatus), "alignof mismatch for RequestAdapterStatus"); + + static_assert(static_cast(RequestAdapterStatus::Success) == WGPURequestAdapterStatus_Success, "value mismatch for RequestAdapterStatus::Success"); + static_assert(static_cast(RequestAdapterStatus::InstanceDropped) == WGPURequestAdapterStatus_InstanceDropped, "value mismatch for RequestAdapterStatus::InstanceDropped"); + static_assert(static_cast(RequestAdapterStatus::Unavailable) == WGPURequestAdapterStatus_Unavailable, "value mismatch for RequestAdapterStatus::Unavailable"); + static_assert(static_cast(RequestAdapterStatus::Error) == WGPURequestAdapterStatus_Error, "value mismatch for RequestAdapterStatus::Error"); + static_assert(static_cast(RequestAdapterStatus::Unknown) == WGPURequestAdapterStatus_Unknown, "value mismatch for RequestAdapterStatus::Unknown"); + + // RequestDeviceStatus + + static_assert(sizeof(RequestDeviceStatus) == sizeof(WGPURequestDeviceStatus), "sizeof mismatch for RequestDeviceStatus"); + static_assert(alignof(RequestDeviceStatus) == alignof(WGPURequestDeviceStatus), "alignof mismatch for RequestDeviceStatus"); + + static_assert(static_cast(RequestDeviceStatus::Success) == WGPURequestDeviceStatus_Success, "value mismatch for RequestDeviceStatus::Success"); + static_assert(static_cast(RequestDeviceStatus::InstanceDropped) == WGPURequestDeviceStatus_InstanceDropped, "value mismatch for RequestDeviceStatus::InstanceDropped"); + static_assert(static_cast(RequestDeviceStatus::Error) == WGPURequestDeviceStatus_Error, "value mismatch for RequestDeviceStatus::Error"); + static_assert(static_cast(RequestDeviceStatus::Unknown) == WGPURequestDeviceStatus_Unknown, "value mismatch for RequestDeviceStatus::Unknown"); + + // SType + + static_assert(sizeof(SType) == sizeof(WGPUSType), "sizeof mismatch for SType"); + static_assert(alignof(SType) == alignof(WGPUSType), "alignof mismatch for SType"); + + static_assert(static_cast(SType::Invalid) == WGPUSType_Invalid, "value mismatch for SType::Invalid"); + static_assert(static_cast(SType::SurfaceDescriptorFromMetalLayer) == WGPUSType_SurfaceDescriptorFromMetalLayer, "value mismatch for SType::SurfaceDescriptorFromMetalLayer"); + static_assert(static_cast(SType::SurfaceDescriptorFromWindowsHWND) == WGPUSType_SurfaceDescriptorFromWindowsHWND, "value mismatch for SType::SurfaceDescriptorFromWindowsHWND"); + static_assert(static_cast(SType::SurfaceDescriptorFromXlibWindow) == WGPUSType_SurfaceDescriptorFromXlibWindow, "value mismatch for SType::SurfaceDescriptorFromXlibWindow"); + static_assert(static_cast(SType::SurfaceDescriptorFromCanvasHTMLSelector) == WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector, "value mismatch for SType::SurfaceDescriptorFromCanvasHTMLSelector"); + static_assert(static_cast(SType::ShaderModuleSPIRVDescriptor) == WGPUSType_ShaderModuleSPIRVDescriptor, "value mismatch for SType::ShaderModuleSPIRVDescriptor"); + static_assert(static_cast(SType::ShaderModuleWGSLDescriptor) == WGPUSType_ShaderModuleWGSLDescriptor, "value mismatch for SType::ShaderModuleWGSLDescriptor"); + static_assert(static_cast(SType::PrimitiveDepthClipControl) == WGPUSType_PrimitiveDepthClipControl, "value mismatch for SType::PrimitiveDepthClipControl"); + static_assert(static_cast(SType::SurfaceDescriptorFromWaylandSurface) == WGPUSType_SurfaceDescriptorFromWaylandSurface, "value mismatch for SType::SurfaceDescriptorFromWaylandSurface"); + static_assert(static_cast(SType::SurfaceDescriptorFromAndroidNativeWindow) == WGPUSType_SurfaceDescriptorFromAndroidNativeWindow, "value mismatch for SType::SurfaceDescriptorFromAndroidNativeWindow"); + static_assert(static_cast(SType::SurfaceDescriptorFromWindowsCoreWindow) == WGPUSType_SurfaceDescriptorFromWindowsCoreWindow, "value mismatch for SType::SurfaceDescriptorFromWindowsCoreWindow"); + static_assert(static_cast(SType::ExternalTextureBindingEntry) == WGPUSType_ExternalTextureBindingEntry, "value mismatch for SType::ExternalTextureBindingEntry"); + static_assert(static_cast(SType::ExternalTextureBindingLayout) == WGPUSType_ExternalTextureBindingLayout, "value mismatch for SType::ExternalTextureBindingLayout"); + static_assert(static_cast(SType::SurfaceDescriptorFromWindowsSwapChainPanel) == WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel, "value mismatch for SType::SurfaceDescriptorFromWindowsSwapChainPanel"); + static_assert(static_cast(SType::RenderPassDescriptorMaxDrawCount) == WGPUSType_RenderPassDescriptorMaxDrawCount, "value mismatch for SType::RenderPassDescriptorMaxDrawCount"); + static_assert(static_cast(SType::DepthStencilStateDepthWriteDefinedDawn) == WGPUSType_DepthStencilStateDepthWriteDefinedDawn, "value mismatch for SType::DepthStencilStateDepthWriteDefinedDawn"); + static_assert(static_cast(SType::TextureBindingViewDimensionDescriptor) == WGPUSType_TextureBindingViewDimensionDescriptor, "value mismatch for SType::TextureBindingViewDimensionDescriptor"); + static_assert(static_cast(SType::DawnTextureInternalUsageDescriptor) == WGPUSType_DawnTextureInternalUsageDescriptor, "value mismatch for SType::DawnTextureInternalUsageDescriptor"); + static_assert(static_cast(SType::DawnEncoderInternalUsageDescriptor) == WGPUSType_DawnEncoderInternalUsageDescriptor, "value mismatch for SType::DawnEncoderInternalUsageDescriptor"); + static_assert(static_cast(SType::DawnInstanceDescriptor) == WGPUSType_DawnInstanceDescriptor, "value mismatch for SType::DawnInstanceDescriptor"); + static_assert(static_cast(SType::DawnCacheDeviceDescriptor) == WGPUSType_DawnCacheDeviceDescriptor, "value mismatch for SType::DawnCacheDeviceDescriptor"); + static_assert(static_cast(SType::DawnAdapterPropertiesPowerPreference) == WGPUSType_DawnAdapterPropertiesPowerPreference, "value mismatch for SType::DawnAdapterPropertiesPowerPreference"); + static_assert(static_cast(SType::DawnBufferDescriptorErrorInfoFromWireClient) == WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient, "value mismatch for SType::DawnBufferDescriptorErrorInfoFromWireClient"); + static_assert(static_cast(SType::DawnTogglesDescriptor) == WGPUSType_DawnTogglesDescriptor, "value mismatch for SType::DawnTogglesDescriptor"); + static_assert(static_cast(SType::DawnShaderModuleSPIRVOptionsDescriptor) == WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor, "value mismatch for SType::DawnShaderModuleSPIRVOptionsDescriptor"); + static_assert(static_cast(SType::RequestAdapterOptionsLUID) == WGPUSType_RequestAdapterOptionsLUID, "value mismatch for SType::RequestAdapterOptionsLUID"); + static_assert(static_cast(SType::RequestAdapterOptionsGetGLProc) == WGPUSType_RequestAdapterOptionsGetGLProc, "value mismatch for SType::RequestAdapterOptionsGetGLProc"); + static_assert(static_cast(SType::RequestAdapterOptionsD3D11Device) == WGPUSType_RequestAdapterOptionsD3D11Device, "value mismatch for SType::RequestAdapterOptionsD3D11Device"); + static_assert(static_cast(SType::DawnMultisampleStateRenderToSingleSampled) == WGPUSType_DawnMultisampleStateRenderToSingleSampled, "value mismatch for SType::DawnMultisampleStateRenderToSingleSampled"); + static_assert(static_cast(SType::DawnRenderPassColorAttachmentRenderToSingleSampled) == WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled, "value mismatch for SType::DawnRenderPassColorAttachmentRenderToSingleSampled"); + static_assert(static_cast(SType::RenderPassPixelLocalStorage) == WGPUSType_RenderPassPixelLocalStorage, "value mismatch for SType::RenderPassPixelLocalStorage"); + static_assert(static_cast(SType::PipelineLayoutPixelLocalStorage) == WGPUSType_PipelineLayoutPixelLocalStorage, "value mismatch for SType::PipelineLayoutPixelLocalStorage"); + static_assert(static_cast(SType::BufferHostMappedPointer) == WGPUSType_BufferHostMappedPointer, "value mismatch for SType::BufferHostMappedPointer"); + static_assert(static_cast(SType::DawnExperimentalSubgroupLimits) == WGPUSType_DawnExperimentalSubgroupLimits, "value mismatch for SType::DawnExperimentalSubgroupLimits"); + static_assert(static_cast(SType::AdapterPropertiesMemoryHeaps) == WGPUSType_AdapterPropertiesMemoryHeaps, "value mismatch for SType::AdapterPropertiesMemoryHeaps"); + static_assert(static_cast(SType::AdapterPropertiesD3D) == WGPUSType_AdapterPropertiesD3D, "value mismatch for SType::AdapterPropertiesD3D"); + static_assert(static_cast(SType::AdapterPropertiesVk) == WGPUSType_AdapterPropertiesVk, "value mismatch for SType::AdapterPropertiesVk"); + static_assert(static_cast(SType::DawnComputePipelineFullSubgroups) == WGPUSType_DawnComputePipelineFullSubgroups, "value mismatch for SType::DawnComputePipelineFullSubgroups"); + static_assert(static_cast(SType::DawnWireWGSLControl) == WGPUSType_DawnWireWGSLControl, "value mismatch for SType::DawnWireWGSLControl"); + static_assert(static_cast(SType::DawnWGSLBlocklist) == WGPUSType_DawnWGSLBlocklist, "value mismatch for SType::DawnWGSLBlocklist"); + static_assert(static_cast(SType::DrmFormatCapabilities) == WGPUSType_DrmFormatCapabilities, "value mismatch for SType::DrmFormatCapabilities"); + static_assert(static_cast(SType::SharedTextureMemoryVkImageDescriptor) == WGPUSType_SharedTextureMemoryVkImageDescriptor, "value mismatch for SType::SharedTextureMemoryVkImageDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryVkDedicatedAllocationDescriptor) == WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor, "value mismatch for SType::SharedTextureMemoryVkDedicatedAllocationDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryAHardwareBufferDescriptor) == WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor, "value mismatch for SType::SharedTextureMemoryAHardwareBufferDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryDmaBufDescriptor) == WGPUSType_SharedTextureMemoryDmaBufDescriptor, "value mismatch for SType::SharedTextureMemoryDmaBufDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryOpaqueFDDescriptor) == WGPUSType_SharedTextureMemoryOpaqueFDDescriptor, "value mismatch for SType::SharedTextureMemoryOpaqueFDDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryZirconHandleDescriptor) == WGPUSType_SharedTextureMemoryZirconHandleDescriptor, "value mismatch for SType::SharedTextureMemoryZirconHandleDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryDXGISharedHandleDescriptor) == WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor, "value mismatch for SType::SharedTextureMemoryDXGISharedHandleDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryD3D11Texture2DDescriptor) == WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor, "value mismatch for SType::SharedTextureMemoryD3D11Texture2DDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryIOSurfaceDescriptor) == WGPUSType_SharedTextureMemoryIOSurfaceDescriptor, "value mismatch for SType::SharedTextureMemoryIOSurfaceDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryEGLImageDescriptor) == WGPUSType_SharedTextureMemoryEGLImageDescriptor, "value mismatch for SType::SharedTextureMemoryEGLImageDescriptor"); + static_assert(static_cast(SType::SharedTextureMemoryInitializedBeginState) == WGPUSType_SharedTextureMemoryInitializedBeginState, "value mismatch for SType::SharedTextureMemoryInitializedBeginState"); + static_assert(static_cast(SType::SharedTextureMemoryInitializedEndState) == WGPUSType_SharedTextureMemoryInitializedEndState, "value mismatch for SType::SharedTextureMemoryInitializedEndState"); + static_assert(static_cast(SType::SharedTextureMemoryVkImageLayoutBeginState) == WGPUSType_SharedTextureMemoryVkImageLayoutBeginState, "value mismatch for SType::SharedTextureMemoryVkImageLayoutBeginState"); + static_assert(static_cast(SType::SharedTextureMemoryVkImageLayoutEndState) == WGPUSType_SharedTextureMemoryVkImageLayoutEndState, "value mismatch for SType::SharedTextureMemoryVkImageLayoutEndState"); + static_assert(static_cast(SType::SharedFenceVkSemaphoreOpaqueFDDescriptor) == WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor, "value mismatch for SType::SharedFenceVkSemaphoreOpaqueFDDescriptor"); + static_assert(static_cast(SType::SharedFenceVkSemaphoreOpaqueFDExportInfo) == WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo, "value mismatch for SType::SharedFenceVkSemaphoreOpaqueFDExportInfo"); + static_assert(static_cast(SType::SharedFenceVkSemaphoreSyncFDDescriptor) == WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor, "value mismatch for SType::SharedFenceVkSemaphoreSyncFDDescriptor"); + static_assert(static_cast(SType::SharedFenceVkSemaphoreSyncFDExportInfo) == WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo, "value mismatch for SType::SharedFenceVkSemaphoreSyncFDExportInfo"); + static_assert(static_cast(SType::SharedFenceVkSemaphoreZirconHandleDescriptor) == WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor, "value mismatch for SType::SharedFenceVkSemaphoreZirconHandleDescriptor"); + static_assert(static_cast(SType::SharedFenceVkSemaphoreZirconHandleExportInfo) == WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo, "value mismatch for SType::SharedFenceVkSemaphoreZirconHandleExportInfo"); + static_assert(static_cast(SType::SharedFenceDXGISharedHandleDescriptor) == WGPUSType_SharedFenceDXGISharedHandleDescriptor, "value mismatch for SType::SharedFenceDXGISharedHandleDescriptor"); + static_assert(static_cast(SType::SharedFenceDXGISharedHandleExportInfo) == WGPUSType_SharedFenceDXGISharedHandleExportInfo, "value mismatch for SType::SharedFenceDXGISharedHandleExportInfo"); + static_assert(static_cast(SType::SharedFenceMTLSharedEventDescriptor) == WGPUSType_SharedFenceMTLSharedEventDescriptor, "value mismatch for SType::SharedFenceMTLSharedEventDescriptor"); + static_assert(static_cast(SType::SharedFenceMTLSharedEventExportInfo) == WGPUSType_SharedFenceMTLSharedEventExportInfo, "value mismatch for SType::SharedFenceMTLSharedEventExportInfo"); + static_assert(static_cast(SType::SharedBufferMemoryD3D12ResourceDescriptor) == WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor, "value mismatch for SType::SharedBufferMemoryD3D12ResourceDescriptor"); + static_assert(static_cast(SType::StaticSamplerBindingLayout) == WGPUSType_StaticSamplerBindingLayout, "value mismatch for SType::StaticSamplerBindingLayout"); + + // SamplerBindingType + + static_assert(sizeof(SamplerBindingType) == sizeof(WGPUSamplerBindingType), "sizeof mismatch for SamplerBindingType"); + static_assert(alignof(SamplerBindingType) == alignof(WGPUSamplerBindingType), "alignof mismatch for SamplerBindingType"); + + static_assert(static_cast(SamplerBindingType::Undefined) == WGPUSamplerBindingType_Undefined, "value mismatch for SamplerBindingType::Undefined"); + static_assert(static_cast(SamplerBindingType::Filtering) == WGPUSamplerBindingType_Filtering, "value mismatch for SamplerBindingType::Filtering"); + static_assert(static_cast(SamplerBindingType::NonFiltering) == WGPUSamplerBindingType_NonFiltering, "value mismatch for SamplerBindingType::NonFiltering"); + static_assert(static_cast(SamplerBindingType::Comparison) == WGPUSamplerBindingType_Comparison, "value mismatch for SamplerBindingType::Comparison"); + + // SharedFenceType + + static_assert(sizeof(SharedFenceType) == sizeof(WGPUSharedFenceType), "sizeof mismatch for SharedFenceType"); + static_assert(alignof(SharedFenceType) == alignof(WGPUSharedFenceType), "alignof mismatch for SharedFenceType"); + + static_assert(static_cast(SharedFenceType::Undefined) == WGPUSharedFenceType_Undefined, "value mismatch for SharedFenceType::Undefined"); + static_assert(static_cast(SharedFenceType::VkSemaphoreOpaqueFD) == WGPUSharedFenceType_VkSemaphoreOpaqueFD, "value mismatch for SharedFenceType::VkSemaphoreOpaqueFD"); + static_assert(static_cast(SharedFenceType::VkSemaphoreSyncFD) == WGPUSharedFenceType_VkSemaphoreSyncFD, "value mismatch for SharedFenceType::VkSemaphoreSyncFD"); + static_assert(static_cast(SharedFenceType::VkSemaphoreZirconHandle) == WGPUSharedFenceType_VkSemaphoreZirconHandle, "value mismatch for SharedFenceType::VkSemaphoreZirconHandle"); + static_assert(static_cast(SharedFenceType::DXGISharedHandle) == WGPUSharedFenceType_DXGISharedHandle, "value mismatch for SharedFenceType::DXGISharedHandle"); + static_assert(static_cast(SharedFenceType::MTLSharedEvent) == WGPUSharedFenceType_MTLSharedEvent, "value mismatch for SharedFenceType::MTLSharedEvent"); + + // StencilOperation + + static_assert(sizeof(StencilOperation) == sizeof(WGPUStencilOperation), "sizeof mismatch for StencilOperation"); + static_assert(alignof(StencilOperation) == alignof(WGPUStencilOperation), "alignof mismatch for StencilOperation"); + + static_assert(static_cast(StencilOperation::Undefined) == WGPUStencilOperation_Undefined, "value mismatch for StencilOperation::Undefined"); + static_assert(static_cast(StencilOperation::Keep) == WGPUStencilOperation_Keep, "value mismatch for StencilOperation::Keep"); + static_assert(static_cast(StencilOperation::Zero) == WGPUStencilOperation_Zero, "value mismatch for StencilOperation::Zero"); + static_assert(static_cast(StencilOperation::Replace) == WGPUStencilOperation_Replace, "value mismatch for StencilOperation::Replace"); + static_assert(static_cast(StencilOperation::Invert) == WGPUStencilOperation_Invert, "value mismatch for StencilOperation::Invert"); + static_assert(static_cast(StencilOperation::IncrementClamp) == WGPUStencilOperation_IncrementClamp, "value mismatch for StencilOperation::IncrementClamp"); + static_assert(static_cast(StencilOperation::DecrementClamp) == WGPUStencilOperation_DecrementClamp, "value mismatch for StencilOperation::DecrementClamp"); + static_assert(static_cast(StencilOperation::IncrementWrap) == WGPUStencilOperation_IncrementWrap, "value mismatch for StencilOperation::IncrementWrap"); + static_assert(static_cast(StencilOperation::DecrementWrap) == WGPUStencilOperation_DecrementWrap, "value mismatch for StencilOperation::DecrementWrap"); + + // StorageTextureAccess + + static_assert(sizeof(StorageTextureAccess) == sizeof(WGPUStorageTextureAccess), "sizeof mismatch for StorageTextureAccess"); + static_assert(alignof(StorageTextureAccess) == alignof(WGPUStorageTextureAccess), "alignof mismatch for StorageTextureAccess"); + + static_assert(static_cast(StorageTextureAccess::Undefined) == WGPUStorageTextureAccess_Undefined, "value mismatch for StorageTextureAccess::Undefined"); + static_assert(static_cast(StorageTextureAccess::WriteOnly) == WGPUStorageTextureAccess_WriteOnly, "value mismatch for StorageTextureAccess::WriteOnly"); + static_assert(static_cast(StorageTextureAccess::ReadOnly) == WGPUStorageTextureAccess_ReadOnly, "value mismatch for StorageTextureAccess::ReadOnly"); + static_assert(static_cast(StorageTextureAccess::ReadWrite) == WGPUStorageTextureAccess_ReadWrite, "value mismatch for StorageTextureAccess::ReadWrite"); + + // StoreOp + + static_assert(sizeof(StoreOp) == sizeof(WGPUStoreOp), "sizeof mismatch for StoreOp"); + static_assert(alignof(StoreOp) == alignof(WGPUStoreOp), "alignof mismatch for StoreOp"); + + static_assert(static_cast(StoreOp::Undefined) == WGPUStoreOp_Undefined, "value mismatch for StoreOp::Undefined"); + static_assert(static_cast(StoreOp::Store) == WGPUStoreOp_Store, "value mismatch for StoreOp::Store"); + static_assert(static_cast(StoreOp::Discard) == WGPUStoreOp_Discard, "value mismatch for StoreOp::Discard"); + + // TextureAspect + + static_assert(sizeof(TextureAspect) == sizeof(WGPUTextureAspect), "sizeof mismatch for TextureAspect"); + static_assert(alignof(TextureAspect) == alignof(WGPUTextureAspect), "alignof mismatch for TextureAspect"); + + static_assert(static_cast(TextureAspect::Undefined) == WGPUTextureAspect_Undefined, "value mismatch for TextureAspect::Undefined"); + static_assert(static_cast(TextureAspect::All) == WGPUTextureAspect_All, "value mismatch for TextureAspect::All"); + static_assert(static_cast(TextureAspect::StencilOnly) == WGPUTextureAspect_StencilOnly, "value mismatch for TextureAspect::StencilOnly"); + static_assert(static_cast(TextureAspect::DepthOnly) == WGPUTextureAspect_DepthOnly, "value mismatch for TextureAspect::DepthOnly"); + static_assert(static_cast(TextureAspect::Plane0Only) == WGPUTextureAspect_Plane0Only, "value mismatch for TextureAspect::Plane0Only"); + static_assert(static_cast(TextureAspect::Plane1Only) == WGPUTextureAspect_Plane1Only, "value mismatch for TextureAspect::Plane1Only"); + static_assert(static_cast(TextureAspect::Plane2Only) == WGPUTextureAspect_Plane2Only, "value mismatch for TextureAspect::Plane2Only"); + + // TextureDimension + + static_assert(sizeof(TextureDimension) == sizeof(WGPUTextureDimension), "sizeof mismatch for TextureDimension"); + static_assert(alignof(TextureDimension) == alignof(WGPUTextureDimension), "alignof mismatch for TextureDimension"); + + static_assert(static_cast(TextureDimension::Undefined) == WGPUTextureDimension_Undefined, "value mismatch for TextureDimension::Undefined"); + static_assert(static_cast(TextureDimension::e1D) == WGPUTextureDimension_1D, "value mismatch for TextureDimension::e1D"); + static_assert(static_cast(TextureDimension::e2D) == WGPUTextureDimension_2D, "value mismatch for TextureDimension::e2D"); + static_assert(static_cast(TextureDimension::e3D) == WGPUTextureDimension_3D, "value mismatch for TextureDimension::e3D"); + + // TextureFormat + + static_assert(sizeof(TextureFormat) == sizeof(WGPUTextureFormat), "sizeof mismatch for TextureFormat"); + static_assert(alignof(TextureFormat) == alignof(WGPUTextureFormat), "alignof mismatch for TextureFormat"); + + static_assert(static_cast(TextureFormat::Undefined) == WGPUTextureFormat_Undefined, "value mismatch for TextureFormat::Undefined"); + static_assert(static_cast(TextureFormat::R8Unorm) == WGPUTextureFormat_R8Unorm, "value mismatch for TextureFormat::R8Unorm"); + static_assert(static_cast(TextureFormat::R8Snorm) == WGPUTextureFormat_R8Snorm, "value mismatch for TextureFormat::R8Snorm"); + static_assert(static_cast(TextureFormat::R8Uint) == WGPUTextureFormat_R8Uint, "value mismatch for TextureFormat::R8Uint"); + static_assert(static_cast(TextureFormat::R8Sint) == WGPUTextureFormat_R8Sint, "value mismatch for TextureFormat::R8Sint"); + static_assert(static_cast(TextureFormat::R16Uint) == WGPUTextureFormat_R16Uint, "value mismatch for TextureFormat::R16Uint"); + static_assert(static_cast(TextureFormat::R16Sint) == WGPUTextureFormat_R16Sint, "value mismatch for TextureFormat::R16Sint"); + static_assert(static_cast(TextureFormat::R16Float) == WGPUTextureFormat_R16Float, "value mismatch for TextureFormat::R16Float"); + static_assert(static_cast(TextureFormat::RG8Unorm) == WGPUTextureFormat_RG8Unorm, "value mismatch for TextureFormat::RG8Unorm"); + static_assert(static_cast(TextureFormat::RG8Snorm) == WGPUTextureFormat_RG8Snorm, "value mismatch for TextureFormat::RG8Snorm"); + static_assert(static_cast(TextureFormat::RG8Uint) == WGPUTextureFormat_RG8Uint, "value mismatch for TextureFormat::RG8Uint"); + static_assert(static_cast(TextureFormat::RG8Sint) == WGPUTextureFormat_RG8Sint, "value mismatch for TextureFormat::RG8Sint"); + static_assert(static_cast(TextureFormat::R32Float) == WGPUTextureFormat_R32Float, "value mismatch for TextureFormat::R32Float"); + static_assert(static_cast(TextureFormat::R32Uint) == WGPUTextureFormat_R32Uint, "value mismatch for TextureFormat::R32Uint"); + static_assert(static_cast(TextureFormat::R32Sint) == WGPUTextureFormat_R32Sint, "value mismatch for TextureFormat::R32Sint"); + static_assert(static_cast(TextureFormat::RG16Uint) == WGPUTextureFormat_RG16Uint, "value mismatch for TextureFormat::RG16Uint"); + static_assert(static_cast(TextureFormat::RG16Sint) == WGPUTextureFormat_RG16Sint, "value mismatch for TextureFormat::RG16Sint"); + static_assert(static_cast(TextureFormat::RG16Float) == WGPUTextureFormat_RG16Float, "value mismatch for TextureFormat::RG16Float"); + static_assert(static_cast(TextureFormat::RGBA8Unorm) == WGPUTextureFormat_RGBA8Unorm, "value mismatch for TextureFormat::RGBA8Unorm"); + static_assert(static_cast(TextureFormat::RGBA8UnormSrgb) == WGPUTextureFormat_RGBA8UnormSrgb, "value mismatch for TextureFormat::RGBA8UnormSrgb"); + static_assert(static_cast(TextureFormat::RGBA8Snorm) == WGPUTextureFormat_RGBA8Snorm, "value mismatch for TextureFormat::RGBA8Snorm"); + static_assert(static_cast(TextureFormat::RGBA8Uint) == WGPUTextureFormat_RGBA8Uint, "value mismatch for TextureFormat::RGBA8Uint"); + static_assert(static_cast(TextureFormat::RGBA8Sint) == WGPUTextureFormat_RGBA8Sint, "value mismatch for TextureFormat::RGBA8Sint"); + static_assert(static_cast(TextureFormat::BGRA8Unorm) == WGPUTextureFormat_BGRA8Unorm, "value mismatch for TextureFormat::BGRA8Unorm"); + static_assert(static_cast(TextureFormat::BGRA8UnormSrgb) == WGPUTextureFormat_BGRA8UnormSrgb, "value mismatch for TextureFormat::BGRA8UnormSrgb"); + static_assert(static_cast(TextureFormat::RGB10A2Uint) == WGPUTextureFormat_RGB10A2Uint, "value mismatch for TextureFormat::RGB10A2Uint"); + static_assert(static_cast(TextureFormat::RGB10A2Unorm) == WGPUTextureFormat_RGB10A2Unorm, "value mismatch for TextureFormat::RGB10A2Unorm"); + static_assert(static_cast(TextureFormat::RG11B10Ufloat) == WGPUTextureFormat_RG11B10Ufloat, "value mismatch for TextureFormat::RG11B10Ufloat"); + static_assert(static_cast(TextureFormat::RGB9E5Ufloat) == WGPUTextureFormat_RGB9E5Ufloat, "value mismatch for TextureFormat::RGB9E5Ufloat"); + static_assert(static_cast(TextureFormat::RG32Float) == WGPUTextureFormat_RG32Float, "value mismatch for TextureFormat::RG32Float"); + static_assert(static_cast(TextureFormat::RG32Uint) == WGPUTextureFormat_RG32Uint, "value mismatch for TextureFormat::RG32Uint"); + static_assert(static_cast(TextureFormat::RG32Sint) == WGPUTextureFormat_RG32Sint, "value mismatch for TextureFormat::RG32Sint"); + static_assert(static_cast(TextureFormat::RGBA16Uint) == WGPUTextureFormat_RGBA16Uint, "value mismatch for TextureFormat::RGBA16Uint"); + static_assert(static_cast(TextureFormat::RGBA16Sint) == WGPUTextureFormat_RGBA16Sint, "value mismatch for TextureFormat::RGBA16Sint"); + static_assert(static_cast(TextureFormat::RGBA16Float) == WGPUTextureFormat_RGBA16Float, "value mismatch for TextureFormat::RGBA16Float"); + static_assert(static_cast(TextureFormat::RGBA32Float) == WGPUTextureFormat_RGBA32Float, "value mismatch for TextureFormat::RGBA32Float"); + static_assert(static_cast(TextureFormat::RGBA32Uint) == WGPUTextureFormat_RGBA32Uint, "value mismatch for TextureFormat::RGBA32Uint"); + static_assert(static_cast(TextureFormat::RGBA32Sint) == WGPUTextureFormat_RGBA32Sint, "value mismatch for TextureFormat::RGBA32Sint"); + static_assert(static_cast(TextureFormat::Stencil8) == WGPUTextureFormat_Stencil8, "value mismatch for TextureFormat::Stencil8"); + static_assert(static_cast(TextureFormat::Depth16Unorm) == WGPUTextureFormat_Depth16Unorm, "value mismatch for TextureFormat::Depth16Unorm"); + static_assert(static_cast(TextureFormat::Depth24Plus) == WGPUTextureFormat_Depth24Plus, "value mismatch for TextureFormat::Depth24Plus"); + static_assert(static_cast(TextureFormat::Depth24PlusStencil8) == WGPUTextureFormat_Depth24PlusStencil8, "value mismatch for TextureFormat::Depth24PlusStencil8"); + static_assert(static_cast(TextureFormat::Depth32Float) == WGPUTextureFormat_Depth32Float, "value mismatch for TextureFormat::Depth32Float"); + static_assert(static_cast(TextureFormat::Depth32FloatStencil8) == WGPUTextureFormat_Depth32FloatStencil8, "value mismatch for TextureFormat::Depth32FloatStencil8"); + static_assert(static_cast(TextureFormat::BC1RGBAUnorm) == WGPUTextureFormat_BC1RGBAUnorm, "value mismatch for TextureFormat::BC1RGBAUnorm"); + static_assert(static_cast(TextureFormat::BC1RGBAUnormSrgb) == WGPUTextureFormat_BC1RGBAUnormSrgb, "value mismatch for TextureFormat::BC1RGBAUnormSrgb"); + static_assert(static_cast(TextureFormat::BC2RGBAUnorm) == WGPUTextureFormat_BC2RGBAUnorm, "value mismatch for TextureFormat::BC2RGBAUnorm"); + static_assert(static_cast(TextureFormat::BC2RGBAUnormSrgb) == WGPUTextureFormat_BC2RGBAUnormSrgb, "value mismatch for TextureFormat::BC2RGBAUnormSrgb"); + static_assert(static_cast(TextureFormat::BC3RGBAUnorm) == WGPUTextureFormat_BC3RGBAUnorm, "value mismatch for TextureFormat::BC3RGBAUnorm"); + static_assert(static_cast(TextureFormat::BC3RGBAUnormSrgb) == WGPUTextureFormat_BC3RGBAUnormSrgb, "value mismatch for TextureFormat::BC3RGBAUnormSrgb"); + static_assert(static_cast(TextureFormat::BC4RUnorm) == WGPUTextureFormat_BC4RUnorm, "value mismatch for TextureFormat::BC4RUnorm"); + static_assert(static_cast(TextureFormat::BC4RSnorm) == WGPUTextureFormat_BC4RSnorm, "value mismatch for TextureFormat::BC4RSnorm"); + static_assert(static_cast(TextureFormat::BC5RGUnorm) == WGPUTextureFormat_BC5RGUnorm, "value mismatch for TextureFormat::BC5RGUnorm"); + static_assert(static_cast(TextureFormat::BC5RGSnorm) == WGPUTextureFormat_BC5RGSnorm, "value mismatch for TextureFormat::BC5RGSnorm"); + static_assert(static_cast(TextureFormat::BC6HRGBUfloat) == WGPUTextureFormat_BC6HRGBUfloat, "value mismatch for TextureFormat::BC6HRGBUfloat"); + static_assert(static_cast(TextureFormat::BC6HRGBFloat) == WGPUTextureFormat_BC6HRGBFloat, "value mismatch for TextureFormat::BC6HRGBFloat"); + static_assert(static_cast(TextureFormat::BC7RGBAUnorm) == WGPUTextureFormat_BC7RGBAUnorm, "value mismatch for TextureFormat::BC7RGBAUnorm"); + static_assert(static_cast(TextureFormat::BC7RGBAUnormSrgb) == WGPUTextureFormat_BC7RGBAUnormSrgb, "value mismatch for TextureFormat::BC7RGBAUnormSrgb"); + static_assert(static_cast(TextureFormat::ETC2RGB8Unorm) == WGPUTextureFormat_ETC2RGB8Unorm, "value mismatch for TextureFormat::ETC2RGB8Unorm"); + static_assert(static_cast(TextureFormat::ETC2RGB8UnormSrgb) == WGPUTextureFormat_ETC2RGB8UnormSrgb, "value mismatch for TextureFormat::ETC2RGB8UnormSrgb"); + static_assert(static_cast(TextureFormat::ETC2RGB8A1Unorm) == WGPUTextureFormat_ETC2RGB8A1Unorm, "value mismatch for TextureFormat::ETC2RGB8A1Unorm"); + static_assert(static_cast(TextureFormat::ETC2RGB8A1UnormSrgb) == WGPUTextureFormat_ETC2RGB8A1UnormSrgb, "value mismatch for TextureFormat::ETC2RGB8A1UnormSrgb"); + static_assert(static_cast(TextureFormat::ETC2RGBA8Unorm) == WGPUTextureFormat_ETC2RGBA8Unorm, "value mismatch for TextureFormat::ETC2RGBA8Unorm"); + static_assert(static_cast(TextureFormat::ETC2RGBA8UnormSrgb) == WGPUTextureFormat_ETC2RGBA8UnormSrgb, "value mismatch for TextureFormat::ETC2RGBA8UnormSrgb"); + static_assert(static_cast(TextureFormat::EACR11Unorm) == WGPUTextureFormat_EACR11Unorm, "value mismatch for TextureFormat::EACR11Unorm"); + static_assert(static_cast(TextureFormat::EACR11Snorm) == WGPUTextureFormat_EACR11Snorm, "value mismatch for TextureFormat::EACR11Snorm"); + static_assert(static_cast(TextureFormat::EACRG11Unorm) == WGPUTextureFormat_EACRG11Unorm, "value mismatch for TextureFormat::EACRG11Unorm"); + static_assert(static_cast(TextureFormat::EACRG11Snorm) == WGPUTextureFormat_EACRG11Snorm, "value mismatch for TextureFormat::EACRG11Snorm"); + static_assert(static_cast(TextureFormat::ASTC4x4Unorm) == WGPUTextureFormat_ASTC4x4Unorm, "value mismatch for TextureFormat::ASTC4x4Unorm"); + static_assert(static_cast(TextureFormat::ASTC4x4UnormSrgb) == WGPUTextureFormat_ASTC4x4UnormSrgb, "value mismatch for TextureFormat::ASTC4x4UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC5x4Unorm) == WGPUTextureFormat_ASTC5x4Unorm, "value mismatch for TextureFormat::ASTC5x4Unorm"); + static_assert(static_cast(TextureFormat::ASTC5x4UnormSrgb) == WGPUTextureFormat_ASTC5x4UnormSrgb, "value mismatch for TextureFormat::ASTC5x4UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC5x5Unorm) == WGPUTextureFormat_ASTC5x5Unorm, "value mismatch for TextureFormat::ASTC5x5Unorm"); + static_assert(static_cast(TextureFormat::ASTC5x5UnormSrgb) == WGPUTextureFormat_ASTC5x5UnormSrgb, "value mismatch for TextureFormat::ASTC5x5UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC6x5Unorm) == WGPUTextureFormat_ASTC6x5Unorm, "value mismatch for TextureFormat::ASTC6x5Unorm"); + static_assert(static_cast(TextureFormat::ASTC6x5UnormSrgb) == WGPUTextureFormat_ASTC6x5UnormSrgb, "value mismatch for TextureFormat::ASTC6x5UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC6x6Unorm) == WGPUTextureFormat_ASTC6x6Unorm, "value mismatch for TextureFormat::ASTC6x6Unorm"); + static_assert(static_cast(TextureFormat::ASTC6x6UnormSrgb) == WGPUTextureFormat_ASTC6x6UnormSrgb, "value mismatch for TextureFormat::ASTC6x6UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC8x5Unorm) == WGPUTextureFormat_ASTC8x5Unorm, "value mismatch for TextureFormat::ASTC8x5Unorm"); + static_assert(static_cast(TextureFormat::ASTC8x5UnormSrgb) == WGPUTextureFormat_ASTC8x5UnormSrgb, "value mismatch for TextureFormat::ASTC8x5UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC8x6Unorm) == WGPUTextureFormat_ASTC8x6Unorm, "value mismatch for TextureFormat::ASTC8x6Unorm"); + static_assert(static_cast(TextureFormat::ASTC8x6UnormSrgb) == WGPUTextureFormat_ASTC8x6UnormSrgb, "value mismatch for TextureFormat::ASTC8x6UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC8x8Unorm) == WGPUTextureFormat_ASTC8x8Unorm, "value mismatch for TextureFormat::ASTC8x8Unorm"); + static_assert(static_cast(TextureFormat::ASTC8x8UnormSrgb) == WGPUTextureFormat_ASTC8x8UnormSrgb, "value mismatch for TextureFormat::ASTC8x8UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC10x5Unorm) == WGPUTextureFormat_ASTC10x5Unorm, "value mismatch for TextureFormat::ASTC10x5Unorm"); + static_assert(static_cast(TextureFormat::ASTC10x5UnormSrgb) == WGPUTextureFormat_ASTC10x5UnormSrgb, "value mismatch for TextureFormat::ASTC10x5UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC10x6Unorm) == WGPUTextureFormat_ASTC10x6Unorm, "value mismatch for TextureFormat::ASTC10x6Unorm"); + static_assert(static_cast(TextureFormat::ASTC10x6UnormSrgb) == WGPUTextureFormat_ASTC10x6UnormSrgb, "value mismatch for TextureFormat::ASTC10x6UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC10x8Unorm) == WGPUTextureFormat_ASTC10x8Unorm, "value mismatch for TextureFormat::ASTC10x8Unorm"); + static_assert(static_cast(TextureFormat::ASTC10x8UnormSrgb) == WGPUTextureFormat_ASTC10x8UnormSrgb, "value mismatch for TextureFormat::ASTC10x8UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC10x10Unorm) == WGPUTextureFormat_ASTC10x10Unorm, "value mismatch for TextureFormat::ASTC10x10Unorm"); + static_assert(static_cast(TextureFormat::ASTC10x10UnormSrgb) == WGPUTextureFormat_ASTC10x10UnormSrgb, "value mismatch for TextureFormat::ASTC10x10UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC12x10Unorm) == WGPUTextureFormat_ASTC12x10Unorm, "value mismatch for TextureFormat::ASTC12x10Unorm"); + static_assert(static_cast(TextureFormat::ASTC12x10UnormSrgb) == WGPUTextureFormat_ASTC12x10UnormSrgb, "value mismatch for TextureFormat::ASTC12x10UnormSrgb"); + static_assert(static_cast(TextureFormat::ASTC12x12Unorm) == WGPUTextureFormat_ASTC12x12Unorm, "value mismatch for TextureFormat::ASTC12x12Unorm"); + static_assert(static_cast(TextureFormat::ASTC12x12UnormSrgb) == WGPUTextureFormat_ASTC12x12UnormSrgb, "value mismatch for TextureFormat::ASTC12x12UnormSrgb"); + static_assert(static_cast(TextureFormat::R16Unorm) == WGPUTextureFormat_R16Unorm, "value mismatch for TextureFormat::R16Unorm"); + static_assert(static_cast(TextureFormat::RG16Unorm) == WGPUTextureFormat_RG16Unorm, "value mismatch for TextureFormat::RG16Unorm"); + static_assert(static_cast(TextureFormat::RGBA16Unorm) == WGPUTextureFormat_RGBA16Unorm, "value mismatch for TextureFormat::RGBA16Unorm"); + static_assert(static_cast(TextureFormat::R16Snorm) == WGPUTextureFormat_R16Snorm, "value mismatch for TextureFormat::R16Snorm"); + static_assert(static_cast(TextureFormat::RG16Snorm) == WGPUTextureFormat_RG16Snorm, "value mismatch for TextureFormat::RG16Snorm"); + static_assert(static_cast(TextureFormat::RGBA16Snorm) == WGPUTextureFormat_RGBA16Snorm, "value mismatch for TextureFormat::RGBA16Snorm"); + static_assert(static_cast(TextureFormat::R8BG8Biplanar420Unorm) == WGPUTextureFormat_R8BG8Biplanar420Unorm, "value mismatch for TextureFormat::R8BG8Biplanar420Unorm"); + static_assert(static_cast(TextureFormat::R10X6BG10X6Biplanar420Unorm) == WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm, "value mismatch for TextureFormat::R10X6BG10X6Biplanar420Unorm"); + static_assert(static_cast(TextureFormat::R8BG8A8Triplanar420Unorm) == WGPUTextureFormat_R8BG8A8Triplanar420Unorm, "value mismatch for TextureFormat::R8BG8A8Triplanar420Unorm"); + + // TextureSampleType + + static_assert(sizeof(TextureSampleType) == sizeof(WGPUTextureSampleType), "sizeof mismatch for TextureSampleType"); + static_assert(alignof(TextureSampleType) == alignof(WGPUTextureSampleType), "alignof mismatch for TextureSampleType"); + + static_assert(static_cast(TextureSampleType::Undefined) == WGPUTextureSampleType_Undefined, "value mismatch for TextureSampleType::Undefined"); + static_assert(static_cast(TextureSampleType::Float) == WGPUTextureSampleType_Float, "value mismatch for TextureSampleType::Float"); + static_assert(static_cast(TextureSampleType::UnfilterableFloat) == WGPUTextureSampleType_UnfilterableFloat, "value mismatch for TextureSampleType::UnfilterableFloat"); + static_assert(static_cast(TextureSampleType::Depth) == WGPUTextureSampleType_Depth, "value mismatch for TextureSampleType::Depth"); + static_assert(static_cast(TextureSampleType::Sint) == WGPUTextureSampleType_Sint, "value mismatch for TextureSampleType::Sint"); + static_assert(static_cast(TextureSampleType::Uint) == WGPUTextureSampleType_Uint, "value mismatch for TextureSampleType::Uint"); + + // TextureViewDimension + + static_assert(sizeof(TextureViewDimension) == sizeof(WGPUTextureViewDimension), "sizeof mismatch for TextureViewDimension"); + static_assert(alignof(TextureViewDimension) == alignof(WGPUTextureViewDimension), "alignof mismatch for TextureViewDimension"); + + static_assert(static_cast(TextureViewDimension::Undefined) == WGPUTextureViewDimension_Undefined, "value mismatch for TextureViewDimension::Undefined"); + static_assert(static_cast(TextureViewDimension::e1D) == WGPUTextureViewDimension_1D, "value mismatch for TextureViewDimension::e1D"); + static_assert(static_cast(TextureViewDimension::e2D) == WGPUTextureViewDimension_2D, "value mismatch for TextureViewDimension::e2D"); + static_assert(static_cast(TextureViewDimension::e2DArray) == WGPUTextureViewDimension_2DArray, "value mismatch for TextureViewDimension::e2DArray"); + static_assert(static_cast(TextureViewDimension::Cube) == WGPUTextureViewDimension_Cube, "value mismatch for TextureViewDimension::Cube"); + static_assert(static_cast(TextureViewDimension::CubeArray) == WGPUTextureViewDimension_CubeArray, "value mismatch for TextureViewDimension::CubeArray"); + static_assert(static_cast(TextureViewDimension::e3D) == WGPUTextureViewDimension_3D, "value mismatch for TextureViewDimension::e3D"); + + // VertexFormat + + static_assert(sizeof(VertexFormat) == sizeof(WGPUVertexFormat), "sizeof mismatch for VertexFormat"); + static_assert(alignof(VertexFormat) == alignof(WGPUVertexFormat), "alignof mismatch for VertexFormat"); + + static_assert(static_cast(VertexFormat::Undefined) == WGPUVertexFormat_Undefined, "value mismatch for VertexFormat::Undefined"); + static_assert(static_cast(VertexFormat::Uint8x2) == WGPUVertexFormat_Uint8x2, "value mismatch for VertexFormat::Uint8x2"); + static_assert(static_cast(VertexFormat::Uint8x4) == WGPUVertexFormat_Uint8x4, "value mismatch for VertexFormat::Uint8x4"); + static_assert(static_cast(VertexFormat::Sint8x2) == WGPUVertexFormat_Sint8x2, "value mismatch for VertexFormat::Sint8x2"); + static_assert(static_cast(VertexFormat::Sint8x4) == WGPUVertexFormat_Sint8x4, "value mismatch for VertexFormat::Sint8x4"); + static_assert(static_cast(VertexFormat::Unorm8x2) == WGPUVertexFormat_Unorm8x2, "value mismatch for VertexFormat::Unorm8x2"); + static_assert(static_cast(VertexFormat::Unorm8x4) == WGPUVertexFormat_Unorm8x4, "value mismatch for VertexFormat::Unorm8x4"); + static_assert(static_cast(VertexFormat::Snorm8x2) == WGPUVertexFormat_Snorm8x2, "value mismatch for VertexFormat::Snorm8x2"); + static_assert(static_cast(VertexFormat::Snorm8x4) == WGPUVertexFormat_Snorm8x4, "value mismatch for VertexFormat::Snorm8x4"); + static_assert(static_cast(VertexFormat::Uint16x2) == WGPUVertexFormat_Uint16x2, "value mismatch for VertexFormat::Uint16x2"); + static_assert(static_cast(VertexFormat::Uint16x4) == WGPUVertexFormat_Uint16x4, "value mismatch for VertexFormat::Uint16x4"); + static_assert(static_cast(VertexFormat::Sint16x2) == WGPUVertexFormat_Sint16x2, "value mismatch for VertexFormat::Sint16x2"); + static_assert(static_cast(VertexFormat::Sint16x4) == WGPUVertexFormat_Sint16x4, "value mismatch for VertexFormat::Sint16x4"); + static_assert(static_cast(VertexFormat::Unorm16x2) == WGPUVertexFormat_Unorm16x2, "value mismatch for VertexFormat::Unorm16x2"); + static_assert(static_cast(VertexFormat::Unorm16x4) == WGPUVertexFormat_Unorm16x4, "value mismatch for VertexFormat::Unorm16x4"); + static_assert(static_cast(VertexFormat::Snorm16x2) == WGPUVertexFormat_Snorm16x2, "value mismatch for VertexFormat::Snorm16x2"); + static_assert(static_cast(VertexFormat::Snorm16x4) == WGPUVertexFormat_Snorm16x4, "value mismatch for VertexFormat::Snorm16x4"); + static_assert(static_cast(VertexFormat::Float16x2) == WGPUVertexFormat_Float16x2, "value mismatch for VertexFormat::Float16x2"); + static_assert(static_cast(VertexFormat::Float16x4) == WGPUVertexFormat_Float16x4, "value mismatch for VertexFormat::Float16x4"); + static_assert(static_cast(VertexFormat::Float32) == WGPUVertexFormat_Float32, "value mismatch for VertexFormat::Float32"); + static_assert(static_cast(VertexFormat::Float32x2) == WGPUVertexFormat_Float32x2, "value mismatch for VertexFormat::Float32x2"); + static_assert(static_cast(VertexFormat::Float32x3) == WGPUVertexFormat_Float32x3, "value mismatch for VertexFormat::Float32x3"); + static_assert(static_cast(VertexFormat::Float32x4) == WGPUVertexFormat_Float32x4, "value mismatch for VertexFormat::Float32x4"); + static_assert(static_cast(VertexFormat::Uint32) == WGPUVertexFormat_Uint32, "value mismatch for VertexFormat::Uint32"); + static_assert(static_cast(VertexFormat::Uint32x2) == WGPUVertexFormat_Uint32x2, "value mismatch for VertexFormat::Uint32x2"); + static_assert(static_cast(VertexFormat::Uint32x3) == WGPUVertexFormat_Uint32x3, "value mismatch for VertexFormat::Uint32x3"); + static_assert(static_cast(VertexFormat::Uint32x4) == WGPUVertexFormat_Uint32x4, "value mismatch for VertexFormat::Uint32x4"); + static_assert(static_cast(VertexFormat::Sint32) == WGPUVertexFormat_Sint32, "value mismatch for VertexFormat::Sint32"); + static_assert(static_cast(VertexFormat::Sint32x2) == WGPUVertexFormat_Sint32x2, "value mismatch for VertexFormat::Sint32x2"); + static_assert(static_cast(VertexFormat::Sint32x3) == WGPUVertexFormat_Sint32x3, "value mismatch for VertexFormat::Sint32x3"); + static_assert(static_cast(VertexFormat::Sint32x4) == WGPUVertexFormat_Sint32x4, "value mismatch for VertexFormat::Sint32x4"); + static_assert(static_cast(VertexFormat::Unorm10_10_10_2) == WGPUVertexFormat_Unorm10_10_10_2, "value mismatch for VertexFormat::Unorm10_10_10_2"); + + // VertexStepMode + + static_assert(sizeof(VertexStepMode) == sizeof(WGPUVertexStepMode), "sizeof mismatch for VertexStepMode"); + static_assert(alignof(VertexStepMode) == alignof(WGPUVertexStepMode), "alignof mismatch for VertexStepMode"); + + static_assert(static_cast(VertexStepMode::Undefined) == WGPUVertexStepMode_Undefined, "value mismatch for VertexStepMode::Undefined"); + static_assert(static_cast(VertexStepMode::VertexBufferNotUsed) == WGPUVertexStepMode_VertexBufferNotUsed, "value mismatch for VertexStepMode::VertexBufferNotUsed"); + static_assert(static_cast(VertexStepMode::Vertex) == WGPUVertexStepMode_Vertex, "value mismatch for VertexStepMode::Vertex"); + static_assert(static_cast(VertexStepMode::Instance) == WGPUVertexStepMode_Instance, "value mismatch for VertexStepMode::Instance"); + + // WaitStatus + + static_assert(sizeof(WaitStatus) == sizeof(WGPUWaitStatus), "sizeof mismatch for WaitStatus"); + static_assert(alignof(WaitStatus) == alignof(WGPUWaitStatus), "alignof mismatch for WaitStatus"); + + static_assert(static_cast(WaitStatus::Success) == WGPUWaitStatus_Success, "value mismatch for WaitStatus::Success"); + static_assert(static_cast(WaitStatus::TimedOut) == WGPUWaitStatus_TimedOut, "value mismatch for WaitStatus::TimedOut"); + static_assert(static_cast(WaitStatus::UnsupportedTimeout) == WGPUWaitStatus_UnsupportedTimeout, "value mismatch for WaitStatus::UnsupportedTimeout"); + static_assert(static_cast(WaitStatus::UnsupportedCount) == WGPUWaitStatus_UnsupportedCount, "value mismatch for WaitStatus::UnsupportedCount"); + static_assert(static_cast(WaitStatus::UnsupportedMixedSources) == WGPUWaitStatus_UnsupportedMixedSources, "value mismatch for WaitStatus::UnsupportedMixedSources"); + static_assert(static_cast(WaitStatus::Unknown) == WGPUWaitStatus_Unknown, "value mismatch for WaitStatus::Unknown"); + + // BufferUsage + + static_assert(sizeof(BufferUsage) == sizeof(WGPUBufferUsageFlags), "sizeof mismatch for BufferUsage"); + static_assert(alignof(BufferUsage) == alignof(WGPUBufferUsageFlags), "alignof mismatch for BufferUsage"); + + static_assert(static_cast(BufferUsage::None) == WGPUBufferUsage_None, "value mismatch for BufferUsage::None"); + static_assert(static_cast(BufferUsage::MapRead) == WGPUBufferUsage_MapRead, "value mismatch for BufferUsage::MapRead"); + static_assert(static_cast(BufferUsage::MapWrite) == WGPUBufferUsage_MapWrite, "value mismatch for BufferUsage::MapWrite"); + static_assert(static_cast(BufferUsage::CopySrc) == WGPUBufferUsage_CopySrc, "value mismatch for BufferUsage::CopySrc"); + static_assert(static_cast(BufferUsage::CopyDst) == WGPUBufferUsage_CopyDst, "value mismatch for BufferUsage::CopyDst"); + static_assert(static_cast(BufferUsage::Index) == WGPUBufferUsage_Index, "value mismatch for BufferUsage::Index"); + static_assert(static_cast(BufferUsage::Vertex) == WGPUBufferUsage_Vertex, "value mismatch for BufferUsage::Vertex"); + static_assert(static_cast(BufferUsage::Uniform) == WGPUBufferUsage_Uniform, "value mismatch for BufferUsage::Uniform"); + static_assert(static_cast(BufferUsage::Storage) == WGPUBufferUsage_Storage, "value mismatch for BufferUsage::Storage"); + static_assert(static_cast(BufferUsage::Indirect) == WGPUBufferUsage_Indirect, "value mismatch for BufferUsage::Indirect"); + static_assert(static_cast(BufferUsage::QueryResolve) == WGPUBufferUsage_QueryResolve, "value mismatch for BufferUsage::QueryResolve"); + + // ColorWriteMask + + static_assert(sizeof(ColorWriteMask) == sizeof(WGPUColorWriteMaskFlags), "sizeof mismatch for ColorWriteMask"); + static_assert(alignof(ColorWriteMask) == alignof(WGPUColorWriteMaskFlags), "alignof mismatch for ColorWriteMask"); + + static_assert(static_cast(ColorWriteMask::None) == WGPUColorWriteMask_None, "value mismatch for ColorWriteMask::None"); + static_assert(static_cast(ColorWriteMask::Red) == WGPUColorWriteMask_Red, "value mismatch for ColorWriteMask::Red"); + static_assert(static_cast(ColorWriteMask::Green) == WGPUColorWriteMask_Green, "value mismatch for ColorWriteMask::Green"); + static_assert(static_cast(ColorWriteMask::Blue) == WGPUColorWriteMask_Blue, "value mismatch for ColorWriteMask::Blue"); + static_assert(static_cast(ColorWriteMask::Alpha) == WGPUColorWriteMask_Alpha, "value mismatch for ColorWriteMask::Alpha"); + static_assert(static_cast(ColorWriteMask::All) == WGPUColorWriteMask_All, "value mismatch for ColorWriteMask::All"); + + // HeapProperty + + static_assert(sizeof(HeapProperty) == sizeof(WGPUHeapPropertyFlags), "sizeof mismatch for HeapProperty"); + static_assert(alignof(HeapProperty) == alignof(WGPUHeapPropertyFlags), "alignof mismatch for HeapProperty"); + + static_assert(static_cast(HeapProperty::Undefined) == WGPUHeapProperty_Undefined, "value mismatch for HeapProperty::Undefined"); + static_assert(static_cast(HeapProperty::DeviceLocal) == WGPUHeapProperty_DeviceLocal, "value mismatch for HeapProperty::DeviceLocal"); + static_assert(static_cast(HeapProperty::HostVisible) == WGPUHeapProperty_HostVisible, "value mismatch for HeapProperty::HostVisible"); + static_assert(static_cast(HeapProperty::HostCoherent) == WGPUHeapProperty_HostCoherent, "value mismatch for HeapProperty::HostCoherent"); + static_assert(static_cast(HeapProperty::HostUncached) == WGPUHeapProperty_HostUncached, "value mismatch for HeapProperty::HostUncached"); + static_assert(static_cast(HeapProperty::HostCached) == WGPUHeapProperty_HostCached, "value mismatch for HeapProperty::HostCached"); + + // MapMode + + static_assert(sizeof(MapMode) == sizeof(WGPUMapModeFlags), "sizeof mismatch for MapMode"); + static_assert(alignof(MapMode) == alignof(WGPUMapModeFlags), "alignof mismatch for MapMode"); + + static_assert(static_cast(MapMode::None) == WGPUMapMode_None, "value mismatch for MapMode::None"); + static_assert(static_cast(MapMode::Read) == WGPUMapMode_Read, "value mismatch for MapMode::Read"); + static_assert(static_cast(MapMode::Write) == WGPUMapMode_Write, "value mismatch for MapMode::Write"); + + // ShaderStage + + static_assert(sizeof(ShaderStage) == sizeof(WGPUShaderStageFlags), "sizeof mismatch for ShaderStage"); + static_assert(alignof(ShaderStage) == alignof(WGPUShaderStageFlags), "alignof mismatch for ShaderStage"); + + static_assert(static_cast(ShaderStage::None) == WGPUShaderStage_None, "value mismatch for ShaderStage::None"); + static_assert(static_cast(ShaderStage::Vertex) == WGPUShaderStage_Vertex, "value mismatch for ShaderStage::Vertex"); + static_assert(static_cast(ShaderStage::Fragment) == WGPUShaderStage_Fragment, "value mismatch for ShaderStage::Fragment"); + static_assert(static_cast(ShaderStage::Compute) == WGPUShaderStage_Compute, "value mismatch for ShaderStage::Compute"); + + // TextureUsage + + static_assert(sizeof(TextureUsage) == sizeof(WGPUTextureUsageFlags), "sizeof mismatch for TextureUsage"); + static_assert(alignof(TextureUsage) == alignof(WGPUTextureUsageFlags), "alignof mismatch for TextureUsage"); + + static_assert(static_cast(TextureUsage::None) == WGPUTextureUsage_None, "value mismatch for TextureUsage::None"); + static_assert(static_cast(TextureUsage::CopySrc) == WGPUTextureUsage_CopySrc, "value mismatch for TextureUsage::CopySrc"); + static_assert(static_cast(TextureUsage::CopyDst) == WGPUTextureUsage_CopyDst, "value mismatch for TextureUsage::CopyDst"); + static_assert(static_cast(TextureUsage::TextureBinding) == WGPUTextureUsage_TextureBinding, "value mismatch for TextureUsage::TextureBinding"); + static_assert(static_cast(TextureUsage::StorageBinding) == WGPUTextureUsage_StorageBinding, "value mismatch for TextureUsage::StorageBinding"); + static_assert(static_cast(TextureUsage::RenderAttachment) == WGPUTextureUsage_RenderAttachment, "value mismatch for TextureUsage::RenderAttachment"); + static_assert(static_cast(TextureUsage::TransientAttachment) == WGPUTextureUsage_TransientAttachment, "value mismatch for TextureUsage::TransientAttachment"); + static_assert(static_cast(TextureUsage::StorageAttachment) == WGPUTextureUsage_StorageAttachment, "value mismatch for TextureUsage::StorageAttachment"); + + // ChainedStruct + + static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct), + "sizeof mismatch for ChainedStruct"); + static_assert(alignof(ChainedStruct) == alignof(WGPUChainedStruct), + "alignof mismatch for ChainedStruct"); + static_assert(offsetof(ChainedStruct, nextInChain) == offsetof(WGPUChainedStruct, next), + "offsetof mismatch for ChainedStruct::nextInChain"); + static_assert(offsetof(ChainedStruct, sType) == offsetof(WGPUChainedStruct, sType), + "offsetof mismatch for ChainedStruct::sType"); + + // AdapterProperties + + static_assert(sizeof(AdapterProperties) == sizeof(WGPUAdapterProperties), "sizeof mismatch for AdapterProperties"); + static_assert(alignof(AdapterProperties) == alignof(WGPUAdapterProperties), "alignof mismatch for AdapterProperties"); + + static_assert(offsetof(AdapterProperties, nextInChain) == offsetof(WGPUAdapterProperties, nextInChain), + "offsetof mismatch for AdapterProperties::nextInChain"); + static_assert(offsetof(AdapterProperties, vendorID) == offsetof(WGPUAdapterProperties, vendorID), + "offsetof mismatch for AdapterProperties::vendorID"); + static_assert(offsetof(AdapterProperties, vendorName) == offsetof(WGPUAdapterProperties, vendorName), + "offsetof mismatch for AdapterProperties::vendorName"); + static_assert(offsetof(AdapterProperties, architecture) == offsetof(WGPUAdapterProperties, architecture), + "offsetof mismatch for AdapterProperties::architecture"); + static_assert(offsetof(AdapterProperties, deviceID) == offsetof(WGPUAdapterProperties, deviceID), + "offsetof mismatch for AdapterProperties::deviceID"); + static_assert(offsetof(AdapterProperties, name) == offsetof(WGPUAdapterProperties, name), + "offsetof mismatch for AdapterProperties::name"); + static_assert(offsetof(AdapterProperties, driverDescription) == offsetof(WGPUAdapterProperties, driverDescription), + "offsetof mismatch for AdapterProperties::driverDescription"); + static_assert(offsetof(AdapterProperties, adapterType) == offsetof(WGPUAdapterProperties, adapterType), + "offsetof mismatch for AdapterProperties::adapterType"); + static_assert(offsetof(AdapterProperties, backendType) == offsetof(WGPUAdapterProperties, backendType), + "offsetof mismatch for AdapterProperties::backendType"); + static_assert(offsetof(AdapterProperties, compatibilityMode) == offsetof(WGPUAdapterProperties, compatibilityMode), + "offsetof mismatch for AdapterProperties::compatibilityMode"); + + // AdapterPropertiesD3D + + static_assert(sizeof(AdapterPropertiesD3D) == sizeof(WGPUAdapterPropertiesD3D), "sizeof mismatch for AdapterPropertiesD3D"); + static_assert(alignof(AdapterPropertiesD3D) == alignof(WGPUAdapterPropertiesD3D), "alignof mismatch for AdapterPropertiesD3D"); + + static_assert(offsetof(AdapterPropertiesD3D, shaderModel) == offsetof(WGPUAdapterPropertiesD3D, shaderModel), + "offsetof mismatch for AdapterPropertiesD3D::shaderModel"); + + // AdapterPropertiesVk + + static_assert(sizeof(AdapterPropertiesVk) == sizeof(WGPUAdapterPropertiesVk), "sizeof mismatch for AdapterPropertiesVk"); + static_assert(alignof(AdapterPropertiesVk) == alignof(WGPUAdapterPropertiesVk), "alignof mismatch for AdapterPropertiesVk"); + + static_assert(offsetof(AdapterPropertiesVk, driverVersion) == offsetof(WGPUAdapterPropertiesVk, driverVersion), + "offsetof mismatch for AdapterPropertiesVk::driverVersion"); + + // BindGroupEntry + + static_assert(sizeof(BindGroupEntry) == sizeof(WGPUBindGroupEntry), "sizeof mismatch for BindGroupEntry"); + static_assert(alignof(BindGroupEntry) == alignof(WGPUBindGroupEntry), "alignof mismatch for BindGroupEntry"); + + static_assert(offsetof(BindGroupEntry, nextInChain) == offsetof(WGPUBindGroupEntry, nextInChain), + "offsetof mismatch for BindGroupEntry::nextInChain"); + static_assert(offsetof(BindGroupEntry, binding) == offsetof(WGPUBindGroupEntry, binding), + "offsetof mismatch for BindGroupEntry::binding"); + static_assert(offsetof(BindGroupEntry, buffer) == offsetof(WGPUBindGroupEntry, buffer), + "offsetof mismatch for BindGroupEntry::buffer"); + static_assert(offsetof(BindGroupEntry, offset) == offsetof(WGPUBindGroupEntry, offset), + "offsetof mismatch for BindGroupEntry::offset"); + static_assert(offsetof(BindGroupEntry, size) == offsetof(WGPUBindGroupEntry, size), + "offsetof mismatch for BindGroupEntry::size"); + static_assert(offsetof(BindGroupEntry, sampler) == offsetof(WGPUBindGroupEntry, sampler), + "offsetof mismatch for BindGroupEntry::sampler"); + static_assert(offsetof(BindGroupEntry, textureView) == offsetof(WGPUBindGroupEntry, textureView), + "offsetof mismatch for BindGroupEntry::textureView"); + + // BlendComponent + + static_assert(sizeof(BlendComponent) == sizeof(WGPUBlendComponent), "sizeof mismatch for BlendComponent"); + static_assert(alignof(BlendComponent) == alignof(WGPUBlendComponent), "alignof mismatch for BlendComponent"); + + static_assert(offsetof(BlendComponent, operation) == offsetof(WGPUBlendComponent, operation), + "offsetof mismatch for BlendComponent::operation"); + static_assert(offsetof(BlendComponent, srcFactor) == offsetof(WGPUBlendComponent, srcFactor), + "offsetof mismatch for BlendComponent::srcFactor"); + static_assert(offsetof(BlendComponent, dstFactor) == offsetof(WGPUBlendComponent, dstFactor), + "offsetof mismatch for BlendComponent::dstFactor"); + + // BufferBindingLayout + + static_assert(sizeof(BufferBindingLayout) == sizeof(WGPUBufferBindingLayout), "sizeof mismatch for BufferBindingLayout"); + static_assert(alignof(BufferBindingLayout) == alignof(WGPUBufferBindingLayout), "alignof mismatch for BufferBindingLayout"); + + static_assert(offsetof(BufferBindingLayout, nextInChain) == offsetof(WGPUBufferBindingLayout, nextInChain), + "offsetof mismatch for BufferBindingLayout::nextInChain"); + static_assert(offsetof(BufferBindingLayout, type) == offsetof(WGPUBufferBindingLayout, type), + "offsetof mismatch for BufferBindingLayout::type"); + static_assert(offsetof(BufferBindingLayout, hasDynamicOffset) == offsetof(WGPUBufferBindingLayout, hasDynamicOffset), + "offsetof mismatch for BufferBindingLayout::hasDynamicOffset"); + static_assert(offsetof(BufferBindingLayout, minBindingSize) == offsetof(WGPUBufferBindingLayout, minBindingSize), + "offsetof mismatch for BufferBindingLayout::minBindingSize"); + + // BufferDescriptor + + static_assert(sizeof(BufferDescriptor) == sizeof(WGPUBufferDescriptor), "sizeof mismatch for BufferDescriptor"); + static_assert(alignof(BufferDescriptor) == alignof(WGPUBufferDescriptor), "alignof mismatch for BufferDescriptor"); + + static_assert(offsetof(BufferDescriptor, nextInChain) == offsetof(WGPUBufferDescriptor, nextInChain), + "offsetof mismatch for BufferDescriptor::nextInChain"); + static_assert(offsetof(BufferDescriptor, label) == offsetof(WGPUBufferDescriptor, label), + "offsetof mismatch for BufferDescriptor::label"); + static_assert(offsetof(BufferDescriptor, usage) == offsetof(WGPUBufferDescriptor, usage), + "offsetof mismatch for BufferDescriptor::usage"); + static_assert(offsetof(BufferDescriptor, size) == offsetof(WGPUBufferDescriptor, size), + "offsetof mismatch for BufferDescriptor::size"); + static_assert(offsetof(BufferDescriptor, mappedAtCreation) == offsetof(WGPUBufferDescriptor, mappedAtCreation), + "offsetof mismatch for BufferDescriptor::mappedAtCreation"); + + // BufferHostMappedPointer + + static_assert(sizeof(BufferHostMappedPointer) == sizeof(WGPUBufferHostMappedPointer), "sizeof mismatch for BufferHostMappedPointer"); + static_assert(alignof(BufferHostMappedPointer) == alignof(WGPUBufferHostMappedPointer), "alignof mismatch for BufferHostMappedPointer"); + + static_assert(offsetof(BufferHostMappedPointer, pointer) == offsetof(WGPUBufferHostMappedPointer, pointer), + "offsetof mismatch for BufferHostMappedPointer::pointer"); + static_assert(offsetof(BufferHostMappedPointer, disposeCallback) == offsetof(WGPUBufferHostMappedPointer, disposeCallback), + "offsetof mismatch for BufferHostMappedPointer::disposeCallback"); + static_assert(offsetof(BufferHostMappedPointer, userdata) == offsetof(WGPUBufferHostMappedPointer, userdata), + "offsetof mismatch for BufferHostMappedPointer::userdata"); + + // BufferMapCallbackInfo + + static_assert(sizeof(BufferMapCallbackInfo) == sizeof(WGPUBufferMapCallbackInfo), "sizeof mismatch for BufferMapCallbackInfo"); + static_assert(alignof(BufferMapCallbackInfo) == alignof(WGPUBufferMapCallbackInfo), "alignof mismatch for BufferMapCallbackInfo"); + + static_assert(offsetof(BufferMapCallbackInfo, nextInChain) == offsetof(WGPUBufferMapCallbackInfo, nextInChain), + "offsetof mismatch for BufferMapCallbackInfo::nextInChain"); + static_assert(offsetof(BufferMapCallbackInfo, mode) == offsetof(WGPUBufferMapCallbackInfo, mode), + "offsetof mismatch for BufferMapCallbackInfo::mode"); + static_assert(offsetof(BufferMapCallbackInfo, callback) == offsetof(WGPUBufferMapCallbackInfo, callback), + "offsetof mismatch for BufferMapCallbackInfo::callback"); + static_assert(offsetof(BufferMapCallbackInfo, userdata) == offsetof(WGPUBufferMapCallbackInfo, userdata), + "offsetof mismatch for BufferMapCallbackInfo::userdata"); + + // Color + + static_assert(sizeof(Color) == sizeof(WGPUColor), "sizeof mismatch for Color"); + static_assert(alignof(Color) == alignof(WGPUColor), "alignof mismatch for Color"); + + static_assert(offsetof(Color, r) == offsetof(WGPUColor, r), + "offsetof mismatch for Color::r"); + static_assert(offsetof(Color, g) == offsetof(WGPUColor, g), + "offsetof mismatch for Color::g"); + static_assert(offsetof(Color, b) == offsetof(WGPUColor, b), + "offsetof mismatch for Color::b"); + static_assert(offsetof(Color, a) == offsetof(WGPUColor, a), + "offsetof mismatch for Color::a"); + + // CommandBufferDescriptor + + static_assert(sizeof(CommandBufferDescriptor) == sizeof(WGPUCommandBufferDescriptor), "sizeof mismatch for CommandBufferDescriptor"); + static_assert(alignof(CommandBufferDescriptor) == alignof(WGPUCommandBufferDescriptor), "alignof mismatch for CommandBufferDescriptor"); + + static_assert(offsetof(CommandBufferDescriptor, nextInChain) == offsetof(WGPUCommandBufferDescriptor, nextInChain), + "offsetof mismatch for CommandBufferDescriptor::nextInChain"); + static_assert(offsetof(CommandBufferDescriptor, label) == offsetof(WGPUCommandBufferDescriptor, label), + "offsetof mismatch for CommandBufferDescriptor::label"); + + // CommandEncoderDescriptor + + static_assert(sizeof(CommandEncoderDescriptor) == sizeof(WGPUCommandEncoderDescriptor), "sizeof mismatch for CommandEncoderDescriptor"); + static_assert(alignof(CommandEncoderDescriptor) == alignof(WGPUCommandEncoderDescriptor), "alignof mismatch for CommandEncoderDescriptor"); + + static_assert(offsetof(CommandEncoderDescriptor, nextInChain) == offsetof(WGPUCommandEncoderDescriptor, nextInChain), + "offsetof mismatch for CommandEncoderDescriptor::nextInChain"); + static_assert(offsetof(CommandEncoderDescriptor, label) == offsetof(WGPUCommandEncoderDescriptor, label), + "offsetof mismatch for CommandEncoderDescriptor::label"); + + // CompilationInfoCallbackInfo + + static_assert(sizeof(CompilationInfoCallbackInfo) == sizeof(WGPUCompilationInfoCallbackInfo), "sizeof mismatch for CompilationInfoCallbackInfo"); + static_assert(alignof(CompilationInfoCallbackInfo) == alignof(WGPUCompilationInfoCallbackInfo), "alignof mismatch for CompilationInfoCallbackInfo"); + + static_assert(offsetof(CompilationInfoCallbackInfo, nextInChain) == offsetof(WGPUCompilationInfoCallbackInfo, nextInChain), + "offsetof mismatch for CompilationInfoCallbackInfo::nextInChain"); + static_assert(offsetof(CompilationInfoCallbackInfo, mode) == offsetof(WGPUCompilationInfoCallbackInfo, mode), + "offsetof mismatch for CompilationInfoCallbackInfo::mode"); + static_assert(offsetof(CompilationInfoCallbackInfo, callback) == offsetof(WGPUCompilationInfoCallbackInfo, callback), + "offsetof mismatch for CompilationInfoCallbackInfo::callback"); + static_assert(offsetof(CompilationInfoCallbackInfo, userdata) == offsetof(WGPUCompilationInfoCallbackInfo, userdata), + "offsetof mismatch for CompilationInfoCallbackInfo::userdata"); + + // CompilationMessage + + static_assert(sizeof(CompilationMessage) == sizeof(WGPUCompilationMessage), "sizeof mismatch for CompilationMessage"); + static_assert(alignof(CompilationMessage) == alignof(WGPUCompilationMessage), "alignof mismatch for CompilationMessage"); + + static_assert(offsetof(CompilationMessage, nextInChain) == offsetof(WGPUCompilationMessage, nextInChain), + "offsetof mismatch for CompilationMessage::nextInChain"); + static_assert(offsetof(CompilationMessage, message) == offsetof(WGPUCompilationMessage, message), + "offsetof mismatch for CompilationMessage::message"); + static_assert(offsetof(CompilationMessage, type) == offsetof(WGPUCompilationMessage, type), + "offsetof mismatch for CompilationMessage::type"); + static_assert(offsetof(CompilationMessage, lineNum) == offsetof(WGPUCompilationMessage, lineNum), + "offsetof mismatch for CompilationMessage::lineNum"); + static_assert(offsetof(CompilationMessage, linePos) == offsetof(WGPUCompilationMessage, linePos), + "offsetof mismatch for CompilationMessage::linePos"); + static_assert(offsetof(CompilationMessage, offset) == offsetof(WGPUCompilationMessage, offset), + "offsetof mismatch for CompilationMessage::offset"); + static_assert(offsetof(CompilationMessage, length) == offsetof(WGPUCompilationMessage, length), + "offsetof mismatch for CompilationMessage::length"); + static_assert(offsetof(CompilationMessage, utf16LinePos) == offsetof(WGPUCompilationMessage, utf16LinePos), + "offsetof mismatch for CompilationMessage::utf16LinePos"); + static_assert(offsetof(CompilationMessage, utf16Offset) == offsetof(WGPUCompilationMessage, utf16Offset), + "offsetof mismatch for CompilationMessage::utf16Offset"); + static_assert(offsetof(CompilationMessage, utf16Length) == offsetof(WGPUCompilationMessage, utf16Length), + "offsetof mismatch for CompilationMessage::utf16Length"); + + // ComputePassTimestampWrites + + static_assert(sizeof(ComputePassTimestampWrites) == sizeof(WGPUComputePassTimestampWrites), "sizeof mismatch for ComputePassTimestampWrites"); + static_assert(alignof(ComputePassTimestampWrites) == alignof(WGPUComputePassTimestampWrites), "alignof mismatch for ComputePassTimestampWrites"); + + static_assert(offsetof(ComputePassTimestampWrites, querySet) == offsetof(WGPUComputePassTimestampWrites, querySet), + "offsetof mismatch for ComputePassTimestampWrites::querySet"); + static_assert(offsetof(ComputePassTimestampWrites, beginningOfPassWriteIndex) == offsetof(WGPUComputePassTimestampWrites, beginningOfPassWriteIndex), + "offsetof mismatch for ComputePassTimestampWrites::beginningOfPassWriteIndex"); + static_assert(offsetof(ComputePassTimestampWrites, endOfPassWriteIndex) == offsetof(WGPUComputePassTimestampWrites, endOfPassWriteIndex), + "offsetof mismatch for ComputePassTimestampWrites::endOfPassWriteIndex"); + + // ConstantEntry + + static_assert(sizeof(ConstantEntry) == sizeof(WGPUConstantEntry), "sizeof mismatch for ConstantEntry"); + static_assert(alignof(ConstantEntry) == alignof(WGPUConstantEntry), "alignof mismatch for ConstantEntry"); + + static_assert(offsetof(ConstantEntry, nextInChain) == offsetof(WGPUConstantEntry, nextInChain), + "offsetof mismatch for ConstantEntry::nextInChain"); + static_assert(offsetof(ConstantEntry, key) == offsetof(WGPUConstantEntry, key), + "offsetof mismatch for ConstantEntry::key"); + static_assert(offsetof(ConstantEntry, value) == offsetof(WGPUConstantEntry, value), + "offsetof mismatch for ConstantEntry::value"); + + // CopyTextureForBrowserOptions + + static_assert(sizeof(CopyTextureForBrowserOptions) == sizeof(WGPUCopyTextureForBrowserOptions), "sizeof mismatch for CopyTextureForBrowserOptions"); + static_assert(alignof(CopyTextureForBrowserOptions) == alignof(WGPUCopyTextureForBrowserOptions), "alignof mismatch for CopyTextureForBrowserOptions"); + + static_assert(offsetof(CopyTextureForBrowserOptions, nextInChain) == offsetof(WGPUCopyTextureForBrowserOptions, nextInChain), + "offsetof mismatch for CopyTextureForBrowserOptions::nextInChain"); + static_assert(offsetof(CopyTextureForBrowserOptions, flipY) == offsetof(WGPUCopyTextureForBrowserOptions, flipY), + "offsetof mismatch for CopyTextureForBrowserOptions::flipY"); + static_assert(offsetof(CopyTextureForBrowserOptions, needsColorSpaceConversion) == offsetof(WGPUCopyTextureForBrowserOptions, needsColorSpaceConversion), + "offsetof mismatch for CopyTextureForBrowserOptions::needsColorSpaceConversion"); + static_assert(offsetof(CopyTextureForBrowserOptions, srcAlphaMode) == offsetof(WGPUCopyTextureForBrowserOptions, srcAlphaMode), + "offsetof mismatch for CopyTextureForBrowserOptions::srcAlphaMode"); + static_assert(offsetof(CopyTextureForBrowserOptions, srcTransferFunctionParameters) == offsetof(WGPUCopyTextureForBrowserOptions, srcTransferFunctionParameters), + "offsetof mismatch for CopyTextureForBrowserOptions::srcTransferFunctionParameters"); + static_assert(offsetof(CopyTextureForBrowserOptions, conversionMatrix) == offsetof(WGPUCopyTextureForBrowserOptions, conversionMatrix), + "offsetof mismatch for CopyTextureForBrowserOptions::conversionMatrix"); + static_assert(offsetof(CopyTextureForBrowserOptions, dstTransferFunctionParameters) == offsetof(WGPUCopyTextureForBrowserOptions, dstTransferFunctionParameters), + "offsetof mismatch for CopyTextureForBrowserOptions::dstTransferFunctionParameters"); + static_assert(offsetof(CopyTextureForBrowserOptions, dstAlphaMode) == offsetof(WGPUCopyTextureForBrowserOptions, dstAlphaMode), + "offsetof mismatch for CopyTextureForBrowserOptions::dstAlphaMode"); + static_assert(offsetof(CopyTextureForBrowserOptions, internalUsage) == offsetof(WGPUCopyTextureForBrowserOptions, internalUsage), + "offsetof mismatch for CopyTextureForBrowserOptions::internalUsage"); + + // CreateComputePipelineAsyncCallbackInfo + + static_assert(sizeof(CreateComputePipelineAsyncCallbackInfo) == sizeof(WGPUCreateComputePipelineAsyncCallbackInfo), "sizeof mismatch for CreateComputePipelineAsyncCallbackInfo"); + static_assert(alignof(CreateComputePipelineAsyncCallbackInfo) == alignof(WGPUCreateComputePipelineAsyncCallbackInfo), "alignof mismatch for CreateComputePipelineAsyncCallbackInfo"); + + static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, nextInChain) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, nextInChain), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::nextInChain"); + static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, mode) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, mode), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::mode"); + static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, callback) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, callback), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::callback"); + static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, userdata) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, userdata), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::userdata"); + + // CreateRenderPipelineAsyncCallbackInfo + + static_assert(sizeof(CreateRenderPipelineAsyncCallbackInfo) == sizeof(WGPUCreateRenderPipelineAsyncCallbackInfo), "sizeof mismatch for CreateRenderPipelineAsyncCallbackInfo"); + static_assert(alignof(CreateRenderPipelineAsyncCallbackInfo) == alignof(WGPUCreateRenderPipelineAsyncCallbackInfo), "alignof mismatch for CreateRenderPipelineAsyncCallbackInfo"); + + static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, nextInChain) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, nextInChain), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::nextInChain"); + static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, mode) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, mode), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::mode"); + static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, callback) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, callback), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::callback"); + static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, userdata) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, userdata), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::userdata"); + + // DawnWGSLBlocklist + + static_assert(sizeof(DawnWGSLBlocklist) == sizeof(WGPUDawnWGSLBlocklist), "sizeof mismatch for DawnWGSLBlocklist"); + static_assert(alignof(DawnWGSLBlocklist) == alignof(WGPUDawnWGSLBlocklist), "alignof mismatch for DawnWGSLBlocklist"); + + static_assert(offsetof(DawnWGSLBlocklist, blocklistedFeatureCount) == offsetof(WGPUDawnWGSLBlocklist, blocklistedFeatureCount), + "offsetof mismatch for DawnWGSLBlocklist::blocklistedFeatureCount"); + static_assert(offsetof(DawnWGSLBlocklist, blocklistedFeatures) == offsetof(WGPUDawnWGSLBlocklist, blocklistedFeatures), + "offsetof mismatch for DawnWGSLBlocklist::blocklistedFeatures"); + + // DawnAdapterPropertiesPowerPreference + + static_assert(sizeof(DawnAdapterPropertiesPowerPreference) == sizeof(WGPUDawnAdapterPropertiesPowerPreference), "sizeof mismatch for DawnAdapterPropertiesPowerPreference"); + static_assert(alignof(DawnAdapterPropertiesPowerPreference) == alignof(WGPUDawnAdapterPropertiesPowerPreference), "alignof mismatch for DawnAdapterPropertiesPowerPreference"); + + static_assert(offsetof(DawnAdapterPropertiesPowerPreference, powerPreference) == offsetof(WGPUDawnAdapterPropertiesPowerPreference, powerPreference), + "offsetof mismatch for DawnAdapterPropertiesPowerPreference::powerPreference"); + + // DawnBufferDescriptorErrorInfoFromWireClient + + static_assert(sizeof(DawnBufferDescriptorErrorInfoFromWireClient) == sizeof(WGPUDawnBufferDescriptorErrorInfoFromWireClient), "sizeof mismatch for DawnBufferDescriptorErrorInfoFromWireClient"); + static_assert(alignof(DawnBufferDescriptorErrorInfoFromWireClient) == alignof(WGPUDawnBufferDescriptorErrorInfoFromWireClient), "alignof mismatch for DawnBufferDescriptorErrorInfoFromWireClient"); + + static_assert(offsetof(DawnBufferDescriptorErrorInfoFromWireClient, outOfMemory) == offsetof(WGPUDawnBufferDescriptorErrorInfoFromWireClient, outOfMemory), + "offsetof mismatch for DawnBufferDescriptorErrorInfoFromWireClient::outOfMemory"); + + // DawnCacheDeviceDescriptor + + static_assert(sizeof(DawnCacheDeviceDescriptor) == sizeof(WGPUDawnCacheDeviceDescriptor), "sizeof mismatch for DawnCacheDeviceDescriptor"); + static_assert(alignof(DawnCacheDeviceDescriptor) == alignof(WGPUDawnCacheDeviceDescriptor), "alignof mismatch for DawnCacheDeviceDescriptor"); + + static_assert(offsetof(DawnCacheDeviceDescriptor, isolationKey) == offsetof(WGPUDawnCacheDeviceDescriptor, isolationKey), + "offsetof mismatch for DawnCacheDeviceDescriptor::isolationKey"); + static_assert(offsetof(DawnCacheDeviceDescriptor, loadDataFunction) == offsetof(WGPUDawnCacheDeviceDescriptor, loadDataFunction), + "offsetof mismatch for DawnCacheDeviceDescriptor::loadDataFunction"); + static_assert(offsetof(DawnCacheDeviceDescriptor, storeDataFunction) == offsetof(WGPUDawnCacheDeviceDescriptor, storeDataFunction), + "offsetof mismatch for DawnCacheDeviceDescriptor::storeDataFunction"); + static_assert(offsetof(DawnCacheDeviceDescriptor, functionUserdata) == offsetof(WGPUDawnCacheDeviceDescriptor, functionUserdata), + "offsetof mismatch for DawnCacheDeviceDescriptor::functionUserdata"); + + // DawnComputePipelineFullSubgroups + + static_assert(sizeof(DawnComputePipelineFullSubgroups) == sizeof(WGPUDawnComputePipelineFullSubgroups), "sizeof mismatch for DawnComputePipelineFullSubgroups"); + static_assert(alignof(DawnComputePipelineFullSubgroups) == alignof(WGPUDawnComputePipelineFullSubgroups), "alignof mismatch for DawnComputePipelineFullSubgroups"); + + static_assert(offsetof(DawnComputePipelineFullSubgroups, requiresFullSubgroups) == offsetof(WGPUDawnComputePipelineFullSubgroups, requiresFullSubgroups), + "offsetof mismatch for DawnComputePipelineFullSubgroups::requiresFullSubgroups"); + + // DawnEncoderInternalUsageDescriptor + + static_assert(sizeof(DawnEncoderInternalUsageDescriptor) == sizeof(WGPUDawnEncoderInternalUsageDescriptor), "sizeof mismatch for DawnEncoderInternalUsageDescriptor"); + static_assert(alignof(DawnEncoderInternalUsageDescriptor) == alignof(WGPUDawnEncoderInternalUsageDescriptor), "alignof mismatch for DawnEncoderInternalUsageDescriptor"); + + static_assert(offsetof(DawnEncoderInternalUsageDescriptor, useInternalUsages) == offsetof(WGPUDawnEncoderInternalUsageDescriptor, useInternalUsages), + "offsetof mismatch for DawnEncoderInternalUsageDescriptor::useInternalUsages"); + + // DawnExperimentalSubgroupLimits + + static_assert(sizeof(DawnExperimentalSubgroupLimits) == sizeof(WGPUDawnExperimentalSubgroupLimits), "sizeof mismatch for DawnExperimentalSubgroupLimits"); + static_assert(alignof(DawnExperimentalSubgroupLimits) == alignof(WGPUDawnExperimentalSubgroupLimits), "alignof mismatch for DawnExperimentalSubgroupLimits"); + + static_assert(offsetof(DawnExperimentalSubgroupLimits, minSubgroupSize) == offsetof(WGPUDawnExperimentalSubgroupLimits, minSubgroupSize), + "offsetof mismatch for DawnExperimentalSubgroupLimits::minSubgroupSize"); + static_assert(offsetof(DawnExperimentalSubgroupLimits, maxSubgroupSize) == offsetof(WGPUDawnExperimentalSubgroupLimits, maxSubgroupSize), + "offsetof mismatch for DawnExperimentalSubgroupLimits::maxSubgroupSize"); + + // DawnMultisampleStateRenderToSingleSampled + + static_assert(sizeof(DawnMultisampleStateRenderToSingleSampled) == sizeof(WGPUDawnMultisampleStateRenderToSingleSampled), "sizeof mismatch for DawnMultisampleStateRenderToSingleSampled"); + static_assert(alignof(DawnMultisampleStateRenderToSingleSampled) == alignof(WGPUDawnMultisampleStateRenderToSingleSampled), "alignof mismatch for DawnMultisampleStateRenderToSingleSampled"); + + static_assert(offsetof(DawnMultisampleStateRenderToSingleSampled, enabled) == offsetof(WGPUDawnMultisampleStateRenderToSingleSampled, enabled), + "offsetof mismatch for DawnMultisampleStateRenderToSingleSampled::enabled"); + + // DawnRenderPassColorAttachmentRenderToSingleSampled + + static_assert(sizeof(DawnRenderPassColorAttachmentRenderToSingleSampled) == sizeof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled), "sizeof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled"); + static_assert(alignof(DawnRenderPassColorAttachmentRenderToSingleSampled) == alignof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled), "alignof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled"); + + static_assert(offsetof(DawnRenderPassColorAttachmentRenderToSingleSampled, implicitSampleCount) == offsetof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled, implicitSampleCount), + "offsetof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled::implicitSampleCount"); + + // DawnShaderModuleSPIRVOptionsDescriptor + + static_assert(sizeof(DawnShaderModuleSPIRVOptionsDescriptor) == sizeof(WGPUDawnShaderModuleSPIRVOptionsDescriptor), "sizeof mismatch for DawnShaderModuleSPIRVOptionsDescriptor"); + static_assert(alignof(DawnShaderModuleSPIRVOptionsDescriptor) == alignof(WGPUDawnShaderModuleSPIRVOptionsDescriptor), "alignof mismatch for DawnShaderModuleSPIRVOptionsDescriptor"); + + static_assert(offsetof(DawnShaderModuleSPIRVOptionsDescriptor, allowNonUniformDerivatives) == offsetof(WGPUDawnShaderModuleSPIRVOptionsDescriptor, allowNonUniformDerivatives), + "offsetof mismatch for DawnShaderModuleSPIRVOptionsDescriptor::allowNonUniformDerivatives"); + + // DawnTextureInternalUsageDescriptor + + static_assert(sizeof(DawnTextureInternalUsageDescriptor) == sizeof(WGPUDawnTextureInternalUsageDescriptor), "sizeof mismatch for DawnTextureInternalUsageDescriptor"); + static_assert(alignof(DawnTextureInternalUsageDescriptor) == alignof(WGPUDawnTextureInternalUsageDescriptor), "alignof mismatch for DawnTextureInternalUsageDescriptor"); + + static_assert(offsetof(DawnTextureInternalUsageDescriptor, internalUsage) == offsetof(WGPUDawnTextureInternalUsageDescriptor, internalUsage), + "offsetof mismatch for DawnTextureInternalUsageDescriptor::internalUsage"); + + // DawnTogglesDescriptor + + static_assert(sizeof(DawnTogglesDescriptor) == sizeof(WGPUDawnTogglesDescriptor), "sizeof mismatch for DawnTogglesDescriptor"); + static_assert(alignof(DawnTogglesDescriptor) == alignof(WGPUDawnTogglesDescriptor), "alignof mismatch for DawnTogglesDescriptor"); + + static_assert(offsetof(DawnTogglesDescriptor, enabledToggleCount) == offsetof(WGPUDawnTogglesDescriptor, enabledToggleCount), + "offsetof mismatch for DawnTogglesDescriptor::enabledToggleCount"); + static_assert(offsetof(DawnTogglesDescriptor, enabledToggles) == offsetof(WGPUDawnTogglesDescriptor, enabledToggles), + "offsetof mismatch for DawnTogglesDescriptor::enabledToggles"); + static_assert(offsetof(DawnTogglesDescriptor, disabledToggleCount) == offsetof(WGPUDawnTogglesDescriptor, disabledToggleCount), + "offsetof mismatch for DawnTogglesDescriptor::disabledToggleCount"); + static_assert(offsetof(DawnTogglesDescriptor, disabledToggles) == offsetof(WGPUDawnTogglesDescriptor, disabledToggles), + "offsetof mismatch for DawnTogglesDescriptor::disabledToggles"); + + // DawnWireWGSLControl + + static_assert(sizeof(DawnWireWGSLControl) == sizeof(WGPUDawnWireWGSLControl), "sizeof mismatch for DawnWireWGSLControl"); + static_assert(alignof(DawnWireWGSLControl) == alignof(WGPUDawnWireWGSLControl), "alignof mismatch for DawnWireWGSLControl"); + + static_assert(offsetof(DawnWireWGSLControl, enableExperimental) == offsetof(WGPUDawnWireWGSLControl, enableExperimental), + "offsetof mismatch for DawnWireWGSLControl::enableExperimental"); + static_assert(offsetof(DawnWireWGSLControl, enableUnsafe) == offsetof(WGPUDawnWireWGSLControl, enableUnsafe), + "offsetof mismatch for DawnWireWGSLControl::enableUnsafe"); + static_assert(offsetof(DawnWireWGSLControl, enableTesting) == offsetof(WGPUDawnWireWGSLControl, enableTesting), + "offsetof mismatch for DawnWireWGSLControl::enableTesting"); + + // DepthStencilStateDepthWriteDefinedDawn + + static_assert(sizeof(DepthStencilStateDepthWriteDefinedDawn) == sizeof(WGPUDepthStencilStateDepthWriteDefinedDawn), "sizeof mismatch for DepthStencilStateDepthWriteDefinedDawn"); + static_assert(alignof(DepthStencilStateDepthWriteDefinedDawn) == alignof(WGPUDepthStencilStateDepthWriteDefinedDawn), "alignof mismatch for DepthStencilStateDepthWriteDefinedDawn"); + + static_assert(offsetof(DepthStencilStateDepthWriteDefinedDawn, depthWriteDefined) == offsetof(WGPUDepthStencilStateDepthWriteDefinedDawn, depthWriteDefined), + "offsetof mismatch for DepthStencilStateDepthWriteDefinedDawn::depthWriteDefined"); + + // DrmFormatProperties + + static_assert(sizeof(DrmFormatProperties) == sizeof(WGPUDrmFormatProperties), "sizeof mismatch for DrmFormatProperties"); + static_assert(alignof(DrmFormatProperties) == alignof(WGPUDrmFormatProperties), "alignof mismatch for DrmFormatProperties"); + + static_assert(offsetof(DrmFormatProperties, modifier) == offsetof(WGPUDrmFormatProperties, modifier), + "offsetof mismatch for DrmFormatProperties::modifier"); + static_assert(offsetof(DrmFormatProperties, modifierPlaneCount) == offsetof(WGPUDrmFormatProperties, modifierPlaneCount), + "offsetof mismatch for DrmFormatProperties::modifierPlaneCount"); + + // Extent2D + + static_assert(sizeof(Extent2D) == sizeof(WGPUExtent2D), "sizeof mismatch for Extent2D"); + static_assert(alignof(Extent2D) == alignof(WGPUExtent2D), "alignof mismatch for Extent2D"); + + static_assert(offsetof(Extent2D, width) == offsetof(WGPUExtent2D, width), + "offsetof mismatch for Extent2D::width"); + static_assert(offsetof(Extent2D, height) == offsetof(WGPUExtent2D, height), + "offsetof mismatch for Extent2D::height"); + + // Extent3D + + static_assert(sizeof(Extent3D) == sizeof(WGPUExtent3D), "sizeof mismatch for Extent3D"); + static_assert(alignof(Extent3D) == alignof(WGPUExtent3D), "alignof mismatch for Extent3D"); + + static_assert(offsetof(Extent3D, width) == offsetof(WGPUExtent3D, width), + "offsetof mismatch for Extent3D::width"); + static_assert(offsetof(Extent3D, height) == offsetof(WGPUExtent3D, height), + "offsetof mismatch for Extent3D::height"); + static_assert(offsetof(Extent3D, depthOrArrayLayers) == offsetof(WGPUExtent3D, depthOrArrayLayers), + "offsetof mismatch for Extent3D::depthOrArrayLayers"); + + // ExternalTextureBindingEntry + + static_assert(sizeof(ExternalTextureBindingEntry) == sizeof(WGPUExternalTextureBindingEntry), "sizeof mismatch for ExternalTextureBindingEntry"); + static_assert(alignof(ExternalTextureBindingEntry) == alignof(WGPUExternalTextureBindingEntry), "alignof mismatch for ExternalTextureBindingEntry"); + + static_assert(offsetof(ExternalTextureBindingEntry, externalTexture) == offsetof(WGPUExternalTextureBindingEntry, externalTexture), + "offsetof mismatch for ExternalTextureBindingEntry::externalTexture"); + + // ExternalTextureBindingLayout + + static_assert(sizeof(ExternalTextureBindingLayout) == sizeof(WGPUExternalTextureBindingLayout), "sizeof mismatch for ExternalTextureBindingLayout"); + static_assert(alignof(ExternalTextureBindingLayout) == alignof(WGPUExternalTextureBindingLayout), "alignof mismatch for ExternalTextureBindingLayout"); + + + // FormatCapabilities + + static_assert(sizeof(FormatCapabilities) == sizeof(WGPUFormatCapabilities), "sizeof mismatch for FormatCapabilities"); + static_assert(alignof(FormatCapabilities) == alignof(WGPUFormatCapabilities), "alignof mismatch for FormatCapabilities"); + + static_assert(offsetof(FormatCapabilities, nextInChain) == offsetof(WGPUFormatCapabilities, nextInChain), + "offsetof mismatch for FormatCapabilities::nextInChain"); + + // Future + + static_assert(sizeof(Future) == sizeof(WGPUFuture), "sizeof mismatch for Future"); + static_assert(alignof(Future) == alignof(WGPUFuture), "alignof mismatch for Future"); + + static_assert(offsetof(Future, id) == offsetof(WGPUFuture, id), + "offsetof mismatch for Future::id"); + + // InstanceFeatures + + static_assert(sizeof(InstanceFeatures) == sizeof(WGPUInstanceFeatures), "sizeof mismatch for InstanceFeatures"); + static_assert(alignof(InstanceFeatures) == alignof(WGPUInstanceFeatures), "alignof mismatch for InstanceFeatures"); + + static_assert(offsetof(InstanceFeatures, nextInChain) == offsetof(WGPUInstanceFeatures, nextInChain), + "offsetof mismatch for InstanceFeatures::nextInChain"); + static_assert(offsetof(InstanceFeatures, timedWaitAnyEnable) == offsetof(WGPUInstanceFeatures, timedWaitAnyEnable), + "offsetof mismatch for InstanceFeatures::timedWaitAnyEnable"); + static_assert(offsetof(InstanceFeatures, timedWaitAnyMaxCount) == offsetof(WGPUInstanceFeatures, timedWaitAnyMaxCount), + "offsetof mismatch for InstanceFeatures::timedWaitAnyMaxCount"); + + // Limits + + static_assert(sizeof(Limits) == sizeof(WGPULimits), "sizeof mismatch for Limits"); + static_assert(alignof(Limits) == alignof(WGPULimits), "alignof mismatch for Limits"); + + static_assert(offsetof(Limits, maxTextureDimension1D) == offsetof(WGPULimits, maxTextureDimension1D), + "offsetof mismatch for Limits::maxTextureDimension1D"); + static_assert(offsetof(Limits, maxTextureDimension2D) == offsetof(WGPULimits, maxTextureDimension2D), + "offsetof mismatch for Limits::maxTextureDimension2D"); + static_assert(offsetof(Limits, maxTextureDimension3D) == offsetof(WGPULimits, maxTextureDimension3D), + "offsetof mismatch for Limits::maxTextureDimension3D"); + static_assert(offsetof(Limits, maxTextureArrayLayers) == offsetof(WGPULimits, maxTextureArrayLayers), + "offsetof mismatch for Limits::maxTextureArrayLayers"); + static_assert(offsetof(Limits, maxBindGroups) == offsetof(WGPULimits, maxBindGroups), + "offsetof mismatch for Limits::maxBindGroups"); + static_assert(offsetof(Limits, maxBindGroupsPlusVertexBuffers) == offsetof(WGPULimits, maxBindGroupsPlusVertexBuffers), + "offsetof mismatch for Limits::maxBindGroupsPlusVertexBuffers"); + static_assert(offsetof(Limits, maxBindingsPerBindGroup) == offsetof(WGPULimits, maxBindingsPerBindGroup), + "offsetof mismatch for Limits::maxBindingsPerBindGroup"); + static_assert(offsetof(Limits, maxDynamicUniformBuffersPerPipelineLayout) == offsetof(WGPULimits, maxDynamicUniformBuffersPerPipelineLayout), + "offsetof mismatch for Limits::maxDynamicUniformBuffersPerPipelineLayout"); + static_assert(offsetof(Limits, maxDynamicStorageBuffersPerPipelineLayout) == offsetof(WGPULimits, maxDynamicStorageBuffersPerPipelineLayout), + "offsetof mismatch for Limits::maxDynamicStorageBuffersPerPipelineLayout"); + static_assert(offsetof(Limits, maxSampledTexturesPerShaderStage) == offsetof(WGPULimits, maxSampledTexturesPerShaderStage), + "offsetof mismatch for Limits::maxSampledTexturesPerShaderStage"); + static_assert(offsetof(Limits, maxSamplersPerShaderStage) == offsetof(WGPULimits, maxSamplersPerShaderStage), + "offsetof mismatch for Limits::maxSamplersPerShaderStage"); + static_assert(offsetof(Limits, maxStorageBuffersPerShaderStage) == offsetof(WGPULimits, maxStorageBuffersPerShaderStage), + "offsetof mismatch for Limits::maxStorageBuffersPerShaderStage"); + static_assert(offsetof(Limits, maxStorageTexturesPerShaderStage) == offsetof(WGPULimits, maxStorageTexturesPerShaderStage), + "offsetof mismatch for Limits::maxStorageTexturesPerShaderStage"); + static_assert(offsetof(Limits, maxUniformBuffersPerShaderStage) == offsetof(WGPULimits, maxUniformBuffersPerShaderStage), + "offsetof mismatch for Limits::maxUniformBuffersPerShaderStage"); + static_assert(offsetof(Limits, maxUniformBufferBindingSize) == offsetof(WGPULimits, maxUniformBufferBindingSize), + "offsetof mismatch for Limits::maxUniformBufferBindingSize"); + static_assert(offsetof(Limits, maxStorageBufferBindingSize) == offsetof(WGPULimits, maxStorageBufferBindingSize), + "offsetof mismatch for Limits::maxStorageBufferBindingSize"); + static_assert(offsetof(Limits, minUniformBufferOffsetAlignment) == offsetof(WGPULimits, minUniformBufferOffsetAlignment), + "offsetof mismatch for Limits::minUniformBufferOffsetAlignment"); + static_assert(offsetof(Limits, minStorageBufferOffsetAlignment) == offsetof(WGPULimits, minStorageBufferOffsetAlignment), + "offsetof mismatch for Limits::minStorageBufferOffsetAlignment"); + static_assert(offsetof(Limits, maxVertexBuffers) == offsetof(WGPULimits, maxVertexBuffers), + "offsetof mismatch for Limits::maxVertexBuffers"); + static_assert(offsetof(Limits, maxBufferSize) == offsetof(WGPULimits, maxBufferSize), + "offsetof mismatch for Limits::maxBufferSize"); + static_assert(offsetof(Limits, maxVertexAttributes) == offsetof(WGPULimits, maxVertexAttributes), + "offsetof mismatch for Limits::maxVertexAttributes"); + static_assert(offsetof(Limits, maxVertexBufferArrayStride) == offsetof(WGPULimits, maxVertexBufferArrayStride), + "offsetof mismatch for Limits::maxVertexBufferArrayStride"); + static_assert(offsetof(Limits, maxInterStageShaderComponents) == offsetof(WGPULimits, maxInterStageShaderComponents), + "offsetof mismatch for Limits::maxInterStageShaderComponents"); + static_assert(offsetof(Limits, maxInterStageShaderVariables) == offsetof(WGPULimits, maxInterStageShaderVariables), + "offsetof mismatch for Limits::maxInterStageShaderVariables"); + static_assert(offsetof(Limits, maxColorAttachments) == offsetof(WGPULimits, maxColorAttachments), + "offsetof mismatch for Limits::maxColorAttachments"); + static_assert(offsetof(Limits, maxColorAttachmentBytesPerSample) == offsetof(WGPULimits, maxColorAttachmentBytesPerSample), + "offsetof mismatch for Limits::maxColorAttachmentBytesPerSample"); + static_assert(offsetof(Limits, maxComputeWorkgroupStorageSize) == offsetof(WGPULimits, maxComputeWorkgroupStorageSize), + "offsetof mismatch for Limits::maxComputeWorkgroupStorageSize"); + static_assert(offsetof(Limits, maxComputeInvocationsPerWorkgroup) == offsetof(WGPULimits, maxComputeInvocationsPerWorkgroup), + "offsetof mismatch for Limits::maxComputeInvocationsPerWorkgroup"); + static_assert(offsetof(Limits, maxComputeWorkgroupSizeX) == offsetof(WGPULimits, maxComputeWorkgroupSizeX), + "offsetof mismatch for Limits::maxComputeWorkgroupSizeX"); + static_assert(offsetof(Limits, maxComputeWorkgroupSizeY) == offsetof(WGPULimits, maxComputeWorkgroupSizeY), + "offsetof mismatch for Limits::maxComputeWorkgroupSizeY"); + static_assert(offsetof(Limits, maxComputeWorkgroupSizeZ) == offsetof(WGPULimits, maxComputeWorkgroupSizeZ), + "offsetof mismatch for Limits::maxComputeWorkgroupSizeZ"); + static_assert(offsetof(Limits, maxComputeWorkgroupsPerDimension) == offsetof(WGPULimits, maxComputeWorkgroupsPerDimension), + "offsetof mismatch for Limits::maxComputeWorkgroupsPerDimension"); + + // MemoryHeapInfo + + static_assert(sizeof(MemoryHeapInfo) == sizeof(WGPUMemoryHeapInfo), "sizeof mismatch for MemoryHeapInfo"); + static_assert(alignof(MemoryHeapInfo) == alignof(WGPUMemoryHeapInfo), "alignof mismatch for MemoryHeapInfo"); + + static_assert(offsetof(MemoryHeapInfo, properties) == offsetof(WGPUMemoryHeapInfo, properties), + "offsetof mismatch for MemoryHeapInfo::properties"); + static_assert(offsetof(MemoryHeapInfo, size) == offsetof(WGPUMemoryHeapInfo, size), + "offsetof mismatch for MemoryHeapInfo::size"); + + // MultisampleState + + static_assert(sizeof(MultisampleState) == sizeof(WGPUMultisampleState), "sizeof mismatch for MultisampleState"); + static_assert(alignof(MultisampleState) == alignof(WGPUMultisampleState), "alignof mismatch for MultisampleState"); + + static_assert(offsetof(MultisampleState, nextInChain) == offsetof(WGPUMultisampleState, nextInChain), + "offsetof mismatch for MultisampleState::nextInChain"); + static_assert(offsetof(MultisampleState, count) == offsetof(WGPUMultisampleState, count), + "offsetof mismatch for MultisampleState::count"); + static_assert(offsetof(MultisampleState, mask) == offsetof(WGPUMultisampleState, mask), + "offsetof mismatch for MultisampleState::mask"); + static_assert(offsetof(MultisampleState, alphaToCoverageEnabled) == offsetof(WGPUMultisampleState, alphaToCoverageEnabled), + "offsetof mismatch for MultisampleState::alphaToCoverageEnabled"); + + // Origin2D + + static_assert(sizeof(Origin2D) == sizeof(WGPUOrigin2D), "sizeof mismatch for Origin2D"); + static_assert(alignof(Origin2D) == alignof(WGPUOrigin2D), "alignof mismatch for Origin2D"); + + static_assert(offsetof(Origin2D, x) == offsetof(WGPUOrigin2D, x), + "offsetof mismatch for Origin2D::x"); + static_assert(offsetof(Origin2D, y) == offsetof(WGPUOrigin2D, y), + "offsetof mismatch for Origin2D::y"); + + // Origin3D + + static_assert(sizeof(Origin3D) == sizeof(WGPUOrigin3D), "sizeof mismatch for Origin3D"); + static_assert(alignof(Origin3D) == alignof(WGPUOrigin3D), "alignof mismatch for Origin3D"); + + static_assert(offsetof(Origin3D, x) == offsetof(WGPUOrigin3D, x), + "offsetof mismatch for Origin3D::x"); + static_assert(offsetof(Origin3D, y) == offsetof(WGPUOrigin3D, y), + "offsetof mismatch for Origin3D::y"); + static_assert(offsetof(Origin3D, z) == offsetof(WGPUOrigin3D, z), + "offsetof mismatch for Origin3D::z"); + + // PipelineLayoutDescriptor + + static_assert(sizeof(PipelineLayoutDescriptor) == sizeof(WGPUPipelineLayoutDescriptor), "sizeof mismatch for PipelineLayoutDescriptor"); + static_assert(alignof(PipelineLayoutDescriptor) == alignof(WGPUPipelineLayoutDescriptor), "alignof mismatch for PipelineLayoutDescriptor"); + + static_assert(offsetof(PipelineLayoutDescriptor, nextInChain) == offsetof(WGPUPipelineLayoutDescriptor, nextInChain), + "offsetof mismatch for PipelineLayoutDescriptor::nextInChain"); + static_assert(offsetof(PipelineLayoutDescriptor, label) == offsetof(WGPUPipelineLayoutDescriptor, label), + "offsetof mismatch for PipelineLayoutDescriptor::label"); + static_assert(offsetof(PipelineLayoutDescriptor, bindGroupLayoutCount) == offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayoutCount), + "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayoutCount"); + static_assert(offsetof(PipelineLayoutDescriptor, bindGroupLayouts) == offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayouts), + "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayouts"); + + // PipelineLayoutStorageAttachment + + static_assert(sizeof(PipelineLayoutStorageAttachment) == sizeof(WGPUPipelineLayoutStorageAttachment), "sizeof mismatch for PipelineLayoutStorageAttachment"); + static_assert(alignof(PipelineLayoutStorageAttachment) == alignof(WGPUPipelineLayoutStorageAttachment), "alignof mismatch for PipelineLayoutStorageAttachment"); + + static_assert(offsetof(PipelineLayoutStorageAttachment, nextInChain) == offsetof(WGPUPipelineLayoutStorageAttachment, nextInChain), + "offsetof mismatch for PipelineLayoutStorageAttachment::nextInChain"); + static_assert(offsetof(PipelineLayoutStorageAttachment, offset) == offsetof(WGPUPipelineLayoutStorageAttachment, offset), + "offsetof mismatch for PipelineLayoutStorageAttachment::offset"); + static_assert(offsetof(PipelineLayoutStorageAttachment, format) == offsetof(WGPUPipelineLayoutStorageAttachment, format), + "offsetof mismatch for PipelineLayoutStorageAttachment::format"); + + // PopErrorScopeCallbackInfo + + static_assert(sizeof(PopErrorScopeCallbackInfo) == sizeof(WGPUPopErrorScopeCallbackInfo), "sizeof mismatch for PopErrorScopeCallbackInfo"); + static_assert(alignof(PopErrorScopeCallbackInfo) == alignof(WGPUPopErrorScopeCallbackInfo), "alignof mismatch for PopErrorScopeCallbackInfo"); + + static_assert(offsetof(PopErrorScopeCallbackInfo, nextInChain) == offsetof(WGPUPopErrorScopeCallbackInfo, nextInChain), + "offsetof mismatch for PopErrorScopeCallbackInfo::nextInChain"); + static_assert(offsetof(PopErrorScopeCallbackInfo, mode) == offsetof(WGPUPopErrorScopeCallbackInfo, mode), + "offsetof mismatch for PopErrorScopeCallbackInfo::mode"); + static_assert(offsetof(PopErrorScopeCallbackInfo, callback) == offsetof(WGPUPopErrorScopeCallbackInfo, callback), + "offsetof mismatch for PopErrorScopeCallbackInfo::callback"); + static_assert(offsetof(PopErrorScopeCallbackInfo, oldCallback) == offsetof(WGPUPopErrorScopeCallbackInfo, oldCallback), + "offsetof mismatch for PopErrorScopeCallbackInfo::oldCallback"); + static_assert(offsetof(PopErrorScopeCallbackInfo, userdata) == offsetof(WGPUPopErrorScopeCallbackInfo, userdata), + "offsetof mismatch for PopErrorScopeCallbackInfo::userdata"); + + // PrimitiveDepthClipControl + + static_assert(sizeof(PrimitiveDepthClipControl) == sizeof(WGPUPrimitiveDepthClipControl), "sizeof mismatch for PrimitiveDepthClipControl"); + static_assert(alignof(PrimitiveDepthClipControl) == alignof(WGPUPrimitiveDepthClipControl), "alignof mismatch for PrimitiveDepthClipControl"); + + static_assert(offsetof(PrimitiveDepthClipControl, unclippedDepth) == offsetof(WGPUPrimitiveDepthClipControl, unclippedDepth), + "offsetof mismatch for PrimitiveDepthClipControl::unclippedDepth"); + + // PrimitiveState + + static_assert(sizeof(PrimitiveState) == sizeof(WGPUPrimitiveState), "sizeof mismatch for PrimitiveState"); + static_assert(alignof(PrimitiveState) == alignof(WGPUPrimitiveState), "alignof mismatch for PrimitiveState"); + + static_assert(offsetof(PrimitiveState, nextInChain) == offsetof(WGPUPrimitiveState, nextInChain), + "offsetof mismatch for PrimitiveState::nextInChain"); + static_assert(offsetof(PrimitiveState, topology) == offsetof(WGPUPrimitiveState, topology), + "offsetof mismatch for PrimitiveState::topology"); + static_assert(offsetof(PrimitiveState, stripIndexFormat) == offsetof(WGPUPrimitiveState, stripIndexFormat), + "offsetof mismatch for PrimitiveState::stripIndexFormat"); + static_assert(offsetof(PrimitiveState, frontFace) == offsetof(WGPUPrimitiveState, frontFace), + "offsetof mismatch for PrimitiveState::frontFace"); + static_assert(offsetof(PrimitiveState, cullMode) == offsetof(WGPUPrimitiveState, cullMode), + "offsetof mismatch for PrimitiveState::cullMode"); + + // QuerySetDescriptor + + static_assert(sizeof(QuerySetDescriptor) == sizeof(WGPUQuerySetDescriptor), "sizeof mismatch for QuerySetDescriptor"); + static_assert(alignof(QuerySetDescriptor) == alignof(WGPUQuerySetDescriptor), "alignof mismatch for QuerySetDescriptor"); + + static_assert(offsetof(QuerySetDescriptor, nextInChain) == offsetof(WGPUQuerySetDescriptor, nextInChain), + "offsetof mismatch for QuerySetDescriptor::nextInChain"); + static_assert(offsetof(QuerySetDescriptor, label) == offsetof(WGPUQuerySetDescriptor, label), + "offsetof mismatch for QuerySetDescriptor::label"); + static_assert(offsetof(QuerySetDescriptor, type) == offsetof(WGPUQuerySetDescriptor, type), + "offsetof mismatch for QuerySetDescriptor::type"); + static_assert(offsetof(QuerySetDescriptor, count) == offsetof(WGPUQuerySetDescriptor, count), + "offsetof mismatch for QuerySetDescriptor::count"); + + // QueueDescriptor + + static_assert(sizeof(QueueDescriptor) == sizeof(WGPUQueueDescriptor), "sizeof mismatch for QueueDescriptor"); + static_assert(alignof(QueueDescriptor) == alignof(WGPUQueueDescriptor), "alignof mismatch for QueueDescriptor"); + + static_assert(offsetof(QueueDescriptor, nextInChain) == offsetof(WGPUQueueDescriptor, nextInChain), + "offsetof mismatch for QueueDescriptor::nextInChain"); + static_assert(offsetof(QueueDescriptor, label) == offsetof(WGPUQueueDescriptor, label), + "offsetof mismatch for QueueDescriptor::label"); + + // QueueWorkDoneCallbackInfo + + static_assert(sizeof(QueueWorkDoneCallbackInfo) == sizeof(WGPUQueueWorkDoneCallbackInfo), "sizeof mismatch for QueueWorkDoneCallbackInfo"); + static_assert(alignof(QueueWorkDoneCallbackInfo) == alignof(WGPUQueueWorkDoneCallbackInfo), "alignof mismatch for QueueWorkDoneCallbackInfo"); + + static_assert(offsetof(QueueWorkDoneCallbackInfo, nextInChain) == offsetof(WGPUQueueWorkDoneCallbackInfo, nextInChain), + "offsetof mismatch for QueueWorkDoneCallbackInfo::nextInChain"); + static_assert(offsetof(QueueWorkDoneCallbackInfo, mode) == offsetof(WGPUQueueWorkDoneCallbackInfo, mode), + "offsetof mismatch for QueueWorkDoneCallbackInfo::mode"); + static_assert(offsetof(QueueWorkDoneCallbackInfo, callback) == offsetof(WGPUQueueWorkDoneCallbackInfo, callback), + "offsetof mismatch for QueueWorkDoneCallbackInfo::callback"); + static_assert(offsetof(QueueWorkDoneCallbackInfo, userdata) == offsetof(WGPUQueueWorkDoneCallbackInfo, userdata), + "offsetof mismatch for QueueWorkDoneCallbackInfo::userdata"); + + // RenderBundleDescriptor + + static_assert(sizeof(RenderBundleDescriptor) == sizeof(WGPURenderBundleDescriptor), "sizeof mismatch for RenderBundleDescriptor"); + static_assert(alignof(RenderBundleDescriptor) == alignof(WGPURenderBundleDescriptor), "alignof mismatch for RenderBundleDescriptor"); + + static_assert(offsetof(RenderBundleDescriptor, nextInChain) == offsetof(WGPURenderBundleDescriptor, nextInChain), + "offsetof mismatch for RenderBundleDescriptor::nextInChain"); + static_assert(offsetof(RenderBundleDescriptor, label) == offsetof(WGPURenderBundleDescriptor, label), + "offsetof mismatch for RenderBundleDescriptor::label"); + + // RenderBundleEncoderDescriptor + + static_assert(sizeof(RenderBundleEncoderDescriptor) == sizeof(WGPURenderBundleEncoderDescriptor), "sizeof mismatch for RenderBundleEncoderDescriptor"); + static_assert(alignof(RenderBundleEncoderDescriptor) == alignof(WGPURenderBundleEncoderDescriptor), "alignof mismatch for RenderBundleEncoderDescriptor"); + + static_assert(offsetof(RenderBundleEncoderDescriptor, nextInChain) == offsetof(WGPURenderBundleEncoderDescriptor, nextInChain), + "offsetof mismatch for RenderBundleEncoderDescriptor::nextInChain"); + static_assert(offsetof(RenderBundleEncoderDescriptor, label) == offsetof(WGPURenderBundleEncoderDescriptor, label), + "offsetof mismatch for RenderBundleEncoderDescriptor::label"); + static_assert(offsetof(RenderBundleEncoderDescriptor, colorFormatCount) == offsetof(WGPURenderBundleEncoderDescriptor, colorFormatCount), + "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormatCount"); + static_assert(offsetof(RenderBundleEncoderDescriptor, colorFormats) == offsetof(WGPURenderBundleEncoderDescriptor, colorFormats), + "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormats"); + static_assert(offsetof(RenderBundleEncoderDescriptor, depthStencilFormat) == offsetof(WGPURenderBundleEncoderDescriptor, depthStencilFormat), + "offsetof mismatch for RenderBundleEncoderDescriptor::depthStencilFormat"); + static_assert(offsetof(RenderBundleEncoderDescriptor, sampleCount) == offsetof(WGPURenderBundleEncoderDescriptor, sampleCount), + "offsetof mismatch for RenderBundleEncoderDescriptor::sampleCount"); + static_assert(offsetof(RenderBundleEncoderDescriptor, depthReadOnly) == offsetof(WGPURenderBundleEncoderDescriptor, depthReadOnly), + "offsetof mismatch for RenderBundleEncoderDescriptor::depthReadOnly"); + static_assert(offsetof(RenderBundleEncoderDescriptor, stencilReadOnly) == offsetof(WGPURenderBundleEncoderDescriptor, stencilReadOnly), + "offsetof mismatch for RenderBundleEncoderDescriptor::stencilReadOnly"); + + // RenderPassDepthStencilAttachment + + static_assert(sizeof(RenderPassDepthStencilAttachment) == sizeof(WGPURenderPassDepthStencilAttachment), "sizeof mismatch for RenderPassDepthStencilAttachment"); + static_assert(alignof(RenderPassDepthStencilAttachment) == alignof(WGPURenderPassDepthStencilAttachment), "alignof mismatch for RenderPassDepthStencilAttachment"); + + static_assert(offsetof(RenderPassDepthStencilAttachment, view) == offsetof(WGPURenderPassDepthStencilAttachment, view), + "offsetof mismatch for RenderPassDepthStencilAttachment::view"); + static_assert(offsetof(RenderPassDepthStencilAttachment, depthLoadOp) == offsetof(WGPURenderPassDepthStencilAttachment, depthLoadOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthLoadOp"); + static_assert(offsetof(RenderPassDepthStencilAttachment, depthStoreOp) == offsetof(WGPURenderPassDepthStencilAttachment, depthStoreOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthStoreOp"); + static_assert(offsetof(RenderPassDepthStencilAttachment, depthClearValue) == offsetof(WGPURenderPassDepthStencilAttachment, depthClearValue), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthClearValue"); + static_assert(offsetof(RenderPassDepthStencilAttachment, depthReadOnly) == offsetof(WGPURenderPassDepthStencilAttachment, depthReadOnly), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthReadOnly"); + static_assert(offsetof(RenderPassDepthStencilAttachment, stencilLoadOp) == offsetof(WGPURenderPassDepthStencilAttachment, stencilLoadOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilLoadOp"); + static_assert(offsetof(RenderPassDepthStencilAttachment, stencilStoreOp) == offsetof(WGPURenderPassDepthStencilAttachment, stencilStoreOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilStoreOp"); + static_assert(offsetof(RenderPassDepthStencilAttachment, stencilClearValue) == offsetof(WGPURenderPassDepthStencilAttachment, stencilClearValue), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilClearValue"); + static_assert(offsetof(RenderPassDepthStencilAttachment, stencilReadOnly) == offsetof(WGPURenderPassDepthStencilAttachment, stencilReadOnly), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilReadOnly"); + + // RenderPassDescriptorMaxDrawCount + + static_assert(sizeof(RenderPassDescriptorMaxDrawCount) == sizeof(WGPURenderPassDescriptorMaxDrawCount), "sizeof mismatch for RenderPassDescriptorMaxDrawCount"); + static_assert(alignof(RenderPassDescriptorMaxDrawCount) == alignof(WGPURenderPassDescriptorMaxDrawCount), "alignof mismatch for RenderPassDescriptorMaxDrawCount"); + + static_assert(offsetof(RenderPassDescriptorMaxDrawCount, maxDrawCount) == offsetof(WGPURenderPassDescriptorMaxDrawCount, maxDrawCount), + "offsetof mismatch for RenderPassDescriptorMaxDrawCount::maxDrawCount"); + + // RenderPassTimestampWrites + + static_assert(sizeof(RenderPassTimestampWrites) == sizeof(WGPURenderPassTimestampWrites), "sizeof mismatch for RenderPassTimestampWrites"); + static_assert(alignof(RenderPassTimestampWrites) == alignof(WGPURenderPassTimestampWrites), "alignof mismatch for RenderPassTimestampWrites"); + + static_assert(offsetof(RenderPassTimestampWrites, querySet) == offsetof(WGPURenderPassTimestampWrites, querySet), + "offsetof mismatch for RenderPassTimestampWrites::querySet"); + static_assert(offsetof(RenderPassTimestampWrites, beginningOfPassWriteIndex) == offsetof(WGPURenderPassTimestampWrites, beginningOfPassWriteIndex), + "offsetof mismatch for RenderPassTimestampWrites::beginningOfPassWriteIndex"); + static_assert(offsetof(RenderPassTimestampWrites, endOfPassWriteIndex) == offsetof(WGPURenderPassTimestampWrites, endOfPassWriteIndex), + "offsetof mismatch for RenderPassTimestampWrites::endOfPassWriteIndex"); + + // RequestAdapterCallbackInfo + + static_assert(sizeof(RequestAdapterCallbackInfo) == sizeof(WGPURequestAdapterCallbackInfo), "sizeof mismatch for RequestAdapterCallbackInfo"); + static_assert(alignof(RequestAdapterCallbackInfo) == alignof(WGPURequestAdapterCallbackInfo), "alignof mismatch for RequestAdapterCallbackInfo"); + + static_assert(offsetof(RequestAdapterCallbackInfo, nextInChain) == offsetof(WGPURequestAdapterCallbackInfo, nextInChain), + "offsetof mismatch for RequestAdapterCallbackInfo::nextInChain"); + static_assert(offsetof(RequestAdapterCallbackInfo, mode) == offsetof(WGPURequestAdapterCallbackInfo, mode), + "offsetof mismatch for RequestAdapterCallbackInfo::mode"); + static_assert(offsetof(RequestAdapterCallbackInfo, callback) == offsetof(WGPURequestAdapterCallbackInfo, callback), + "offsetof mismatch for RequestAdapterCallbackInfo::callback"); + static_assert(offsetof(RequestAdapterCallbackInfo, userdata) == offsetof(WGPURequestAdapterCallbackInfo, userdata), + "offsetof mismatch for RequestAdapterCallbackInfo::userdata"); + + // RequestAdapterOptions + + static_assert(sizeof(RequestAdapterOptions) == sizeof(WGPURequestAdapterOptions), "sizeof mismatch for RequestAdapterOptions"); + static_assert(alignof(RequestAdapterOptions) == alignof(WGPURequestAdapterOptions), "alignof mismatch for RequestAdapterOptions"); + + static_assert(offsetof(RequestAdapterOptions, nextInChain) == offsetof(WGPURequestAdapterOptions, nextInChain), + "offsetof mismatch for RequestAdapterOptions::nextInChain"); + static_assert(offsetof(RequestAdapterOptions, compatibleSurface) == offsetof(WGPURequestAdapterOptions, compatibleSurface), + "offsetof mismatch for RequestAdapterOptions::compatibleSurface"); + static_assert(offsetof(RequestAdapterOptions, powerPreference) == offsetof(WGPURequestAdapterOptions, powerPreference), + "offsetof mismatch for RequestAdapterOptions::powerPreference"); + static_assert(offsetof(RequestAdapterOptions, backendType) == offsetof(WGPURequestAdapterOptions, backendType), + "offsetof mismatch for RequestAdapterOptions::backendType"); + static_assert(offsetof(RequestAdapterOptions, forceFallbackAdapter) == offsetof(WGPURequestAdapterOptions, forceFallbackAdapter), + "offsetof mismatch for RequestAdapterOptions::forceFallbackAdapter"); + static_assert(offsetof(RequestAdapterOptions, compatibilityMode) == offsetof(WGPURequestAdapterOptions, compatibilityMode), + "offsetof mismatch for RequestAdapterOptions::compatibilityMode"); + + // RequestDeviceCallbackInfo + + static_assert(sizeof(RequestDeviceCallbackInfo) == sizeof(WGPURequestDeviceCallbackInfo), "sizeof mismatch for RequestDeviceCallbackInfo"); + static_assert(alignof(RequestDeviceCallbackInfo) == alignof(WGPURequestDeviceCallbackInfo), "alignof mismatch for RequestDeviceCallbackInfo"); + + static_assert(offsetof(RequestDeviceCallbackInfo, nextInChain) == offsetof(WGPURequestDeviceCallbackInfo, nextInChain), + "offsetof mismatch for RequestDeviceCallbackInfo::nextInChain"); + static_assert(offsetof(RequestDeviceCallbackInfo, mode) == offsetof(WGPURequestDeviceCallbackInfo, mode), + "offsetof mismatch for RequestDeviceCallbackInfo::mode"); + static_assert(offsetof(RequestDeviceCallbackInfo, callback) == offsetof(WGPURequestDeviceCallbackInfo, callback), + "offsetof mismatch for RequestDeviceCallbackInfo::callback"); + static_assert(offsetof(RequestDeviceCallbackInfo, userdata) == offsetof(WGPURequestDeviceCallbackInfo, userdata), + "offsetof mismatch for RequestDeviceCallbackInfo::userdata"); + + // SamplerBindingLayout + + static_assert(sizeof(SamplerBindingLayout) == sizeof(WGPUSamplerBindingLayout), "sizeof mismatch for SamplerBindingLayout"); + static_assert(alignof(SamplerBindingLayout) == alignof(WGPUSamplerBindingLayout), "alignof mismatch for SamplerBindingLayout"); + + static_assert(offsetof(SamplerBindingLayout, nextInChain) == offsetof(WGPUSamplerBindingLayout, nextInChain), + "offsetof mismatch for SamplerBindingLayout::nextInChain"); + static_assert(offsetof(SamplerBindingLayout, type) == offsetof(WGPUSamplerBindingLayout, type), + "offsetof mismatch for SamplerBindingLayout::type"); + + // SamplerDescriptor + + static_assert(sizeof(SamplerDescriptor) == sizeof(WGPUSamplerDescriptor), "sizeof mismatch for SamplerDescriptor"); + static_assert(alignof(SamplerDescriptor) == alignof(WGPUSamplerDescriptor), "alignof mismatch for SamplerDescriptor"); + + static_assert(offsetof(SamplerDescriptor, nextInChain) == offsetof(WGPUSamplerDescriptor, nextInChain), + "offsetof mismatch for SamplerDescriptor::nextInChain"); + static_assert(offsetof(SamplerDescriptor, label) == offsetof(WGPUSamplerDescriptor, label), + "offsetof mismatch for SamplerDescriptor::label"); + static_assert(offsetof(SamplerDescriptor, addressModeU) == offsetof(WGPUSamplerDescriptor, addressModeU), + "offsetof mismatch for SamplerDescriptor::addressModeU"); + static_assert(offsetof(SamplerDescriptor, addressModeV) == offsetof(WGPUSamplerDescriptor, addressModeV), + "offsetof mismatch for SamplerDescriptor::addressModeV"); + static_assert(offsetof(SamplerDescriptor, addressModeW) == offsetof(WGPUSamplerDescriptor, addressModeW), + "offsetof mismatch for SamplerDescriptor::addressModeW"); + static_assert(offsetof(SamplerDescriptor, magFilter) == offsetof(WGPUSamplerDescriptor, magFilter), + "offsetof mismatch for SamplerDescriptor::magFilter"); + static_assert(offsetof(SamplerDescriptor, minFilter) == offsetof(WGPUSamplerDescriptor, minFilter), + "offsetof mismatch for SamplerDescriptor::minFilter"); + static_assert(offsetof(SamplerDescriptor, mipmapFilter) == offsetof(WGPUSamplerDescriptor, mipmapFilter), + "offsetof mismatch for SamplerDescriptor::mipmapFilter"); + static_assert(offsetof(SamplerDescriptor, lodMinClamp) == offsetof(WGPUSamplerDescriptor, lodMinClamp), + "offsetof mismatch for SamplerDescriptor::lodMinClamp"); + static_assert(offsetof(SamplerDescriptor, lodMaxClamp) == offsetof(WGPUSamplerDescriptor, lodMaxClamp), + "offsetof mismatch for SamplerDescriptor::lodMaxClamp"); + static_assert(offsetof(SamplerDescriptor, compare) == offsetof(WGPUSamplerDescriptor, compare), + "offsetof mismatch for SamplerDescriptor::compare"); + static_assert(offsetof(SamplerDescriptor, maxAnisotropy) == offsetof(WGPUSamplerDescriptor, maxAnisotropy), + "offsetof mismatch for SamplerDescriptor::maxAnisotropy"); + + // ShaderModuleSPIRVDescriptor + + static_assert(sizeof(ShaderModuleSPIRVDescriptor) == sizeof(WGPUShaderModuleSPIRVDescriptor), "sizeof mismatch for ShaderModuleSPIRVDescriptor"); + static_assert(alignof(ShaderModuleSPIRVDescriptor) == alignof(WGPUShaderModuleSPIRVDescriptor), "alignof mismatch for ShaderModuleSPIRVDescriptor"); + + static_assert(offsetof(ShaderModuleSPIRVDescriptor, codeSize) == offsetof(WGPUShaderModuleSPIRVDescriptor, codeSize), + "offsetof mismatch for ShaderModuleSPIRVDescriptor::codeSize"); + static_assert(offsetof(ShaderModuleSPIRVDescriptor, code) == offsetof(WGPUShaderModuleSPIRVDescriptor, code), + "offsetof mismatch for ShaderModuleSPIRVDescriptor::code"); + + // ShaderModuleWGSLDescriptor + + static_assert(sizeof(ShaderModuleWGSLDescriptor) == sizeof(WGPUShaderModuleWGSLDescriptor), "sizeof mismatch for ShaderModuleWGSLDescriptor"); + static_assert(alignof(ShaderModuleWGSLDescriptor) == alignof(WGPUShaderModuleWGSLDescriptor), "alignof mismatch for ShaderModuleWGSLDescriptor"); + + static_assert(offsetof(ShaderModuleWGSLDescriptor, code) == offsetof(WGPUShaderModuleWGSLDescriptor, code), + "offsetof mismatch for ShaderModuleWGSLDescriptor::code"); + + // ShaderModuleDescriptor + + static_assert(sizeof(ShaderModuleDescriptor) == sizeof(WGPUShaderModuleDescriptor), "sizeof mismatch for ShaderModuleDescriptor"); + static_assert(alignof(ShaderModuleDescriptor) == alignof(WGPUShaderModuleDescriptor), "alignof mismatch for ShaderModuleDescriptor"); + + static_assert(offsetof(ShaderModuleDescriptor, nextInChain) == offsetof(WGPUShaderModuleDescriptor, nextInChain), + "offsetof mismatch for ShaderModuleDescriptor::nextInChain"); + static_assert(offsetof(ShaderModuleDescriptor, label) == offsetof(WGPUShaderModuleDescriptor, label), + "offsetof mismatch for ShaderModuleDescriptor::label"); + + // SharedBufferMemoryBeginAccessDescriptor + + static_assert(sizeof(SharedBufferMemoryBeginAccessDescriptor) == sizeof(WGPUSharedBufferMemoryBeginAccessDescriptor), "sizeof mismatch for SharedBufferMemoryBeginAccessDescriptor"); + static_assert(alignof(SharedBufferMemoryBeginAccessDescriptor) == alignof(WGPUSharedBufferMemoryBeginAccessDescriptor), "alignof mismatch for SharedBufferMemoryBeginAccessDescriptor"); + + static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, nextInChain) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, nextInChain), + "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::nextInChain"); + static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, initialized) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, initialized), + "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::initialized"); + static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, fenceCount) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, fenceCount), + "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::fenceCount"); + static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, fences) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, fences), + "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::fences"); + static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, signaledValues) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, signaledValues), + "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::signaledValues"); + + // SharedBufferMemoryDescriptor + + static_assert(sizeof(SharedBufferMemoryDescriptor) == sizeof(WGPUSharedBufferMemoryDescriptor), "sizeof mismatch for SharedBufferMemoryDescriptor"); + static_assert(alignof(SharedBufferMemoryDescriptor) == alignof(WGPUSharedBufferMemoryDescriptor), "alignof mismatch for SharedBufferMemoryDescriptor"); + + static_assert(offsetof(SharedBufferMemoryDescriptor, nextInChain) == offsetof(WGPUSharedBufferMemoryDescriptor, nextInChain), + "offsetof mismatch for SharedBufferMemoryDescriptor::nextInChain"); + static_assert(offsetof(SharedBufferMemoryDescriptor, label) == offsetof(WGPUSharedBufferMemoryDescriptor, label), + "offsetof mismatch for SharedBufferMemoryDescriptor::label"); + + // SharedBufferMemoryEndAccessState + + static_assert(sizeof(SharedBufferMemoryEndAccessState) == sizeof(WGPUSharedBufferMemoryEndAccessState), "sizeof mismatch for SharedBufferMemoryEndAccessState"); + static_assert(alignof(SharedBufferMemoryEndAccessState) == alignof(WGPUSharedBufferMemoryEndAccessState), "alignof mismatch for SharedBufferMemoryEndAccessState"); + + static_assert(offsetof(SharedBufferMemoryEndAccessState, nextInChain) == offsetof(WGPUSharedBufferMemoryEndAccessState, nextInChain), + "offsetof mismatch for SharedBufferMemoryEndAccessState::nextInChain"); + static_assert(offsetof(SharedBufferMemoryEndAccessState, initialized) == offsetof(WGPUSharedBufferMemoryEndAccessState, initialized), + "offsetof mismatch for SharedBufferMemoryEndAccessState::initialized"); + static_assert(offsetof(SharedBufferMemoryEndAccessState, fenceCount) == offsetof(WGPUSharedBufferMemoryEndAccessState, fenceCount), + "offsetof mismatch for SharedBufferMemoryEndAccessState::fenceCount"); + static_assert(offsetof(SharedBufferMemoryEndAccessState, fences) == offsetof(WGPUSharedBufferMemoryEndAccessState, fences), + "offsetof mismatch for SharedBufferMemoryEndAccessState::fences"); + static_assert(offsetof(SharedBufferMemoryEndAccessState, signaledValues) == offsetof(WGPUSharedBufferMemoryEndAccessState, signaledValues), + "offsetof mismatch for SharedBufferMemoryEndAccessState::signaledValues"); + + // SharedBufferMemoryProperties + + static_assert(sizeof(SharedBufferMemoryProperties) == sizeof(WGPUSharedBufferMemoryProperties), "sizeof mismatch for SharedBufferMemoryProperties"); + static_assert(alignof(SharedBufferMemoryProperties) == alignof(WGPUSharedBufferMemoryProperties), "alignof mismatch for SharedBufferMemoryProperties"); + + static_assert(offsetof(SharedBufferMemoryProperties, nextInChain) == offsetof(WGPUSharedBufferMemoryProperties, nextInChain), + "offsetof mismatch for SharedBufferMemoryProperties::nextInChain"); + static_assert(offsetof(SharedBufferMemoryProperties, usage) == offsetof(WGPUSharedBufferMemoryProperties, usage), + "offsetof mismatch for SharedBufferMemoryProperties::usage"); + static_assert(offsetof(SharedBufferMemoryProperties, size) == offsetof(WGPUSharedBufferMemoryProperties, size), + "offsetof mismatch for SharedBufferMemoryProperties::size"); + + // SharedFenceDXGISharedHandleDescriptor + + static_assert(sizeof(SharedFenceDXGISharedHandleDescriptor) == sizeof(WGPUSharedFenceDXGISharedHandleDescriptor), "sizeof mismatch for SharedFenceDXGISharedHandleDescriptor"); + static_assert(alignof(SharedFenceDXGISharedHandleDescriptor) == alignof(WGPUSharedFenceDXGISharedHandleDescriptor), "alignof mismatch for SharedFenceDXGISharedHandleDescriptor"); + + static_assert(offsetof(SharedFenceDXGISharedHandleDescriptor, handle) == offsetof(WGPUSharedFenceDXGISharedHandleDescriptor, handle), + "offsetof mismatch for SharedFenceDXGISharedHandleDescriptor::handle"); + + // SharedFenceDXGISharedHandleExportInfo + + static_assert(sizeof(SharedFenceDXGISharedHandleExportInfo) == sizeof(WGPUSharedFenceDXGISharedHandleExportInfo), "sizeof mismatch for SharedFenceDXGISharedHandleExportInfo"); + static_assert(alignof(SharedFenceDXGISharedHandleExportInfo) == alignof(WGPUSharedFenceDXGISharedHandleExportInfo), "alignof mismatch for SharedFenceDXGISharedHandleExportInfo"); + + static_assert(offsetof(SharedFenceDXGISharedHandleExportInfo, handle) == offsetof(WGPUSharedFenceDXGISharedHandleExportInfo, handle), + "offsetof mismatch for SharedFenceDXGISharedHandleExportInfo::handle"); + + // SharedFenceMTLSharedEventDescriptor + + static_assert(sizeof(SharedFenceMTLSharedEventDescriptor) == sizeof(WGPUSharedFenceMTLSharedEventDescriptor), "sizeof mismatch for SharedFenceMTLSharedEventDescriptor"); + static_assert(alignof(SharedFenceMTLSharedEventDescriptor) == alignof(WGPUSharedFenceMTLSharedEventDescriptor), "alignof mismatch for SharedFenceMTLSharedEventDescriptor"); + + static_assert(offsetof(SharedFenceMTLSharedEventDescriptor, sharedEvent) == offsetof(WGPUSharedFenceMTLSharedEventDescriptor, sharedEvent), + "offsetof mismatch for SharedFenceMTLSharedEventDescriptor::sharedEvent"); + + // SharedFenceMTLSharedEventExportInfo + + static_assert(sizeof(SharedFenceMTLSharedEventExportInfo) == sizeof(WGPUSharedFenceMTLSharedEventExportInfo), "sizeof mismatch for SharedFenceMTLSharedEventExportInfo"); + static_assert(alignof(SharedFenceMTLSharedEventExportInfo) == alignof(WGPUSharedFenceMTLSharedEventExportInfo), "alignof mismatch for SharedFenceMTLSharedEventExportInfo"); + + static_assert(offsetof(SharedFenceMTLSharedEventExportInfo, sharedEvent) == offsetof(WGPUSharedFenceMTLSharedEventExportInfo, sharedEvent), + "offsetof mismatch for SharedFenceMTLSharedEventExportInfo::sharedEvent"); + + // SharedFenceDescriptor + + static_assert(sizeof(SharedFenceDescriptor) == sizeof(WGPUSharedFenceDescriptor), "sizeof mismatch for SharedFenceDescriptor"); + static_assert(alignof(SharedFenceDescriptor) == alignof(WGPUSharedFenceDescriptor), "alignof mismatch for SharedFenceDescriptor"); + + static_assert(offsetof(SharedFenceDescriptor, nextInChain) == offsetof(WGPUSharedFenceDescriptor, nextInChain), + "offsetof mismatch for SharedFenceDescriptor::nextInChain"); + static_assert(offsetof(SharedFenceDescriptor, label) == offsetof(WGPUSharedFenceDescriptor, label), + "offsetof mismatch for SharedFenceDescriptor::label"); + + // SharedFenceExportInfo + + static_assert(sizeof(SharedFenceExportInfo) == sizeof(WGPUSharedFenceExportInfo), "sizeof mismatch for SharedFenceExportInfo"); + static_assert(alignof(SharedFenceExportInfo) == alignof(WGPUSharedFenceExportInfo), "alignof mismatch for SharedFenceExportInfo"); + + static_assert(offsetof(SharedFenceExportInfo, nextInChain) == offsetof(WGPUSharedFenceExportInfo, nextInChain), + "offsetof mismatch for SharedFenceExportInfo::nextInChain"); + static_assert(offsetof(SharedFenceExportInfo, type) == offsetof(WGPUSharedFenceExportInfo, type), + "offsetof mismatch for SharedFenceExportInfo::type"); + + // SharedFenceVkSemaphoreOpaqueFDDescriptor + + static_assert(sizeof(SharedFenceVkSemaphoreOpaqueFDDescriptor) == sizeof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor), "sizeof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor"); + static_assert(alignof(SharedFenceVkSemaphoreOpaqueFDDescriptor) == alignof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor), "alignof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor"); + + static_assert(offsetof(SharedFenceVkSemaphoreOpaqueFDDescriptor, handle) == offsetof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor, handle), + "offsetof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor::handle"); + + // SharedFenceVkSemaphoreOpaqueFDExportInfo + + static_assert(sizeof(SharedFenceVkSemaphoreOpaqueFDExportInfo) == sizeof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo), "sizeof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo"); + static_assert(alignof(SharedFenceVkSemaphoreOpaqueFDExportInfo) == alignof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo), "alignof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo"); + + static_assert(offsetof(SharedFenceVkSemaphoreOpaqueFDExportInfo, handle) == offsetof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo, handle), + "offsetof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo::handle"); + + // SharedFenceVkSemaphoreSyncFDDescriptor + + static_assert(sizeof(SharedFenceVkSemaphoreSyncFDDescriptor) == sizeof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor), "sizeof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor"); + static_assert(alignof(SharedFenceVkSemaphoreSyncFDDescriptor) == alignof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor), "alignof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor"); + + static_assert(offsetof(SharedFenceVkSemaphoreSyncFDDescriptor, handle) == offsetof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor, handle), + "offsetof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor::handle"); + + // SharedFenceVkSemaphoreSyncFDExportInfo + + static_assert(sizeof(SharedFenceVkSemaphoreSyncFDExportInfo) == sizeof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo), "sizeof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo"); + static_assert(alignof(SharedFenceVkSemaphoreSyncFDExportInfo) == alignof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo), "alignof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo"); + + static_assert(offsetof(SharedFenceVkSemaphoreSyncFDExportInfo, handle) == offsetof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo, handle), + "offsetof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo::handle"); + + // SharedFenceVkSemaphoreZirconHandleDescriptor + + static_assert(sizeof(SharedFenceVkSemaphoreZirconHandleDescriptor) == sizeof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor), "sizeof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor"); + static_assert(alignof(SharedFenceVkSemaphoreZirconHandleDescriptor) == alignof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor), "alignof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor"); + + static_assert(offsetof(SharedFenceVkSemaphoreZirconHandleDescriptor, handle) == offsetof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor, handle), + "offsetof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor::handle"); + + // SharedFenceVkSemaphoreZirconHandleExportInfo + + static_assert(sizeof(SharedFenceVkSemaphoreZirconHandleExportInfo) == sizeof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo), "sizeof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo"); + static_assert(alignof(SharedFenceVkSemaphoreZirconHandleExportInfo) == alignof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo), "alignof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo"); + + static_assert(offsetof(SharedFenceVkSemaphoreZirconHandleExportInfo, handle) == offsetof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo, handle), + "offsetof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo::handle"); + + // SharedTextureMemoryDXGISharedHandleDescriptor + + static_assert(sizeof(SharedTextureMemoryDXGISharedHandleDescriptor) == sizeof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor), "sizeof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor"); + static_assert(alignof(SharedTextureMemoryDXGISharedHandleDescriptor) == alignof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor), "alignof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor"); + + static_assert(offsetof(SharedTextureMemoryDXGISharedHandleDescriptor, handle) == offsetof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, handle), + "offsetof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor::handle"); + static_assert(offsetof(SharedTextureMemoryDXGISharedHandleDescriptor, useKeyedMutex) == offsetof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, useKeyedMutex), + "offsetof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor::useKeyedMutex"); + + // SharedTextureMemoryEGLImageDescriptor + + static_assert(sizeof(SharedTextureMemoryEGLImageDescriptor) == sizeof(WGPUSharedTextureMemoryEGLImageDescriptor), "sizeof mismatch for SharedTextureMemoryEGLImageDescriptor"); + static_assert(alignof(SharedTextureMemoryEGLImageDescriptor) == alignof(WGPUSharedTextureMemoryEGLImageDescriptor), "alignof mismatch for SharedTextureMemoryEGLImageDescriptor"); + + static_assert(offsetof(SharedTextureMemoryEGLImageDescriptor, image) == offsetof(WGPUSharedTextureMemoryEGLImageDescriptor, image), + "offsetof mismatch for SharedTextureMemoryEGLImageDescriptor::image"); + + // SharedTextureMemoryIOSurfaceDescriptor + + static_assert(sizeof(SharedTextureMemoryIOSurfaceDescriptor) == sizeof(WGPUSharedTextureMemoryIOSurfaceDescriptor), "sizeof mismatch for SharedTextureMemoryIOSurfaceDescriptor"); + static_assert(alignof(SharedTextureMemoryIOSurfaceDescriptor) == alignof(WGPUSharedTextureMemoryIOSurfaceDescriptor), "alignof mismatch for SharedTextureMemoryIOSurfaceDescriptor"); + + static_assert(offsetof(SharedTextureMemoryIOSurfaceDescriptor, ioSurface) == offsetof(WGPUSharedTextureMemoryIOSurfaceDescriptor, ioSurface), + "offsetof mismatch for SharedTextureMemoryIOSurfaceDescriptor::ioSurface"); + + // SharedTextureMemoryAHardwareBufferDescriptor + + static_assert(sizeof(SharedTextureMemoryAHardwareBufferDescriptor) == sizeof(WGPUSharedTextureMemoryAHardwareBufferDescriptor), "sizeof mismatch for SharedTextureMemoryAHardwareBufferDescriptor"); + static_assert(alignof(SharedTextureMemoryAHardwareBufferDescriptor) == alignof(WGPUSharedTextureMemoryAHardwareBufferDescriptor), "alignof mismatch for SharedTextureMemoryAHardwareBufferDescriptor"); + + static_assert(offsetof(SharedTextureMemoryAHardwareBufferDescriptor, handle) == offsetof(WGPUSharedTextureMemoryAHardwareBufferDescriptor, handle), + "offsetof mismatch for SharedTextureMemoryAHardwareBufferDescriptor::handle"); + + // SharedTextureMemoryBeginAccessDescriptor + + static_assert(sizeof(SharedTextureMemoryBeginAccessDescriptor) == sizeof(WGPUSharedTextureMemoryBeginAccessDescriptor), "sizeof mismatch for SharedTextureMemoryBeginAccessDescriptor"); + static_assert(alignof(SharedTextureMemoryBeginAccessDescriptor) == alignof(WGPUSharedTextureMemoryBeginAccessDescriptor), "alignof mismatch for SharedTextureMemoryBeginAccessDescriptor"); + + static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, nextInChain) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, nextInChain), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::nextInChain"); + static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, concurrentRead) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, concurrentRead), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::concurrentRead"); + static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, initialized) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, initialized), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::initialized"); + static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, fenceCount) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, fenceCount), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::fenceCount"); + static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, fences) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, fences), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::fences"); + static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, signaledValues) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, signaledValues), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::signaledValues"); + + // SharedTextureMemoryDescriptor + + static_assert(sizeof(SharedTextureMemoryDescriptor) == sizeof(WGPUSharedTextureMemoryDescriptor), "sizeof mismatch for SharedTextureMemoryDescriptor"); + static_assert(alignof(SharedTextureMemoryDescriptor) == alignof(WGPUSharedTextureMemoryDescriptor), "alignof mismatch for SharedTextureMemoryDescriptor"); + + static_assert(offsetof(SharedTextureMemoryDescriptor, nextInChain) == offsetof(WGPUSharedTextureMemoryDescriptor, nextInChain), + "offsetof mismatch for SharedTextureMemoryDescriptor::nextInChain"); + static_assert(offsetof(SharedTextureMemoryDescriptor, label) == offsetof(WGPUSharedTextureMemoryDescriptor, label), + "offsetof mismatch for SharedTextureMemoryDescriptor::label"); + + // SharedTextureMemoryDmaBufPlane + + static_assert(sizeof(SharedTextureMemoryDmaBufPlane) == sizeof(WGPUSharedTextureMemoryDmaBufPlane), "sizeof mismatch for SharedTextureMemoryDmaBufPlane"); + static_assert(alignof(SharedTextureMemoryDmaBufPlane) == alignof(WGPUSharedTextureMemoryDmaBufPlane), "alignof mismatch for SharedTextureMemoryDmaBufPlane"); + + static_assert(offsetof(SharedTextureMemoryDmaBufPlane, fd) == offsetof(WGPUSharedTextureMemoryDmaBufPlane, fd), + "offsetof mismatch for SharedTextureMemoryDmaBufPlane::fd"); + static_assert(offsetof(SharedTextureMemoryDmaBufPlane, offset) == offsetof(WGPUSharedTextureMemoryDmaBufPlane, offset), + "offsetof mismatch for SharedTextureMemoryDmaBufPlane::offset"); + static_assert(offsetof(SharedTextureMemoryDmaBufPlane, stride) == offsetof(WGPUSharedTextureMemoryDmaBufPlane, stride), + "offsetof mismatch for SharedTextureMemoryDmaBufPlane::stride"); + + // SharedTextureMemoryEndAccessState + + static_assert(sizeof(SharedTextureMemoryEndAccessState) == sizeof(WGPUSharedTextureMemoryEndAccessState), "sizeof mismatch for SharedTextureMemoryEndAccessState"); + static_assert(alignof(SharedTextureMemoryEndAccessState) == alignof(WGPUSharedTextureMemoryEndAccessState), "alignof mismatch for SharedTextureMemoryEndAccessState"); + + static_assert(offsetof(SharedTextureMemoryEndAccessState, nextInChain) == offsetof(WGPUSharedTextureMemoryEndAccessState, nextInChain), + "offsetof mismatch for SharedTextureMemoryEndAccessState::nextInChain"); + static_assert(offsetof(SharedTextureMemoryEndAccessState, initialized) == offsetof(WGPUSharedTextureMemoryEndAccessState, initialized), + "offsetof mismatch for SharedTextureMemoryEndAccessState::initialized"); + static_assert(offsetof(SharedTextureMemoryEndAccessState, fenceCount) == offsetof(WGPUSharedTextureMemoryEndAccessState, fenceCount), + "offsetof mismatch for SharedTextureMemoryEndAccessState::fenceCount"); + static_assert(offsetof(SharedTextureMemoryEndAccessState, fences) == offsetof(WGPUSharedTextureMemoryEndAccessState, fences), + "offsetof mismatch for SharedTextureMemoryEndAccessState::fences"); + static_assert(offsetof(SharedTextureMemoryEndAccessState, signaledValues) == offsetof(WGPUSharedTextureMemoryEndAccessState, signaledValues), + "offsetof mismatch for SharedTextureMemoryEndAccessState::signaledValues"); + + // SharedTextureMemoryOpaqueFDDescriptor + + static_assert(sizeof(SharedTextureMemoryOpaqueFDDescriptor) == sizeof(WGPUSharedTextureMemoryOpaqueFDDescriptor), "sizeof mismatch for SharedTextureMemoryOpaqueFDDescriptor"); + static_assert(alignof(SharedTextureMemoryOpaqueFDDescriptor) == alignof(WGPUSharedTextureMemoryOpaqueFDDescriptor), "alignof mismatch for SharedTextureMemoryOpaqueFDDescriptor"); + + static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, vkImageCreateInfo) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, vkImageCreateInfo), + "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::vkImageCreateInfo"); + static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, memoryFD) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, memoryFD), + "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::memoryFD"); + static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, memoryTypeIndex) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, memoryTypeIndex), + "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::memoryTypeIndex"); + static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, allocationSize) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, allocationSize), + "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::allocationSize"); + static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, dedicatedAllocation) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, dedicatedAllocation), + "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::dedicatedAllocation"); + + // SharedTextureMemoryVkDedicatedAllocationDescriptor + + static_assert(sizeof(SharedTextureMemoryVkDedicatedAllocationDescriptor) == sizeof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor), "sizeof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor"); + static_assert(alignof(SharedTextureMemoryVkDedicatedAllocationDescriptor) == alignof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor), "alignof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor"); + + static_assert(offsetof(SharedTextureMemoryVkDedicatedAllocationDescriptor, dedicatedAllocation) == offsetof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor, dedicatedAllocation), + "offsetof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor::dedicatedAllocation"); + + // SharedTextureMemoryVkImageLayoutBeginState + + static_assert(sizeof(SharedTextureMemoryVkImageLayoutBeginState) == sizeof(WGPUSharedTextureMemoryVkImageLayoutBeginState), "sizeof mismatch for SharedTextureMemoryVkImageLayoutBeginState"); + static_assert(alignof(SharedTextureMemoryVkImageLayoutBeginState) == alignof(WGPUSharedTextureMemoryVkImageLayoutBeginState), "alignof mismatch for SharedTextureMemoryVkImageLayoutBeginState"); + + static_assert(offsetof(SharedTextureMemoryVkImageLayoutBeginState, oldLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutBeginState, oldLayout), + "offsetof mismatch for SharedTextureMemoryVkImageLayoutBeginState::oldLayout"); + static_assert(offsetof(SharedTextureMemoryVkImageLayoutBeginState, newLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutBeginState, newLayout), + "offsetof mismatch for SharedTextureMemoryVkImageLayoutBeginState::newLayout"); + + // SharedTextureMemoryVkImageLayoutEndState + + static_assert(sizeof(SharedTextureMemoryVkImageLayoutEndState) == sizeof(WGPUSharedTextureMemoryVkImageLayoutEndState), "sizeof mismatch for SharedTextureMemoryVkImageLayoutEndState"); + static_assert(alignof(SharedTextureMemoryVkImageLayoutEndState) == alignof(WGPUSharedTextureMemoryVkImageLayoutEndState), "alignof mismatch for SharedTextureMemoryVkImageLayoutEndState"); + + static_assert(offsetof(SharedTextureMemoryVkImageLayoutEndState, oldLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutEndState, oldLayout), + "offsetof mismatch for SharedTextureMemoryVkImageLayoutEndState::oldLayout"); + static_assert(offsetof(SharedTextureMemoryVkImageLayoutEndState, newLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutEndState, newLayout), + "offsetof mismatch for SharedTextureMemoryVkImageLayoutEndState::newLayout"); + + // SharedTextureMemoryZirconHandleDescriptor + + static_assert(sizeof(SharedTextureMemoryZirconHandleDescriptor) == sizeof(WGPUSharedTextureMemoryZirconHandleDescriptor), "sizeof mismatch for SharedTextureMemoryZirconHandleDescriptor"); + static_assert(alignof(SharedTextureMemoryZirconHandleDescriptor) == alignof(WGPUSharedTextureMemoryZirconHandleDescriptor), "alignof mismatch for SharedTextureMemoryZirconHandleDescriptor"); + + static_assert(offsetof(SharedTextureMemoryZirconHandleDescriptor, memoryFD) == offsetof(WGPUSharedTextureMemoryZirconHandleDescriptor, memoryFD), + "offsetof mismatch for SharedTextureMemoryZirconHandleDescriptor::memoryFD"); + static_assert(offsetof(SharedTextureMemoryZirconHandleDescriptor, allocationSize) == offsetof(WGPUSharedTextureMemoryZirconHandleDescriptor, allocationSize), + "offsetof mismatch for SharedTextureMemoryZirconHandleDescriptor::allocationSize"); + + // StaticSamplerBindingLayout + + static_assert(sizeof(StaticSamplerBindingLayout) == sizeof(WGPUStaticSamplerBindingLayout), "sizeof mismatch for StaticSamplerBindingLayout"); + static_assert(alignof(StaticSamplerBindingLayout) == alignof(WGPUStaticSamplerBindingLayout), "alignof mismatch for StaticSamplerBindingLayout"); + + static_assert(offsetof(StaticSamplerBindingLayout, sampler) == offsetof(WGPUStaticSamplerBindingLayout, sampler), + "offsetof mismatch for StaticSamplerBindingLayout::sampler"); + + // StencilFaceState + + static_assert(sizeof(StencilFaceState) == sizeof(WGPUStencilFaceState), "sizeof mismatch for StencilFaceState"); + static_assert(alignof(StencilFaceState) == alignof(WGPUStencilFaceState), "alignof mismatch for StencilFaceState"); + + static_assert(offsetof(StencilFaceState, compare) == offsetof(WGPUStencilFaceState, compare), + "offsetof mismatch for StencilFaceState::compare"); + static_assert(offsetof(StencilFaceState, failOp) == offsetof(WGPUStencilFaceState, failOp), + "offsetof mismatch for StencilFaceState::failOp"); + static_assert(offsetof(StencilFaceState, depthFailOp) == offsetof(WGPUStencilFaceState, depthFailOp), + "offsetof mismatch for StencilFaceState::depthFailOp"); + static_assert(offsetof(StencilFaceState, passOp) == offsetof(WGPUStencilFaceState, passOp), + "offsetof mismatch for StencilFaceState::passOp"); + + // StorageTextureBindingLayout + + static_assert(sizeof(StorageTextureBindingLayout) == sizeof(WGPUStorageTextureBindingLayout), "sizeof mismatch for StorageTextureBindingLayout"); + static_assert(alignof(StorageTextureBindingLayout) == alignof(WGPUStorageTextureBindingLayout), "alignof mismatch for StorageTextureBindingLayout"); + + static_assert(offsetof(StorageTextureBindingLayout, nextInChain) == offsetof(WGPUStorageTextureBindingLayout, nextInChain), + "offsetof mismatch for StorageTextureBindingLayout::nextInChain"); + static_assert(offsetof(StorageTextureBindingLayout, access) == offsetof(WGPUStorageTextureBindingLayout, access), + "offsetof mismatch for StorageTextureBindingLayout::access"); + static_assert(offsetof(StorageTextureBindingLayout, format) == offsetof(WGPUStorageTextureBindingLayout, format), + "offsetof mismatch for StorageTextureBindingLayout::format"); + static_assert(offsetof(StorageTextureBindingLayout, viewDimension) == offsetof(WGPUStorageTextureBindingLayout, viewDimension), + "offsetof mismatch for StorageTextureBindingLayout::viewDimension"); + + // SurfaceDescriptor + + static_assert(sizeof(SurfaceDescriptor) == sizeof(WGPUSurfaceDescriptor), "sizeof mismatch for SurfaceDescriptor"); + static_assert(alignof(SurfaceDescriptor) == alignof(WGPUSurfaceDescriptor), "alignof mismatch for SurfaceDescriptor"); + + static_assert(offsetof(SurfaceDescriptor, nextInChain) == offsetof(WGPUSurfaceDescriptor, nextInChain), + "offsetof mismatch for SurfaceDescriptor::nextInChain"); + static_assert(offsetof(SurfaceDescriptor, label) == offsetof(WGPUSurfaceDescriptor, label), + "offsetof mismatch for SurfaceDescriptor::label"); + + // SurfaceDescriptorFromAndroidNativeWindow + + static_assert(sizeof(SurfaceDescriptorFromAndroidNativeWindow) == sizeof(WGPUSurfaceDescriptorFromAndroidNativeWindow), "sizeof mismatch for SurfaceDescriptorFromAndroidNativeWindow"); + static_assert(alignof(SurfaceDescriptorFromAndroidNativeWindow) == alignof(WGPUSurfaceDescriptorFromAndroidNativeWindow), "alignof mismatch for SurfaceDescriptorFromAndroidNativeWindow"); + + static_assert(offsetof(SurfaceDescriptorFromAndroidNativeWindow, window) == offsetof(WGPUSurfaceDescriptorFromAndroidNativeWindow, window), + "offsetof mismatch for SurfaceDescriptorFromAndroidNativeWindow::window"); + + // SurfaceDescriptorFromCanvasHTMLSelector + + static_assert(sizeof(SurfaceDescriptorFromCanvasHTMLSelector) == sizeof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), "sizeof mismatch for SurfaceDescriptorFromCanvasHTMLSelector"); + static_assert(alignof(SurfaceDescriptorFromCanvasHTMLSelector) == alignof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), "alignof mismatch for SurfaceDescriptorFromCanvasHTMLSelector"); + + static_assert(offsetof(SurfaceDescriptorFromCanvasHTMLSelector, selector) == offsetof(WGPUSurfaceDescriptorFromCanvasHTMLSelector, selector), + "offsetof mismatch for SurfaceDescriptorFromCanvasHTMLSelector::selector"); + + // SurfaceDescriptorFromMetalLayer + + static_assert(sizeof(SurfaceDescriptorFromMetalLayer) == sizeof(WGPUSurfaceDescriptorFromMetalLayer), "sizeof mismatch for SurfaceDescriptorFromMetalLayer"); + static_assert(alignof(SurfaceDescriptorFromMetalLayer) == alignof(WGPUSurfaceDescriptorFromMetalLayer), "alignof mismatch for SurfaceDescriptorFromMetalLayer"); + + static_assert(offsetof(SurfaceDescriptorFromMetalLayer, layer) == offsetof(WGPUSurfaceDescriptorFromMetalLayer, layer), + "offsetof mismatch for SurfaceDescriptorFromMetalLayer::layer"); + + // SurfaceDescriptorFromWaylandSurface + + static_assert(sizeof(SurfaceDescriptorFromWaylandSurface) == sizeof(WGPUSurfaceDescriptorFromWaylandSurface), "sizeof mismatch for SurfaceDescriptorFromWaylandSurface"); + static_assert(alignof(SurfaceDescriptorFromWaylandSurface) == alignof(WGPUSurfaceDescriptorFromWaylandSurface), "alignof mismatch for SurfaceDescriptorFromWaylandSurface"); + + static_assert(offsetof(SurfaceDescriptorFromWaylandSurface, display) == offsetof(WGPUSurfaceDescriptorFromWaylandSurface, display), + "offsetof mismatch for SurfaceDescriptorFromWaylandSurface::display"); + static_assert(offsetof(SurfaceDescriptorFromWaylandSurface, surface) == offsetof(WGPUSurfaceDescriptorFromWaylandSurface, surface), + "offsetof mismatch for SurfaceDescriptorFromWaylandSurface::surface"); + + // SurfaceDescriptorFromWindowsHWND + + static_assert(sizeof(SurfaceDescriptorFromWindowsHWND) == sizeof(WGPUSurfaceDescriptorFromWindowsHWND), "sizeof mismatch for SurfaceDescriptorFromWindowsHWND"); + static_assert(alignof(SurfaceDescriptorFromWindowsHWND) == alignof(WGPUSurfaceDescriptorFromWindowsHWND), "alignof mismatch for SurfaceDescriptorFromWindowsHWND"); + + static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hinstance) == offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hinstance), + "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hinstance"); + static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hwnd) == offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hwnd), + "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hwnd"); + + // SurfaceDescriptorFromWindowsCoreWindow + + static_assert(sizeof(SurfaceDescriptorFromWindowsCoreWindow) == sizeof(WGPUSurfaceDescriptorFromWindowsCoreWindow), "sizeof mismatch for SurfaceDescriptorFromWindowsCoreWindow"); + static_assert(alignof(SurfaceDescriptorFromWindowsCoreWindow) == alignof(WGPUSurfaceDescriptorFromWindowsCoreWindow), "alignof mismatch for SurfaceDescriptorFromWindowsCoreWindow"); + + static_assert(offsetof(SurfaceDescriptorFromWindowsCoreWindow, coreWindow) == offsetof(WGPUSurfaceDescriptorFromWindowsCoreWindow, coreWindow), + "offsetof mismatch for SurfaceDescriptorFromWindowsCoreWindow::coreWindow"); + + // SurfaceDescriptorFromWindowsSwapChainPanel + + static_assert(sizeof(SurfaceDescriptorFromWindowsSwapChainPanel) == sizeof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel), "sizeof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel"); + static_assert(alignof(SurfaceDescriptorFromWindowsSwapChainPanel) == alignof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel), "alignof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel"); + + static_assert(offsetof(SurfaceDescriptorFromWindowsSwapChainPanel, swapChainPanel) == offsetof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel, swapChainPanel), + "offsetof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel::swapChainPanel"); + + // SurfaceDescriptorFromXlibWindow + + static_assert(sizeof(SurfaceDescriptorFromXlibWindow) == sizeof(WGPUSurfaceDescriptorFromXlibWindow), "sizeof mismatch for SurfaceDescriptorFromXlibWindow"); + static_assert(alignof(SurfaceDescriptorFromXlibWindow) == alignof(WGPUSurfaceDescriptorFromXlibWindow), "alignof mismatch for SurfaceDescriptorFromXlibWindow"); + + static_assert(offsetof(SurfaceDescriptorFromXlibWindow, display) == offsetof(WGPUSurfaceDescriptorFromXlibWindow, display), + "offsetof mismatch for SurfaceDescriptorFromXlibWindow::display"); + static_assert(offsetof(SurfaceDescriptorFromXlibWindow, window) == offsetof(WGPUSurfaceDescriptorFromXlibWindow, window), + "offsetof mismatch for SurfaceDescriptorFromXlibWindow::window"); + + // SwapChainDescriptor + + static_assert(sizeof(SwapChainDescriptor) == sizeof(WGPUSwapChainDescriptor), "sizeof mismatch for SwapChainDescriptor"); + static_assert(alignof(SwapChainDescriptor) == alignof(WGPUSwapChainDescriptor), "alignof mismatch for SwapChainDescriptor"); + + static_assert(offsetof(SwapChainDescriptor, nextInChain) == offsetof(WGPUSwapChainDescriptor, nextInChain), + "offsetof mismatch for SwapChainDescriptor::nextInChain"); + static_assert(offsetof(SwapChainDescriptor, label) == offsetof(WGPUSwapChainDescriptor, label), + "offsetof mismatch for SwapChainDescriptor::label"); + static_assert(offsetof(SwapChainDescriptor, usage) == offsetof(WGPUSwapChainDescriptor, usage), + "offsetof mismatch for SwapChainDescriptor::usage"); + static_assert(offsetof(SwapChainDescriptor, format) == offsetof(WGPUSwapChainDescriptor, format), + "offsetof mismatch for SwapChainDescriptor::format"); + static_assert(offsetof(SwapChainDescriptor, width) == offsetof(WGPUSwapChainDescriptor, width), + "offsetof mismatch for SwapChainDescriptor::width"); + static_assert(offsetof(SwapChainDescriptor, height) == offsetof(WGPUSwapChainDescriptor, height), + "offsetof mismatch for SwapChainDescriptor::height"); + static_assert(offsetof(SwapChainDescriptor, presentMode) == offsetof(WGPUSwapChainDescriptor, presentMode), + "offsetof mismatch for SwapChainDescriptor::presentMode"); + + // TextureBindingLayout + + static_assert(sizeof(TextureBindingLayout) == sizeof(WGPUTextureBindingLayout), "sizeof mismatch for TextureBindingLayout"); + static_assert(alignof(TextureBindingLayout) == alignof(WGPUTextureBindingLayout), "alignof mismatch for TextureBindingLayout"); + + static_assert(offsetof(TextureBindingLayout, nextInChain) == offsetof(WGPUTextureBindingLayout, nextInChain), + "offsetof mismatch for TextureBindingLayout::nextInChain"); + static_assert(offsetof(TextureBindingLayout, sampleType) == offsetof(WGPUTextureBindingLayout, sampleType), + "offsetof mismatch for TextureBindingLayout::sampleType"); + static_assert(offsetof(TextureBindingLayout, viewDimension) == offsetof(WGPUTextureBindingLayout, viewDimension), + "offsetof mismatch for TextureBindingLayout::viewDimension"); + static_assert(offsetof(TextureBindingLayout, multisampled) == offsetof(WGPUTextureBindingLayout, multisampled), + "offsetof mismatch for TextureBindingLayout::multisampled"); + + // TextureBindingViewDimensionDescriptor + + static_assert(sizeof(TextureBindingViewDimensionDescriptor) == sizeof(WGPUTextureBindingViewDimensionDescriptor), "sizeof mismatch for TextureBindingViewDimensionDescriptor"); + static_assert(alignof(TextureBindingViewDimensionDescriptor) == alignof(WGPUTextureBindingViewDimensionDescriptor), "alignof mismatch for TextureBindingViewDimensionDescriptor"); + + static_assert(offsetof(TextureBindingViewDimensionDescriptor, textureBindingViewDimension) == offsetof(WGPUTextureBindingViewDimensionDescriptor, textureBindingViewDimension), + "offsetof mismatch for TextureBindingViewDimensionDescriptor::textureBindingViewDimension"); + + // TextureDataLayout + + static_assert(sizeof(TextureDataLayout) == sizeof(WGPUTextureDataLayout), "sizeof mismatch for TextureDataLayout"); + static_assert(alignof(TextureDataLayout) == alignof(WGPUTextureDataLayout), "alignof mismatch for TextureDataLayout"); + + static_assert(offsetof(TextureDataLayout, nextInChain) == offsetof(WGPUTextureDataLayout, nextInChain), + "offsetof mismatch for TextureDataLayout::nextInChain"); + static_assert(offsetof(TextureDataLayout, offset) == offsetof(WGPUTextureDataLayout, offset), + "offsetof mismatch for TextureDataLayout::offset"); + static_assert(offsetof(TextureDataLayout, bytesPerRow) == offsetof(WGPUTextureDataLayout, bytesPerRow), + "offsetof mismatch for TextureDataLayout::bytesPerRow"); + static_assert(offsetof(TextureDataLayout, rowsPerImage) == offsetof(WGPUTextureDataLayout, rowsPerImage), + "offsetof mismatch for TextureDataLayout::rowsPerImage"); + + // TextureViewDescriptor + + static_assert(sizeof(TextureViewDescriptor) == sizeof(WGPUTextureViewDescriptor), "sizeof mismatch for TextureViewDescriptor"); + static_assert(alignof(TextureViewDescriptor) == alignof(WGPUTextureViewDescriptor), "alignof mismatch for TextureViewDescriptor"); + + static_assert(offsetof(TextureViewDescriptor, nextInChain) == offsetof(WGPUTextureViewDescriptor, nextInChain), + "offsetof mismatch for TextureViewDescriptor::nextInChain"); + static_assert(offsetof(TextureViewDescriptor, label) == offsetof(WGPUTextureViewDescriptor, label), + "offsetof mismatch for TextureViewDescriptor::label"); + static_assert(offsetof(TextureViewDescriptor, format) == offsetof(WGPUTextureViewDescriptor, format), + "offsetof mismatch for TextureViewDescriptor::format"); + static_assert(offsetof(TextureViewDescriptor, dimension) == offsetof(WGPUTextureViewDescriptor, dimension), + "offsetof mismatch for TextureViewDescriptor::dimension"); + static_assert(offsetof(TextureViewDescriptor, baseMipLevel) == offsetof(WGPUTextureViewDescriptor, baseMipLevel), + "offsetof mismatch for TextureViewDescriptor::baseMipLevel"); + static_assert(offsetof(TextureViewDescriptor, mipLevelCount) == offsetof(WGPUTextureViewDescriptor, mipLevelCount), + "offsetof mismatch for TextureViewDescriptor::mipLevelCount"); + static_assert(offsetof(TextureViewDescriptor, baseArrayLayer) == offsetof(WGPUTextureViewDescriptor, baseArrayLayer), + "offsetof mismatch for TextureViewDescriptor::baseArrayLayer"); + static_assert(offsetof(TextureViewDescriptor, arrayLayerCount) == offsetof(WGPUTextureViewDescriptor, arrayLayerCount), + "offsetof mismatch for TextureViewDescriptor::arrayLayerCount"); + static_assert(offsetof(TextureViewDescriptor, aspect) == offsetof(WGPUTextureViewDescriptor, aspect), + "offsetof mismatch for TextureViewDescriptor::aspect"); + + // VertexAttribute + + static_assert(sizeof(VertexAttribute) == sizeof(WGPUVertexAttribute), "sizeof mismatch for VertexAttribute"); + static_assert(alignof(VertexAttribute) == alignof(WGPUVertexAttribute), "alignof mismatch for VertexAttribute"); + + static_assert(offsetof(VertexAttribute, format) == offsetof(WGPUVertexAttribute, format), + "offsetof mismatch for VertexAttribute::format"); + static_assert(offsetof(VertexAttribute, offset) == offsetof(WGPUVertexAttribute, offset), + "offsetof mismatch for VertexAttribute::offset"); + static_assert(offsetof(VertexAttribute, shaderLocation) == offsetof(WGPUVertexAttribute, shaderLocation), + "offsetof mismatch for VertexAttribute::shaderLocation"); + + // AdapterPropertiesMemoryHeaps + + static_assert(sizeof(AdapterPropertiesMemoryHeaps) == sizeof(WGPUAdapterPropertiesMemoryHeaps), "sizeof mismatch for AdapterPropertiesMemoryHeaps"); + static_assert(alignof(AdapterPropertiesMemoryHeaps) == alignof(WGPUAdapterPropertiesMemoryHeaps), "alignof mismatch for AdapterPropertiesMemoryHeaps"); + + static_assert(offsetof(AdapterPropertiesMemoryHeaps, heapCount) == offsetof(WGPUAdapterPropertiesMemoryHeaps, heapCount), + "offsetof mismatch for AdapterPropertiesMemoryHeaps::heapCount"); + static_assert(offsetof(AdapterPropertiesMemoryHeaps, heapInfo) == offsetof(WGPUAdapterPropertiesMemoryHeaps, heapInfo), + "offsetof mismatch for AdapterPropertiesMemoryHeaps::heapInfo"); + + // BindGroupDescriptor + + static_assert(sizeof(BindGroupDescriptor) == sizeof(WGPUBindGroupDescriptor), "sizeof mismatch for BindGroupDescriptor"); + static_assert(alignof(BindGroupDescriptor) == alignof(WGPUBindGroupDescriptor), "alignof mismatch for BindGroupDescriptor"); + + static_assert(offsetof(BindGroupDescriptor, nextInChain) == offsetof(WGPUBindGroupDescriptor, nextInChain), + "offsetof mismatch for BindGroupDescriptor::nextInChain"); + static_assert(offsetof(BindGroupDescriptor, label) == offsetof(WGPUBindGroupDescriptor, label), + "offsetof mismatch for BindGroupDescriptor::label"); + static_assert(offsetof(BindGroupDescriptor, layout) == offsetof(WGPUBindGroupDescriptor, layout), + "offsetof mismatch for BindGroupDescriptor::layout"); + static_assert(offsetof(BindGroupDescriptor, entryCount) == offsetof(WGPUBindGroupDescriptor, entryCount), + "offsetof mismatch for BindGroupDescriptor::entryCount"); + static_assert(offsetof(BindGroupDescriptor, entries) == offsetof(WGPUBindGroupDescriptor, entries), + "offsetof mismatch for BindGroupDescriptor::entries"); + + // BindGroupLayoutEntry + + static_assert(sizeof(BindGroupLayoutEntry) == sizeof(WGPUBindGroupLayoutEntry), "sizeof mismatch for BindGroupLayoutEntry"); + static_assert(alignof(BindGroupLayoutEntry) == alignof(WGPUBindGroupLayoutEntry), "alignof mismatch for BindGroupLayoutEntry"); + + static_assert(offsetof(BindGroupLayoutEntry, nextInChain) == offsetof(WGPUBindGroupLayoutEntry, nextInChain), + "offsetof mismatch for BindGroupLayoutEntry::nextInChain"); + static_assert(offsetof(BindGroupLayoutEntry, binding) == offsetof(WGPUBindGroupLayoutEntry, binding), + "offsetof mismatch for BindGroupLayoutEntry::binding"); + static_assert(offsetof(BindGroupLayoutEntry, visibility) == offsetof(WGPUBindGroupLayoutEntry, visibility), + "offsetof mismatch for BindGroupLayoutEntry::visibility"); + static_assert(offsetof(BindGroupLayoutEntry, buffer) == offsetof(WGPUBindGroupLayoutEntry, buffer), + "offsetof mismatch for BindGroupLayoutEntry::buffer"); + static_assert(offsetof(BindGroupLayoutEntry, sampler) == offsetof(WGPUBindGroupLayoutEntry, sampler), + "offsetof mismatch for BindGroupLayoutEntry::sampler"); + static_assert(offsetof(BindGroupLayoutEntry, texture) == offsetof(WGPUBindGroupLayoutEntry, texture), + "offsetof mismatch for BindGroupLayoutEntry::texture"); + static_assert(offsetof(BindGroupLayoutEntry, storageTexture) == offsetof(WGPUBindGroupLayoutEntry, storageTexture), + "offsetof mismatch for BindGroupLayoutEntry::storageTexture"); + + // BlendState + + static_assert(sizeof(BlendState) == sizeof(WGPUBlendState), "sizeof mismatch for BlendState"); + static_assert(alignof(BlendState) == alignof(WGPUBlendState), "alignof mismatch for BlendState"); + + static_assert(offsetof(BlendState, color) == offsetof(WGPUBlendState, color), + "offsetof mismatch for BlendState::color"); + static_assert(offsetof(BlendState, alpha) == offsetof(WGPUBlendState, alpha), + "offsetof mismatch for BlendState::alpha"); + + // CompilationInfo + + static_assert(sizeof(CompilationInfo) == sizeof(WGPUCompilationInfo), "sizeof mismatch for CompilationInfo"); + static_assert(alignof(CompilationInfo) == alignof(WGPUCompilationInfo), "alignof mismatch for CompilationInfo"); + + static_assert(offsetof(CompilationInfo, nextInChain) == offsetof(WGPUCompilationInfo, nextInChain), + "offsetof mismatch for CompilationInfo::nextInChain"); + static_assert(offsetof(CompilationInfo, messageCount) == offsetof(WGPUCompilationInfo, messageCount), + "offsetof mismatch for CompilationInfo::messageCount"); + static_assert(offsetof(CompilationInfo, messages) == offsetof(WGPUCompilationInfo, messages), + "offsetof mismatch for CompilationInfo::messages"); + + // ComputePassDescriptor + + static_assert(sizeof(ComputePassDescriptor) == sizeof(WGPUComputePassDescriptor), "sizeof mismatch for ComputePassDescriptor"); + static_assert(alignof(ComputePassDescriptor) == alignof(WGPUComputePassDescriptor), "alignof mismatch for ComputePassDescriptor"); + + static_assert(offsetof(ComputePassDescriptor, nextInChain) == offsetof(WGPUComputePassDescriptor, nextInChain), + "offsetof mismatch for ComputePassDescriptor::nextInChain"); + static_assert(offsetof(ComputePassDescriptor, label) == offsetof(WGPUComputePassDescriptor, label), + "offsetof mismatch for ComputePassDescriptor::label"); + static_assert(offsetof(ComputePassDescriptor, timestampWrites) == offsetof(WGPUComputePassDescriptor, timestampWrites), + "offsetof mismatch for ComputePassDescriptor::timestampWrites"); + + // DepthStencilState + + static_assert(sizeof(DepthStencilState) == sizeof(WGPUDepthStencilState), "sizeof mismatch for DepthStencilState"); + static_assert(alignof(DepthStencilState) == alignof(WGPUDepthStencilState), "alignof mismatch for DepthStencilState"); + + static_assert(offsetof(DepthStencilState, nextInChain) == offsetof(WGPUDepthStencilState, nextInChain), + "offsetof mismatch for DepthStencilState::nextInChain"); + static_assert(offsetof(DepthStencilState, format) == offsetof(WGPUDepthStencilState, format), + "offsetof mismatch for DepthStencilState::format"); + static_assert(offsetof(DepthStencilState, depthWriteEnabled) == offsetof(WGPUDepthStencilState, depthWriteEnabled), + "offsetof mismatch for DepthStencilState::depthWriteEnabled"); + static_assert(offsetof(DepthStencilState, depthCompare) == offsetof(WGPUDepthStencilState, depthCompare), + "offsetof mismatch for DepthStencilState::depthCompare"); + static_assert(offsetof(DepthStencilState, stencilFront) == offsetof(WGPUDepthStencilState, stencilFront), + "offsetof mismatch for DepthStencilState::stencilFront"); + static_assert(offsetof(DepthStencilState, stencilBack) == offsetof(WGPUDepthStencilState, stencilBack), + "offsetof mismatch for DepthStencilState::stencilBack"); + static_assert(offsetof(DepthStencilState, stencilReadMask) == offsetof(WGPUDepthStencilState, stencilReadMask), + "offsetof mismatch for DepthStencilState::stencilReadMask"); + static_assert(offsetof(DepthStencilState, stencilWriteMask) == offsetof(WGPUDepthStencilState, stencilWriteMask), + "offsetof mismatch for DepthStencilState::stencilWriteMask"); + static_assert(offsetof(DepthStencilState, depthBias) == offsetof(WGPUDepthStencilState, depthBias), + "offsetof mismatch for DepthStencilState::depthBias"); + static_assert(offsetof(DepthStencilState, depthBiasSlopeScale) == offsetof(WGPUDepthStencilState, depthBiasSlopeScale), + "offsetof mismatch for DepthStencilState::depthBiasSlopeScale"); + static_assert(offsetof(DepthStencilState, depthBiasClamp) == offsetof(WGPUDepthStencilState, depthBiasClamp), + "offsetof mismatch for DepthStencilState::depthBiasClamp"); + + // DrmFormatCapabilities + + static_assert(sizeof(DrmFormatCapabilities) == sizeof(WGPUDrmFormatCapabilities), "sizeof mismatch for DrmFormatCapabilities"); + static_assert(alignof(DrmFormatCapabilities) == alignof(WGPUDrmFormatCapabilities), "alignof mismatch for DrmFormatCapabilities"); + + static_assert(offsetof(DrmFormatCapabilities, propertiesCount) == offsetof(WGPUDrmFormatCapabilities, propertiesCount), + "offsetof mismatch for DrmFormatCapabilities::propertiesCount"); + static_assert(offsetof(DrmFormatCapabilities, properties) == offsetof(WGPUDrmFormatCapabilities, properties), + "offsetof mismatch for DrmFormatCapabilities::properties"); + + // ExternalTextureDescriptor + + static_assert(sizeof(ExternalTextureDescriptor) == sizeof(WGPUExternalTextureDescriptor), "sizeof mismatch for ExternalTextureDescriptor"); + static_assert(alignof(ExternalTextureDescriptor) == alignof(WGPUExternalTextureDescriptor), "alignof mismatch for ExternalTextureDescriptor"); + + static_assert(offsetof(ExternalTextureDescriptor, nextInChain) == offsetof(WGPUExternalTextureDescriptor, nextInChain), + "offsetof mismatch for ExternalTextureDescriptor::nextInChain"); + static_assert(offsetof(ExternalTextureDescriptor, label) == offsetof(WGPUExternalTextureDescriptor, label), + "offsetof mismatch for ExternalTextureDescriptor::label"); + static_assert(offsetof(ExternalTextureDescriptor, plane0) == offsetof(WGPUExternalTextureDescriptor, plane0), + "offsetof mismatch for ExternalTextureDescriptor::plane0"); + static_assert(offsetof(ExternalTextureDescriptor, plane1) == offsetof(WGPUExternalTextureDescriptor, plane1), + "offsetof mismatch for ExternalTextureDescriptor::plane1"); + static_assert(offsetof(ExternalTextureDescriptor, visibleOrigin) == offsetof(WGPUExternalTextureDescriptor, visibleOrigin), + "offsetof mismatch for ExternalTextureDescriptor::visibleOrigin"); + static_assert(offsetof(ExternalTextureDescriptor, visibleSize) == offsetof(WGPUExternalTextureDescriptor, visibleSize), + "offsetof mismatch for ExternalTextureDescriptor::visibleSize"); + static_assert(offsetof(ExternalTextureDescriptor, doYuvToRgbConversionOnly) == offsetof(WGPUExternalTextureDescriptor, doYuvToRgbConversionOnly), + "offsetof mismatch for ExternalTextureDescriptor::doYuvToRgbConversionOnly"); + static_assert(offsetof(ExternalTextureDescriptor, yuvToRgbConversionMatrix) == offsetof(WGPUExternalTextureDescriptor, yuvToRgbConversionMatrix), + "offsetof mismatch for ExternalTextureDescriptor::yuvToRgbConversionMatrix"); + static_assert(offsetof(ExternalTextureDescriptor, srcTransferFunctionParameters) == offsetof(WGPUExternalTextureDescriptor, srcTransferFunctionParameters), + "offsetof mismatch for ExternalTextureDescriptor::srcTransferFunctionParameters"); + static_assert(offsetof(ExternalTextureDescriptor, dstTransferFunctionParameters) == offsetof(WGPUExternalTextureDescriptor, dstTransferFunctionParameters), + "offsetof mismatch for ExternalTextureDescriptor::dstTransferFunctionParameters"); + static_assert(offsetof(ExternalTextureDescriptor, gamutConversionMatrix) == offsetof(WGPUExternalTextureDescriptor, gamutConversionMatrix), + "offsetof mismatch for ExternalTextureDescriptor::gamutConversionMatrix"); + static_assert(offsetof(ExternalTextureDescriptor, flipY) == offsetof(WGPUExternalTextureDescriptor, flipY), + "offsetof mismatch for ExternalTextureDescriptor::flipY"); + static_assert(offsetof(ExternalTextureDescriptor, mirrored) == offsetof(WGPUExternalTextureDescriptor, mirrored), + "offsetof mismatch for ExternalTextureDescriptor::mirrored"); + static_assert(offsetof(ExternalTextureDescriptor, rotation) == offsetof(WGPUExternalTextureDescriptor, rotation), + "offsetof mismatch for ExternalTextureDescriptor::rotation"); + + // FutureWaitInfo + + static_assert(sizeof(FutureWaitInfo) == sizeof(WGPUFutureWaitInfo), "sizeof mismatch for FutureWaitInfo"); + static_assert(alignof(FutureWaitInfo) == alignof(WGPUFutureWaitInfo), "alignof mismatch for FutureWaitInfo"); + + static_assert(offsetof(FutureWaitInfo, future) == offsetof(WGPUFutureWaitInfo, future), + "offsetof mismatch for FutureWaitInfo::future"); + static_assert(offsetof(FutureWaitInfo, completed) == offsetof(WGPUFutureWaitInfo, completed), + "offsetof mismatch for FutureWaitInfo::completed"); + + // ImageCopyBuffer + + static_assert(sizeof(ImageCopyBuffer) == sizeof(WGPUImageCopyBuffer), "sizeof mismatch for ImageCopyBuffer"); + static_assert(alignof(ImageCopyBuffer) == alignof(WGPUImageCopyBuffer), "alignof mismatch for ImageCopyBuffer"); + + static_assert(offsetof(ImageCopyBuffer, nextInChain) == offsetof(WGPUImageCopyBuffer, nextInChain), + "offsetof mismatch for ImageCopyBuffer::nextInChain"); + static_assert(offsetof(ImageCopyBuffer, layout) == offsetof(WGPUImageCopyBuffer, layout), + "offsetof mismatch for ImageCopyBuffer::layout"); + static_assert(offsetof(ImageCopyBuffer, buffer) == offsetof(WGPUImageCopyBuffer, buffer), + "offsetof mismatch for ImageCopyBuffer::buffer"); + + // ImageCopyExternalTexture + + static_assert(sizeof(ImageCopyExternalTexture) == sizeof(WGPUImageCopyExternalTexture), "sizeof mismatch for ImageCopyExternalTexture"); + static_assert(alignof(ImageCopyExternalTexture) == alignof(WGPUImageCopyExternalTexture), "alignof mismatch for ImageCopyExternalTexture"); + + static_assert(offsetof(ImageCopyExternalTexture, nextInChain) == offsetof(WGPUImageCopyExternalTexture, nextInChain), + "offsetof mismatch for ImageCopyExternalTexture::nextInChain"); + static_assert(offsetof(ImageCopyExternalTexture, externalTexture) == offsetof(WGPUImageCopyExternalTexture, externalTexture), + "offsetof mismatch for ImageCopyExternalTexture::externalTexture"); + static_assert(offsetof(ImageCopyExternalTexture, origin) == offsetof(WGPUImageCopyExternalTexture, origin), + "offsetof mismatch for ImageCopyExternalTexture::origin"); + static_assert(offsetof(ImageCopyExternalTexture, naturalSize) == offsetof(WGPUImageCopyExternalTexture, naturalSize), + "offsetof mismatch for ImageCopyExternalTexture::naturalSize"); + + // ImageCopyTexture + + static_assert(sizeof(ImageCopyTexture) == sizeof(WGPUImageCopyTexture), "sizeof mismatch for ImageCopyTexture"); + static_assert(alignof(ImageCopyTexture) == alignof(WGPUImageCopyTexture), "alignof mismatch for ImageCopyTexture"); + + static_assert(offsetof(ImageCopyTexture, nextInChain) == offsetof(WGPUImageCopyTexture, nextInChain), + "offsetof mismatch for ImageCopyTexture::nextInChain"); + static_assert(offsetof(ImageCopyTexture, texture) == offsetof(WGPUImageCopyTexture, texture), + "offsetof mismatch for ImageCopyTexture::texture"); + static_assert(offsetof(ImageCopyTexture, mipLevel) == offsetof(WGPUImageCopyTexture, mipLevel), + "offsetof mismatch for ImageCopyTexture::mipLevel"); + static_assert(offsetof(ImageCopyTexture, origin) == offsetof(WGPUImageCopyTexture, origin), + "offsetof mismatch for ImageCopyTexture::origin"); + static_assert(offsetof(ImageCopyTexture, aspect) == offsetof(WGPUImageCopyTexture, aspect), + "offsetof mismatch for ImageCopyTexture::aspect"); + + // InstanceDescriptor + + static_assert(sizeof(InstanceDescriptor) == sizeof(WGPUInstanceDescriptor), "sizeof mismatch for InstanceDescriptor"); + static_assert(alignof(InstanceDescriptor) == alignof(WGPUInstanceDescriptor), "alignof mismatch for InstanceDescriptor"); + + static_assert(offsetof(InstanceDescriptor, nextInChain) == offsetof(WGPUInstanceDescriptor, nextInChain), + "offsetof mismatch for InstanceDescriptor::nextInChain"); + static_assert(offsetof(InstanceDescriptor, features) == offsetof(WGPUInstanceDescriptor, features), + "offsetof mismatch for InstanceDescriptor::features"); + + // PipelineLayoutPixelLocalStorage + + static_assert(sizeof(PipelineLayoutPixelLocalStorage) == sizeof(WGPUPipelineLayoutPixelLocalStorage), "sizeof mismatch for PipelineLayoutPixelLocalStorage"); + static_assert(alignof(PipelineLayoutPixelLocalStorage) == alignof(WGPUPipelineLayoutPixelLocalStorage), "alignof mismatch for PipelineLayoutPixelLocalStorage"); + + static_assert(offsetof(PipelineLayoutPixelLocalStorage, totalPixelLocalStorageSize) == offsetof(WGPUPipelineLayoutPixelLocalStorage, totalPixelLocalStorageSize), + "offsetof mismatch for PipelineLayoutPixelLocalStorage::totalPixelLocalStorageSize"); + static_assert(offsetof(PipelineLayoutPixelLocalStorage, storageAttachmentCount) == offsetof(WGPUPipelineLayoutPixelLocalStorage, storageAttachmentCount), + "offsetof mismatch for PipelineLayoutPixelLocalStorage::storageAttachmentCount"); + static_assert(offsetof(PipelineLayoutPixelLocalStorage, storageAttachments) == offsetof(WGPUPipelineLayoutPixelLocalStorage, storageAttachments), + "offsetof mismatch for PipelineLayoutPixelLocalStorage::storageAttachments"); + + // ProgrammableStageDescriptor + + static_assert(sizeof(ProgrammableStageDescriptor) == sizeof(WGPUProgrammableStageDescriptor), "sizeof mismatch for ProgrammableStageDescriptor"); + static_assert(alignof(ProgrammableStageDescriptor) == alignof(WGPUProgrammableStageDescriptor), "alignof mismatch for ProgrammableStageDescriptor"); + + static_assert(offsetof(ProgrammableStageDescriptor, nextInChain) == offsetof(WGPUProgrammableStageDescriptor, nextInChain), + "offsetof mismatch for ProgrammableStageDescriptor::nextInChain"); + static_assert(offsetof(ProgrammableStageDescriptor, module) == offsetof(WGPUProgrammableStageDescriptor, module), + "offsetof mismatch for ProgrammableStageDescriptor::module"); + static_assert(offsetof(ProgrammableStageDescriptor, entryPoint) == offsetof(WGPUProgrammableStageDescriptor, entryPoint), + "offsetof mismatch for ProgrammableStageDescriptor::entryPoint"); + static_assert(offsetof(ProgrammableStageDescriptor, constantCount) == offsetof(WGPUProgrammableStageDescriptor, constantCount), + "offsetof mismatch for ProgrammableStageDescriptor::constantCount"); + static_assert(offsetof(ProgrammableStageDescriptor, constants) == offsetof(WGPUProgrammableStageDescriptor, constants), + "offsetof mismatch for ProgrammableStageDescriptor::constants"); + + // RenderPassColorAttachment + + static_assert(sizeof(RenderPassColorAttachment) == sizeof(WGPURenderPassColorAttachment), "sizeof mismatch for RenderPassColorAttachment"); + static_assert(alignof(RenderPassColorAttachment) == alignof(WGPURenderPassColorAttachment), "alignof mismatch for RenderPassColorAttachment"); + + static_assert(offsetof(RenderPassColorAttachment, nextInChain) == offsetof(WGPURenderPassColorAttachment, nextInChain), + "offsetof mismatch for RenderPassColorAttachment::nextInChain"); + static_assert(offsetof(RenderPassColorAttachment, view) == offsetof(WGPURenderPassColorAttachment, view), + "offsetof mismatch for RenderPassColorAttachment::view"); + static_assert(offsetof(RenderPassColorAttachment, depthSlice) == offsetof(WGPURenderPassColorAttachment, depthSlice), + "offsetof mismatch for RenderPassColorAttachment::depthSlice"); + static_assert(offsetof(RenderPassColorAttachment, resolveTarget) == offsetof(WGPURenderPassColorAttachment, resolveTarget), + "offsetof mismatch for RenderPassColorAttachment::resolveTarget"); + static_assert(offsetof(RenderPassColorAttachment, loadOp) == offsetof(WGPURenderPassColorAttachment, loadOp), + "offsetof mismatch for RenderPassColorAttachment::loadOp"); + static_assert(offsetof(RenderPassColorAttachment, storeOp) == offsetof(WGPURenderPassColorAttachment, storeOp), + "offsetof mismatch for RenderPassColorAttachment::storeOp"); + static_assert(offsetof(RenderPassColorAttachment, clearValue) == offsetof(WGPURenderPassColorAttachment, clearValue), + "offsetof mismatch for RenderPassColorAttachment::clearValue"); + + // RenderPassStorageAttachment + + static_assert(sizeof(RenderPassStorageAttachment) == sizeof(WGPURenderPassStorageAttachment), "sizeof mismatch for RenderPassStorageAttachment"); + static_assert(alignof(RenderPassStorageAttachment) == alignof(WGPURenderPassStorageAttachment), "alignof mismatch for RenderPassStorageAttachment"); + + static_assert(offsetof(RenderPassStorageAttachment, nextInChain) == offsetof(WGPURenderPassStorageAttachment, nextInChain), + "offsetof mismatch for RenderPassStorageAttachment::nextInChain"); + static_assert(offsetof(RenderPassStorageAttachment, offset) == offsetof(WGPURenderPassStorageAttachment, offset), + "offsetof mismatch for RenderPassStorageAttachment::offset"); + static_assert(offsetof(RenderPassStorageAttachment, storage) == offsetof(WGPURenderPassStorageAttachment, storage), + "offsetof mismatch for RenderPassStorageAttachment::storage"); + static_assert(offsetof(RenderPassStorageAttachment, loadOp) == offsetof(WGPURenderPassStorageAttachment, loadOp), + "offsetof mismatch for RenderPassStorageAttachment::loadOp"); + static_assert(offsetof(RenderPassStorageAttachment, storeOp) == offsetof(WGPURenderPassStorageAttachment, storeOp), + "offsetof mismatch for RenderPassStorageAttachment::storeOp"); + static_assert(offsetof(RenderPassStorageAttachment, clearValue) == offsetof(WGPURenderPassStorageAttachment, clearValue), + "offsetof mismatch for RenderPassStorageAttachment::clearValue"); + + // RequiredLimits + + static_assert(sizeof(RequiredLimits) == sizeof(WGPURequiredLimits), "sizeof mismatch for RequiredLimits"); + static_assert(alignof(RequiredLimits) == alignof(WGPURequiredLimits), "alignof mismatch for RequiredLimits"); + + static_assert(offsetof(RequiredLimits, nextInChain) == offsetof(WGPURequiredLimits, nextInChain), + "offsetof mismatch for RequiredLimits::nextInChain"); + static_assert(offsetof(RequiredLimits, limits) == offsetof(WGPURequiredLimits, limits), + "offsetof mismatch for RequiredLimits::limits"); + + // SharedTextureMemoryDmaBufDescriptor + + static_assert(sizeof(SharedTextureMemoryDmaBufDescriptor) == sizeof(WGPUSharedTextureMemoryDmaBufDescriptor), "sizeof mismatch for SharedTextureMemoryDmaBufDescriptor"); + static_assert(alignof(SharedTextureMemoryDmaBufDescriptor) == alignof(WGPUSharedTextureMemoryDmaBufDescriptor), "alignof mismatch for SharedTextureMemoryDmaBufDescriptor"); + + static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, size) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, size), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::size"); + static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, drmFormat) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, drmFormat), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::drmFormat"); + static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, drmModifier) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, drmModifier), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::drmModifier"); + static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, planeCount) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, planeCount), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::planeCount"); + static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, planes) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, planes), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::planes"); + + // SharedTextureMemoryProperties + + static_assert(sizeof(SharedTextureMemoryProperties) == sizeof(WGPUSharedTextureMemoryProperties), "sizeof mismatch for SharedTextureMemoryProperties"); + static_assert(alignof(SharedTextureMemoryProperties) == alignof(WGPUSharedTextureMemoryProperties), "alignof mismatch for SharedTextureMemoryProperties"); + + static_assert(offsetof(SharedTextureMemoryProperties, nextInChain) == offsetof(WGPUSharedTextureMemoryProperties, nextInChain), + "offsetof mismatch for SharedTextureMemoryProperties::nextInChain"); + static_assert(offsetof(SharedTextureMemoryProperties, usage) == offsetof(WGPUSharedTextureMemoryProperties, usage), + "offsetof mismatch for SharedTextureMemoryProperties::usage"); + static_assert(offsetof(SharedTextureMemoryProperties, size) == offsetof(WGPUSharedTextureMemoryProperties, size), + "offsetof mismatch for SharedTextureMemoryProperties::size"); + static_assert(offsetof(SharedTextureMemoryProperties, format) == offsetof(WGPUSharedTextureMemoryProperties, format), + "offsetof mismatch for SharedTextureMemoryProperties::format"); + + // SharedTextureMemoryVkImageDescriptor + + static_assert(sizeof(SharedTextureMemoryVkImageDescriptor) == sizeof(WGPUSharedTextureMemoryVkImageDescriptor), "sizeof mismatch for SharedTextureMemoryVkImageDescriptor"); + static_assert(alignof(SharedTextureMemoryVkImageDescriptor) == alignof(WGPUSharedTextureMemoryVkImageDescriptor), "alignof mismatch for SharedTextureMemoryVkImageDescriptor"); + + static_assert(offsetof(SharedTextureMemoryVkImageDescriptor, vkFormat) == offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkFormat), + "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkFormat"); + static_assert(offsetof(SharedTextureMemoryVkImageDescriptor, vkUsageFlags) == offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkUsageFlags), + "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkUsageFlags"); + static_assert(offsetof(SharedTextureMemoryVkImageDescriptor, vkExtent3D) == offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkExtent3D), + "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkExtent3D"); + + // SupportedLimits + + static_assert(sizeof(SupportedLimits) == sizeof(WGPUSupportedLimits), "sizeof mismatch for SupportedLimits"); + static_assert(alignof(SupportedLimits) == alignof(WGPUSupportedLimits), "alignof mismatch for SupportedLimits"); + + static_assert(offsetof(SupportedLimits, nextInChain) == offsetof(WGPUSupportedLimits, nextInChain), + "offsetof mismatch for SupportedLimits::nextInChain"); + static_assert(offsetof(SupportedLimits, limits) == offsetof(WGPUSupportedLimits, limits), + "offsetof mismatch for SupportedLimits::limits"); + + // TextureDescriptor + + static_assert(sizeof(TextureDescriptor) == sizeof(WGPUTextureDescriptor), "sizeof mismatch for TextureDescriptor"); + static_assert(alignof(TextureDescriptor) == alignof(WGPUTextureDescriptor), "alignof mismatch for TextureDescriptor"); + + static_assert(offsetof(TextureDescriptor, nextInChain) == offsetof(WGPUTextureDescriptor, nextInChain), + "offsetof mismatch for TextureDescriptor::nextInChain"); + static_assert(offsetof(TextureDescriptor, label) == offsetof(WGPUTextureDescriptor, label), + "offsetof mismatch for TextureDescriptor::label"); + static_assert(offsetof(TextureDescriptor, usage) == offsetof(WGPUTextureDescriptor, usage), + "offsetof mismatch for TextureDescriptor::usage"); + static_assert(offsetof(TextureDescriptor, dimension) == offsetof(WGPUTextureDescriptor, dimension), + "offsetof mismatch for TextureDescriptor::dimension"); + static_assert(offsetof(TextureDescriptor, size) == offsetof(WGPUTextureDescriptor, size), + "offsetof mismatch for TextureDescriptor::size"); + static_assert(offsetof(TextureDescriptor, format) == offsetof(WGPUTextureDescriptor, format), + "offsetof mismatch for TextureDescriptor::format"); + static_assert(offsetof(TextureDescriptor, mipLevelCount) == offsetof(WGPUTextureDescriptor, mipLevelCount), + "offsetof mismatch for TextureDescriptor::mipLevelCount"); + static_assert(offsetof(TextureDescriptor, sampleCount) == offsetof(WGPUTextureDescriptor, sampleCount), + "offsetof mismatch for TextureDescriptor::sampleCount"); + static_assert(offsetof(TextureDescriptor, viewFormatCount) == offsetof(WGPUTextureDescriptor, viewFormatCount), + "offsetof mismatch for TextureDescriptor::viewFormatCount"); + static_assert(offsetof(TextureDescriptor, viewFormats) == offsetof(WGPUTextureDescriptor, viewFormats), + "offsetof mismatch for TextureDescriptor::viewFormats"); + + // VertexBufferLayout + + static_assert(sizeof(VertexBufferLayout) == sizeof(WGPUVertexBufferLayout), "sizeof mismatch for VertexBufferLayout"); + static_assert(alignof(VertexBufferLayout) == alignof(WGPUVertexBufferLayout), "alignof mismatch for VertexBufferLayout"); + + static_assert(offsetof(VertexBufferLayout, arrayStride) == offsetof(WGPUVertexBufferLayout, arrayStride), + "offsetof mismatch for VertexBufferLayout::arrayStride"); + static_assert(offsetof(VertexBufferLayout, stepMode) == offsetof(WGPUVertexBufferLayout, stepMode), + "offsetof mismatch for VertexBufferLayout::stepMode"); + static_assert(offsetof(VertexBufferLayout, attributeCount) == offsetof(WGPUVertexBufferLayout, attributeCount), + "offsetof mismatch for VertexBufferLayout::attributeCount"); + static_assert(offsetof(VertexBufferLayout, attributes) == offsetof(WGPUVertexBufferLayout, attributes), + "offsetof mismatch for VertexBufferLayout::attributes"); + + // BindGroupLayoutDescriptor + + static_assert(sizeof(BindGroupLayoutDescriptor) == sizeof(WGPUBindGroupLayoutDescriptor), "sizeof mismatch for BindGroupLayoutDescriptor"); + static_assert(alignof(BindGroupLayoutDescriptor) == alignof(WGPUBindGroupLayoutDescriptor), "alignof mismatch for BindGroupLayoutDescriptor"); + + static_assert(offsetof(BindGroupLayoutDescriptor, nextInChain) == offsetof(WGPUBindGroupLayoutDescriptor, nextInChain), + "offsetof mismatch for BindGroupLayoutDescriptor::nextInChain"); + static_assert(offsetof(BindGroupLayoutDescriptor, label) == offsetof(WGPUBindGroupLayoutDescriptor, label), + "offsetof mismatch for BindGroupLayoutDescriptor::label"); + static_assert(offsetof(BindGroupLayoutDescriptor, entryCount) == offsetof(WGPUBindGroupLayoutDescriptor, entryCount), + "offsetof mismatch for BindGroupLayoutDescriptor::entryCount"); + static_assert(offsetof(BindGroupLayoutDescriptor, entries) == offsetof(WGPUBindGroupLayoutDescriptor, entries), + "offsetof mismatch for BindGroupLayoutDescriptor::entries"); + + // ColorTargetState + + static_assert(sizeof(ColorTargetState) == sizeof(WGPUColorTargetState), "sizeof mismatch for ColorTargetState"); + static_assert(alignof(ColorTargetState) == alignof(WGPUColorTargetState), "alignof mismatch for ColorTargetState"); + + static_assert(offsetof(ColorTargetState, nextInChain) == offsetof(WGPUColorTargetState, nextInChain), + "offsetof mismatch for ColorTargetState::nextInChain"); + static_assert(offsetof(ColorTargetState, format) == offsetof(WGPUColorTargetState, format), + "offsetof mismatch for ColorTargetState::format"); + static_assert(offsetof(ColorTargetState, blend) == offsetof(WGPUColorTargetState, blend), + "offsetof mismatch for ColorTargetState::blend"); + static_assert(offsetof(ColorTargetState, writeMask) == offsetof(WGPUColorTargetState, writeMask), + "offsetof mismatch for ColorTargetState::writeMask"); + + // ComputePipelineDescriptor + + static_assert(sizeof(ComputePipelineDescriptor) == sizeof(WGPUComputePipelineDescriptor), "sizeof mismatch for ComputePipelineDescriptor"); + static_assert(alignof(ComputePipelineDescriptor) == alignof(WGPUComputePipelineDescriptor), "alignof mismatch for ComputePipelineDescriptor"); + + static_assert(offsetof(ComputePipelineDescriptor, nextInChain) == offsetof(WGPUComputePipelineDescriptor, nextInChain), + "offsetof mismatch for ComputePipelineDescriptor::nextInChain"); + static_assert(offsetof(ComputePipelineDescriptor, label) == offsetof(WGPUComputePipelineDescriptor, label), + "offsetof mismatch for ComputePipelineDescriptor::label"); + static_assert(offsetof(ComputePipelineDescriptor, layout) == offsetof(WGPUComputePipelineDescriptor, layout), + "offsetof mismatch for ComputePipelineDescriptor::layout"); + static_assert(offsetof(ComputePipelineDescriptor, compute) == offsetof(WGPUComputePipelineDescriptor, compute), + "offsetof mismatch for ComputePipelineDescriptor::compute"); + + // DeviceDescriptor + + static_assert(sizeof(DeviceDescriptor) == sizeof(WGPUDeviceDescriptor), "sizeof mismatch for DeviceDescriptor"); + static_assert(alignof(DeviceDescriptor) == alignof(WGPUDeviceDescriptor), "alignof mismatch for DeviceDescriptor"); + + static_assert(offsetof(DeviceDescriptor, nextInChain) == offsetof(WGPUDeviceDescriptor, nextInChain), + "offsetof mismatch for DeviceDescriptor::nextInChain"); + static_assert(offsetof(DeviceDescriptor, label) == offsetof(WGPUDeviceDescriptor, label), + "offsetof mismatch for DeviceDescriptor::label"); + static_assert(offsetof(DeviceDescriptor, requiredFeatureCount) == offsetof(WGPUDeviceDescriptor, requiredFeatureCount), + "offsetof mismatch for DeviceDescriptor::requiredFeatureCount"); + static_assert(offsetof(DeviceDescriptor, requiredFeatures) == offsetof(WGPUDeviceDescriptor, requiredFeatures), + "offsetof mismatch for DeviceDescriptor::requiredFeatures"); + static_assert(offsetof(DeviceDescriptor, requiredLimits) == offsetof(WGPUDeviceDescriptor, requiredLimits), + "offsetof mismatch for DeviceDescriptor::requiredLimits"); + static_assert(offsetof(DeviceDescriptor, defaultQueue) == offsetof(WGPUDeviceDescriptor, defaultQueue), + "offsetof mismatch for DeviceDescriptor::defaultQueue"); + static_assert(offsetof(DeviceDescriptor, deviceLostCallback) == offsetof(WGPUDeviceDescriptor, deviceLostCallback), + "offsetof mismatch for DeviceDescriptor::deviceLostCallback"); + static_assert(offsetof(DeviceDescriptor, deviceLostUserdata) == offsetof(WGPUDeviceDescriptor, deviceLostUserdata), + "offsetof mismatch for DeviceDescriptor::deviceLostUserdata"); + + // RenderPassDescriptor + + static_assert(sizeof(RenderPassDescriptor) == sizeof(WGPURenderPassDescriptor), "sizeof mismatch for RenderPassDescriptor"); + static_assert(alignof(RenderPassDescriptor) == alignof(WGPURenderPassDescriptor), "alignof mismatch for RenderPassDescriptor"); + + static_assert(offsetof(RenderPassDescriptor, nextInChain) == offsetof(WGPURenderPassDescriptor, nextInChain), + "offsetof mismatch for RenderPassDescriptor::nextInChain"); + static_assert(offsetof(RenderPassDescriptor, label) == offsetof(WGPURenderPassDescriptor, label), + "offsetof mismatch for RenderPassDescriptor::label"); + static_assert(offsetof(RenderPassDescriptor, colorAttachmentCount) == offsetof(WGPURenderPassDescriptor, colorAttachmentCount), + "offsetof mismatch for RenderPassDescriptor::colorAttachmentCount"); + static_assert(offsetof(RenderPassDescriptor, colorAttachments) == offsetof(WGPURenderPassDescriptor, colorAttachments), + "offsetof mismatch for RenderPassDescriptor::colorAttachments"); + static_assert(offsetof(RenderPassDescriptor, depthStencilAttachment) == offsetof(WGPURenderPassDescriptor, depthStencilAttachment), + "offsetof mismatch for RenderPassDescriptor::depthStencilAttachment"); + static_assert(offsetof(RenderPassDescriptor, occlusionQuerySet) == offsetof(WGPURenderPassDescriptor, occlusionQuerySet), + "offsetof mismatch for RenderPassDescriptor::occlusionQuerySet"); + static_assert(offsetof(RenderPassDescriptor, timestampWrites) == offsetof(WGPURenderPassDescriptor, timestampWrites), + "offsetof mismatch for RenderPassDescriptor::timestampWrites"); + + // RenderPassPixelLocalStorage + + static_assert(sizeof(RenderPassPixelLocalStorage) == sizeof(WGPURenderPassPixelLocalStorage), "sizeof mismatch for RenderPassPixelLocalStorage"); + static_assert(alignof(RenderPassPixelLocalStorage) == alignof(WGPURenderPassPixelLocalStorage), "alignof mismatch for RenderPassPixelLocalStorage"); + + static_assert(offsetof(RenderPassPixelLocalStorage, totalPixelLocalStorageSize) == offsetof(WGPURenderPassPixelLocalStorage, totalPixelLocalStorageSize), + "offsetof mismatch for RenderPassPixelLocalStorage::totalPixelLocalStorageSize"); + static_assert(offsetof(RenderPassPixelLocalStorage, storageAttachmentCount) == offsetof(WGPURenderPassPixelLocalStorage, storageAttachmentCount), + "offsetof mismatch for RenderPassPixelLocalStorage::storageAttachmentCount"); + static_assert(offsetof(RenderPassPixelLocalStorage, storageAttachments) == offsetof(WGPURenderPassPixelLocalStorage, storageAttachments), + "offsetof mismatch for RenderPassPixelLocalStorage::storageAttachments"); + + // VertexState + + static_assert(sizeof(VertexState) == sizeof(WGPUVertexState), "sizeof mismatch for VertexState"); + static_assert(alignof(VertexState) == alignof(WGPUVertexState), "alignof mismatch for VertexState"); + + static_assert(offsetof(VertexState, nextInChain) == offsetof(WGPUVertexState, nextInChain), + "offsetof mismatch for VertexState::nextInChain"); + static_assert(offsetof(VertexState, module) == offsetof(WGPUVertexState, module), + "offsetof mismatch for VertexState::module"); + static_assert(offsetof(VertexState, entryPoint) == offsetof(WGPUVertexState, entryPoint), + "offsetof mismatch for VertexState::entryPoint"); + static_assert(offsetof(VertexState, constantCount) == offsetof(WGPUVertexState, constantCount), + "offsetof mismatch for VertexState::constantCount"); + static_assert(offsetof(VertexState, constants) == offsetof(WGPUVertexState, constants), + "offsetof mismatch for VertexState::constants"); + static_assert(offsetof(VertexState, bufferCount) == offsetof(WGPUVertexState, bufferCount), + "offsetof mismatch for VertexState::bufferCount"); + static_assert(offsetof(VertexState, buffers) == offsetof(WGPUVertexState, buffers), + "offsetof mismatch for VertexState::buffers"); + + // FragmentState + + static_assert(sizeof(FragmentState) == sizeof(WGPUFragmentState), "sizeof mismatch for FragmentState"); + static_assert(alignof(FragmentState) == alignof(WGPUFragmentState), "alignof mismatch for FragmentState"); + + static_assert(offsetof(FragmentState, nextInChain) == offsetof(WGPUFragmentState, nextInChain), + "offsetof mismatch for FragmentState::nextInChain"); + static_assert(offsetof(FragmentState, module) == offsetof(WGPUFragmentState, module), + "offsetof mismatch for FragmentState::module"); + static_assert(offsetof(FragmentState, entryPoint) == offsetof(WGPUFragmentState, entryPoint), + "offsetof mismatch for FragmentState::entryPoint"); + static_assert(offsetof(FragmentState, constantCount) == offsetof(WGPUFragmentState, constantCount), + "offsetof mismatch for FragmentState::constantCount"); + static_assert(offsetof(FragmentState, constants) == offsetof(WGPUFragmentState, constants), + "offsetof mismatch for FragmentState::constants"); + static_assert(offsetof(FragmentState, targetCount) == offsetof(WGPUFragmentState, targetCount), + "offsetof mismatch for FragmentState::targetCount"); + static_assert(offsetof(FragmentState, targets) == offsetof(WGPUFragmentState, targets), + "offsetof mismatch for FragmentState::targets"); + + // RenderPipelineDescriptor + + static_assert(sizeof(RenderPipelineDescriptor) == sizeof(WGPURenderPipelineDescriptor), "sizeof mismatch for RenderPipelineDescriptor"); + static_assert(alignof(RenderPipelineDescriptor) == alignof(WGPURenderPipelineDescriptor), "alignof mismatch for RenderPipelineDescriptor"); + + static_assert(offsetof(RenderPipelineDescriptor, nextInChain) == offsetof(WGPURenderPipelineDescriptor, nextInChain), + "offsetof mismatch for RenderPipelineDescriptor::nextInChain"); + static_assert(offsetof(RenderPipelineDescriptor, label) == offsetof(WGPURenderPipelineDescriptor, label), + "offsetof mismatch for RenderPipelineDescriptor::label"); + static_assert(offsetof(RenderPipelineDescriptor, layout) == offsetof(WGPURenderPipelineDescriptor, layout), + "offsetof mismatch for RenderPipelineDescriptor::layout"); + static_assert(offsetof(RenderPipelineDescriptor, vertex) == offsetof(WGPURenderPipelineDescriptor, vertex), + "offsetof mismatch for RenderPipelineDescriptor::vertex"); + static_assert(offsetof(RenderPipelineDescriptor, primitive) == offsetof(WGPURenderPipelineDescriptor, primitive), + "offsetof mismatch for RenderPipelineDescriptor::primitive"); + static_assert(offsetof(RenderPipelineDescriptor, depthStencil) == offsetof(WGPURenderPipelineDescriptor, depthStencil), + "offsetof mismatch for RenderPipelineDescriptor::depthStencil"); + static_assert(offsetof(RenderPipelineDescriptor, multisample) == offsetof(WGPURenderPipelineDescriptor, multisample), + "offsetof mismatch for RenderPipelineDescriptor::multisample"); + static_assert(offsetof(RenderPipelineDescriptor, fragment) == offsetof(WGPURenderPipelineDescriptor, fragment), + "offsetof mismatch for RenderPipelineDescriptor::fragment"); +template + static T& AsNonConstReference(const T& value) { + return const_cast(value); + } + + // AdapterProperties + AdapterProperties::~AdapterProperties() { + if (this->vendorName != nullptr || this->architecture != nullptr || this->name != nullptr || this->driverDescription != nullptr) { + wgpuAdapterPropertiesFreeMembers( + *reinterpret_cast(this)); + } + } + + static void Reset(AdapterProperties& value) { + AdapterProperties defaultValue{}; + AsNonConstReference(value.vendorID) = defaultValue.vendorID; + AsNonConstReference(value.vendorName) = defaultValue.vendorName; + AsNonConstReference(value.architecture) = defaultValue.architecture; + AsNonConstReference(value.deviceID) = defaultValue.deviceID; + AsNonConstReference(value.name) = defaultValue.name; + AsNonConstReference(value.driverDescription) = defaultValue.driverDescription; + AsNonConstReference(value.adapterType) = defaultValue.adapterType; + AsNonConstReference(value.backendType) = defaultValue.backendType; + AsNonConstReference(value.compatibilityMode) = defaultValue.compatibilityMode; + } + + AdapterProperties::AdapterProperties(AdapterProperties&& rhs) + : vendorID(rhs.vendorID), + vendorName(rhs.vendorName), + architecture(rhs.architecture), + deviceID(rhs.deviceID), + name(rhs.name), + driverDescription(rhs.driverDescription), + adapterType(rhs.adapterType), + backendType(rhs.backendType), + compatibilityMode(rhs.compatibilityMode){ + Reset(rhs); + } + + AdapterProperties& AdapterProperties::operator=(AdapterProperties&& rhs) { + if (&rhs == this) { + return *this; + } + this->~AdapterProperties(); + AsNonConstReference(this->vendorID) = std::move(rhs.vendorID); + AsNonConstReference(this->vendorName) = std::move(rhs.vendorName); + AsNonConstReference(this->architecture) = std::move(rhs.architecture); + AsNonConstReference(this->deviceID) = std::move(rhs.deviceID); + AsNonConstReference(this->name) = std::move(rhs.name); + AsNonConstReference(this->driverDescription) = std::move(rhs.driverDescription); + AsNonConstReference(this->adapterType) = std::move(rhs.adapterType); + AsNonConstReference(this->backendType) = std::move(rhs.backendType); + AsNonConstReference(this->compatibilityMode) = std::move(rhs.compatibilityMode); + Reset(rhs); + return *this; + } + + // SharedBufferMemoryEndAccessState + SharedBufferMemoryEndAccessState::~SharedBufferMemoryEndAccessState() { + if (this->fences != nullptr || this->signaledValues != nullptr) { + wgpuSharedBufferMemoryEndAccessStateFreeMembers( + *reinterpret_cast(this)); + } + } + + static void Reset(SharedBufferMemoryEndAccessState& value) { + SharedBufferMemoryEndAccessState defaultValue{}; + AsNonConstReference(value.initialized) = defaultValue.initialized; + AsNonConstReference(value.fenceCount) = defaultValue.fenceCount; + AsNonConstReference(value.fences) = defaultValue.fences; + AsNonConstReference(value.signaledValues) = defaultValue.signaledValues; + } + + SharedBufferMemoryEndAccessState::SharedBufferMemoryEndAccessState(SharedBufferMemoryEndAccessState&& rhs) + : initialized(rhs.initialized), + fenceCount(rhs.fenceCount), + fences(rhs.fences), + signaledValues(rhs.signaledValues){ + Reset(rhs); + } + + SharedBufferMemoryEndAccessState& SharedBufferMemoryEndAccessState::operator=(SharedBufferMemoryEndAccessState&& rhs) { + if (&rhs == this) { + return *this; + } + this->~SharedBufferMemoryEndAccessState(); + AsNonConstReference(this->initialized) = std::move(rhs.initialized); + AsNonConstReference(this->fenceCount) = std::move(rhs.fenceCount); + AsNonConstReference(this->fences) = std::move(rhs.fences); + AsNonConstReference(this->signaledValues) = std::move(rhs.signaledValues); + Reset(rhs); + return *this; + } + + // SharedTextureMemoryEndAccessState + SharedTextureMemoryEndAccessState::~SharedTextureMemoryEndAccessState() { + if (this->fences != nullptr || this->signaledValues != nullptr) { + wgpuSharedTextureMemoryEndAccessStateFreeMembers( + *reinterpret_cast(this)); + } + } + + static void Reset(SharedTextureMemoryEndAccessState& value) { + SharedTextureMemoryEndAccessState defaultValue{}; + AsNonConstReference(value.initialized) = defaultValue.initialized; + AsNonConstReference(value.fenceCount) = defaultValue.fenceCount; + AsNonConstReference(value.fences) = defaultValue.fences; + AsNonConstReference(value.signaledValues) = defaultValue.signaledValues; + } + + SharedTextureMemoryEndAccessState::SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState&& rhs) + : initialized(rhs.initialized), + fenceCount(rhs.fenceCount), + fences(rhs.fences), + signaledValues(rhs.signaledValues){ + Reset(rhs); + } + + SharedTextureMemoryEndAccessState& SharedTextureMemoryEndAccessState::operator=(SharedTextureMemoryEndAccessState&& rhs) { + if (&rhs == this) { + return *this; + } + this->~SharedTextureMemoryEndAccessState(); + AsNonConstReference(this->initialized) = std::move(rhs.initialized); + AsNonConstReference(this->fenceCount) = std::move(rhs.fenceCount); + AsNonConstReference(this->fences) = std::move(rhs.fences); + AsNonConstReference(this->signaledValues) = std::move(rhs.signaledValues); + Reset(rhs); + return *this; + } + + // AdapterPropertiesMemoryHeaps + AdapterPropertiesMemoryHeaps::~AdapterPropertiesMemoryHeaps() { + if (this->heapInfo != nullptr) { + wgpuAdapterPropertiesMemoryHeapsFreeMembers( + *reinterpret_cast(this)); + } + } + + static void Reset(AdapterPropertiesMemoryHeaps& value) { + AdapterPropertiesMemoryHeaps defaultValue{}; + AsNonConstReference(value.heapCount) = defaultValue.heapCount; + AsNonConstReference(value.heapInfo) = defaultValue.heapInfo; + } + + AdapterPropertiesMemoryHeaps::AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps&& rhs) + : heapCount(rhs.heapCount), + heapInfo(rhs.heapInfo){ + Reset(rhs); + } + + AdapterPropertiesMemoryHeaps& AdapterPropertiesMemoryHeaps::operator=(AdapterPropertiesMemoryHeaps&& rhs) { + if (&rhs == this) { + return *this; + } + this->~AdapterPropertiesMemoryHeaps(); + AsNonConstReference(this->heapCount) = std::move(rhs.heapCount); + AsNonConstReference(this->heapInfo) = std::move(rhs.heapInfo); + Reset(rhs); + return *this; + } + + // DrmFormatCapabilities + DrmFormatCapabilities::~DrmFormatCapabilities() { + if (this->properties != nullptr) { + wgpuDrmFormatCapabilitiesFreeMembers( + *reinterpret_cast(this)); + } + } + + static void Reset(DrmFormatCapabilities& value) { + DrmFormatCapabilities defaultValue{}; + AsNonConstReference(value.propertiesCount) = defaultValue.propertiesCount; + AsNonConstReference(value.properties) = defaultValue.properties; + } + + DrmFormatCapabilities::DrmFormatCapabilities(DrmFormatCapabilities&& rhs) + : propertiesCount(rhs.propertiesCount), + properties(rhs.properties){ + Reset(rhs); + } + + DrmFormatCapabilities& DrmFormatCapabilities::operator=(DrmFormatCapabilities&& rhs) { + if (&rhs == this) { + return *this; + } + this->~DrmFormatCapabilities(); + AsNonConstReference(this->propertiesCount) = std::move(rhs.propertiesCount); + AsNonConstReference(this->properties) = std::move(rhs.properties); + Reset(rhs); + return *this; + } + + + + // Adapter + + static_assert(sizeof(Adapter) == sizeof(WGPUAdapter), "sizeof mismatch for Adapter"); + static_assert(alignof(Adapter) == alignof(WGPUAdapter), "alignof mismatch for Adapter"); + + Device Adapter::CreateDevice(DeviceDescriptor const * descriptor) const { + auto result = wgpuAdapterCreateDevice(Get(), reinterpret_cast(descriptor)); + return Device::Acquire(result); + } + size_t Adapter::EnumerateFeatures(FeatureName * features) const { + auto result = wgpuAdapterEnumerateFeatures(Get(), reinterpret_cast(features)); + return result; + } + Bool Adapter::GetFormatCapabilities(TextureFormat format, FormatCapabilities * capabilities) const { + auto result = wgpuAdapterGetFormatCapabilities(Get(), static_cast(format), reinterpret_cast(capabilities)); + return result; + } + Instance Adapter::GetInstance() const { + auto result = wgpuAdapterGetInstance(Get()); + return Instance::Acquire(result); + } + Bool Adapter::GetLimits(SupportedLimits * limits) const { + auto result = wgpuAdapterGetLimits(Get(), reinterpret_cast(limits)); + return result; + } + void Adapter::GetProperties(AdapterProperties * properties) const { + *properties = AdapterProperties(); + wgpuAdapterGetProperties(Get(), reinterpret_cast(properties)); + } + Bool Adapter::HasFeature(FeatureName feature) const { + auto result = wgpuAdapterHasFeature(Get(), static_cast(feature)); + return result; + } + void Adapter::RequestDevice(DeviceDescriptor const * descriptor, RequestDeviceCallback callback, void * userdata) const { + wgpuAdapterRequestDevice(Get(), reinterpret_cast(descriptor), callback, userdata); + } + Future Adapter::RequestDevice(DeviceDescriptor const * options, RequestDeviceCallbackInfo callbackInfo) const { + auto result = wgpuAdapterRequestDeviceF(Get(), reinterpret_cast(options), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + void Adapter::WGPUReference(WGPUAdapter handle) { + if (handle != nullptr) { + wgpuAdapterReference(handle); + } + } + void Adapter::WGPURelease(WGPUAdapter handle) { + if (handle != nullptr) { + wgpuAdapterRelease(handle); + } + } + + // BindGroup + + static_assert(sizeof(BindGroup) == sizeof(WGPUBindGroup), "sizeof mismatch for BindGroup"); + static_assert(alignof(BindGroup) == alignof(WGPUBindGroup), "alignof mismatch for BindGroup"); + + void BindGroup::SetLabel(char const * label) const { + wgpuBindGroupSetLabel(Get(), reinterpret_cast(label)); + } + void BindGroup::WGPUReference(WGPUBindGroup handle) { + if (handle != nullptr) { + wgpuBindGroupReference(handle); + } + } + void BindGroup::WGPURelease(WGPUBindGroup handle) { + if (handle != nullptr) { + wgpuBindGroupRelease(handle); + } + } + + // BindGroupLayout + + static_assert(sizeof(BindGroupLayout) == sizeof(WGPUBindGroupLayout), "sizeof mismatch for BindGroupLayout"); + static_assert(alignof(BindGroupLayout) == alignof(WGPUBindGroupLayout), "alignof mismatch for BindGroupLayout"); + + void BindGroupLayout::SetLabel(char const * label) const { + wgpuBindGroupLayoutSetLabel(Get(), reinterpret_cast(label)); + } + void BindGroupLayout::WGPUReference(WGPUBindGroupLayout handle) { + if (handle != nullptr) { + wgpuBindGroupLayoutReference(handle); + } + } + void BindGroupLayout::WGPURelease(WGPUBindGroupLayout handle) { + if (handle != nullptr) { + wgpuBindGroupLayoutRelease(handle); + } + } + + // Buffer + + static_assert(sizeof(Buffer) == sizeof(WGPUBuffer), "sizeof mismatch for Buffer"); + static_assert(alignof(Buffer) == alignof(WGPUBuffer), "alignof mismatch for Buffer"); + + void Buffer::Destroy() const { + wgpuBufferDestroy(Get()); + } + void const * Buffer::GetConstMappedRange(size_t offset, size_t size) const { + auto result = wgpuBufferGetConstMappedRange(Get(), offset, size); + return result; + } + BufferMapState Buffer::GetMapState() const { + auto result = wgpuBufferGetMapState(Get()); + return static_cast(result); + } + void * Buffer::GetMappedRange(size_t offset, size_t size) const { + auto result = wgpuBufferGetMappedRange(Get(), offset, size); + return result; + } + uint64_t Buffer::GetSize() const { + auto result = wgpuBufferGetSize(Get()); + return result; + } + BufferUsage Buffer::GetUsage() const { + auto result = wgpuBufferGetUsage(Get()); + return static_cast(result); + } + void Buffer::MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallback callback, void * userdata) const { + wgpuBufferMapAsync(Get(), static_cast(mode), offset, size, callback, userdata); + } + Future Buffer::MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallbackInfo callbackInfo) const { + auto result = wgpuBufferMapAsyncF(Get(), static_cast(mode), offset, size, *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + void Buffer::SetLabel(char const * label) const { + wgpuBufferSetLabel(Get(), reinterpret_cast(label)); + } + void Buffer::Unmap() const { + wgpuBufferUnmap(Get()); + } + void Buffer::WGPUReference(WGPUBuffer handle) { + if (handle != nullptr) { + wgpuBufferReference(handle); + } + } + void Buffer::WGPURelease(WGPUBuffer handle) { + if (handle != nullptr) { + wgpuBufferRelease(handle); + } + } + + // CommandBuffer + + static_assert(sizeof(CommandBuffer) == sizeof(WGPUCommandBuffer), "sizeof mismatch for CommandBuffer"); + static_assert(alignof(CommandBuffer) == alignof(WGPUCommandBuffer), "alignof mismatch for CommandBuffer"); + + void CommandBuffer::SetLabel(char const * label) const { + wgpuCommandBufferSetLabel(Get(), reinterpret_cast(label)); + } + void CommandBuffer::WGPUReference(WGPUCommandBuffer handle) { + if (handle != nullptr) { + wgpuCommandBufferReference(handle); + } + } + void CommandBuffer::WGPURelease(WGPUCommandBuffer handle) { + if (handle != nullptr) { + wgpuCommandBufferRelease(handle); + } + } + + // CommandEncoder + + static_assert(sizeof(CommandEncoder) == sizeof(WGPUCommandEncoder), "sizeof mismatch for CommandEncoder"); + static_assert(alignof(CommandEncoder) == alignof(WGPUCommandEncoder), "alignof mismatch for CommandEncoder"); + + ComputePassEncoder CommandEncoder::BeginComputePass(ComputePassDescriptor const * descriptor) const { + auto result = wgpuCommandEncoderBeginComputePass(Get(), reinterpret_cast(descriptor)); + return ComputePassEncoder::Acquire(result); + } + RenderPassEncoder CommandEncoder::BeginRenderPass(RenderPassDescriptor const * descriptor) const { + auto result = wgpuCommandEncoderBeginRenderPass(Get(), reinterpret_cast(descriptor)); + return RenderPassEncoder::Acquire(result); + } + void CommandEncoder::ClearBuffer(Buffer const& buffer, uint64_t offset, uint64_t size) const { + wgpuCommandEncoderClearBuffer(Get(), buffer.Get(), offset, size); + } + void CommandEncoder::CopyBufferToBuffer(Buffer const& source, uint64_t sourceOffset, Buffer const& destination, uint64_t destinationOffset, uint64_t size) const { + wgpuCommandEncoderCopyBufferToBuffer(Get(), source.Get(), sourceOffset, destination.Get(), destinationOffset, size); + } + void CommandEncoder::CopyBufferToTexture(ImageCopyBuffer const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const { + wgpuCommandEncoderCopyBufferToTexture(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize)); + } + void CommandEncoder::CopyTextureToBuffer(ImageCopyTexture const * source, ImageCopyBuffer const * destination, Extent3D const * copySize) const { + wgpuCommandEncoderCopyTextureToBuffer(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize)); + } + void CommandEncoder::CopyTextureToTexture(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const { + wgpuCommandEncoderCopyTextureToTexture(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize)); + } + CommandBuffer CommandEncoder::Finish(CommandBufferDescriptor const * descriptor) const { + auto result = wgpuCommandEncoderFinish(Get(), reinterpret_cast(descriptor)); + return CommandBuffer::Acquire(result); + } + void CommandEncoder::InjectValidationError(char const * message) const { + wgpuCommandEncoderInjectValidationError(Get(), reinterpret_cast(message)); + } + void CommandEncoder::InsertDebugMarker(char const * markerLabel) const { + wgpuCommandEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); + } + void CommandEncoder::PopDebugGroup() const { + wgpuCommandEncoderPopDebugGroup(Get()); + } + void CommandEncoder::PushDebugGroup(char const * groupLabel) const { + wgpuCommandEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); + } + void CommandEncoder::ResolveQuerySet(QuerySet const& querySet, uint32_t firstQuery, uint32_t queryCount, Buffer const& destination, uint64_t destinationOffset) const { + wgpuCommandEncoderResolveQuerySet(Get(), querySet.Get(), firstQuery, queryCount, destination.Get(), destinationOffset); + } + void CommandEncoder::SetLabel(char const * label) const { + wgpuCommandEncoderSetLabel(Get(), reinterpret_cast(label)); + } + void CommandEncoder::WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) const { + wgpuCommandEncoderWriteBuffer(Get(), buffer.Get(), bufferOffset, reinterpret_cast(data), size); + } + void CommandEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const { + wgpuCommandEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); + } + void CommandEncoder::WGPUReference(WGPUCommandEncoder handle) { + if (handle != nullptr) { + wgpuCommandEncoderReference(handle); + } + } + void CommandEncoder::WGPURelease(WGPUCommandEncoder handle) { + if (handle != nullptr) { + wgpuCommandEncoderRelease(handle); + } + } + + // ComputePassEncoder + + static_assert(sizeof(ComputePassEncoder) == sizeof(WGPUComputePassEncoder), "sizeof mismatch for ComputePassEncoder"); + static_assert(alignof(ComputePassEncoder) == alignof(WGPUComputePassEncoder), "alignof mismatch for ComputePassEncoder"); + + void ComputePassEncoder::DispatchWorkgroups(uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) const { + wgpuComputePassEncoderDispatchWorkgroups(Get(), workgroupCountX, workgroupCountY, workgroupCountZ); + } + void ComputePassEncoder::DispatchWorkgroupsIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { + wgpuComputePassEncoderDispatchWorkgroupsIndirect(Get(), indirectBuffer.Get(), indirectOffset); + } + void ComputePassEncoder::End() const { + wgpuComputePassEncoderEnd(Get()); + } + void ComputePassEncoder::InsertDebugMarker(char const * markerLabel) const { + wgpuComputePassEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); + } + void ComputePassEncoder::PopDebugGroup() const { + wgpuComputePassEncoderPopDebugGroup(Get()); + } + void ComputePassEncoder::PushDebugGroup(char const * groupLabel) const { + wgpuComputePassEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); + } + void ComputePassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { + wgpuComputePassEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast(dynamicOffsets)); + } + void ComputePassEncoder::SetLabel(char const * label) const { + wgpuComputePassEncoderSetLabel(Get(), reinterpret_cast(label)); + } + void ComputePassEncoder::SetPipeline(ComputePipeline const& pipeline) const { + wgpuComputePassEncoderSetPipeline(Get(), pipeline.Get()); + } + void ComputePassEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const { + wgpuComputePassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); + } + void ComputePassEncoder::WGPUReference(WGPUComputePassEncoder handle) { + if (handle != nullptr) { + wgpuComputePassEncoderReference(handle); + } + } + void ComputePassEncoder::WGPURelease(WGPUComputePassEncoder handle) { + if (handle != nullptr) { + wgpuComputePassEncoderRelease(handle); + } + } + + // ComputePipeline + + static_assert(sizeof(ComputePipeline) == sizeof(WGPUComputePipeline), "sizeof mismatch for ComputePipeline"); + static_assert(alignof(ComputePipeline) == alignof(WGPUComputePipeline), "alignof mismatch for ComputePipeline"); + + BindGroupLayout ComputePipeline::GetBindGroupLayout(uint32_t groupIndex) const { + auto result = wgpuComputePipelineGetBindGroupLayout(Get(), groupIndex); + return BindGroupLayout::Acquire(result); + } + void ComputePipeline::SetLabel(char const * label) const { + wgpuComputePipelineSetLabel(Get(), reinterpret_cast(label)); + } + void ComputePipeline::WGPUReference(WGPUComputePipeline handle) { + if (handle != nullptr) { + wgpuComputePipelineReference(handle); + } + } + void ComputePipeline::WGPURelease(WGPUComputePipeline handle) { + if (handle != nullptr) { + wgpuComputePipelineRelease(handle); + } + } + + // Device + + static_assert(sizeof(Device) == sizeof(WGPUDevice), "sizeof mismatch for Device"); + static_assert(alignof(Device) == alignof(WGPUDevice), "alignof mismatch for Device"); + + BindGroup Device::CreateBindGroup(BindGroupDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateBindGroup(Get(), reinterpret_cast(descriptor)); + return BindGroup::Acquire(result); + } + BindGroupLayout Device::CreateBindGroupLayout(BindGroupLayoutDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateBindGroupLayout(Get(), reinterpret_cast(descriptor)); + return BindGroupLayout::Acquire(result); + } + Buffer Device::CreateBuffer(BufferDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateBuffer(Get(), reinterpret_cast(descriptor)); + return Buffer::Acquire(result); + } + CommandEncoder Device::CreateCommandEncoder(CommandEncoderDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateCommandEncoder(Get(), reinterpret_cast(descriptor)); + return CommandEncoder::Acquire(result); + } + ComputePipeline Device::CreateComputePipeline(ComputePipelineDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateComputePipeline(Get(), reinterpret_cast(descriptor)); + return ComputePipeline::Acquire(result); + } + void Device::CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallback callback, void * userdata) const { + wgpuDeviceCreateComputePipelineAsync(Get(), reinterpret_cast(descriptor), callback, userdata); + } + Future Device::CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallbackInfo callbackInfo) const { + auto result = wgpuDeviceCreateComputePipelineAsyncF(Get(), reinterpret_cast(descriptor), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + Buffer Device::CreateErrorBuffer(BufferDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateErrorBuffer(Get(), reinterpret_cast(descriptor)); + return Buffer::Acquire(result); + } + ExternalTexture Device::CreateErrorExternalTexture() const { + auto result = wgpuDeviceCreateErrorExternalTexture(Get()); + return ExternalTexture::Acquire(result); + } + ShaderModule Device::CreateErrorShaderModule(ShaderModuleDescriptor const * descriptor, char const * errorMessage) const { + auto result = wgpuDeviceCreateErrorShaderModule(Get(), reinterpret_cast(descriptor), reinterpret_cast(errorMessage)); + return ShaderModule::Acquire(result); + } + Texture Device::CreateErrorTexture(TextureDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateErrorTexture(Get(), reinterpret_cast(descriptor)); + return Texture::Acquire(result); + } + ExternalTexture Device::CreateExternalTexture(ExternalTextureDescriptor const * externalTextureDescriptor) const { + auto result = wgpuDeviceCreateExternalTexture(Get(), reinterpret_cast(externalTextureDescriptor)); + return ExternalTexture::Acquire(result); + } + PipelineLayout Device::CreatePipelineLayout(PipelineLayoutDescriptor const * descriptor) const { + auto result = wgpuDeviceCreatePipelineLayout(Get(), reinterpret_cast(descriptor)); + return PipelineLayout::Acquire(result); + } + QuerySet Device::CreateQuerySet(QuerySetDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateQuerySet(Get(), reinterpret_cast(descriptor)); + return QuerySet::Acquire(result); + } + RenderBundleEncoder Device::CreateRenderBundleEncoder(RenderBundleEncoderDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateRenderBundleEncoder(Get(), reinterpret_cast(descriptor)); + return RenderBundleEncoder::Acquire(result); + } + RenderPipeline Device::CreateRenderPipeline(RenderPipelineDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateRenderPipeline(Get(), reinterpret_cast(descriptor)); + return RenderPipeline::Acquire(result); + } + void Device::CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallback callback, void * userdata) const { + wgpuDeviceCreateRenderPipelineAsync(Get(), reinterpret_cast(descriptor), callback, userdata); + } + Future Device::CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallbackInfo callbackInfo) const { + auto result = wgpuDeviceCreateRenderPipelineAsyncF(Get(), reinterpret_cast(descriptor), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + Sampler Device::CreateSampler(SamplerDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateSampler(Get(), reinterpret_cast(descriptor)); + return Sampler::Acquire(result); + } + ShaderModule Device::CreateShaderModule(ShaderModuleDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateShaderModule(Get(), reinterpret_cast(descriptor)); + return ShaderModule::Acquire(result); + } + SwapChain Device::CreateSwapChain(Surface const& surface, SwapChainDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateSwapChain(Get(), surface.Get(), reinterpret_cast(descriptor)); + return SwapChain::Acquire(result); + } + Texture Device::CreateTexture(TextureDescriptor const * descriptor) const { + auto result = wgpuDeviceCreateTexture(Get(), reinterpret_cast(descriptor)); + return Texture::Acquire(result); + } + void Device::Destroy() const { + wgpuDeviceDestroy(Get()); + } + size_t Device::EnumerateFeatures(FeatureName * features) const { + auto result = wgpuDeviceEnumerateFeatures(Get(), reinterpret_cast(features)); + return result; + } + void Device::ForceLoss(DeviceLostReason type, char const * message) const { + wgpuDeviceForceLoss(Get(), static_cast(type), reinterpret_cast(message)); + } + Adapter Device::GetAdapter() const { + auto result = wgpuDeviceGetAdapter(Get()); + return Adapter::Acquire(result); + } + Bool Device::GetLimits(SupportedLimits * limits) const { + auto result = wgpuDeviceGetLimits(Get(), reinterpret_cast(limits)); + return result; + } + Queue Device::GetQueue() const { + auto result = wgpuDeviceGetQueue(Get()); + return Queue::Acquire(result); + } + TextureUsage Device::GetSupportedSurfaceUsage(Surface const& surface) const { + auto result = wgpuDeviceGetSupportedSurfaceUsage(Get(), surface.Get()); + return static_cast(result); + } + Bool Device::HasFeature(FeatureName feature) const { + auto result = wgpuDeviceHasFeature(Get(), static_cast(feature)); + return result; + } + SharedBufferMemory Device::ImportSharedBufferMemory(SharedBufferMemoryDescriptor const * descriptor) const { + auto result = wgpuDeviceImportSharedBufferMemory(Get(), reinterpret_cast(descriptor)); + return SharedBufferMemory::Acquire(result); + } + SharedFence Device::ImportSharedFence(SharedFenceDescriptor const * descriptor) const { + auto result = wgpuDeviceImportSharedFence(Get(), reinterpret_cast(descriptor)); + return SharedFence::Acquire(result); + } + SharedTextureMemory Device::ImportSharedTextureMemory(SharedTextureMemoryDescriptor const * descriptor) const { + auto result = wgpuDeviceImportSharedTextureMemory(Get(), reinterpret_cast(descriptor)); + return SharedTextureMemory::Acquire(result); + } + void Device::InjectError(ErrorType type, char const * message) const { + wgpuDeviceInjectError(Get(), static_cast(type), reinterpret_cast(message)); + } + void Device::PopErrorScope(ErrorCallback oldCallback, void * userdata) const { + wgpuDevicePopErrorScope(Get(), oldCallback, userdata); + } + Future Device::PopErrorScope(PopErrorScopeCallbackInfo callbackInfo) const { + auto result = wgpuDevicePopErrorScopeF(Get(), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + void Device::PushErrorScope(ErrorFilter filter) const { + wgpuDevicePushErrorScope(Get(), static_cast(filter)); + } + void Device::SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const { + wgpuDeviceSetDeviceLostCallback(Get(), callback, userdata); + } + void Device::SetLabel(char const * label) const { + wgpuDeviceSetLabel(Get(), reinterpret_cast(label)); + } + void Device::SetLoggingCallback(LoggingCallback callback, void * userdata) const { + wgpuDeviceSetLoggingCallback(Get(), callback, userdata); + } + void Device::SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const { + wgpuDeviceSetUncapturedErrorCallback(Get(), callback, userdata); + } + void Device::Tick() const { + wgpuDeviceTick(Get()); + } + void Device::ValidateTextureDescriptor(TextureDescriptor const * descriptor) const { + wgpuDeviceValidateTextureDescriptor(Get(), reinterpret_cast(descriptor)); + } + void Device::WGPUReference(WGPUDevice handle) { + if (handle != nullptr) { + wgpuDeviceReference(handle); + } + } + void Device::WGPURelease(WGPUDevice handle) { + if (handle != nullptr) { + wgpuDeviceRelease(handle); + } + } + + // ExternalTexture + + static_assert(sizeof(ExternalTexture) == sizeof(WGPUExternalTexture), "sizeof mismatch for ExternalTexture"); + static_assert(alignof(ExternalTexture) == alignof(WGPUExternalTexture), "alignof mismatch for ExternalTexture"); + + void ExternalTexture::Destroy() const { + wgpuExternalTextureDestroy(Get()); + } + void ExternalTexture::Expire() const { + wgpuExternalTextureExpire(Get()); + } + void ExternalTexture::Refresh() const { + wgpuExternalTextureRefresh(Get()); + } + void ExternalTexture::SetLabel(char const * label) const { + wgpuExternalTextureSetLabel(Get(), reinterpret_cast(label)); + } + void ExternalTexture::WGPUReference(WGPUExternalTexture handle) { + if (handle != nullptr) { + wgpuExternalTextureReference(handle); + } + } + void ExternalTexture::WGPURelease(WGPUExternalTexture handle) { + if (handle != nullptr) { + wgpuExternalTextureRelease(handle); + } + } + + // Instance + + static_assert(sizeof(Instance) == sizeof(WGPUInstance), "sizeof mismatch for Instance"); + static_assert(alignof(Instance) == alignof(WGPUInstance), "alignof mismatch for Instance"); + + Surface Instance::CreateSurface(SurfaceDescriptor const * descriptor) const { + auto result = wgpuInstanceCreateSurface(Get(), reinterpret_cast(descriptor)); + return Surface::Acquire(result); + } + size_t Instance::EnumerateWGSLLanguageFeatures(WGSLFeatureName * features) const { + auto result = wgpuInstanceEnumerateWGSLLanguageFeatures(Get(), reinterpret_cast(features)); + return result; + } + Bool Instance::HasWGSLLanguageFeature(WGSLFeatureName feature) const { + auto result = wgpuInstanceHasWGSLLanguageFeature(Get(), static_cast(feature)); + return result; + } + void Instance::ProcessEvents() const { + wgpuInstanceProcessEvents(Get()); + } + void Instance::RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallback callback, void * userdata) const { + wgpuInstanceRequestAdapter(Get(), reinterpret_cast(options), callback, userdata); + } + Future Instance::RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallbackInfo callbackInfo) const { + auto result = wgpuInstanceRequestAdapterF(Get(), reinterpret_cast(options), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + WaitStatus Instance::WaitAny(size_t futureCount, FutureWaitInfo * futures, uint64_t timeoutNS) const { + auto result = wgpuInstanceWaitAny(Get(), futureCount, reinterpret_cast(futures), timeoutNS); + return static_cast(result); + } + void Instance::WGPUReference(WGPUInstance handle) { + if (handle != nullptr) { + wgpuInstanceReference(handle); + } + } + void Instance::WGPURelease(WGPUInstance handle) { + if (handle != nullptr) { + wgpuInstanceRelease(handle); + } + } + + // PipelineLayout + + static_assert(sizeof(PipelineLayout) == sizeof(WGPUPipelineLayout), "sizeof mismatch for PipelineLayout"); + static_assert(alignof(PipelineLayout) == alignof(WGPUPipelineLayout), "alignof mismatch for PipelineLayout"); + + void PipelineLayout::SetLabel(char const * label) const { + wgpuPipelineLayoutSetLabel(Get(), reinterpret_cast(label)); + } + void PipelineLayout::WGPUReference(WGPUPipelineLayout handle) { + if (handle != nullptr) { + wgpuPipelineLayoutReference(handle); + } + } + void PipelineLayout::WGPURelease(WGPUPipelineLayout handle) { + if (handle != nullptr) { + wgpuPipelineLayoutRelease(handle); + } + } + + // QuerySet + + static_assert(sizeof(QuerySet) == sizeof(WGPUQuerySet), "sizeof mismatch for QuerySet"); + static_assert(alignof(QuerySet) == alignof(WGPUQuerySet), "alignof mismatch for QuerySet"); + + void QuerySet::Destroy() const { + wgpuQuerySetDestroy(Get()); + } + uint32_t QuerySet::GetCount() const { + auto result = wgpuQuerySetGetCount(Get()); + return result; + } + QueryType QuerySet::GetType() const { + auto result = wgpuQuerySetGetType(Get()); + return static_cast(result); + } + void QuerySet::SetLabel(char const * label) const { + wgpuQuerySetSetLabel(Get(), reinterpret_cast(label)); + } + void QuerySet::WGPUReference(WGPUQuerySet handle) { + if (handle != nullptr) { + wgpuQuerySetReference(handle); + } + } + void QuerySet::WGPURelease(WGPUQuerySet handle) { + if (handle != nullptr) { + wgpuQuerySetRelease(handle); + } + } + + // Queue + + static_assert(sizeof(Queue) == sizeof(WGPUQueue), "sizeof mismatch for Queue"); + static_assert(alignof(Queue) == alignof(WGPUQueue), "alignof mismatch for Queue"); + + void Queue::CopyExternalTextureForBrowser(ImageCopyExternalTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const { + wgpuQueueCopyExternalTextureForBrowser(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize), reinterpret_cast(options)); + } + void Queue::CopyTextureForBrowser(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const { + wgpuQueueCopyTextureForBrowser(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize), reinterpret_cast(options)); + } + void Queue::OnSubmittedWorkDone(QueueWorkDoneCallback callback, void * userdata) const { + wgpuQueueOnSubmittedWorkDone(Get(), callback, userdata); + } + Future Queue::OnSubmittedWorkDone(QueueWorkDoneCallbackInfo callbackInfo) const { + auto result = wgpuQueueOnSubmittedWorkDoneF(Get(), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + void Queue::SetLabel(char const * label) const { + wgpuQueueSetLabel(Get(), reinterpret_cast(label)); + } + void Queue::Submit(size_t commandCount, CommandBuffer const * commands) const { + wgpuQueueSubmit(Get(), commandCount, reinterpret_cast(commands)); + } + void Queue::WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, void const * data, size_t size) const { + wgpuQueueWriteBuffer(Get(), buffer.Get(), bufferOffset, reinterpret_cast(data), size); + } + void Queue::WriteTexture(ImageCopyTexture const * destination, void const * data, size_t dataSize, TextureDataLayout const * dataLayout, Extent3D const * writeSize) const { + wgpuQueueWriteTexture(Get(), reinterpret_cast(destination), reinterpret_cast(data), dataSize, reinterpret_cast(dataLayout), reinterpret_cast(writeSize)); + } + void Queue::WGPUReference(WGPUQueue handle) { + if (handle != nullptr) { + wgpuQueueReference(handle); + } + } + void Queue::WGPURelease(WGPUQueue handle) { + if (handle != nullptr) { + wgpuQueueRelease(handle); + } + } + + // RenderBundle + + static_assert(sizeof(RenderBundle) == sizeof(WGPURenderBundle), "sizeof mismatch for RenderBundle"); + static_assert(alignof(RenderBundle) == alignof(WGPURenderBundle), "alignof mismatch for RenderBundle"); + + void RenderBundle::SetLabel(char const * label) const { + wgpuRenderBundleSetLabel(Get(), reinterpret_cast(label)); + } + void RenderBundle::WGPUReference(WGPURenderBundle handle) { + if (handle != nullptr) { + wgpuRenderBundleReference(handle); + } + } + void RenderBundle::WGPURelease(WGPURenderBundle handle) { + if (handle != nullptr) { + wgpuRenderBundleRelease(handle); + } + } + + // RenderBundleEncoder + + static_assert(sizeof(RenderBundleEncoder) == sizeof(WGPURenderBundleEncoder), "sizeof mismatch for RenderBundleEncoder"); + static_assert(alignof(RenderBundleEncoder) == alignof(WGPURenderBundleEncoder), "alignof mismatch for RenderBundleEncoder"); + + void RenderBundleEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) const { + wgpuRenderBundleEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, firstInstance); + } + void RenderBundleEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) const { + wgpuRenderBundleEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, baseVertex, firstInstance); + } + void RenderBundleEncoder::DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { + wgpuRenderBundleEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), indirectOffset); + } + void RenderBundleEncoder::DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { + wgpuRenderBundleEncoderDrawIndirect(Get(), indirectBuffer.Get(), indirectOffset); + } + RenderBundle RenderBundleEncoder::Finish(RenderBundleDescriptor const * descriptor) const { + auto result = wgpuRenderBundleEncoderFinish(Get(), reinterpret_cast(descriptor)); + return RenderBundle::Acquire(result); + } + void RenderBundleEncoder::InsertDebugMarker(char const * markerLabel) const { + wgpuRenderBundleEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); + } + void RenderBundleEncoder::PopDebugGroup() const { + wgpuRenderBundleEncoderPopDebugGroup(Get()); + } + void RenderBundleEncoder::PushDebugGroup(char const * groupLabel) const { + wgpuRenderBundleEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); + } + void RenderBundleEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { + wgpuRenderBundleEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast(dynamicOffsets)); + } + void RenderBundleEncoder::SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const { + wgpuRenderBundleEncoderSetIndexBuffer(Get(), buffer.Get(), static_cast(format), offset, size); + } + void RenderBundleEncoder::SetLabel(char const * label) const { + wgpuRenderBundleEncoderSetLabel(Get(), reinterpret_cast(label)); + } + void RenderBundleEncoder::SetPipeline(RenderPipeline const& pipeline) const { + wgpuRenderBundleEncoderSetPipeline(Get(), pipeline.Get()); + } + void RenderBundleEncoder::SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset, uint64_t size) const { + wgpuRenderBundleEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size); + } + void RenderBundleEncoder::WGPUReference(WGPURenderBundleEncoder handle) { + if (handle != nullptr) { + wgpuRenderBundleEncoderReference(handle); + } + } + void RenderBundleEncoder::WGPURelease(WGPURenderBundleEncoder handle) { + if (handle != nullptr) { + wgpuRenderBundleEncoderRelease(handle); + } + } + + // RenderPassEncoder + + static_assert(sizeof(RenderPassEncoder) == sizeof(WGPURenderPassEncoder), "sizeof mismatch for RenderPassEncoder"); + static_assert(alignof(RenderPassEncoder) == alignof(WGPURenderPassEncoder), "alignof mismatch for RenderPassEncoder"); + + void RenderPassEncoder::BeginOcclusionQuery(uint32_t queryIndex) const { + wgpuRenderPassEncoderBeginOcclusionQuery(Get(), queryIndex); + } + void RenderPassEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) const { + wgpuRenderPassEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, firstInstance); + } + void RenderPassEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) const { + wgpuRenderPassEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, baseVertex, firstInstance); + } + void RenderPassEncoder::DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { + wgpuRenderPassEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), indirectOffset); + } + void RenderPassEncoder::DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { + wgpuRenderPassEncoderDrawIndirect(Get(), indirectBuffer.Get(), indirectOffset); + } + void RenderPassEncoder::End() const { + wgpuRenderPassEncoderEnd(Get()); + } + void RenderPassEncoder::EndOcclusionQuery() const { + wgpuRenderPassEncoderEndOcclusionQuery(Get()); + } + void RenderPassEncoder::ExecuteBundles(size_t bundleCount, RenderBundle const * bundles) const { + wgpuRenderPassEncoderExecuteBundles(Get(), bundleCount, reinterpret_cast(bundles)); + } + void RenderPassEncoder::InsertDebugMarker(char const * markerLabel) const { + wgpuRenderPassEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); + } + void RenderPassEncoder::PixelLocalStorageBarrier() const { + wgpuRenderPassEncoderPixelLocalStorageBarrier(Get()); + } + void RenderPassEncoder::PopDebugGroup() const { + wgpuRenderPassEncoderPopDebugGroup(Get()); + } + void RenderPassEncoder::PushDebugGroup(char const * groupLabel) const { + wgpuRenderPassEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); + } + void RenderPassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { + wgpuRenderPassEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast(dynamicOffsets)); + } + void RenderPassEncoder::SetBlendConstant(Color const * color) const { + wgpuRenderPassEncoderSetBlendConstant(Get(), reinterpret_cast(color)); + } + void RenderPassEncoder::SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const { + wgpuRenderPassEncoderSetIndexBuffer(Get(), buffer.Get(), static_cast(format), offset, size); + } + void RenderPassEncoder::SetLabel(char const * label) const { + wgpuRenderPassEncoderSetLabel(Get(), reinterpret_cast(label)); + } + void RenderPassEncoder::SetPipeline(RenderPipeline const& pipeline) const { + wgpuRenderPassEncoderSetPipeline(Get(), pipeline.Get()); + } + void RenderPassEncoder::SetScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height) const { + wgpuRenderPassEncoderSetScissorRect(Get(), x, y, width, height); + } + void RenderPassEncoder::SetStencilReference(uint32_t reference) const { + wgpuRenderPassEncoderSetStencilReference(Get(), reference); + } + void RenderPassEncoder::SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset, uint64_t size) const { + wgpuRenderPassEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size); + } + void RenderPassEncoder::SetViewport(float x, float y, float width, float height, float minDepth, float maxDepth) const { + wgpuRenderPassEncoderSetViewport(Get(), x, y, width, height, minDepth, maxDepth); + } + void RenderPassEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const { + wgpuRenderPassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); + } + void RenderPassEncoder::WGPUReference(WGPURenderPassEncoder handle) { + if (handle != nullptr) { + wgpuRenderPassEncoderReference(handle); + } + } + void RenderPassEncoder::WGPURelease(WGPURenderPassEncoder handle) { + if (handle != nullptr) { + wgpuRenderPassEncoderRelease(handle); + } + } + + // RenderPipeline + + static_assert(sizeof(RenderPipeline) == sizeof(WGPURenderPipeline), "sizeof mismatch for RenderPipeline"); + static_assert(alignof(RenderPipeline) == alignof(WGPURenderPipeline), "alignof mismatch for RenderPipeline"); + + BindGroupLayout RenderPipeline::GetBindGroupLayout(uint32_t groupIndex) const { + auto result = wgpuRenderPipelineGetBindGroupLayout(Get(), groupIndex); + return BindGroupLayout::Acquire(result); + } + void RenderPipeline::SetLabel(char const * label) const { + wgpuRenderPipelineSetLabel(Get(), reinterpret_cast(label)); + } + void RenderPipeline::WGPUReference(WGPURenderPipeline handle) { + if (handle != nullptr) { + wgpuRenderPipelineReference(handle); + } + } + void RenderPipeline::WGPURelease(WGPURenderPipeline handle) { + if (handle != nullptr) { + wgpuRenderPipelineRelease(handle); + } + } + + // Sampler + + static_assert(sizeof(Sampler) == sizeof(WGPUSampler), "sizeof mismatch for Sampler"); + static_assert(alignof(Sampler) == alignof(WGPUSampler), "alignof mismatch for Sampler"); + + void Sampler::SetLabel(char const * label) const { + wgpuSamplerSetLabel(Get(), reinterpret_cast(label)); + } + void Sampler::WGPUReference(WGPUSampler handle) { + if (handle != nullptr) { + wgpuSamplerReference(handle); + } + } + void Sampler::WGPURelease(WGPUSampler handle) { + if (handle != nullptr) { + wgpuSamplerRelease(handle); + } + } + + // ShaderModule + + static_assert(sizeof(ShaderModule) == sizeof(WGPUShaderModule), "sizeof mismatch for ShaderModule"); + static_assert(alignof(ShaderModule) == alignof(WGPUShaderModule), "alignof mismatch for ShaderModule"); + + void ShaderModule::GetCompilationInfo(CompilationInfoCallback callback, void * userdata) const { + wgpuShaderModuleGetCompilationInfo(Get(), callback, userdata); + } + Future ShaderModule::GetCompilationInfo(CompilationInfoCallbackInfo callbackInfo) const { + auto result = wgpuShaderModuleGetCompilationInfoF(Get(), *reinterpret_cast(&callbackInfo)); + return Future { + result.id + }; + } + void ShaderModule::SetLabel(char const * label) const { + wgpuShaderModuleSetLabel(Get(), reinterpret_cast(label)); + } + void ShaderModule::WGPUReference(WGPUShaderModule handle) { + if (handle != nullptr) { + wgpuShaderModuleReference(handle); + } + } + void ShaderModule::WGPURelease(WGPUShaderModule handle) { + if (handle != nullptr) { + wgpuShaderModuleRelease(handle); + } + } + + // SharedBufferMemory + + static_assert(sizeof(SharedBufferMemory) == sizeof(WGPUSharedBufferMemory), "sizeof mismatch for SharedBufferMemory"); + static_assert(alignof(SharedBufferMemory) == alignof(WGPUSharedBufferMemory), "alignof mismatch for SharedBufferMemory"); + + Bool SharedBufferMemory::BeginAccess(Buffer const& buffer, SharedBufferMemoryBeginAccessDescriptor const * descriptor) const { + auto result = wgpuSharedBufferMemoryBeginAccess(Get(), buffer.Get(), reinterpret_cast(descriptor)); + return result; + } + Buffer SharedBufferMemory::CreateBuffer(BufferDescriptor const * descriptor) const { + auto result = wgpuSharedBufferMemoryCreateBuffer(Get(), reinterpret_cast(descriptor)); + return Buffer::Acquire(result); + } + Bool SharedBufferMemory::EndAccess(Buffer const& buffer, SharedBufferMemoryEndAccessState * descriptor) const { + *descriptor = SharedBufferMemoryEndAccessState(); + auto result = wgpuSharedBufferMemoryEndAccess(Get(), buffer.Get(), reinterpret_cast(descriptor)); + return result; + } + void SharedBufferMemory::GetProperties(SharedBufferMemoryProperties * properties) const { + wgpuSharedBufferMemoryGetProperties(Get(), reinterpret_cast(properties)); + } + Bool SharedBufferMemory::IsDeviceLost() const { + auto result = wgpuSharedBufferMemoryIsDeviceLost(Get()); + return result; + } + void SharedBufferMemory::SetLabel(char const * label) const { + wgpuSharedBufferMemorySetLabel(Get(), reinterpret_cast(label)); + } + void SharedBufferMemory::WGPUReference(WGPUSharedBufferMemory handle) { + if (handle != nullptr) { + wgpuSharedBufferMemoryReference(handle); + } + } + void SharedBufferMemory::WGPURelease(WGPUSharedBufferMemory handle) { + if (handle != nullptr) { + wgpuSharedBufferMemoryRelease(handle); + } + } + + // SharedFence + + static_assert(sizeof(SharedFence) == sizeof(WGPUSharedFence), "sizeof mismatch for SharedFence"); + static_assert(alignof(SharedFence) == alignof(WGPUSharedFence), "alignof mismatch for SharedFence"); + + void SharedFence::ExportInfo(SharedFenceExportInfo * info) const { + wgpuSharedFenceExportInfo(Get(), reinterpret_cast(info)); + } + void SharedFence::WGPUReference(WGPUSharedFence handle) { + if (handle != nullptr) { + wgpuSharedFenceReference(handle); + } + } + void SharedFence::WGPURelease(WGPUSharedFence handle) { + if (handle != nullptr) { + wgpuSharedFenceRelease(handle); + } + } + + // SharedTextureMemory + + static_assert(sizeof(SharedTextureMemory) == sizeof(WGPUSharedTextureMemory), "sizeof mismatch for SharedTextureMemory"); + static_assert(alignof(SharedTextureMemory) == alignof(WGPUSharedTextureMemory), "alignof mismatch for SharedTextureMemory"); + + Bool SharedTextureMemory::BeginAccess(Texture const& texture, SharedTextureMemoryBeginAccessDescriptor const * descriptor) const { + auto result = wgpuSharedTextureMemoryBeginAccess(Get(), texture.Get(), reinterpret_cast(descriptor)); + return result; + } + Texture SharedTextureMemory::CreateTexture(TextureDescriptor const * descriptor) const { + auto result = wgpuSharedTextureMemoryCreateTexture(Get(), reinterpret_cast(descriptor)); + return Texture::Acquire(result); + } + Bool SharedTextureMemory::EndAccess(Texture const& texture, SharedTextureMemoryEndAccessState * descriptor) const { + *descriptor = SharedTextureMemoryEndAccessState(); + auto result = wgpuSharedTextureMemoryEndAccess(Get(), texture.Get(), reinterpret_cast(descriptor)); + return result; + } + void SharedTextureMemory::GetProperties(SharedTextureMemoryProperties * properties) const { + wgpuSharedTextureMemoryGetProperties(Get(), reinterpret_cast(properties)); + } + Bool SharedTextureMemory::IsDeviceLost() const { + auto result = wgpuSharedTextureMemoryIsDeviceLost(Get()); + return result; + } + void SharedTextureMemory::SetLabel(char const * label) const { + wgpuSharedTextureMemorySetLabel(Get(), reinterpret_cast(label)); + } + void SharedTextureMemory::WGPUReference(WGPUSharedTextureMemory handle) { + if (handle != nullptr) { + wgpuSharedTextureMemoryReference(handle); + } + } + void SharedTextureMemory::WGPURelease(WGPUSharedTextureMemory handle) { + if (handle != nullptr) { + wgpuSharedTextureMemoryRelease(handle); + } + } + + // Surface + + static_assert(sizeof(Surface) == sizeof(WGPUSurface), "sizeof mismatch for Surface"); + static_assert(alignof(Surface) == alignof(WGPUSurface), "alignof mismatch for Surface"); + + TextureFormat Surface::GetPreferredFormat(Adapter const& adapter) const { + auto result = wgpuSurfaceGetPreferredFormat(Get(), adapter.Get()); + return static_cast(result); + } + void Surface::WGPUReference(WGPUSurface handle) { + if (handle != nullptr) { + wgpuSurfaceReference(handle); + } + } + void Surface::WGPURelease(WGPUSurface handle) { + if (handle != nullptr) { + wgpuSurfaceRelease(handle); + } + } + + // SwapChain + + static_assert(sizeof(SwapChain) == sizeof(WGPUSwapChain), "sizeof mismatch for SwapChain"); + static_assert(alignof(SwapChain) == alignof(WGPUSwapChain), "alignof mismatch for SwapChain"); + + Texture SwapChain::GetCurrentTexture() const { + auto result = wgpuSwapChainGetCurrentTexture(Get()); + return Texture::Acquire(result); + } + TextureView SwapChain::GetCurrentTextureView() const { + auto result = wgpuSwapChainGetCurrentTextureView(Get()); + return TextureView::Acquire(result); + } + void SwapChain::Present() const { + wgpuSwapChainPresent(Get()); + } + void SwapChain::WGPUReference(WGPUSwapChain handle) { + if (handle != nullptr) { + wgpuSwapChainReference(handle); + } + } + void SwapChain::WGPURelease(WGPUSwapChain handle) { + if (handle != nullptr) { + wgpuSwapChainRelease(handle); + } + } + + // Texture + + static_assert(sizeof(Texture) == sizeof(WGPUTexture), "sizeof mismatch for Texture"); + static_assert(alignof(Texture) == alignof(WGPUTexture), "alignof mismatch for Texture"); + + TextureView Texture::CreateErrorView(TextureViewDescriptor const * descriptor) const { + auto result = wgpuTextureCreateErrorView(Get(), reinterpret_cast(descriptor)); + return TextureView::Acquire(result); + } + TextureView Texture::CreateView(TextureViewDescriptor const * descriptor) const { + auto result = wgpuTextureCreateView(Get(), reinterpret_cast(descriptor)); + return TextureView::Acquire(result); + } + void Texture::Destroy() const { + wgpuTextureDestroy(Get()); + } + uint32_t Texture::GetDepthOrArrayLayers() const { + auto result = wgpuTextureGetDepthOrArrayLayers(Get()); + return result; + } + TextureDimension Texture::GetDimension() const { + auto result = wgpuTextureGetDimension(Get()); + return static_cast(result); + } + TextureFormat Texture::GetFormat() const { + auto result = wgpuTextureGetFormat(Get()); + return static_cast(result); + } + uint32_t Texture::GetHeight() const { + auto result = wgpuTextureGetHeight(Get()); + return result; + } + uint32_t Texture::GetMipLevelCount() const { + auto result = wgpuTextureGetMipLevelCount(Get()); + return result; + } + uint32_t Texture::GetSampleCount() const { + auto result = wgpuTextureGetSampleCount(Get()); + return result; + } + TextureUsage Texture::GetUsage() const { + auto result = wgpuTextureGetUsage(Get()); + return static_cast(result); + } + uint32_t Texture::GetWidth() const { + auto result = wgpuTextureGetWidth(Get()); + return result; + } + void Texture::SetLabel(char const * label) const { + wgpuTextureSetLabel(Get(), reinterpret_cast(label)); + } + void Texture::WGPUReference(WGPUTexture handle) { + if (handle != nullptr) { + wgpuTextureReference(handle); + } + } + void Texture::WGPURelease(WGPUTexture handle) { + if (handle != nullptr) { + wgpuTextureRelease(handle); + } + } + + // TextureView + + static_assert(sizeof(TextureView) == sizeof(WGPUTextureView), "sizeof mismatch for TextureView"); + static_assert(alignof(TextureView) == alignof(WGPUTextureView), "alignof mismatch for TextureView"); + + void TextureView::SetLabel(char const * label) const { + wgpuTextureViewSetLabel(Get(), reinterpret_cast(label)); + } + void TextureView::WGPUReference(WGPUTextureView handle) { + if (handle != nullptr) { + wgpuTextureViewReference(handle); + } + } + void TextureView::WGPURelease(WGPUTextureView handle) { + if (handle != nullptr) { + wgpuTextureViewRelease(handle); + } + } + + // Function + + Instance CreateInstance(InstanceDescriptor const * descriptor) { + auto result = wgpuCreateInstance(reinterpret_cast(descriptor)); + return Instance::Acquire(result); + } + Bool GetInstanceFeatures(InstanceFeatures * features) { + auto result = wgpuGetInstanceFeatures(reinterpret_cast(features)); + return result; + } + Proc GetProcAddress(Device device, char const * procName) { + auto result = wgpuGetProcAddress(device.Get(), reinterpret_cast(procName)); + return reinterpret_cast(result); + } + +} diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h index ddf755bd8b..e3e117e0d6 100644 --- a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h +++ b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h @@ -1,13 +1,12 @@ #ifdef __EMSCRIPTEN__ -#error \ - "Do not include this header. Emscripten already provides headers needed for WebGPU." +#error "Do not include this header. Emscripten already provides headers needed for WebGPU." #endif #ifndef WEBGPU_CPP_H_ #define WEBGPU_CPP_H_ -#include "dawn/EnumClassBitmasks.h" -#include "dawn/webgpu.h" -#include "dawn/webgpu_cpp_chained_struct.h" +#include "webgpu/webgpu.h" +#include "webgpu/webgpu_cpp_chained_struct.h" +#include "webgpu/webgpu_enum_class_bitmasks.h" #include #include #include @@ -15,2734 +14,2856 @@ namespace wgpu { -namespace detail { -constexpr size_t ConstexprMax(size_t a, size_t b) { return a > b ? a : b; } -} // namespace detail - -static constexpr uint32_t kArrayLayerCountUndefined = - WGPU_ARRAY_LAYER_COUNT_UNDEFINED; -static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED; -static constexpr uint32_t kDepthSliceUndefined = WGPU_DEPTH_SLICE_UNDEFINED; -static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED; -static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED; -static constexpr uint32_t kMipLevelCountUndefined = - WGPU_MIP_LEVEL_COUNT_UNDEFINED; -static constexpr uint32_t kQuerySetIndexUndefined = - WGPU_QUERY_SET_INDEX_UNDEFINED; -static constexpr size_t kWholeMapSize = WGPU_WHOLE_MAP_SIZE; -static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE; - -enum class WGSLFeatureName : uint32_t { - Undefined = 0x00000000, - ReadonlyAndReadwriteStorageTextures = 0x00000001, - Packed4x8IntegerDotProduct = 0x00000002, - UnrestrictedPointerParameters = 0x00000003, - PointerCompositeAccess = 0x00000004, - ChromiumTestingUnimplemented = 0x000003E8, - ChromiumTestingUnsafeExperimental = 0x000003E9, - ChromiumTestingExperimental = 0x000003EA, - ChromiumTestingShippedWithKillswitch = 0x000003EB, - ChromiumTestingShipped = 0x000003EC, -}; - -enum class AdapterType : uint32_t { - DiscreteGPU = 0x00000000, - IntegratedGPU = 0x00000001, - CPU = 0x00000002, - Unknown = 0x00000003, -}; - -enum class AddressMode : uint32_t { - Repeat = 0x00000000, - MirrorRepeat = 0x00000001, - ClampToEdge = 0x00000002, -}; - -enum class AlphaMode : uint32_t { - Premultiplied = 0x00000000, - Unpremultiplied = 0x00000001, - Opaque = 0x00000002, -}; - -enum class BackendType : uint32_t { - Undefined = 0x00000000, - Null = 0x00000001, - WebGPU = 0x00000002, - D3D11 = 0x00000003, - D3D12 = 0x00000004, - Metal = 0x00000005, - Vulkan = 0x00000006, - OpenGL = 0x00000007, - OpenGLES = 0x00000008, -}; - -enum class BlendFactor : uint32_t { - Zero = 0x00000000, - One = 0x00000001, - Src = 0x00000002, - OneMinusSrc = 0x00000003, - SrcAlpha = 0x00000004, - OneMinusSrcAlpha = 0x00000005, - Dst = 0x00000006, - OneMinusDst = 0x00000007, - DstAlpha = 0x00000008, - OneMinusDstAlpha = 0x00000009, - SrcAlphaSaturated = 0x0000000A, - Constant = 0x0000000B, - OneMinusConstant = 0x0000000C, - Src1 = 0x0000000D, - OneMinusSrc1 = 0x0000000E, - Src1Alpha = 0x0000000F, - OneMinusSrc1Alpha = 0x00000010, -}; - -enum class BlendOperation : uint32_t { - Add = 0x00000000, - Subtract = 0x00000001, - ReverseSubtract = 0x00000002, - Min = 0x00000003, - Max = 0x00000004, -}; - -enum class BufferBindingType : uint32_t { - Undefined = 0x00000000, - Uniform = 0x00000001, - Storage = 0x00000002, - ReadOnlyStorage = 0x00000003, -}; - -enum class BufferMapAsyncStatus : uint32_t { - Success = 0x00000000, - ValidationError = 0x00000001, - Unknown = 0x00000002, - DeviceLost = 0x00000003, - DestroyedBeforeCallback = 0x00000004, - UnmappedBeforeCallback = 0x00000005, - MappingAlreadyPending = 0x00000006, - OffsetOutOfRange = 0x00000007, - SizeOutOfRange = 0x00000008, -}; - -enum class BufferMapState : uint32_t { - Unmapped = 0x00000000, - Pending = 0x00000001, - Mapped = 0x00000002, -}; - -enum class CallbackMode : uint32_t { - WaitAnyOnly = 0x00000000, - AllowProcessEvents = 0x00000001, - AllowSpontaneous = 0x00000002, -}; - -enum class CompareFunction : uint32_t { - Undefined = 0x00000000, - Never = 0x00000001, - Less = 0x00000002, - LessEqual = 0x00000003, - Greater = 0x00000004, - GreaterEqual = 0x00000005, - Equal = 0x00000006, - NotEqual = 0x00000007, - Always = 0x00000008, -}; - -enum class CompilationInfoRequestStatus : uint32_t { - Success = 0x00000000, - Error = 0x00000001, - DeviceLost = 0x00000002, - Unknown = 0x00000003, -}; - -enum class CompilationMessageType : uint32_t { - Error = 0x00000000, - Warning = 0x00000001, - Info = 0x00000002, -}; - -enum class CreatePipelineAsyncStatus : uint32_t { - Success = 0x00000000, - ValidationError = 0x00000001, - InternalError = 0x00000002, - DeviceLost = 0x00000003, - DeviceDestroyed = 0x00000004, - Unknown = 0x00000005, -}; - -enum class CullMode : uint32_t { - None = 0x00000000, - Front = 0x00000001, - Back = 0x00000002, -}; - -enum class DeviceLostReason : uint32_t { - Undefined = 0x00000000, - Destroyed = 0x00000001, -}; - -enum class ErrorFilter : uint32_t { - Validation = 0x00000000, - OutOfMemory = 0x00000001, - Internal = 0x00000002, -}; - -enum class ErrorType : uint32_t { - NoError = 0x00000000, - Validation = 0x00000001, - OutOfMemory = 0x00000002, - Internal = 0x00000003, - Unknown = 0x00000004, - DeviceLost = 0x00000005, -}; - -enum class ExternalTextureRotation : uint32_t { - Rotate0Degrees = 0x00000000, - Rotate90Degrees = 0x00000001, - Rotate180Degrees = 0x00000002, - Rotate270Degrees = 0x00000003, -}; - -enum class FeatureName : uint32_t { - Undefined = 0x00000000, - DepthClipControl = 0x00000001, - Depth32FloatStencil8 = 0x00000002, - TimestampQuery = 0x00000003, - TextureCompressionBC = 0x00000004, - TextureCompressionETC2 = 0x00000005, - TextureCompressionASTC = 0x00000006, - IndirectFirstInstance = 0x00000007, - ShaderF16 = 0x00000008, - RG11B10UfloatRenderable = 0x00000009, - BGRA8UnormStorage = 0x0000000A, - Float32Filterable = 0x0000000B, - DawnInternalUsages = 0x000003EA, - DawnMultiPlanarFormats = 0x000003EB, - DawnNative = 0x000003EC, - ChromiumExperimentalDp4a = 0x000003ED, - ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, - ImplicitDeviceSynchronization = 0x000003EF, - SurfaceCapabilities = 0x000003F0, - TransientAttachments = 0x000003F1, - MSAARenderToSingleSampled = 0x000003F2, - DualSourceBlending = 0x000003F3, - D3D11MultithreadProtected = 0x000003F4, - ANGLETextureSharing = 0x000003F5, - ChromiumExperimentalSubgroups = 0x000003F6, - ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, - PixelLocalStorageCoherent = 0x000003F9, - PixelLocalStorageNonCoherent = 0x000003FA, - Norm16TextureFormats = 0x000003FB, - MultiPlanarFormatExtendedUsages = 0x000003FC, - MultiPlanarFormatP010 = 0x000003FD, - HostMappedPointer = 0x000003FE, - MultiPlanarRenderTargets = 0x000003FF, - MultiPlanarFormatNv12a = 0x00000400, - FramebufferFetch = 0x00000401, - BufferMapExtendedUsages = 0x00000402, - AdapterPropertiesMemoryHeaps = 0x00000403, - SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, - SharedTextureMemoryAHardwareBuffer = 0x0000044D, - SharedTextureMemoryDmaBuf = 0x0000044E, - SharedTextureMemoryOpaqueFD = 0x0000044F, - SharedTextureMemoryZirconHandle = 0x00000450, - SharedTextureMemoryDXGISharedHandle = 0x00000451, - SharedTextureMemoryD3D11Texture2D = 0x00000452, - SharedTextureMemoryIOSurface = 0x00000453, - SharedTextureMemoryEGLImage = 0x00000454, - SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, - SharedFenceVkSemaphoreSyncFD = 0x000004B1, - SharedFenceVkSemaphoreZirconHandle = 0x000004B2, - SharedFenceDXGISharedHandle = 0x000004B3, - SharedFenceMTLSharedEvent = 0x000004B4, -}; - -enum class FilterMode : uint32_t { - Nearest = 0x00000000, - Linear = 0x00000001, -}; - -enum class FrontFace : uint32_t { - CCW = 0x00000000, - CW = 0x00000001, -}; - -enum class IndexFormat : uint32_t { - Undefined = 0x00000000, - Uint16 = 0x00000001, - Uint32 = 0x00000002, -}; - -enum class LoadOp : uint32_t { - Undefined = 0x00000000, - Clear = 0x00000001, - Load = 0x00000002, -}; - -enum class LoggingType : uint32_t { - Verbose = 0x00000000, - Info = 0x00000001, - Warning = 0x00000002, - Error = 0x00000003, -}; - -enum class MipmapFilterMode : uint32_t { - Nearest = 0x00000000, - Linear = 0x00000001, -}; - -enum class PowerPreference : uint32_t { - Undefined = 0x00000000, - LowPower = 0x00000001, - HighPerformance = 0x00000002, -}; - -enum class PresentMode : uint32_t { - Fifo = 0x00000000, - Immediate = 0x00000002, - Mailbox = 0x00000003, -}; - -enum class PrimitiveTopology : uint32_t { - PointList = 0x00000000, - LineList = 0x00000001, - LineStrip = 0x00000002, - TriangleList = 0x00000003, - TriangleStrip = 0x00000004, -}; - -enum class QueryType : uint32_t { - Occlusion = 0x00000000, - Timestamp = 0x00000001, -}; - -enum class QueueWorkDoneStatus : uint32_t { - Success = 0x00000000, - Error = 0x00000001, - Unknown = 0x00000002, - DeviceLost = 0x00000003, -}; - -enum class RequestAdapterStatus : uint32_t { - Success = 0x00000000, - Unavailable = 0x00000001, - Error = 0x00000002, - Unknown = 0x00000003, -}; - -enum class RequestDeviceStatus : uint32_t { - Success = 0x00000000, - Error = 0x00000001, - Unknown = 0x00000002, -}; - -enum class SType : uint32_t { - Invalid = 0x00000000, - SurfaceDescriptorFromMetalLayer = 0x00000001, - SurfaceDescriptorFromWindowsHWND = 0x00000002, - SurfaceDescriptorFromXlibWindow = 0x00000003, - SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, - ShaderModuleSPIRVDescriptor = 0x00000005, - ShaderModuleWGSLDescriptor = 0x00000006, - PrimitiveDepthClipControl = 0x00000007, - SurfaceDescriptorFromWaylandSurface = 0x00000008, - SurfaceDescriptorFromAndroidNativeWindow = 0x00000009, - SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, - ExternalTextureBindingEntry = 0x0000000C, - ExternalTextureBindingLayout = 0x0000000D, - SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, - RenderPassDescriptorMaxDrawCount = 0x0000000F, - DepthStencilStateDepthWriteDefinedDawn = 0x00000010, - TextureBindingViewDimensionDescriptor = 0x00000011, - DawnTextureInternalUsageDescriptor = 0x000003E8, - DawnEncoderInternalUsageDescriptor = 0x000003EB, - DawnInstanceDescriptor = 0x000003EC, - DawnCacheDeviceDescriptor = 0x000003ED, - DawnAdapterPropertiesPowerPreference = 0x000003EE, - DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, - DawnTogglesDescriptor = 0x000003F0, - DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, - RequestAdapterOptionsLUID = 0x000003F2, - RequestAdapterOptionsGetGLProc = 0x000003F3, - RequestAdapterOptionsD3D11Device = 0x000003F4, - DawnMultisampleStateRenderToSingleSampled = 0x000003F5, - DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, - RenderPassPixelLocalStorage = 0x000003F7, - PipelineLayoutPixelLocalStorage = 0x000003F8, - BufferHostMappedPointer = 0x000003F9, - DawnExperimentalSubgroupLimits = 0x000003FA, - AdapterPropertiesMemoryHeaps = 0x000003FB, - DawnComputePipelineFullSubgroups = 0x000003FC, - SharedTextureMemoryVkImageDescriptor = 0x0000044C, - SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, - SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, - SharedTextureMemoryDmaBufDescriptor = 0x0000044F, - SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, - SharedTextureMemoryZirconHandleDescriptor = 0x00000451, - SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, - SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, - SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, - SharedTextureMemoryEGLImageDescriptor = 0x00000455, - SharedTextureMemoryInitializedBeginState = 0x000004B0, - SharedTextureMemoryInitializedEndState = 0x000004B1, - SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, - SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, - SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, - SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, - SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, - SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, - SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, - SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, - SharedFenceDXGISharedHandleDescriptor = 0x000004BA, - SharedFenceDXGISharedHandleExportInfo = 0x000004BB, - SharedFenceMTLSharedEventDescriptor = 0x000004BC, - SharedFenceMTLSharedEventExportInfo = 0x000004BD, -}; - -enum class SamplerBindingType : uint32_t { - Undefined = 0x00000000, - Filtering = 0x00000001, - NonFiltering = 0x00000002, - Comparison = 0x00000003, -}; - -enum class SharedFenceType : uint32_t { - Undefined = 0x00000000, - VkSemaphoreOpaqueFD = 0x00000001, - VkSemaphoreSyncFD = 0x00000002, - VkSemaphoreZirconHandle = 0x00000003, - DXGISharedHandle = 0x00000004, - MTLSharedEvent = 0x00000005, -}; - -enum class StencilOperation : uint32_t { - Keep = 0x00000000, - Zero = 0x00000001, - Replace = 0x00000002, - Invert = 0x00000003, - IncrementClamp = 0x00000004, - DecrementClamp = 0x00000005, - IncrementWrap = 0x00000006, - DecrementWrap = 0x00000007, -}; - -enum class StorageTextureAccess : uint32_t { - Undefined = 0x00000000, - WriteOnly = 0x00000001, - ReadOnly = 0x00000002, - ReadWrite = 0x00000003, -}; - -enum class StoreOp : uint32_t { - Undefined = 0x00000000, - Store = 0x00000001, - Discard = 0x00000002, -}; - -enum class TextureAspect : uint32_t { - All = 0x00000000, - StencilOnly = 0x00000001, - DepthOnly = 0x00000002, - Plane0Only = 0x00000003, - Plane1Only = 0x00000004, - Plane2Only = 0x00000005, -}; - -enum class TextureDimension : uint32_t { - e1D = 0x00000000, - e2D = 0x00000001, - e3D = 0x00000002, -}; - -enum class TextureFormat : uint32_t { - Undefined = 0x00000000, - R8Unorm = 0x00000001, - R8Snorm = 0x00000002, - R8Uint = 0x00000003, - R8Sint = 0x00000004, - R16Uint = 0x00000005, - R16Sint = 0x00000006, - R16Float = 0x00000007, - RG8Unorm = 0x00000008, - RG8Snorm = 0x00000009, - RG8Uint = 0x0000000A, - RG8Sint = 0x0000000B, - R32Float = 0x0000000C, - R32Uint = 0x0000000D, - R32Sint = 0x0000000E, - RG16Uint = 0x0000000F, - RG16Sint = 0x00000010, - RG16Float = 0x00000011, - RGBA8Unorm = 0x00000012, - RGBA8UnormSrgb = 0x00000013, - RGBA8Snorm = 0x00000014, - RGBA8Uint = 0x00000015, - RGBA8Sint = 0x00000016, - BGRA8Unorm = 0x00000017, - BGRA8UnormSrgb = 0x00000018, - RGB10A2Uint = 0x00000019, - RGB10A2Unorm = 0x0000001A, - RG11B10Ufloat = 0x0000001B, - RGB9E5Ufloat = 0x0000001C, - RG32Float = 0x0000001D, - RG32Uint = 0x0000001E, - RG32Sint = 0x0000001F, - RGBA16Uint = 0x00000020, - RGBA16Sint = 0x00000021, - RGBA16Float = 0x00000022, - RGBA32Float = 0x00000023, - RGBA32Uint = 0x00000024, - RGBA32Sint = 0x00000025, - Stencil8 = 0x00000026, - Depth16Unorm = 0x00000027, - Depth24Plus = 0x00000028, - Depth24PlusStencil8 = 0x00000029, - Depth32Float = 0x0000002A, - Depth32FloatStencil8 = 0x0000002B, - BC1RGBAUnorm = 0x0000002C, - BC1RGBAUnormSrgb = 0x0000002D, - BC2RGBAUnorm = 0x0000002E, - BC2RGBAUnormSrgb = 0x0000002F, - BC3RGBAUnorm = 0x00000030, - BC3RGBAUnormSrgb = 0x00000031, - BC4RUnorm = 0x00000032, - BC4RSnorm = 0x00000033, - BC5RGUnorm = 0x00000034, - BC5RGSnorm = 0x00000035, - BC6HRGBUfloat = 0x00000036, - BC6HRGBFloat = 0x00000037, - BC7RGBAUnorm = 0x00000038, - BC7RGBAUnormSrgb = 0x00000039, - ETC2RGB8Unorm = 0x0000003A, - ETC2RGB8UnormSrgb = 0x0000003B, - ETC2RGB8A1Unorm = 0x0000003C, - ETC2RGB8A1UnormSrgb = 0x0000003D, - ETC2RGBA8Unorm = 0x0000003E, - ETC2RGBA8UnormSrgb = 0x0000003F, - EACR11Unorm = 0x00000040, - EACR11Snorm = 0x00000041, - EACRG11Unorm = 0x00000042, - EACRG11Snorm = 0x00000043, - ASTC4x4Unorm = 0x00000044, - ASTC4x4UnormSrgb = 0x00000045, - ASTC5x4Unorm = 0x00000046, - ASTC5x4UnormSrgb = 0x00000047, - ASTC5x5Unorm = 0x00000048, - ASTC5x5UnormSrgb = 0x00000049, - ASTC6x5Unorm = 0x0000004A, - ASTC6x5UnormSrgb = 0x0000004B, - ASTC6x6Unorm = 0x0000004C, - ASTC6x6UnormSrgb = 0x0000004D, - ASTC8x5Unorm = 0x0000004E, - ASTC8x5UnormSrgb = 0x0000004F, - ASTC8x6Unorm = 0x00000050, - ASTC8x6UnormSrgb = 0x00000051, - ASTC8x8Unorm = 0x00000052, - ASTC8x8UnormSrgb = 0x00000053, - ASTC10x5Unorm = 0x00000054, - ASTC10x5UnormSrgb = 0x00000055, - ASTC10x6Unorm = 0x00000056, - ASTC10x6UnormSrgb = 0x00000057, - ASTC10x8Unorm = 0x00000058, - ASTC10x8UnormSrgb = 0x00000059, - ASTC10x10Unorm = 0x0000005A, - ASTC10x10UnormSrgb = 0x0000005B, - ASTC12x10Unorm = 0x0000005C, - ASTC12x10UnormSrgb = 0x0000005D, - ASTC12x12Unorm = 0x0000005E, - ASTC12x12UnormSrgb = 0x0000005F, - R16Unorm = 0x00000060, - RG16Unorm = 0x00000061, - RGBA16Unorm = 0x00000062, - R16Snorm = 0x00000063, - RG16Snorm = 0x00000064, - RGBA16Snorm = 0x00000065, - R8BG8Biplanar420Unorm = 0x00000066, - R10X6BG10X6Biplanar420Unorm = 0x00000067, - R8BG8A8Triplanar420Unorm = 0x00000068, -}; - -enum class TextureSampleType : uint32_t { - Undefined = 0x00000000, - Float = 0x00000001, - UnfilterableFloat = 0x00000002, - Depth = 0x00000003, - Sint = 0x00000004, - Uint = 0x00000005, -}; - -enum class TextureViewDimension : uint32_t { - Undefined = 0x00000000, - e1D = 0x00000001, - e2D = 0x00000002, - e2DArray = 0x00000003, - Cube = 0x00000004, - CubeArray = 0x00000005, - e3D = 0x00000006, -}; - -enum class VertexFormat : uint32_t { - Undefined = 0x00000000, - Uint8x2 = 0x00000001, - Uint8x4 = 0x00000002, - Sint8x2 = 0x00000003, - Sint8x4 = 0x00000004, - Unorm8x2 = 0x00000005, - Unorm8x4 = 0x00000006, - Snorm8x2 = 0x00000007, - Snorm8x4 = 0x00000008, - Uint16x2 = 0x00000009, - Uint16x4 = 0x0000000A, - Sint16x2 = 0x0000000B, - Sint16x4 = 0x0000000C, - Unorm16x2 = 0x0000000D, - Unorm16x4 = 0x0000000E, - Snorm16x2 = 0x0000000F, - Snorm16x4 = 0x00000010, - Float16x2 = 0x00000011, - Float16x4 = 0x00000012, - Float32 = 0x00000013, - Float32x2 = 0x00000014, - Float32x3 = 0x00000015, - Float32x4 = 0x00000016, - Uint32 = 0x00000017, - Uint32x2 = 0x00000018, - Uint32x3 = 0x00000019, - Uint32x4 = 0x0000001A, - Sint32 = 0x0000001B, - Sint32x2 = 0x0000001C, - Sint32x3 = 0x0000001D, - Sint32x4 = 0x0000001E, - Unorm10_10_10_2 = 0x0000001F, -}; - -enum class VertexStepMode : uint32_t { - Vertex = 0x00000000, - Instance = 0x00000001, - VertexBufferNotUsed = 0x00000002, -}; - -enum class WaitStatus : uint32_t { - Success = 0x00000000, - TimedOut = 0x00000001, - UnsupportedTimeout = 0x00000002, - UnsupportedCount = 0x00000003, - UnsupportedMixedSources = 0x00000004, - Unknown = 0x00000005, -}; - -enum class BufferUsage : uint32_t { - None = 0x00000000, - MapRead = 0x00000001, - MapWrite = 0x00000002, - CopySrc = 0x00000004, - CopyDst = 0x00000008, - Index = 0x00000010, - Vertex = 0x00000020, - Uniform = 0x00000040, - Storage = 0x00000080, - Indirect = 0x00000100, - QueryResolve = 0x00000200, -}; - -enum class ColorWriteMask : uint32_t { - None = 0x00000000, - Red = 0x00000001, - Green = 0x00000002, - Blue = 0x00000004, - Alpha = 0x00000008, - All = 0x0000000F, -}; - -enum class HeapProperty : uint32_t { - Undefined = 0x00000000, - DeviceLocal = 0x00000001, - HostVisible = 0x00000002, - HostCoherent = 0x00000004, - HostUncached = 0x00000008, - HostCached = 0x00000010, -}; - -enum class MapMode : uint32_t { - None = 0x00000000, - Read = 0x00000001, - Write = 0x00000002, -}; - -enum class ShaderStage : uint32_t { - None = 0x00000000, - Vertex = 0x00000001, - Fragment = 0x00000002, - Compute = 0x00000004, -}; - -enum class TextureUsage : uint32_t { - None = 0x00000000, - CopySrc = 0x00000001, - CopyDst = 0x00000002, - TextureBinding = 0x00000004, - StorageBinding = 0x00000008, - RenderAttachment = 0x00000010, - TransientAttachment = 0x00000020, - StorageAttachment = 0x00000040, -}; - -using BufferMapCallback = WGPUBufferMapCallback; -using Callback = WGPUCallback; -using CompilationInfoCallback = WGPUCompilationInfoCallback; -using CreateComputePipelineAsyncCallback = - WGPUCreateComputePipelineAsyncCallback; -using CreateRenderPipelineAsyncCallback = WGPUCreateRenderPipelineAsyncCallback; -using DeviceLostCallback = WGPUDeviceLostCallback; -using ErrorCallback = WGPUErrorCallback; -using LoggingCallback = WGPULoggingCallback; -using Proc = WGPUProc; -using QueueWorkDoneCallback = WGPUQueueWorkDoneCallback; -using RequestAdapterCallback = WGPURequestAdapterCallback; -using RequestDeviceCallback = WGPURequestDeviceCallback; - -class Adapter; -class BindGroup; -class BindGroupLayout; -class Buffer; -class CommandBuffer; -class CommandEncoder; -class ComputePassEncoder; -class ComputePipeline; -class Device; -class ExternalTexture; -class Instance; -class PipelineLayout; -class QuerySet; -class Queue; -class RenderBundle; -class RenderBundleEncoder; -class RenderPassEncoder; -class RenderPipeline; -class Sampler; -class ShaderModule; -class SharedFence; -class SharedTextureMemory; -class Surface; -class SwapChain; -class Texture; -class TextureView; - -struct AdapterProperties; -struct BindGroupEntry; -struct BlendComponent; -struct BufferBindingLayout; -struct BufferDescriptor; -struct BufferHostMappedPointer; -struct BufferMapCallbackInfo; -struct Color; -struct CommandBufferDescriptor; -struct CommandEncoderDescriptor; -struct CompilationMessage; -struct ComputePassTimestampWrites; -struct ConstantEntry; -struct CopyTextureForBrowserOptions; -struct DawnAdapterPropertiesPowerPreference; -struct DawnBufferDescriptorErrorInfoFromWireClient; -struct DawnCacheDeviceDescriptor; -struct DawnComputePipelineFullSubgroups; -struct DawnEncoderInternalUsageDescriptor; -struct DawnExperimentalSubgroupLimits; -struct DawnMultisampleStateRenderToSingleSampled; -struct DawnRenderPassColorAttachmentRenderToSingleSampled; -struct DawnShaderModuleSPIRVOptionsDescriptor; -struct DawnTextureInternalUsageDescriptor; -struct DawnTogglesDescriptor; -struct DepthStencilStateDepthWriteDefinedDawn; -struct Extent2D; -struct Extent3D; -struct ExternalTextureBindingEntry; -struct ExternalTextureBindingLayout; -struct Future; -struct InstanceFeatures; -struct Limits; -struct MemoryHeapInfo; -struct MultisampleState; -struct Origin2D; -struct Origin3D; -struct PipelineLayoutDescriptor; -struct PipelineLayoutStorageAttachment; -struct PrimitiveDepthClipControl; -struct PrimitiveState; -struct QuerySetDescriptor; -struct QueueDescriptor; -struct QueueWorkDoneCallbackInfo; -struct RenderBundleDescriptor; -struct RenderBundleEncoderDescriptor; -struct RenderPassDepthStencilAttachment; -struct RenderPassDescriptorMaxDrawCount; -struct RenderPassTimestampWrites; -struct RequestAdapterCallbackInfo; -struct RequestAdapterOptions; -struct SamplerBindingLayout; -struct SamplerDescriptor; -struct ShaderModuleSPIRVDescriptor; -struct ShaderModuleWGSLDescriptor; -struct ShaderModuleDescriptor; -struct SharedFenceDXGISharedHandleDescriptor; -struct SharedFenceDXGISharedHandleExportInfo; -struct SharedFenceMTLSharedEventDescriptor; -struct SharedFenceMTLSharedEventExportInfo; -struct SharedFenceDescriptor; -struct SharedFenceExportInfo; -struct SharedFenceVkSemaphoreOpaqueFDDescriptor; -struct SharedFenceVkSemaphoreOpaqueFDExportInfo; -struct SharedFenceVkSemaphoreSyncFDDescriptor; -struct SharedFenceVkSemaphoreSyncFDExportInfo; -struct SharedFenceVkSemaphoreZirconHandleDescriptor; -struct SharedFenceVkSemaphoreZirconHandleExportInfo; -struct SharedTextureMemoryDXGISharedHandleDescriptor; -struct SharedTextureMemoryEGLImageDescriptor; -struct SharedTextureMemoryIOSurfaceDescriptor; -struct SharedTextureMemoryAHardwareBufferDescriptor; -struct SharedTextureMemoryBeginAccessDescriptor; -struct SharedTextureMemoryDescriptor; -struct SharedTextureMemoryDmaBufPlane; -struct SharedTextureMemoryEndAccessState; -struct SharedTextureMemoryOpaqueFDDescriptor; -struct SharedTextureMemoryVkDedicatedAllocationDescriptor; -struct SharedTextureMemoryVkImageLayoutBeginState; -struct SharedTextureMemoryVkImageLayoutEndState; -struct SharedTextureMemoryZirconHandleDescriptor; -struct StencilFaceState; -struct StorageTextureBindingLayout; -struct SurfaceDescriptor; -struct SurfaceDescriptorFromAndroidNativeWindow; -struct SurfaceDescriptorFromCanvasHTMLSelector; -struct SurfaceDescriptorFromMetalLayer; -struct SurfaceDescriptorFromWaylandSurface; -struct SurfaceDescriptorFromWindowsHWND; -struct SurfaceDescriptorFromWindowsCoreWindow; -struct SurfaceDescriptorFromWindowsSwapChainPanel; -struct SurfaceDescriptorFromXlibWindow; -struct SwapChainDescriptor; -struct TextureBindingLayout; -struct TextureBindingViewDimensionDescriptor; -struct TextureDataLayout; -struct TextureViewDescriptor; -struct VertexAttribute; -struct AdapterPropertiesMemoryHeaps; -struct BindGroupDescriptor; -struct BindGroupLayoutEntry; -struct BlendState; -struct CompilationInfo; -struct ComputePassDescriptor; -struct DepthStencilState; -struct ExternalTextureDescriptor; -struct FutureWaitInfo; -struct ImageCopyBuffer; -struct ImageCopyExternalTexture; -struct ImageCopyTexture; -struct InstanceDescriptor; -struct PipelineLayoutPixelLocalStorage; -struct ProgrammableStageDescriptor; -struct RenderPassColorAttachment; -struct RenderPassStorageAttachment; -struct RequiredLimits; -struct SharedTextureMemoryDmaBufDescriptor; -struct SharedTextureMemoryProperties; -struct SharedTextureMemoryVkImageDescriptor; -struct SupportedLimits; -struct TextureDescriptor; -struct VertexBufferLayout; -struct BindGroupLayoutDescriptor; -struct ColorTargetState; -struct ComputePipelineDescriptor; -struct DeviceDescriptor; -struct RenderPassDescriptor; -struct RenderPassPixelLocalStorage; -struct VertexState; -struct FragmentState; -struct RenderPipelineDescriptor; - -// Special class for booleans in order to allow implicit conversions. -class Bool { -public: - constexpr Bool() = default; - // NOLINTNEXTLINE(runtime/explicit) allow implicit construction - constexpr Bool(bool value) : mValue(static_cast(value)) {} - // NOLINTNEXTLINE(runtime/explicit) allow implicit construction - Bool(WGPUBool value) : mValue(value) {} - - constexpr operator bool() const { return static_cast(mValue); } - -private: - friend struct std::hash; - // Default to false. - WGPUBool mValue = static_cast(false); -}; - -template class ObjectBase { -public: - ObjectBase() = default; - ObjectBase(CType handle) : mHandle(handle) { - if (mHandle) - Derived::WGPUReference(mHandle); - } - ~ObjectBase() { - if (mHandle) - Derived::WGPURelease(mHandle); - } - - ObjectBase(ObjectBase const &other) : ObjectBase(other.Get()) {} - Derived &operator=(ObjectBase const &other) { - if (&other != this) { - if (mHandle) - Derived::WGPURelease(mHandle); - mHandle = other.mHandle; - if (mHandle) - Derived::WGPUReference(mHandle); - } - - return static_cast(*this); - } - - ObjectBase(ObjectBase &&other) { - mHandle = other.mHandle; - other.mHandle = 0; - } - Derived &operator=(ObjectBase &&other) { - if (&other != this) { - if (mHandle) - Derived::WGPURelease(mHandle); - mHandle = other.mHandle; - other.mHandle = 0; - } - - return static_cast(*this); - } - - ObjectBase(std::nullptr_t) {} - Derived &operator=(std::nullptr_t) { - if (mHandle != nullptr) { - Derived::WGPURelease(mHandle); - mHandle = nullptr; - } - return static_cast(*this); - } - - bool operator==(std::nullptr_t) const { return mHandle == nullptr; } - bool operator!=(std::nullptr_t) const { return mHandle != nullptr; } - - explicit operator bool() const { return mHandle != nullptr; } - CType Get() const { return mHandle; } - CType MoveToCHandle() { - CType result = mHandle; - mHandle = 0; - return result; - } - static Derived Acquire(CType handle) { - Derived result; - result.mHandle = handle; - return result; - } - -protected: - CType mHandle = nullptr; -}; - -class Adapter : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Device CreateDevice(DeviceDescriptor const *descriptor = nullptr) const; - size_t EnumerateFeatures(FeatureName *features) const; - Instance GetInstance() const; - Bool GetLimits(SupportedLimits *limits) const; - void GetProperties(AdapterProperties *properties) const; - Bool HasFeature(FeatureName feature) const; - void RequestDevice(DeviceDescriptor const *descriptor, - RequestDeviceCallback callback, void *userdata) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUAdapter handle); - static void WGPURelease(WGPUAdapter handle); -}; - -class BindGroup : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUBindGroup handle); - static void WGPURelease(WGPUBindGroup handle); -}; - -class BindGroupLayout - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUBindGroupLayout handle); - static void WGPURelease(WGPUBindGroupLayout handle); -}; - -class Buffer : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Destroy() const; - void const *GetConstMappedRange(size_t offset = 0, - size_t size = WGPU_WHOLE_MAP_SIZE) const; - BufferMapState GetMapState() const; - void *GetMappedRange(size_t offset = 0, - size_t size = WGPU_WHOLE_MAP_SIZE) const; - uint64_t GetSize() const; - BufferUsage GetUsage() const; - void MapAsync(MapMode mode, size_t offset, size_t size, - BufferMapCallback callback, void *userdata) const; - Future MapAsyncF(MapMode mode, size_t offset, size_t size, - BufferMapCallbackInfo callbackInfo) const; - void SetLabel(char const *label) const; - void Unmap() const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUBuffer handle); - static void WGPURelease(WGPUBuffer handle); -}; - -class CommandBuffer : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUCommandBuffer handle); - static void WGPURelease(WGPUCommandBuffer handle); -}; - -class CommandEncoder : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - ComputePassEncoder - BeginComputePass(ComputePassDescriptor const *descriptor = nullptr) const; - RenderPassEncoder - BeginRenderPass(RenderPassDescriptor const *descriptor) const; - void ClearBuffer(Buffer const &buffer, uint64_t offset = 0, - uint64_t size = WGPU_WHOLE_SIZE) const; - void CopyBufferToBuffer(Buffer const &source, uint64_t sourceOffset, - Buffer const &destination, uint64_t destinationOffset, - uint64_t size) const; - void CopyBufferToTexture(ImageCopyBuffer const *source, - ImageCopyTexture const *destination, - Extent3D const *copySize) const; - void CopyTextureToBuffer(ImageCopyTexture const *source, - ImageCopyBuffer const *destination, - Extent3D const *copySize) const; - void CopyTextureToTexture(ImageCopyTexture const *source, - ImageCopyTexture const *destination, - Extent3D const *copySize) const; - CommandBuffer - Finish(CommandBufferDescriptor const *descriptor = nullptr) const; - void InjectValidationError(char const *message) const; - void InsertDebugMarker(char const *markerLabel) const; - void PopDebugGroup() const; - void PushDebugGroup(char const *groupLabel) const; - void ResolveQuerySet(QuerySet const &querySet, uint32_t firstQuery, - uint32_t queryCount, Buffer const &destination, - uint64_t destinationOffset) const; - void SetLabel(char const *label) const; - void WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, - uint8_t const *data, uint64_t size) const; - void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUCommandEncoder handle); - static void WGPURelease(WGPUCommandEncoder handle); -}; - -class ComputePassEncoder - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void DispatchWorkgroups(uint32_t workgroupCountX, - uint32_t workgroupCountY = 1, - uint32_t workgroupCountZ = 1) const; - void DispatchWorkgroupsIndirect(Buffer const &indirectBuffer, - uint64_t indirectOffset) const; - void End() const; - void InsertDebugMarker(char const *markerLabel) const; - void PopDebugGroup() const; - void PushDebugGroup(char const *groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const &group, - size_t dynamicOffsetCount = 0, - uint32_t const *dynamicOffsets = nullptr) const; - void SetLabel(char const *label) const; - void SetPipeline(ComputePipeline const &pipeline) const; - void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUComputePassEncoder handle); - static void WGPURelease(WGPUComputePassEncoder handle); -}; - -class ComputePipeline - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUComputePipeline handle); - static void WGPURelease(WGPUComputePipeline handle); -}; - -class Device : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - BindGroup CreateBindGroup(BindGroupDescriptor const *descriptor) const; - BindGroupLayout - CreateBindGroupLayout(BindGroupLayoutDescriptor const *descriptor) const; - Buffer CreateBuffer(BufferDescriptor const *descriptor) const; - CommandEncoder CreateCommandEncoder( - CommandEncoderDescriptor const *descriptor = nullptr) const; - ComputePipeline - CreateComputePipeline(ComputePipelineDescriptor const *descriptor) const; - void CreateComputePipelineAsync(ComputePipelineDescriptor const *descriptor, - CreateComputePipelineAsyncCallback callback, - void *userdata) const; - Buffer CreateErrorBuffer(BufferDescriptor const *descriptor) const; - ExternalTexture CreateErrorExternalTexture() const; - ShaderModule CreateErrorShaderModule(ShaderModuleDescriptor const *descriptor, - char const *errorMessage) const; - Texture CreateErrorTexture(TextureDescriptor const *descriptor) const; - ExternalTexture CreateExternalTexture( - ExternalTextureDescriptor const *externalTextureDescriptor) const; - PipelineLayout - CreatePipelineLayout(PipelineLayoutDescriptor const *descriptor) const; - QuerySet CreateQuerySet(QuerySetDescriptor const *descriptor) const; - RenderBundleEncoder CreateRenderBundleEncoder( - RenderBundleEncoderDescriptor const *descriptor) const; - RenderPipeline - CreateRenderPipeline(RenderPipelineDescriptor const *descriptor) const; - void CreateRenderPipelineAsync(RenderPipelineDescriptor const *descriptor, - CreateRenderPipelineAsyncCallback callback, - void *userdata) const; - Sampler CreateSampler(SamplerDescriptor const *descriptor = nullptr) const; - ShaderModule - CreateShaderModule(ShaderModuleDescriptor const *descriptor) const; - SwapChain CreateSwapChain(Surface const &surface, - SwapChainDescriptor const *descriptor) const; - Texture CreateTexture(TextureDescriptor const *descriptor) const; - void Destroy() const; - size_t EnumerateFeatures(FeatureName *features) const; - void ForceLoss(DeviceLostReason type, char const *message) const; - Adapter GetAdapter() const; - Bool GetLimits(SupportedLimits *limits) const; - Queue GetQueue() const; - TextureUsage GetSupportedSurfaceUsage(Surface const &surface) const; - Bool HasFeature(FeatureName feature) const; - SharedFence ImportSharedFence(SharedFenceDescriptor const *descriptor) const; - SharedTextureMemory ImportSharedTextureMemory( - SharedTextureMemoryDescriptor const *descriptor) const; - void InjectError(ErrorType type, char const *message) const; - void PopErrorScope(ErrorCallback callback, void *userdata) const; - void PushErrorScope(ErrorFilter filter) const; - void SetDeviceLostCallback(DeviceLostCallback callback, void *userdata) const; - void SetLabel(char const *label) const; - void SetLoggingCallback(LoggingCallback callback, void *userdata) const; - void SetUncapturedErrorCallback(ErrorCallback callback, void *userdata) const; - void Tick() const; - void ValidateTextureDescriptor(TextureDescriptor const *descriptor) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUDevice handle); - static void WGPURelease(WGPUDevice handle); -}; - -class ExternalTexture - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Destroy() const; - void Expire() const; - void Refresh() const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUExternalTexture handle); - static void WGPURelease(WGPUExternalTexture handle); -}; - -class Instance : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Surface CreateSurface(SurfaceDescriptor const *descriptor) const; - size_t EnumerateWGSLLanguageFeatures(WGSLFeatureName *features) const; - Bool HasWGSLLanguageFeature(WGSLFeatureName feature) const; - void ProcessEvents() const; - void RequestAdapter(RequestAdapterOptions const *options, - RequestAdapterCallback callback, void *userdata) const; - Future RequestAdapterF(RequestAdapterOptions const *options, - RequestAdapterCallbackInfo callbackInfo) const; - WaitStatus WaitAny(size_t futureCount, FutureWaitInfo *futures, - uint64_t timeoutNS) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUInstance handle); - static void WGPURelease(WGPUInstance handle); -}; - -class PipelineLayout : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUPipelineLayout handle); - static void WGPURelease(WGPUPipelineLayout handle); -}; - -class QuerySet : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Destroy() const; - uint32_t GetCount() const; - QueryType GetType() const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUQuerySet handle); - static void WGPURelease(WGPUQuerySet handle); -}; - -class Queue : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void CopyExternalTextureForBrowser( - ImageCopyExternalTexture const *source, - ImageCopyTexture const *destination, Extent3D const *copySize, - CopyTextureForBrowserOptions const *options) const; - void CopyTextureForBrowser(ImageCopyTexture const *source, - ImageCopyTexture const *destination, - Extent3D const *copySize, - CopyTextureForBrowserOptions const *options) const; - void OnSubmittedWorkDone(QueueWorkDoneCallback callback, - void *userdata) const; - Future OnSubmittedWorkDoneF(QueueWorkDoneCallbackInfo callbackInfo) const; - void SetLabel(char const *label) const; - void Submit(size_t commandCount, CommandBuffer const *commands) const; - void WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, - void const *data, size_t size) const; - void WriteTexture(ImageCopyTexture const *destination, void const *data, - size_t dataSize, TextureDataLayout const *dataLayout, - Extent3D const *writeSize) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUQueue handle); - static void WGPURelease(WGPUQueue handle); -}; - -class RenderBundle : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPURenderBundle handle); - static void WGPURelease(WGPURenderBundle handle); -}; - -class RenderBundleEncoder - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, - uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; - void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, - uint32_t firstIndex = 0, int32_t baseVertex = 0, - uint32_t firstInstance = 0) const; - void DrawIndexedIndirect(Buffer const &indirectBuffer, - uint64_t indirectOffset) const; - void DrawIndirect(Buffer const &indirectBuffer, - uint64_t indirectOffset) const; - RenderBundle Finish(RenderBundleDescriptor const *descriptor = nullptr) const; - void InsertDebugMarker(char const *markerLabel) const; - void PopDebugGroup() const; - void PushDebugGroup(char const *groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const &group, - size_t dynamicOffsetCount = 0, - uint32_t const *dynamicOffsets = nullptr) const; - void SetIndexBuffer(Buffer const &buffer, IndexFormat format, - uint64_t offset = 0, - uint64_t size = WGPU_WHOLE_SIZE) const; - void SetLabel(char const *label) const; - void SetPipeline(RenderPipeline const &pipeline) const; - void SetVertexBuffer(uint32_t slot, Buffer const &buffer, uint64_t offset = 0, - uint64_t size = WGPU_WHOLE_SIZE) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPURenderBundleEncoder handle); - static void WGPURelease(WGPURenderBundleEncoder handle); -}; - -class RenderPassEncoder - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void BeginOcclusionQuery(uint32_t queryIndex) const; - void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, - uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; - void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, - uint32_t firstIndex = 0, int32_t baseVertex = 0, - uint32_t firstInstance = 0) const; - void DrawIndexedIndirect(Buffer const &indirectBuffer, - uint64_t indirectOffset) const; - void DrawIndirect(Buffer const &indirectBuffer, - uint64_t indirectOffset) const; - void End() const; - void EndOcclusionQuery() const; - void ExecuteBundles(size_t bundleCount, RenderBundle const *bundles) const; - void InsertDebugMarker(char const *markerLabel) const; - void PixelLocalStorageBarrier() const; - void PopDebugGroup() const; - void PushDebugGroup(char const *groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const &group, - size_t dynamicOffsetCount = 0, - uint32_t const *dynamicOffsets = nullptr) const; - void SetBlendConstant(Color const *color) const; - void SetIndexBuffer(Buffer const &buffer, IndexFormat format, - uint64_t offset = 0, - uint64_t size = WGPU_WHOLE_SIZE) const; - void SetLabel(char const *label) const; - void SetPipeline(RenderPipeline const &pipeline) const; - void SetScissorRect(uint32_t x, uint32_t y, uint32_t width, - uint32_t height) const; - void SetStencilReference(uint32_t reference) const; - void SetVertexBuffer(uint32_t slot, Buffer const &buffer, uint64_t offset = 0, - uint64_t size = WGPU_WHOLE_SIZE) const; - void SetViewport(float x, float y, float width, float height, float minDepth, - float maxDepth) const; - void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPURenderPassEncoder handle); - static void WGPURelease(WGPURenderPassEncoder handle); -}; - -class RenderPipeline : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPURenderPipeline handle); - static void WGPURelease(WGPURenderPipeline handle); -}; - -class Sampler : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUSampler handle); - static void WGPURelease(WGPUSampler handle); -}; - -class ShaderModule : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void GetCompilationInfo(CompilationInfoCallback callback, - void *userdata) const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUShaderModule handle); - static void WGPURelease(WGPUShaderModule handle); -}; - -class SharedFence : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void ExportInfo(SharedFenceExportInfo *info) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUSharedFence handle); - static void WGPURelease(WGPUSharedFence handle); -}; - -class SharedTextureMemory - : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Bool - BeginAccess(Texture const &texture, - SharedTextureMemoryBeginAccessDescriptor const *descriptor) const; - Texture CreateTexture(TextureDescriptor const *descriptor = nullptr) const; - Bool EndAccess(Texture const &texture, - SharedTextureMemoryEndAccessState *descriptor) const; - void GetProperties(SharedTextureMemoryProperties *properties) const; - Bool IsDeviceLost() const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUSharedTextureMemory handle); - static void WGPURelease(WGPUSharedTextureMemory handle); -}; - -class Surface : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - -private: - friend ObjectBase; - static void WGPUReference(WGPUSurface handle); - static void WGPURelease(WGPUSurface handle); -}; - -class SwapChain : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Texture GetCurrentTexture() const; - TextureView GetCurrentTextureView() const; - void Present() const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUSwapChain handle); - static void WGPURelease(WGPUSwapChain handle); -}; - -class Texture : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - TextureView - CreateView(TextureViewDescriptor const *descriptor = nullptr) const; - void Destroy() const; - uint32_t GetDepthOrArrayLayers() const; - TextureDimension GetDimension() const; - TextureFormat GetFormat() const; - uint32_t GetHeight() const; - uint32_t GetMipLevelCount() const; - uint32_t GetSampleCount() const; - TextureUsage GetUsage() const; - uint32_t GetWidth() const; - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUTexture handle); - static void WGPURelease(WGPUTexture handle); -}; - -class TextureView : public ObjectBase { -public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const *label) const; - -private: - friend ObjectBase; - static void WGPUReference(WGPUTextureView handle); - static void WGPURelease(WGPUTextureView handle); -}; - -Instance CreateInstance(InstanceDescriptor const *descriptor = nullptr); -Bool GetInstanceFeatures(InstanceFeatures *features); -Proc GetProcAddress(Device device, char const *procName); - -struct AdapterProperties { - AdapterProperties() = default; - ~AdapterProperties(); - AdapterProperties(const AdapterProperties &) = delete; - AdapterProperties &operator=(const AdapterProperties &) = delete; - AdapterProperties(AdapterProperties &&); - AdapterProperties &operator=(AdapterProperties &&); - ChainedStructOut *nextInChain = nullptr; - uint32_t const vendorID = {}; - char const *const vendorName = nullptr; - char const *const architecture = nullptr; - uint32_t const deviceID = {}; - char const *const name = nullptr; - char const *const driverDescription = nullptr; - AdapterType const adapterType = {}; - BackendType const backendType = {}; - Bool const compatibilityMode = false; -}; - -struct BindGroupEntry { - ChainedStruct const *nextInChain = nullptr; - uint32_t binding; - Buffer buffer; - uint64_t offset = 0; - uint64_t size = WGPU_WHOLE_SIZE; - Sampler sampler; - TextureView textureView; -}; - -struct BlendComponent { - BlendOperation operation = BlendOperation::Add; - BlendFactor srcFactor = BlendFactor::One; - BlendFactor dstFactor = BlendFactor::Zero; -}; - -struct BufferBindingLayout { - ChainedStruct const *nextInChain = nullptr; - BufferBindingType type = BufferBindingType::Undefined; - Bool hasDynamicOffset = false; - uint64_t minBindingSize = 0; -}; - -struct BufferDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - BufferUsage usage; - uint64_t size; - Bool mappedAtCreation = false; -}; - -// Can be chained in BufferDescriptor -struct BufferHostMappedPointer : ChainedStruct { - BufferHostMappedPointer() { sType = SType::BufferHostMappedPointer; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *pointer; - Callback disposeCallback; - void *userdata; -}; - -struct BufferMapCallbackInfo { - ChainedStruct const *nextInChain = nullptr; - CallbackMode mode; - BufferMapCallback callback; - void *userdata; -}; - -struct Color { - double r; - double g; - double b; - double a; -}; - -struct CommandBufferDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -struct CommandEncoderDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -struct CompilationMessage { - ChainedStruct const *nextInChain = nullptr; - char const *message = nullptr; - CompilationMessageType type; - uint64_t lineNum; - uint64_t linePos; - uint64_t offset; - uint64_t length; - uint64_t utf16LinePos; - uint64_t utf16Offset; - uint64_t utf16Length; -}; - -struct ComputePassTimestampWrites { - QuerySet querySet; - uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; - uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; -}; - -struct ConstantEntry { - ChainedStruct const *nextInChain = nullptr; - char const *key; - double value; -}; - -struct CopyTextureForBrowserOptions { - ChainedStruct const *nextInChain = nullptr; - Bool flipY = false; - Bool needsColorSpaceConversion = false; - AlphaMode srcAlphaMode = AlphaMode::Unpremultiplied; - float const *srcTransferFunctionParameters = nullptr; - float const *conversionMatrix = nullptr; - float const *dstTransferFunctionParameters = nullptr; - AlphaMode dstAlphaMode = AlphaMode::Unpremultiplied; - Bool internalUsage = false; -}; - -// Can be chained in AdapterProperties -struct DawnAdapterPropertiesPowerPreference : ChainedStructOut { - DawnAdapterPropertiesPowerPreference() { - sType = SType::DawnAdapterPropertiesPowerPreference; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(PowerPreference)); - alignas(kFirstMemberAlignment) - PowerPreference powerPreference = PowerPreference::Undefined; -}; - -// Can be chained in BufferDescriptor -struct DawnBufferDescriptorErrorInfoFromWireClient : ChainedStruct { - DawnBufferDescriptorErrorInfoFromWireClient() { - sType = SType::DawnBufferDescriptorErrorInfoFromWireClient; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool outOfMemory = false; -}; - -// Can be chained in DeviceDescriptor -struct DawnCacheDeviceDescriptor : ChainedStruct { - DawnCacheDeviceDescriptor() { sType = SType::DawnCacheDeviceDescriptor; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); - alignas(kFirstMemberAlignment) char const *isolationKey = ""; -}; - -// Can be chained in ComputePipelineDescriptor -struct DawnComputePipelineFullSubgroups : ChainedStruct { - DawnComputePipelineFullSubgroups() { - sType = SType::DawnComputePipelineFullSubgroups; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool requiresFullSubgroups = false; -}; - -// Can be chained in CommandEncoderDescriptor -struct DawnEncoderInternalUsageDescriptor : ChainedStruct { - DawnEncoderInternalUsageDescriptor() { - sType = SType::DawnEncoderInternalUsageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool useInternalUsages = false; -}; - -// Can be chained in SupportedLimits -struct DawnExperimentalSubgroupLimits : ChainedStructOut { - DawnExperimentalSubgroupLimits() { - sType = SType::DawnExperimentalSubgroupLimits; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); - alignas(kFirstMemberAlignment) uint32_t minSubgroupSize = - WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; -}; - -// Can be chained in MultisampleState -struct DawnMultisampleStateRenderToSingleSampled : ChainedStruct { - DawnMultisampleStateRenderToSingleSampled() { - sType = SType::DawnMultisampleStateRenderToSingleSampled; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool enabled = false; -}; - -// Can be chained in RenderPassColorAttachment -struct DawnRenderPassColorAttachmentRenderToSingleSampled : ChainedStruct { - DawnRenderPassColorAttachmentRenderToSingleSampled() { - sType = SType::DawnRenderPassColorAttachmentRenderToSingleSampled; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); - alignas(kFirstMemberAlignment) uint32_t implicitSampleCount = 1; -}; - -// Can be chained in ShaderModuleDescriptor -struct DawnShaderModuleSPIRVOptionsDescriptor : ChainedStruct { - DawnShaderModuleSPIRVOptionsDescriptor() { - sType = SType::DawnShaderModuleSPIRVOptionsDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool allowNonUniformDerivatives = false; -}; - -// Can be chained in TextureDescriptor -struct DawnTextureInternalUsageDescriptor : ChainedStruct { - DawnTextureInternalUsageDescriptor() { - sType = SType::DawnTextureInternalUsageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureUsage)); - alignas(kFirstMemberAlignment) - TextureUsage internalUsage = TextureUsage::None; -}; - -// Can be chained in InstanceDescriptor -// Can be chained in RequestAdapterOptions -// Can be chained in DeviceDescriptor -struct DawnTogglesDescriptor : ChainedStruct { - DawnTogglesDescriptor() { sType = SType::DawnTogglesDescriptor; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); - alignas(kFirstMemberAlignment) size_t enabledToggleCount = 0; - const char *const *enabledToggles; - size_t disabledToggleCount = 0; - const char *const *disabledToggles; -}; - -// Can be chained in DepthStencilState -struct DepthStencilStateDepthWriteDefinedDawn : ChainedStruct { - DepthStencilStateDepthWriteDefinedDawn() { - sType = SType::DepthStencilStateDepthWriteDefinedDawn; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool depthWriteDefined; -}; - -struct Extent2D { - uint32_t width; - uint32_t height; -}; - -struct Extent3D { - uint32_t width; - uint32_t height = 1; - uint32_t depthOrArrayLayers = 1; -}; - -// Can be chained in BindGroupEntry -struct ExternalTextureBindingEntry : ChainedStruct { - ExternalTextureBindingEntry() { sType = SType::ExternalTextureBindingEntry; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(ExternalTexture)); - alignas(kFirstMemberAlignment) ExternalTexture externalTexture; -}; - -// Can be chained in BindGroupLayoutEntry -struct ExternalTextureBindingLayout : ChainedStruct { - ExternalTextureBindingLayout() { - sType = SType::ExternalTextureBindingLayout; - } -}; - -struct Future { - uint64_t id; -}; - -struct InstanceFeatures { - ChainedStruct const *nextInChain = nullptr; - Bool timedWaitAnyEnable = false; - size_t timedWaitAnyMaxCount = 0; -}; - -struct Limits { - uint32_t maxTextureDimension1D = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxTextureDimension3D = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxTextureArrayLayers = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxBindGroups = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxBindGroupsPlusVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxBindingsPerBindGroup = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxDynamicUniformBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxDynamicStorageBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxSampledTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxSamplersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxStorageBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxStorageTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxUniformBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint64_t maxUniformBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; - uint64_t maxStorageBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; - uint32_t minUniformBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; - uint32_t minStorageBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; - uint64_t maxBufferSize = WGPU_LIMIT_U64_UNDEFINED; - uint32_t maxVertexAttributes = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxVertexBufferArrayStride = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxInterStageShaderComponents = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxInterStageShaderVariables = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxColorAttachments = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxColorAttachmentBytesPerSample = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupStorageSize = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeInvocationsPerWorkgroup = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupSizeX = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupSizeY = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupSizeZ = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupsPerDimension = WGPU_LIMIT_U32_UNDEFINED; -}; - -struct MemoryHeapInfo { - HeapProperty properties; - uint64_t size; -}; - -struct MultisampleState { - ChainedStruct const *nextInChain = nullptr; - uint32_t count = 1; - uint32_t mask = 0xFFFFFFFF; - Bool alphaToCoverageEnabled = false; -}; - -struct Origin2D { - uint32_t x = 0; - uint32_t y = 0; -}; - -struct Origin3D { - uint32_t x = 0; - uint32_t y = 0; - uint32_t z = 0; -}; - -struct PipelineLayoutDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - size_t bindGroupLayoutCount; - BindGroupLayout const *bindGroupLayouts; -}; - -struct PipelineLayoutStorageAttachment { - ChainedStruct const *nextInChain = nullptr; - uint64_t offset = 0; - TextureFormat format; -}; - -// Can be chained in PrimitiveState -struct PrimitiveDepthClipControl : ChainedStruct { - PrimitiveDepthClipControl() { sType = SType::PrimitiveDepthClipControl; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool unclippedDepth = false; -}; - -struct PrimitiveState { - ChainedStruct const *nextInChain = nullptr; - PrimitiveTopology topology = PrimitiveTopology::TriangleList; - IndexFormat stripIndexFormat = IndexFormat::Undefined; - FrontFace frontFace = FrontFace::CCW; - CullMode cullMode = CullMode::None; -}; - -struct QuerySetDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - QueryType type; - uint32_t count; -}; - -struct QueueDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -struct QueueWorkDoneCallbackInfo { - ChainedStruct const *nextInChain = nullptr; - CallbackMode mode; - QueueWorkDoneCallback callback; - void *userdata; -}; - -struct RenderBundleDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -struct RenderBundleEncoderDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - size_t colorFormatCount; - TextureFormat const *colorFormats; - TextureFormat depthStencilFormat = TextureFormat::Undefined; - uint32_t sampleCount = 1; - Bool depthReadOnly = false; - Bool stencilReadOnly = false; -}; - -struct RenderPassDepthStencilAttachment { - TextureView view; - LoadOp depthLoadOp = LoadOp::Undefined; - StoreOp depthStoreOp = StoreOp::Undefined; - float depthClearValue = NAN; - Bool depthReadOnly = false; - LoadOp stencilLoadOp = LoadOp::Undefined; - StoreOp stencilStoreOp = StoreOp::Undefined; - uint32_t stencilClearValue = 0; - Bool stencilReadOnly = false; -}; - -// Can be chained in RenderPassDescriptor -struct RenderPassDescriptorMaxDrawCount : ChainedStruct { - RenderPassDescriptorMaxDrawCount() { - sType = SType::RenderPassDescriptorMaxDrawCount; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); - alignas(kFirstMemberAlignment) uint64_t maxDrawCount = 50000000; -}; - -struct RenderPassTimestampWrites { - QuerySet querySet; - uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; - uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; -}; - -struct RequestAdapterCallbackInfo { - ChainedStruct const *nextInChain = nullptr; - CallbackMode mode; - RequestAdapterCallback callback; - void *userdata; -}; - -struct RequestAdapterOptions { - ChainedStruct const *nextInChain = nullptr; - Surface compatibleSurface; - PowerPreference powerPreference = PowerPreference::Undefined; - BackendType backendType = BackendType::Undefined; - Bool forceFallbackAdapter = false; - Bool compatibilityMode = false; -}; - -struct SamplerBindingLayout { - ChainedStruct const *nextInChain = nullptr; - SamplerBindingType type = SamplerBindingType::Undefined; -}; - -struct SamplerDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - AddressMode addressModeU = AddressMode::ClampToEdge; - AddressMode addressModeV = AddressMode::ClampToEdge; - AddressMode addressModeW = AddressMode::ClampToEdge; - FilterMode magFilter = FilterMode::Nearest; - FilterMode minFilter = FilterMode::Nearest; - MipmapFilterMode mipmapFilter = MipmapFilterMode::Nearest; - float lodMinClamp = 0.0f; - float lodMaxClamp = 32.0f; - CompareFunction compare = CompareFunction::Undefined; - uint16_t maxAnisotropy = 1; -}; - -// Can be chained in ShaderModuleDescriptor -struct ShaderModuleSPIRVDescriptor : ChainedStruct { - ShaderModuleSPIRVDescriptor() { sType = SType::ShaderModuleSPIRVDescriptor; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); - alignas(kFirstMemberAlignment) uint32_t codeSize; - uint32_t const *code; -}; - -// Can be chained in ShaderModuleDescriptor -struct ShaderModuleWGSLDescriptor : ChainedStruct { - ShaderModuleWGSLDescriptor() { sType = SType::ShaderModuleWGSLDescriptor; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); - alignas(kFirstMemberAlignment) char const *code; -}; - -struct ShaderModuleDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -// Can be chained in SharedFenceDescriptor -struct SharedFenceDXGISharedHandleDescriptor : ChainedStruct { - SharedFenceDXGISharedHandleDescriptor() { - sType = SType::SharedFenceDXGISharedHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *handle; -}; - -// Can be chained in SharedFenceExportInfo -struct SharedFenceDXGISharedHandleExportInfo : ChainedStructOut { - SharedFenceDXGISharedHandleExportInfo() { - sType = SType::SharedFenceDXGISharedHandleExportInfo; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *handle; -}; - -// Can be chained in SharedFenceDescriptor -struct SharedFenceMTLSharedEventDescriptor : ChainedStruct { - SharedFenceMTLSharedEventDescriptor() { - sType = SType::SharedFenceMTLSharedEventDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *sharedEvent; -}; - -// Can be chained in SharedFenceExportInfo -struct SharedFenceMTLSharedEventExportInfo : ChainedStructOut { - SharedFenceMTLSharedEventExportInfo() { - sType = SType::SharedFenceMTLSharedEventExportInfo; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *sharedEvent; -}; - -struct SharedFenceDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -struct SharedFenceExportInfo { - ChainedStructOut *nextInChain = nullptr; - SharedFenceType type; -}; - -// Can be chained in SharedFenceDescriptor -struct SharedFenceVkSemaphoreOpaqueFDDescriptor : ChainedStruct { - SharedFenceVkSemaphoreOpaqueFDDescriptor() { - sType = SType::SharedFenceVkSemaphoreOpaqueFDDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); - alignas(kFirstMemberAlignment) int handle; -}; - -// Can be chained in SharedFenceExportInfo -struct SharedFenceVkSemaphoreOpaqueFDExportInfo : ChainedStructOut { - SharedFenceVkSemaphoreOpaqueFDExportInfo() { - sType = SType::SharedFenceVkSemaphoreOpaqueFDExportInfo; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); - alignas(kFirstMemberAlignment) int handle; -}; - -// Can be chained in SharedFenceDescriptor -struct SharedFenceVkSemaphoreSyncFDDescriptor : ChainedStruct { - SharedFenceVkSemaphoreSyncFDDescriptor() { - sType = SType::SharedFenceVkSemaphoreSyncFDDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); - alignas(kFirstMemberAlignment) int handle; -}; - -// Can be chained in SharedFenceExportInfo -struct SharedFenceVkSemaphoreSyncFDExportInfo : ChainedStructOut { - SharedFenceVkSemaphoreSyncFDExportInfo() { - sType = SType::SharedFenceVkSemaphoreSyncFDExportInfo; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); - alignas(kFirstMemberAlignment) int handle; -}; - -// Can be chained in SharedFenceDescriptor -struct SharedFenceVkSemaphoreZirconHandleDescriptor : ChainedStruct { - SharedFenceVkSemaphoreZirconHandleDescriptor() { - sType = SType::SharedFenceVkSemaphoreZirconHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); - alignas(kFirstMemberAlignment) uint32_t handle; -}; - -// Can be chained in SharedFenceExportInfo -struct SharedFenceVkSemaphoreZirconHandleExportInfo : ChainedStructOut { - SharedFenceVkSemaphoreZirconHandleExportInfo() { - sType = SType::SharedFenceVkSemaphoreZirconHandleExportInfo; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); - alignas(kFirstMemberAlignment) uint32_t handle; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryDXGISharedHandleDescriptor : ChainedStruct { - SharedTextureMemoryDXGISharedHandleDescriptor() { - sType = SType::SharedTextureMemoryDXGISharedHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *handle; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryEGLImageDescriptor : ChainedStruct { - SharedTextureMemoryEGLImageDescriptor() { - sType = SType::SharedTextureMemoryEGLImageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *image; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryIOSurfaceDescriptor : ChainedStruct { - SharedTextureMemoryIOSurfaceDescriptor() { - sType = SType::SharedTextureMemoryIOSurfaceDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *ioSurface; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryAHardwareBufferDescriptor : ChainedStruct { - SharedTextureMemoryAHardwareBufferDescriptor() { - sType = SType::SharedTextureMemoryAHardwareBufferDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *handle; -}; - -struct SharedTextureMemoryBeginAccessDescriptor { - ChainedStruct const *nextInChain = nullptr; - Bool initialized; - size_t fenceCount; - SharedFence const *fences; - uint64_t const *signaledValues; -}; - -struct SharedTextureMemoryDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -struct SharedTextureMemoryDmaBufPlane { - int fd; - uint64_t offset; - uint32_t stride; -}; - -struct SharedTextureMemoryEndAccessState { - SharedTextureMemoryEndAccessState() = default; - ~SharedTextureMemoryEndAccessState(); - SharedTextureMemoryEndAccessState(const SharedTextureMemoryEndAccessState &) = - delete; - SharedTextureMemoryEndAccessState & - operator=(const SharedTextureMemoryEndAccessState &) = delete; - SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState &&); - SharedTextureMemoryEndAccessState & - operator=(SharedTextureMemoryEndAccessState &&); - ChainedStructOut *nextInChain = nullptr; - Bool const initialized = {}; - size_t const fenceCount = {}; - SharedFence const *const fences = {}; - uint64_t const *const signaledValues = {}; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryOpaqueFDDescriptor : ChainedStruct { - SharedTextureMemoryOpaqueFDDescriptor() { - sType = SType::SharedTextureMemoryOpaqueFDDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); - alignas(kFirstMemberAlignment) int memoryFD; - uint64_t allocationSize; -}; + namespace detail { + constexpr size_t ConstexprMax(size_t a, size_t b) { + return a > b ? a : b; + } + } // namespace detail + + static constexpr uint32_t kArrayLayerCountUndefined = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; + static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED; + static constexpr uint32_t kDepthSliceUndefined = WGPU_DEPTH_SLICE_UNDEFINED; + static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED; + static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED; + static constexpr uint32_t kMipLevelCountUndefined = WGPU_MIP_LEVEL_COUNT_UNDEFINED; + static constexpr uint32_t kQuerySetIndexUndefined = WGPU_QUERY_SET_INDEX_UNDEFINED; + static constexpr size_t kWholeMapSize = WGPU_WHOLE_MAP_SIZE; + static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE; + + enum class WGSLFeatureName : uint32_t { + Undefined = 0x00000000, + ReadonlyAndReadwriteStorageTextures = 0x00000001, + Packed4x8IntegerDotProduct = 0x00000002, + UnrestrictedPointerParameters = 0x00000003, + PointerCompositeAccess = 0x00000004, + ChromiumTestingUnimplemented = 0x000003E8, + ChromiumTestingUnsafeExperimental = 0x000003E9, + ChromiumTestingExperimental = 0x000003EA, + ChromiumTestingShippedWithKillswitch = 0x000003EB, + ChromiumTestingShipped = 0x000003EC, + }; + + enum class AdapterType : uint32_t { + DiscreteGPU = 0x00000001, + IntegratedGPU = 0x00000002, + CPU = 0x00000003, + Unknown = 0x00000004, + }; + + enum class AddressMode : uint32_t { + Undefined = 0x00000000, + ClampToEdge = 0x00000001, + Repeat = 0x00000002, + MirrorRepeat = 0x00000003, + }; + + enum class AlphaMode : uint32_t { + Opaque = 0x00000001, + Premultiplied = 0x00000002, + Unpremultiplied = 0x00000003, + }; + + enum class BackendType : uint32_t { + Undefined = 0x00000000, + Null = 0x00000001, + WebGPU = 0x00000002, + D3D11 = 0x00000003, + D3D12 = 0x00000004, + Metal = 0x00000005, + Vulkan = 0x00000006, + OpenGL = 0x00000007, + OpenGLES = 0x00000008, + }; + + enum class BlendFactor : uint32_t { + Undefined = 0x00000000, + Zero = 0x00000001, + One = 0x00000002, + Src = 0x00000003, + OneMinusSrc = 0x00000004, + SrcAlpha = 0x00000005, + OneMinusSrcAlpha = 0x00000006, + Dst = 0x00000007, + OneMinusDst = 0x00000008, + DstAlpha = 0x00000009, + OneMinusDstAlpha = 0x0000000A, + SrcAlphaSaturated = 0x0000000B, + Constant = 0x0000000C, + OneMinusConstant = 0x0000000D, + Src1 = 0x0000000E, + OneMinusSrc1 = 0x0000000F, + Src1Alpha = 0x00000010, + OneMinusSrc1Alpha = 0x00000011, + }; + + enum class BlendOperation : uint32_t { + Undefined = 0x00000000, + Add = 0x00000001, + Subtract = 0x00000002, + ReverseSubtract = 0x00000003, + Min = 0x00000004, + Max = 0x00000005, + }; + + enum class BufferBindingType : uint32_t { + Undefined = 0x00000000, + Uniform = 0x00000001, + Storage = 0x00000002, + ReadOnlyStorage = 0x00000003, + }; + + enum class BufferMapAsyncStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + ValidationError = 0x00000002, + Unknown = 0x00000003, + DeviceLost = 0x00000004, + DestroyedBeforeCallback = 0x00000005, + UnmappedBeforeCallback = 0x00000006, + MappingAlreadyPending = 0x00000007, + OffsetOutOfRange = 0x00000008, + SizeOutOfRange = 0x00000009, + }; + + enum class BufferMapState : uint32_t { + Unmapped = 0x00000001, + Pending = 0x00000002, + Mapped = 0x00000003, + }; + + enum class CallbackMode : uint32_t { + WaitAnyOnly = 0x00000000, + AllowProcessEvents = 0x00000001, + AllowSpontaneous = 0x00000002, + }; + + enum class CompareFunction : uint32_t { + Undefined = 0x00000000, + Never = 0x00000001, + Less = 0x00000002, + Equal = 0x00000003, + LessEqual = 0x00000004, + Greater = 0x00000005, + NotEqual = 0x00000006, + GreaterEqual = 0x00000007, + Always = 0x00000008, + }; + + enum class CompilationInfoRequestStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Error = 0x00000002, + DeviceLost = 0x00000003, + Unknown = 0x00000004, + }; + + enum class CompilationMessageType : uint32_t { + Error = 0x00000001, + Warning = 0x00000002, + Info = 0x00000003, + }; + + enum class CreatePipelineAsyncStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + ValidationError = 0x00000002, + InternalError = 0x00000003, + DeviceLost = 0x00000004, + DeviceDestroyed = 0x00000005, + Unknown = 0x00000006, + }; + + enum class CullMode : uint32_t { + Undefined = 0x00000000, + None = 0x00000001, + Front = 0x00000002, + Back = 0x00000003, + }; + + enum class DeviceLostReason : uint32_t { + Undefined = 0x00000000, + Destroyed = 0x00000001, + }; + + enum class ErrorFilter : uint32_t { + Validation = 0x00000001, + OutOfMemory = 0x00000002, + Internal = 0x00000003, + }; + + enum class ErrorType : uint32_t { + NoError = 0x00000000, + Validation = 0x00000001, + OutOfMemory = 0x00000002, + Internal = 0x00000003, + Unknown = 0x00000004, + DeviceLost = 0x00000005, + }; + + enum class ExternalTextureRotation : uint32_t { + Rotate0Degrees = 0x00000000, + Rotate90Degrees = 0x00000001, + Rotate180Degrees = 0x00000002, + Rotate270Degrees = 0x00000003, + }; + + enum class FeatureName : uint32_t { + Undefined = 0x00000000, + DepthClipControl = 0x00000001, + Depth32FloatStencil8 = 0x00000002, + TimestampQuery = 0x00000003, + TextureCompressionBC = 0x00000004, + TextureCompressionETC2 = 0x00000005, + TextureCompressionASTC = 0x00000006, + IndirectFirstInstance = 0x00000007, + ShaderF16 = 0x00000008, + RG11B10UfloatRenderable = 0x00000009, + BGRA8UnormStorage = 0x0000000A, + Float32Filterable = 0x0000000B, + DawnInternalUsages = 0x000003EA, + DawnMultiPlanarFormats = 0x000003EB, + DawnNative = 0x000003EC, + ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, + ImplicitDeviceSynchronization = 0x000003EF, + SurfaceCapabilities = 0x000003F0, + TransientAttachments = 0x000003F1, + MSAARenderToSingleSampled = 0x000003F2, + DualSourceBlending = 0x000003F3, + D3D11MultithreadProtected = 0x000003F4, + ANGLETextureSharing = 0x000003F5, + ChromiumExperimentalSubgroups = 0x000003F6, + ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, + PixelLocalStorageCoherent = 0x000003F9, + PixelLocalStorageNonCoherent = 0x000003FA, + Unorm16TextureFormats = 0x000003FB, + Snorm16TextureFormats = 0x000003FC, + MultiPlanarFormatExtendedUsages = 0x000003FD, + MultiPlanarFormatP010 = 0x000003FE, + HostMappedPointer = 0x000003FF, + MultiPlanarRenderTargets = 0x00000400, + MultiPlanarFormatNv12a = 0x00000401, + FramebufferFetch = 0x00000402, + BufferMapExtendedUsages = 0x00000403, + AdapterPropertiesMemoryHeaps = 0x00000404, + AdapterPropertiesD3D = 0x00000405, + AdapterPropertiesVk = 0x00000406, + R8UnormStorage = 0x00000407, + FormatCapabilities = 0x00000408, + DrmFormatCapabilities = 0x00000409, + Norm16TextureFormats = 0x0000040A, + SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, + SharedTextureMemoryAHardwareBuffer = 0x0000044D, + SharedTextureMemoryDmaBuf = 0x0000044E, + SharedTextureMemoryOpaqueFD = 0x0000044F, + SharedTextureMemoryZirconHandle = 0x00000450, + SharedTextureMemoryDXGISharedHandle = 0x00000451, + SharedTextureMemoryD3D11Texture2D = 0x00000452, + SharedTextureMemoryIOSurface = 0x00000453, + SharedTextureMemoryEGLImage = 0x00000454, + SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, + SharedFenceVkSemaphoreSyncFD = 0x000004B1, + SharedFenceVkSemaphoreZirconHandle = 0x000004B2, + SharedFenceDXGISharedHandle = 0x000004B3, + SharedFenceMTLSharedEvent = 0x000004B4, + SharedBufferMemoryD3D12Resource = 0x000004B5, + StaticSamplers = 0x000004B6, + }; + + enum class FilterMode : uint32_t { + Undefined = 0x00000000, + Nearest = 0x00000001, + Linear = 0x00000002, + }; + + enum class FrontFace : uint32_t { + Undefined = 0x00000000, + CCW = 0x00000001, + CW = 0x00000002, + }; + + enum class IndexFormat : uint32_t { + Undefined = 0x00000000, + Uint16 = 0x00000001, + Uint32 = 0x00000002, + }; + + enum class LoadOp : uint32_t { + Undefined = 0x00000000, + Clear = 0x00000001, + Load = 0x00000002, + }; + + enum class LoggingType : uint32_t { + Verbose = 0x00000001, + Info = 0x00000002, + Warning = 0x00000003, + Error = 0x00000004, + }; + + enum class MipmapFilterMode : uint32_t { + Undefined = 0x00000000, + Nearest = 0x00000001, + Linear = 0x00000002, + }; + + enum class PopErrorScopeStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + }; + + enum class PowerPreference : uint32_t { + Undefined = 0x00000000, + LowPower = 0x00000001, + HighPerformance = 0x00000002, + }; + + enum class PresentMode : uint32_t { + Fifo = 0x00000001, + Immediate = 0x00000003, + Mailbox = 0x00000004, + }; + + enum class PrimitiveTopology : uint32_t { + Undefined = 0x00000000, + PointList = 0x00000001, + LineList = 0x00000002, + LineStrip = 0x00000003, + TriangleList = 0x00000004, + TriangleStrip = 0x00000005, + }; + + enum class QueryType : uint32_t { + Occlusion = 0x00000001, + Timestamp = 0x00000002, + }; + + enum class QueueWorkDoneStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Error = 0x00000002, + Unknown = 0x00000003, + DeviceLost = 0x00000004, + }; + + enum class RequestAdapterStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Unavailable = 0x00000002, + Error = 0x00000003, + Unknown = 0x00000004, + }; + + enum class RequestDeviceStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Error = 0x00000002, + Unknown = 0x00000003, + }; + + enum class SType : uint32_t { + Invalid = 0x00000000, + SurfaceDescriptorFromMetalLayer = 0x00000001, + SurfaceDescriptorFromWindowsHWND = 0x00000002, + SurfaceDescriptorFromXlibWindow = 0x00000003, + SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, + ShaderModuleSPIRVDescriptor = 0x00000005, + ShaderModuleWGSLDescriptor = 0x00000006, + PrimitiveDepthClipControl = 0x00000007, + SurfaceDescriptorFromWaylandSurface = 0x00000008, + SurfaceDescriptorFromAndroidNativeWindow = 0x00000009, + SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, + ExternalTextureBindingEntry = 0x0000000C, + ExternalTextureBindingLayout = 0x0000000D, + SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, + RenderPassDescriptorMaxDrawCount = 0x0000000F, + DepthStencilStateDepthWriteDefinedDawn = 0x00000010, + TextureBindingViewDimensionDescriptor = 0x00000011, + DawnTextureInternalUsageDescriptor = 0x000003E8, + DawnEncoderInternalUsageDescriptor = 0x000003EB, + DawnInstanceDescriptor = 0x000003EC, + DawnCacheDeviceDescriptor = 0x000003ED, + DawnAdapterPropertiesPowerPreference = 0x000003EE, + DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, + DawnTogglesDescriptor = 0x000003F0, + DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, + RequestAdapterOptionsLUID = 0x000003F2, + RequestAdapterOptionsGetGLProc = 0x000003F3, + RequestAdapterOptionsD3D11Device = 0x000003F4, + DawnMultisampleStateRenderToSingleSampled = 0x000003F5, + DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, + RenderPassPixelLocalStorage = 0x000003F7, + PipelineLayoutPixelLocalStorage = 0x000003F8, + BufferHostMappedPointer = 0x000003F9, + DawnExperimentalSubgroupLimits = 0x000003FA, + AdapterPropertiesMemoryHeaps = 0x000003FB, + AdapterPropertiesD3D = 0x000003FC, + AdapterPropertiesVk = 0x000003FD, + DawnComputePipelineFullSubgroups = 0x000003FE, + DawnWireWGSLControl = 0x000003FF, + DawnWGSLBlocklist = 0x00000400, + DrmFormatCapabilities = 0x00000401, + SharedTextureMemoryVkImageDescriptor = 0x0000044C, + SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, + SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, + SharedTextureMemoryDmaBufDescriptor = 0x0000044F, + SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, + SharedTextureMemoryZirconHandleDescriptor = 0x00000451, + SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, + SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, + SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, + SharedTextureMemoryEGLImageDescriptor = 0x00000455, + SharedTextureMemoryInitializedBeginState = 0x000004B0, + SharedTextureMemoryInitializedEndState = 0x000004B1, + SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, + SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, + SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, + SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, + SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, + SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, + SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, + SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, + SharedFenceDXGISharedHandleDescriptor = 0x000004BA, + SharedFenceDXGISharedHandleExportInfo = 0x000004BB, + SharedFenceMTLSharedEventDescriptor = 0x000004BC, + SharedFenceMTLSharedEventExportInfo = 0x000004BD, + SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, + StaticSamplerBindingLayout = 0x000004BF, + }; + + enum class SamplerBindingType : uint32_t { + Undefined = 0x00000000, + Filtering = 0x00000001, + NonFiltering = 0x00000002, + Comparison = 0x00000003, + }; + + enum class SharedFenceType : uint32_t { + Undefined = 0x00000000, + VkSemaphoreOpaqueFD = 0x00000001, + VkSemaphoreSyncFD = 0x00000002, + VkSemaphoreZirconHandle = 0x00000003, + DXGISharedHandle = 0x00000004, + MTLSharedEvent = 0x00000005, + }; + + enum class StencilOperation : uint32_t { + Undefined = 0x00000000, + Keep = 0x00000001, + Zero = 0x00000002, + Replace = 0x00000003, + Invert = 0x00000004, + IncrementClamp = 0x00000005, + DecrementClamp = 0x00000006, + IncrementWrap = 0x00000007, + DecrementWrap = 0x00000008, + }; + + enum class StorageTextureAccess : uint32_t { + Undefined = 0x00000000, + WriteOnly = 0x00000001, + ReadOnly = 0x00000002, + ReadWrite = 0x00000003, + }; + + enum class StoreOp : uint32_t { + Undefined = 0x00000000, + Store = 0x00000001, + Discard = 0x00000002, + }; + + enum class TextureAspect : uint32_t { + Undefined = 0x00000000, + All = 0x00000001, + StencilOnly = 0x00000002, + DepthOnly = 0x00000003, + Plane0Only = 0x00000004, + Plane1Only = 0x00000005, + Plane2Only = 0x00000006, + }; + + enum class TextureDimension : uint32_t { + Undefined = 0x00000000, + e1D = 0x00000001, + e2D = 0x00000002, + e3D = 0x00000003, + }; + + enum class TextureFormat : uint32_t { + Undefined = 0x00000000, + R8Unorm = 0x00000001, + R8Snorm = 0x00000002, + R8Uint = 0x00000003, + R8Sint = 0x00000004, + R16Uint = 0x00000005, + R16Sint = 0x00000006, + R16Float = 0x00000007, + RG8Unorm = 0x00000008, + RG8Snorm = 0x00000009, + RG8Uint = 0x0000000A, + RG8Sint = 0x0000000B, + R32Float = 0x0000000C, + R32Uint = 0x0000000D, + R32Sint = 0x0000000E, + RG16Uint = 0x0000000F, + RG16Sint = 0x00000010, + RG16Float = 0x00000011, + RGBA8Unorm = 0x00000012, + RGBA8UnormSrgb = 0x00000013, + RGBA8Snorm = 0x00000014, + RGBA8Uint = 0x00000015, + RGBA8Sint = 0x00000016, + BGRA8Unorm = 0x00000017, + BGRA8UnormSrgb = 0x00000018, + RGB10A2Uint = 0x00000019, + RGB10A2Unorm = 0x0000001A, + RG11B10Ufloat = 0x0000001B, + RGB9E5Ufloat = 0x0000001C, + RG32Float = 0x0000001D, + RG32Uint = 0x0000001E, + RG32Sint = 0x0000001F, + RGBA16Uint = 0x00000020, + RGBA16Sint = 0x00000021, + RGBA16Float = 0x00000022, + RGBA32Float = 0x00000023, + RGBA32Uint = 0x00000024, + RGBA32Sint = 0x00000025, + Stencil8 = 0x00000026, + Depth16Unorm = 0x00000027, + Depth24Plus = 0x00000028, + Depth24PlusStencil8 = 0x00000029, + Depth32Float = 0x0000002A, + Depth32FloatStencil8 = 0x0000002B, + BC1RGBAUnorm = 0x0000002C, + BC1RGBAUnormSrgb = 0x0000002D, + BC2RGBAUnorm = 0x0000002E, + BC2RGBAUnormSrgb = 0x0000002F, + BC3RGBAUnorm = 0x00000030, + BC3RGBAUnormSrgb = 0x00000031, + BC4RUnorm = 0x00000032, + BC4RSnorm = 0x00000033, + BC5RGUnorm = 0x00000034, + BC5RGSnorm = 0x00000035, + BC6HRGBUfloat = 0x00000036, + BC6HRGBFloat = 0x00000037, + BC7RGBAUnorm = 0x00000038, + BC7RGBAUnormSrgb = 0x00000039, + ETC2RGB8Unorm = 0x0000003A, + ETC2RGB8UnormSrgb = 0x0000003B, + ETC2RGB8A1Unorm = 0x0000003C, + ETC2RGB8A1UnormSrgb = 0x0000003D, + ETC2RGBA8Unorm = 0x0000003E, + ETC2RGBA8UnormSrgb = 0x0000003F, + EACR11Unorm = 0x00000040, + EACR11Snorm = 0x00000041, + EACRG11Unorm = 0x00000042, + EACRG11Snorm = 0x00000043, + ASTC4x4Unorm = 0x00000044, + ASTC4x4UnormSrgb = 0x00000045, + ASTC5x4Unorm = 0x00000046, + ASTC5x4UnormSrgb = 0x00000047, + ASTC5x5Unorm = 0x00000048, + ASTC5x5UnormSrgb = 0x00000049, + ASTC6x5Unorm = 0x0000004A, + ASTC6x5UnormSrgb = 0x0000004B, + ASTC6x6Unorm = 0x0000004C, + ASTC6x6UnormSrgb = 0x0000004D, + ASTC8x5Unorm = 0x0000004E, + ASTC8x5UnormSrgb = 0x0000004F, + ASTC8x6Unorm = 0x00000050, + ASTC8x6UnormSrgb = 0x00000051, + ASTC8x8Unorm = 0x00000052, + ASTC8x8UnormSrgb = 0x00000053, + ASTC10x5Unorm = 0x00000054, + ASTC10x5UnormSrgb = 0x00000055, + ASTC10x6Unorm = 0x00000056, + ASTC10x6UnormSrgb = 0x00000057, + ASTC10x8Unorm = 0x00000058, + ASTC10x8UnormSrgb = 0x00000059, + ASTC10x10Unorm = 0x0000005A, + ASTC10x10UnormSrgb = 0x0000005B, + ASTC12x10Unorm = 0x0000005C, + ASTC12x10UnormSrgb = 0x0000005D, + ASTC12x12Unorm = 0x0000005E, + ASTC12x12UnormSrgb = 0x0000005F, + R16Unorm = 0x00000060, + RG16Unorm = 0x00000061, + RGBA16Unorm = 0x00000062, + R16Snorm = 0x00000063, + RG16Snorm = 0x00000064, + RGBA16Snorm = 0x00000065, + R8BG8Biplanar420Unorm = 0x00000066, + R10X6BG10X6Biplanar420Unorm = 0x00000067, + R8BG8A8Triplanar420Unorm = 0x00000068, + }; + + enum class TextureSampleType : uint32_t { + Undefined = 0x00000000, + Float = 0x00000001, + UnfilterableFloat = 0x00000002, + Depth = 0x00000003, + Sint = 0x00000004, + Uint = 0x00000005, + }; + + enum class TextureViewDimension : uint32_t { + Undefined = 0x00000000, + e1D = 0x00000001, + e2D = 0x00000002, + e2DArray = 0x00000003, + Cube = 0x00000004, + CubeArray = 0x00000005, + e3D = 0x00000006, + }; + + enum class VertexFormat : uint32_t { + Undefined = 0x00000000, + Uint8x2 = 0x00000001, + Uint8x4 = 0x00000002, + Sint8x2 = 0x00000003, + Sint8x4 = 0x00000004, + Unorm8x2 = 0x00000005, + Unorm8x4 = 0x00000006, + Snorm8x2 = 0x00000007, + Snorm8x4 = 0x00000008, + Uint16x2 = 0x00000009, + Uint16x4 = 0x0000000A, + Sint16x2 = 0x0000000B, + Sint16x4 = 0x0000000C, + Unorm16x2 = 0x0000000D, + Unorm16x4 = 0x0000000E, + Snorm16x2 = 0x0000000F, + Snorm16x4 = 0x00000010, + Float16x2 = 0x00000011, + Float16x4 = 0x00000012, + Float32 = 0x00000013, + Float32x2 = 0x00000014, + Float32x3 = 0x00000015, + Float32x4 = 0x00000016, + Uint32 = 0x00000017, + Uint32x2 = 0x00000018, + Uint32x3 = 0x00000019, + Uint32x4 = 0x0000001A, + Sint32 = 0x0000001B, + Sint32x2 = 0x0000001C, + Sint32x3 = 0x0000001D, + Sint32x4 = 0x0000001E, + Unorm10_10_10_2 = 0x0000001F, + }; + + enum class VertexStepMode : uint32_t { + Undefined = 0x00000000, + VertexBufferNotUsed = 0x00000001, + Vertex = 0x00000002, + Instance = 0x00000003, + }; + + enum class WaitStatus : uint32_t { + Success = 0x00000000, + TimedOut = 0x00000001, + UnsupportedTimeout = 0x00000002, + UnsupportedCount = 0x00000003, + UnsupportedMixedSources = 0x00000004, + Unknown = 0x00000005, + }; + + + enum class BufferUsage : uint32_t { + None = 0x00000000, + MapRead = 0x00000001, + MapWrite = 0x00000002, + CopySrc = 0x00000004, + CopyDst = 0x00000008, + Index = 0x00000010, + Vertex = 0x00000020, + Uniform = 0x00000040, + Storage = 0x00000080, + Indirect = 0x00000100, + QueryResolve = 0x00000200, + }; + + enum class ColorWriteMask : uint32_t { + None = 0x00000000, + Red = 0x00000001, + Green = 0x00000002, + Blue = 0x00000004, + Alpha = 0x00000008, + All = 0x0000000F, + }; + + enum class HeapProperty : uint32_t { + Undefined = 0x00000000, + DeviceLocal = 0x00000001, + HostVisible = 0x00000002, + HostCoherent = 0x00000004, + HostUncached = 0x00000008, + HostCached = 0x00000010, + }; + + enum class MapMode : uint32_t { + None = 0x00000000, + Read = 0x00000001, + Write = 0x00000002, + }; + + enum class ShaderStage : uint32_t { + None = 0x00000000, + Vertex = 0x00000001, + Fragment = 0x00000002, + Compute = 0x00000004, + }; + + enum class TextureUsage : uint32_t { + None = 0x00000000, + CopySrc = 0x00000001, + CopyDst = 0x00000002, + TextureBinding = 0x00000004, + StorageBinding = 0x00000008, + RenderAttachment = 0x00000010, + TransientAttachment = 0x00000020, + StorageAttachment = 0x00000040, + }; + + + using BufferMapCallback = WGPUBufferMapCallback; + using Callback = WGPUCallback; + using CompilationInfoCallback = WGPUCompilationInfoCallback; + using CreateComputePipelineAsyncCallback = WGPUCreateComputePipelineAsyncCallback; + using CreateRenderPipelineAsyncCallback = WGPUCreateRenderPipelineAsyncCallback; + using DawnLoadCacheDataFunction = WGPUDawnLoadCacheDataFunction; + using DawnStoreCacheDataFunction = WGPUDawnStoreCacheDataFunction; + using DeviceLostCallback = WGPUDeviceLostCallback; + using ErrorCallback = WGPUErrorCallback; + using LoggingCallback = WGPULoggingCallback; + using PopErrorScopeCallback = WGPUPopErrorScopeCallback; + using Proc = WGPUProc; + using QueueWorkDoneCallback = WGPUQueueWorkDoneCallback; + using RequestAdapterCallback = WGPURequestAdapterCallback; + using RequestDeviceCallback = WGPURequestDeviceCallback; + + class Adapter; + class BindGroup; + class BindGroupLayout; + class Buffer; + class CommandBuffer; + class CommandEncoder; + class ComputePassEncoder; + class ComputePipeline; + class Device; + class ExternalTexture; + class Instance; + class PipelineLayout; + class QuerySet; + class Queue; + class RenderBundle; + class RenderBundleEncoder; + class RenderPassEncoder; + class RenderPipeline; + class Sampler; + class ShaderModule; + class SharedBufferMemory; + class SharedFence; + class SharedTextureMemory; + class Surface; + class SwapChain; + class Texture; + class TextureView; + + struct AdapterProperties; + struct AdapterPropertiesD3D; + struct AdapterPropertiesVk; + struct BindGroupEntry; + struct BlendComponent; + struct BufferBindingLayout; + struct BufferDescriptor; + struct BufferHostMappedPointer; + struct BufferMapCallbackInfo; + struct Color; + struct CommandBufferDescriptor; + struct CommandEncoderDescriptor; + struct CompilationInfoCallbackInfo; + struct CompilationMessage; + struct ComputePassTimestampWrites; + struct ConstantEntry; + struct CopyTextureForBrowserOptions; + struct CreateComputePipelineAsyncCallbackInfo; + struct CreateRenderPipelineAsyncCallbackInfo; + struct DawnWGSLBlocklist; + struct DawnAdapterPropertiesPowerPreference; + struct DawnBufferDescriptorErrorInfoFromWireClient; + struct DawnCacheDeviceDescriptor; + struct DawnComputePipelineFullSubgroups; + struct DawnEncoderInternalUsageDescriptor; + struct DawnExperimentalSubgroupLimits; + struct DawnMultisampleStateRenderToSingleSampled; + struct DawnRenderPassColorAttachmentRenderToSingleSampled; + struct DawnShaderModuleSPIRVOptionsDescriptor; + struct DawnTextureInternalUsageDescriptor; + struct DawnTogglesDescriptor; + struct DawnWireWGSLControl; + struct DepthStencilStateDepthWriteDefinedDawn; + struct DrmFormatProperties; + struct Extent2D; + struct Extent3D; + struct ExternalTextureBindingEntry; + struct ExternalTextureBindingLayout; + struct FormatCapabilities; + struct Future; + struct InstanceFeatures; + struct Limits; + struct MemoryHeapInfo; + struct MultisampleState; + struct Origin2D; + struct Origin3D; + struct PipelineLayoutDescriptor; + struct PipelineLayoutStorageAttachment; + struct PopErrorScopeCallbackInfo; + struct PrimitiveDepthClipControl; + struct PrimitiveState; + struct QuerySetDescriptor; + struct QueueDescriptor; + struct QueueWorkDoneCallbackInfo; + struct RenderBundleDescriptor; + struct RenderBundleEncoderDescriptor; + struct RenderPassDepthStencilAttachment; + struct RenderPassDescriptorMaxDrawCount; + struct RenderPassTimestampWrites; + struct RequestAdapterCallbackInfo; + struct RequestAdapterOptions; + struct RequestDeviceCallbackInfo; + struct SamplerBindingLayout; + struct SamplerDescriptor; + struct ShaderModuleSPIRVDescriptor; + struct ShaderModuleWGSLDescriptor; + struct ShaderModuleDescriptor; + struct SharedBufferMemoryBeginAccessDescriptor; + struct SharedBufferMemoryDescriptor; + struct SharedBufferMemoryEndAccessState; + struct SharedBufferMemoryProperties; + struct SharedFenceDXGISharedHandleDescriptor; + struct SharedFenceDXGISharedHandleExportInfo; + struct SharedFenceMTLSharedEventDescriptor; + struct SharedFenceMTLSharedEventExportInfo; + struct SharedFenceDescriptor; + struct SharedFenceExportInfo; + struct SharedFenceVkSemaphoreOpaqueFDDescriptor; + struct SharedFenceVkSemaphoreOpaqueFDExportInfo; + struct SharedFenceVkSemaphoreSyncFDDescriptor; + struct SharedFenceVkSemaphoreSyncFDExportInfo; + struct SharedFenceVkSemaphoreZirconHandleDescriptor; + struct SharedFenceVkSemaphoreZirconHandleExportInfo; + struct SharedTextureMemoryDXGISharedHandleDescriptor; + struct SharedTextureMemoryEGLImageDescriptor; + struct SharedTextureMemoryIOSurfaceDescriptor; + struct SharedTextureMemoryAHardwareBufferDescriptor; + struct SharedTextureMemoryBeginAccessDescriptor; + struct SharedTextureMemoryDescriptor; + struct SharedTextureMemoryDmaBufPlane; + struct SharedTextureMemoryEndAccessState; + struct SharedTextureMemoryOpaqueFDDescriptor; + struct SharedTextureMemoryVkDedicatedAllocationDescriptor; + struct SharedTextureMemoryVkImageLayoutBeginState; + struct SharedTextureMemoryVkImageLayoutEndState; + struct SharedTextureMemoryZirconHandleDescriptor; + struct StaticSamplerBindingLayout; + struct StencilFaceState; + struct StorageTextureBindingLayout; + struct SurfaceDescriptor; + struct SurfaceDescriptorFromAndroidNativeWindow; + struct SurfaceDescriptorFromCanvasHTMLSelector; + struct SurfaceDescriptorFromMetalLayer; + struct SurfaceDescriptorFromWaylandSurface; + struct SurfaceDescriptorFromWindowsHWND; + struct SurfaceDescriptorFromWindowsCoreWindow; + struct SurfaceDescriptorFromWindowsSwapChainPanel; + struct SurfaceDescriptorFromXlibWindow; + struct SwapChainDescriptor; + struct TextureBindingLayout; + struct TextureBindingViewDimensionDescriptor; + struct TextureDataLayout; + struct TextureViewDescriptor; + struct VertexAttribute; + struct AdapterPropertiesMemoryHeaps; + struct BindGroupDescriptor; + struct BindGroupLayoutEntry; + struct BlendState; + struct CompilationInfo; + struct ComputePassDescriptor; + struct DepthStencilState; + struct DrmFormatCapabilities; + struct ExternalTextureDescriptor; + struct FutureWaitInfo; + struct ImageCopyBuffer; + struct ImageCopyExternalTexture; + struct ImageCopyTexture; + struct InstanceDescriptor; + struct PipelineLayoutPixelLocalStorage; + struct ProgrammableStageDescriptor; + struct RenderPassColorAttachment; + struct RenderPassStorageAttachment; + struct RequiredLimits; + struct SharedTextureMemoryDmaBufDescriptor; + struct SharedTextureMemoryProperties; + struct SharedTextureMemoryVkImageDescriptor; + struct SupportedLimits; + struct TextureDescriptor; + struct VertexBufferLayout; + struct BindGroupLayoutDescriptor; + struct ColorTargetState; + struct ComputePipelineDescriptor; + struct DeviceDescriptor; + struct RenderPassDescriptor; + struct RenderPassPixelLocalStorage; + struct VertexState; + struct FragmentState; + struct RenderPipelineDescriptor; + + + // Special class for booleans in order to allow implicit conversions. + class Bool { + public: + constexpr Bool() = default; + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction + constexpr Bool(bool value) : mValue(static_cast(value)) {} + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction + Bool(WGPUBool value): mValue(value) {} + + constexpr operator bool() const { return static_cast(mValue); } + + private: + friend struct std::hash; + // Default to false. + WGPUBool mValue = static_cast(false); + }; + + template + class ObjectBase { + public: + ObjectBase() = default; + ObjectBase(CType handle): mHandle(handle) { + if (mHandle) Derived::WGPUReference(mHandle); + } + ~ObjectBase() { + if (mHandle) Derived::WGPURelease(mHandle); + } + + ObjectBase(ObjectBase const& other) + : ObjectBase(other.Get()) { + } + Derived& operator=(ObjectBase const& other) { + if (&other != this) { + if (mHandle) Derived::WGPURelease(mHandle); + mHandle = other.mHandle; + if (mHandle) Derived::WGPUReference(mHandle); + } + + return static_cast(*this); + } + + ObjectBase(ObjectBase&& other) { + mHandle = other.mHandle; + other.mHandle = 0; + } + Derived& operator=(ObjectBase&& other) { + if (&other != this) { + if (mHandle) Derived::WGPURelease(mHandle); + mHandle = other.mHandle; + other.mHandle = 0; + } + + return static_cast(*this); + } + + ObjectBase(std::nullptr_t) {} + Derived& operator=(std::nullptr_t) { + if (mHandle != nullptr) { + Derived::WGPURelease(mHandle); + mHandle = nullptr; + } + return static_cast(*this); + } + + bool operator==(std::nullptr_t) const { + return mHandle == nullptr; + } + bool operator!=(std::nullptr_t) const { + return mHandle != nullptr; + } + + explicit operator bool() const { + return mHandle != nullptr; + } + CType Get() const { + return mHandle; + } + CType MoveToCHandle() { + CType result = mHandle; + mHandle = 0; + return result; + } + static Derived Acquire(CType handle) { + Derived result; + result.mHandle = handle; + return result; + } + + protected: + CType mHandle = nullptr; + }; + + + + class Adapter : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Device CreateDevice(DeviceDescriptor const * descriptor = nullptr) const; + size_t EnumerateFeatures(FeatureName * features) const; + Bool GetFormatCapabilities(TextureFormat format, FormatCapabilities * capabilities) const; + Instance GetInstance() const; + Bool GetLimits(SupportedLimits * limits) const; + void GetProperties(AdapterProperties * properties) const; + Bool HasFeature(FeatureName feature) const; + void RequestDevice(DeviceDescriptor const * descriptor, RequestDeviceCallback callback, void * userdata) const; + Future RequestDevice(DeviceDescriptor const * options, RequestDeviceCallbackInfo callbackInfo) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUAdapter handle); + static void WGPURelease(WGPUAdapter handle); + }; + + class BindGroup : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUBindGroup handle); + static void WGPURelease(WGPUBindGroup handle); + }; + + class BindGroupLayout : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUBindGroupLayout handle); + static void WGPURelease(WGPUBindGroupLayout handle); + }; + + class Buffer : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + void const * GetConstMappedRange(size_t offset = 0, size_t size = WGPU_WHOLE_MAP_SIZE) const; + BufferMapState GetMapState() const; + void * GetMappedRange(size_t offset = 0, size_t size = WGPU_WHOLE_MAP_SIZE) const; + uint64_t GetSize() const; + BufferUsage GetUsage() const; + void MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallback callback, void * userdata) const; + Future MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallbackInfo callbackInfo) const; + void SetLabel(char const * label) const; + void Unmap() const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUBuffer handle); + static void WGPURelease(WGPUBuffer handle); + }; + + class CommandBuffer : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUCommandBuffer handle); + static void WGPURelease(WGPUCommandBuffer handle); + }; + + class CommandEncoder : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + ComputePassEncoder BeginComputePass(ComputePassDescriptor const * descriptor = nullptr) const; + RenderPassEncoder BeginRenderPass(RenderPassDescriptor const * descriptor) const; + void ClearBuffer(Buffer const& buffer, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; + void CopyBufferToBuffer(Buffer const& source, uint64_t sourceOffset, Buffer const& destination, uint64_t destinationOffset, uint64_t size) const; + void CopyBufferToTexture(ImageCopyBuffer const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const; + void CopyTextureToBuffer(ImageCopyTexture const * source, ImageCopyBuffer const * destination, Extent3D const * copySize) const; + void CopyTextureToTexture(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const; + CommandBuffer Finish(CommandBufferDescriptor const * descriptor = nullptr) const; + void InjectValidationError(char const * message) const; + void InsertDebugMarker(char const * markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const * groupLabel) const; + void ResolveQuerySet(QuerySet const& querySet, uint32_t firstQuery, uint32_t queryCount, Buffer const& destination, uint64_t destinationOffset) const; + void SetLabel(char const * label) const; + void WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) const; + void WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUCommandEncoder handle); + static void WGPURelease(WGPUCommandEncoder handle); + }; + + class ComputePassEncoder : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void DispatchWorkgroups(uint32_t workgroupCountX, uint32_t workgroupCountY = 1, uint32_t workgroupCountZ = 1) const; + void DispatchWorkgroupsIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; + void End() const; + void InsertDebugMarker(char const * markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const * groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) const; + void SetLabel(char const * label) const; + void SetPipeline(ComputePipeline const& pipeline) const; + void WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUComputePassEncoder handle); + static void WGPURelease(WGPUComputePassEncoder handle); + }; + + class ComputePipeline : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUComputePipeline handle); + static void WGPURelease(WGPUComputePipeline handle); + }; + + class Device : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroup CreateBindGroup(BindGroupDescriptor const * descriptor) const; + BindGroupLayout CreateBindGroupLayout(BindGroupLayoutDescriptor const * descriptor) const; + Buffer CreateBuffer(BufferDescriptor const * descriptor) const; + CommandEncoder CreateCommandEncoder(CommandEncoderDescriptor const * descriptor = nullptr) const; + ComputePipeline CreateComputePipeline(ComputePipelineDescriptor const * descriptor) const; + void CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallback callback, void * userdata) const; + Future CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallbackInfo callbackInfo) const; + Buffer CreateErrorBuffer(BufferDescriptor const * descriptor) const; + ExternalTexture CreateErrorExternalTexture() const; + ShaderModule CreateErrorShaderModule(ShaderModuleDescriptor const * descriptor, char const * errorMessage) const; + Texture CreateErrorTexture(TextureDescriptor const * descriptor) const; + ExternalTexture CreateExternalTexture(ExternalTextureDescriptor const * externalTextureDescriptor) const; + PipelineLayout CreatePipelineLayout(PipelineLayoutDescriptor const * descriptor) const; + QuerySet CreateQuerySet(QuerySetDescriptor const * descriptor) const; + RenderBundleEncoder CreateRenderBundleEncoder(RenderBundleEncoderDescriptor const * descriptor) const; + RenderPipeline CreateRenderPipeline(RenderPipelineDescriptor const * descriptor) const; + void CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallback callback, void * userdata) const; + Future CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallbackInfo callbackInfo) const; + Sampler CreateSampler(SamplerDescriptor const * descriptor = nullptr) const; + ShaderModule CreateShaderModule(ShaderModuleDescriptor const * descriptor) const; + SwapChain CreateSwapChain(Surface const& surface, SwapChainDescriptor const * descriptor) const; + Texture CreateTexture(TextureDescriptor const * descriptor) const; + void Destroy() const; + size_t EnumerateFeatures(FeatureName * features) const; + void ForceLoss(DeviceLostReason type, char const * message) const; + Adapter GetAdapter() const; + Bool GetLimits(SupportedLimits * limits) const; + Queue GetQueue() const; + TextureUsage GetSupportedSurfaceUsage(Surface const& surface) const; + Bool HasFeature(FeatureName feature) const; + SharedBufferMemory ImportSharedBufferMemory(SharedBufferMemoryDescriptor const * descriptor) const; + SharedFence ImportSharedFence(SharedFenceDescriptor const * descriptor) const; + SharedTextureMemory ImportSharedTextureMemory(SharedTextureMemoryDescriptor const * descriptor) const; + void InjectError(ErrorType type, char const * message) const; + void PopErrorScope(ErrorCallback oldCallback, void * userdata) const; + Future PopErrorScope(PopErrorScopeCallbackInfo callbackInfo) const; + void PushErrorScope(ErrorFilter filter) const; + void SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const; + void SetLabel(char const * label) const; + void SetLoggingCallback(LoggingCallback callback, void * userdata) const; + void SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const; + void Tick() const; + void ValidateTextureDescriptor(TextureDescriptor const * descriptor) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUDevice handle); + static void WGPURelease(WGPUDevice handle); + }; + + class ExternalTexture : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + void Expire() const; + void Refresh() const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUExternalTexture handle); + static void WGPURelease(WGPUExternalTexture handle); + }; + + class Instance : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Surface CreateSurface(SurfaceDescriptor const * descriptor) const; + size_t EnumerateWGSLLanguageFeatures(WGSLFeatureName * features) const; + Bool HasWGSLLanguageFeature(WGSLFeatureName feature) const; + void ProcessEvents() const; + void RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallback callback, void * userdata) const; + Future RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallbackInfo callbackInfo) const; + WaitStatus WaitAny(size_t futureCount, FutureWaitInfo * futures, uint64_t timeoutNS) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUInstance handle); + static void WGPURelease(WGPUInstance handle); + }; + + class PipelineLayout : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUPipelineLayout handle); + static void WGPURelease(WGPUPipelineLayout handle); + }; + + class QuerySet : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + uint32_t GetCount() const; + QueryType GetType() const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUQuerySet handle); + static void WGPURelease(WGPUQuerySet handle); + }; + + class Queue : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void CopyExternalTextureForBrowser(ImageCopyExternalTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const; + void CopyTextureForBrowser(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const; + void OnSubmittedWorkDone(QueueWorkDoneCallback callback, void * userdata) const; + Future OnSubmittedWorkDone(QueueWorkDoneCallbackInfo callbackInfo) const; + void SetLabel(char const * label) const; + void Submit(size_t commandCount, CommandBuffer const * commands) const; + void WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, void const * data, size_t size) const; + void WriteTexture(ImageCopyTexture const * destination, void const * data, size_t dataSize, TextureDataLayout const * dataLayout, Extent3D const * writeSize) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUQueue handle); + static void WGPURelease(WGPUQueue handle); + }; + + class RenderBundle : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPURenderBundle handle); + static void WGPURelease(WGPURenderBundle handle); + }; + + class RenderBundleEncoder : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t firstIndex = 0, int32_t baseVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; + void DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; + RenderBundle Finish(RenderBundleDescriptor const * descriptor = nullptr) const; + void InsertDebugMarker(char const * markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const * groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) const; + void SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; + void SetLabel(char const * label) const; + void SetPipeline(RenderPipeline const& pipeline) const; + void SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPURenderBundleEncoder handle); + static void WGPURelease(WGPURenderBundleEncoder handle); + }; + + class RenderPassEncoder : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void BeginOcclusionQuery(uint32_t queryIndex) const; + void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t firstIndex = 0, int32_t baseVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; + void DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; + void End() const; + void EndOcclusionQuery() const; + void ExecuteBundles(size_t bundleCount, RenderBundle const * bundles) const; + void InsertDebugMarker(char const * markerLabel) const; + void PixelLocalStorageBarrier() const; + void PopDebugGroup() const; + void PushDebugGroup(char const * groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) const; + void SetBlendConstant(Color const * color) const; + void SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; + void SetLabel(char const * label) const; + void SetPipeline(RenderPipeline const& pipeline) const; + void SetScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height) const; + void SetStencilReference(uint32_t reference) const; + void SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; + void SetViewport(float x, float y, float width, float height, float minDepth, float maxDepth) const; + void WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPURenderPassEncoder handle); + static void WGPURelease(WGPURenderPassEncoder handle); + }; + + class RenderPipeline : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPURenderPipeline handle); + static void WGPURelease(WGPURenderPipeline handle); + }; + + class Sampler : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUSampler handle); + static void WGPURelease(WGPUSampler handle); + }; + + class ShaderModule : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void GetCompilationInfo(CompilationInfoCallback callback, void * userdata) const; + Future GetCompilationInfo(CompilationInfoCallbackInfo callbackInfo) const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUShaderModule handle); + static void WGPURelease(WGPUShaderModule handle); + }; + + class SharedBufferMemory : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Bool BeginAccess(Buffer const& buffer, SharedBufferMemoryBeginAccessDescriptor const * descriptor) const; + Buffer CreateBuffer(BufferDescriptor const * descriptor = nullptr) const; + Bool EndAccess(Buffer const& buffer, SharedBufferMemoryEndAccessState * descriptor) const; + void GetProperties(SharedBufferMemoryProperties * properties) const; + Bool IsDeviceLost() const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUSharedBufferMemory handle); + static void WGPURelease(WGPUSharedBufferMemory handle); + }; + + class SharedFence : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void ExportInfo(SharedFenceExportInfo * info) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUSharedFence handle); + static void WGPURelease(WGPUSharedFence handle); + }; + + class SharedTextureMemory : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Bool BeginAccess(Texture const& texture, SharedTextureMemoryBeginAccessDescriptor const * descriptor) const; + Texture CreateTexture(TextureDescriptor const * descriptor = nullptr) const; + Bool EndAccess(Texture const& texture, SharedTextureMemoryEndAccessState * descriptor) const; + void GetProperties(SharedTextureMemoryProperties * properties) const; + Bool IsDeviceLost() const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUSharedTextureMemory handle); + static void WGPURelease(WGPUSharedTextureMemory handle); + }; + + class Surface : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + TextureFormat GetPreferredFormat(Adapter const& adapter) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUSurface handle); + static void WGPURelease(WGPUSurface handle); + }; + + class SwapChain : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Texture GetCurrentTexture() const; + TextureView GetCurrentTextureView() const; + void Present() const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUSwapChain handle); + static void WGPURelease(WGPUSwapChain handle); + }; + + class Texture : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + TextureView CreateErrorView(TextureViewDescriptor const * descriptor = nullptr) const; + TextureView CreateView(TextureViewDescriptor const * descriptor = nullptr) const; + void Destroy() const; + uint32_t GetDepthOrArrayLayers() const; + TextureDimension GetDimension() const; + TextureFormat GetFormat() const; + uint32_t GetHeight() const; + uint32_t GetMipLevelCount() const; + uint32_t GetSampleCount() const; + TextureUsage GetUsage() const; + uint32_t GetWidth() const; + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUTexture handle); + static void WGPURelease(WGPUTexture handle); + }; + + class TextureView : public ObjectBase { + public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const * label) const; + + private: + friend ObjectBase; + static void WGPUReference(WGPUTextureView handle); + static void WGPURelease(WGPUTextureView handle); + }; + + + Instance CreateInstance(InstanceDescriptor const * descriptor = nullptr); + Bool GetInstanceFeatures(InstanceFeatures * features); + Proc GetProcAddress(Device device, char const * procName); + + struct AdapterProperties { + AdapterProperties() = default; + ~AdapterProperties(); + AdapterProperties(const AdapterProperties&) = delete; + AdapterProperties& operator=(const AdapterProperties&) = delete; + AdapterProperties(AdapterProperties&&); + AdapterProperties& operator=(AdapterProperties&&); + ChainedStructOut * nextInChain = nullptr; + uint32_t const vendorID = {}; + char const * const vendorName = nullptr; + char const * const architecture = nullptr; + uint32_t const deviceID = {}; + char const * const name = nullptr; + char const * const driverDescription = nullptr; + AdapterType const adapterType = {}; + BackendType const backendType = {}; + Bool const compatibilityMode = false; + }; + + // Can be chained in AdapterProperties + struct AdapterPropertiesD3D : ChainedStructOut { + AdapterPropertiesD3D() { + sType = SType::AdapterPropertiesD3D; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t shaderModel; + }; + + // Can be chained in AdapterProperties + struct AdapterPropertiesVk : ChainedStructOut { + AdapterPropertiesVk() { + sType = SType::AdapterPropertiesVk; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t driverVersion; + }; + + struct BindGroupEntry { + ChainedStruct const * nextInChain = nullptr; + uint32_t binding; + Buffer buffer = nullptr; + uint64_t offset = 0; + uint64_t size = WGPU_WHOLE_SIZE; + Sampler sampler = nullptr; + TextureView textureView = nullptr; + }; + + struct BlendComponent { + BlendOperation operation = BlendOperation::Add; + BlendFactor srcFactor = BlendFactor::One; + BlendFactor dstFactor = BlendFactor::Zero; + }; + + struct BufferBindingLayout { + ChainedStruct const * nextInChain = nullptr; + BufferBindingType type = BufferBindingType::Undefined; + Bool hasDynamicOffset = false; + uint64_t minBindingSize = 0; + }; + + struct BufferDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + BufferUsage usage; + uint64_t size; + Bool mappedAtCreation = false; + }; + + // Can be chained in BufferDescriptor + struct BufferHostMappedPointer : ChainedStruct { + BufferHostMappedPointer() { + sType = SType::BufferHostMappedPointer; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * pointer; + Callback disposeCallback; + void * userdata; + }; + + struct BufferMapCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + BufferMapCallback callback; + void * userdata; + }; + + struct Color { + double r; + double g; + double b; + double a; + }; + + struct CommandBufferDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct CommandEncoderDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct CompilationInfoCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + CompilationInfoCallback callback; + void * userdata = nullptr; + }; + + struct CompilationMessage { + ChainedStruct const * nextInChain = nullptr; + char const * message = nullptr; + CompilationMessageType type; + uint64_t lineNum; + uint64_t linePos; + uint64_t offset; + uint64_t length; + uint64_t utf16LinePos; + uint64_t utf16Offset; + uint64_t utf16Length; + }; + + struct ComputePassTimestampWrites { + QuerySet querySet; + uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + }; + + struct ConstantEntry { + ChainedStruct const * nextInChain = nullptr; + char const * key; + double value; + }; + + struct CopyTextureForBrowserOptions { + ChainedStruct const * nextInChain = nullptr; + Bool flipY = false; + Bool needsColorSpaceConversion = false; + AlphaMode srcAlphaMode = AlphaMode::Unpremultiplied; + float const * srcTransferFunctionParameters = nullptr; + float const * conversionMatrix = nullptr; + float const * dstTransferFunctionParameters = nullptr; + AlphaMode dstAlphaMode = AlphaMode::Unpremultiplied; + Bool internalUsage = false; + }; + + struct CreateComputePipelineAsyncCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + CreateComputePipelineAsyncCallback callback; + void * userdata; + }; + + struct CreateRenderPipelineAsyncCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + CreateRenderPipelineAsyncCallback callback; + void * userdata; + }; + + // Can be chained in InstanceDescriptor + struct DawnWGSLBlocklist : ChainedStruct { + DawnWGSLBlocklist() { + sType = SType::DawnWGSLBlocklist; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); + alignas(kFirstMemberAlignment) size_t blocklistedFeatureCount = 0; + const char* const * blocklistedFeatures; + }; + + // Can be chained in AdapterProperties + struct DawnAdapterPropertiesPowerPreference : ChainedStructOut { + DawnAdapterPropertiesPowerPreference() { + sType = SType::DawnAdapterPropertiesPowerPreference; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(PowerPreference )); + alignas(kFirstMemberAlignment) PowerPreference powerPreference = PowerPreference::Undefined; + }; + + // Can be chained in BufferDescriptor + struct DawnBufferDescriptorErrorInfoFromWireClient : ChainedStruct { + DawnBufferDescriptorErrorInfoFromWireClient() { + sType = SType::DawnBufferDescriptorErrorInfoFromWireClient; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool outOfMemory = false; + }; + + // Can be chained in DeviceDescriptor + struct DawnCacheDeviceDescriptor : ChainedStruct { + DawnCacheDeviceDescriptor() { + sType = SType::DawnCacheDeviceDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); + alignas(kFirstMemberAlignment) char const * isolationKey = ""; + DawnLoadCacheDataFunction loadDataFunction = nullptr; + DawnStoreCacheDataFunction storeDataFunction = nullptr; + void * functionUserdata = nullptr; + }; + + // Can be chained in ComputePipelineDescriptor + struct DawnComputePipelineFullSubgroups : ChainedStruct { + DawnComputePipelineFullSubgroups() { + sType = SType::DawnComputePipelineFullSubgroups; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool requiresFullSubgroups = false; + }; + + // Can be chained in CommandEncoderDescriptor + struct DawnEncoderInternalUsageDescriptor : ChainedStruct { + DawnEncoderInternalUsageDescriptor() { + sType = SType::DawnEncoderInternalUsageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool useInternalUsages = false; + }; + + // Can be chained in SupportedLimits + struct DawnExperimentalSubgroupLimits : ChainedStructOut { + DawnExperimentalSubgroupLimits() { + sType = SType::DawnExperimentalSubgroupLimits; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t minSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; + }; + + // Can be chained in MultisampleState + struct DawnMultisampleStateRenderToSingleSampled : ChainedStruct { + DawnMultisampleStateRenderToSingleSampled() { + sType = SType::DawnMultisampleStateRenderToSingleSampled; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool enabled = false; + }; + + // Can be chained in RenderPassColorAttachment + struct DawnRenderPassColorAttachmentRenderToSingleSampled : ChainedStruct { + DawnRenderPassColorAttachmentRenderToSingleSampled() { + sType = SType::DawnRenderPassColorAttachmentRenderToSingleSampled; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t implicitSampleCount = 1; + }; + + // Can be chained in ShaderModuleDescriptor + struct DawnShaderModuleSPIRVOptionsDescriptor : ChainedStruct { + DawnShaderModuleSPIRVOptionsDescriptor() { + sType = SType::DawnShaderModuleSPIRVOptionsDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool allowNonUniformDerivatives = false; + }; + + // Can be chained in TextureDescriptor + struct DawnTextureInternalUsageDescriptor : ChainedStruct { + DawnTextureInternalUsageDescriptor() { + sType = SType::DawnTextureInternalUsageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureUsage )); + alignas(kFirstMemberAlignment) TextureUsage internalUsage = TextureUsage::None; + }; + + // Can be chained in InstanceDescriptor + // Can be chained in RequestAdapterOptions + // Can be chained in DeviceDescriptor + struct DawnTogglesDescriptor : ChainedStruct { + DawnTogglesDescriptor() { + sType = SType::DawnTogglesDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); + alignas(kFirstMemberAlignment) size_t enabledToggleCount = 0; + const char* const * enabledToggles; + size_t disabledToggleCount = 0; + const char* const * disabledToggles; + }; + + // Can be chained in InstanceDescriptor + struct DawnWireWGSLControl : ChainedStruct { + DawnWireWGSLControl() { + sType = SType::DawnWireWGSLControl; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool enableExperimental = false; + Bool enableUnsafe = false; + Bool enableTesting = false; + }; + + // Can be chained in DepthStencilState + struct DepthStencilStateDepthWriteDefinedDawn : ChainedStruct { + DepthStencilStateDepthWriteDefinedDawn() { + sType = SType::DepthStencilStateDepthWriteDefinedDawn; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool depthWriteDefined; + }; + + struct DrmFormatProperties { + uint64_t modifier; + uint32_t modifierPlaneCount; + }; + + struct Extent2D { + uint32_t width; + uint32_t height; + }; + + struct Extent3D { + uint32_t width; + uint32_t height = 1; + uint32_t depthOrArrayLayers = 1; + }; + + // Can be chained in BindGroupEntry + struct ExternalTextureBindingEntry : ChainedStruct { + ExternalTextureBindingEntry() { + sType = SType::ExternalTextureBindingEntry; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(ExternalTexture )); + alignas(kFirstMemberAlignment) ExternalTexture externalTexture; + }; + + // Can be chained in BindGroupLayoutEntry + struct ExternalTextureBindingLayout : ChainedStruct { + ExternalTextureBindingLayout() { + sType = SType::ExternalTextureBindingLayout; + } + }; + + struct FormatCapabilities { + ChainedStructOut * nextInChain = nullptr; + }; + + struct Future { + uint64_t id; + }; + + struct InstanceFeatures { + ChainedStruct const * nextInChain = nullptr; + Bool timedWaitAnyEnable = false; + size_t timedWaitAnyMaxCount = 0; + }; + + struct Limits { + uint32_t maxTextureDimension1D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureDimension3D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureArrayLayers = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindGroups = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindGroupsPlusVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindingsPerBindGroup = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxDynamicUniformBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxDynamicStorageBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSampledTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSamplersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxStorageBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxStorageTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxUniformBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint64_t maxUniformBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; + uint64_t maxStorageBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; + uint32_t minUniformBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; + uint32_t minStorageBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; + uint64_t maxBufferSize = WGPU_LIMIT_U64_UNDEFINED; + uint32_t maxVertexAttributes = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxVertexBufferArrayStride = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxInterStageShaderComponents = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxInterStageShaderVariables = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxColorAttachments = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxColorAttachmentBytesPerSample = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupStorageSize = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeInvocationsPerWorkgroup = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeX = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeY = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeZ = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupsPerDimension = WGPU_LIMIT_U32_UNDEFINED; + }; + + struct MemoryHeapInfo { + HeapProperty properties; + uint64_t size; + }; + + struct MultisampleState { + ChainedStruct const * nextInChain = nullptr; + uint32_t count = 1; + uint32_t mask = 0xFFFFFFFF; + Bool alphaToCoverageEnabled = false; + }; + + struct Origin2D { + uint32_t x = 0; + uint32_t y = 0; + }; + + struct Origin3D { + uint32_t x = 0; + uint32_t y = 0; + uint32_t z = 0; + }; + + struct PipelineLayoutDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + size_t bindGroupLayoutCount; + BindGroupLayout const * bindGroupLayouts; + }; + + struct PipelineLayoutStorageAttachment { + ChainedStruct const * nextInChain = nullptr; + uint64_t offset = 0; + TextureFormat format; + }; + + struct PopErrorScopeCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + PopErrorScopeCallback callback; + ErrorCallback oldCallback; + void * userdata = nullptr; + }; + + // Can be chained in PrimitiveState + struct PrimitiveDepthClipControl : ChainedStruct { + PrimitiveDepthClipControl() { + sType = SType::PrimitiveDepthClipControl; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool unclippedDepth = false; + }; + + struct PrimitiveState { + ChainedStruct const * nextInChain = nullptr; + PrimitiveTopology topology = PrimitiveTopology::TriangleList; + IndexFormat stripIndexFormat = IndexFormat::Undefined; + FrontFace frontFace = FrontFace::CCW; + CullMode cullMode = CullMode::None; + }; + + struct QuerySetDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + QueryType type; + uint32_t count; + }; + + struct QueueDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct QueueWorkDoneCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + QueueWorkDoneCallback callback; + void * userdata; + }; + + struct RenderBundleDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct RenderBundleEncoderDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + size_t colorFormatCount; + TextureFormat const * colorFormats; + TextureFormat depthStencilFormat = TextureFormat::Undefined; + uint32_t sampleCount = 1; + Bool depthReadOnly = false; + Bool stencilReadOnly = false; + }; + + struct RenderPassDepthStencilAttachment { + TextureView view; + LoadOp depthLoadOp = LoadOp::Undefined; + StoreOp depthStoreOp = StoreOp::Undefined; + float depthClearValue = NAN; + Bool depthReadOnly = false; + LoadOp stencilLoadOp = LoadOp::Undefined; + StoreOp stencilStoreOp = StoreOp::Undefined; + uint32_t stencilClearValue = 0; + Bool stencilReadOnly = false; + }; + + // Can be chained in RenderPassDescriptor + struct RenderPassDescriptorMaxDrawCount : ChainedStruct { + RenderPassDescriptorMaxDrawCount() { + sType = SType::RenderPassDescriptorMaxDrawCount; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t )); + alignas(kFirstMemberAlignment) uint64_t maxDrawCount = 50000000; + }; + + struct RenderPassTimestampWrites { + QuerySet querySet; + uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + }; + + struct RequestAdapterCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + RequestAdapterCallback callback; + void * userdata; + }; + + struct RequestAdapterOptions { + ChainedStruct const * nextInChain = nullptr; + Surface compatibleSurface = nullptr; + PowerPreference powerPreference = PowerPreference::Undefined; + BackendType backendType = BackendType::Undefined; + Bool forceFallbackAdapter = false; + Bool compatibilityMode = false; + }; + + struct RequestDeviceCallbackInfo { + ChainedStruct const * nextInChain = nullptr; + CallbackMode mode; + RequestDeviceCallback callback; + void * userdata; + }; + + struct SamplerBindingLayout { + ChainedStruct const * nextInChain = nullptr; + SamplerBindingType type = SamplerBindingType::Undefined; + }; + + struct SamplerDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + AddressMode addressModeU = AddressMode::ClampToEdge; + AddressMode addressModeV = AddressMode::ClampToEdge; + AddressMode addressModeW = AddressMode::ClampToEdge; + FilterMode magFilter = FilterMode::Nearest; + FilterMode minFilter = FilterMode::Nearest; + MipmapFilterMode mipmapFilter = MipmapFilterMode::Nearest; + float lodMinClamp = 0.0f; + float lodMaxClamp = 32.0f; + CompareFunction compare = CompareFunction::Undefined; + uint16_t maxAnisotropy = 1; + }; + + // Can be chained in ShaderModuleDescriptor + struct ShaderModuleSPIRVDescriptor : ChainedStruct { + ShaderModuleSPIRVDescriptor() { + sType = SType::ShaderModuleSPIRVDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t codeSize; + uint32_t const * code; + }; + + // Can be chained in ShaderModuleDescriptor + struct ShaderModuleWGSLDescriptor : ChainedStruct { + ShaderModuleWGSLDescriptor() { + sType = SType::ShaderModuleWGSLDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); + alignas(kFirstMemberAlignment) char const * code; + }; + + struct ShaderModuleDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct SharedBufferMemoryBeginAccessDescriptor { + ChainedStruct const * nextInChain = nullptr; + Bool initialized; + size_t fenceCount; + SharedFence const * fences; + uint64_t const * signaledValues; + }; + + struct SharedBufferMemoryDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct SharedBufferMemoryEndAccessState { + SharedBufferMemoryEndAccessState() = default; + ~SharedBufferMemoryEndAccessState(); + SharedBufferMemoryEndAccessState(const SharedBufferMemoryEndAccessState&) = delete; + SharedBufferMemoryEndAccessState& operator=(const SharedBufferMemoryEndAccessState&) = delete; + SharedBufferMemoryEndAccessState(SharedBufferMemoryEndAccessState&&); + SharedBufferMemoryEndAccessState& operator=(SharedBufferMemoryEndAccessState&&); + ChainedStructOut * nextInChain = nullptr; + Bool const initialized = {}; + size_t const fenceCount = {}; + SharedFence const * const fences = {}; + uint64_t const * const signaledValues = {}; + }; + + struct SharedBufferMemoryProperties { + ChainedStructOut * nextInChain = nullptr; + BufferUsage usage; + uint64_t size; + }; + + // Can be chained in SharedFenceDescriptor + struct SharedFenceDXGISharedHandleDescriptor : ChainedStruct { + SharedFenceDXGISharedHandleDescriptor() { + sType = SType::SharedFenceDXGISharedHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * handle; + }; + + // Can be chained in SharedFenceExportInfo + struct SharedFenceDXGISharedHandleExportInfo : ChainedStructOut { + SharedFenceDXGISharedHandleExportInfo() { + sType = SType::SharedFenceDXGISharedHandleExportInfo; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * handle; + }; + + // Can be chained in SharedFenceDescriptor + struct SharedFenceMTLSharedEventDescriptor : ChainedStruct { + SharedFenceMTLSharedEventDescriptor() { + sType = SType::SharedFenceMTLSharedEventDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * sharedEvent; + }; + + // Can be chained in SharedFenceExportInfo + struct SharedFenceMTLSharedEventExportInfo : ChainedStructOut { + SharedFenceMTLSharedEventExportInfo() { + sType = SType::SharedFenceMTLSharedEventExportInfo; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * sharedEvent; + }; + + struct SharedFenceDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct SharedFenceExportInfo { + ChainedStructOut * nextInChain = nullptr; + SharedFenceType type; + }; + + // Can be chained in SharedFenceDescriptor + struct SharedFenceVkSemaphoreOpaqueFDDescriptor : ChainedStruct { + SharedFenceVkSemaphoreOpaqueFDDescriptor() { + sType = SType::SharedFenceVkSemaphoreOpaqueFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); + alignas(kFirstMemberAlignment) int handle; + }; + + // Can be chained in SharedFenceExportInfo + struct SharedFenceVkSemaphoreOpaqueFDExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreOpaqueFDExportInfo() { + sType = SType::SharedFenceVkSemaphoreOpaqueFDExportInfo; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); + alignas(kFirstMemberAlignment) int handle; + }; + + // Can be chained in SharedFenceDescriptor + struct SharedFenceVkSemaphoreSyncFDDescriptor : ChainedStruct { + SharedFenceVkSemaphoreSyncFDDescriptor() { + sType = SType::SharedFenceVkSemaphoreSyncFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); + alignas(kFirstMemberAlignment) int handle; + }; + + // Can be chained in SharedFenceExportInfo + struct SharedFenceVkSemaphoreSyncFDExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreSyncFDExportInfo() { + sType = SType::SharedFenceVkSemaphoreSyncFDExportInfo; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); + alignas(kFirstMemberAlignment) int handle; + }; + + // Can be chained in SharedFenceDescriptor + struct SharedFenceVkSemaphoreZirconHandleDescriptor : ChainedStruct { + SharedFenceVkSemaphoreZirconHandleDescriptor() { + sType = SType::SharedFenceVkSemaphoreZirconHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t handle; + }; + + // Can be chained in SharedFenceExportInfo + struct SharedFenceVkSemaphoreZirconHandleExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreZirconHandleExportInfo() { + sType = SType::SharedFenceVkSemaphoreZirconHandleExportInfo; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t handle; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryDXGISharedHandleDescriptor : ChainedStruct { + SharedTextureMemoryDXGISharedHandleDescriptor() { + sType = SType::SharedTextureMemoryDXGISharedHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * handle; + Bool useKeyedMutex; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryEGLImageDescriptor : ChainedStruct { + SharedTextureMemoryEGLImageDescriptor() { + sType = SType::SharedTextureMemoryEGLImageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * image; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryIOSurfaceDescriptor : ChainedStruct { + SharedTextureMemoryIOSurfaceDescriptor() { + sType = SType::SharedTextureMemoryIOSurfaceDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * ioSurface; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryAHardwareBufferDescriptor : ChainedStruct { + SharedTextureMemoryAHardwareBufferDescriptor() { + sType = SType::SharedTextureMemoryAHardwareBufferDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * handle; + }; + + struct SharedTextureMemoryBeginAccessDescriptor { + ChainedStruct const * nextInChain = nullptr; + Bool concurrentRead; + Bool initialized; + size_t fenceCount; + SharedFence const * fences; + uint64_t const * signaledValues; + }; + + struct SharedTextureMemoryDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + struct SharedTextureMemoryDmaBufPlane { + int fd; + uint64_t offset; + uint32_t stride; + }; + + struct SharedTextureMemoryEndAccessState { + SharedTextureMemoryEndAccessState() = default; + ~SharedTextureMemoryEndAccessState(); + SharedTextureMemoryEndAccessState(const SharedTextureMemoryEndAccessState&) = delete; + SharedTextureMemoryEndAccessState& operator=(const SharedTextureMemoryEndAccessState&) = delete; + SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState&&); + SharedTextureMemoryEndAccessState& operator=(SharedTextureMemoryEndAccessState&&); + ChainedStructOut * nextInChain = nullptr; + Bool const initialized = {}; + size_t const fenceCount = {}; + SharedFence const * const fences = {}; + uint64_t const * const signaledValues = {}; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryOpaqueFDDescriptor : ChainedStruct { + SharedTextureMemoryOpaqueFDDescriptor() { + sType = SType::SharedTextureMemoryOpaqueFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void const * )); + alignas(kFirstMemberAlignment) void const * vkImageCreateInfo; + int memoryFD; + uint32_t memoryTypeIndex; + uint64_t allocationSize; + Bool dedicatedAllocation; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryVkDedicatedAllocationDescriptor : ChainedStruct { + SharedTextureMemoryVkDedicatedAllocationDescriptor() { + sType = SType::SharedTextureMemoryVkDedicatedAllocationDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); + alignas(kFirstMemberAlignment) Bool dedicatedAllocation; + }; + + // Can be chained in SharedTextureMemoryBeginAccessDescriptor + struct SharedTextureMemoryVkImageLayoutBeginState : ChainedStruct { + SharedTextureMemoryVkImageLayoutBeginState() { + sType = SType::SharedTextureMemoryVkImageLayoutBeginState; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t )); + alignas(kFirstMemberAlignment) int32_t oldLayout; + int32_t newLayout; + }; + + // Can be chained in SharedTextureMemoryEndAccessState + struct SharedTextureMemoryVkImageLayoutEndState : ChainedStructOut { + SharedTextureMemoryVkImageLayoutEndState() { + sType = SType::SharedTextureMemoryVkImageLayoutEndState; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t )); + alignas(kFirstMemberAlignment) int32_t oldLayout; + int32_t newLayout; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryZirconHandleDescriptor : ChainedStruct { + SharedTextureMemoryZirconHandleDescriptor() { + sType = SType::SharedTextureMemoryZirconHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); + alignas(kFirstMemberAlignment) uint32_t memoryFD; + uint64_t allocationSize; + }; + + // Can be chained in BindGroupLayoutEntry + struct StaticSamplerBindingLayout : ChainedStruct { + StaticSamplerBindingLayout() { + sType = SType::StaticSamplerBindingLayout; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Sampler )); + alignas(kFirstMemberAlignment) Sampler sampler; + }; + + struct StencilFaceState { + CompareFunction compare = CompareFunction::Always; + StencilOperation failOp = StencilOperation::Keep; + StencilOperation depthFailOp = StencilOperation::Keep; + StencilOperation passOp = StencilOperation::Keep; + }; + + struct StorageTextureBindingLayout { + ChainedStruct const * nextInChain = nullptr; + StorageTextureAccess access = StorageTextureAccess::Undefined; + TextureFormat format = TextureFormat::Undefined; + TextureViewDimension viewDimension = TextureViewDimension::e2D; + }; + + struct SurfaceDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromAndroidNativeWindow : ChainedStruct { + SurfaceDescriptorFromAndroidNativeWindow() { + sType = SType::SurfaceDescriptorFromAndroidNativeWindow; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * window; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromCanvasHTMLSelector : ChainedStruct { + SurfaceDescriptorFromCanvasHTMLSelector() { + sType = SType::SurfaceDescriptorFromCanvasHTMLSelector; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); + alignas(kFirstMemberAlignment) char const * selector; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromMetalLayer : ChainedStruct { + SurfaceDescriptorFromMetalLayer() { + sType = SType::SurfaceDescriptorFromMetalLayer; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * layer; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromWaylandSurface : ChainedStruct { + SurfaceDescriptorFromWaylandSurface() { + sType = SType::SurfaceDescriptorFromWaylandSurface; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * display; + void * surface; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromWindowsHWND : ChainedStruct { + SurfaceDescriptorFromWindowsHWND() { + sType = SType::SurfaceDescriptorFromWindowsHWND; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * hinstance; + void * hwnd; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromWindowsCoreWindow : ChainedStruct { + SurfaceDescriptorFromWindowsCoreWindow() { + sType = SType::SurfaceDescriptorFromWindowsCoreWindow; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * coreWindow; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromWindowsSwapChainPanel : ChainedStruct { + SurfaceDescriptorFromWindowsSwapChainPanel() { + sType = SType::SurfaceDescriptorFromWindowsSwapChainPanel; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * swapChainPanel; + }; + + // Can be chained in SurfaceDescriptor + struct SurfaceDescriptorFromXlibWindow : ChainedStruct { + SurfaceDescriptorFromXlibWindow() { + sType = SType::SurfaceDescriptorFromXlibWindow; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); + alignas(kFirstMemberAlignment) void * display; + uint64_t window; + }; + + struct SwapChainDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + TextureUsage usage; + TextureFormat format; + uint32_t width; + uint32_t height; + PresentMode presentMode; + }; + + struct TextureBindingLayout { + ChainedStruct const * nextInChain = nullptr; + TextureSampleType sampleType = TextureSampleType::Undefined; + TextureViewDimension viewDimension = TextureViewDimension::e2D; + Bool multisampled = false; + }; + + // Can be chained in TextureDescriptor + struct TextureBindingViewDimensionDescriptor : ChainedStruct { + TextureBindingViewDimensionDescriptor() { + sType = SType::TextureBindingViewDimensionDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureViewDimension )); + alignas(kFirstMemberAlignment) TextureViewDimension textureBindingViewDimension = TextureViewDimension::Undefined; + }; + + struct TextureDataLayout { + ChainedStruct const * nextInChain = nullptr; + uint64_t offset = 0; + uint32_t bytesPerRow = WGPU_COPY_STRIDE_UNDEFINED; + uint32_t rowsPerImage = WGPU_COPY_STRIDE_UNDEFINED; + }; + + struct TextureViewDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + TextureFormat format = TextureFormat::Undefined; + TextureViewDimension dimension = TextureViewDimension::Undefined; + uint32_t baseMipLevel = 0; + uint32_t mipLevelCount = WGPU_MIP_LEVEL_COUNT_UNDEFINED; + uint32_t baseArrayLayer = 0; + uint32_t arrayLayerCount = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; + TextureAspect aspect = TextureAspect::All; + }; + + struct VertexAttribute { + VertexFormat format; + uint64_t offset; + uint32_t shaderLocation; + }; + + // Can be chained in AdapterProperties + struct AdapterPropertiesMemoryHeaps : ChainedStructOut { + AdapterPropertiesMemoryHeaps() { + sType = SType::AdapterPropertiesMemoryHeaps; + } + ~AdapterPropertiesMemoryHeaps(); + AdapterPropertiesMemoryHeaps(const AdapterPropertiesMemoryHeaps&) = delete; + AdapterPropertiesMemoryHeaps& operator=(const AdapterPropertiesMemoryHeaps&) = delete; + AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps&&); + AdapterPropertiesMemoryHeaps& operator=(AdapterPropertiesMemoryHeaps&&); + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); + alignas(kFirstMemberAlignment) size_t const heapCount = {}; + MemoryHeapInfo const * const heapInfo = {}; + }; + + struct BindGroupDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + BindGroupLayout layout; + size_t entryCount; + BindGroupEntry const * entries; + }; + + struct BindGroupLayoutEntry { + ChainedStruct const * nextInChain = nullptr; + uint32_t binding; + ShaderStage visibility; + BufferBindingLayout buffer; + SamplerBindingLayout sampler; + TextureBindingLayout texture; + StorageTextureBindingLayout storageTexture; + }; + + struct BlendState { + BlendComponent color; + BlendComponent alpha; + }; + + struct CompilationInfo { + ChainedStruct const * nextInChain = nullptr; + size_t messageCount; + CompilationMessage const * messages; + }; + + struct ComputePassDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + ComputePassTimestampWrites const * timestampWrites = nullptr; + }; + + struct DepthStencilState { + ChainedStruct const * nextInChain = nullptr; + TextureFormat format; + Bool depthWriteEnabled = false; + CompareFunction depthCompare = CompareFunction::Undefined; + StencilFaceState stencilFront; + StencilFaceState stencilBack; + uint32_t stencilReadMask = 0xFFFFFFFF; + uint32_t stencilWriteMask = 0xFFFFFFFF; + int32_t depthBias = 0; + float depthBiasSlopeScale = 0.0f; + float depthBiasClamp = 0.0f; + }; + + // Can be chained in FormatCapabilities + struct DrmFormatCapabilities : ChainedStructOut { + DrmFormatCapabilities() { + sType = SType::DrmFormatCapabilities; + } + ~DrmFormatCapabilities(); + DrmFormatCapabilities(const DrmFormatCapabilities&) = delete; + DrmFormatCapabilities& operator=(const DrmFormatCapabilities&) = delete; + DrmFormatCapabilities(DrmFormatCapabilities&&); + DrmFormatCapabilities& operator=(DrmFormatCapabilities&&); + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); + alignas(kFirstMemberAlignment) size_t const propertiesCount = {}; + DrmFormatProperties const * const properties = {}; + }; + + struct ExternalTextureDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + TextureView plane0; + TextureView plane1 = nullptr; + Origin2D visibleOrigin; + Extent2D visibleSize; + Bool doYuvToRgbConversionOnly = false; + float const * yuvToRgbConversionMatrix = nullptr; + float const * srcTransferFunctionParameters; + float const * dstTransferFunctionParameters; + float const * gamutConversionMatrix; + Bool flipY = false; + Bool mirrored = false; + ExternalTextureRotation rotation = ExternalTextureRotation::Rotate0Degrees; + }; + + struct FutureWaitInfo { + Future future; + Bool completed = false; + }; + + struct ImageCopyBuffer { + ChainedStruct const * nextInChain = nullptr; + TextureDataLayout layout; + Buffer buffer; + }; + + struct ImageCopyExternalTexture { + ChainedStruct const * nextInChain = nullptr; + ExternalTexture externalTexture; + Origin3D origin; + Extent2D naturalSize; + }; + + struct ImageCopyTexture { + ChainedStruct const * nextInChain = nullptr; + Texture texture; + uint32_t mipLevel = 0; + Origin3D origin; + TextureAspect aspect = TextureAspect::All; + }; + + struct InstanceDescriptor { + ChainedStruct const * nextInChain = nullptr; + InstanceFeatures features; + }; + + // Can be chained in PipelineLayoutDescriptor + struct PipelineLayoutPixelLocalStorage : ChainedStruct { + PipelineLayoutPixelLocalStorage() { + sType = SType::PipelineLayoutPixelLocalStorage; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t )); + alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount = 0; + PipelineLayoutStorageAttachment const * storageAttachments; + }; + + struct ProgrammableStageDescriptor { + ChainedStruct const * nextInChain = nullptr; + ShaderModule module; + char const * entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const * constants; + }; + + struct RenderPassColorAttachment { + ChainedStruct const * nextInChain = nullptr; + TextureView view = nullptr; + uint32_t depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; + TextureView resolveTarget = nullptr; + LoadOp loadOp; + StoreOp storeOp; + Color clearValue; + }; + + struct RenderPassStorageAttachment { + ChainedStruct const * nextInChain = nullptr; + uint64_t offset = 0; + TextureView storage; + LoadOp loadOp; + StoreOp storeOp; + Color clearValue; + }; + + struct RequiredLimits { + ChainedStruct const * nextInChain = nullptr; + Limits limits; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryDmaBufDescriptor : ChainedStruct { + SharedTextureMemoryDmaBufDescriptor() { + sType = SType::SharedTextureMemoryDmaBufDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Extent3D )); + alignas(kFirstMemberAlignment) Extent3D size; + uint32_t drmFormat; + uint64_t drmModifier; + size_t planeCount; + SharedTextureMemoryDmaBufPlane const * planes; + }; + + struct SharedTextureMemoryProperties { + ChainedStructOut * nextInChain = nullptr; + TextureUsage usage; + Extent3D size; + TextureFormat format; + }; + + // Can be chained in SharedTextureMemoryDescriptor + struct SharedTextureMemoryVkImageDescriptor : ChainedStruct { + SharedTextureMemoryVkImageDescriptor() { + sType = SType::SharedTextureMemoryVkImageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t )); + alignas(kFirstMemberAlignment) int32_t vkFormat; + int32_t vkUsageFlags; + Extent3D vkExtent3D; + }; + + struct SupportedLimits { + ChainedStructOut * nextInChain = nullptr; + Limits limits; + }; + + struct TextureDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + TextureUsage usage; + TextureDimension dimension = TextureDimension::e2D; + Extent3D size; + TextureFormat format; + uint32_t mipLevelCount = 1; + uint32_t sampleCount = 1; + size_t viewFormatCount = 0; + TextureFormat const * viewFormats; + }; + + struct VertexBufferLayout { + uint64_t arrayStride; + VertexStepMode stepMode = VertexStepMode::Vertex; + size_t attributeCount; + VertexAttribute const * attributes; + }; + + struct BindGroupLayoutDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + size_t entryCount; + BindGroupLayoutEntry const * entries; + }; + + struct ColorTargetState { + ChainedStruct const * nextInChain = nullptr; + TextureFormat format; + BlendState const * blend = nullptr; + ColorWriteMask writeMask = ColorWriteMask::All; + }; + + struct ComputePipelineDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + PipelineLayout layout = nullptr; + ProgrammableStageDescriptor compute; + }; + + struct DeviceDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + size_t requiredFeatureCount = 0; + FeatureName const * requiredFeatures = nullptr; + RequiredLimits const * requiredLimits = nullptr; + QueueDescriptor defaultQueue; + DeviceLostCallback deviceLostCallback = nullptr; + void * deviceLostUserdata = nullptr; + }; + + struct RenderPassDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + size_t colorAttachmentCount; + RenderPassColorAttachment const * colorAttachments; + RenderPassDepthStencilAttachment const * depthStencilAttachment = nullptr; + QuerySet occlusionQuerySet = nullptr; + RenderPassTimestampWrites const * timestampWrites = nullptr; + }; + + // Can be chained in RenderPassDescriptor + struct RenderPassPixelLocalStorage : ChainedStruct { + RenderPassPixelLocalStorage() { + sType = SType::RenderPassPixelLocalStorage; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t )); + alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount = 0; + RenderPassStorageAttachment const * storageAttachments; + }; + + struct VertexState { + ChainedStruct const * nextInChain = nullptr; + ShaderModule module; + char const * entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const * constants; + size_t bufferCount = 0; + VertexBufferLayout const * buffers; + }; + + struct FragmentState { + ChainedStruct const * nextInChain = nullptr; + ShaderModule module; + char const * entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const * constants; + size_t targetCount; + ColorTargetState const * targets; + }; + + struct RenderPipelineDescriptor { + ChainedStruct const * nextInChain = nullptr; + char const * label = nullptr; + PipelineLayout layout = nullptr; + VertexState vertex; + PrimitiveState primitive; + DepthStencilState const * depthStencil = nullptr; + MultisampleState multisample; + FragmentState const * fragment = nullptr; + }; + +} // namespace wgpu -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryVkDedicatedAllocationDescriptor : ChainedStruct { - SharedTextureMemoryVkDedicatedAllocationDescriptor() { - sType = SType::SharedTextureMemoryVkDedicatedAllocationDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); - alignas(kFirstMemberAlignment) Bool dedicatedAllocation; -}; - -// Can be chained in SharedTextureMemoryBeginAccessDescriptor -struct SharedTextureMemoryVkImageLayoutBeginState : ChainedStruct { - SharedTextureMemoryVkImageLayoutBeginState() { - sType = SType::SharedTextureMemoryVkImageLayoutBeginState; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); - alignas(kFirstMemberAlignment) int32_t oldLayout; - int32_t newLayout; -}; - -// Can be chained in SharedTextureMemoryEndAccessState -struct SharedTextureMemoryVkImageLayoutEndState : ChainedStructOut { - SharedTextureMemoryVkImageLayoutEndState() { - sType = SType::SharedTextureMemoryVkImageLayoutEndState; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); - alignas(kFirstMemberAlignment) int32_t oldLayout; - int32_t newLayout; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryZirconHandleDescriptor : ChainedStruct { - SharedTextureMemoryZirconHandleDescriptor() { - sType = SType::SharedTextureMemoryZirconHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); - alignas(kFirstMemberAlignment) uint32_t memoryFD; - uint64_t allocationSize; -}; - -struct StencilFaceState { - CompareFunction compare = CompareFunction::Always; - StencilOperation failOp = StencilOperation::Keep; - StencilOperation depthFailOp = StencilOperation::Keep; - StencilOperation passOp = StencilOperation::Keep; -}; - -struct StorageTextureBindingLayout { - ChainedStruct const *nextInChain = nullptr; - StorageTextureAccess access = StorageTextureAccess::Undefined; - TextureFormat format = TextureFormat::Undefined; - TextureViewDimension viewDimension = TextureViewDimension::Undefined; -}; - -struct SurfaceDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromAndroidNativeWindow : ChainedStruct { - SurfaceDescriptorFromAndroidNativeWindow() { - sType = SType::SurfaceDescriptorFromAndroidNativeWindow; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *window; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromCanvasHTMLSelector : ChainedStruct { - SurfaceDescriptorFromCanvasHTMLSelector() { - sType = SType::SurfaceDescriptorFromCanvasHTMLSelector; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); - alignas(kFirstMemberAlignment) char const *selector; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromMetalLayer : ChainedStruct { - SurfaceDescriptorFromMetalLayer() { - sType = SType::SurfaceDescriptorFromMetalLayer; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *layer; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromWaylandSurface : ChainedStruct { - SurfaceDescriptorFromWaylandSurface() { - sType = SType::SurfaceDescriptorFromWaylandSurface; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *display; - void *surface; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromWindowsHWND : ChainedStruct { - SurfaceDescriptorFromWindowsHWND() { - sType = SType::SurfaceDescriptorFromWindowsHWND; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *hinstance; - void *hwnd; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromWindowsCoreWindow : ChainedStruct { - SurfaceDescriptorFromWindowsCoreWindow() { - sType = SType::SurfaceDescriptorFromWindowsCoreWindow; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *coreWindow; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromWindowsSwapChainPanel : ChainedStruct { - SurfaceDescriptorFromWindowsSwapChainPanel() { - sType = SType::SurfaceDescriptorFromWindowsSwapChainPanel; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *swapChainPanel; -}; - -// Can be chained in SurfaceDescriptor -struct SurfaceDescriptorFromXlibWindow : ChainedStruct { - SurfaceDescriptorFromXlibWindow() { - sType = SType::SurfaceDescriptorFromXlibWindow; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); - alignas(kFirstMemberAlignment) void *display; - uint64_t window; -}; - -struct SwapChainDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - TextureUsage usage; - TextureFormat format; - uint32_t width; - uint32_t height; - PresentMode presentMode; -}; - -struct TextureBindingLayout { - ChainedStruct const *nextInChain = nullptr; - TextureSampleType sampleType = TextureSampleType::Undefined; - TextureViewDimension viewDimension = TextureViewDimension::Undefined; - Bool multisampled = false; -}; - -// Can be chained in TextureDescriptor -struct TextureBindingViewDimensionDescriptor : ChainedStruct { - TextureBindingViewDimensionDescriptor() { - sType = SType::TextureBindingViewDimensionDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax( - alignof(ChainedStruct), alignof(TextureViewDimension)); - alignas(kFirstMemberAlignment) TextureViewDimension - textureBindingViewDimension = TextureViewDimension::Undefined; -}; - -struct TextureDataLayout { - ChainedStruct const *nextInChain = nullptr; - uint64_t offset = 0; - uint32_t bytesPerRow = WGPU_COPY_STRIDE_UNDEFINED; - uint32_t rowsPerImage = WGPU_COPY_STRIDE_UNDEFINED; -}; - -struct TextureViewDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - TextureFormat format = TextureFormat::Undefined; - TextureViewDimension dimension = TextureViewDimension::Undefined; - uint32_t baseMipLevel = 0; - uint32_t mipLevelCount = WGPU_MIP_LEVEL_COUNT_UNDEFINED; - uint32_t baseArrayLayer = 0; - uint32_t arrayLayerCount = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; - TextureAspect aspect = TextureAspect::All; -}; - -struct VertexAttribute { - VertexFormat format; - uint64_t offset; - uint32_t shaderLocation; -}; - -// Can be chained in AdapterProperties -struct AdapterPropertiesMemoryHeaps : ChainedStructOut { - AdapterPropertiesMemoryHeaps() { - sType = SType::AdapterPropertiesMemoryHeaps; - } - ~AdapterPropertiesMemoryHeaps(); - AdapterPropertiesMemoryHeaps(const AdapterPropertiesMemoryHeaps &) = delete; - AdapterPropertiesMemoryHeaps & - operator=(const AdapterPropertiesMemoryHeaps &) = delete; - AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps &&); - AdapterPropertiesMemoryHeaps &operator=(AdapterPropertiesMemoryHeaps &&); - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); - alignas(kFirstMemberAlignment) size_t const heapCount = {}; - MemoryHeapInfo const *const heapInfo = {}; -}; - -struct BindGroupDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - BindGroupLayout layout; - size_t entryCount; - BindGroupEntry const *entries; -}; - -struct BindGroupLayoutEntry { - ChainedStruct const *nextInChain = nullptr; - uint32_t binding; - ShaderStage visibility; - BufferBindingLayout buffer; - SamplerBindingLayout sampler; - TextureBindingLayout texture; - StorageTextureBindingLayout storageTexture; -}; - -struct BlendState { - BlendComponent color; - BlendComponent alpha; -}; - -struct CompilationInfo { - ChainedStruct const *nextInChain = nullptr; - size_t messageCount; - CompilationMessage const *messages; -}; - -struct ComputePassDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - ComputePassTimestampWrites const *timestampWrites = nullptr; -}; - -struct DepthStencilState { - ChainedStruct const *nextInChain = nullptr; - TextureFormat format; - Bool depthWriteEnabled = false; - CompareFunction depthCompare = CompareFunction::Undefined; - StencilFaceState stencilFront; - StencilFaceState stencilBack; - uint32_t stencilReadMask = 0xFFFFFFFF; - uint32_t stencilWriteMask = 0xFFFFFFFF; - int32_t depthBias = 0; - float depthBiasSlopeScale = 0.0f; - float depthBiasClamp = 0.0f; -}; - -struct ExternalTextureDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - TextureView plane0; - TextureView plane1; - Origin2D visibleOrigin; - Extent2D visibleSize; - Bool doYuvToRgbConversionOnly = false; - float const *yuvToRgbConversionMatrix = nullptr; - float const *srcTransferFunctionParameters; - float const *dstTransferFunctionParameters; - float const *gamutConversionMatrix; - Bool flipY = false; - ExternalTextureRotation rotation = ExternalTextureRotation::Rotate0Degrees; -}; - -struct FutureWaitInfo { - Future future; - Bool completed = false; -}; - -struct ImageCopyBuffer { - ChainedStruct const *nextInChain = nullptr; - TextureDataLayout layout; - Buffer buffer; -}; - -struct ImageCopyExternalTexture { - ChainedStruct const *nextInChain = nullptr; - ExternalTexture externalTexture; - Origin3D origin; - Extent2D naturalSize; -}; - -struct ImageCopyTexture { - ChainedStruct const *nextInChain = nullptr; - Texture texture; - uint32_t mipLevel = 0; - Origin3D origin; - TextureAspect aspect = TextureAspect::All; -}; - -struct InstanceDescriptor { - ChainedStruct const *nextInChain = nullptr; - InstanceFeatures features; -}; - -// Can be chained in PipelineLayoutDescriptor -struct PipelineLayoutPixelLocalStorage : ChainedStruct { - PipelineLayoutPixelLocalStorage() { - sType = SType::PipelineLayoutPixelLocalStorage; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); - alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount = 0; - PipelineLayoutStorageAttachment const *storageAttachments; -}; - -struct ProgrammableStageDescriptor { - ChainedStruct const *nextInChain = nullptr; - ShaderModule module; - char const *entryPoint = nullptr; - size_t constantCount = 0; - ConstantEntry const *constants; -}; - -struct RenderPassColorAttachment { - ChainedStruct const *nextInChain = nullptr; - TextureView view; - uint32_t depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; - TextureView resolveTarget; - LoadOp loadOp; - StoreOp storeOp; - Color clearValue; -}; - -struct RenderPassStorageAttachment { - ChainedStruct const *nextInChain = nullptr; - uint64_t offset = 0; - TextureView storage; - LoadOp loadOp; - StoreOp storeOp; - Color clearValue; -}; - -struct RequiredLimits { - ChainedStruct const *nextInChain = nullptr; - Limits limits; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryDmaBufDescriptor : ChainedStruct { - SharedTextureMemoryDmaBufDescriptor() { - sType = SType::SharedTextureMemoryDmaBufDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(Extent3D)); - alignas(kFirstMemberAlignment) Extent3D size; - uint32_t drmFormat; - uint64_t drmModifier; - size_t planeCount; - SharedTextureMemoryDmaBufPlane const *planes; -}; - -struct SharedTextureMemoryProperties { - ChainedStructOut *nextInChain = nullptr; - TextureUsage usage; - Extent3D size; - TextureFormat format; -}; - -// Can be chained in SharedTextureMemoryDescriptor -struct SharedTextureMemoryVkImageDescriptor : ChainedStruct { - SharedTextureMemoryVkImageDescriptor() { - sType = SType::SharedTextureMemoryVkImageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); - alignas(kFirstMemberAlignment) int32_t vkFormat; - int32_t vkUsageFlags; - Extent3D vkExtent3D; -}; - -struct SupportedLimits { - ChainedStructOut *nextInChain = nullptr; - Limits limits; -}; - -struct TextureDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - TextureUsage usage; - TextureDimension dimension = TextureDimension::e2D; - Extent3D size; - TextureFormat format; - uint32_t mipLevelCount = 1; - uint32_t sampleCount = 1; - size_t viewFormatCount = 0; - TextureFormat const *viewFormats; -}; - -struct VertexBufferLayout { - uint64_t arrayStride; - VertexStepMode stepMode = VertexStepMode::Vertex; - size_t attributeCount; - VertexAttribute const *attributes; -}; - -struct BindGroupLayoutDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - size_t entryCount; - BindGroupLayoutEntry const *entries; -}; - -struct ColorTargetState { - ChainedStruct const *nextInChain = nullptr; - TextureFormat format; - BlendState const *blend = nullptr; - ColorWriteMask writeMask = ColorWriteMask::All; -}; - -struct ComputePipelineDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - PipelineLayout layout; - ProgrammableStageDescriptor compute; -}; - -struct DeviceDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - size_t requiredFeatureCount = 0; - FeatureName const *requiredFeatures = nullptr; - RequiredLimits const *requiredLimits = nullptr; - QueueDescriptor defaultQueue; - DeviceLostCallback deviceLostCallback = nullptr; - void *deviceLostUserdata = nullptr; -}; - -struct RenderPassDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - size_t colorAttachmentCount; - RenderPassColorAttachment const *colorAttachments; - RenderPassDepthStencilAttachment const *depthStencilAttachment = nullptr; - QuerySet occlusionQuerySet; - RenderPassTimestampWrites const *timestampWrites = nullptr; -}; - -// Can be chained in RenderPassDescriptor -struct RenderPassPixelLocalStorage : ChainedStruct { - RenderPassPixelLocalStorage() { sType = SType::RenderPassPixelLocalStorage; } - static constexpr size_t kFirstMemberAlignment = - detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); - alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount = 0; - RenderPassStorageAttachment const *storageAttachments; -}; - -struct VertexState { - ChainedStruct const *nextInChain = nullptr; - ShaderModule module; - char const *entryPoint = nullptr; - size_t constantCount = 0; - ConstantEntry const *constants; - size_t bufferCount = 0; - VertexBufferLayout const *buffers; -}; - -struct FragmentState { - ChainedStruct const *nextInChain = nullptr; - ShaderModule module; - char const *entryPoint = nullptr; - size_t constantCount = 0; - ConstantEntry const *constants; - size_t targetCount; - ColorTargetState const *targets; -}; - -struct RenderPipelineDescriptor { - ChainedStruct const *nextInChain = nullptr; - char const *label = nullptr; - PipelineLayout layout; - VertexState vertex; - PrimitiveState primitive; - DepthStencilState const *depthStencil = nullptr; - MultisampleState multisample; - FragmentState const *fragment = nullptr; -}; +namespace wgpu { + template<> + struct IsWGPUBitmask { + static constexpr bool enable = true; + }; + + template<> + struct IsWGPUBitmask { + static constexpr bool enable = true; + }; + + template<> + struct IsWGPUBitmask { + static constexpr bool enable = true; + }; + + template<> + struct IsWGPUBitmask { + static constexpr bool enable = true; + }; + + template<> + struct IsWGPUBitmask { + static constexpr bool enable = true; + }; + + template<> + struct IsWGPUBitmask { + static constexpr bool enable = true; + }; -// The operators of EnumClassBitmmasks in the dawn:: namespace need to be -// imported in the wgpu namespace for Argument Dependent Lookup. -// DAWN_IMPORT_BITMASK_OPERATORS } // namespace wgpu -namespace dawn { -// template <> struct IsDawnBitmask { -// static constexpr bool enable = true; -// }; - -// template <> struct IsDawnBitmask { -// static constexpr bool enable = true; -// }; - -// template <> struct IsDawnBitmask { -// static constexpr bool enable = true; -// }; - -// template <> struct IsDawnBitmask { -// static constexpr bool enable = true; -// }; - -// template <> struct IsDawnBitmask { -// static constexpr bool enable = true; -// }; - -// template <> struct IsDawnBitmask { -// static constexpr bool enable = true; -// }; - -} // namespace dawn - namespace std { -// Custom boolean class needs corresponding hash function so that it appears as -// a transparent bool. -template <> struct hash { -public: - size_t operator()(const wgpu::Bool &v) const { return hash()(v); } +// Custom boolean class needs corresponding hash function so that it appears as a transparent bool. +template <> +struct hash { + public: + size_t operator()(const wgpu::Bool &v) const { + return hash()(v); + } }; -} // namespace std +} // namespace std #endif // WEBGPU_CPP_H_ diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h b/package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h deleted file mode 100644 index 49340c3afb..0000000000 --- a/package/android/cpp/rnskia-android/dawn/webgpu_cpp_chained_struct.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifdef __EMSCRIPTEN__ -#error \ - "Do not include this header. Emscripten already provides headers needed for WebGPU." -#endif -#ifndef WEBGPU_CPP_CHAINED_STRUCT_H_ -#define WEBGPU_CPP_CHAINED_STRUCT_H_ - -#include -#include - -// This header file declares the ChainedStruct structures separately from the -// WebGPU headers so that dependencies can directly extend structures without -// including the larger header which exposes capabilities that may require -// correctly set proc tables. -namespace wgpu { - -enum class SType : uint32_t; - -struct ChainedStruct { - ChainedStruct const *nextInChain = nullptr; - SType sType = SType(0u); -}; - -struct ChainedStructOut { - ChainedStructOut *nextInChain = nullptr; - SType sType = SType(0u); -}; - -} // namespace wgpu - -#endif // WEBGPU_CPP_CHAINED_STRUCT_H_ diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu.h b/package/android/cpp/rnskia-android/webgpu/webgpu.h new file mode 100644 index 0000000000..1f4d039b42 --- /dev/null +++ b/package/android/cpp/rnskia-android/webgpu/webgpu.h @@ -0,0 +1,2762 @@ +// 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. +#ifdef __EMSCRIPTEN__ +#error "Do not include this header. Emscripten already provides headers needed for WebGPU." +#endif +#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 UINT32_MAX +#define WGPU_COPY_STRIDE_UNDEFINED UINT32_MAX +#define WGPU_DEPTH_SLICE_UNDEFINED UINT32_MAX +#define WGPU_LIMIT_U32_UNDEFINED UINT32_MAX +#define WGPU_LIMIT_U64_UNDEFINED UINT64_MAX +#define WGPU_MIP_LEVEL_COUNT_UNDEFINED UINT32_MAX +#define WGPU_QUERY_SET_INDEX_UNDEFINED UINT32_MAX +#define WGPU_WHOLE_MAP_SIZE SIZE_MAX +#define WGPU_WHOLE_SIZE UINT64_MAX + +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 WGPUExternalTextureImpl* WGPUExternalTexture 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 WGPUSharedBufferMemoryImpl* WGPUSharedBufferMemory WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedFenceImpl* WGPUSharedFence WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedTextureMemoryImpl* WGPUSharedTextureMemory WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSurfaceImpl* WGPUSurface WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSwapChainImpl* WGPUSwapChain WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTextureImpl* WGPUTexture WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE; + +// Structure forward declarations +struct WGPUAdapterProperties; +struct WGPUAdapterPropertiesD3D; +struct WGPUAdapterPropertiesVk; +struct WGPUBindGroupEntry; +struct WGPUBlendComponent; +struct WGPUBufferBindingLayout; +struct WGPUBufferDescriptor; +struct WGPUBufferHostMappedPointer; +struct WGPUBufferMapCallbackInfo; +struct WGPUColor; +struct WGPUCommandBufferDescriptor; +struct WGPUCommandEncoderDescriptor; +struct WGPUCompilationInfoCallbackInfo; +struct WGPUCompilationMessage; +struct WGPUComputePassTimestampWrites; +struct WGPUConstantEntry; +struct WGPUCopyTextureForBrowserOptions; +struct WGPUCreateComputePipelineAsyncCallbackInfo; +struct WGPUCreateRenderPipelineAsyncCallbackInfo; +struct WGPUDawnWGSLBlocklist; +struct WGPUDawnAdapterPropertiesPowerPreference; +struct WGPUDawnBufferDescriptorErrorInfoFromWireClient; +struct WGPUDawnCacheDeviceDescriptor; +struct WGPUDawnComputePipelineFullSubgroups; +struct WGPUDawnEncoderInternalUsageDescriptor; +struct WGPUDawnExperimentalSubgroupLimits; +struct WGPUDawnMultisampleStateRenderToSingleSampled; +struct WGPUDawnRenderPassColorAttachmentRenderToSingleSampled; +struct WGPUDawnShaderModuleSPIRVOptionsDescriptor; +struct WGPUDawnTextureInternalUsageDescriptor; +struct WGPUDawnTogglesDescriptor; +struct WGPUDawnWireWGSLControl; +struct WGPUDepthStencilStateDepthWriteDefinedDawn; +struct WGPUDrmFormatProperties; +struct WGPUExtent2D; +struct WGPUExtent3D; +struct WGPUExternalTextureBindingEntry; +struct WGPUExternalTextureBindingLayout; +struct WGPUFormatCapabilities; +struct WGPUFuture; +struct WGPUInstanceFeatures; +struct WGPULimits; +struct WGPUMemoryHeapInfo; +struct WGPUMultisampleState; +struct WGPUOrigin2D; +struct WGPUOrigin3D; +struct WGPUPipelineLayoutDescriptor; +struct WGPUPipelineLayoutStorageAttachment; +struct WGPUPopErrorScopeCallbackInfo; +struct WGPUPrimitiveDepthClipControl; +struct WGPUPrimitiveState; +struct WGPUQuerySetDescriptor; +struct WGPUQueueDescriptor; +struct WGPUQueueWorkDoneCallbackInfo; +struct WGPURenderBundleDescriptor; +struct WGPURenderBundleEncoderDescriptor; +struct WGPURenderPassDepthStencilAttachment; +struct WGPURenderPassDescriptorMaxDrawCount; +struct WGPURenderPassTimestampWrites; +struct WGPURequestAdapterCallbackInfo; +struct WGPURequestAdapterOptions; +struct WGPURequestDeviceCallbackInfo; +struct WGPUSamplerBindingLayout; +struct WGPUSamplerDescriptor; +struct WGPUShaderModuleSPIRVDescriptor; +struct WGPUShaderModuleWGSLDescriptor; +struct WGPUShaderModuleDescriptor; +struct WGPUSharedBufferMemoryBeginAccessDescriptor; +struct WGPUSharedBufferMemoryDescriptor; +struct WGPUSharedBufferMemoryEndAccessState; +struct WGPUSharedBufferMemoryProperties; +struct WGPUSharedFenceDXGISharedHandleDescriptor; +struct WGPUSharedFenceDXGISharedHandleExportInfo; +struct WGPUSharedFenceMTLSharedEventDescriptor; +struct WGPUSharedFenceMTLSharedEventExportInfo; +struct WGPUSharedFenceDescriptor; +struct WGPUSharedFenceExportInfo; +struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor; +struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo; +struct WGPUSharedFenceVkSemaphoreSyncFDDescriptor; +struct WGPUSharedFenceVkSemaphoreSyncFDExportInfo; +struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor; +struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo; +struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor; +struct WGPUSharedTextureMemoryEGLImageDescriptor; +struct WGPUSharedTextureMemoryIOSurfaceDescriptor; +struct WGPUSharedTextureMemoryAHardwareBufferDescriptor; +struct WGPUSharedTextureMemoryBeginAccessDescriptor; +struct WGPUSharedTextureMemoryDescriptor; +struct WGPUSharedTextureMemoryDmaBufPlane; +struct WGPUSharedTextureMemoryEndAccessState; +struct WGPUSharedTextureMemoryOpaqueFDDescriptor; +struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor; +struct WGPUSharedTextureMemoryVkImageLayoutBeginState; +struct WGPUSharedTextureMemoryVkImageLayoutEndState; +struct WGPUSharedTextureMemoryZirconHandleDescriptor; +struct WGPUStaticSamplerBindingLayout; +struct WGPUStencilFaceState; +struct WGPUStorageTextureBindingLayout; +struct WGPUSurfaceDescriptor; +struct WGPUSurfaceDescriptorFromAndroidNativeWindow; +struct WGPUSurfaceDescriptorFromCanvasHTMLSelector; +struct WGPUSurfaceDescriptorFromMetalLayer; +struct WGPUSurfaceDescriptorFromWaylandSurface; +struct WGPUSurfaceDescriptorFromWindowsHWND; +struct WGPUSurfaceDescriptorFromWindowsCoreWindow; +struct WGPUSurfaceDescriptorFromWindowsSwapChainPanel; +struct WGPUSurfaceDescriptorFromXlibWindow; +struct WGPUSwapChainDescriptor; +struct WGPUTextureBindingLayout; +struct WGPUTextureBindingViewDimensionDescriptor; +struct WGPUTextureDataLayout; +struct WGPUTextureViewDescriptor; +struct WGPUVertexAttribute; +struct WGPUAdapterPropertiesMemoryHeaps; +struct WGPUBindGroupDescriptor; +struct WGPUBindGroupLayoutEntry; +struct WGPUBlendState; +struct WGPUCompilationInfo; +struct WGPUComputePassDescriptor; +struct WGPUDepthStencilState; +struct WGPUDrmFormatCapabilities; +struct WGPUExternalTextureDescriptor; +struct WGPUFutureWaitInfo; +struct WGPUImageCopyBuffer; +struct WGPUImageCopyExternalTexture; +struct WGPUImageCopyTexture; +struct WGPUInstanceDescriptor; +struct WGPUPipelineLayoutPixelLocalStorage; +struct WGPUProgrammableStageDescriptor; +struct WGPURenderPassColorAttachment; +struct WGPURenderPassStorageAttachment; +struct WGPURequiredLimits; +struct WGPUSharedTextureMemoryDmaBufDescriptor; +struct WGPUSharedTextureMemoryProperties; +struct WGPUSharedTextureMemoryVkImageDescriptor; +struct WGPUSupportedLimits; +struct WGPUTextureDescriptor; +struct WGPUVertexBufferLayout; +struct WGPUBindGroupLayoutDescriptor; +struct WGPUColorTargetState; +struct WGPUComputePipelineDescriptor; +struct WGPUDeviceDescriptor; +struct WGPURenderPassDescriptor; +struct WGPURenderPassPixelLocalStorage; +struct WGPUVertexState; +struct WGPUFragmentState; +struct WGPURenderPipelineDescriptor; + +typedef enum WGPUWGSLFeatureName { + WGPUWGSLFeatureName_Undefined = 0x00000000, + WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures = 0x00000001, + WGPUWGSLFeatureName_Packed4x8IntegerDotProduct = 0x00000002, + WGPUWGSLFeatureName_UnrestrictedPointerParameters = 0x00000003, + WGPUWGSLFeatureName_PointerCompositeAccess = 0x00000004, + WGPUWGSLFeatureName_ChromiumTestingUnimplemented = 0x000003E8, + WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental = 0x000003E9, + WGPUWGSLFeatureName_ChromiumTestingExperimental = 0x000003EA, + WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch = 0x000003EB, + WGPUWGSLFeatureName_ChromiumTestingShipped = 0x000003EC, + WGPUWGSLFeatureName_Force32 = 0x7FFFFFFF +} WGPUWGSLFeatureName WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUAdapterType { + WGPUAdapterType_DiscreteGPU = 0x00000001, + WGPUAdapterType_IntegratedGPU = 0x00000002, + WGPUAdapterType_CPU = 0x00000003, + WGPUAdapterType_Unknown = 0x00000004, + WGPUAdapterType_Force32 = 0x7FFFFFFF +} WGPUAdapterType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUAddressMode { + WGPUAddressMode_Undefined = 0x00000000, + WGPUAddressMode_ClampToEdge = 0x00000001, + WGPUAddressMode_Repeat = 0x00000002, + WGPUAddressMode_MirrorRepeat = 0x00000003, + WGPUAddressMode_Force32 = 0x7FFFFFFF +} WGPUAddressMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUAlphaMode { + WGPUAlphaMode_Opaque = 0x00000001, + WGPUAlphaMode_Premultiplied = 0x00000002, + WGPUAlphaMode_Unpremultiplied = 0x00000003, + WGPUAlphaMode_Force32 = 0x7FFFFFFF +} WGPUAlphaMode 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_Undefined = 0x00000000, + WGPUBlendFactor_Zero = 0x00000001, + WGPUBlendFactor_One = 0x00000002, + WGPUBlendFactor_Src = 0x00000003, + WGPUBlendFactor_OneMinusSrc = 0x00000004, + WGPUBlendFactor_SrcAlpha = 0x00000005, + WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, + WGPUBlendFactor_Dst = 0x00000007, + WGPUBlendFactor_OneMinusDst = 0x00000008, + WGPUBlendFactor_DstAlpha = 0x00000009, + WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, + WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, + WGPUBlendFactor_Constant = 0x0000000C, + WGPUBlendFactor_OneMinusConstant = 0x0000000D, + WGPUBlendFactor_Src1 = 0x0000000E, + WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, + WGPUBlendFactor_Src1Alpha = 0x00000010, + WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, + WGPUBlendFactor_Force32 = 0x7FFFFFFF +} WGPUBlendFactor WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBlendOperation { + WGPUBlendOperation_Undefined = 0x00000000, + WGPUBlendOperation_Add = 0x00000001, + WGPUBlendOperation_Subtract = 0x00000002, + WGPUBlendOperation_ReverseSubtract = 0x00000003, + WGPUBlendOperation_Min = 0x00000004, + WGPUBlendOperation_Max = 0x00000005, + 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_InstanceDropped = 0x00000001, + WGPUBufferMapAsyncStatus_ValidationError = 0x00000002, + WGPUBufferMapAsyncStatus_Unknown = 0x00000003, + WGPUBufferMapAsyncStatus_DeviceLost = 0x00000004, + WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 0x00000005, + WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 0x00000006, + WGPUBufferMapAsyncStatus_MappingAlreadyPending = 0x00000007, + WGPUBufferMapAsyncStatus_OffsetOutOfRange = 0x00000008, + WGPUBufferMapAsyncStatus_SizeOutOfRange = 0x00000009, + WGPUBufferMapAsyncStatus_Force32 = 0x7FFFFFFF +} WGPUBufferMapAsyncStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBufferMapState { + WGPUBufferMapState_Unmapped = 0x00000001, + WGPUBufferMapState_Pending = 0x00000002, + WGPUBufferMapState_Mapped = 0x00000003, + WGPUBufferMapState_Force32 = 0x7FFFFFFF +} WGPUBufferMapState WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCallbackMode { + WGPUCallbackMode_WaitAnyOnly = 0x00000000, + WGPUCallbackMode_AllowProcessEvents = 0x00000001, + WGPUCallbackMode_AllowSpontaneous = 0x00000002, + WGPUCallbackMode_Force32 = 0x7FFFFFFF +} WGPUCallbackMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompareFunction { + WGPUCompareFunction_Undefined = 0x00000000, + WGPUCompareFunction_Never = 0x00000001, + WGPUCompareFunction_Less = 0x00000002, + WGPUCompareFunction_Equal = 0x00000003, + WGPUCompareFunction_LessEqual = 0x00000004, + WGPUCompareFunction_Greater = 0x00000005, + WGPUCompareFunction_NotEqual = 0x00000006, + WGPUCompareFunction_GreaterEqual = 0x00000007, + WGPUCompareFunction_Always = 0x00000008, + WGPUCompareFunction_Force32 = 0x7FFFFFFF +} WGPUCompareFunction WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompilationInfoRequestStatus { + WGPUCompilationInfoRequestStatus_Success = 0x00000000, + WGPUCompilationInfoRequestStatus_InstanceDropped = 0x00000001, + WGPUCompilationInfoRequestStatus_Error = 0x00000002, + WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000003, + WGPUCompilationInfoRequestStatus_Unknown = 0x00000004, + WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF +} WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompilationMessageType { + WGPUCompilationMessageType_Error = 0x00000001, + WGPUCompilationMessageType_Warning = 0x00000002, + WGPUCompilationMessageType_Info = 0x00000003, + WGPUCompilationMessageType_Force32 = 0x7FFFFFFF +} WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCreatePipelineAsyncStatus { + WGPUCreatePipelineAsyncStatus_Success = 0x00000000, + WGPUCreatePipelineAsyncStatus_InstanceDropped = 0x00000001, + WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000002, + WGPUCreatePipelineAsyncStatus_InternalError = 0x00000003, + WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000004, + WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000005, + WGPUCreatePipelineAsyncStatus_Unknown = 0x00000006, + WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF +} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCullMode { + WGPUCullMode_Undefined = 0x00000000, + WGPUCullMode_None = 0x00000001, + WGPUCullMode_Front = 0x00000002, + WGPUCullMode_Back = 0x00000003, + 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 = 0x00000001, + WGPUErrorFilter_OutOfMemory = 0x00000002, + WGPUErrorFilter_Internal = 0x00000003, + 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 WGPUExternalTextureRotation { + WGPUExternalTextureRotation_Rotate0Degrees = 0x00000000, + WGPUExternalTextureRotation_Rotate90Degrees = 0x00000001, + WGPUExternalTextureRotation_Rotate180Degrees = 0x00000002, + WGPUExternalTextureRotation_Rotate270Degrees = 0x00000003, + WGPUExternalTextureRotation_Force32 = 0x7FFFFFFF +} WGPUExternalTextureRotation 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_DawnInternalUsages = 0x000003EA, + WGPUFeatureName_DawnMultiPlanarFormats = 0x000003EB, + WGPUFeatureName_DawnNative = 0x000003EC, + WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, + WGPUFeatureName_ImplicitDeviceSynchronization = 0x000003EF, + WGPUFeatureName_SurfaceCapabilities = 0x000003F0, + WGPUFeatureName_TransientAttachments = 0x000003F1, + WGPUFeatureName_MSAARenderToSingleSampled = 0x000003F2, + WGPUFeatureName_DualSourceBlending = 0x000003F3, + WGPUFeatureName_D3D11MultithreadProtected = 0x000003F4, + WGPUFeatureName_ANGLETextureSharing = 0x000003F5, + WGPUFeatureName_ChromiumExperimentalSubgroups = 0x000003F6, + WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, + WGPUFeatureName_PixelLocalStorageCoherent = 0x000003F9, + WGPUFeatureName_PixelLocalStorageNonCoherent = 0x000003FA, + WGPUFeatureName_Unorm16TextureFormats = 0x000003FB, + WGPUFeatureName_Snorm16TextureFormats = 0x000003FC, + WGPUFeatureName_MultiPlanarFormatExtendedUsages = 0x000003FD, + WGPUFeatureName_MultiPlanarFormatP010 = 0x000003FE, + WGPUFeatureName_HostMappedPointer = 0x000003FF, + WGPUFeatureName_MultiPlanarRenderTargets = 0x00000400, + WGPUFeatureName_MultiPlanarFormatNv12a = 0x00000401, + WGPUFeatureName_FramebufferFetch = 0x00000402, + WGPUFeatureName_BufferMapExtendedUsages = 0x00000403, + WGPUFeatureName_AdapterPropertiesMemoryHeaps = 0x00000404, + WGPUFeatureName_AdapterPropertiesD3D = 0x00000405, + WGPUFeatureName_AdapterPropertiesVk = 0x00000406, + WGPUFeatureName_R8UnormStorage = 0x00000407, + WGPUFeatureName_FormatCapabilities = 0x00000408, + WGPUFeatureName_DrmFormatCapabilities = 0x00000409, + WGPUFeatureName_Norm16TextureFormats = 0x0000040A, + WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, + WGPUFeatureName_SharedTextureMemoryAHardwareBuffer = 0x0000044D, + WGPUFeatureName_SharedTextureMemoryDmaBuf = 0x0000044E, + WGPUFeatureName_SharedTextureMemoryOpaqueFD = 0x0000044F, + WGPUFeatureName_SharedTextureMemoryZirconHandle = 0x00000450, + WGPUFeatureName_SharedTextureMemoryDXGISharedHandle = 0x00000451, + WGPUFeatureName_SharedTextureMemoryD3D11Texture2D = 0x00000452, + WGPUFeatureName_SharedTextureMemoryIOSurface = 0x00000453, + WGPUFeatureName_SharedTextureMemoryEGLImage = 0x00000454, + WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, + WGPUFeatureName_SharedFenceVkSemaphoreSyncFD = 0x000004B1, + WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle = 0x000004B2, + WGPUFeatureName_SharedFenceDXGISharedHandle = 0x000004B3, + WGPUFeatureName_SharedFenceMTLSharedEvent = 0x000004B4, + WGPUFeatureName_SharedBufferMemoryD3D12Resource = 0x000004B5, + WGPUFeatureName_StaticSamplers = 0x000004B6, + WGPUFeatureName_Force32 = 0x7FFFFFFF +} WGPUFeatureName WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUFilterMode { + WGPUFilterMode_Undefined = 0x00000000, + WGPUFilterMode_Nearest = 0x00000001, + WGPUFilterMode_Linear = 0x00000002, + WGPUFilterMode_Force32 = 0x7FFFFFFF +} WGPUFilterMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUFrontFace { + WGPUFrontFace_Undefined = 0x00000000, + WGPUFrontFace_CCW = 0x00000001, + WGPUFrontFace_CW = 0x00000002, + 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 WGPULoggingType { + WGPULoggingType_Verbose = 0x00000001, + WGPULoggingType_Info = 0x00000002, + WGPULoggingType_Warning = 0x00000003, + WGPULoggingType_Error = 0x00000004, + WGPULoggingType_Force32 = 0x7FFFFFFF +} WGPULoggingType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUMipmapFilterMode { + WGPUMipmapFilterMode_Undefined = 0x00000000, + WGPUMipmapFilterMode_Nearest = 0x00000001, + WGPUMipmapFilterMode_Linear = 0x00000002, + WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF +} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPopErrorScopeStatus { + WGPUPopErrorScopeStatus_Success = 0x00000000, + WGPUPopErrorScopeStatus_InstanceDropped = 0x00000001, + WGPUPopErrorScopeStatus_Force32 = 0x7FFFFFFF +} WGPUPopErrorScopeStatus 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 = 0x00000001, + WGPUPresentMode_Immediate = 0x00000003, + WGPUPresentMode_Mailbox = 0x00000004, + WGPUPresentMode_Force32 = 0x7FFFFFFF +} WGPUPresentMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPrimitiveTopology { + WGPUPrimitiveTopology_Undefined = 0x00000000, + WGPUPrimitiveTopology_PointList = 0x00000001, + WGPUPrimitiveTopology_LineList = 0x00000002, + WGPUPrimitiveTopology_LineStrip = 0x00000003, + WGPUPrimitiveTopology_TriangleList = 0x00000004, + WGPUPrimitiveTopology_TriangleStrip = 0x00000005, + WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF +} WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUQueryType { + WGPUQueryType_Occlusion = 0x00000001, + WGPUQueryType_Timestamp = 0x00000002, + WGPUQueryType_Force32 = 0x7FFFFFFF +} WGPUQueryType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUQueueWorkDoneStatus { + WGPUQueueWorkDoneStatus_Success = 0x00000000, + WGPUQueueWorkDoneStatus_InstanceDropped = 0x00000001, + WGPUQueueWorkDoneStatus_Error = 0x00000002, + WGPUQueueWorkDoneStatus_Unknown = 0x00000003, + WGPUQueueWorkDoneStatus_DeviceLost = 0x00000004, + WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF +} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPURequestAdapterStatus { + WGPURequestAdapterStatus_Success = 0x00000000, + WGPURequestAdapterStatus_InstanceDropped = 0x00000001, + WGPURequestAdapterStatus_Unavailable = 0x00000002, + WGPURequestAdapterStatus_Error = 0x00000003, + WGPURequestAdapterStatus_Unknown = 0x00000004, + WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF +} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPURequestDeviceStatus { + WGPURequestDeviceStatus_Success = 0x00000000, + WGPURequestDeviceStatus_InstanceDropped = 0x00000001, + WGPURequestDeviceStatus_Error = 0x00000002, + WGPURequestDeviceStatus_Unknown = 0x00000003, + 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_SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, + WGPUSType_ExternalTextureBindingEntry = 0x0000000C, + WGPUSType_ExternalTextureBindingLayout = 0x0000000D, + WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, + WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, + WGPUSType_DepthStencilStateDepthWriteDefinedDawn = 0x00000010, + WGPUSType_TextureBindingViewDimensionDescriptor = 0x00000011, + WGPUSType_DawnTextureInternalUsageDescriptor = 0x000003E8, + WGPUSType_DawnEncoderInternalUsageDescriptor = 0x000003EB, + WGPUSType_DawnInstanceDescriptor = 0x000003EC, + WGPUSType_DawnCacheDeviceDescriptor = 0x000003ED, + WGPUSType_DawnAdapterPropertiesPowerPreference = 0x000003EE, + WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, + WGPUSType_DawnTogglesDescriptor = 0x000003F0, + WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, + WGPUSType_RequestAdapterOptionsLUID = 0x000003F2, + WGPUSType_RequestAdapterOptionsGetGLProc = 0x000003F3, + WGPUSType_RequestAdapterOptionsD3D11Device = 0x000003F4, + WGPUSType_DawnMultisampleStateRenderToSingleSampled = 0x000003F5, + WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, + WGPUSType_RenderPassPixelLocalStorage = 0x000003F7, + WGPUSType_PipelineLayoutPixelLocalStorage = 0x000003F8, + WGPUSType_BufferHostMappedPointer = 0x000003F9, + WGPUSType_DawnExperimentalSubgroupLimits = 0x000003FA, + WGPUSType_AdapterPropertiesMemoryHeaps = 0x000003FB, + WGPUSType_AdapterPropertiesD3D = 0x000003FC, + WGPUSType_AdapterPropertiesVk = 0x000003FD, + WGPUSType_DawnComputePipelineFullSubgroups = 0x000003FE, + WGPUSType_DawnWireWGSLControl = 0x000003FF, + WGPUSType_DawnWGSLBlocklist = 0x00000400, + WGPUSType_DrmFormatCapabilities = 0x00000401, + WGPUSType_SharedTextureMemoryVkImageDescriptor = 0x0000044C, + WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, + WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, + WGPUSType_SharedTextureMemoryDmaBufDescriptor = 0x0000044F, + WGPUSType_SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, + WGPUSType_SharedTextureMemoryZirconHandleDescriptor = 0x00000451, + WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, + WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, + WGPUSType_SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, + WGPUSType_SharedTextureMemoryEGLImageDescriptor = 0x00000455, + WGPUSType_SharedTextureMemoryInitializedBeginState = 0x000004B0, + WGPUSType_SharedTextureMemoryInitializedEndState = 0x000004B1, + WGPUSType_SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, + WGPUSType_SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, + WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, + WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, + WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, + WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, + WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, + WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, + WGPUSType_SharedFenceDXGISharedHandleDescriptor = 0x000004BA, + WGPUSType_SharedFenceDXGISharedHandleExportInfo = 0x000004BB, + WGPUSType_SharedFenceMTLSharedEventDescriptor = 0x000004BC, + WGPUSType_SharedFenceMTLSharedEventExportInfo = 0x000004BD, + WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, + WGPUSType_StaticSamplerBindingLayout = 0x000004BF, + 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 WGPUSharedFenceType { + WGPUSharedFenceType_Undefined = 0x00000000, + WGPUSharedFenceType_VkSemaphoreOpaqueFD = 0x00000001, + WGPUSharedFenceType_VkSemaphoreSyncFD = 0x00000002, + WGPUSharedFenceType_VkSemaphoreZirconHandle = 0x00000003, + WGPUSharedFenceType_DXGISharedHandle = 0x00000004, + WGPUSharedFenceType_MTLSharedEvent = 0x00000005, + WGPUSharedFenceType_Force32 = 0x7FFFFFFF +} WGPUSharedFenceType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUStencilOperation { + WGPUStencilOperation_Undefined = 0x00000000, + WGPUStencilOperation_Keep = 0x00000001, + WGPUStencilOperation_Zero = 0x00000002, + WGPUStencilOperation_Replace = 0x00000003, + WGPUStencilOperation_Invert = 0x00000004, + WGPUStencilOperation_IncrementClamp = 0x00000005, + WGPUStencilOperation_DecrementClamp = 0x00000006, + WGPUStencilOperation_IncrementWrap = 0x00000007, + WGPUStencilOperation_DecrementWrap = 0x00000008, + 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 WGPUTextureAspect { + WGPUTextureAspect_Undefined = 0x00000000, + WGPUTextureAspect_All = 0x00000001, + WGPUTextureAspect_StencilOnly = 0x00000002, + WGPUTextureAspect_DepthOnly = 0x00000003, + WGPUTextureAspect_Plane0Only = 0x00000004, + WGPUTextureAspect_Plane1Only = 0x00000005, + WGPUTextureAspect_Plane2Only = 0x00000006, + WGPUTextureAspect_Force32 = 0x7FFFFFFF +} WGPUTextureAspect WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTextureDimension { + WGPUTextureDimension_Undefined = 0x00000000, + WGPUTextureDimension_1D = 0x00000001, + WGPUTextureDimension_2D = 0x00000002, + WGPUTextureDimension_3D = 0x00000003, + 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_R16Unorm = 0x00000060, + WGPUTextureFormat_RG16Unorm = 0x00000061, + WGPUTextureFormat_RGBA16Unorm = 0x00000062, + WGPUTextureFormat_R16Snorm = 0x00000063, + WGPUTextureFormat_RG16Snorm = 0x00000064, + WGPUTextureFormat_RGBA16Snorm = 0x00000065, + WGPUTextureFormat_R8BG8Biplanar420Unorm = 0x00000066, + WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm = 0x00000067, + WGPUTextureFormat_R8BG8A8Triplanar420Unorm = 0x00000068, + 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_Unorm10_10_10_2 = 0x0000001F, + WGPUVertexFormat_Force32 = 0x7FFFFFFF +} WGPUVertexFormat WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUVertexStepMode { + WGPUVertexStepMode_Undefined = 0x00000000, + WGPUVertexStepMode_VertexBufferNotUsed = 0x00000001, + WGPUVertexStepMode_Vertex = 0x00000002, + WGPUVertexStepMode_Instance = 0x00000003, + WGPUVertexStepMode_Force32 = 0x7FFFFFFF +} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUWaitStatus { + WGPUWaitStatus_Success = 0x00000000, + WGPUWaitStatus_TimedOut = 0x00000001, + WGPUWaitStatus_UnsupportedTimeout = 0x00000002, + WGPUWaitStatus_UnsupportedCount = 0x00000003, + WGPUWaitStatus_UnsupportedMixedSources = 0x00000004, + WGPUWaitStatus_Unknown = 0x00000005, + WGPUWaitStatus_Force32 = 0x7FFFFFFF +} WGPUWaitStatus 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 WGPUHeapProperty { + WGPUHeapProperty_Undefined = 0x00000000, + WGPUHeapProperty_DeviceLocal = 0x00000001, + WGPUHeapProperty_HostVisible = 0x00000002, + WGPUHeapProperty_HostCoherent = 0x00000004, + WGPUHeapProperty_HostUncached = 0x00000008, + WGPUHeapProperty_HostCached = 0x00000010, + WGPUHeapProperty_Force32 = 0x7FFFFFFF +} WGPUHeapProperty WGPU_ENUM_ATTRIBUTE; +typedef WGPUFlags WGPUHeapPropertyFlags 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_TransientAttachment = 0x00000020, + WGPUTextureUsage_StorageAttachment = 0x00000040, + 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 (*WGPUCallback)(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 size_t (*WGPUDawnLoadCacheDataFunction)(void const * key, size_t keySize, void * value, size_t valueSize, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUDawnStoreCacheDataFunction)(void const * key, size_t keySize, void const * value, size_t valueSize, 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 (*WGPULoggingCallback)(WGPULoggingType type, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUPopErrorScopeCallback)(WGPUPopErrorScopeStatus status, 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; + WGPUBool compatibilityMode; +} WGPUAdapterProperties WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUAdapterProperties +typedef struct WGPUAdapterPropertiesD3D { + WGPUChainedStructOut chain; + uint32_t shaderModel; +} WGPUAdapterPropertiesD3D WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUAdapterProperties +typedef struct WGPUAdapterPropertiesVk { + WGPUChainedStructOut chain; + uint32_t driverVersion; +} WGPUAdapterPropertiesVk 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; + +// Can be chained in WGPUBufferDescriptor +typedef struct WGPUBufferHostMappedPointer { + WGPUChainedStruct chain; + void * pointer; + WGPUCallback disposeCallback; + void * userdata; +} WGPUBufferHostMappedPointer WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUBufferMapCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPUBufferMapCallback callback; + void * userdata; +} WGPUBufferMapCallbackInfo 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 WGPUCompilationInfoCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPUCompilationInfoCallback callback; + void * userdata; +} WGPUCompilationInfoCallbackInfo 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 WGPUCopyTextureForBrowserOptions { + WGPUChainedStruct const * nextInChain; + WGPUBool flipY; + WGPUBool needsColorSpaceConversion; + WGPUAlphaMode srcAlphaMode; + WGPU_NULLABLE float const * srcTransferFunctionParameters; + WGPU_NULLABLE float const * conversionMatrix; + WGPU_NULLABLE float const * dstTransferFunctionParameters; + WGPUAlphaMode dstAlphaMode; + WGPUBool internalUsage; +} WGPUCopyTextureForBrowserOptions WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUCreateComputePipelineAsyncCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPUCreateComputePipelineAsyncCallback callback; + void * userdata; +} WGPUCreateComputePipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUCreateRenderPipelineAsyncCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPUCreateRenderPipelineAsyncCallback callback; + void * userdata; +} WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUInstanceDescriptor +typedef struct WGPUDawnWGSLBlocklist { + WGPUChainedStruct chain; + size_t blocklistedFeatureCount; + const char* const * blocklistedFeatures; +} WGPUDawnWGSLBlocklist WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUAdapterProperties +typedef struct WGPUDawnAdapterPropertiesPowerPreference { + WGPUChainedStructOut chain; + WGPUPowerPreference powerPreference; +} WGPUDawnAdapterPropertiesPowerPreference WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUBufferDescriptor +typedef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient { + WGPUChainedStruct chain; + WGPUBool outOfMemory; +} WGPUDawnBufferDescriptorErrorInfoFromWireClient WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnCacheDeviceDescriptor { + WGPUChainedStruct chain; + char const * isolationKey; + WGPUDawnLoadCacheDataFunction loadDataFunction; + WGPUDawnStoreCacheDataFunction storeDataFunction; + void * functionUserdata; +} WGPUDawnCacheDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUComputePipelineDescriptor +typedef struct WGPUDawnComputePipelineFullSubgroups { + WGPUChainedStruct chain; + WGPUBool requiresFullSubgroups; +} WGPUDawnComputePipelineFullSubgroups WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUCommandEncoderDescriptor +typedef struct WGPUDawnEncoderInternalUsageDescriptor { + WGPUChainedStruct chain; + WGPUBool useInternalUsages; +} WGPUDawnEncoderInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSupportedLimits +typedef struct WGPUDawnExperimentalSubgroupLimits { + WGPUChainedStructOut chain; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; +} WGPUDawnExperimentalSubgroupLimits WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUMultisampleState +typedef struct WGPUDawnMultisampleStateRenderToSingleSampled { + WGPUChainedStruct chain; + WGPUBool enabled; +} WGPUDawnMultisampleStateRenderToSingleSampled WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPURenderPassColorAttachment +typedef struct WGPUDawnRenderPassColorAttachmentRenderToSingleSampled { + WGPUChainedStruct chain; + uint32_t implicitSampleCount; +} WGPUDawnRenderPassColorAttachmentRenderToSingleSampled WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUShaderModuleDescriptor +typedef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor { + WGPUChainedStruct chain; + WGPUBool allowNonUniformDerivatives; +} WGPUDawnShaderModuleSPIRVOptionsDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUTextureDescriptor +typedef struct WGPUDawnTextureInternalUsageDescriptor { + WGPUChainedStruct chain; + WGPUTextureUsageFlags internalUsage; +} WGPUDawnTextureInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUInstanceDescriptor +// Can be chained in WGPURequestAdapterOptions +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnTogglesDescriptor { + WGPUChainedStruct chain; + size_t enabledToggleCount; + const char* const * enabledToggles; + size_t disabledToggleCount; + const char* const * disabledToggles; +} WGPUDawnTogglesDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUInstanceDescriptor +typedef struct WGPUDawnWireWGSLControl { + WGPUChainedStruct chain; + WGPUBool enableExperimental; + WGPUBool enableUnsafe; + WGPUBool enableTesting; +} WGPUDawnWireWGSLControl WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUDepthStencilState +typedef struct WGPUDepthStencilStateDepthWriteDefinedDawn { + WGPUChainedStruct chain; + WGPUBool depthWriteDefined; +} WGPUDepthStencilStateDepthWriteDefinedDawn WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUDrmFormatProperties { + uint64_t modifier; + uint32_t modifierPlaneCount; +} WGPUDrmFormatProperties WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUExtent2D { + uint32_t width; + uint32_t height; +} WGPUExtent2D WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUExtent3D { + uint32_t width; + uint32_t height; + uint32_t depthOrArrayLayers; +} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUBindGroupEntry +typedef struct WGPUExternalTextureBindingEntry { + WGPUChainedStruct chain; + WGPUExternalTexture externalTexture; +} WGPUExternalTextureBindingEntry WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUBindGroupLayoutEntry +typedef struct WGPUExternalTextureBindingLayout { + WGPUChainedStruct chain; +} WGPUExternalTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUFormatCapabilities { + WGPUChainedStructOut * nextInChain; +} WGPUFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUFuture { + uint64_t id; +} WGPUFuture WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUInstanceFeatures { + WGPUChainedStruct const * nextInChain; + WGPUBool timedWaitAnyEnable; + size_t timedWaitAnyMaxCount; +} WGPUInstanceFeatures 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 WGPUMemoryHeapInfo { + WGPUHeapPropertyFlags properties; + uint64_t size; +} WGPUMemoryHeapInfo WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUMultisampleState { + WGPUChainedStruct const * nextInChain; + uint32_t count; + uint32_t mask; + WGPUBool alphaToCoverageEnabled; +} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUOrigin2D { + uint32_t x; + uint32_t y; +} WGPUOrigin2D 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; + +typedef struct WGPUPipelineLayoutStorageAttachment { + WGPUChainedStruct const * nextInChain; + uint64_t offset; + WGPUTextureFormat format; +} WGPUPipelineLayoutStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUPopErrorScopeCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPUPopErrorScopeCallback callback; + WGPUErrorCallback oldCallback; + void * userdata; +} WGPUPopErrorScopeCallbackInfo 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 WGPUQueueWorkDoneCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPUQueueWorkDoneCallback callback; + void * userdata; +} WGPUQueueWorkDoneCallbackInfo 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 WGPURequestAdapterCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPURequestAdapterCallback callback; + void * userdata; +} WGPURequestAdapterCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPURequestAdapterOptions { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE WGPUSurface compatibleSurface; + WGPUPowerPreference powerPreference; + WGPUBackendType backendType; + WGPUBool forceFallbackAdapter; + WGPUBool compatibilityMode; +} WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPURequestDeviceCallbackInfo { + WGPUChainedStruct const * nextInChain; + WGPUCallbackMode mode; + WGPURequestDeviceCallback callback; + void * userdata; +} WGPURequestDeviceCallbackInfo 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; + +// 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 WGPUShaderModuleDescriptor { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE char const * label; +} WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedBufferMemoryBeginAccessDescriptor { + WGPUChainedStruct const * nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + uint64_t const * signaledValues; +} WGPUSharedBufferMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedBufferMemoryDescriptor { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE char const * label; +} WGPUSharedBufferMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedBufferMemoryEndAccessState { + WGPUChainedStructOut * nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + uint64_t const * signaledValues; +} WGPUSharedBufferMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedBufferMemoryProperties { + WGPUChainedStructOut * nextInChain; + WGPUBufferUsageFlags usage; + uint64_t size; +} WGPUSharedBufferMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceDXGISharedHandleDescriptor { + WGPUChainedStruct chain; + void * handle; +} WGPUSharedFenceDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceDXGISharedHandleExportInfo { + WGPUChainedStructOut chain; + void * handle; +} WGPUSharedFenceDXGISharedHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceMTLSharedEventDescriptor { + WGPUChainedStruct chain; + void * sharedEvent; +} WGPUSharedFenceMTLSharedEventDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceMTLSharedEventExportInfo { + WGPUChainedStructOut chain; + void * sharedEvent; +} WGPUSharedFenceMTLSharedEventExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedFenceDescriptor { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE char const * label; +} WGPUSharedFenceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedFenceExportInfo { + WGPUChainedStructOut * nextInChain; + WGPUSharedFenceType type; +} WGPUSharedFenceExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor { + WGPUChainedStruct chain; + int handle; +} WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo { + WGPUChainedStructOut chain; + int handle; +} WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceVkSemaphoreSyncFDDescriptor { + WGPUChainedStruct chain; + int handle; +} WGPUSharedFenceVkSemaphoreSyncFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceVkSemaphoreSyncFDExportInfo { + WGPUChainedStructOut chain; + int handle; +} WGPUSharedFenceVkSemaphoreSyncFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor { + WGPUChainedStruct chain; + uint32_t handle; +} WGPUSharedFenceVkSemaphoreZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo { + WGPUChainedStructOut chain; + uint32_t handle; +} WGPUSharedFenceVkSemaphoreZirconHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor { + WGPUChainedStruct chain; + void * handle; + WGPUBool useKeyedMutex; +} WGPUSharedTextureMemoryDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryEGLImageDescriptor { + WGPUChainedStruct chain; + void * image; +} WGPUSharedTextureMemoryEGLImageDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryIOSurfaceDescriptor { + WGPUChainedStruct chain; + void * ioSurface; +} WGPUSharedTextureMemoryIOSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor { + WGPUChainedStruct chain; + void * handle; +} WGPUSharedTextureMemoryAHardwareBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedTextureMemoryBeginAccessDescriptor { + WGPUChainedStruct const * nextInChain; + WGPUBool concurrentRead; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + uint64_t const * signaledValues; +} WGPUSharedTextureMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedTextureMemoryDescriptor { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE char const * label; +} WGPUSharedTextureMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedTextureMemoryDmaBufPlane { + int fd; + uint64_t offset; + uint32_t stride; +} WGPUSharedTextureMemoryDmaBufPlane WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedTextureMemoryEndAccessState { + WGPUChainedStructOut * nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + uint64_t const * signaledValues; +} WGPUSharedTextureMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryOpaqueFDDescriptor { + WGPUChainedStruct chain; + void const * vkImageCreateInfo; + int memoryFD; + uint32_t memoryTypeIndex; + uint64_t allocationSize; + WGPUBool dedicatedAllocation; +} WGPUSharedTextureMemoryOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor { + WGPUChainedStruct chain; + WGPUBool dedicatedAllocation; +} WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryBeginAccessDescriptor +typedef struct WGPUSharedTextureMemoryVkImageLayoutBeginState { + WGPUChainedStruct chain; + int32_t oldLayout; + int32_t newLayout; +} WGPUSharedTextureMemoryVkImageLayoutBeginState WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryEndAccessState +typedef struct WGPUSharedTextureMemoryVkImageLayoutEndState { + WGPUChainedStructOut chain; + int32_t oldLayout; + int32_t newLayout; +} WGPUSharedTextureMemoryVkImageLayoutEndState WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryZirconHandleDescriptor { + WGPUChainedStruct chain; + uint32_t memoryFD; + uint64_t allocationSize; +} WGPUSharedTextureMemoryZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUBindGroupLayoutEntry +typedef struct WGPUStaticSamplerBindingLayout { + WGPUChainedStruct chain; + WGPUSampler sampler; +} WGPUStaticSamplerBindingLayout 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 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 WGPUSurfaceDescriptorFromWindowsCoreWindow { + WGPUChainedStruct chain; + void * coreWindow; +} WGPUSurfaceDescriptorFromWindowsCoreWindow WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceDescriptorFromWindowsSwapChainPanel { + WGPUChainedStruct chain; + void * swapChainPanel; +} WGPUSurfaceDescriptorFromWindowsSwapChainPanel WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceDescriptorFromXlibWindow { + WGPUChainedStruct chain; + void * display; + uint64_t window; +} WGPUSurfaceDescriptorFromXlibWindow WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSwapChainDescriptor { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE char const * label; + WGPUTextureUsageFlags usage; + WGPUTextureFormat format; + uint32_t width; + uint32_t height; + WGPUPresentMode presentMode; +} WGPUSwapChainDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUTextureBindingLayout { + WGPUChainedStruct const * nextInChain; + WGPUTextureSampleType sampleType; + WGPUTextureViewDimension viewDimension; + WGPUBool multisampled; +} WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUTextureDescriptor +typedef struct WGPUTextureBindingViewDimensionDescriptor { + WGPUChainedStruct chain; + WGPUTextureViewDimension textureBindingViewDimension; +} WGPUTextureBindingViewDimensionDescriptor 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; + +// Can be chained in WGPUAdapterProperties +typedef struct WGPUAdapterPropertiesMemoryHeaps { + WGPUChainedStructOut chain; + size_t heapCount; + WGPUMemoryHeapInfo const * heapInfo; +} WGPUAdapterPropertiesMemoryHeaps 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; + +// Can be chained in WGPUFormatCapabilities +typedef struct WGPUDrmFormatCapabilities { + WGPUChainedStructOut chain; + size_t propertiesCount; + WGPUDrmFormatProperties const * properties; +} WGPUDrmFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUExternalTextureDescriptor { + WGPUChainedStruct const * nextInChain; + WGPU_NULLABLE char const * label; + WGPUTextureView plane0; + WGPU_NULLABLE WGPUTextureView plane1; + WGPUOrigin2D visibleOrigin; + WGPUExtent2D visibleSize; + WGPUBool doYuvToRgbConversionOnly; + WGPU_NULLABLE float const * yuvToRgbConversionMatrix; + float const * srcTransferFunctionParameters; + float const * dstTransferFunctionParameters; + float const * gamutConversionMatrix; + WGPUBool flipY; + WGPUBool mirrored; + WGPUExternalTextureRotation rotation; +} WGPUExternalTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUFutureWaitInfo { + WGPUFuture future; + WGPUBool completed; +} WGPUFutureWaitInfo WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUImageCopyBuffer { + WGPUChainedStruct const * nextInChain; + WGPUTextureDataLayout layout; + WGPUBuffer buffer; +} WGPUImageCopyBuffer WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUImageCopyExternalTexture { + WGPUChainedStruct const * nextInChain; + WGPUExternalTexture externalTexture; + WGPUOrigin3D origin; + WGPUExtent2D naturalSize; +} WGPUImageCopyExternalTexture WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUImageCopyTexture { + WGPUChainedStruct const * nextInChain; + WGPUTexture texture; + uint32_t mipLevel; + WGPUOrigin3D origin; + WGPUTextureAspect aspect; +} WGPUImageCopyTexture WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUInstanceDescriptor { + WGPUChainedStruct const * nextInChain; + WGPUInstanceFeatures features; +} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUPipelineLayoutDescriptor +typedef struct WGPUPipelineLayoutPixelLocalStorage { + WGPUChainedStruct chain; + uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount; + WGPUPipelineLayoutStorageAttachment const * storageAttachments; +} WGPUPipelineLayoutPixelLocalStorage 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; + uint32_t depthSlice; + WGPU_NULLABLE WGPUTextureView resolveTarget; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; +} WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPURenderPassStorageAttachment { + WGPUChainedStruct const * nextInChain; + uint64_t offset; + WGPUTextureView storage; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; +} WGPURenderPassStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPURequiredLimits { + WGPUChainedStruct const * nextInChain; + WGPULimits limits; +} WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryDmaBufDescriptor { + WGPUChainedStruct chain; + WGPUExtent3D size; + uint32_t drmFormat; + uint64_t drmModifier; + size_t planeCount; + WGPUSharedTextureMemoryDmaBufPlane const * planes; +} WGPUSharedTextureMemoryDmaBufDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUSharedTextureMemoryProperties { + WGPUChainedStructOut * nextInChain; + WGPUTextureUsageFlags usage; + WGPUExtent3D size; + WGPUTextureFormat format; +} WGPUSharedTextureMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryVkImageDescriptor { + WGPUChainedStruct chain; + int32_t vkFormat; + int32_t vkUsageFlags; + WGPUExtent3D vkExtent3D; +} WGPUSharedTextureMemoryVkImageDescriptor 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; + +// Can be chained in WGPURenderPassDescriptor +typedef struct WGPURenderPassPixelLocalStorage { + WGPUChainedStruct chain; + uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount; + WGPURenderPassStorageAttachment const * storageAttachments; +} WGPURenderPassPixelLocalStorage 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 void (*WGPUProcAdapterPropertiesFreeMembers)(WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterPropertiesMemoryHeapsFreeMembers)(WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUInstance (*WGPUProcCreateInstance)(WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDrmFormatCapabilitiesFreeMembers)(WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcGetInstanceFeatures)(WGPUInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryEndAccessStateFreeMembers)(WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryEndAccessStateFreeMembers)(WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Adapter +typedef WGPUDevice (*WGPUProcAdapterCreateDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcAdapterGetFormatCapabilities)(WGPUAdapter adapter, WGPUTextureFormat format, WGPUFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUInstance (*WGPUProcAdapterGetInstance)(WGPUAdapter adapter) 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 WGPUFuture (*WGPUProcAdapterRequestDeviceF)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * options, WGPURequestDeviceCallbackInfo callbackInfo) 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 WGPUFuture (*WGPUProcBufferMapAsyncF)(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) 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 (*WGPUProcCommandEncoderInjectValidationError)(WGPUCommandEncoder commandEncoder, char const * message) 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 (*WGPUProcCommandEncoderWriteBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) 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 (*WGPUProcComputePassEncoderWriteTimestamp)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) 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 WGPUFuture (*WGPUProcDeviceCreateComputePipelineAsyncF)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBuffer (*WGPUProcDeviceCreateErrorBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUExternalTexture (*WGPUProcDeviceCreateErrorExternalTexture)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUShaderModule (*WGPUProcDeviceCreateErrorShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, char const * errorMessage) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcDeviceCreateErrorTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUExternalTexture (*WGPUProcDeviceCreateExternalTexture)(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) 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 WGPUFuture (*WGPUProcDeviceCreateRenderPipelineAsyncF)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) 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 WGPUSwapChain (*WGPUProcDeviceCreateSwapChain)(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor 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 void (*WGPUProcDeviceForceLoss)(WGPUDevice device, WGPUDeviceLostReason type, char const * message) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUAdapter (*WGPUProcDeviceGetAdapter)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureUsageFlags (*WGPUProcDeviceGetSupportedSurfaceUsage)(WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedBufferMemory (*WGPUProcDeviceImportSharedBufferMemory)(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedFence (*WGPUProcDeviceImportSharedFence)(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedTextureMemory (*WGPUProcDeviceImportSharedTextureMemory)(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceInjectError)(WGPUDevice device, WGPUErrorType type, char const * message) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback oldCallback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcDevicePopErrorScopeF)(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetDeviceLostCallback)(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetLoggingCallback)(WGPUDevice device, WGPULoggingCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceTick)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceValidateTextureDescriptor)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceReference)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of ExternalTexture +typedef void (*WGPUProcExternalTextureDestroy)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureExpire)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureRefresh)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureSetLabel)(WGPUExternalTexture externalTexture, char const * label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureReference)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureRelease)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Instance +typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef size_t (*WGPUProcInstanceEnumerateWGSLLanguageFeatures)(WGPUInstance instance, WGPUWGSLFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcInstanceHasWGSLLanguageFeature)(WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture (*WGPUProcInstanceRequestAdapterF)(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUWaitStatus (*WGPUProcInstanceWaitAny)(WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo * futures, uint64_t timeoutNS) 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 (*WGPUProcQueueCopyExternalTextureForBrowser)(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueCopyTextureForBrowser)(WGPUQueue queue, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcQueueOnSubmittedWorkDoneF)(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) 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 (*WGPUProcRenderPassEncoderPixelLocalStorageBarrier)(WGPURenderPassEncoder renderPassEncoder) 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 (*WGPUProcRenderPassEncoderWriteTimestamp)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) 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 WGPUFuture (*WGPUProcShaderModuleGetCompilationInfoF)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) 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 SharedBufferMemory +typedef WGPUBool (*WGPUProcSharedBufferMemoryBeginAccess)(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBuffer (*WGPUProcSharedBufferMemoryCreateBuffer)(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedBufferMemoryEndAccess)(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryGetProperties)(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedBufferMemoryIsDeviceLost)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemorySetLabel)(WGPUSharedBufferMemory sharedBufferMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryReference)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryRelease)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedFence +typedef void (*WGPUProcSharedFenceExportInfo)(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceReference)(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceRelease)(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedTextureMemory +typedef WGPUBool (*WGPUProcSharedTextureMemoryBeginAccess)(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcSharedTextureMemoryCreateTexture)(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedTextureMemoryEndAccess)(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryGetProperties)(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedTextureMemoryIsDeviceLost)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemorySetLabel)(WGPUSharedTextureMemory sharedTextureMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryReference)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryRelease)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Surface +typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SwapChain +typedef WGPUTexture (*WGPUProcSwapChainGetCurrentTexture)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureView (*WGPUProcSwapChainGetCurrentTextureView)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSwapChainPresent)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSwapChainReference)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSwapChainRelease)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Texture +typedef WGPUTextureView (*WGPUProcTextureCreateErrorView)(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +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 void wgpuAdapterPropertiesFreeMembers(WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterPropertiesMemoryHeapsFreeMembers(WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDrmFormatCapabilitiesFreeMembers(WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuGetInstanceFeatures(WGPUInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPU_NULLABLE WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryEndAccessStateFreeMembers(WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryEndAccessStateFreeMembers(WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Adapter +WGPU_EXPORT WGPUDevice wgpuAdapterCreateDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuAdapterGetFormatCapabilities(WGPUAdapter adapter, WGPUTextureFormat format, WGPUFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter) 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 WGPUFuture wgpuAdapterRequestDeviceF(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * options, WGPURequestDeviceCallbackInfo callbackInfo) 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 WGPUFuture wgpuBufferMapAsyncF(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) 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 wgpuCommandEncoderInjectValidationError(WGPUCommandEncoder commandEncoder, char const * message) 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 wgpuCommandEncoderWriteBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) 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 wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) 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 WGPUFuture wgpuDeviceCreateComputePipelineAsyncF(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateErrorShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, char const * errorMessage) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuDeviceCreateErrorTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) 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 WGPUFuture wgpuDeviceCreateRenderPipelineAsyncF(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) 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 WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor 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 void wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, char const * message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device) 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 WGPUTextureUsageFlags wgpuDeviceGetSupportedSurfaceUsage(WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedFence wgpuDeviceImportSharedFence(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, char const * message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback oldCallback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScopeF(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetDeviceLostCallback(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceTick(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceValidateTextureDescriptor(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of ExternalTexture +WGPU_EXPORT void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, char const * label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureReference(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Instance +WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT size_t wgpuInstanceEnumerateWGSLLanguageFeatures(WGPUInstance instance, WGPUWGSLFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuInstanceHasWGSLLanguageFeature(WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture wgpuInstanceRequestAdapterF(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUWaitStatus wgpuInstanceWaitAny(WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo * futures, uint64_t timeoutNS) 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 wgpuQueueCopyExternalTextureForBrowser(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueCopyTextureForBrowser(WGPUQueue queue, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuQueueOnSubmittedWorkDoneF(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) 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 wgpuRenderPassEncoderPixelLocalStorageBarrier(WGPURenderPassEncoder renderPassEncoder) 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 wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) 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 WGPUFuture wgpuShaderModuleGetCompilationInfoF(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) 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 SharedBufferMemory +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryBeginAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBuffer wgpuSharedBufferMemoryCreateBuffer(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryEndAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryGetProperties(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryIsDeviceLost(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryReference(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryRelease(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedFence +WGPU_EXPORT void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedFenceReference(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedFenceRelease(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedTextureMemory +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryBeginAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuSharedTextureMemoryCreateTexture(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryEndAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryGetProperties(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryIsDeviceLost(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryReference(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryRelease(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Surface +WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SwapChain +WGPU_EXPORT WGPUTexture wgpuSwapChainGetCurrentTexture(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSwapChainPresent(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSwapChainReference(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSwapChainRelease(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Texture +WGPU_EXPORT WGPUTextureView wgpuTextureCreateErrorView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +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/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h new file mode 100644 index 0000000000..96bbec4f44 --- /dev/null +++ b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h @@ -0,0 +1,29 @@ +#ifdef __EMSCRIPTEN__ +#error "Do not include this header. Emscripten already provides headers needed for WebGPU." +#endif +#ifndef WEBGPU_CPP_CHAINED_STRUCT_H_ +#define WEBGPU_CPP_CHAINED_STRUCT_H_ + +#include +#include + +// This header file declares the ChainedStruct structures separately from the WebGPU +// headers so that dependencies can directly extend structures without including the larger header +// which exposes capabilities that may require correctly set proc tables. +namespace wgpu { + + enum class SType : uint32_t; + + struct ChainedStruct { + ChainedStruct const * nextInChain = nullptr; + SType sType = SType(0u); + }; + + struct ChainedStructOut { + ChainedStructOut * nextInChain = nullptr; + SType sType = SType(0u); + }; + +} // namespace wgpu} + +#endif // WEBGPU_CPP_CHAINED_STRUCT_H_ diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h new file mode 100644 index 0000000000..8bf43fa1f9 --- /dev/null +++ b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h @@ -0,0 +1,2301 @@ + +#ifndef WEBGPU_CPP_PRINT_H_ +#define WEBGPU_CPP_PRINT_H_ + +#include "dawn/webgpu_cpp.h" + +#include +#include +#include +#include + +namespace wgpu { + + template + std::basic_ostream& operator<<(std::basic_ostream& o, WGSLFeatureName value) { + switch (value) { + case WGSLFeatureName::Undefined: + o << "WGSLFeatureName::Undefined"; + break; + case WGSLFeatureName::ReadonlyAndReadwriteStorageTextures: + o << "WGSLFeatureName::ReadonlyAndReadwriteStorageTextures"; + break; + case WGSLFeatureName::Packed4x8IntegerDotProduct: + o << "WGSLFeatureName::Packed4x8IntegerDotProduct"; + break; + case WGSLFeatureName::UnrestrictedPointerParameters: + o << "WGSLFeatureName::UnrestrictedPointerParameters"; + break; + case WGSLFeatureName::PointerCompositeAccess: + o << "WGSLFeatureName::PointerCompositeAccess"; + break; + case WGSLFeatureName::ChromiumTestingUnimplemented: + o << "WGSLFeatureName::ChromiumTestingUnimplemented"; + break; + case WGSLFeatureName::ChromiumTestingUnsafeExperimental: + o << "WGSLFeatureName::ChromiumTestingUnsafeExperimental"; + break; + case WGSLFeatureName::ChromiumTestingExperimental: + o << "WGSLFeatureName::ChromiumTestingExperimental"; + break; + case WGSLFeatureName::ChromiumTestingShippedWithKillswitch: + o << "WGSLFeatureName::ChromiumTestingShippedWithKillswitch"; + break; + case WGSLFeatureName::ChromiumTestingShipped: + o << "WGSLFeatureName::ChromiumTestingShipped"; + break; + default: + o << "WGSLFeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, AdapterType value) { + switch (value) { + case AdapterType::DiscreteGPU: + o << "AdapterType::DiscreteGPU"; + break; + case AdapterType::IntegratedGPU: + o << "AdapterType::IntegratedGPU"; + break; + case AdapterType::CPU: + o << "AdapterType::CPU"; + break; + case AdapterType::Unknown: + o << "AdapterType::Unknown"; + break; + default: + o << "AdapterType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, AddressMode value) { + switch (value) { + case AddressMode::Undefined: + o << "AddressMode::Undefined"; + break; + case AddressMode::ClampToEdge: + o << "AddressMode::ClampToEdge"; + break; + case AddressMode::Repeat: + o << "AddressMode::Repeat"; + break; + case AddressMode::MirrorRepeat: + o << "AddressMode::MirrorRepeat"; + break; + default: + o << "AddressMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, AlphaMode value) { + switch (value) { + case AlphaMode::Opaque: + o << "AlphaMode::Opaque"; + break; + case AlphaMode::Premultiplied: + o << "AlphaMode::Premultiplied"; + break; + case AlphaMode::Unpremultiplied: + o << "AlphaMode::Unpremultiplied"; + break; + default: + o << "AlphaMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, BackendType value) { + switch (value) { + case BackendType::Undefined: + o << "BackendType::Undefined"; + break; + case BackendType::Null: + o << "BackendType::Null"; + break; + case BackendType::WebGPU: + o << "BackendType::WebGPU"; + break; + case BackendType::D3D11: + o << "BackendType::D3D11"; + break; + case BackendType::D3D12: + o << "BackendType::D3D12"; + break; + case BackendType::Metal: + o << "BackendType::Metal"; + break; + case BackendType::Vulkan: + o << "BackendType::Vulkan"; + break; + case BackendType::OpenGL: + o << "BackendType::OpenGL"; + break; + case BackendType::OpenGLES: + o << "BackendType::OpenGLES"; + break; + default: + o << "BackendType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, BlendFactor value) { + switch (value) { + case BlendFactor::Undefined: + o << "BlendFactor::Undefined"; + break; + case BlendFactor::Zero: + o << "BlendFactor::Zero"; + break; + case BlendFactor::One: + o << "BlendFactor::One"; + break; + case BlendFactor::Src: + o << "BlendFactor::Src"; + break; + case BlendFactor::OneMinusSrc: + o << "BlendFactor::OneMinusSrc"; + break; + case BlendFactor::SrcAlpha: + o << "BlendFactor::SrcAlpha"; + break; + case BlendFactor::OneMinusSrcAlpha: + o << "BlendFactor::OneMinusSrcAlpha"; + break; + case BlendFactor::Dst: + o << "BlendFactor::Dst"; + break; + case BlendFactor::OneMinusDst: + o << "BlendFactor::OneMinusDst"; + break; + case BlendFactor::DstAlpha: + o << "BlendFactor::DstAlpha"; + break; + case BlendFactor::OneMinusDstAlpha: + o << "BlendFactor::OneMinusDstAlpha"; + break; + case BlendFactor::SrcAlphaSaturated: + o << "BlendFactor::SrcAlphaSaturated"; + break; + case BlendFactor::Constant: + o << "BlendFactor::Constant"; + break; + case BlendFactor::OneMinusConstant: + o << "BlendFactor::OneMinusConstant"; + break; + case BlendFactor::Src1: + o << "BlendFactor::Src1"; + break; + case BlendFactor::OneMinusSrc1: + o << "BlendFactor::OneMinusSrc1"; + break; + case BlendFactor::Src1Alpha: + o << "BlendFactor::Src1Alpha"; + break; + case BlendFactor::OneMinusSrc1Alpha: + o << "BlendFactor::OneMinusSrc1Alpha"; + break; + default: + o << "BlendFactor::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, BlendOperation value) { + switch (value) { + case BlendOperation::Undefined: + o << "BlendOperation::Undefined"; + break; + case BlendOperation::Add: + o << "BlendOperation::Add"; + break; + case BlendOperation::Subtract: + o << "BlendOperation::Subtract"; + break; + case BlendOperation::ReverseSubtract: + o << "BlendOperation::ReverseSubtract"; + break; + case BlendOperation::Min: + o << "BlendOperation::Min"; + break; + case BlendOperation::Max: + o << "BlendOperation::Max"; + break; + default: + o << "BlendOperation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, BufferBindingType value) { + switch (value) { + case BufferBindingType::Undefined: + o << "BufferBindingType::Undefined"; + break; + case BufferBindingType::Uniform: + o << "BufferBindingType::Uniform"; + break; + case BufferBindingType::Storage: + o << "BufferBindingType::Storage"; + break; + case BufferBindingType::ReadOnlyStorage: + o << "BufferBindingType::ReadOnlyStorage"; + break; + default: + o << "BufferBindingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, BufferMapAsyncStatus value) { + switch (value) { + case BufferMapAsyncStatus::Success: + o << "BufferMapAsyncStatus::Success"; + break; + case BufferMapAsyncStatus::InstanceDropped: + o << "BufferMapAsyncStatus::InstanceDropped"; + break; + case BufferMapAsyncStatus::ValidationError: + o << "BufferMapAsyncStatus::ValidationError"; + break; + case BufferMapAsyncStatus::Unknown: + o << "BufferMapAsyncStatus::Unknown"; + break; + case BufferMapAsyncStatus::DeviceLost: + o << "BufferMapAsyncStatus::DeviceLost"; + break; + case BufferMapAsyncStatus::DestroyedBeforeCallback: + o << "BufferMapAsyncStatus::DestroyedBeforeCallback"; + break; + case BufferMapAsyncStatus::UnmappedBeforeCallback: + o << "BufferMapAsyncStatus::UnmappedBeforeCallback"; + break; + case BufferMapAsyncStatus::MappingAlreadyPending: + o << "BufferMapAsyncStatus::MappingAlreadyPending"; + break; + case BufferMapAsyncStatus::OffsetOutOfRange: + o << "BufferMapAsyncStatus::OffsetOutOfRange"; + break; + case BufferMapAsyncStatus::SizeOutOfRange: + o << "BufferMapAsyncStatus::SizeOutOfRange"; + break; + default: + o << "BufferMapAsyncStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, BufferMapState value) { + switch (value) { + case BufferMapState::Unmapped: + o << "BufferMapState::Unmapped"; + break; + case BufferMapState::Pending: + o << "BufferMapState::Pending"; + break; + case BufferMapState::Mapped: + o << "BufferMapState::Mapped"; + break; + default: + o << "BufferMapState::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, CallbackMode value) { + switch (value) { + case CallbackMode::WaitAnyOnly: + o << "CallbackMode::WaitAnyOnly"; + break; + case CallbackMode::AllowProcessEvents: + o << "CallbackMode::AllowProcessEvents"; + break; + case CallbackMode::AllowSpontaneous: + o << "CallbackMode::AllowSpontaneous"; + break; + default: + o << "CallbackMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, CompareFunction value) { + switch (value) { + case CompareFunction::Undefined: + o << "CompareFunction::Undefined"; + break; + case CompareFunction::Never: + o << "CompareFunction::Never"; + break; + case CompareFunction::Less: + o << "CompareFunction::Less"; + break; + case CompareFunction::Equal: + o << "CompareFunction::Equal"; + break; + case CompareFunction::LessEqual: + o << "CompareFunction::LessEqual"; + break; + case CompareFunction::Greater: + o << "CompareFunction::Greater"; + break; + case CompareFunction::NotEqual: + o << "CompareFunction::NotEqual"; + break; + case CompareFunction::GreaterEqual: + o << "CompareFunction::GreaterEqual"; + break; + case CompareFunction::Always: + o << "CompareFunction::Always"; + break; + default: + o << "CompareFunction::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, CompilationInfoRequestStatus value) { + switch (value) { + case CompilationInfoRequestStatus::Success: + o << "CompilationInfoRequestStatus::Success"; + break; + case CompilationInfoRequestStatus::InstanceDropped: + o << "CompilationInfoRequestStatus::InstanceDropped"; + break; + case CompilationInfoRequestStatus::Error: + o << "CompilationInfoRequestStatus::Error"; + break; + case CompilationInfoRequestStatus::DeviceLost: + o << "CompilationInfoRequestStatus::DeviceLost"; + break; + case CompilationInfoRequestStatus::Unknown: + o << "CompilationInfoRequestStatus::Unknown"; + break; + default: + o << "CompilationInfoRequestStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, CompilationMessageType value) { + switch (value) { + case CompilationMessageType::Error: + o << "CompilationMessageType::Error"; + break; + case CompilationMessageType::Warning: + o << "CompilationMessageType::Warning"; + break; + case CompilationMessageType::Info: + o << "CompilationMessageType::Info"; + break; + default: + o << "CompilationMessageType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, CreatePipelineAsyncStatus value) { + switch (value) { + case CreatePipelineAsyncStatus::Success: + o << "CreatePipelineAsyncStatus::Success"; + break; + case CreatePipelineAsyncStatus::InstanceDropped: + o << "CreatePipelineAsyncStatus::InstanceDropped"; + break; + case CreatePipelineAsyncStatus::ValidationError: + o << "CreatePipelineAsyncStatus::ValidationError"; + break; + case CreatePipelineAsyncStatus::InternalError: + o << "CreatePipelineAsyncStatus::InternalError"; + break; + case CreatePipelineAsyncStatus::DeviceLost: + o << "CreatePipelineAsyncStatus::DeviceLost"; + break; + case CreatePipelineAsyncStatus::DeviceDestroyed: + o << "CreatePipelineAsyncStatus::DeviceDestroyed"; + break; + case CreatePipelineAsyncStatus::Unknown: + o << "CreatePipelineAsyncStatus::Unknown"; + break; + default: + o << "CreatePipelineAsyncStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, CullMode value) { + switch (value) { + case CullMode::Undefined: + o << "CullMode::Undefined"; + break; + case CullMode::None: + o << "CullMode::None"; + break; + case CullMode::Front: + o << "CullMode::Front"; + break; + case CullMode::Back: + o << "CullMode::Back"; + break; + default: + o << "CullMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, DeviceLostReason value) { + switch (value) { + case DeviceLostReason::Undefined: + o << "DeviceLostReason::Undefined"; + break; + case DeviceLostReason::Destroyed: + o << "DeviceLostReason::Destroyed"; + break; + default: + o << "DeviceLostReason::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, ErrorFilter value) { + switch (value) { + case ErrorFilter::Validation: + o << "ErrorFilter::Validation"; + break; + case ErrorFilter::OutOfMemory: + o << "ErrorFilter::OutOfMemory"; + break; + case ErrorFilter::Internal: + o << "ErrorFilter::Internal"; + break; + default: + o << "ErrorFilter::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, ErrorType value) { + switch (value) { + case ErrorType::NoError: + o << "ErrorType::NoError"; + break; + case ErrorType::Validation: + o << "ErrorType::Validation"; + break; + case ErrorType::OutOfMemory: + o << "ErrorType::OutOfMemory"; + break; + case ErrorType::Internal: + o << "ErrorType::Internal"; + break; + case ErrorType::Unknown: + o << "ErrorType::Unknown"; + break; + case ErrorType::DeviceLost: + o << "ErrorType::DeviceLost"; + break; + default: + o << "ErrorType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, ExternalTextureRotation value) { + switch (value) { + case ExternalTextureRotation::Rotate0Degrees: + o << "ExternalTextureRotation::Rotate0Degrees"; + break; + case ExternalTextureRotation::Rotate90Degrees: + o << "ExternalTextureRotation::Rotate90Degrees"; + break; + case ExternalTextureRotation::Rotate180Degrees: + o << "ExternalTextureRotation::Rotate180Degrees"; + break; + case ExternalTextureRotation::Rotate270Degrees: + o << "ExternalTextureRotation::Rotate270Degrees"; + break; + default: + o << "ExternalTextureRotation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, FeatureName value) { + switch (value) { + case FeatureName::Undefined: + o << "FeatureName::Undefined"; + break; + case FeatureName::DepthClipControl: + o << "FeatureName::DepthClipControl"; + break; + case FeatureName::Depth32FloatStencil8: + o << "FeatureName::Depth32FloatStencil8"; + break; + case FeatureName::TimestampQuery: + o << "FeatureName::TimestampQuery"; + break; + case FeatureName::TextureCompressionBC: + o << "FeatureName::TextureCompressionBC"; + break; + case FeatureName::TextureCompressionETC2: + o << "FeatureName::TextureCompressionETC2"; + break; + case FeatureName::TextureCompressionASTC: + o << "FeatureName::TextureCompressionASTC"; + break; + case FeatureName::IndirectFirstInstance: + o << "FeatureName::IndirectFirstInstance"; + break; + case FeatureName::ShaderF16: + o << "FeatureName::ShaderF16"; + break; + case FeatureName::RG11B10UfloatRenderable: + o << "FeatureName::RG11B10UfloatRenderable"; + break; + case FeatureName::BGRA8UnormStorage: + o << "FeatureName::BGRA8UnormStorage"; + break; + case FeatureName::Float32Filterable: + o << "FeatureName::Float32Filterable"; + break; + case FeatureName::DawnInternalUsages: + o << "FeatureName::DawnInternalUsages"; + break; + case FeatureName::DawnMultiPlanarFormats: + o << "FeatureName::DawnMultiPlanarFormats"; + break; + case FeatureName::DawnNative: + o << "FeatureName::DawnNative"; + break; + case FeatureName::ChromiumExperimentalTimestampQueryInsidePasses: + o << "FeatureName::ChromiumExperimentalTimestampQueryInsidePasses"; + break; + case FeatureName::ImplicitDeviceSynchronization: + o << "FeatureName::ImplicitDeviceSynchronization"; + break; + case FeatureName::SurfaceCapabilities: + o << "FeatureName::SurfaceCapabilities"; + break; + case FeatureName::TransientAttachments: + o << "FeatureName::TransientAttachments"; + break; + case FeatureName::MSAARenderToSingleSampled: + o << "FeatureName::MSAARenderToSingleSampled"; + break; + case FeatureName::DualSourceBlending: + o << "FeatureName::DualSourceBlending"; + break; + case FeatureName::D3D11MultithreadProtected: + o << "FeatureName::D3D11MultithreadProtected"; + break; + case FeatureName::ANGLETextureSharing: + o << "FeatureName::ANGLETextureSharing"; + break; + case FeatureName::ChromiumExperimentalSubgroups: + o << "FeatureName::ChromiumExperimentalSubgroups"; + break; + case FeatureName::ChromiumExperimentalSubgroupUniformControlFlow: + o << "FeatureName::ChromiumExperimentalSubgroupUniformControlFlow"; + break; + case FeatureName::PixelLocalStorageCoherent: + o << "FeatureName::PixelLocalStorageCoherent"; + break; + case FeatureName::PixelLocalStorageNonCoherent: + o << "FeatureName::PixelLocalStorageNonCoherent"; + break; + case FeatureName::Unorm16TextureFormats: + o << "FeatureName::Unorm16TextureFormats"; + break; + case FeatureName::Snorm16TextureFormats: + o << "FeatureName::Snorm16TextureFormats"; + break; + case FeatureName::MultiPlanarFormatExtendedUsages: + o << "FeatureName::MultiPlanarFormatExtendedUsages"; + break; + case FeatureName::MultiPlanarFormatP010: + o << "FeatureName::MultiPlanarFormatP010"; + break; + case FeatureName::HostMappedPointer: + o << "FeatureName::HostMappedPointer"; + break; + case FeatureName::MultiPlanarRenderTargets: + o << "FeatureName::MultiPlanarRenderTargets"; + break; + case FeatureName::MultiPlanarFormatNv12a: + o << "FeatureName::MultiPlanarFormatNv12a"; + break; + case FeatureName::FramebufferFetch: + o << "FeatureName::FramebufferFetch"; + break; + case FeatureName::BufferMapExtendedUsages: + o << "FeatureName::BufferMapExtendedUsages"; + break; + case FeatureName::AdapterPropertiesMemoryHeaps: + o << "FeatureName::AdapterPropertiesMemoryHeaps"; + break; + case FeatureName::AdapterPropertiesD3D: + o << "FeatureName::AdapterPropertiesD3D"; + break; + case FeatureName::AdapterPropertiesVk: + o << "FeatureName::AdapterPropertiesVk"; + break; + case FeatureName::R8UnormStorage: + o << "FeatureName::R8UnormStorage"; + break; + case FeatureName::FormatCapabilities: + o << "FeatureName::FormatCapabilities"; + break; + case FeatureName::DrmFormatCapabilities: + o << "FeatureName::DrmFormatCapabilities"; + break; + case FeatureName::Norm16TextureFormats: + o << "FeatureName::Norm16TextureFormats"; + break; + case FeatureName::SharedTextureMemoryVkDedicatedAllocation: + o << "FeatureName::SharedTextureMemoryVkDedicatedAllocation"; + break; + case FeatureName::SharedTextureMemoryAHardwareBuffer: + o << "FeatureName::SharedTextureMemoryAHardwareBuffer"; + break; + case FeatureName::SharedTextureMemoryDmaBuf: + o << "FeatureName::SharedTextureMemoryDmaBuf"; + break; + case FeatureName::SharedTextureMemoryOpaqueFD: + o << "FeatureName::SharedTextureMemoryOpaqueFD"; + break; + case FeatureName::SharedTextureMemoryZirconHandle: + o << "FeatureName::SharedTextureMemoryZirconHandle"; + break; + case FeatureName::SharedTextureMemoryDXGISharedHandle: + o << "FeatureName::SharedTextureMemoryDXGISharedHandle"; + break; + case FeatureName::SharedTextureMemoryD3D11Texture2D: + o << "FeatureName::SharedTextureMemoryD3D11Texture2D"; + break; + case FeatureName::SharedTextureMemoryIOSurface: + o << "FeatureName::SharedTextureMemoryIOSurface"; + break; + case FeatureName::SharedTextureMemoryEGLImage: + o << "FeatureName::SharedTextureMemoryEGLImage"; + break; + case FeatureName::SharedFenceVkSemaphoreOpaqueFD: + o << "FeatureName::SharedFenceVkSemaphoreOpaqueFD"; + break; + case FeatureName::SharedFenceVkSemaphoreSyncFD: + o << "FeatureName::SharedFenceVkSemaphoreSyncFD"; + break; + case FeatureName::SharedFenceVkSemaphoreZirconHandle: + o << "FeatureName::SharedFenceVkSemaphoreZirconHandle"; + break; + case FeatureName::SharedFenceDXGISharedHandle: + o << "FeatureName::SharedFenceDXGISharedHandle"; + break; + case FeatureName::SharedFenceMTLSharedEvent: + o << "FeatureName::SharedFenceMTLSharedEvent"; + break; + case FeatureName::SharedBufferMemoryD3D12Resource: + o << "FeatureName::SharedBufferMemoryD3D12Resource"; + break; + case FeatureName::StaticSamplers: + o << "FeatureName::StaticSamplers"; + break; + default: + o << "FeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, FilterMode value) { + switch (value) { + case FilterMode::Undefined: + o << "FilterMode::Undefined"; + break; + case FilterMode::Nearest: + o << "FilterMode::Nearest"; + break; + case FilterMode::Linear: + o << "FilterMode::Linear"; + break; + default: + o << "FilterMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, FrontFace value) { + switch (value) { + case FrontFace::Undefined: + o << "FrontFace::Undefined"; + break; + case FrontFace::CCW: + o << "FrontFace::CCW"; + break; + case FrontFace::CW: + o << "FrontFace::CW"; + break; + default: + o << "FrontFace::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, IndexFormat value) { + switch (value) { + case IndexFormat::Undefined: + o << "IndexFormat::Undefined"; + break; + case IndexFormat::Uint16: + o << "IndexFormat::Uint16"; + break; + case IndexFormat::Uint32: + o << "IndexFormat::Uint32"; + break; + default: + o << "IndexFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, LoadOp value) { + switch (value) { + case LoadOp::Undefined: + o << "LoadOp::Undefined"; + break; + case LoadOp::Clear: + o << "LoadOp::Clear"; + break; + case LoadOp::Load: + o << "LoadOp::Load"; + break; + default: + o << "LoadOp::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, LoggingType value) { + switch (value) { + case LoggingType::Verbose: + o << "LoggingType::Verbose"; + break; + case LoggingType::Info: + o << "LoggingType::Info"; + break; + case LoggingType::Warning: + o << "LoggingType::Warning"; + break; + case LoggingType::Error: + o << "LoggingType::Error"; + break; + default: + o << "LoggingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, MipmapFilterMode value) { + switch (value) { + case MipmapFilterMode::Undefined: + o << "MipmapFilterMode::Undefined"; + break; + case MipmapFilterMode::Nearest: + o << "MipmapFilterMode::Nearest"; + break; + case MipmapFilterMode::Linear: + o << "MipmapFilterMode::Linear"; + break; + default: + o << "MipmapFilterMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, PopErrorScopeStatus value) { + switch (value) { + case PopErrorScopeStatus::Success: + o << "PopErrorScopeStatus::Success"; + break; + case PopErrorScopeStatus::InstanceDropped: + o << "PopErrorScopeStatus::InstanceDropped"; + break; + default: + o << "PopErrorScopeStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, PowerPreference value) { + switch (value) { + case PowerPreference::Undefined: + o << "PowerPreference::Undefined"; + break; + case PowerPreference::LowPower: + o << "PowerPreference::LowPower"; + break; + case PowerPreference::HighPerformance: + o << "PowerPreference::HighPerformance"; + break; + default: + o << "PowerPreference::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, PresentMode value) { + switch (value) { + case PresentMode::Fifo: + o << "PresentMode::Fifo"; + break; + case PresentMode::Immediate: + o << "PresentMode::Immediate"; + break; + case PresentMode::Mailbox: + o << "PresentMode::Mailbox"; + break; + default: + o << "PresentMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, PrimitiveTopology value) { + switch (value) { + case PrimitiveTopology::Undefined: + o << "PrimitiveTopology::Undefined"; + break; + case PrimitiveTopology::PointList: + o << "PrimitiveTopology::PointList"; + break; + case PrimitiveTopology::LineList: + o << "PrimitiveTopology::LineList"; + break; + case PrimitiveTopology::LineStrip: + o << "PrimitiveTopology::LineStrip"; + break; + case PrimitiveTopology::TriangleList: + o << "PrimitiveTopology::TriangleList"; + break; + case PrimitiveTopology::TriangleStrip: + o << "PrimitiveTopology::TriangleStrip"; + break; + default: + o << "PrimitiveTopology::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, QueryType value) { + switch (value) { + case QueryType::Occlusion: + o << "QueryType::Occlusion"; + break; + case QueryType::Timestamp: + o << "QueryType::Timestamp"; + break; + default: + o << "QueryType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, QueueWorkDoneStatus value) { + switch (value) { + case QueueWorkDoneStatus::Success: + o << "QueueWorkDoneStatus::Success"; + break; + case QueueWorkDoneStatus::InstanceDropped: + o << "QueueWorkDoneStatus::InstanceDropped"; + break; + case QueueWorkDoneStatus::Error: + o << "QueueWorkDoneStatus::Error"; + break; + case QueueWorkDoneStatus::Unknown: + o << "QueueWorkDoneStatus::Unknown"; + break; + case QueueWorkDoneStatus::DeviceLost: + o << "QueueWorkDoneStatus::DeviceLost"; + break; + default: + o << "QueueWorkDoneStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, RequestAdapterStatus value) { + switch (value) { + case RequestAdapterStatus::Success: + o << "RequestAdapterStatus::Success"; + break; + case RequestAdapterStatus::InstanceDropped: + o << "RequestAdapterStatus::InstanceDropped"; + break; + case RequestAdapterStatus::Unavailable: + o << "RequestAdapterStatus::Unavailable"; + break; + case RequestAdapterStatus::Error: + o << "RequestAdapterStatus::Error"; + break; + case RequestAdapterStatus::Unknown: + o << "RequestAdapterStatus::Unknown"; + break; + default: + o << "RequestAdapterStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, RequestDeviceStatus value) { + switch (value) { + case RequestDeviceStatus::Success: + o << "RequestDeviceStatus::Success"; + break; + case RequestDeviceStatus::InstanceDropped: + o << "RequestDeviceStatus::InstanceDropped"; + break; + case RequestDeviceStatus::Error: + o << "RequestDeviceStatus::Error"; + break; + case RequestDeviceStatus::Unknown: + o << "RequestDeviceStatus::Unknown"; + break; + default: + o << "RequestDeviceStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, SType value) { + switch (value) { + case SType::Invalid: + o << "SType::Invalid"; + break; + case SType::SurfaceDescriptorFromMetalLayer: + o << "SType::SurfaceDescriptorFromMetalLayer"; + break; + case SType::SurfaceDescriptorFromWindowsHWND: + o << "SType::SurfaceDescriptorFromWindowsHWND"; + break; + case SType::SurfaceDescriptorFromXlibWindow: + o << "SType::SurfaceDescriptorFromXlibWindow"; + break; + case SType::SurfaceDescriptorFromCanvasHTMLSelector: + o << "SType::SurfaceDescriptorFromCanvasHTMLSelector"; + break; + case SType::ShaderModuleSPIRVDescriptor: + o << "SType::ShaderModuleSPIRVDescriptor"; + break; + case SType::ShaderModuleWGSLDescriptor: + o << "SType::ShaderModuleWGSLDescriptor"; + break; + case SType::PrimitiveDepthClipControl: + o << "SType::PrimitiveDepthClipControl"; + break; + case SType::SurfaceDescriptorFromWaylandSurface: + o << "SType::SurfaceDescriptorFromWaylandSurface"; + break; + case SType::SurfaceDescriptorFromAndroidNativeWindow: + o << "SType::SurfaceDescriptorFromAndroidNativeWindow"; + break; + case SType::SurfaceDescriptorFromWindowsCoreWindow: + o << "SType::SurfaceDescriptorFromWindowsCoreWindow"; + break; + case SType::ExternalTextureBindingEntry: + o << "SType::ExternalTextureBindingEntry"; + break; + case SType::ExternalTextureBindingLayout: + o << "SType::ExternalTextureBindingLayout"; + break; + case SType::SurfaceDescriptorFromWindowsSwapChainPanel: + o << "SType::SurfaceDescriptorFromWindowsSwapChainPanel"; + break; + case SType::RenderPassDescriptorMaxDrawCount: + o << "SType::RenderPassDescriptorMaxDrawCount"; + break; + case SType::DepthStencilStateDepthWriteDefinedDawn: + o << "SType::DepthStencilStateDepthWriteDefinedDawn"; + break; + case SType::TextureBindingViewDimensionDescriptor: + o << "SType::TextureBindingViewDimensionDescriptor"; + break; + case SType::DawnTextureInternalUsageDescriptor: + o << "SType::DawnTextureInternalUsageDescriptor"; + break; + case SType::DawnEncoderInternalUsageDescriptor: + o << "SType::DawnEncoderInternalUsageDescriptor"; + break; + case SType::DawnInstanceDescriptor: + o << "SType::DawnInstanceDescriptor"; + break; + case SType::DawnCacheDeviceDescriptor: + o << "SType::DawnCacheDeviceDescriptor"; + break; + case SType::DawnAdapterPropertiesPowerPreference: + o << "SType::DawnAdapterPropertiesPowerPreference"; + break; + case SType::DawnBufferDescriptorErrorInfoFromWireClient: + o << "SType::DawnBufferDescriptorErrorInfoFromWireClient"; + break; + case SType::DawnTogglesDescriptor: + o << "SType::DawnTogglesDescriptor"; + break; + case SType::DawnShaderModuleSPIRVOptionsDescriptor: + o << "SType::DawnShaderModuleSPIRVOptionsDescriptor"; + break; + case SType::RequestAdapterOptionsLUID: + o << "SType::RequestAdapterOptionsLUID"; + break; + case SType::RequestAdapterOptionsGetGLProc: + o << "SType::RequestAdapterOptionsGetGLProc"; + break; + case SType::RequestAdapterOptionsD3D11Device: + o << "SType::RequestAdapterOptionsD3D11Device"; + break; + case SType::DawnMultisampleStateRenderToSingleSampled: + o << "SType::DawnMultisampleStateRenderToSingleSampled"; + break; + case SType::DawnRenderPassColorAttachmentRenderToSingleSampled: + o << "SType::DawnRenderPassColorAttachmentRenderToSingleSampled"; + break; + case SType::RenderPassPixelLocalStorage: + o << "SType::RenderPassPixelLocalStorage"; + break; + case SType::PipelineLayoutPixelLocalStorage: + o << "SType::PipelineLayoutPixelLocalStorage"; + break; + case SType::BufferHostMappedPointer: + o << "SType::BufferHostMappedPointer"; + break; + case SType::DawnExperimentalSubgroupLimits: + o << "SType::DawnExperimentalSubgroupLimits"; + break; + case SType::AdapterPropertiesMemoryHeaps: + o << "SType::AdapterPropertiesMemoryHeaps"; + break; + case SType::AdapterPropertiesD3D: + o << "SType::AdapterPropertiesD3D"; + break; + case SType::AdapterPropertiesVk: + o << "SType::AdapterPropertiesVk"; + break; + case SType::DawnComputePipelineFullSubgroups: + o << "SType::DawnComputePipelineFullSubgroups"; + break; + case SType::DawnWireWGSLControl: + o << "SType::DawnWireWGSLControl"; + break; + case SType::DawnWGSLBlocklist: + o << "SType::DawnWGSLBlocklist"; + break; + case SType::DrmFormatCapabilities: + o << "SType::DrmFormatCapabilities"; + break; + case SType::SharedTextureMemoryVkImageDescriptor: + o << "SType::SharedTextureMemoryVkImageDescriptor"; + break; + case SType::SharedTextureMemoryVkDedicatedAllocationDescriptor: + o << "SType::SharedTextureMemoryVkDedicatedAllocationDescriptor"; + break; + case SType::SharedTextureMemoryAHardwareBufferDescriptor: + o << "SType::SharedTextureMemoryAHardwareBufferDescriptor"; + break; + case SType::SharedTextureMemoryDmaBufDescriptor: + o << "SType::SharedTextureMemoryDmaBufDescriptor"; + break; + case SType::SharedTextureMemoryOpaqueFDDescriptor: + o << "SType::SharedTextureMemoryOpaqueFDDescriptor"; + break; + case SType::SharedTextureMemoryZirconHandleDescriptor: + o << "SType::SharedTextureMemoryZirconHandleDescriptor"; + break; + case SType::SharedTextureMemoryDXGISharedHandleDescriptor: + o << "SType::SharedTextureMemoryDXGISharedHandleDescriptor"; + break; + case SType::SharedTextureMemoryD3D11Texture2DDescriptor: + o << "SType::SharedTextureMemoryD3D11Texture2DDescriptor"; + break; + case SType::SharedTextureMemoryIOSurfaceDescriptor: + o << "SType::SharedTextureMemoryIOSurfaceDescriptor"; + break; + case SType::SharedTextureMemoryEGLImageDescriptor: + o << "SType::SharedTextureMemoryEGLImageDescriptor"; + break; + case SType::SharedTextureMemoryInitializedBeginState: + o << "SType::SharedTextureMemoryInitializedBeginState"; + break; + case SType::SharedTextureMemoryInitializedEndState: + o << "SType::SharedTextureMemoryInitializedEndState"; + break; + case SType::SharedTextureMemoryVkImageLayoutBeginState: + o << "SType::SharedTextureMemoryVkImageLayoutBeginState"; + break; + case SType::SharedTextureMemoryVkImageLayoutEndState: + o << "SType::SharedTextureMemoryVkImageLayoutEndState"; + break; + case SType::SharedFenceVkSemaphoreOpaqueFDDescriptor: + o << "SType::SharedFenceVkSemaphoreOpaqueFDDescriptor"; + break; + case SType::SharedFenceVkSemaphoreOpaqueFDExportInfo: + o << "SType::SharedFenceVkSemaphoreOpaqueFDExportInfo"; + break; + case SType::SharedFenceVkSemaphoreSyncFDDescriptor: + o << "SType::SharedFenceVkSemaphoreSyncFDDescriptor"; + break; + case SType::SharedFenceVkSemaphoreSyncFDExportInfo: + o << "SType::SharedFenceVkSemaphoreSyncFDExportInfo"; + break; + case SType::SharedFenceVkSemaphoreZirconHandleDescriptor: + o << "SType::SharedFenceVkSemaphoreZirconHandleDescriptor"; + break; + case SType::SharedFenceVkSemaphoreZirconHandleExportInfo: + o << "SType::SharedFenceVkSemaphoreZirconHandleExportInfo"; + break; + case SType::SharedFenceDXGISharedHandleDescriptor: + o << "SType::SharedFenceDXGISharedHandleDescriptor"; + break; + case SType::SharedFenceDXGISharedHandleExportInfo: + o << "SType::SharedFenceDXGISharedHandleExportInfo"; + break; + case SType::SharedFenceMTLSharedEventDescriptor: + o << "SType::SharedFenceMTLSharedEventDescriptor"; + break; + case SType::SharedFenceMTLSharedEventExportInfo: + o << "SType::SharedFenceMTLSharedEventExportInfo"; + break; + case SType::SharedBufferMemoryD3D12ResourceDescriptor: + o << "SType::SharedBufferMemoryD3D12ResourceDescriptor"; + break; + case SType::StaticSamplerBindingLayout: + o << "SType::StaticSamplerBindingLayout"; + break; + default: + o << "SType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, SamplerBindingType value) { + switch (value) { + case SamplerBindingType::Undefined: + o << "SamplerBindingType::Undefined"; + break; + case SamplerBindingType::Filtering: + o << "SamplerBindingType::Filtering"; + break; + case SamplerBindingType::NonFiltering: + o << "SamplerBindingType::NonFiltering"; + break; + case SamplerBindingType::Comparison: + o << "SamplerBindingType::Comparison"; + break; + default: + o << "SamplerBindingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, SharedFenceType value) { + switch (value) { + case SharedFenceType::Undefined: + o << "SharedFenceType::Undefined"; + break; + case SharedFenceType::VkSemaphoreOpaqueFD: + o << "SharedFenceType::VkSemaphoreOpaqueFD"; + break; + case SharedFenceType::VkSemaphoreSyncFD: + o << "SharedFenceType::VkSemaphoreSyncFD"; + break; + case SharedFenceType::VkSemaphoreZirconHandle: + o << "SharedFenceType::VkSemaphoreZirconHandle"; + break; + case SharedFenceType::DXGISharedHandle: + o << "SharedFenceType::DXGISharedHandle"; + break; + case SharedFenceType::MTLSharedEvent: + o << "SharedFenceType::MTLSharedEvent"; + break; + default: + o << "SharedFenceType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, StencilOperation value) { + switch (value) { + case StencilOperation::Undefined: + o << "StencilOperation::Undefined"; + break; + case StencilOperation::Keep: + o << "StencilOperation::Keep"; + break; + case StencilOperation::Zero: + o << "StencilOperation::Zero"; + break; + case StencilOperation::Replace: + o << "StencilOperation::Replace"; + break; + case StencilOperation::Invert: + o << "StencilOperation::Invert"; + break; + case StencilOperation::IncrementClamp: + o << "StencilOperation::IncrementClamp"; + break; + case StencilOperation::DecrementClamp: + o << "StencilOperation::DecrementClamp"; + break; + case StencilOperation::IncrementWrap: + o << "StencilOperation::IncrementWrap"; + break; + case StencilOperation::DecrementWrap: + o << "StencilOperation::DecrementWrap"; + break; + default: + o << "StencilOperation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, StorageTextureAccess value) { + switch (value) { + case StorageTextureAccess::Undefined: + o << "StorageTextureAccess::Undefined"; + break; + case StorageTextureAccess::WriteOnly: + o << "StorageTextureAccess::WriteOnly"; + break; + case StorageTextureAccess::ReadOnly: + o << "StorageTextureAccess::ReadOnly"; + break; + case StorageTextureAccess::ReadWrite: + o << "StorageTextureAccess::ReadWrite"; + break; + default: + o << "StorageTextureAccess::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, StoreOp value) { + switch (value) { + case StoreOp::Undefined: + o << "StoreOp::Undefined"; + break; + case StoreOp::Store: + o << "StoreOp::Store"; + break; + case StoreOp::Discard: + o << "StoreOp::Discard"; + break; + default: + o << "StoreOp::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, TextureAspect value) { + switch (value) { + case TextureAspect::Undefined: + o << "TextureAspect::Undefined"; + break; + case TextureAspect::All: + o << "TextureAspect::All"; + break; + case TextureAspect::StencilOnly: + o << "TextureAspect::StencilOnly"; + break; + case TextureAspect::DepthOnly: + o << "TextureAspect::DepthOnly"; + break; + case TextureAspect::Plane0Only: + o << "TextureAspect::Plane0Only"; + break; + case TextureAspect::Plane1Only: + o << "TextureAspect::Plane1Only"; + break; + case TextureAspect::Plane2Only: + o << "TextureAspect::Plane2Only"; + break; + default: + o << "TextureAspect::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, TextureDimension value) { + switch (value) { + case TextureDimension::Undefined: + o << "TextureDimension::Undefined"; + break; + case TextureDimension::e1D: + o << "TextureDimension::e1D"; + break; + case TextureDimension::e2D: + o << "TextureDimension::e2D"; + break; + case TextureDimension::e3D: + o << "TextureDimension::e3D"; + break; + default: + o << "TextureDimension::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, TextureFormat value) { + switch (value) { + case TextureFormat::Undefined: + o << "TextureFormat::Undefined"; + break; + case TextureFormat::R8Unorm: + o << "TextureFormat::R8Unorm"; + break; + case TextureFormat::R8Snorm: + o << "TextureFormat::R8Snorm"; + break; + case TextureFormat::R8Uint: + o << "TextureFormat::R8Uint"; + break; + case TextureFormat::R8Sint: + o << "TextureFormat::R8Sint"; + break; + case TextureFormat::R16Uint: + o << "TextureFormat::R16Uint"; + break; + case TextureFormat::R16Sint: + o << "TextureFormat::R16Sint"; + break; + case TextureFormat::R16Float: + o << "TextureFormat::R16Float"; + break; + case TextureFormat::RG8Unorm: + o << "TextureFormat::RG8Unorm"; + break; + case TextureFormat::RG8Snorm: + o << "TextureFormat::RG8Snorm"; + break; + case TextureFormat::RG8Uint: + o << "TextureFormat::RG8Uint"; + break; + case TextureFormat::RG8Sint: + o << "TextureFormat::RG8Sint"; + break; + case TextureFormat::R32Float: + o << "TextureFormat::R32Float"; + break; + case TextureFormat::R32Uint: + o << "TextureFormat::R32Uint"; + break; + case TextureFormat::R32Sint: + o << "TextureFormat::R32Sint"; + break; + case TextureFormat::RG16Uint: + o << "TextureFormat::RG16Uint"; + break; + case TextureFormat::RG16Sint: + o << "TextureFormat::RG16Sint"; + break; + case TextureFormat::RG16Float: + o << "TextureFormat::RG16Float"; + break; + case TextureFormat::RGBA8Unorm: + o << "TextureFormat::RGBA8Unorm"; + break; + case TextureFormat::RGBA8UnormSrgb: + o << "TextureFormat::RGBA8UnormSrgb"; + break; + case TextureFormat::RGBA8Snorm: + o << "TextureFormat::RGBA8Snorm"; + break; + case TextureFormat::RGBA8Uint: + o << "TextureFormat::RGBA8Uint"; + break; + case TextureFormat::RGBA8Sint: + o << "TextureFormat::RGBA8Sint"; + break; + case TextureFormat::BGRA8Unorm: + o << "TextureFormat::BGRA8Unorm"; + break; + case TextureFormat::BGRA8UnormSrgb: + o << "TextureFormat::BGRA8UnormSrgb"; + break; + case TextureFormat::RGB10A2Uint: + o << "TextureFormat::RGB10A2Uint"; + break; + case TextureFormat::RGB10A2Unorm: + o << "TextureFormat::RGB10A2Unorm"; + break; + case TextureFormat::RG11B10Ufloat: + o << "TextureFormat::RG11B10Ufloat"; + break; + case TextureFormat::RGB9E5Ufloat: + o << "TextureFormat::RGB9E5Ufloat"; + break; + case TextureFormat::RG32Float: + o << "TextureFormat::RG32Float"; + break; + case TextureFormat::RG32Uint: + o << "TextureFormat::RG32Uint"; + break; + case TextureFormat::RG32Sint: + o << "TextureFormat::RG32Sint"; + break; + case TextureFormat::RGBA16Uint: + o << "TextureFormat::RGBA16Uint"; + break; + case TextureFormat::RGBA16Sint: + o << "TextureFormat::RGBA16Sint"; + break; + case TextureFormat::RGBA16Float: + o << "TextureFormat::RGBA16Float"; + break; + case TextureFormat::RGBA32Float: + o << "TextureFormat::RGBA32Float"; + break; + case TextureFormat::RGBA32Uint: + o << "TextureFormat::RGBA32Uint"; + break; + case TextureFormat::RGBA32Sint: + o << "TextureFormat::RGBA32Sint"; + break; + case TextureFormat::Stencil8: + o << "TextureFormat::Stencil8"; + break; + case TextureFormat::Depth16Unorm: + o << "TextureFormat::Depth16Unorm"; + break; + case TextureFormat::Depth24Plus: + o << "TextureFormat::Depth24Plus"; + break; + case TextureFormat::Depth24PlusStencil8: + o << "TextureFormat::Depth24PlusStencil8"; + break; + case TextureFormat::Depth32Float: + o << "TextureFormat::Depth32Float"; + break; + case TextureFormat::Depth32FloatStencil8: + o << "TextureFormat::Depth32FloatStencil8"; + break; + case TextureFormat::BC1RGBAUnorm: + o << "TextureFormat::BC1RGBAUnorm"; + break; + case TextureFormat::BC1RGBAUnormSrgb: + o << "TextureFormat::BC1RGBAUnormSrgb"; + break; + case TextureFormat::BC2RGBAUnorm: + o << "TextureFormat::BC2RGBAUnorm"; + break; + case TextureFormat::BC2RGBAUnormSrgb: + o << "TextureFormat::BC2RGBAUnormSrgb"; + break; + case TextureFormat::BC3RGBAUnorm: + o << "TextureFormat::BC3RGBAUnorm"; + break; + case TextureFormat::BC3RGBAUnormSrgb: + o << "TextureFormat::BC3RGBAUnormSrgb"; + break; + case TextureFormat::BC4RUnorm: + o << "TextureFormat::BC4RUnorm"; + break; + case TextureFormat::BC4RSnorm: + o << "TextureFormat::BC4RSnorm"; + break; + case TextureFormat::BC5RGUnorm: + o << "TextureFormat::BC5RGUnorm"; + break; + case TextureFormat::BC5RGSnorm: + o << "TextureFormat::BC5RGSnorm"; + break; + case TextureFormat::BC6HRGBUfloat: + o << "TextureFormat::BC6HRGBUfloat"; + break; + case TextureFormat::BC6HRGBFloat: + o << "TextureFormat::BC6HRGBFloat"; + break; + case TextureFormat::BC7RGBAUnorm: + o << "TextureFormat::BC7RGBAUnorm"; + break; + case TextureFormat::BC7RGBAUnormSrgb: + o << "TextureFormat::BC7RGBAUnormSrgb"; + break; + case TextureFormat::ETC2RGB8Unorm: + o << "TextureFormat::ETC2RGB8Unorm"; + break; + case TextureFormat::ETC2RGB8UnormSrgb: + o << "TextureFormat::ETC2RGB8UnormSrgb"; + break; + case TextureFormat::ETC2RGB8A1Unorm: + o << "TextureFormat::ETC2RGB8A1Unorm"; + break; + case TextureFormat::ETC2RGB8A1UnormSrgb: + o << "TextureFormat::ETC2RGB8A1UnormSrgb"; + break; + case TextureFormat::ETC2RGBA8Unorm: + o << "TextureFormat::ETC2RGBA8Unorm"; + break; + case TextureFormat::ETC2RGBA8UnormSrgb: + o << "TextureFormat::ETC2RGBA8UnormSrgb"; + break; + case TextureFormat::EACR11Unorm: + o << "TextureFormat::EACR11Unorm"; + break; + case TextureFormat::EACR11Snorm: + o << "TextureFormat::EACR11Snorm"; + break; + case TextureFormat::EACRG11Unorm: + o << "TextureFormat::EACRG11Unorm"; + break; + case TextureFormat::EACRG11Snorm: + o << "TextureFormat::EACRG11Snorm"; + break; + case TextureFormat::ASTC4x4Unorm: + o << "TextureFormat::ASTC4x4Unorm"; + break; + case TextureFormat::ASTC4x4UnormSrgb: + o << "TextureFormat::ASTC4x4UnormSrgb"; + break; + case TextureFormat::ASTC5x4Unorm: + o << "TextureFormat::ASTC5x4Unorm"; + break; + case TextureFormat::ASTC5x4UnormSrgb: + o << "TextureFormat::ASTC5x4UnormSrgb"; + break; + case TextureFormat::ASTC5x5Unorm: + o << "TextureFormat::ASTC5x5Unorm"; + break; + case TextureFormat::ASTC5x5UnormSrgb: + o << "TextureFormat::ASTC5x5UnormSrgb"; + break; + case TextureFormat::ASTC6x5Unorm: + o << "TextureFormat::ASTC6x5Unorm"; + break; + case TextureFormat::ASTC6x5UnormSrgb: + o << "TextureFormat::ASTC6x5UnormSrgb"; + break; + case TextureFormat::ASTC6x6Unorm: + o << "TextureFormat::ASTC6x6Unorm"; + break; + case TextureFormat::ASTC6x6UnormSrgb: + o << "TextureFormat::ASTC6x6UnormSrgb"; + break; + case TextureFormat::ASTC8x5Unorm: + o << "TextureFormat::ASTC8x5Unorm"; + break; + case TextureFormat::ASTC8x5UnormSrgb: + o << "TextureFormat::ASTC8x5UnormSrgb"; + break; + case TextureFormat::ASTC8x6Unorm: + o << "TextureFormat::ASTC8x6Unorm"; + break; + case TextureFormat::ASTC8x6UnormSrgb: + o << "TextureFormat::ASTC8x6UnormSrgb"; + break; + case TextureFormat::ASTC8x8Unorm: + o << "TextureFormat::ASTC8x8Unorm"; + break; + case TextureFormat::ASTC8x8UnormSrgb: + o << "TextureFormat::ASTC8x8UnormSrgb"; + break; + case TextureFormat::ASTC10x5Unorm: + o << "TextureFormat::ASTC10x5Unorm"; + break; + case TextureFormat::ASTC10x5UnormSrgb: + o << "TextureFormat::ASTC10x5UnormSrgb"; + break; + case TextureFormat::ASTC10x6Unorm: + o << "TextureFormat::ASTC10x6Unorm"; + break; + case TextureFormat::ASTC10x6UnormSrgb: + o << "TextureFormat::ASTC10x6UnormSrgb"; + break; + case TextureFormat::ASTC10x8Unorm: + o << "TextureFormat::ASTC10x8Unorm"; + break; + case TextureFormat::ASTC10x8UnormSrgb: + o << "TextureFormat::ASTC10x8UnormSrgb"; + break; + case TextureFormat::ASTC10x10Unorm: + o << "TextureFormat::ASTC10x10Unorm"; + break; + case TextureFormat::ASTC10x10UnormSrgb: + o << "TextureFormat::ASTC10x10UnormSrgb"; + break; + case TextureFormat::ASTC12x10Unorm: + o << "TextureFormat::ASTC12x10Unorm"; + break; + case TextureFormat::ASTC12x10UnormSrgb: + o << "TextureFormat::ASTC12x10UnormSrgb"; + break; + case TextureFormat::ASTC12x12Unorm: + o << "TextureFormat::ASTC12x12Unorm"; + break; + case TextureFormat::ASTC12x12UnormSrgb: + o << "TextureFormat::ASTC12x12UnormSrgb"; + break; + case TextureFormat::R16Unorm: + o << "TextureFormat::R16Unorm"; + break; + case TextureFormat::RG16Unorm: + o << "TextureFormat::RG16Unorm"; + break; + case TextureFormat::RGBA16Unorm: + o << "TextureFormat::RGBA16Unorm"; + break; + case TextureFormat::R16Snorm: + o << "TextureFormat::R16Snorm"; + break; + case TextureFormat::RG16Snorm: + o << "TextureFormat::RG16Snorm"; + break; + case TextureFormat::RGBA16Snorm: + o << "TextureFormat::RGBA16Snorm"; + break; + case TextureFormat::R8BG8Biplanar420Unorm: + o << "TextureFormat::R8BG8Biplanar420Unorm"; + break; + case TextureFormat::R10X6BG10X6Biplanar420Unorm: + o << "TextureFormat::R10X6BG10X6Biplanar420Unorm"; + break; + case TextureFormat::R8BG8A8Triplanar420Unorm: + o << "TextureFormat::R8BG8A8Triplanar420Unorm"; + break; + default: + o << "TextureFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, TextureSampleType value) { + switch (value) { + case TextureSampleType::Undefined: + o << "TextureSampleType::Undefined"; + break; + case TextureSampleType::Float: + o << "TextureSampleType::Float"; + break; + case TextureSampleType::UnfilterableFloat: + o << "TextureSampleType::UnfilterableFloat"; + break; + case TextureSampleType::Depth: + o << "TextureSampleType::Depth"; + break; + case TextureSampleType::Sint: + o << "TextureSampleType::Sint"; + break; + case TextureSampleType::Uint: + o << "TextureSampleType::Uint"; + break; + default: + o << "TextureSampleType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, TextureViewDimension value) { + switch (value) { + case TextureViewDimension::Undefined: + o << "TextureViewDimension::Undefined"; + break; + case TextureViewDimension::e1D: + o << "TextureViewDimension::e1D"; + break; + case TextureViewDimension::e2D: + o << "TextureViewDimension::e2D"; + break; + case TextureViewDimension::e2DArray: + o << "TextureViewDimension::e2DArray"; + break; + case TextureViewDimension::Cube: + o << "TextureViewDimension::Cube"; + break; + case TextureViewDimension::CubeArray: + o << "TextureViewDimension::CubeArray"; + break; + case TextureViewDimension::e3D: + o << "TextureViewDimension::e3D"; + break; + default: + o << "TextureViewDimension::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, VertexFormat value) { + switch (value) { + case VertexFormat::Undefined: + o << "VertexFormat::Undefined"; + break; + case VertexFormat::Uint8x2: + o << "VertexFormat::Uint8x2"; + break; + case VertexFormat::Uint8x4: + o << "VertexFormat::Uint8x4"; + break; + case VertexFormat::Sint8x2: + o << "VertexFormat::Sint8x2"; + break; + case VertexFormat::Sint8x4: + o << "VertexFormat::Sint8x4"; + break; + case VertexFormat::Unorm8x2: + o << "VertexFormat::Unorm8x2"; + break; + case VertexFormat::Unorm8x4: + o << "VertexFormat::Unorm8x4"; + break; + case VertexFormat::Snorm8x2: + o << "VertexFormat::Snorm8x2"; + break; + case VertexFormat::Snorm8x4: + o << "VertexFormat::Snorm8x4"; + break; + case VertexFormat::Uint16x2: + o << "VertexFormat::Uint16x2"; + break; + case VertexFormat::Uint16x4: + o << "VertexFormat::Uint16x4"; + break; + case VertexFormat::Sint16x2: + o << "VertexFormat::Sint16x2"; + break; + case VertexFormat::Sint16x4: + o << "VertexFormat::Sint16x4"; + break; + case VertexFormat::Unorm16x2: + o << "VertexFormat::Unorm16x2"; + break; + case VertexFormat::Unorm16x4: + o << "VertexFormat::Unorm16x4"; + break; + case VertexFormat::Snorm16x2: + o << "VertexFormat::Snorm16x2"; + break; + case VertexFormat::Snorm16x4: + o << "VertexFormat::Snorm16x4"; + break; + case VertexFormat::Float16x2: + o << "VertexFormat::Float16x2"; + break; + case VertexFormat::Float16x4: + o << "VertexFormat::Float16x4"; + break; + case VertexFormat::Float32: + o << "VertexFormat::Float32"; + break; + case VertexFormat::Float32x2: + o << "VertexFormat::Float32x2"; + break; + case VertexFormat::Float32x3: + o << "VertexFormat::Float32x3"; + break; + case VertexFormat::Float32x4: + o << "VertexFormat::Float32x4"; + break; + case VertexFormat::Uint32: + o << "VertexFormat::Uint32"; + break; + case VertexFormat::Uint32x2: + o << "VertexFormat::Uint32x2"; + break; + case VertexFormat::Uint32x3: + o << "VertexFormat::Uint32x3"; + break; + case VertexFormat::Uint32x4: + o << "VertexFormat::Uint32x4"; + break; + case VertexFormat::Sint32: + o << "VertexFormat::Sint32"; + break; + case VertexFormat::Sint32x2: + o << "VertexFormat::Sint32x2"; + break; + case VertexFormat::Sint32x3: + o << "VertexFormat::Sint32x3"; + break; + case VertexFormat::Sint32x4: + o << "VertexFormat::Sint32x4"; + break; + case VertexFormat::Unorm10_10_10_2: + o << "VertexFormat::Unorm10_10_10_2"; + break; + default: + o << "VertexFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, VertexStepMode value) { + switch (value) { + case VertexStepMode::Undefined: + o << "VertexStepMode::Undefined"; + break; + case VertexStepMode::VertexBufferNotUsed: + o << "VertexStepMode::VertexBufferNotUsed"; + break; + case VertexStepMode::Vertex: + o << "VertexStepMode::Vertex"; + break; + case VertexStepMode::Instance: + o << "VertexStepMode::Instance"; + break; + default: + o << "VertexStepMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, WaitStatus value) { + switch (value) { + case WaitStatus::Success: + o << "WaitStatus::Success"; + break; + case WaitStatus::TimedOut: + o << "WaitStatus::TimedOut"; + break; + case WaitStatus::UnsupportedTimeout: + o << "WaitStatus::UnsupportedTimeout"; + break; + case WaitStatus::UnsupportedCount: + o << "WaitStatus::UnsupportedCount"; + break; + case WaitStatus::UnsupportedMixedSources: + o << "WaitStatus::UnsupportedMixedSources"; + break; + case WaitStatus::Unknown: + o << "WaitStatus::Unknown"; + break; + default: + o << "WaitStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + return o; + } + + template + std::basic_ostream& operator<<(std::basic_ostream& o, BufferUsage value) { + o << "BufferUsage::"; + if (!static_cast(value)) { + // 0 is often explicitly declared as None. + o << "None"; + return o; + } + + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } + + bool first = true; + if (value & BufferUsage::MapRead) { + if (!first) { + o << "|"; + } + first = false; + o << "MapRead"; + value &= ~BufferUsage::MapRead; + } + if (value & BufferUsage::MapWrite) { + if (!first) { + o << "|"; + } + first = false; + o << "MapWrite"; + value &= ~BufferUsage::MapWrite; + } + if (value & BufferUsage::CopySrc) { + if (!first) { + o << "|"; + } + first = false; + o << "CopySrc"; + value &= ~BufferUsage::CopySrc; + } + if (value & BufferUsage::CopyDst) { + if (!first) { + o << "|"; + } + first = false; + o << "CopyDst"; + value &= ~BufferUsage::CopyDst; + } + if (value & BufferUsage::Index) { + if (!first) { + o << "|"; + } + first = false; + o << "Index"; + value &= ~BufferUsage::Index; + } + if (value & BufferUsage::Vertex) { + if (!first) { + o << "|"; + } + first = false; + o << "Vertex"; + value &= ~BufferUsage::Vertex; + } + if (value & BufferUsage::Uniform) { + if (!first) { + o << "|"; + } + first = false; + o << "Uniform"; + value &= ~BufferUsage::Uniform; + } + if (value & BufferUsage::Storage) { + if (!first) { + o << "|"; + } + first = false; + o << "Storage"; + value &= ~BufferUsage::Storage; + } + if (value & BufferUsage::Indirect) { + if (!first) { + o << "|"; + } + first = false; + o << "Indirect"; + value &= ~BufferUsage::Indirect; + } + if (value & BufferUsage::QueryResolve) { + if (!first) { + o << "|"; + } + first = false; + o << "QueryResolve"; + value &= ~BufferUsage::QueryResolve; + } + + if (static_cast(value)) { + if (!first) { + o << "|"; + } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + + if (moreThanOneBit) { + o << ")"; + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, ColorWriteMask value) { + o << "ColorWriteMask::"; + if (!static_cast(value)) { + // 0 is often explicitly declared as None. + o << "None"; + return o; + } + + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } + + bool first = true; + if (value & ColorWriteMask::Red) { + if (!first) { + o << "|"; + } + first = false; + o << "Red"; + value &= ~ColorWriteMask::Red; + } + if (value & ColorWriteMask::Green) { + if (!first) { + o << "|"; + } + first = false; + o << "Green"; + value &= ~ColorWriteMask::Green; + } + if (value & ColorWriteMask::Blue) { + if (!first) { + o << "|"; + } + first = false; + o << "Blue"; + value &= ~ColorWriteMask::Blue; + } + if (value & ColorWriteMask::Alpha) { + if (!first) { + o << "|"; + } + first = false; + o << "Alpha"; + value &= ~ColorWriteMask::Alpha; + } + if (value & ColorWriteMask::All) { + if (!first) { + o << "|"; + } + first = false; + o << "All"; + value &= ~ColorWriteMask::All; + } + + if (static_cast(value)) { + if (!first) { + o << "|"; + } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + + if (moreThanOneBit) { + o << ")"; + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, HeapProperty value) { + o << "HeapProperty::"; + if (!static_cast(value)) { + // 0 is often explicitly declared as None. + o << "Undefined"; + return o; + } + + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } + + bool first = true; + if (value & HeapProperty::DeviceLocal) { + if (!first) { + o << "|"; + } + first = false; + o << "DeviceLocal"; + value &= ~HeapProperty::DeviceLocal; + } + if (value & HeapProperty::HostVisible) { + if (!first) { + o << "|"; + } + first = false; + o << "HostVisible"; + value &= ~HeapProperty::HostVisible; + } + if (value & HeapProperty::HostCoherent) { + if (!first) { + o << "|"; + } + first = false; + o << "HostCoherent"; + value &= ~HeapProperty::HostCoherent; + } + if (value & HeapProperty::HostUncached) { + if (!first) { + o << "|"; + } + first = false; + o << "HostUncached"; + value &= ~HeapProperty::HostUncached; + } + if (value & HeapProperty::HostCached) { + if (!first) { + o << "|"; + } + first = false; + o << "HostCached"; + value &= ~HeapProperty::HostCached; + } + + if (static_cast(value)) { + if (!first) { + o << "|"; + } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + + if (moreThanOneBit) { + o << ")"; + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, MapMode value) { + o << "MapMode::"; + if (!static_cast(value)) { + // 0 is often explicitly declared as None. + o << "None"; + return o; + } + + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } + + bool first = true; + if (value & MapMode::Read) { + if (!first) { + o << "|"; + } + first = false; + o << "Read"; + value &= ~MapMode::Read; + } + if (value & MapMode::Write) { + if (!first) { + o << "|"; + } + first = false; + o << "Write"; + value &= ~MapMode::Write; + } + + if (static_cast(value)) { + if (!first) { + o << "|"; + } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + + if (moreThanOneBit) { + o << ")"; + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, ShaderStage value) { + o << "ShaderStage::"; + if (!static_cast(value)) { + // 0 is often explicitly declared as None. + o << "None"; + return o; + } + + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } + + bool first = true; + if (value & ShaderStage::Vertex) { + if (!first) { + o << "|"; + } + first = false; + o << "Vertex"; + value &= ~ShaderStage::Vertex; + } + if (value & ShaderStage::Fragment) { + if (!first) { + o << "|"; + } + first = false; + o << "Fragment"; + value &= ~ShaderStage::Fragment; + } + if (value & ShaderStage::Compute) { + if (!first) { + o << "|"; + } + first = false; + o << "Compute"; + value &= ~ShaderStage::Compute; + } + + if (static_cast(value)) { + if (!first) { + o << "|"; + } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + + if (moreThanOneBit) { + o << ")"; + } + return o; + } + template + std::basic_ostream& operator<<(std::basic_ostream& o, TextureUsage value) { + o << "TextureUsage::"; + if (!static_cast(value)) { + // 0 is often explicitly declared as None. + o << "None"; + return o; + } + + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } + + bool first = true; + if (value & TextureUsage::CopySrc) { + if (!first) { + o << "|"; + } + first = false; + o << "CopySrc"; + value &= ~TextureUsage::CopySrc; + } + if (value & TextureUsage::CopyDst) { + if (!first) { + o << "|"; + } + first = false; + o << "CopyDst"; + value &= ~TextureUsage::CopyDst; + } + if (value & TextureUsage::TextureBinding) { + if (!first) { + o << "|"; + } + first = false; + o << "TextureBinding"; + value &= ~TextureUsage::TextureBinding; + } + if (value & TextureUsage::StorageBinding) { + if (!first) { + o << "|"; + } + first = false; + o << "StorageBinding"; + value &= ~TextureUsage::StorageBinding; + } + if (value & TextureUsage::RenderAttachment) { + if (!first) { + o << "|"; + } + first = false; + o << "RenderAttachment"; + value &= ~TextureUsage::RenderAttachment; + } + if (value & TextureUsage::TransientAttachment) { + if (!first) { + o << "|"; + } + first = false; + o << "TransientAttachment"; + value &= ~TextureUsage::TransientAttachment; + } + if (value & TextureUsage::StorageAttachment) { + if (!first) { + o << "|"; + } + first = false; + o << "StorageAttachment"; + value &= ~TextureUsage::StorageAttachment; + } + + if (static_cast(value)) { + if (!first) { + o << "|"; + } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + } + + if (moreThanOneBit) { + o << ")"; + } + return o; + } + +} // namespace wgpu + +#endif // WEBGPU_CPP_PRINT_H_ diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h b/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h new file mode 100644 index 0000000000..e98c8c5da0 --- /dev/null +++ b/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h @@ -0,0 +1,161 @@ +// Copyright 2017 The Dawn & Tint Authors +// +// 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_ENUM_CLASS_BITMASKS_H_ +#define WEBGPU_ENUM_CLASS_BITMASKS_H_ + +#include + +// The operators in wgpu:: namespace need be introduced into other namespaces with +// using-declarations for C++ Argument Dependent Lookup to work. +#define WGPU_IMPORT_BITMASK_OPERATORS \ + using wgpu::operator|; \ + using wgpu::operator&; \ + using wgpu::operator^; \ + using wgpu::operator~; \ + using wgpu::operator&=; \ + using wgpu::operator|=; \ + using wgpu::operator^=; \ + using wgpu::HasZeroOrOneBits; + +namespace wgpu { + +template +struct IsWGPUBitmask { + static constexpr bool enable = false; +}; + +template +struct LowerBitmask { + static constexpr bool enable = false; +}; + +template +struct LowerBitmask::enable>::type> { + static constexpr bool enable = true; + using type = T; + constexpr static T Lower(T t) { return t; } +}; + +template +struct BoolConvertible { + using Integral = typename std::underlying_type::type; + + // NOLINTNEXTLINE(runtime/explicit) + explicit constexpr BoolConvertible(Integral value) : value(value) {} + constexpr operator bool() const { return value != 0; } + constexpr operator T() const { return static_cast(value); } + + Integral value; +}; + +template +struct LowerBitmask> { + static constexpr bool enable = true; + using type = T; + static constexpr type Lower(BoolConvertible t) { return t; } +}; + +template < + typename T1, + typename T2, + typename = typename std::enable_if::enable && LowerBitmask::enable>::type> +constexpr BoolConvertible::type> operator|(T1 left, T2 right) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible(static_cast(LowerBitmask::Lower(left)) | + static_cast(LowerBitmask::Lower(right))); +} + +template < + typename T1, + typename T2, + typename = typename std::enable_if::enable && LowerBitmask::enable>::type> +constexpr BoolConvertible::type> operator&(T1 left, T2 right) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible(static_cast(LowerBitmask::Lower(left)) & + static_cast(LowerBitmask::Lower(right))); +} + +template < + typename T1, + typename T2, + typename = typename std::enable_if::enable && LowerBitmask::enable>::type> +constexpr BoolConvertible::type> operator^(T1 left, T2 right) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible(static_cast(LowerBitmask::Lower(left)) ^ + static_cast(LowerBitmask::Lower(right))); +} + +template +constexpr BoolConvertible::type> operator~(T1 t) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible(~static_cast(LowerBitmask::Lower(t))); +} + +template < + typename T, + typename T2, + typename = typename std::enable_if::enable && LowerBitmask::enable>::type> +constexpr T& operator&=(T& l, T2 right) { + T r = LowerBitmask::Lower(right); + l = l & r; + return l; +} + +template < + typename T, + typename T2, + typename = typename std::enable_if::enable && LowerBitmask::enable>::type> +constexpr T& operator|=(T& l, T2 right) { + T r = LowerBitmask::Lower(right); + l = l | r; + return l; +} + +template < + typename T, + typename T2, + typename = typename std::enable_if::enable && LowerBitmask::enable>::type> +constexpr T& operator^=(T& l, T2 right) { + T r = LowerBitmask::Lower(right); + l = l ^ r; + return l; +} + +template +constexpr bool HasZeroOrOneBits(T value) { + using Integral = typename std::underlying_type::type; + return (static_cast(value) & (static_cast(value) - 1)) == 0; +} + +} // namespace wgpu + +#endif // WEBGPU_ENUM_CLASS_BITMASKS_H_ diff --git a/scripts/generator/dawn.json b/scripts/generator/dawn.json index 9ef013214b..e777ef90d9 100644 --- a/scripts/generator/dawn.json +++ b/scripts/generator/dawn.json @@ -1,4 +1,44 @@ { + "_comment": [ + "Copyright 2017 The Dawn & Tint Authors", + "", + "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." + ], + + "_doc": "See docs/dawn/codegen.md", + + "_metadata": { + "api": "WebGPU", + "c_prefix": "WGPU", + "namespace": "wgpu", + "proc_table_prefix": "Dawn", + "native_namespace": "dawn native", + "copyright_year": "2019" + }, + "create instance": { "category": "function", "returns": "instance", @@ -55,9 +95,10 @@ "emscripten_no_enum_table": true, "values": [ {"value": 0, "name": "success"}, - {"value": 1, "name": "unavailable"}, - {"value": 2, "name": "error"}, - {"value": 3, "name": "unknown"} + {"value": 1, "name": "instance dropped"}, + {"value": 2, "name": "unavailable"}, + {"value": 3, "name": "error"}, + {"value": 4, "name": "unknown"} ] }, "adapter": { @@ -104,6 +145,16 @@ {"name": "userdata", "type": "void *"} ] }, + { + "name": "request device f", + "_comment": "TODO(crbug.com/dawn/2021): This is dawn/emscripten-only until we rename it to replace the old API. See bug for details.", + "tags": ["dawn", "emscripten"], + "returns": "future", + "args": [ + {"name": "options", "type": "device descriptor", "annotation": "const*", "optional": true, "no_default": true}, + {"name": "callback info", "type": "request device callback info"} + ] + }, { "name": "create device", "tags": ["dawn"], @@ -111,6 +162,15 @@ "args": [ {"name": "descriptor", "type": "device descriptor", "annotation": "const*", "optional": true} ] + }, + { + "name": "get format capabilities", + "tags": ["dawn"], + "returns": "bool", + "args": [ + {"name": "format", "type": "texture format"}, + {"name": "capabilities", "type": "format capabilities", "annotation": "*"} + ] } ] }, @@ -133,10 +193,10 @@ "category": "enum", "emscripten_no_enum_table": true, "values": [ - {"value": 0, "name": "discrete GPU"}, - {"value": 1, "name": "integrated GPU"}, - {"value": 2, "name": "CPU"}, - {"value": 3, "name": "unknown"} + {"value": 1, "name": "discrete GPU"}, + {"value": 2, "name": "integrated GPU"}, + {"value": 3, "name": "CPU"}, + {"value": 4, "name": "unknown"} ] }, "device descriptor": { @@ -164,21 +224,58 @@ {"name": "disabled toggles", "type": "char", "annotation": "const*const*", "length": "disabled toggle count"} ] }, + "dawn load cache data function": { + "tags": ["dawn", "native"], + "category": "function pointer", + "returns": "size_t", + "args": [ + {"name": "key", "type": "void const *"}, + {"name": "key size", "type": "size_t"}, + {"name": "value", "type": "void *"}, + {"name": "value size", "type": "size_t"}, + {"name": "userdata", "type": "void *"} + ] + }, + "dawn store cache data function": { + "tags": ["dawn", "native"], + "category": "function pointer", + "args": [ + {"name": "key", "type": "void const *"}, + {"name": "key size", "type": "size_t"}, + {"name": "value", "type": "void const *"}, + {"name": "value size", "type": "size_t"}, + {"name": "userdata", "type": "void *"} + ] + }, "dawn cache device descriptor" : { "tags": ["dawn", "native"], "category": "structure", "chained": "in", "chain roots": ["device descriptor"], "members": [ - {"name": "isolation key", "type": "char", "annotation": "const*", "length": "strlen", "default": "\"\""} + {"name": "isolation key", "type": "char", "annotation": "const*", "length": "strlen", "default": "\"\""}, + {"name": "load data function", "type": "dawn load cache data function", "default": "nullptr"}, + {"name": "store data function", "type": "dawn store cache data function", "default": "nullptr"}, + {"name": "function userdata", "type": "void *", "default": "nullptr"} + ] + }, + "dawn WGSL blocklist": { + "tags": ["dawn", "native"], + "category": "structure", + "chained": "in", + "chain roots": ["instance descriptor"], + "members": [ + {"name": "blocklisted feature count", "type": "size_t", "default": 0}, + {"name": "blocklisted features", "type": "char", "annotation": "const*const*", "length": "blocklisted feature count"} ] }, "address mode": { "category": "enum", "values": [ - {"value": 0, "name": "repeat"}, - {"value": 1, "name": "mirror repeat"}, - {"value": 2, "name": "clamp to edge"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "clamp to edge"}, + {"value": 2, "name": "repeat"}, + {"value": 3, "name": "mirror repeat"} ] }, "backend type": { @@ -278,7 +375,15 @@ {"name": "type", "type": "sampler binding type", "default": "undefined"} ] }, - + "static sampler binding layout": { + "category": "structure", + "chained": "in", + "chain roots": ["bind group layout entry"], + "tags": ["dawn"], + "members": [ + {"name": "sampler", "type": "sampler"} + ] + }, "texture sample type": { "category": "enum", "values": [ @@ -295,7 +400,7 @@ "extensible": "in", "members": [ {"name": "sample type", "type": "texture sample type", "default": "undefined"}, - {"name": "view dimension", "type": "texture view dimension", "default": "undefined"}, + {"name": "view dimension", "type": "texture view dimension", "default": "2D"}, {"name": "multisampled", "type": "bool", "default": "false"} ] }, @@ -358,8 +463,8 @@ "values": [ {"value": 0, "name": "undefined", "jsrepr": "undefined", "valid": false}, {"value": 1, "name": "write only"}, - {"value": 2, "name": "read only", "tags": ["dawn"]}, - {"value": 3, "name": "read write", "tags": ["dawn"]} + {"value": 2, "name": "read only"}, + {"value": 3, "name": "read write"} ] }, "storage texture binding layout": { @@ -368,7 +473,7 @@ "members": [ {"name": "access", "type": "storage texture access", "default": "undefined"}, {"name": "format", "type": "texture format", "default": "undefined"}, - {"name": "view dimension", "type": "texture view dimension", "default": "undefined"} + {"name": "view dimension", "type": "texture view dimension", "default": "2D"} ] }, @@ -404,34 +509,37 @@ }, "blend factor": { "category": "enum", + "_comment": "TODO(github.com/gpuweb/gpuweb/issues/4283): make sure the dual source blending names match the spec when it lands, and remove the tags.", "values": [ - {"value": 0, "name": "zero"}, - {"value": 1, "name": "one"}, - {"value": 2, "name": "src"}, - {"value": 3, "name": "one minus src"}, - {"value": 4, "name": "src alpha"}, - {"value": 5, "name": "one minus src alpha"}, - {"value": 6, "name": "dst"}, - {"value": 7, "name": "one minus dst"}, - {"value": 8, "name": "dst alpha"}, - {"value": 9, "name": "one minus dst alpha"}, - {"value": 10, "name": "src alpha saturated"}, - {"value": 11, "name": "constant"}, - {"value": 12, "name": "one minus constant"}, - {"value": 13, "name": "src1", "tags": ["dawn"]}, - {"value": 14, "name": "one minus src1", "tags": ["dawn"]}, - {"value": 15, "name": "src1 alpha", "tags": ["dawn"]}, - {"value": 16, "name": "one minus src1 alpha", "tags": ["dawn"]} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "zero"}, + {"value": 2, "name": "one"}, + {"value": 3, "name": "src"}, + {"value": 4, "name": "one minus src"}, + {"value": 5, "name": "src alpha"}, + {"value": 6, "name": "one minus src alpha"}, + {"value": 7, "name": "dst"}, + {"value": 8, "name": "one minus dst"}, + {"value": 9, "name": "dst alpha"}, + {"value": 10, "name": "one minus dst alpha"}, + {"value": 11, "name": "src alpha saturated"}, + {"value": 12, "name": "constant"}, + {"value": 13, "name": "one minus constant"}, + {"value": 14, "name": "src1", "tags": ["dawn"]}, + {"value": 15, "name": "one minus src1", "tags": ["dawn"]}, + {"value": 16, "name": "src1 alpha", "tags": ["dawn"]}, + {"value": 17, "name": "one minus src1 alpha", "tags": ["dawn"]} ] }, "blend operation": { "category": "enum", "values": [ - {"value": 0, "name": "add"}, - {"value": 1, "name": "subtract"}, - {"value": 2, "name": "reverse subtract"}, - {"value": 3, "name": "min"}, - {"value": 4, "name": "max"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "add"}, + {"value": 2, "name": "subtract"}, + {"value": 3, "name": "reverse subtract"}, + {"value": 4, "name": "min"}, + {"value": 5, "name": "max"} ] }, "bool": { @@ -554,22 +662,23 @@ "emscripten_no_enum_table": true, "values": [ {"value": 0, "name": "success"}, - {"value": 1, "name": "validation error"}, - {"value": 2, "name": "unknown"}, - {"value": 3, "name": "device lost"}, - {"value": 4, "name": "destroyed before callback"}, - {"value": 5, "name": "unmapped before callback"}, - {"value": 6, "name": "mapping already pending"}, - {"value": 7, "name": "offset out of range"}, - {"value": 8, "name": "size out of range"} + {"value": 1, "name": "instance dropped"}, + {"value": 2, "name": "validation error"}, + {"value": 3, "name": "unknown"}, + {"value": 4, "name": "device lost"}, + {"value": 5, "name": "destroyed before callback"}, + {"value": 6, "name": "unmapped before callback"}, + {"value": 7, "name": "mapping already pending"}, + {"value": 8, "name": "offset out of range"}, + {"value": 9, "name": "size out of range"} ] }, "buffer map state": { "category": "enum", "values": [ - {"value": 0, "name": "unmapped"}, - {"value": 1, "name": "pending"}, - {"value": 2, "name": "mapped"} + {"value": 1, "name": "unmapped"}, + {"value": 2, "name": "pending"}, + {"value": 3, "name": "mapped"} ] }, "buffer usage": { @@ -774,14 +883,14 @@ "compare function": { "category": "enum", "values": [ - {"value": 0, "name": "undefined", "jsrepr": "undefined", "valid": false}, + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, {"value": 1, "name": "never"}, {"value": 2, "name": "less"}, - {"value": 3, "name": "less equal"}, - {"value": 4, "name": "greater"}, - {"value": 5, "name": "greater equal"}, - {"value": 6, "name": "equal"}, - {"value": 7, "name": "not equal"}, + {"value": 3, "name": "equal"}, + {"value": 4, "name": "less equal"}, + {"value": 5, "name": "greater"}, + {"value": 6, "name": "not equal"}, + {"value": 7, "name": "greater equal"}, {"value": 8, "name": "always"} ] }, @@ -801,13 +910,23 @@ {"name": "userdata", "type": "void *"} ] }, + "compilation info callback info": { + "category": "structure", + "extensible": "in", + "members": [ + {"name": "mode", "type": "callback mode"}, + {"name": "callback", "type": "compilation info callback"}, + {"name": "userdata", "type": "void *", "default": "nullptr"} + ] + }, "compilation info request status": { "category": "enum", "values": [ {"value": 0, "name": "success"}, - {"value": 1, "name": "error"}, - {"value": 2, "name": "device lost"}, - {"value": 3, "name": "unknown"} + {"value": 1, "name": "instance dropped"}, + {"value": 2, "name": "error"}, + {"value": 3, "name": "device lost"}, + {"value": 4, "name": "unknown"} ] }, "compilation message": { @@ -829,9 +948,9 @@ "category": "enum", "emscripten_no_enum_table": true, "values": [ - {"value": 0, "name": "error"}, - {"value": 1, "name": "warning"}, - {"value": 2, "name": "info"} + {"value": 1, "name": "error"}, + {"value": 2, "name": "warning"}, + {"value": 3, "name": "info"} ] }, "compute pass descriptor": { @@ -963,6 +1082,7 @@ "category": "structure", "chained": "in", "chain roots": ["compute pipeline descriptor"], + "tags": ["dawn"], "members": [ {"name": "requires full subgroups", "type": "bool", "default": "false"} ] @@ -971,9 +1091,9 @@ "category": "enum", "tags": ["dawn"], "values": [ - {"value": 0, "name": "premultiplied"}, - {"value": 1, "name": "unpremultiplied"}, - {"value": 2, "name": "opaque"} + {"value": 1, "name": "opaque"}, + {"value": 2, "name": "premultiplied"}, + {"value": 3, "name": "unpremultiplied"} ] }, "copy texture for browser options": { @@ -1003,16 +1123,26 @@ {"name": "userdata", "type": "void *"} ] }, + "create compute pipeline async callback info": { + "category": "structure", + "extensible": "in", + "members": [ + {"name": "mode", "type": "callback mode"}, + {"name": "callback", "type": "create compute pipeline async callback"}, + {"name": "userdata", "type": "void *"} + ] + }, "create pipeline async status": { "category": "enum", "emscripten_no_enum_table": true, "values": [ {"value": 0, "name": "success"}, - {"value": 1, "name": "validation error"}, - {"value": 2, "name": "internal error"}, - {"value": 3, "name": "device lost"}, - {"value": 4, "name": "device destroyed"}, - {"value": 5, "name": "unknown"} + {"value": 1, "name": "instance dropped"}, + {"value": 2, "name": "validation error"}, + {"value": 3, "name": "internal error"}, + {"value": 4, "name": "device lost"}, + {"value": 5, "name": "device destroyed"}, + {"value": 6, "name": "unknown"} ] }, "create render pipeline async callback": { @@ -1024,12 +1154,22 @@ {"name": "userdata", "type": "void *"} ] }, + "create render pipeline async callback info": { + "category": "structure", + "extensible": "in", + "members": [ + {"name": "mode", "type": "callback mode"}, + {"name": "callback", "type": "create render pipeline async callback"}, + {"name": "userdata", "type": "void *"} + ] + }, "cull mode": { "category": "enum", "values": [ - {"value": 0, "name": "none"}, - {"value": 1, "name": "front"}, - {"value": 2, "name": "back"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "none"}, + {"value": 2, "name": "front"}, + {"value": 3, "name": "back"} ] }, "device": { @@ -1051,6 +1191,7 @@ }, { "name": "create buffer", + "no autolock": true, "returns": "buffer", "args": [ {"name": "descriptor", "type": "buffer descriptor", "annotation": "const*"} @@ -1073,6 +1214,7 @@ }, { "name": "create compute pipeline", + "no autolock": true, "returns": "compute pipeline", "args": [ {"name": "descriptor", "type": "compute pipeline descriptor", "annotation": "const*"} @@ -1087,6 +1229,16 @@ {"name": "userdata", "type": "void *"} ] }, + { + "name": "create compute pipeline async f", + "_comment": "TODO(crbug.com/dawn/2021): This is dawn/emscripten-only until we rename it to replace the old API. See bug for details.", + "tags": ["dawn", "emscripten"], + "returns": "future", + "args": [ + {"name": "descriptor", "type": "compute pipeline descriptor", "annotation": "const*"}, + {"name": "callback info", "type": "create compute pipeline async callback info"} + ] + }, { "name": "create external texture", "returns": "external texture", @@ -1123,6 +1275,16 @@ {"name": "userdata", "type": "void *"} ] }, + { + "name": "create render pipeline async f", + "_comment": "TODO(crbug.com/dawn/2021): This is dawn/emscripten-only until we rename it to replace the old API. See bug for details.", + "tags": ["dawn", "emscripten"], + "returns": "future", + "args": [ + {"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"}, + {"name": "callback info", "type": "create render pipeline async callback info"} + ] + }, { "name": "create render bundle encoder", "returns": "render bundle encoder", @@ -1132,6 +1294,7 @@ }, { "name": "create render pipeline", + "no autolock": true, "returns": "render pipeline", "args": [ {"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"} @@ -1146,6 +1309,7 @@ }, { "name": "create shader module", + "no autolock": true, "returns": "shader module", "args": [ {"name": "descriptor", "type": "shader module descriptor", "annotation": "const*"} @@ -1176,6 +1340,14 @@ {"name": "descriptor", "type": "texture descriptor", "annotation": "const*"} ] }, + { + "name": "import shared buffer memory", + "returns": "shared buffer memory", + "tags": ["dawn", "native"], + "args": [ + {"name": "descriptor", "type": "shared buffer memory descriptor", "annotation": "const*"} + ] + }, { "name": "import shared texture memory", "returns": "shared texture memory", @@ -1288,11 +1460,21 @@ }, { "name": "pop error scope", + "no autolock": true, "args": [ - {"name": "callback", "type": "error callback"}, + {"name": "old callback", "type": "error callback"}, {"name": "userdata", "type": "void *"} ] }, + { + "name": "pop error scope f", + "_comment": "TODO(crbug.com/dawn/2021): This is dawn/emscripten-only until we rename it to replace the old API. See bug for details.", + "tags": ["dawn", "emscripten"], + "returns": "future", + "args": [ + {"name": "callback info", "type": "pop error scope callback info"} + ] + }, { "name": "set label", "returns": "void", @@ -1344,6 +1526,33 @@ {"name": "userdata", "type": "void *"} ] }, + "pop error scope status": { + "category": "enum", + "emscripten_no_enum_table": true, + "values": [ + {"value": 0, "name": "success"}, + {"value": 1, "name": "instance dropped"} + ] + }, + "pop error scope callback": { + "category": "function pointer", + "args": [ + {"name": "status", "type": "pop error scope status"}, + {"name": "type", "type": "error type"}, + {"name": "message", "type": "char", "annotation": "const*", "length": "strlen"}, + {"name": "userdata", "type": "void *"} + ] + }, + "pop error scope callback info": { + "category": "structure", + "extensible": "in", + "members": [ + {"name": "mode", "type": "callback mode"}, + {"name": "callback", "type": "pop error scope callback"}, + {"name": "old callback", "type": "error callback", "_comment": "TODO(crbug.com/dawn/2021) Deprecate this field once we have moved callers to use the new callback signature."}, + {"name": "userdata", "type": "void *", "default": "nullptr"} + ] + }, "limits": { "category": "structure", "members": [ @@ -1385,6 +1594,7 @@ "category": "structure", "chained": "out", "chain roots": ["supported limits"], + "tags": ["dawn"], "members": [ {"name": "min subgroup size", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, {"name": "max subgroup size", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"} @@ -1416,9 +1626,9 @@ "error filter": { "category": "enum", "values": [ - {"value": 0, "name": "validation"}, - {"value": 1, "name": "out of memory"}, - {"value": 2, "name": "internal"} + {"value": 1, "name": "validation"}, + {"value": 2, "name": "out of memory"}, + {"value": 3, "name": "internal"} ] }, "error type": { @@ -1437,10 +1647,10 @@ "category": "enum", "tags": ["dawn"], "values": [ - {"value": 0, "name": "verbose"}, - {"value": 1, "name": "info"}, - {"value": 2, "name": "warning"}, - {"value": 3, "name": "error"} + {"value": 1, "name": "verbose"}, + {"value": 2, "name": "info"}, + {"value": 3, "name": "warning"}, + {"value": 4, "name": "error"} ] }, "extent 2D": { @@ -1487,6 +1697,7 @@ "external texture rotation":{ "category": "enum", "tags": ["dawn"], + "_comment": "ANGLEs are clockwise rotation degrees and not trigonometric.", "values": [ {"value": 0, "name": "rotate 0 degrees"}, {"value": 1, "name": "rotate 90 degrees"}, @@ -1498,6 +1709,7 @@ "category": "structure", "extensible": "in", "tags": ["dawn"], + "_comment": "TODO(crbug.com/1514732): deprecate flipY", "members": [ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "plane 0", "type": "texture view"}, @@ -1513,10 +1725,76 @@ "length": 7}, {"name": "gamut conversion matrix", "type": "float", "annotation": "const*", "length": 9}, - {"name": "flip y", "type": "bool", "default": "false"}, + {"name": "flip y", "type": "bool", "default": "false", "tags": ["deprecated"]}, + {"name": "mirrored", "type": "bool", "default": "false"}, {"name": "rotation", "type": "external texture rotation", "default": "rotate 0 degrees"} ] }, + "shared buffer memory": { + "category": "object", + "tags": ["dawn", "native"], + "methods": [ + { + "name": "set label", + "returns": "void", + "args": [ + {"name": "label", "type": "char", "annotation": "const*", "length": "strlen"} + ] + }, + { + "name": "get properties", + "returns": "void", + "args": [ + {"name": "properties", "type": "shared buffer memory properties", "annotation": "*"} + ] + }, + { + "name": "create buffer", + "returns": "buffer", + "args": [ + {"name": "descriptor", "type": "buffer descriptor", "annotation": "const*", "optional": true, "default": "nullptr"} + ] + }, + { + "name": "begin access", + "returns": "bool", + "args": [ + {"name": "buffer", "type": "buffer"}, + {"name": "descriptor", "type": "shared buffer memory begin access descriptor", "annotation": "const*"} + ] + }, + { + "name": "end access", + "returns": "bool", + "args": [ + {"name": "buffer", "type": "buffer"}, + {"name": "descriptor", "type": "shared buffer memory end access state", "annotation": "*"} + ] + }, + { + "name": "is device lost", + "returns": "bool", + "args": [] + } + ] + }, + "shared buffer memory properties": { + "category": "structure", + "extensible": "out", + "tags": ["dawn", "native"], + "members": [ + {"name": "usage", "type": "buffer usage"}, + {"name": "size", "type": "uint64_t"} + ] + }, + "shared buffer memory descriptor": { + "category": "structure", + "extensible": "in", + "tags": ["dawn", "native"], + "members": [ + {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} + ] + }, "shared texture memory": { "category": "object", "tags": ["dawn", "native"], @@ -1583,6 +1861,28 @@ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} ] }, + "shared buffer memory begin access descriptor": { + "category": "structure", + "extensible": "in", + "tags": ["dawn", "native"], + "members": [ + {"name": "initialized", "type": "bool"}, + {"name": "fence count", "type": "size_t"}, + {"name": "fences", "type": "shared fence", "annotation": "const*", "length": "fence count"}, + {"name": "signaled values", "type": "uint64_t", "annotation": "const*", "length": "fence count"} + ] + }, + "shared buffer memory end access state": { + "category": "structure", + "extensible": "out", + "tags": ["dawn", "native"], + "members": [ + {"name": "initialized", "type": "bool"}, + {"name": "fence count", "type": "size_t"}, + {"name": "fences", "type": "shared fence", "annotation": "const*", "length": "fence count"}, + {"name": "signaled values", "type": "uint64_t", "annotation": "const*", "length": "fence count"} + ] + }, "shared texture memory vk image descriptor": { "category": "structure", "chained": "in", @@ -1640,8 +1940,11 @@ "chain roots": ["shared texture memory descriptor"], "tags": ["dawn", "native"], "members": [ + {"name": "vk image create info", "type": "void const *"}, {"name": "memory FD", "type": "int"}, - {"name": "allocation size", "type": "uint64_t"} + {"name": "memory type index", "type": "uint32_t"}, + {"name": "allocation size", "type": "uint64_t"}, + {"name": "dedicated allocation", "type": "bool"} ] }, "shared texture memory zircon handle descriptor": { @@ -1661,7 +1964,8 @@ "tags": ["dawn", "native"], "_comment": "TODO(crbug.com/dawn/1745): improve type safety", "members": [ - {"name": "handle", "type": "void *"} + {"name": "handle", "type": "void *"}, + {"name": "use keyed mutex", "type": "bool"} ] }, "shared texture memory IO surface descriptor": { @@ -1689,6 +1993,7 @@ "extensible": "in", "tags": ["dawn", "native"], "members": [ + {"name": "concurrent read", "type": "bool"}, {"name": "initialized", "type": "bool"}, {"name": "fence count", "type": "size_t"}, {"name": "fences", "type": "shared fence", "annotation": "const*", "length": "fence count"}, @@ -1875,12 +2180,11 @@ {"value": 8, "name": "shader f16"}, {"value": 9, "name": "RG11B10 ufloat renderable"}, {"value": 10, "name": "BGRA8 unorm storage"}, - {"value": 11, "name": "float32 filterable"}, + {"value": 11, "name": "float32 filterable", "jsrepr": "'float32-filterable'"}, {"value": 1002, "name": "dawn internal usages", "tags": ["dawn"]}, {"value": 1003, "name": "dawn multi planar formats", "tags": ["dawn"]}, {"value": 1004, "name": "dawn native", "tags": ["dawn", "native"]}, - {"value": 1005, "name": "chromium experimental dp4a", "tags": ["dawn"]}, {"value": 1006, "name": "chromium experimental timestamp query inside passes", "tags": ["dawn"]}, {"value": 1007, "name": "implicit device synchronization", "tags": ["dawn", "native"]}, {"value": 1008, "name": "surface capabilities", "tags": ["dawn", "native"]}, @@ -1893,15 +2197,22 @@ {"value": 1015, "name": "chromium experimental subgroup uniform control flow", "tags": ["dawn"]}, {"value": 1017, "name": "pixel local storage coherent", "tags": ["dawn"]}, {"value": 1018, "name": "pixel local storage non coherent", "tags": ["dawn"]}, - {"value": 1019, "name": "norm16 texture formats", "tags": ["dawn"]}, - {"value": 1020, "name": "multi planar format extended usages", "tags": ["dawn"]}, - {"value": 1021, "name": "multi planar format p010", "tags": ["dawn"]}, - {"value": 1022, "name": "host mapped pointer", "tags": ["dawn"]}, - {"value": 1023, "name": "multi planar render targets", "tags": ["dawn"]}, - {"value": 1024, "name": "multi planar format nv12a", "tags": ["dawn"]}, - {"value": 1025, "name": "framebuffer fetch", "tags": ["dawn"]}, - {"value": 1026, "name": "buffer map extended usages", "tags": ["dawn"]}, - {"value": 1027, "name": "adapter properties memory heaps", "tags": ["dawn"]}, + {"value": 1019, "name": "unorm16 texture formats", "tags": ["dawn"]}, + {"value": 1020, "name": "snorm16 texture formats", "tags": ["dawn"]}, + {"value": 1021, "name": "multi planar format extended usages", "tags": ["dawn"]}, + {"value": 1022, "name": "multi planar format p010", "tags": ["dawn"]}, + {"value": 1023, "name": "host mapped pointer", "tags": ["dawn"]}, + {"value": 1024, "name": "multi planar render targets", "tags": ["dawn"]}, + {"value": 1025, "name": "multi planar format nv12a", "tags": ["dawn"]}, + {"value": 1026, "name": "framebuffer fetch", "tags": ["dawn"]}, + {"value": 1027, "name": "buffer map extended usages", "tags": ["dawn"]}, + {"value": 1028, "name": "adapter properties memory heaps", "tags": ["dawn"]}, + {"value": 1029, "name": "adapter properties D3D", "tags": ["dawn"]}, + {"value": 1030, "name": "adapter properties vk", "tags": ["dawn"]}, + {"value": 1031, "name": "r8 unorm storage", "tags": ["dawn"]}, + {"value": 1032, "name": "format capabilities", "tags": ["dawn"]}, + {"value": 1033, "name": "drm format capabilities", "tags": ["dawn"]}, + {"value": 1034, "name": "norm16 texture formats", "tags": ["dawn"]}, {"value": 1100, "name": "shared texture memory vk dedicated allocation", "tags": ["dawn", "native"]}, {"value": 1101, "name": "shared texture memory a hardware buffer", "tags": ["dawn", "native"]}, @@ -1916,24 +2227,52 @@ {"value": 1201, "name": "shared fence vk semaphore sync FD", "tags": ["dawn", "native"]}, {"value": 1202, "name": "shared fence vk semaphore zircon handle", "tags": ["dawn", "native"]}, {"value": 1203, "name": "shared fence DXGI shared handle", "tags": ["dawn", "native"]}, - {"value": 1204, "name": "shared fence MTL shared event", "tags": ["dawn", "native"]} + {"value": 1204, "name": "shared fence MTL shared event", "tags": ["dawn", "native"]}, + {"value": 1205, "name": "shared buffer memory D3D12 resource", "tags": ["dawn", "native"]}, + {"value": 1206, "name": "static samplers", "tags": ["dawn"]} ] }, "filter mode": { "category": "enum", "values": [ - {"value": 0, "name": "nearest"}, - {"value": 1, "name": "linear"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "nearest"}, + {"value": 2, "name": "linear"} ] }, "float": { "category": "native" }, + "format capabilities": { + "category": "structure", + "tags": ["dawn"], + "extensible": "out", + "members": [] + }, + "drm format capabilities": { + "category": "structure", + "tags": ["dawn"], + "chained": "out", + "chain roots": ["format capabilities"], + "members": [ + {"name": "properties count", "type": "size_t"}, + {"name": "properties", "type": "drm format properties", "annotation": "const*", "length": "properties count"} + ] + }, + "drm format properties": { + "category": "structure", + "tags": ["dawn"], + "members": [ + {"name": "modifier", "type": "uint64_t"}, + {"name": "modifier plane count", "type": "uint32_t"} + ] + }, "front face": { "category": "enum", "values": [ - {"value": 0, "name": "CCW"}, - {"value": 1, "name": "CW"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "CCW"}, + {"value": 2, "name": "CW"} ] }, "image copy buffer": { @@ -2031,10 +2370,12 @@ }, "callback mode": { "category": "enum", + "emscripten_no_enum_table": true, + "_comment": "TODO(crbug.com/dawn/2224): Should this be renumbered to reserve 0?", "values": [ - {"name": "wait any only", "value": 0}, - {"name": "allow process events", "value": 1}, - {"name": "allow spontaneous", "value": 2} + {"value": 0, "name": "wait any only"}, + {"value": 1, "name": "allow process events"}, + {"value": 2, "name": "allow spontaneous"} ] }, "future": { @@ -2048,12 +2389,12 @@ "_comment": "TODO(crbug.com/dawn/2053): This could possibly be [[nodiscard]].", "emscripten_no_enum_table": true, "values": [ - {"name": "success", "value": 0}, - {"name": "timed out", "value": 1}, - {"name": "unsupported timeout", "value": 2}, - {"name": "unsupported count", "value": 3}, - {"name": "unsupported mixed sources", "value": 4}, - {"name": "unknown", "value": 5} + {"value": 0, "name": "success"}, + {"value": 1, "name": "timed out"}, + {"value": 2, "name": "unsupported timeout"}, + {"value": 3, "name": "unsupported count"}, + {"value": 4, "name": "unsupported mixed sources"}, + {"value": 5, "name": "unknown"} ] }, "future wait info": { @@ -2086,6 +2427,17 @@ {"name": "features", "type": "instance features", "annotation": "*"} ] }, + "dawn wire WGSL control": { + "category": "structure", + "tags": ["dawn"], + "chained": "in", + "chain roots": ["instance descriptor"], + "members": [ + {"name": "enable experimental", "type": "bool", "default": "false"}, + {"name": "enable unsafe", "type": "bool", "default": "false"}, + {"name": "enable testing", "type": "bool", "default": "false"} + ] + }, "vertex attribute": { "category": "structure", "extensible": false, @@ -2108,9 +2460,10 @@ "vertex step mode": { "category": "enum", "values": [ - {"value": 0, "name": "vertex"}, - {"value": 1, "name": "instance"}, - {"value": 2, "name": "vertex buffer not used", "jsrepr": "undefined", "valid": true} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "vertex buffer not used"}, + {"value": 2, "name": "vertex"}, + {"value": 3, "name": "instance"} ] }, "load op": { @@ -2132,8 +2485,9 @@ "mipmap filter mode": { "category": "enum", "values": [ - {"value": 0, "name": "nearest"}, - {"value": 1, "name": "linear"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "nearest"}, + {"value": 2, "name": "linear"} ] }, "store op": { @@ -2213,10 +2567,10 @@ "category": "enum", "emscripten_no_enum_table": true, "values": [ - {"value": 0, "name": "fifo"}, - {"value": 1, "name": "fifo relaxed", "tags": ["upstream"]}, - {"value": 2, "name": "immediate"}, - {"value": 3, "name": "mailbox"} + {"value": 1, "name": "fifo"}, + {"value": 2, "name": "fifo relaxed", "tags": ["upstream"]}, + {"value": 3, "name": "immediate"}, + {"value": 4, "name": "mailbox"} ] }, "programmable stage descriptor": { @@ -2232,11 +2586,12 @@ "primitive topology": { "category": "enum", "values": [ - {"value": 0, "name": "point list"}, - {"value": 1, "name": "line list"}, - {"value": 2, "name": "line strip"}, - {"value": 3, "name": "triangle list"}, - {"value": 4, "name": "triangle strip"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "point list"}, + {"value": 2, "name": "line list"}, + {"value": 3, "name": "line strip"}, + {"value": 4, "name": "triangle list"}, + {"value": 5, "name": "triangle strip"} ] }, "query set": { @@ -2274,8 +2629,8 @@ "query type": { "category": "enum", "values": [ - {"value": 0, "name": "occlusion"}, - {"value": 1, "name": "timestamp"} + {"value": 1, "name": "occlusion"}, + {"value": 2, "name": "timestamp"} ] }, "queue": { @@ -2392,9 +2747,10 @@ "emscripten_no_enum_table": true, "values": [ {"value": 0, "name": "success"}, - {"value": 1, "name": "error"}, - {"value": 2, "name": "unknown"}, - {"value": 3, "name": "device lost"} + {"value": 1, "name": "instance dropped"}, + {"value": 2, "name": "error"}, + {"value": 3, "name": "unknown"}, + {"value": 4, "name": "device lost"} ] }, @@ -2812,14 +3168,24 @@ {"name": "userdata", "type": "void *"} ] }, + "request device callback info": { + "category": "structure", + "extensible": "in", + "members": [ + {"name": "mode", "type": "callback mode"}, + {"name": "callback", "type": "request device callback"}, + {"name": "userdata", "type": "void *"} + ] + }, "request device status": { "category": "enum", "emscripten_no_enum_table": true, "values": [ {"value": 0, "name": "success"}, - {"value": 1, "name": "error"}, - {"value": 2, "name": "unknown"} + {"value": 1, "name": "instance dropped"}, + {"value": 2, "name": "error"}, + {"value": 3, "name": "unknown"} ] }, @@ -2986,6 +3352,15 @@ {"name": "userdata", "type": "void *"} ] }, + { + "name": "get compilation info f", + "_comment": "TODO(crbug.com/dawn/2021): This is dawn/emscripten-only until we rename it to replace the old API. See bug for details.", + "tags": ["dawn", "emscripten"], + "returns": "future", + "args": [ + {"name": "callback info", "type": "compilation info callback info"} + ] + }, { "name": "set label", "returns": "void", @@ -3051,14 +3426,15 @@ "stencil operation": { "category": "enum", "values": [ - {"value": 0, "name": "keep"}, - {"value": 1, "name": "zero"}, - {"value": 2, "name": "replace"}, - {"value": 3, "name": "invert"}, - {"value": 4, "name": "increment clamp"}, - {"value": 5, "name": "decrement clamp"}, - {"value": 6, "name": "increment wrap"}, - {"value": 7, "name": "decrement wrap"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "keep"}, + {"value": 2, "name": "zero"}, + {"value": 3, "name": "replace"}, + {"value": 4, "name": "invert"}, + {"value": 5, "name": "increment clamp"}, + {"value": 6, "name": "decrement clamp"}, + {"value": 7, "name": "increment wrap"}, + {"value": 8, "name": "decrement wrap"} ] }, "stencil face state": { @@ -3103,7 +3479,6 @@ { "name": "get preferred format", "returns": "texture format", - "tags": ["upstream", "emscripten"], "args": [ {"name": "adapter", "type": "adapter"} ] @@ -3284,7 +3659,12 @@ {"value": 1017, "name": "buffer host mapped pointer", "tags": ["dawn"]}, {"value": 1018, "name": "dawn experimental subgroup limits", "tags": ["dawn"]}, {"value": 1019, "name": "adapter properties memory heaps", "tags": ["dawn"]}, - {"value": 1020, "name": "dawn compute pipeline full subgroups", "tags": ["dawn"]}, + {"value": 1020, "name": "adapter properties D3D", "tags": ["dawn"]}, + {"value": 1021, "name": "adapter properties vk", "tags": ["dawn"]}, + {"value": 1022, "name": "dawn compute pipeline full subgroups", "tags": ["dawn"]}, + {"value": 1023, "name": "dawn wire WGSL control", "tags": ["dawn"]}, + {"value": 1024, "name": "dawn WGSL blocklist", "tags": ["dawn", "native"]}, + {"value": 1025, "name": "drm format capabilities", "tags": ["dawn"]}, {"value": 1100, "name": "shared texture memory vk image descriptor", "tags": ["dawn", "native"]}, {"value": 1101, "name": "shared texture memory vk dedicated allocation descriptor", "tags": ["dawn", "native"]}, @@ -3309,7 +3689,9 @@ {"value": 1210, "name": "shared fence DXGI shared handle descriptor", "tags": ["dawn", "native"]}, {"value": 1211, "name": "shared fence DXGI shared handle export info", "tags": ["dawn", "native"]}, {"value": 1212, "name": "shared fence MTL shared event descriptor", "tags": ["dawn", "native"]}, - {"value": 1213, "name": "shared fence MTL shared event export info", "tags": ["dawn", "native"]} + {"value": 1213, "name": "shared fence MTL shared event export info", "tags": ["dawn", "native"]}, + {"value": 1214, "name": "shared buffer memory D3D12 resource descriptor", "tags": ["dawn", "native"]}, + {"value": 1215, "name": "static sampler binding layout", "tags": ["dawn"]} ] }, "texture": { @@ -3322,6 +3704,14 @@ {"name": "descriptor", "type": "texture view descriptor", "annotation": "const*", "optional": true} ] }, + { + "name": "create error view", + "returns": "texture view", + "tags": ["dawn"], + "args": [ + {"name": "descriptor", "type": "texture view descriptor", "annotation": "const*", "optional": true} + ] + }, { "name": "set label", "returns": "void", @@ -3381,12 +3771,13 @@ "texture aspect": { "category": "enum", "values": [ - {"value": 0, "name": "all"}, - {"value": 1, "name": "stencil only"}, - {"value": 2, "name": "depth only"}, - {"value": 3, "name": "plane 0 only", "tags": ["dawn"]}, - {"value": 4, "name": "plane 1 only", "tags": ["dawn"]}, - {"value": 5, "name": "plane 2 only", "tags": ["dawn"]} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "all"}, + {"value": 2, "name": "stencil only"}, + {"value": 3, "name": "depth only"}, + {"value": 4, "name": "plane 0 only", "tags": ["dawn"]}, + {"value": 5, "name": "plane 1 only", "tags": ["dawn"]}, + {"value": 6, "name": "plane 2 only", "tags": ["dawn"]} ] }, "texture data layout": { @@ -3424,15 +3815,16 @@ "texture dimension": { "category": "enum", "values": [ - {"value": 0, "name": "1D"}, - {"value": 1, "name": "2D"}, - {"value": 2, "name": "3D"} + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, + {"value": 1, "name": "1D"}, + {"value": 2, "name": "2D"}, + {"value": 3, "name": "3D"} ] }, "texture format": { "category": "enum", "values": [ - {"value": 0, "name": "undefined", "valid": false, "jsrepr": "undefined"}, + {"value": 0, "name": "undefined", "jsrepr": "undefined", "valid": false}, {"value": 1, "name": "R8 unorm"}, {"value": 2, "name": "R8 snorm"}, @@ -3592,7 +3984,7 @@ "texture view dimension": { "category": "enum", "values": [ - {"value": 0, "name": "undefined", "valid": false, "jsrepr": "undefined"}, + {"value": 0, "name": "undefined", "jsrepr": "undefined"}, {"value": 1, "name": "1D"}, {"value": 2, "name": "2D"}, {"value": 3, "name": "2D array"}, @@ -3604,7 +3996,7 @@ "vertex format": { "category": "enum", "values": [ - {"value": 0, "name": "undefined", "valid": false, "jsrepr": "undefined"}, + {"value": 0, "name": "undefined", "jsrepr": "undefined", "valid": false}, {"value": 1, "name": "uint8x2"}, {"value": 2, "name": "uint8x4"}, {"value": 3, "name": "sint8x2"}, @@ -3642,15 +4034,15 @@ "category": "enum", "values": [ {"value": 0, "name": "undefined", "valid": false, "jsrepr": "undefined"}, - {"value": 1, "name": "readonly and readwrite storage textures"}, - {"value": 2, "name": "packed 4x8 integer dot product"}, - {"value": 3, "name": "unrestricted pointer parameters"}, - {"value": 4, "name": "pointer composite access"}, - {"value": 1000, "name": "chromium testing unimplemented", "tags": ["dawn"]}, - {"value": 1001, "name": "chromium testing unsafe experimental", "tags": ["dawn"]}, - {"value": 1002, "name": "chromium testing experimental", "tags": ["dawn"]}, - {"value": 1003, "name": "chromium testing shipped with killswitch", "tags": ["dawn"]}, - {"value": 1004, "name": "chromium testing shipped", "tags": ["dawn"]} + {"value": 1, "name": "readonly and readwrite storage textures", "jsrepr": "'readonly_and_readwrite_storage_textures'"}, + {"value": 2, "name": "packed 4x8 integer dot product", "jsrepr": "'packed_4x8_integer_dot_product'"}, + {"value": 3, "name": "unrestricted pointer parameters", "jsrepr": "'unrestricted_pointer_parameters'"}, + {"value": 4, "name": "pointer composite access", "jsrepr": "'pointer_composite_access'"}, + {"value": 1000, "name": "chromium testing unimplemented", "jsrepr": "'chromium_testing_unimplemented'", "tags": ["dawn"]}, + {"value": 1001, "name": "chromium testing unsafe experimental", "jsrepr": "'chromium_testing_unsafe_experimental'", "tags": ["dawn"]}, + {"value": 1002, "name": "chromium testing experimental", "jsrepr": "'chromium_testing_experimental'", "tags": ["dawn"]}, + {"value": 1003, "name": "chromium testing shipped with killswitch", "jsrepr": "'chromium_testing_shipped_with_killswitch'", "tags": ["dawn"]}, + {"value": 1004, "name": "chromium testing shipped", "jsrepr": "'chromium_testing_shipped'", "tags": ["dawn"]} ] }, "whole size" : { @@ -3691,7 +4083,7 @@ "depth slice undefined" : { "category": "constant", "type": "uint32_t", - "value": "(0xffffffffUL)" + "value": "UINT32_MAX" }, "query set index undefined" : { "category": "constant", @@ -3798,6 +4190,24 @@ {"name": "heap info", "type": "memory heap info", "annotation": "const*", "length": "heap count"} ] }, + "adapter properties D3D": { + "category": "structure", + "chained": "out", + "chain roots": ["adapter properties"], + "tags": ["dawn"], + "members": [ + {"name": "shader model", "type": "uint32_t"} + ] + }, + "adapter properties vk": { + "category": "structure", + "chained": "out", + "chain roots": ["adapter properties"], + "tags": ["dawn"], + "members": [ + {"name": "driver version", "type": "uint32_t"} + ] + }, "dawn buffer descriptor error info from wire client": { "category": "structure", "chained": "in", diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index ade249cc92..5d5092dff0 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -179,7 +179,7 @@ export const generateObject = (object: JSIObject) => { #include #include -#include "dawn/webgpu_cpp.h" +#include "webgpu/webgpu_cpp.h" #include From 979c447810f79d1fd52b732a14b2d18a6017e9a3 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 16:08:15 +0200 Subject: [PATCH 05/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 23 +------ example/src/Examples/Breathe/demo2.ts | 77 ++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 21 deletions(-) create mode 100644 example/src/Examples/Breathe/demo2.ts diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 70ee72aa67..0db29c30eb 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -3,29 +3,10 @@ import { gpu, SkiaDomView, } from "@shopify/react-native-skia"; -import { demo1 } from "./demo1/main"; - -const triangleVertWGSL = `@vertex -fn main( - @builtin(vertex_index) VertexIndex : u32 -) -> @builtin(position) vec4f { - var pos = array( - vec2(0.0, 0.5), - vec2(-0.5, -0.5), - vec2(0.5, -0.5) - ); - - return vec4f(pos[VertexIndex], 0.0, 1.0); -} -`; - -const redFragWGSL = `@fragment -fn main() -> @location(0) vec4f { - return vec4(0.3, 0.6, 1.0, 1.0); -}`; +import { demo2 } from "./demo2"; const draw = async (ctx: GPUCanvasContext) => { - await demo1(ctx); + await demo2(ctx); ctx.present(); }; diff --git a/example/src/Examples/Breathe/demo2.ts b/example/src/Examples/Breathe/demo2.ts new file mode 100644 index 0000000000..11aa8d5c10 --- /dev/null +++ b/example/src/Examples/Breathe/demo2.ts @@ -0,0 +1,77 @@ +import { gpu } from "@shopify/react-native-skia"; + +const triangleVertWGSL = `@vertex +fn main( + @builtin(vertex_index) VertexIndex : u32 +) -> @builtin(position) vec4f { + var pos = array( + vec2(0.0, 0.5), + vec2(-0.5, -0.5), + vec2(0.5, -0.5) + ); + + return vec4f(pos[VertexIndex], 0.0, 1.0); +} +`; + +const redFragWGSL = `@fragment +fn main() -> @location(0) vec4f { + return vec4(0.3, 0.6, 1.0, 1.0); +}`; + + +export const demo2 = async(context: GPUCanvasContext) => { + const adapter = await gpu.requestAdapter(); + const device = await adapter!.requestDevice(); + const presentationFormat = 'rgba8unorm'; + context.configure({ + device, + format: presentationFormat, + alphaMode: 'premultiplied', + }); + + const pipeline = device.createRenderPipeline({ + layout: 'auto', + vertex: { + module: device.createShaderModule({ + code: triangleVertWGSL, + }), + entryPoint: 'main', + }, + fragment: { + module: device.createShaderModule({ + code: redFragWGSL, + }), + entryPoint: 'main', + targets: [ + { + format: presentationFormat, + }, + ], + }, + primitive: { + topology: 'triangle-list', + }, + }); + + const commandEncoder = device.createCommandEncoder(); + const textureView = context.getCurrentTexture().createView(); + + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: textureView, + clearValue: [1.0, 0.0, 1.0, 1], + loadOp: 'clear', + storeOp: 'store', + }, + ], + }; + + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.draw(3); + passEncoder.end(); + + device.queue.submit([commandEncoder.finish()]); + }; \ No newline at end of file From 0a48e6fe5a625ef5370f0849514454ee09f2aca6 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 16:19:13 +0200 Subject: [PATCH 06/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 4 +-- example/src/Examples/Breathe/demo1/main.ts | 33 ++++++---------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 0db29c30eb..7b3da29368 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -3,10 +3,10 @@ import { gpu, SkiaDomView, } from "@shopify/react-native-skia"; -import { demo2 } from "./demo2"; +import { demo1 } from "./demo1/main"; const draw = async (ctx: GPUCanvasContext) => { - await demo2(ctx); + await demo1(ctx); ctx.present(); }; diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index c0370fd306..492f5c5c1f 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -12,21 +12,6 @@ import {basicVertWGSL, vertexPositionColorWGSL} from './shaders'; import { gpu } from '@shopify/react-native-skia'; import { Dimensions } from 'react-native'; -const GPUBufferUsage = { - None: 0x00000000, - MapRead: 0x00000001, - MapWrite: 0x00000002, - CopyStr: 0x00000004, - COPY_DST: 0x00000008, - Index: 0x00000010, - VERTEX: 0x00000020, - UNIFORM: 0x00000040, - Storage: 0x00000080, - Indirect: 0x00000100, - QueryResolve: 0x00000200, - Force32: 0x7FFFFFFF -}; - const GPUTextureUsage = { RENDER_ATTACHMENT: 0x00000010, } @@ -46,7 +31,7 @@ context.configure({ // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ size: cubeVertexArray.byteLength, - usage: GPUBufferUsage.VERTEX, + usage: 32,//GPUBufferUsage.VERTEX, mappedAtCreation: true, }); @@ -113,14 +98,14 @@ const pipeline = device.createRenderPipeline({ const depthTexture = device.createTexture({ size: { width, height }, format: 'depth24plus', - usage: GPUTextureUsage.RENDER_ATTACHMENT, + usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, }); const uniformBufferSize = 4 * 16; // 4x4 matrix const uniformBuffer = device.createBuffer({ size: uniformBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + usage: 72,// GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, mappedAtCreation: false }); @@ -139,9 +124,7 @@ const uniformBindGroup = device.createBindGroup({ const renderPassDescriptor: GPURenderPassDescriptor = { colorAttachments: [ { - view: context - .getCurrentTexture() - .createView(), + view: undefined, clearValue: [0.5, 0.5, 0.5, 1.0], loadOp: 'clear', @@ -185,9 +168,9 @@ function frame() { transformationMatrix.byteOffset, transformationMatrix.byteLength ); - // renderPassDescriptor.colorAttachments[0].view = context - // .getCurrentTexture() - // .createView(); + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); const commandEncoder = device.createCommandEncoder(); const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); @@ -201,7 +184,7 @@ function frame() { console.log("RENDER"); context.present(); - //requestAnimationFrame(frame); + // requestAnimationFrame(frame); } frame(); From 98df5b672a1d2178c62a265be818baaf18ee4cbd Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 19:01:48 +0200 Subject: [PATCH 07/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 26 +- .../cpp/rnskia-android/dawn/webgpu_cpp.cpp | 10804 ++++++++++------ .../cpp/rnskia-android/dawn/webgpu_cpp.h | 5812 +++++---- .../cpp/rnskia-android/webgpu/webgpu.h | 4340 ++++--- .../webgpu/webgpu_cpp_chained_struct.h | 30 +- .../rnskia-android/webgpu/webgpu_cpp_print.h | 4163 +++--- .../webgpu/webgpu_enum_class_bitmasks.h | 205 +- package/cpp/wgpu/JsiBuffer.h | 21 + package/cpp/wgpu/JsiGPU.h | 12 +- package/cpp/wgpu/JsiWGPUContext.h | 3 +- scripts/generator/generateObject.ts | 2 +- scripts/generator/model.ts | 27 +- 12 files changed, 14729 insertions(+), 10716 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 492f5c5c1f..0957583121 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -12,12 +12,25 @@ import {basicVertWGSL, vertexPositionColorWGSL} from './shaders'; import { gpu } from '@shopify/react-native-skia'; import { Dimensions } from 'react-native'; -const GPUTextureUsage = { - RENDER_ATTACHMENT: 0x00000010, -} - const {width, height} = Dimensions.get("window"); +async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { + const readBuffer = device.createBuffer({ + size: byteLength, + usage: 9//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + }); + + const commandEncoder = device.createCommandEncoder(); + commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); + const gpuCommands = commandEncoder.finish(); + device.queue.submit([gpuCommands]); + + await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ + const copyArrayBuffer = readBuffer.getMappedRange(); + console.log(new Float32Array(copyArrayBuffer)); // For float buffers, adjust as needed + readBuffer.unmap(); +} + export const demo1 = async (context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); const device = await adapter!.requestDevice(); @@ -27,7 +40,7 @@ context.configure({ format: presentationFormat, alphaMode: 'premultiplied', }); - +console.log(cubeVertexArray.byteLength); // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ size: cubeVertexArray.byteLength, @@ -181,7 +194,8 @@ function frame() { passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - + readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); + console.log("RENDER"); context.present(); // requestAnimationFrame(frame); diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp index 9f9abf83bc..b8784a52b5 100644 --- a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp +++ b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.cpp @@ -4,4126 +4,6890 @@ #include "dawn/webgpu_cpp.h" #if defined(__GNUC__) || defined(__clang__) -// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported +// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is +// conditionally-supported #pragma GCC diagnostic ignored "-Winvalid-offsetof" #endif namespace wgpu { - // WGSLFeatureName - - static_assert(sizeof(WGSLFeatureName) == sizeof(WGPUWGSLFeatureName), "sizeof mismatch for WGSLFeatureName"); - static_assert(alignof(WGSLFeatureName) == alignof(WGPUWGSLFeatureName), "alignof mismatch for WGSLFeatureName"); - - static_assert(static_cast(WGSLFeatureName::Undefined) == WGPUWGSLFeatureName_Undefined, "value mismatch for WGSLFeatureName::Undefined"); - static_assert(static_cast(WGSLFeatureName::ReadonlyAndReadwriteStorageTextures) == WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures, "value mismatch for WGSLFeatureName::ReadonlyAndReadwriteStorageTextures"); - static_assert(static_cast(WGSLFeatureName::Packed4x8IntegerDotProduct) == WGPUWGSLFeatureName_Packed4x8IntegerDotProduct, "value mismatch for WGSLFeatureName::Packed4x8IntegerDotProduct"); - static_assert(static_cast(WGSLFeatureName::UnrestrictedPointerParameters) == WGPUWGSLFeatureName_UnrestrictedPointerParameters, "value mismatch for WGSLFeatureName::UnrestrictedPointerParameters"); - static_assert(static_cast(WGSLFeatureName::PointerCompositeAccess) == WGPUWGSLFeatureName_PointerCompositeAccess, "value mismatch for WGSLFeatureName::PointerCompositeAccess"); - static_assert(static_cast(WGSLFeatureName::ChromiumTestingUnimplemented) == WGPUWGSLFeatureName_ChromiumTestingUnimplemented, "value mismatch for WGSLFeatureName::ChromiumTestingUnimplemented"); - static_assert(static_cast(WGSLFeatureName::ChromiumTestingUnsafeExperimental) == WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental, "value mismatch for WGSLFeatureName::ChromiumTestingUnsafeExperimental"); - static_assert(static_cast(WGSLFeatureName::ChromiumTestingExperimental) == WGPUWGSLFeatureName_ChromiumTestingExperimental, "value mismatch for WGSLFeatureName::ChromiumTestingExperimental"); - static_assert(static_cast(WGSLFeatureName::ChromiumTestingShippedWithKillswitch) == WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch, "value mismatch for WGSLFeatureName::ChromiumTestingShippedWithKillswitch"); - static_assert(static_cast(WGSLFeatureName::ChromiumTestingShipped) == WGPUWGSLFeatureName_ChromiumTestingShipped, "value mismatch for WGSLFeatureName::ChromiumTestingShipped"); - - // AdapterType - - static_assert(sizeof(AdapterType) == sizeof(WGPUAdapterType), "sizeof mismatch for AdapterType"); - static_assert(alignof(AdapterType) == alignof(WGPUAdapterType), "alignof mismatch for AdapterType"); - - static_assert(static_cast(AdapterType::DiscreteGPU) == WGPUAdapterType_DiscreteGPU, "value mismatch for AdapterType::DiscreteGPU"); - static_assert(static_cast(AdapterType::IntegratedGPU) == WGPUAdapterType_IntegratedGPU, "value mismatch for AdapterType::IntegratedGPU"); - static_assert(static_cast(AdapterType::CPU) == WGPUAdapterType_CPU, "value mismatch for AdapterType::CPU"); - static_assert(static_cast(AdapterType::Unknown) == WGPUAdapterType_Unknown, "value mismatch for AdapterType::Unknown"); - - // AddressMode - - static_assert(sizeof(AddressMode) == sizeof(WGPUAddressMode), "sizeof mismatch for AddressMode"); - static_assert(alignof(AddressMode) == alignof(WGPUAddressMode), "alignof mismatch for AddressMode"); - - static_assert(static_cast(AddressMode::Undefined) == WGPUAddressMode_Undefined, "value mismatch for AddressMode::Undefined"); - static_assert(static_cast(AddressMode::ClampToEdge) == WGPUAddressMode_ClampToEdge, "value mismatch for AddressMode::ClampToEdge"); - static_assert(static_cast(AddressMode::Repeat) == WGPUAddressMode_Repeat, "value mismatch for AddressMode::Repeat"); - static_assert(static_cast(AddressMode::MirrorRepeat) == WGPUAddressMode_MirrorRepeat, "value mismatch for AddressMode::MirrorRepeat"); - - // AlphaMode - - static_assert(sizeof(AlphaMode) == sizeof(WGPUAlphaMode), "sizeof mismatch for AlphaMode"); - static_assert(alignof(AlphaMode) == alignof(WGPUAlphaMode), "alignof mismatch for AlphaMode"); - - static_assert(static_cast(AlphaMode::Opaque) == WGPUAlphaMode_Opaque, "value mismatch for AlphaMode::Opaque"); - static_assert(static_cast(AlphaMode::Premultiplied) == WGPUAlphaMode_Premultiplied, "value mismatch for AlphaMode::Premultiplied"); - static_assert(static_cast(AlphaMode::Unpremultiplied) == WGPUAlphaMode_Unpremultiplied, "value mismatch for AlphaMode::Unpremultiplied"); - - // BackendType - - static_assert(sizeof(BackendType) == sizeof(WGPUBackendType), "sizeof mismatch for BackendType"); - static_assert(alignof(BackendType) == alignof(WGPUBackendType), "alignof mismatch for BackendType"); - - static_assert(static_cast(BackendType::Undefined) == WGPUBackendType_Undefined, "value mismatch for BackendType::Undefined"); - static_assert(static_cast(BackendType::Null) == WGPUBackendType_Null, "value mismatch for BackendType::Null"); - static_assert(static_cast(BackendType::WebGPU) == WGPUBackendType_WebGPU, "value mismatch for BackendType::WebGPU"); - static_assert(static_cast(BackendType::D3D11) == WGPUBackendType_D3D11, "value mismatch for BackendType::D3D11"); - static_assert(static_cast(BackendType::D3D12) == WGPUBackendType_D3D12, "value mismatch for BackendType::D3D12"); - static_assert(static_cast(BackendType::Metal) == WGPUBackendType_Metal, "value mismatch for BackendType::Metal"); - static_assert(static_cast(BackendType::Vulkan) == WGPUBackendType_Vulkan, "value mismatch for BackendType::Vulkan"); - static_assert(static_cast(BackendType::OpenGL) == WGPUBackendType_OpenGL, "value mismatch for BackendType::OpenGL"); - static_assert(static_cast(BackendType::OpenGLES) == WGPUBackendType_OpenGLES, "value mismatch for BackendType::OpenGLES"); - - // BlendFactor - - static_assert(sizeof(BlendFactor) == sizeof(WGPUBlendFactor), "sizeof mismatch for BlendFactor"); - static_assert(alignof(BlendFactor) == alignof(WGPUBlendFactor), "alignof mismatch for BlendFactor"); - - static_assert(static_cast(BlendFactor::Undefined) == WGPUBlendFactor_Undefined, "value mismatch for BlendFactor::Undefined"); - static_assert(static_cast(BlendFactor::Zero) == WGPUBlendFactor_Zero, "value mismatch for BlendFactor::Zero"); - static_assert(static_cast(BlendFactor::One) == WGPUBlendFactor_One, "value mismatch for BlendFactor::One"); - static_assert(static_cast(BlendFactor::Src) == WGPUBlendFactor_Src, "value mismatch for BlendFactor::Src"); - static_assert(static_cast(BlendFactor::OneMinusSrc) == WGPUBlendFactor_OneMinusSrc, "value mismatch for BlendFactor::OneMinusSrc"); - static_assert(static_cast(BlendFactor::SrcAlpha) == WGPUBlendFactor_SrcAlpha, "value mismatch for BlendFactor::SrcAlpha"); - static_assert(static_cast(BlendFactor::OneMinusSrcAlpha) == WGPUBlendFactor_OneMinusSrcAlpha, "value mismatch for BlendFactor::OneMinusSrcAlpha"); - static_assert(static_cast(BlendFactor::Dst) == WGPUBlendFactor_Dst, "value mismatch for BlendFactor::Dst"); - static_assert(static_cast(BlendFactor::OneMinusDst) == WGPUBlendFactor_OneMinusDst, "value mismatch for BlendFactor::OneMinusDst"); - static_assert(static_cast(BlendFactor::DstAlpha) == WGPUBlendFactor_DstAlpha, "value mismatch for BlendFactor::DstAlpha"); - static_assert(static_cast(BlendFactor::OneMinusDstAlpha) == WGPUBlendFactor_OneMinusDstAlpha, "value mismatch for BlendFactor::OneMinusDstAlpha"); - static_assert(static_cast(BlendFactor::SrcAlphaSaturated) == WGPUBlendFactor_SrcAlphaSaturated, "value mismatch for BlendFactor::SrcAlphaSaturated"); - static_assert(static_cast(BlendFactor::Constant) == WGPUBlendFactor_Constant, "value mismatch for BlendFactor::Constant"); - static_assert(static_cast(BlendFactor::OneMinusConstant) == WGPUBlendFactor_OneMinusConstant, "value mismatch for BlendFactor::OneMinusConstant"); - static_assert(static_cast(BlendFactor::Src1) == WGPUBlendFactor_Src1, "value mismatch for BlendFactor::Src1"); - static_assert(static_cast(BlendFactor::OneMinusSrc1) == WGPUBlendFactor_OneMinusSrc1, "value mismatch for BlendFactor::OneMinusSrc1"); - static_assert(static_cast(BlendFactor::Src1Alpha) == WGPUBlendFactor_Src1Alpha, "value mismatch for BlendFactor::Src1Alpha"); - static_assert(static_cast(BlendFactor::OneMinusSrc1Alpha) == WGPUBlendFactor_OneMinusSrc1Alpha, "value mismatch for BlendFactor::OneMinusSrc1Alpha"); - - // BlendOperation - - static_assert(sizeof(BlendOperation) == sizeof(WGPUBlendOperation), "sizeof mismatch for BlendOperation"); - static_assert(alignof(BlendOperation) == alignof(WGPUBlendOperation), "alignof mismatch for BlendOperation"); - - static_assert(static_cast(BlendOperation::Undefined) == WGPUBlendOperation_Undefined, "value mismatch for BlendOperation::Undefined"); - static_assert(static_cast(BlendOperation::Add) == WGPUBlendOperation_Add, "value mismatch for BlendOperation::Add"); - static_assert(static_cast(BlendOperation::Subtract) == WGPUBlendOperation_Subtract, "value mismatch for BlendOperation::Subtract"); - static_assert(static_cast(BlendOperation::ReverseSubtract) == WGPUBlendOperation_ReverseSubtract, "value mismatch for BlendOperation::ReverseSubtract"); - static_assert(static_cast(BlendOperation::Min) == WGPUBlendOperation_Min, "value mismatch for BlendOperation::Min"); - static_assert(static_cast(BlendOperation::Max) == WGPUBlendOperation_Max, "value mismatch for BlendOperation::Max"); - - // BufferBindingType - - static_assert(sizeof(BufferBindingType) == sizeof(WGPUBufferBindingType), "sizeof mismatch for BufferBindingType"); - static_assert(alignof(BufferBindingType) == alignof(WGPUBufferBindingType), "alignof mismatch for BufferBindingType"); - - static_assert(static_cast(BufferBindingType::Undefined) == WGPUBufferBindingType_Undefined, "value mismatch for BufferBindingType::Undefined"); - static_assert(static_cast(BufferBindingType::Uniform) == WGPUBufferBindingType_Uniform, "value mismatch for BufferBindingType::Uniform"); - static_assert(static_cast(BufferBindingType::Storage) == WGPUBufferBindingType_Storage, "value mismatch for BufferBindingType::Storage"); - static_assert(static_cast(BufferBindingType::ReadOnlyStorage) == WGPUBufferBindingType_ReadOnlyStorage, "value mismatch for BufferBindingType::ReadOnlyStorage"); - - // BufferMapAsyncStatus - - static_assert(sizeof(BufferMapAsyncStatus) == sizeof(WGPUBufferMapAsyncStatus), "sizeof mismatch for BufferMapAsyncStatus"); - static_assert(alignof(BufferMapAsyncStatus) == alignof(WGPUBufferMapAsyncStatus), "alignof mismatch for BufferMapAsyncStatus"); - - static_assert(static_cast(BufferMapAsyncStatus::Success) == WGPUBufferMapAsyncStatus_Success, "value mismatch for BufferMapAsyncStatus::Success"); - static_assert(static_cast(BufferMapAsyncStatus::InstanceDropped) == WGPUBufferMapAsyncStatus_InstanceDropped, "value mismatch for BufferMapAsyncStatus::InstanceDropped"); - static_assert(static_cast(BufferMapAsyncStatus::ValidationError) == WGPUBufferMapAsyncStatus_ValidationError, "value mismatch for BufferMapAsyncStatus::ValidationError"); - static_assert(static_cast(BufferMapAsyncStatus::Unknown) == WGPUBufferMapAsyncStatus_Unknown, "value mismatch for BufferMapAsyncStatus::Unknown"); - static_assert(static_cast(BufferMapAsyncStatus::DeviceLost) == WGPUBufferMapAsyncStatus_DeviceLost, "value mismatch for BufferMapAsyncStatus::DeviceLost"); - static_assert(static_cast(BufferMapAsyncStatus::DestroyedBeforeCallback) == WGPUBufferMapAsyncStatus_DestroyedBeforeCallback, "value mismatch for BufferMapAsyncStatus::DestroyedBeforeCallback"); - static_assert(static_cast(BufferMapAsyncStatus::UnmappedBeforeCallback) == WGPUBufferMapAsyncStatus_UnmappedBeforeCallback, "value mismatch for BufferMapAsyncStatus::UnmappedBeforeCallback"); - static_assert(static_cast(BufferMapAsyncStatus::MappingAlreadyPending) == WGPUBufferMapAsyncStatus_MappingAlreadyPending, "value mismatch for BufferMapAsyncStatus::MappingAlreadyPending"); - static_assert(static_cast(BufferMapAsyncStatus::OffsetOutOfRange) == WGPUBufferMapAsyncStatus_OffsetOutOfRange, "value mismatch for BufferMapAsyncStatus::OffsetOutOfRange"); - static_assert(static_cast(BufferMapAsyncStatus::SizeOutOfRange) == WGPUBufferMapAsyncStatus_SizeOutOfRange, "value mismatch for BufferMapAsyncStatus::SizeOutOfRange"); - - // BufferMapState - - static_assert(sizeof(BufferMapState) == sizeof(WGPUBufferMapState), "sizeof mismatch for BufferMapState"); - static_assert(alignof(BufferMapState) == alignof(WGPUBufferMapState), "alignof mismatch for BufferMapState"); - - static_assert(static_cast(BufferMapState::Unmapped) == WGPUBufferMapState_Unmapped, "value mismatch for BufferMapState::Unmapped"); - static_assert(static_cast(BufferMapState::Pending) == WGPUBufferMapState_Pending, "value mismatch for BufferMapState::Pending"); - static_assert(static_cast(BufferMapState::Mapped) == WGPUBufferMapState_Mapped, "value mismatch for BufferMapState::Mapped"); - - // CallbackMode - - static_assert(sizeof(CallbackMode) == sizeof(WGPUCallbackMode), "sizeof mismatch for CallbackMode"); - static_assert(alignof(CallbackMode) == alignof(WGPUCallbackMode), "alignof mismatch for CallbackMode"); - - static_assert(static_cast(CallbackMode::WaitAnyOnly) == WGPUCallbackMode_WaitAnyOnly, "value mismatch for CallbackMode::WaitAnyOnly"); - static_assert(static_cast(CallbackMode::AllowProcessEvents) == WGPUCallbackMode_AllowProcessEvents, "value mismatch for CallbackMode::AllowProcessEvents"); - static_assert(static_cast(CallbackMode::AllowSpontaneous) == WGPUCallbackMode_AllowSpontaneous, "value mismatch for CallbackMode::AllowSpontaneous"); - - // CompareFunction - - static_assert(sizeof(CompareFunction) == sizeof(WGPUCompareFunction), "sizeof mismatch for CompareFunction"); - static_assert(alignof(CompareFunction) == alignof(WGPUCompareFunction), "alignof mismatch for CompareFunction"); - - static_assert(static_cast(CompareFunction::Undefined) == WGPUCompareFunction_Undefined, "value mismatch for CompareFunction::Undefined"); - static_assert(static_cast(CompareFunction::Never) == WGPUCompareFunction_Never, "value mismatch for CompareFunction::Never"); - static_assert(static_cast(CompareFunction::Less) == WGPUCompareFunction_Less, "value mismatch for CompareFunction::Less"); - static_assert(static_cast(CompareFunction::Equal) == WGPUCompareFunction_Equal, "value mismatch for CompareFunction::Equal"); - static_assert(static_cast(CompareFunction::LessEqual) == WGPUCompareFunction_LessEqual, "value mismatch for CompareFunction::LessEqual"); - static_assert(static_cast(CompareFunction::Greater) == WGPUCompareFunction_Greater, "value mismatch for CompareFunction::Greater"); - static_assert(static_cast(CompareFunction::NotEqual) == WGPUCompareFunction_NotEqual, "value mismatch for CompareFunction::NotEqual"); - static_assert(static_cast(CompareFunction::GreaterEqual) == WGPUCompareFunction_GreaterEqual, "value mismatch for CompareFunction::GreaterEqual"); - static_assert(static_cast(CompareFunction::Always) == WGPUCompareFunction_Always, "value mismatch for CompareFunction::Always"); - - // CompilationInfoRequestStatus - - static_assert(sizeof(CompilationInfoRequestStatus) == sizeof(WGPUCompilationInfoRequestStatus), "sizeof mismatch for CompilationInfoRequestStatus"); - static_assert(alignof(CompilationInfoRequestStatus) == alignof(WGPUCompilationInfoRequestStatus), "alignof mismatch for CompilationInfoRequestStatus"); - - static_assert(static_cast(CompilationInfoRequestStatus::Success) == WGPUCompilationInfoRequestStatus_Success, "value mismatch for CompilationInfoRequestStatus::Success"); - static_assert(static_cast(CompilationInfoRequestStatus::InstanceDropped) == WGPUCompilationInfoRequestStatus_InstanceDropped, "value mismatch for CompilationInfoRequestStatus::InstanceDropped"); - static_assert(static_cast(CompilationInfoRequestStatus::Error) == WGPUCompilationInfoRequestStatus_Error, "value mismatch for CompilationInfoRequestStatus::Error"); - static_assert(static_cast(CompilationInfoRequestStatus::DeviceLost) == WGPUCompilationInfoRequestStatus_DeviceLost, "value mismatch for CompilationInfoRequestStatus::DeviceLost"); - static_assert(static_cast(CompilationInfoRequestStatus::Unknown) == WGPUCompilationInfoRequestStatus_Unknown, "value mismatch for CompilationInfoRequestStatus::Unknown"); - - // CompilationMessageType - - static_assert(sizeof(CompilationMessageType) == sizeof(WGPUCompilationMessageType), "sizeof mismatch for CompilationMessageType"); - static_assert(alignof(CompilationMessageType) == alignof(WGPUCompilationMessageType), "alignof mismatch for CompilationMessageType"); - - static_assert(static_cast(CompilationMessageType::Error) == WGPUCompilationMessageType_Error, "value mismatch for CompilationMessageType::Error"); - static_assert(static_cast(CompilationMessageType::Warning) == WGPUCompilationMessageType_Warning, "value mismatch for CompilationMessageType::Warning"); - static_assert(static_cast(CompilationMessageType::Info) == WGPUCompilationMessageType_Info, "value mismatch for CompilationMessageType::Info"); - - // CreatePipelineAsyncStatus - - static_assert(sizeof(CreatePipelineAsyncStatus) == sizeof(WGPUCreatePipelineAsyncStatus), "sizeof mismatch for CreatePipelineAsyncStatus"); - static_assert(alignof(CreatePipelineAsyncStatus) == alignof(WGPUCreatePipelineAsyncStatus), "alignof mismatch for CreatePipelineAsyncStatus"); - - static_assert(static_cast(CreatePipelineAsyncStatus::Success) == WGPUCreatePipelineAsyncStatus_Success, "value mismatch for CreatePipelineAsyncStatus::Success"); - static_assert(static_cast(CreatePipelineAsyncStatus::InstanceDropped) == WGPUCreatePipelineAsyncStatus_InstanceDropped, "value mismatch for CreatePipelineAsyncStatus::InstanceDropped"); - static_assert(static_cast(CreatePipelineAsyncStatus::ValidationError) == WGPUCreatePipelineAsyncStatus_ValidationError, "value mismatch for CreatePipelineAsyncStatus::ValidationError"); - static_assert(static_cast(CreatePipelineAsyncStatus::InternalError) == WGPUCreatePipelineAsyncStatus_InternalError, "value mismatch for CreatePipelineAsyncStatus::InternalError"); - static_assert(static_cast(CreatePipelineAsyncStatus::DeviceLost) == WGPUCreatePipelineAsyncStatus_DeviceLost, "value mismatch for CreatePipelineAsyncStatus::DeviceLost"); - static_assert(static_cast(CreatePipelineAsyncStatus::DeviceDestroyed) == WGPUCreatePipelineAsyncStatus_DeviceDestroyed, "value mismatch for CreatePipelineAsyncStatus::DeviceDestroyed"); - static_assert(static_cast(CreatePipelineAsyncStatus::Unknown) == WGPUCreatePipelineAsyncStatus_Unknown, "value mismatch for CreatePipelineAsyncStatus::Unknown"); - - // CullMode - - static_assert(sizeof(CullMode) == sizeof(WGPUCullMode), "sizeof mismatch for CullMode"); - static_assert(alignof(CullMode) == alignof(WGPUCullMode), "alignof mismatch for CullMode"); - - static_assert(static_cast(CullMode::Undefined) == WGPUCullMode_Undefined, "value mismatch for CullMode::Undefined"); - static_assert(static_cast(CullMode::None) == WGPUCullMode_None, "value mismatch for CullMode::None"); - static_assert(static_cast(CullMode::Front) == WGPUCullMode_Front, "value mismatch for CullMode::Front"); - static_assert(static_cast(CullMode::Back) == WGPUCullMode_Back, "value mismatch for CullMode::Back"); - - // DeviceLostReason - - static_assert(sizeof(DeviceLostReason) == sizeof(WGPUDeviceLostReason), "sizeof mismatch for DeviceLostReason"); - static_assert(alignof(DeviceLostReason) == alignof(WGPUDeviceLostReason), "alignof mismatch for DeviceLostReason"); - - static_assert(static_cast(DeviceLostReason::Undefined) == WGPUDeviceLostReason_Undefined, "value mismatch for DeviceLostReason::Undefined"); - static_assert(static_cast(DeviceLostReason::Destroyed) == WGPUDeviceLostReason_Destroyed, "value mismatch for DeviceLostReason::Destroyed"); - - // ErrorFilter - - static_assert(sizeof(ErrorFilter) == sizeof(WGPUErrorFilter), "sizeof mismatch for ErrorFilter"); - static_assert(alignof(ErrorFilter) == alignof(WGPUErrorFilter), "alignof mismatch for ErrorFilter"); - - static_assert(static_cast(ErrorFilter::Validation) == WGPUErrorFilter_Validation, "value mismatch for ErrorFilter::Validation"); - static_assert(static_cast(ErrorFilter::OutOfMemory) == WGPUErrorFilter_OutOfMemory, "value mismatch for ErrorFilter::OutOfMemory"); - static_assert(static_cast(ErrorFilter::Internal) == WGPUErrorFilter_Internal, "value mismatch for ErrorFilter::Internal"); - - // ErrorType - - static_assert(sizeof(ErrorType) == sizeof(WGPUErrorType), "sizeof mismatch for ErrorType"); - static_assert(alignof(ErrorType) == alignof(WGPUErrorType), "alignof mismatch for ErrorType"); - - static_assert(static_cast(ErrorType::NoError) == WGPUErrorType_NoError, "value mismatch for ErrorType::NoError"); - static_assert(static_cast(ErrorType::Validation) == WGPUErrorType_Validation, "value mismatch for ErrorType::Validation"); - static_assert(static_cast(ErrorType::OutOfMemory) == WGPUErrorType_OutOfMemory, "value mismatch for ErrorType::OutOfMemory"); - static_assert(static_cast(ErrorType::Internal) == WGPUErrorType_Internal, "value mismatch for ErrorType::Internal"); - static_assert(static_cast(ErrorType::Unknown) == WGPUErrorType_Unknown, "value mismatch for ErrorType::Unknown"); - static_assert(static_cast(ErrorType::DeviceLost) == WGPUErrorType_DeviceLost, "value mismatch for ErrorType::DeviceLost"); - - // ExternalTextureRotation - - static_assert(sizeof(ExternalTextureRotation) == sizeof(WGPUExternalTextureRotation), "sizeof mismatch for ExternalTextureRotation"); - static_assert(alignof(ExternalTextureRotation) == alignof(WGPUExternalTextureRotation), "alignof mismatch for ExternalTextureRotation"); - - static_assert(static_cast(ExternalTextureRotation::Rotate0Degrees) == WGPUExternalTextureRotation_Rotate0Degrees, "value mismatch for ExternalTextureRotation::Rotate0Degrees"); - static_assert(static_cast(ExternalTextureRotation::Rotate90Degrees) == WGPUExternalTextureRotation_Rotate90Degrees, "value mismatch for ExternalTextureRotation::Rotate90Degrees"); - static_assert(static_cast(ExternalTextureRotation::Rotate180Degrees) == WGPUExternalTextureRotation_Rotate180Degrees, "value mismatch for ExternalTextureRotation::Rotate180Degrees"); - static_assert(static_cast(ExternalTextureRotation::Rotate270Degrees) == WGPUExternalTextureRotation_Rotate270Degrees, "value mismatch for ExternalTextureRotation::Rotate270Degrees"); - - // FeatureName - - static_assert(sizeof(FeatureName) == sizeof(WGPUFeatureName), "sizeof mismatch for FeatureName"); - static_assert(alignof(FeatureName) == alignof(WGPUFeatureName), "alignof mismatch for FeatureName"); - - static_assert(static_cast(FeatureName::Undefined) == WGPUFeatureName_Undefined, "value mismatch for FeatureName::Undefined"); - static_assert(static_cast(FeatureName::DepthClipControl) == WGPUFeatureName_DepthClipControl, "value mismatch for FeatureName::DepthClipControl"); - static_assert(static_cast(FeatureName::Depth32FloatStencil8) == WGPUFeatureName_Depth32FloatStencil8, "value mismatch for FeatureName::Depth32FloatStencil8"); - static_assert(static_cast(FeatureName::TimestampQuery) == WGPUFeatureName_TimestampQuery, "value mismatch for FeatureName::TimestampQuery"); - static_assert(static_cast(FeatureName::TextureCompressionBC) == WGPUFeatureName_TextureCompressionBC, "value mismatch for FeatureName::TextureCompressionBC"); - static_assert(static_cast(FeatureName::TextureCompressionETC2) == WGPUFeatureName_TextureCompressionETC2, "value mismatch for FeatureName::TextureCompressionETC2"); - static_assert(static_cast(FeatureName::TextureCompressionASTC) == WGPUFeatureName_TextureCompressionASTC, "value mismatch for FeatureName::TextureCompressionASTC"); - static_assert(static_cast(FeatureName::IndirectFirstInstance) == WGPUFeatureName_IndirectFirstInstance, "value mismatch for FeatureName::IndirectFirstInstance"); - static_assert(static_cast(FeatureName::ShaderF16) == WGPUFeatureName_ShaderF16, "value mismatch for FeatureName::ShaderF16"); - static_assert(static_cast(FeatureName::RG11B10UfloatRenderable) == WGPUFeatureName_RG11B10UfloatRenderable, "value mismatch for FeatureName::RG11B10UfloatRenderable"); - static_assert(static_cast(FeatureName::BGRA8UnormStorage) == WGPUFeatureName_BGRA8UnormStorage, "value mismatch for FeatureName::BGRA8UnormStorage"); - static_assert(static_cast(FeatureName::Float32Filterable) == WGPUFeatureName_Float32Filterable, "value mismatch for FeatureName::Float32Filterable"); - static_assert(static_cast(FeatureName::DawnInternalUsages) == WGPUFeatureName_DawnInternalUsages, "value mismatch for FeatureName::DawnInternalUsages"); - static_assert(static_cast(FeatureName::DawnMultiPlanarFormats) == WGPUFeatureName_DawnMultiPlanarFormats, "value mismatch for FeatureName::DawnMultiPlanarFormats"); - static_assert(static_cast(FeatureName::DawnNative) == WGPUFeatureName_DawnNative, "value mismatch for FeatureName::DawnNative"); - static_assert(static_cast(FeatureName::ChromiumExperimentalTimestampQueryInsidePasses) == WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses, "value mismatch for FeatureName::ChromiumExperimentalTimestampQueryInsidePasses"); - static_assert(static_cast(FeatureName::ImplicitDeviceSynchronization) == WGPUFeatureName_ImplicitDeviceSynchronization, "value mismatch for FeatureName::ImplicitDeviceSynchronization"); - static_assert(static_cast(FeatureName::SurfaceCapabilities) == WGPUFeatureName_SurfaceCapabilities, "value mismatch for FeatureName::SurfaceCapabilities"); - static_assert(static_cast(FeatureName::TransientAttachments) == WGPUFeatureName_TransientAttachments, "value mismatch for FeatureName::TransientAttachments"); - static_assert(static_cast(FeatureName::MSAARenderToSingleSampled) == WGPUFeatureName_MSAARenderToSingleSampled, "value mismatch for FeatureName::MSAARenderToSingleSampled"); - static_assert(static_cast(FeatureName::DualSourceBlending) == WGPUFeatureName_DualSourceBlending, "value mismatch for FeatureName::DualSourceBlending"); - static_assert(static_cast(FeatureName::D3D11MultithreadProtected) == WGPUFeatureName_D3D11MultithreadProtected, "value mismatch for FeatureName::D3D11MultithreadProtected"); - static_assert(static_cast(FeatureName::ANGLETextureSharing) == WGPUFeatureName_ANGLETextureSharing, "value mismatch for FeatureName::ANGLETextureSharing"); - static_assert(static_cast(FeatureName::ChromiumExperimentalSubgroups) == WGPUFeatureName_ChromiumExperimentalSubgroups, "value mismatch for FeatureName::ChromiumExperimentalSubgroups"); - static_assert(static_cast(FeatureName::ChromiumExperimentalSubgroupUniformControlFlow) == WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow, "value mismatch for FeatureName::ChromiumExperimentalSubgroupUniformControlFlow"); - static_assert(static_cast(FeatureName::PixelLocalStorageCoherent) == WGPUFeatureName_PixelLocalStorageCoherent, "value mismatch for FeatureName::PixelLocalStorageCoherent"); - static_assert(static_cast(FeatureName::PixelLocalStorageNonCoherent) == WGPUFeatureName_PixelLocalStorageNonCoherent, "value mismatch for FeatureName::PixelLocalStorageNonCoherent"); - static_assert(static_cast(FeatureName::Unorm16TextureFormats) == WGPUFeatureName_Unorm16TextureFormats, "value mismatch for FeatureName::Unorm16TextureFormats"); - static_assert(static_cast(FeatureName::Snorm16TextureFormats) == WGPUFeatureName_Snorm16TextureFormats, "value mismatch for FeatureName::Snorm16TextureFormats"); - static_assert(static_cast(FeatureName::MultiPlanarFormatExtendedUsages) == WGPUFeatureName_MultiPlanarFormatExtendedUsages, "value mismatch for FeatureName::MultiPlanarFormatExtendedUsages"); - static_assert(static_cast(FeatureName::MultiPlanarFormatP010) == WGPUFeatureName_MultiPlanarFormatP010, "value mismatch for FeatureName::MultiPlanarFormatP010"); - static_assert(static_cast(FeatureName::HostMappedPointer) == WGPUFeatureName_HostMappedPointer, "value mismatch for FeatureName::HostMappedPointer"); - static_assert(static_cast(FeatureName::MultiPlanarRenderTargets) == WGPUFeatureName_MultiPlanarRenderTargets, "value mismatch for FeatureName::MultiPlanarRenderTargets"); - static_assert(static_cast(FeatureName::MultiPlanarFormatNv12a) == WGPUFeatureName_MultiPlanarFormatNv12a, "value mismatch for FeatureName::MultiPlanarFormatNv12a"); - static_assert(static_cast(FeatureName::FramebufferFetch) == WGPUFeatureName_FramebufferFetch, "value mismatch for FeatureName::FramebufferFetch"); - static_assert(static_cast(FeatureName::BufferMapExtendedUsages) == WGPUFeatureName_BufferMapExtendedUsages, "value mismatch for FeatureName::BufferMapExtendedUsages"); - static_assert(static_cast(FeatureName::AdapterPropertiesMemoryHeaps) == WGPUFeatureName_AdapterPropertiesMemoryHeaps, "value mismatch for FeatureName::AdapterPropertiesMemoryHeaps"); - static_assert(static_cast(FeatureName::AdapterPropertiesD3D) == WGPUFeatureName_AdapterPropertiesD3D, "value mismatch for FeatureName::AdapterPropertiesD3D"); - static_assert(static_cast(FeatureName::AdapterPropertiesVk) == WGPUFeatureName_AdapterPropertiesVk, "value mismatch for FeatureName::AdapterPropertiesVk"); - static_assert(static_cast(FeatureName::R8UnormStorage) == WGPUFeatureName_R8UnormStorage, "value mismatch for FeatureName::R8UnormStorage"); - static_assert(static_cast(FeatureName::FormatCapabilities) == WGPUFeatureName_FormatCapabilities, "value mismatch for FeatureName::FormatCapabilities"); - static_assert(static_cast(FeatureName::DrmFormatCapabilities) == WGPUFeatureName_DrmFormatCapabilities, "value mismatch for FeatureName::DrmFormatCapabilities"); - static_assert(static_cast(FeatureName::Norm16TextureFormats) == WGPUFeatureName_Norm16TextureFormats, "value mismatch for FeatureName::Norm16TextureFormats"); - static_assert(static_cast(FeatureName::SharedTextureMemoryVkDedicatedAllocation) == WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation, "value mismatch for FeatureName::SharedTextureMemoryVkDedicatedAllocation"); - static_assert(static_cast(FeatureName::SharedTextureMemoryAHardwareBuffer) == WGPUFeatureName_SharedTextureMemoryAHardwareBuffer, "value mismatch for FeatureName::SharedTextureMemoryAHardwareBuffer"); - static_assert(static_cast(FeatureName::SharedTextureMemoryDmaBuf) == WGPUFeatureName_SharedTextureMemoryDmaBuf, "value mismatch for FeatureName::SharedTextureMemoryDmaBuf"); - static_assert(static_cast(FeatureName::SharedTextureMemoryOpaqueFD) == WGPUFeatureName_SharedTextureMemoryOpaqueFD, "value mismatch for FeatureName::SharedTextureMemoryOpaqueFD"); - static_assert(static_cast(FeatureName::SharedTextureMemoryZirconHandle) == WGPUFeatureName_SharedTextureMemoryZirconHandle, "value mismatch for FeatureName::SharedTextureMemoryZirconHandle"); - static_assert(static_cast(FeatureName::SharedTextureMemoryDXGISharedHandle) == WGPUFeatureName_SharedTextureMemoryDXGISharedHandle, "value mismatch for FeatureName::SharedTextureMemoryDXGISharedHandle"); - static_assert(static_cast(FeatureName::SharedTextureMemoryD3D11Texture2D) == WGPUFeatureName_SharedTextureMemoryD3D11Texture2D, "value mismatch for FeatureName::SharedTextureMemoryD3D11Texture2D"); - static_assert(static_cast(FeatureName::SharedTextureMemoryIOSurface) == WGPUFeatureName_SharedTextureMemoryIOSurface, "value mismatch for FeatureName::SharedTextureMemoryIOSurface"); - static_assert(static_cast(FeatureName::SharedTextureMemoryEGLImage) == WGPUFeatureName_SharedTextureMemoryEGLImage, "value mismatch for FeatureName::SharedTextureMemoryEGLImage"); - static_assert(static_cast(FeatureName::SharedFenceVkSemaphoreOpaqueFD) == WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD, "value mismatch for FeatureName::SharedFenceVkSemaphoreOpaqueFD"); - static_assert(static_cast(FeatureName::SharedFenceVkSemaphoreSyncFD) == WGPUFeatureName_SharedFenceVkSemaphoreSyncFD, "value mismatch for FeatureName::SharedFenceVkSemaphoreSyncFD"); - static_assert(static_cast(FeatureName::SharedFenceVkSemaphoreZirconHandle) == WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle, "value mismatch for FeatureName::SharedFenceVkSemaphoreZirconHandle"); - static_assert(static_cast(FeatureName::SharedFenceDXGISharedHandle) == WGPUFeatureName_SharedFenceDXGISharedHandle, "value mismatch for FeatureName::SharedFenceDXGISharedHandle"); - static_assert(static_cast(FeatureName::SharedFenceMTLSharedEvent) == WGPUFeatureName_SharedFenceMTLSharedEvent, "value mismatch for FeatureName::SharedFenceMTLSharedEvent"); - static_assert(static_cast(FeatureName::SharedBufferMemoryD3D12Resource) == WGPUFeatureName_SharedBufferMemoryD3D12Resource, "value mismatch for FeatureName::SharedBufferMemoryD3D12Resource"); - static_assert(static_cast(FeatureName::StaticSamplers) == WGPUFeatureName_StaticSamplers, "value mismatch for FeatureName::StaticSamplers"); - - // FilterMode - - static_assert(sizeof(FilterMode) == sizeof(WGPUFilterMode), "sizeof mismatch for FilterMode"); - static_assert(alignof(FilterMode) == alignof(WGPUFilterMode), "alignof mismatch for FilterMode"); - - static_assert(static_cast(FilterMode::Undefined) == WGPUFilterMode_Undefined, "value mismatch for FilterMode::Undefined"); - static_assert(static_cast(FilterMode::Nearest) == WGPUFilterMode_Nearest, "value mismatch for FilterMode::Nearest"); - static_assert(static_cast(FilterMode::Linear) == WGPUFilterMode_Linear, "value mismatch for FilterMode::Linear"); - - // FrontFace - - static_assert(sizeof(FrontFace) == sizeof(WGPUFrontFace), "sizeof mismatch for FrontFace"); - static_assert(alignof(FrontFace) == alignof(WGPUFrontFace), "alignof mismatch for FrontFace"); - - static_assert(static_cast(FrontFace::Undefined) == WGPUFrontFace_Undefined, "value mismatch for FrontFace::Undefined"); - static_assert(static_cast(FrontFace::CCW) == WGPUFrontFace_CCW, "value mismatch for FrontFace::CCW"); - static_assert(static_cast(FrontFace::CW) == WGPUFrontFace_CW, "value mismatch for FrontFace::CW"); - - // IndexFormat - - static_assert(sizeof(IndexFormat) == sizeof(WGPUIndexFormat), "sizeof mismatch for IndexFormat"); - static_assert(alignof(IndexFormat) == alignof(WGPUIndexFormat), "alignof mismatch for IndexFormat"); - - static_assert(static_cast(IndexFormat::Undefined) == WGPUIndexFormat_Undefined, "value mismatch for IndexFormat::Undefined"); - static_assert(static_cast(IndexFormat::Uint16) == WGPUIndexFormat_Uint16, "value mismatch for IndexFormat::Uint16"); - static_assert(static_cast(IndexFormat::Uint32) == WGPUIndexFormat_Uint32, "value mismatch for IndexFormat::Uint32"); - - // LoadOp - - static_assert(sizeof(LoadOp) == sizeof(WGPULoadOp), "sizeof mismatch for LoadOp"); - static_assert(alignof(LoadOp) == alignof(WGPULoadOp), "alignof mismatch for LoadOp"); - - static_assert(static_cast(LoadOp::Undefined) == WGPULoadOp_Undefined, "value mismatch for LoadOp::Undefined"); - static_assert(static_cast(LoadOp::Clear) == WGPULoadOp_Clear, "value mismatch for LoadOp::Clear"); - static_assert(static_cast(LoadOp::Load) == WGPULoadOp_Load, "value mismatch for LoadOp::Load"); - - // LoggingType - - static_assert(sizeof(LoggingType) == sizeof(WGPULoggingType), "sizeof mismatch for LoggingType"); - static_assert(alignof(LoggingType) == alignof(WGPULoggingType), "alignof mismatch for LoggingType"); - - static_assert(static_cast(LoggingType::Verbose) == WGPULoggingType_Verbose, "value mismatch for LoggingType::Verbose"); - static_assert(static_cast(LoggingType::Info) == WGPULoggingType_Info, "value mismatch for LoggingType::Info"); - static_assert(static_cast(LoggingType::Warning) == WGPULoggingType_Warning, "value mismatch for LoggingType::Warning"); - static_assert(static_cast(LoggingType::Error) == WGPULoggingType_Error, "value mismatch for LoggingType::Error"); - - // MipmapFilterMode - - static_assert(sizeof(MipmapFilterMode) == sizeof(WGPUMipmapFilterMode), "sizeof mismatch for MipmapFilterMode"); - static_assert(alignof(MipmapFilterMode) == alignof(WGPUMipmapFilterMode), "alignof mismatch for MipmapFilterMode"); - - static_assert(static_cast(MipmapFilterMode::Undefined) == WGPUMipmapFilterMode_Undefined, "value mismatch for MipmapFilterMode::Undefined"); - static_assert(static_cast(MipmapFilterMode::Nearest) == WGPUMipmapFilterMode_Nearest, "value mismatch for MipmapFilterMode::Nearest"); - static_assert(static_cast(MipmapFilterMode::Linear) == WGPUMipmapFilterMode_Linear, "value mismatch for MipmapFilterMode::Linear"); - - // PopErrorScopeStatus - - static_assert(sizeof(PopErrorScopeStatus) == sizeof(WGPUPopErrorScopeStatus), "sizeof mismatch for PopErrorScopeStatus"); - static_assert(alignof(PopErrorScopeStatus) == alignof(WGPUPopErrorScopeStatus), "alignof mismatch for PopErrorScopeStatus"); - - static_assert(static_cast(PopErrorScopeStatus::Success) == WGPUPopErrorScopeStatus_Success, "value mismatch for PopErrorScopeStatus::Success"); - static_assert(static_cast(PopErrorScopeStatus::InstanceDropped) == WGPUPopErrorScopeStatus_InstanceDropped, "value mismatch for PopErrorScopeStatus::InstanceDropped"); - - // PowerPreference - - static_assert(sizeof(PowerPreference) == sizeof(WGPUPowerPreference), "sizeof mismatch for PowerPreference"); - static_assert(alignof(PowerPreference) == alignof(WGPUPowerPreference), "alignof mismatch for PowerPreference"); - - static_assert(static_cast(PowerPreference::Undefined) == WGPUPowerPreference_Undefined, "value mismatch for PowerPreference::Undefined"); - static_assert(static_cast(PowerPreference::LowPower) == WGPUPowerPreference_LowPower, "value mismatch for PowerPreference::LowPower"); - static_assert(static_cast(PowerPreference::HighPerformance) == WGPUPowerPreference_HighPerformance, "value mismatch for PowerPreference::HighPerformance"); - - // PresentMode - - static_assert(sizeof(PresentMode) == sizeof(WGPUPresentMode), "sizeof mismatch for PresentMode"); - static_assert(alignof(PresentMode) == alignof(WGPUPresentMode), "alignof mismatch for PresentMode"); - - static_assert(static_cast(PresentMode::Fifo) == WGPUPresentMode_Fifo, "value mismatch for PresentMode::Fifo"); - static_assert(static_cast(PresentMode::Immediate) == WGPUPresentMode_Immediate, "value mismatch for PresentMode::Immediate"); - static_assert(static_cast(PresentMode::Mailbox) == WGPUPresentMode_Mailbox, "value mismatch for PresentMode::Mailbox"); - - // PrimitiveTopology - - static_assert(sizeof(PrimitiveTopology) == sizeof(WGPUPrimitiveTopology), "sizeof mismatch for PrimitiveTopology"); - static_assert(alignof(PrimitiveTopology) == alignof(WGPUPrimitiveTopology), "alignof mismatch for PrimitiveTopology"); - - static_assert(static_cast(PrimitiveTopology::Undefined) == WGPUPrimitiveTopology_Undefined, "value mismatch for PrimitiveTopology::Undefined"); - static_assert(static_cast(PrimitiveTopology::PointList) == WGPUPrimitiveTopology_PointList, "value mismatch for PrimitiveTopology::PointList"); - static_assert(static_cast(PrimitiveTopology::LineList) == WGPUPrimitiveTopology_LineList, "value mismatch for PrimitiveTopology::LineList"); - static_assert(static_cast(PrimitiveTopology::LineStrip) == WGPUPrimitiveTopology_LineStrip, "value mismatch for PrimitiveTopology::LineStrip"); - static_assert(static_cast(PrimitiveTopology::TriangleList) == WGPUPrimitiveTopology_TriangleList, "value mismatch for PrimitiveTopology::TriangleList"); - static_assert(static_cast(PrimitiveTopology::TriangleStrip) == WGPUPrimitiveTopology_TriangleStrip, "value mismatch for PrimitiveTopology::TriangleStrip"); - - // QueryType - - static_assert(sizeof(QueryType) == sizeof(WGPUQueryType), "sizeof mismatch for QueryType"); - static_assert(alignof(QueryType) == alignof(WGPUQueryType), "alignof mismatch for QueryType"); - - static_assert(static_cast(QueryType::Occlusion) == WGPUQueryType_Occlusion, "value mismatch for QueryType::Occlusion"); - static_assert(static_cast(QueryType::Timestamp) == WGPUQueryType_Timestamp, "value mismatch for QueryType::Timestamp"); - - // QueueWorkDoneStatus - - static_assert(sizeof(QueueWorkDoneStatus) == sizeof(WGPUQueueWorkDoneStatus), "sizeof mismatch for QueueWorkDoneStatus"); - static_assert(alignof(QueueWorkDoneStatus) == alignof(WGPUQueueWorkDoneStatus), "alignof mismatch for QueueWorkDoneStatus"); - - static_assert(static_cast(QueueWorkDoneStatus::Success) == WGPUQueueWorkDoneStatus_Success, "value mismatch for QueueWorkDoneStatus::Success"); - static_assert(static_cast(QueueWorkDoneStatus::InstanceDropped) == WGPUQueueWorkDoneStatus_InstanceDropped, "value mismatch for QueueWorkDoneStatus::InstanceDropped"); - static_assert(static_cast(QueueWorkDoneStatus::Error) == WGPUQueueWorkDoneStatus_Error, "value mismatch for QueueWorkDoneStatus::Error"); - static_assert(static_cast(QueueWorkDoneStatus::Unknown) == WGPUQueueWorkDoneStatus_Unknown, "value mismatch for QueueWorkDoneStatus::Unknown"); - static_assert(static_cast(QueueWorkDoneStatus::DeviceLost) == WGPUQueueWorkDoneStatus_DeviceLost, "value mismatch for QueueWorkDoneStatus::DeviceLost"); - - // RequestAdapterStatus - - static_assert(sizeof(RequestAdapterStatus) == sizeof(WGPURequestAdapterStatus), "sizeof mismatch for RequestAdapterStatus"); - static_assert(alignof(RequestAdapterStatus) == alignof(WGPURequestAdapterStatus), "alignof mismatch for RequestAdapterStatus"); - - static_assert(static_cast(RequestAdapterStatus::Success) == WGPURequestAdapterStatus_Success, "value mismatch for RequestAdapterStatus::Success"); - static_assert(static_cast(RequestAdapterStatus::InstanceDropped) == WGPURequestAdapterStatus_InstanceDropped, "value mismatch for RequestAdapterStatus::InstanceDropped"); - static_assert(static_cast(RequestAdapterStatus::Unavailable) == WGPURequestAdapterStatus_Unavailable, "value mismatch for RequestAdapterStatus::Unavailable"); - static_assert(static_cast(RequestAdapterStatus::Error) == WGPURequestAdapterStatus_Error, "value mismatch for RequestAdapterStatus::Error"); - static_assert(static_cast(RequestAdapterStatus::Unknown) == WGPURequestAdapterStatus_Unknown, "value mismatch for RequestAdapterStatus::Unknown"); - - // RequestDeviceStatus - - static_assert(sizeof(RequestDeviceStatus) == sizeof(WGPURequestDeviceStatus), "sizeof mismatch for RequestDeviceStatus"); - static_assert(alignof(RequestDeviceStatus) == alignof(WGPURequestDeviceStatus), "alignof mismatch for RequestDeviceStatus"); - - static_assert(static_cast(RequestDeviceStatus::Success) == WGPURequestDeviceStatus_Success, "value mismatch for RequestDeviceStatus::Success"); - static_assert(static_cast(RequestDeviceStatus::InstanceDropped) == WGPURequestDeviceStatus_InstanceDropped, "value mismatch for RequestDeviceStatus::InstanceDropped"); - static_assert(static_cast(RequestDeviceStatus::Error) == WGPURequestDeviceStatus_Error, "value mismatch for RequestDeviceStatus::Error"); - static_assert(static_cast(RequestDeviceStatus::Unknown) == WGPURequestDeviceStatus_Unknown, "value mismatch for RequestDeviceStatus::Unknown"); - - // SType - - static_assert(sizeof(SType) == sizeof(WGPUSType), "sizeof mismatch for SType"); - static_assert(alignof(SType) == alignof(WGPUSType), "alignof mismatch for SType"); - - static_assert(static_cast(SType::Invalid) == WGPUSType_Invalid, "value mismatch for SType::Invalid"); - static_assert(static_cast(SType::SurfaceDescriptorFromMetalLayer) == WGPUSType_SurfaceDescriptorFromMetalLayer, "value mismatch for SType::SurfaceDescriptorFromMetalLayer"); - static_assert(static_cast(SType::SurfaceDescriptorFromWindowsHWND) == WGPUSType_SurfaceDescriptorFromWindowsHWND, "value mismatch for SType::SurfaceDescriptorFromWindowsHWND"); - static_assert(static_cast(SType::SurfaceDescriptorFromXlibWindow) == WGPUSType_SurfaceDescriptorFromXlibWindow, "value mismatch for SType::SurfaceDescriptorFromXlibWindow"); - static_assert(static_cast(SType::SurfaceDescriptorFromCanvasHTMLSelector) == WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector, "value mismatch for SType::SurfaceDescriptorFromCanvasHTMLSelector"); - static_assert(static_cast(SType::ShaderModuleSPIRVDescriptor) == WGPUSType_ShaderModuleSPIRVDescriptor, "value mismatch for SType::ShaderModuleSPIRVDescriptor"); - static_assert(static_cast(SType::ShaderModuleWGSLDescriptor) == WGPUSType_ShaderModuleWGSLDescriptor, "value mismatch for SType::ShaderModuleWGSLDescriptor"); - static_assert(static_cast(SType::PrimitiveDepthClipControl) == WGPUSType_PrimitiveDepthClipControl, "value mismatch for SType::PrimitiveDepthClipControl"); - static_assert(static_cast(SType::SurfaceDescriptorFromWaylandSurface) == WGPUSType_SurfaceDescriptorFromWaylandSurface, "value mismatch for SType::SurfaceDescriptorFromWaylandSurface"); - static_assert(static_cast(SType::SurfaceDescriptorFromAndroidNativeWindow) == WGPUSType_SurfaceDescriptorFromAndroidNativeWindow, "value mismatch for SType::SurfaceDescriptorFromAndroidNativeWindow"); - static_assert(static_cast(SType::SurfaceDescriptorFromWindowsCoreWindow) == WGPUSType_SurfaceDescriptorFromWindowsCoreWindow, "value mismatch for SType::SurfaceDescriptorFromWindowsCoreWindow"); - static_assert(static_cast(SType::ExternalTextureBindingEntry) == WGPUSType_ExternalTextureBindingEntry, "value mismatch for SType::ExternalTextureBindingEntry"); - static_assert(static_cast(SType::ExternalTextureBindingLayout) == WGPUSType_ExternalTextureBindingLayout, "value mismatch for SType::ExternalTextureBindingLayout"); - static_assert(static_cast(SType::SurfaceDescriptorFromWindowsSwapChainPanel) == WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel, "value mismatch for SType::SurfaceDescriptorFromWindowsSwapChainPanel"); - static_assert(static_cast(SType::RenderPassDescriptorMaxDrawCount) == WGPUSType_RenderPassDescriptorMaxDrawCount, "value mismatch for SType::RenderPassDescriptorMaxDrawCount"); - static_assert(static_cast(SType::DepthStencilStateDepthWriteDefinedDawn) == WGPUSType_DepthStencilStateDepthWriteDefinedDawn, "value mismatch for SType::DepthStencilStateDepthWriteDefinedDawn"); - static_assert(static_cast(SType::TextureBindingViewDimensionDescriptor) == WGPUSType_TextureBindingViewDimensionDescriptor, "value mismatch for SType::TextureBindingViewDimensionDescriptor"); - static_assert(static_cast(SType::DawnTextureInternalUsageDescriptor) == WGPUSType_DawnTextureInternalUsageDescriptor, "value mismatch for SType::DawnTextureInternalUsageDescriptor"); - static_assert(static_cast(SType::DawnEncoderInternalUsageDescriptor) == WGPUSType_DawnEncoderInternalUsageDescriptor, "value mismatch for SType::DawnEncoderInternalUsageDescriptor"); - static_assert(static_cast(SType::DawnInstanceDescriptor) == WGPUSType_DawnInstanceDescriptor, "value mismatch for SType::DawnInstanceDescriptor"); - static_assert(static_cast(SType::DawnCacheDeviceDescriptor) == WGPUSType_DawnCacheDeviceDescriptor, "value mismatch for SType::DawnCacheDeviceDescriptor"); - static_assert(static_cast(SType::DawnAdapterPropertiesPowerPreference) == WGPUSType_DawnAdapterPropertiesPowerPreference, "value mismatch for SType::DawnAdapterPropertiesPowerPreference"); - static_assert(static_cast(SType::DawnBufferDescriptorErrorInfoFromWireClient) == WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient, "value mismatch for SType::DawnBufferDescriptorErrorInfoFromWireClient"); - static_assert(static_cast(SType::DawnTogglesDescriptor) == WGPUSType_DawnTogglesDescriptor, "value mismatch for SType::DawnTogglesDescriptor"); - static_assert(static_cast(SType::DawnShaderModuleSPIRVOptionsDescriptor) == WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor, "value mismatch for SType::DawnShaderModuleSPIRVOptionsDescriptor"); - static_assert(static_cast(SType::RequestAdapterOptionsLUID) == WGPUSType_RequestAdapterOptionsLUID, "value mismatch for SType::RequestAdapterOptionsLUID"); - static_assert(static_cast(SType::RequestAdapterOptionsGetGLProc) == WGPUSType_RequestAdapterOptionsGetGLProc, "value mismatch for SType::RequestAdapterOptionsGetGLProc"); - static_assert(static_cast(SType::RequestAdapterOptionsD3D11Device) == WGPUSType_RequestAdapterOptionsD3D11Device, "value mismatch for SType::RequestAdapterOptionsD3D11Device"); - static_assert(static_cast(SType::DawnMultisampleStateRenderToSingleSampled) == WGPUSType_DawnMultisampleStateRenderToSingleSampled, "value mismatch for SType::DawnMultisampleStateRenderToSingleSampled"); - static_assert(static_cast(SType::DawnRenderPassColorAttachmentRenderToSingleSampled) == WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled, "value mismatch for SType::DawnRenderPassColorAttachmentRenderToSingleSampled"); - static_assert(static_cast(SType::RenderPassPixelLocalStorage) == WGPUSType_RenderPassPixelLocalStorage, "value mismatch for SType::RenderPassPixelLocalStorage"); - static_assert(static_cast(SType::PipelineLayoutPixelLocalStorage) == WGPUSType_PipelineLayoutPixelLocalStorage, "value mismatch for SType::PipelineLayoutPixelLocalStorage"); - static_assert(static_cast(SType::BufferHostMappedPointer) == WGPUSType_BufferHostMappedPointer, "value mismatch for SType::BufferHostMappedPointer"); - static_assert(static_cast(SType::DawnExperimentalSubgroupLimits) == WGPUSType_DawnExperimentalSubgroupLimits, "value mismatch for SType::DawnExperimentalSubgroupLimits"); - static_assert(static_cast(SType::AdapterPropertiesMemoryHeaps) == WGPUSType_AdapterPropertiesMemoryHeaps, "value mismatch for SType::AdapterPropertiesMemoryHeaps"); - static_assert(static_cast(SType::AdapterPropertiesD3D) == WGPUSType_AdapterPropertiesD3D, "value mismatch for SType::AdapterPropertiesD3D"); - static_assert(static_cast(SType::AdapterPropertiesVk) == WGPUSType_AdapterPropertiesVk, "value mismatch for SType::AdapterPropertiesVk"); - static_assert(static_cast(SType::DawnComputePipelineFullSubgroups) == WGPUSType_DawnComputePipelineFullSubgroups, "value mismatch for SType::DawnComputePipelineFullSubgroups"); - static_assert(static_cast(SType::DawnWireWGSLControl) == WGPUSType_DawnWireWGSLControl, "value mismatch for SType::DawnWireWGSLControl"); - static_assert(static_cast(SType::DawnWGSLBlocklist) == WGPUSType_DawnWGSLBlocklist, "value mismatch for SType::DawnWGSLBlocklist"); - static_assert(static_cast(SType::DrmFormatCapabilities) == WGPUSType_DrmFormatCapabilities, "value mismatch for SType::DrmFormatCapabilities"); - static_assert(static_cast(SType::SharedTextureMemoryVkImageDescriptor) == WGPUSType_SharedTextureMemoryVkImageDescriptor, "value mismatch for SType::SharedTextureMemoryVkImageDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryVkDedicatedAllocationDescriptor) == WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor, "value mismatch for SType::SharedTextureMemoryVkDedicatedAllocationDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryAHardwareBufferDescriptor) == WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor, "value mismatch for SType::SharedTextureMemoryAHardwareBufferDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryDmaBufDescriptor) == WGPUSType_SharedTextureMemoryDmaBufDescriptor, "value mismatch for SType::SharedTextureMemoryDmaBufDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryOpaqueFDDescriptor) == WGPUSType_SharedTextureMemoryOpaqueFDDescriptor, "value mismatch for SType::SharedTextureMemoryOpaqueFDDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryZirconHandleDescriptor) == WGPUSType_SharedTextureMemoryZirconHandleDescriptor, "value mismatch for SType::SharedTextureMemoryZirconHandleDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryDXGISharedHandleDescriptor) == WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor, "value mismatch for SType::SharedTextureMemoryDXGISharedHandleDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryD3D11Texture2DDescriptor) == WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor, "value mismatch for SType::SharedTextureMemoryD3D11Texture2DDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryIOSurfaceDescriptor) == WGPUSType_SharedTextureMemoryIOSurfaceDescriptor, "value mismatch for SType::SharedTextureMemoryIOSurfaceDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryEGLImageDescriptor) == WGPUSType_SharedTextureMemoryEGLImageDescriptor, "value mismatch for SType::SharedTextureMemoryEGLImageDescriptor"); - static_assert(static_cast(SType::SharedTextureMemoryInitializedBeginState) == WGPUSType_SharedTextureMemoryInitializedBeginState, "value mismatch for SType::SharedTextureMemoryInitializedBeginState"); - static_assert(static_cast(SType::SharedTextureMemoryInitializedEndState) == WGPUSType_SharedTextureMemoryInitializedEndState, "value mismatch for SType::SharedTextureMemoryInitializedEndState"); - static_assert(static_cast(SType::SharedTextureMemoryVkImageLayoutBeginState) == WGPUSType_SharedTextureMemoryVkImageLayoutBeginState, "value mismatch for SType::SharedTextureMemoryVkImageLayoutBeginState"); - static_assert(static_cast(SType::SharedTextureMemoryVkImageLayoutEndState) == WGPUSType_SharedTextureMemoryVkImageLayoutEndState, "value mismatch for SType::SharedTextureMemoryVkImageLayoutEndState"); - static_assert(static_cast(SType::SharedFenceVkSemaphoreOpaqueFDDescriptor) == WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor, "value mismatch for SType::SharedFenceVkSemaphoreOpaqueFDDescriptor"); - static_assert(static_cast(SType::SharedFenceVkSemaphoreOpaqueFDExportInfo) == WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo, "value mismatch for SType::SharedFenceVkSemaphoreOpaqueFDExportInfo"); - static_assert(static_cast(SType::SharedFenceVkSemaphoreSyncFDDescriptor) == WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor, "value mismatch for SType::SharedFenceVkSemaphoreSyncFDDescriptor"); - static_assert(static_cast(SType::SharedFenceVkSemaphoreSyncFDExportInfo) == WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo, "value mismatch for SType::SharedFenceVkSemaphoreSyncFDExportInfo"); - static_assert(static_cast(SType::SharedFenceVkSemaphoreZirconHandleDescriptor) == WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor, "value mismatch for SType::SharedFenceVkSemaphoreZirconHandleDescriptor"); - static_assert(static_cast(SType::SharedFenceVkSemaphoreZirconHandleExportInfo) == WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo, "value mismatch for SType::SharedFenceVkSemaphoreZirconHandleExportInfo"); - static_assert(static_cast(SType::SharedFenceDXGISharedHandleDescriptor) == WGPUSType_SharedFenceDXGISharedHandleDescriptor, "value mismatch for SType::SharedFenceDXGISharedHandleDescriptor"); - static_assert(static_cast(SType::SharedFenceDXGISharedHandleExportInfo) == WGPUSType_SharedFenceDXGISharedHandleExportInfo, "value mismatch for SType::SharedFenceDXGISharedHandleExportInfo"); - static_assert(static_cast(SType::SharedFenceMTLSharedEventDescriptor) == WGPUSType_SharedFenceMTLSharedEventDescriptor, "value mismatch for SType::SharedFenceMTLSharedEventDescriptor"); - static_assert(static_cast(SType::SharedFenceMTLSharedEventExportInfo) == WGPUSType_SharedFenceMTLSharedEventExportInfo, "value mismatch for SType::SharedFenceMTLSharedEventExportInfo"); - static_assert(static_cast(SType::SharedBufferMemoryD3D12ResourceDescriptor) == WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor, "value mismatch for SType::SharedBufferMemoryD3D12ResourceDescriptor"); - static_assert(static_cast(SType::StaticSamplerBindingLayout) == WGPUSType_StaticSamplerBindingLayout, "value mismatch for SType::StaticSamplerBindingLayout"); - - // SamplerBindingType - - static_assert(sizeof(SamplerBindingType) == sizeof(WGPUSamplerBindingType), "sizeof mismatch for SamplerBindingType"); - static_assert(alignof(SamplerBindingType) == alignof(WGPUSamplerBindingType), "alignof mismatch for SamplerBindingType"); - - static_assert(static_cast(SamplerBindingType::Undefined) == WGPUSamplerBindingType_Undefined, "value mismatch for SamplerBindingType::Undefined"); - static_assert(static_cast(SamplerBindingType::Filtering) == WGPUSamplerBindingType_Filtering, "value mismatch for SamplerBindingType::Filtering"); - static_assert(static_cast(SamplerBindingType::NonFiltering) == WGPUSamplerBindingType_NonFiltering, "value mismatch for SamplerBindingType::NonFiltering"); - static_assert(static_cast(SamplerBindingType::Comparison) == WGPUSamplerBindingType_Comparison, "value mismatch for SamplerBindingType::Comparison"); - - // SharedFenceType - - static_assert(sizeof(SharedFenceType) == sizeof(WGPUSharedFenceType), "sizeof mismatch for SharedFenceType"); - static_assert(alignof(SharedFenceType) == alignof(WGPUSharedFenceType), "alignof mismatch for SharedFenceType"); - - static_assert(static_cast(SharedFenceType::Undefined) == WGPUSharedFenceType_Undefined, "value mismatch for SharedFenceType::Undefined"); - static_assert(static_cast(SharedFenceType::VkSemaphoreOpaqueFD) == WGPUSharedFenceType_VkSemaphoreOpaqueFD, "value mismatch for SharedFenceType::VkSemaphoreOpaqueFD"); - static_assert(static_cast(SharedFenceType::VkSemaphoreSyncFD) == WGPUSharedFenceType_VkSemaphoreSyncFD, "value mismatch for SharedFenceType::VkSemaphoreSyncFD"); - static_assert(static_cast(SharedFenceType::VkSemaphoreZirconHandle) == WGPUSharedFenceType_VkSemaphoreZirconHandle, "value mismatch for SharedFenceType::VkSemaphoreZirconHandle"); - static_assert(static_cast(SharedFenceType::DXGISharedHandle) == WGPUSharedFenceType_DXGISharedHandle, "value mismatch for SharedFenceType::DXGISharedHandle"); - static_assert(static_cast(SharedFenceType::MTLSharedEvent) == WGPUSharedFenceType_MTLSharedEvent, "value mismatch for SharedFenceType::MTLSharedEvent"); - - // StencilOperation - - static_assert(sizeof(StencilOperation) == sizeof(WGPUStencilOperation), "sizeof mismatch for StencilOperation"); - static_assert(alignof(StencilOperation) == alignof(WGPUStencilOperation), "alignof mismatch for StencilOperation"); - - static_assert(static_cast(StencilOperation::Undefined) == WGPUStencilOperation_Undefined, "value mismatch for StencilOperation::Undefined"); - static_assert(static_cast(StencilOperation::Keep) == WGPUStencilOperation_Keep, "value mismatch for StencilOperation::Keep"); - static_assert(static_cast(StencilOperation::Zero) == WGPUStencilOperation_Zero, "value mismatch for StencilOperation::Zero"); - static_assert(static_cast(StencilOperation::Replace) == WGPUStencilOperation_Replace, "value mismatch for StencilOperation::Replace"); - static_assert(static_cast(StencilOperation::Invert) == WGPUStencilOperation_Invert, "value mismatch for StencilOperation::Invert"); - static_assert(static_cast(StencilOperation::IncrementClamp) == WGPUStencilOperation_IncrementClamp, "value mismatch for StencilOperation::IncrementClamp"); - static_assert(static_cast(StencilOperation::DecrementClamp) == WGPUStencilOperation_DecrementClamp, "value mismatch for StencilOperation::DecrementClamp"); - static_assert(static_cast(StencilOperation::IncrementWrap) == WGPUStencilOperation_IncrementWrap, "value mismatch for StencilOperation::IncrementWrap"); - static_assert(static_cast(StencilOperation::DecrementWrap) == WGPUStencilOperation_DecrementWrap, "value mismatch for StencilOperation::DecrementWrap"); - - // StorageTextureAccess - - static_assert(sizeof(StorageTextureAccess) == sizeof(WGPUStorageTextureAccess), "sizeof mismatch for StorageTextureAccess"); - static_assert(alignof(StorageTextureAccess) == alignof(WGPUStorageTextureAccess), "alignof mismatch for StorageTextureAccess"); - - static_assert(static_cast(StorageTextureAccess::Undefined) == WGPUStorageTextureAccess_Undefined, "value mismatch for StorageTextureAccess::Undefined"); - static_assert(static_cast(StorageTextureAccess::WriteOnly) == WGPUStorageTextureAccess_WriteOnly, "value mismatch for StorageTextureAccess::WriteOnly"); - static_assert(static_cast(StorageTextureAccess::ReadOnly) == WGPUStorageTextureAccess_ReadOnly, "value mismatch for StorageTextureAccess::ReadOnly"); - static_assert(static_cast(StorageTextureAccess::ReadWrite) == WGPUStorageTextureAccess_ReadWrite, "value mismatch for StorageTextureAccess::ReadWrite"); - - // StoreOp - - static_assert(sizeof(StoreOp) == sizeof(WGPUStoreOp), "sizeof mismatch for StoreOp"); - static_assert(alignof(StoreOp) == alignof(WGPUStoreOp), "alignof mismatch for StoreOp"); - - static_assert(static_cast(StoreOp::Undefined) == WGPUStoreOp_Undefined, "value mismatch for StoreOp::Undefined"); - static_assert(static_cast(StoreOp::Store) == WGPUStoreOp_Store, "value mismatch for StoreOp::Store"); - static_assert(static_cast(StoreOp::Discard) == WGPUStoreOp_Discard, "value mismatch for StoreOp::Discard"); - - // TextureAspect - - static_assert(sizeof(TextureAspect) == sizeof(WGPUTextureAspect), "sizeof mismatch for TextureAspect"); - static_assert(alignof(TextureAspect) == alignof(WGPUTextureAspect), "alignof mismatch for TextureAspect"); - - static_assert(static_cast(TextureAspect::Undefined) == WGPUTextureAspect_Undefined, "value mismatch for TextureAspect::Undefined"); - static_assert(static_cast(TextureAspect::All) == WGPUTextureAspect_All, "value mismatch for TextureAspect::All"); - static_assert(static_cast(TextureAspect::StencilOnly) == WGPUTextureAspect_StencilOnly, "value mismatch for TextureAspect::StencilOnly"); - static_assert(static_cast(TextureAspect::DepthOnly) == WGPUTextureAspect_DepthOnly, "value mismatch for TextureAspect::DepthOnly"); - static_assert(static_cast(TextureAspect::Plane0Only) == WGPUTextureAspect_Plane0Only, "value mismatch for TextureAspect::Plane0Only"); - static_assert(static_cast(TextureAspect::Plane1Only) == WGPUTextureAspect_Plane1Only, "value mismatch for TextureAspect::Plane1Only"); - static_assert(static_cast(TextureAspect::Plane2Only) == WGPUTextureAspect_Plane2Only, "value mismatch for TextureAspect::Plane2Only"); - - // TextureDimension - - static_assert(sizeof(TextureDimension) == sizeof(WGPUTextureDimension), "sizeof mismatch for TextureDimension"); - static_assert(alignof(TextureDimension) == alignof(WGPUTextureDimension), "alignof mismatch for TextureDimension"); - - static_assert(static_cast(TextureDimension::Undefined) == WGPUTextureDimension_Undefined, "value mismatch for TextureDimension::Undefined"); - static_assert(static_cast(TextureDimension::e1D) == WGPUTextureDimension_1D, "value mismatch for TextureDimension::e1D"); - static_assert(static_cast(TextureDimension::e2D) == WGPUTextureDimension_2D, "value mismatch for TextureDimension::e2D"); - static_assert(static_cast(TextureDimension::e3D) == WGPUTextureDimension_3D, "value mismatch for TextureDimension::e3D"); - - // TextureFormat - - static_assert(sizeof(TextureFormat) == sizeof(WGPUTextureFormat), "sizeof mismatch for TextureFormat"); - static_assert(alignof(TextureFormat) == alignof(WGPUTextureFormat), "alignof mismatch for TextureFormat"); - - static_assert(static_cast(TextureFormat::Undefined) == WGPUTextureFormat_Undefined, "value mismatch for TextureFormat::Undefined"); - static_assert(static_cast(TextureFormat::R8Unorm) == WGPUTextureFormat_R8Unorm, "value mismatch for TextureFormat::R8Unorm"); - static_assert(static_cast(TextureFormat::R8Snorm) == WGPUTextureFormat_R8Snorm, "value mismatch for TextureFormat::R8Snorm"); - static_assert(static_cast(TextureFormat::R8Uint) == WGPUTextureFormat_R8Uint, "value mismatch for TextureFormat::R8Uint"); - static_assert(static_cast(TextureFormat::R8Sint) == WGPUTextureFormat_R8Sint, "value mismatch for TextureFormat::R8Sint"); - static_assert(static_cast(TextureFormat::R16Uint) == WGPUTextureFormat_R16Uint, "value mismatch for TextureFormat::R16Uint"); - static_assert(static_cast(TextureFormat::R16Sint) == WGPUTextureFormat_R16Sint, "value mismatch for TextureFormat::R16Sint"); - static_assert(static_cast(TextureFormat::R16Float) == WGPUTextureFormat_R16Float, "value mismatch for TextureFormat::R16Float"); - static_assert(static_cast(TextureFormat::RG8Unorm) == WGPUTextureFormat_RG8Unorm, "value mismatch for TextureFormat::RG8Unorm"); - static_assert(static_cast(TextureFormat::RG8Snorm) == WGPUTextureFormat_RG8Snorm, "value mismatch for TextureFormat::RG8Snorm"); - static_assert(static_cast(TextureFormat::RG8Uint) == WGPUTextureFormat_RG8Uint, "value mismatch for TextureFormat::RG8Uint"); - static_assert(static_cast(TextureFormat::RG8Sint) == WGPUTextureFormat_RG8Sint, "value mismatch for TextureFormat::RG8Sint"); - static_assert(static_cast(TextureFormat::R32Float) == WGPUTextureFormat_R32Float, "value mismatch for TextureFormat::R32Float"); - static_assert(static_cast(TextureFormat::R32Uint) == WGPUTextureFormat_R32Uint, "value mismatch for TextureFormat::R32Uint"); - static_assert(static_cast(TextureFormat::R32Sint) == WGPUTextureFormat_R32Sint, "value mismatch for TextureFormat::R32Sint"); - static_assert(static_cast(TextureFormat::RG16Uint) == WGPUTextureFormat_RG16Uint, "value mismatch for TextureFormat::RG16Uint"); - static_assert(static_cast(TextureFormat::RG16Sint) == WGPUTextureFormat_RG16Sint, "value mismatch for TextureFormat::RG16Sint"); - static_assert(static_cast(TextureFormat::RG16Float) == WGPUTextureFormat_RG16Float, "value mismatch for TextureFormat::RG16Float"); - static_assert(static_cast(TextureFormat::RGBA8Unorm) == WGPUTextureFormat_RGBA8Unorm, "value mismatch for TextureFormat::RGBA8Unorm"); - static_assert(static_cast(TextureFormat::RGBA8UnormSrgb) == WGPUTextureFormat_RGBA8UnormSrgb, "value mismatch for TextureFormat::RGBA8UnormSrgb"); - static_assert(static_cast(TextureFormat::RGBA8Snorm) == WGPUTextureFormat_RGBA8Snorm, "value mismatch for TextureFormat::RGBA8Snorm"); - static_assert(static_cast(TextureFormat::RGBA8Uint) == WGPUTextureFormat_RGBA8Uint, "value mismatch for TextureFormat::RGBA8Uint"); - static_assert(static_cast(TextureFormat::RGBA8Sint) == WGPUTextureFormat_RGBA8Sint, "value mismatch for TextureFormat::RGBA8Sint"); - static_assert(static_cast(TextureFormat::BGRA8Unorm) == WGPUTextureFormat_BGRA8Unorm, "value mismatch for TextureFormat::BGRA8Unorm"); - static_assert(static_cast(TextureFormat::BGRA8UnormSrgb) == WGPUTextureFormat_BGRA8UnormSrgb, "value mismatch for TextureFormat::BGRA8UnormSrgb"); - static_assert(static_cast(TextureFormat::RGB10A2Uint) == WGPUTextureFormat_RGB10A2Uint, "value mismatch for TextureFormat::RGB10A2Uint"); - static_assert(static_cast(TextureFormat::RGB10A2Unorm) == WGPUTextureFormat_RGB10A2Unorm, "value mismatch for TextureFormat::RGB10A2Unorm"); - static_assert(static_cast(TextureFormat::RG11B10Ufloat) == WGPUTextureFormat_RG11B10Ufloat, "value mismatch for TextureFormat::RG11B10Ufloat"); - static_assert(static_cast(TextureFormat::RGB9E5Ufloat) == WGPUTextureFormat_RGB9E5Ufloat, "value mismatch for TextureFormat::RGB9E5Ufloat"); - static_assert(static_cast(TextureFormat::RG32Float) == WGPUTextureFormat_RG32Float, "value mismatch for TextureFormat::RG32Float"); - static_assert(static_cast(TextureFormat::RG32Uint) == WGPUTextureFormat_RG32Uint, "value mismatch for TextureFormat::RG32Uint"); - static_assert(static_cast(TextureFormat::RG32Sint) == WGPUTextureFormat_RG32Sint, "value mismatch for TextureFormat::RG32Sint"); - static_assert(static_cast(TextureFormat::RGBA16Uint) == WGPUTextureFormat_RGBA16Uint, "value mismatch for TextureFormat::RGBA16Uint"); - static_assert(static_cast(TextureFormat::RGBA16Sint) == WGPUTextureFormat_RGBA16Sint, "value mismatch for TextureFormat::RGBA16Sint"); - static_assert(static_cast(TextureFormat::RGBA16Float) == WGPUTextureFormat_RGBA16Float, "value mismatch for TextureFormat::RGBA16Float"); - static_assert(static_cast(TextureFormat::RGBA32Float) == WGPUTextureFormat_RGBA32Float, "value mismatch for TextureFormat::RGBA32Float"); - static_assert(static_cast(TextureFormat::RGBA32Uint) == WGPUTextureFormat_RGBA32Uint, "value mismatch for TextureFormat::RGBA32Uint"); - static_assert(static_cast(TextureFormat::RGBA32Sint) == WGPUTextureFormat_RGBA32Sint, "value mismatch for TextureFormat::RGBA32Sint"); - static_assert(static_cast(TextureFormat::Stencil8) == WGPUTextureFormat_Stencil8, "value mismatch for TextureFormat::Stencil8"); - static_assert(static_cast(TextureFormat::Depth16Unorm) == WGPUTextureFormat_Depth16Unorm, "value mismatch for TextureFormat::Depth16Unorm"); - static_assert(static_cast(TextureFormat::Depth24Plus) == WGPUTextureFormat_Depth24Plus, "value mismatch for TextureFormat::Depth24Plus"); - static_assert(static_cast(TextureFormat::Depth24PlusStencil8) == WGPUTextureFormat_Depth24PlusStencil8, "value mismatch for TextureFormat::Depth24PlusStencil8"); - static_assert(static_cast(TextureFormat::Depth32Float) == WGPUTextureFormat_Depth32Float, "value mismatch for TextureFormat::Depth32Float"); - static_assert(static_cast(TextureFormat::Depth32FloatStencil8) == WGPUTextureFormat_Depth32FloatStencil8, "value mismatch for TextureFormat::Depth32FloatStencil8"); - static_assert(static_cast(TextureFormat::BC1RGBAUnorm) == WGPUTextureFormat_BC1RGBAUnorm, "value mismatch for TextureFormat::BC1RGBAUnorm"); - static_assert(static_cast(TextureFormat::BC1RGBAUnormSrgb) == WGPUTextureFormat_BC1RGBAUnormSrgb, "value mismatch for TextureFormat::BC1RGBAUnormSrgb"); - static_assert(static_cast(TextureFormat::BC2RGBAUnorm) == WGPUTextureFormat_BC2RGBAUnorm, "value mismatch for TextureFormat::BC2RGBAUnorm"); - static_assert(static_cast(TextureFormat::BC2RGBAUnormSrgb) == WGPUTextureFormat_BC2RGBAUnormSrgb, "value mismatch for TextureFormat::BC2RGBAUnormSrgb"); - static_assert(static_cast(TextureFormat::BC3RGBAUnorm) == WGPUTextureFormat_BC3RGBAUnorm, "value mismatch for TextureFormat::BC3RGBAUnorm"); - static_assert(static_cast(TextureFormat::BC3RGBAUnormSrgb) == WGPUTextureFormat_BC3RGBAUnormSrgb, "value mismatch for TextureFormat::BC3RGBAUnormSrgb"); - static_assert(static_cast(TextureFormat::BC4RUnorm) == WGPUTextureFormat_BC4RUnorm, "value mismatch for TextureFormat::BC4RUnorm"); - static_assert(static_cast(TextureFormat::BC4RSnorm) == WGPUTextureFormat_BC4RSnorm, "value mismatch for TextureFormat::BC4RSnorm"); - static_assert(static_cast(TextureFormat::BC5RGUnorm) == WGPUTextureFormat_BC5RGUnorm, "value mismatch for TextureFormat::BC5RGUnorm"); - static_assert(static_cast(TextureFormat::BC5RGSnorm) == WGPUTextureFormat_BC5RGSnorm, "value mismatch for TextureFormat::BC5RGSnorm"); - static_assert(static_cast(TextureFormat::BC6HRGBUfloat) == WGPUTextureFormat_BC6HRGBUfloat, "value mismatch for TextureFormat::BC6HRGBUfloat"); - static_assert(static_cast(TextureFormat::BC6HRGBFloat) == WGPUTextureFormat_BC6HRGBFloat, "value mismatch for TextureFormat::BC6HRGBFloat"); - static_assert(static_cast(TextureFormat::BC7RGBAUnorm) == WGPUTextureFormat_BC7RGBAUnorm, "value mismatch for TextureFormat::BC7RGBAUnorm"); - static_assert(static_cast(TextureFormat::BC7RGBAUnormSrgb) == WGPUTextureFormat_BC7RGBAUnormSrgb, "value mismatch for TextureFormat::BC7RGBAUnormSrgb"); - static_assert(static_cast(TextureFormat::ETC2RGB8Unorm) == WGPUTextureFormat_ETC2RGB8Unorm, "value mismatch for TextureFormat::ETC2RGB8Unorm"); - static_assert(static_cast(TextureFormat::ETC2RGB8UnormSrgb) == WGPUTextureFormat_ETC2RGB8UnormSrgb, "value mismatch for TextureFormat::ETC2RGB8UnormSrgb"); - static_assert(static_cast(TextureFormat::ETC2RGB8A1Unorm) == WGPUTextureFormat_ETC2RGB8A1Unorm, "value mismatch for TextureFormat::ETC2RGB8A1Unorm"); - static_assert(static_cast(TextureFormat::ETC2RGB8A1UnormSrgb) == WGPUTextureFormat_ETC2RGB8A1UnormSrgb, "value mismatch for TextureFormat::ETC2RGB8A1UnormSrgb"); - static_assert(static_cast(TextureFormat::ETC2RGBA8Unorm) == WGPUTextureFormat_ETC2RGBA8Unorm, "value mismatch for TextureFormat::ETC2RGBA8Unorm"); - static_assert(static_cast(TextureFormat::ETC2RGBA8UnormSrgb) == WGPUTextureFormat_ETC2RGBA8UnormSrgb, "value mismatch for TextureFormat::ETC2RGBA8UnormSrgb"); - static_assert(static_cast(TextureFormat::EACR11Unorm) == WGPUTextureFormat_EACR11Unorm, "value mismatch for TextureFormat::EACR11Unorm"); - static_assert(static_cast(TextureFormat::EACR11Snorm) == WGPUTextureFormat_EACR11Snorm, "value mismatch for TextureFormat::EACR11Snorm"); - static_assert(static_cast(TextureFormat::EACRG11Unorm) == WGPUTextureFormat_EACRG11Unorm, "value mismatch for TextureFormat::EACRG11Unorm"); - static_assert(static_cast(TextureFormat::EACRG11Snorm) == WGPUTextureFormat_EACRG11Snorm, "value mismatch for TextureFormat::EACRG11Snorm"); - static_assert(static_cast(TextureFormat::ASTC4x4Unorm) == WGPUTextureFormat_ASTC4x4Unorm, "value mismatch for TextureFormat::ASTC4x4Unorm"); - static_assert(static_cast(TextureFormat::ASTC4x4UnormSrgb) == WGPUTextureFormat_ASTC4x4UnormSrgb, "value mismatch for TextureFormat::ASTC4x4UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC5x4Unorm) == WGPUTextureFormat_ASTC5x4Unorm, "value mismatch for TextureFormat::ASTC5x4Unorm"); - static_assert(static_cast(TextureFormat::ASTC5x4UnormSrgb) == WGPUTextureFormat_ASTC5x4UnormSrgb, "value mismatch for TextureFormat::ASTC5x4UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC5x5Unorm) == WGPUTextureFormat_ASTC5x5Unorm, "value mismatch for TextureFormat::ASTC5x5Unorm"); - static_assert(static_cast(TextureFormat::ASTC5x5UnormSrgb) == WGPUTextureFormat_ASTC5x5UnormSrgb, "value mismatch for TextureFormat::ASTC5x5UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC6x5Unorm) == WGPUTextureFormat_ASTC6x5Unorm, "value mismatch for TextureFormat::ASTC6x5Unorm"); - static_assert(static_cast(TextureFormat::ASTC6x5UnormSrgb) == WGPUTextureFormat_ASTC6x5UnormSrgb, "value mismatch for TextureFormat::ASTC6x5UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC6x6Unorm) == WGPUTextureFormat_ASTC6x6Unorm, "value mismatch for TextureFormat::ASTC6x6Unorm"); - static_assert(static_cast(TextureFormat::ASTC6x6UnormSrgb) == WGPUTextureFormat_ASTC6x6UnormSrgb, "value mismatch for TextureFormat::ASTC6x6UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC8x5Unorm) == WGPUTextureFormat_ASTC8x5Unorm, "value mismatch for TextureFormat::ASTC8x5Unorm"); - static_assert(static_cast(TextureFormat::ASTC8x5UnormSrgb) == WGPUTextureFormat_ASTC8x5UnormSrgb, "value mismatch for TextureFormat::ASTC8x5UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC8x6Unorm) == WGPUTextureFormat_ASTC8x6Unorm, "value mismatch for TextureFormat::ASTC8x6Unorm"); - static_assert(static_cast(TextureFormat::ASTC8x6UnormSrgb) == WGPUTextureFormat_ASTC8x6UnormSrgb, "value mismatch for TextureFormat::ASTC8x6UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC8x8Unorm) == WGPUTextureFormat_ASTC8x8Unorm, "value mismatch for TextureFormat::ASTC8x8Unorm"); - static_assert(static_cast(TextureFormat::ASTC8x8UnormSrgb) == WGPUTextureFormat_ASTC8x8UnormSrgb, "value mismatch for TextureFormat::ASTC8x8UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC10x5Unorm) == WGPUTextureFormat_ASTC10x5Unorm, "value mismatch for TextureFormat::ASTC10x5Unorm"); - static_assert(static_cast(TextureFormat::ASTC10x5UnormSrgb) == WGPUTextureFormat_ASTC10x5UnormSrgb, "value mismatch for TextureFormat::ASTC10x5UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC10x6Unorm) == WGPUTextureFormat_ASTC10x6Unorm, "value mismatch for TextureFormat::ASTC10x6Unorm"); - static_assert(static_cast(TextureFormat::ASTC10x6UnormSrgb) == WGPUTextureFormat_ASTC10x6UnormSrgb, "value mismatch for TextureFormat::ASTC10x6UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC10x8Unorm) == WGPUTextureFormat_ASTC10x8Unorm, "value mismatch for TextureFormat::ASTC10x8Unorm"); - static_assert(static_cast(TextureFormat::ASTC10x8UnormSrgb) == WGPUTextureFormat_ASTC10x8UnormSrgb, "value mismatch for TextureFormat::ASTC10x8UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC10x10Unorm) == WGPUTextureFormat_ASTC10x10Unorm, "value mismatch for TextureFormat::ASTC10x10Unorm"); - static_assert(static_cast(TextureFormat::ASTC10x10UnormSrgb) == WGPUTextureFormat_ASTC10x10UnormSrgb, "value mismatch for TextureFormat::ASTC10x10UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC12x10Unorm) == WGPUTextureFormat_ASTC12x10Unorm, "value mismatch for TextureFormat::ASTC12x10Unorm"); - static_assert(static_cast(TextureFormat::ASTC12x10UnormSrgb) == WGPUTextureFormat_ASTC12x10UnormSrgb, "value mismatch for TextureFormat::ASTC12x10UnormSrgb"); - static_assert(static_cast(TextureFormat::ASTC12x12Unorm) == WGPUTextureFormat_ASTC12x12Unorm, "value mismatch for TextureFormat::ASTC12x12Unorm"); - static_assert(static_cast(TextureFormat::ASTC12x12UnormSrgb) == WGPUTextureFormat_ASTC12x12UnormSrgb, "value mismatch for TextureFormat::ASTC12x12UnormSrgb"); - static_assert(static_cast(TextureFormat::R16Unorm) == WGPUTextureFormat_R16Unorm, "value mismatch for TextureFormat::R16Unorm"); - static_assert(static_cast(TextureFormat::RG16Unorm) == WGPUTextureFormat_RG16Unorm, "value mismatch for TextureFormat::RG16Unorm"); - static_assert(static_cast(TextureFormat::RGBA16Unorm) == WGPUTextureFormat_RGBA16Unorm, "value mismatch for TextureFormat::RGBA16Unorm"); - static_assert(static_cast(TextureFormat::R16Snorm) == WGPUTextureFormat_R16Snorm, "value mismatch for TextureFormat::R16Snorm"); - static_assert(static_cast(TextureFormat::RG16Snorm) == WGPUTextureFormat_RG16Snorm, "value mismatch for TextureFormat::RG16Snorm"); - static_assert(static_cast(TextureFormat::RGBA16Snorm) == WGPUTextureFormat_RGBA16Snorm, "value mismatch for TextureFormat::RGBA16Snorm"); - static_assert(static_cast(TextureFormat::R8BG8Biplanar420Unorm) == WGPUTextureFormat_R8BG8Biplanar420Unorm, "value mismatch for TextureFormat::R8BG8Biplanar420Unorm"); - static_assert(static_cast(TextureFormat::R10X6BG10X6Biplanar420Unorm) == WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm, "value mismatch for TextureFormat::R10X6BG10X6Biplanar420Unorm"); - static_assert(static_cast(TextureFormat::R8BG8A8Triplanar420Unorm) == WGPUTextureFormat_R8BG8A8Triplanar420Unorm, "value mismatch for TextureFormat::R8BG8A8Triplanar420Unorm"); - - // TextureSampleType - - static_assert(sizeof(TextureSampleType) == sizeof(WGPUTextureSampleType), "sizeof mismatch for TextureSampleType"); - static_assert(alignof(TextureSampleType) == alignof(WGPUTextureSampleType), "alignof mismatch for TextureSampleType"); - - static_assert(static_cast(TextureSampleType::Undefined) == WGPUTextureSampleType_Undefined, "value mismatch for TextureSampleType::Undefined"); - static_assert(static_cast(TextureSampleType::Float) == WGPUTextureSampleType_Float, "value mismatch for TextureSampleType::Float"); - static_assert(static_cast(TextureSampleType::UnfilterableFloat) == WGPUTextureSampleType_UnfilterableFloat, "value mismatch for TextureSampleType::UnfilterableFloat"); - static_assert(static_cast(TextureSampleType::Depth) == WGPUTextureSampleType_Depth, "value mismatch for TextureSampleType::Depth"); - static_assert(static_cast(TextureSampleType::Sint) == WGPUTextureSampleType_Sint, "value mismatch for TextureSampleType::Sint"); - static_assert(static_cast(TextureSampleType::Uint) == WGPUTextureSampleType_Uint, "value mismatch for TextureSampleType::Uint"); - - // TextureViewDimension - - static_assert(sizeof(TextureViewDimension) == sizeof(WGPUTextureViewDimension), "sizeof mismatch for TextureViewDimension"); - static_assert(alignof(TextureViewDimension) == alignof(WGPUTextureViewDimension), "alignof mismatch for TextureViewDimension"); - - static_assert(static_cast(TextureViewDimension::Undefined) == WGPUTextureViewDimension_Undefined, "value mismatch for TextureViewDimension::Undefined"); - static_assert(static_cast(TextureViewDimension::e1D) == WGPUTextureViewDimension_1D, "value mismatch for TextureViewDimension::e1D"); - static_assert(static_cast(TextureViewDimension::e2D) == WGPUTextureViewDimension_2D, "value mismatch for TextureViewDimension::e2D"); - static_assert(static_cast(TextureViewDimension::e2DArray) == WGPUTextureViewDimension_2DArray, "value mismatch for TextureViewDimension::e2DArray"); - static_assert(static_cast(TextureViewDimension::Cube) == WGPUTextureViewDimension_Cube, "value mismatch for TextureViewDimension::Cube"); - static_assert(static_cast(TextureViewDimension::CubeArray) == WGPUTextureViewDimension_CubeArray, "value mismatch for TextureViewDimension::CubeArray"); - static_assert(static_cast(TextureViewDimension::e3D) == WGPUTextureViewDimension_3D, "value mismatch for TextureViewDimension::e3D"); - - // VertexFormat - - static_assert(sizeof(VertexFormat) == sizeof(WGPUVertexFormat), "sizeof mismatch for VertexFormat"); - static_assert(alignof(VertexFormat) == alignof(WGPUVertexFormat), "alignof mismatch for VertexFormat"); - - static_assert(static_cast(VertexFormat::Undefined) == WGPUVertexFormat_Undefined, "value mismatch for VertexFormat::Undefined"); - static_assert(static_cast(VertexFormat::Uint8x2) == WGPUVertexFormat_Uint8x2, "value mismatch for VertexFormat::Uint8x2"); - static_assert(static_cast(VertexFormat::Uint8x4) == WGPUVertexFormat_Uint8x4, "value mismatch for VertexFormat::Uint8x4"); - static_assert(static_cast(VertexFormat::Sint8x2) == WGPUVertexFormat_Sint8x2, "value mismatch for VertexFormat::Sint8x2"); - static_assert(static_cast(VertexFormat::Sint8x4) == WGPUVertexFormat_Sint8x4, "value mismatch for VertexFormat::Sint8x4"); - static_assert(static_cast(VertexFormat::Unorm8x2) == WGPUVertexFormat_Unorm8x2, "value mismatch for VertexFormat::Unorm8x2"); - static_assert(static_cast(VertexFormat::Unorm8x4) == WGPUVertexFormat_Unorm8x4, "value mismatch for VertexFormat::Unorm8x4"); - static_assert(static_cast(VertexFormat::Snorm8x2) == WGPUVertexFormat_Snorm8x2, "value mismatch for VertexFormat::Snorm8x2"); - static_assert(static_cast(VertexFormat::Snorm8x4) == WGPUVertexFormat_Snorm8x4, "value mismatch for VertexFormat::Snorm8x4"); - static_assert(static_cast(VertexFormat::Uint16x2) == WGPUVertexFormat_Uint16x2, "value mismatch for VertexFormat::Uint16x2"); - static_assert(static_cast(VertexFormat::Uint16x4) == WGPUVertexFormat_Uint16x4, "value mismatch for VertexFormat::Uint16x4"); - static_assert(static_cast(VertexFormat::Sint16x2) == WGPUVertexFormat_Sint16x2, "value mismatch for VertexFormat::Sint16x2"); - static_assert(static_cast(VertexFormat::Sint16x4) == WGPUVertexFormat_Sint16x4, "value mismatch for VertexFormat::Sint16x4"); - static_assert(static_cast(VertexFormat::Unorm16x2) == WGPUVertexFormat_Unorm16x2, "value mismatch for VertexFormat::Unorm16x2"); - static_assert(static_cast(VertexFormat::Unorm16x4) == WGPUVertexFormat_Unorm16x4, "value mismatch for VertexFormat::Unorm16x4"); - static_assert(static_cast(VertexFormat::Snorm16x2) == WGPUVertexFormat_Snorm16x2, "value mismatch for VertexFormat::Snorm16x2"); - static_assert(static_cast(VertexFormat::Snorm16x4) == WGPUVertexFormat_Snorm16x4, "value mismatch for VertexFormat::Snorm16x4"); - static_assert(static_cast(VertexFormat::Float16x2) == WGPUVertexFormat_Float16x2, "value mismatch for VertexFormat::Float16x2"); - static_assert(static_cast(VertexFormat::Float16x4) == WGPUVertexFormat_Float16x4, "value mismatch for VertexFormat::Float16x4"); - static_assert(static_cast(VertexFormat::Float32) == WGPUVertexFormat_Float32, "value mismatch for VertexFormat::Float32"); - static_assert(static_cast(VertexFormat::Float32x2) == WGPUVertexFormat_Float32x2, "value mismatch for VertexFormat::Float32x2"); - static_assert(static_cast(VertexFormat::Float32x3) == WGPUVertexFormat_Float32x3, "value mismatch for VertexFormat::Float32x3"); - static_assert(static_cast(VertexFormat::Float32x4) == WGPUVertexFormat_Float32x4, "value mismatch for VertexFormat::Float32x4"); - static_assert(static_cast(VertexFormat::Uint32) == WGPUVertexFormat_Uint32, "value mismatch for VertexFormat::Uint32"); - static_assert(static_cast(VertexFormat::Uint32x2) == WGPUVertexFormat_Uint32x2, "value mismatch for VertexFormat::Uint32x2"); - static_assert(static_cast(VertexFormat::Uint32x3) == WGPUVertexFormat_Uint32x3, "value mismatch for VertexFormat::Uint32x3"); - static_assert(static_cast(VertexFormat::Uint32x4) == WGPUVertexFormat_Uint32x4, "value mismatch for VertexFormat::Uint32x4"); - static_assert(static_cast(VertexFormat::Sint32) == WGPUVertexFormat_Sint32, "value mismatch for VertexFormat::Sint32"); - static_assert(static_cast(VertexFormat::Sint32x2) == WGPUVertexFormat_Sint32x2, "value mismatch for VertexFormat::Sint32x2"); - static_assert(static_cast(VertexFormat::Sint32x3) == WGPUVertexFormat_Sint32x3, "value mismatch for VertexFormat::Sint32x3"); - static_assert(static_cast(VertexFormat::Sint32x4) == WGPUVertexFormat_Sint32x4, "value mismatch for VertexFormat::Sint32x4"); - static_assert(static_cast(VertexFormat::Unorm10_10_10_2) == WGPUVertexFormat_Unorm10_10_10_2, "value mismatch for VertexFormat::Unorm10_10_10_2"); - - // VertexStepMode - - static_assert(sizeof(VertexStepMode) == sizeof(WGPUVertexStepMode), "sizeof mismatch for VertexStepMode"); - static_assert(alignof(VertexStepMode) == alignof(WGPUVertexStepMode), "alignof mismatch for VertexStepMode"); - - static_assert(static_cast(VertexStepMode::Undefined) == WGPUVertexStepMode_Undefined, "value mismatch for VertexStepMode::Undefined"); - static_assert(static_cast(VertexStepMode::VertexBufferNotUsed) == WGPUVertexStepMode_VertexBufferNotUsed, "value mismatch for VertexStepMode::VertexBufferNotUsed"); - static_assert(static_cast(VertexStepMode::Vertex) == WGPUVertexStepMode_Vertex, "value mismatch for VertexStepMode::Vertex"); - static_assert(static_cast(VertexStepMode::Instance) == WGPUVertexStepMode_Instance, "value mismatch for VertexStepMode::Instance"); - - // WaitStatus - - static_assert(sizeof(WaitStatus) == sizeof(WGPUWaitStatus), "sizeof mismatch for WaitStatus"); - static_assert(alignof(WaitStatus) == alignof(WGPUWaitStatus), "alignof mismatch for WaitStatus"); - - static_assert(static_cast(WaitStatus::Success) == WGPUWaitStatus_Success, "value mismatch for WaitStatus::Success"); - static_assert(static_cast(WaitStatus::TimedOut) == WGPUWaitStatus_TimedOut, "value mismatch for WaitStatus::TimedOut"); - static_assert(static_cast(WaitStatus::UnsupportedTimeout) == WGPUWaitStatus_UnsupportedTimeout, "value mismatch for WaitStatus::UnsupportedTimeout"); - static_assert(static_cast(WaitStatus::UnsupportedCount) == WGPUWaitStatus_UnsupportedCount, "value mismatch for WaitStatus::UnsupportedCount"); - static_assert(static_cast(WaitStatus::UnsupportedMixedSources) == WGPUWaitStatus_UnsupportedMixedSources, "value mismatch for WaitStatus::UnsupportedMixedSources"); - static_assert(static_cast(WaitStatus::Unknown) == WGPUWaitStatus_Unknown, "value mismatch for WaitStatus::Unknown"); - - // BufferUsage - - static_assert(sizeof(BufferUsage) == sizeof(WGPUBufferUsageFlags), "sizeof mismatch for BufferUsage"); - static_assert(alignof(BufferUsage) == alignof(WGPUBufferUsageFlags), "alignof mismatch for BufferUsage"); - - static_assert(static_cast(BufferUsage::None) == WGPUBufferUsage_None, "value mismatch for BufferUsage::None"); - static_assert(static_cast(BufferUsage::MapRead) == WGPUBufferUsage_MapRead, "value mismatch for BufferUsage::MapRead"); - static_assert(static_cast(BufferUsage::MapWrite) == WGPUBufferUsage_MapWrite, "value mismatch for BufferUsage::MapWrite"); - static_assert(static_cast(BufferUsage::CopySrc) == WGPUBufferUsage_CopySrc, "value mismatch for BufferUsage::CopySrc"); - static_assert(static_cast(BufferUsage::CopyDst) == WGPUBufferUsage_CopyDst, "value mismatch for BufferUsage::CopyDst"); - static_assert(static_cast(BufferUsage::Index) == WGPUBufferUsage_Index, "value mismatch for BufferUsage::Index"); - static_assert(static_cast(BufferUsage::Vertex) == WGPUBufferUsage_Vertex, "value mismatch for BufferUsage::Vertex"); - static_assert(static_cast(BufferUsage::Uniform) == WGPUBufferUsage_Uniform, "value mismatch for BufferUsage::Uniform"); - static_assert(static_cast(BufferUsage::Storage) == WGPUBufferUsage_Storage, "value mismatch for BufferUsage::Storage"); - static_assert(static_cast(BufferUsage::Indirect) == WGPUBufferUsage_Indirect, "value mismatch for BufferUsage::Indirect"); - static_assert(static_cast(BufferUsage::QueryResolve) == WGPUBufferUsage_QueryResolve, "value mismatch for BufferUsage::QueryResolve"); - - // ColorWriteMask - - static_assert(sizeof(ColorWriteMask) == sizeof(WGPUColorWriteMaskFlags), "sizeof mismatch for ColorWriteMask"); - static_assert(alignof(ColorWriteMask) == alignof(WGPUColorWriteMaskFlags), "alignof mismatch for ColorWriteMask"); - - static_assert(static_cast(ColorWriteMask::None) == WGPUColorWriteMask_None, "value mismatch for ColorWriteMask::None"); - static_assert(static_cast(ColorWriteMask::Red) == WGPUColorWriteMask_Red, "value mismatch for ColorWriteMask::Red"); - static_assert(static_cast(ColorWriteMask::Green) == WGPUColorWriteMask_Green, "value mismatch for ColorWriteMask::Green"); - static_assert(static_cast(ColorWriteMask::Blue) == WGPUColorWriteMask_Blue, "value mismatch for ColorWriteMask::Blue"); - static_assert(static_cast(ColorWriteMask::Alpha) == WGPUColorWriteMask_Alpha, "value mismatch for ColorWriteMask::Alpha"); - static_assert(static_cast(ColorWriteMask::All) == WGPUColorWriteMask_All, "value mismatch for ColorWriteMask::All"); - - // HeapProperty - - static_assert(sizeof(HeapProperty) == sizeof(WGPUHeapPropertyFlags), "sizeof mismatch for HeapProperty"); - static_assert(alignof(HeapProperty) == alignof(WGPUHeapPropertyFlags), "alignof mismatch for HeapProperty"); - - static_assert(static_cast(HeapProperty::Undefined) == WGPUHeapProperty_Undefined, "value mismatch for HeapProperty::Undefined"); - static_assert(static_cast(HeapProperty::DeviceLocal) == WGPUHeapProperty_DeviceLocal, "value mismatch for HeapProperty::DeviceLocal"); - static_assert(static_cast(HeapProperty::HostVisible) == WGPUHeapProperty_HostVisible, "value mismatch for HeapProperty::HostVisible"); - static_assert(static_cast(HeapProperty::HostCoherent) == WGPUHeapProperty_HostCoherent, "value mismatch for HeapProperty::HostCoherent"); - static_assert(static_cast(HeapProperty::HostUncached) == WGPUHeapProperty_HostUncached, "value mismatch for HeapProperty::HostUncached"); - static_assert(static_cast(HeapProperty::HostCached) == WGPUHeapProperty_HostCached, "value mismatch for HeapProperty::HostCached"); - - // MapMode - - static_assert(sizeof(MapMode) == sizeof(WGPUMapModeFlags), "sizeof mismatch for MapMode"); - static_assert(alignof(MapMode) == alignof(WGPUMapModeFlags), "alignof mismatch for MapMode"); - - static_assert(static_cast(MapMode::None) == WGPUMapMode_None, "value mismatch for MapMode::None"); - static_assert(static_cast(MapMode::Read) == WGPUMapMode_Read, "value mismatch for MapMode::Read"); - static_assert(static_cast(MapMode::Write) == WGPUMapMode_Write, "value mismatch for MapMode::Write"); - - // ShaderStage - - static_assert(sizeof(ShaderStage) == sizeof(WGPUShaderStageFlags), "sizeof mismatch for ShaderStage"); - static_assert(alignof(ShaderStage) == alignof(WGPUShaderStageFlags), "alignof mismatch for ShaderStage"); - - static_assert(static_cast(ShaderStage::None) == WGPUShaderStage_None, "value mismatch for ShaderStage::None"); - static_assert(static_cast(ShaderStage::Vertex) == WGPUShaderStage_Vertex, "value mismatch for ShaderStage::Vertex"); - static_assert(static_cast(ShaderStage::Fragment) == WGPUShaderStage_Fragment, "value mismatch for ShaderStage::Fragment"); - static_assert(static_cast(ShaderStage::Compute) == WGPUShaderStage_Compute, "value mismatch for ShaderStage::Compute"); - - // TextureUsage - - static_assert(sizeof(TextureUsage) == sizeof(WGPUTextureUsageFlags), "sizeof mismatch for TextureUsage"); - static_assert(alignof(TextureUsage) == alignof(WGPUTextureUsageFlags), "alignof mismatch for TextureUsage"); - - static_assert(static_cast(TextureUsage::None) == WGPUTextureUsage_None, "value mismatch for TextureUsage::None"); - static_assert(static_cast(TextureUsage::CopySrc) == WGPUTextureUsage_CopySrc, "value mismatch for TextureUsage::CopySrc"); - static_assert(static_cast(TextureUsage::CopyDst) == WGPUTextureUsage_CopyDst, "value mismatch for TextureUsage::CopyDst"); - static_assert(static_cast(TextureUsage::TextureBinding) == WGPUTextureUsage_TextureBinding, "value mismatch for TextureUsage::TextureBinding"); - static_assert(static_cast(TextureUsage::StorageBinding) == WGPUTextureUsage_StorageBinding, "value mismatch for TextureUsage::StorageBinding"); - static_assert(static_cast(TextureUsage::RenderAttachment) == WGPUTextureUsage_RenderAttachment, "value mismatch for TextureUsage::RenderAttachment"); - static_assert(static_cast(TextureUsage::TransientAttachment) == WGPUTextureUsage_TransientAttachment, "value mismatch for TextureUsage::TransientAttachment"); - static_assert(static_cast(TextureUsage::StorageAttachment) == WGPUTextureUsage_StorageAttachment, "value mismatch for TextureUsage::StorageAttachment"); - - // ChainedStruct - - static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct), - "sizeof mismatch for ChainedStruct"); - static_assert(alignof(ChainedStruct) == alignof(WGPUChainedStruct), - "alignof mismatch for ChainedStruct"); - static_assert(offsetof(ChainedStruct, nextInChain) == offsetof(WGPUChainedStruct, next), - "offsetof mismatch for ChainedStruct::nextInChain"); - static_assert(offsetof(ChainedStruct, sType) == offsetof(WGPUChainedStruct, sType), - "offsetof mismatch for ChainedStruct::sType"); - - // AdapterProperties - - static_assert(sizeof(AdapterProperties) == sizeof(WGPUAdapterProperties), "sizeof mismatch for AdapterProperties"); - static_assert(alignof(AdapterProperties) == alignof(WGPUAdapterProperties), "alignof mismatch for AdapterProperties"); - - static_assert(offsetof(AdapterProperties, nextInChain) == offsetof(WGPUAdapterProperties, nextInChain), - "offsetof mismatch for AdapterProperties::nextInChain"); - static_assert(offsetof(AdapterProperties, vendorID) == offsetof(WGPUAdapterProperties, vendorID), - "offsetof mismatch for AdapterProperties::vendorID"); - static_assert(offsetof(AdapterProperties, vendorName) == offsetof(WGPUAdapterProperties, vendorName), - "offsetof mismatch for AdapterProperties::vendorName"); - static_assert(offsetof(AdapterProperties, architecture) == offsetof(WGPUAdapterProperties, architecture), - "offsetof mismatch for AdapterProperties::architecture"); - static_assert(offsetof(AdapterProperties, deviceID) == offsetof(WGPUAdapterProperties, deviceID), - "offsetof mismatch for AdapterProperties::deviceID"); - static_assert(offsetof(AdapterProperties, name) == offsetof(WGPUAdapterProperties, name), - "offsetof mismatch for AdapterProperties::name"); - static_assert(offsetof(AdapterProperties, driverDescription) == offsetof(WGPUAdapterProperties, driverDescription), - "offsetof mismatch for AdapterProperties::driverDescription"); - static_assert(offsetof(AdapterProperties, adapterType) == offsetof(WGPUAdapterProperties, adapterType), - "offsetof mismatch for AdapterProperties::adapterType"); - static_assert(offsetof(AdapterProperties, backendType) == offsetof(WGPUAdapterProperties, backendType), - "offsetof mismatch for AdapterProperties::backendType"); - static_assert(offsetof(AdapterProperties, compatibilityMode) == offsetof(WGPUAdapterProperties, compatibilityMode), - "offsetof mismatch for AdapterProperties::compatibilityMode"); - - // AdapterPropertiesD3D - - static_assert(sizeof(AdapterPropertiesD3D) == sizeof(WGPUAdapterPropertiesD3D), "sizeof mismatch for AdapterPropertiesD3D"); - static_assert(alignof(AdapterPropertiesD3D) == alignof(WGPUAdapterPropertiesD3D), "alignof mismatch for AdapterPropertiesD3D"); - - static_assert(offsetof(AdapterPropertiesD3D, shaderModel) == offsetof(WGPUAdapterPropertiesD3D, shaderModel), - "offsetof mismatch for AdapterPropertiesD3D::shaderModel"); - - // AdapterPropertiesVk - - static_assert(sizeof(AdapterPropertiesVk) == sizeof(WGPUAdapterPropertiesVk), "sizeof mismatch for AdapterPropertiesVk"); - static_assert(alignof(AdapterPropertiesVk) == alignof(WGPUAdapterPropertiesVk), "alignof mismatch for AdapterPropertiesVk"); - - static_assert(offsetof(AdapterPropertiesVk, driverVersion) == offsetof(WGPUAdapterPropertiesVk, driverVersion), - "offsetof mismatch for AdapterPropertiesVk::driverVersion"); - - // BindGroupEntry - - static_assert(sizeof(BindGroupEntry) == sizeof(WGPUBindGroupEntry), "sizeof mismatch for BindGroupEntry"); - static_assert(alignof(BindGroupEntry) == alignof(WGPUBindGroupEntry), "alignof mismatch for BindGroupEntry"); - - static_assert(offsetof(BindGroupEntry, nextInChain) == offsetof(WGPUBindGroupEntry, nextInChain), - "offsetof mismatch for BindGroupEntry::nextInChain"); - static_assert(offsetof(BindGroupEntry, binding) == offsetof(WGPUBindGroupEntry, binding), - "offsetof mismatch for BindGroupEntry::binding"); - static_assert(offsetof(BindGroupEntry, buffer) == offsetof(WGPUBindGroupEntry, buffer), - "offsetof mismatch for BindGroupEntry::buffer"); - static_assert(offsetof(BindGroupEntry, offset) == offsetof(WGPUBindGroupEntry, offset), - "offsetof mismatch for BindGroupEntry::offset"); - static_assert(offsetof(BindGroupEntry, size) == offsetof(WGPUBindGroupEntry, size), - "offsetof mismatch for BindGroupEntry::size"); - static_assert(offsetof(BindGroupEntry, sampler) == offsetof(WGPUBindGroupEntry, sampler), - "offsetof mismatch for BindGroupEntry::sampler"); - static_assert(offsetof(BindGroupEntry, textureView) == offsetof(WGPUBindGroupEntry, textureView), - "offsetof mismatch for BindGroupEntry::textureView"); - - // BlendComponent - - static_assert(sizeof(BlendComponent) == sizeof(WGPUBlendComponent), "sizeof mismatch for BlendComponent"); - static_assert(alignof(BlendComponent) == alignof(WGPUBlendComponent), "alignof mismatch for BlendComponent"); - - static_assert(offsetof(BlendComponent, operation) == offsetof(WGPUBlendComponent, operation), - "offsetof mismatch for BlendComponent::operation"); - static_assert(offsetof(BlendComponent, srcFactor) == offsetof(WGPUBlendComponent, srcFactor), - "offsetof mismatch for BlendComponent::srcFactor"); - static_assert(offsetof(BlendComponent, dstFactor) == offsetof(WGPUBlendComponent, dstFactor), - "offsetof mismatch for BlendComponent::dstFactor"); - - // BufferBindingLayout - - static_assert(sizeof(BufferBindingLayout) == sizeof(WGPUBufferBindingLayout), "sizeof mismatch for BufferBindingLayout"); - static_assert(alignof(BufferBindingLayout) == alignof(WGPUBufferBindingLayout), "alignof mismatch for BufferBindingLayout"); - - static_assert(offsetof(BufferBindingLayout, nextInChain) == offsetof(WGPUBufferBindingLayout, nextInChain), - "offsetof mismatch for BufferBindingLayout::nextInChain"); - static_assert(offsetof(BufferBindingLayout, type) == offsetof(WGPUBufferBindingLayout, type), - "offsetof mismatch for BufferBindingLayout::type"); - static_assert(offsetof(BufferBindingLayout, hasDynamicOffset) == offsetof(WGPUBufferBindingLayout, hasDynamicOffset), - "offsetof mismatch for BufferBindingLayout::hasDynamicOffset"); - static_assert(offsetof(BufferBindingLayout, minBindingSize) == offsetof(WGPUBufferBindingLayout, minBindingSize), - "offsetof mismatch for BufferBindingLayout::minBindingSize"); - - // BufferDescriptor - - static_assert(sizeof(BufferDescriptor) == sizeof(WGPUBufferDescriptor), "sizeof mismatch for BufferDescriptor"); - static_assert(alignof(BufferDescriptor) == alignof(WGPUBufferDescriptor), "alignof mismatch for BufferDescriptor"); - - static_assert(offsetof(BufferDescriptor, nextInChain) == offsetof(WGPUBufferDescriptor, nextInChain), - "offsetof mismatch for BufferDescriptor::nextInChain"); - static_assert(offsetof(BufferDescriptor, label) == offsetof(WGPUBufferDescriptor, label), - "offsetof mismatch for BufferDescriptor::label"); - static_assert(offsetof(BufferDescriptor, usage) == offsetof(WGPUBufferDescriptor, usage), - "offsetof mismatch for BufferDescriptor::usage"); - static_assert(offsetof(BufferDescriptor, size) == offsetof(WGPUBufferDescriptor, size), - "offsetof mismatch for BufferDescriptor::size"); - static_assert(offsetof(BufferDescriptor, mappedAtCreation) == offsetof(WGPUBufferDescriptor, mappedAtCreation), - "offsetof mismatch for BufferDescriptor::mappedAtCreation"); - - // BufferHostMappedPointer - - static_assert(sizeof(BufferHostMappedPointer) == sizeof(WGPUBufferHostMappedPointer), "sizeof mismatch for BufferHostMappedPointer"); - static_assert(alignof(BufferHostMappedPointer) == alignof(WGPUBufferHostMappedPointer), "alignof mismatch for BufferHostMappedPointer"); - - static_assert(offsetof(BufferHostMappedPointer, pointer) == offsetof(WGPUBufferHostMappedPointer, pointer), - "offsetof mismatch for BufferHostMappedPointer::pointer"); - static_assert(offsetof(BufferHostMappedPointer, disposeCallback) == offsetof(WGPUBufferHostMappedPointer, disposeCallback), - "offsetof mismatch for BufferHostMappedPointer::disposeCallback"); - static_assert(offsetof(BufferHostMappedPointer, userdata) == offsetof(WGPUBufferHostMappedPointer, userdata), - "offsetof mismatch for BufferHostMappedPointer::userdata"); - - // BufferMapCallbackInfo - - static_assert(sizeof(BufferMapCallbackInfo) == sizeof(WGPUBufferMapCallbackInfo), "sizeof mismatch for BufferMapCallbackInfo"); - static_assert(alignof(BufferMapCallbackInfo) == alignof(WGPUBufferMapCallbackInfo), "alignof mismatch for BufferMapCallbackInfo"); - - static_assert(offsetof(BufferMapCallbackInfo, nextInChain) == offsetof(WGPUBufferMapCallbackInfo, nextInChain), - "offsetof mismatch for BufferMapCallbackInfo::nextInChain"); - static_assert(offsetof(BufferMapCallbackInfo, mode) == offsetof(WGPUBufferMapCallbackInfo, mode), - "offsetof mismatch for BufferMapCallbackInfo::mode"); - static_assert(offsetof(BufferMapCallbackInfo, callback) == offsetof(WGPUBufferMapCallbackInfo, callback), - "offsetof mismatch for BufferMapCallbackInfo::callback"); - static_assert(offsetof(BufferMapCallbackInfo, userdata) == offsetof(WGPUBufferMapCallbackInfo, userdata), - "offsetof mismatch for BufferMapCallbackInfo::userdata"); - - // Color - - static_assert(sizeof(Color) == sizeof(WGPUColor), "sizeof mismatch for Color"); - static_assert(alignof(Color) == alignof(WGPUColor), "alignof mismatch for Color"); - - static_assert(offsetof(Color, r) == offsetof(WGPUColor, r), - "offsetof mismatch for Color::r"); - static_assert(offsetof(Color, g) == offsetof(WGPUColor, g), - "offsetof mismatch for Color::g"); - static_assert(offsetof(Color, b) == offsetof(WGPUColor, b), - "offsetof mismatch for Color::b"); - static_assert(offsetof(Color, a) == offsetof(WGPUColor, a), - "offsetof mismatch for Color::a"); - - // CommandBufferDescriptor - - static_assert(sizeof(CommandBufferDescriptor) == sizeof(WGPUCommandBufferDescriptor), "sizeof mismatch for CommandBufferDescriptor"); - static_assert(alignof(CommandBufferDescriptor) == alignof(WGPUCommandBufferDescriptor), "alignof mismatch for CommandBufferDescriptor"); - - static_assert(offsetof(CommandBufferDescriptor, nextInChain) == offsetof(WGPUCommandBufferDescriptor, nextInChain), - "offsetof mismatch for CommandBufferDescriptor::nextInChain"); - static_assert(offsetof(CommandBufferDescriptor, label) == offsetof(WGPUCommandBufferDescriptor, label), - "offsetof mismatch for CommandBufferDescriptor::label"); - - // CommandEncoderDescriptor - - static_assert(sizeof(CommandEncoderDescriptor) == sizeof(WGPUCommandEncoderDescriptor), "sizeof mismatch for CommandEncoderDescriptor"); - static_assert(alignof(CommandEncoderDescriptor) == alignof(WGPUCommandEncoderDescriptor), "alignof mismatch for CommandEncoderDescriptor"); - - static_assert(offsetof(CommandEncoderDescriptor, nextInChain) == offsetof(WGPUCommandEncoderDescriptor, nextInChain), - "offsetof mismatch for CommandEncoderDescriptor::nextInChain"); - static_assert(offsetof(CommandEncoderDescriptor, label) == offsetof(WGPUCommandEncoderDescriptor, label), - "offsetof mismatch for CommandEncoderDescriptor::label"); - - // CompilationInfoCallbackInfo - - static_assert(sizeof(CompilationInfoCallbackInfo) == sizeof(WGPUCompilationInfoCallbackInfo), "sizeof mismatch for CompilationInfoCallbackInfo"); - static_assert(alignof(CompilationInfoCallbackInfo) == alignof(WGPUCompilationInfoCallbackInfo), "alignof mismatch for CompilationInfoCallbackInfo"); - - static_assert(offsetof(CompilationInfoCallbackInfo, nextInChain) == offsetof(WGPUCompilationInfoCallbackInfo, nextInChain), - "offsetof mismatch for CompilationInfoCallbackInfo::nextInChain"); - static_assert(offsetof(CompilationInfoCallbackInfo, mode) == offsetof(WGPUCompilationInfoCallbackInfo, mode), - "offsetof mismatch for CompilationInfoCallbackInfo::mode"); - static_assert(offsetof(CompilationInfoCallbackInfo, callback) == offsetof(WGPUCompilationInfoCallbackInfo, callback), - "offsetof mismatch for CompilationInfoCallbackInfo::callback"); - static_assert(offsetof(CompilationInfoCallbackInfo, userdata) == offsetof(WGPUCompilationInfoCallbackInfo, userdata), - "offsetof mismatch for CompilationInfoCallbackInfo::userdata"); - - // CompilationMessage - - static_assert(sizeof(CompilationMessage) == sizeof(WGPUCompilationMessage), "sizeof mismatch for CompilationMessage"); - static_assert(alignof(CompilationMessage) == alignof(WGPUCompilationMessage), "alignof mismatch for CompilationMessage"); - - static_assert(offsetof(CompilationMessage, nextInChain) == offsetof(WGPUCompilationMessage, nextInChain), - "offsetof mismatch for CompilationMessage::nextInChain"); - static_assert(offsetof(CompilationMessage, message) == offsetof(WGPUCompilationMessage, message), - "offsetof mismatch for CompilationMessage::message"); - static_assert(offsetof(CompilationMessage, type) == offsetof(WGPUCompilationMessage, type), - "offsetof mismatch for CompilationMessage::type"); - static_assert(offsetof(CompilationMessage, lineNum) == offsetof(WGPUCompilationMessage, lineNum), - "offsetof mismatch for CompilationMessage::lineNum"); - static_assert(offsetof(CompilationMessage, linePos) == offsetof(WGPUCompilationMessage, linePos), - "offsetof mismatch for CompilationMessage::linePos"); - static_assert(offsetof(CompilationMessage, offset) == offsetof(WGPUCompilationMessage, offset), - "offsetof mismatch for CompilationMessage::offset"); - static_assert(offsetof(CompilationMessage, length) == offsetof(WGPUCompilationMessage, length), - "offsetof mismatch for CompilationMessage::length"); - static_assert(offsetof(CompilationMessage, utf16LinePos) == offsetof(WGPUCompilationMessage, utf16LinePos), - "offsetof mismatch for CompilationMessage::utf16LinePos"); - static_assert(offsetof(CompilationMessage, utf16Offset) == offsetof(WGPUCompilationMessage, utf16Offset), - "offsetof mismatch for CompilationMessage::utf16Offset"); - static_assert(offsetof(CompilationMessage, utf16Length) == offsetof(WGPUCompilationMessage, utf16Length), - "offsetof mismatch for CompilationMessage::utf16Length"); - - // ComputePassTimestampWrites - - static_assert(sizeof(ComputePassTimestampWrites) == sizeof(WGPUComputePassTimestampWrites), "sizeof mismatch for ComputePassTimestampWrites"); - static_assert(alignof(ComputePassTimestampWrites) == alignof(WGPUComputePassTimestampWrites), "alignof mismatch for ComputePassTimestampWrites"); - - static_assert(offsetof(ComputePassTimestampWrites, querySet) == offsetof(WGPUComputePassTimestampWrites, querySet), - "offsetof mismatch for ComputePassTimestampWrites::querySet"); - static_assert(offsetof(ComputePassTimestampWrites, beginningOfPassWriteIndex) == offsetof(WGPUComputePassTimestampWrites, beginningOfPassWriteIndex), - "offsetof mismatch for ComputePassTimestampWrites::beginningOfPassWriteIndex"); - static_assert(offsetof(ComputePassTimestampWrites, endOfPassWriteIndex) == offsetof(WGPUComputePassTimestampWrites, endOfPassWriteIndex), - "offsetof mismatch for ComputePassTimestampWrites::endOfPassWriteIndex"); - - // ConstantEntry - - static_assert(sizeof(ConstantEntry) == sizeof(WGPUConstantEntry), "sizeof mismatch for ConstantEntry"); - static_assert(alignof(ConstantEntry) == alignof(WGPUConstantEntry), "alignof mismatch for ConstantEntry"); - - static_assert(offsetof(ConstantEntry, nextInChain) == offsetof(WGPUConstantEntry, nextInChain), - "offsetof mismatch for ConstantEntry::nextInChain"); - static_assert(offsetof(ConstantEntry, key) == offsetof(WGPUConstantEntry, key), - "offsetof mismatch for ConstantEntry::key"); - static_assert(offsetof(ConstantEntry, value) == offsetof(WGPUConstantEntry, value), - "offsetof mismatch for ConstantEntry::value"); - - // CopyTextureForBrowserOptions - - static_assert(sizeof(CopyTextureForBrowserOptions) == sizeof(WGPUCopyTextureForBrowserOptions), "sizeof mismatch for CopyTextureForBrowserOptions"); - static_assert(alignof(CopyTextureForBrowserOptions) == alignof(WGPUCopyTextureForBrowserOptions), "alignof mismatch for CopyTextureForBrowserOptions"); - - static_assert(offsetof(CopyTextureForBrowserOptions, nextInChain) == offsetof(WGPUCopyTextureForBrowserOptions, nextInChain), - "offsetof mismatch for CopyTextureForBrowserOptions::nextInChain"); - static_assert(offsetof(CopyTextureForBrowserOptions, flipY) == offsetof(WGPUCopyTextureForBrowserOptions, flipY), - "offsetof mismatch for CopyTextureForBrowserOptions::flipY"); - static_assert(offsetof(CopyTextureForBrowserOptions, needsColorSpaceConversion) == offsetof(WGPUCopyTextureForBrowserOptions, needsColorSpaceConversion), - "offsetof mismatch for CopyTextureForBrowserOptions::needsColorSpaceConversion"); - static_assert(offsetof(CopyTextureForBrowserOptions, srcAlphaMode) == offsetof(WGPUCopyTextureForBrowserOptions, srcAlphaMode), - "offsetof mismatch for CopyTextureForBrowserOptions::srcAlphaMode"); - static_assert(offsetof(CopyTextureForBrowserOptions, srcTransferFunctionParameters) == offsetof(WGPUCopyTextureForBrowserOptions, srcTransferFunctionParameters), - "offsetof mismatch for CopyTextureForBrowserOptions::srcTransferFunctionParameters"); - static_assert(offsetof(CopyTextureForBrowserOptions, conversionMatrix) == offsetof(WGPUCopyTextureForBrowserOptions, conversionMatrix), - "offsetof mismatch for CopyTextureForBrowserOptions::conversionMatrix"); - static_assert(offsetof(CopyTextureForBrowserOptions, dstTransferFunctionParameters) == offsetof(WGPUCopyTextureForBrowserOptions, dstTransferFunctionParameters), - "offsetof mismatch for CopyTextureForBrowserOptions::dstTransferFunctionParameters"); - static_assert(offsetof(CopyTextureForBrowserOptions, dstAlphaMode) == offsetof(WGPUCopyTextureForBrowserOptions, dstAlphaMode), - "offsetof mismatch for CopyTextureForBrowserOptions::dstAlphaMode"); - static_assert(offsetof(CopyTextureForBrowserOptions, internalUsage) == offsetof(WGPUCopyTextureForBrowserOptions, internalUsage), - "offsetof mismatch for CopyTextureForBrowserOptions::internalUsage"); - - // CreateComputePipelineAsyncCallbackInfo - - static_assert(sizeof(CreateComputePipelineAsyncCallbackInfo) == sizeof(WGPUCreateComputePipelineAsyncCallbackInfo), "sizeof mismatch for CreateComputePipelineAsyncCallbackInfo"); - static_assert(alignof(CreateComputePipelineAsyncCallbackInfo) == alignof(WGPUCreateComputePipelineAsyncCallbackInfo), "alignof mismatch for CreateComputePipelineAsyncCallbackInfo"); - - static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, nextInChain) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, nextInChain), - "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::nextInChain"); - static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, mode) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, mode), - "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::mode"); - static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, callback) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, callback), - "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::callback"); - static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, userdata) == offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, userdata), - "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::userdata"); - - // CreateRenderPipelineAsyncCallbackInfo - - static_assert(sizeof(CreateRenderPipelineAsyncCallbackInfo) == sizeof(WGPUCreateRenderPipelineAsyncCallbackInfo), "sizeof mismatch for CreateRenderPipelineAsyncCallbackInfo"); - static_assert(alignof(CreateRenderPipelineAsyncCallbackInfo) == alignof(WGPUCreateRenderPipelineAsyncCallbackInfo), "alignof mismatch for CreateRenderPipelineAsyncCallbackInfo"); - - static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, nextInChain) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, nextInChain), - "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::nextInChain"); - static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, mode) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, mode), - "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::mode"); - static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, callback) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, callback), - "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::callback"); - static_assert(offsetof(CreateRenderPipelineAsyncCallbackInfo, userdata) == offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, userdata), - "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::userdata"); - - // DawnWGSLBlocklist - - static_assert(sizeof(DawnWGSLBlocklist) == sizeof(WGPUDawnWGSLBlocklist), "sizeof mismatch for DawnWGSLBlocklist"); - static_assert(alignof(DawnWGSLBlocklist) == alignof(WGPUDawnWGSLBlocklist), "alignof mismatch for DawnWGSLBlocklist"); - - static_assert(offsetof(DawnWGSLBlocklist, blocklistedFeatureCount) == offsetof(WGPUDawnWGSLBlocklist, blocklistedFeatureCount), - "offsetof mismatch for DawnWGSLBlocklist::blocklistedFeatureCount"); - static_assert(offsetof(DawnWGSLBlocklist, blocklistedFeatures) == offsetof(WGPUDawnWGSLBlocklist, blocklistedFeatures), - "offsetof mismatch for DawnWGSLBlocklist::blocklistedFeatures"); - - // DawnAdapterPropertiesPowerPreference - - static_assert(sizeof(DawnAdapterPropertiesPowerPreference) == sizeof(WGPUDawnAdapterPropertiesPowerPreference), "sizeof mismatch for DawnAdapterPropertiesPowerPreference"); - static_assert(alignof(DawnAdapterPropertiesPowerPreference) == alignof(WGPUDawnAdapterPropertiesPowerPreference), "alignof mismatch for DawnAdapterPropertiesPowerPreference"); - - static_assert(offsetof(DawnAdapterPropertiesPowerPreference, powerPreference) == offsetof(WGPUDawnAdapterPropertiesPowerPreference, powerPreference), - "offsetof mismatch for DawnAdapterPropertiesPowerPreference::powerPreference"); - - // DawnBufferDescriptorErrorInfoFromWireClient - - static_assert(sizeof(DawnBufferDescriptorErrorInfoFromWireClient) == sizeof(WGPUDawnBufferDescriptorErrorInfoFromWireClient), "sizeof mismatch for DawnBufferDescriptorErrorInfoFromWireClient"); - static_assert(alignof(DawnBufferDescriptorErrorInfoFromWireClient) == alignof(WGPUDawnBufferDescriptorErrorInfoFromWireClient), "alignof mismatch for DawnBufferDescriptorErrorInfoFromWireClient"); - - static_assert(offsetof(DawnBufferDescriptorErrorInfoFromWireClient, outOfMemory) == offsetof(WGPUDawnBufferDescriptorErrorInfoFromWireClient, outOfMemory), - "offsetof mismatch for DawnBufferDescriptorErrorInfoFromWireClient::outOfMemory"); - - // DawnCacheDeviceDescriptor - - static_assert(sizeof(DawnCacheDeviceDescriptor) == sizeof(WGPUDawnCacheDeviceDescriptor), "sizeof mismatch for DawnCacheDeviceDescriptor"); - static_assert(alignof(DawnCacheDeviceDescriptor) == alignof(WGPUDawnCacheDeviceDescriptor), "alignof mismatch for DawnCacheDeviceDescriptor"); - - static_assert(offsetof(DawnCacheDeviceDescriptor, isolationKey) == offsetof(WGPUDawnCacheDeviceDescriptor, isolationKey), - "offsetof mismatch for DawnCacheDeviceDescriptor::isolationKey"); - static_assert(offsetof(DawnCacheDeviceDescriptor, loadDataFunction) == offsetof(WGPUDawnCacheDeviceDescriptor, loadDataFunction), - "offsetof mismatch for DawnCacheDeviceDescriptor::loadDataFunction"); - static_assert(offsetof(DawnCacheDeviceDescriptor, storeDataFunction) == offsetof(WGPUDawnCacheDeviceDescriptor, storeDataFunction), - "offsetof mismatch for DawnCacheDeviceDescriptor::storeDataFunction"); - static_assert(offsetof(DawnCacheDeviceDescriptor, functionUserdata) == offsetof(WGPUDawnCacheDeviceDescriptor, functionUserdata), - "offsetof mismatch for DawnCacheDeviceDescriptor::functionUserdata"); - - // DawnComputePipelineFullSubgroups - - static_assert(sizeof(DawnComputePipelineFullSubgroups) == sizeof(WGPUDawnComputePipelineFullSubgroups), "sizeof mismatch for DawnComputePipelineFullSubgroups"); - static_assert(alignof(DawnComputePipelineFullSubgroups) == alignof(WGPUDawnComputePipelineFullSubgroups), "alignof mismatch for DawnComputePipelineFullSubgroups"); - - static_assert(offsetof(DawnComputePipelineFullSubgroups, requiresFullSubgroups) == offsetof(WGPUDawnComputePipelineFullSubgroups, requiresFullSubgroups), - "offsetof mismatch for DawnComputePipelineFullSubgroups::requiresFullSubgroups"); - - // DawnEncoderInternalUsageDescriptor - - static_assert(sizeof(DawnEncoderInternalUsageDescriptor) == sizeof(WGPUDawnEncoderInternalUsageDescriptor), "sizeof mismatch for DawnEncoderInternalUsageDescriptor"); - static_assert(alignof(DawnEncoderInternalUsageDescriptor) == alignof(WGPUDawnEncoderInternalUsageDescriptor), "alignof mismatch for DawnEncoderInternalUsageDescriptor"); - - static_assert(offsetof(DawnEncoderInternalUsageDescriptor, useInternalUsages) == offsetof(WGPUDawnEncoderInternalUsageDescriptor, useInternalUsages), - "offsetof mismatch for DawnEncoderInternalUsageDescriptor::useInternalUsages"); - - // DawnExperimentalSubgroupLimits - - static_assert(sizeof(DawnExperimentalSubgroupLimits) == sizeof(WGPUDawnExperimentalSubgroupLimits), "sizeof mismatch for DawnExperimentalSubgroupLimits"); - static_assert(alignof(DawnExperimentalSubgroupLimits) == alignof(WGPUDawnExperimentalSubgroupLimits), "alignof mismatch for DawnExperimentalSubgroupLimits"); - - static_assert(offsetof(DawnExperimentalSubgroupLimits, minSubgroupSize) == offsetof(WGPUDawnExperimentalSubgroupLimits, minSubgroupSize), - "offsetof mismatch for DawnExperimentalSubgroupLimits::minSubgroupSize"); - static_assert(offsetof(DawnExperimentalSubgroupLimits, maxSubgroupSize) == offsetof(WGPUDawnExperimentalSubgroupLimits, maxSubgroupSize), - "offsetof mismatch for DawnExperimentalSubgroupLimits::maxSubgroupSize"); - - // DawnMultisampleStateRenderToSingleSampled - - static_assert(sizeof(DawnMultisampleStateRenderToSingleSampled) == sizeof(WGPUDawnMultisampleStateRenderToSingleSampled), "sizeof mismatch for DawnMultisampleStateRenderToSingleSampled"); - static_assert(alignof(DawnMultisampleStateRenderToSingleSampled) == alignof(WGPUDawnMultisampleStateRenderToSingleSampled), "alignof mismatch for DawnMultisampleStateRenderToSingleSampled"); - - static_assert(offsetof(DawnMultisampleStateRenderToSingleSampled, enabled) == offsetof(WGPUDawnMultisampleStateRenderToSingleSampled, enabled), - "offsetof mismatch for DawnMultisampleStateRenderToSingleSampled::enabled"); - - // DawnRenderPassColorAttachmentRenderToSingleSampled - - static_assert(sizeof(DawnRenderPassColorAttachmentRenderToSingleSampled) == sizeof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled), "sizeof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled"); - static_assert(alignof(DawnRenderPassColorAttachmentRenderToSingleSampled) == alignof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled), "alignof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled"); - - static_assert(offsetof(DawnRenderPassColorAttachmentRenderToSingleSampled, implicitSampleCount) == offsetof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled, implicitSampleCount), - "offsetof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled::implicitSampleCount"); - - // DawnShaderModuleSPIRVOptionsDescriptor - - static_assert(sizeof(DawnShaderModuleSPIRVOptionsDescriptor) == sizeof(WGPUDawnShaderModuleSPIRVOptionsDescriptor), "sizeof mismatch for DawnShaderModuleSPIRVOptionsDescriptor"); - static_assert(alignof(DawnShaderModuleSPIRVOptionsDescriptor) == alignof(WGPUDawnShaderModuleSPIRVOptionsDescriptor), "alignof mismatch for DawnShaderModuleSPIRVOptionsDescriptor"); - - static_assert(offsetof(DawnShaderModuleSPIRVOptionsDescriptor, allowNonUniformDerivatives) == offsetof(WGPUDawnShaderModuleSPIRVOptionsDescriptor, allowNonUniformDerivatives), - "offsetof mismatch for DawnShaderModuleSPIRVOptionsDescriptor::allowNonUniformDerivatives"); - - // DawnTextureInternalUsageDescriptor - - static_assert(sizeof(DawnTextureInternalUsageDescriptor) == sizeof(WGPUDawnTextureInternalUsageDescriptor), "sizeof mismatch for DawnTextureInternalUsageDescriptor"); - static_assert(alignof(DawnTextureInternalUsageDescriptor) == alignof(WGPUDawnTextureInternalUsageDescriptor), "alignof mismatch for DawnTextureInternalUsageDescriptor"); - - static_assert(offsetof(DawnTextureInternalUsageDescriptor, internalUsage) == offsetof(WGPUDawnTextureInternalUsageDescriptor, internalUsage), - "offsetof mismatch for DawnTextureInternalUsageDescriptor::internalUsage"); - - // DawnTogglesDescriptor - - static_assert(sizeof(DawnTogglesDescriptor) == sizeof(WGPUDawnTogglesDescriptor), "sizeof mismatch for DawnTogglesDescriptor"); - static_assert(alignof(DawnTogglesDescriptor) == alignof(WGPUDawnTogglesDescriptor), "alignof mismatch for DawnTogglesDescriptor"); - - static_assert(offsetof(DawnTogglesDescriptor, enabledToggleCount) == offsetof(WGPUDawnTogglesDescriptor, enabledToggleCount), - "offsetof mismatch for DawnTogglesDescriptor::enabledToggleCount"); - static_assert(offsetof(DawnTogglesDescriptor, enabledToggles) == offsetof(WGPUDawnTogglesDescriptor, enabledToggles), - "offsetof mismatch for DawnTogglesDescriptor::enabledToggles"); - static_assert(offsetof(DawnTogglesDescriptor, disabledToggleCount) == offsetof(WGPUDawnTogglesDescriptor, disabledToggleCount), - "offsetof mismatch for DawnTogglesDescriptor::disabledToggleCount"); - static_assert(offsetof(DawnTogglesDescriptor, disabledToggles) == offsetof(WGPUDawnTogglesDescriptor, disabledToggles), - "offsetof mismatch for DawnTogglesDescriptor::disabledToggles"); - - // DawnWireWGSLControl - - static_assert(sizeof(DawnWireWGSLControl) == sizeof(WGPUDawnWireWGSLControl), "sizeof mismatch for DawnWireWGSLControl"); - static_assert(alignof(DawnWireWGSLControl) == alignof(WGPUDawnWireWGSLControl), "alignof mismatch for DawnWireWGSLControl"); - - static_assert(offsetof(DawnWireWGSLControl, enableExperimental) == offsetof(WGPUDawnWireWGSLControl, enableExperimental), - "offsetof mismatch for DawnWireWGSLControl::enableExperimental"); - static_assert(offsetof(DawnWireWGSLControl, enableUnsafe) == offsetof(WGPUDawnWireWGSLControl, enableUnsafe), - "offsetof mismatch for DawnWireWGSLControl::enableUnsafe"); - static_assert(offsetof(DawnWireWGSLControl, enableTesting) == offsetof(WGPUDawnWireWGSLControl, enableTesting), - "offsetof mismatch for DawnWireWGSLControl::enableTesting"); - - // DepthStencilStateDepthWriteDefinedDawn - - static_assert(sizeof(DepthStencilStateDepthWriteDefinedDawn) == sizeof(WGPUDepthStencilStateDepthWriteDefinedDawn), "sizeof mismatch for DepthStencilStateDepthWriteDefinedDawn"); - static_assert(alignof(DepthStencilStateDepthWriteDefinedDawn) == alignof(WGPUDepthStencilStateDepthWriteDefinedDawn), "alignof mismatch for DepthStencilStateDepthWriteDefinedDawn"); - - static_assert(offsetof(DepthStencilStateDepthWriteDefinedDawn, depthWriteDefined) == offsetof(WGPUDepthStencilStateDepthWriteDefinedDawn, depthWriteDefined), - "offsetof mismatch for DepthStencilStateDepthWriteDefinedDawn::depthWriteDefined"); - - // DrmFormatProperties - - static_assert(sizeof(DrmFormatProperties) == sizeof(WGPUDrmFormatProperties), "sizeof mismatch for DrmFormatProperties"); - static_assert(alignof(DrmFormatProperties) == alignof(WGPUDrmFormatProperties), "alignof mismatch for DrmFormatProperties"); - - static_assert(offsetof(DrmFormatProperties, modifier) == offsetof(WGPUDrmFormatProperties, modifier), - "offsetof mismatch for DrmFormatProperties::modifier"); - static_assert(offsetof(DrmFormatProperties, modifierPlaneCount) == offsetof(WGPUDrmFormatProperties, modifierPlaneCount), - "offsetof mismatch for DrmFormatProperties::modifierPlaneCount"); - - // Extent2D - - static_assert(sizeof(Extent2D) == sizeof(WGPUExtent2D), "sizeof mismatch for Extent2D"); - static_assert(alignof(Extent2D) == alignof(WGPUExtent2D), "alignof mismatch for Extent2D"); - - static_assert(offsetof(Extent2D, width) == offsetof(WGPUExtent2D, width), - "offsetof mismatch for Extent2D::width"); - static_assert(offsetof(Extent2D, height) == offsetof(WGPUExtent2D, height), - "offsetof mismatch for Extent2D::height"); - - // Extent3D - - static_assert(sizeof(Extent3D) == sizeof(WGPUExtent3D), "sizeof mismatch for Extent3D"); - static_assert(alignof(Extent3D) == alignof(WGPUExtent3D), "alignof mismatch for Extent3D"); - - static_assert(offsetof(Extent3D, width) == offsetof(WGPUExtent3D, width), - "offsetof mismatch for Extent3D::width"); - static_assert(offsetof(Extent3D, height) == offsetof(WGPUExtent3D, height), - "offsetof mismatch for Extent3D::height"); - static_assert(offsetof(Extent3D, depthOrArrayLayers) == offsetof(WGPUExtent3D, depthOrArrayLayers), - "offsetof mismatch for Extent3D::depthOrArrayLayers"); - - // ExternalTextureBindingEntry - - static_assert(sizeof(ExternalTextureBindingEntry) == sizeof(WGPUExternalTextureBindingEntry), "sizeof mismatch for ExternalTextureBindingEntry"); - static_assert(alignof(ExternalTextureBindingEntry) == alignof(WGPUExternalTextureBindingEntry), "alignof mismatch for ExternalTextureBindingEntry"); - - static_assert(offsetof(ExternalTextureBindingEntry, externalTexture) == offsetof(WGPUExternalTextureBindingEntry, externalTexture), - "offsetof mismatch for ExternalTextureBindingEntry::externalTexture"); - - // ExternalTextureBindingLayout - - static_assert(sizeof(ExternalTextureBindingLayout) == sizeof(WGPUExternalTextureBindingLayout), "sizeof mismatch for ExternalTextureBindingLayout"); - static_assert(alignof(ExternalTextureBindingLayout) == alignof(WGPUExternalTextureBindingLayout), "alignof mismatch for ExternalTextureBindingLayout"); - - - // FormatCapabilities - - static_assert(sizeof(FormatCapabilities) == sizeof(WGPUFormatCapabilities), "sizeof mismatch for FormatCapabilities"); - static_assert(alignof(FormatCapabilities) == alignof(WGPUFormatCapabilities), "alignof mismatch for FormatCapabilities"); - - static_assert(offsetof(FormatCapabilities, nextInChain) == offsetof(WGPUFormatCapabilities, nextInChain), - "offsetof mismatch for FormatCapabilities::nextInChain"); - - // Future - - static_assert(sizeof(Future) == sizeof(WGPUFuture), "sizeof mismatch for Future"); - static_assert(alignof(Future) == alignof(WGPUFuture), "alignof mismatch for Future"); - - static_assert(offsetof(Future, id) == offsetof(WGPUFuture, id), - "offsetof mismatch for Future::id"); - - // InstanceFeatures - - static_assert(sizeof(InstanceFeatures) == sizeof(WGPUInstanceFeatures), "sizeof mismatch for InstanceFeatures"); - static_assert(alignof(InstanceFeatures) == alignof(WGPUInstanceFeatures), "alignof mismatch for InstanceFeatures"); - - static_assert(offsetof(InstanceFeatures, nextInChain) == offsetof(WGPUInstanceFeatures, nextInChain), - "offsetof mismatch for InstanceFeatures::nextInChain"); - static_assert(offsetof(InstanceFeatures, timedWaitAnyEnable) == offsetof(WGPUInstanceFeatures, timedWaitAnyEnable), - "offsetof mismatch for InstanceFeatures::timedWaitAnyEnable"); - static_assert(offsetof(InstanceFeatures, timedWaitAnyMaxCount) == offsetof(WGPUInstanceFeatures, timedWaitAnyMaxCount), - "offsetof mismatch for InstanceFeatures::timedWaitAnyMaxCount"); - - // Limits - - static_assert(sizeof(Limits) == sizeof(WGPULimits), "sizeof mismatch for Limits"); - static_assert(alignof(Limits) == alignof(WGPULimits), "alignof mismatch for Limits"); - - static_assert(offsetof(Limits, maxTextureDimension1D) == offsetof(WGPULimits, maxTextureDimension1D), - "offsetof mismatch for Limits::maxTextureDimension1D"); - static_assert(offsetof(Limits, maxTextureDimension2D) == offsetof(WGPULimits, maxTextureDimension2D), - "offsetof mismatch for Limits::maxTextureDimension2D"); - static_assert(offsetof(Limits, maxTextureDimension3D) == offsetof(WGPULimits, maxTextureDimension3D), - "offsetof mismatch for Limits::maxTextureDimension3D"); - static_assert(offsetof(Limits, maxTextureArrayLayers) == offsetof(WGPULimits, maxTextureArrayLayers), - "offsetof mismatch for Limits::maxTextureArrayLayers"); - static_assert(offsetof(Limits, maxBindGroups) == offsetof(WGPULimits, maxBindGroups), - "offsetof mismatch for Limits::maxBindGroups"); - static_assert(offsetof(Limits, maxBindGroupsPlusVertexBuffers) == offsetof(WGPULimits, maxBindGroupsPlusVertexBuffers), - "offsetof mismatch for Limits::maxBindGroupsPlusVertexBuffers"); - static_assert(offsetof(Limits, maxBindingsPerBindGroup) == offsetof(WGPULimits, maxBindingsPerBindGroup), - "offsetof mismatch for Limits::maxBindingsPerBindGroup"); - static_assert(offsetof(Limits, maxDynamicUniformBuffersPerPipelineLayout) == offsetof(WGPULimits, maxDynamicUniformBuffersPerPipelineLayout), - "offsetof mismatch for Limits::maxDynamicUniformBuffersPerPipelineLayout"); - static_assert(offsetof(Limits, maxDynamicStorageBuffersPerPipelineLayout) == offsetof(WGPULimits, maxDynamicStorageBuffersPerPipelineLayout), - "offsetof mismatch for Limits::maxDynamicStorageBuffersPerPipelineLayout"); - static_assert(offsetof(Limits, maxSampledTexturesPerShaderStage) == offsetof(WGPULimits, maxSampledTexturesPerShaderStage), - "offsetof mismatch for Limits::maxSampledTexturesPerShaderStage"); - static_assert(offsetof(Limits, maxSamplersPerShaderStage) == offsetof(WGPULimits, maxSamplersPerShaderStage), - "offsetof mismatch for Limits::maxSamplersPerShaderStage"); - static_assert(offsetof(Limits, maxStorageBuffersPerShaderStage) == offsetof(WGPULimits, maxStorageBuffersPerShaderStage), - "offsetof mismatch for Limits::maxStorageBuffersPerShaderStage"); - static_assert(offsetof(Limits, maxStorageTexturesPerShaderStage) == offsetof(WGPULimits, maxStorageTexturesPerShaderStage), - "offsetof mismatch for Limits::maxStorageTexturesPerShaderStage"); - static_assert(offsetof(Limits, maxUniformBuffersPerShaderStage) == offsetof(WGPULimits, maxUniformBuffersPerShaderStage), - "offsetof mismatch for Limits::maxUniformBuffersPerShaderStage"); - static_assert(offsetof(Limits, maxUniformBufferBindingSize) == offsetof(WGPULimits, maxUniformBufferBindingSize), - "offsetof mismatch for Limits::maxUniformBufferBindingSize"); - static_assert(offsetof(Limits, maxStorageBufferBindingSize) == offsetof(WGPULimits, maxStorageBufferBindingSize), - "offsetof mismatch for Limits::maxStorageBufferBindingSize"); - static_assert(offsetof(Limits, minUniformBufferOffsetAlignment) == offsetof(WGPULimits, minUniformBufferOffsetAlignment), - "offsetof mismatch for Limits::minUniformBufferOffsetAlignment"); - static_assert(offsetof(Limits, minStorageBufferOffsetAlignment) == offsetof(WGPULimits, minStorageBufferOffsetAlignment), - "offsetof mismatch for Limits::minStorageBufferOffsetAlignment"); - static_assert(offsetof(Limits, maxVertexBuffers) == offsetof(WGPULimits, maxVertexBuffers), - "offsetof mismatch for Limits::maxVertexBuffers"); - static_assert(offsetof(Limits, maxBufferSize) == offsetof(WGPULimits, maxBufferSize), - "offsetof mismatch for Limits::maxBufferSize"); - static_assert(offsetof(Limits, maxVertexAttributes) == offsetof(WGPULimits, maxVertexAttributes), - "offsetof mismatch for Limits::maxVertexAttributes"); - static_assert(offsetof(Limits, maxVertexBufferArrayStride) == offsetof(WGPULimits, maxVertexBufferArrayStride), - "offsetof mismatch for Limits::maxVertexBufferArrayStride"); - static_assert(offsetof(Limits, maxInterStageShaderComponents) == offsetof(WGPULimits, maxInterStageShaderComponents), - "offsetof mismatch for Limits::maxInterStageShaderComponents"); - static_assert(offsetof(Limits, maxInterStageShaderVariables) == offsetof(WGPULimits, maxInterStageShaderVariables), - "offsetof mismatch for Limits::maxInterStageShaderVariables"); - static_assert(offsetof(Limits, maxColorAttachments) == offsetof(WGPULimits, maxColorAttachments), - "offsetof mismatch for Limits::maxColorAttachments"); - static_assert(offsetof(Limits, maxColorAttachmentBytesPerSample) == offsetof(WGPULimits, maxColorAttachmentBytesPerSample), - "offsetof mismatch for Limits::maxColorAttachmentBytesPerSample"); - static_assert(offsetof(Limits, maxComputeWorkgroupStorageSize) == offsetof(WGPULimits, maxComputeWorkgroupStorageSize), - "offsetof mismatch for Limits::maxComputeWorkgroupStorageSize"); - static_assert(offsetof(Limits, maxComputeInvocationsPerWorkgroup) == offsetof(WGPULimits, maxComputeInvocationsPerWorkgroup), - "offsetof mismatch for Limits::maxComputeInvocationsPerWorkgroup"); - static_assert(offsetof(Limits, maxComputeWorkgroupSizeX) == offsetof(WGPULimits, maxComputeWorkgroupSizeX), - "offsetof mismatch for Limits::maxComputeWorkgroupSizeX"); - static_assert(offsetof(Limits, maxComputeWorkgroupSizeY) == offsetof(WGPULimits, maxComputeWorkgroupSizeY), - "offsetof mismatch for Limits::maxComputeWorkgroupSizeY"); - static_assert(offsetof(Limits, maxComputeWorkgroupSizeZ) == offsetof(WGPULimits, maxComputeWorkgroupSizeZ), - "offsetof mismatch for Limits::maxComputeWorkgroupSizeZ"); - static_assert(offsetof(Limits, maxComputeWorkgroupsPerDimension) == offsetof(WGPULimits, maxComputeWorkgroupsPerDimension), - "offsetof mismatch for Limits::maxComputeWorkgroupsPerDimension"); - - // MemoryHeapInfo - - static_assert(sizeof(MemoryHeapInfo) == sizeof(WGPUMemoryHeapInfo), "sizeof mismatch for MemoryHeapInfo"); - static_assert(alignof(MemoryHeapInfo) == alignof(WGPUMemoryHeapInfo), "alignof mismatch for MemoryHeapInfo"); - - static_assert(offsetof(MemoryHeapInfo, properties) == offsetof(WGPUMemoryHeapInfo, properties), - "offsetof mismatch for MemoryHeapInfo::properties"); - static_assert(offsetof(MemoryHeapInfo, size) == offsetof(WGPUMemoryHeapInfo, size), - "offsetof mismatch for MemoryHeapInfo::size"); - - // MultisampleState - - static_assert(sizeof(MultisampleState) == sizeof(WGPUMultisampleState), "sizeof mismatch for MultisampleState"); - static_assert(alignof(MultisampleState) == alignof(WGPUMultisampleState), "alignof mismatch for MultisampleState"); - - static_assert(offsetof(MultisampleState, nextInChain) == offsetof(WGPUMultisampleState, nextInChain), - "offsetof mismatch for MultisampleState::nextInChain"); - static_assert(offsetof(MultisampleState, count) == offsetof(WGPUMultisampleState, count), - "offsetof mismatch for MultisampleState::count"); - static_assert(offsetof(MultisampleState, mask) == offsetof(WGPUMultisampleState, mask), - "offsetof mismatch for MultisampleState::mask"); - static_assert(offsetof(MultisampleState, alphaToCoverageEnabled) == offsetof(WGPUMultisampleState, alphaToCoverageEnabled), - "offsetof mismatch for MultisampleState::alphaToCoverageEnabled"); - - // Origin2D - - static_assert(sizeof(Origin2D) == sizeof(WGPUOrigin2D), "sizeof mismatch for Origin2D"); - static_assert(alignof(Origin2D) == alignof(WGPUOrigin2D), "alignof mismatch for Origin2D"); - - static_assert(offsetof(Origin2D, x) == offsetof(WGPUOrigin2D, x), - "offsetof mismatch for Origin2D::x"); - static_assert(offsetof(Origin2D, y) == offsetof(WGPUOrigin2D, y), - "offsetof mismatch for Origin2D::y"); - - // Origin3D - - static_assert(sizeof(Origin3D) == sizeof(WGPUOrigin3D), "sizeof mismatch for Origin3D"); - static_assert(alignof(Origin3D) == alignof(WGPUOrigin3D), "alignof mismatch for Origin3D"); - - static_assert(offsetof(Origin3D, x) == offsetof(WGPUOrigin3D, x), - "offsetof mismatch for Origin3D::x"); - static_assert(offsetof(Origin3D, y) == offsetof(WGPUOrigin3D, y), - "offsetof mismatch for Origin3D::y"); - static_assert(offsetof(Origin3D, z) == offsetof(WGPUOrigin3D, z), - "offsetof mismatch for Origin3D::z"); - - // PipelineLayoutDescriptor - - static_assert(sizeof(PipelineLayoutDescriptor) == sizeof(WGPUPipelineLayoutDescriptor), "sizeof mismatch for PipelineLayoutDescriptor"); - static_assert(alignof(PipelineLayoutDescriptor) == alignof(WGPUPipelineLayoutDescriptor), "alignof mismatch for PipelineLayoutDescriptor"); - - static_assert(offsetof(PipelineLayoutDescriptor, nextInChain) == offsetof(WGPUPipelineLayoutDescriptor, nextInChain), - "offsetof mismatch for PipelineLayoutDescriptor::nextInChain"); - static_assert(offsetof(PipelineLayoutDescriptor, label) == offsetof(WGPUPipelineLayoutDescriptor, label), - "offsetof mismatch for PipelineLayoutDescriptor::label"); - static_assert(offsetof(PipelineLayoutDescriptor, bindGroupLayoutCount) == offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayoutCount), - "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayoutCount"); - static_assert(offsetof(PipelineLayoutDescriptor, bindGroupLayouts) == offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayouts), - "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayouts"); - - // PipelineLayoutStorageAttachment - - static_assert(sizeof(PipelineLayoutStorageAttachment) == sizeof(WGPUPipelineLayoutStorageAttachment), "sizeof mismatch for PipelineLayoutStorageAttachment"); - static_assert(alignof(PipelineLayoutStorageAttachment) == alignof(WGPUPipelineLayoutStorageAttachment), "alignof mismatch for PipelineLayoutStorageAttachment"); - - static_assert(offsetof(PipelineLayoutStorageAttachment, nextInChain) == offsetof(WGPUPipelineLayoutStorageAttachment, nextInChain), - "offsetof mismatch for PipelineLayoutStorageAttachment::nextInChain"); - static_assert(offsetof(PipelineLayoutStorageAttachment, offset) == offsetof(WGPUPipelineLayoutStorageAttachment, offset), - "offsetof mismatch for PipelineLayoutStorageAttachment::offset"); - static_assert(offsetof(PipelineLayoutStorageAttachment, format) == offsetof(WGPUPipelineLayoutStorageAttachment, format), - "offsetof mismatch for PipelineLayoutStorageAttachment::format"); - - // PopErrorScopeCallbackInfo - - static_assert(sizeof(PopErrorScopeCallbackInfo) == sizeof(WGPUPopErrorScopeCallbackInfo), "sizeof mismatch for PopErrorScopeCallbackInfo"); - static_assert(alignof(PopErrorScopeCallbackInfo) == alignof(WGPUPopErrorScopeCallbackInfo), "alignof mismatch for PopErrorScopeCallbackInfo"); - - static_assert(offsetof(PopErrorScopeCallbackInfo, nextInChain) == offsetof(WGPUPopErrorScopeCallbackInfo, nextInChain), - "offsetof mismatch for PopErrorScopeCallbackInfo::nextInChain"); - static_assert(offsetof(PopErrorScopeCallbackInfo, mode) == offsetof(WGPUPopErrorScopeCallbackInfo, mode), - "offsetof mismatch for PopErrorScopeCallbackInfo::mode"); - static_assert(offsetof(PopErrorScopeCallbackInfo, callback) == offsetof(WGPUPopErrorScopeCallbackInfo, callback), - "offsetof mismatch for PopErrorScopeCallbackInfo::callback"); - static_assert(offsetof(PopErrorScopeCallbackInfo, oldCallback) == offsetof(WGPUPopErrorScopeCallbackInfo, oldCallback), - "offsetof mismatch for PopErrorScopeCallbackInfo::oldCallback"); - static_assert(offsetof(PopErrorScopeCallbackInfo, userdata) == offsetof(WGPUPopErrorScopeCallbackInfo, userdata), - "offsetof mismatch for PopErrorScopeCallbackInfo::userdata"); - - // PrimitiveDepthClipControl - - static_assert(sizeof(PrimitiveDepthClipControl) == sizeof(WGPUPrimitiveDepthClipControl), "sizeof mismatch for PrimitiveDepthClipControl"); - static_assert(alignof(PrimitiveDepthClipControl) == alignof(WGPUPrimitiveDepthClipControl), "alignof mismatch for PrimitiveDepthClipControl"); - - static_assert(offsetof(PrimitiveDepthClipControl, unclippedDepth) == offsetof(WGPUPrimitiveDepthClipControl, unclippedDepth), - "offsetof mismatch for PrimitiveDepthClipControl::unclippedDepth"); - - // PrimitiveState - - static_assert(sizeof(PrimitiveState) == sizeof(WGPUPrimitiveState), "sizeof mismatch for PrimitiveState"); - static_assert(alignof(PrimitiveState) == alignof(WGPUPrimitiveState), "alignof mismatch for PrimitiveState"); - - static_assert(offsetof(PrimitiveState, nextInChain) == offsetof(WGPUPrimitiveState, nextInChain), - "offsetof mismatch for PrimitiveState::nextInChain"); - static_assert(offsetof(PrimitiveState, topology) == offsetof(WGPUPrimitiveState, topology), - "offsetof mismatch for PrimitiveState::topology"); - static_assert(offsetof(PrimitiveState, stripIndexFormat) == offsetof(WGPUPrimitiveState, stripIndexFormat), - "offsetof mismatch for PrimitiveState::stripIndexFormat"); - static_assert(offsetof(PrimitiveState, frontFace) == offsetof(WGPUPrimitiveState, frontFace), - "offsetof mismatch for PrimitiveState::frontFace"); - static_assert(offsetof(PrimitiveState, cullMode) == offsetof(WGPUPrimitiveState, cullMode), - "offsetof mismatch for PrimitiveState::cullMode"); - - // QuerySetDescriptor - - static_assert(sizeof(QuerySetDescriptor) == sizeof(WGPUQuerySetDescriptor), "sizeof mismatch for QuerySetDescriptor"); - static_assert(alignof(QuerySetDescriptor) == alignof(WGPUQuerySetDescriptor), "alignof mismatch for QuerySetDescriptor"); - - static_assert(offsetof(QuerySetDescriptor, nextInChain) == offsetof(WGPUQuerySetDescriptor, nextInChain), - "offsetof mismatch for QuerySetDescriptor::nextInChain"); - static_assert(offsetof(QuerySetDescriptor, label) == offsetof(WGPUQuerySetDescriptor, label), - "offsetof mismatch for QuerySetDescriptor::label"); - static_assert(offsetof(QuerySetDescriptor, type) == offsetof(WGPUQuerySetDescriptor, type), - "offsetof mismatch for QuerySetDescriptor::type"); - static_assert(offsetof(QuerySetDescriptor, count) == offsetof(WGPUQuerySetDescriptor, count), - "offsetof mismatch for QuerySetDescriptor::count"); - - // QueueDescriptor - - static_assert(sizeof(QueueDescriptor) == sizeof(WGPUQueueDescriptor), "sizeof mismatch for QueueDescriptor"); - static_assert(alignof(QueueDescriptor) == alignof(WGPUQueueDescriptor), "alignof mismatch for QueueDescriptor"); - - static_assert(offsetof(QueueDescriptor, nextInChain) == offsetof(WGPUQueueDescriptor, nextInChain), - "offsetof mismatch for QueueDescriptor::nextInChain"); - static_assert(offsetof(QueueDescriptor, label) == offsetof(WGPUQueueDescriptor, label), - "offsetof mismatch for QueueDescriptor::label"); - - // QueueWorkDoneCallbackInfo - - static_assert(sizeof(QueueWorkDoneCallbackInfo) == sizeof(WGPUQueueWorkDoneCallbackInfo), "sizeof mismatch for QueueWorkDoneCallbackInfo"); - static_assert(alignof(QueueWorkDoneCallbackInfo) == alignof(WGPUQueueWorkDoneCallbackInfo), "alignof mismatch for QueueWorkDoneCallbackInfo"); - - static_assert(offsetof(QueueWorkDoneCallbackInfo, nextInChain) == offsetof(WGPUQueueWorkDoneCallbackInfo, nextInChain), - "offsetof mismatch for QueueWorkDoneCallbackInfo::nextInChain"); - static_assert(offsetof(QueueWorkDoneCallbackInfo, mode) == offsetof(WGPUQueueWorkDoneCallbackInfo, mode), - "offsetof mismatch for QueueWorkDoneCallbackInfo::mode"); - static_assert(offsetof(QueueWorkDoneCallbackInfo, callback) == offsetof(WGPUQueueWorkDoneCallbackInfo, callback), - "offsetof mismatch for QueueWorkDoneCallbackInfo::callback"); - static_assert(offsetof(QueueWorkDoneCallbackInfo, userdata) == offsetof(WGPUQueueWorkDoneCallbackInfo, userdata), - "offsetof mismatch for QueueWorkDoneCallbackInfo::userdata"); - - // RenderBundleDescriptor - - static_assert(sizeof(RenderBundleDescriptor) == sizeof(WGPURenderBundleDescriptor), "sizeof mismatch for RenderBundleDescriptor"); - static_assert(alignof(RenderBundleDescriptor) == alignof(WGPURenderBundleDescriptor), "alignof mismatch for RenderBundleDescriptor"); - - static_assert(offsetof(RenderBundleDescriptor, nextInChain) == offsetof(WGPURenderBundleDescriptor, nextInChain), - "offsetof mismatch for RenderBundleDescriptor::nextInChain"); - static_assert(offsetof(RenderBundleDescriptor, label) == offsetof(WGPURenderBundleDescriptor, label), - "offsetof mismatch for RenderBundleDescriptor::label"); - - // RenderBundleEncoderDescriptor - - static_assert(sizeof(RenderBundleEncoderDescriptor) == sizeof(WGPURenderBundleEncoderDescriptor), "sizeof mismatch for RenderBundleEncoderDescriptor"); - static_assert(alignof(RenderBundleEncoderDescriptor) == alignof(WGPURenderBundleEncoderDescriptor), "alignof mismatch for RenderBundleEncoderDescriptor"); - - static_assert(offsetof(RenderBundleEncoderDescriptor, nextInChain) == offsetof(WGPURenderBundleEncoderDescriptor, nextInChain), - "offsetof mismatch for RenderBundleEncoderDescriptor::nextInChain"); - static_assert(offsetof(RenderBundleEncoderDescriptor, label) == offsetof(WGPURenderBundleEncoderDescriptor, label), - "offsetof mismatch for RenderBundleEncoderDescriptor::label"); - static_assert(offsetof(RenderBundleEncoderDescriptor, colorFormatCount) == offsetof(WGPURenderBundleEncoderDescriptor, colorFormatCount), - "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormatCount"); - static_assert(offsetof(RenderBundleEncoderDescriptor, colorFormats) == offsetof(WGPURenderBundleEncoderDescriptor, colorFormats), - "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormats"); - static_assert(offsetof(RenderBundleEncoderDescriptor, depthStencilFormat) == offsetof(WGPURenderBundleEncoderDescriptor, depthStencilFormat), - "offsetof mismatch for RenderBundleEncoderDescriptor::depthStencilFormat"); - static_assert(offsetof(RenderBundleEncoderDescriptor, sampleCount) == offsetof(WGPURenderBundleEncoderDescriptor, sampleCount), - "offsetof mismatch for RenderBundleEncoderDescriptor::sampleCount"); - static_assert(offsetof(RenderBundleEncoderDescriptor, depthReadOnly) == offsetof(WGPURenderBundleEncoderDescriptor, depthReadOnly), - "offsetof mismatch for RenderBundleEncoderDescriptor::depthReadOnly"); - static_assert(offsetof(RenderBundleEncoderDescriptor, stencilReadOnly) == offsetof(WGPURenderBundleEncoderDescriptor, stencilReadOnly), - "offsetof mismatch for RenderBundleEncoderDescriptor::stencilReadOnly"); - - // RenderPassDepthStencilAttachment - - static_assert(sizeof(RenderPassDepthStencilAttachment) == sizeof(WGPURenderPassDepthStencilAttachment), "sizeof mismatch for RenderPassDepthStencilAttachment"); - static_assert(alignof(RenderPassDepthStencilAttachment) == alignof(WGPURenderPassDepthStencilAttachment), "alignof mismatch for RenderPassDepthStencilAttachment"); - - static_assert(offsetof(RenderPassDepthStencilAttachment, view) == offsetof(WGPURenderPassDepthStencilAttachment, view), - "offsetof mismatch for RenderPassDepthStencilAttachment::view"); - static_assert(offsetof(RenderPassDepthStencilAttachment, depthLoadOp) == offsetof(WGPURenderPassDepthStencilAttachment, depthLoadOp), - "offsetof mismatch for RenderPassDepthStencilAttachment::depthLoadOp"); - static_assert(offsetof(RenderPassDepthStencilAttachment, depthStoreOp) == offsetof(WGPURenderPassDepthStencilAttachment, depthStoreOp), - "offsetof mismatch for RenderPassDepthStencilAttachment::depthStoreOp"); - static_assert(offsetof(RenderPassDepthStencilAttachment, depthClearValue) == offsetof(WGPURenderPassDepthStencilAttachment, depthClearValue), - "offsetof mismatch for RenderPassDepthStencilAttachment::depthClearValue"); - static_assert(offsetof(RenderPassDepthStencilAttachment, depthReadOnly) == offsetof(WGPURenderPassDepthStencilAttachment, depthReadOnly), - "offsetof mismatch for RenderPassDepthStencilAttachment::depthReadOnly"); - static_assert(offsetof(RenderPassDepthStencilAttachment, stencilLoadOp) == offsetof(WGPURenderPassDepthStencilAttachment, stencilLoadOp), - "offsetof mismatch for RenderPassDepthStencilAttachment::stencilLoadOp"); - static_assert(offsetof(RenderPassDepthStencilAttachment, stencilStoreOp) == offsetof(WGPURenderPassDepthStencilAttachment, stencilStoreOp), - "offsetof mismatch for RenderPassDepthStencilAttachment::stencilStoreOp"); - static_assert(offsetof(RenderPassDepthStencilAttachment, stencilClearValue) == offsetof(WGPURenderPassDepthStencilAttachment, stencilClearValue), - "offsetof mismatch for RenderPassDepthStencilAttachment::stencilClearValue"); - static_assert(offsetof(RenderPassDepthStencilAttachment, stencilReadOnly) == offsetof(WGPURenderPassDepthStencilAttachment, stencilReadOnly), - "offsetof mismatch for RenderPassDepthStencilAttachment::stencilReadOnly"); - - // RenderPassDescriptorMaxDrawCount - - static_assert(sizeof(RenderPassDescriptorMaxDrawCount) == sizeof(WGPURenderPassDescriptorMaxDrawCount), "sizeof mismatch for RenderPassDescriptorMaxDrawCount"); - static_assert(alignof(RenderPassDescriptorMaxDrawCount) == alignof(WGPURenderPassDescriptorMaxDrawCount), "alignof mismatch for RenderPassDescriptorMaxDrawCount"); - - static_assert(offsetof(RenderPassDescriptorMaxDrawCount, maxDrawCount) == offsetof(WGPURenderPassDescriptorMaxDrawCount, maxDrawCount), - "offsetof mismatch for RenderPassDescriptorMaxDrawCount::maxDrawCount"); - - // RenderPassTimestampWrites - - static_assert(sizeof(RenderPassTimestampWrites) == sizeof(WGPURenderPassTimestampWrites), "sizeof mismatch for RenderPassTimestampWrites"); - static_assert(alignof(RenderPassTimestampWrites) == alignof(WGPURenderPassTimestampWrites), "alignof mismatch for RenderPassTimestampWrites"); - - static_assert(offsetof(RenderPassTimestampWrites, querySet) == offsetof(WGPURenderPassTimestampWrites, querySet), - "offsetof mismatch for RenderPassTimestampWrites::querySet"); - static_assert(offsetof(RenderPassTimestampWrites, beginningOfPassWriteIndex) == offsetof(WGPURenderPassTimestampWrites, beginningOfPassWriteIndex), - "offsetof mismatch for RenderPassTimestampWrites::beginningOfPassWriteIndex"); - static_assert(offsetof(RenderPassTimestampWrites, endOfPassWriteIndex) == offsetof(WGPURenderPassTimestampWrites, endOfPassWriteIndex), - "offsetof mismatch for RenderPassTimestampWrites::endOfPassWriteIndex"); - - // RequestAdapterCallbackInfo - - static_assert(sizeof(RequestAdapterCallbackInfo) == sizeof(WGPURequestAdapterCallbackInfo), "sizeof mismatch for RequestAdapterCallbackInfo"); - static_assert(alignof(RequestAdapterCallbackInfo) == alignof(WGPURequestAdapterCallbackInfo), "alignof mismatch for RequestAdapterCallbackInfo"); - - static_assert(offsetof(RequestAdapterCallbackInfo, nextInChain) == offsetof(WGPURequestAdapterCallbackInfo, nextInChain), - "offsetof mismatch for RequestAdapterCallbackInfo::nextInChain"); - static_assert(offsetof(RequestAdapterCallbackInfo, mode) == offsetof(WGPURequestAdapterCallbackInfo, mode), - "offsetof mismatch for RequestAdapterCallbackInfo::mode"); - static_assert(offsetof(RequestAdapterCallbackInfo, callback) == offsetof(WGPURequestAdapterCallbackInfo, callback), - "offsetof mismatch for RequestAdapterCallbackInfo::callback"); - static_assert(offsetof(RequestAdapterCallbackInfo, userdata) == offsetof(WGPURequestAdapterCallbackInfo, userdata), - "offsetof mismatch for RequestAdapterCallbackInfo::userdata"); - - // RequestAdapterOptions - - static_assert(sizeof(RequestAdapterOptions) == sizeof(WGPURequestAdapterOptions), "sizeof mismatch for RequestAdapterOptions"); - static_assert(alignof(RequestAdapterOptions) == alignof(WGPURequestAdapterOptions), "alignof mismatch for RequestAdapterOptions"); - - static_assert(offsetof(RequestAdapterOptions, nextInChain) == offsetof(WGPURequestAdapterOptions, nextInChain), - "offsetof mismatch for RequestAdapterOptions::nextInChain"); - static_assert(offsetof(RequestAdapterOptions, compatibleSurface) == offsetof(WGPURequestAdapterOptions, compatibleSurface), - "offsetof mismatch for RequestAdapterOptions::compatibleSurface"); - static_assert(offsetof(RequestAdapterOptions, powerPreference) == offsetof(WGPURequestAdapterOptions, powerPreference), - "offsetof mismatch for RequestAdapterOptions::powerPreference"); - static_assert(offsetof(RequestAdapterOptions, backendType) == offsetof(WGPURequestAdapterOptions, backendType), - "offsetof mismatch for RequestAdapterOptions::backendType"); - static_assert(offsetof(RequestAdapterOptions, forceFallbackAdapter) == offsetof(WGPURequestAdapterOptions, forceFallbackAdapter), - "offsetof mismatch for RequestAdapterOptions::forceFallbackAdapter"); - static_assert(offsetof(RequestAdapterOptions, compatibilityMode) == offsetof(WGPURequestAdapterOptions, compatibilityMode), - "offsetof mismatch for RequestAdapterOptions::compatibilityMode"); - - // RequestDeviceCallbackInfo - - static_assert(sizeof(RequestDeviceCallbackInfo) == sizeof(WGPURequestDeviceCallbackInfo), "sizeof mismatch for RequestDeviceCallbackInfo"); - static_assert(alignof(RequestDeviceCallbackInfo) == alignof(WGPURequestDeviceCallbackInfo), "alignof mismatch for RequestDeviceCallbackInfo"); - - static_assert(offsetof(RequestDeviceCallbackInfo, nextInChain) == offsetof(WGPURequestDeviceCallbackInfo, nextInChain), - "offsetof mismatch for RequestDeviceCallbackInfo::nextInChain"); - static_assert(offsetof(RequestDeviceCallbackInfo, mode) == offsetof(WGPURequestDeviceCallbackInfo, mode), - "offsetof mismatch for RequestDeviceCallbackInfo::mode"); - static_assert(offsetof(RequestDeviceCallbackInfo, callback) == offsetof(WGPURequestDeviceCallbackInfo, callback), - "offsetof mismatch for RequestDeviceCallbackInfo::callback"); - static_assert(offsetof(RequestDeviceCallbackInfo, userdata) == offsetof(WGPURequestDeviceCallbackInfo, userdata), - "offsetof mismatch for RequestDeviceCallbackInfo::userdata"); - - // SamplerBindingLayout - - static_assert(sizeof(SamplerBindingLayout) == sizeof(WGPUSamplerBindingLayout), "sizeof mismatch for SamplerBindingLayout"); - static_assert(alignof(SamplerBindingLayout) == alignof(WGPUSamplerBindingLayout), "alignof mismatch for SamplerBindingLayout"); - - static_assert(offsetof(SamplerBindingLayout, nextInChain) == offsetof(WGPUSamplerBindingLayout, nextInChain), - "offsetof mismatch for SamplerBindingLayout::nextInChain"); - static_assert(offsetof(SamplerBindingLayout, type) == offsetof(WGPUSamplerBindingLayout, type), - "offsetof mismatch for SamplerBindingLayout::type"); - - // SamplerDescriptor - - static_assert(sizeof(SamplerDescriptor) == sizeof(WGPUSamplerDescriptor), "sizeof mismatch for SamplerDescriptor"); - static_assert(alignof(SamplerDescriptor) == alignof(WGPUSamplerDescriptor), "alignof mismatch for SamplerDescriptor"); - - static_assert(offsetof(SamplerDescriptor, nextInChain) == offsetof(WGPUSamplerDescriptor, nextInChain), - "offsetof mismatch for SamplerDescriptor::nextInChain"); - static_assert(offsetof(SamplerDescriptor, label) == offsetof(WGPUSamplerDescriptor, label), - "offsetof mismatch for SamplerDescriptor::label"); - static_assert(offsetof(SamplerDescriptor, addressModeU) == offsetof(WGPUSamplerDescriptor, addressModeU), - "offsetof mismatch for SamplerDescriptor::addressModeU"); - static_assert(offsetof(SamplerDescriptor, addressModeV) == offsetof(WGPUSamplerDescriptor, addressModeV), - "offsetof mismatch for SamplerDescriptor::addressModeV"); - static_assert(offsetof(SamplerDescriptor, addressModeW) == offsetof(WGPUSamplerDescriptor, addressModeW), - "offsetof mismatch for SamplerDescriptor::addressModeW"); - static_assert(offsetof(SamplerDescriptor, magFilter) == offsetof(WGPUSamplerDescriptor, magFilter), - "offsetof mismatch for SamplerDescriptor::magFilter"); - static_assert(offsetof(SamplerDescriptor, minFilter) == offsetof(WGPUSamplerDescriptor, minFilter), - "offsetof mismatch for SamplerDescriptor::minFilter"); - static_assert(offsetof(SamplerDescriptor, mipmapFilter) == offsetof(WGPUSamplerDescriptor, mipmapFilter), - "offsetof mismatch for SamplerDescriptor::mipmapFilter"); - static_assert(offsetof(SamplerDescriptor, lodMinClamp) == offsetof(WGPUSamplerDescriptor, lodMinClamp), - "offsetof mismatch for SamplerDescriptor::lodMinClamp"); - static_assert(offsetof(SamplerDescriptor, lodMaxClamp) == offsetof(WGPUSamplerDescriptor, lodMaxClamp), - "offsetof mismatch for SamplerDescriptor::lodMaxClamp"); - static_assert(offsetof(SamplerDescriptor, compare) == offsetof(WGPUSamplerDescriptor, compare), - "offsetof mismatch for SamplerDescriptor::compare"); - static_assert(offsetof(SamplerDescriptor, maxAnisotropy) == offsetof(WGPUSamplerDescriptor, maxAnisotropy), - "offsetof mismatch for SamplerDescriptor::maxAnisotropy"); - - // ShaderModuleSPIRVDescriptor - - static_assert(sizeof(ShaderModuleSPIRVDescriptor) == sizeof(WGPUShaderModuleSPIRVDescriptor), "sizeof mismatch for ShaderModuleSPIRVDescriptor"); - static_assert(alignof(ShaderModuleSPIRVDescriptor) == alignof(WGPUShaderModuleSPIRVDescriptor), "alignof mismatch for ShaderModuleSPIRVDescriptor"); - - static_assert(offsetof(ShaderModuleSPIRVDescriptor, codeSize) == offsetof(WGPUShaderModuleSPIRVDescriptor, codeSize), - "offsetof mismatch for ShaderModuleSPIRVDescriptor::codeSize"); - static_assert(offsetof(ShaderModuleSPIRVDescriptor, code) == offsetof(WGPUShaderModuleSPIRVDescriptor, code), - "offsetof mismatch for ShaderModuleSPIRVDescriptor::code"); - - // ShaderModuleWGSLDescriptor - - static_assert(sizeof(ShaderModuleWGSLDescriptor) == sizeof(WGPUShaderModuleWGSLDescriptor), "sizeof mismatch for ShaderModuleWGSLDescriptor"); - static_assert(alignof(ShaderModuleWGSLDescriptor) == alignof(WGPUShaderModuleWGSLDescriptor), "alignof mismatch for ShaderModuleWGSLDescriptor"); - - static_assert(offsetof(ShaderModuleWGSLDescriptor, code) == offsetof(WGPUShaderModuleWGSLDescriptor, code), - "offsetof mismatch for ShaderModuleWGSLDescriptor::code"); - - // ShaderModuleDescriptor - - static_assert(sizeof(ShaderModuleDescriptor) == sizeof(WGPUShaderModuleDescriptor), "sizeof mismatch for ShaderModuleDescriptor"); - static_assert(alignof(ShaderModuleDescriptor) == alignof(WGPUShaderModuleDescriptor), "alignof mismatch for ShaderModuleDescriptor"); - - static_assert(offsetof(ShaderModuleDescriptor, nextInChain) == offsetof(WGPUShaderModuleDescriptor, nextInChain), - "offsetof mismatch for ShaderModuleDescriptor::nextInChain"); - static_assert(offsetof(ShaderModuleDescriptor, label) == offsetof(WGPUShaderModuleDescriptor, label), - "offsetof mismatch for ShaderModuleDescriptor::label"); - - // SharedBufferMemoryBeginAccessDescriptor - - static_assert(sizeof(SharedBufferMemoryBeginAccessDescriptor) == sizeof(WGPUSharedBufferMemoryBeginAccessDescriptor), "sizeof mismatch for SharedBufferMemoryBeginAccessDescriptor"); - static_assert(alignof(SharedBufferMemoryBeginAccessDescriptor) == alignof(WGPUSharedBufferMemoryBeginAccessDescriptor), "alignof mismatch for SharedBufferMemoryBeginAccessDescriptor"); - - static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, nextInChain) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, nextInChain), - "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::nextInChain"); - static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, initialized) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, initialized), - "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::initialized"); - static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, fenceCount) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, fenceCount), - "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::fenceCount"); - static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, fences) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, fences), - "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::fences"); - static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, signaledValues) == offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, signaledValues), - "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::signaledValues"); - - // SharedBufferMemoryDescriptor - - static_assert(sizeof(SharedBufferMemoryDescriptor) == sizeof(WGPUSharedBufferMemoryDescriptor), "sizeof mismatch for SharedBufferMemoryDescriptor"); - static_assert(alignof(SharedBufferMemoryDescriptor) == alignof(WGPUSharedBufferMemoryDescriptor), "alignof mismatch for SharedBufferMemoryDescriptor"); - - static_assert(offsetof(SharedBufferMemoryDescriptor, nextInChain) == offsetof(WGPUSharedBufferMemoryDescriptor, nextInChain), - "offsetof mismatch for SharedBufferMemoryDescriptor::nextInChain"); - static_assert(offsetof(SharedBufferMemoryDescriptor, label) == offsetof(WGPUSharedBufferMemoryDescriptor, label), - "offsetof mismatch for SharedBufferMemoryDescriptor::label"); - - // SharedBufferMemoryEndAccessState - - static_assert(sizeof(SharedBufferMemoryEndAccessState) == sizeof(WGPUSharedBufferMemoryEndAccessState), "sizeof mismatch for SharedBufferMemoryEndAccessState"); - static_assert(alignof(SharedBufferMemoryEndAccessState) == alignof(WGPUSharedBufferMemoryEndAccessState), "alignof mismatch for SharedBufferMemoryEndAccessState"); - - static_assert(offsetof(SharedBufferMemoryEndAccessState, nextInChain) == offsetof(WGPUSharedBufferMemoryEndAccessState, nextInChain), - "offsetof mismatch for SharedBufferMemoryEndAccessState::nextInChain"); - static_assert(offsetof(SharedBufferMemoryEndAccessState, initialized) == offsetof(WGPUSharedBufferMemoryEndAccessState, initialized), - "offsetof mismatch for SharedBufferMemoryEndAccessState::initialized"); - static_assert(offsetof(SharedBufferMemoryEndAccessState, fenceCount) == offsetof(WGPUSharedBufferMemoryEndAccessState, fenceCount), - "offsetof mismatch for SharedBufferMemoryEndAccessState::fenceCount"); - static_assert(offsetof(SharedBufferMemoryEndAccessState, fences) == offsetof(WGPUSharedBufferMemoryEndAccessState, fences), - "offsetof mismatch for SharedBufferMemoryEndAccessState::fences"); - static_assert(offsetof(SharedBufferMemoryEndAccessState, signaledValues) == offsetof(WGPUSharedBufferMemoryEndAccessState, signaledValues), - "offsetof mismatch for SharedBufferMemoryEndAccessState::signaledValues"); - - // SharedBufferMemoryProperties - - static_assert(sizeof(SharedBufferMemoryProperties) == sizeof(WGPUSharedBufferMemoryProperties), "sizeof mismatch for SharedBufferMemoryProperties"); - static_assert(alignof(SharedBufferMemoryProperties) == alignof(WGPUSharedBufferMemoryProperties), "alignof mismatch for SharedBufferMemoryProperties"); - - static_assert(offsetof(SharedBufferMemoryProperties, nextInChain) == offsetof(WGPUSharedBufferMemoryProperties, nextInChain), - "offsetof mismatch for SharedBufferMemoryProperties::nextInChain"); - static_assert(offsetof(SharedBufferMemoryProperties, usage) == offsetof(WGPUSharedBufferMemoryProperties, usage), - "offsetof mismatch for SharedBufferMemoryProperties::usage"); - static_assert(offsetof(SharedBufferMemoryProperties, size) == offsetof(WGPUSharedBufferMemoryProperties, size), - "offsetof mismatch for SharedBufferMemoryProperties::size"); - - // SharedFenceDXGISharedHandleDescriptor - - static_assert(sizeof(SharedFenceDXGISharedHandleDescriptor) == sizeof(WGPUSharedFenceDXGISharedHandleDescriptor), "sizeof mismatch for SharedFenceDXGISharedHandleDescriptor"); - static_assert(alignof(SharedFenceDXGISharedHandleDescriptor) == alignof(WGPUSharedFenceDXGISharedHandleDescriptor), "alignof mismatch for SharedFenceDXGISharedHandleDescriptor"); - - static_assert(offsetof(SharedFenceDXGISharedHandleDescriptor, handle) == offsetof(WGPUSharedFenceDXGISharedHandleDescriptor, handle), - "offsetof mismatch for SharedFenceDXGISharedHandleDescriptor::handle"); - - // SharedFenceDXGISharedHandleExportInfo - - static_assert(sizeof(SharedFenceDXGISharedHandleExportInfo) == sizeof(WGPUSharedFenceDXGISharedHandleExportInfo), "sizeof mismatch for SharedFenceDXGISharedHandleExportInfo"); - static_assert(alignof(SharedFenceDXGISharedHandleExportInfo) == alignof(WGPUSharedFenceDXGISharedHandleExportInfo), "alignof mismatch for SharedFenceDXGISharedHandleExportInfo"); - - static_assert(offsetof(SharedFenceDXGISharedHandleExportInfo, handle) == offsetof(WGPUSharedFenceDXGISharedHandleExportInfo, handle), - "offsetof mismatch for SharedFenceDXGISharedHandleExportInfo::handle"); - - // SharedFenceMTLSharedEventDescriptor - - static_assert(sizeof(SharedFenceMTLSharedEventDescriptor) == sizeof(WGPUSharedFenceMTLSharedEventDescriptor), "sizeof mismatch for SharedFenceMTLSharedEventDescriptor"); - static_assert(alignof(SharedFenceMTLSharedEventDescriptor) == alignof(WGPUSharedFenceMTLSharedEventDescriptor), "alignof mismatch for SharedFenceMTLSharedEventDescriptor"); - - static_assert(offsetof(SharedFenceMTLSharedEventDescriptor, sharedEvent) == offsetof(WGPUSharedFenceMTLSharedEventDescriptor, sharedEvent), - "offsetof mismatch for SharedFenceMTLSharedEventDescriptor::sharedEvent"); - - // SharedFenceMTLSharedEventExportInfo - - static_assert(sizeof(SharedFenceMTLSharedEventExportInfo) == sizeof(WGPUSharedFenceMTLSharedEventExportInfo), "sizeof mismatch for SharedFenceMTLSharedEventExportInfo"); - static_assert(alignof(SharedFenceMTLSharedEventExportInfo) == alignof(WGPUSharedFenceMTLSharedEventExportInfo), "alignof mismatch for SharedFenceMTLSharedEventExportInfo"); - - static_assert(offsetof(SharedFenceMTLSharedEventExportInfo, sharedEvent) == offsetof(WGPUSharedFenceMTLSharedEventExportInfo, sharedEvent), - "offsetof mismatch for SharedFenceMTLSharedEventExportInfo::sharedEvent"); - - // SharedFenceDescriptor - - static_assert(sizeof(SharedFenceDescriptor) == sizeof(WGPUSharedFenceDescriptor), "sizeof mismatch for SharedFenceDescriptor"); - static_assert(alignof(SharedFenceDescriptor) == alignof(WGPUSharedFenceDescriptor), "alignof mismatch for SharedFenceDescriptor"); - - static_assert(offsetof(SharedFenceDescriptor, nextInChain) == offsetof(WGPUSharedFenceDescriptor, nextInChain), - "offsetof mismatch for SharedFenceDescriptor::nextInChain"); - static_assert(offsetof(SharedFenceDescriptor, label) == offsetof(WGPUSharedFenceDescriptor, label), - "offsetof mismatch for SharedFenceDescriptor::label"); - - // SharedFenceExportInfo - - static_assert(sizeof(SharedFenceExportInfo) == sizeof(WGPUSharedFenceExportInfo), "sizeof mismatch for SharedFenceExportInfo"); - static_assert(alignof(SharedFenceExportInfo) == alignof(WGPUSharedFenceExportInfo), "alignof mismatch for SharedFenceExportInfo"); - - static_assert(offsetof(SharedFenceExportInfo, nextInChain) == offsetof(WGPUSharedFenceExportInfo, nextInChain), - "offsetof mismatch for SharedFenceExportInfo::nextInChain"); - static_assert(offsetof(SharedFenceExportInfo, type) == offsetof(WGPUSharedFenceExportInfo, type), - "offsetof mismatch for SharedFenceExportInfo::type"); - - // SharedFenceVkSemaphoreOpaqueFDDescriptor - - static_assert(sizeof(SharedFenceVkSemaphoreOpaqueFDDescriptor) == sizeof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor), "sizeof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor"); - static_assert(alignof(SharedFenceVkSemaphoreOpaqueFDDescriptor) == alignof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor), "alignof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor"); - - static_assert(offsetof(SharedFenceVkSemaphoreOpaqueFDDescriptor, handle) == offsetof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor, handle), - "offsetof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor::handle"); +// WGSLFeatureName + +static_assert(sizeof(WGSLFeatureName) == sizeof(WGPUWGSLFeatureName), + "sizeof mismatch for WGSLFeatureName"); +static_assert(alignof(WGSLFeatureName) == alignof(WGPUWGSLFeatureName), + "alignof mismatch for WGSLFeatureName"); + +static_assert(static_cast(WGSLFeatureName::Undefined) == + WGPUWGSLFeatureName_Undefined, + "value mismatch for WGSLFeatureName::Undefined"); +static_assert( + static_cast( + WGSLFeatureName::ReadonlyAndReadwriteStorageTextures) == + WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures, + "value mismatch for WGSLFeatureName::ReadonlyAndReadwriteStorageTextures"); +static_assert( + static_cast(WGSLFeatureName::Packed4x8IntegerDotProduct) == + WGPUWGSLFeatureName_Packed4x8IntegerDotProduct, + "value mismatch for WGSLFeatureName::Packed4x8IntegerDotProduct"); +static_assert( + static_cast(WGSLFeatureName::UnrestrictedPointerParameters) == + WGPUWGSLFeatureName_UnrestrictedPointerParameters, + "value mismatch for WGSLFeatureName::UnrestrictedPointerParameters"); +static_assert(static_cast(WGSLFeatureName::PointerCompositeAccess) == + WGPUWGSLFeatureName_PointerCompositeAccess, + "value mismatch for WGSLFeatureName::PointerCompositeAccess"); +static_assert( + static_cast(WGSLFeatureName::ChromiumTestingUnimplemented) == + WGPUWGSLFeatureName_ChromiumTestingUnimplemented, + "value mismatch for WGSLFeatureName::ChromiumTestingUnimplemented"); +static_assert( + static_cast(WGSLFeatureName::ChromiumTestingUnsafeExperimental) == + WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental, + "value mismatch for WGSLFeatureName::ChromiumTestingUnsafeExperimental"); +static_assert( + static_cast(WGSLFeatureName::ChromiumTestingExperimental) == + WGPUWGSLFeatureName_ChromiumTestingExperimental, + "value mismatch for WGSLFeatureName::ChromiumTestingExperimental"); +static_assert( + static_cast( + WGSLFeatureName::ChromiumTestingShippedWithKillswitch) == + WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch, + "value mismatch for WGSLFeatureName::ChromiumTestingShippedWithKillswitch"); +static_assert(static_cast(WGSLFeatureName::ChromiumTestingShipped) == + WGPUWGSLFeatureName_ChromiumTestingShipped, + "value mismatch for WGSLFeatureName::ChromiumTestingShipped"); + +// AdapterType + +static_assert(sizeof(AdapterType) == sizeof(WGPUAdapterType), + "sizeof mismatch for AdapterType"); +static_assert(alignof(AdapterType) == alignof(WGPUAdapterType), + "alignof mismatch for AdapterType"); + +static_assert(static_cast(AdapterType::DiscreteGPU) == + WGPUAdapterType_DiscreteGPU, + "value mismatch for AdapterType::DiscreteGPU"); +static_assert(static_cast(AdapterType::IntegratedGPU) == + WGPUAdapterType_IntegratedGPU, + "value mismatch for AdapterType::IntegratedGPU"); +static_assert(static_cast(AdapterType::CPU) == WGPUAdapterType_CPU, + "value mismatch for AdapterType::CPU"); +static_assert(static_cast(AdapterType::Unknown) == + WGPUAdapterType_Unknown, + "value mismatch for AdapterType::Unknown"); + +// AddressMode + +static_assert(sizeof(AddressMode) == sizeof(WGPUAddressMode), + "sizeof mismatch for AddressMode"); +static_assert(alignof(AddressMode) == alignof(WGPUAddressMode), + "alignof mismatch for AddressMode"); + +static_assert(static_cast(AddressMode::Undefined) == + WGPUAddressMode_Undefined, + "value mismatch for AddressMode::Undefined"); +static_assert(static_cast(AddressMode::ClampToEdge) == + WGPUAddressMode_ClampToEdge, + "value mismatch for AddressMode::ClampToEdge"); +static_assert(static_cast(AddressMode::Repeat) == + WGPUAddressMode_Repeat, + "value mismatch for AddressMode::Repeat"); +static_assert(static_cast(AddressMode::MirrorRepeat) == + WGPUAddressMode_MirrorRepeat, + "value mismatch for AddressMode::MirrorRepeat"); + +// AlphaMode + +static_assert(sizeof(AlphaMode) == sizeof(WGPUAlphaMode), + "sizeof mismatch for AlphaMode"); +static_assert(alignof(AlphaMode) == alignof(WGPUAlphaMode), + "alignof mismatch for AlphaMode"); + +static_assert(static_cast(AlphaMode::Opaque) == WGPUAlphaMode_Opaque, + "value mismatch for AlphaMode::Opaque"); +static_assert(static_cast(AlphaMode::Premultiplied) == + WGPUAlphaMode_Premultiplied, + "value mismatch for AlphaMode::Premultiplied"); +static_assert(static_cast(AlphaMode::Unpremultiplied) == + WGPUAlphaMode_Unpremultiplied, + "value mismatch for AlphaMode::Unpremultiplied"); + +// BackendType + +static_assert(sizeof(BackendType) == sizeof(WGPUBackendType), + "sizeof mismatch for BackendType"); +static_assert(alignof(BackendType) == alignof(WGPUBackendType), + "alignof mismatch for BackendType"); + +static_assert(static_cast(BackendType::Undefined) == + WGPUBackendType_Undefined, + "value mismatch for BackendType::Undefined"); +static_assert(static_cast(BackendType::Null) == WGPUBackendType_Null, + "value mismatch for BackendType::Null"); +static_assert(static_cast(BackendType::WebGPU) == + WGPUBackendType_WebGPU, + "value mismatch for BackendType::WebGPU"); +static_assert(static_cast(BackendType::D3D11) == + WGPUBackendType_D3D11, + "value mismatch for BackendType::D3D11"); +static_assert(static_cast(BackendType::D3D12) == + WGPUBackendType_D3D12, + "value mismatch for BackendType::D3D12"); +static_assert(static_cast(BackendType::Metal) == + WGPUBackendType_Metal, + "value mismatch for BackendType::Metal"); +static_assert(static_cast(BackendType::Vulkan) == + WGPUBackendType_Vulkan, + "value mismatch for BackendType::Vulkan"); +static_assert(static_cast(BackendType::OpenGL) == + WGPUBackendType_OpenGL, + "value mismatch for BackendType::OpenGL"); +static_assert(static_cast(BackendType::OpenGLES) == + WGPUBackendType_OpenGLES, + "value mismatch for BackendType::OpenGLES"); + +// BlendFactor + +static_assert(sizeof(BlendFactor) == sizeof(WGPUBlendFactor), + "sizeof mismatch for BlendFactor"); +static_assert(alignof(BlendFactor) == alignof(WGPUBlendFactor), + "alignof mismatch for BlendFactor"); + +static_assert(static_cast(BlendFactor::Undefined) == + WGPUBlendFactor_Undefined, + "value mismatch for BlendFactor::Undefined"); +static_assert(static_cast(BlendFactor::Zero) == WGPUBlendFactor_Zero, + "value mismatch for BlendFactor::Zero"); +static_assert(static_cast(BlendFactor::One) == WGPUBlendFactor_One, + "value mismatch for BlendFactor::One"); +static_assert(static_cast(BlendFactor::Src) == WGPUBlendFactor_Src, + "value mismatch for BlendFactor::Src"); +static_assert(static_cast(BlendFactor::OneMinusSrc) == + WGPUBlendFactor_OneMinusSrc, + "value mismatch for BlendFactor::OneMinusSrc"); +static_assert(static_cast(BlendFactor::SrcAlpha) == + WGPUBlendFactor_SrcAlpha, + "value mismatch for BlendFactor::SrcAlpha"); +static_assert(static_cast(BlendFactor::OneMinusSrcAlpha) == + WGPUBlendFactor_OneMinusSrcAlpha, + "value mismatch for BlendFactor::OneMinusSrcAlpha"); +static_assert(static_cast(BlendFactor::Dst) == WGPUBlendFactor_Dst, + "value mismatch for BlendFactor::Dst"); +static_assert(static_cast(BlendFactor::OneMinusDst) == + WGPUBlendFactor_OneMinusDst, + "value mismatch for BlendFactor::OneMinusDst"); +static_assert(static_cast(BlendFactor::DstAlpha) == + WGPUBlendFactor_DstAlpha, + "value mismatch for BlendFactor::DstAlpha"); +static_assert(static_cast(BlendFactor::OneMinusDstAlpha) == + WGPUBlendFactor_OneMinusDstAlpha, + "value mismatch for BlendFactor::OneMinusDstAlpha"); +static_assert(static_cast(BlendFactor::SrcAlphaSaturated) == + WGPUBlendFactor_SrcAlphaSaturated, + "value mismatch for BlendFactor::SrcAlphaSaturated"); +static_assert(static_cast(BlendFactor::Constant) == + WGPUBlendFactor_Constant, + "value mismatch for BlendFactor::Constant"); +static_assert(static_cast(BlendFactor::OneMinusConstant) == + WGPUBlendFactor_OneMinusConstant, + "value mismatch for BlendFactor::OneMinusConstant"); +static_assert(static_cast(BlendFactor::Src1) == WGPUBlendFactor_Src1, + "value mismatch for BlendFactor::Src1"); +static_assert(static_cast(BlendFactor::OneMinusSrc1) == + WGPUBlendFactor_OneMinusSrc1, + "value mismatch for BlendFactor::OneMinusSrc1"); +static_assert(static_cast(BlendFactor::Src1Alpha) == + WGPUBlendFactor_Src1Alpha, + "value mismatch for BlendFactor::Src1Alpha"); +static_assert(static_cast(BlendFactor::OneMinusSrc1Alpha) == + WGPUBlendFactor_OneMinusSrc1Alpha, + "value mismatch for BlendFactor::OneMinusSrc1Alpha"); + +// BlendOperation + +static_assert(sizeof(BlendOperation) == sizeof(WGPUBlendOperation), + "sizeof mismatch for BlendOperation"); +static_assert(alignof(BlendOperation) == alignof(WGPUBlendOperation), + "alignof mismatch for BlendOperation"); + +static_assert(static_cast(BlendOperation::Undefined) == + WGPUBlendOperation_Undefined, + "value mismatch for BlendOperation::Undefined"); +static_assert(static_cast(BlendOperation::Add) == + WGPUBlendOperation_Add, + "value mismatch for BlendOperation::Add"); +static_assert(static_cast(BlendOperation::Subtract) == + WGPUBlendOperation_Subtract, + "value mismatch for BlendOperation::Subtract"); +static_assert(static_cast(BlendOperation::ReverseSubtract) == + WGPUBlendOperation_ReverseSubtract, + "value mismatch for BlendOperation::ReverseSubtract"); +static_assert(static_cast(BlendOperation::Min) == + WGPUBlendOperation_Min, + "value mismatch for BlendOperation::Min"); +static_assert(static_cast(BlendOperation::Max) == + WGPUBlendOperation_Max, + "value mismatch for BlendOperation::Max"); + +// BufferBindingType + +static_assert(sizeof(BufferBindingType) == sizeof(WGPUBufferBindingType), + "sizeof mismatch for BufferBindingType"); +static_assert(alignof(BufferBindingType) == alignof(WGPUBufferBindingType), + "alignof mismatch for BufferBindingType"); + +static_assert(static_cast(BufferBindingType::Undefined) == + WGPUBufferBindingType_Undefined, + "value mismatch for BufferBindingType::Undefined"); +static_assert(static_cast(BufferBindingType::Uniform) == + WGPUBufferBindingType_Uniform, + "value mismatch for BufferBindingType::Uniform"); +static_assert(static_cast(BufferBindingType::Storage) == + WGPUBufferBindingType_Storage, + "value mismatch for BufferBindingType::Storage"); +static_assert(static_cast(BufferBindingType::ReadOnlyStorage) == + WGPUBufferBindingType_ReadOnlyStorage, + "value mismatch for BufferBindingType::ReadOnlyStorage"); + +// BufferMapAsyncStatus + +static_assert(sizeof(BufferMapAsyncStatus) == sizeof(WGPUBufferMapAsyncStatus), + "sizeof mismatch for BufferMapAsyncStatus"); +static_assert(alignof(BufferMapAsyncStatus) == + alignof(WGPUBufferMapAsyncStatus), + "alignof mismatch for BufferMapAsyncStatus"); + +static_assert(static_cast(BufferMapAsyncStatus::Success) == + WGPUBufferMapAsyncStatus_Success, + "value mismatch for BufferMapAsyncStatus::Success"); +static_assert(static_cast(BufferMapAsyncStatus::InstanceDropped) == + WGPUBufferMapAsyncStatus_InstanceDropped, + "value mismatch for BufferMapAsyncStatus::InstanceDropped"); +static_assert(static_cast(BufferMapAsyncStatus::ValidationError) == + WGPUBufferMapAsyncStatus_ValidationError, + "value mismatch for BufferMapAsyncStatus::ValidationError"); +static_assert(static_cast(BufferMapAsyncStatus::Unknown) == + WGPUBufferMapAsyncStatus_Unknown, + "value mismatch for BufferMapAsyncStatus::Unknown"); +static_assert(static_cast(BufferMapAsyncStatus::DeviceLost) == + WGPUBufferMapAsyncStatus_DeviceLost, + "value mismatch for BufferMapAsyncStatus::DeviceLost"); +static_assert( + static_cast(BufferMapAsyncStatus::DestroyedBeforeCallback) == + WGPUBufferMapAsyncStatus_DestroyedBeforeCallback, + "value mismatch for BufferMapAsyncStatus::DestroyedBeforeCallback"); +static_assert( + static_cast(BufferMapAsyncStatus::UnmappedBeforeCallback) == + WGPUBufferMapAsyncStatus_UnmappedBeforeCallback, + "value mismatch for BufferMapAsyncStatus::UnmappedBeforeCallback"); +static_assert( + static_cast(BufferMapAsyncStatus::MappingAlreadyPending) == + WGPUBufferMapAsyncStatus_MappingAlreadyPending, + "value mismatch for BufferMapAsyncStatus::MappingAlreadyPending"); +static_assert(static_cast(BufferMapAsyncStatus::OffsetOutOfRange) == + WGPUBufferMapAsyncStatus_OffsetOutOfRange, + "value mismatch for BufferMapAsyncStatus::OffsetOutOfRange"); +static_assert(static_cast(BufferMapAsyncStatus::SizeOutOfRange) == + WGPUBufferMapAsyncStatus_SizeOutOfRange, + "value mismatch for BufferMapAsyncStatus::SizeOutOfRange"); + +// BufferMapState + +static_assert(sizeof(BufferMapState) == sizeof(WGPUBufferMapState), + "sizeof mismatch for BufferMapState"); +static_assert(alignof(BufferMapState) == alignof(WGPUBufferMapState), + "alignof mismatch for BufferMapState"); + +static_assert(static_cast(BufferMapState::Unmapped) == + WGPUBufferMapState_Unmapped, + "value mismatch for BufferMapState::Unmapped"); +static_assert(static_cast(BufferMapState::Pending) == + WGPUBufferMapState_Pending, + "value mismatch for BufferMapState::Pending"); +static_assert(static_cast(BufferMapState::Mapped) == + WGPUBufferMapState_Mapped, + "value mismatch for BufferMapState::Mapped"); + +// CallbackMode + +static_assert(sizeof(CallbackMode) == sizeof(WGPUCallbackMode), + "sizeof mismatch for CallbackMode"); +static_assert(alignof(CallbackMode) == alignof(WGPUCallbackMode), + "alignof mismatch for CallbackMode"); + +static_assert(static_cast(CallbackMode::WaitAnyOnly) == + WGPUCallbackMode_WaitAnyOnly, + "value mismatch for CallbackMode::WaitAnyOnly"); +static_assert(static_cast(CallbackMode::AllowProcessEvents) == + WGPUCallbackMode_AllowProcessEvents, + "value mismatch for CallbackMode::AllowProcessEvents"); +static_assert(static_cast(CallbackMode::AllowSpontaneous) == + WGPUCallbackMode_AllowSpontaneous, + "value mismatch for CallbackMode::AllowSpontaneous"); + +// CompareFunction + +static_assert(sizeof(CompareFunction) == sizeof(WGPUCompareFunction), + "sizeof mismatch for CompareFunction"); +static_assert(alignof(CompareFunction) == alignof(WGPUCompareFunction), + "alignof mismatch for CompareFunction"); + +static_assert(static_cast(CompareFunction::Undefined) == + WGPUCompareFunction_Undefined, + "value mismatch for CompareFunction::Undefined"); +static_assert(static_cast(CompareFunction::Never) == + WGPUCompareFunction_Never, + "value mismatch for CompareFunction::Never"); +static_assert(static_cast(CompareFunction::Less) == + WGPUCompareFunction_Less, + "value mismatch for CompareFunction::Less"); +static_assert(static_cast(CompareFunction::Equal) == + WGPUCompareFunction_Equal, + "value mismatch for CompareFunction::Equal"); +static_assert(static_cast(CompareFunction::LessEqual) == + WGPUCompareFunction_LessEqual, + "value mismatch for CompareFunction::LessEqual"); +static_assert(static_cast(CompareFunction::Greater) == + WGPUCompareFunction_Greater, + "value mismatch for CompareFunction::Greater"); +static_assert(static_cast(CompareFunction::NotEqual) == + WGPUCompareFunction_NotEqual, + "value mismatch for CompareFunction::NotEqual"); +static_assert(static_cast(CompareFunction::GreaterEqual) == + WGPUCompareFunction_GreaterEqual, + "value mismatch for CompareFunction::GreaterEqual"); +static_assert(static_cast(CompareFunction::Always) == + WGPUCompareFunction_Always, + "value mismatch for CompareFunction::Always"); + +// CompilationInfoRequestStatus + +static_assert(sizeof(CompilationInfoRequestStatus) == + sizeof(WGPUCompilationInfoRequestStatus), + "sizeof mismatch for CompilationInfoRequestStatus"); +static_assert(alignof(CompilationInfoRequestStatus) == + alignof(WGPUCompilationInfoRequestStatus), + "alignof mismatch for CompilationInfoRequestStatus"); + +static_assert(static_cast(CompilationInfoRequestStatus::Success) == + WGPUCompilationInfoRequestStatus_Success, + "value mismatch for CompilationInfoRequestStatus::Success"); +static_assert( + static_cast(CompilationInfoRequestStatus::InstanceDropped) == + WGPUCompilationInfoRequestStatus_InstanceDropped, + "value mismatch for CompilationInfoRequestStatus::InstanceDropped"); +static_assert(static_cast(CompilationInfoRequestStatus::Error) == + WGPUCompilationInfoRequestStatus_Error, + "value mismatch for CompilationInfoRequestStatus::Error"); +static_assert(static_cast(CompilationInfoRequestStatus::DeviceLost) == + WGPUCompilationInfoRequestStatus_DeviceLost, + "value mismatch for CompilationInfoRequestStatus::DeviceLost"); +static_assert(static_cast(CompilationInfoRequestStatus::Unknown) == + WGPUCompilationInfoRequestStatus_Unknown, + "value mismatch for CompilationInfoRequestStatus::Unknown"); + +// CompilationMessageType + +static_assert(sizeof(CompilationMessageType) == + sizeof(WGPUCompilationMessageType), + "sizeof mismatch for CompilationMessageType"); +static_assert(alignof(CompilationMessageType) == + alignof(WGPUCompilationMessageType), + "alignof mismatch for CompilationMessageType"); + +static_assert(static_cast(CompilationMessageType::Error) == + WGPUCompilationMessageType_Error, + "value mismatch for CompilationMessageType::Error"); +static_assert(static_cast(CompilationMessageType::Warning) == + WGPUCompilationMessageType_Warning, + "value mismatch for CompilationMessageType::Warning"); +static_assert(static_cast(CompilationMessageType::Info) == + WGPUCompilationMessageType_Info, + "value mismatch for CompilationMessageType::Info"); + +// CreatePipelineAsyncStatus + +static_assert(sizeof(CreatePipelineAsyncStatus) == + sizeof(WGPUCreatePipelineAsyncStatus), + "sizeof mismatch for CreatePipelineAsyncStatus"); +static_assert(alignof(CreatePipelineAsyncStatus) == + alignof(WGPUCreatePipelineAsyncStatus), + "alignof mismatch for CreatePipelineAsyncStatus"); + +static_assert(static_cast(CreatePipelineAsyncStatus::Success) == + WGPUCreatePipelineAsyncStatus_Success, + "value mismatch for CreatePipelineAsyncStatus::Success"); +static_assert( + static_cast(CreatePipelineAsyncStatus::InstanceDropped) == + WGPUCreatePipelineAsyncStatus_InstanceDropped, + "value mismatch for CreatePipelineAsyncStatus::InstanceDropped"); +static_assert( + static_cast(CreatePipelineAsyncStatus::ValidationError) == + WGPUCreatePipelineAsyncStatus_ValidationError, + "value mismatch for CreatePipelineAsyncStatus::ValidationError"); +static_assert(static_cast(CreatePipelineAsyncStatus::InternalError) == + WGPUCreatePipelineAsyncStatus_InternalError, + "value mismatch for CreatePipelineAsyncStatus::InternalError"); +static_assert(static_cast(CreatePipelineAsyncStatus::DeviceLost) == + WGPUCreatePipelineAsyncStatus_DeviceLost, + "value mismatch for CreatePipelineAsyncStatus::DeviceLost"); +static_assert( + static_cast(CreatePipelineAsyncStatus::DeviceDestroyed) == + WGPUCreatePipelineAsyncStatus_DeviceDestroyed, + "value mismatch for CreatePipelineAsyncStatus::DeviceDestroyed"); +static_assert(static_cast(CreatePipelineAsyncStatus::Unknown) == + WGPUCreatePipelineAsyncStatus_Unknown, + "value mismatch for CreatePipelineAsyncStatus::Unknown"); + +// CullMode + +static_assert(sizeof(CullMode) == sizeof(WGPUCullMode), + "sizeof mismatch for CullMode"); +static_assert(alignof(CullMode) == alignof(WGPUCullMode), + "alignof mismatch for CullMode"); + +static_assert(static_cast(CullMode::Undefined) == + WGPUCullMode_Undefined, + "value mismatch for CullMode::Undefined"); +static_assert(static_cast(CullMode::None) == WGPUCullMode_None, + "value mismatch for CullMode::None"); +static_assert(static_cast(CullMode::Front) == WGPUCullMode_Front, + "value mismatch for CullMode::Front"); +static_assert(static_cast(CullMode::Back) == WGPUCullMode_Back, + "value mismatch for CullMode::Back"); + +// DeviceLostReason + +static_assert(sizeof(DeviceLostReason) == sizeof(WGPUDeviceLostReason), + "sizeof mismatch for DeviceLostReason"); +static_assert(alignof(DeviceLostReason) == alignof(WGPUDeviceLostReason), + "alignof mismatch for DeviceLostReason"); + +static_assert(static_cast(DeviceLostReason::Undefined) == + WGPUDeviceLostReason_Undefined, + "value mismatch for DeviceLostReason::Undefined"); +static_assert(static_cast(DeviceLostReason::Destroyed) == + WGPUDeviceLostReason_Destroyed, + "value mismatch for DeviceLostReason::Destroyed"); + +// ErrorFilter + +static_assert(sizeof(ErrorFilter) == sizeof(WGPUErrorFilter), + "sizeof mismatch for ErrorFilter"); +static_assert(alignof(ErrorFilter) == alignof(WGPUErrorFilter), + "alignof mismatch for ErrorFilter"); + +static_assert(static_cast(ErrorFilter::Validation) == + WGPUErrorFilter_Validation, + "value mismatch for ErrorFilter::Validation"); +static_assert(static_cast(ErrorFilter::OutOfMemory) == + WGPUErrorFilter_OutOfMemory, + "value mismatch for ErrorFilter::OutOfMemory"); +static_assert(static_cast(ErrorFilter::Internal) == + WGPUErrorFilter_Internal, + "value mismatch for ErrorFilter::Internal"); + +// ErrorType + +static_assert(sizeof(ErrorType) == sizeof(WGPUErrorType), + "sizeof mismatch for ErrorType"); +static_assert(alignof(ErrorType) == alignof(WGPUErrorType), + "alignof mismatch for ErrorType"); + +static_assert(static_cast(ErrorType::NoError) == + WGPUErrorType_NoError, + "value mismatch for ErrorType::NoError"); +static_assert(static_cast(ErrorType::Validation) == + WGPUErrorType_Validation, + "value mismatch for ErrorType::Validation"); +static_assert(static_cast(ErrorType::OutOfMemory) == + WGPUErrorType_OutOfMemory, + "value mismatch for ErrorType::OutOfMemory"); +static_assert(static_cast(ErrorType::Internal) == + WGPUErrorType_Internal, + "value mismatch for ErrorType::Internal"); +static_assert(static_cast(ErrorType::Unknown) == + WGPUErrorType_Unknown, + "value mismatch for ErrorType::Unknown"); +static_assert(static_cast(ErrorType::DeviceLost) == + WGPUErrorType_DeviceLost, + "value mismatch for ErrorType::DeviceLost"); + +// ExternalTextureRotation + +static_assert(sizeof(ExternalTextureRotation) == + sizeof(WGPUExternalTextureRotation), + "sizeof mismatch for ExternalTextureRotation"); +static_assert(alignof(ExternalTextureRotation) == + alignof(WGPUExternalTextureRotation), + "alignof mismatch for ExternalTextureRotation"); + +static_assert(static_cast(ExternalTextureRotation::Rotate0Degrees) == + WGPUExternalTextureRotation_Rotate0Degrees, + "value mismatch for ExternalTextureRotation::Rotate0Degrees"); +static_assert(static_cast(ExternalTextureRotation::Rotate90Degrees) == + WGPUExternalTextureRotation_Rotate90Degrees, + "value mismatch for ExternalTextureRotation::Rotate90Degrees"); +static_assert( + static_cast(ExternalTextureRotation::Rotate180Degrees) == + WGPUExternalTextureRotation_Rotate180Degrees, + "value mismatch for ExternalTextureRotation::Rotate180Degrees"); +static_assert( + static_cast(ExternalTextureRotation::Rotate270Degrees) == + WGPUExternalTextureRotation_Rotate270Degrees, + "value mismatch for ExternalTextureRotation::Rotate270Degrees"); + +// FeatureName + +static_assert(sizeof(FeatureName) == sizeof(WGPUFeatureName), + "sizeof mismatch for FeatureName"); +static_assert(alignof(FeatureName) == alignof(WGPUFeatureName), + "alignof mismatch for FeatureName"); + +static_assert(static_cast(FeatureName::Undefined) == + WGPUFeatureName_Undefined, + "value mismatch for FeatureName::Undefined"); +static_assert(static_cast(FeatureName::DepthClipControl) == + WGPUFeatureName_DepthClipControl, + "value mismatch for FeatureName::DepthClipControl"); +static_assert(static_cast(FeatureName::Depth32FloatStencil8) == + WGPUFeatureName_Depth32FloatStencil8, + "value mismatch for FeatureName::Depth32FloatStencil8"); +static_assert(static_cast(FeatureName::TimestampQuery) == + WGPUFeatureName_TimestampQuery, + "value mismatch for FeatureName::TimestampQuery"); +static_assert(static_cast(FeatureName::TextureCompressionBC) == + WGPUFeatureName_TextureCompressionBC, + "value mismatch for FeatureName::TextureCompressionBC"); +static_assert(static_cast(FeatureName::TextureCompressionETC2) == + WGPUFeatureName_TextureCompressionETC2, + "value mismatch for FeatureName::TextureCompressionETC2"); +static_assert(static_cast(FeatureName::TextureCompressionASTC) == + WGPUFeatureName_TextureCompressionASTC, + "value mismatch for FeatureName::TextureCompressionASTC"); +static_assert(static_cast(FeatureName::IndirectFirstInstance) == + WGPUFeatureName_IndirectFirstInstance, + "value mismatch for FeatureName::IndirectFirstInstance"); +static_assert(static_cast(FeatureName::ShaderF16) == + WGPUFeatureName_ShaderF16, + "value mismatch for FeatureName::ShaderF16"); +static_assert(static_cast(FeatureName::RG11B10UfloatRenderable) == + WGPUFeatureName_RG11B10UfloatRenderable, + "value mismatch for FeatureName::RG11B10UfloatRenderable"); +static_assert(static_cast(FeatureName::BGRA8UnormStorage) == + WGPUFeatureName_BGRA8UnormStorage, + "value mismatch for FeatureName::BGRA8UnormStorage"); +static_assert(static_cast(FeatureName::Float32Filterable) == + WGPUFeatureName_Float32Filterable, + "value mismatch for FeatureName::Float32Filterable"); +static_assert(static_cast(FeatureName::DawnInternalUsages) == + WGPUFeatureName_DawnInternalUsages, + "value mismatch for FeatureName::DawnInternalUsages"); +static_assert(static_cast(FeatureName::DawnMultiPlanarFormats) == + WGPUFeatureName_DawnMultiPlanarFormats, + "value mismatch for FeatureName::DawnMultiPlanarFormats"); +static_assert(static_cast(FeatureName::DawnNative) == + WGPUFeatureName_DawnNative, + "value mismatch for FeatureName::DawnNative"); +static_assert( + static_cast( + FeatureName::ChromiumExperimentalTimestampQueryInsidePasses) == + WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses, + "value mismatch for " + "FeatureName::ChromiumExperimentalTimestampQueryInsidePasses"); +static_assert( + static_cast(FeatureName::ImplicitDeviceSynchronization) == + WGPUFeatureName_ImplicitDeviceSynchronization, + "value mismatch for FeatureName::ImplicitDeviceSynchronization"); +static_assert(static_cast(FeatureName::SurfaceCapabilities) == + WGPUFeatureName_SurfaceCapabilities, + "value mismatch for FeatureName::SurfaceCapabilities"); +static_assert(static_cast(FeatureName::TransientAttachments) == + WGPUFeatureName_TransientAttachments, + "value mismatch for FeatureName::TransientAttachments"); +static_assert(static_cast(FeatureName::MSAARenderToSingleSampled) == + WGPUFeatureName_MSAARenderToSingleSampled, + "value mismatch for FeatureName::MSAARenderToSingleSampled"); +static_assert(static_cast(FeatureName::DualSourceBlending) == + WGPUFeatureName_DualSourceBlending, + "value mismatch for FeatureName::DualSourceBlending"); +static_assert(static_cast(FeatureName::D3D11MultithreadProtected) == + WGPUFeatureName_D3D11MultithreadProtected, + "value mismatch for FeatureName::D3D11MultithreadProtected"); +static_assert(static_cast(FeatureName::ANGLETextureSharing) == + WGPUFeatureName_ANGLETextureSharing, + "value mismatch for FeatureName::ANGLETextureSharing"); +static_assert( + static_cast(FeatureName::ChromiumExperimentalSubgroups) == + WGPUFeatureName_ChromiumExperimentalSubgroups, + "value mismatch for FeatureName::ChromiumExperimentalSubgroups"); +static_assert( + static_cast( + FeatureName::ChromiumExperimentalSubgroupUniformControlFlow) == + WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow, + "value mismatch for " + "FeatureName::ChromiumExperimentalSubgroupUniformControlFlow"); +static_assert(static_cast(FeatureName::PixelLocalStorageCoherent) == + WGPUFeatureName_PixelLocalStorageCoherent, + "value mismatch for FeatureName::PixelLocalStorageCoherent"); +static_assert( + static_cast(FeatureName::PixelLocalStorageNonCoherent) == + WGPUFeatureName_PixelLocalStorageNonCoherent, + "value mismatch for FeatureName::PixelLocalStorageNonCoherent"); +static_assert(static_cast(FeatureName::Unorm16TextureFormats) == + WGPUFeatureName_Unorm16TextureFormats, + "value mismatch for FeatureName::Unorm16TextureFormats"); +static_assert(static_cast(FeatureName::Snorm16TextureFormats) == + WGPUFeatureName_Snorm16TextureFormats, + "value mismatch for FeatureName::Snorm16TextureFormats"); +static_assert( + static_cast(FeatureName::MultiPlanarFormatExtendedUsages) == + WGPUFeatureName_MultiPlanarFormatExtendedUsages, + "value mismatch for FeatureName::MultiPlanarFormatExtendedUsages"); +static_assert(static_cast(FeatureName::MultiPlanarFormatP010) == + WGPUFeatureName_MultiPlanarFormatP010, + "value mismatch for FeatureName::MultiPlanarFormatP010"); +static_assert(static_cast(FeatureName::HostMappedPointer) == + WGPUFeatureName_HostMappedPointer, + "value mismatch for FeatureName::HostMappedPointer"); +static_assert(static_cast(FeatureName::MultiPlanarRenderTargets) == + WGPUFeatureName_MultiPlanarRenderTargets, + "value mismatch for FeatureName::MultiPlanarRenderTargets"); +static_assert(static_cast(FeatureName::MultiPlanarFormatNv12a) == + WGPUFeatureName_MultiPlanarFormatNv12a, + "value mismatch for FeatureName::MultiPlanarFormatNv12a"); +static_assert(static_cast(FeatureName::FramebufferFetch) == + WGPUFeatureName_FramebufferFetch, + "value mismatch for FeatureName::FramebufferFetch"); +static_assert(static_cast(FeatureName::BufferMapExtendedUsages) == + WGPUFeatureName_BufferMapExtendedUsages, + "value mismatch for FeatureName::BufferMapExtendedUsages"); +static_assert( + static_cast(FeatureName::AdapterPropertiesMemoryHeaps) == + WGPUFeatureName_AdapterPropertiesMemoryHeaps, + "value mismatch for FeatureName::AdapterPropertiesMemoryHeaps"); +static_assert(static_cast(FeatureName::AdapterPropertiesD3D) == + WGPUFeatureName_AdapterPropertiesD3D, + "value mismatch for FeatureName::AdapterPropertiesD3D"); +static_assert(static_cast(FeatureName::AdapterPropertiesVk) == + WGPUFeatureName_AdapterPropertiesVk, + "value mismatch for FeatureName::AdapterPropertiesVk"); +static_assert(static_cast(FeatureName::R8UnormStorage) == + WGPUFeatureName_R8UnormStorage, + "value mismatch for FeatureName::R8UnormStorage"); +static_assert(static_cast(FeatureName::FormatCapabilities) == + WGPUFeatureName_FormatCapabilities, + "value mismatch for FeatureName::FormatCapabilities"); +static_assert(static_cast(FeatureName::DrmFormatCapabilities) == + WGPUFeatureName_DrmFormatCapabilities, + "value mismatch for FeatureName::DrmFormatCapabilities"); +static_assert(static_cast(FeatureName::Norm16TextureFormats) == + WGPUFeatureName_Norm16TextureFormats, + "value mismatch for FeatureName::Norm16TextureFormats"); +static_assert( + static_cast( + FeatureName::SharedTextureMemoryVkDedicatedAllocation) == + WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation, + "value mismatch for FeatureName::SharedTextureMemoryVkDedicatedAllocation"); +static_assert( + static_cast(FeatureName::SharedTextureMemoryAHardwareBuffer) == + WGPUFeatureName_SharedTextureMemoryAHardwareBuffer, + "value mismatch for FeatureName::SharedTextureMemoryAHardwareBuffer"); +static_assert(static_cast(FeatureName::SharedTextureMemoryDmaBuf) == + WGPUFeatureName_SharedTextureMemoryDmaBuf, + "value mismatch for FeatureName::SharedTextureMemoryDmaBuf"); +static_assert(static_cast(FeatureName::SharedTextureMemoryOpaqueFD) == + WGPUFeatureName_SharedTextureMemoryOpaqueFD, + "value mismatch for FeatureName::SharedTextureMemoryOpaqueFD"); +static_assert( + static_cast(FeatureName::SharedTextureMemoryZirconHandle) == + WGPUFeatureName_SharedTextureMemoryZirconHandle, + "value mismatch for FeatureName::SharedTextureMemoryZirconHandle"); +static_assert( + static_cast(FeatureName::SharedTextureMemoryDXGISharedHandle) == + WGPUFeatureName_SharedTextureMemoryDXGISharedHandle, + "value mismatch for FeatureName::SharedTextureMemoryDXGISharedHandle"); +static_assert( + static_cast(FeatureName::SharedTextureMemoryD3D11Texture2D) == + WGPUFeatureName_SharedTextureMemoryD3D11Texture2D, + "value mismatch for FeatureName::SharedTextureMemoryD3D11Texture2D"); +static_assert( + static_cast(FeatureName::SharedTextureMemoryIOSurface) == + WGPUFeatureName_SharedTextureMemoryIOSurface, + "value mismatch for FeatureName::SharedTextureMemoryIOSurface"); +static_assert(static_cast(FeatureName::SharedTextureMemoryEGLImage) == + WGPUFeatureName_SharedTextureMemoryEGLImage, + "value mismatch for FeatureName::SharedTextureMemoryEGLImage"); +static_assert( + static_cast(FeatureName::SharedFenceVkSemaphoreOpaqueFD) == + WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD, + "value mismatch for FeatureName::SharedFenceVkSemaphoreOpaqueFD"); +static_assert( + static_cast(FeatureName::SharedFenceVkSemaphoreSyncFD) == + WGPUFeatureName_SharedFenceVkSemaphoreSyncFD, + "value mismatch for FeatureName::SharedFenceVkSemaphoreSyncFD"); +static_assert( + static_cast(FeatureName::SharedFenceVkSemaphoreZirconHandle) == + WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle, + "value mismatch for FeatureName::SharedFenceVkSemaphoreZirconHandle"); +static_assert(static_cast(FeatureName::SharedFenceDXGISharedHandle) == + WGPUFeatureName_SharedFenceDXGISharedHandle, + "value mismatch for FeatureName::SharedFenceDXGISharedHandle"); +static_assert(static_cast(FeatureName::SharedFenceMTLSharedEvent) == + WGPUFeatureName_SharedFenceMTLSharedEvent, + "value mismatch for FeatureName::SharedFenceMTLSharedEvent"); +static_assert( + static_cast(FeatureName::SharedBufferMemoryD3D12Resource) == + WGPUFeatureName_SharedBufferMemoryD3D12Resource, + "value mismatch for FeatureName::SharedBufferMemoryD3D12Resource"); +static_assert(static_cast(FeatureName::StaticSamplers) == + WGPUFeatureName_StaticSamplers, + "value mismatch for FeatureName::StaticSamplers"); + +// FilterMode + +static_assert(sizeof(FilterMode) == sizeof(WGPUFilterMode), + "sizeof mismatch for FilterMode"); +static_assert(alignof(FilterMode) == alignof(WGPUFilterMode), + "alignof mismatch for FilterMode"); + +static_assert(static_cast(FilterMode::Undefined) == + WGPUFilterMode_Undefined, + "value mismatch for FilterMode::Undefined"); +static_assert(static_cast(FilterMode::Nearest) == + WGPUFilterMode_Nearest, + "value mismatch for FilterMode::Nearest"); +static_assert(static_cast(FilterMode::Linear) == + WGPUFilterMode_Linear, + "value mismatch for FilterMode::Linear"); + +// FrontFace + +static_assert(sizeof(FrontFace) == sizeof(WGPUFrontFace), + "sizeof mismatch for FrontFace"); +static_assert(alignof(FrontFace) == alignof(WGPUFrontFace), + "alignof mismatch for FrontFace"); + +static_assert(static_cast(FrontFace::Undefined) == + WGPUFrontFace_Undefined, + "value mismatch for FrontFace::Undefined"); +static_assert(static_cast(FrontFace::CCW) == WGPUFrontFace_CCW, + "value mismatch for FrontFace::CCW"); +static_assert(static_cast(FrontFace::CW) == WGPUFrontFace_CW, + "value mismatch for FrontFace::CW"); + +// IndexFormat + +static_assert(sizeof(IndexFormat) == sizeof(WGPUIndexFormat), + "sizeof mismatch for IndexFormat"); +static_assert(alignof(IndexFormat) == alignof(WGPUIndexFormat), + "alignof mismatch for IndexFormat"); + +static_assert(static_cast(IndexFormat::Undefined) == + WGPUIndexFormat_Undefined, + "value mismatch for IndexFormat::Undefined"); +static_assert(static_cast(IndexFormat::Uint16) == + WGPUIndexFormat_Uint16, + "value mismatch for IndexFormat::Uint16"); +static_assert(static_cast(IndexFormat::Uint32) == + WGPUIndexFormat_Uint32, + "value mismatch for IndexFormat::Uint32"); + +// LoadOp + +static_assert(sizeof(LoadOp) == sizeof(WGPULoadOp), + "sizeof mismatch for LoadOp"); +static_assert(alignof(LoadOp) == alignof(WGPULoadOp), + "alignof mismatch for LoadOp"); + +static_assert(static_cast(LoadOp::Undefined) == WGPULoadOp_Undefined, + "value mismatch for LoadOp::Undefined"); +static_assert(static_cast(LoadOp::Clear) == WGPULoadOp_Clear, + "value mismatch for LoadOp::Clear"); +static_assert(static_cast(LoadOp::Load) == WGPULoadOp_Load, + "value mismatch for LoadOp::Load"); + +// LoggingType + +static_assert(sizeof(LoggingType) == sizeof(WGPULoggingType), + "sizeof mismatch for LoggingType"); +static_assert(alignof(LoggingType) == alignof(WGPULoggingType), + "alignof mismatch for LoggingType"); + +static_assert(static_cast(LoggingType::Verbose) == + WGPULoggingType_Verbose, + "value mismatch for LoggingType::Verbose"); +static_assert(static_cast(LoggingType::Info) == WGPULoggingType_Info, + "value mismatch for LoggingType::Info"); +static_assert(static_cast(LoggingType::Warning) == + WGPULoggingType_Warning, + "value mismatch for LoggingType::Warning"); +static_assert(static_cast(LoggingType::Error) == + WGPULoggingType_Error, + "value mismatch for LoggingType::Error"); + +// MipmapFilterMode + +static_assert(sizeof(MipmapFilterMode) == sizeof(WGPUMipmapFilterMode), + "sizeof mismatch for MipmapFilterMode"); +static_assert(alignof(MipmapFilterMode) == alignof(WGPUMipmapFilterMode), + "alignof mismatch for MipmapFilterMode"); + +static_assert(static_cast(MipmapFilterMode::Undefined) == + WGPUMipmapFilterMode_Undefined, + "value mismatch for MipmapFilterMode::Undefined"); +static_assert(static_cast(MipmapFilterMode::Nearest) == + WGPUMipmapFilterMode_Nearest, + "value mismatch for MipmapFilterMode::Nearest"); +static_assert(static_cast(MipmapFilterMode::Linear) == + WGPUMipmapFilterMode_Linear, + "value mismatch for MipmapFilterMode::Linear"); + +// PopErrorScopeStatus + +static_assert(sizeof(PopErrorScopeStatus) == sizeof(WGPUPopErrorScopeStatus), + "sizeof mismatch for PopErrorScopeStatus"); +static_assert(alignof(PopErrorScopeStatus) == alignof(WGPUPopErrorScopeStatus), + "alignof mismatch for PopErrorScopeStatus"); + +static_assert(static_cast(PopErrorScopeStatus::Success) == + WGPUPopErrorScopeStatus_Success, + "value mismatch for PopErrorScopeStatus::Success"); +static_assert(static_cast(PopErrorScopeStatus::InstanceDropped) == + WGPUPopErrorScopeStatus_InstanceDropped, + "value mismatch for PopErrorScopeStatus::InstanceDropped"); + +// PowerPreference + +static_assert(sizeof(PowerPreference) == sizeof(WGPUPowerPreference), + "sizeof mismatch for PowerPreference"); +static_assert(alignof(PowerPreference) == alignof(WGPUPowerPreference), + "alignof mismatch for PowerPreference"); + +static_assert(static_cast(PowerPreference::Undefined) == + WGPUPowerPreference_Undefined, + "value mismatch for PowerPreference::Undefined"); +static_assert(static_cast(PowerPreference::LowPower) == + WGPUPowerPreference_LowPower, + "value mismatch for PowerPreference::LowPower"); +static_assert(static_cast(PowerPreference::HighPerformance) == + WGPUPowerPreference_HighPerformance, + "value mismatch for PowerPreference::HighPerformance"); + +// PresentMode + +static_assert(sizeof(PresentMode) == sizeof(WGPUPresentMode), + "sizeof mismatch for PresentMode"); +static_assert(alignof(PresentMode) == alignof(WGPUPresentMode), + "alignof mismatch for PresentMode"); + +static_assert(static_cast(PresentMode::Fifo) == WGPUPresentMode_Fifo, + "value mismatch for PresentMode::Fifo"); +static_assert(static_cast(PresentMode::Immediate) == + WGPUPresentMode_Immediate, + "value mismatch for PresentMode::Immediate"); +static_assert(static_cast(PresentMode::Mailbox) == + WGPUPresentMode_Mailbox, + "value mismatch for PresentMode::Mailbox"); + +// PrimitiveTopology + +static_assert(sizeof(PrimitiveTopology) == sizeof(WGPUPrimitiveTopology), + "sizeof mismatch for PrimitiveTopology"); +static_assert(alignof(PrimitiveTopology) == alignof(WGPUPrimitiveTopology), + "alignof mismatch for PrimitiveTopology"); + +static_assert(static_cast(PrimitiveTopology::Undefined) == + WGPUPrimitiveTopology_Undefined, + "value mismatch for PrimitiveTopology::Undefined"); +static_assert(static_cast(PrimitiveTopology::PointList) == + WGPUPrimitiveTopology_PointList, + "value mismatch for PrimitiveTopology::PointList"); +static_assert(static_cast(PrimitiveTopology::LineList) == + WGPUPrimitiveTopology_LineList, + "value mismatch for PrimitiveTopology::LineList"); +static_assert(static_cast(PrimitiveTopology::LineStrip) == + WGPUPrimitiveTopology_LineStrip, + "value mismatch for PrimitiveTopology::LineStrip"); +static_assert(static_cast(PrimitiveTopology::TriangleList) == + WGPUPrimitiveTopology_TriangleList, + "value mismatch for PrimitiveTopology::TriangleList"); +static_assert(static_cast(PrimitiveTopology::TriangleStrip) == + WGPUPrimitiveTopology_TriangleStrip, + "value mismatch for PrimitiveTopology::TriangleStrip"); + +// QueryType + +static_assert(sizeof(QueryType) == sizeof(WGPUQueryType), + "sizeof mismatch for QueryType"); +static_assert(alignof(QueryType) == alignof(WGPUQueryType), + "alignof mismatch for QueryType"); + +static_assert(static_cast(QueryType::Occlusion) == + WGPUQueryType_Occlusion, + "value mismatch for QueryType::Occlusion"); +static_assert(static_cast(QueryType::Timestamp) == + WGPUQueryType_Timestamp, + "value mismatch for QueryType::Timestamp"); + +// QueueWorkDoneStatus + +static_assert(sizeof(QueueWorkDoneStatus) == sizeof(WGPUQueueWorkDoneStatus), + "sizeof mismatch for QueueWorkDoneStatus"); +static_assert(alignof(QueueWorkDoneStatus) == alignof(WGPUQueueWorkDoneStatus), + "alignof mismatch for QueueWorkDoneStatus"); + +static_assert(static_cast(QueueWorkDoneStatus::Success) == + WGPUQueueWorkDoneStatus_Success, + "value mismatch for QueueWorkDoneStatus::Success"); +static_assert(static_cast(QueueWorkDoneStatus::InstanceDropped) == + WGPUQueueWorkDoneStatus_InstanceDropped, + "value mismatch for QueueWorkDoneStatus::InstanceDropped"); +static_assert(static_cast(QueueWorkDoneStatus::Error) == + WGPUQueueWorkDoneStatus_Error, + "value mismatch for QueueWorkDoneStatus::Error"); +static_assert(static_cast(QueueWorkDoneStatus::Unknown) == + WGPUQueueWorkDoneStatus_Unknown, + "value mismatch for QueueWorkDoneStatus::Unknown"); +static_assert(static_cast(QueueWorkDoneStatus::DeviceLost) == + WGPUQueueWorkDoneStatus_DeviceLost, + "value mismatch for QueueWorkDoneStatus::DeviceLost"); + +// RequestAdapterStatus + +static_assert(sizeof(RequestAdapterStatus) == sizeof(WGPURequestAdapterStatus), + "sizeof mismatch for RequestAdapterStatus"); +static_assert(alignof(RequestAdapterStatus) == + alignof(WGPURequestAdapterStatus), + "alignof mismatch for RequestAdapterStatus"); + +static_assert(static_cast(RequestAdapterStatus::Success) == + WGPURequestAdapterStatus_Success, + "value mismatch for RequestAdapterStatus::Success"); +static_assert(static_cast(RequestAdapterStatus::InstanceDropped) == + WGPURequestAdapterStatus_InstanceDropped, + "value mismatch for RequestAdapterStatus::InstanceDropped"); +static_assert(static_cast(RequestAdapterStatus::Unavailable) == + WGPURequestAdapterStatus_Unavailable, + "value mismatch for RequestAdapterStatus::Unavailable"); +static_assert(static_cast(RequestAdapterStatus::Error) == + WGPURequestAdapterStatus_Error, + "value mismatch for RequestAdapterStatus::Error"); +static_assert(static_cast(RequestAdapterStatus::Unknown) == + WGPURequestAdapterStatus_Unknown, + "value mismatch for RequestAdapterStatus::Unknown"); + +// RequestDeviceStatus + +static_assert(sizeof(RequestDeviceStatus) == sizeof(WGPURequestDeviceStatus), + "sizeof mismatch for RequestDeviceStatus"); +static_assert(alignof(RequestDeviceStatus) == alignof(WGPURequestDeviceStatus), + "alignof mismatch for RequestDeviceStatus"); + +static_assert(static_cast(RequestDeviceStatus::Success) == + WGPURequestDeviceStatus_Success, + "value mismatch for RequestDeviceStatus::Success"); +static_assert(static_cast(RequestDeviceStatus::InstanceDropped) == + WGPURequestDeviceStatus_InstanceDropped, + "value mismatch for RequestDeviceStatus::InstanceDropped"); +static_assert(static_cast(RequestDeviceStatus::Error) == + WGPURequestDeviceStatus_Error, + "value mismatch for RequestDeviceStatus::Error"); +static_assert(static_cast(RequestDeviceStatus::Unknown) == + WGPURequestDeviceStatus_Unknown, + "value mismatch for RequestDeviceStatus::Unknown"); + +// SType + +static_assert(sizeof(SType) == sizeof(WGPUSType), "sizeof mismatch for SType"); +static_assert(alignof(SType) == alignof(WGPUSType), + "alignof mismatch for SType"); + +static_assert(static_cast(SType::Invalid) == WGPUSType_Invalid, + "value mismatch for SType::Invalid"); +static_assert(static_cast(SType::SurfaceDescriptorFromMetalLayer) == + WGPUSType_SurfaceDescriptorFromMetalLayer, + "value mismatch for SType::SurfaceDescriptorFromMetalLayer"); +static_assert(static_cast(SType::SurfaceDescriptorFromWindowsHWND) == + WGPUSType_SurfaceDescriptorFromWindowsHWND, + "value mismatch for SType::SurfaceDescriptorFromWindowsHWND"); +static_assert(static_cast(SType::SurfaceDescriptorFromXlibWindow) == + WGPUSType_SurfaceDescriptorFromXlibWindow, + "value mismatch for SType::SurfaceDescriptorFromXlibWindow"); +static_assert( + static_cast(SType::SurfaceDescriptorFromCanvasHTMLSelector) == + WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector, + "value mismatch for SType::SurfaceDescriptorFromCanvasHTMLSelector"); +static_assert(static_cast(SType::ShaderModuleSPIRVDescriptor) == + WGPUSType_ShaderModuleSPIRVDescriptor, + "value mismatch for SType::ShaderModuleSPIRVDescriptor"); +static_assert(static_cast(SType::ShaderModuleWGSLDescriptor) == + WGPUSType_ShaderModuleWGSLDescriptor, + "value mismatch for SType::ShaderModuleWGSLDescriptor"); +static_assert(static_cast(SType::PrimitiveDepthClipControl) == + WGPUSType_PrimitiveDepthClipControl, + "value mismatch for SType::PrimitiveDepthClipControl"); +static_assert( + static_cast(SType::SurfaceDescriptorFromWaylandSurface) == + WGPUSType_SurfaceDescriptorFromWaylandSurface, + "value mismatch for SType::SurfaceDescriptorFromWaylandSurface"); +static_assert( + static_cast(SType::SurfaceDescriptorFromAndroidNativeWindow) == + WGPUSType_SurfaceDescriptorFromAndroidNativeWindow, + "value mismatch for SType::SurfaceDescriptorFromAndroidNativeWindow"); +static_assert( + static_cast(SType::SurfaceDescriptorFromWindowsCoreWindow) == + WGPUSType_SurfaceDescriptorFromWindowsCoreWindow, + "value mismatch for SType::SurfaceDescriptorFromWindowsCoreWindow"); +static_assert(static_cast(SType::ExternalTextureBindingEntry) == + WGPUSType_ExternalTextureBindingEntry, + "value mismatch for SType::ExternalTextureBindingEntry"); +static_assert(static_cast(SType::ExternalTextureBindingLayout) == + WGPUSType_ExternalTextureBindingLayout, + "value mismatch for SType::ExternalTextureBindingLayout"); +static_assert( + static_cast(SType::SurfaceDescriptorFromWindowsSwapChainPanel) == + WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel, + "value mismatch for SType::SurfaceDescriptorFromWindowsSwapChainPanel"); +static_assert(static_cast(SType::RenderPassDescriptorMaxDrawCount) == + WGPUSType_RenderPassDescriptorMaxDrawCount, + "value mismatch for SType::RenderPassDescriptorMaxDrawCount"); +static_assert( + static_cast(SType::DepthStencilStateDepthWriteDefinedDawn) == + WGPUSType_DepthStencilStateDepthWriteDefinedDawn, + "value mismatch for SType::DepthStencilStateDepthWriteDefinedDawn"); +static_assert( + static_cast(SType::TextureBindingViewDimensionDescriptor) == + WGPUSType_TextureBindingViewDimensionDescriptor, + "value mismatch for SType::TextureBindingViewDimensionDescriptor"); +static_assert( + static_cast(SType::DawnTextureInternalUsageDescriptor) == + WGPUSType_DawnTextureInternalUsageDescriptor, + "value mismatch for SType::DawnTextureInternalUsageDescriptor"); +static_assert( + static_cast(SType::DawnEncoderInternalUsageDescriptor) == + WGPUSType_DawnEncoderInternalUsageDescriptor, + "value mismatch for SType::DawnEncoderInternalUsageDescriptor"); +static_assert(static_cast(SType::DawnInstanceDescriptor) == + WGPUSType_DawnInstanceDescriptor, + "value mismatch for SType::DawnInstanceDescriptor"); +static_assert(static_cast(SType::DawnCacheDeviceDescriptor) == + WGPUSType_DawnCacheDeviceDescriptor, + "value mismatch for SType::DawnCacheDeviceDescriptor"); +static_assert( + static_cast(SType::DawnAdapterPropertiesPowerPreference) == + WGPUSType_DawnAdapterPropertiesPowerPreference, + "value mismatch for SType::DawnAdapterPropertiesPowerPreference"); +static_assert( + static_cast(SType::DawnBufferDescriptorErrorInfoFromWireClient) == + WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient, + "value mismatch for SType::DawnBufferDescriptorErrorInfoFromWireClient"); +static_assert(static_cast(SType::DawnTogglesDescriptor) == + WGPUSType_DawnTogglesDescriptor, + "value mismatch for SType::DawnTogglesDescriptor"); +static_assert( + static_cast(SType::DawnShaderModuleSPIRVOptionsDescriptor) == + WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor, + "value mismatch for SType::DawnShaderModuleSPIRVOptionsDescriptor"); +static_assert(static_cast(SType::RequestAdapterOptionsLUID) == + WGPUSType_RequestAdapterOptionsLUID, + "value mismatch for SType::RequestAdapterOptionsLUID"); +static_assert(static_cast(SType::RequestAdapterOptionsGetGLProc) == + WGPUSType_RequestAdapterOptionsGetGLProc, + "value mismatch for SType::RequestAdapterOptionsGetGLProc"); +static_assert(static_cast(SType::RequestAdapterOptionsD3D11Device) == + WGPUSType_RequestAdapterOptionsD3D11Device, + "value mismatch for SType::RequestAdapterOptionsD3D11Device"); +static_assert( + static_cast(SType::DawnMultisampleStateRenderToSingleSampled) == + WGPUSType_DawnMultisampleStateRenderToSingleSampled, + "value mismatch for SType::DawnMultisampleStateRenderToSingleSampled"); +static_assert(static_cast( + SType::DawnRenderPassColorAttachmentRenderToSingleSampled) == + WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled, + "value mismatch for " + "SType::DawnRenderPassColorAttachmentRenderToSingleSampled"); +static_assert(static_cast(SType::RenderPassPixelLocalStorage) == + WGPUSType_RenderPassPixelLocalStorage, + "value mismatch for SType::RenderPassPixelLocalStorage"); +static_assert(static_cast(SType::PipelineLayoutPixelLocalStorage) == + WGPUSType_PipelineLayoutPixelLocalStorage, + "value mismatch for SType::PipelineLayoutPixelLocalStorage"); +static_assert(static_cast(SType::BufferHostMappedPointer) == + WGPUSType_BufferHostMappedPointer, + "value mismatch for SType::BufferHostMappedPointer"); +static_assert(static_cast(SType::DawnExperimentalSubgroupLimits) == + WGPUSType_DawnExperimentalSubgroupLimits, + "value mismatch for SType::DawnExperimentalSubgroupLimits"); +static_assert(static_cast(SType::AdapterPropertiesMemoryHeaps) == + WGPUSType_AdapterPropertiesMemoryHeaps, + "value mismatch for SType::AdapterPropertiesMemoryHeaps"); +static_assert(static_cast(SType::AdapterPropertiesD3D) == + WGPUSType_AdapterPropertiesD3D, + "value mismatch for SType::AdapterPropertiesD3D"); +static_assert(static_cast(SType::AdapterPropertiesVk) == + WGPUSType_AdapterPropertiesVk, + "value mismatch for SType::AdapterPropertiesVk"); +static_assert(static_cast(SType::DawnComputePipelineFullSubgroups) == + WGPUSType_DawnComputePipelineFullSubgroups, + "value mismatch for SType::DawnComputePipelineFullSubgroups"); +static_assert(static_cast(SType::DawnWireWGSLControl) == + WGPUSType_DawnWireWGSLControl, + "value mismatch for SType::DawnWireWGSLControl"); +static_assert(static_cast(SType::DawnWGSLBlocklist) == + WGPUSType_DawnWGSLBlocklist, + "value mismatch for SType::DawnWGSLBlocklist"); +static_assert(static_cast(SType::DrmFormatCapabilities) == + WGPUSType_DrmFormatCapabilities, + "value mismatch for SType::DrmFormatCapabilities"); +static_assert( + static_cast(SType::SharedTextureMemoryVkImageDescriptor) == + WGPUSType_SharedTextureMemoryVkImageDescriptor, + "value mismatch for SType::SharedTextureMemoryVkImageDescriptor"); +static_assert(static_cast( + SType::SharedTextureMemoryVkDedicatedAllocationDescriptor) == + WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor, + "value mismatch for " + "SType::SharedTextureMemoryVkDedicatedAllocationDescriptor"); +static_assert( + static_cast( + SType::SharedTextureMemoryAHardwareBufferDescriptor) == + WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor, + "value mismatch for SType::SharedTextureMemoryAHardwareBufferDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryDmaBufDescriptor) == + WGPUSType_SharedTextureMemoryDmaBufDescriptor, + "value mismatch for SType::SharedTextureMemoryDmaBufDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryOpaqueFDDescriptor) == + WGPUSType_SharedTextureMemoryOpaqueFDDescriptor, + "value mismatch for SType::SharedTextureMemoryOpaqueFDDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryZirconHandleDescriptor) == + WGPUSType_SharedTextureMemoryZirconHandleDescriptor, + "value mismatch for SType::SharedTextureMemoryZirconHandleDescriptor"); +static_assert( + static_cast( + SType::SharedTextureMemoryDXGISharedHandleDescriptor) == + WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor, + "value mismatch for SType::SharedTextureMemoryDXGISharedHandleDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryD3D11Texture2DDescriptor) == + WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor, + "value mismatch for SType::SharedTextureMemoryD3D11Texture2DDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryIOSurfaceDescriptor) == + WGPUSType_SharedTextureMemoryIOSurfaceDescriptor, + "value mismatch for SType::SharedTextureMemoryIOSurfaceDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryEGLImageDescriptor) == + WGPUSType_SharedTextureMemoryEGLImageDescriptor, + "value mismatch for SType::SharedTextureMemoryEGLImageDescriptor"); +static_assert( + static_cast(SType::SharedTextureMemoryInitializedBeginState) == + WGPUSType_SharedTextureMemoryInitializedBeginState, + "value mismatch for SType::SharedTextureMemoryInitializedBeginState"); +static_assert( + static_cast(SType::SharedTextureMemoryInitializedEndState) == + WGPUSType_SharedTextureMemoryInitializedEndState, + "value mismatch for SType::SharedTextureMemoryInitializedEndState"); +static_assert( + static_cast(SType::SharedTextureMemoryVkImageLayoutBeginState) == + WGPUSType_SharedTextureMemoryVkImageLayoutBeginState, + "value mismatch for SType::SharedTextureMemoryVkImageLayoutBeginState"); +static_assert( + static_cast(SType::SharedTextureMemoryVkImageLayoutEndState) == + WGPUSType_SharedTextureMemoryVkImageLayoutEndState, + "value mismatch for SType::SharedTextureMemoryVkImageLayoutEndState"); +static_assert( + static_cast(SType::SharedFenceVkSemaphoreOpaqueFDDescriptor) == + WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor, + "value mismatch for SType::SharedFenceVkSemaphoreOpaqueFDDescriptor"); +static_assert( + static_cast(SType::SharedFenceVkSemaphoreOpaqueFDExportInfo) == + WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo, + "value mismatch for SType::SharedFenceVkSemaphoreOpaqueFDExportInfo"); +static_assert( + static_cast(SType::SharedFenceVkSemaphoreSyncFDDescriptor) == + WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor, + "value mismatch for SType::SharedFenceVkSemaphoreSyncFDDescriptor"); +static_assert( + static_cast(SType::SharedFenceVkSemaphoreSyncFDExportInfo) == + WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo, + "value mismatch for SType::SharedFenceVkSemaphoreSyncFDExportInfo"); +static_assert( + static_cast( + SType::SharedFenceVkSemaphoreZirconHandleDescriptor) == + WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor, + "value mismatch for SType::SharedFenceVkSemaphoreZirconHandleDescriptor"); +static_assert( + static_cast( + SType::SharedFenceVkSemaphoreZirconHandleExportInfo) == + WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo, + "value mismatch for SType::SharedFenceVkSemaphoreZirconHandleExportInfo"); +static_assert( + static_cast(SType::SharedFenceDXGISharedHandleDescriptor) == + WGPUSType_SharedFenceDXGISharedHandleDescriptor, + "value mismatch for SType::SharedFenceDXGISharedHandleDescriptor"); +static_assert( + static_cast(SType::SharedFenceDXGISharedHandleExportInfo) == + WGPUSType_SharedFenceDXGISharedHandleExportInfo, + "value mismatch for SType::SharedFenceDXGISharedHandleExportInfo"); +static_assert( + static_cast(SType::SharedFenceMTLSharedEventDescriptor) == + WGPUSType_SharedFenceMTLSharedEventDescriptor, + "value mismatch for SType::SharedFenceMTLSharedEventDescriptor"); +static_assert( + static_cast(SType::SharedFenceMTLSharedEventExportInfo) == + WGPUSType_SharedFenceMTLSharedEventExportInfo, + "value mismatch for SType::SharedFenceMTLSharedEventExportInfo"); +static_assert( + static_cast(SType::SharedBufferMemoryD3D12ResourceDescriptor) == + WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor, + "value mismatch for SType::SharedBufferMemoryD3D12ResourceDescriptor"); +static_assert(static_cast(SType::StaticSamplerBindingLayout) == + WGPUSType_StaticSamplerBindingLayout, + "value mismatch for SType::StaticSamplerBindingLayout"); + +// SamplerBindingType + +static_assert(sizeof(SamplerBindingType) == sizeof(WGPUSamplerBindingType), + "sizeof mismatch for SamplerBindingType"); +static_assert(alignof(SamplerBindingType) == alignof(WGPUSamplerBindingType), + "alignof mismatch for SamplerBindingType"); + +static_assert(static_cast(SamplerBindingType::Undefined) == + WGPUSamplerBindingType_Undefined, + "value mismatch for SamplerBindingType::Undefined"); +static_assert(static_cast(SamplerBindingType::Filtering) == + WGPUSamplerBindingType_Filtering, + "value mismatch for SamplerBindingType::Filtering"); +static_assert(static_cast(SamplerBindingType::NonFiltering) == + WGPUSamplerBindingType_NonFiltering, + "value mismatch for SamplerBindingType::NonFiltering"); +static_assert(static_cast(SamplerBindingType::Comparison) == + WGPUSamplerBindingType_Comparison, + "value mismatch for SamplerBindingType::Comparison"); + +// SharedFenceType + +static_assert(sizeof(SharedFenceType) == sizeof(WGPUSharedFenceType), + "sizeof mismatch for SharedFenceType"); +static_assert(alignof(SharedFenceType) == alignof(WGPUSharedFenceType), + "alignof mismatch for SharedFenceType"); + +static_assert(static_cast(SharedFenceType::Undefined) == + WGPUSharedFenceType_Undefined, + "value mismatch for SharedFenceType::Undefined"); +static_assert(static_cast(SharedFenceType::VkSemaphoreOpaqueFD) == + WGPUSharedFenceType_VkSemaphoreOpaqueFD, + "value mismatch for SharedFenceType::VkSemaphoreOpaqueFD"); +static_assert(static_cast(SharedFenceType::VkSemaphoreSyncFD) == + WGPUSharedFenceType_VkSemaphoreSyncFD, + "value mismatch for SharedFenceType::VkSemaphoreSyncFD"); +static_assert(static_cast(SharedFenceType::VkSemaphoreZirconHandle) == + WGPUSharedFenceType_VkSemaphoreZirconHandle, + "value mismatch for SharedFenceType::VkSemaphoreZirconHandle"); +static_assert(static_cast(SharedFenceType::DXGISharedHandle) == + WGPUSharedFenceType_DXGISharedHandle, + "value mismatch for SharedFenceType::DXGISharedHandle"); +static_assert(static_cast(SharedFenceType::MTLSharedEvent) == + WGPUSharedFenceType_MTLSharedEvent, + "value mismatch for SharedFenceType::MTLSharedEvent"); + +// StencilOperation + +static_assert(sizeof(StencilOperation) == sizeof(WGPUStencilOperation), + "sizeof mismatch for StencilOperation"); +static_assert(alignof(StencilOperation) == alignof(WGPUStencilOperation), + "alignof mismatch for StencilOperation"); + +static_assert(static_cast(StencilOperation::Undefined) == + WGPUStencilOperation_Undefined, + "value mismatch for StencilOperation::Undefined"); +static_assert(static_cast(StencilOperation::Keep) == + WGPUStencilOperation_Keep, + "value mismatch for StencilOperation::Keep"); +static_assert(static_cast(StencilOperation::Zero) == + WGPUStencilOperation_Zero, + "value mismatch for StencilOperation::Zero"); +static_assert(static_cast(StencilOperation::Replace) == + WGPUStencilOperation_Replace, + "value mismatch for StencilOperation::Replace"); +static_assert(static_cast(StencilOperation::Invert) == + WGPUStencilOperation_Invert, + "value mismatch for StencilOperation::Invert"); +static_assert(static_cast(StencilOperation::IncrementClamp) == + WGPUStencilOperation_IncrementClamp, + "value mismatch for StencilOperation::IncrementClamp"); +static_assert(static_cast(StencilOperation::DecrementClamp) == + WGPUStencilOperation_DecrementClamp, + "value mismatch for StencilOperation::DecrementClamp"); +static_assert(static_cast(StencilOperation::IncrementWrap) == + WGPUStencilOperation_IncrementWrap, + "value mismatch for StencilOperation::IncrementWrap"); +static_assert(static_cast(StencilOperation::DecrementWrap) == + WGPUStencilOperation_DecrementWrap, + "value mismatch for StencilOperation::DecrementWrap"); + +// StorageTextureAccess + +static_assert(sizeof(StorageTextureAccess) == sizeof(WGPUStorageTextureAccess), + "sizeof mismatch for StorageTextureAccess"); +static_assert(alignof(StorageTextureAccess) == + alignof(WGPUStorageTextureAccess), + "alignof mismatch for StorageTextureAccess"); + +static_assert(static_cast(StorageTextureAccess::Undefined) == + WGPUStorageTextureAccess_Undefined, + "value mismatch for StorageTextureAccess::Undefined"); +static_assert(static_cast(StorageTextureAccess::WriteOnly) == + WGPUStorageTextureAccess_WriteOnly, + "value mismatch for StorageTextureAccess::WriteOnly"); +static_assert(static_cast(StorageTextureAccess::ReadOnly) == + WGPUStorageTextureAccess_ReadOnly, + "value mismatch for StorageTextureAccess::ReadOnly"); +static_assert(static_cast(StorageTextureAccess::ReadWrite) == + WGPUStorageTextureAccess_ReadWrite, + "value mismatch for StorageTextureAccess::ReadWrite"); + +// StoreOp + +static_assert(sizeof(StoreOp) == sizeof(WGPUStoreOp), + "sizeof mismatch for StoreOp"); +static_assert(alignof(StoreOp) == alignof(WGPUStoreOp), + "alignof mismatch for StoreOp"); + +static_assert(static_cast(StoreOp::Undefined) == + WGPUStoreOp_Undefined, + "value mismatch for StoreOp::Undefined"); +static_assert(static_cast(StoreOp::Store) == WGPUStoreOp_Store, + "value mismatch for StoreOp::Store"); +static_assert(static_cast(StoreOp::Discard) == WGPUStoreOp_Discard, + "value mismatch for StoreOp::Discard"); + +// TextureAspect + +static_assert(sizeof(TextureAspect) == sizeof(WGPUTextureAspect), + "sizeof mismatch for TextureAspect"); +static_assert(alignof(TextureAspect) == alignof(WGPUTextureAspect), + "alignof mismatch for TextureAspect"); + +static_assert(static_cast(TextureAspect::Undefined) == + WGPUTextureAspect_Undefined, + "value mismatch for TextureAspect::Undefined"); +static_assert(static_cast(TextureAspect::All) == + WGPUTextureAspect_All, + "value mismatch for TextureAspect::All"); +static_assert(static_cast(TextureAspect::StencilOnly) == + WGPUTextureAspect_StencilOnly, + "value mismatch for TextureAspect::StencilOnly"); +static_assert(static_cast(TextureAspect::DepthOnly) == + WGPUTextureAspect_DepthOnly, + "value mismatch for TextureAspect::DepthOnly"); +static_assert(static_cast(TextureAspect::Plane0Only) == + WGPUTextureAspect_Plane0Only, + "value mismatch for TextureAspect::Plane0Only"); +static_assert(static_cast(TextureAspect::Plane1Only) == + WGPUTextureAspect_Plane1Only, + "value mismatch for TextureAspect::Plane1Only"); +static_assert(static_cast(TextureAspect::Plane2Only) == + WGPUTextureAspect_Plane2Only, + "value mismatch for TextureAspect::Plane2Only"); + +// TextureDimension + +static_assert(sizeof(TextureDimension) == sizeof(WGPUTextureDimension), + "sizeof mismatch for TextureDimension"); +static_assert(alignof(TextureDimension) == alignof(WGPUTextureDimension), + "alignof mismatch for TextureDimension"); + +static_assert(static_cast(TextureDimension::Undefined) == + WGPUTextureDimension_Undefined, + "value mismatch for TextureDimension::Undefined"); +static_assert(static_cast(TextureDimension::e1D) == + WGPUTextureDimension_1D, + "value mismatch for TextureDimension::e1D"); +static_assert(static_cast(TextureDimension::e2D) == + WGPUTextureDimension_2D, + "value mismatch for TextureDimension::e2D"); +static_assert(static_cast(TextureDimension::e3D) == + WGPUTextureDimension_3D, + "value mismatch for TextureDimension::e3D"); + +// TextureFormat + +static_assert(sizeof(TextureFormat) == sizeof(WGPUTextureFormat), + "sizeof mismatch for TextureFormat"); +static_assert(alignof(TextureFormat) == alignof(WGPUTextureFormat), + "alignof mismatch for TextureFormat"); + +static_assert(static_cast(TextureFormat::Undefined) == + WGPUTextureFormat_Undefined, + "value mismatch for TextureFormat::Undefined"); +static_assert(static_cast(TextureFormat::R8Unorm) == + WGPUTextureFormat_R8Unorm, + "value mismatch for TextureFormat::R8Unorm"); +static_assert(static_cast(TextureFormat::R8Snorm) == + WGPUTextureFormat_R8Snorm, + "value mismatch for TextureFormat::R8Snorm"); +static_assert(static_cast(TextureFormat::R8Uint) == + WGPUTextureFormat_R8Uint, + "value mismatch for TextureFormat::R8Uint"); +static_assert(static_cast(TextureFormat::R8Sint) == + WGPUTextureFormat_R8Sint, + "value mismatch for TextureFormat::R8Sint"); +static_assert(static_cast(TextureFormat::R16Uint) == + WGPUTextureFormat_R16Uint, + "value mismatch for TextureFormat::R16Uint"); +static_assert(static_cast(TextureFormat::R16Sint) == + WGPUTextureFormat_R16Sint, + "value mismatch for TextureFormat::R16Sint"); +static_assert(static_cast(TextureFormat::R16Float) == + WGPUTextureFormat_R16Float, + "value mismatch for TextureFormat::R16Float"); +static_assert(static_cast(TextureFormat::RG8Unorm) == + WGPUTextureFormat_RG8Unorm, + "value mismatch for TextureFormat::RG8Unorm"); +static_assert(static_cast(TextureFormat::RG8Snorm) == + WGPUTextureFormat_RG8Snorm, + "value mismatch for TextureFormat::RG8Snorm"); +static_assert(static_cast(TextureFormat::RG8Uint) == + WGPUTextureFormat_RG8Uint, + "value mismatch for TextureFormat::RG8Uint"); +static_assert(static_cast(TextureFormat::RG8Sint) == + WGPUTextureFormat_RG8Sint, + "value mismatch for TextureFormat::RG8Sint"); +static_assert(static_cast(TextureFormat::R32Float) == + WGPUTextureFormat_R32Float, + "value mismatch for TextureFormat::R32Float"); +static_assert(static_cast(TextureFormat::R32Uint) == + WGPUTextureFormat_R32Uint, + "value mismatch for TextureFormat::R32Uint"); +static_assert(static_cast(TextureFormat::R32Sint) == + WGPUTextureFormat_R32Sint, + "value mismatch for TextureFormat::R32Sint"); +static_assert(static_cast(TextureFormat::RG16Uint) == + WGPUTextureFormat_RG16Uint, + "value mismatch for TextureFormat::RG16Uint"); +static_assert(static_cast(TextureFormat::RG16Sint) == + WGPUTextureFormat_RG16Sint, + "value mismatch for TextureFormat::RG16Sint"); +static_assert(static_cast(TextureFormat::RG16Float) == + WGPUTextureFormat_RG16Float, + "value mismatch for TextureFormat::RG16Float"); +static_assert(static_cast(TextureFormat::RGBA8Unorm) == + WGPUTextureFormat_RGBA8Unorm, + "value mismatch for TextureFormat::RGBA8Unorm"); +static_assert(static_cast(TextureFormat::RGBA8UnormSrgb) == + WGPUTextureFormat_RGBA8UnormSrgb, + "value mismatch for TextureFormat::RGBA8UnormSrgb"); +static_assert(static_cast(TextureFormat::RGBA8Snorm) == + WGPUTextureFormat_RGBA8Snorm, + "value mismatch for TextureFormat::RGBA8Snorm"); +static_assert(static_cast(TextureFormat::RGBA8Uint) == + WGPUTextureFormat_RGBA8Uint, + "value mismatch for TextureFormat::RGBA8Uint"); +static_assert(static_cast(TextureFormat::RGBA8Sint) == + WGPUTextureFormat_RGBA8Sint, + "value mismatch for TextureFormat::RGBA8Sint"); +static_assert(static_cast(TextureFormat::BGRA8Unorm) == + WGPUTextureFormat_BGRA8Unorm, + "value mismatch for TextureFormat::BGRA8Unorm"); +static_assert(static_cast(TextureFormat::BGRA8UnormSrgb) == + WGPUTextureFormat_BGRA8UnormSrgb, + "value mismatch for TextureFormat::BGRA8UnormSrgb"); +static_assert(static_cast(TextureFormat::RGB10A2Uint) == + WGPUTextureFormat_RGB10A2Uint, + "value mismatch for TextureFormat::RGB10A2Uint"); +static_assert(static_cast(TextureFormat::RGB10A2Unorm) == + WGPUTextureFormat_RGB10A2Unorm, + "value mismatch for TextureFormat::RGB10A2Unorm"); +static_assert(static_cast(TextureFormat::RG11B10Ufloat) == + WGPUTextureFormat_RG11B10Ufloat, + "value mismatch for TextureFormat::RG11B10Ufloat"); +static_assert(static_cast(TextureFormat::RGB9E5Ufloat) == + WGPUTextureFormat_RGB9E5Ufloat, + "value mismatch for TextureFormat::RGB9E5Ufloat"); +static_assert(static_cast(TextureFormat::RG32Float) == + WGPUTextureFormat_RG32Float, + "value mismatch for TextureFormat::RG32Float"); +static_assert(static_cast(TextureFormat::RG32Uint) == + WGPUTextureFormat_RG32Uint, + "value mismatch for TextureFormat::RG32Uint"); +static_assert(static_cast(TextureFormat::RG32Sint) == + WGPUTextureFormat_RG32Sint, + "value mismatch for TextureFormat::RG32Sint"); +static_assert(static_cast(TextureFormat::RGBA16Uint) == + WGPUTextureFormat_RGBA16Uint, + "value mismatch for TextureFormat::RGBA16Uint"); +static_assert(static_cast(TextureFormat::RGBA16Sint) == + WGPUTextureFormat_RGBA16Sint, + "value mismatch for TextureFormat::RGBA16Sint"); +static_assert(static_cast(TextureFormat::RGBA16Float) == + WGPUTextureFormat_RGBA16Float, + "value mismatch for TextureFormat::RGBA16Float"); +static_assert(static_cast(TextureFormat::RGBA32Float) == + WGPUTextureFormat_RGBA32Float, + "value mismatch for TextureFormat::RGBA32Float"); +static_assert(static_cast(TextureFormat::RGBA32Uint) == + WGPUTextureFormat_RGBA32Uint, + "value mismatch for TextureFormat::RGBA32Uint"); +static_assert(static_cast(TextureFormat::RGBA32Sint) == + WGPUTextureFormat_RGBA32Sint, + "value mismatch for TextureFormat::RGBA32Sint"); +static_assert(static_cast(TextureFormat::Stencil8) == + WGPUTextureFormat_Stencil8, + "value mismatch for TextureFormat::Stencil8"); +static_assert(static_cast(TextureFormat::Depth16Unorm) == + WGPUTextureFormat_Depth16Unorm, + "value mismatch for TextureFormat::Depth16Unorm"); +static_assert(static_cast(TextureFormat::Depth24Plus) == + WGPUTextureFormat_Depth24Plus, + "value mismatch for TextureFormat::Depth24Plus"); +static_assert(static_cast(TextureFormat::Depth24PlusStencil8) == + WGPUTextureFormat_Depth24PlusStencil8, + "value mismatch for TextureFormat::Depth24PlusStencil8"); +static_assert(static_cast(TextureFormat::Depth32Float) == + WGPUTextureFormat_Depth32Float, + "value mismatch for TextureFormat::Depth32Float"); +static_assert(static_cast(TextureFormat::Depth32FloatStencil8) == + WGPUTextureFormat_Depth32FloatStencil8, + "value mismatch for TextureFormat::Depth32FloatStencil8"); +static_assert(static_cast(TextureFormat::BC1RGBAUnorm) == + WGPUTextureFormat_BC1RGBAUnorm, + "value mismatch for TextureFormat::BC1RGBAUnorm"); +static_assert(static_cast(TextureFormat::BC1RGBAUnormSrgb) == + WGPUTextureFormat_BC1RGBAUnormSrgb, + "value mismatch for TextureFormat::BC1RGBAUnormSrgb"); +static_assert(static_cast(TextureFormat::BC2RGBAUnorm) == + WGPUTextureFormat_BC2RGBAUnorm, + "value mismatch for TextureFormat::BC2RGBAUnorm"); +static_assert(static_cast(TextureFormat::BC2RGBAUnormSrgb) == + WGPUTextureFormat_BC2RGBAUnormSrgb, + "value mismatch for TextureFormat::BC2RGBAUnormSrgb"); +static_assert(static_cast(TextureFormat::BC3RGBAUnorm) == + WGPUTextureFormat_BC3RGBAUnorm, + "value mismatch for TextureFormat::BC3RGBAUnorm"); +static_assert(static_cast(TextureFormat::BC3RGBAUnormSrgb) == + WGPUTextureFormat_BC3RGBAUnormSrgb, + "value mismatch for TextureFormat::BC3RGBAUnormSrgb"); +static_assert(static_cast(TextureFormat::BC4RUnorm) == + WGPUTextureFormat_BC4RUnorm, + "value mismatch for TextureFormat::BC4RUnorm"); +static_assert(static_cast(TextureFormat::BC4RSnorm) == + WGPUTextureFormat_BC4RSnorm, + "value mismatch for TextureFormat::BC4RSnorm"); +static_assert(static_cast(TextureFormat::BC5RGUnorm) == + WGPUTextureFormat_BC5RGUnorm, + "value mismatch for TextureFormat::BC5RGUnorm"); +static_assert(static_cast(TextureFormat::BC5RGSnorm) == + WGPUTextureFormat_BC5RGSnorm, + "value mismatch for TextureFormat::BC5RGSnorm"); +static_assert(static_cast(TextureFormat::BC6HRGBUfloat) == + WGPUTextureFormat_BC6HRGBUfloat, + "value mismatch for TextureFormat::BC6HRGBUfloat"); +static_assert(static_cast(TextureFormat::BC6HRGBFloat) == + WGPUTextureFormat_BC6HRGBFloat, + "value mismatch for TextureFormat::BC6HRGBFloat"); +static_assert(static_cast(TextureFormat::BC7RGBAUnorm) == + WGPUTextureFormat_BC7RGBAUnorm, + "value mismatch for TextureFormat::BC7RGBAUnorm"); +static_assert(static_cast(TextureFormat::BC7RGBAUnormSrgb) == + WGPUTextureFormat_BC7RGBAUnormSrgb, + "value mismatch for TextureFormat::BC7RGBAUnormSrgb"); +static_assert(static_cast(TextureFormat::ETC2RGB8Unorm) == + WGPUTextureFormat_ETC2RGB8Unorm, + "value mismatch for TextureFormat::ETC2RGB8Unorm"); +static_assert(static_cast(TextureFormat::ETC2RGB8UnormSrgb) == + WGPUTextureFormat_ETC2RGB8UnormSrgb, + "value mismatch for TextureFormat::ETC2RGB8UnormSrgb"); +static_assert(static_cast(TextureFormat::ETC2RGB8A1Unorm) == + WGPUTextureFormat_ETC2RGB8A1Unorm, + "value mismatch for TextureFormat::ETC2RGB8A1Unorm"); +static_assert(static_cast(TextureFormat::ETC2RGB8A1UnormSrgb) == + WGPUTextureFormat_ETC2RGB8A1UnormSrgb, + "value mismatch for TextureFormat::ETC2RGB8A1UnormSrgb"); +static_assert(static_cast(TextureFormat::ETC2RGBA8Unorm) == + WGPUTextureFormat_ETC2RGBA8Unorm, + "value mismatch for TextureFormat::ETC2RGBA8Unorm"); +static_assert(static_cast(TextureFormat::ETC2RGBA8UnormSrgb) == + WGPUTextureFormat_ETC2RGBA8UnormSrgb, + "value mismatch for TextureFormat::ETC2RGBA8UnormSrgb"); +static_assert(static_cast(TextureFormat::EACR11Unorm) == + WGPUTextureFormat_EACR11Unorm, + "value mismatch for TextureFormat::EACR11Unorm"); +static_assert(static_cast(TextureFormat::EACR11Snorm) == + WGPUTextureFormat_EACR11Snorm, + "value mismatch for TextureFormat::EACR11Snorm"); +static_assert(static_cast(TextureFormat::EACRG11Unorm) == + WGPUTextureFormat_EACRG11Unorm, + "value mismatch for TextureFormat::EACRG11Unorm"); +static_assert(static_cast(TextureFormat::EACRG11Snorm) == + WGPUTextureFormat_EACRG11Snorm, + "value mismatch for TextureFormat::EACRG11Snorm"); +static_assert(static_cast(TextureFormat::ASTC4x4Unorm) == + WGPUTextureFormat_ASTC4x4Unorm, + "value mismatch for TextureFormat::ASTC4x4Unorm"); +static_assert(static_cast(TextureFormat::ASTC4x4UnormSrgb) == + WGPUTextureFormat_ASTC4x4UnormSrgb, + "value mismatch for TextureFormat::ASTC4x4UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC5x4Unorm) == + WGPUTextureFormat_ASTC5x4Unorm, + "value mismatch for TextureFormat::ASTC5x4Unorm"); +static_assert(static_cast(TextureFormat::ASTC5x4UnormSrgb) == + WGPUTextureFormat_ASTC5x4UnormSrgb, + "value mismatch for TextureFormat::ASTC5x4UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC5x5Unorm) == + WGPUTextureFormat_ASTC5x5Unorm, + "value mismatch for TextureFormat::ASTC5x5Unorm"); +static_assert(static_cast(TextureFormat::ASTC5x5UnormSrgb) == + WGPUTextureFormat_ASTC5x5UnormSrgb, + "value mismatch for TextureFormat::ASTC5x5UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC6x5Unorm) == + WGPUTextureFormat_ASTC6x5Unorm, + "value mismatch for TextureFormat::ASTC6x5Unorm"); +static_assert(static_cast(TextureFormat::ASTC6x5UnormSrgb) == + WGPUTextureFormat_ASTC6x5UnormSrgb, + "value mismatch for TextureFormat::ASTC6x5UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC6x6Unorm) == + WGPUTextureFormat_ASTC6x6Unorm, + "value mismatch for TextureFormat::ASTC6x6Unorm"); +static_assert(static_cast(TextureFormat::ASTC6x6UnormSrgb) == + WGPUTextureFormat_ASTC6x6UnormSrgb, + "value mismatch for TextureFormat::ASTC6x6UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC8x5Unorm) == + WGPUTextureFormat_ASTC8x5Unorm, + "value mismatch for TextureFormat::ASTC8x5Unorm"); +static_assert(static_cast(TextureFormat::ASTC8x5UnormSrgb) == + WGPUTextureFormat_ASTC8x5UnormSrgb, + "value mismatch for TextureFormat::ASTC8x5UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC8x6Unorm) == + WGPUTextureFormat_ASTC8x6Unorm, + "value mismatch for TextureFormat::ASTC8x6Unorm"); +static_assert(static_cast(TextureFormat::ASTC8x6UnormSrgb) == + WGPUTextureFormat_ASTC8x6UnormSrgb, + "value mismatch for TextureFormat::ASTC8x6UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC8x8Unorm) == + WGPUTextureFormat_ASTC8x8Unorm, + "value mismatch for TextureFormat::ASTC8x8Unorm"); +static_assert(static_cast(TextureFormat::ASTC8x8UnormSrgb) == + WGPUTextureFormat_ASTC8x8UnormSrgb, + "value mismatch for TextureFormat::ASTC8x8UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC10x5Unorm) == + WGPUTextureFormat_ASTC10x5Unorm, + "value mismatch for TextureFormat::ASTC10x5Unorm"); +static_assert(static_cast(TextureFormat::ASTC10x5UnormSrgb) == + WGPUTextureFormat_ASTC10x5UnormSrgb, + "value mismatch for TextureFormat::ASTC10x5UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC10x6Unorm) == + WGPUTextureFormat_ASTC10x6Unorm, + "value mismatch for TextureFormat::ASTC10x6Unorm"); +static_assert(static_cast(TextureFormat::ASTC10x6UnormSrgb) == + WGPUTextureFormat_ASTC10x6UnormSrgb, + "value mismatch for TextureFormat::ASTC10x6UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC10x8Unorm) == + WGPUTextureFormat_ASTC10x8Unorm, + "value mismatch for TextureFormat::ASTC10x8Unorm"); +static_assert(static_cast(TextureFormat::ASTC10x8UnormSrgb) == + WGPUTextureFormat_ASTC10x8UnormSrgb, + "value mismatch for TextureFormat::ASTC10x8UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC10x10Unorm) == + WGPUTextureFormat_ASTC10x10Unorm, + "value mismatch for TextureFormat::ASTC10x10Unorm"); +static_assert(static_cast(TextureFormat::ASTC10x10UnormSrgb) == + WGPUTextureFormat_ASTC10x10UnormSrgb, + "value mismatch for TextureFormat::ASTC10x10UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC12x10Unorm) == + WGPUTextureFormat_ASTC12x10Unorm, + "value mismatch for TextureFormat::ASTC12x10Unorm"); +static_assert(static_cast(TextureFormat::ASTC12x10UnormSrgb) == + WGPUTextureFormat_ASTC12x10UnormSrgb, + "value mismatch for TextureFormat::ASTC12x10UnormSrgb"); +static_assert(static_cast(TextureFormat::ASTC12x12Unorm) == + WGPUTextureFormat_ASTC12x12Unorm, + "value mismatch for TextureFormat::ASTC12x12Unorm"); +static_assert(static_cast(TextureFormat::ASTC12x12UnormSrgb) == + WGPUTextureFormat_ASTC12x12UnormSrgb, + "value mismatch for TextureFormat::ASTC12x12UnormSrgb"); +static_assert(static_cast(TextureFormat::R16Unorm) == + WGPUTextureFormat_R16Unorm, + "value mismatch for TextureFormat::R16Unorm"); +static_assert(static_cast(TextureFormat::RG16Unorm) == + WGPUTextureFormat_RG16Unorm, + "value mismatch for TextureFormat::RG16Unorm"); +static_assert(static_cast(TextureFormat::RGBA16Unorm) == + WGPUTextureFormat_RGBA16Unorm, + "value mismatch for TextureFormat::RGBA16Unorm"); +static_assert(static_cast(TextureFormat::R16Snorm) == + WGPUTextureFormat_R16Snorm, + "value mismatch for TextureFormat::R16Snorm"); +static_assert(static_cast(TextureFormat::RG16Snorm) == + WGPUTextureFormat_RG16Snorm, + "value mismatch for TextureFormat::RG16Snorm"); +static_assert(static_cast(TextureFormat::RGBA16Snorm) == + WGPUTextureFormat_RGBA16Snorm, + "value mismatch for TextureFormat::RGBA16Snorm"); +static_assert(static_cast(TextureFormat::R8BG8Biplanar420Unorm) == + WGPUTextureFormat_R8BG8Biplanar420Unorm, + "value mismatch for TextureFormat::R8BG8Biplanar420Unorm"); +static_assert( + static_cast(TextureFormat::R10X6BG10X6Biplanar420Unorm) == + WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm, + "value mismatch for TextureFormat::R10X6BG10X6Biplanar420Unorm"); +static_assert(static_cast(TextureFormat::R8BG8A8Triplanar420Unorm) == + WGPUTextureFormat_R8BG8A8Triplanar420Unorm, + "value mismatch for TextureFormat::R8BG8A8Triplanar420Unorm"); + +// TextureSampleType + +static_assert(sizeof(TextureSampleType) == sizeof(WGPUTextureSampleType), + "sizeof mismatch for TextureSampleType"); +static_assert(alignof(TextureSampleType) == alignof(WGPUTextureSampleType), + "alignof mismatch for TextureSampleType"); + +static_assert(static_cast(TextureSampleType::Undefined) == + WGPUTextureSampleType_Undefined, + "value mismatch for TextureSampleType::Undefined"); +static_assert(static_cast(TextureSampleType::Float) == + WGPUTextureSampleType_Float, + "value mismatch for TextureSampleType::Float"); +static_assert(static_cast(TextureSampleType::UnfilterableFloat) == + WGPUTextureSampleType_UnfilterableFloat, + "value mismatch for TextureSampleType::UnfilterableFloat"); +static_assert(static_cast(TextureSampleType::Depth) == + WGPUTextureSampleType_Depth, + "value mismatch for TextureSampleType::Depth"); +static_assert(static_cast(TextureSampleType::Sint) == + WGPUTextureSampleType_Sint, + "value mismatch for TextureSampleType::Sint"); +static_assert(static_cast(TextureSampleType::Uint) == + WGPUTextureSampleType_Uint, + "value mismatch for TextureSampleType::Uint"); + +// TextureViewDimension + +static_assert(sizeof(TextureViewDimension) == sizeof(WGPUTextureViewDimension), + "sizeof mismatch for TextureViewDimension"); +static_assert(alignof(TextureViewDimension) == + alignof(WGPUTextureViewDimension), + "alignof mismatch for TextureViewDimension"); + +static_assert(static_cast(TextureViewDimension::Undefined) == + WGPUTextureViewDimension_Undefined, + "value mismatch for TextureViewDimension::Undefined"); +static_assert(static_cast(TextureViewDimension::e1D) == + WGPUTextureViewDimension_1D, + "value mismatch for TextureViewDimension::e1D"); +static_assert(static_cast(TextureViewDimension::e2D) == + WGPUTextureViewDimension_2D, + "value mismatch for TextureViewDimension::e2D"); +static_assert(static_cast(TextureViewDimension::e2DArray) == + WGPUTextureViewDimension_2DArray, + "value mismatch for TextureViewDimension::e2DArray"); +static_assert(static_cast(TextureViewDimension::Cube) == + WGPUTextureViewDimension_Cube, + "value mismatch for TextureViewDimension::Cube"); +static_assert(static_cast(TextureViewDimension::CubeArray) == + WGPUTextureViewDimension_CubeArray, + "value mismatch for TextureViewDimension::CubeArray"); +static_assert(static_cast(TextureViewDimension::e3D) == + WGPUTextureViewDimension_3D, + "value mismatch for TextureViewDimension::e3D"); + +// VertexFormat + +static_assert(sizeof(VertexFormat) == sizeof(WGPUVertexFormat), + "sizeof mismatch for VertexFormat"); +static_assert(alignof(VertexFormat) == alignof(WGPUVertexFormat), + "alignof mismatch for VertexFormat"); + +static_assert(static_cast(VertexFormat::Undefined) == + WGPUVertexFormat_Undefined, + "value mismatch for VertexFormat::Undefined"); +static_assert(static_cast(VertexFormat::Uint8x2) == + WGPUVertexFormat_Uint8x2, + "value mismatch for VertexFormat::Uint8x2"); +static_assert(static_cast(VertexFormat::Uint8x4) == + WGPUVertexFormat_Uint8x4, + "value mismatch for VertexFormat::Uint8x4"); +static_assert(static_cast(VertexFormat::Sint8x2) == + WGPUVertexFormat_Sint8x2, + "value mismatch for VertexFormat::Sint8x2"); +static_assert(static_cast(VertexFormat::Sint8x4) == + WGPUVertexFormat_Sint8x4, + "value mismatch for VertexFormat::Sint8x4"); +static_assert(static_cast(VertexFormat::Unorm8x2) == + WGPUVertexFormat_Unorm8x2, + "value mismatch for VertexFormat::Unorm8x2"); +static_assert(static_cast(VertexFormat::Unorm8x4) == + WGPUVertexFormat_Unorm8x4, + "value mismatch for VertexFormat::Unorm8x4"); +static_assert(static_cast(VertexFormat::Snorm8x2) == + WGPUVertexFormat_Snorm8x2, + "value mismatch for VertexFormat::Snorm8x2"); +static_assert(static_cast(VertexFormat::Snorm8x4) == + WGPUVertexFormat_Snorm8x4, + "value mismatch for VertexFormat::Snorm8x4"); +static_assert(static_cast(VertexFormat::Uint16x2) == + WGPUVertexFormat_Uint16x2, + "value mismatch for VertexFormat::Uint16x2"); +static_assert(static_cast(VertexFormat::Uint16x4) == + WGPUVertexFormat_Uint16x4, + "value mismatch for VertexFormat::Uint16x4"); +static_assert(static_cast(VertexFormat::Sint16x2) == + WGPUVertexFormat_Sint16x2, + "value mismatch for VertexFormat::Sint16x2"); +static_assert(static_cast(VertexFormat::Sint16x4) == + WGPUVertexFormat_Sint16x4, + "value mismatch for VertexFormat::Sint16x4"); +static_assert(static_cast(VertexFormat::Unorm16x2) == + WGPUVertexFormat_Unorm16x2, + "value mismatch for VertexFormat::Unorm16x2"); +static_assert(static_cast(VertexFormat::Unorm16x4) == + WGPUVertexFormat_Unorm16x4, + "value mismatch for VertexFormat::Unorm16x4"); +static_assert(static_cast(VertexFormat::Snorm16x2) == + WGPUVertexFormat_Snorm16x2, + "value mismatch for VertexFormat::Snorm16x2"); +static_assert(static_cast(VertexFormat::Snorm16x4) == + WGPUVertexFormat_Snorm16x4, + "value mismatch for VertexFormat::Snorm16x4"); +static_assert(static_cast(VertexFormat::Float16x2) == + WGPUVertexFormat_Float16x2, + "value mismatch for VertexFormat::Float16x2"); +static_assert(static_cast(VertexFormat::Float16x4) == + WGPUVertexFormat_Float16x4, + "value mismatch for VertexFormat::Float16x4"); +static_assert(static_cast(VertexFormat::Float32) == + WGPUVertexFormat_Float32, + "value mismatch for VertexFormat::Float32"); +static_assert(static_cast(VertexFormat::Float32x2) == + WGPUVertexFormat_Float32x2, + "value mismatch for VertexFormat::Float32x2"); +static_assert(static_cast(VertexFormat::Float32x3) == + WGPUVertexFormat_Float32x3, + "value mismatch for VertexFormat::Float32x3"); +static_assert(static_cast(VertexFormat::Float32x4) == + WGPUVertexFormat_Float32x4, + "value mismatch for VertexFormat::Float32x4"); +static_assert(static_cast(VertexFormat::Uint32) == + WGPUVertexFormat_Uint32, + "value mismatch for VertexFormat::Uint32"); +static_assert(static_cast(VertexFormat::Uint32x2) == + WGPUVertexFormat_Uint32x2, + "value mismatch for VertexFormat::Uint32x2"); +static_assert(static_cast(VertexFormat::Uint32x3) == + WGPUVertexFormat_Uint32x3, + "value mismatch for VertexFormat::Uint32x3"); +static_assert(static_cast(VertexFormat::Uint32x4) == + WGPUVertexFormat_Uint32x4, + "value mismatch for VertexFormat::Uint32x4"); +static_assert(static_cast(VertexFormat::Sint32) == + WGPUVertexFormat_Sint32, + "value mismatch for VertexFormat::Sint32"); +static_assert(static_cast(VertexFormat::Sint32x2) == + WGPUVertexFormat_Sint32x2, + "value mismatch for VertexFormat::Sint32x2"); +static_assert(static_cast(VertexFormat::Sint32x3) == + WGPUVertexFormat_Sint32x3, + "value mismatch for VertexFormat::Sint32x3"); +static_assert(static_cast(VertexFormat::Sint32x4) == + WGPUVertexFormat_Sint32x4, + "value mismatch for VertexFormat::Sint32x4"); +static_assert(static_cast(VertexFormat::Unorm10_10_10_2) == + WGPUVertexFormat_Unorm10_10_10_2, + "value mismatch for VertexFormat::Unorm10_10_10_2"); + +// VertexStepMode + +static_assert(sizeof(VertexStepMode) == sizeof(WGPUVertexStepMode), + "sizeof mismatch for VertexStepMode"); +static_assert(alignof(VertexStepMode) == alignof(WGPUVertexStepMode), + "alignof mismatch for VertexStepMode"); + +static_assert(static_cast(VertexStepMode::Undefined) == + WGPUVertexStepMode_Undefined, + "value mismatch for VertexStepMode::Undefined"); +static_assert(static_cast(VertexStepMode::VertexBufferNotUsed) == + WGPUVertexStepMode_VertexBufferNotUsed, + "value mismatch for VertexStepMode::VertexBufferNotUsed"); +static_assert(static_cast(VertexStepMode::Vertex) == + WGPUVertexStepMode_Vertex, + "value mismatch for VertexStepMode::Vertex"); +static_assert(static_cast(VertexStepMode::Instance) == + WGPUVertexStepMode_Instance, + "value mismatch for VertexStepMode::Instance"); + +// WaitStatus + +static_assert(sizeof(WaitStatus) == sizeof(WGPUWaitStatus), + "sizeof mismatch for WaitStatus"); +static_assert(alignof(WaitStatus) == alignof(WGPUWaitStatus), + "alignof mismatch for WaitStatus"); + +static_assert(static_cast(WaitStatus::Success) == + WGPUWaitStatus_Success, + "value mismatch for WaitStatus::Success"); +static_assert(static_cast(WaitStatus::TimedOut) == + WGPUWaitStatus_TimedOut, + "value mismatch for WaitStatus::TimedOut"); +static_assert(static_cast(WaitStatus::UnsupportedTimeout) == + WGPUWaitStatus_UnsupportedTimeout, + "value mismatch for WaitStatus::UnsupportedTimeout"); +static_assert(static_cast(WaitStatus::UnsupportedCount) == + WGPUWaitStatus_UnsupportedCount, + "value mismatch for WaitStatus::UnsupportedCount"); +static_assert(static_cast(WaitStatus::UnsupportedMixedSources) == + WGPUWaitStatus_UnsupportedMixedSources, + "value mismatch for WaitStatus::UnsupportedMixedSources"); +static_assert(static_cast(WaitStatus::Unknown) == + WGPUWaitStatus_Unknown, + "value mismatch for WaitStatus::Unknown"); + +// BufferUsage + +static_assert(sizeof(BufferUsage) == sizeof(WGPUBufferUsageFlags), + "sizeof mismatch for BufferUsage"); +static_assert(alignof(BufferUsage) == alignof(WGPUBufferUsageFlags), + "alignof mismatch for BufferUsage"); + +static_assert(static_cast(BufferUsage::None) == WGPUBufferUsage_None, + "value mismatch for BufferUsage::None"); +static_assert(static_cast(BufferUsage::MapRead) == + WGPUBufferUsage_MapRead, + "value mismatch for BufferUsage::MapRead"); +static_assert(static_cast(BufferUsage::MapWrite) == + WGPUBufferUsage_MapWrite, + "value mismatch for BufferUsage::MapWrite"); +static_assert(static_cast(BufferUsage::CopySrc) == + WGPUBufferUsage_CopySrc, + "value mismatch for BufferUsage::CopySrc"); +static_assert(static_cast(BufferUsage::CopyDst) == + WGPUBufferUsage_CopyDst, + "value mismatch for BufferUsage::CopyDst"); +static_assert(static_cast(BufferUsage::Index) == + WGPUBufferUsage_Index, + "value mismatch for BufferUsage::Index"); +static_assert(static_cast(BufferUsage::Vertex) == + WGPUBufferUsage_Vertex, + "value mismatch for BufferUsage::Vertex"); +static_assert(static_cast(BufferUsage::Uniform) == + WGPUBufferUsage_Uniform, + "value mismatch for BufferUsage::Uniform"); +static_assert(static_cast(BufferUsage::Storage) == + WGPUBufferUsage_Storage, + "value mismatch for BufferUsage::Storage"); +static_assert(static_cast(BufferUsage::Indirect) == + WGPUBufferUsage_Indirect, + "value mismatch for BufferUsage::Indirect"); +static_assert(static_cast(BufferUsage::QueryResolve) == + WGPUBufferUsage_QueryResolve, + "value mismatch for BufferUsage::QueryResolve"); + +// ColorWriteMask + +static_assert(sizeof(ColorWriteMask) == sizeof(WGPUColorWriteMaskFlags), + "sizeof mismatch for ColorWriteMask"); +static_assert(alignof(ColorWriteMask) == alignof(WGPUColorWriteMaskFlags), + "alignof mismatch for ColorWriteMask"); + +static_assert(static_cast(ColorWriteMask::None) == + WGPUColorWriteMask_None, + "value mismatch for ColorWriteMask::None"); +static_assert(static_cast(ColorWriteMask::Red) == + WGPUColorWriteMask_Red, + "value mismatch for ColorWriteMask::Red"); +static_assert(static_cast(ColorWriteMask::Green) == + WGPUColorWriteMask_Green, + "value mismatch for ColorWriteMask::Green"); +static_assert(static_cast(ColorWriteMask::Blue) == + WGPUColorWriteMask_Blue, + "value mismatch for ColorWriteMask::Blue"); +static_assert(static_cast(ColorWriteMask::Alpha) == + WGPUColorWriteMask_Alpha, + "value mismatch for ColorWriteMask::Alpha"); +static_assert(static_cast(ColorWriteMask::All) == + WGPUColorWriteMask_All, + "value mismatch for ColorWriteMask::All"); + +// HeapProperty + +static_assert(sizeof(HeapProperty) == sizeof(WGPUHeapPropertyFlags), + "sizeof mismatch for HeapProperty"); +static_assert(alignof(HeapProperty) == alignof(WGPUHeapPropertyFlags), + "alignof mismatch for HeapProperty"); + +static_assert(static_cast(HeapProperty::Undefined) == + WGPUHeapProperty_Undefined, + "value mismatch for HeapProperty::Undefined"); +static_assert(static_cast(HeapProperty::DeviceLocal) == + WGPUHeapProperty_DeviceLocal, + "value mismatch for HeapProperty::DeviceLocal"); +static_assert(static_cast(HeapProperty::HostVisible) == + WGPUHeapProperty_HostVisible, + "value mismatch for HeapProperty::HostVisible"); +static_assert(static_cast(HeapProperty::HostCoherent) == + WGPUHeapProperty_HostCoherent, + "value mismatch for HeapProperty::HostCoherent"); +static_assert(static_cast(HeapProperty::HostUncached) == + WGPUHeapProperty_HostUncached, + "value mismatch for HeapProperty::HostUncached"); +static_assert(static_cast(HeapProperty::HostCached) == + WGPUHeapProperty_HostCached, + "value mismatch for HeapProperty::HostCached"); + +// MapMode + +static_assert(sizeof(MapMode) == sizeof(WGPUMapModeFlags), + "sizeof mismatch for MapMode"); +static_assert(alignof(MapMode) == alignof(WGPUMapModeFlags), + "alignof mismatch for MapMode"); + +static_assert(static_cast(MapMode::None) == WGPUMapMode_None, + "value mismatch for MapMode::None"); +static_assert(static_cast(MapMode::Read) == WGPUMapMode_Read, + "value mismatch for MapMode::Read"); +static_assert(static_cast(MapMode::Write) == WGPUMapMode_Write, + "value mismatch for MapMode::Write"); + +// ShaderStage + +static_assert(sizeof(ShaderStage) == sizeof(WGPUShaderStageFlags), + "sizeof mismatch for ShaderStage"); +static_assert(alignof(ShaderStage) == alignof(WGPUShaderStageFlags), + "alignof mismatch for ShaderStage"); + +static_assert(static_cast(ShaderStage::None) == WGPUShaderStage_None, + "value mismatch for ShaderStage::None"); +static_assert(static_cast(ShaderStage::Vertex) == + WGPUShaderStage_Vertex, + "value mismatch for ShaderStage::Vertex"); +static_assert(static_cast(ShaderStage::Fragment) == + WGPUShaderStage_Fragment, + "value mismatch for ShaderStage::Fragment"); +static_assert(static_cast(ShaderStage::Compute) == + WGPUShaderStage_Compute, + "value mismatch for ShaderStage::Compute"); + +// TextureUsage + +static_assert(sizeof(TextureUsage) == sizeof(WGPUTextureUsageFlags), + "sizeof mismatch for TextureUsage"); +static_assert(alignof(TextureUsage) == alignof(WGPUTextureUsageFlags), + "alignof mismatch for TextureUsage"); + +static_assert(static_cast(TextureUsage::None) == + WGPUTextureUsage_None, + "value mismatch for TextureUsage::None"); +static_assert(static_cast(TextureUsage::CopySrc) == + WGPUTextureUsage_CopySrc, + "value mismatch for TextureUsage::CopySrc"); +static_assert(static_cast(TextureUsage::CopyDst) == + WGPUTextureUsage_CopyDst, + "value mismatch for TextureUsage::CopyDst"); +static_assert(static_cast(TextureUsage::TextureBinding) == + WGPUTextureUsage_TextureBinding, + "value mismatch for TextureUsage::TextureBinding"); +static_assert(static_cast(TextureUsage::StorageBinding) == + WGPUTextureUsage_StorageBinding, + "value mismatch for TextureUsage::StorageBinding"); +static_assert(static_cast(TextureUsage::RenderAttachment) == + WGPUTextureUsage_RenderAttachment, + "value mismatch for TextureUsage::RenderAttachment"); +static_assert(static_cast(TextureUsage::TransientAttachment) == + WGPUTextureUsage_TransientAttachment, + "value mismatch for TextureUsage::TransientAttachment"); +static_assert(static_cast(TextureUsage::StorageAttachment) == + WGPUTextureUsage_StorageAttachment, + "value mismatch for TextureUsage::StorageAttachment"); + +// ChainedStruct + +static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct), + "sizeof mismatch for ChainedStruct"); +static_assert(alignof(ChainedStruct) == alignof(WGPUChainedStruct), + "alignof mismatch for ChainedStruct"); +static_assert(offsetof(ChainedStruct, nextInChain) == + offsetof(WGPUChainedStruct, next), + "offsetof mismatch for ChainedStruct::nextInChain"); +static_assert(offsetof(ChainedStruct, sType) == + offsetof(WGPUChainedStruct, sType), + "offsetof mismatch for ChainedStruct::sType"); + +// AdapterProperties + +static_assert(sizeof(AdapterProperties) == sizeof(WGPUAdapterProperties), + "sizeof mismatch for AdapterProperties"); +static_assert(alignof(AdapterProperties) == alignof(WGPUAdapterProperties), + "alignof mismatch for AdapterProperties"); + +static_assert(offsetof(AdapterProperties, nextInChain) == + offsetof(WGPUAdapterProperties, nextInChain), + "offsetof mismatch for AdapterProperties::nextInChain"); +static_assert(offsetof(AdapterProperties, vendorID) == + offsetof(WGPUAdapterProperties, vendorID), + "offsetof mismatch for AdapterProperties::vendorID"); +static_assert(offsetof(AdapterProperties, vendorName) == + offsetof(WGPUAdapterProperties, vendorName), + "offsetof mismatch for AdapterProperties::vendorName"); +static_assert(offsetof(AdapterProperties, architecture) == + offsetof(WGPUAdapterProperties, architecture), + "offsetof mismatch for AdapterProperties::architecture"); +static_assert(offsetof(AdapterProperties, deviceID) == + offsetof(WGPUAdapterProperties, deviceID), + "offsetof mismatch for AdapterProperties::deviceID"); +static_assert(offsetof(AdapterProperties, name) == + offsetof(WGPUAdapterProperties, name), + "offsetof mismatch for AdapterProperties::name"); +static_assert(offsetof(AdapterProperties, driverDescription) == + offsetof(WGPUAdapterProperties, driverDescription), + "offsetof mismatch for AdapterProperties::driverDescription"); +static_assert(offsetof(AdapterProperties, adapterType) == + offsetof(WGPUAdapterProperties, adapterType), + "offsetof mismatch for AdapterProperties::adapterType"); +static_assert(offsetof(AdapterProperties, backendType) == + offsetof(WGPUAdapterProperties, backendType), + "offsetof mismatch for AdapterProperties::backendType"); +static_assert(offsetof(AdapterProperties, compatibilityMode) == + offsetof(WGPUAdapterProperties, compatibilityMode), + "offsetof mismatch for AdapterProperties::compatibilityMode"); + +// AdapterPropertiesD3D + +static_assert(sizeof(AdapterPropertiesD3D) == sizeof(WGPUAdapterPropertiesD3D), + "sizeof mismatch for AdapterPropertiesD3D"); +static_assert(alignof(AdapterPropertiesD3D) == + alignof(WGPUAdapterPropertiesD3D), + "alignof mismatch for AdapterPropertiesD3D"); + +static_assert(offsetof(AdapterPropertiesD3D, shaderModel) == + offsetof(WGPUAdapterPropertiesD3D, shaderModel), + "offsetof mismatch for AdapterPropertiesD3D::shaderModel"); + +// AdapterPropertiesVk + +static_assert(sizeof(AdapterPropertiesVk) == sizeof(WGPUAdapterPropertiesVk), + "sizeof mismatch for AdapterPropertiesVk"); +static_assert(alignof(AdapterPropertiesVk) == alignof(WGPUAdapterPropertiesVk), + "alignof mismatch for AdapterPropertiesVk"); + +static_assert(offsetof(AdapterPropertiesVk, driverVersion) == + offsetof(WGPUAdapterPropertiesVk, driverVersion), + "offsetof mismatch for AdapterPropertiesVk::driverVersion"); + +// BindGroupEntry + +static_assert(sizeof(BindGroupEntry) == sizeof(WGPUBindGroupEntry), + "sizeof mismatch for BindGroupEntry"); +static_assert(alignof(BindGroupEntry) == alignof(WGPUBindGroupEntry), + "alignof mismatch for BindGroupEntry"); + +static_assert(offsetof(BindGroupEntry, nextInChain) == + offsetof(WGPUBindGroupEntry, nextInChain), + "offsetof mismatch for BindGroupEntry::nextInChain"); +static_assert(offsetof(BindGroupEntry, binding) == + offsetof(WGPUBindGroupEntry, binding), + "offsetof mismatch for BindGroupEntry::binding"); +static_assert(offsetof(BindGroupEntry, buffer) == + offsetof(WGPUBindGroupEntry, buffer), + "offsetof mismatch for BindGroupEntry::buffer"); +static_assert(offsetof(BindGroupEntry, offset) == + offsetof(WGPUBindGroupEntry, offset), + "offsetof mismatch for BindGroupEntry::offset"); +static_assert(offsetof(BindGroupEntry, size) == + offsetof(WGPUBindGroupEntry, size), + "offsetof mismatch for BindGroupEntry::size"); +static_assert(offsetof(BindGroupEntry, sampler) == + offsetof(WGPUBindGroupEntry, sampler), + "offsetof mismatch for BindGroupEntry::sampler"); +static_assert(offsetof(BindGroupEntry, textureView) == + offsetof(WGPUBindGroupEntry, textureView), + "offsetof mismatch for BindGroupEntry::textureView"); + +// BlendComponent + +static_assert(sizeof(BlendComponent) == sizeof(WGPUBlendComponent), + "sizeof mismatch for BlendComponent"); +static_assert(alignof(BlendComponent) == alignof(WGPUBlendComponent), + "alignof mismatch for BlendComponent"); + +static_assert(offsetof(BlendComponent, operation) == + offsetof(WGPUBlendComponent, operation), + "offsetof mismatch for BlendComponent::operation"); +static_assert(offsetof(BlendComponent, srcFactor) == + offsetof(WGPUBlendComponent, srcFactor), + "offsetof mismatch for BlendComponent::srcFactor"); +static_assert(offsetof(BlendComponent, dstFactor) == + offsetof(WGPUBlendComponent, dstFactor), + "offsetof mismatch for BlendComponent::dstFactor"); + +// BufferBindingLayout + +static_assert(sizeof(BufferBindingLayout) == sizeof(WGPUBufferBindingLayout), + "sizeof mismatch for BufferBindingLayout"); +static_assert(alignof(BufferBindingLayout) == alignof(WGPUBufferBindingLayout), + "alignof mismatch for BufferBindingLayout"); + +static_assert(offsetof(BufferBindingLayout, nextInChain) == + offsetof(WGPUBufferBindingLayout, nextInChain), + "offsetof mismatch for BufferBindingLayout::nextInChain"); +static_assert(offsetof(BufferBindingLayout, type) == + offsetof(WGPUBufferBindingLayout, type), + "offsetof mismatch for BufferBindingLayout::type"); +static_assert(offsetof(BufferBindingLayout, hasDynamicOffset) == + offsetof(WGPUBufferBindingLayout, hasDynamicOffset), + "offsetof mismatch for BufferBindingLayout::hasDynamicOffset"); +static_assert(offsetof(BufferBindingLayout, minBindingSize) == + offsetof(WGPUBufferBindingLayout, minBindingSize), + "offsetof mismatch for BufferBindingLayout::minBindingSize"); + +// BufferDescriptor + +static_assert(sizeof(BufferDescriptor) == sizeof(WGPUBufferDescriptor), + "sizeof mismatch for BufferDescriptor"); +static_assert(alignof(BufferDescriptor) == alignof(WGPUBufferDescriptor), + "alignof mismatch for BufferDescriptor"); + +static_assert(offsetof(BufferDescriptor, nextInChain) == + offsetof(WGPUBufferDescriptor, nextInChain), + "offsetof mismatch for BufferDescriptor::nextInChain"); +static_assert(offsetof(BufferDescriptor, label) == + offsetof(WGPUBufferDescriptor, label), + "offsetof mismatch for BufferDescriptor::label"); +static_assert(offsetof(BufferDescriptor, usage) == + offsetof(WGPUBufferDescriptor, usage), + "offsetof mismatch for BufferDescriptor::usage"); +static_assert(offsetof(BufferDescriptor, size) == + offsetof(WGPUBufferDescriptor, size), + "offsetof mismatch for BufferDescriptor::size"); +static_assert(offsetof(BufferDescriptor, mappedAtCreation) == + offsetof(WGPUBufferDescriptor, mappedAtCreation), + "offsetof mismatch for BufferDescriptor::mappedAtCreation"); + +// BufferHostMappedPointer + +static_assert(sizeof(BufferHostMappedPointer) == + sizeof(WGPUBufferHostMappedPointer), + "sizeof mismatch for BufferHostMappedPointer"); +static_assert(alignof(BufferHostMappedPointer) == + alignof(WGPUBufferHostMappedPointer), + "alignof mismatch for BufferHostMappedPointer"); + +static_assert(offsetof(BufferHostMappedPointer, pointer) == + offsetof(WGPUBufferHostMappedPointer, pointer), + "offsetof mismatch for BufferHostMappedPointer::pointer"); +static_assert(offsetof(BufferHostMappedPointer, disposeCallback) == + offsetof(WGPUBufferHostMappedPointer, disposeCallback), + "offsetof mismatch for BufferHostMappedPointer::disposeCallback"); +static_assert(offsetof(BufferHostMappedPointer, userdata) == + offsetof(WGPUBufferHostMappedPointer, userdata), + "offsetof mismatch for BufferHostMappedPointer::userdata"); + +// BufferMapCallbackInfo + +static_assert(sizeof(BufferMapCallbackInfo) == + sizeof(WGPUBufferMapCallbackInfo), + "sizeof mismatch for BufferMapCallbackInfo"); +static_assert(alignof(BufferMapCallbackInfo) == + alignof(WGPUBufferMapCallbackInfo), + "alignof mismatch for BufferMapCallbackInfo"); + +static_assert(offsetof(BufferMapCallbackInfo, nextInChain) == + offsetof(WGPUBufferMapCallbackInfo, nextInChain), + "offsetof mismatch for BufferMapCallbackInfo::nextInChain"); +static_assert(offsetof(BufferMapCallbackInfo, mode) == + offsetof(WGPUBufferMapCallbackInfo, mode), + "offsetof mismatch for BufferMapCallbackInfo::mode"); +static_assert(offsetof(BufferMapCallbackInfo, callback) == + offsetof(WGPUBufferMapCallbackInfo, callback), + "offsetof mismatch for BufferMapCallbackInfo::callback"); +static_assert(offsetof(BufferMapCallbackInfo, userdata) == + offsetof(WGPUBufferMapCallbackInfo, userdata), + "offsetof mismatch for BufferMapCallbackInfo::userdata"); + +// Color + +static_assert(sizeof(Color) == sizeof(WGPUColor), "sizeof mismatch for Color"); +static_assert(alignof(Color) == alignof(WGPUColor), + "alignof mismatch for Color"); + +static_assert(offsetof(Color, r) == offsetof(WGPUColor, r), + "offsetof mismatch for Color::r"); +static_assert(offsetof(Color, g) == offsetof(WGPUColor, g), + "offsetof mismatch for Color::g"); +static_assert(offsetof(Color, b) == offsetof(WGPUColor, b), + "offsetof mismatch for Color::b"); +static_assert(offsetof(Color, a) == offsetof(WGPUColor, a), + "offsetof mismatch for Color::a"); + +// CommandBufferDescriptor + +static_assert(sizeof(CommandBufferDescriptor) == + sizeof(WGPUCommandBufferDescriptor), + "sizeof mismatch for CommandBufferDescriptor"); +static_assert(alignof(CommandBufferDescriptor) == + alignof(WGPUCommandBufferDescriptor), + "alignof mismatch for CommandBufferDescriptor"); + +static_assert(offsetof(CommandBufferDescriptor, nextInChain) == + offsetof(WGPUCommandBufferDescriptor, nextInChain), + "offsetof mismatch for CommandBufferDescriptor::nextInChain"); +static_assert(offsetof(CommandBufferDescriptor, label) == + offsetof(WGPUCommandBufferDescriptor, label), + "offsetof mismatch for CommandBufferDescriptor::label"); + +// CommandEncoderDescriptor + +static_assert(sizeof(CommandEncoderDescriptor) == + sizeof(WGPUCommandEncoderDescriptor), + "sizeof mismatch for CommandEncoderDescriptor"); +static_assert(alignof(CommandEncoderDescriptor) == + alignof(WGPUCommandEncoderDescriptor), + "alignof mismatch for CommandEncoderDescriptor"); + +static_assert(offsetof(CommandEncoderDescriptor, nextInChain) == + offsetof(WGPUCommandEncoderDescriptor, nextInChain), + "offsetof mismatch for CommandEncoderDescriptor::nextInChain"); +static_assert(offsetof(CommandEncoderDescriptor, label) == + offsetof(WGPUCommandEncoderDescriptor, label), + "offsetof mismatch for CommandEncoderDescriptor::label"); + +// CompilationInfoCallbackInfo + +static_assert(sizeof(CompilationInfoCallbackInfo) == + sizeof(WGPUCompilationInfoCallbackInfo), + "sizeof mismatch for CompilationInfoCallbackInfo"); +static_assert(alignof(CompilationInfoCallbackInfo) == + alignof(WGPUCompilationInfoCallbackInfo), + "alignof mismatch for CompilationInfoCallbackInfo"); + +static_assert(offsetof(CompilationInfoCallbackInfo, nextInChain) == + offsetof(WGPUCompilationInfoCallbackInfo, nextInChain), + "offsetof mismatch for CompilationInfoCallbackInfo::nextInChain"); +static_assert(offsetof(CompilationInfoCallbackInfo, mode) == + offsetof(WGPUCompilationInfoCallbackInfo, mode), + "offsetof mismatch for CompilationInfoCallbackInfo::mode"); +static_assert(offsetof(CompilationInfoCallbackInfo, callback) == + offsetof(WGPUCompilationInfoCallbackInfo, callback), + "offsetof mismatch for CompilationInfoCallbackInfo::callback"); +static_assert(offsetof(CompilationInfoCallbackInfo, userdata) == + offsetof(WGPUCompilationInfoCallbackInfo, userdata), + "offsetof mismatch for CompilationInfoCallbackInfo::userdata"); + +// CompilationMessage + +static_assert(sizeof(CompilationMessage) == sizeof(WGPUCompilationMessage), + "sizeof mismatch for CompilationMessage"); +static_assert(alignof(CompilationMessage) == alignof(WGPUCompilationMessage), + "alignof mismatch for CompilationMessage"); + +static_assert(offsetof(CompilationMessage, nextInChain) == + offsetof(WGPUCompilationMessage, nextInChain), + "offsetof mismatch for CompilationMessage::nextInChain"); +static_assert(offsetof(CompilationMessage, message) == + offsetof(WGPUCompilationMessage, message), + "offsetof mismatch for CompilationMessage::message"); +static_assert(offsetof(CompilationMessage, type) == + offsetof(WGPUCompilationMessage, type), + "offsetof mismatch for CompilationMessage::type"); +static_assert(offsetof(CompilationMessage, lineNum) == + offsetof(WGPUCompilationMessage, lineNum), + "offsetof mismatch for CompilationMessage::lineNum"); +static_assert(offsetof(CompilationMessage, linePos) == + offsetof(WGPUCompilationMessage, linePos), + "offsetof mismatch for CompilationMessage::linePos"); +static_assert(offsetof(CompilationMessage, offset) == + offsetof(WGPUCompilationMessage, offset), + "offsetof mismatch for CompilationMessage::offset"); +static_assert(offsetof(CompilationMessage, length) == + offsetof(WGPUCompilationMessage, length), + "offsetof mismatch for CompilationMessage::length"); +static_assert(offsetof(CompilationMessage, utf16LinePos) == + offsetof(WGPUCompilationMessage, utf16LinePos), + "offsetof mismatch for CompilationMessage::utf16LinePos"); +static_assert(offsetof(CompilationMessage, utf16Offset) == + offsetof(WGPUCompilationMessage, utf16Offset), + "offsetof mismatch for CompilationMessage::utf16Offset"); +static_assert(offsetof(CompilationMessage, utf16Length) == + offsetof(WGPUCompilationMessage, utf16Length), + "offsetof mismatch for CompilationMessage::utf16Length"); + +// ComputePassTimestampWrites + +static_assert(sizeof(ComputePassTimestampWrites) == + sizeof(WGPUComputePassTimestampWrites), + "sizeof mismatch for ComputePassTimestampWrites"); +static_assert(alignof(ComputePassTimestampWrites) == + alignof(WGPUComputePassTimestampWrites), + "alignof mismatch for ComputePassTimestampWrites"); + +static_assert(offsetof(ComputePassTimestampWrites, querySet) == + offsetof(WGPUComputePassTimestampWrites, querySet), + "offsetof mismatch for ComputePassTimestampWrites::querySet"); +static_assert(offsetof(ComputePassTimestampWrites, beginningOfPassWriteIndex) == + offsetof(WGPUComputePassTimestampWrites, + beginningOfPassWriteIndex), + "offsetof mismatch for " + "ComputePassTimestampWrites::beginningOfPassWriteIndex"); +static_assert( + offsetof(ComputePassTimestampWrites, endOfPassWriteIndex) == + offsetof(WGPUComputePassTimestampWrites, endOfPassWriteIndex), + "offsetof mismatch for ComputePassTimestampWrites::endOfPassWriteIndex"); + +// ConstantEntry + +static_assert(sizeof(ConstantEntry) == sizeof(WGPUConstantEntry), + "sizeof mismatch for ConstantEntry"); +static_assert(alignof(ConstantEntry) == alignof(WGPUConstantEntry), + "alignof mismatch for ConstantEntry"); + +static_assert(offsetof(ConstantEntry, nextInChain) == + offsetof(WGPUConstantEntry, nextInChain), + "offsetof mismatch for ConstantEntry::nextInChain"); +static_assert(offsetof(ConstantEntry, key) == offsetof(WGPUConstantEntry, key), + "offsetof mismatch for ConstantEntry::key"); +static_assert(offsetof(ConstantEntry, value) == + offsetof(WGPUConstantEntry, value), + "offsetof mismatch for ConstantEntry::value"); + +// CopyTextureForBrowserOptions + +static_assert(sizeof(CopyTextureForBrowserOptions) == + sizeof(WGPUCopyTextureForBrowserOptions), + "sizeof mismatch for CopyTextureForBrowserOptions"); +static_assert(alignof(CopyTextureForBrowserOptions) == + alignof(WGPUCopyTextureForBrowserOptions), + "alignof mismatch for CopyTextureForBrowserOptions"); + +static_assert( + offsetof(CopyTextureForBrowserOptions, nextInChain) == + offsetof(WGPUCopyTextureForBrowserOptions, nextInChain), + "offsetof mismatch for CopyTextureForBrowserOptions::nextInChain"); +static_assert(offsetof(CopyTextureForBrowserOptions, flipY) == + offsetof(WGPUCopyTextureForBrowserOptions, flipY), + "offsetof mismatch for CopyTextureForBrowserOptions::flipY"); +static_assert(offsetof(CopyTextureForBrowserOptions, + needsColorSpaceConversion) == + offsetof(WGPUCopyTextureForBrowserOptions, + needsColorSpaceConversion), + "offsetof mismatch for " + "CopyTextureForBrowserOptions::needsColorSpaceConversion"); +static_assert( + offsetof(CopyTextureForBrowserOptions, srcAlphaMode) == + offsetof(WGPUCopyTextureForBrowserOptions, srcAlphaMode), + "offsetof mismatch for CopyTextureForBrowserOptions::srcAlphaMode"); +static_assert(offsetof(CopyTextureForBrowserOptions, + srcTransferFunctionParameters) == + offsetof(WGPUCopyTextureForBrowserOptions, + srcTransferFunctionParameters), + "offsetof mismatch for " + "CopyTextureForBrowserOptions::srcTransferFunctionParameters"); +static_assert( + offsetof(CopyTextureForBrowserOptions, conversionMatrix) == + offsetof(WGPUCopyTextureForBrowserOptions, conversionMatrix), + "offsetof mismatch for CopyTextureForBrowserOptions::conversionMatrix"); +static_assert(offsetof(CopyTextureForBrowserOptions, + dstTransferFunctionParameters) == + offsetof(WGPUCopyTextureForBrowserOptions, + dstTransferFunctionParameters), + "offsetof mismatch for " + "CopyTextureForBrowserOptions::dstTransferFunctionParameters"); +static_assert( + offsetof(CopyTextureForBrowserOptions, dstAlphaMode) == + offsetof(WGPUCopyTextureForBrowserOptions, dstAlphaMode), + "offsetof mismatch for CopyTextureForBrowserOptions::dstAlphaMode"); +static_assert( + offsetof(CopyTextureForBrowserOptions, internalUsage) == + offsetof(WGPUCopyTextureForBrowserOptions, internalUsage), + "offsetof mismatch for CopyTextureForBrowserOptions::internalUsage"); + +// CreateComputePipelineAsyncCallbackInfo + +static_assert(sizeof(CreateComputePipelineAsyncCallbackInfo) == + sizeof(WGPUCreateComputePipelineAsyncCallbackInfo), + "sizeof mismatch for CreateComputePipelineAsyncCallbackInfo"); +static_assert(alignof(CreateComputePipelineAsyncCallbackInfo) == + alignof(WGPUCreateComputePipelineAsyncCallbackInfo), + "alignof mismatch for CreateComputePipelineAsyncCallbackInfo"); + +static_assert(offsetof(CreateComputePipelineAsyncCallbackInfo, nextInChain) == + offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, + nextInChain), + "offsetof mismatch for " + "CreateComputePipelineAsyncCallbackInfo::nextInChain"); +static_assert( + offsetof(CreateComputePipelineAsyncCallbackInfo, mode) == + offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, mode), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::mode"); +static_assert( + offsetof(CreateComputePipelineAsyncCallbackInfo, callback) == + offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, callback), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::callback"); +static_assert( + offsetof(CreateComputePipelineAsyncCallbackInfo, userdata) == + offsetof(WGPUCreateComputePipelineAsyncCallbackInfo, userdata), + "offsetof mismatch for CreateComputePipelineAsyncCallbackInfo::userdata"); + +// CreateRenderPipelineAsyncCallbackInfo + +static_assert(sizeof(CreateRenderPipelineAsyncCallbackInfo) == + sizeof(WGPUCreateRenderPipelineAsyncCallbackInfo), + "sizeof mismatch for CreateRenderPipelineAsyncCallbackInfo"); +static_assert(alignof(CreateRenderPipelineAsyncCallbackInfo) == + alignof(WGPUCreateRenderPipelineAsyncCallbackInfo), + "alignof mismatch for CreateRenderPipelineAsyncCallbackInfo"); + +static_assert( + offsetof(CreateRenderPipelineAsyncCallbackInfo, nextInChain) == + offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, nextInChain), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::nextInChain"); +static_assert( + offsetof(CreateRenderPipelineAsyncCallbackInfo, mode) == + offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, mode), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::mode"); +static_assert( + offsetof(CreateRenderPipelineAsyncCallbackInfo, callback) == + offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, callback), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::callback"); +static_assert( + offsetof(CreateRenderPipelineAsyncCallbackInfo, userdata) == + offsetof(WGPUCreateRenderPipelineAsyncCallbackInfo, userdata), + "offsetof mismatch for CreateRenderPipelineAsyncCallbackInfo::userdata"); + +// DawnWGSLBlocklist + +static_assert(sizeof(DawnWGSLBlocklist) == sizeof(WGPUDawnWGSLBlocklist), + "sizeof mismatch for DawnWGSLBlocklist"); +static_assert(alignof(DawnWGSLBlocklist) == alignof(WGPUDawnWGSLBlocklist), + "alignof mismatch for DawnWGSLBlocklist"); + +static_assert( + offsetof(DawnWGSLBlocklist, blocklistedFeatureCount) == + offsetof(WGPUDawnWGSLBlocklist, blocklistedFeatureCount), + "offsetof mismatch for DawnWGSLBlocklist::blocklistedFeatureCount"); +static_assert(offsetof(DawnWGSLBlocklist, blocklistedFeatures) == + offsetof(WGPUDawnWGSLBlocklist, blocklistedFeatures), + "offsetof mismatch for DawnWGSLBlocklist::blocklistedFeatures"); + +// DawnAdapterPropertiesPowerPreference + +static_assert(sizeof(DawnAdapterPropertiesPowerPreference) == + sizeof(WGPUDawnAdapterPropertiesPowerPreference), + "sizeof mismatch for DawnAdapterPropertiesPowerPreference"); +static_assert(alignof(DawnAdapterPropertiesPowerPreference) == + alignof(WGPUDawnAdapterPropertiesPowerPreference), + "alignof mismatch for DawnAdapterPropertiesPowerPreference"); + +static_assert(offsetof(DawnAdapterPropertiesPowerPreference, powerPreference) == + offsetof(WGPUDawnAdapterPropertiesPowerPreference, + powerPreference), + "offsetof mismatch for " + "DawnAdapterPropertiesPowerPreference::powerPreference"); + +// DawnBufferDescriptorErrorInfoFromWireClient + +static_assert( + sizeof(DawnBufferDescriptorErrorInfoFromWireClient) == + sizeof(WGPUDawnBufferDescriptorErrorInfoFromWireClient), + "sizeof mismatch for DawnBufferDescriptorErrorInfoFromWireClient"); +static_assert( + alignof(DawnBufferDescriptorErrorInfoFromWireClient) == + alignof(WGPUDawnBufferDescriptorErrorInfoFromWireClient), + "alignof mismatch for DawnBufferDescriptorErrorInfoFromWireClient"); + +static_assert(offsetof(DawnBufferDescriptorErrorInfoFromWireClient, + outOfMemory) == + offsetof(WGPUDawnBufferDescriptorErrorInfoFromWireClient, + outOfMemory), + "offsetof mismatch for " + "DawnBufferDescriptorErrorInfoFromWireClient::outOfMemory"); + +// DawnCacheDeviceDescriptor + +static_assert(sizeof(DawnCacheDeviceDescriptor) == + sizeof(WGPUDawnCacheDeviceDescriptor), + "sizeof mismatch for DawnCacheDeviceDescriptor"); +static_assert(alignof(DawnCacheDeviceDescriptor) == + alignof(WGPUDawnCacheDeviceDescriptor), + "alignof mismatch for DawnCacheDeviceDescriptor"); + +static_assert(offsetof(DawnCacheDeviceDescriptor, isolationKey) == + offsetof(WGPUDawnCacheDeviceDescriptor, isolationKey), + "offsetof mismatch for DawnCacheDeviceDescriptor::isolationKey"); +static_assert( + offsetof(DawnCacheDeviceDescriptor, loadDataFunction) == + offsetof(WGPUDawnCacheDeviceDescriptor, loadDataFunction), + "offsetof mismatch for DawnCacheDeviceDescriptor::loadDataFunction"); +static_assert( + offsetof(DawnCacheDeviceDescriptor, storeDataFunction) == + offsetof(WGPUDawnCacheDeviceDescriptor, storeDataFunction), + "offsetof mismatch for DawnCacheDeviceDescriptor::storeDataFunction"); +static_assert( + offsetof(DawnCacheDeviceDescriptor, functionUserdata) == + offsetof(WGPUDawnCacheDeviceDescriptor, functionUserdata), + "offsetof mismatch for DawnCacheDeviceDescriptor::functionUserdata"); + +// DawnComputePipelineFullSubgroups + +static_assert(sizeof(DawnComputePipelineFullSubgroups) == + sizeof(WGPUDawnComputePipelineFullSubgroups), + "sizeof mismatch for DawnComputePipelineFullSubgroups"); +static_assert(alignof(DawnComputePipelineFullSubgroups) == + alignof(WGPUDawnComputePipelineFullSubgroups), + "alignof mismatch for DawnComputePipelineFullSubgroups"); + +static_assert(offsetof(DawnComputePipelineFullSubgroups, + requiresFullSubgroups) == + offsetof(WGPUDawnComputePipelineFullSubgroups, + requiresFullSubgroups), + "offsetof mismatch for " + "DawnComputePipelineFullSubgroups::requiresFullSubgroups"); + +// DawnEncoderInternalUsageDescriptor + +static_assert(sizeof(DawnEncoderInternalUsageDescriptor) == + sizeof(WGPUDawnEncoderInternalUsageDescriptor), + "sizeof mismatch for DawnEncoderInternalUsageDescriptor"); +static_assert(alignof(DawnEncoderInternalUsageDescriptor) == + alignof(WGPUDawnEncoderInternalUsageDescriptor), + "alignof mismatch for DawnEncoderInternalUsageDescriptor"); + +static_assert(offsetof(DawnEncoderInternalUsageDescriptor, useInternalUsages) == + offsetof(WGPUDawnEncoderInternalUsageDescriptor, + useInternalUsages), + "offsetof mismatch for " + "DawnEncoderInternalUsageDescriptor::useInternalUsages"); + +// DawnExperimentalSubgroupLimits + +static_assert(sizeof(DawnExperimentalSubgroupLimits) == + sizeof(WGPUDawnExperimentalSubgroupLimits), + "sizeof mismatch for DawnExperimentalSubgroupLimits"); +static_assert(alignof(DawnExperimentalSubgroupLimits) == + alignof(WGPUDawnExperimentalSubgroupLimits), + "alignof mismatch for DawnExperimentalSubgroupLimits"); + +static_assert( + offsetof(DawnExperimentalSubgroupLimits, minSubgroupSize) == + offsetof(WGPUDawnExperimentalSubgroupLimits, minSubgroupSize), + "offsetof mismatch for DawnExperimentalSubgroupLimits::minSubgroupSize"); +static_assert( + offsetof(DawnExperimentalSubgroupLimits, maxSubgroupSize) == + offsetof(WGPUDawnExperimentalSubgroupLimits, maxSubgroupSize), + "offsetof mismatch for DawnExperimentalSubgroupLimits::maxSubgroupSize"); + +// DawnMultisampleStateRenderToSingleSampled + +static_assert(sizeof(DawnMultisampleStateRenderToSingleSampled) == + sizeof(WGPUDawnMultisampleStateRenderToSingleSampled), + "sizeof mismatch for DawnMultisampleStateRenderToSingleSampled"); +static_assert(alignof(DawnMultisampleStateRenderToSingleSampled) == + alignof(WGPUDawnMultisampleStateRenderToSingleSampled), + "alignof mismatch for DawnMultisampleStateRenderToSingleSampled"); + +static_assert( + offsetof(DawnMultisampleStateRenderToSingleSampled, enabled) == + offsetof(WGPUDawnMultisampleStateRenderToSingleSampled, enabled), + "offsetof mismatch for DawnMultisampleStateRenderToSingleSampled::enabled"); + +// DawnRenderPassColorAttachmentRenderToSingleSampled + +static_assert( + sizeof(DawnRenderPassColorAttachmentRenderToSingleSampled) == + sizeof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled), + "sizeof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled"); +static_assert( + alignof(DawnRenderPassColorAttachmentRenderToSingleSampled) == + alignof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled), + "alignof mismatch for DawnRenderPassColorAttachmentRenderToSingleSampled"); + +static_assert( + offsetof(DawnRenderPassColorAttachmentRenderToSingleSampled, + implicitSampleCount) == + offsetof(WGPUDawnRenderPassColorAttachmentRenderToSingleSampled, + implicitSampleCount), + "offsetof mismatch for " + "DawnRenderPassColorAttachmentRenderToSingleSampled::implicitSampleCount"); + +// DawnShaderModuleSPIRVOptionsDescriptor + +static_assert(sizeof(DawnShaderModuleSPIRVOptionsDescriptor) == + sizeof(WGPUDawnShaderModuleSPIRVOptionsDescriptor), + "sizeof mismatch for DawnShaderModuleSPIRVOptionsDescriptor"); +static_assert(alignof(DawnShaderModuleSPIRVOptionsDescriptor) == + alignof(WGPUDawnShaderModuleSPIRVOptionsDescriptor), + "alignof mismatch for DawnShaderModuleSPIRVOptionsDescriptor"); + +static_assert( + offsetof(DawnShaderModuleSPIRVOptionsDescriptor, + allowNonUniformDerivatives) == + offsetof(WGPUDawnShaderModuleSPIRVOptionsDescriptor, + allowNonUniformDerivatives), + "offsetof mismatch for " + "DawnShaderModuleSPIRVOptionsDescriptor::allowNonUniformDerivatives"); + +// DawnTextureInternalUsageDescriptor + +static_assert(sizeof(DawnTextureInternalUsageDescriptor) == + sizeof(WGPUDawnTextureInternalUsageDescriptor), + "sizeof mismatch for DawnTextureInternalUsageDescriptor"); +static_assert(alignof(DawnTextureInternalUsageDescriptor) == + alignof(WGPUDawnTextureInternalUsageDescriptor), + "alignof mismatch for DawnTextureInternalUsageDescriptor"); + +static_assert( + offsetof(DawnTextureInternalUsageDescriptor, internalUsage) == + offsetof(WGPUDawnTextureInternalUsageDescriptor, internalUsage), + "offsetof mismatch for DawnTextureInternalUsageDescriptor::internalUsage"); + +// DawnTogglesDescriptor + +static_assert(sizeof(DawnTogglesDescriptor) == + sizeof(WGPUDawnTogglesDescriptor), + "sizeof mismatch for DawnTogglesDescriptor"); +static_assert(alignof(DawnTogglesDescriptor) == + alignof(WGPUDawnTogglesDescriptor), + "alignof mismatch for DawnTogglesDescriptor"); + +static_assert( + offsetof(DawnTogglesDescriptor, enabledToggleCount) == + offsetof(WGPUDawnTogglesDescriptor, enabledToggleCount), + "offsetof mismatch for DawnTogglesDescriptor::enabledToggleCount"); +static_assert(offsetof(DawnTogglesDescriptor, enabledToggles) == + offsetof(WGPUDawnTogglesDescriptor, enabledToggles), + "offsetof mismatch for DawnTogglesDescriptor::enabledToggles"); +static_assert( + offsetof(DawnTogglesDescriptor, disabledToggleCount) == + offsetof(WGPUDawnTogglesDescriptor, disabledToggleCount), + "offsetof mismatch for DawnTogglesDescriptor::disabledToggleCount"); +static_assert(offsetof(DawnTogglesDescriptor, disabledToggles) == + offsetof(WGPUDawnTogglesDescriptor, disabledToggles), + "offsetof mismatch for DawnTogglesDescriptor::disabledToggles"); + +// DawnWireWGSLControl + +static_assert(sizeof(DawnWireWGSLControl) == sizeof(WGPUDawnWireWGSLControl), + "sizeof mismatch for DawnWireWGSLControl"); +static_assert(alignof(DawnWireWGSLControl) == alignof(WGPUDawnWireWGSLControl), + "alignof mismatch for DawnWireWGSLControl"); + +static_assert(offsetof(DawnWireWGSLControl, enableExperimental) == + offsetof(WGPUDawnWireWGSLControl, enableExperimental), + "offsetof mismatch for DawnWireWGSLControl::enableExperimental"); +static_assert(offsetof(DawnWireWGSLControl, enableUnsafe) == + offsetof(WGPUDawnWireWGSLControl, enableUnsafe), + "offsetof mismatch for DawnWireWGSLControl::enableUnsafe"); +static_assert(offsetof(DawnWireWGSLControl, enableTesting) == + offsetof(WGPUDawnWireWGSLControl, enableTesting), + "offsetof mismatch for DawnWireWGSLControl::enableTesting"); + +// DepthStencilStateDepthWriteDefinedDawn + +static_assert(sizeof(DepthStencilStateDepthWriteDefinedDawn) == + sizeof(WGPUDepthStencilStateDepthWriteDefinedDawn), + "sizeof mismatch for DepthStencilStateDepthWriteDefinedDawn"); +static_assert(alignof(DepthStencilStateDepthWriteDefinedDawn) == + alignof(WGPUDepthStencilStateDepthWriteDefinedDawn), + "alignof mismatch for DepthStencilStateDepthWriteDefinedDawn"); + +static_assert(offsetof(DepthStencilStateDepthWriteDefinedDawn, + depthWriteDefined) == + offsetof(WGPUDepthStencilStateDepthWriteDefinedDawn, + depthWriteDefined), + "offsetof mismatch for " + "DepthStencilStateDepthWriteDefinedDawn::depthWriteDefined"); + +// DrmFormatProperties + +static_assert(sizeof(DrmFormatProperties) == sizeof(WGPUDrmFormatProperties), + "sizeof mismatch for DrmFormatProperties"); +static_assert(alignof(DrmFormatProperties) == alignof(WGPUDrmFormatProperties), + "alignof mismatch for DrmFormatProperties"); + +static_assert(offsetof(DrmFormatProperties, modifier) == + offsetof(WGPUDrmFormatProperties, modifier), + "offsetof mismatch for DrmFormatProperties::modifier"); +static_assert(offsetof(DrmFormatProperties, modifierPlaneCount) == + offsetof(WGPUDrmFormatProperties, modifierPlaneCount), + "offsetof mismatch for DrmFormatProperties::modifierPlaneCount"); + +// Extent2D + +static_assert(sizeof(Extent2D) == sizeof(WGPUExtent2D), + "sizeof mismatch for Extent2D"); +static_assert(alignof(Extent2D) == alignof(WGPUExtent2D), + "alignof mismatch for Extent2D"); + +static_assert(offsetof(Extent2D, width) == offsetof(WGPUExtent2D, width), + "offsetof mismatch for Extent2D::width"); +static_assert(offsetof(Extent2D, height) == offsetof(WGPUExtent2D, height), + "offsetof mismatch for Extent2D::height"); + +// Extent3D + +static_assert(sizeof(Extent3D) == sizeof(WGPUExtent3D), + "sizeof mismatch for Extent3D"); +static_assert(alignof(Extent3D) == alignof(WGPUExtent3D), + "alignof mismatch for Extent3D"); + +static_assert(offsetof(Extent3D, width) == offsetof(WGPUExtent3D, width), + "offsetof mismatch for Extent3D::width"); +static_assert(offsetof(Extent3D, height) == offsetof(WGPUExtent3D, height), + "offsetof mismatch for Extent3D::height"); +static_assert(offsetof(Extent3D, depthOrArrayLayers) == + offsetof(WGPUExtent3D, depthOrArrayLayers), + "offsetof mismatch for Extent3D::depthOrArrayLayers"); + +// ExternalTextureBindingEntry + +static_assert(sizeof(ExternalTextureBindingEntry) == + sizeof(WGPUExternalTextureBindingEntry), + "sizeof mismatch for ExternalTextureBindingEntry"); +static_assert(alignof(ExternalTextureBindingEntry) == + alignof(WGPUExternalTextureBindingEntry), + "alignof mismatch for ExternalTextureBindingEntry"); + +static_assert( + offsetof(ExternalTextureBindingEntry, externalTexture) == + offsetof(WGPUExternalTextureBindingEntry, externalTexture), + "offsetof mismatch for ExternalTextureBindingEntry::externalTexture"); + +// ExternalTextureBindingLayout + +static_assert(sizeof(ExternalTextureBindingLayout) == + sizeof(WGPUExternalTextureBindingLayout), + "sizeof mismatch for ExternalTextureBindingLayout"); +static_assert(alignof(ExternalTextureBindingLayout) == + alignof(WGPUExternalTextureBindingLayout), + "alignof mismatch for ExternalTextureBindingLayout"); + +// FormatCapabilities + +static_assert(sizeof(FormatCapabilities) == sizeof(WGPUFormatCapabilities), + "sizeof mismatch for FormatCapabilities"); +static_assert(alignof(FormatCapabilities) == alignof(WGPUFormatCapabilities), + "alignof mismatch for FormatCapabilities"); + +static_assert(offsetof(FormatCapabilities, nextInChain) == + offsetof(WGPUFormatCapabilities, nextInChain), + "offsetof mismatch for FormatCapabilities::nextInChain"); + +// Future + +static_assert(sizeof(Future) == sizeof(WGPUFuture), + "sizeof mismatch for Future"); +static_assert(alignof(Future) == alignof(WGPUFuture), + "alignof mismatch for Future"); + +static_assert(offsetof(Future, id) == offsetof(WGPUFuture, id), + "offsetof mismatch for Future::id"); + +// InstanceFeatures + +static_assert(sizeof(InstanceFeatures) == sizeof(WGPUInstanceFeatures), + "sizeof mismatch for InstanceFeatures"); +static_assert(alignof(InstanceFeatures) == alignof(WGPUInstanceFeatures), + "alignof mismatch for InstanceFeatures"); + +static_assert(offsetof(InstanceFeatures, nextInChain) == + offsetof(WGPUInstanceFeatures, nextInChain), + "offsetof mismatch for InstanceFeatures::nextInChain"); +static_assert(offsetof(InstanceFeatures, timedWaitAnyEnable) == + offsetof(WGPUInstanceFeatures, timedWaitAnyEnable), + "offsetof mismatch for InstanceFeatures::timedWaitAnyEnable"); +static_assert(offsetof(InstanceFeatures, timedWaitAnyMaxCount) == + offsetof(WGPUInstanceFeatures, timedWaitAnyMaxCount), + "offsetof mismatch for InstanceFeatures::timedWaitAnyMaxCount"); + +// Limits + +static_assert(sizeof(Limits) == sizeof(WGPULimits), + "sizeof mismatch for Limits"); +static_assert(alignof(Limits) == alignof(WGPULimits), + "alignof mismatch for Limits"); + +static_assert(offsetof(Limits, maxTextureDimension1D) == + offsetof(WGPULimits, maxTextureDimension1D), + "offsetof mismatch for Limits::maxTextureDimension1D"); +static_assert(offsetof(Limits, maxTextureDimension2D) == + offsetof(WGPULimits, maxTextureDimension2D), + "offsetof mismatch for Limits::maxTextureDimension2D"); +static_assert(offsetof(Limits, maxTextureDimension3D) == + offsetof(WGPULimits, maxTextureDimension3D), + "offsetof mismatch for Limits::maxTextureDimension3D"); +static_assert(offsetof(Limits, maxTextureArrayLayers) == + offsetof(WGPULimits, maxTextureArrayLayers), + "offsetof mismatch for Limits::maxTextureArrayLayers"); +static_assert(offsetof(Limits, maxBindGroups) == + offsetof(WGPULimits, maxBindGroups), + "offsetof mismatch for Limits::maxBindGroups"); +static_assert(offsetof(Limits, maxBindGroupsPlusVertexBuffers) == + offsetof(WGPULimits, maxBindGroupsPlusVertexBuffers), + "offsetof mismatch for Limits::maxBindGroupsPlusVertexBuffers"); +static_assert(offsetof(Limits, maxBindingsPerBindGroup) == + offsetof(WGPULimits, maxBindingsPerBindGroup), + "offsetof mismatch for Limits::maxBindingsPerBindGroup"); +static_assert( + offsetof(Limits, maxDynamicUniformBuffersPerPipelineLayout) == + offsetof(WGPULimits, maxDynamicUniformBuffersPerPipelineLayout), + "offsetof mismatch for Limits::maxDynamicUniformBuffersPerPipelineLayout"); +static_assert( + offsetof(Limits, maxDynamicStorageBuffersPerPipelineLayout) == + offsetof(WGPULimits, maxDynamicStorageBuffersPerPipelineLayout), + "offsetof mismatch for Limits::maxDynamicStorageBuffersPerPipelineLayout"); +static_assert(offsetof(Limits, maxSampledTexturesPerShaderStage) == + offsetof(WGPULimits, maxSampledTexturesPerShaderStage), + "offsetof mismatch for Limits::maxSampledTexturesPerShaderStage"); +static_assert(offsetof(Limits, maxSamplersPerShaderStage) == + offsetof(WGPULimits, maxSamplersPerShaderStage), + "offsetof mismatch for Limits::maxSamplersPerShaderStage"); +static_assert(offsetof(Limits, maxStorageBuffersPerShaderStage) == + offsetof(WGPULimits, maxStorageBuffersPerShaderStage), + "offsetof mismatch for Limits::maxStorageBuffersPerShaderStage"); +static_assert(offsetof(Limits, maxStorageTexturesPerShaderStage) == + offsetof(WGPULimits, maxStorageTexturesPerShaderStage), + "offsetof mismatch for Limits::maxStorageTexturesPerShaderStage"); +static_assert(offsetof(Limits, maxUniformBuffersPerShaderStage) == + offsetof(WGPULimits, maxUniformBuffersPerShaderStage), + "offsetof mismatch for Limits::maxUniformBuffersPerShaderStage"); +static_assert(offsetof(Limits, maxUniformBufferBindingSize) == + offsetof(WGPULimits, maxUniformBufferBindingSize), + "offsetof mismatch for Limits::maxUniformBufferBindingSize"); +static_assert(offsetof(Limits, maxStorageBufferBindingSize) == + offsetof(WGPULimits, maxStorageBufferBindingSize), + "offsetof mismatch for Limits::maxStorageBufferBindingSize"); +static_assert(offsetof(Limits, minUniformBufferOffsetAlignment) == + offsetof(WGPULimits, minUniformBufferOffsetAlignment), + "offsetof mismatch for Limits::minUniformBufferOffsetAlignment"); +static_assert(offsetof(Limits, minStorageBufferOffsetAlignment) == + offsetof(WGPULimits, minStorageBufferOffsetAlignment), + "offsetof mismatch for Limits::minStorageBufferOffsetAlignment"); +static_assert(offsetof(Limits, maxVertexBuffers) == + offsetof(WGPULimits, maxVertexBuffers), + "offsetof mismatch for Limits::maxVertexBuffers"); +static_assert(offsetof(Limits, maxBufferSize) == + offsetof(WGPULimits, maxBufferSize), + "offsetof mismatch for Limits::maxBufferSize"); +static_assert(offsetof(Limits, maxVertexAttributes) == + offsetof(WGPULimits, maxVertexAttributes), + "offsetof mismatch for Limits::maxVertexAttributes"); +static_assert(offsetof(Limits, maxVertexBufferArrayStride) == + offsetof(WGPULimits, maxVertexBufferArrayStride), + "offsetof mismatch for Limits::maxVertexBufferArrayStride"); +static_assert(offsetof(Limits, maxInterStageShaderComponents) == + offsetof(WGPULimits, maxInterStageShaderComponents), + "offsetof mismatch for Limits::maxInterStageShaderComponents"); +static_assert(offsetof(Limits, maxInterStageShaderVariables) == + offsetof(WGPULimits, maxInterStageShaderVariables), + "offsetof mismatch for Limits::maxInterStageShaderVariables"); +static_assert(offsetof(Limits, maxColorAttachments) == + offsetof(WGPULimits, maxColorAttachments), + "offsetof mismatch for Limits::maxColorAttachments"); +static_assert(offsetof(Limits, maxColorAttachmentBytesPerSample) == + offsetof(WGPULimits, maxColorAttachmentBytesPerSample), + "offsetof mismatch for Limits::maxColorAttachmentBytesPerSample"); +static_assert(offsetof(Limits, maxComputeWorkgroupStorageSize) == + offsetof(WGPULimits, maxComputeWorkgroupStorageSize), + "offsetof mismatch for Limits::maxComputeWorkgroupStorageSize"); +static_assert( + offsetof(Limits, maxComputeInvocationsPerWorkgroup) == + offsetof(WGPULimits, maxComputeInvocationsPerWorkgroup), + "offsetof mismatch for Limits::maxComputeInvocationsPerWorkgroup"); +static_assert(offsetof(Limits, maxComputeWorkgroupSizeX) == + offsetof(WGPULimits, maxComputeWorkgroupSizeX), + "offsetof mismatch for Limits::maxComputeWorkgroupSizeX"); +static_assert(offsetof(Limits, maxComputeWorkgroupSizeY) == + offsetof(WGPULimits, maxComputeWorkgroupSizeY), + "offsetof mismatch for Limits::maxComputeWorkgroupSizeY"); +static_assert(offsetof(Limits, maxComputeWorkgroupSizeZ) == + offsetof(WGPULimits, maxComputeWorkgroupSizeZ), + "offsetof mismatch for Limits::maxComputeWorkgroupSizeZ"); +static_assert(offsetof(Limits, maxComputeWorkgroupsPerDimension) == + offsetof(WGPULimits, maxComputeWorkgroupsPerDimension), + "offsetof mismatch for Limits::maxComputeWorkgroupsPerDimension"); + +// MemoryHeapInfo + +static_assert(sizeof(MemoryHeapInfo) == sizeof(WGPUMemoryHeapInfo), + "sizeof mismatch for MemoryHeapInfo"); +static_assert(alignof(MemoryHeapInfo) == alignof(WGPUMemoryHeapInfo), + "alignof mismatch for MemoryHeapInfo"); + +static_assert(offsetof(MemoryHeapInfo, properties) == + offsetof(WGPUMemoryHeapInfo, properties), + "offsetof mismatch for MemoryHeapInfo::properties"); +static_assert(offsetof(MemoryHeapInfo, size) == + offsetof(WGPUMemoryHeapInfo, size), + "offsetof mismatch for MemoryHeapInfo::size"); + +// MultisampleState + +static_assert(sizeof(MultisampleState) == sizeof(WGPUMultisampleState), + "sizeof mismatch for MultisampleState"); +static_assert(alignof(MultisampleState) == alignof(WGPUMultisampleState), + "alignof mismatch for MultisampleState"); + +static_assert(offsetof(MultisampleState, nextInChain) == + offsetof(WGPUMultisampleState, nextInChain), + "offsetof mismatch for MultisampleState::nextInChain"); +static_assert(offsetof(MultisampleState, count) == + offsetof(WGPUMultisampleState, count), + "offsetof mismatch for MultisampleState::count"); +static_assert(offsetof(MultisampleState, mask) == + offsetof(WGPUMultisampleState, mask), + "offsetof mismatch for MultisampleState::mask"); +static_assert(offsetof(MultisampleState, alphaToCoverageEnabled) == + offsetof(WGPUMultisampleState, alphaToCoverageEnabled), + "offsetof mismatch for MultisampleState::alphaToCoverageEnabled"); + +// Origin2D + +static_assert(sizeof(Origin2D) == sizeof(WGPUOrigin2D), + "sizeof mismatch for Origin2D"); +static_assert(alignof(Origin2D) == alignof(WGPUOrigin2D), + "alignof mismatch for Origin2D"); + +static_assert(offsetof(Origin2D, x) == offsetof(WGPUOrigin2D, x), + "offsetof mismatch for Origin2D::x"); +static_assert(offsetof(Origin2D, y) == offsetof(WGPUOrigin2D, y), + "offsetof mismatch for Origin2D::y"); + +// Origin3D + +static_assert(sizeof(Origin3D) == sizeof(WGPUOrigin3D), + "sizeof mismatch for Origin3D"); +static_assert(alignof(Origin3D) == alignof(WGPUOrigin3D), + "alignof mismatch for Origin3D"); + +static_assert(offsetof(Origin3D, x) == offsetof(WGPUOrigin3D, x), + "offsetof mismatch for Origin3D::x"); +static_assert(offsetof(Origin3D, y) == offsetof(WGPUOrigin3D, y), + "offsetof mismatch for Origin3D::y"); +static_assert(offsetof(Origin3D, z) == offsetof(WGPUOrigin3D, z), + "offsetof mismatch for Origin3D::z"); + +// PipelineLayoutDescriptor + +static_assert(sizeof(PipelineLayoutDescriptor) == + sizeof(WGPUPipelineLayoutDescriptor), + "sizeof mismatch for PipelineLayoutDescriptor"); +static_assert(alignof(PipelineLayoutDescriptor) == + alignof(WGPUPipelineLayoutDescriptor), + "alignof mismatch for PipelineLayoutDescriptor"); + +static_assert(offsetof(PipelineLayoutDescriptor, nextInChain) == + offsetof(WGPUPipelineLayoutDescriptor, nextInChain), + "offsetof mismatch for PipelineLayoutDescriptor::nextInChain"); +static_assert(offsetof(PipelineLayoutDescriptor, label) == + offsetof(WGPUPipelineLayoutDescriptor, label), + "offsetof mismatch for PipelineLayoutDescriptor::label"); +static_assert( + offsetof(PipelineLayoutDescriptor, bindGroupLayoutCount) == + offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayoutCount), + "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayoutCount"); +static_assert( + offsetof(PipelineLayoutDescriptor, bindGroupLayouts) == + offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayouts), + "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayouts"); + +// PipelineLayoutStorageAttachment + +static_assert(sizeof(PipelineLayoutStorageAttachment) == + sizeof(WGPUPipelineLayoutStorageAttachment), + "sizeof mismatch for PipelineLayoutStorageAttachment"); +static_assert(alignof(PipelineLayoutStorageAttachment) == + alignof(WGPUPipelineLayoutStorageAttachment), + "alignof mismatch for PipelineLayoutStorageAttachment"); + +static_assert( + offsetof(PipelineLayoutStorageAttachment, nextInChain) == + offsetof(WGPUPipelineLayoutStorageAttachment, nextInChain), + "offsetof mismatch for PipelineLayoutStorageAttachment::nextInChain"); +static_assert(offsetof(PipelineLayoutStorageAttachment, offset) == + offsetof(WGPUPipelineLayoutStorageAttachment, offset), + "offsetof mismatch for PipelineLayoutStorageAttachment::offset"); +static_assert(offsetof(PipelineLayoutStorageAttachment, format) == + offsetof(WGPUPipelineLayoutStorageAttachment, format), + "offsetof mismatch for PipelineLayoutStorageAttachment::format"); + +// PopErrorScopeCallbackInfo + +static_assert(sizeof(PopErrorScopeCallbackInfo) == + sizeof(WGPUPopErrorScopeCallbackInfo), + "sizeof mismatch for PopErrorScopeCallbackInfo"); +static_assert(alignof(PopErrorScopeCallbackInfo) == + alignof(WGPUPopErrorScopeCallbackInfo), + "alignof mismatch for PopErrorScopeCallbackInfo"); + +static_assert(offsetof(PopErrorScopeCallbackInfo, nextInChain) == + offsetof(WGPUPopErrorScopeCallbackInfo, nextInChain), + "offsetof mismatch for PopErrorScopeCallbackInfo::nextInChain"); +static_assert(offsetof(PopErrorScopeCallbackInfo, mode) == + offsetof(WGPUPopErrorScopeCallbackInfo, mode), + "offsetof mismatch for PopErrorScopeCallbackInfo::mode"); +static_assert(offsetof(PopErrorScopeCallbackInfo, callback) == + offsetof(WGPUPopErrorScopeCallbackInfo, callback), + "offsetof mismatch for PopErrorScopeCallbackInfo::callback"); +static_assert(offsetof(PopErrorScopeCallbackInfo, oldCallback) == + offsetof(WGPUPopErrorScopeCallbackInfo, oldCallback), + "offsetof mismatch for PopErrorScopeCallbackInfo::oldCallback"); +static_assert(offsetof(PopErrorScopeCallbackInfo, userdata) == + offsetof(WGPUPopErrorScopeCallbackInfo, userdata), + "offsetof mismatch for PopErrorScopeCallbackInfo::userdata"); + +// PrimitiveDepthClipControl + +static_assert(sizeof(PrimitiveDepthClipControl) == + sizeof(WGPUPrimitiveDepthClipControl), + "sizeof mismatch for PrimitiveDepthClipControl"); +static_assert(alignof(PrimitiveDepthClipControl) == + alignof(WGPUPrimitiveDepthClipControl), + "alignof mismatch for PrimitiveDepthClipControl"); + +static_assert( + offsetof(PrimitiveDepthClipControl, unclippedDepth) == + offsetof(WGPUPrimitiveDepthClipControl, unclippedDepth), + "offsetof mismatch for PrimitiveDepthClipControl::unclippedDepth"); + +// PrimitiveState + +static_assert(sizeof(PrimitiveState) == sizeof(WGPUPrimitiveState), + "sizeof mismatch for PrimitiveState"); +static_assert(alignof(PrimitiveState) == alignof(WGPUPrimitiveState), + "alignof mismatch for PrimitiveState"); + +static_assert(offsetof(PrimitiveState, nextInChain) == + offsetof(WGPUPrimitiveState, nextInChain), + "offsetof mismatch for PrimitiveState::nextInChain"); +static_assert(offsetof(PrimitiveState, topology) == + offsetof(WGPUPrimitiveState, topology), + "offsetof mismatch for PrimitiveState::topology"); +static_assert(offsetof(PrimitiveState, stripIndexFormat) == + offsetof(WGPUPrimitiveState, stripIndexFormat), + "offsetof mismatch for PrimitiveState::stripIndexFormat"); +static_assert(offsetof(PrimitiveState, frontFace) == + offsetof(WGPUPrimitiveState, frontFace), + "offsetof mismatch for PrimitiveState::frontFace"); +static_assert(offsetof(PrimitiveState, cullMode) == + offsetof(WGPUPrimitiveState, cullMode), + "offsetof mismatch for PrimitiveState::cullMode"); + +// QuerySetDescriptor + +static_assert(sizeof(QuerySetDescriptor) == sizeof(WGPUQuerySetDescriptor), + "sizeof mismatch for QuerySetDescriptor"); +static_assert(alignof(QuerySetDescriptor) == alignof(WGPUQuerySetDescriptor), + "alignof mismatch for QuerySetDescriptor"); + +static_assert(offsetof(QuerySetDescriptor, nextInChain) == + offsetof(WGPUQuerySetDescriptor, nextInChain), + "offsetof mismatch for QuerySetDescriptor::nextInChain"); +static_assert(offsetof(QuerySetDescriptor, label) == + offsetof(WGPUQuerySetDescriptor, label), + "offsetof mismatch for QuerySetDescriptor::label"); +static_assert(offsetof(QuerySetDescriptor, type) == + offsetof(WGPUQuerySetDescriptor, type), + "offsetof mismatch for QuerySetDescriptor::type"); +static_assert(offsetof(QuerySetDescriptor, count) == + offsetof(WGPUQuerySetDescriptor, count), + "offsetof mismatch for QuerySetDescriptor::count"); + +// QueueDescriptor + +static_assert(sizeof(QueueDescriptor) == sizeof(WGPUQueueDescriptor), + "sizeof mismatch for QueueDescriptor"); +static_assert(alignof(QueueDescriptor) == alignof(WGPUQueueDescriptor), + "alignof mismatch for QueueDescriptor"); + +static_assert(offsetof(QueueDescriptor, nextInChain) == + offsetof(WGPUQueueDescriptor, nextInChain), + "offsetof mismatch for QueueDescriptor::nextInChain"); +static_assert(offsetof(QueueDescriptor, label) == + offsetof(WGPUQueueDescriptor, label), + "offsetof mismatch for QueueDescriptor::label"); + +// QueueWorkDoneCallbackInfo + +static_assert(sizeof(QueueWorkDoneCallbackInfo) == + sizeof(WGPUQueueWorkDoneCallbackInfo), + "sizeof mismatch for QueueWorkDoneCallbackInfo"); +static_assert(alignof(QueueWorkDoneCallbackInfo) == + alignof(WGPUQueueWorkDoneCallbackInfo), + "alignof mismatch for QueueWorkDoneCallbackInfo"); + +static_assert(offsetof(QueueWorkDoneCallbackInfo, nextInChain) == + offsetof(WGPUQueueWorkDoneCallbackInfo, nextInChain), + "offsetof mismatch for QueueWorkDoneCallbackInfo::nextInChain"); +static_assert(offsetof(QueueWorkDoneCallbackInfo, mode) == + offsetof(WGPUQueueWorkDoneCallbackInfo, mode), + "offsetof mismatch for QueueWorkDoneCallbackInfo::mode"); +static_assert(offsetof(QueueWorkDoneCallbackInfo, callback) == + offsetof(WGPUQueueWorkDoneCallbackInfo, callback), + "offsetof mismatch for QueueWorkDoneCallbackInfo::callback"); +static_assert(offsetof(QueueWorkDoneCallbackInfo, userdata) == + offsetof(WGPUQueueWorkDoneCallbackInfo, userdata), + "offsetof mismatch for QueueWorkDoneCallbackInfo::userdata"); + +// RenderBundleDescriptor + +static_assert(sizeof(RenderBundleDescriptor) == + sizeof(WGPURenderBundleDescriptor), + "sizeof mismatch for RenderBundleDescriptor"); +static_assert(alignof(RenderBundleDescriptor) == + alignof(WGPURenderBundleDescriptor), + "alignof mismatch for RenderBundleDescriptor"); + +static_assert(offsetof(RenderBundleDescriptor, nextInChain) == + offsetof(WGPURenderBundleDescriptor, nextInChain), + "offsetof mismatch for RenderBundleDescriptor::nextInChain"); +static_assert(offsetof(RenderBundleDescriptor, label) == + offsetof(WGPURenderBundleDescriptor, label), + "offsetof mismatch for RenderBundleDescriptor::label"); + +// RenderBundleEncoderDescriptor + +static_assert(sizeof(RenderBundleEncoderDescriptor) == + sizeof(WGPURenderBundleEncoderDescriptor), + "sizeof mismatch for RenderBundleEncoderDescriptor"); +static_assert(alignof(RenderBundleEncoderDescriptor) == + alignof(WGPURenderBundleEncoderDescriptor), + "alignof mismatch for RenderBundleEncoderDescriptor"); + +static_assert( + offsetof(RenderBundleEncoderDescriptor, nextInChain) == + offsetof(WGPURenderBundleEncoderDescriptor, nextInChain), + "offsetof mismatch for RenderBundleEncoderDescriptor::nextInChain"); +static_assert(offsetof(RenderBundleEncoderDescriptor, label) == + offsetof(WGPURenderBundleEncoderDescriptor, label), + "offsetof mismatch for RenderBundleEncoderDescriptor::label"); +static_assert( + offsetof(RenderBundleEncoderDescriptor, colorFormatCount) == + offsetof(WGPURenderBundleEncoderDescriptor, colorFormatCount), + "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormatCount"); +static_assert( + offsetof(RenderBundleEncoderDescriptor, colorFormats) == + offsetof(WGPURenderBundleEncoderDescriptor, colorFormats), + "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormats"); +static_assert( + offsetof(RenderBundleEncoderDescriptor, depthStencilFormat) == + offsetof(WGPURenderBundleEncoderDescriptor, depthStencilFormat), + "offsetof mismatch for RenderBundleEncoderDescriptor::depthStencilFormat"); +static_assert( + offsetof(RenderBundleEncoderDescriptor, sampleCount) == + offsetof(WGPURenderBundleEncoderDescriptor, sampleCount), + "offsetof mismatch for RenderBundleEncoderDescriptor::sampleCount"); +static_assert( + offsetof(RenderBundleEncoderDescriptor, depthReadOnly) == + offsetof(WGPURenderBundleEncoderDescriptor, depthReadOnly), + "offsetof mismatch for RenderBundleEncoderDescriptor::depthReadOnly"); +static_assert( + offsetof(RenderBundleEncoderDescriptor, stencilReadOnly) == + offsetof(WGPURenderBundleEncoderDescriptor, stencilReadOnly), + "offsetof mismatch for RenderBundleEncoderDescriptor::stencilReadOnly"); + +// RenderPassDepthStencilAttachment + +static_assert(sizeof(RenderPassDepthStencilAttachment) == + sizeof(WGPURenderPassDepthStencilAttachment), + "sizeof mismatch for RenderPassDepthStencilAttachment"); +static_assert(alignof(RenderPassDepthStencilAttachment) == + alignof(WGPURenderPassDepthStencilAttachment), + "alignof mismatch for RenderPassDepthStencilAttachment"); + +static_assert(offsetof(RenderPassDepthStencilAttachment, view) == + offsetof(WGPURenderPassDepthStencilAttachment, view), + "offsetof mismatch for RenderPassDepthStencilAttachment::view"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, depthLoadOp) == + offsetof(WGPURenderPassDepthStencilAttachment, depthLoadOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthLoadOp"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, depthStoreOp) == + offsetof(WGPURenderPassDepthStencilAttachment, depthStoreOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthStoreOp"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, depthClearValue) == + offsetof(WGPURenderPassDepthStencilAttachment, depthClearValue), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthClearValue"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, depthReadOnly) == + offsetof(WGPURenderPassDepthStencilAttachment, depthReadOnly), + "offsetof mismatch for RenderPassDepthStencilAttachment::depthReadOnly"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, stencilLoadOp) == + offsetof(WGPURenderPassDepthStencilAttachment, stencilLoadOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilLoadOp"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, stencilStoreOp) == + offsetof(WGPURenderPassDepthStencilAttachment, stencilStoreOp), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilStoreOp"); +static_assert(offsetof(RenderPassDepthStencilAttachment, stencilClearValue) == + offsetof(WGPURenderPassDepthStencilAttachment, + stencilClearValue), + "offsetof mismatch for " + "RenderPassDepthStencilAttachment::stencilClearValue"); +static_assert( + offsetof(RenderPassDepthStencilAttachment, stencilReadOnly) == + offsetof(WGPURenderPassDepthStencilAttachment, stencilReadOnly), + "offsetof mismatch for RenderPassDepthStencilAttachment::stencilReadOnly"); + +// RenderPassDescriptorMaxDrawCount + +static_assert(sizeof(RenderPassDescriptorMaxDrawCount) == + sizeof(WGPURenderPassDescriptorMaxDrawCount), + "sizeof mismatch for RenderPassDescriptorMaxDrawCount"); +static_assert(alignof(RenderPassDescriptorMaxDrawCount) == + alignof(WGPURenderPassDescriptorMaxDrawCount), + "alignof mismatch for RenderPassDescriptorMaxDrawCount"); + +static_assert( + offsetof(RenderPassDescriptorMaxDrawCount, maxDrawCount) == + offsetof(WGPURenderPassDescriptorMaxDrawCount, maxDrawCount), + "offsetof mismatch for RenderPassDescriptorMaxDrawCount::maxDrawCount"); + +// RenderPassTimestampWrites + +static_assert(sizeof(RenderPassTimestampWrites) == + sizeof(WGPURenderPassTimestampWrites), + "sizeof mismatch for RenderPassTimestampWrites"); +static_assert(alignof(RenderPassTimestampWrites) == + alignof(WGPURenderPassTimestampWrites), + "alignof mismatch for RenderPassTimestampWrites"); + +static_assert(offsetof(RenderPassTimestampWrites, querySet) == + offsetof(WGPURenderPassTimestampWrites, querySet), + "offsetof mismatch for RenderPassTimestampWrites::querySet"); +static_assert(offsetof(RenderPassTimestampWrites, beginningOfPassWriteIndex) == + offsetof(WGPURenderPassTimestampWrites, + beginningOfPassWriteIndex), + "offsetof mismatch for " + "RenderPassTimestampWrites::beginningOfPassWriteIndex"); +static_assert( + offsetof(RenderPassTimestampWrites, endOfPassWriteIndex) == + offsetof(WGPURenderPassTimestampWrites, endOfPassWriteIndex), + "offsetof mismatch for RenderPassTimestampWrites::endOfPassWriteIndex"); + +// RequestAdapterCallbackInfo + +static_assert(sizeof(RequestAdapterCallbackInfo) == + sizeof(WGPURequestAdapterCallbackInfo), + "sizeof mismatch for RequestAdapterCallbackInfo"); +static_assert(alignof(RequestAdapterCallbackInfo) == + alignof(WGPURequestAdapterCallbackInfo), + "alignof mismatch for RequestAdapterCallbackInfo"); + +static_assert(offsetof(RequestAdapterCallbackInfo, nextInChain) == + offsetof(WGPURequestAdapterCallbackInfo, nextInChain), + "offsetof mismatch for RequestAdapterCallbackInfo::nextInChain"); +static_assert(offsetof(RequestAdapterCallbackInfo, mode) == + offsetof(WGPURequestAdapterCallbackInfo, mode), + "offsetof mismatch for RequestAdapterCallbackInfo::mode"); +static_assert(offsetof(RequestAdapterCallbackInfo, callback) == + offsetof(WGPURequestAdapterCallbackInfo, callback), + "offsetof mismatch for RequestAdapterCallbackInfo::callback"); +static_assert(offsetof(RequestAdapterCallbackInfo, userdata) == + offsetof(WGPURequestAdapterCallbackInfo, userdata), + "offsetof mismatch for RequestAdapterCallbackInfo::userdata"); + +// RequestAdapterOptions + +static_assert(sizeof(RequestAdapterOptions) == + sizeof(WGPURequestAdapterOptions), + "sizeof mismatch for RequestAdapterOptions"); +static_assert(alignof(RequestAdapterOptions) == + alignof(WGPURequestAdapterOptions), + "alignof mismatch for RequestAdapterOptions"); + +static_assert(offsetof(RequestAdapterOptions, nextInChain) == + offsetof(WGPURequestAdapterOptions, nextInChain), + "offsetof mismatch for RequestAdapterOptions::nextInChain"); +static_assert(offsetof(RequestAdapterOptions, compatibleSurface) == + offsetof(WGPURequestAdapterOptions, compatibleSurface), + "offsetof mismatch for RequestAdapterOptions::compatibleSurface"); +static_assert(offsetof(RequestAdapterOptions, powerPreference) == + offsetof(WGPURequestAdapterOptions, powerPreference), + "offsetof mismatch for RequestAdapterOptions::powerPreference"); +static_assert(offsetof(RequestAdapterOptions, backendType) == + offsetof(WGPURequestAdapterOptions, backendType), + "offsetof mismatch for RequestAdapterOptions::backendType"); +static_assert( + offsetof(RequestAdapterOptions, forceFallbackAdapter) == + offsetof(WGPURequestAdapterOptions, forceFallbackAdapter), + "offsetof mismatch for RequestAdapterOptions::forceFallbackAdapter"); +static_assert(offsetof(RequestAdapterOptions, compatibilityMode) == + offsetof(WGPURequestAdapterOptions, compatibilityMode), + "offsetof mismatch for RequestAdapterOptions::compatibilityMode"); + +// RequestDeviceCallbackInfo + +static_assert(sizeof(RequestDeviceCallbackInfo) == + sizeof(WGPURequestDeviceCallbackInfo), + "sizeof mismatch for RequestDeviceCallbackInfo"); +static_assert(alignof(RequestDeviceCallbackInfo) == + alignof(WGPURequestDeviceCallbackInfo), + "alignof mismatch for RequestDeviceCallbackInfo"); + +static_assert(offsetof(RequestDeviceCallbackInfo, nextInChain) == + offsetof(WGPURequestDeviceCallbackInfo, nextInChain), + "offsetof mismatch for RequestDeviceCallbackInfo::nextInChain"); +static_assert(offsetof(RequestDeviceCallbackInfo, mode) == + offsetof(WGPURequestDeviceCallbackInfo, mode), + "offsetof mismatch for RequestDeviceCallbackInfo::mode"); +static_assert(offsetof(RequestDeviceCallbackInfo, callback) == + offsetof(WGPURequestDeviceCallbackInfo, callback), + "offsetof mismatch for RequestDeviceCallbackInfo::callback"); +static_assert(offsetof(RequestDeviceCallbackInfo, userdata) == + offsetof(WGPURequestDeviceCallbackInfo, userdata), + "offsetof mismatch for RequestDeviceCallbackInfo::userdata"); + +// SamplerBindingLayout + +static_assert(sizeof(SamplerBindingLayout) == sizeof(WGPUSamplerBindingLayout), + "sizeof mismatch for SamplerBindingLayout"); +static_assert(alignof(SamplerBindingLayout) == + alignof(WGPUSamplerBindingLayout), + "alignof mismatch for SamplerBindingLayout"); + +static_assert(offsetof(SamplerBindingLayout, nextInChain) == + offsetof(WGPUSamplerBindingLayout, nextInChain), + "offsetof mismatch for SamplerBindingLayout::nextInChain"); +static_assert(offsetof(SamplerBindingLayout, type) == + offsetof(WGPUSamplerBindingLayout, type), + "offsetof mismatch for SamplerBindingLayout::type"); + +// SamplerDescriptor + +static_assert(sizeof(SamplerDescriptor) == sizeof(WGPUSamplerDescriptor), + "sizeof mismatch for SamplerDescriptor"); +static_assert(alignof(SamplerDescriptor) == alignof(WGPUSamplerDescriptor), + "alignof mismatch for SamplerDescriptor"); + +static_assert(offsetof(SamplerDescriptor, nextInChain) == + offsetof(WGPUSamplerDescriptor, nextInChain), + "offsetof mismatch for SamplerDescriptor::nextInChain"); +static_assert(offsetof(SamplerDescriptor, label) == + offsetof(WGPUSamplerDescriptor, label), + "offsetof mismatch for SamplerDescriptor::label"); +static_assert(offsetof(SamplerDescriptor, addressModeU) == + offsetof(WGPUSamplerDescriptor, addressModeU), + "offsetof mismatch for SamplerDescriptor::addressModeU"); +static_assert(offsetof(SamplerDescriptor, addressModeV) == + offsetof(WGPUSamplerDescriptor, addressModeV), + "offsetof mismatch for SamplerDescriptor::addressModeV"); +static_assert(offsetof(SamplerDescriptor, addressModeW) == + offsetof(WGPUSamplerDescriptor, addressModeW), + "offsetof mismatch for SamplerDescriptor::addressModeW"); +static_assert(offsetof(SamplerDescriptor, magFilter) == + offsetof(WGPUSamplerDescriptor, magFilter), + "offsetof mismatch for SamplerDescriptor::magFilter"); +static_assert(offsetof(SamplerDescriptor, minFilter) == + offsetof(WGPUSamplerDescriptor, minFilter), + "offsetof mismatch for SamplerDescriptor::minFilter"); +static_assert(offsetof(SamplerDescriptor, mipmapFilter) == + offsetof(WGPUSamplerDescriptor, mipmapFilter), + "offsetof mismatch for SamplerDescriptor::mipmapFilter"); +static_assert(offsetof(SamplerDescriptor, lodMinClamp) == + offsetof(WGPUSamplerDescriptor, lodMinClamp), + "offsetof mismatch for SamplerDescriptor::lodMinClamp"); +static_assert(offsetof(SamplerDescriptor, lodMaxClamp) == + offsetof(WGPUSamplerDescriptor, lodMaxClamp), + "offsetof mismatch for SamplerDescriptor::lodMaxClamp"); +static_assert(offsetof(SamplerDescriptor, compare) == + offsetof(WGPUSamplerDescriptor, compare), + "offsetof mismatch for SamplerDescriptor::compare"); +static_assert(offsetof(SamplerDescriptor, maxAnisotropy) == + offsetof(WGPUSamplerDescriptor, maxAnisotropy), + "offsetof mismatch for SamplerDescriptor::maxAnisotropy"); + +// ShaderModuleSPIRVDescriptor + +static_assert(sizeof(ShaderModuleSPIRVDescriptor) == + sizeof(WGPUShaderModuleSPIRVDescriptor), + "sizeof mismatch for ShaderModuleSPIRVDescriptor"); +static_assert(alignof(ShaderModuleSPIRVDescriptor) == + alignof(WGPUShaderModuleSPIRVDescriptor), + "alignof mismatch for ShaderModuleSPIRVDescriptor"); + +static_assert(offsetof(ShaderModuleSPIRVDescriptor, codeSize) == + offsetof(WGPUShaderModuleSPIRVDescriptor, codeSize), + "offsetof mismatch for ShaderModuleSPIRVDescriptor::codeSize"); +static_assert(offsetof(ShaderModuleSPIRVDescriptor, code) == + offsetof(WGPUShaderModuleSPIRVDescriptor, code), + "offsetof mismatch for ShaderModuleSPIRVDescriptor::code"); + +// ShaderModuleWGSLDescriptor + +static_assert(sizeof(ShaderModuleWGSLDescriptor) == + sizeof(WGPUShaderModuleWGSLDescriptor), + "sizeof mismatch for ShaderModuleWGSLDescriptor"); +static_assert(alignof(ShaderModuleWGSLDescriptor) == + alignof(WGPUShaderModuleWGSLDescriptor), + "alignof mismatch for ShaderModuleWGSLDescriptor"); + +static_assert(offsetof(ShaderModuleWGSLDescriptor, code) == + offsetof(WGPUShaderModuleWGSLDescriptor, code), + "offsetof mismatch for ShaderModuleWGSLDescriptor::code"); + +// ShaderModuleDescriptor + +static_assert(sizeof(ShaderModuleDescriptor) == + sizeof(WGPUShaderModuleDescriptor), + "sizeof mismatch for ShaderModuleDescriptor"); +static_assert(alignof(ShaderModuleDescriptor) == + alignof(WGPUShaderModuleDescriptor), + "alignof mismatch for ShaderModuleDescriptor"); + +static_assert(offsetof(ShaderModuleDescriptor, nextInChain) == + offsetof(WGPUShaderModuleDescriptor, nextInChain), + "offsetof mismatch for ShaderModuleDescriptor::nextInChain"); +static_assert(offsetof(ShaderModuleDescriptor, label) == + offsetof(WGPUShaderModuleDescriptor, label), + "offsetof mismatch for ShaderModuleDescriptor::label"); + +// SharedBufferMemoryBeginAccessDescriptor + +static_assert(sizeof(SharedBufferMemoryBeginAccessDescriptor) == + sizeof(WGPUSharedBufferMemoryBeginAccessDescriptor), + "sizeof mismatch for SharedBufferMemoryBeginAccessDescriptor"); +static_assert(alignof(SharedBufferMemoryBeginAccessDescriptor) == + alignof(WGPUSharedBufferMemoryBeginAccessDescriptor), + "alignof mismatch for SharedBufferMemoryBeginAccessDescriptor"); + +static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, nextInChain) == + offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, + nextInChain), + "offsetof mismatch for " + "SharedBufferMemoryBeginAccessDescriptor::nextInChain"); +static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, initialized) == + offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, + initialized), + "offsetof mismatch for " + "SharedBufferMemoryBeginAccessDescriptor::initialized"); +static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, fenceCount) == + offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, + fenceCount), + "offsetof mismatch for " + "SharedBufferMemoryBeginAccessDescriptor::fenceCount"); +static_assert( + offsetof(SharedBufferMemoryBeginAccessDescriptor, fences) == + offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, fences), + "offsetof mismatch for SharedBufferMemoryBeginAccessDescriptor::fences"); +static_assert(offsetof(SharedBufferMemoryBeginAccessDescriptor, + signaledValues) == + offsetof(WGPUSharedBufferMemoryBeginAccessDescriptor, + signaledValues), + "offsetof mismatch for " + "SharedBufferMemoryBeginAccessDescriptor::signaledValues"); + +// SharedBufferMemoryDescriptor + +static_assert(sizeof(SharedBufferMemoryDescriptor) == + sizeof(WGPUSharedBufferMemoryDescriptor), + "sizeof mismatch for SharedBufferMemoryDescriptor"); +static_assert(alignof(SharedBufferMemoryDescriptor) == + alignof(WGPUSharedBufferMemoryDescriptor), + "alignof mismatch for SharedBufferMemoryDescriptor"); + +static_assert( + offsetof(SharedBufferMemoryDescriptor, nextInChain) == + offsetof(WGPUSharedBufferMemoryDescriptor, nextInChain), + "offsetof mismatch for SharedBufferMemoryDescriptor::nextInChain"); +static_assert(offsetof(SharedBufferMemoryDescriptor, label) == + offsetof(WGPUSharedBufferMemoryDescriptor, label), + "offsetof mismatch for SharedBufferMemoryDescriptor::label"); + +// SharedBufferMemoryEndAccessState + +static_assert(sizeof(SharedBufferMemoryEndAccessState) == + sizeof(WGPUSharedBufferMemoryEndAccessState), + "sizeof mismatch for SharedBufferMemoryEndAccessState"); +static_assert(alignof(SharedBufferMemoryEndAccessState) == + alignof(WGPUSharedBufferMemoryEndAccessState), + "alignof mismatch for SharedBufferMemoryEndAccessState"); + +static_assert( + offsetof(SharedBufferMemoryEndAccessState, nextInChain) == + offsetof(WGPUSharedBufferMemoryEndAccessState, nextInChain), + "offsetof mismatch for SharedBufferMemoryEndAccessState::nextInChain"); +static_assert( + offsetof(SharedBufferMemoryEndAccessState, initialized) == + offsetof(WGPUSharedBufferMemoryEndAccessState, initialized), + "offsetof mismatch for SharedBufferMemoryEndAccessState::initialized"); +static_assert( + offsetof(SharedBufferMemoryEndAccessState, fenceCount) == + offsetof(WGPUSharedBufferMemoryEndAccessState, fenceCount), + "offsetof mismatch for SharedBufferMemoryEndAccessState::fenceCount"); +static_assert(offsetof(SharedBufferMemoryEndAccessState, fences) == + offsetof(WGPUSharedBufferMemoryEndAccessState, fences), + "offsetof mismatch for SharedBufferMemoryEndAccessState::fences"); +static_assert( + offsetof(SharedBufferMemoryEndAccessState, signaledValues) == + offsetof(WGPUSharedBufferMemoryEndAccessState, signaledValues), + "offsetof mismatch for SharedBufferMemoryEndAccessState::signaledValues"); + +// SharedBufferMemoryProperties + +static_assert(sizeof(SharedBufferMemoryProperties) == + sizeof(WGPUSharedBufferMemoryProperties), + "sizeof mismatch for SharedBufferMemoryProperties"); +static_assert(alignof(SharedBufferMemoryProperties) == + alignof(WGPUSharedBufferMemoryProperties), + "alignof mismatch for SharedBufferMemoryProperties"); + +static_assert( + offsetof(SharedBufferMemoryProperties, nextInChain) == + offsetof(WGPUSharedBufferMemoryProperties, nextInChain), + "offsetof mismatch for SharedBufferMemoryProperties::nextInChain"); +static_assert(offsetof(SharedBufferMemoryProperties, usage) == + offsetof(WGPUSharedBufferMemoryProperties, usage), + "offsetof mismatch for SharedBufferMemoryProperties::usage"); +static_assert(offsetof(SharedBufferMemoryProperties, size) == + offsetof(WGPUSharedBufferMemoryProperties, size), + "offsetof mismatch for SharedBufferMemoryProperties::size"); + +// SharedFenceDXGISharedHandleDescriptor + +static_assert(sizeof(SharedFenceDXGISharedHandleDescriptor) == + sizeof(WGPUSharedFenceDXGISharedHandleDescriptor), + "sizeof mismatch for SharedFenceDXGISharedHandleDescriptor"); +static_assert(alignof(SharedFenceDXGISharedHandleDescriptor) == + alignof(WGPUSharedFenceDXGISharedHandleDescriptor), + "alignof mismatch for SharedFenceDXGISharedHandleDescriptor"); + +static_assert( + offsetof(SharedFenceDXGISharedHandleDescriptor, handle) == + offsetof(WGPUSharedFenceDXGISharedHandleDescriptor, handle), + "offsetof mismatch for SharedFenceDXGISharedHandleDescriptor::handle"); + +// SharedFenceDXGISharedHandleExportInfo + +static_assert(sizeof(SharedFenceDXGISharedHandleExportInfo) == + sizeof(WGPUSharedFenceDXGISharedHandleExportInfo), + "sizeof mismatch for SharedFenceDXGISharedHandleExportInfo"); +static_assert(alignof(SharedFenceDXGISharedHandleExportInfo) == + alignof(WGPUSharedFenceDXGISharedHandleExportInfo), + "alignof mismatch for SharedFenceDXGISharedHandleExportInfo"); + +static_assert( + offsetof(SharedFenceDXGISharedHandleExportInfo, handle) == + offsetof(WGPUSharedFenceDXGISharedHandleExportInfo, handle), + "offsetof mismatch for SharedFenceDXGISharedHandleExportInfo::handle"); + +// SharedFenceMTLSharedEventDescriptor + +static_assert(sizeof(SharedFenceMTLSharedEventDescriptor) == + sizeof(WGPUSharedFenceMTLSharedEventDescriptor), + "sizeof mismatch for SharedFenceMTLSharedEventDescriptor"); +static_assert(alignof(SharedFenceMTLSharedEventDescriptor) == + alignof(WGPUSharedFenceMTLSharedEventDescriptor), + "alignof mismatch for SharedFenceMTLSharedEventDescriptor"); + +static_assert( + offsetof(SharedFenceMTLSharedEventDescriptor, sharedEvent) == + offsetof(WGPUSharedFenceMTLSharedEventDescriptor, sharedEvent), + "offsetof mismatch for SharedFenceMTLSharedEventDescriptor::sharedEvent"); + +// SharedFenceMTLSharedEventExportInfo + +static_assert(sizeof(SharedFenceMTLSharedEventExportInfo) == + sizeof(WGPUSharedFenceMTLSharedEventExportInfo), + "sizeof mismatch for SharedFenceMTLSharedEventExportInfo"); +static_assert(alignof(SharedFenceMTLSharedEventExportInfo) == + alignof(WGPUSharedFenceMTLSharedEventExportInfo), + "alignof mismatch for SharedFenceMTLSharedEventExportInfo"); + +static_assert( + offsetof(SharedFenceMTLSharedEventExportInfo, sharedEvent) == + offsetof(WGPUSharedFenceMTLSharedEventExportInfo, sharedEvent), + "offsetof mismatch for SharedFenceMTLSharedEventExportInfo::sharedEvent"); + +// SharedFenceDescriptor + +static_assert(sizeof(SharedFenceDescriptor) == + sizeof(WGPUSharedFenceDescriptor), + "sizeof mismatch for SharedFenceDescriptor"); +static_assert(alignof(SharedFenceDescriptor) == + alignof(WGPUSharedFenceDescriptor), + "alignof mismatch for SharedFenceDescriptor"); + +static_assert(offsetof(SharedFenceDescriptor, nextInChain) == + offsetof(WGPUSharedFenceDescriptor, nextInChain), + "offsetof mismatch for SharedFenceDescriptor::nextInChain"); +static_assert(offsetof(SharedFenceDescriptor, label) == + offsetof(WGPUSharedFenceDescriptor, label), + "offsetof mismatch for SharedFenceDescriptor::label"); + +// SharedFenceExportInfo + +static_assert(sizeof(SharedFenceExportInfo) == + sizeof(WGPUSharedFenceExportInfo), + "sizeof mismatch for SharedFenceExportInfo"); +static_assert(alignof(SharedFenceExportInfo) == + alignof(WGPUSharedFenceExportInfo), + "alignof mismatch for SharedFenceExportInfo"); + +static_assert(offsetof(SharedFenceExportInfo, nextInChain) == + offsetof(WGPUSharedFenceExportInfo, nextInChain), + "offsetof mismatch for SharedFenceExportInfo::nextInChain"); +static_assert(offsetof(SharedFenceExportInfo, type) == + offsetof(WGPUSharedFenceExportInfo, type), + "offsetof mismatch for SharedFenceExportInfo::type"); + +// SharedFenceVkSemaphoreOpaqueFDDescriptor + +static_assert(sizeof(SharedFenceVkSemaphoreOpaqueFDDescriptor) == + sizeof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor), + "sizeof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor"); +static_assert(alignof(SharedFenceVkSemaphoreOpaqueFDDescriptor) == + alignof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor), + "alignof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor"); + +static_assert( + offsetof(SharedFenceVkSemaphoreOpaqueFDDescriptor, handle) == + offsetof(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor, handle), + "offsetof mismatch for SharedFenceVkSemaphoreOpaqueFDDescriptor::handle"); + +// SharedFenceVkSemaphoreOpaqueFDExportInfo + +static_assert(sizeof(SharedFenceVkSemaphoreOpaqueFDExportInfo) == + sizeof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo), + "sizeof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo"); +static_assert(alignof(SharedFenceVkSemaphoreOpaqueFDExportInfo) == + alignof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo), + "alignof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo"); + +static_assert( + offsetof(SharedFenceVkSemaphoreOpaqueFDExportInfo, handle) == + offsetof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo, handle), + "offsetof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo::handle"); + +// SharedFenceVkSemaphoreSyncFDDescriptor + +static_assert(sizeof(SharedFenceVkSemaphoreSyncFDDescriptor) == + sizeof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor), + "sizeof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor"); +static_assert(alignof(SharedFenceVkSemaphoreSyncFDDescriptor) == + alignof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor), + "alignof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor"); + +static_assert( + offsetof(SharedFenceVkSemaphoreSyncFDDescriptor, handle) == + offsetof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor, handle), + "offsetof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor::handle"); + +// SharedFenceVkSemaphoreSyncFDExportInfo + +static_assert(sizeof(SharedFenceVkSemaphoreSyncFDExportInfo) == + sizeof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo), + "sizeof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo"); +static_assert(alignof(SharedFenceVkSemaphoreSyncFDExportInfo) == + alignof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo), + "alignof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo"); + +static_assert( + offsetof(SharedFenceVkSemaphoreSyncFDExportInfo, handle) == + offsetof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo, handle), + "offsetof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo::handle"); + +// SharedFenceVkSemaphoreZirconHandleDescriptor + +static_assert( + sizeof(SharedFenceVkSemaphoreZirconHandleDescriptor) == + sizeof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor), + "sizeof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor"); +static_assert( + alignof(SharedFenceVkSemaphoreZirconHandleDescriptor) == + alignof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor), + "alignof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor"); + +static_assert(offsetof(SharedFenceVkSemaphoreZirconHandleDescriptor, handle) == + offsetof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor, + handle), + "offsetof mismatch for " + "SharedFenceVkSemaphoreZirconHandleDescriptor::handle"); + +// SharedFenceVkSemaphoreZirconHandleExportInfo + +static_assert( + sizeof(SharedFenceVkSemaphoreZirconHandleExportInfo) == + sizeof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo), + "sizeof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo"); +static_assert( + alignof(SharedFenceVkSemaphoreZirconHandleExportInfo) == + alignof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo), + "alignof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo"); + +static_assert(offsetof(SharedFenceVkSemaphoreZirconHandleExportInfo, handle) == + offsetof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo, + handle), + "offsetof mismatch for " + "SharedFenceVkSemaphoreZirconHandleExportInfo::handle"); + +// SharedTextureMemoryDXGISharedHandleDescriptor + +static_assert( + sizeof(SharedTextureMemoryDXGISharedHandleDescriptor) == + sizeof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor), + "sizeof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor"); +static_assert( + alignof(SharedTextureMemoryDXGISharedHandleDescriptor) == + alignof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor), + "alignof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor"); + +static_assert(offsetof(SharedTextureMemoryDXGISharedHandleDescriptor, handle) == + offsetof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, + handle), + "offsetof mismatch for " + "SharedTextureMemoryDXGISharedHandleDescriptor::handle"); +static_assert(offsetof(SharedTextureMemoryDXGISharedHandleDescriptor, + useKeyedMutex) == + offsetof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, + useKeyedMutex), + "offsetof mismatch for " + "SharedTextureMemoryDXGISharedHandleDescriptor::useKeyedMutex"); + +// SharedTextureMemoryEGLImageDescriptor + +static_assert(sizeof(SharedTextureMemoryEGLImageDescriptor) == + sizeof(WGPUSharedTextureMemoryEGLImageDescriptor), + "sizeof mismatch for SharedTextureMemoryEGLImageDescriptor"); +static_assert(alignof(SharedTextureMemoryEGLImageDescriptor) == + alignof(WGPUSharedTextureMemoryEGLImageDescriptor), + "alignof mismatch for SharedTextureMemoryEGLImageDescriptor"); + +static_assert( + offsetof(SharedTextureMemoryEGLImageDescriptor, image) == + offsetof(WGPUSharedTextureMemoryEGLImageDescriptor, image), + "offsetof mismatch for SharedTextureMemoryEGLImageDescriptor::image"); + +// SharedTextureMemoryIOSurfaceDescriptor + +static_assert(sizeof(SharedTextureMemoryIOSurfaceDescriptor) == + sizeof(WGPUSharedTextureMemoryIOSurfaceDescriptor), + "sizeof mismatch for SharedTextureMemoryIOSurfaceDescriptor"); +static_assert(alignof(SharedTextureMemoryIOSurfaceDescriptor) == + alignof(WGPUSharedTextureMemoryIOSurfaceDescriptor), + "alignof mismatch for SharedTextureMemoryIOSurfaceDescriptor"); + +static_assert( + offsetof(SharedTextureMemoryIOSurfaceDescriptor, ioSurface) == + offsetof(WGPUSharedTextureMemoryIOSurfaceDescriptor, ioSurface), + "offsetof mismatch for SharedTextureMemoryIOSurfaceDescriptor::ioSurface"); + +// SharedTextureMemoryAHardwareBufferDescriptor + +static_assert( + sizeof(SharedTextureMemoryAHardwareBufferDescriptor) == + sizeof(WGPUSharedTextureMemoryAHardwareBufferDescriptor), + "sizeof mismatch for SharedTextureMemoryAHardwareBufferDescriptor"); +static_assert( + alignof(SharedTextureMemoryAHardwareBufferDescriptor) == + alignof(WGPUSharedTextureMemoryAHardwareBufferDescriptor), + "alignof mismatch for SharedTextureMemoryAHardwareBufferDescriptor"); + +static_assert(offsetof(SharedTextureMemoryAHardwareBufferDescriptor, handle) == + offsetof(WGPUSharedTextureMemoryAHardwareBufferDescriptor, + handle), + "offsetof mismatch for " + "SharedTextureMemoryAHardwareBufferDescriptor::handle"); + +// SharedTextureMemoryBeginAccessDescriptor + +static_assert(sizeof(SharedTextureMemoryBeginAccessDescriptor) == + sizeof(WGPUSharedTextureMemoryBeginAccessDescriptor), + "sizeof mismatch for SharedTextureMemoryBeginAccessDescriptor"); +static_assert(alignof(SharedTextureMemoryBeginAccessDescriptor) == + alignof(WGPUSharedTextureMemoryBeginAccessDescriptor), + "alignof mismatch for SharedTextureMemoryBeginAccessDescriptor"); + +static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, nextInChain) == + offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, + nextInChain), + "offsetof mismatch for " + "SharedTextureMemoryBeginAccessDescriptor::nextInChain"); +static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, + concurrentRead) == + offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, + concurrentRead), + "offsetof mismatch for " + "SharedTextureMemoryBeginAccessDescriptor::concurrentRead"); +static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, initialized) == + offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, + initialized), + "offsetof mismatch for " + "SharedTextureMemoryBeginAccessDescriptor::initialized"); +static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, fenceCount) == + offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, + fenceCount), + "offsetof mismatch for " + "SharedTextureMemoryBeginAccessDescriptor::fenceCount"); +static_assert( + offsetof(SharedTextureMemoryBeginAccessDescriptor, fences) == + offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, fences), + "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::fences"); +static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, + signaledValues) == + offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, + signaledValues), + "offsetof mismatch for " + "SharedTextureMemoryBeginAccessDescriptor::signaledValues"); + +// SharedTextureMemoryDescriptor + +static_assert(sizeof(SharedTextureMemoryDescriptor) == + sizeof(WGPUSharedTextureMemoryDescriptor), + "sizeof mismatch for SharedTextureMemoryDescriptor"); +static_assert(alignof(SharedTextureMemoryDescriptor) == + alignof(WGPUSharedTextureMemoryDescriptor), + "alignof mismatch for SharedTextureMemoryDescriptor"); + +static_assert( + offsetof(SharedTextureMemoryDescriptor, nextInChain) == + offsetof(WGPUSharedTextureMemoryDescriptor, nextInChain), + "offsetof mismatch for SharedTextureMemoryDescriptor::nextInChain"); +static_assert(offsetof(SharedTextureMemoryDescriptor, label) == + offsetof(WGPUSharedTextureMemoryDescriptor, label), + "offsetof mismatch for SharedTextureMemoryDescriptor::label"); + +// SharedTextureMemoryDmaBufPlane + +static_assert(sizeof(SharedTextureMemoryDmaBufPlane) == + sizeof(WGPUSharedTextureMemoryDmaBufPlane), + "sizeof mismatch for SharedTextureMemoryDmaBufPlane"); +static_assert(alignof(SharedTextureMemoryDmaBufPlane) == + alignof(WGPUSharedTextureMemoryDmaBufPlane), + "alignof mismatch for SharedTextureMemoryDmaBufPlane"); + +static_assert(offsetof(SharedTextureMemoryDmaBufPlane, fd) == + offsetof(WGPUSharedTextureMemoryDmaBufPlane, fd), + "offsetof mismatch for SharedTextureMemoryDmaBufPlane::fd"); +static_assert(offsetof(SharedTextureMemoryDmaBufPlane, offset) == + offsetof(WGPUSharedTextureMemoryDmaBufPlane, offset), + "offsetof mismatch for SharedTextureMemoryDmaBufPlane::offset"); +static_assert(offsetof(SharedTextureMemoryDmaBufPlane, stride) == + offsetof(WGPUSharedTextureMemoryDmaBufPlane, stride), + "offsetof mismatch for SharedTextureMemoryDmaBufPlane::stride"); + +// SharedTextureMemoryEndAccessState + +static_assert(sizeof(SharedTextureMemoryEndAccessState) == + sizeof(WGPUSharedTextureMemoryEndAccessState), + "sizeof mismatch for SharedTextureMemoryEndAccessState"); +static_assert(alignof(SharedTextureMemoryEndAccessState) == + alignof(WGPUSharedTextureMemoryEndAccessState), + "alignof mismatch for SharedTextureMemoryEndAccessState"); + +static_assert( + offsetof(SharedTextureMemoryEndAccessState, nextInChain) == + offsetof(WGPUSharedTextureMemoryEndAccessState, nextInChain), + "offsetof mismatch for SharedTextureMemoryEndAccessState::nextInChain"); +static_assert( + offsetof(SharedTextureMemoryEndAccessState, initialized) == + offsetof(WGPUSharedTextureMemoryEndAccessState, initialized), + "offsetof mismatch for SharedTextureMemoryEndAccessState::initialized"); +static_assert( + offsetof(SharedTextureMemoryEndAccessState, fenceCount) == + offsetof(WGPUSharedTextureMemoryEndAccessState, fenceCount), + "offsetof mismatch for SharedTextureMemoryEndAccessState::fenceCount"); +static_assert( + offsetof(SharedTextureMemoryEndAccessState, fences) == + offsetof(WGPUSharedTextureMemoryEndAccessState, fences), + "offsetof mismatch for SharedTextureMemoryEndAccessState::fences"); +static_assert( + offsetof(SharedTextureMemoryEndAccessState, signaledValues) == + offsetof(WGPUSharedTextureMemoryEndAccessState, signaledValues), + "offsetof mismatch for SharedTextureMemoryEndAccessState::signaledValues"); + +// SharedTextureMemoryOpaqueFDDescriptor + +static_assert(sizeof(SharedTextureMemoryOpaqueFDDescriptor) == + sizeof(WGPUSharedTextureMemoryOpaqueFDDescriptor), + "sizeof mismatch for SharedTextureMemoryOpaqueFDDescriptor"); +static_assert(alignof(SharedTextureMemoryOpaqueFDDescriptor) == + alignof(WGPUSharedTextureMemoryOpaqueFDDescriptor), + "alignof mismatch for SharedTextureMemoryOpaqueFDDescriptor"); + +static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, + vkImageCreateInfo) == + offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, + vkImageCreateInfo), + "offsetof mismatch for " + "SharedTextureMemoryOpaqueFDDescriptor::vkImageCreateInfo"); +static_assert( + offsetof(SharedTextureMemoryOpaqueFDDescriptor, memoryFD) == + offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, memoryFD), + "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::memoryFD"); +static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, + memoryTypeIndex) == + offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, + memoryTypeIndex), + "offsetof mismatch for " + "SharedTextureMemoryOpaqueFDDescriptor::memoryTypeIndex"); +static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, allocationSize) == + offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, + allocationSize), + "offsetof mismatch for " + "SharedTextureMemoryOpaqueFDDescriptor::allocationSize"); +static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, + dedicatedAllocation) == + offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, + dedicatedAllocation), + "offsetof mismatch for " + "SharedTextureMemoryOpaqueFDDescriptor::dedicatedAllocation"); + +// SharedTextureMemoryVkDedicatedAllocationDescriptor + +static_assert( + sizeof(SharedTextureMemoryVkDedicatedAllocationDescriptor) == + sizeof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor), + "sizeof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor"); +static_assert( + alignof(SharedTextureMemoryVkDedicatedAllocationDescriptor) == + alignof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor), + "alignof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor"); + +static_assert( + offsetof(SharedTextureMemoryVkDedicatedAllocationDescriptor, + dedicatedAllocation) == + offsetof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor, + dedicatedAllocation), + "offsetof mismatch for " + "SharedTextureMemoryVkDedicatedAllocationDescriptor::dedicatedAllocation"); + +// SharedTextureMemoryVkImageLayoutBeginState + +static_assert(sizeof(SharedTextureMemoryVkImageLayoutBeginState) == + sizeof(WGPUSharedTextureMemoryVkImageLayoutBeginState), + "sizeof mismatch for SharedTextureMemoryVkImageLayoutBeginState"); +static_assert( + alignof(SharedTextureMemoryVkImageLayoutBeginState) == + alignof(WGPUSharedTextureMemoryVkImageLayoutBeginState), + "alignof mismatch for SharedTextureMemoryVkImageLayoutBeginState"); + +static_assert(offsetof(SharedTextureMemoryVkImageLayoutBeginState, oldLayout) == + offsetof(WGPUSharedTextureMemoryVkImageLayoutBeginState, + oldLayout), + "offsetof mismatch for " + "SharedTextureMemoryVkImageLayoutBeginState::oldLayout"); +static_assert(offsetof(SharedTextureMemoryVkImageLayoutBeginState, newLayout) == + offsetof(WGPUSharedTextureMemoryVkImageLayoutBeginState, + newLayout), + "offsetof mismatch for " + "SharedTextureMemoryVkImageLayoutBeginState::newLayout"); + +// SharedTextureMemoryVkImageLayoutEndState + +static_assert(sizeof(SharedTextureMemoryVkImageLayoutEndState) == + sizeof(WGPUSharedTextureMemoryVkImageLayoutEndState), + "sizeof mismatch for SharedTextureMemoryVkImageLayoutEndState"); +static_assert(alignof(SharedTextureMemoryVkImageLayoutEndState) == + alignof(WGPUSharedTextureMemoryVkImageLayoutEndState), + "alignof mismatch for SharedTextureMemoryVkImageLayoutEndState"); + +static_assert(offsetof(SharedTextureMemoryVkImageLayoutEndState, oldLayout) == + offsetof(WGPUSharedTextureMemoryVkImageLayoutEndState, + oldLayout), + "offsetof mismatch for " + "SharedTextureMemoryVkImageLayoutEndState::oldLayout"); +static_assert(offsetof(SharedTextureMemoryVkImageLayoutEndState, newLayout) == + offsetof(WGPUSharedTextureMemoryVkImageLayoutEndState, + newLayout), + "offsetof mismatch for " + "SharedTextureMemoryVkImageLayoutEndState::newLayout"); + +// SharedTextureMemoryZirconHandleDescriptor + +static_assert(sizeof(SharedTextureMemoryZirconHandleDescriptor) == + sizeof(WGPUSharedTextureMemoryZirconHandleDescriptor), + "sizeof mismatch for SharedTextureMemoryZirconHandleDescriptor"); +static_assert(alignof(SharedTextureMemoryZirconHandleDescriptor) == + alignof(WGPUSharedTextureMemoryZirconHandleDescriptor), + "alignof mismatch for SharedTextureMemoryZirconHandleDescriptor"); + +static_assert(offsetof(SharedTextureMemoryZirconHandleDescriptor, memoryFD) == + offsetof(WGPUSharedTextureMemoryZirconHandleDescriptor, + memoryFD), + "offsetof mismatch for " + "SharedTextureMemoryZirconHandleDescriptor::memoryFD"); +static_assert(offsetof(SharedTextureMemoryZirconHandleDescriptor, + allocationSize) == + offsetof(WGPUSharedTextureMemoryZirconHandleDescriptor, + allocationSize), + "offsetof mismatch for " + "SharedTextureMemoryZirconHandleDescriptor::allocationSize"); + +// StaticSamplerBindingLayout + +static_assert(sizeof(StaticSamplerBindingLayout) == + sizeof(WGPUStaticSamplerBindingLayout), + "sizeof mismatch for StaticSamplerBindingLayout"); +static_assert(alignof(StaticSamplerBindingLayout) == + alignof(WGPUStaticSamplerBindingLayout), + "alignof mismatch for StaticSamplerBindingLayout"); + +static_assert(offsetof(StaticSamplerBindingLayout, sampler) == + offsetof(WGPUStaticSamplerBindingLayout, sampler), + "offsetof mismatch for StaticSamplerBindingLayout::sampler"); + +// StencilFaceState + +static_assert(sizeof(StencilFaceState) == sizeof(WGPUStencilFaceState), + "sizeof mismatch for StencilFaceState"); +static_assert(alignof(StencilFaceState) == alignof(WGPUStencilFaceState), + "alignof mismatch for StencilFaceState"); + +static_assert(offsetof(StencilFaceState, compare) == + offsetof(WGPUStencilFaceState, compare), + "offsetof mismatch for StencilFaceState::compare"); +static_assert(offsetof(StencilFaceState, failOp) == + offsetof(WGPUStencilFaceState, failOp), + "offsetof mismatch for StencilFaceState::failOp"); +static_assert(offsetof(StencilFaceState, depthFailOp) == + offsetof(WGPUStencilFaceState, depthFailOp), + "offsetof mismatch for StencilFaceState::depthFailOp"); +static_assert(offsetof(StencilFaceState, passOp) == + offsetof(WGPUStencilFaceState, passOp), + "offsetof mismatch for StencilFaceState::passOp"); + +// StorageTextureBindingLayout + +static_assert(sizeof(StorageTextureBindingLayout) == + sizeof(WGPUStorageTextureBindingLayout), + "sizeof mismatch for StorageTextureBindingLayout"); +static_assert(alignof(StorageTextureBindingLayout) == + alignof(WGPUStorageTextureBindingLayout), + "alignof mismatch for StorageTextureBindingLayout"); + +static_assert(offsetof(StorageTextureBindingLayout, nextInChain) == + offsetof(WGPUStorageTextureBindingLayout, nextInChain), + "offsetof mismatch for StorageTextureBindingLayout::nextInChain"); +static_assert(offsetof(StorageTextureBindingLayout, access) == + offsetof(WGPUStorageTextureBindingLayout, access), + "offsetof mismatch for StorageTextureBindingLayout::access"); +static_assert(offsetof(StorageTextureBindingLayout, format) == + offsetof(WGPUStorageTextureBindingLayout, format), + "offsetof mismatch for StorageTextureBindingLayout::format"); +static_assert( + offsetof(StorageTextureBindingLayout, viewDimension) == + offsetof(WGPUStorageTextureBindingLayout, viewDimension), + "offsetof mismatch for StorageTextureBindingLayout::viewDimension"); + +// SurfaceDescriptor + +static_assert(sizeof(SurfaceDescriptor) == sizeof(WGPUSurfaceDescriptor), + "sizeof mismatch for SurfaceDescriptor"); +static_assert(alignof(SurfaceDescriptor) == alignof(WGPUSurfaceDescriptor), + "alignof mismatch for SurfaceDescriptor"); + +static_assert(offsetof(SurfaceDescriptor, nextInChain) == + offsetof(WGPUSurfaceDescriptor, nextInChain), + "offsetof mismatch for SurfaceDescriptor::nextInChain"); +static_assert(offsetof(SurfaceDescriptor, label) == + offsetof(WGPUSurfaceDescriptor, label), + "offsetof mismatch for SurfaceDescriptor::label"); + +// SurfaceDescriptorFromAndroidNativeWindow + +static_assert(sizeof(SurfaceDescriptorFromAndroidNativeWindow) == + sizeof(WGPUSurfaceDescriptorFromAndroidNativeWindow), + "sizeof mismatch for SurfaceDescriptorFromAndroidNativeWindow"); +static_assert(alignof(SurfaceDescriptorFromAndroidNativeWindow) == + alignof(WGPUSurfaceDescriptorFromAndroidNativeWindow), + "alignof mismatch for SurfaceDescriptorFromAndroidNativeWindow"); + +static_assert( + offsetof(SurfaceDescriptorFromAndroidNativeWindow, window) == + offsetof(WGPUSurfaceDescriptorFromAndroidNativeWindow, window), + "offsetof mismatch for SurfaceDescriptorFromAndroidNativeWindow::window"); + +// SurfaceDescriptorFromCanvasHTMLSelector + +static_assert(sizeof(SurfaceDescriptorFromCanvasHTMLSelector) == + sizeof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), + "sizeof mismatch for SurfaceDescriptorFromCanvasHTMLSelector"); +static_assert(alignof(SurfaceDescriptorFromCanvasHTMLSelector) == + alignof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), + "alignof mismatch for SurfaceDescriptorFromCanvasHTMLSelector"); + +static_assert( + offsetof(SurfaceDescriptorFromCanvasHTMLSelector, selector) == + offsetof(WGPUSurfaceDescriptorFromCanvasHTMLSelector, selector), + "offsetof mismatch for SurfaceDescriptorFromCanvasHTMLSelector::selector"); + +// SurfaceDescriptorFromMetalLayer + +static_assert(sizeof(SurfaceDescriptorFromMetalLayer) == + sizeof(WGPUSurfaceDescriptorFromMetalLayer), + "sizeof mismatch for SurfaceDescriptorFromMetalLayer"); +static_assert(alignof(SurfaceDescriptorFromMetalLayer) == + alignof(WGPUSurfaceDescriptorFromMetalLayer), + "alignof mismatch for SurfaceDescriptorFromMetalLayer"); + +static_assert(offsetof(SurfaceDescriptorFromMetalLayer, layer) == + offsetof(WGPUSurfaceDescriptorFromMetalLayer, layer), + "offsetof mismatch for SurfaceDescriptorFromMetalLayer::layer"); + +// SurfaceDescriptorFromWaylandSurface + +static_assert(sizeof(SurfaceDescriptorFromWaylandSurface) == + sizeof(WGPUSurfaceDescriptorFromWaylandSurface), + "sizeof mismatch for SurfaceDescriptorFromWaylandSurface"); +static_assert(alignof(SurfaceDescriptorFromWaylandSurface) == + alignof(WGPUSurfaceDescriptorFromWaylandSurface), + "alignof mismatch for SurfaceDescriptorFromWaylandSurface"); + +static_assert( + offsetof(SurfaceDescriptorFromWaylandSurface, display) == + offsetof(WGPUSurfaceDescriptorFromWaylandSurface, display), + "offsetof mismatch for SurfaceDescriptorFromWaylandSurface::display"); +static_assert( + offsetof(SurfaceDescriptorFromWaylandSurface, surface) == + offsetof(WGPUSurfaceDescriptorFromWaylandSurface, surface), + "offsetof mismatch for SurfaceDescriptorFromWaylandSurface::surface"); + +// SurfaceDescriptorFromWindowsHWND + +static_assert(sizeof(SurfaceDescriptorFromWindowsHWND) == + sizeof(WGPUSurfaceDescriptorFromWindowsHWND), + "sizeof mismatch for SurfaceDescriptorFromWindowsHWND"); +static_assert(alignof(SurfaceDescriptorFromWindowsHWND) == + alignof(WGPUSurfaceDescriptorFromWindowsHWND), + "alignof mismatch for SurfaceDescriptorFromWindowsHWND"); + +static_assert( + offsetof(SurfaceDescriptorFromWindowsHWND, hinstance) == + offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hinstance), + "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hinstance"); +static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hwnd) == + offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hwnd), + "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hwnd"); + +// SurfaceDescriptorFromWindowsCoreWindow + +static_assert(sizeof(SurfaceDescriptorFromWindowsCoreWindow) == + sizeof(WGPUSurfaceDescriptorFromWindowsCoreWindow), + "sizeof mismatch for SurfaceDescriptorFromWindowsCoreWindow"); +static_assert(alignof(SurfaceDescriptorFromWindowsCoreWindow) == + alignof(WGPUSurfaceDescriptorFromWindowsCoreWindow), + "alignof mismatch for SurfaceDescriptorFromWindowsCoreWindow"); + +static_assert( + offsetof(SurfaceDescriptorFromWindowsCoreWindow, coreWindow) == + offsetof(WGPUSurfaceDescriptorFromWindowsCoreWindow, coreWindow), + "offsetof mismatch for SurfaceDescriptorFromWindowsCoreWindow::coreWindow"); + +// SurfaceDescriptorFromWindowsSwapChainPanel + +static_assert(sizeof(SurfaceDescriptorFromWindowsSwapChainPanel) == + sizeof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel), + "sizeof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel"); +static_assert( + alignof(SurfaceDescriptorFromWindowsSwapChainPanel) == + alignof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel), + "alignof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel"); + +static_assert(offsetof(SurfaceDescriptorFromWindowsSwapChainPanel, + swapChainPanel) == + offsetof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel, + swapChainPanel), + "offsetof mismatch for " + "SurfaceDescriptorFromWindowsSwapChainPanel::swapChainPanel"); + +// SurfaceDescriptorFromXlibWindow + +static_assert(sizeof(SurfaceDescriptorFromXlibWindow) == + sizeof(WGPUSurfaceDescriptorFromXlibWindow), + "sizeof mismatch for SurfaceDescriptorFromXlibWindow"); +static_assert(alignof(SurfaceDescriptorFromXlibWindow) == + alignof(WGPUSurfaceDescriptorFromXlibWindow), + "alignof mismatch for SurfaceDescriptorFromXlibWindow"); + +static_assert(offsetof(SurfaceDescriptorFromXlibWindow, display) == + offsetof(WGPUSurfaceDescriptorFromXlibWindow, display), + "offsetof mismatch for SurfaceDescriptorFromXlibWindow::display"); +static_assert(offsetof(SurfaceDescriptorFromXlibWindow, window) == + offsetof(WGPUSurfaceDescriptorFromXlibWindow, window), + "offsetof mismatch for SurfaceDescriptorFromXlibWindow::window"); + +// SwapChainDescriptor + +static_assert(sizeof(SwapChainDescriptor) == sizeof(WGPUSwapChainDescriptor), + "sizeof mismatch for SwapChainDescriptor"); +static_assert(alignof(SwapChainDescriptor) == alignof(WGPUSwapChainDescriptor), + "alignof mismatch for SwapChainDescriptor"); + +static_assert(offsetof(SwapChainDescriptor, nextInChain) == + offsetof(WGPUSwapChainDescriptor, nextInChain), + "offsetof mismatch for SwapChainDescriptor::nextInChain"); +static_assert(offsetof(SwapChainDescriptor, label) == + offsetof(WGPUSwapChainDescriptor, label), + "offsetof mismatch for SwapChainDescriptor::label"); +static_assert(offsetof(SwapChainDescriptor, usage) == + offsetof(WGPUSwapChainDescriptor, usage), + "offsetof mismatch for SwapChainDescriptor::usage"); +static_assert(offsetof(SwapChainDescriptor, format) == + offsetof(WGPUSwapChainDescriptor, format), + "offsetof mismatch for SwapChainDescriptor::format"); +static_assert(offsetof(SwapChainDescriptor, width) == + offsetof(WGPUSwapChainDescriptor, width), + "offsetof mismatch for SwapChainDescriptor::width"); +static_assert(offsetof(SwapChainDescriptor, height) == + offsetof(WGPUSwapChainDescriptor, height), + "offsetof mismatch for SwapChainDescriptor::height"); +static_assert(offsetof(SwapChainDescriptor, presentMode) == + offsetof(WGPUSwapChainDescriptor, presentMode), + "offsetof mismatch for SwapChainDescriptor::presentMode"); + +// TextureBindingLayout + +static_assert(sizeof(TextureBindingLayout) == sizeof(WGPUTextureBindingLayout), + "sizeof mismatch for TextureBindingLayout"); +static_assert(alignof(TextureBindingLayout) == + alignof(WGPUTextureBindingLayout), + "alignof mismatch for TextureBindingLayout"); + +static_assert(offsetof(TextureBindingLayout, nextInChain) == + offsetof(WGPUTextureBindingLayout, nextInChain), + "offsetof mismatch for TextureBindingLayout::nextInChain"); +static_assert(offsetof(TextureBindingLayout, sampleType) == + offsetof(WGPUTextureBindingLayout, sampleType), + "offsetof mismatch for TextureBindingLayout::sampleType"); +static_assert(offsetof(TextureBindingLayout, viewDimension) == + offsetof(WGPUTextureBindingLayout, viewDimension), + "offsetof mismatch for TextureBindingLayout::viewDimension"); +static_assert(offsetof(TextureBindingLayout, multisampled) == + offsetof(WGPUTextureBindingLayout, multisampled), + "offsetof mismatch for TextureBindingLayout::multisampled"); + +// TextureBindingViewDimensionDescriptor + +static_assert(sizeof(TextureBindingViewDimensionDescriptor) == + sizeof(WGPUTextureBindingViewDimensionDescriptor), + "sizeof mismatch for TextureBindingViewDimensionDescriptor"); +static_assert(alignof(TextureBindingViewDimensionDescriptor) == + alignof(WGPUTextureBindingViewDimensionDescriptor), + "alignof mismatch for TextureBindingViewDimensionDescriptor"); + +static_assert( + offsetof(TextureBindingViewDimensionDescriptor, + textureBindingViewDimension) == + offsetof(WGPUTextureBindingViewDimensionDescriptor, + textureBindingViewDimension), + "offsetof mismatch for " + "TextureBindingViewDimensionDescriptor::textureBindingViewDimension"); + +// TextureDataLayout + +static_assert(sizeof(TextureDataLayout) == sizeof(WGPUTextureDataLayout), + "sizeof mismatch for TextureDataLayout"); +static_assert(alignof(TextureDataLayout) == alignof(WGPUTextureDataLayout), + "alignof mismatch for TextureDataLayout"); + +static_assert(offsetof(TextureDataLayout, nextInChain) == + offsetof(WGPUTextureDataLayout, nextInChain), + "offsetof mismatch for TextureDataLayout::nextInChain"); +static_assert(offsetof(TextureDataLayout, offset) == + offsetof(WGPUTextureDataLayout, offset), + "offsetof mismatch for TextureDataLayout::offset"); +static_assert(offsetof(TextureDataLayout, bytesPerRow) == + offsetof(WGPUTextureDataLayout, bytesPerRow), + "offsetof mismatch for TextureDataLayout::bytesPerRow"); +static_assert(offsetof(TextureDataLayout, rowsPerImage) == + offsetof(WGPUTextureDataLayout, rowsPerImage), + "offsetof mismatch for TextureDataLayout::rowsPerImage"); + +// TextureViewDescriptor + +static_assert(sizeof(TextureViewDescriptor) == + sizeof(WGPUTextureViewDescriptor), + "sizeof mismatch for TextureViewDescriptor"); +static_assert(alignof(TextureViewDescriptor) == + alignof(WGPUTextureViewDescriptor), + "alignof mismatch for TextureViewDescriptor"); + +static_assert(offsetof(TextureViewDescriptor, nextInChain) == + offsetof(WGPUTextureViewDescriptor, nextInChain), + "offsetof mismatch for TextureViewDescriptor::nextInChain"); +static_assert(offsetof(TextureViewDescriptor, label) == + offsetof(WGPUTextureViewDescriptor, label), + "offsetof mismatch for TextureViewDescriptor::label"); +static_assert(offsetof(TextureViewDescriptor, format) == + offsetof(WGPUTextureViewDescriptor, format), + "offsetof mismatch for TextureViewDescriptor::format"); +static_assert(offsetof(TextureViewDescriptor, dimension) == + offsetof(WGPUTextureViewDescriptor, dimension), + "offsetof mismatch for TextureViewDescriptor::dimension"); +static_assert(offsetof(TextureViewDescriptor, baseMipLevel) == + offsetof(WGPUTextureViewDescriptor, baseMipLevel), + "offsetof mismatch for TextureViewDescriptor::baseMipLevel"); +static_assert(offsetof(TextureViewDescriptor, mipLevelCount) == + offsetof(WGPUTextureViewDescriptor, mipLevelCount), + "offsetof mismatch for TextureViewDescriptor::mipLevelCount"); +static_assert(offsetof(TextureViewDescriptor, baseArrayLayer) == + offsetof(WGPUTextureViewDescriptor, baseArrayLayer), + "offsetof mismatch for TextureViewDescriptor::baseArrayLayer"); +static_assert(offsetof(TextureViewDescriptor, arrayLayerCount) == + offsetof(WGPUTextureViewDescriptor, arrayLayerCount), + "offsetof mismatch for TextureViewDescriptor::arrayLayerCount"); +static_assert(offsetof(TextureViewDescriptor, aspect) == + offsetof(WGPUTextureViewDescriptor, aspect), + "offsetof mismatch for TextureViewDescriptor::aspect"); + +// VertexAttribute + +static_assert(sizeof(VertexAttribute) == sizeof(WGPUVertexAttribute), + "sizeof mismatch for VertexAttribute"); +static_assert(alignof(VertexAttribute) == alignof(WGPUVertexAttribute), + "alignof mismatch for VertexAttribute"); + +static_assert(offsetof(VertexAttribute, format) == + offsetof(WGPUVertexAttribute, format), + "offsetof mismatch for VertexAttribute::format"); +static_assert(offsetof(VertexAttribute, offset) == + offsetof(WGPUVertexAttribute, offset), + "offsetof mismatch for VertexAttribute::offset"); +static_assert(offsetof(VertexAttribute, shaderLocation) == + offsetof(WGPUVertexAttribute, shaderLocation), + "offsetof mismatch for VertexAttribute::shaderLocation"); + +// AdapterPropertiesMemoryHeaps + +static_assert(sizeof(AdapterPropertiesMemoryHeaps) == + sizeof(WGPUAdapterPropertiesMemoryHeaps), + "sizeof mismatch for AdapterPropertiesMemoryHeaps"); +static_assert(alignof(AdapterPropertiesMemoryHeaps) == + alignof(WGPUAdapterPropertiesMemoryHeaps), + "alignof mismatch for AdapterPropertiesMemoryHeaps"); + +static_assert(offsetof(AdapterPropertiesMemoryHeaps, heapCount) == + offsetof(WGPUAdapterPropertiesMemoryHeaps, heapCount), + "offsetof mismatch for AdapterPropertiesMemoryHeaps::heapCount"); +static_assert(offsetof(AdapterPropertiesMemoryHeaps, heapInfo) == + offsetof(WGPUAdapterPropertiesMemoryHeaps, heapInfo), + "offsetof mismatch for AdapterPropertiesMemoryHeaps::heapInfo"); + +// BindGroupDescriptor + +static_assert(sizeof(BindGroupDescriptor) == sizeof(WGPUBindGroupDescriptor), + "sizeof mismatch for BindGroupDescriptor"); +static_assert(alignof(BindGroupDescriptor) == alignof(WGPUBindGroupDescriptor), + "alignof mismatch for BindGroupDescriptor"); + +static_assert(offsetof(BindGroupDescriptor, nextInChain) == + offsetof(WGPUBindGroupDescriptor, nextInChain), + "offsetof mismatch for BindGroupDescriptor::nextInChain"); +static_assert(offsetof(BindGroupDescriptor, label) == + offsetof(WGPUBindGroupDescriptor, label), + "offsetof mismatch for BindGroupDescriptor::label"); +static_assert(offsetof(BindGroupDescriptor, layout) == + offsetof(WGPUBindGroupDescriptor, layout), + "offsetof mismatch for BindGroupDescriptor::layout"); +static_assert(offsetof(BindGroupDescriptor, entryCount) == + offsetof(WGPUBindGroupDescriptor, entryCount), + "offsetof mismatch for BindGroupDescriptor::entryCount"); +static_assert(offsetof(BindGroupDescriptor, entries) == + offsetof(WGPUBindGroupDescriptor, entries), + "offsetof mismatch for BindGroupDescriptor::entries"); + +// BindGroupLayoutEntry + +static_assert(sizeof(BindGroupLayoutEntry) == sizeof(WGPUBindGroupLayoutEntry), + "sizeof mismatch for BindGroupLayoutEntry"); +static_assert(alignof(BindGroupLayoutEntry) == + alignof(WGPUBindGroupLayoutEntry), + "alignof mismatch for BindGroupLayoutEntry"); + +static_assert(offsetof(BindGroupLayoutEntry, nextInChain) == + offsetof(WGPUBindGroupLayoutEntry, nextInChain), + "offsetof mismatch for BindGroupLayoutEntry::nextInChain"); +static_assert(offsetof(BindGroupLayoutEntry, binding) == + offsetof(WGPUBindGroupLayoutEntry, binding), + "offsetof mismatch for BindGroupLayoutEntry::binding"); +static_assert(offsetof(BindGroupLayoutEntry, visibility) == + offsetof(WGPUBindGroupLayoutEntry, visibility), + "offsetof mismatch for BindGroupLayoutEntry::visibility"); +static_assert(offsetof(BindGroupLayoutEntry, buffer) == + offsetof(WGPUBindGroupLayoutEntry, buffer), + "offsetof mismatch for BindGroupLayoutEntry::buffer"); +static_assert(offsetof(BindGroupLayoutEntry, sampler) == + offsetof(WGPUBindGroupLayoutEntry, sampler), + "offsetof mismatch for BindGroupLayoutEntry::sampler"); +static_assert(offsetof(BindGroupLayoutEntry, texture) == + offsetof(WGPUBindGroupLayoutEntry, texture), + "offsetof mismatch for BindGroupLayoutEntry::texture"); +static_assert(offsetof(BindGroupLayoutEntry, storageTexture) == + offsetof(WGPUBindGroupLayoutEntry, storageTexture), + "offsetof mismatch for BindGroupLayoutEntry::storageTexture"); + +// BlendState + +static_assert(sizeof(BlendState) == sizeof(WGPUBlendState), + "sizeof mismatch for BlendState"); +static_assert(alignof(BlendState) == alignof(WGPUBlendState), + "alignof mismatch for BlendState"); + +static_assert(offsetof(BlendState, color) == offsetof(WGPUBlendState, color), + "offsetof mismatch for BlendState::color"); +static_assert(offsetof(BlendState, alpha) == offsetof(WGPUBlendState, alpha), + "offsetof mismatch for BlendState::alpha"); + +// CompilationInfo + +static_assert(sizeof(CompilationInfo) == sizeof(WGPUCompilationInfo), + "sizeof mismatch for CompilationInfo"); +static_assert(alignof(CompilationInfo) == alignof(WGPUCompilationInfo), + "alignof mismatch for CompilationInfo"); + +static_assert(offsetof(CompilationInfo, nextInChain) == + offsetof(WGPUCompilationInfo, nextInChain), + "offsetof mismatch for CompilationInfo::nextInChain"); +static_assert(offsetof(CompilationInfo, messageCount) == + offsetof(WGPUCompilationInfo, messageCount), + "offsetof mismatch for CompilationInfo::messageCount"); +static_assert(offsetof(CompilationInfo, messages) == + offsetof(WGPUCompilationInfo, messages), + "offsetof mismatch for CompilationInfo::messages"); + +// ComputePassDescriptor + +static_assert(sizeof(ComputePassDescriptor) == + sizeof(WGPUComputePassDescriptor), + "sizeof mismatch for ComputePassDescriptor"); +static_assert(alignof(ComputePassDescriptor) == + alignof(WGPUComputePassDescriptor), + "alignof mismatch for ComputePassDescriptor"); + +static_assert(offsetof(ComputePassDescriptor, nextInChain) == + offsetof(WGPUComputePassDescriptor, nextInChain), + "offsetof mismatch for ComputePassDescriptor::nextInChain"); +static_assert(offsetof(ComputePassDescriptor, label) == + offsetof(WGPUComputePassDescriptor, label), + "offsetof mismatch for ComputePassDescriptor::label"); +static_assert(offsetof(ComputePassDescriptor, timestampWrites) == + offsetof(WGPUComputePassDescriptor, timestampWrites), + "offsetof mismatch for ComputePassDescriptor::timestampWrites"); + +// DepthStencilState + +static_assert(sizeof(DepthStencilState) == sizeof(WGPUDepthStencilState), + "sizeof mismatch for DepthStencilState"); +static_assert(alignof(DepthStencilState) == alignof(WGPUDepthStencilState), + "alignof mismatch for DepthStencilState"); + +static_assert(offsetof(DepthStencilState, nextInChain) == + offsetof(WGPUDepthStencilState, nextInChain), + "offsetof mismatch for DepthStencilState::nextInChain"); +static_assert(offsetof(DepthStencilState, format) == + offsetof(WGPUDepthStencilState, format), + "offsetof mismatch for DepthStencilState::format"); +static_assert(offsetof(DepthStencilState, depthWriteEnabled) == + offsetof(WGPUDepthStencilState, depthWriteEnabled), + "offsetof mismatch for DepthStencilState::depthWriteEnabled"); +static_assert(offsetof(DepthStencilState, depthCompare) == + offsetof(WGPUDepthStencilState, depthCompare), + "offsetof mismatch for DepthStencilState::depthCompare"); +static_assert(offsetof(DepthStencilState, stencilFront) == + offsetof(WGPUDepthStencilState, stencilFront), + "offsetof mismatch for DepthStencilState::stencilFront"); +static_assert(offsetof(DepthStencilState, stencilBack) == + offsetof(WGPUDepthStencilState, stencilBack), + "offsetof mismatch for DepthStencilState::stencilBack"); +static_assert(offsetof(DepthStencilState, stencilReadMask) == + offsetof(WGPUDepthStencilState, stencilReadMask), + "offsetof mismatch for DepthStencilState::stencilReadMask"); +static_assert(offsetof(DepthStencilState, stencilWriteMask) == + offsetof(WGPUDepthStencilState, stencilWriteMask), + "offsetof mismatch for DepthStencilState::stencilWriteMask"); +static_assert(offsetof(DepthStencilState, depthBias) == + offsetof(WGPUDepthStencilState, depthBias), + "offsetof mismatch for DepthStencilState::depthBias"); +static_assert(offsetof(DepthStencilState, depthBiasSlopeScale) == + offsetof(WGPUDepthStencilState, depthBiasSlopeScale), + "offsetof mismatch for DepthStencilState::depthBiasSlopeScale"); +static_assert(offsetof(DepthStencilState, depthBiasClamp) == + offsetof(WGPUDepthStencilState, depthBiasClamp), + "offsetof mismatch for DepthStencilState::depthBiasClamp"); + +// DrmFormatCapabilities + +static_assert(sizeof(DrmFormatCapabilities) == + sizeof(WGPUDrmFormatCapabilities), + "sizeof mismatch for DrmFormatCapabilities"); +static_assert(alignof(DrmFormatCapabilities) == + alignof(WGPUDrmFormatCapabilities), + "alignof mismatch for DrmFormatCapabilities"); + +static_assert(offsetof(DrmFormatCapabilities, propertiesCount) == + offsetof(WGPUDrmFormatCapabilities, propertiesCount), + "offsetof mismatch for DrmFormatCapabilities::propertiesCount"); +static_assert(offsetof(DrmFormatCapabilities, properties) == + offsetof(WGPUDrmFormatCapabilities, properties), + "offsetof mismatch for DrmFormatCapabilities::properties"); + +// ExternalTextureDescriptor + +static_assert(sizeof(ExternalTextureDescriptor) == + sizeof(WGPUExternalTextureDescriptor), + "sizeof mismatch for ExternalTextureDescriptor"); +static_assert(alignof(ExternalTextureDescriptor) == + alignof(WGPUExternalTextureDescriptor), + "alignof mismatch for ExternalTextureDescriptor"); + +static_assert(offsetof(ExternalTextureDescriptor, nextInChain) == + offsetof(WGPUExternalTextureDescriptor, nextInChain), + "offsetof mismatch for ExternalTextureDescriptor::nextInChain"); +static_assert(offsetof(ExternalTextureDescriptor, label) == + offsetof(WGPUExternalTextureDescriptor, label), + "offsetof mismatch for ExternalTextureDescriptor::label"); +static_assert(offsetof(ExternalTextureDescriptor, plane0) == + offsetof(WGPUExternalTextureDescriptor, plane0), + "offsetof mismatch for ExternalTextureDescriptor::plane0"); +static_assert(offsetof(ExternalTextureDescriptor, plane1) == + offsetof(WGPUExternalTextureDescriptor, plane1), + "offsetof mismatch for ExternalTextureDescriptor::plane1"); +static_assert(offsetof(ExternalTextureDescriptor, visibleOrigin) == + offsetof(WGPUExternalTextureDescriptor, visibleOrigin), + "offsetof mismatch for ExternalTextureDescriptor::visibleOrigin"); +static_assert(offsetof(ExternalTextureDescriptor, visibleSize) == + offsetof(WGPUExternalTextureDescriptor, visibleSize), + "offsetof mismatch for ExternalTextureDescriptor::visibleSize"); +static_assert(offsetof(ExternalTextureDescriptor, doYuvToRgbConversionOnly) == + offsetof(WGPUExternalTextureDescriptor, + doYuvToRgbConversionOnly), + "offsetof mismatch for " + "ExternalTextureDescriptor::doYuvToRgbConversionOnly"); +static_assert(offsetof(ExternalTextureDescriptor, yuvToRgbConversionMatrix) == + offsetof(WGPUExternalTextureDescriptor, + yuvToRgbConversionMatrix), + "offsetof mismatch for " + "ExternalTextureDescriptor::yuvToRgbConversionMatrix"); +static_assert(offsetof(ExternalTextureDescriptor, + srcTransferFunctionParameters) == + offsetof(WGPUExternalTextureDescriptor, + srcTransferFunctionParameters), + "offsetof mismatch for " + "ExternalTextureDescriptor::srcTransferFunctionParameters"); +static_assert(offsetof(ExternalTextureDescriptor, + dstTransferFunctionParameters) == + offsetof(WGPUExternalTextureDescriptor, + dstTransferFunctionParameters), + "offsetof mismatch for " + "ExternalTextureDescriptor::dstTransferFunctionParameters"); +static_assert( + offsetof(ExternalTextureDescriptor, gamutConversionMatrix) == + offsetof(WGPUExternalTextureDescriptor, gamutConversionMatrix), + "offsetof mismatch for ExternalTextureDescriptor::gamutConversionMatrix"); +static_assert(offsetof(ExternalTextureDescriptor, flipY) == + offsetof(WGPUExternalTextureDescriptor, flipY), + "offsetof mismatch for ExternalTextureDescriptor::flipY"); +static_assert(offsetof(ExternalTextureDescriptor, mirrored) == + offsetof(WGPUExternalTextureDescriptor, mirrored), + "offsetof mismatch for ExternalTextureDescriptor::mirrored"); +static_assert(offsetof(ExternalTextureDescriptor, rotation) == + offsetof(WGPUExternalTextureDescriptor, rotation), + "offsetof mismatch for ExternalTextureDescriptor::rotation"); + +// FutureWaitInfo + +static_assert(sizeof(FutureWaitInfo) == sizeof(WGPUFutureWaitInfo), + "sizeof mismatch for FutureWaitInfo"); +static_assert(alignof(FutureWaitInfo) == alignof(WGPUFutureWaitInfo), + "alignof mismatch for FutureWaitInfo"); + +static_assert(offsetof(FutureWaitInfo, future) == + offsetof(WGPUFutureWaitInfo, future), + "offsetof mismatch for FutureWaitInfo::future"); +static_assert(offsetof(FutureWaitInfo, completed) == + offsetof(WGPUFutureWaitInfo, completed), + "offsetof mismatch for FutureWaitInfo::completed"); + +// ImageCopyBuffer + +static_assert(sizeof(ImageCopyBuffer) == sizeof(WGPUImageCopyBuffer), + "sizeof mismatch for ImageCopyBuffer"); +static_assert(alignof(ImageCopyBuffer) == alignof(WGPUImageCopyBuffer), + "alignof mismatch for ImageCopyBuffer"); + +static_assert(offsetof(ImageCopyBuffer, nextInChain) == + offsetof(WGPUImageCopyBuffer, nextInChain), + "offsetof mismatch for ImageCopyBuffer::nextInChain"); +static_assert(offsetof(ImageCopyBuffer, layout) == + offsetof(WGPUImageCopyBuffer, layout), + "offsetof mismatch for ImageCopyBuffer::layout"); +static_assert(offsetof(ImageCopyBuffer, buffer) == + offsetof(WGPUImageCopyBuffer, buffer), + "offsetof mismatch for ImageCopyBuffer::buffer"); + +// ImageCopyExternalTexture + +static_assert(sizeof(ImageCopyExternalTexture) == + sizeof(WGPUImageCopyExternalTexture), + "sizeof mismatch for ImageCopyExternalTexture"); +static_assert(alignof(ImageCopyExternalTexture) == + alignof(WGPUImageCopyExternalTexture), + "alignof mismatch for ImageCopyExternalTexture"); + +static_assert(offsetof(ImageCopyExternalTexture, nextInChain) == + offsetof(WGPUImageCopyExternalTexture, nextInChain), + "offsetof mismatch for ImageCopyExternalTexture::nextInChain"); +static_assert( + offsetof(ImageCopyExternalTexture, externalTexture) == + offsetof(WGPUImageCopyExternalTexture, externalTexture), + "offsetof mismatch for ImageCopyExternalTexture::externalTexture"); +static_assert(offsetof(ImageCopyExternalTexture, origin) == + offsetof(WGPUImageCopyExternalTexture, origin), + "offsetof mismatch for ImageCopyExternalTexture::origin"); +static_assert(offsetof(ImageCopyExternalTexture, naturalSize) == + offsetof(WGPUImageCopyExternalTexture, naturalSize), + "offsetof mismatch for ImageCopyExternalTexture::naturalSize"); + +// ImageCopyTexture + +static_assert(sizeof(ImageCopyTexture) == sizeof(WGPUImageCopyTexture), + "sizeof mismatch for ImageCopyTexture"); +static_assert(alignof(ImageCopyTexture) == alignof(WGPUImageCopyTexture), + "alignof mismatch for ImageCopyTexture"); + +static_assert(offsetof(ImageCopyTexture, nextInChain) == + offsetof(WGPUImageCopyTexture, nextInChain), + "offsetof mismatch for ImageCopyTexture::nextInChain"); +static_assert(offsetof(ImageCopyTexture, texture) == + offsetof(WGPUImageCopyTexture, texture), + "offsetof mismatch for ImageCopyTexture::texture"); +static_assert(offsetof(ImageCopyTexture, mipLevel) == + offsetof(WGPUImageCopyTexture, mipLevel), + "offsetof mismatch for ImageCopyTexture::mipLevel"); +static_assert(offsetof(ImageCopyTexture, origin) == + offsetof(WGPUImageCopyTexture, origin), + "offsetof mismatch for ImageCopyTexture::origin"); +static_assert(offsetof(ImageCopyTexture, aspect) == + offsetof(WGPUImageCopyTexture, aspect), + "offsetof mismatch for ImageCopyTexture::aspect"); + +// InstanceDescriptor + +static_assert(sizeof(InstanceDescriptor) == sizeof(WGPUInstanceDescriptor), + "sizeof mismatch for InstanceDescriptor"); +static_assert(alignof(InstanceDescriptor) == alignof(WGPUInstanceDescriptor), + "alignof mismatch for InstanceDescriptor"); + +static_assert(offsetof(InstanceDescriptor, nextInChain) == + offsetof(WGPUInstanceDescriptor, nextInChain), + "offsetof mismatch for InstanceDescriptor::nextInChain"); +static_assert(offsetof(InstanceDescriptor, features) == + offsetof(WGPUInstanceDescriptor, features), + "offsetof mismatch for InstanceDescriptor::features"); + +// PipelineLayoutPixelLocalStorage + +static_assert(sizeof(PipelineLayoutPixelLocalStorage) == + sizeof(WGPUPipelineLayoutPixelLocalStorage), + "sizeof mismatch for PipelineLayoutPixelLocalStorage"); +static_assert(alignof(PipelineLayoutPixelLocalStorage) == + alignof(WGPUPipelineLayoutPixelLocalStorage), + "alignof mismatch for PipelineLayoutPixelLocalStorage"); + +static_assert(offsetof(PipelineLayoutPixelLocalStorage, + totalPixelLocalStorageSize) == + offsetof(WGPUPipelineLayoutPixelLocalStorage, + totalPixelLocalStorageSize), + "offsetof mismatch for " + "PipelineLayoutPixelLocalStorage::totalPixelLocalStorageSize"); +static_assert(offsetof(PipelineLayoutPixelLocalStorage, + storageAttachmentCount) == + offsetof(WGPUPipelineLayoutPixelLocalStorage, + storageAttachmentCount), + "offsetof mismatch for " + "PipelineLayoutPixelLocalStorage::storageAttachmentCount"); +static_assert(offsetof(PipelineLayoutPixelLocalStorage, storageAttachments) == + offsetof(WGPUPipelineLayoutPixelLocalStorage, + storageAttachments), + "offsetof mismatch for " + "PipelineLayoutPixelLocalStorage::storageAttachments"); + +// ProgrammableStageDescriptor + +static_assert(sizeof(ProgrammableStageDescriptor) == + sizeof(WGPUProgrammableStageDescriptor), + "sizeof mismatch for ProgrammableStageDescriptor"); +static_assert(alignof(ProgrammableStageDescriptor) == + alignof(WGPUProgrammableStageDescriptor), + "alignof mismatch for ProgrammableStageDescriptor"); + +static_assert(offsetof(ProgrammableStageDescriptor, nextInChain) == + offsetof(WGPUProgrammableStageDescriptor, nextInChain), + "offsetof mismatch for ProgrammableStageDescriptor::nextInChain"); +static_assert(offsetof(ProgrammableStageDescriptor, module) == + offsetof(WGPUProgrammableStageDescriptor, module), + "offsetof mismatch for ProgrammableStageDescriptor::module"); +static_assert(offsetof(ProgrammableStageDescriptor, entryPoint) == + offsetof(WGPUProgrammableStageDescriptor, entryPoint), + "offsetof mismatch for ProgrammableStageDescriptor::entryPoint"); +static_assert( + offsetof(ProgrammableStageDescriptor, constantCount) == + offsetof(WGPUProgrammableStageDescriptor, constantCount), + "offsetof mismatch for ProgrammableStageDescriptor::constantCount"); +static_assert(offsetof(ProgrammableStageDescriptor, constants) == + offsetof(WGPUProgrammableStageDescriptor, constants), + "offsetof mismatch for ProgrammableStageDescriptor::constants"); + +// RenderPassColorAttachment + +static_assert(sizeof(RenderPassColorAttachment) == + sizeof(WGPURenderPassColorAttachment), + "sizeof mismatch for RenderPassColorAttachment"); +static_assert(alignof(RenderPassColorAttachment) == + alignof(WGPURenderPassColorAttachment), + "alignof mismatch for RenderPassColorAttachment"); + +static_assert(offsetof(RenderPassColorAttachment, nextInChain) == + offsetof(WGPURenderPassColorAttachment, nextInChain), + "offsetof mismatch for RenderPassColorAttachment::nextInChain"); +static_assert(offsetof(RenderPassColorAttachment, view) == + offsetof(WGPURenderPassColorAttachment, view), + "offsetof mismatch for RenderPassColorAttachment::view"); +static_assert(offsetof(RenderPassColorAttachment, depthSlice) == + offsetof(WGPURenderPassColorAttachment, depthSlice), + "offsetof mismatch for RenderPassColorAttachment::depthSlice"); +static_assert(offsetof(RenderPassColorAttachment, resolveTarget) == + offsetof(WGPURenderPassColorAttachment, resolveTarget), + "offsetof mismatch for RenderPassColorAttachment::resolveTarget"); +static_assert(offsetof(RenderPassColorAttachment, loadOp) == + offsetof(WGPURenderPassColorAttachment, loadOp), + "offsetof mismatch for RenderPassColorAttachment::loadOp"); +static_assert(offsetof(RenderPassColorAttachment, storeOp) == + offsetof(WGPURenderPassColorAttachment, storeOp), + "offsetof mismatch for RenderPassColorAttachment::storeOp"); +static_assert(offsetof(RenderPassColorAttachment, clearValue) == + offsetof(WGPURenderPassColorAttachment, clearValue), + "offsetof mismatch for RenderPassColorAttachment::clearValue"); + +// RenderPassStorageAttachment + +static_assert(sizeof(RenderPassStorageAttachment) == + sizeof(WGPURenderPassStorageAttachment), + "sizeof mismatch for RenderPassStorageAttachment"); +static_assert(alignof(RenderPassStorageAttachment) == + alignof(WGPURenderPassStorageAttachment), + "alignof mismatch for RenderPassStorageAttachment"); + +static_assert(offsetof(RenderPassStorageAttachment, nextInChain) == + offsetof(WGPURenderPassStorageAttachment, nextInChain), + "offsetof mismatch for RenderPassStorageAttachment::nextInChain"); +static_assert(offsetof(RenderPassStorageAttachment, offset) == + offsetof(WGPURenderPassStorageAttachment, offset), + "offsetof mismatch for RenderPassStorageAttachment::offset"); +static_assert(offsetof(RenderPassStorageAttachment, storage) == + offsetof(WGPURenderPassStorageAttachment, storage), + "offsetof mismatch for RenderPassStorageAttachment::storage"); +static_assert(offsetof(RenderPassStorageAttachment, loadOp) == + offsetof(WGPURenderPassStorageAttachment, loadOp), + "offsetof mismatch for RenderPassStorageAttachment::loadOp"); +static_assert(offsetof(RenderPassStorageAttachment, storeOp) == + offsetof(WGPURenderPassStorageAttachment, storeOp), + "offsetof mismatch for RenderPassStorageAttachment::storeOp"); +static_assert(offsetof(RenderPassStorageAttachment, clearValue) == + offsetof(WGPURenderPassStorageAttachment, clearValue), + "offsetof mismatch for RenderPassStorageAttachment::clearValue"); + +// RequiredLimits + +static_assert(sizeof(RequiredLimits) == sizeof(WGPURequiredLimits), + "sizeof mismatch for RequiredLimits"); +static_assert(alignof(RequiredLimits) == alignof(WGPURequiredLimits), + "alignof mismatch for RequiredLimits"); + +static_assert(offsetof(RequiredLimits, nextInChain) == + offsetof(WGPURequiredLimits, nextInChain), + "offsetof mismatch for RequiredLimits::nextInChain"); +static_assert(offsetof(RequiredLimits, limits) == + offsetof(WGPURequiredLimits, limits), + "offsetof mismatch for RequiredLimits::limits"); + +// SharedTextureMemoryDmaBufDescriptor + +static_assert(sizeof(SharedTextureMemoryDmaBufDescriptor) == + sizeof(WGPUSharedTextureMemoryDmaBufDescriptor), + "sizeof mismatch for SharedTextureMemoryDmaBufDescriptor"); +static_assert(alignof(SharedTextureMemoryDmaBufDescriptor) == + alignof(WGPUSharedTextureMemoryDmaBufDescriptor), + "alignof mismatch for SharedTextureMemoryDmaBufDescriptor"); + +static_assert( + offsetof(SharedTextureMemoryDmaBufDescriptor, size) == + offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, size), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::size"); +static_assert( + offsetof(SharedTextureMemoryDmaBufDescriptor, drmFormat) == + offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, drmFormat), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::drmFormat"); +static_assert( + offsetof(SharedTextureMemoryDmaBufDescriptor, drmModifier) == + offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, drmModifier), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::drmModifier"); +static_assert( + offsetof(SharedTextureMemoryDmaBufDescriptor, planeCount) == + offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, planeCount), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::planeCount"); +static_assert( + offsetof(SharedTextureMemoryDmaBufDescriptor, planes) == + offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, planes), + "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::planes"); + +// SharedTextureMemoryProperties + +static_assert(sizeof(SharedTextureMemoryProperties) == + sizeof(WGPUSharedTextureMemoryProperties), + "sizeof mismatch for SharedTextureMemoryProperties"); +static_assert(alignof(SharedTextureMemoryProperties) == + alignof(WGPUSharedTextureMemoryProperties), + "alignof mismatch for SharedTextureMemoryProperties"); + +static_assert( + offsetof(SharedTextureMemoryProperties, nextInChain) == + offsetof(WGPUSharedTextureMemoryProperties, nextInChain), + "offsetof mismatch for SharedTextureMemoryProperties::nextInChain"); +static_assert(offsetof(SharedTextureMemoryProperties, usage) == + offsetof(WGPUSharedTextureMemoryProperties, usage), + "offsetof mismatch for SharedTextureMemoryProperties::usage"); +static_assert(offsetof(SharedTextureMemoryProperties, size) == + offsetof(WGPUSharedTextureMemoryProperties, size), + "offsetof mismatch for SharedTextureMemoryProperties::size"); +static_assert(offsetof(SharedTextureMemoryProperties, format) == + offsetof(WGPUSharedTextureMemoryProperties, format), + "offsetof mismatch for SharedTextureMemoryProperties::format"); + +// SharedTextureMemoryVkImageDescriptor + +static_assert(sizeof(SharedTextureMemoryVkImageDescriptor) == + sizeof(WGPUSharedTextureMemoryVkImageDescriptor), + "sizeof mismatch for SharedTextureMemoryVkImageDescriptor"); +static_assert(alignof(SharedTextureMemoryVkImageDescriptor) == + alignof(WGPUSharedTextureMemoryVkImageDescriptor), + "alignof mismatch for SharedTextureMemoryVkImageDescriptor"); + +static_assert( + offsetof(SharedTextureMemoryVkImageDescriptor, vkFormat) == + offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkFormat), + "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkFormat"); +static_assert( + offsetof(SharedTextureMemoryVkImageDescriptor, vkUsageFlags) == + offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkUsageFlags), + "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkUsageFlags"); +static_assert( + offsetof(SharedTextureMemoryVkImageDescriptor, vkExtent3D) == + offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkExtent3D), + "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkExtent3D"); + +// SupportedLimits + +static_assert(sizeof(SupportedLimits) == sizeof(WGPUSupportedLimits), + "sizeof mismatch for SupportedLimits"); +static_assert(alignof(SupportedLimits) == alignof(WGPUSupportedLimits), + "alignof mismatch for SupportedLimits"); + +static_assert(offsetof(SupportedLimits, nextInChain) == + offsetof(WGPUSupportedLimits, nextInChain), + "offsetof mismatch for SupportedLimits::nextInChain"); +static_assert(offsetof(SupportedLimits, limits) == + offsetof(WGPUSupportedLimits, limits), + "offsetof mismatch for SupportedLimits::limits"); + +// TextureDescriptor + +static_assert(sizeof(TextureDescriptor) == sizeof(WGPUTextureDescriptor), + "sizeof mismatch for TextureDescriptor"); +static_assert(alignof(TextureDescriptor) == alignof(WGPUTextureDescriptor), + "alignof mismatch for TextureDescriptor"); + +static_assert(offsetof(TextureDescriptor, nextInChain) == + offsetof(WGPUTextureDescriptor, nextInChain), + "offsetof mismatch for TextureDescriptor::nextInChain"); +static_assert(offsetof(TextureDescriptor, label) == + offsetof(WGPUTextureDescriptor, label), + "offsetof mismatch for TextureDescriptor::label"); +static_assert(offsetof(TextureDescriptor, usage) == + offsetof(WGPUTextureDescriptor, usage), + "offsetof mismatch for TextureDescriptor::usage"); +static_assert(offsetof(TextureDescriptor, dimension) == + offsetof(WGPUTextureDescriptor, dimension), + "offsetof mismatch for TextureDescriptor::dimension"); +static_assert(offsetof(TextureDescriptor, size) == + offsetof(WGPUTextureDescriptor, size), + "offsetof mismatch for TextureDescriptor::size"); +static_assert(offsetof(TextureDescriptor, format) == + offsetof(WGPUTextureDescriptor, format), + "offsetof mismatch for TextureDescriptor::format"); +static_assert(offsetof(TextureDescriptor, mipLevelCount) == + offsetof(WGPUTextureDescriptor, mipLevelCount), + "offsetof mismatch for TextureDescriptor::mipLevelCount"); +static_assert(offsetof(TextureDescriptor, sampleCount) == + offsetof(WGPUTextureDescriptor, sampleCount), + "offsetof mismatch for TextureDescriptor::sampleCount"); +static_assert(offsetof(TextureDescriptor, viewFormatCount) == + offsetof(WGPUTextureDescriptor, viewFormatCount), + "offsetof mismatch for TextureDescriptor::viewFormatCount"); +static_assert(offsetof(TextureDescriptor, viewFormats) == + offsetof(WGPUTextureDescriptor, viewFormats), + "offsetof mismatch for TextureDescriptor::viewFormats"); + +// VertexBufferLayout + +static_assert(sizeof(VertexBufferLayout) == sizeof(WGPUVertexBufferLayout), + "sizeof mismatch for VertexBufferLayout"); +static_assert(alignof(VertexBufferLayout) == alignof(WGPUVertexBufferLayout), + "alignof mismatch for VertexBufferLayout"); + +static_assert(offsetof(VertexBufferLayout, arrayStride) == + offsetof(WGPUVertexBufferLayout, arrayStride), + "offsetof mismatch for VertexBufferLayout::arrayStride"); +static_assert(offsetof(VertexBufferLayout, stepMode) == + offsetof(WGPUVertexBufferLayout, stepMode), + "offsetof mismatch for VertexBufferLayout::stepMode"); +static_assert(offsetof(VertexBufferLayout, attributeCount) == + offsetof(WGPUVertexBufferLayout, attributeCount), + "offsetof mismatch for VertexBufferLayout::attributeCount"); +static_assert(offsetof(VertexBufferLayout, attributes) == + offsetof(WGPUVertexBufferLayout, attributes), + "offsetof mismatch for VertexBufferLayout::attributes"); + +// BindGroupLayoutDescriptor + +static_assert(sizeof(BindGroupLayoutDescriptor) == + sizeof(WGPUBindGroupLayoutDescriptor), + "sizeof mismatch for BindGroupLayoutDescriptor"); +static_assert(alignof(BindGroupLayoutDescriptor) == + alignof(WGPUBindGroupLayoutDescriptor), + "alignof mismatch for BindGroupLayoutDescriptor"); + +static_assert(offsetof(BindGroupLayoutDescriptor, nextInChain) == + offsetof(WGPUBindGroupLayoutDescriptor, nextInChain), + "offsetof mismatch for BindGroupLayoutDescriptor::nextInChain"); +static_assert(offsetof(BindGroupLayoutDescriptor, label) == + offsetof(WGPUBindGroupLayoutDescriptor, label), + "offsetof mismatch for BindGroupLayoutDescriptor::label"); +static_assert(offsetof(BindGroupLayoutDescriptor, entryCount) == + offsetof(WGPUBindGroupLayoutDescriptor, entryCount), + "offsetof mismatch for BindGroupLayoutDescriptor::entryCount"); +static_assert(offsetof(BindGroupLayoutDescriptor, entries) == + offsetof(WGPUBindGroupLayoutDescriptor, entries), + "offsetof mismatch for BindGroupLayoutDescriptor::entries"); + +// ColorTargetState + +static_assert(sizeof(ColorTargetState) == sizeof(WGPUColorTargetState), + "sizeof mismatch for ColorTargetState"); +static_assert(alignof(ColorTargetState) == alignof(WGPUColorTargetState), + "alignof mismatch for ColorTargetState"); + +static_assert(offsetof(ColorTargetState, nextInChain) == + offsetof(WGPUColorTargetState, nextInChain), + "offsetof mismatch for ColorTargetState::nextInChain"); +static_assert(offsetof(ColorTargetState, format) == + offsetof(WGPUColorTargetState, format), + "offsetof mismatch for ColorTargetState::format"); +static_assert(offsetof(ColorTargetState, blend) == + offsetof(WGPUColorTargetState, blend), + "offsetof mismatch for ColorTargetState::blend"); +static_assert(offsetof(ColorTargetState, writeMask) == + offsetof(WGPUColorTargetState, writeMask), + "offsetof mismatch for ColorTargetState::writeMask"); + +// ComputePipelineDescriptor + +static_assert(sizeof(ComputePipelineDescriptor) == + sizeof(WGPUComputePipelineDescriptor), + "sizeof mismatch for ComputePipelineDescriptor"); +static_assert(alignof(ComputePipelineDescriptor) == + alignof(WGPUComputePipelineDescriptor), + "alignof mismatch for ComputePipelineDescriptor"); + +static_assert(offsetof(ComputePipelineDescriptor, nextInChain) == + offsetof(WGPUComputePipelineDescriptor, nextInChain), + "offsetof mismatch for ComputePipelineDescriptor::nextInChain"); +static_assert(offsetof(ComputePipelineDescriptor, label) == + offsetof(WGPUComputePipelineDescriptor, label), + "offsetof mismatch for ComputePipelineDescriptor::label"); +static_assert(offsetof(ComputePipelineDescriptor, layout) == + offsetof(WGPUComputePipelineDescriptor, layout), + "offsetof mismatch for ComputePipelineDescriptor::layout"); +static_assert(offsetof(ComputePipelineDescriptor, compute) == + offsetof(WGPUComputePipelineDescriptor, compute), + "offsetof mismatch for ComputePipelineDescriptor::compute"); + +// DeviceDescriptor + +static_assert(sizeof(DeviceDescriptor) == sizeof(WGPUDeviceDescriptor), + "sizeof mismatch for DeviceDescriptor"); +static_assert(alignof(DeviceDescriptor) == alignof(WGPUDeviceDescriptor), + "alignof mismatch for DeviceDescriptor"); + +static_assert(offsetof(DeviceDescriptor, nextInChain) == + offsetof(WGPUDeviceDescriptor, nextInChain), + "offsetof mismatch for DeviceDescriptor::nextInChain"); +static_assert(offsetof(DeviceDescriptor, label) == + offsetof(WGPUDeviceDescriptor, label), + "offsetof mismatch for DeviceDescriptor::label"); +static_assert(offsetof(DeviceDescriptor, requiredFeatureCount) == + offsetof(WGPUDeviceDescriptor, requiredFeatureCount), + "offsetof mismatch for DeviceDescriptor::requiredFeatureCount"); +static_assert(offsetof(DeviceDescriptor, requiredFeatures) == + offsetof(WGPUDeviceDescriptor, requiredFeatures), + "offsetof mismatch for DeviceDescriptor::requiredFeatures"); +static_assert(offsetof(DeviceDescriptor, requiredLimits) == + offsetof(WGPUDeviceDescriptor, requiredLimits), + "offsetof mismatch for DeviceDescriptor::requiredLimits"); +static_assert(offsetof(DeviceDescriptor, defaultQueue) == + offsetof(WGPUDeviceDescriptor, defaultQueue), + "offsetof mismatch for DeviceDescriptor::defaultQueue"); +static_assert(offsetof(DeviceDescriptor, deviceLostCallback) == + offsetof(WGPUDeviceDescriptor, deviceLostCallback), + "offsetof mismatch for DeviceDescriptor::deviceLostCallback"); +static_assert(offsetof(DeviceDescriptor, deviceLostUserdata) == + offsetof(WGPUDeviceDescriptor, deviceLostUserdata), + "offsetof mismatch for DeviceDescriptor::deviceLostUserdata"); + +// RenderPassDescriptor + +static_assert(sizeof(RenderPassDescriptor) == sizeof(WGPURenderPassDescriptor), + "sizeof mismatch for RenderPassDescriptor"); +static_assert(alignof(RenderPassDescriptor) == + alignof(WGPURenderPassDescriptor), + "alignof mismatch for RenderPassDescriptor"); + +static_assert(offsetof(RenderPassDescriptor, nextInChain) == + offsetof(WGPURenderPassDescriptor, nextInChain), + "offsetof mismatch for RenderPassDescriptor::nextInChain"); +static_assert(offsetof(RenderPassDescriptor, label) == + offsetof(WGPURenderPassDescriptor, label), + "offsetof mismatch for RenderPassDescriptor::label"); +static_assert( + offsetof(RenderPassDescriptor, colorAttachmentCount) == + offsetof(WGPURenderPassDescriptor, colorAttachmentCount), + "offsetof mismatch for RenderPassDescriptor::colorAttachmentCount"); +static_assert(offsetof(RenderPassDescriptor, colorAttachments) == + offsetof(WGPURenderPassDescriptor, colorAttachments), + "offsetof mismatch for RenderPassDescriptor::colorAttachments"); +static_assert( + offsetof(RenderPassDescriptor, depthStencilAttachment) == + offsetof(WGPURenderPassDescriptor, depthStencilAttachment), + "offsetof mismatch for RenderPassDescriptor::depthStencilAttachment"); +static_assert(offsetof(RenderPassDescriptor, occlusionQuerySet) == + offsetof(WGPURenderPassDescriptor, occlusionQuerySet), + "offsetof mismatch for RenderPassDescriptor::occlusionQuerySet"); +static_assert(offsetof(RenderPassDescriptor, timestampWrites) == + offsetof(WGPURenderPassDescriptor, timestampWrites), + "offsetof mismatch for RenderPassDescriptor::timestampWrites"); + +// RenderPassPixelLocalStorage + +static_assert(sizeof(RenderPassPixelLocalStorage) == + sizeof(WGPURenderPassPixelLocalStorage), + "sizeof mismatch for RenderPassPixelLocalStorage"); +static_assert(alignof(RenderPassPixelLocalStorage) == + alignof(WGPURenderPassPixelLocalStorage), + "alignof mismatch for RenderPassPixelLocalStorage"); + +static_assert(offsetof(RenderPassPixelLocalStorage, + totalPixelLocalStorageSize) == + offsetof(WGPURenderPassPixelLocalStorage, + totalPixelLocalStorageSize), + "offsetof mismatch for " + "RenderPassPixelLocalStorage::totalPixelLocalStorageSize"); +static_assert(offsetof(RenderPassPixelLocalStorage, storageAttachmentCount) == + offsetof(WGPURenderPassPixelLocalStorage, + storageAttachmentCount), + "offsetof mismatch for " + "RenderPassPixelLocalStorage::storageAttachmentCount"); +static_assert( + offsetof(RenderPassPixelLocalStorage, storageAttachments) == + offsetof(WGPURenderPassPixelLocalStorage, storageAttachments), + "offsetof mismatch for RenderPassPixelLocalStorage::storageAttachments"); + +// VertexState + +static_assert(sizeof(VertexState) == sizeof(WGPUVertexState), + "sizeof mismatch for VertexState"); +static_assert(alignof(VertexState) == alignof(WGPUVertexState), + "alignof mismatch for VertexState"); + +static_assert(offsetof(VertexState, nextInChain) == + offsetof(WGPUVertexState, nextInChain), + "offsetof mismatch for VertexState::nextInChain"); +static_assert(offsetof(VertexState, module) == + offsetof(WGPUVertexState, module), + "offsetof mismatch for VertexState::module"); +static_assert(offsetof(VertexState, entryPoint) == + offsetof(WGPUVertexState, entryPoint), + "offsetof mismatch for VertexState::entryPoint"); +static_assert(offsetof(VertexState, constantCount) == + offsetof(WGPUVertexState, constantCount), + "offsetof mismatch for VertexState::constantCount"); +static_assert(offsetof(VertexState, constants) == + offsetof(WGPUVertexState, constants), + "offsetof mismatch for VertexState::constants"); +static_assert(offsetof(VertexState, bufferCount) == + offsetof(WGPUVertexState, bufferCount), + "offsetof mismatch for VertexState::bufferCount"); +static_assert(offsetof(VertexState, buffers) == + offsetof(WGPUVertexState, buffers), + "offsetof mismatch for VertexState::buffers"); + +// FragmentState + +static_assert(sizeof(FragmentState) == sizeof(WGPUFragmentState), + "sizeof mismatch for FragmentState"); +static_assert(alignof(FragmentState) == alignof(WGPUFragmentState), + "alignof mismatch for FragmentState"); + +static_assert(offsetof(FragmentState, nextInChain) == + offsetof(WGPUFragmentState, nextInChain), + "offsetof mismatch for FragmentState::nextInChain"); +static_assert(offsetof(FragmentState, module) == + offsetof(WGPUFragmentState, module), + "offsetof mismatch for FragmentState::module"); +static_assert(offsetof(FragmentState, entryPoint) == + offsetof(WGPUFragmentState, entryPoint), + "offsetof mismatch for FragmentState::entryPoint"); +static_assert(offsetof(FragmentState, constantCount) == + offsetof(WGPUFragmentState, constantCount), + "offsetof mismatch for FragmentState::constantCount"); +static_assert(offsetof(FragmentState, constants) == + offsetof(WGPUFragmentState, constants), + "offsetof mismatch for FragmentState::constants"); +static_assert(offsetof(FragmentState, targetCount) == + offsetof(WGPUFragmentState, targetCount), + "offsetof mismatch for FragmentState::targetCount"); +static_assert(offsetof(FragmentState, targets) == + offsetof(WGPUFragmentState, targets), + "offsetof mismatch for FragmentState::targets"); + +// RenderPipelineDescriptor + +static_assert(sizeof(RenderPipelineDescriptor) == + sizeof(WGPURenderPipelineDescriptor), + "sizeof mismatch for RenderPipelineDescriptor"); +static_assert(alignof(RenderPipelineDescriptor) == + alignof(WGPURenderPipelineDescriptor), + "alignof mismatch for RenderPipelineDescriptor"); + +static_assert(offsetof(RenderPipelineDescriptor, nextInChain) == + offsetof(WGPURenderPipelineDescriptor, nextInChain), + "offsetof mismatch for RenderPipelineDescriptor::nextInChain"); +static_assert(offsetof(RenderPipelineDescriptor, label) == + offsetof(WGPURenderPipelineDescriptor, label), + "offsetof mismatch for RenderPipelineDescriptor::label"); +static_assert(offsetof(RenderPipelineDescriptor, layout) == + offsetof(WGPURenderPipelineDescriptor, layout), + "offsetof mismatch for RenderPipelineDescriptor::layout"); +static_assert(offsetof(RenderPipelineDescriptor, vertex) == + offsetof(WGPURenderPipelineDescriptor, vertex), + "offsetof mismatch for RenderPipelineDescriptor::vertex"); +static_assert(offsetof(RenderPipelineDescriptor, primitive) == + offsetof(WGPURenderPipelineDescriptor, primitive), + "offsetof mismatch for RenderPipelineDescriptor::primitive"); +static_assert(offsetof(RenderPipelineDescriptor, depthStencil) == + offsetof(WGPURenderPipelineDescriptor, depthStencil), + "offsetof mismatch for RenderPipelineDescriptor::depthStencil"); +static_assert(offsetof(RenderPipelineDescriptor, multisample) == + offsetof(WGPURenderPipelineDescriptor, multisample), + "offsetof mismatch for RenderPipelineDescriptor::multisample"); +static_assert(offsetof(RenderPipelineDescriptor, fragment) == + offsetof(WGPURenderPipelineDescriptor, fragment), + "offsetof mismatch for RenderPipelineDescriptor::fragment"); +template static T &AsNonConstReference(const T &value) { + return const_cast(value); +} - // SharedFenceVkSemaphoreOpaqueFDExportInfo +// AdapterProperties +AdapterProperties::~AdapterProperties() { + if (this->vendorName != nullptr || this->architecture != nullptr || + this->name != nullptr || this->driverDescription != nullptr) { + wgpuAdapterPropertiesFreeMembers( + *reinterpret_cast(this)); + } +} - static_assert(sizeof(SharedFenceVkSemaphoreOpaqueFDExportInfo) == sizeof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo), "sizeof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo"); - static_assert(alignof(SharedFenceVkSemaphoreOpaqueFDExportInfo) == alignof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo), "alignof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo"); +static void Reset(AdapterProperties &value) { + AdapterProperties defaultValue{}; + AsNonConstReference(value.vendorID) = defaultValue.vendorID; + AsNonConstReference(value.vendorName) = defaultValue.vendorName; + AsNonConstReference(value.architecture) = defaultValue.architecture; + AsNonConstReference(value.deviceID) = defaultValue.deviceID; + AsNonConstReference(value.name) = defaultValue.name; + AsNonConstReference(value.driverDescription) = defaultValue.driverDescription; + AsNonConstReference(value.adapterType) = defaultValue.adapterType; + AsNonConstReference(value.backendType) = defaultValue.backendType; + AsNonConstReference(value.compatibilityMode) = defaultValue.compatibilityMode; +} - static_assert(offsetof(SharedFenceVkSemaphoreOpaqueFDExportInfo, handle) == offsetof(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo, handle), - "offsetof mismatch for SharedFenceVkSemaphoreOpaqueFDExportInfo::handle"); +AdapterProperties::AdapterProperties(AdapterProperties &&rhs) + : vendorID(rhs.vendorID), vendorName(rhs.vendorName), + architecture(rhs.architecture), deviceID(rhs.deviceID), name(rhs.name), + driverDescription(rhs.driverDescription), adapterType(rhs.adapterType), + backendType(rhs.backendType), compatibilityMode(rhs.compatibilityMode) { + Reset(rhs); +} - // SharedFenceVkSemaphoreSyncFDDescriptor +AdapterProperties &AdapterProperties::operator=(AdapterProperties &&rhs) { + if (&rhs == this) { + return *this; + } + this->~AdapterProperties(); + AsNonConstReference(this->vendorID) = std::move(rhs.vendorID); + AsNonConstReference(this->vendorName) = std::move(rhs.vendorName); + AsNonConstReference(this->architecture) = std::move(rhs.architecture); + AsNonConstReference(this->deviceID) = std::move(rhs.deviceID); + AsNonConstReference(this->name) = std::move(rhs.name); + AsNonConstReference(this->driverDescription) = + std::move(rhs.driverDescription); + AsNonConstReference(this->adapterType) = std::move(rhs.adapterType); + AsNonConstReference(this->backendType) = std::move(rhs.backendType); + AsNonConstReference(this->compatibilityMode) = + std::move(rhs.compatibilityMode); + Reset(rhs); + return *this; +} - static_assert(sizeof(SharedFenceVkSemaphoreSyncFDDescriptor) == sizeof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor), "sizeof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor"); - static_assert(alignof(SharedFenceVkSemaphoreSyncFDDescriptor) == alignof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor), "alignof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor"); +// SharedBufferMemoryEndAccessState +SharedBufferMemoryEndAccessState::~SharedBufferMemoryEndAccessState() { + if (this->fences != nullptr || this->signaledValues != nullptr) { + wgpuSharedBufferMemoryEndAccessStateFreeMembers( + *reinterpret_cast(this)); + } +} - static_assert(offsetof(SharedFenceVkSemaphoreSyncFDDescriptor, handle) == offsetof(WGPUSharedFenceVkSemaphoreSyncFDDescriptor, handle), - "offsetof mismatch for SharedFenceVkSemaphoreSyncFDDescriptor::handle"); +static void Reset(SharedBufferMemoryEndAccessState &value) { + SharedBufferMemoryEndAccessState defaultValue{}; + AsNonConstReference(value.initialized) = defaultValue.initialized; + AsNonConstReference(value.fenceCount) = defaultValue.fenceCount; + AsNonConstReference(value.fences) = defaultValue.fences; + AsNonConstReference(value.signaledValues) = defaultValue.signaledValues; +} - // SharedFenceVkSemaphoreSyncFDExportInfo +SharedBufferMemoryEndAccessState::SharedBufferMemoryEndAccessState( + SharedBufferMemoryEndAccessState &&rhs) + : initialized(rhs.initialized), fenceCount(rhs.fenceCount), + fences(rhs.fences), signaledValues(rhs.signaledValues) { + Reset(rhs); +} - static_assert(sizeof(SharedFenceVkSemaphoreSyncFDExportInfo) == sizeof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo), "sizeof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo"); - static_assert(alignof(SharedFenceVkSemaphoreSyncFDExportInfo) == alignof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo), "alignof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo"); +SharedBufferMemoryEndAccessState &SharedBufferMemoryEndAccessState::operator=( + SharedBufferMemoryEndAccessState &&rhs) { + if (&rhs == this) { + return *this; + } + this->~SharedBufferMemoryEndAccessState(); + AsNonConstReference(this->initialized) = std::move(rhs.initialized); + AsNonConstReference(this->fenceCount) = std::move(rhs.fenceCount); + AsNonConstReference(this->fences) = std::move(rhs.fences); + AsNonConstReference(this->signaledValues) = std::move(rhs.signaledValues); + Reset(rhs); + return *this; +} - static_assert(offsetof(SharedFenceVkSemaphoreSyncFDExportInfo, handle) == offsetof(WGPUSharedFenceVkSemaphoreSyncFDExportInfo, handle), - "offsetof mismatch for SharedFenceVkSemaphoreSyncFDExportInfo::handle"); +// SharedTextureMemoryEndAccessState +SharedTextureMemoryEndAccessState::~SharedTextureMemoryEndAccessState() { + if (this->fences != nullptr || this->signaledValues != nullptr) { + wgpuSharedTextureMemoryEndAccessStateFreeMembers( + *reinterpret_cast(this)); + } +} - // SharedFenceVkSemaphoreZirconHandleDescriptor +static void Reset(SharedTextureMemoryEndAccessState &value) { + SharedTextureMemoryEndAccessState defaultValue{}; + AsNonConstReference(value.initialized) = defaultValue.initialized; + AsNonConstReference(value.fenceCount) = defaultValue.fenceCount; + AsNonConstReference(value.fences) = defaultValue.fences; + AsNonConstReference(value.signaledValues) = defaultValue.signaledValues; +} - static_assert(sizeof(SharedFenceVkSemaphoreZirconHandleDescriptor) == sizeof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor), "sizeof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor"); - static_assert(alignof(SharedFenceVkSemaphoreZirconHandleDescriptor) == alignof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor), "alignof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor"); +SharedTextureMemoryEndAccessState::SharedTextureMemoryEndAccessState( + SharedTextureMemoryEndAccessState &&rhs) + : initialized(rhs.initialized), fenceCount(rhs.fenceCount), + fences(rhs.fences), signaledValues(rhs.signaledValues) { + Reset(rhs); +} - static_assert(offsetof(SharedFenceVkSemaphoreZirconHandleDescriptor, handle) == offsetof(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor, handle), - "offsetof mismatch for SharedFenceVkSemaphoreZirconHandleDescriptor::handle"); +SharedTextureMemoryEndAccessState &SharedTextureMemoryEndAccessState::operator=( + SharedTextureMemoryEndAccessState &&rhs) { + if (&rhs == this) { + return *this; + } + this->~SharedTextureMemoryEndAccessState(); + AsNonConstReference(this->initialized) = std::move(rhs.initialized); + AsNonConstReference(this->fenceCount) = std::move(rhs.fenceCount); + AsNonConstReference(this->fences) = std::move(rhs.fences); + AsNonConstReference(this->signaledValues) = std::move(rhs.signaledValues); + Reset(rhs); + return *this; +} - // SharedFenceVkSemaphoreZirconHandleExportInfo +// AdapterPropertiesMemoryHeaps +AdapterPropertiesMemoryHeaps::~AdapterPropertiesMemoryHeaps() { + if (this->heapInfo != nullptr) { + wgpuAdapterPropertiesMemoryHeapsFreeMembers( + *reinterpret_cast(this)); + } +} - static_assert(sizeof(SharedFenceVkSemaphoreZirconHandleExportInfo) == sizeof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo), "sizeof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo"); - static_assert(alignof(SharedFenceVkSemaphoreZirconHandleExportInfo) == alignof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo), "alignof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo"); +static void Reset(AdapterPropertiesMemoryHeaps &value) { + AdapterPropertiesMemoryHeaps defaultValue{}; + AsNonConstReference(value.heapCount) = defaultValue.heapCount; + AsNonConstReference(value.heapInfo) = defaultValue.heapInfo; +} - static_assert(offsetof(SharedFenceVkSemaphoreZirconHandleExportInfo, handle) == offsetof(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo, handle), - "offsetof mismatch for SharedFenceVkSemaphoreZirconHandleExportInfo::handle"); +AdapterPropertiesMemoryHeaps::AdapterPropertiesMemoryHeaps( + AdapterPropertiesMemoryHeaps &&rhs) + : heapCount(rhs.heapCount), heapInfo(rhs.heapInfo) { + Reset(rhs); +} - // SharedTextureMemoryDXGISharedHandleDescriptor +AdapterPropertiesMemoryHeaps & +AdapterPropertiesMemoryHeaps::operator=(AdapterPropertiesMemoryHeaps &&rhs) { + if (&rhs == this) { + return *this; + } + this->~AdapterPropertiesMemoryHeaps(); + AsNonConstReference(this->heapCount) = std::move(rhs.heapCount); + AsNonConstReference(this->heapInfo) = std::move(rhs.heapInfo); + Reset(rhs); + return *this; +} - static_assert(sizeof(SharedTextureMemoryDXGISharedHandleDescriptor) == sizeof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor), "sizeof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor"); - static_assert(alignof(SharedTextureMemoryDXGISharedHandleDescriptor) == alignof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor), "alignof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor"); +// DrmFormatCapabilities +DrmFormatCapabilities::~DrmFormatCapabilities() { + if (this->properties != nullptr) { + wgpuDrmFormatCapabilitiesFreeMembers( + *reinterpret_cast(this)); + } +} - static_assert(offsetof(SharedTextureMemoryDXGISharedHandleDescriptor, handle) == offsetof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, handle), - "offsetof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor::handle"); - static_assert(offsetof(SharedTextureMemoryDXGISharedHandleDescriptor, useKeyedMutex) == offsetof(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, useKeyedMutex), - "offsetof mismatch for SharedTextureMemoryDXGISharedHandleDescriptor::useKeyedMutex"); +static void Reset(DrmFormatCapabilities &value) { + DrmFormatCapabilities defaultValue{}; + AsNonConstReference(value.propertiesCount) = defaultValue.propertiesCount; + AsNonConstReference(value.properties) = defaultValue.properties; +} - // SharedTextureMemoryEGLImageDescriptor +DrmFormatCapabilities::DrmFormatCapabilities(DrmFormatCapabilities &&rhs) + : propertiesCount(rhs.propertiesCount), properties(rhs.properties) { + Reset(rhs); +} - static_assert(sizeof(SharedTextureMemoryEGLImageDescriptor) == sizeof(WGPUSharedTextureMemoryEGLImageDescriptor), "sizeof mismatch for SharedTextureMemoryEGLImageDescriptor"); - static_assert(alignof(SharedTextureMemoryEGLImageDescriptor) == alignof(WGPUSharedTextureMemoryEGLImageDescriptor), "alignof mismatch for SharedTextureMemoryEGLImageDescriptor"); +DrmFormatCapabilities & +DrmFormatCapabilities::operator=(DrmFormatCapabilities &&rhs) { + if (&rhs == this) { + return *this; + } + this->~DrmFormatCapabilities(); + AsNonConstReference(this->propertiesCount) = std::move(rhs.propertiesCount); + AsNonConstReference(this->properties) = std::move(rhs.properties); + Reset(rhs); + return *this; +} - static_assert(offsetof(SharedTextureMemoryEGLImageDescriptor, image) == offsetof(WGPUSharedTextureMemoryEGLImageDescriptor, image), - "offsetof mismatch for SharedTextureMemoryEGLImageDescriptor::image"); +// Adapter - // SharedTextureMemoryIOSurfaceDescriptor +static_assert(sizeof(Adapter) == sizeof(WGPUAdapter), + "sizeof mismatch for Adapter"); +static_assert(alignof(Adapter) == alignof(WGPUAdapter), + "alignof mismatch for Adapter"); - static_assert(sizeof(SharedTextureMemoryIOSurfaceDescriptor) == sizeof(WGPUSharedTextureMemoryIOSurfaceDescriptor), "sizeof mismatch for SharedTextureMemoryIOSurfaceDescriptor"); - static_assert(alignof(SharedTextureMemoryIOSurfaceDescriptor) == alignof(WGPUSharedTextureMemoryIOSurfaceDescriptor), "alignof mismatch for SharedTextureMemoryIOSurfaceDescriptor"); +Device Adapter::CreateDevice(DeviceDescriptor const *descriptor) const { + auto result = wgpuAdapterCreateDevice( + Get(), reinterpret_cast(descriptor)); + return Device::Acquire(result); +} +size_t Adapter::EnumerateFeatures(FeatureName *features) const { + auto result = wgpuAdapterEnumerateFeatures( + Get(), reinterpret_cast(features)); + return result; +} +Bool Adapter::GetFormatCapabilities(TextureFormat format, + FormatCapabilities *capabilities) const { + auto result = wgpuAdapterGetFormatCapabilities( + Get(), static_cast(format), + reinterpret_cast(capabilities)); + return result; +} +Instance Adapter::GetInstance() const { + auto result = wgpuAdapterGetInstance(Get()); + return Instance::Acquire(result); +} +Bool Adapter::GetLimits(SupportedLimits *limits) const { + auto result = wgpuAdapterGetLimits( + Get(), reinterpret_cast(limits)); + return result; +} +void Adapter::GetProperties(AdapterProperties *properties) const { + *properties = AdapterProperties(); + wgpuAdapterGetProperties( + Get(), reinterpret_cast(properties)); +} +Bool Adapter::HasFeature(FeatureName feature) const { + auto result = + wgpuAdapterHasFeature(Get(), static_cast(feature)); + return result; +} +void Adapter::RequestDevice(DeviceDescriptor const *descriptor, + RequestDeviceCallback callback, + void *userdata) const { + wgpuAdapterRequestDevice( + Get(), reinterpret_cast(descriptor), + callback, userdata); +} +Future Adapter::RequestDevice(DeviceDescriptor const *options, + RequestDeviceCallbackInfo callbackInfo) const { + auto result = wgpuAdapterRequestDeviceF( + Get(), reinterpret_cast(options), + *reinterpret_cast(&callbackInfo)); + return Future{result.id}; +} +void Adapter::WGPUReference(WGPUAdapter handle) { + if (handle != nullptr) { + wgpuAdapterReference(handle); + } +} +void Adapter::WGPURelease(WGPUAdapter handle) { + if (handle != nullptr) { + wgpuAdapterRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryIOSurfaceDescriptor, ioSurface) == offsetof(WGPUSharedTextureMemoryIOSurfaceDescriptor, ioSurface), - "offsetof mismatch for SharedTextureMemoryIOSurfaceDescriptor::ioSurface"); +// BindGroup - // SharedTextureMemoryAHardwareBufferDescriptor +static_assert(sizeof(BindGroup) == sizeof(WGPUBindGroup), + "sizeof mismatch for BindGroup"); +static_assert(alignof(BindGroup) == alignof(WGPUBindGroup), + "alignof mismatch for BindGroup"); - static_assert(sizeof(SharedTextureMemoryAHardwareBufferDescriptor) == sizeof(WGPUSharedTextureMemoryAHardwareBufferDescriptor), "sizeof mismatch for SharedTextureMemoryAHardwareBufferDescriptor"); - static_assert(alignof(SharedTextureMemoryAHardwareBufferDescriptor) == alignof(WGPUSharedTextureMemoryAHardwareBufferDescriptor), "alignof mismatch for SharedTextureMemoryAHardwareBufferDescriptor"); +void BindGroup::SetLabel(char const *label) const { + wgpuBindGroupSetLabel(Get(), reinterpret_cast(label)); +} +void BindGroup::WGPUReference(WGPUBindGroup handle) { + if (handle != nullptr) { + wgpuBindGroupReference(handle); + } +} +void BindGroup::WGPURelease(WGPUBindGroup handle) { + if (handle != nullptr) { + wgpuBindGroupRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryAHardwareBufferDescriptor, handle) == offsetof(WGPUSharedTextureMemoryAHardwareBufferDescriptor, handle), - "offsetof mismatch for SharedTextureMemoryAHardwareBufferDescriptor::handle"); +// BindGroupLayout - // SharedTextureMemoryBeginAccessDescriptor +static_assert(sizeof(BindGroupLayout) == sizeof(WGPUBindGroupLayout), + "sizeof mismatch for BindGroupLayout"); +static_assert(alignof(BindGroupLayout) == alignof(WGPUBindGroupLayout), + "alignof mismatch for BindGroupLayout"); - static_assert(sizeof(SharedTextureMemoryBeginAccessDescriptor) == sizeof(WGPUSharedTextureMemoryBeginAccessDescriptor), "sizeof mismatch for SharedTextureMemoryBeginAccessDescriptor"); - static_assert(alignof(SharedTextureMemoryBeginAccessDescriptor) == alignof(WGPUSharedTextureMemoryBeginAccessDescriptor), "alignof mismatch for SharedTextureMemoryBeginAccessDescriptor"); +void BindGroupLayout::SetLabel(char const *label) const { + wgpuBindGroupLayoutSetLabel(Get(), reinterpret_cast(label)); +} +void BindGroupLayout::WGPUReference(WGPUBindGroupLayout handle) { + if (handle != nullptr) { + wgpuBindGroupLayoutReference(handle); + } +} +void BindGroupLayout::WGPURelease(WGPUBindGroupLayout handle) { + if (handle != nullptr) { + wgpuBindGroupLayoutRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, nextInChain) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, nextInChain), - "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::nextInChain"); - static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, concurrentRead) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, concurrentRead), - "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::concurrentRead"); - static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, initialized) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, initialized), - "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::initialized"); - static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, fenceCount) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, fenceCount), - "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::fenceCount"); - static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, fences) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, fences), - "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::fences"); - static_assert(offsetof(SharedTextureMemoryBeginAccessDescriptor, signaledValues) == offsetof(WGPUSharedTextureMemoryBeginAccessDescriptor, signaledValues), - "offsetof mismatch for SharedTextureMemoryBeginAccessDescriptor::signaledValues"); +// Buffer - // SharedTextureMemoryDescriptor +static_assert(sizeof(Buffer) == sizeof(WGPUBuffer), + "sizeof mismatch for Buffer"); +static_assert(alignof(Buffer) == alignof(WGPUBuffer), + "alignof mismatch for Buffer"); - static_assert(sizeof(SharedTextureMemoryDescriptor) == sizeof(WGPUSharedTextureMemoryDescriptor), "sizeof mismatch for SharedTextureMemoryDescriptor"); - static_assert(alignof(SharedTextureMemoryDescriptor) == alignof(WGPUSharedTextureMemoryDescriptor), "alignof mismatch for SharedTextureMemoryDescriptor"); +void Buffer::Destroy() const { wgpuBufferDestroy(Get()); } +void const *Buffer::GetConstMappedRange(size_t offset, size_t size) const { + auto result = wgpuBufferGetConstMappedRange(Get(), offset, size); + return result; +} +BufferMapState Buffer::GetMapState() const { + auto result = wgpuBufferGetMapState(Get()); + return static_cast(result); +} +void *Buffer::GetMappedRange(size_t offset, size_t size) const { + auto result = wgpuBufferGetMappedRange(Get(), offset, size); + return result; +} +uint64_t Buffer::GetSize() const { + auto result = wgpuBufferGetSize(Get()); + return result; +} +BufferUsage Buffer::GetUsage() const { + auto result = wgpuBufferGetUsage(Get()); + return static_cast(result); +} +void Buffer::MapAsync(MapMode mode, size_t offset, size_t size, + BufferMapCallback callback, void *userdata) const { + wgpuBufferMapAsync(Get(), static_cast(mode), offset, size, + callback, userdata); +} +Future Buffer::MapAsync(MapMode mode, size_t offset, size_t size, + BufferMapCallbackInfo callbackInfo) const { + auto result = wgpuBufferMapAsyncF( + Get(), static_cast(mode), offset, size, + *reinterpret_cast(&callbackInfo)); + return Future{result.id}; +} +void Buffer::SetLabel(char const *label) const { + wgpuBufferSetLabel(Get(), reinterpret_cast(label)); +} +void Buffer::Unmap() const { wgpuBufferUnmap(Get()); } +void Buffer::WGPUReference(WGPUBuffer handle) { + if (handle != nullptr) { + wgpuBufferReference(handle); + } +} +void Buffer::WGPURelease(WGPUBuffer handle) { + if (handle != nullptr) { + wgpuBufferRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryDescriptor, nextInChain) == offsetof(WGPUSharedTextureMemoryDescriptor, nextInChain), - "offsetof mismatch for SharedTextureMemoryDescriptor::nextInChain"); - static_assert(offsetof(SharedTextureMemoryDescriptor, label) == offsetof(WGPUSharedTextureMemoryDescriptor, label), - "offsetof mismatch for SharedTextureMemoryDescriptor::label"); +// CommandBuffer - // SharedTextureMemoryDmaBufPlane +static_assert(sizeof(CommandBuffer) == sizeof(WGPUCommandBuffer), + "sizeof mismatch for CommandBuffer"); +static_assert(alignof(CommandBuffer) == alignof(WGPUCommandBuffer), + "alignof mismatch for CommandBuffer"); - static_assert(sizeof(SharedTextureMemoryDmaBufPlane) == sizeof(WGPUSharedTextureMemoryDmaBufPlane), "sizeof mismatch for SharedTextureMemoryDmaBufPlane"); - static_assert(alignof(SharedTextureMemoryDmaBufPlane) == alignof(WGPUSharedTextureMemoryDmaBufPlane), "alignof mismatch for SharedTextureMemoryDmaBufPlane"); +void CommandBuffer::SetLabel(char const *label) const { + wgpuCommandBufferSetLabel(Get(), reinterpret_cast(label)); +} +void CommandBuffer::WGPUReference(WGPUCommandBuffer handle) { + if (handle != nullptr) { + wgpuCommandBufferReference(handle); + } +} +void CommandBuffer::WGPURelease(WGPUCommandBuffer handle) { + if (handle != nullptr) { + wgpuCommandBufferRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryDmaBufPlane, fd) == offsetof(WGPUSharedTextureMemoryDmaBufPlane, fd), - "offsetof mismatch for SharedTextureMemoryDmaBufPlane::fd"); - static_assert(offsetof(SharedTextureMemoryDmaBufPlane, offset) == offsetof(WGPUSharedTextureMemoryDmaBufPlane, offset), - "offsetof mismatch for SharedTextureMemoryDmaBufPlane::offset"); - static_assert(offsetof(SharedTextureMemoryDmaBufPlane, stride) == offsetof(WGPUSharedTextureMemoryDmaBufPlane, stride), - "offsetof mismatch for SharedTextureMemoryDmaBufPlane::stride"); +// CommandEncoder - // SharedTextureMemoryEndAccessState +static_assert(sizeof(CommandEncoder) == sizeof(WGPUCommandEncoder), + "sizeof mismatch for CommandEncoder"); +static_assert(alignof(CommandEncoder) == alignof(WGPUCommandEncoder), + "alignof mismatch for CommandEncoder"); - static_assert(sizeof(SharedTextureMemoryEndAccessState) == sizeof(WGPUSharedTextureMemoryEndAccessState), "sizeof mismatch for SharedTextureMemoryEndAccessState"); - static_assert(alignof(SharedTextureMemoryEndAccessState) == alignof(WGPUSharedTextureMemoryEndAccessState), "alignof mismatch for SharedTextureMemoryEndAccessState"); +ComputePassEncoder CommandEncoder::BeginComputePass( + ComputePassDescriptor const *descriptor) const { + auto result = wgpuCommandEncoderBeginComputePass( + Get(), reinterpret_cast(descriptor)); + return ComputePassEncoder::Acquire(result); +} +RenderPassEncoder +CommandEncoder::BeginRenderPass(RenderPassDescriptor const *descriptor) const { + auto result = wgpuCommandEncoderBeginRenderPass( + Get(), reinterpret_cast(descriptor)); + return RenderPassEncoder::Acquire(result); +} +void CommandEncoder::ClearBuffer(Buffer const &buffer, uint64_t offset, + uint64_t size) const { + wgpuCommandEncoderClearBuffer(Get(), buffer.Get(), offset, size); +} +void CommandEncoder::CopyBufferToBuffer(Buffer const &source, + uint64_t sourceOffset, + Buffer const &destination, + uint64_t destinationOffset, + uint64_t size) const { + wgpuCommandEncoderCopyBufferToBuffer(Get(), source.Get(), sourceOffset, + destination.Get(), destinationOffset, + size); +} +void CommandEncoder::CopyBufferToTexture(ImageCopyBuffer const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize) const { + wgpuCommandEncoderCopyBufferToTexture( + Get(), reinterpret_cast(source), + reinterpret_cast(destination), + reinterpret_cast(copySize)); +} +void CommandEncoder::CopyTextureToBuffer(ImageCopyTexture const *source, + ImageCopyBuffer const *destination, + Extent3D const *copySize) const { + wgpuCommandEncoderCopyTextureToBuffer( + Get(), reinterpret_cast(source), + reinterpret_cast(destination), + reinterpret_cast(copySize)); +} +void CommandEncoder::CopyTextureToTexture(ImageCopyTexture const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize) const { + wgpuCommandEncoderCopyTextureToTexture( + Get(), reinterpret_cast(source), + reinterpret_cast(destination), + reinterpret_cast(copySize)); +} +CommandBuffer +CommandEncoder::Finish(CommandBufferDescriptor const *descriptor) const { + auto result = wgpuCommandEncoderFinish( + Get(), reinterpret_cast(descriptor)); + return CommandBuffer::Acquire(result); +} +void CommandEncoder::InjectValidationError(char const *message) const { + wgpuCommandEncoderInjectValidationError( + Get(), reinterpret_cast(message)); +} +void CommandEncoder::InsertDebugMarker(char const *markerLabel) const { + wgpuCommandEncoderInsertDebugMarker( + Get(), reinterpret_cast(markerLabel)); +} +void CommandEncoder::PopDebugGroup() const { + wgpuCommandEncoderPopDebugGroup(Get()); +} +void CommandEncoder::PushDebugGroup(char const *groupLabel) const { + wgpuCommandEncoderPushDebugGroup(Get(), + reinterpret_cast(groupLabel)); +} +void CommandEncoder::ResolveQuerySet(QuerySet const &querySet, + uint32_t firstQuery, uint32_t queryCount, + Buffer const &destination, + uint64_t destinationOffset) const { + wgpuCommandEncoderResolveQuerySet(Get(), querySet.Get(), firstQuery, + queryCount, destination.Get(), + destinationOffset); +} +void CommandEncoder::SetLabel(char const *label) const { + wgpuCommandEncoderSetLabel(Get(), reinterpret_cast(label)); +} +void CommandEncoder::WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, + uint8_t const *data, uint64_t size) const { + wgpuCommandEncoderWriteBuffer(Get(), buffer.Get(), bufferOffset, + reinterpret_cast(data), size); +} +void CommandEncoder::WriteTimestamp(QuerySet const &querySet, + uint32_t queryIndex) const { + wgpuCommandEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); +} +void CommandEncoder::WGPUReference(WGPUCommandEncoder handle) { + if (handle != nullptr) { + wgpuCommandEncoderReference(handle); + } +} +void CommandEncoder::WGPURelease(WGPUCommandEncoder handle) { + if (handle != nullptr) { + wgpuCommandEncoderRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryEndAccessState, nextInChain) == offsetof(WGPUSharedTextureMemoryEndAccessState, nextInChain), - "offsetof mismatch for SharedTextureMemoryEndAccessState::nextInChain"); - static_assert(offsetof(SharedTextureMemoryEndAccessState, initialized) == offsetof(WGPUSharedTextureMemoryEndAccessState, initialized), - "offsetof mismatch for SharedTextureMemoryEndAccessState::initialized"); - static_assert(offsetof(SharedTextureMemoryEndAccessState, fenceCount) == offsetof(WGPUSharedTextureMemoryEndAccessState, fenceCount), - "offsetof mismatch for SharedTextureMemoryEndAccessState::fenceCount"); - static_assert(offsetof(SharedTextureMemoryEndAccessState, fences) == offsetof(WGPUSharedTextureMemoryEndAccessState, fences), - "offsetof mismatch for SharedTextureMemoryEndAccessState::fences"); - static_assert(offsetof(SharedTextureMemoryEndAccessState, signaledValues) == offsetof(WGPUSharedTextureMemoryEndAccessState, signaledValues), - "offsetof mismatch for SharedTextureMemoryEndAccessState::signaledValues"); +// ComputePassEncoder - // SharedTextureMemoryOpaqueFDDescriptor +static_assert(sizeof(ComputePassEncoder) == sizeof(WGPUComputePassEncoder), + "sizeof mismatch for ComputePassEncoder"); +static_assert(alignof(ComputePassEncoder) == alignof(WGPUComputePassEncoder), + "alignof mismatch for ComputePassEncoder"); - static_assert(sizeof(SharedTextureMemoryOpaqueFDDescriptor) == sizeof(WGPUSharedTextureMemoryOpaqueFDDescriptor), "sizeof mismatch for SharedTextureMemoryOpaqueFDDescriptor"); - static_assert(alignof(SharedTextureMemoryOpaqueFDDescriptor) == alignof(WGPUSharedTextureMemoryOpaqueFDDescriptor), "alignof mismatch for SharedTextureMemoryOpaqueFDDescriptor"); +void ComputePassEncoder::DispatchWorkgroups(uint32_t workgroupCountX, + uint32_t workgroupCountY, + uint32_t workgroupCountZ) const { + wgpuComputePassEncoderDispatchWorkgroups(Get(), workgroupCountX, + workgroupCountY, workgroupCountZ); +} +void ComputePassEncoder::DispatchWorkgroupsIndirect( + Buffer const &indirectBuffer, uint64_t indirectOffset) const { + wgpuComputePassEncoderDispatchWorkgroupsIndirect(Get(), indirectBuffer.Get(), + indirectOffset); +} +void ComputePassEncoder::End() const { wgpuComputePassEncoderEnd(Get()); } +void ComputePassEncoder::InsertDebugMarker(char const *markerLabel) const { + wgpuComputePassEncoderInsertDebugMarker( + Get(), reinterpret_cast(markerLabel)); +} +void ComputePassEncoder::PopDebugGroup() const { + wgpuComputePassEncoderPopDebugGroup(Get()); +} +void ComputePassEncoder::PushDebugGroup(char const *groupLabel) const { + wgpuComputePassEncoderPushDebugGroup( + Get(), reinterpret_cast(groupLabel)); +} +void ComputePassEncoder::SetBindGroup(uint32_t groupIndex, + BindGroup const &group, + size_t dynamicOffsetCount, + uint32_t const *dynamicOffsets) const { + wgpuComputePassEncoderSetBindGroup( + Get(), groupIndex, group.Get(), dynamicOffsetCount, + reinterpret_cast(dynamicOffsets)); +} +void ComputePassEncoder::SetLabel(char const *label) const { + wgpuComputePassEncoderSetLabel(Get(), reinterpret_cast(label)); +} +void ComputePassEncoder::SetPipeline(ComputePipeline const &pipeline) const { + wgpuComputePassEncoderSetPipeline(Get(), pipeline.Get()); +} +void ComputePassEncoder::WriteTimestamp(QuerySet const &querySet, + uint32_t queryIndex) const { + wgpuComputePassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); +} +void ComputePassEncoder::WGPUReference(WGPUComputePassEncoder handle) { + if (handle != nullptr) { + wgpuComputePassEncoderReference(handle); + } +} +void ComputePassEncoder::WGPURelease(WGPUComputePassEncoder handle) { + if (handle != nullptr) { + wgpuComputePassEncoderRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, vkImageCreateInfo) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, vkImageCreateInfo), - "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::vkImageCreateInfo"); - static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, memoryFD) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, memoryFD), - "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::memoryFD"); - static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, memoryTypeIndex) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, memoryTypeIndex), - "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::memoryTypeIndex"); - static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, allocationSize) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, allocationSize), - "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::allocationSize"); - static_assert(offsetof(SharedTextureMemoryOpaqueFDDescriptor, dedicatedAllocation) == offsetof(WGPUSharedTextureMemoryOpaqueFDDescriptor, dedicatedAllocation), - "offsetof mismatch for SharedTextureMemoryOpaqueFDDescriptor::dedicatedAllocation"); +// ComputePipeline - // SharedTextureMemoryVkDedicatedAllocationDescriptor +static_assert(sizeof(ComputePipeline) == sizeof(WGPUComputePipeline), + "sizeof mismatch for ComputePipeline"); +static_assert(alignof(ComputePipeline) == alignof(WGPUComputePipeline), + "alignof mismatch for ComputePipeline"); - static_assert(sizeof(SharedTextureMemoryVkDedicatedAllocationDescriptor) == sizeof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor), "sizeof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor"); - static_assert(alignof(SharedTextureMemoryVkDedicatedAllocationDescriptor) == alignof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor), "alignof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor"); +BindGroupLayout ComputePipeline::GetBindGroupLayout(uint32_t groupIndex) const { + auto result = wgpuComputePipelineGetBindGroupLayout(Get(), groupIndex); + return BindGroupLayout::Acquire(result); +} +void ComputePipeline::SetLabel(char const *label) const { + wgpuComputePipelineSetLabel(Get(), reinterpret_cast(label)); +} +void ComputePipeline::WGPUReference(WGPUComputePipeline handle) { + if (handle != nullptr) { + wgpuComputePipelineReference(handle); + } +} +void ComputePipeline::WGPURelease(WGPUComputePipeline handle) { + if (handle != nullptr) { + wgpuComputePipelineRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryVkDedicatedAllocationDescriptor, dedicatedAllocation) == offsetof(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor, dedicatedAllocation), - "offsetof mismatch for SharedTextureMemoryVkDedicatedAllocationDescriptor::dedicatedAllocation"); +// Device - // SharedTextureMemoryVkImageLayoutBeginState +static_assert(sizeof(Device) == sizeof(WGPUDevice), + "sizeof mismatch for Device"); +static_assert(alignof(Device) == alignof(WGPUDevice), + "alignof mismatch for Device"); - static_assert(sizeof(SharedTextureMemoryVkImageLayoutBeginState) == sizeof(WGPUSharedTextureMemoryVkImageLayoutBeginState), "sizeof mismatch for SharedTextureMemoryVkImageLayoutBeginState"); - static_assert(alignof(SharedTextureMemoryVkImageLayoutBeginState) == alignof(WGPUSharedTextureMemoryVkImageLayoutBeginState), "alignof mismatch for SharedTextureMemoryVkImageLayoutBeginState"); +BindGroup Device::CreateBindGroup(BindGroupDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateBindGroup( + Get(), reinterpret_cast(descriptor)); + return BindGroup::Acquire(result); +} +BindGroupLayout Device::CreateBindGroupLayout( + BindGroupLayoutDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateBindGroupLayout( + Get(), + reinterpret_cast(descriptor)); + return BindGroupLayout::Acquire(result); +} +Buffer Device::CreateBuffer(BufferDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateBuffer( + Get(), reinterpret_cast(descriptor)); + return Buffer::Acquire(result); +} +CommandEncoder +Device::CreateCommandEncoder(CommandEncoderDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateCommandEncoder( + Get(), + reinterpret_cast(descriptor)); + return CommandEncoder::Acquire(result); +} +ComputePipeline Device::CreateComputePipeline( + ComputePipelineDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateComputePipeline( + Get(), + reinterpret_cast(descriptor)); + return ComputePipeline::Acquire(result); +} +void Device::CreateComputePipelineAsync( + ComputePipelineDescriptor const *descriptor, + CreateComputePipelineAsyncCallback callback, void *userdata) const { + wgpuDeviceCreateComputePipelineAsync( + Get(), + reinterpret_cast(descriptor), + callback, userdata); +} +Future Device::CreateComputePipelineAsync( + ComputePipelineDescriptor const *descriptor, + CreateComputePipelineAsyncCallbackInfo callbackInfo) const { + auto result = wgpuDeviceCreateComputePipelineAsyncF( + Get(), + reinterpret_cast(descriptor), + *reinterpret_cast( + &callbackInfo)); + return Future{result.id}; +} +Buffer Device::CreateErrorBuffer(BufferDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateErrorBuffer( + Get(), reinterpret_cast(descriptor)); + return Buffer::Acquire(result); +} +ExternalTexture Device::CreateErrorExternalTexture() const { + auto result = wgpuDeviceCreateErrorExternalTexture(Get()); + return ExternalTexture::Acquire(result); +} +ShaderModule +Device::CreateErrorShaderModule(ShaderModuleDescriptor const *descriptor, + char const *errorMessage) const { + auto result = wgpuDeviceCreateErrorShaderModule( + Get(), reinterpret_cast(descriptor), + reinterpret_cast(errorMessage)); + return ShaderModule::Acquire(result); +} +Texture Device::CreateErrorTexture(TextureDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateErrorTexture( + Get(), reinterpret_cast(descriptor)); + return Texture::Acquire(result); +} +ExternalTexture Device::CreateExternalTexture( + ExternalTextureDescriptor const *externalTextureDescriptor) const { + auto result = wgpuDeviceCreateExternalTexture( + Get(), reinterpret_cast( + externalTextureDescriptor)); + return ExternalTexture::Acquire(result); +} +PipelineLayout +Device::CreatePipelineLayout(PipelineLayoutDescriptor const *descriptor) const { + auto result = wgpuDeviceCreatePipelineLayout( + Get(), + reinterpret_cast(descriptor)); + return PipelineLayout::Acquire(result); +} +QuerySet Device::CreateQuerySet(QuerySetDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateQuerySet( + Get(), reinterpret_cast(descriptor)); + return QuerySet::Acquire(result); +} +RenderBundleEncoder Device::CreateRenderBundleEncoder( + RenderBundleEncoderDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateRenderBundleEncoder( + Get(), + reinterpret_cast(descriptor)); + return RenderBundleEncoder::Acquire(result); +} +RenderPipeline +Device::CreateRenderPipeline(RenderPipelineDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateRenderPipeline( + Get(), + reinterpret_cast(descriptor)); + return RenderPipeline::Acquire(result); +} +void Device::CreateRenderPipelineAsync( + RenderPipelineDescriptor const *descriptor, + CreateRenderPipelineAsyncCallback callback, void *userdata) const { + wgpuDeviceCreateRenderPipelineAsync( + Get(), reinterpret_cast(descriptor), + callback, userdata); +} +Future Device::CreateRenderPipelineAsync( + RenderPipelineDescriptor const *descriptor, + CreateRenderPipelineAsyncCallbackInfo callbackInfo) const { + auto result = wgpuDeviceCreateRenderPipelineAsyncF( + Get(), reinterpret_cast(descriptor), + *reinterpret_cast( + &callbackInfo)); + return Future{result.id}; +} +Sampler Device::CreateSampler(SamplerDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateSampler( + Get(), reinterpret_cast(descriptor)); + return Sampler::Acquire(result); +} +ShaderModule +Device::CreateShaderModule(ShaderModuleDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateShaderModule( + Get(), reinterpret_cast(descriptor)); + return ShaderModule::Acquire(result); +} +SwapChain Device::CreateSwapChain(Surface const &surface, + SwapChainDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateSwapChain( + Get(), surface.Get(), + reinterpret_cast(descriptor)); + return SwapChain::Acquire(result); +} +Texture Device::CreateTexture(TextureDescriptor const *descriptor) const { + auto result = wgpuDeviceCreateTexture( + Get(), reinterpret_cast(descriptor)); + return Texture::Acquire(result); +} +void Device::Destroy() const { wgpuDeviceDestroy(Get()); } +size_t Device::EnumerateFeatures(FeatureName *features) const { + auto result = wgpuDeviceEnumerateFeatures( + Get(), reinterpret_cast(features)); + return result; +} +void Device::ForceLoss(DeviceLostReason type, char const *message) const { + wgpuDeviceForceLoss(Get(), static_cast(type), + reinterpret_cast(message)); +} +Adapter Device::GetAdapter() const { + auto result = wgpuDeviceGetAdapter(Get()); + return Adapter::Acquire(result); +} +Bool Device::GetLimits(SupportedLimits *limits) const { + auto result = wgpuDeviceGetLimits( + Get(), reinterpret_cast(limits)); + return result; +} +Queue Device::GetQueue() const { + auto result = wgpuDeviceGetQueue(Get()); + return Queue::Acquire(result); +} +TextureUsage Device::GetSupportedSurfaceUsage(Surface const &surface) const { + auto result = wgpuDeviceGetSupportedSurfaceUsage(Get(), surface.Get()); + return static_cast(result); +} +Bool Device::HasFeature(FeatureName feature) const { + auto result = + wgpuDeviceHasFeature(Get(), static_cast(feature)); + return result; +} +SharedBufferMemory Device::ImportSharedBufferMemory( + SharedBufferMemoryDescriptor const *descriptor) const { + auto result = wgpuDeviceImportSharedBufferMemory( + Get(), + reinterpret_cast(descriptor)); + return SharedBufferMemory::Acquire(result); +} +SharedFence +Device::ImportSharedFence(SharedFenceDescriptor const *descriptor) const { + auto result = wgpuDeviceImportSharedFence( + Get(), reinterpret_cast(descriptor)); + return SharedFence::Acquire(result); +} +SharedTextureMemory Device::ImportSharedTextureMemory( + SharedTextureMemoryDescriptor const *descriptor) const { + auto result = wgpuDeviceImportSharedTextureMemory( + Get(), + reinterpret_cast(descriptor)); + return SharedTextureMemory::Acquire(result); +} +void Device::InjectError(ErrorType type, char const *message) const { + wgpuDeviceInjectError(Get(), static_cast(type), + reinterpret_cast(message)); +} +void Device::PopErrorScope(ErrorCallback oldCallback, void *userdata) const { + wgpuDevicePopErrorScope(Get(), oldCallback, userdata); +} +Future Device::PopErrorScope(PopErrorScopeCallbackInfo callbackInfo) const { + auto result = wgpuDevicePopErrorScopeF( + Get(), + *reinterpret_cast(&callbackInfo)); + return Future{result.id}; +} +void Device::PushErrorScope(ErrorFilter filter) const { + wgpuDevicePushErrorScope(Get(), static_cast(filter)); +} +void Device::SetDeviceLostCallback(DeviceLostCallback callback, + void *userdata) const { + wgpuDeviceSetDeviceLostCallback(Get(), callback, userdata); +} +void Device::SetLabel(char const *label) const { + wgpuDeviceSetLabel(Get(), reinterpret_cast(label)); +} +void Device::SetLoggingCallback(LoggingCallback callback, + void *userdata) const { + wgpuDeviceSetLoggingCallback(Get(), callback, userdata); +} +void Device::SetUncapturedErrorCallback(ErrorCallback callback, + void *userdata) const { + wgpuDeviceSetUncapturedErrorCallback(Get(), callback, userdata); +} +void Device::Tick() const { wgpuDeviceTick(Get()); } +void Device::ValidateTextureDescriptor( + TextureDescriptor const *descriptor) const { + wgpuDeviceValidateTextureDescriptor( + Get(), reinterpret_cast(descriptor)); +} +void Device::WGPUReference(WGPUDevice handle) { + if (handle != nullptr) { + wgpuDeviceReference(handle); + } +} +void Device::WGPURelease(WGPUDevice handle) { + if (handle != nullptr) { + wgpuDeviceRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryVkImageLayoutBeginState, oldLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutBeginState, oldLayout), - "offsetof mismatch for SharedTextureMemoryVkImageLayoutBeginState::oldLayout"); - static_assert(offsetof(SharedTextureMemoryVkImageLayoutBeginState, newLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutBeginState, newLayout), - "offsetof mismatch for SharedTextureMemoryVkImageLayoutBeginState::newLayout"); +// ExternalTexture - // SharedTextureMemoryVkImageLayoutEndState +static_assert(sizeof(ExternalTexture) == sizeof(WGPUExternalTexture), + "sizeof mismatch for ExternalTexture"); +static_assert(alignof(ExternalTexture) == alignof(WGPUExternalTexture), + "alignof mismatch for ExternalTexture"); - static_assert(sizeof(SharedTextureMemoryVkImageLayoutEndState) == sizeof(WGPUSharedTextureMemoryVkImageLayoutEndState), "sizeof mismatch for SharedTextureMemoryVkImageLayoutEndState"); - static_assert(alignof(SharedTextureMemoryVkImageLayoutEndState) == alignof(WGPUSharedTextureMemoryVkImageLayoutEndState), "alignof mismatch for SharedTextureMemoryVkImageLayoutEndState"); +void ExternalTexture::Destroy() const { wgpuExternalTextureDestroy(Get()); } +void ExternalTexture::Expire() const { wgpuExternalTextureExpire(Get()); } +void ExternalTexture::Refresh() const { wgpuExternalTextureRefresh(Get()); } +void ExternalTexture::SetLabel(char const *label) const { + wgpuExternalTextureSetLabel(Get(), reinterpret_cast(label)); +} +void ExternalTexture::WGPUReference(WGPUExternalTexture handle) { + if (handle != nullptr) { + wgpuExternalTextureReference(handle); + } +} +void ExternalTexture::WGPURelease(WGPUExternalTexture handle) { + if (handle != nullptr) { + wgpuExternalTextureRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryVkImageLayoutEndState, oldLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutEndState, oldLayout), - "offsetof mismatch for SharedTextureMemoryVkImageLayoutEndState::oldLayout"); - static_assert(offsetof(SharedTextureMemoryVkImageLayoutEndState, newLayout) == offsetof(WGPUSharedTextureMemoryVkImageLayoutEndState, newLayout), - "offsetof mismatch for SharedTextureMemoryVkImageLayoutEndState::newLayout"); +// Instance - // SharedTextureMemoryZirconHandleDescriptor +static_assert(sizeof(Instance) == sizeof(WGPUInstance), + "sizeof mismatch for Instance"); +static_assert(alignof(Instance) == alignof(WGPUInstance), + "alignof mismatch for Instance"); - static_assert(sizeof(SharedTextureMemoryZirconHandleDescriptor) == sizeof(WGPUSharedTextureMemoryZirconHandleDescriptor), "sizeof mismatch for SharedTextureMemoryZirconHandleDescriptor"); - static_assert(alignof(SharedTextureMemoryZirconHandleDescriptor) == alignof(WGPUSharedTextureMemoryZirconHandleDescriptor), "alignof mismatch for SharedTextureMemoryZirconHandleDescriptor"); +Surface Instance::CreateSurface(SurfaceDescriptor const *descriptor) const { + auto result = wgpuInstanceCreateSurface( + Get(), reinterpret_cast(descriptor)); + return Surface::Acquire(result); +} +size_t +Instance::EnumerateWGSLLanguageFeatures(WGSLFeatureName *features) const { + auto result = wgpuInstanceEnumerateWGSLLanguageFeatures( + Get(), reinterpret_cast(features)); + return result; +} +Bool Instance::HasWGSLLanguageFeature(WGSLFeatureName feature) const { + auto result = wgpuInstanceHasWGSLLanguageFeature( + Get(), static_cast(feature)); + return result; +} +void Instance::ProcessEvents() const { wgpuInstanceProcessEvents(Get()); } +void Instance::RequestAdapter(RequestAdapterOptions const *options, + RequestAdapterCallback callback, + void *userdata) const { + wgpuInstanceRequestAdapter( + Get(), reinterpret_cast(options), + callback, userdata); +} +Future Instance::RequestAdapter(RequestAdapterOptions const *options, + RequestAdapterCallbackInfo callbackInfo) const { + auto result = wgpuInstanceRequestAdapterF( + Get(), reinterpret_cast(options), + *reinterpret_cast(&callbackInfo)); + return Future{result.id}; +} +WaitStatus Instance::WaitAny(size_t futureCount, FutureWaitInfo *futures, + uint64_t timeoutNS) const { + auto result = wgpuInstanceWaitAny( + Get(), futureCount, reinterpret_cast(futures), + timeoutNS); + return static_cast(result); +} +void Instance::WGPUReference(WGPUInstance handle) { + if (handle != nullptr) { + wgpuInstanceReference(handle); + } +} +void Instance::WGPURelease(WGPUInstance handle) { + if (handle != nullptr) { + wgpuInstanceRelease(handle); + } +} - static_assert(offsetof(SharedTextureMemoryZirconHandleDescriptor, memoryFD) == offsetof(WGPUSharedTextureMemoryZirconHandleDescriptor, memoryFD), - "offsetof mismatch for SharedTextureMemoryZirconHandleDescriptor::memoryFD"); - static_assert(offsetof(SharedTextureMemoryZirconHandleDescriptor, allocationSize) == offsetof(WGPUSharedTextureMemoryZirconHandleDescriptor, allocationSize), - "offsetof mismatch for SharedTextureMemoryZirconHandleDescriptor::allocationSize"); +// PipelineLayout - // StaticSamplerBindingLayout +static_assert(sizeof(PipelineLayout) == sizeof(WGPUPipelineLayout), + "sizeof mismatch for PipelineLayout"); +static_assert(alignof(PipelineLayout) == alignof(WGPUPipelineLayout), + "alignof mismatch for PipelineLayout"); - static_assert(sizeof(StaticSamplerBindingLayout) == sizeof(WGPUStaticSamplerBindingLayout), "sizeof mismatch for StaticSamplerBindingLayout"); - static_assert(alignof(StaticSamplerBindingLayout) == alignof(WGPUStaticSamplerBindingLayout), "alignof mismatch for StaticSamplerBindingLayout"); +void PipelineLayout::SetLabel(char const *label) const { + wgpuPipelineLayoutSetLabel(Get(), reinterpret_cast(label)); +} +void PipelineLayout::WGPUReference(WGPUPipelineLayout handle) { + if (handle != nullptr) { + wgpuPipelineLayoutReference(handle); + } +} +void PipelineLayout::WGPURelease(WGPUPipelineLayout handle) { + if (handle != nullptr) { + wgpuPipelineLayoutRelease(handle); + } +} - static_assert(offsetof(StaticSamplerBindingLayout, sampler) == offsetof(WGPUStaticSamplerBindingLayout, sampler), - "offsetof mismatch for StaticSamplerBindingLayout::sampler"); +// QuerySet - // StencilFaceState +static_assert(sizeof(QuerySet) == sizeof(WGPUQuerySet), + "sizeof mismatch for QuerySet"); +static_assert(alignof(QuerySet) == alignof(WGPUQuerySet), + "alignof mismatch for QuerySet"); - static_assert(sizeof(StencilFaceState) == sizeof(WGPUStencilFaceState), "sizeof mismatch for StencilFaceState"); - static_assert(alignof(StencilFaceState) == alignof(WGPUStencilFaceState), "alignof mismatch for StencilFaceState"); +void QuerySet::Destroy() const { wgpuQuerySetDestroy(Get()); } +uint32_t QuerySet::GetCount() const { + auto result = wgpuQuerySetGetCount(Get()); + return result; +} +QueryType QuerySet::GetType() const { + auto result = wgpuQuerySetGetType(Get()); + return static_cast(result); +} +void QuerySet::SetLabel(char const *label) const { + wgpuQuerySetSetLabel(Get(), reinterpret_cast(label)); +} +void QuerySet::WGPUReference(WGPUQuerySet handle) { + if (handle != nullptr) { + wgpuQuerySetReference(handle); + } +} +void QuerySet::WGPURelease(WGPUQuerySet handle) { + if (handle != nullptr) { + wgpuQuerySetRelease(handle); + } +} - static_assert(offsetof(StencilFaceState, compare) == offsetof(WGPUStencilFaceState, compare), - "offsetof mismatch for StencilFaceState::compare"); - static_assert(offsetof(StencilFaceState, failOp) == offsetof(WGPUStencilFaceState, failOp), - "offsetof mismatch for StencilFaceState::failOp"); - static_assert(offsetof(StencilFaceState, depthFailOp) == offsetof(WGPUStencilFaceState, depthFailOp), - "offsetof mismatch for StencilFaceState::depthFailOp"); - static_assert(offsetof(StencilFaceState, passOp) == offsetof(WGPUStencilFaceState, passOp), - "offsetof mismatch for StencilFaceState::passOp"); +// Queue + +static_assert(sizeof(Queue) == sizeof(WGPUQueue), "sizeof mismatch for Queue"); +static_assert(alignof(Queue) == alignof(WGPUQueue), + "alignof mismatch for Queue"); + +void Queue::CopyExternalTextureForBrowser( + ImageCopyExternalTexture const *source, ImageCopyTexture const *destination, + Extent3D const *copySize, + CopyTextureForBrowserOptions const *options) const { + wgpuQueueCopyExternalTextureForBrowser( + Get(), reinterpret_cast(source), + reinterpret_cast(destination), + reinterpret_cast(copySize), + reinterpret_cast(options)); +} +void Queue::CopyTextureForBrowser( + ImageCopyTexture const *source, ImageCopyTexture const *destination, + Extent3D const *copySize, + CopyTextureForBrowserOptions const *options) const { + wgpuQueueCopyTextureForBrowser( + Get(), reinterpret_cast(source), + reinterpret_cast(destination), + reinterpret_cast(copySize), + reinterpret_cast(options)); +} +void Queue::OnSubmittedWorkDone(QueueWorkDoneCallback callback, + void *userdata) const { + wgpuQueueOnSubmittedWorkDone(Get(), callback, userdata); +} +Future +Queue::OnSubmittedWorkDone(QueueWorkDoneCallbackInfo callbackInfo) const { + auto result = wgpuQueueOnSubmittedWorkDoneF( + Get(), + *reinterpret_cast(&callbackInfo)); + return Future{result.id}; +} +void Queue::SetLabel(char const *label) const { + wgpuQueueSetLabel(Get(), reinterpret_cast(label)); +} +void Queue::Submit(size_t commandCount, CommandBuffer const *commands) const { + wgpuQueueSubmit(Get(), commandCount, + reinterpret_cast(commands)); +} +void Queue::WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, + void const *data, size_t size) const { + wgpuQueueWriteBuffer(Get(), buffer.Get(), bufferOffset, + reinterpret_cast(data), size); +} +void Queue::WriteTexture(ImageCopyTexture const *destination, void const *data, + size_t dataSize, TextureDataLayout const *dataLayout, + Extent3D const *writeSize) const { + wgpuQueueWriteTexture( + Get(), reinterpret_cast(destination), + reinterpret_cast(data), dataSize, + reinterpret_cast(dataLayout), + reinterpret_cast(writeSize)); +} +void Queue::WGPUReference(WGPUQueue handle) { + if (handle != nullptr) { + wgpuQueueReference(handle); + } +} +void Queue::WGPURelease(WGPUQueue handle) { + if (handle != nullptr) { + wgpuQueueRelease(handle); + } +} - // StorageTextureBindingLayout +// RenderBundle - static_assert(sizeof(StorageTextureBindingLayout) == sizeof(WGPUStorageTextureBindingLayout), "sizeof mismatch for StorageTextureBindingLayout"); - static_assert(alignof(StorageTextureBindingLayout) == alignof(WGPUStorageTextureBindingLayout), "alignof mismatch for StorageTextureBindingLayout"); +static_assert(sizeof(RenderBundle) == sizeof(WGPURenderBundle), + "sizeof mismatch for RenderBundle"); +static_assert(alignof(RenderBundle) == alignof(WGPURenderBundle), + "alignof mismatch for RenderBundle"); - static_assert(offsetof(StorageTextureBindingLayout, nextInChain) == offsetof(WGPUStorageTextureBindingLayout, nextInChain), - "offsetof mismatch for StorageTextureBindingLayout::nextInChain"); - static_assert(offsetof(StorageTextureBindingLayout, access) == offsetof(WGPUStorageTextureBindingLayout, access), - "offsetof mismatch for StorageTextureBindingLayout::access"); - static_assert(offsetof(StorageTextureBindingLayout, format) == offsetof(WGPUStorageTextureBindingLayout, format), - "offsetof mismatch for StorageTextureBindingLayout::format"); - static_assert(offsetof(StorageTextureBindingLayout, viewDimension) == offsetof(WGPUStorageTextureBindingLayout, viewDimension), - "offsetof mismatch for StorageTextureBindingLayout::viewDimension"); +void RenderBundle::SetLabel(char const *label) const { + wgpuRenderBundleSetLabel(Get(), reinterpret_cast(label)); +} +void RenderBundle::WGPUReference(WGPURenderBundle handle) { + if (handle != nullptr) { + wgpuRenderBundleReference(handle); + } +} +void RenderBundle::WGPURelease(WGPURenderBundle handle) { + if (handle != nullptr) { + wgpuRenderBundleRelease(handle); + } +} - // SurfaceDescriptor +// RenderBundleEncoder - static_assert(sizeof(SurfaceDescriptor) == sizeof(WGPUSurfaceDescriptor), "sizeof mismatch for SurfaceDescriptor"); - static_assert(alignof(SurfaceDescriptor) == alignof(WGPUSurfaceDescriptor), "alignof mismatch for SurfaceDescriptor"); +static_assert(sizeof(RenderBundleEncoder) == sizeof(WGPURenderBundleEncoder), + "sizeof mismatch for RenderBundleEncoder"); +static_assert(alignof(RenderBundleEncoder) == alignof(WGPURenderBundleEncoder), + "alignof mismatch for RenderBundleEncoder"); - static_assert(offsetof(SurfaceDescriptor, nextInChain) == offsetof(WGPUSurfaceDescriptor, nextInChain), - "offsetof mismatch for SurfaceDescriptor::nextInChain"); - static_assert(offsetof(SurfaceDescriptor, label) == offsetof(WGPUSurfaceDescriptor, label), - "offsetof mismatch for SurfaceDescriptor::label"); +void RenderBundleEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance) const { + wgpuRenderBundleEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, + firstInstance); +} +void RenderBundleEncoder::DrawIndexed(uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, int32_t baseVertex, + uint32_t firstInstance) const { + wgpuRenderBundleEncoderDrawIndexed(Get(), indexCount, instanceCount, + firstIndex, baseVertex, firstInstance); +} +void RenderBundleEncoder::DrawIndexedIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const { + wgpuRenderBundleEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), + indirectOffset); +} +void RenderBundleEncoder::DrawIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const { + wgpuRenderBundleEncoderDrawIndirect(Get(), indirectBuffer.Get(), + indirectOffset); +} +RenderBundle +RenderBundleEncoder::Finish(RenderBundleDescriptor const *descriptor) const { + auto result = wgpuRenderBundleEncoderFinish( + Get(), reinterpret_cast(descriptor)); + return RenderBundle::Acquire(result); +} +void RenderBundleEncoder::InsertDebugMarker(char const *markerLabel) const { + wgpuRenderBundleEncoderInsertDebugMarker( + Get(), reinterpret_cast(markerLabel)); +} +void RenderBundleEncoder::PopDebugGroup() const { + wgpuRenderBundleEncoderPopDebugGroup(Get()); +} +void RenderBundleEncoder::PushDebugGroup(char const *groupLabel) const { + wgpuRenderBundleEncoderPushDebugGroup( + Get(), reinterpret_cast(groupLabel)); +} +void RenderBundleEncoder::SetBindGroup(uint32_t groupIndex, + BindGroup const &group, + size_t dynamicOffsetCount, + uint32_t const *dynamicOffsets) const { + wgpuRenderBundleEncoderSetBindGroup( + Get(), groupIndex, group.Get(), dynamicOffsetCount, + reinterpret_cast(dynamicOffsets)); +} +void RenderBundleEncoder::SetIndexBuffer(Buffer const &buffer, + IndexFormat format, uint64_t offset, + uint64_t size) const { + wgpuRenderBundleEncoderSetIndexBuffer( + Get(), buffer.Get(), static_cast(format), offset, size); +} +void RenderBundleEncoder::SetLabel(char const *label) const { + wgpuRenderBundleEncoderSetLabel(Get(), reinterpret_cast(label)); +} +void RenderBundleEncoder::SetPipeline(RenderPipeline const &pipeline) const { + wgpuRenderBundleEncoderSetPipeline(Get(), pipeline.Get()); +} +void RenderBundleEncoder::SetVertexBuffer(uint32_t slot, Buffer const &buffer, + uint64_t offset, + uint64_t size) const { + wgpuRenderBundleEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, + size); +} +void RenderBundleEncoder::WGPUReference(WGPURenderBundleEncoder handle) { + if (handle != nullptr) { + wgpuRenderBundleEncoderReference(handle); + } +} +void RenderBundleEncoder::WGPURelease(WGPURenderBundleEncoder handle) { + if (handle != nullptr) { + wgpuRenderBundleEncoderRelease(handle); + } +} - // SurfaceDescriptorFromAndroidNativeWindow +// RenderPassEncoder - static_assert(sizeof(SurfaceDescriptorFromAndroidNativeWindow) == sizeof(WGPUSurfaceDescriptorFromAndroidNativeWindow), "sizeof mismatch for SurfaceDescriptorFromAndroidNativeWindow"); - static_assert(alignof(SurfaceDescriptorFromAndroidNativeWindow) == alignof(WGPUSurfaceDescriptorFromAndroidNativeWindow), "alignof mismatch for SurfaceDescriptorFromAndroidNativeWindow"); +static_assert(sizeof(RenderPassEncoder) == sizeof(WGPURenderPassEncoder), + "sizeof mismatch for RenderPassEncoder"); +static_assert(alignof(RenderPassEncoder) == alignof(WGPURenderPassEncoder), + "alignof mismatch for RenderPassEncoder"); - static_assert(offsetof(SurfaceDescriptorFromAndroidNativeWindow, window) == offsetof(WGPUSurfaceDescriptorFromAndroidNativeWindow, window), - "offsetof mismatch for SurfaceDescriptorFromAndroidNativeWindow::window"); +void RenderPassEncoder::BeginOcclusionQuery(uint32_t queryIndex) const { + wgpuRenderPassEncoderBeginOcclusionQuery(Get(), queryIndex); +} +void RenderPassEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance) const { + wgpuRenderPassEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, + firstInstance); +} +void RenderPassEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, + uint32_t firstIndex, int32_t baseVertex, + uint32_t firstInstance) const { + wgpuRenderPassEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, + baseVertex, firstInstance); +} +void RenderPassEncoder::DrawIndexedIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const { + wgpuRenderPassEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), + indirectOffset); +} +void RenderPassEncoder::DrawIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const { + wgpuRenderPassEncoderDrawIndirect(Get(), indirectBuffer.Get(), + indirectOffset); +} +void RenderPassEncoder::End() const { wgpuRenderPassEncoderEnd(Get()); } +void RenderPassEncoder::EndOcclusionQuery() const { + wgpuRenderPassEncoderEndOcclusionQuery(Get()); +} +void RenderPassEncoder::ExecuteBundles(size_t bundleCount, + RenderBundle const *bundles) const { + wgpuRenderPassEncoderExecuteBundles( + Get(), bundleCount, reinterpret_cast(bundles)); +} +void RenderPassEncoder::InsertDebugMarker(char const *markerLabel) const { + wgpuRenderPassEncoderInsertDebugMarker( + Get(), reinterpret_cast(markerLabel)); +} +void RenderPassEncoder::PixelLocalStorageBarrier() const { + wgpuRenderPassEncoderPixelLocalStorageBarrier(Get()); +} +void RenderPassEncoder::PopDebugGroup() const { + wgpuRenderPassEncoderPopDebugGroup(Get()); +} +void RenderPassEncoder::PushDebugGroup(char const *groupLabel) const { + wgpuRenderPassEncoderPushDebugGroup( + Get(), reinterpret_cast(groupLabel)); +} +void RenderPassEncoder::SetBindGroup(uint32_t groupIndex, + BindGroup const &group, + size_t dynamicOffsetCount, + uint32_t const *dynamicOffsets) const { + wgpuRenderPassEncoderSetBindGroup( + Get(), groupIndex, group.Get(), dynamicOffsetCount, + reinterpret_cast(dynamicOffsets)); +} +void RenderPassEncoder::SetBlendConstant(Color const *color) const { + wgpuRenderPassEncoderSetBlendConstant( + Get(), reinterpret_cast(color)); +} +void RenderPassEncoder::SetIndexBuffer(Buffer const &buffer, IndexFormat format, + uint64_t offset, uint64_t size) const { + wgpuRenderPassEncoderSetIndexBuffer( + Get(), buffer.Get(), static_cast(format), offset, size); +} +void RenderPassEncoder::SetLabel(char const *label) const { + wgpuRenderPassEncoderSetLabel(Get(), reinterpret_cast(label)); +} +void RenderPassEncoder::SetPipeline(RenderPipeline const &pipeline) const { + wgpuRenderPassEncoderSetPipeline(Get(), pipeline.Get()); +} +void RenderPassEncoder::SetScissorRect(uint32_t x, uint32_t y, uint32_t width, + uint32_t height) const { + wgpuRenderPassEncoderSetScissorRect(Get(), x, y, width, height); +} +void RenderPassEncoder::SetStencilReference(uint32_t reference) const { + wgpuRenderPassEncoderSetStencilReference(Get(), reference); +} +void RenderPassEncoder::SetVertexBuffer(uint32_t slot, Buffer const &buffer, + uint64_t offset, uint64_t size) const { + wgpuRenderPassEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size); +} +void RenderPassEncoder::SetViewport(float x, float y, float width, float height, + float minDepth, float maxDepth) const { + wgpuRenderPassEncoderSetViewport(Get(), x, y, width, height, minDepth, + maxDepth); +} +void RenderPassEncoder::WriteTimestamp(QuerySet const &querySet, + uint32_t queryIndex) const { + wgpuRenderPassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); +} +void RenderPassEncoder::WGPUReference(WGPURenderPassEncoder handle) { + if (handle != nullptr) { + wgpuRenderPassEncoderReference(handle); + } +} +void RenderPassEncoder::WGPURelease(WGPURenderPassEncoder handle) { + if (handle != nullptr) { + wgpuRenderPassEncoderRelease(handle); + } +} - // SurfaceDescriptorFromCanvasHTMLSelector +// RenderPipeline - static_assert(sizeof(SurfaceDescriptorFromCanvasHTMLSelector) == sizeof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), "sizeof mismatch for SurfaceDescriptorFromCanvasHTMLSelector"); - static_assert(alignof(SurfaceDescriptorFromCanvasHTMLSelector) == alignof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), "alignof mismatch for SurfaceDescriptorFromCanvasHTMLSelector"); +static_assert(sizeof(RenderPipeline) == sizeof(WGPURenderPipeline), + "sizeof mismatch for RenderPipeline"); +static_assert(alignof(RenderPipeline) == alignof(WGPURenderPipeline), + "alignof mismatch for RenderPipeline"); - static_assert(offsetof(SurfaceDescriptorFromCanvasHTMLSelector, selector) == offsetof(WGPUSurfaceDescriptorFromCanvasHTMLSelector, selector), - "offsetof mismatch for SurfaceDescriptorFromCanvasHTMLSelector::selector"); +BindGroupLayout RenderPipeline::GetBindGroupLayout(uint32_t groupIndex) const { + auto result = wgpuRenderPipelineGetBindGroupLayout(Get(), groupIndex); + return BindGroupLayout::Acquire(result); +} +void RenderPipeline::SetLabel(char const *label) const { + wgpuRenderPipelineSetLabel(Get(), reinterpret_cast(label)); +} +void RenderPipeline::WGPUReference(WGPURenderPipeline handle) { + if (handle != nullptr) { + wgpuRenderPipelineReference(handle); + } +} +void RenderPipeline::WGPURelease(WGPURenderPipeline handle) { + if (handle != nullptr) { + wgpuRenderPipelineRelease(handle); + } +} - // SurfaceDescriptorFromMetalLayer +// Sampler - static_assert(sizeof(SurfaceDescriptorFromMetalLayer) == sizeof(WGPUSurfaceDescriptorFromMetalLayer), "sizeof mismatch for SurfaceDescriptorFromMetalLayer"); - static_assert(alignof(SurfaceDescriptorFromMetalLayer) == alignof(WGPUSurfaceDescriptorFromMetalLayer), "alignof mismatch for SurfaceDescriptorFromMetalLayer"); +static_assert(sizeof(Sampler) == sizeof(WGPUSampler), + "sizeof mismatch for Sampler"); +static_assert(alignof(Sampler) == alignof(WGPUSampler), + "alignof mismatch for Sampler"); - static_assert(offsetof(SurfaceDescriptorFromMetalLayer, layer) == offsetof(WGPUSurfaceDescriptorFromMetalLayer, layer), - "offsetof mismatch for SurfaceDescriptorFromMetalLayer::layer"); +void Sampler::SetLabel(char const *label) const { + wgpuSamplerSetLabel(Get(), reinterpret_cast(label)); +} +void Sampler::WGPUReference(WGPUSampler handle) { + if (handle != nullptr) { + wgpuSamplerReference(handle); + } +} +void Sampler::WGPURelease(WGPUSampler handle) { + if (handle != nullptr) { + wgpuSamplerRelease(handle); + } +} - // SurfaceDescriptorFromWaylandSurface +// ShaderModule - static_assert(sizeof(SurfaceDescriptorFromWaylandSurface) == sizeof(WGPUSurfaceDescriptorFromWaylandSurface), "sizeof mismatch for SurfaceDescriptorFromWaylandSurface"); - static_assert(alignof(SurfaceDescriptorFromWaylandSurface) == alignof(WGPUSurfaceDescriptorFromWaylandSurface), "alignof mismatch for SurfaceDescriptorFromWaylandSurface"); +static_assert(sizeof(ShaderModule) == sizeof(WGPUShaderModule), + "sizeof mismatch for ShaderModule"); +static_assert(alignof(ShaderModule) == alignof(WGPUShaderModule), + "alignof mismatch for ShaderModule"); - static_assert(offsetof(SurfaceDescriptorFromWaylandSurface, display) == offsetof(WGPUSurfaceDescriptorFromWaylandSurface, display), - "offsetof mismatch for SurfaceDescriptorFromWaylandSurface::display"); - static_assert(offsetof(SurfaceDescriptorFromWaylandSurface, surface) == offsetof(WGPUSurfaceDescriptorFromWaylandSurface, surface), - "offsetof mismatch for SurfaceDescriptorFromWaylandSurface::surface"); +void ShaderModule::GetCompilationInfo(CompilationInfoCallback callback, + void *userdata) const { + wgpuShaderModuleGetCompilationInfo(Get(), callback, userdata); +} +Future ShaderModule::GetCompilationInfo( + CompilationInfoCallbackInfo callbackInfo) const { + auto result = wgpuShaderModuleGetCompilationInfoF( + Get(), *reinterpret_cast( + &callbackInfo)); + return Future{result.id}; +} +void ShaderModule::SetLabel(char const *label) const { + wgpuShaderModuleSetLabel(Get(), reinterpret_cast(label)); +} +void ShaderModule::WGPUReference(WGPUShaderModule handle) { + if (handle != nullptr) { + wgpuShaderModuleReference(handle); + } +} +void ShaderModule::WGPURelease(WGPUShaderModule handle) { + if (handle != nullptr) { + wgpuShaderModuleRelease(handle); + } +} - // SurfaceDescriptorFromWindowsHWND +// SharedBufferMemory + +static_assert(sizeof(SharedBufferMemory) == sizeof(WGPUSharedBufferMemory), + "sizeof mismatch for SharedBufferMemory"); +static_assert(alignof(SharedBufferMemory) == alignof(WGPUSharedBufferMemory), + "alignof mismatch for SharedBufferMemory"); + +Bool SharedBufferMemory::BeginAccess( + Buffer const &buffer, + SharedBufferMemoryBeginAccessDescriptor const *descriptor) const { + auto result = wgpuSharedBufferMemoryBeginAccess( + Get(), buffer.Get(), + reinterpret_cast( + descriptor)); + return result; +} +Buffer +SharedBufferMemory::CreateBuffer(BufferDescriptor const *descriptor) const { + auto result = wgpuSharedBufferMemoryCreateBuffer( + Get(), reinterpret_cast(descriptor)); + return Buffer::Acquire(result); +} +Bool SharedBufferMemory::EndAccess( + Buffer const &buffer, SharedBufferMemoryEndAccessState *descriptor) const { + *descriptor = SharedBufferMemoryEndAccessState(); + auto result = wgpuSharedBufferMemoryEndAccess( + Get(), buffer.Get(), + reinterpret_cast(descriptor)); + return result; +} +void SharedBufferMemory::GetProperties( + SharedBufferMemoryProperties *properties) const { + wgpuSharedBufferMemoryGetProperties( + Get(), reinterpret_cast(properties)); +} +Bool SharedBufferMemory::IsDeviceLost() const { + auto result = wgpuSharedBufferMemoryIsDeviceLost(Get()); + return result; +} +void SharedBufferMemory::SetLabel(char const *label) const { + wgpuSharedBufferMemorySetLabel(Get(), reinterpret_cast(label)); +} +void SharedBufferMemory::WGPUReference(WGPUSharedBufferMemory handle) { + if (handle != nullptr) { + wgpuSharedBufferMemoryReference(handle); + } +} +void SharedBufferMemory::WGPURelease(WGPUSharedBufferMemory handle) { + if (handle != nullptr) { + wgpuSharedBufferMemoryRelease(handle); + } +} - static_assert(sizeof(SurfaceDescriptorFromWindowsHWND) == sizeof(WGPUSurfaceDescriptorFromWindowsHWND), "sizeof mismatch for SurfaceDescriptorFromWindowsHWND"); - static_assert(alignof(SurfaceDescriptorFromWindowsHWND) == alignof(WGPUSurfaceDescriptorFromWindowsHWND), "alignof mismatch for SurfaceDescriptorFromWindowsHWND"); +// SharedFence - static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hinstance) == offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hinstance), - "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hinstance"); - static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hwnd) == offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hwnd), - "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hwnd"); +static_assert(sizeof(SharedFence) == sizeof(WGPUSharedFence), + "sizeof mismatch for SharedFence"); +static_assert(alignof(SharedFence) == alignof(WGPUSharedFence), + "alignof mismatch for SharedFence"); - // SurfaceDescriptorFromWindowsCoreWindow +void SharedFence::ExportInfo(SharedFenceExportInfo *info) const { + wgpuSharedFenceExportInfo( + Get(), reinterpret_cast(info)); +} +void SharedFence::WGPUReference(WGPUSharedFence handle) { + if (handle != nullptr) { + wgpuSharedFenceReference(handle); + } +} +void SharedFence::WGPURelease(WGPUSharedFence handle) { + if (handle != nullptr) { + wgpuSharedFenceRelease(handle); + } +} - static_assert(sizeof(SurfaceDescriptorFromWindowsCoreWindow) == sizeof(WGPUSurfaceDescriptorFromWindowsCoreWindow), "sizeof mismatch for SurfaceDescriptorFromWindowsCoreWindow"); - static_assert(alignof(SurfaceDescriptorFromWindowsCoreWindow) == alignof(WGPUSurfaceDescriptorFromWindowsCoreWindow), "alignof mismatch for SurfaceDescriptorFromWindowsCoreWindow"); +// SharedTextureMemory + +static_assert(sizeof(SharedTextureMemory) == sizeof(WGPUSharedTextureMemory), + "sizeof mismatch for SharedTextureMemory"); +static_assert(alignof(SharedTextureMemory) == alignof(WGPUSharedTextureMemory), + "alignof mismatch for SharedTextureMemory"); + +Bool SharedTextureMemory::BeginAccess( + Texture const &texture, + SharedTextureMemoryBeginAccessDescriptor const *descriptor) const { + auto result = wgpuSharedTextureMemoryBeginAccess( + Get(), texture.Get(), + reinterpret_cast( + descriptor)); + return result; +} +Texture +SharedTextureMemory::CreateTexture(TextureDescriptor const *descriptor) const { + auto result = wgpuSharedTextureMemoryCreateTexture( + Get(), reinterpret_cast(descriptor)); + return Texture::Acquire(result); +} +Bool SharedTextureMemory::EndAccess( + Texture const &texture, + SharedTextureMemoryEndAccessState *descriptor) const { + *descriptor = SharedTextureMemoryEndAccessState(); + auto result = wgpuSharedTextureMemoryEndAccess( + Get(), texture.Get(), + reinterpret_cast(descriptor)); + return result; +} +void SharedTextureMemory::GetProperties( + SharedTextureMemoryProperties *properties) const { + wgpuSharedTextureMemoryGetProperties( + Get(), reinterpret_cast(properties)); +} +Bool SharedTextureMemory::IsDeviceLost() const { + auto result = wgpuSharedTextureMemoryIsDeviceLost(Get()); + return result; +} +void SharedTextureMemory::SetLabel(char const *label) const { + wgpuSharedTextureMemorySetLabel(Get(), reinterpret_cast(label)); +} +void SharedTextureMemory::WGPUReference(WGPUSharedTextureMemory handle) { + if (handle != nullptr) { + wgpuSharedTextureMemoryReference(handle); + } +} +void SharedTextureMemory::WGPURelease(WGPUSharedTextureMemory handle) { + if (handle != nullptr) { + wgpuSharedTextureMemoryRelease(handle); + } +} - static_assert(offsetof(SurfaceDescriptorFromWindowsCoreWindow, coreWindow) == offsetof(WGPUSurfaceDescriptorFromWindowsCoreWindow, coreWindow), - "offsetof mismatch for SurfaceDescriptorFromWindowsCoreWindow::coreWindow"); +// Surface - // SurfaceDescriptorFromWindowsSwapChainPanel +static_assert(sizeof(Surface) == sizeof(WGPUSurface), + "sizeof mismatch for Surface"); +static_assert(alignof(Surface) == alignof(WGPUSurface), + "alignof mismatch for Surface"); - static_assert(sizeof(SurfaceDescriptorFromWindowsSwapChainPanel) == sizeof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel), "sizeof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel"); - static_assert(alignof(SurfaceDescriptorFromWindowsSwapChainPanel) == alignof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel), "alignof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel"); +TextureFormat Surface::GetPreferredFormat(Adapter const &adapter) const { + auto result = wgpuSurfaceGetPreferredFormat(Get(), adapter.Get()); + return static_cast(result); +} +void Surface::WGPUReference(WGPUSurface handle) { + if (handle != nullptr) { + wgpuSurfaceReference(handle); + } +} +void Surface::WGPURelease(WGPUSurface handle) { + if (handle != nullptr) { + wgpuSurfaceRelease(handle); + } +} - static_assert(offsetof(SurfaceDescriptorFromWindowsSwapChainPanel, swapChainPanel) == offsetof(WGPUSurfaceDescriptorFromWindowsSwapChainPanel, swapChainPanel), - "offsetof mismatch for SurfaceDescriptorFromWindowsSwapChainPanel::swapChainPanel"); +// SwapChain - // SurfaceDescriptorFromXlibWindow +static_assert(sizeof(SwapChain) == sizeof(WGPUSwapChain), + "sizeof mismatch for SwapChain"); +static_assert(alignof(SwapChain) == alignof(WGPUSwapChain), + "alignof mismatch for SwapChain"); - static_assert(sizeof(SurfaceDescriptorFromXlibWindow) == sizeof(WGPUSurfaceDescriptorFromXlibWindow), "sizeof mismatch for SurfaceDescriptorFromXlibWindow"); - static_assert(alignof(SurfaceDescriptorFromXlibWindow) == alignof(WGPUSurfaceDescriptorFromXlibWindow), "alignof mismatch for SurfaceDescriptorFromXlibWindow"); +Texture SwapChain::GetCurrentTexture() const { + auto result = wgpuSwapChainGetCurrentTexture(Get()); + return Texture::Acquire(result); +} +TextureView SwapChain::GetCurrentTextureView() const { + auto result = wgpuSwapChainGetCurrentTextureView(Get()); + return TextureView::Acquire(result); +} +void SwapChain::Present() const { wgpuSwapChainPresent(Get()); } +void SwapChain::WGPUReference(WGPUSwapChain handle) { + if (handle != nullptr) { + wgpuSwapChainReference(handle); + } +} +void SwapChain::WGPURelease(WGPUSwapChain handle) { + if (handle != nullptr) { + wgpuSwapChainRelease(handle); + } +} - static_assert(offsetof(SurfaceDescriptorFromXlibWindow, display) == offsetof(WGPUSurfaceDescriptorFromXlibWindow, display), - "offsetof mismatch for SurfaceDescriptorFromXlibWindow::display"); - static_assert(offsetof(SurfaceDescriptorFromXlibWindow, window) == offsetof(WGPUSurfaceDescriptorFromXlibWindow, window), - "offsetof mismatch for SurfaceDescriptorFromXlibWindow::window"); +// Texture - // SwapChainDescriptor +static_assert(sizeof(Texture) == sizeof(WGPUTexture), + "sizeof mismatch for Texture"); +static_assert(alignof(Texture) == alignof(WGPUTexture), + "alignof mismatch for Texture"); - static_assert(sizeof(SwapChainDescriptor) == sizeof(WGPUSwapChainDescriptor), "sizeof mismatch for SwapChainDescriptor"); - static_assert(alignof(SwapChainDescriptor) == alignof(WGPUSwapChainDescriptor), "alignof mismatch for SwapChainDescriptor"); +TextureView +Texture::CreateErrorView(TextureViewDescriptor const *descriptor) const { + auto result = wgpuTextureCreateErrorView( + Get(), reinterpret_cast(descriptor)); + return TextureView::Acquire(result); +} +TextureView Texture::CreateView(TextureViewDescriptor const *descriptor) const { + auto result = wgpuTextureCreateView( + Get(), reinterpret_cast(descriptor)); + return TextureView::Acquire(result); +} +void Texture::Destroy() const { wgpuTextureDestroy(Get()); } +uint32_t Texture::GetDepthOrArrayLayers() const { + auto result = wgpuTextureGetDepthOrArrayLayers(Get()); + return result; +} +TextureDimension Texture::GetDimension() const { + auto result = wgpuTextureGetDimension(Get()); + return static_cast(result); +} +TextureFormat Texture::GetFormat() const { + auto result = wgpuTextureGetFormat(Get()); + return static_cast(result); +} +uint32_t Texture::GetHeight() const { + auto result = wgpuTextureGetHeight(Get()); + return result; +} +uint32_t Texture::GetMipLevelCount() const { + auto result = wgpuTextureGetMipLevelCount(Get()); + return result; +} +uint32_t Texture::GetSampleCount() const { + auto result = wgpuTextureGetSampleCount(Get()); + return result; +} +TextureUsage Texture::GetUsage() const { + auto result = wgpuTextureGetUsage(Get()); + return static_cast(result); +} +uint32_t Texture::GetWidth() const { + auto result = wgpuTextureGetWidth(Get()); + return result; +} +void Texture::SetLabel(char const *label) const { + wgpuTextureSetLabel(Get(), reinterpret_cast(label)); +} +void Texture::WGPUReference(WGPUTexture handle) { + if (handle != nullptr) { + wgpuTextureReference(handle); + } +} +void Texture::WGPURelease(WGPUTexture handle) { + if (handle != nullptr) { + wgpuTextureRelease(handle); + } +} - static_assert(offsetof(SwapChainDescriptor, nextInChain) == offsetof(WGPUSwapChainDescriptor, nextInChain), - "offsetof mismatch for SwapChainDescriptor::nextInChain"); - static_assert(offsetof(SwapChainDescriptor, label) == offsetof(WGPUSwapChainDescriptor, label), - "offsetof mismatch for SwapChainDescriptor::label"); - static_assert(offsetof(SwapChainDescriptor, usage) == offsetof(WGPUSwapChainDescriptor, usage), - "offsetof mismatch for SwapChainDescriptor::usage"); - static_assert(offsetof(SwapChainDescriptor, format) == offsetof(WGPUSwapChainDescriptor, format), - "offsetof mismatch for SwapChainDescriptor::format"); - static_assert(offsetof(SwapChainDescriptor, width) == offsetof(WGPUSwapChainDescriptor, width), - "offsetof mismatch for SwapChainDescriptor::width"); - static_assert(offsetof(SwapChainDescriptor, height) == offsetof(WGPUSwapChainDescriptor, height), - "offsetof mismatch for SwapChainDescriptor::height"); - static_assert(offsetof(SwapChainDescriptor, presentMode) == offsetof(WGPUSwapChainDescriptor, presentMode), - "offsetof mismatch for SwapChainDescriptor::presentMode"); +// TextureView - // TextureBindingLayout +static_assert(sizeof(TextureView) == sizeof(WGPUTextureView), + "sizeof mismatch for TextureView"); +static_assert(alignof(TextureView) == alignof(WGPUTextureView), + "alignof mismatch for TextureView"); - static_assert(sizeof(TextureBindingLayout) == sizeof(WGPUTextureBindingLayout), "sizeof mismatch for TextureBindingLayout"); - static_assert(alignof(TextureBindingLayout) == alignof(WGPUTextureBindingLayout), "alignof mismatch for TextureBindingLayout"); +void TextureView::SetLabel(char const *label) const { + wgpuTextureViewSetLabel(Get(), reinterpret_cast(label)); +} +void TextureView::WGPUReference(WGPUTextureView handle) { + if (handle != nullptr) { + wgpuTextureViewReference(handle); + } +} +void TextureView::WGPURelease(WGPUTextureView handle) { + if (handle != nullptr) { + wgpuTextureViewRelease(handle); + } +} - static_assert(offsetof(TextureBindingLayout, nextInChain) == offsetof(WGPUTextureBindingLayout, nextInChain), - "offsetof mismatch for TextureBindingLayout::nextInChain"); - static_assert(offsetof(TextureBindingLayout, sampleType) == offsetof(WGPUTextureBindingLayout, sampleType), - "offsetof mismatch for TextureBindingLayout::sampleType"); - static_assert(offsetof(TextureBindingLayout, viewDimension) == offsetof(WGPUTextureBindingLayout, viewDimension), - "offsetof mismatch for TextureBindingLayout::viewDimension"); - static_assert(offsetof(TextureBindingLayout, multisampled) == offsetof(WGPUTextureBindingLayout, multisampled), - "offsetof mismatch for TextureBindingLayout::multisampled"); - - // TextureBindingViewDimensionDescriptor - - static_assert(sizeof(TextureBindingViewDimensionDescriptor) == sizeof(WGPUTextureBindingViewDimensionDescriptor), "sizeof mismatch for TextureBindingViewDimensionDescriptor"); - static_assert(alignof(TextureBindingViewDimensionDescriptor) == alignof(WGPUTextureBindingViewDimensionDescriptor), "alignof mismatch for TextureBindingViewDimensionDescriptor"); - - static_assert(offsetof(TextureBindingViewDimensionDescriptor, textureBindingViewDimension) == offsetof(WGPUTextureBindingViewDimensionDescriptor, textureBindingViewDimension), - "offsetof mismatch for TextureBindingViewDimensionDescriptor::textureBindingViewDimension"); - - // TextureDataLayout - - static_assert(sizeof(TextureDataLayout) == sizeof(WGPUTextureDataLayout), "sizeof mismatch for TextureDataLayout"); - static_assert(alignof(TextureDataLayout) == alignof(WGPUTextureDataLayout), "alignof mismatch for TextureDataLayout"); - - static_assert(offsetof(TextureDataLayout, nextInChain) == offsetof(WGPUTextureDataLayout, nextInChain), - "offsetof mismatch for TextureDataLayout::nextInChain"); - static_assert(offsetof(TextureDataLayout, offset) == offsetof(WGPUTextureDataLayout, offset), - "offsetof mismatch for TextureDataLayout::offset"); - static_assert(offsetof(TextureDataLayout, bytesPerRow) == offsetof(WGPUTextureDataLayout, bytesPerRow), - "offsetof mismatch for TextureDataLayout::bytesPerRow"); - static_assert(offsetof(TextureDataLayout, rowsPerImage) == offsetof(WGPUTextureDataLayout, rowsPerImage), - "offsetof mismatch for TextureDataLayout::rowsPerImage"); - - // TextureViewDescriptor - - static_assert(sizeof(TextureViewDescriptor) == sizeof(WGPUTextureViewDescriptor), "sizeof mismatch for TextureViewDescriptor"); - static_assert(alignof(TextureViewDescriptor) == alignof(WGPUTextureViewDescriptor), "alignof mismatch for TextureViewDescriptor"); - - static_assert(offsetof(TextureViewDescriptor, nextInChain) == offsetof(WGPUTextureViewDescriptor, nextInChain), - "offsetof mismatch for TextureViewDescriptor::nextInChain"); - static_assert(offsetof(TextureViewDescriptor, label) == offsetof(WGPUTextureViewDescriptor, label), - "offsetof mismatch for TextureViewDescriptor::label"); - static_assert(offsetof(TextureViewDescriptor, format) == offsetof(WGPUTextureViewDescriptor, format), - "offsetof mismatch for TextureViewDescriptor::format"); - static_assert(offsetof(TextureViewDescriptor, dimension) == offsetof(WGPUTextureViewDescriptor, dimension), - "offsetof mismatch for TextureViewDescriptor::dimension"); - static_assert(offsetof(TextureViewDescriptor, baseMipLevel) == offsetof(WGPUTextureViewDescriptor, baseMipLevel), - "offsetof mismatch for TextureViewDescriptor::baseMipLevel"); - static_assert(offsetof(TextureViewDescriptor, mipLevelCount) == offsetof(WGPUTextureViewDescriptor, mipLevelCount), - "offsetof mismatch for TextureViewDescriptor::mipLevelCount"); - static_assert(offsetof(TextureViewDescriptor, baseArrayLayer) == offsetof(WGPUTextureViewDescriptor, baseArrayLayer), - "offsetof mismatch for TextureViewDescriptor::baseArrayLayer"); - static_assert(offsetof(TextureViewDescriptor, arrayLayerCount) == offsetof(WGPUTextureViewDescriptor, arrayLayerCount), - "offsetof mismatch for TextureViewDescriptor::arrayLayerCount"); - static_assert(offsetof(TextureViewDescriptor, aspect) == offsetof(WGPUTextureViewDescriptor, aspect), - "offsetof mismatch for TextureViewDescriptor::aspect"); - - // VertexAttribute - - static_assert(sizeof(VertexAttribute) == sizeof(WGPUVertexAttribute), "sizeof mismatch for VertexAttribute"); - static_assert(alignof(VertexAttribute) == alignof(WGPUVertexAttribute), "alignof mismatch for VertexAttribute"); - - static_assert(offsetof(VertexAttribute, format) == offsetof(WGPUVertexAttribute, format), - "offsetof mismatch for VertexAttribute::format"); - static_assert(offsetof(VertexAttribute, offset) == offsetof(WGPUVertexAttribute, offset), - "offsetof mismatch for VertexAttribute::offset"); - static_assert(offsetof(VertexAttribute, shaderLocation) == offsetof(WGPUVertexAttribute, shaderLocation), - "offsetof mismatch for VertexAttribute::shaderLocation"); - - // AdapterPropertiesMemoryHeaps - - static_assert(sizeof(AdapterPropertiesMemoryHeaps) == sizeof(WGPUAdapterPropertiesMemoryHeaps), "sizeof mismatch for AdapterPropertiesMemoryHeaps"); - static_assert(alignof(AdapterPropertiesMemoryHeaps) == alignof(WGPUAdapterPropertiesMemoryHeaps), "alignof mismatch for AdapterPropertiesMemoryHeaps"); - - static_assert(offsetof(AdapterPropertiesMemoryHeaps, heapCount) == offsetof(WGPUAdapterPropertiesMemoryHeaps, heapCount), - "offsetof mismatch for AdapterPropertiesMemoryHeaps::heapCount"); - static_assert(offsetof(AdapterPropertiesMemoryHeaps, heapInfo) == offsetof(WGPUAdapterPropertiesMemoryHeaps, heapInfo), - "offsetof mismatch for AdapterPropertiesMemoryHeaps::heapInfo"); - - // BindGroupDescriptor - - static_assert(sizeof(BindGroupDescriptor) == sizeof(WGPUBindGroupDescriptor), "sizeof mismatch for BindGroupDescriptor"); - static_assert(alignof(BindGroupDescriptor) == alignof(WGPUBindGroupDescriptor), "alignof mismatch for BindGroupDescriptor"); - - static_assert(offsetof(BindGroupDescriptor, nextInChain) == offsetof(WGPUBindGroupDescriptor, nextInChain), - "offsetof mismatch for BindGroupDescriptor::nextInChain"); - static_assert(offsetof(BindGroupDescriptor, label) == offsetof(WGPUBindGroupDescriptor, label), - "offsetof mismatch for BindGroupDescriptor::label"); - static_assert(offsetof(BindGroupDescriptor, layout) == offsetof(WGPUBindGroupDescriptor, layout), - "offsetof mismatch for BindGroupDescriptor::layout"); - static_assert(offsetof(BindGroupDescriptor, entryCount) == offsetof(WGPUBindGroupDescriptor, entryCount), - "offsetof mismatch for BindGroupDescriptor::entryCount"); - static_assert(offsetof(BindGroupDescriptor, entries) == offsetof(WGPUBindGroupDescriptor, entries), - "offsetof mismatch for BindGroupDescriptor::entries"); - - // BindGroupLayoutEntry - - static_assert(sizeof(BindGroupLayoutEntry) == sizeof(WGPUBindGroupLayoutEntry), "sizeof mismatch for BindGroupLayoutEntry"); - static_assert(alignof(BindGroupLayoutEntry) == alignof(WGPUBindGroupLayoutEntry), "alignof mismatch for BindGroupLayoutEntry"); - - static_assert(offsetof(BindGroupLayoutEntry, nextInChain) == offsetof(WGPUBindGroupLayoutEntry, nextInChain), - "offsetof mismatch for BindGroupLayoutEntry::nextInChain"); - static_assert(offsetof(BindGroupLayoutEntry, binding) == offsetof(WGPUBindGroupLayoutEntry, binding), - "offsetof mismatch for BindGroupLayoutEntry::binding"); - static_assert(offsetof(BindGroupLayoutEntry, visibility) == offsetof(WGPUBindGroupLayoutEntry, visibility), - "offsetof mismatch for BindGroupLayoutEntry::visibility"); - static_assert(offsetof(BindGroupLayoutEntry, buffer) == offsetof(WGPUBindGroupLayoutEntry, buffer), - "offsetof mismatch for BindGroupLayoutEntry::buffer"); - static_assert(offsetof(BindGroupLayoutEntry, sampler) == offsetof(WGPUBindGroupLayoutEntry, sampler), - "offsetof mismatch for BindGroupLayoutEntry::sampler"); - static_assert(offsetof(BindGroupLayoutEntry, texture) == offsetof(WGPUBindGroupLayoutEntry, texture), - "offsetof mismatch for BindGroupLayoutEntry::texture"); - static_assert(offsetof(BindGroupLayoutEntry, storageTexture) == offsetof(WGPUBindGroupLayoutEntry, storageTexture), - "offsetof mismatch for BindGroupLayoutEntry::storageTexture"); - - // BlendState - - static_assert(sizeof(BlendState) == sizeof(WGPUBlendState), "sizeof mismatch for BlendState"); - static_assert(alignof(BlendState) == alignof(WGPUBlendState), "alignof mismatch for BlendState"); - - static_assert(offsetof(BlendState, color) == offsetof(WGPUBlendState, color), - "offsetof mismatch for BlendState::color"); - static_assert(offsetof(BlendState, alpha) == offsetof(WGPUBlendState, alpha), - "offsetof mismatch for BlendState::alpha"); - - // CompilationInfo - - static_assert(sizeof(CompilationInfo) == sizeof(WGPUCompilationInfo), "sizeof mismatch for CompilationInfo"); - static_assert(alignof(CompilationInfo) == alignof(WGPUCompilationInfo), "alignof mismatch for CompilationInfo"); - - static_assert(offsetof(CompilationInfo, nextInChain) == offsetof(WGPUCompilationInfo, nextInChain), - "offsetof mismatch for CompilationInfo::nextInChain"); - static_assert(offsetof(CompilationInfo, messageCount) == offsetof(WGPUCompilationInfo, messageCount), - "offsetof mismatch for CompilationInfo::messageCount"); - static_assert(offsetof(CompilationInfo, messages) == offsetof(WGPUCompilationInfo, messages), - "offsetof mismatch for CompilationInfo::messages"); - - // ComputePassDescriptor - - static_assert(sizeof(ComputePassDescriptor) == sizeof(WGPUComputePassDescriptor), "sizeof mismatch for ComputePassDescriptor"); - static_assert(alignof(ComputePassDescriptor) == alignof(WGPUComputePassDescriptor), "alignof mismatch for ComputePassDescriptor"); - - static_assert(offsetof(ComputePassDescriptor, nextInChain) == offsetof(WGPUComputePassDescriptor, nextInChain), - "offsetof mismatch for ComputePassDescriptor::nextInChain"); - static_assert(offsetof(ComputePassDescriptor, label) == offsetof(WGPUComputePassDescriptor, label), - "offsetof mismatch for ComputePassDescriptor::label"); - static_assert(offsetof(ComputePassDescriptor, timestampWrites) == offsetof(WGPUComputePassDescriptor, timestampWrites), - "offsetof mismatch for ComputePassDescriptor::timestampWrites"); - - // DepthStencilState - - static_assert(sizeof(DepthStencilState) == sizeof(WGPUDepthStencilState), "sizeof mismatch for DepthStencilState"); - static_assert(alignof(DepthStencilState) == alignof(WGPUDepthStencilState), "alignof mismatch for DepthStencilState"); - - static_assert(offsetof(DepthStencilState, nextInChain) == offsetof(WGPUDepthStencilState, nextInChain), - "offsetof mismatch for DepthStencilState::nextInChain"); - static_assert(offsetof(DepthStencilState, format) == offsetof(WGPUDepthStencilState, format), - "offsetof mismatch for DepthStencilState::format"); - static_assert(offsetof(DepthStencilState, depthWriteEnabled) == offsetof(WGPUDepthStencilState, depthWriteEnabled), - "offsetof mismatch for DepthStencilState::depthWriteEnabled"); - static_assert(offsetof(DepthStencilState, depthCompare) == offsetof(WGPUDepthStencilState, depthCompare), - "offsetof mismatch for DepthStencilState::depthCompare"); - static_assert(offsetof(DepthStencilState, stencilFront) == offsetof(WGPUDepthStencilState, stencilFront), - "offsetof mismatch for DepthStencilState::stencilFront"); - static_assert(offsetof(DepthStencilState, stencilBack) == offsetof(WGPUDepthStencilState, stencilBack), - "offsetof mismatch for DepthStencilState::stencilBack"); - static_assert(offsetof(DepthStencilState, stencilReadMask) == offsetof(WGPUDepthStencilState, stencilReadMask), - "offsetof mismatch for DepthStencilState::stencilReadMask"); - static_assert(offsetof(DepthStencilState, stencilWriteMask) == offsetof(WGPUDepthStencilState, stencilWriteMask), - "offsetof mismatch for DepthStencilState::stencilWriteMask"); - static_assert(offsetof(DepthStencilState, depthBias) == offsetof(WGPUDepthStencilState, depthBias), - "offsetof mismatch for DepthStencilState::depthBias"); - static_assert(offsetof(DepthStencilState, depthBiasSlopeScale) == offsetof(WGPUDepthStencilState, depthBiasSlopeScale), - "offsetof mismatch for DepthStencilState::depthBiasSlopeScale"); - static_assert(offsetof(DepthStencilState, depthBiasClamp) == offsetof(WGPUDepthStencilState, depthBiasClamp), - "offsetof mismatch for DepthStencilState::depthBiasClamp"); - - // DrmFormatCapabilities - - static_assert(sizeof(DrmFormatCapabilities) == sizeof(WGPUDrmFormatCapabilities), "sizeof mismatch for DrmFormatCapabilities"); - static_assert(alignof(DrmFormatCapabilities) == alignof(WGPUDrmFormatCapabilities), "alignof mismatch for DrmFormatCapabilities"); - - static_assert(offsetof(DrmFormatCapabilities, propertiesCount) == offsetof(WGPUDrmFormatCapabilities, propertiesCount), - "offsetof mismatch for DrmFormatCapabilities::propertiesCount"); - static_assert(offsetof(DrmFormatCapabilities, properties) == offsetof(WGPUDrmFormatCapabilities, properties), - "offsetof mismatch for DrmFormatCapabilities::properties"); - - // ExternalTextureDescriptor - - static_assert(sizeof(ExternalTextureDescriptor) == sizeof(WGPUExternalTextureDescriptor), "sizeof mismatch for ExternalTextureDescriptor"); - static_assert(alignof(ExternalTextureDescriptor) == alignof(WGPUExternalTextureDescriptor), "alignof mismatch for ExternalTextureDescriptor"); - - static_assert(offsetof(ExternalTextureDescriptor, nextInChain) == offsetof(WGPUExternalTextureDescriptor, nextInChain), - "offsetof mismatch for ExternalTextureDescriptor::nextInChain"); - static_assert(offsetof(ExternalTextureDescriptor, label) == offsetof(WGPUExternalTextureDescriptor, label), - "offsetof mismatch for ExternalTextureDescriptor::label"); - static_assert(offsetof(ExternalTextureDescriptor, plane0) == offsetof(WGPUExternalTextureDescriptor, plane0), - "offsetof mismatch for ExternalTextureDescriptor::plane0"); - static_assert(offsetof(ExternalTextureDescriptor, plane1) == offsetof(WGPUExternalTextureDescriptor, plane1), - "offsetof mismatch for ExternalTextureDescriptor::plane1"); - static_assert(offsetof(ExternalTextureDescriptor, visibleOrigin) == offsetof(WGPUExternalTextureDescriptor, visibleOrigin), - "offsetof mismatch for ExternalTextureDescriptor::visibleOrigin"); - static_assert(offsetof(ExternalTextureDescriptor, visibleSize) == offsetof(WGPUExternalTextureDescriptor, visibleSize), - "offsetof mismatch for ExternalTextureDescriptor::visibleSize"); - static_assert(offsetof(ExternalTextureDescriptor, doYuvToRgbConversionOnly) == offsetof(WGPUExternalTextureDescriptor, doYuvToRgbConversionOnly), - "offsetof mismatch for ExternalTextureDescriptor::doYuvToRgbConversionOnly"); - static_assert(offsetof(ExternalTextureDescriptor, yuvToRgbConversionMatrix) == offsetof(WGPUExternalTextureDescriptor, yuvToRgbConversionMatrix), - "offsetof mismatch for ExternalTextureDescriptor::yuvToRgbConversionMatrix"); - static_assert(offsetof(ExternalTextureDescriptor, srcTransferFunctionParameters) == offsetof(WGPUExternalTextureDescriptor, srcTransferFunctionParameters), - "offsetof mismatch for ExternalTextureDescriptor::srcTransferFunctionParameters"); - static_assert(offsetof(ExternalTextureDescriptor, dstTransferFunctionParameters) == offsetof(WGPUExternalTextureDescriptor, dstTransferFunctionParameters), - "offsetof mismatch for ExternalTextureDescriptor::dstTransferFunctionParameters"); - static_assert(offsetof(ExternalTextureDescriptor, gamutConversionMatrix) == offsetof(WGPUExternalTextureDescriptor, gamutConversionMatrix), - "offsetof mismatch for ExternalTextureDescriptor::gamutConversionMatrix"); - static_assert(offsetof(ExternalTextureDescriptor, flipY) == offsetof(WGPUExternalTextureDescriptor, flipY), - "offsetof mismatch for ExternalTextureDescriptor::flipY"); - static_assert(offsetof(ExternalTextureDescriptor, mirrored) == offsetof(WGPUExternalTextureDescriptor, mirrored), - "offsetof mismatch for ExternalTextureDescriptor::mirrored"); - static_assert(offsetof(ExternalTextureDescriptor, rotation) == offsetof(WGPUExternalTextureDescriptor, rotation), - "offsetof mismatch for ExternalTextureDescriptor::rotation"); - - // FutureWaitInfo - - static_assert(sizeof(FutureWaitInfo) == sizeof(WGPUFutureWaitInfo), "sizeof mismatch for FutureWaitInfo"); - static_assert(alignof(FutureWaitInfo) == alignof(WGPUFutureWaitInfo), "alignof mismatch for FutureWaitInfo"); - - static_assert(offsetof(FutureWaitInfo, future) == offsetof(WGPUFutureWaitInfo, future), - "offsetof mismatch for FutureWaitInfo::future"); - static_assert(offsetof(FutureWaitInfo, completed) == offsetof(WGPUFutureWaitInfo, completed), - "offsetof mismatch for FutureWaitInfo::completed"); - - // ImageCopyBuffer - - static_assert(sizeof(ImageCopyBuffer) == sizeof(WGPUImageCopyBuffer), "sizeof mismatch for ImageCopyBuffer"); - static_assert(alignof(ImageCopyBuffer) == alignof(WGPUImageCopyBuffer), "alignof mismatch for ImageCopyBuffer"); - - static_assert(offsetof(ImageCopyBuffer, nextInChain) == offsetof(WGPUImageCopyBuffer, nextInChain), - "offsetof mismatch for ImageCopyBuffer::nextInChain"); - static_assert(offsetof(ImageCopyBuffer, layout) == offsetof(WGPUImageCopyBuffer, layout), - "offsetof mismatch for ImageCopyBuffer::layout"); - static_assert(offsetof(ImageCopyBuffer, buffer) == offsetof(WGPUImageCopyBuffer, buffer), - "offsetof mismatch for ImageCopyBuffer::buffer"); - - // ImageCopyExternalTexture - - static_assert(sizeof(ImageCopyExternalTexture) == sizeof(WGPUImageCopyExternalTexture), "sizeof mismatch for ImageCopyExternalTexture"); - static_assert(alignof(ImageCopyExternalTexture) == alignof(WGPUImageCopyExternalTexture), "alignof mismatch for ImageCopyExternalTexture"); - - static_assert(offsetof(ImageCopyExternalTexture, nextInChain) == offsetof(WGPUImageCopyExternalTexture, nextInChain), - "offsetof mismatch for ImageCopyExternalTexture::nextInChain"); - static_assert(offsetof(ImageCopyExternalTexture, externalTexture) == offsetof(WGPUImageCopyExternalTexture, externalTexture), - "offsetof mismatch for ImageCopyExternalTexture::externalTexture"); - static_assert(offsetof(ImageCopyExternalTexture, origin) == offsetof(WGPUImageCopyExternalTexture, origin), - "offsetof mismatch for ImageCopyExternalTexture::origin"); - static_assert(offsetof(ImageCopyExternalTexture, naturalSize) == offsetof(WGPUImageCopyExternalTexture, naturalSize), - "offsetof mismatch for ImageCopyExternalTexture::naturalSize"); - - // ImageCopyTexture - - static_assert(sizeof(ImageCopyTexture) == sizeof(WGPUImageCopyTexture), "sizeof mismatch for ImageCopyTexture"); - static_assert(alignof(ImageCopyTexture) == alignof(WGPUImageCopyTexture), "alignof mismatch for ImageCopyTexture"); - - static_assert(offsetof(ImageCopyTexture, nextInChain) == offsetof(WGPUImageCopyTexture, nextInChain), - "offsetof mismatch for ImageCopyTexture::nextInChain"); - static_assert(offsetof(ImageCopyTexture, texture) == offsetof(WGPUImageCopyTexture, texture), - "offsetof mismatch for ImageCopyTexture::texture"); - static_assert(offsetof(ImageCopyTexture, mipLevel) == offsetof(WGPUImageCopyTexture, mipLevel), - "offsetof mismatch for ImageCopyTexture::mipLevel"); - static_assert(offsetof(ImageCopyTexture, origin) == offsetof(WGPUImageCopyTexture, origin), - "offsetof mismatch for ImageCopyTexture::origin"); - static_assert(offsetof(ImageCopyTexture, aspect) == offsetof(WGPUImageCopyTexture, aspect), - "offsetof mismatch for ImageCopyTexture::aspect"); - - // InstanceDescriptor - - static_assert(sizeof(InstanceDescriptor) == sizeof(WGPUInstanceDescriptor), "sizeof mismatch for InstanceDescriptor"); - static_assert(alignof(InstanceDescriptor) == alignof(WGPUInstanceDescriptor), "alignof mismatch for InstanceDescriptor"); - - static_assert(offsetof(InstanceDescriptor, nextInChain) == offsetof(WGPUInstanceDescriptor, nextInChain), - "offsetof mismatch for InstanceDescriptor::nextInChain"); - static_assert(offsetof(InstanceDescriptor, features) == offsetof(WGPUInstanceDescriptor, features), - "offsetof mismatch for InstanceDescriptor::features"); - - // PipelineLayoutPixelLocalStorage - - static_assert(sizeof(PipelineLayoutPixelLocalStorage) == sizeof(WGPUPipelineLayoutPixelLocalStorage), "sizeof mismatch for PipelineLayoutPixelLocalStorage"); - static_assert(alignof(PipelineLayoutPixelLocalStorage) == alignof(WGPUPipelineLayoutPixelLocalStorage), "alignof mismatch for PipelineLayoutPixelLocalStorage"); - - static_assert(offsetof(PipelineLayoutPixelLocalStorage, totalPixelLocalStorageSize) == offsetof(WGPUPipelineLayoutPixelLocalStorage, totalPixelLocalStorageSize), - "offsetof mismatch for PipelineLayoutPixelLocalStorage::totalPixelLocalStorageSize"); - static_assert(offsetof(PipelineLayoutPixelLocalStorage, storageAttachmentCount) == offsetof(WGPUPipelineLayoutPixelLocalStorage, storageAttachmentCount), - "offsetof mismatch for PipelineLayoutPixelLocalStorage::storageAttachmentCount"); - static_assert(offsetof(PipelineLayoutPixelLocalStorage, storageAttachments) == offsetof(WGPUPipelineLayoutPixelLocalStorage, storageAttachments), - "offsetof mismatch for PipelineLayoutPixelLocalStorage::storageAttachments"); - - // ProgrammableStageDescriptor - - static_assert(sizeof(ProgrammableStageDescriptor) == sizeof(WGPUProgrammableStageDescriptor), "sizeof mismatch for ProgrammableStageDescriptor"); - static_assert(alignof(ProgrammableStageDescriptor) == alignof(WGPUProgrammableStageDescriptor), "alignof mismatch for ProgrammableStageDescriptor"); - - static_assert(offsetof(ProgrammableStageDescriptor, nextInChain) == offsetof(WGPUProgrammableStageDescriptor, nextInChain), - "offsetof mismatch for ProgrammableStageDescriptor::nextInChain"); - static_assert(offsetof(ProgrammableStageDescriptor, module) == offsetof(WGPUProgrammableStageDescriptor, module), - "offsetof mismatch for ProgrammableStageDescriptor::module"); - static_assert(offsetof(ProgrammableStageDescriptor, entryPoint) == offsetof(WGPUProgrammableStageDescriptor, entryPoint), - "offsetof mismatch for ProgrammableStageDescriptor::entryPoint"); - static_assert(offsetof(ProgrammableStageDescriptor, constantCount) == offsetof(WGPUProgrammableStageDescriptor, constantCount), - "offsetof mismatch for ProgrammableStageDescriptor::constantCount"); - static_assert(offsetof(ProgrammableStageDescriptor, constants) == offsetof(WGPUProgrammableStageDescriptor, constants), - "offsetof mismatch for ProgrammableStageDescriptor::constants"); - - // RenderPassColorAttachment - - static_assert(sizeof(RenderPassColorAttachment) == sizeof(WGPURenderPassColorAttachment), "sizeof mismatch for RenderPassColorAttachment"); - static_assert(alignof(RenderPassColorAttachment) == alignof(WGPURenderPassColorAttachment), "alignof mismatch for RenderPassColorAttachment"); - - static_assert(offsetof(RenderPassColorAttachment, nextInChain) == offsetof(WGPURenderPassColorAttachment, nextInChain), - "offsetof mismatch for RenderPassColorAttachment::nextInChain"); - static_assert(offsetof(RenderPassColorAttachment, view) == offsetof(WGPURenderPassColorAttachment, view), - "offsetof mismatch for RenderPassColorAttachment::view"); - static_assert(offsetof(RenderPassColorAttachment, depthSlice) == offsetof(WGPURenderPassColorAttachment, depthSlice), - "offsetof mismatch for RenderPassColorAttachment::depthSlice"); - static_assert(offsetof(RenderPassColorAttachment, resolveTarget) == offsetof(WGPURenderPassColorAttachment, resolveTarget), - "offsetof mismatch for RenderPassColorAttachment::resolveTarget"); - static_assert(offsetof(RenderPassColorAttachment, loadOp) == offsetof(WGPURenderPassColorAttachment, loadOp), - "offsetof mismatch for RenderPassColorAttachment::loadOp"); - static_assert(offsetof(RenderPassColorAttachment, storeOp) == offsetof(WGPURenderPassColorAttachment, storeOp), - "offsetof mismatch for RenderPassColorAttachment::storeOp"); - static_assert(offsetof(RenderPassColorAttachment, clearValue) == offsetof(WGPURenderPassColorAttachment, clearValue), - "offsetof mismatch for RenderPassColorAttachment::clearValue"); - - // RenderPassStorageAttachment - - static_assert(sizeof(RenderPassStorageAttachment) == sizeof(WGPURenderPassStorageAttachment), "sizeof mismatch for RenderPassStorageAttachment"); - static_assert(alignof(RenderPassStorageAttachment) == alignof(WGPURenderPassStorageAttachment), "alignof mismatch for RenderPassStorageAttachment"); - - static_assert(offsetof(RenderPassStorageAttachment, nextInChain) == offsetof(WGPURenderPassStorageAttachment, nextInChain), - "offsetof mismatch for RenderPassStorageAttachment::nextInChain"); - static_assert(offsetof(RenderPassStorageAttachment, offset) == offsetof(WGPURenderPassStorageAttachment, offset), - "offsetof mismatch for RenderPassStorageAttachment::offset"); - static_assert(offsetof(RenderPassStorageAttachment, storage) == offsetof(WGPURenderPassStorageAttachment, storage), - "offsetof mismatch for RenderPassStorageAttachment::storage"); - static_assert(offsetof(RenderPassStorageAttachment, loadOp) == offsetof(WGPURenderPassStorageAttachment, loadOp), - "offsetof mismatch for RenderPassStorageAttachment::loadOp"); - static_assert(offsetof(RenderPassStorageAttachment, storeOp) == offsetof(WGPURenderPassStorageAttachment, storeOp), - "offsetof mismatch for RenderPassStorageAttachment::storeOp"); - static_assert(offsetof(RenderPassStorageAttachment, clearValue) == offsetof(WGPURenderPassStorageAttachment, clearValue), - "offsetof mismatch for RenderPassStorageAttachment::clearValue"); - - // RequiredLimits - - static_assert(sizeof(RequiredLimits) == sizeof(WGPURequiredLimits), "sizeof mismatch for RequiredLimits"); - static_assert(alignof(RequiredLimits) == alignof(WGPURequiredLimits), "alignof mismatch for RequiredLimits"); - - static_assert(offsetof(RequiredLimits, nextInChain) == offsetof(WGPURequiredLimits, nextInChain), - "offsetof mismatch for RequiredLimits::nextInChain"); - static_assert(offsetof(RequiredLimits, limits) == offsetof(WGPURequiredLimits, limits), - "offsetof mismatch for RequiredLimits::limits"); - - // SharedTextureMemoryDmaBufDescriptor - - static_assert(sizeof(SharedTextureMemoryDmaBufDescriptor) == sizeof(WGPUSharedTextureMemoryDmaBufDescriptor), "sizeof mismatch for SharedTextureMemoryDmaBufDescriptor"); - static_assert(alignof(SharedTextureMemoryDmaBufDescriptor) == alignof(WGPUSharedTextureMemoryDmaBufDescriptor), "alignof mismatch for SharedTextureMemoryDmaBufDescriptor"); - - static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, size) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, size), - "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::size"); - static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, drmFormat) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, drmFormat), - "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::drmFormat"); - static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, drmModifier) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, drmModifier), - "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::drmModifier"); - static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, planeCount) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, planeCount), - "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::planeCount"); - static_assert(offsetof(SharedTextureMemoryDmaBufDescriptor, planes) == offsetof(WGPUSharedTextureMemoryDmaBufDescriptor, planes), - "offsetof mismatch for SharedTextureMemoryDmaBufDescriptor::planes"); - - // SharedTextureMemoryProperties - - static_assert(sizeof(SharedTextureMemoryProperties) == sizeof(WGPUSharedTextureMemoryProperties), "sizeof mismatch for SharedTextureMemoryProperties"); - static_assert(alignof(SharedTextureMemoryProperties) == alignof(WGPUSharedTextureMemoryProperties), "alignof mismatch for SharedTextureMemoryProperties"); - - static_assert(offsetof(SharedTextureMemoryProperties, nextInChain) == offsetof(WGPUSharedTextureMemoryProperties, nextInChain), - "offsetof mismatch for SharedTextureMemoryProperties::nextInChain"); - static_assert(offsetof(SharedTextureMemoryProperties, usage) == offsetof(WGPUSharedTextureMemoryProperties, usage), - "offsetof mismatch for SharedTextureMemoryProperties::usage"); - static_assert(offsetof(SharedTextureMemoryProperties, size) == offsetof(WGPUSharedTextureMemoryProperties, size), - "offsetof mismatch for SharedTextureMemoryProperties::size"); - static_assert(offsetof(SharedTextureMemoryProperties, format) == offsetof(WGPUSharedTextureMemoryProperties, format), - "offsetof mismatch for SharedTextureMemoryProperties::format"); - - // SharedTextureMemoryVkImageDescriptor - - static_assert(sizeof(SharedTextureMemoryVkImageDescriptor) == sizeof(WGPUSharedTextureMemoryVkImageDescriptor), "sizeof mismatch for SharedTextureMemoryVkImageDescriptor"); - static_assert(alignof(SharedTextureMemoryVkImageDescriptor) == alignof(WGPUSharedTextureMemoryVkImageDescriptor), "alignof mismatch for SharedTextureMemoryVkImageDescriptor"); - - static_assert(offsetof(SharedTextureMemoryVkImageDescriptor, vkFormat) == offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkFormat), - "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkFormat"); - static_assert(offsetof(SharedTextureMemoryVkImageDescriptor, vkUsageFlags) == offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkUsageFlags), - "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkUsageFlags"); - static_assert(offsetof(SharedTextureMemoryVkImageDescriptor, vkExtent3D) == offsetof(WGPUSharedTextureMemoryVkImageDescriptor, vkExtent3D), - "offsetof mismatch for SharedTextureMemoryVkImageDescriptor::vkExtent3D"); - - // SupportedLimits - - static_assert(sizeof(SupportedLimits) == sizeof(WGPUSupportedLimits), "sizeof mismatch for SupportedLimits"); - static_assert(alignof(SupportedLimits) == alignof(WGPUSupportedLimits), "alignof mismatch for SupportedLimits"); - - static_assert(offsetof(SupportedLimits, nextInChain) == offsetof(WGPUSupportedLimits, nextInChain), - "offsetof mismatch for SupportedLimits::nextInChain"); - static_assert(offsetof(SupportedLimits, limits) == offsetof(WGPUSupportedLimits, limits), - "offsetof mismatch for SupportedLimits::limits"); - - // TextureDescriptor - - static_assert(sizeof(TextureDescriptor) == sizeof(WGPUTextureDescriptor), "sizeof mismatch for TextureDescriptor"); - static_assert(alignof(TextureDescriptor) == alignof(WGPUTextureDescriptor), "alignof mismatch for TextureDescriptor"); - - static_assert(offsetof(TextureDescriptor, nextInChain) == offsetof(WGPUTextureDescriptor, nextInChain), - "offsetof mismatch for TextureDescriptor::nextInChain"); - static_assert(offsetof(TextureDescriptor, label) == offsetof(WGPUTextureDescriptor, label), - "offsetof mismatch for TextureDescriptor::label"); - static_assert(offsetof(TextureDescriptor, usage) == offsetof(WGPUTextureDescriptor, usage), - "offsetof mismatch for TextureDescriptor::usage"); - static_assert(offsetof(TextureDescriptor, dimension) == offsetof(WGPUTextureDescriptor, dimension), - "offsetof mismatch for TextureDescriptor::dimension"); - static_assert(offsetof(TextureDescriptor, size) == offsetof(WGPUTextureDescriptor, size), - "offsetof mismatch for TextureDescriptor::size"); - static_assert(offsetof(TextureDescriptor, format) == offsetof(WGPUTextureDescriptor, format), - "offsetof mismatch for TextureDescriptor::format"); - static_assert(offsetof(TextureDescriptor, mipLevelCount) == offsetof(WGPUTextureDescriptor, mipLevelCount), - "offsetof mismatch for TextureDescriptor::mipLevelCount"); - static_assert(offsetof(TextureDescriptor, sampleCount) == offsetof(WGPUTextureDescriptor, sampleCount), - "offsetof mismatch for TextureDescriptor::sampleCount"); - static_assert(offsetof(TextureDescriptor, viewFormatCount) == offsetof(WGPUTextureDescriptor, viewFormatCount), - "offsetof mismatch for TextureDescriptor::viewFormatCount"); - static_assert(offsetof(TextureDescriptor, viewFormats) == offsetof(WGPUTextureDescriptor, viewFormats), - "offsetof mismatch for TextureDescriptor::viewFormats"); - - // VertexBufferLayout - - static_assert(sizeof(VertexBufferLayout) == sizeof(WGPUVertexBufferLayout), "sizeof mismatch for VertexBufferLayout"); - static_assert(alignof(VertexBufferLayout) == alignof(WGPUVertexBufferLayout), "alignof mismatch for VertexBufferLayout"); - - static_assert(offsetof(VertexBufferLayout, arrayStride) == offsetof(WGPUVertexBufferLayout, arrayStride), - "offsetof mismatch for VertexBufferLayout::arrayStride"); - static_assert(offsetof(VertexBufferLayout, stepMode) == offsetof(WGPUVertexBufferLayout, stepMode), - "offsetof mismatch for VertexBufferLayout::stepMode"); - static_assert(offsetof(VertexBufferLayout, attributeCount) == offsetof(WGPUVertexBufferLayout, attributeCount), - "offsetof mismatch for VertexBufferLayout::attributeCount"); - static_assert(offsetof(VertexBufferLayout, attributes) == offsetof(WGPUVertexBufferLayout, attributes), - "offsetof mismatch for VertexBufferLayout::attributes"); - - // BindGroupLayoutDescriptor - - static_assert(sizeof(BindGroupLayoutDescriptor) == sizeof(WGPUBindGroupLayoutDescriptor), "sizeof mismatch for BindGroupLayoutDescriptor"); - static_assert(alignof(BindGroupLayoutDescriptor) == alignof(WGPUBindGroupLayoutDescriptor), "alignof mismatch for BindGroupLayoutDescriptor"); - - static_assert(offsetof(BindGroupLayoutDescriptor, nextInChain) == offsetof(WGPUBindGroupLayoutDescriptor, nextInChain), - "offsetof mismatch for BindGroupLayoutDescriptor::nextInChain"); - static_assert(offsetof(BindGroupLayoutDescriptor, label) == offsetof(WGPUBindGroupLayoutDescriptor, label), - "offsetof mismatch for BindGroupLayoutDescriptor::label"); - static_assert(offsetof(BindGroupLayoutDescriptor, entryCount) == offsetof(WGPUBindGroupLayoutDescriptor, entryCount), - "offsetof mismatch for BindGroupLayoutDescriptor::entryCount"); - static_assert(offsetof(BindGroupLayoutDescriptor, entries) == offsetof(WGPUBindGroupLayoutDescriptor, entries), - "offsetof mismatch for BindGroupLayoutDescriptor::entries"); - - // ColorTargetState - - static_assert(sizeof(ColorTargetState) == sizeof(WGPUColorTargetState), "sizeof mismatch for ColorTargetState"); - static_assert(alignof(ColorTargetState) == alignof(WGPUColorTargetState), "alignof mismatch for ColorTargetState"); - - static_assert(offsetof(ColorTargetState, nextInChain) == offsetof(WGPUColorTargetState, nextInChain), - "offsetof mismatch for ColorTargetState::nextInChain"); - static_assert(offsetof(ColorTargetState, format) == offsetof(WGPUColorTargetState, format), - "offsetof mismatch for ColorTargetState::format"); - static_assert(offsetof(ColorTargetState, blend) == offsetof(WGPUColorTargetState, blend), - "offsetof mismatch for ColorTargetState::blend"); - static_assert(offsetof(ColorTargetState, writeMask) == offsetof(WGPUColorTargetState, writeMask), - "offsetof mismatch for ColorTargetState::writeMask"); - - // ComputePipelineDescriptor - - static_assert(sizeof(ComputePipelineDescriptor) == sizeof(WGPUComputePipelineDescriptor), "sizeof mismatch for ComputePipelineDescriptor"); - static_assert(alignof(ComputePipelineDescriptor) == alignof(WGPUComputePipelineDescriptor), "alignof mismatch for ComputePipelineDescriptor"); - - static_assert(offsetof(ComputePipelineDescriptor, nextInChain) == offsetof(WGPUComputePipelineDescriptor, nextInChain), - "offsetof mismatch for ComputePipelineDescriptor::nextInChain"); - static_assert(offsetof(ComputePipelineDescriptor, label) == offsetof(WGPUComputePipelineDescriptor, label), - "offsetof mismatch for ComputePipelineDescriptor::label"); - static_assert(offsetof(ComputePipelineDescriptor, layout) == offsetof(WGPUComputePipelineDescriptor, layout), - "offsetof mismatch for ComputePipelineDescriptor::layout"); - static_assert(offsetof(ComputePipelineDescriptor, compute) == offsetof(WGPUComputePipelineDescriptor, compute), - "offsetof mismatch for ComputePipelineDescriptor::compute"); - - // DeviceDescriptor - - static_assert(sizeof(DeviceDescriptor) == sizeof(WGPUDeviceDescriptor), "sizeof mismatch for DeviceDescriptor"); - static_assert(alignof(DeviceDescriptor) == alignof(WGPUDeviceDescriptor), "alignof mismatch for DeviceDescriptor"); - - static_assert(offsetof(DeviceDescriptor, nextInChain) == offsetof(WGPUDeviceDescriptor, nextInChain), - "offsetof mismatch for DeviceDescriptor::nextInChain"); - static_assert(offsetof(DeviceDescriptor, label) == offsetof(WGPUDeviceDescriptor, label), - "offsetof mismatch for DeviceDescriptor::label"); - static_assert(offsetof(DeviceDescriptor, requiredFeatureCount) == offsetof(WGPUDeviceDescriptor, requiredFeatureCount), - "offsetof mismatch for DeviceDescriptor::requiredFeatureCount"); - static_assert(offsetof(DeviceDescriptor, requiredFeatures) == offsetof(WGPUDeviceDescriptor, requiredFeatures), - "offsetof mismatch for DeviceDescriptor::requiredFeatures"); - static_assert(offsetof(DeviceDescriptor, requiredLimits) == offsetof(WGPUDeviceDescriptor, requiredLimits), - "offsetof mismatch for DeviceDescriptor::requiredLimits"); - static_assert(offsetof(DeviceDescriptor, defaultQueue) == offsetof(WGPUDeviceDescriptor, defaultQueue), - "offsetof mismatch for DeviceDescriptor::defaultQueue"); - static_assert(offsetof(DeviceDescriptor, deviceLostCallback) == offsetof(WGPUDeviceDescriptor, deviceLostCallback), - "offsetof mismatch for DeviceDescriptor::deviceLostCallback"); - static_assert(offsetof(DeviceDescriptor, deviceLostUserdata) == offsetof(WGPUDeviceDescriptor, deviceLostUserdata), - "offsetof mismatch for DeviceDescriptor::deviceLostUserdata"); - - // RenderPassDescriptor - - static_assert(sizeof(RenderPassDescriptor) == sizeof(WGPURenderPassDescriptor), "sizeof mismatch for RenderPassDescriptor"); - static_assert(alignof(RenderPassDescriptor) == alignof(WGPURenderPassDescriptor), "alignof mismatch for RenderPassDescriptor"); - - static_assert(offsetof(RenderPassDescriptor, nextInChain) == offsetof(WGPURenderPassDescriptor, nextInChain), - "offsetof mismatch for RenderPassDescriptor::nextInChain"); - static_assert(offsetof(RenderPassDescriptor, label) == offsetof(WGPURenderPassDescriptor, label), - "offsetof mismatch for RenderPassDescriptor::label"); - static_assert(offsetof(RenderPassDescriptor, colorAttachmentCount) == offsetof(WGPURenderPassDescriptor, colorAttachmentCount), - "offsetof mismatch for RenderPassDescriptor::colorAttachmentCount"); - static_assert(offsetof(RenderPassDescriptor, colorAttachments) == offsetof(WGPURenderPassDescriptor, colorAttachments), - "offsetof mismatch for RenderPassDescriptor::colorAttachments"); - static_assert(offsetof(RenderPassDescriptor, depthStencilAttachment) == offsetof(WGPURenderPassDescriptor, depthStencilAttachment), - "offsetof mismatch for RenderPassDescriptor::depthStencilAttachment"); - static_assert(offsetof(RenderPassDescriptor, occlusionQuerySet) == offsetof(WGPURenderPassDescriptor, occlusionQuerySet), - "offsetof mismatch for RenderPassDescriptor::occlusionQuerySet"); - static_assert(offsetof(RenderPassDescriptor, timestampWrites) == offsetof(WGPURenderPassDescriptor, timestampWrites), - "offsetof mismatch for RenderPassDescriptor::timestampWrites"); - - // RenderPassPixelLocalStorage - - static_assert(sizeof(RenderPassPixelLocalStorage) == sizeof(WGPURenderPassPixelLocalStorage), "sizeof mismatch for RenderPassPixelLocalStorage"); - static_assert(alignof(RenderPassPixelLocalStorage) == alignof(WGPURenderPassPixelLocalStorage), "alignof mismatch for RenderPassPixelLocalStorage"); - - static_assert(offsetof(RenderPassPixelLocalStorage, totalPixelLocalStorageSize) == offsetof(WGPURenderPassPixelLocalStorage, totalPixelLocalStorageSize), - "offsetof mismatch for RenderPassPixelLocalStorage::totalPixelLocalStorageSize"); - static_assert(offsetof(RenderPassPixelLocalStorage, storageAttachmentCount) == offsetof(WGPURenderPassPixelLocalStorage, storageAttachmentCount), - "offsetof mismatch for RenderPassPixelLocalStorage::storageAttachmentCount"); - static_assert(offsetof(RenderPassPixelLocalStorage, storageAttachments) == offsetof(WGPURenderPassPixelLocalStorage, storageAttachments), - "offsetof mismatch for RenderPassPixelLocalStorage::storageAttachments"); - - // VertexState - - static_assert(sizeof(VertexState) == sizeof(WGPUVertexState), "sizeof mismatch for VertexState"); - static_assert(alignof(VertexState) == alignof(WGPUVertexState), "alignof mismatch for VertexState"); - - static_assert(offsetof(VertexState, nextInChain) == offsetof(WGPUVertexState, nextInChain), - "offsetof mismatch for VertexState::nextInChain"); - static_assert(offsetof(VertexState, module) == offsetof(WGPUVertexState, module), - "offsetof mismatch for VertexState::module"); - static_assert(offsetof(VertexState, entryPoint) == offsetof(WGPUVertexState, entryPoint), - "offsetof mismatch for VertexState::entryPoint"); - static_assert(offsetof(VertexState, constantCount) == offsetof(WGPUVertexState, constantCount), - "offsetof mismatch for VertexState::constantCount"); - static_assert(offsetof(VertexState, constants) == offsetof(WGPUVertexState, constants), - "offsetof mismatch for VertexState::constants"); - static_assert(offsetof(VertexState, bufferCount) == offsetof(WGPUVertexState, bufferCount), - "offsetof mismatch for VertexState::bufferCount"); - static_assert(offsetof(VertexState, buffers) == offsetof(WGPUVertexState, buffers), - "offsetof mismatch for VertexState::buffers"); - - // FragmentState - - static_assert(sizeof(FragmentState) == sizeof(WGPUFragmentState), "sizeof mismatch for FragmentState"); - static_assert(alignof(FragmentState) == alignof(WGPUFragmentState), "alignof mismatch for FragmentState"); - - static_assert(offsetof(FragmentState, nextInChain) == offsetof(WGPUFragmentState, nextInChain), - "offsetof mismatch for FragmentState::nextInChain"); - static_assert(offsetof(FragmentState, module) == offsetof(WGPUFragmentState, module), - "offsetof mismatch for FragmentState::module"); - static_assert(offsetof(FragmentState, entryPoint) == offsetof(WGPUFragmentState, entryPoint), - "offsetof mismatch for FragmentState::entryPoint"); - static_assert(offsetof(FragmentState, constantCount) == offsetof(WGPUFragmentState, constantCount), - "offsetof mismatch for FragmentState::constantCount"); - static_assert(offsetof(FragmentState, constants) == offsetof(WGPUFragmentState, constants), - "offsetof mismatch for FragmentState::constants"); - static_assert(offsetof(FragmentState, targetCount) == offsetof(WGPUFragmentState, targetCount), - "offsetof mismatch for FragmentState::targetCount"); - static_assert(offsetof(FragmentState, targets) == offsetof(WGPUFragmentState, targets), - "offsetof mismatch for FragmentState::targets"); - - // RenderPipelineDescriptor - - static_assert(sizeof(RenderPipelineDescriptor) == sizeof(WGPURenderPipelineDescriptor), "sizeof mismatch for RenderPipelineDescriptor"); - static_assert(alignof(RenderPipelineDescriptor) == alignof(WGPURenderPipelineDescriptor), "alignof mismatch for RenderPipelineDescriptor"); - - static_assert(offsetof(RenderPipelineDescriptor, nextInChain) == offsetof(WGPURenderPipelineDescriptor, nextInChain), - "offsetof mismatch for RenderPipelineDescriptor::nextInChain"); - static_assert(offsetof(RenderPipelineDescriptor, label) == offsetof(WGPURenderPipelineDescriptor, label), - "offsetof mismatch for RenderPipelineDescriptor::label"); - static_assert(offsetof(RenderPipelineDescriptor, layout) == offsetof(WGPURenderPipelineDescriptor, layout), - "offsetof mismatch for RenderPipelineDescriptor::layout"); - static_assert(offsetof(RenderPipelineDescriptor, vertex) == offsetof(WGPURenderPipelineDescriptor, vertex), - "offsetof mismatch for RenderPipelineDescriptor::vertex"); - static_assert(offsetof(RenderPipelineDescriptor, primitive) == offsetof(WGPURenderPipelineDescriptor, primitive), - "offsetof mismatch for RenderPipelineDescriptor::primitive"); - static_assert(offsetof(RenderPipelineDescriptor, depthStencil) == offsetof(WGPURenderPipelineDescriptor, depthStencil), - "offsetof mismatch for RenderPipelineDescriptor::depthStencil"); - static_assert(offsetof(RenderPipelineDescriptor, multisample) == offsetof(WGPURenderPipelineDescriptor, multisample), - "offsetof mismatch for RenderPipelineDescriptor::multisample"); - static_assert(offsetof(RenderPipelineDescriptor, fragment) == offsetof(WGPURenderPipelineDescriptor, fragment), - "offsetof mismatch for RenderPipelineDescriptor::fragment"); -template - static T& AsNonConstReference(const T& value) { - return const_cast(value); - } - - // AdapterProperties - AdapterProperties::~AdapterProperties() { - if (this->vendorName != nullptr || this->architecture != nullptr || this->name != nullptr || this->driverDescription != nullptr) { - wgpuAdapterPropertiesFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(AdapterProperties& value) { - AdapterProperties defaultValue{}; - AsNonConstReference(value.vendorID) = defaultValue.vendorID; - AsNonConstReference(value.vendorName) = defaultValue.vendorName; - AsNonConstReference(value.architecture) = defaultValue.architecture; - AsNonConstReference(value.deviceID) = defaultValue.deviceID; - AsNonConstReference(value.name) = defaultValue.name; - AsNonConstReference(value.driverDescription) = defaultValue.driverDescription; - AsNonConstReference(value.adapterType) = defaultValue.adapterType; - AsNonConstReference(value.backendType) = defaultValue.backendType; - AsNonConstReference(value.compatibilityMode) = defaultValue.compatibilityMode; - } - - AdapterProperties::AdapterProperties(AdapterProperties&& rhs) - : vendorID(rhs.vendorID), - vendorName(rhs.vendorName), - architecture(rhs.architecture), - deviceID(rhs.deviceID), - name(rhs.name), - driverDescription(rhs.driverDescription), - adapterType(rhs.adapterType), - backendType(rhs.backendType), - compatibilityMode(rhs.compatibilityMode){ - Reset(rhs); - } - - AdapterProperties& AdapterProperties::operator=(AdapterProperties&& rhs) { - if (&rhs == this) { - return *this; - } - this->~AdapterProperties(); - AsNonConstReference(this->vendorID) = std::move(rhs.vendorID); - AsNonConstReference(this->vendorName) = std::move(rhs.vendorName); - AsNonConstReference(this->architecture) = std::move(rhs.architecture); - AsNonConstReference(this->deviceID) = std::move(rhs.deviceID); - AsNonConstReference(this->name) = std::move(rhs.name); - AsNonConstReference(this->driverDescription) = std::move(rhs.driverDescription); - AsNonConstReference(this->adapterType) = std::move(rhs.adapterType); - AsNonConstReference(this->backendType) = std::move(rhs.backendType); - AsNonConstReference(this->compatibilityMode) = std::move(rhs.compatibilityMode); - Reset(rhs); - return *this; - } - - // SharedBufferMemoryEndAccessState - SharedBufferMemoryEndAccessState::~SharedBufferMemoryEndAccessState() { - if (this->fences != nullptr || this->signaledValues != nullptr) { - wgpuSharedBufferMemoryEndAccessStateFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(SharedBufferMemoryEndAccessState& value) { - SharedBufferMemoryEndAccessState defaultValue{}; - AsNonConstReference(value.initialized) = defaultValue.initialized; - AsNonConstReference(value.fenceCount) = defaultValue.fenceCount; - AsNonConstReference(value.fences) = defaultValue.fences; - AsNonConstReference(value.signaledValues) = defaultValue.signaledValues; - } - - SharedBufferMemoryEndAccessState::SharedBufferMemoryEndAccessState(SharedBufferMemoryEndAccessState&& rhs) - : initialized(rhs.initialized), - fenceCount(rhs.fenceCount), - fences(rhs.fences), - signaledValues(rhs.signaledValues){ - Reset(rhs); - } - - SharedBufferMemoryEndAccessState& SharedBufferMemoryEndAccessState::operator=(SharedBufferMemoryEndAccessState&& rhs) { - if (&rhs == this) { - return *this; - } - this->~SharedBufferMemoryEndAccessState(); - AsNonConstReference(this->initialized) = std::move(rhs.initialized); - AsNonConstReference(this->fenceCount) = std::move(rhs.fenceCount); - AsNonConstReference(this->fences) = std::move(rhs.fences); - AsNonConstReference(this->signaledValues) = std::move(rhs.signaledValues); - Reset(rhs); - return *this; - } - - // SharedTextureMemoryEndAccessState - SharedTextureMemoryEndAccessState::~SharedTextureMemoryEndAccessState() { - if (this->fences != nullptr || this->signaledValues != nullptr) { - wgpuSharedTextureMemoryEndAccessStateFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(SharedTextureMemoryEndAccessState& value) { - SharedTextureMemoryEndAccessState defaultValue{}; - AsNonConstReference(value.initialized) = defaultValue.initialized; - AsNonConstReference(value.fenceCount) = defaultValue.fenceCount; - AsNonConstReference(value.fences) = defaultValue.fences; - AsNonConstReference(value.signaledValues) = defaultValue.signaledValues; - } - - SharedTextureMemoryEndAccessState::SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState&& rhs) - : initialized(rhs.initialized), - fenceCount(rhs.fenceCount), - fences(rhs.fences), - signaledValues(rhs.signaledValues){ - Reset(rhs); - } - - SharedTextureMemoryEndAccessState& SharedTextureMemoryEndAccessState::operator=(SharedTextureMemoryEndAccessState&& rhs) { - if (&rhs == this) { - return *this; - } - this->~SharedTextureMemoryEndAccessState(); - AsNonConstReference(this->initialized) = std::move(rhs.initialized); - AsNonConstReference(this->fenceCount) = std::move(rhs.fenceCount); - AsNonConstReference(this->fences) = std::move(rhs.fences); - AsNonConstReference(this->signaledValues) = std::move(rhs.signaledValues); - Reset(rhs); - return *this; - } - - // AdapterPropertiesMemoryHeaps - AdapterPropertiesMemoryHeaps::~AdapterPropertiesMemoryHeaps() { - if (this->heapInfo != nullptr) { - wgpuAdapterPropertiesMemoryHeapsFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(AdapterPropertiesMemoryHeaps& value) { - AdapterPropertiesMemoryHeaps defaultValue{}; - AsNonConstReference(value.heapCount) = defaultValue.heapCount; - AsNonConstReference(value.heapInfo) = defaultValue.heapInfo; - } - - AdapterPropertiesMemoryHeaps::AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps&& rhs) - : heapCount(rhs.heapCount), - heapInfo(rhs.heapInfo){ - Reset(rhs); - } - - AdapterPropertiesMemoryHeaps& AdapterPropertiesMemoryHeaps::operator=(AdapterPropertiesMemoryHeaps&& rhs) { - if (&rhs == this) { - return *this; - } - this->~AdapterPropertiesMemoryHeaps(); - AsNonConstReference(this->heapCount) = std::move(rhs.heapCount); - AsNonConstReference(this->heapInfo) = std::move(rhs.heapInfo); - Reset(rhs); - return *this; - } - - // DrmFormatCapabilities - DrmFormatCapabilities::~DrmFormatCapabilities() { - if (this->properties != nullptr) { - wgpuDrmFormatCapabilitiesFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(DrmFormatCapabilities& value) { - DrmFormatCapabilities defaultValue{}; - AsNonConstReference(value.propertiesCount) = defaultValue.propertiesCount; - AsNonConstReference(value.properties) = defaultValue.properties; - } - - DrmFormatCapabilities::DrmFormatCapabilities(DrmFormatCapabilities&& rhs) - : propertiesCount(rhs.propertiesCount), - properties(rhs.properties){ - Reset(rhs); - } - - DrmFormatCapabilities& DrmFormatCapabilities::operator=(DrmFormatCapabilities&& rhs) { - if (&rhs == this) { - return *this; - } - this->~DrmFormatCapabilities(); - AsNonConstReference(this->propertiesCount) = std::move(rhs.propertiesCount); - AsNonConstReference(this->properties) = std::move(rhs.properties); - Reset(rhs); - return *this; - } - - - - // Adapter - - static_assert(sizeof(Adapter) == sizeof(WGPUAdapter), "sizeof mismatch for Adapter"); - static_assert(alignof(Adapter) == alignof(WGPUAdapter), "alignof mismatch for Adapter"); - - Device Adapter::CreateDevice(DeviceDescriptor const * descriptor) const { - auto result = wgpuAdapterCreateDevice(Get(), reinterpret_cast(descriptor)); - return Device::Acquire(result); - } - size_t Adapter::EnumerateFeatures(FeatureName * features) const { - auto result = wgpuAdapterEnumerateFeatures(Get(), reinterpret_cast(features)); - return result; - } - Bool Adapter::GetFormatCapabilities(TextureFormat format, FormatCapabilities * capabilities) const { - auto result = wgpuAdapterGetFormatCapabilities(Get(), static_cast(format), reinterpret_cast(capabilities)); - return result; - } - Instance Adapter::GetInstance() const { - auto result = wgpuAdapterGetInstance(Get()); - return Instance::Acquire(result); - } - Bool Adapter::GetLimits(SupportedLimits * limits) const { - auto result = wgpuAdapterGetLimits(Get(), reinterpret_cast(limits)); - return result; - } - void Adapter::GetProperties(AdapterProperties * properties) const { - *properties = AdapterProperties(); - wgpuAdapterGetProperties(Get(), reinterpret_cast(properties)); - } - Bool Adapter::HasFeature(FeatureName feature) const { - auto result = wgpuAdapterHasFeature(Get(), static_cast(feature)); - return result; - } - void Adapter::RequestDevice(DeviceDescriptor const * descriptor, RequestDeviceCallback callback, void * userdata) const { - wgpuAdapterRequestDevice(Get(), reinterpret_cast(descriptor), callback, userdata); - } - Future Adapter::RequestDevice(DeviceDescriptor const * options, RequestDeviceCallbackInfo callbackInfo) const { - auto result = wgpuAdapterRequestDeviceF(Get(), reinterpret_cast(options), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - void Adapter::WGPUReference(WGPUAdapter handle) { - if (handle != nullptr) { - wgpuAdapterReference(handle); - } - } - void Adapter::WGPURelease(WGPUAdapter handle) { - if (handle != nullptr) { - wgpuAdapterRelease(handle); - } - } - - // BindGroup - - static_assert(sizeof(BindGroup) == sizeof(WGPUBindGroup), "sizeof mismatch for BindGroup"); - static_assert(alignof(BindGroup) == alignof(WGPUBindGroup), "alignof mismatch for BindGroup"); - - void BindGroup::SetLabel(char const * label) const { - wgpuBindGroupSetLabel(Get(), reinterpret_cast(label)); - } - void BindGroup::WGPUReference(WGPUBindGroup handle) { - if (handle != nullptr) { - wgpuBindGroupReference(handle); - } - } - void BindGroup::WGPURelease(WGPUBindGroup handle) { - if (handle != nullptr) { - wgpuBindGroupRelease(handle); - } - } - - // BindGroupLayout - - static_assert(sizeof(BindGroupLayout) == sizeof(WGPUBindGroupLayout), "sizeof mismatch for BindGroupLayout"); - static_assert(alignof(BindGroupLayout) == alignof(WGPUBindGroupLayout), "alignof mismatch for BindGroupLayout"); - - void BindGroupLayout::SetLabel(char const * label) const { - wgpuBindGroupLayoutSetLabel(Get(), reinterpret_cast(label)); - } - void BindGroupLayout::WGPUReference(WGPUBindGroupLayout handle) { - if (handle != nullptr) { - wgpuBindGroupLayoutReference(handle); - } - } - void BindGroupLayout::WGPURelease(WGPUBindGroupLayout handle) { - if (handle != nullptr) { - wgpuBindGroupLayoutRelease(handle); - } - } - - // Buffer - - static_assert(sizeof(Buffer) == sizeof(WGPUBuffer), "sizeof mismatch for Buffer"); - static_assert(alignof(Buffer) == alignof(WGPUBuffer), "alignof mismatch for Buffer"); - - void Buffer::Destroy() const { - wgpuBufferDestroy(Get()); - } - void const * Buffer::GetConstMappedRange(size_t offset, size_t size) const { - auto result = wgpuBufferGetConstMappedRange(Get(), offset, size); - return result; - } - BufferMapState Buffer::GetMapState() const { - auto result = wgpuBufferGetMapState(Get()); - return static_cast(result); - } - void * Buffer::GetMappedRange(size_t offset, size_t size) const { - auto result = wgpuBufferGetMappedRange(Get(), offset, size); - return result; - } - uint64_t Buffer::GetSize() const { - auto result = wgpuBufferGetSize(Get()); - return result; - } - BufferUsage Buffer::GetUsage() const { - auto result = wgpuBufferGetUsage(Get()); - return static_cast(result); - } - void Buffer::MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallback callback, void * userdata) const { - wgpuBufferMapAsync(Get(), static_cast(mode), offset, size, callback, userdata); - } - Future Buffer::MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallbackInfo callbackInfo) const { - auto result = wgpuBufferMapAsyncF(Get(), static_cast(mode), offset, size, *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - void Buffer::SetLabel(char const * label) const { - wgpuBufferSetLabel(Get(), reinterpret_cast(label)); - } - void Buffer::Unmap() const { - wgpuBufferUnmap(Get()); - } - void Buffer::WGPUReference(WGPUBuffer handle) { - if (handle != nullptr) { - wgpuBufferReference(handle); - } - } - void Buffer::WGPURelease(WGPUBuffer handle) { - if (handle != nullptr) { - wgpuBufferRelease(handle); - } - } - - // CommandBuffer - - static_assert(sizeof(CommandBuffer) == sizeof(WGPUCommandBuffer), "sizeof mismatch for CommandBuffer"); - static_assert(alignof(CommandBuffer) == alignof(WGPUCommandBuffer), "alignof mismatch for CommandBuffer"); - - void CommandBuffer::SetLabel(char const * label) const { - wgpuCommandBufferSetLabel(Get(), reinterpret_cast(label)); - } - void CommandBuffer::WGPUReference(WGPUCommandBuffer handle) { - if (handle != nullptr) { - wgpuCommandBufferReference(handle); - } - } - void CommandBuffer::WGPURelease(WGPUCommandBuffer handle) { - if (handle != nullptr) { - wgpuCommandBufferRelease(handle); - } - } - - // CommandEncoder - - static_assert(sizeof(CommandEncoder) == sizeof(WGPUCommandEncoder), "sizeof mismatch for CommandEncoder"); - static_assert(alignof(CommandEncoder) == alignof(WGPUCommandEncoder), "alignof mismatch for CommandEncoder"); - - ComputePassEncoder CommandEncoder::BeginComputePass(ComputePassDescriptor const * descriptor) const { - auto result = wgpuCommandEncoderBeginComputePass(Get(), reinterpret_cast(descriptor)); - return ComputePassEncoder::Acquire(result); - } - RenderPassEncoder CommandEncoder::BeginRenderPass(RenderPassDescriptor const * descriptor) const { - auto result = wgpuCommandEncoderBeginRenderPass(Get(), reinterpret_cast(descriptor)); - return RenderPassEncoder::Acquire(result); - } - void CommandEncoder::ClearBuffer(Buffer const& buffer, uint64_t offset, uint64_t size) const { - wgpuCommandEncoderClearBuffer(Get(), buffer.Get(), offset, size); - } - void CommandEncoder::CopyBufferToBuffer(Buffer const& source, uint64_t sourceOffset, Buffer const& destination, uint64_t destinationOffset, uint64_t size) const { - wgpuCommandEncoderCopyBufferToBuffer(Get(), source.Get(), sourceOffset, destination.Get(), destinationOffset, size); - } - void CommandEncoder::CopyBufferToTexture(ImageCopyBuffer const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const { - wgpuCommandEncoderCopyBufferToTexture(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize)); - } - void CommandEncoder::CopyTextureToBuffer(ImageCopyTexture const * source, ImageCopyBuffer const * destination, Extent3D const * copySize) const { - wgpuCommandEncoderCopyTextureToBuffer(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize)); - } - void CommandEncoder::CopyTextureToTexture(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const { - wgpuCommandEncoderCopyTextureToTexture(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize)); - } - CommandBuffer CommandEncoder::Finish(CommandBufferDescriptor const * descriptor) const { - auto result = wgpuCommandEncoderFinish(Get(), reinterpret_cast(descriptor)); - return CommandBuffer::Acquire(result); - } - void CommandEncoder::InjectValidationError(char const * message) const { - wgpuCommandEncoderInjectValidationError(Get(), reinterpret_cast(message)); - } - void CommandEncoder::InsertDebugMarker(char const * markerLabel) const { - wgpuCommandEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); - } - void CommandEncoder::PopDebugGroup() const { - wgpuCommandEncoderPopDebugGroup(Get()); - } - void CommandEncoder::PushDebugGroup(char const * groupLabel) const { - wgpuCommandEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); - } - void CommandEncoder::ResolveQuerySet(QuerySet const& querySet, uint32_t firstQuery, uint32_t queryCount, Buffer const& destination, uint64_t destinationOffset) const { - wgpuCommandEncoderResolveQuerySet(Get(), querySet.Get(), firstQuery, queryCount, destination.Get(), destinationOffset); - } - void CommandEncoder::SetLabel(char const * label) const { - wgpuCommandEncoderSetLabel(Get(), reinterpret_cast(label)); - } - void CommandEncoder::WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) const { - wgpuCommandEncoderWriteBuffer(Get(), buffer.Get(), bufferOffset, reinterpret_cast(data), size); - } - void CommandEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const { - wgpuCommandEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); - } - void CommandEncoder::WGPUReference(WGPUCommandEncoder handle) { - if (handle != nullptr) { - wgpuCommandEncoderReference(handle); - } - } - void CommandEncoder::WGPURelease(WGPUCommandEncoder handle) { - if (handle != nullptr) { - wgpuCommandEncoderRelease(handle); - } - } - - // ComputePassEncoder - - static_assert(sizeof(ComputePassEncoder) == sizeof(WGPUComputePassEncoder), "sizeof mismatch for ComputePassEncoder"); - static_assert(alignof(ComputePassEncoder) == alignof(WGPUComputePassEncoder), "alignof mismatch for ComputePassEncoder"); - - void ComputePassEncoder::DispatchWorkgroups(uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) const { - wgpuComputePassEncoderDispatchWorkgroups(Get(), workgroupCountX, workgroupCountY, workgroupCountZ); - } - void ComputePassEncoder::DispatchWorkgroupsIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { - wgpuComputePassEncoderDispatchWorkgroupsIndirect(Get(), indirectBuffer.Get(), indirectOffset); - } - void ComputePassEncoder::End() const { - wgpuComputePassEncoderEnd(Get()); - } - void ComputePassEncoder::InsertDebugMarker(char const * markerLabel) const { - wgpuComputePassEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); - } - void ComputePassEncoder::PopDebugGroup() const { - wgpuComputePassEncoderPopDebugGroup(Get()); - } - void ComputePassEncoder::PushDebugGroup(char const * groupLabel) const { - wgpuComputePassEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); - } - void ComputePassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { - wgpuComputePassEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast(dynamicOffsets)); - } - void ComputePassEncoder::SetLabel(char const * label) const { - wgpuComputePassEncoderSetLabel(Get(), reinterpret_cast(label)); - } - void ComputePassEncoder::SetPipeline(ComputePipeline const& pipeline) const { - wgpuComputePassEncoderSetPipeline(Get(), pipeline.Get()); - } - void ComputePassEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const { - wgpuComputePassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); - } - void ComputePassEncoder::WGPUReference(WGPUComputePassEncoder handle) { - if (handle != nullptr) { - wgpuComputePassEncoderReference(handle); - } - } - void ComputePassEncoder::WGPURelease(WGPUComputePassEncoder handle) { - if (handle != nullptr) { - wgpuComputePassEncoderRelease(handle); - } - } - - // ComputePipeline - - static_assert(sizeof(ComputePipeline) == sizeof(WGPUComputePipeline), "sizeof mismatch for ComputePipeline"); - static_assert(alignof(ComputePipeline) == alignof(WGPUComputePipeline), "alignof mismatch for ComputePipeline"); - - BindGroupLayout ComputePipeline::GetBindGroupLayout(uint32_t groupIndex) const { - auto result = wgpuComputePipelineGetBindGroupLayout(Get(), groupIndex); - return BindGroupLayout::Acquire(result); - } - void ComputePipeline::SetLabel(char const * label) const { - wgpuComputePipelineSetLabel(Get(), reinterpret_cast(label)); - } - void ComputePipeline::WGPUReference(WGPUComputePipeline handle) { - if (handle != nullptr) { - wgpuComputePipelineReference(handle); - } - } - void ComputePipeline::WGPURelease(WGPUComputePipeline handle) { - if (handle != nullptr) { - wgpuComputePipelineRelease(handle); - } - } - - // Device - - static_assert(sizeof(Device) == sizeof(WGPUDevice), "sizeof mismatch for Device"); - static_assert(alignof(Device) == alignof(WGPUDevice), "alignof mismatch for Device"); - - BindGroup Device::CreateBindGroup(BindGroupDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateBindGroup(Get(), reinterpret_cast(descriptor)); - return BindGroup::Acquire(result); - } - BindGroupLayout Device::CreateBindGroupLayout(BindGroupLayoutDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateBindGroupLayout(Get(), reinterpret_cast(descriptor)); - return BindGroupLayout::Acquire(result); - } - Buffer Device::CreateBuffer(BufferDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateBuffer(Get(), reinterpret_cast(descriptor)); - return Buffer::Acquire(result); - } - CommandEncoder Device::CreateCommandEncoder(CommandEncoderDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateCommandEncoder(Get(), reinterpret_cast(descriptor)); - return CommandEncoder::Acquire(result); - } - ComputePipeline Device::CreateComputePipeline(ComputePipelineDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateComputePipeline(Get(), reinterpret_cast(descriptor)); - return ComputePipeline::Acquire(result); - } - void Device::CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallback callback, void * userdata) const { - wgpuDeviceCreateComputePipelineAsync(Get(), reinterpret_cast(descriptor), callback, userdata); - } - Future Device::CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallbackInfo callbackInfo) const { - auto result = wgpuDeviceCreateComputePipelineAsyncF(Get(), reinterpret_cast(descriptor), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - Buffer Device::CreateErrorBuffer(BufferDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateErrorBuffer(Get(), reinterpret_cast(descriptor)); - return Buffer::Acquire(result); - } - ExternalTexture Device::CreateErrorExternalTexture() const { - auto result = wgpuDeviceCreateErrorExternalTexture(Get()); - return ExternalTexture::Acquire(result); - } - ShaderModule Device::CreateErrorShaderModule(ShaderModuleDescriptor const * descriptor, char const * errorMessage) const { - auto result = wgpuDeviceCreateErrorShaderModule(Get(), reinterpret_cast(descriptor), reinterpret_cast(errorMessage)); - return ShaderModule::Acquire(result); - } - Texture Device::CreateErrorTexture(TextureDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateErrorTexture(Get(), reinterpret_cast(descriptor)); - return Texture::Acquire(result); - } - ExternalTexture Device::CreateExternalTexture(ExternalTextureDescriptor const * externalTextureDescriptor) const { - auto result = wgpuDeviceCreateExternalTexture(Get(), reinterpret_cast(externalTextureDescriptor)); - return ExternalTexture::Acquire(result); - } - PipelineLayout Device::CreatePipelineLayout(PipelineLayoutDescriptor const * descriptor) const { - auto result = wgpuDeviceCreatePipelineLayout(Get(), reinterpret_cast(descriptor)); - return PipelineLayout::Acquire(result); - } - QuerySet Device::CreateQuerySet(QuerySetDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateQuerySet(Get(), reinterpret_cast(descriptor)); - return QuerySet::Acquire(result); - } - RenderBundleEncoder Device::CreateRenderBundleEncoder(RenderBundleEncoderDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateRenderBundleEncoder(Get(), reinterpret_cast(descriptor)); - return RenderBundleEncoder::Acquire(result); - } - RenderPipeline Device::CreateRenderPipeline(RenderPipelineDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateRenderPipeline(Get(), reinterpret_cast(descriptor)); - return RenderPipeline::Acquire(result); - } - void Device::CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallback callback, void * userdata) const { - wgpuDeviceCreateRenderPipelineAsync(Get(), reinterpret_cast(descriptor), callback, userdata); - } - Future Device::CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallbackInfo callbackInfo) const { - auto result = wgpuDeviceCreateRenderPipelineAsyncF(Get(), reinterpret_cast(descriptor), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - Sampler Device::CreateSampler(SamplerDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateSampler(Get(), reinterpret_cast(descriptor)); - return Sampler::Acquire(result); - } - ShaderModule Device::CreateShaderModule(ShaderModuleDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateShaderModule(Get(), reinterpret_cast(descriptor)); - return ShaderModule::Acquire(result); - } - SwapChain Device::CreateSwapChain(Surface const& surface, SwapChainDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateSwapChain(Get(), surface.Get(), reinterpret_cast(descriptor)); - return SwapChain::Acquire(result); - } - Texture Device::CreateTexture(TextureDescriptor const * descriptor) const { - auto result = wgpuDeviceCreateTexture(Get(), reinterpret_cast(descriptor)); - return Texture::Acquire(result); - } - void Device::Destroy() const { - wgpuDeviceDestroy(Get()); - } - size_t Device::EnumerateFeatures(FeatureName * features) const { - auto result = wgpuDeviceEnumerateFeatures(Get(), reinterpret_cast(features)); - return result; - } - void Device::ForceLoss(DeviceLostReason type, char const * message) const { - wgpuDeviceForceLoss(Get(), static_cast(type), reinterpret_cast(message)); - } - Adapter Device::GetAdapter() const { - auto result = wgpuDeviceGetAdapter(Get()); - return Adapter::Acquire(result); - } - Bool Device::GetLimits(SupportedLimits * limits) const { - auto result = wgpuDeviceGetLimits(Get(), reinterpret_cast(limits)); - return result; - } - Queue Device::GetQueue() const { - auto result = wgpuDeviceGetQueue(Get()); - return Queue::Acquire(result); - } - TextureUsage Device::GetSupportedSurfaceUsage(Surface const& surface) const { - auto result = wgpuDeviceGetSupportedSurfaceUsage(Get(), surface.Get()); - return static_cast(result); - } - Bool Device::HasFeature(FeatureName feature) const { - auto result = wgpuDeviceHasFeature(Get(), static_cast(feature)); - return result; - } - SharedBufferMemory Device::ImportSharedBufferMemory(SharedBufferMemoryDescriptor const * descriptor) const { - auto result = wgpuDeviceImportSharedBufferMemory(Get(), reinterpret_cast(descriptor)); - return SharedBufferMemory::Acquire(result); - } - SharedFence Device::ImportSharedFence(SharedFenceDescriptor const * descriptor) const { - auto result = wgpuDeviceImportSharedFence(Get(), reinterpret_cast(descriptor)); - return SharedFence::Acquire(result); - } - SharedTextureMemory Device::ImportSharedTextureMemory(SharedTextureMemoryDescriptor const * descriptor) const { - auto result = wgpuDeviceImportSharedTextureMemory(Get(), reinterpret_cast(descriptor)); - return SharedTextureMemory::Acquire(result); - } - void Device::InjectError(ErrorType type, char const * message) const { - wgpuDeviceInjectError(Get(), static_cast(type), reinterpret_cast(message)); - } - void Device::PopErrorScope(ErrorCallback oldCallback, void * userdata) const { - wgpuDevicePopErrorScope(Get(), oldCallback, userdata); - } - Future Device::PopErrorScope(PopErrorScopeCallbackInfo callbackInfo) const { - auto result = wgpuDevicePopErrorScopeF(Get(), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - void Device::PushErrorScope(ErrorFilter filter) const { - wgpuDevicePushErrorScope(Get(), static_cast(filter)); - } - void Device::SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const { - wgpuDeviceSetDeviceLostCallback(Get(), callback, userdata); - } - void Device::SetLabel(char const * label) const { - wgpuDeviceSetLabel(Get(), reinterpret_cast(label)); - } - void Device::SetLoggingCallback(LoggingCallback callback, void * userdata) const { - wgpuDeviceSetLoggingCallback(Get(), callback, userdata); - } - void Device::SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const { - wgpuDeviceSetUncapturedErrorCallback(Get(), callback, userdata); - } - void Device::Tick() const { - wgpuDeviceTick(Get()); - } - void Device::ValidateTextureDescriptor(TextureDescriptor const * descriptor) const { - wgpuDeviceValidateTextureDescriptor(Get(), reinterpret_cast(descriptor)); - } - void Device::WGPUReference(WGPUDevice handle) { - if (handle != nullptr) { - wgpuDeviceReference(handle); - } - } - void Device::WGPURelease(WGPUDevice handle) { - if (handle != nullptr) { - wgpuDeviceRelease(handle); - } - } - - // ExternalTexture - - static_assert(sizeof(ExternalTexture) == sizeof(WGPUExternalTexture), "sizeof mismatch for ExternalTexture"); - static_assert(alignof(ExternalTexture) == alignof(WGPUExternalTexture), "alignof mismatch for ExternalTexture"); - - void ExternalTexture::Destroy() const { - wgpuExternalTextureDestroy(Get()); - } - void ExternalTexture::Expire() const { - wgpuExternalTextureExpire(Get()); - } - void ExternalTexture::Refresh() const { - wgpuExternalTextureRefresh(Get()); - } - void ExternalTexture::SetLabel(char const * label) const { - wgpuExternalTextureSetLabel(Get(), reinterpret_cast(label)); - } - void ExternalTexture::WGPUReference(WGPUExternalTexture handle) { - if (handle != nullptr) { - wgpuExternalTextureReference(handle); - } - } - void ExternalTexture::WGPURelease(WGPUExternalTexture handle) { - if (handle != nullptr) { - wgpuExternalTextureRelease(handle); - } - } - - // Instance - - static_assert(sizeof(Instance) == sizeof(WGPUInstance), "sizeof mismatch for Instance"); - static_assert(alignof(Instance) == alignof(WGPUInstance), "alignof mismatch for Instance"); - - Surface Instance::CreateSurface(SurfaceDescriptor const * descriptor) const { - auto result = wgpuInstanceCreateSurface(Get(), reinterpret_cast(descriptor)); - return Surface::Acquire(result); - } - size_t Instance::EnumerateWGSLLanguageFeatures(WGSLFeatureName * features) const { - auto result = wgpuInstanceEnumerateWGSLLanguageFeatures(Get(), reinterpret_cast(features)); - return result; - } - Bool Instance::HasWGSLLanguageFeature(WGSLFeatureName feature) const { - auto result = wgpuInstanceHasWGSLLanguageFeature(Get(), static_cast(feature)); - return result; - } - void Instance::ProcessEvents() const { - wgpuInstanceProcessEvents(Get()); - } - void Instance::RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallback callback, void * userdata) const { - wgpuInstanceRequestAdapter(Get(), reinterpret_cast(options), callback, userdata); - } - Future Instance::RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallbackInfo callbackInfo) const { - auto result = wgpuInstanceRequestAdapterF(Get(), reinterpret_cast(options), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - WaitStatus Instance::WaitAny(size_t futureCount, FutureWaitInfo * futures, uint64_t timeoutNS) const { - auto result = wgpuInstanceWaitAny(Get(), futureCount, reinterpret_cast(futures), timeoutNS); - return static_cast(result); - } - void Instance::WGPUReference(WGPUInstance handle) { - if (handle != nullptr) { - wgpuInstanceReference(handle); - } - } - void Instance::WGPURelease(WGPUInstance handle) { - if (handle != nullptr) { - wgpuInstanceRelease(handle); - } - } - - // PipelineLayout - - static_assert(sizeof(PipelineLayout) == sizeof(WGPUPipelineLayout), "sizeof mismatch for PipelineLayout"); - static_assert(alignof(PipelineLayout) == alignof(WGPUPipelineLayout), "alignof mismatch for PipelineLayout"); - - void PipelineLayout::SetLabel(char const * label) const { - wgpuPipelineLayoutSetLabel(Get(), reinterpret_cast(label)); - } - void PipelineLayout::WGPUReference(WGPUPipelineLayout handle) { - if (handle != nullptr) { - wgpuPipelineLayoutReference(handle); - } - } - void PipelineLayout::WGPURelease(WGPUPipelineLayout handle) { - if (handle != nullptr) { - wgpuPipelineLayoutRelease(handle); - } - } - - // QuerySet - - static_assert(sizeof(QuerySet) == sizeof(WGPUQuerySet), "sizeof mismatch for QuerySet"); - static_assert(alignof(QuerySet) == alignof(WGPUQuerySet), "alignof mismatch for QuerySet"); - - void QuerySet::Destroy() const { - wgpuQuerySetDestroy(Get()); - } - uint32_t QuerySet::GetCount() const { - auto result = wgpuQuerySetGetCount(Get()); - return result; - } - QueryType QuerySet::GetType() const { - auto result = wgpuQuerySetGetType(Get()); - return static_cast(result); - } - void QuerySet::SetLabel(char const * label) const { - wgpuQuerySetSetLabel(Get(), reinterpret_cast(label)); - } - void QuerySet::WGPUReference(WGPUQuerySet handle) { - if (handle != nullptr) { - wgpuQuerySetReference(handle); - } - } - void QuerySet::WGPURelease(WGPUQuerySet handle) { - if (handle != nullptr) { - wgpuQuerySetRelease(handle); - } - } - - // Queue - - static_assert(sizeof(Queue) == sizeof(WGPUQueue), "sizeof mismatch for Queue"); - static_assert(alignof(Queue) == alignof(WGPUQueue), "alignof mismatch for Queue"); - - void Queue::CopyExternalTextureForBrowser(ImageCopyExternalTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const { - wgpuQueueCopyExternalTextureForBrowser(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize), reinterpret_cast(options)); - } - void Queue::CopyTextureForBrowser(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const { - wgpuQueueCopyTextureForBrowser(Get(), reinterpret_cast(source), reinterpret_cast(destination), reinterpret_cast(copySize), reinterpret_cast(options)); - } - void Queue::OnSubmittedWorkDone(QueueWorkDoneCallback callback, void * userdata) const { - wgpuQueueOnSubmittedWorkDone(Get(), callback, userdata); - } - Future Queue::OnSubmittedWorkDone(QueueWorkDoneCallbackInfo callbackInfo) const { - auto result = wgpuQueueOnSubmittedWorkDoneF(Get(), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - void Queue::SetLabel(char const * label) const { - wgpuQueueSetLabel(Get(), reinterpret_cast(label)); - } - void Queue::Submit(size_t commandCount, CommandBuffer const * commands) const { - wgpuQueueSubmit(Get(), commandCount, reinterpret_cast(commands)); - } - void Queue::WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, void const * data, size_t size) const { - wgpuQueueWriteBuffer(Get(), buffer.Get(), bufferOffset, reinterpret_cast(data), size); - } - void Queue::WriteTexture(ImageCopyTexture const * destination, void const * data, size_t dataSize, TextureDataLayout const * dataLayout, Extent3D const * writeSize) const { - wgpuQueueWriteTexture(Get(), reinterpret_cast(destination), reinterpret_cast(data), dataSize, reinterpret_cast(dataLayout), reinterpret_cast(writeSize)); - } - void Queue::WGPUReference(WGPUQueue handle) { - if (handle != nullptr) { - wgpuQueueReference(handle); - } - } - void Queue::WGPURelease(WGPUQueue handle) { - if (handle != nullptr) { - wgpuQueueRelease(handle); - } - } - - // RenderBundle - - static_assert(sizeof(RenderBundle) == sizeof(WGPURenderBundle), "sizeof mismatch for RenderBundle"); - static_assert(alignof(RenderBundle) == alignof(WGPURenderBundle), "alignof mismatch for RenderBundle"); - - void RenderBundle::SetLabel(char const * label) const { - wgpuRenderBundleSetLabel(Get(), reinterpret_cast(label)); - } - void RenderBundle::WGPUReference(WGPURenderBundle handle) { - if (handle != nullptr) { - wgpuRenderBundleReference(handle); - } - } - void RenderBundle::WGPURelease(WGPURenderBundle handle) { - if (handle != nullptr) { - wgpuRenderBundleRelease(handle); - } - } - - // RenderBundleEncoder - - static_assert(sizeof(RenderBundleEncoder) == sizeof(WGPURenderBundleEncoder), "sizeof mismatch for RenderBundleEncoder"); - static_assert(alignof(RenderBundleEncoder) == alignof(WGPURenderBundleEncoder), "alignof mismatch for RenderBundleEncoder"); - - void RenderBundleEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) const { - wgpuRenderBundleEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, firstInstance); - } - void RenderBundleEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) const { - wgpuRenderBundleEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } - void RenderBundleEncoder::DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { - wgpuRenderBundleEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), indirectOffset); - } - void RenderBundleEncoder::DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { - wgpuRenderBundleEncoderDrawIndirect(Get(), indirectBuffer.Get(), indirectOffset); - } - RenderBundle RenderBundleEncoder::Finish(RenderBundleDescriptor const * descriptor) const { - auto result = wgpuRenderBundleEncoderFinish(Get(), reinterpret_cast(descriptor)); - return RenderBundle::Acquire(result); - } - void RenderBundleEncoder::InsertDebugMarker(char const * markerLabel) const { - wgpuRenderBundleEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); - } - void RenderBundleEncoder::PopDebugGroup() const { - wgpuRenderBundleEncoderPopDebugGroup(Get()); - } - void RenderBundleEncoder::PushDebugGroup(char const * groupLabel) const { - wgpuRenderBundleEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); - } - void RenderBundleEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { - wgpuRenderBundleEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast(dynamicOffsets)); - } - void RenderBundleEncoder::SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const { - wgpuRenderBundleEncoderSetIndexBuffer(Get(), buffer.Get(), static_cast(format), offset, size); - } - void RenderBundleEncoder::SetLabel(char const * label) const { - wgpuRenderBundleEncoderSetLabel(Get(), reinterpret_cast(label)); - } - void RenderBundleEncoder::SetPipeline(RenderPipeline const& pipeline) const { - wgpuRenderBundleEncoderSetPipeline(Get(), pipeline.Get()); - } - void RenderBundleEncoder::SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset, uint64_t size) const { - wgpuRenderBundleEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size); - } - void RenderBundleEncoder::WGPUReference(WGPURenderBundleEncoder handle) { - if (handle != nullptr) { - wgpuRenderBundleEncoderReference(handle); - } - } - void RenderBundleEncoder::WGPURelease(WGPURenderBundleEncoder handle) { - if (handle != nullptr) { - wgpuRenderBundleEncoderRelease(handle); - } - } - - // RenderPassEncoder - - static_assert(sizeof(RenderPassEncoder) == sizeof(WGPURenderPassEncoder), "sizeof mismatch for RenderPassEncoder"); - static_assert(alignof(RenderPassEncoder) == alignof(WGPURenderPassEncoder), "alignof mismatch for RenderPassEncoder"); - - void RenderPassEncoder::BeginOcclusionQuery(uint32_t queryIndex) const { - wgpuRenderPassEncoderBeginOcclusionQuery(Get(), queryIndex); - } - void RenderPassEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) const { - wgpuRenderPassEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, firstInstance); - } - void RenderPassEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) const { - wgpuRenderPassEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - } - void RenderPassEncoder::DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { - wgpuRenderPassEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), indirectOffset); - } - void RenderPassEncoder::DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const { - wgpuRenderPassEncoderDrawIndirect(Get(), indirectBuffer.Get(), indirectOffset); - } - void RenderPassEncoder::End() const { - wgpuRenderPassEncoderEnd(Get()); - } - void RenderPassEncoder::EndOcclusionQuery() const { - wgpuRenderPassEncoderEndOcclusionQuery(Get()); - } - void RenderPassEncoder::ExecuteBundles(size_t bundleCount, RenderBundle const * bundles) const { - wgpuRenderPassEncoderExecuteBundles(Get(), bundleCount, reinterpret_cast(bundles)); - } - void RenderPassEncoder::InsertDebugMarker(char const * markerLabel) const { - wgpuRenderPassEncoderInsertDebugMarker(Get(), reinterpret_cast(markerLabel)); - } - void RenderPassEncoder::PixelLocalStorageBarrier() const { - wgpuRenderPassEncoderPixelLocalStorageBarrier(Get()); - } - void RenderPassEncoder::PopDebugGroup() const { - wgpuRenderPassEncoderPopDebugGroup(Get()); - } - void RenderPassEncoder::PushDebugGroup(char const * groupLabel) const { - wgpuRenderPassEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); - } - void RenderPassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { - wgpuRenderPassEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast(dynamicOffsets)); - } - void RenderPassEncoder::SetBlendConstant(Color const * color) const { - wgpuRenderPassEncoderSetBlendConstant(Get(), reinterpret_cast(color)); - } - void RenderPassEncoder::SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const { - wgpuRenderPassEncoderSetIndexBuffer(Get(), buffer.Get(), static_cast(format), offset, size); - } - void RenderPassEncoder::SetLabel(char const * label) const { - wgpuRenderPassEncoderSetLabel(Get(), reinterpret_cast(label)); - } - void RenderPassEncoder::SetPipeline(RenderPipeline const& pipeline) const { - wgpuRenderPassEncoderSetPipeline(Get(), pipeline.Get()); - } - void RenderPassEncoder::SetScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height) const { - wgpuRenderPassEncoderSetScissorRect(Get(), x, y, width, height); - } - void RenderPassEncoder::SetStencilReference(uint32_t reference) const { - wgpuRenderPassEncoderSetStencilReference(Get(), reference); - } - void RenderPassEncoder::SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset, uint64_t size) const { - wgpuRenderPassEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size); - } - void RenderPassEncoder::SetViewport(float x, float y, float width, float height, float minDepth, float maxDepth) const { - wgpuRenderPassEncoderSetViewport(Get(), x, y, width, height, minDepth, maxDepth); - } - void RenderPassEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const { - wgpuRenderPassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex); - } - void RenderPassEncoder::WGPUReference(WGPURenderPassEncoder handle) { - if (handle != nullptr) { - wgpuRenderPassEncoderReference(handle); - } - } - void RenderPassEncoder::WGPURelease(WGPURenderPassEncoder handle) { - if (handle != nullptr) { - wgpuRenderPassEncoderRelease(handle); - } - } - - // RenderPipeline - - static_assert(sizeof(RenderPipeline) == sizeof(WGPURenderPipeline), "sizeof mismatch for RenderPipeline"); - static_assert(alignof(RenderPipeline) == alignof(WGPURenderPipeline), "alignof mismatch for RenderPipeline"); - - BindGroupLayout RenderPipeline::GetBindGroupLayout(uint32_t groupIndex) const { - auto result = wgpuRenderPipelineGetBindGroupLayout(Get(), groupIndex); - return BindGroupLayout::Acquire(result); - } - void RenderPipeline::SetLabel(char const * label) const { - wgpuRenderPipelineSetLabel(Get(), reinterpret_cast(label)); - } - void RenderPipeline::WGPUReference(WGPURenderPipeline handle) { - if (handle != nullptr) { - wgpuRenderPipelineReference(handle); - } - } - void RenderPipeline::WGPURelease(WGPURenderPipeline handle) { - if (handle != nullptr) { - wgpuRenderPipelineRelease(handle); - } - } - - // Sampler - - static_assert(sizeof(Sampler) == sizeof(WGPUSampler), "sizeof mismatch for Sampler"); - static_assert(alignof(Sampler) == alignof(WGPUSampler), "alignof mismatch for Sampler"); - - void Sampler::SetLabel(char const * label) const { - wgpuSamplerSetLabel(Get(), reinterpret_cast(label)); - } - void Sampler::WGPUReference(WGPUSampler handle) { - if (handle != nullptr) { - wgpuSamplerReference(handle); - } - } - void Sampler::WGPURelease(WGPUSampler handle) { - if (handle != nullptr) { - wgpuSamplerRelease(handle); - } - } - - // ShaderModule - - static_assert(sizeof(ShaderModule) == sizeof(WGPUShaderModule), "sizeof mismatch for ShaderModule"); - static_assert(alignof(ShaderModule) == alignof(WGPUShaderModule), "alignof mismatch for ShaderModule"); - - void ShaderModule::GetCompilationInfo(CompilationInfoCallback callback, void * userdata) const { - wgpuShaderModuleGetCompilationInfo(Get(), callback, userdata); - } - Future ShaderModule::GetCompilationInfo(CompilationInfoCallbackInfo callbackInfo) const { - auto result = wgpuShaderModuleGetCompilationInfoF(Get(), *reinterpret_cast(&callbackInfo)); - return Future { - result.id - }; - } - void ShaderModule::SetLabel(char const * label) const { - wgpuShaderModuleSetLabel(Get(), reinterpret_cast(label)); - } - void ShaderModule::WGPUReference(WGPUShaderModule handle) { - if (handle != nullptr) { - wgpuShaderModuleReference(handle); - } - } - void ShaderModule::WGPURelease(WGPUShaderModule handle) { - if (handle != nullptr) { - wgpuShaderModuleRelease(handle); - } - } - - // SharedBufferMemory - - static_assert(sizeof(SharedBufferMemory) == sizeof(WGPUSharedBufferMemory), "sizeof mismatch for SharedBufferMemory"); - static_assert(alignof(SharedBufferMemory) == alignof(WGPUSharedBufferMemory), "alignof mismatch for SharedBufferMemory"); - - Bool SharedBufferMemory::BeginAccess(Buffer const& buffer, SharedBufferMemoryBeginAccessDescriptor const * descriptor) const { - auto result = wgpuSharedBufferMemoryBeginAccess(Get(), buffer.Get(), reinterpret_cast(descriptor)); - return result; - } - Buffer SharedBufferMemory::CreateBuffer(BufferDescriptor const * descriptor) const { - auto result = wgpuSharedBufferMemoryCreateBuffer(Get(), reinterpret_cast(descriptor)); - return Buffer::Acquire(result); - } - Bool SharedBufferMemory::EndAccess(Buffer const& buffer, SharedBufferMemoryEndAccessState * descriptor) const { - *descriptor = SharedBufferMemoryEndAccessState(); - auto result = wgpuSharedBufferMemoryEndAccess(Get(), buffer.Get(), reinterpret_cast(descriptor)); - return result; - } - void SharedBufferMemory::GetProperties(SharedBufferMemoryProperties * properties) const { - wgpuSharedBufferMemoryGetProperties(Get(), reinterpret_cast(properties)); - } - Bool SharedBufferMemory::IsDeviceLost() const { - auto result = wgpuSharedBufferMemoryIsDeviceLost(Get()); - return result; - } - void SharedBufferMemory::SetLabel(char const * label) const { - wgpuSharedBufferMemorySetLabel(Get(), reinterpret_cast(label)); - } - void SharedBufferMemory::WGPUReference(WGPUSharedBufferMemory handle) { - if (handle != nullptr) { - wgpuSharedBufferMemoryReference(handle); - } - } - void SharedBufferMemory::WGPURelease(WGPUSharedBufferMemory handle) { - if (handle != nullptr) { - wgpuSharedBufferMemoryRelease(handle); - } - } - - // SharedFence - - static_assert(sizeof(SharedFence) == sizeof(WGPUSharedFence), "sizeof mismatch for SharedFence"); - static_assert(alignof(SharedFence) == alignof(WGPUSharedFence), "alignof mismatch for SharedFence"); - - void SharedFence::ExportInfo(SharedFenceExportInfo * info) const { - wgpuSharedFenceExportInfo(Get(), reinterpret_cast(info)); - } - void SharedFence::WGPUReference(WGPUSharedFence handle) { - if (handle != nullptr) { - wgpuSharedFenceReference(handle); - } - } - void SharedFence::WGPURelease(WGPUSharedFence handle) { - if (handle != nullptr) { - wgpuSharedFenceRelease(handle); - } - } - - // SharedTextureMemory - - static_assert(sizeof(SharedTextureMemory) == sizeof(WGPUSharedTextureMemory), "sizeof mismatch for SharedTextureMemory"); - static_assert(alignof(SharedTextureMemory) == alignof(WGPUSharedTextureMemory), "alignof mismatch for SharedTextureMemory"); - - Bool SharedTextureMemory::BeginAccess(Texture const& texture, SharedTextureMemoryBeginAccessDescriptor const * descriptor) const { - auto result = wgpuSharedTextureMemoryBeginAccess(Get(), texture.Get(), reinterpret_cast(descriptor)); - return result; - } - Texture SharedTextureMemory::CreateTexture(TextureDescriptor const * descriptor) const { - auto result = wgpuSharedTextureMemoryCreateTexture(Get(), reinterpret_cast(descriptor)); - return Texture::Acquire(result); - } - Bool SharedTextureMemory::EndAccess(Texture const& texture, SharedTextureMemoryEndAccessState * descriptor) const { - *descriptor = SharedTextureMemoryEndAccessState(); - auto result = wgpuSharedTextureMemoryEndAccess(Get(), texture.Get(), reinterpret_cast(descriptor)); - return result; - } - void SharedTextureMemory::GetProperties(SharedTextureMemoryProperties * properties) const { - wgpuSharedTextureMemoryGetProperties(Get(), reinterpret_cast(properties)); - } - Bool SharedTextureMemory::IsDeviceLost() const { - auto result = wgpuSharedTextureMemoryIsDeviceLost(Get()); - return result; - } - void SharedTextureMemory::SetLabel(char const * label) const { - wgpuSharedTextureMemorySetLabel(Get(), reinterpret_cast(label)); - } - void SharedTextureMemory::WGPUReference(WGPUSharedTextureMemory handle) { - if (handle != nullptr) { - wgpuSharedTextureMemoryReference(handle); - } - } - void SharedTextureMemory::WGPURelease(WGPUSharedTextureMemory handle) { - if (handle != nullptr) { - wgpuSharedTextureMemoryRelease(handle); - } - } - - // Surface - - static_assert(sizeof(Surface) == sizeof(WGPUSurface), "sizeof mismatch for Surface"); - static_assert(alignof(Surface) == alignof(WGPUSurface), "alignof mismatch for Surface"); - - TextureFormat Surface::GetPreferredFormat(Adapter const& adapter) const { - auto result = wgpuSurfaceGetPreferredFormat(Get(), adapter.Get()); - return static_cast(result); - } - void Surface::WGPUReference(WGPUSurface handle) { - if (handle != nullptr) { - wgpuSurfaceReference(handle); - } - } - void Surface::WGPURelease(WGPUSurface handle) { - if (handle != nullptr) { - wgpuSurfaceRelease(handle); - } - } - - // SwapChain - - static_assert(sizeof(SwapChain) == sizeof(WGPUSwapChain), "sizeof mismatch for SwapChain"); - static_assert(alignof(SwapChain) == alignof(WGPUSwapChain), "alignof mismatch for SwapChain"); - - Texture SwapChain::GetCurrentTexture() const { - auto result = wgpuSwapChainGetCurrentTexture(Get()); - return Texture::Acquire(result); - } - TextureView SwapChain::GetCurrentTextureView() const { - auto result = wgpuSwapChainGetCurrentTextureView(Get()); - return TextureView::Acquire(result); - } - void SwapChain::Present() const { - wgpuSwapChainPresent(Get()); - } - void SwapChain::WGPUReference(WGPUSwapChain handle) { - if (handle != nullptr) { - wgpuSwapChainReference(handle); - } - } - void SwapChain::WGPURelease(WGPUSwapChain handle) { - if (handle != nullptr) { - wgpuSwapChainRelease(handle); - } - } - - // Texture - - static_assert(sizeof(Texture) == sizeof(WGPUTexture), "sizeof mismatch for Texture"); - static_assert(alignof(Texture) == alignof(WGPUTexture), "alignof mismatch for Texture"); - - TextureView Texture::CreateErrorView(TextureViewDescriptor const * descriptor) const { - auto result = wgpuTextureCreateErrorView(Get(), reinterpret_cast(descriptor)); - return TextureView::Acquire(result); - } - TextureView Texture::CreateView(TextureViewDescriptor const * descriptor) const { - auto result = wgpuTextureCreateView(Get(), reinterpret_cast(descriptor)); - return TextureView::Acquire(result); - } - void Texture::Destroy() const { - wgpuTextureDestroy(Get()); - } - uint32_t Texture::GetDepthOrArrayLayers() const { - auto result = wgpuTextureGetDepthOrArrayLayers(Get()); - return result; - } - TextureDimension Texture::GetDimension() const { - auto result = wgpuTextureGetDimension(Get()); - return static_cast(result); - } - TextureFormat Texture::GetFormat() const { - auto result = wgpuTextureGetFormat(Get()); - return static_cast(result); - } - uint32_t Texture::GetHeight() const { - auto result = wgpuTextureGetHeight(Get()); - return result; - } - uint32_t Texture::GetMipLevelCount() const { - auto result = wgpuTextureGetMipLevelCount(Get()); - return result; - } - uint32_t Texture::GetSampleCount() const { - auto result = wgpuTextureGetSampleCount(Get()); - return result; - } - TextureUsage Texture::GetUsage() const { - auto result = wgpuTextureGetUsage(Get()); - return static_cast(result); - } - uint32_t Texture::GetWidth() const { - auto result = wgpuTextureGetWidth(Get()); - return result; - } - void Texture::SetLabel(char const * label) const { - wgpuTextureSetLabel(Get(), reinterpret_cast(label)); - } - void Texture::WGPUReference(WGPUTexture handle) { - if (handle != nullptr) { - wgpuTextureReference(handle); - } - } - void Texture::WGPURelease(WGPUTexture handle) { - if (handle != nullptr) { - wgpuTextureRelease(handle); - } - } - - // TextureView - - static_assert(sizeof(TextureView) == sizeof(WGPUTextureView), "sizeof mismatch for TextureView"); - static_assert(alignof(TextureView) == alignof(WGPUTextureView), "alignof mismatch for TextureView"); - - void TextureView::SetLabel(char const * label) const { - wgpuTextureViewSetLabel(Get(), reinterpret_cast(label)); - } - void TextureView::WGPUReference(WGPUTextureView handle) { - if (handle != nullptr) { - wgpuTextureViewReference(handle); - } - } - void TextureView::WGPURelease(WGPUTextureView handle) { - if (handle != nullptr) { - wgpuTextureViewRelease(handle); - } - } - - // Function - - Instance CreateInstance(InstanceDescriptor const * descriptor) { - auto result = wgpuCreateInstance(reinterpret_cast(descriptor)); - return Instance::Acquire(result); - } - Bool GetInstanceFeatures(InstanceFeatures * features) { - auto result = wgpuGetInstanceFeatures(reinterpret_cast(features)); - return result; - } - Proc GetProcAddress(Device device, char const * procName) { - auto result = wgpuGetProcAddress(device.Get(), reinterpret_cast(procName)); - return reinterpret_cast(result); - } +// Function +Instance CreateInstance(InstanceDescriptor const *descriptor) { + auto result = wgpuCreateInstance( + reinterpret_cast(descriptor)); + return Instance::Acquire(result); +} +Bool GetInstanceFeatures(InstanceFeatures *features) { + auto result = wgpuGetInstanceFeatures( + reinterpret_cast(features)); + return result; } +Proc GetProcAddress(Device device, char const *procName) { + auto result = wgpuGetProcAddress(device.Get(), + reinterpret_cast(procName)); + return reinterpret_cast(result); +} + +} // namespace wgpu diff --git a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h index e3e117e0d6..4b7ca41535 100644 --- a/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h +++ b/package/android/cpp/rnskia-android/dawn/webgpu_cpp.h @@ -1,5 +1,6 @@ #ifdef __EMSCRIPTEN__ -#error "Do not include this header. Emscripten already provides headers needed for WebGPU." +#error \ + "Do not include this header. Emscripten already provides headers needed for WebGPU." #endif #ifndef WEBGPU_CPP_H_ #define WEBGPU_CPP_H_ @@ -14,2856 +15,2977 @@ namespace wgpu { - namespace detail { - constexpr size_t ConstexprMax(size_t a, size_t b) { - return a > b ? a : b; - } - } // namespace detail - - static constexpr uint32_t kArrayLayerCountUndefined = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; - static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED; - static constexpr uint32_t kDepthSliceUndefined = WGPU_DEPTH_SLICE_UNDEFINED; - static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED; - static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED; - static constexpr uint32_t kMipLevelCountUndefined = WGPU_MIP_LEVEL_COUNT_UNDEFINED; - static constexpr uint32_t kQuerySetIndexUndefined = WGPU_QUERY_SET_INDEX_UNDEFINED; - static constexpr size_t kWholeMapSize = WGPU_WHOLE_MAP_SIZE; - static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE; - - enum class WGSLFeatureName : uint32_t { - Undefined = 0x00000000, - ReadonlyAndReadwriteStorageTextures = 0x00000001, - Packed4x8IntegerDotProduct = 0x00000002, - UnrestrictedPointerParameters = 0x00000003, - PointerCompositeAccess = 0x00000004, - ChromiumTestingUnimplemented = 0x000003E8, - ChromiumTestingUnsafeExperimental = 0x000003E9, - ChromiumTestingExperimental = 0x000003EA, - ChromiumTestingShippedWithKillswitch = 0x000003EB, - ChromiumTestingShipped = 0x000003EC, - }; - - enum class AdapterType : uint32_t { - DiscreteGPU = 0x00000001, - IntegratedGPU = 0x00000002, - CPU = 0x00000003, - Unknown = 0x00000004, - }; - - enum class AddressMode : uint32_t { - Undefined = 0x00000000, - ClampToEdge = 0x00000001, - Repeat = 0x00000002, - MirrorRepeat = 0x00000003, - }; - - enum class AlphaMode : uint32_t { - Opaque = 0x00000001, - Premultiplied = 0x00000002, - Unpremultiplied = 0x00000003, - }; - - enum class BackendType : uint32_t { - Undefined = 0x00000000, - Null = 0x00000001, - WebGPU = 0x00000002, - D3D11 = 0x00000003, - D3D12 = 0x00000004, - Metal = 0x00000005, - Vulkan = 0x00000006, - OpenGL = 0x00000007, - OpenGLES = 0x00000008, - }; - - enum class BlendFactor : uint32_t { - Undefined = 0x00000000, - Zero = 0x00000001, - One = 0x00000002, - Src = 0x00000003, - OneMinusSrc = 0x00000004, - SrcAlpha = 0x00000005, - OneMinusSrcAlpha = 0x00000006, - Dst = 0x00000007, - OneMinusDst = 0x00000008, - DstAlpha = 0x00000009, - OneMinusDstAlpha = 0x0000000A, - SrcAlphaSaturated = 0x0000000B, - Constant = 0x0000000C, - OneMinusConstant = 0x0000000D, - Src1 = 0x0000000E, - OneMinusSrc1 = 0x0000000F, - Src1Alpha = 0x00000010, - OneMinusSrc1Alpha = 0x00000011, - }; - - enum class BlendOperation : uint32_t { - Undefined = 0x00000000, - Add = 0x00000001, - Subtract = 0x00000002, - ReverseSubtract = 0x00000003, - Min = 0x00000004, - Max = 0x00000005, - }; - - enum class BufferBindingType : uint32_t { - Undefined = 0x00000000, - Uniform = 0x00000001, - Storage = 0x00000002, - ReadOnlyStorage = 0x00000003, - }; - - enum class BufferMapAsyncStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - ValidationError = 0x00000002, - Unknown = 0x00000003, - DeviceLost = 0x00000004, - DestroyedBeforeCallback = 0x00000005, - UnmappedBeforeCallback = 0x00000006, - MappingAlreadyPending = 0x00000007, - OffsetOutOfRange = 0x00000008, - SizeOutOfRange = 0x00000009, - }; - - enum class BufferMapState : uint32_t { - Unmapped = 0x00000001, - Pending = 0x00000002, - Mapped = 0x00000003, - }; - - enum class CallbackMode : uint32_t { - WaitAnyOnly = 0x00000000, - AllowProcessEvents = 0x00000001, - AllowSpontaneous = 0x00000002, - }; - - enum class CompareFunction : uint32_t { - Undefined = 0x00000000, - Never = 0x00000001, - Less = 0x00000002, - Equal = 0x00000003, - LessEqual = 0x00000004, - Greater = 0x00000005, - NotEqual = 0x00000006, - GreaterEqual = 0x00000007, - Always = 0x00000008, - }; - - enum class CompilationInfoRequestStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - Error = 0x00000002, - DeviceLost = 0x00000003, - Unknown = 0x00000004, - }; - - enum class CompilationMessageType : uint32_t { - Error = 0x00000001, - Warning = 0x00000002, - Info = 0x00000003, - }; - - enum class CreatePipelineAsyncStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - ValidationError = 0x00000002, - InternalError = 0x00000003, - DeviceLost = 0x00000004, - DeviceDestroyed = 0x00000005, - Unknown = 0x00000006, - }; - - enum class CullMode : uint32_t { - Undefined = 0x00000000, - None = 0x00000001, - Front = 0x00000002, - Back = 0x00000003, - }; - - enum class DeviceLostReason : uint32_t { - Undefined = 0x00000000, - Destroyed = 0x00000001, - }; - - enum class ErrorFilter : uint32_t { - Validation = 0x00000001, - OutOfMemory = 0x00000002, - Internal = 0x00000003, - }; - - enum class ErrorType : uint32_t { - NoError = 0x00000000, - Validation = 0x00000001, - OutOfMemory = 0x00000002, - Internal = 0x00000003, - Unknown = 0x00000004, - DeviceLost = 0x00000005, - }; - - enum class ExternalTextureRotation : uint32_t { - Rotate0Degrees = 0x00000000, - Rotate90Degrees = 0x00000001, - Rotate180Degrees = 0x00000002, - Rotate270Degrees = 0x00000003, - }; - - enum class FeatureName : uint32_t { - Undefined = 0x00000000, - DepthClipControl = 0x00000001, - Depth32FloatStencil8 = 0x00000002, - TimestampQuery = 0x00000003, - TextureCompressionBC = 0x00000004, - TextureCompressionETC2 = 0x00000005, - TextureCompressionASTC = 0x00000006, - IndirectFirstInstance = 0x00000007, - ShaderF16 = 0x00000008, - RG11B10UfloatRenderable = 0x00000009, - BGRA8UnormStorage = 0x0000000A, - Float32Filterable = 0x0000000B, - DawnInternalUsages = 0x000003EA, - DawnMultiPlanarFormats = 0x000003EB, - DawnNative = 0x000003EC, - ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, - ImplicitDeviceSynchronization = 0x000003EF, - SurfaceCapabilities = 0x000003F0, - TransientAttachments = 0x000003F1, - MSAARenderToSingleSampled = 0x000003F2, - DualSourceBlending = 0x000003F3, - D3D11MultithreadProtected = 0x000003F4, - ANGLETextureSharing = 0x000003F5, - ChromiumExperimentalSubgroups = 0x000003F6, - ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, - PixelLocalStorageCoherent = 0x000003F9, - PixelLocalStorageNonCoherent = 0x000003FA, - Unorm16TextureFormats = 0x000003FB, - Snorm16TextureFormats = 0x000003FC, - MultiPlanarFormatExtendedUsages = 0x000003FD, - MultiPlanarFormatP010 = 0x000003FE, - HostMappedPointer = 0x000003FF, - MultiPlanarRenderTargets = 0x00000400, - MultiPlanarFormatNv12a = 0x00000401, - FramebufferFetch = 0x00000402, - BufferMapExtendedUsages = 0x00000403, - AdapterPropertiesMemoryHeaps = 0x00000404, - AdapterPropertiesD3D = 0x00000405, - AdapterPropertiesVk = 0x00000406, - R8UnormStorage = 0x00000407, - FormatCapabilities = 0x00000408, - DrmFormatCapabilities = 0x00000409, - Norm16TextureFormats = 0x0000040A, - SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, - SharedTextureMemoryAHardwareBuffer = 0x0000044D, - SharedTextureMemoryDmaBuf = 0x0000044E, - SharedTextureMemoryOpaqueFD = 0x0000044F, - SharedTextureMemoryZirconHandle = 0x00000450, - SharedTextureMemoryDXGISharedHandle = 0x00000451, - SharedTextureMemoryD3D11Texture2D = 0x00000452, - SharedTextureMemoryIOSurface = 0x00000453, - SharedTextureMemoryEGLImage = 0x00000454, - SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, - SharedFenceVkSemaphoreSyncFD = 0x000004B1, - SharedFenceVkSemaphoreZirconHandle = 0x000004B2, - SharedFenceDXGISharedHandle = 0x000004B3, - SharedFenceMTLSharedEvent = 0x000004B4, - SharedBufferMemoryD3D12Resource = 0x000004B5, - StaticSamplers = 0x000004B6, - }; - - enum class FilterMode : uint32_t { - Undefined = 0x00000000, - Nearest = 0x00000001, - Linear = 0x00000002, - }; - - enum class FrontFace : uint32_t { - Undefined = 0x00000000, - CCW = 0x00000001, - CW = 0x00000002, - }; - - enum class IndexFormat : uint32_t { - Undefined = 0x00000000, - Uint16 = 0x00000001, - Uint32 = 0x00000002, - }; - - enum class LoadOp : uint32_t { - Undefined = 0x00000000, - Clear = 0x00000001, - Load = 0x00000002, - }; - - enum class LoggingType : uint32_t { - Verbose = 0x00000001, - Info = 0x00000002, - Warning = 0x00000003, - Error = 0x00000004, - }; - - enum class MipmapFilterMode : uint32_t { - Undefined = 0x00000000, - Nearest = 0x00000001, - Linear = 0x00000002, - }; - - enum class PopErrorScopeStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - }; - - enum class PowerPreference : uint32_t { - Undefined = 0x00000000, - LowPower = 0x00000001, - HighPerformance = 0x00000002, - }; - - enum class PresentMode : uint32_t { - Fifo = 0x00000001, - Immediate = 0x00000003, - Mailbox = 0x00000004, - }; - - enum class PrimitiveTopology : uint32_t { - Undefined = 0x00000000, - PointList = 0x00000001, - LineList = 0x00000002, - LineStrip = 0x00000003, - TriangleList = 0x00000004, - TriangleStrip = 0x00000005, - }; - - enum class QueryType : uint32_t { - Occlusion = 0x00000001, - Timestamp = 0x00000002, - }; - - enum class QueueWorkDoneStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - Error = 0x00000002, - Unknown = 0x00000003, - DeviceLost = 0x00000004, - }; - - enum class RequestAdapterStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - Unavailable = 0x00000002, - Error = 0x00000003, - Unknown = 0x00000004, - }; - - enum class RequestDeviceStatus : uint32_t { - Success = 0x00000000, - InstanceDropped = 0x00000001, - Error = 0x00000002, - Unknown = 0x00000003, - }; - - enum class SType : uint32_t { - Invalid = 0x00000000, - SurfaceDescriptorFromMetalLayer = 0x00000001, - SurfaceDescriptorFromWindowsHWND = 0x00000002, - SurfaceDescriptorFromXlibWindow = 0x00000003, - SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, - ShaderModuleSPIRVDescriptor = 0x00000005, - ShaderModuleWGSLDescriptor = 0x00000006, - PrimitiveDepthClipControl = 0x00000007, - SurfaceDescriptorFromWaylandSurface = 0x00000008, - SurfaceDescriptorFromAndroidNativeWindow = 0x00000009, - SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, - ExternalTextureBindingEntry = 0x0000000C, - ExternalTextureBindingLayout = 0x0000000D, - SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, - RenderPassDescriptorMaxDrawCount = 0x0000000F, - DepthStencilStateDepthWriteDefinedDawn = 0x00000010, - TextureBindingViewDimensionDescriptor = 0x00000011, - DawnTextureInternalUsageDescriptor = 0x000003E8, - DawnEncoderInternalUsageDescriptor = 0x000003EB, - DawnInstanceDescriptor = 0x000003EC, - DawnCacheDeviceDescriptor = 0x000003ED, - DawnAdapterPropertiesPowerPreference = 0x000003EE, - DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, - DawnTogglesDescriptor = 0x000003F0, - DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, - RequestAdapterOptionsLUID = 0x000003F2, - RequestAdapterOptionsGetGLProc = 0x000003F3, - RequestAdapterOptionsD3D11Device = 0x000003F4, - DawnMultisampleStateRenderToSingleSampled = 0x000003F5, - DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, - RenderPassPixelLocalStorage = 0x000003F7, - PipelineLayoutPixelLocalStorage = 0x000003F8, - BufferHostMappedPointer = 0x000003F9, - DawnExperimentalSubgroupLimits = 0x000003FA, - AdapterPropertiesMemoryHeaps = 0x000003FB, - AdapterPropertiesD3D = 0x000003FC, - AdapterPropertiesVk = 0x000003FD, - DawnComputePipelineFullSubgroups = 0x000003FE, - DawnWireWGSLControl = 0x000003FF, - DawnWGSLBlocklist = 0x00000400, - DrmFormatCapabilities = 0x00000401, - SharedTextureMemoryVkImageDescriptor = 0x0000044C, - SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, - SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, - SharedTextureMemoryDmaBufDescriptor = 0x0000044F, - SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, - SharedTextureMemoryZirconHandleDescriptor = 0x00000451, - SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, - SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, - SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, - SharedTextureMemoryEGLImageDescriptor = 0x00000455, - SharedTextureMemoryInitializedBeginState = 0x000004B0, - SharedTextureMemoryInitializedEndState = 0x000004B1, - SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, - SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, - SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, - SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, - SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, - SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, - SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, - SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, - SharedFenceDXGISharedHandleDescriptor = 0x000004BA, - SharedFenceDXGISharedHandleExportInfo = 0x000004BB, - SharedFenceMTLSharedEventDescriptor = 0x000004BC, - SharedFenceMTLSharedEventExportInfo = 0x000004BD, - SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, - StaticSamplerBindingLayout = 0x000004BF, - }; - - enum class SamplerBindingType : uint32_t { - Undefined = 0x00000000, - Filtering = 0x00000001, - NonFiltering = 0x00000002, - Comparison = 0x00000003, - }; - - enum class SharedFenceType : uint32_t { - Undefined = 0x00000000, - VkSemaphoreOpaqueFD = 0x00000001, - VkSemaphoreSyncFD = 0x00000002, - VkSemaphoreZirconHandle = 0x00000003, - DXGISharedHandle = 0x00000004, - MTLSharedEvent = 0x00000005, - }; - - enum class StencilOperation : uint32_t { - Undefined = 0x00000000, - Keep = 0x00000001, - Zero = 0x00000002, - Replace = 0x00000003, - Invert = 0x00000004, - IncrementClamp = 0x00000005, - DecrementClamp = 0x00000006, - IncrementWrap = 0x00000007, - DecrementWrap = 0x00000008, - }; - - enum class StorageTextureAccess : uint32_t { - Undefined = 0x00000000, - WriteOnly = 0x00000001, - ReadOnly = 0x00000002, - ReadWrite = 0x00000003, - }; - - enum class StoreOp : uint32_t { - Undefined = 0x00000000, - Store = 0x00000001, - Discard = 0x00000002, - }; - - enum class TextureAspect : uint32_t { - Undefined = 0x00000000, - All = 0x00000001, - StencilOnly = 0x00000002, - DepthOnly = 0x00000003, - Plane0Only = 0x00000004, - Plane1Only = 0x00000005, - Plane2Only = 0x00000006, - }; - - enum class TextureDimension : uint32_t { - Undefined = 0x00000000, - e1D = 0x00000001, - e2D = 0x00000002, - e3D = 0x00000003, - }; - - enum class TextureFormat : uint32_t { - Undefined = 0x00000000, - R8Unorm = 0x00000001, - R8Snorm = 0x00000002, - R8Uint = 0x00000003, - R8Sint = 0x00000004, - R16Uint = 0x00000005, - R16Sint = 0x00000006, - R16Float = 0x00000007, - RG8Unorm = 0x00000008, - RG8Snorm = 0x00000009, - RG8Uint = 0x0000000A, - RG8Sint = 0x0000000B, - R32Float = 0x0000000C, - R32Uint = 0x0000000D, - R32Sint = 0x0000000E, - RG16Uint = 0x0000000F, - RG16Sint = 0x00000010, - RG16Float = 0x00000011, - RGBA8Unorm = 0x00000012, - RGBA8UnormSrgb = 0x00000013, - RGBA8Snorm = 0x00000014, - RGBA8Uint = 0x00000015, - RGBA8Sint = 0x00000016, - BGRA8Unorm = 0x00000017, - BGRA8UnormSrgb = 0x00000018, - RGB10A2Uint = 0x00000019, - RGB10A2Unorm = 0x0000001A, - RG11B10Ufloat = 0x0000001B, - RGB9E5Ufloat = 0x0000001C, - RG32Float = 0x0000001D, - RG32Uint = 0x0000001E, - RG32Sint = 0x0000001F, - RGBA16Uint = 0x00000020, - RGBA16Sint = 0x00000021, - RGBA16Float = 0x00000022, - RGBA32Float = 0x00000023, - RGBA32Uint = 0x00000024, - RGBA32Sint = 0x00000025, - Stencil8 = 0x00000026, - Depth16Unorm = 0x00000027, - Depth24Plus = 0x00000028, - Depth24PlusStencil8 = 0x00000029, - Depth32Float = 0x0000002A, - Depth32FloatStencil8 = 0x0000002B, - BC1RGBAUnorm = 0x0000002C, - BC1RGBAUnormSrgb = 0x0000002D, - BC2RGBAUnorm = 0x0000002E, - BC2RGBAUnormSrgb = 0x0000002F, - BC3RGBAUnorm = 0x00000030, - BC3RGBAUnormSrgb = 0x00000031, - BC4RUnorm = 0x00000032, - BC4RSnorm = 0x00000033, - BC5RGUnorm = 0x00000034, - BC5RGSnorm = 0x00000035, - BC6HRGBUfloat = 0x00000036, - BC6HRGBFloat = 0x00000037, - BC7RGBAUnorm = 0x00000038, - BC7RGBAUnormSrgb = 0x00000039, - ETC2RGB8Unorm = 0x0000003A, - ETC2RGB8UnormSrgb = 0x0000003B, - ETC2RGB8A1Unorm = 0x0000003C, - ETC2RGB8A1UnormSrgb = 0x0000003D, - ETC2RGBA8Unorm = 0x0000003E, - ETC2RGBA8UnormSrgb = 0x0000003F, - EACR11Unorm = 0x00000040, - EACR11Snorm = 0x00000041, - EACRG11Unorm = 0x00000042, - EACRG11Snorm = 0x00000043, - ASTC4x4Unorm = 0x00000044, - ASTC4x4UnormSrgb = 0x00000045, - ASTC5x4Unorm = 0x00000046, - ASTC5x4UnormSrgb = 0x00000047, - ASTC5x5Unorm = 0x00000048, - ASTC5x5UnormSrgb = 0x00000049, - ASTC6x5Unorm = 0x0000004A, - ASTC6x5UnormSrgb = 0x0000004B, - ASTC6x6Unorm = 0x0000004C, - ASTC6x6UnormSrgb = 0x0000004D, - ASTC8x5Unorm = 0x0000004E, - ASTC8x5UnormSrgb = 0x0000004F, - ASTC8x6Unorm = 0x00000050, - ASTC8x6UnormSrgb = 0x00000051, - ASTC8x8Unorm = 0x00000052, - ASTC8x8UnormSrgb = 0x00000053, - ASTC10x5Unorm = 0x00000054, - ASTC10x5UnormSrgb = 0x00000055, - ASTC10x6Unorm = 0x00000056, - ASTC10x6UnormSrgb = 0x00000057, - ASTC10x8Unorm = 0x00000058, - ASTC10x8UnormSrgb = 0x00000059, - ASTC10x10Unorm = 0x0000005A, - ASTC10x10UnormSrgb = 0x0000005B, - ASTC12x10Unorm = 0x0000005C, - ASTC12x10UnormSrgb = 0x0000005D, - ASTC12x12Unorm = 0x0000005E, - ASTC12x12UnormSrgb = 0x0000005F, - R16Unorm = 0x00000060, - RG16Unorm = 0x00000061, - RGBA16Unorm = 0x00000062, - R16Snorm = 0x00000063, - RG16Snorm = 0x00000064, - RGBA16Snorm = 0x00000065, - R8BG8Biplanar420Unorm = 0x00000066, - R10X6BG10X6Biplanar420Unorm = 0x00000067, - R8BG8A8Triplanar420Unorm = 0x00000068, - }; - - enum class TextureSampleType : uint32_t { - Undefined = 0x00000000, - Float = 0x00000001, - UnfilterableFloat = 0x00000002, - Depth = 0x00000003, - Sint = 0x00000004, - Uint = 0x00000005, - }; - - enum class TextureViewDimension : uint32_t { - Undefined = 0x00000000, - e1D = 0x00000001, - e2D = 0x00000002, - e2DArray = 0x00000003, - Cube = 0x00000004, - CubeArray = 0x00000005, - e3D = 0x00000006, - }; - - enum class VertexFormat : uint32_t { - Undefined = 0x00000000, - Uint8x2 = 0x00000001, - Uint8x4 = 0x00000002, - Sint8x2 = 0x00000003, - Sint8x4 = 0x00000004, - Unorm8x2 = 0x00000005, - Unorm8x4 = 0x00000006, - Snorm8x2 = 0x00000007, - Snorm8x4 = 0x00000008, - Uint16x2 = 0x00000009, - Uint16x4 = 0x0000000A, - Sint16x2 = 0x0000000B, - Sint16x4 = 0x0000000C, - Unorm16x2 = 0x0000000D, - Unorm16x4 = 0x0000000E, - Snorm16x2 = 0x0000000F, - Snorm16x4 = 0x00000010, - Float16x2 = 0x00000011, - Float16x4 = 0x00000012, - Float32 = 0x00000013, - Float32x2 = 0x00000014, - Float32x3 = 0x00000015, - Float32x4 = 0x00000016, - Uint32 = 0x00000017, - Uint32x2 = 0x00000018, - Uint32x3 = 0x00000019, - Uint32x4 = 0x0000001A, - Sint32 = 0x0000001B, - Sint32x2 = 0x0000001C, - Sint32x3 = 0x0000001D, - Sint32x4 = 0x0000001E, - Unorm10_10_10_2 = 0x0000001F, - }; - - enum class VertexStepMode : uint32_t { - Undefined = 0x00000000, - VertexBufferNotUsed = 0x00000001, - Vertex = 0x00000002, - Instance = 0x00000003, - }; - - enum class WaitStatus : uint32_t { - Success = 0x00000000, - TimedOut = 0x00000001, - UnsupportedTimeout = 0x00000002, - UnsupportedCount = 0x00000003, - UnsupportedMixedSources = 0x00000004, - Unknown = 0x00000005, - }; - - - enum class BufferUsage : uint32_t { - None = 0x00000000, - MapRead = 0x00000001, - MapWrite = 0x00000002, - CopySrc = 0x00000004, - CopyDst = 0x00000008, - Index = 0x00000010, - Vertex = 0x00000020, - Uniform = 0x00000040, - Storage = 0x00000080, - Indirect = 0x00000100, - QueryResolve = 0x00000200, - }; - - enum class ColorWriteMask : uint32_t { - None = 0x00000000, - Red = 0x00000001, - Green = 0x00000002, - Blue = 0x00000004, - Alpha = 0x00000008, - All = 0x0000000F, - }; - - enum class HeapProperty : uint32_t { - Undefined = 0x00000000, - DeviceLocal = 0x00000001, - HostVisible = 0x00000002, - HostCoherent = 0x00000004, - HostUncached = 0x00000008, - HostCached = 0x00000010, - }; - - enum class MapMode : uint32_t { - None = 0x00000000, - Read = 0x00000001, - Write = 0x00000002, - }; - - enum class ShaderStage : uint32_t { - None = 0x00000000, - Vertex = 0x00000001, - Fragment = 0x00000002, - Compute = 0x00000004, - }; - - enum class TextureUsage : uint32_t { - None = 0x00000000, - CopySrc = 0x00000001, - CopyDst = 0x00000002, - TextureBinding = 0x00000004, - StorageBinding = 0x00000008, - RenderAttachment = 0x00000010, - TransientAttachment = 0x00000020, - StorageAttachment = 0x00000040, - }; - - - using BufferMapCallback = WGPUBufferMapCallback; - using Callback = WGPUCallback; - using CompilationInfoCallback = WGPUCompilationInfoCallback; - using CreateComputePipelineAsyncCallback = WGPUCreateComputePipelineAsyncCallback; - using CreateRenderPipelineAsyncCallback = WGPUCreateRenderPipelineAsyncCallback; - using DawnLoadCacheDataFunction = WGPUDawnLoadCacheDataFunction; - using DawnStoreCacheDataFunction = WGPUDawnStoreCacheDataFunction; - using DeviceLostCallback = WGPUDeviceLostCallback; - using ErrorCallback = WGPUErrorCallback; - using LoggingCallback = WGPULoggingCallback; - using PopErrorScopeCallback = WGPUPopErrorScopeCallback; - using Proc = WGPUProc; - using QueueWorkDoneCallback = WGPUQueueWorkDoneCallback; - using RequestAdapterCallback = WGPURequestAdapterCallback; - using RequestDeviceCallback = WGPURequestDeviceCallback; - - class Adapter; - class BindGroup; - class BindGroupLayout; - class Buffer; - class CommandBuffer; - class CommandEncoder; - class ComputePassEncoder; - class ComputePipeline; - class Device; - class ExternalTexture; - class Instance; - class PipelineLayout; - class QuerySet; - class Queue; - class RenderBundle; - class RenderBundleEncoder; - class RenderPassEncoder; - class RenderPipeline; - class Sampler; - class ShaderModule; - class SharedBufferMemory; - class SharedFence; - class SharedTextureMemory; - class Surface; - class SwapChain; - class Texture; - class TextureView; - - struct AdapterProperties; - struct AdapterPropertiesD3D; - struct AdapterPropertiesVk; - struct BindGroupEntry; - struct BlendComponent; - struct BufferBindingLayout; - struct BufferDescriptor; - struct BufferHostMappedPointer; - struct BufferMapCallbackInfo; - struct Color; - struct CommandBufferDescriptor; - struct CommandEncoderDescriptor; - struct CompilationInfoCallbackInfo; - struct CompilationMessage; - struct ComputePassTimestampWrites; - struct ConstantEntry; - struct CopyTextureForBrowserOptions; - struct CreateComputePipelineAsyncCallbackInfo; - struct CreateRenderPipelineAsyncCallbackInfo; - struct DawnWGSLBlocklist; - struct DawnAdapterPropertiesPowerPreference; - struct DawnBufferDescriptorErrorInfoFromWireClient; - struct DawnCacheDeviceDescriptor; - struct DawnComputePipelineFullSubgroups; - struct DawnEncoderInternalUsageDescriptor; - struct DawnExperimentalSubgroupLimits; - struct DawnMultisampleStateRenderToSingleSampled; - struct DawnRenderPassColorAttachmentRenderToSingleSampled; - struct DawnShaderModuleSPIRVOptionsDescriptor; - struct DawnTextureInternalUsageDescriptor; - struct DawnTogglesDescriptor; - struct DawnWireWGSLControl; - struct DepthStencilStateDepthWriteDefinedDawn; - struct DrmFormatProperties; - struct Extent2D; - struct Extent3D; - struct ExternalTextureBindingEntry; - struct ExternalTextureBindingLayout; - struct FormatCapabilities; - struct Future; - struct InstanceFeatures; - struct Limits; - struct MemoryHeapInfo; - struct MultisampleState; - struct Origin2D; - struct Origin3D; - struct PipelineLayoutDescriptor; - struct PipelineLayoutStorageAttachment; - struct PopErrorScopeCallbackInfo; - struct PrimitiveDepthClipControl; - struct PrimitiveState; - struct QuerySetDescriptor; - struct QueueDescriptor; - struct QueueWorkDoneCallbackInfo; - struct RenderBundleDescriptor; - struct RenderBundleEncoderDescriptor; - struct RenderPassDepthStencilAttachment; - struct RenderPassDescriptorMaxDrawCount; - struct RenderPassTimestampWrites; - struct RequestAdapterCallbackInfo; - struct RequestAdapterOptions; - struct RequestDeviceCallbackInfo; - struct SamplerBindingLayout; - struct SamplerDescriptor; - struct ShaderModuleSPIRVDescriptor; - struct ShaderModuleWGSLDescriptor; - struct ShaderModuleDescriptor; - struct SharedBufferMemoryBeginAccessDescriptor; - struct SharedBufferMemoryDescriptor; - struct SharedBufferMemoryEndAccessState; - struct SharedBufferMemoryProperties; - struct SharedFenceDXGISharedHandleDescriptor; - struct SharedFenceDXGISharedHandleExportInfo; - struct SharedFenceMTLSharedEventDescriptor; - struct SharedFenceMTLSharedEventExportInfo; - struct SharedFenceDescriptor; - struct SharedFenceExportInfo; - struct SharedFenceVkSemaphoreOpaqueFDDescriptor; - struct SharedFenceVkSemaphoreOpaqueFDExportInfo; - struct SharedFenceVkSemaphoreSyncFDDescriptor; - struct SharedFenceVkSemaphoreSyncFDExportInfo; - struct SharedFenceVkSemaphoreZirconHandleDescriptor; - struct SharedFenceVkSemaphoreZirconHandleExportInfo; - struct SharedTextureMemoryDXGISharedHandleDescriptor; - struct SharedTextureMemoryEGLImageDescriptor; - struct SharedTextureMemoryIOSurfaceDescriptor; - struct SharedTextureMemoryAHardwareBufferDescriptor; - struct SharedTextureMemoryBeginAccessDescriptor; - struct SharedTextureMemoryDescriptor; - struct SharedTextureMemoryDmaBufPlane; - struct SharedTextureMemoryEndAccessState; - struct SharedTextureMemoryOpaqueFDDescriptor; - struct SharedTextureMemoryVkDedicatedAllocationDescriptor; - struct SharedTextureMemoryVkImageLayoutBeginState; - struct SharedTextureMemoryVkImageLayoutEndState; - struct SharedTextureMemoryZirconHandleDescriptor; - struct StaticSamplerBindingLayout; - struct StencilFaceState; - struct StorageTextureBindingLayout; - struct SurfaceDescriptor; - struct SurfaceDescriptorFromAndroidNativeWindow; - struct SurfaceDescriptorFromCanvasHTMLSelector; - struct SurfaceDescriptorFromMetalLayer; - struct SurfaceDescriptorFromWaylandSurface; - struct SurfaceDescriptorFromWindowsHWND; - struct SurfaceDescriptorFromWindowsCoreWindow; - struct SurfaceDescriptorFromWindowsSwapChainPanel; - struct SurfaceDescriptorFromXlibWindow; - struct SwapChainDescriptor; - struct TextureBindingLayout; - struct TextureBindingViewDimensionDescriptor; - struct TextureDataLayout; - struct TextureViewDescriptor; - struct VertexAttribute; - struct AdapterPropertiesMemoryHeaps; - struct BindGroupDescriptor; - struct BindGroupLayoutEntry; - struct BlendState; - struct CompilationInfo; - struct ComputePassDescriptor; - struct DepthStencilState; - struct DrmFormatCapabilities; - struct ExternalTextureDescriptor; - struct FutureWaitInfo; - struct ImageCopyBuffer; - struct ImageCopyExternalTexture; - struct ImageCopyTexture; - struct InstanceDescriptor; - struct PipelineLayoutPixelLocalStorage; - struct ProgrammableStageDescriptor; - struct RenderPassColorAttachment; - struct RenderPassStorageAttachment; - struct RequiredLimits; - struct SharedTextureMemoryDmaBufDescriptor; - struct SharedTextureMemoryProperties; - struct SharedTextureMemoryVkImageDescriptor; - struct SupportedLimits; - struct TextureDescriptor; - struct VertexBufferLayout; - struct BindGroupLayoutDescriptor; - struct ColorTargetState; - struct ComputePipelineDescriptor; - struct DeviceDescriptor; - struct RenderPassDescriptor; - struct RenderPassPixelLocalStorage; - struct VertexState; - struct FragmentState; - struct RenderPipelineDescriptor; - - - // Special class for booleans in order to allow implicit conversions. - class Bool { - public: - constexpr Bool() = default; - // NOLINTNEXTLINE(runtime/explicit) allow implicit construction - constexpr Bool(bool value) : mValue(static_cast(value)) {} - // NOLINTNEXTLINE(runtime/explicit) allow implicit construction - Bool(WGPUBool value): mValue(value) {} - - constexpr operator bool() const { return static_cast(mValue); } - - private: - friend struct std::hash; - // Default to false. - WGPUBool mValue = static_cast(false); - }; - - template - class ObjectBase { - public: - ObjectBase() = default; - ObjectBase(CType handle): mHandle(handle) { - if (mHandle) Derived::WGPUReference(mHandle); - } - ~ObjectBase() { - if (mHandle) Derived::WGPURelease(mHandle); - } - - ObjectBase(ObjectBase const& other) - : ObjectBase(other.Get()) { - } - Derived& operator=(ObjectBase const& other) { - if (&other != this) { - if (mHandle) Derived::WGPURelease(mHandle); - mHandle = other.mHandle; - if (mHandle) Derived::WGPUReference(mHandle); - } - - return static_cast(*this); - } - - ObjectBase(ObjectBase&& other) { - mHandle = other.mHandle; - other.mHandle = 0; - } - Derived& operator=(ObjectBase&& other) { - if (&other != this) { - if (mHandle) Derived::WGPURelease(mHandle); - mHandle = other.mHandle; - other.mHandle = 0; - } - - return static_cast(*this); - } - - ObjectBase(std::nullptr_t) {} - Derived& operator=(std::nullptr_t) { - if (mHandle != nullptr) { - Derived::WGPURelease(mHandle); - mHandle = nullptr; - } - return static_cast(*this); - } - - bool operator==(std::nullptr_t) const { - return mHandle == nullptr; - } - bool operator!=(std::nullptr_t) const { - return mHandle != nullptr; - } - - explicit operator bool() const { - return mHandle != nullptr; - } - CType Get() const { - return mHandle; - } - CType MoveToCHandle() { - CType result = mHandle; - mHandle = 0; - return result; - } - static Derived Acquire(CType handle) { - Derived result; - result.mHandle = handle; - return result; - } - - protected: - CType mHandle = nullptr; - }; - - - - class Adapter : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Device CreateDevice(DeviceDescriptor const * descriptor = nullptr) const; - size_t EnumerateFeatures(FeatureName * features) const; - Bool GetFormatCapabilities(TextureFormat format, FormatCapabilities * capabilities) const; - Instance GetInstance() const; - Bool GetLimits(SupportedLimits * limits) const; - void GetProperties(AdapterProperties * properties) const; - Bool HasFeature(FeatureName feature) const; - void RequestDevice(DeviceDescriptor const * descriptor, RequestDeviceCallback callback, void * userdata) const; - Future RequestDevice(DeviceDescriptor const * options, RequestDeviceCallbackInfo callbackInfo) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUAdapter handle); - static void WGPURelease(WGPUAdapter handle); - }; - - class BindGroup : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUBindGroup handle); - static void WGPURelease(WGPUBindGroup handle); - }; - - class BindGroupLayout : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUBindGroupLayout handle); - static void WGPURelease(WGPUBindGroupLayout handle); - }; - - class Buffer : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Destroy() const; - void const * GetConstMappedRange(size_t offset = 0, size_t size = WGPU_WHOLE_MAP_SIZE) const; - BufferMapState GetMapState() const; - void * GetMappedRange(size_t offset = 0, size_t size = WGPU_WHOLE_MAP_SIZE) const; - uint64_t GetSize() const; - BufferUsage GetUsage() const; - void MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallback callback, void * userdata) const; - Future MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallbackInfo callbackInfo) const; - void SetLabel(char const * label) const; - void Unmap() const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUBuffer handle); - static void WGPURelease(WGPUBuffer handle); - }; - - class CommandBuffer : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUCommandBuffer handle); - static void WGPURelease(WGPUCommandBuffer handle); - }; - - class CommandEncoder : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - ComputePassEncoder BeginComputePass(ComputePassDescriptor const * descriptor = nullptr) const; - RenderPassEncoder BeginRenderPass(RenderPassDescriptor const * descriptor) const; - void ClearBuffer(Buffer const& buffer, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; - void CopyBufferToBuffer(Buffer const& source, uint64_t sourceOffset, Buffer const& destination, uint64_t destinationOffset, uint64_t size) const; - void CopyBufferToTexture(ImageCopyBuffer const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const; - void CopyTextureToBuffer(ImageCopyTexture const * source, ImageCopyBuffer const * destination, Extent3D const * copySize) const; - void CopyTextureToTexture(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize) const; - CommandBuffer Finish(CommandBufferDescriptor const * descriptor = nullptr) const; - void InjectValidationError(char const * message) const; - void InsertDebugMarker(char const * markerLabel) const; - void PopDebugGroup() const; - void PushDebugGroup(char const * groupLabel) const; - void ResolveQuerySet(QuerySet const& querySet, uint32_t firstQuery, uint32_t queryCount, Buffer const& destination, uint64_t destinationOffset) const; - void SetLabel(char const * label) const; - void WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) const; - void WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUCommandEncoder handle); - static void WGPURelease(WGPUCommandEncoder handle); - }; - - class ComputePassEncoder : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void DispatchWorkgroups(uint32_t workgroupCountX, uint32_t workgroupCountY = 1, uint32_t workgroupCountZ = 1) const; - void DispatchWorkgroupsIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; - void End() const; - void InsertDebugMarker(char const * markerLabel) const; - void PopDebugGroup() const; - void PushDebugGroup(char const * groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) const; - void SetLabel(char const * label) const; - void SetPipeline(ComputePipeline const& pipeline) const; - void WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUComputePassEncoder handle); - static void WGPURelease(WGPUComputePassEncoder handle); - }; - - class ComputePipeline : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUComputePipeline handle); - static void WGPURelease(WGPUComputePipeline handle); - }; - - class Device : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - BindGroup CreateBindGroup(BindGroupDescriptor const * descriptor) const; - BindGroupLayout CreateBindGroupLayout(BindGroupLayoutDescriptor const * descriptor) const; - Buffer CreateBuffer(BufferDescriptor const * descriptor) const; - CommandEncoder CreateCommandEncoder(CommandEncoderDescriptor const * descriptor = nullptr) const; - ComputePipeline CreateComputePipeline(ComputePipelineDescriptor const * descriptor) const; - void CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallback callback, void * userdata) const; - Future CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallbackInfo callbackInfo) const; - Buffer CreateErrorBuffer(BufferDescriptor const * descriptor) const; - ExternalTexture CreateErrorExternalTexture() const; - ShaderModule CreateErrorShaderModule(ShaderModuleDescriptor const * descriptor, char const * errorMessage) const; - Texture CreateErrorTexture(TextureDescriptor const * descriptor) const; - ExternalTexture CreateExternalTexture(ExternalTextureDescriptor const * externalTextureDescriptor) const; - PipelineLayout CreatePipelineLayout(PipelineLayoutDescriptor const * descriptor) const; - QuerySet CreateQuerySet(QuerySetDescriptor const * descriptor) const; - RenderBundleEncoder CreateRenderBundleEncoder(RenderBundleEncoderDescriptor const * descriptor) const; - RenderPipeline CreateRenderPipeline(RenderPipelineDescriptor const * descriptor) const; - void CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallback callback, void * userdata) const; - Future CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallbackInfo callbackInfo) const; - Sampler CreateSampler(SamplerDescriptor const * descriptor = nullptr) const; - ShaderModule CreateShaderModule(ShaderModuleDescriptor const * descriptor) const; - SwapChain CreateSwapChain(Surface const& surface, SwapChainDescriptor const * descriptor) const; - Texture CreateTexture(TextureDescriptor const * descriptor) const; - void Destroy() const; - size_t EnumerateFeatures(FeatureName * features) const; - void ForceLoss(DeviceLostReason type, char const * message) const; - Adapter GetAdapter() const; - Bool GetLimits(SupportedLimits * limits) const; - Queue GetQueue() const; - TextureUsage GetSupportedSurfaceUsage(Surface const& surface) const; - Bool HasFeature(FeatureName feature) const; - SharedBufferMemory ImportSharedBufferMemory(SharedBufferMemoryDescriptor const * descriptor) const; - SharedFence ImportSharedFence(SharedFenceDescriptor const * descriptor) const; - SharedTextureMemory ImportSharedTextureMemory(SharedTextureMemoryDescriptor const * descriptor) const; - void InjectError(ErrorType type, char const * message) const; - void PopErrorScope(ErrorCallback oldCallback, void * userdata) const; - Future PopErrorScope(PopErrorScopeCallbackInfo callbackInfo) const; - void PushErrorScope(ErrorFilter filter) const; - void SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const; - void SetLabel(char const * label) const; - void SetLoggingCallback(LoggingCallback callback, void * userdata) const; - void SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const; - void Tick() const; - void ValidateTextureDescriptor(TextureDescriptor const * descriptor) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUDevice handle); - static void WGPURelease(WGPUDevice handle); - }; - - class ExternalTexture : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Destroy() const; - void Expire() const; - void Refresh() const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUExternalTexture handle); - static void WGPURelease(WGPUExternalTexture handle); - }; - - class Instance : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Surface CreateSurface(SurfaceDescriptor const * descriptor) const; - size_t EnumerateWGSLLanguageFeatures(WGSLFeatureName * features) const; - Bool HasWGSLLanguageFeature(WGSLFeatureName feature) const; - void ProcessEvents() const; - void RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallback callback, void * userdata) const; - Future RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallbackInfo callbackInfo) const; - WaitStatus WaitAny(size_t futureCount, FutureWaitInfo * futures, uint64_t timeoutNS) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUInstance handle); - static void WGPURelease(WGPUInstance handle); - }; - - class PipelineLayout : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUPipelineLayout handle); - static void WGPURelease(WGPUPipelineLayout handle); - }; - - class QuerySet : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Destroy() const; - uint32_t GetCount() const; - QueryType GetType() const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUQuerySet handle); - static void WGPURelease(WGPUQuerySet handle); - }; - - class Queue : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void CopyExternalTextureForBrowser(ImageCopyExternalTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const; - void CopyTextureForBrowser(ImageCopyTexture const * source, ImageCopyTexture const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const; - void OnSubmittedWorkDone(QueueWorkDoneCallback callback, void * userdata) const; - Future OnSubmittedWorkDone(QueueWorkDoneCallbackInfo callbackInfo) const; - void SetLabel(char const * label) const; - void Submit(size_t commandCount, CommandBuffer const * commands) const; - void WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, void const * data, size_t size) const; - void WriteTexture(ImageCopyTexture const * destination, void const * data, size_t dataSize, TextureDataLayout const * dataLayout, Extent3D const * writeSize) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUQueue handle); - static void WGPURelease(WGPUQueue handle); - }; - - class RenderBundle : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPURenderBundle handle); - static void WGPURelease(WGPURenderBundle handle); - }; - - class RenderBundleEncoder : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; - void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t firstIndex = 0, int32_t baseVertex = 0, uint32_t firstInstance = 0) const; - void DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; - void DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; - RenderBundle Finish(RenderBundleDescriptor const * descriptor = nullptr) const; - void InsertDebugMarker(char const * markerLabel) const; - void PopDebugGroup() const; - void PushDebugGroup(char const * groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) const; - void SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; - void SetLabel(char const * label) const; - void SetPipeline(RenderPipeline const& pipeline) const; - void SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPURenderBundleEncoder handle); - static void WGPURelease(WGPURenderBundleEncoder handle); - }; - - class RenderPassEncoder : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void BeginOcclusionQuery(uint32_t queryIndex) const; - void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; - void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t firstIndex = 0, int32_t baseVertex = 0, uint32_t firstInstance = 0) const; - void DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; - void DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const; - void End() const; - void EndOcclusionQuery() const; - void ExecuteBundles(size_t bundleCount, RenderBundle const * bundles) const; - void InsertDebugMarker(char const * markerLabel) const; - void PixelLocalStorageBarrier() const; - void PopDebugGroup() const; - void PushDebugGroup(char const * groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const& group, size_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) const; - void SetBlendConstant(Color const * color) const; - void SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; - void SetLabel(char const * label) const; - void SetPipeline(RenderPipeline const& pipeline) const; - void SetScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height) const; - void SetStencilReference(uint32_t reference) const; - void SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset = 0, uint64_t size = WGPU_WHOLE_SIZE) const; - void SetViewport(float x, float y, float width, float height, float minDepth, float maxDepth) const; - void WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPURenderPassEncoder handle); - static void WGPURelease(WGPURenderPassEncoder handle); - }; - - class RenderPipeline : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPURenderPipeline handle); - static void WGPURelease(WGPURenderPipeline handle); - }; - - class Sampler : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUSampler handle); - static void WGPURelease(WGPUSampler handle); - }; - - class ShaderModule : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void GetCompilationInfo(CompilationInfoCallback callback, void * userdata) const; - Future GetCompilationInfo(CompilationInfoCallbackInfo callbackInfo) const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUShaderModule handle); - static void WGPURelease(WGPUShaderModule handle); - }; - - class SharedBufferMemory : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Bool BeginAccess(Buffer const& buffer, SharedBufferMemoryBeginAccessDescriptor const * descriptor) const; - Buffer CreateBuffer(BufferDescriptor const * descriptor = nullptr) const; - Bool EndAccess(Buffer const& buffer, SharedBufferMemoryEndAccessState * descriptor) const; - void GetProperties(SharedBufferMemoryProperties * properties) const; - Bool IsDeviceLost() const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUSharedBufferMemory handle); - static void WGPURelease(WGPUSharedBufferMemory handle); - }; - - class SharedFence : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void ExportInfo(SharedFenceExportInfo * info) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUSharedFence handle); - static void WGPURelease(WGPUSharedFence handle); - }; - - class SharedTextureMemory : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Bool BeginAccess(Texture const& texture, SharedTextureMemoryBeginAccessDescriptor const * descriptor) const; - Texture CreateTexture(TextureDescriptor const * descriptor = nullptr) const; - Bool EndAccess(Texture const& texture, SharedTextureMemoryEndAccessState * descriptor) const; - void GetProperties(SharedTextureMemoryProperties * properties) const; - Bool IsDeviceLost() const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUSharedTextureMemory handle); - static void WGPURelease(WGPUSharedTextureMemory handle); - }; - - class Surface : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - TextureFormat GetPreferredFormat(Adapter const& adapter) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUSurface handle); - static void WGPURelease(WGPUSurface handle); - }; - - class SwapChain : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Texture GetCurrentTexture() const; - TextureView GetCurrentTextureView() const; - void Present() const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUSwapChain handle); - static void WGPURelease(WGPUSwapChain handle); - }; - - class Texture : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - TextureView CreateErrorView(TextureViewDescriptor const * descriptor = nullptr) const; - TextureView CreateView(TextureViewDescriptor const * descriptor = nullptr) const; - void Destroy() const; - uint32_t GetDepthOrArrayLayers() const; - TextureDimension GetDimension() const; - TextureFormat GetFormat() const; - uint32_t GetHeight() const; - uint32_t GetMipLevelCount() const; - uint32_t GetSampleCount() const; - TextureUsage GetUsage() const; - uint32_t GetWidth() const; - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUTexture handle); - static void WGPURelease(WGPUTexture handle); - }; - - class TextureView : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void SetLabel(char const * label) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUTextureView handle); - static void WGPURelease(WGPUTextureView handle); - }; - - - Instance CreateInstance(InstanceDescriptor const * descriptor = nullptr); - Bool GetInstanceFeatures(InstanceFeatures * features); - Proc GetProcAddress(Device device, char const * procName); - - struct AdapterProperties { - AdapterProperties() = default; - ~AdapterProperties(); - AdapterProperties(const AdapterProperties&) = delete; - AdapterProperties& operator=(const AdapterProperties&) = delete; - AdapterProperties(AdapterProperties&&); - AdapterProperties& operator=(AdapterProperties&&); - ChainedStructOut * nextInChain = nullptr; - uint32_t const vendorID = {}; - char const * const vendorName = nullptr; - char const * const architecture = nullptr; - uint32_t const deviceID = {}; - char const * const name = nullptr; - char const * const driverDescription = nullptr; - AdapterType const adapterType = {}; - BackendType const backendType = {}; - Bool const compatibilityMode = false; - }; - - // Can be chained in AdapterProperties - struct AdapterPropertiesD3D : ChainedStructOut { - AdapterPropertiesD3D() { - sType = SType::AdapterPropertiesD3D; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t shaderModel; - }; - - // Can be chained in AdapterProperties - struct AdapterPropertiesVk : ChainedStructOut { - AdapterPropertiesVk() { - sType = SType::AdapterPropertiesVk; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t driverVersion; - }; - - struct BindGroupEntry { - ChainedStruct const * nextInChain = nullptr; - uint32_t binding; - Buffer buffer = nullptr; - uint64_t offset = 0; - uint64_t size = WGPU_WHOLE_SIZE; - Sampler sampler = nullptr; - TextureView textureView = nullptr; - }; - - struct BlendComponent { - BlendOperation operation = BlendOperation::Add; - BlendFactor srcFactor = BlendFactor::One; - BlendFactor dstFactor = BlendFactor::Zero; - }; - - struct BufferBindingLayout { - ChainedStruct const * nextInChain = nullptr; - BufferBindingType type = BufferBindingType::Undefined; - Bool hasDynamicOffset = false; - uint64_t minBindingSize = 0; - }; - - struct BufferDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - BufferUsage usage; - uint64_t size; - Bool mappedAtCreation = false; - }; - - // Can be chained in BufferDescriptor - struct BufferHostMappedPointer : ChainedStruct { - BufferHostMappedPointer() { - sType = SType::BufferHostMappedPointer; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * pointer; - Callback disposeCallback; - void * userdata; - }; - - struct BufferMapCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - BufferMapCallback callback; - void * userdata; - }; - - struct Color { - double r; - double g; - double b; - double a; - }; - - struct CommandBufferDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct CommandEncoderDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct CompilationInfoCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - CompilationInfoCallback callback; - void * userdata = nullptr; - }; - - struct CompilationMessage { - ChainedStruct const * nextInChain = nullptr; - char const * message = nullptr; - CompilationMessageType type; - uint64_t lineNum; - uint64_t linePos; - uint64_t offset; - uint64_t length; - uint64_t utf16LinePos; - uint64_t utf16Offset; - uint64_t utf16Length; - }; - - struct ComputePassTimestampWrites { - QuerySet querySet; - uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; - uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; - }; - - struct ConstantEntry { - ChainedStruct const * nextInChain = nullptr; - char const * key; - double value; - }; - - struct CopyTextureForBrowserOptions { - ChainedStruct const * nextInChain = nullptr; - Bool flipY = false; - Bool needsColorSpaceConversion = false; - AlphaMode srcAlphaMode = AlphaMode::Unpremultiplied; - float const * srcTransferFunctionParameters = nullptr; - float const * conversionMatrix = nullptr; - float const * dstTransferFunctionParameters = nullptr; - AlphaMode dstAlphaMode = AlphaMode::Unpremultiplied; - Bool internalUsage = false; - }; - - struct CreateComputePipelineAsyncCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - CreateComputePipelineAsyncCallback callback; - void * userdata; - }; - - struct CreateRenderPipelineAsyncCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - CreateRenderPipelineAsyncCallback callback; - void * userdata; - }; - - // Can be chained in InstanceDescriptor - struct DawnWGSLBlocklist : ChainedStruct { - DawnWGSLBlocklist() { - sType = SType::DawnWGSLBlocklist; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); - alignas(kFirstMemberAlignment) size_t blocklistedFeatureCount = 0; - const char* const * blocklistedFeatures; - }; - - // Can be chained in AdapterProperties - struct DawnAdapterPropertiesPowerPreference : ChainedStructOut { - DawnAdapterPropertiesPowerPreference() { - sType = SType::DawnAdapterPropertiesPowerPreference; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(PowerPreference )); - alignas(kFirstMemberAlignment) PowerPreference powerPreference = PowerPreference::Undefined; - }; - - // Can be chained in BufferDescriptor - struct DawnBufferDescriptorErrorInfoFromWireClient : ChainedStruct { - DawnBufferDescriptorErrorInfoFromWireClient() { - sType = SType::DawnBufferDescriptorErrorInfoFromWireClient; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool outOfMemory = false; - }; - - // Can be chained in DeviceDescriptor - struct DawnCacheDeviceDescriptor : ChainedStruct { - DawnCacheDeviceDescriptor() { - sType = SType::DawnCacheDeviceDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); - alignas(kFirstMemberAlignment) char const * isolationKey = ""; - DawnLoadCacheDataFunction loadDataFunction = nullptr; - DawnStoreCacheDataFunction storeDataFunction = nullptr; - void * functionUserdata = nullptr; - }; - - // Can be chained in ComputePipelineDescriptor - struct DawnComputePipelineFullSubgroups : ChainedStruct { - DawnComputePipelineFullSubgroups() { - sType = SType::DawnComputePipelineFullSubgroups; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool requiresFullSubgroups = false; - }; - - // Can be chained in CommandEncoderDescriptor - struct DawnEncoderInternalUsageDescriptor : ChainedStruct { - DawnEncoderInternalUsageDescriptor() { - sType = SType::DawnEncoderInternalUsageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool useInternalUsages = false; - }; - - // Can be chained in SupportedLimits - struct DawnExperimentalSubgroupLimits : ChainedStructOut { - DawnExperimentalSubgroupLimits() { - sType = SType::DawnExperimentalSubgroupLimits; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t minSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; - }; - - // Can be chained in MultisampleState - struct DawnMultisampleStateRenderToSingleSampled : ChainedStruct { - DawnMultisampleStateRenderToSingleSampled() { - sType = SType::DawnMultisampleStateRenderToSingleSampled; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool enabled = false; - }; - - // Can be chained in RenderPassColorAttachment - struct DawnRenderPassColorAttachmentRenderToSingleSampled : ChainedStruct { - DawnRenderPassColorAttachmentRenderToSingleSampled() { - sType = SType::DawnRenderPassColorAttachmentRenderToSingleSampled; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t implicitSampleCount = 1; - }; - - // Can be chained in ShaderModuleDescriptor - struct DawnShaderModuleSPIRVOptionsDescriptor : ChainedStruct { - DawnShaderModuleSPIRVOptionsDescriptor() { - sType = SType::DawnShaderModuleSPIRVOptionsDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool allowNonUniformDerivatives = false; - }; - - // Can be chained in TextureDescriptor - struct DawnTextureInternalUsageDescriptor : ChainedStruct { - DawnTextureInternalUsageDescriptor() { - sType = SType::DawnTextureInternalUsageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureUsage )); - alignas(kFirstMemberAlignment) TextureUsage internalUsage = TextureUsage::None; - }; - - // Can be chained in InstanceDescriptor - // Can be chained in RequestAdapterOptions - // Can be chained in DeviceDescriptor - struct DawnTogglesDescriptor : ChainedStruct { - DawnTogglesDescriptor() { - sType = SType::DawnTogglesDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); - alignas(kFirstMemberAlignment) size_t enabledToggleCount = 0; - const char* const * enabledToggles; - size_t disabledToggleCount = 0; - const char* const * disabledToggles; - }; - - // Can be chained in InstanceDescriptor - struct DawnWireWGSLControl : ChainedStruct { - DawnWireWGSLControl() { - sType = SType::DawnWireWGSLControl; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool enableExperimental = false; - Bool enableUnsafe = false; - Bool enableTesting = false; - }; - - // Can be chained in DepthStencilState - struct DepthStencilStateDepthWriteDefinedDawn : ChainedStruct { - DepthStencilStateDepthWriteDefinedDawn() { - sType = SType::DepthStencilStateDepthWriteDefinedDawn; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool depthWriteDefined; - }; - - struct DrmFormatProperties { - uint64_t modifier; - uint32_t modifierPlaneCount; - }; - - struct Extent2D { - uint32_t width; - uint32_t height; - }; - - struct Extent3D { - uint32_t width; - uint32_t height = 1; - uint32_t depthOrArrayLayers = 1; - }; - - // Can be chained in BindGroupEntry - struct ExternalTextureBindingEntry : ChainedStruct { - ExternalTextureBindingEntry() { - sType = SType::ExternalTextureBindingEntry; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(ExternalTexture )); - alignas(kFirstMemberAlignment) ExternalTexture externalTexture; - }; - - // Can be chained in BindGroupLayoutEntry - struct ExternalTextureBindingLayout : ChainedStruct { - ExternalTextureBindingLayout() { - sType = SType::ExternalTextureBindingLayout; - } - }; - - struct FormatCapabilities { - ChainedStructOut * nextInChain = nullptr; - }; - - struct Future { - uint64_t id; - }; - - struct InstanceFeatures { - ChainedStruct const * nextInChain = nullptr; - Bool timedWaitAnyEnable = false; - size_t timedWaitAnyMaxCount = 0; - }; - - struct Limits { - uint32_t maxTextureDimension1D = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxTextureDimension3D = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxTextureArrayLayers = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxBindGroups = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxBindGroupsPlusVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxBindingsPerBindGroup = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxDynamicUniformBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxDynamicStorageBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxSampledTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxSamplersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxStorageBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxStorageTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxUniformBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; - uint64_t maxUniformBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; - uint64_t maxStorageBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; - uint32_t minUniformBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; - uint32_t minStorageBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; - uint64_t maxBufferSize = WGPU_LIMIT_U64_UNDEFINED; - uint32_t maxVertexAttributes = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxVertexBufferArrayStride = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxInterStageShaderComponents = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxInterStageShaderVariables = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxColorAttachments = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxColorAttachmentBytesPerSample = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupStorageSize = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeInvocationsPerWorkgroup = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupSizeX = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupSizeY = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupSizeZ = WGPU_LIMIT_U32_UNDEFINED; - uint32_t maxComputeWorkgroupsPerDimension = WGPU_LIMIT_U32_UNDEFINED; - }; - - struct MemoryHeapInfo { - HeapProperty properties; - uint64_t size; - }; - - struct MultisampleState { - ChainedStruct const * nextInChain = nullptr; - uint32_t count = 1; - uint32_t mask = 0xFFFFFFFF; - Bool alphaToCoverageEnabled = false; - }; - - struct Origin2D { - uint32_t x = 0; - uint32_t y = 0; - }; - - struct Origin3D { - uint32_t x = 0; - uint32_t y = 0; - uint32_t z = 0; - }; - - struct PipelineLayoutDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - size_t bindGroupLayoutCount; - BindGroupLayout const * bindGroupLayouts; - }; - - struct PipelineLayoutStorageAttachment { - ChainedStruct const * nextInChain = nullptr; - uint64_t offset = 0; - TextureFormat format; - }; - - struct PopErrorScopeCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - PopErrorScopeCallback callback; - ErrorCallback oldCallback; - void * userdata = nullptr; - }; - - // Can be chained in PrimitiveState - struct PrimitiveDepthClipControl : ChainedStruct { - PrimitiveDepthClipControl() { - sType = SType::PrimitiveDepthClipControl; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool unclippedDepth = false; - }; - - struct PrimitiveState { - ChainedStruct const * nextInChain = nullptr; - PrimitiveTopology topology = PrimitiveTopology::TriangleList; - IndexFormat stripIndexFormat = IndexFormat::Undefined; - FrontFace frontFace = FrontFace::CCW; - CullMode cullMode = CullMode::None; - }; - - struct QuerySetDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - QueryType type; - uint32_t count; - }; - - struct QueueDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct QueueWorkDoneCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - QueueWorkDoneCallback callback; - void * userdata; - }; - - struct RenderBundleDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct RenderBundleEncoderDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - size_t colorFormatCount; - TextureFormat const * colorFormats; - TextureFormat depthStencilFormat = TextureFormat::Undefined; - uint32_t sampleCount = 1; - Bool depthReadOnly = false; - Bool stencilReadOnly = false; - }; - - struct RenderPassDepthStencilAttachment { - TextureView view; - LoadOp depthLoadOp = LoadOp::Undefined; - StoreOp depthStoreOp = StoreOp::Undefined; - float depthClearValue = NAN; - Bool depthReadOnly = false; - LoadOp stencilLoadOp = LoadOp::Undefined; - StoreOp stencilStoreOp = StoreOp::Undefined; - uint32_t stencilClearValue = 0; - Bool stencilReadOnly = false; - }; - - // Can be chained in RenderPassDescriptor - struct RenderPassDescriptorMaxDrawCount : ChainedStruct { - RenderPassDescriptorMaxDrawCount() { - sType = SType::RenderPassDescriptorMaxDrawCount; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t )); - alignas(kFirstMemberAlignment) uint64_t maxDrawCount = 50000000; - }; - - struct RenderPassTimestampWrites { - QuerySet querySet; - uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; - uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; - }; - - struct RequestAdapterCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - RequestAdapterCallback callback; - void * userdata; - }; - - struct RequestAdapterOptions { - ChainedStruct const * nextInChain = nullptr; - Surface compatibleSurface = nullptr; - PowerPreference powerPreference = PowerPreference::Undefined; - BackendType backendType = BackendType::Undefined; - Bool forceFallbackAdapter = false; - Bool compatibilityMode = false; - }; - - struct RequestDeviceCallbackInfo { - ChainedStruct const * nextInChain = nullptr; - CallbackMode mode; - RequestDeviceCallback callback; - void * userdata; - }; - - struct SamplerBindingLayout { - ChainedStruct const * nextInChain = nullptr; - SamplerBindingType type = SamplerBindingType::Undefined; - }; - - struct SamplerDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - AddressMode addressModeU = AddressMode::ClampToEdge; - AddressMode addressModeV = AddressMode::ClampToEdge; - AddressMode addressModeW = AddressMode::ClampToEdge; - FilterMode magFilter = FilterMode::Nearest; - FilterMode minFilter = FilterMode::Nearest; - MipmapFilterMode mipmapFilter = MipmapFilterMode::Nearest; - float lodMinClamp = 0.0f; - float lodMaxClamp = 32.0f; - CompareFunction compare = CompareFunction::Undefined; - uint16_t maxAnisotropy = 1; - }; - - // Can be chained in ShaderModuleDescriptor - struct ShaderModuleSPIRVDescriptor : ChainedStruct { - ShaderModuleSPIRVDescriptor() { - sType = SType::ShaderModuleSPIRVDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t codeSize; - uint32_t const * code; - }; - - // Can be chained in ShaderModuleDescriptor - struct ShaderModuleWGSLDescriptor : ChainedStruct { - ShaderModuleWGSLDescriptor() { - sType = SType::ShaderModuleWGSLDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); - alignas(kFirstMemberAlignment) char const * code; - }; - - struct ShaderModuleDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct SharedBufferMemoryBeginAccessDescriptor { - ChainedStruct const * nextInChain = nullptr; - Bool initialized; - size_t fenceCount; - SharedFence const * fences; - uint64_t const * signaledValues; - }; - - struct SharedBufferMemoryDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct SharedBufferMemoryEndAccessState { - SharedBufferMemoryEndAccessState() = default; - ~SharedBufferMemoryEndAccessState(); - SharedBufferMemoryEndAccessState(const SharedBufferMemoryEndAccessState&) = delete; - SharedBufferMemoryEndAccessState& operator=(const SharedBufferMemoryEndAccessState&) = delete; - SharedBufferMemoryEndAccessState(SharedBufferMemoryEndAccessState&&); - SharedBufferMemoryEndAccessState& operator=(SharedBufferMemoryEndAccessState&&); - ChainedStructOut * nextInChain = nullptr; - Bool const initialized = {}; - size_t const fenceCount = {}; - SharedFence const * const fences = {}; - uint64_t const * const signaledValues = {}; - }; - - struct SharedBufferMemoryProperties { - ChainedStructOut * nextInChain = nullptr; - BufferUsage usage; - uint64_t size; - }; - - // Can be chained in SharedFenceDescriptor - struct SharedFenceDXGISharedHandleDescriptor : ChainedStruct { - SharedFenceDXGISharedHandleDescriptor() { - sType = SType::SharedFenceDXGISharedHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * handle; - }; - - // Can be chained in SharedFenceExportInfo - struct SharedFenceDXGISharedHandleExportInfo : ChainedStructOut { - SharedFenceDXGISharedHandleExportInfo() { - sType = SType::SharedFenceDXGISharedHandleExportInfo; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * handle; - }; - - // Can be chained in SharedFenceDescriptor - struct SharedFenceMTLSharedEventDescriptor : ChainedStruct { - SharedFenceMTLSharedEventDescriptor() { - sType = SType::SharedFenceMTLSharedEventDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * sharedEvent; - }; - - // Can be chained in SharedFenceExportInfo - struct SharedFenceMTLSharedEventExportInfo : ChainedStructOut { - SharedFenceMTLSharedEventExportInfo() { - sType = SType::SharedFenceMTLSharedEventExportInfo; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * sharedEvent; - }; - - struct SharedFenceDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct SharedFenceExportInfo { - ChainedStructOut * nextInChain = nullptr; - SharedFenceType type; - }; - - // Can be chained in SharedFenceDescriptor - struct SharedFenceVkSemaphoreOpaqueFDDescriptor : ChainedStruct { - SharedFenceVkSemaphoreOpaqueFDDescriptor() { - sType = SType::SharedFenceVkSemaphoreOpaqueFDDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); - alignas(kFirstMemberAlignment) int handle; - }; - - // Can be chained in SharedFenceExportInfo - struct SharedFenceVkSemaphoreOpaqueFDExportInfo : ChainedStructOut { - SharedFenceVkSemaphoreOpaqueFDExportInfo() { - sType = SType::SharedFenceVkSemaphoreOpaqueFDExportInfo; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); - alignas(kFirstMemberAlignment) int handle; - }; - - // Can be chained in SharedFenceDescriptor - struct SharedFenceVkSemaphoreSyncFDDescriptor : ChainedStruct { - SharedFenceVkSemaphoreSyncFDDescriptor() { - sType = SType::SharedFenceVkSemaphoreSyncFDDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); - alignas(kFirstMemberAlignment) int handle; - }; - - // Can be chained in SharedFenceExportInfo - struct SharedFenceVkSemaphoreSyncFDExportInfo : ChainedStructOut { - SharedFenceVkSemaphoreSyncFDExportInfo() { - sType = SType::SharedFenceVkSemaphoreSyncFDExportInfo; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int )); - alignas(kFirstMemberAlignment) int handle; - }; - - // Can be chained in SharedFenceDescriptor - struct SharedFenceVkSemaphoreZirconHandleDescriptor : ChainedStruct { - SharedFenceVkSemaphoreZirconHandleDescriptor() { - sType = SType::SharedFenceVkSemaphoreZirconHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t handle; - }; - - // Can be chained in SharedFenceExportInfo - struct SharedFenceVkSemaphoreZirconHandleExportInfo : ChainedStructOut { - SharedFenceVkSemaphoreZirconHandleExportInfo() { - sType = SType::SharedFenceVkSemaphoreZirconHandleExportInfo; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t handle; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryDXGISharedHandleDescriptor : ChainedStruct { - SharedTextureMemoryDXGISharedHandleDescriptor() { - sType = SType::SharedTextureMemoryDXGISharedHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * handle; - Bool useKeyedMutex; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryEGLImageDescriptor : ChainedStruct { - SharedTextureMemoryEGLImageDescriptor() { - sType = SType::SharedTextureMemoryEGLImageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * image; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryIOSurfaceDescriptor : ChainedStruct { - SharedTextureMemoryIOSurfaceDescriptor() { - sType = SType::SharedTextureMemoryIOSurfaceDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * ioSurface; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryAHardwareBufferDescriptor : ChainedStruct { - SharedTextureMemoryAHardwareBufferDescriptor() { - sType = SType::SharedTextureMemoryAHardwareBufferDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * handle; - }; - - struct SharedTextureMemoryBeginAccessDescriptor { - ChainedStruct const * nextInChain = nullptr; - Bool concurrentRead; - Bool initialized; - size_t fenceCount; - SharedFence const * fences; - uint64_t const * signaledValues; - }; - - struct SharedTextureMemoryDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - struct SharedTextureMemoryDmaBufPlane { - int fd; - uint64_t offset; - uint32_t stride; - }; - - struct SharedTextureMemoryEndAccessState { - SharedTextureMemoryEndAccessState() = default; - ~SharedTextureMemoryEndAccessState(); - SharedTextureMemoryEndAccessState(const SharedTextureMemoryEndAccessState&) = delete; - SharedTextureMemoryEndAccessState& operator=(const SharedTextureMemoryEndAccessState&) = delete; - SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState&&); - SharedTextureMemoryEndAccessState& operator=(SharedTextureMemoryEndAccessState&&); - ChainedStructOut * nextInChain = nullptr; - Bool const initialized = {}; - size_t const fenceCount = {}; - SharedFence const * const fences = {}; - uint64_t const * const signaledValues = {}; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryOpaqueFDDescriptor : ChainedStruct { - SharedTextureMemoryOpaqueFDDescriptor() { - sType = SType::SharedTextureMemoryOpaqueFDDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void const * )); - alignas(kFirstMemberAlignment) void const * vkImageCreateInfo; - int memoryFD; - uint32_t memoryTypeIndex; - uint64_t allocationSize; - Bool dedicatedAllocation; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryVkDedicatedAllocationDescriptor : ChainedStruct { - SharedTextureMemoryVkDedicatedAllocationDescriptor() { - sType = SType::SharedTextureMemoryVkDedicatedAllocationDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool )); - alignas(kFirstMemberAlignment) Bool dedicatedAllocation; - }; - - // Can be chained in SharedTextureMemoryBeginAccessDescriptor - struct SharedTextureMemoryVkImageLayoutBeginState : ChainedStruct { - SharedTextureMemoryVkImageLayoutBeginState() { - sType = SType::SharedTextureMemoryVkImageLayoutBeginState; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t )); - alignas(kFirstMemberAlignment) int32_t oldLayout; - int32_t newLayout; - }; - - // Can be chained in SharedTextureMemoryEndAccessState - struct SharedTextureMemoryVkImageLayoutEndState : ChainedStructOut { - SharedTextureMemoryVkImageLayoutEndState() { - sType = SType::SharedTextureMemoryVkImageLayoutEndState; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t )); - alignas(kFirstMemberAlignment) int32_t oldLayout; - int32_t newLayout; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryZirconHandleDescriptor : ChainedStruct { - SharedTextureMemoryZirconHandleDescriptor() { - sType = SType::SharedTextureMemoryZirconHandleDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t )); - alignas(kFirstMemberAlignment) uint32_t memoryFD; - uint64_t allocationSize; - }; - - // Can be chained in BindGroupLayoutEntry - struct StaticSamplerBindingLayout : ChainedStruct { - StaticSamplerBindingLayout() { - sType = SType::StaticSamplerBindingLayout; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Sampler )); - alignas(kFirstMemberAlignment) Sampler sampler; - }; - - struct StencilFaceState { - CompareFunction compare = CompareFunction::Always; - StencilOperation failOp = StencilOperation::Keep; - StencilOperation depthFailOp = StencilOperation::Keep; - StencilOperation passOp = StencilOperation::Keep; - }; - - struct StorageTextureBindingLayout { - ChainedStruct const * nextInChain = nullptr; - StorageTextureAccess access = StorageTextureAccess::Undefined; - TextureFormat format = TextureFormat::Undefined; - TextureViewDimension viewDimension = TextureViewDimension::e2D; - }; - - struct SurfaceDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromAndroidNativeWindow : ChainedStruct { - SurfaceDescriptorFromAndroidNativeWindow() { - sType = SType::SurfaceDescriptorFromAndroidNativeWindow; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * window; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromCanvasHTMLSelector : ChainedStruct { - SurfaceDescriptorFromCanvasHTMLSelector() { - sType = SType::SurfaceDescriptorFromCanvasHTMLSelector; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); - alignas(kFirstMemberAlignment) char const * selector; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromMetalLayer : ChainedStruct { - SurfaceDescriptorFromMetalLayer() { - sType = SType::SurfaceDescriptorFromMetalLayer; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * layer; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromWaylandSurface : ChainedStruct { - SurfaceDescriptorFromWaylandSurface() { - sType = SType::SurfaceDescriptorFromWaylandSurface; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * display; - void * surface; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromWindowsHWND : ChainedStruct { - SurfaceDescriptorFromWindowsHWND() { - sType = SType::SurfaceDescriptorFromWindowsHWND; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * hinstance; - void * hwnd; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromWindowsCoreWindow : ChainedStruct { - SurfaceDescriptorFromWindowsCoreWindow() { - sType = SType::SurfaceDescriptorFromWindowsCoreWindow; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * coreWindow; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromWindowsSwapChainPanel : ChainedStruct { - SurfaceDescriptorFromWindowsSwapChainPanel() { - sType = SType::SurfaceDescriptorFromWindowsSwapChainPanel; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * swapChainPanel; - }; - - // Can be chained in SurfaceDescriptor - struct SurfaceDescriptorFromXlibWindow : ChainedStruct { - SurfaceDescriptorFromXlibWindow() { - sType = SType::SurfaceDescriptorFromXlibWindow; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(void * )); - alignas(kFirstMemberAlignment) void * display; - uint64_t window; - }; - - struct SwapChainDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - TextureUsage usage; - TextureFormat format; - uint32_t width; - uint32_t height; - PresentMode presentMode; - }; - - struct TextureBindingLayout { - ChainedStruct const * nextInChain = nullptr; - TextureSampleType sampleType = TextureSampleType::Undefined; - TextureViewDimension viewDimension = TextureViewDimension::e2D; - Bool multisampled = false; - }; - - // Can be chained in TextureDescriptor - struct TextureBindingViewDimensionDescriptor : ChainedStruct { - TextureBindingViewDimensionDescriptor() { - sType = SType::TextureBindingViewDimensionDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureViewDimension )); - alignas(kFirstMemberAlignment) TextureViewDimension textureBindingViewDimension = TextureViewDimension::Undefined; - }; - - struct TextureDataLayout { - ChainedStruct const * nextInChain = nullptr; - uint64_t offset = 0; - uint32_t bytesPerRow = WGPU_COPY_STRIDE_UNDEFINED; - uint32_t rowsPerImage = WGPU_COPY_STRIDE_UNDEFINED; - }; - - struct TextureViewDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - TextureFormat format = TextureFormat::Undefined; - TextureViewDimension dimension = TextureViewDimension::Undefined; - uint32_t baseMipLevel = 0; - uint32_t mipLevelCount = WGPU_MIP_LEVEL_COUNT_UNDEFINED; - uint32_t baseArrayLayer = 0; - uint32_t arrayLayerCount = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; - TextureAspect aspect = TextureAspect::All; - }; - - struct VertexAttribute { - VertexFormat format; - uint64_t offset; - uint32_t shaderLocation; - }; - - // Can be chained in AdapterProperties - struct AdapterPropertiesMemoryHeaps : ChainedStructOut { - AdapterPropertiesMemoryHeaps() { - sType = SType::AdapterPropertiesMemoryHeaps; - } - ~AdapterPropertiesMemoryHeaps(); - AdapterPropertiesMemoryHeaps(const AdapterPropertiesMemoryHeaps&) = delete; - AdapterPropertiesMemoryHeaps& operator=(const AdapterPropertiesMemoryHeaps&) = delete; - AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps&&); - AdapterPropertiesMemoryHeaps& operator=(AdapterPropertiesMemoryHeaps&&); - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); - alignas(kFirstMemberAlignment) size_t const heapCount = {}; - MemoryHeapInfo const * const heapInfo = {}; - }; - - struct BindGroupDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - BindGroupLayout layout; - size_t entryCount; - BindGroupEntry const * entries; - }; - - struct BindGroupLayoutEntry { - ChainedStruct const * nextInChain = nullptr; - uint32_t binding; - ShaderStage visibility; - BufferBindingLayout buffer; - SamplerBindingLayout sampler; - TextureBindingLayout texture; - StorageTextureBindingLayout storageTexture; - }; - - struct BlendState { - BlendComponent color; - BlendComponent alpha; - }; - - struct CompilationInfo { - ChainedStruct const * nextInChain = nullptr; - size_t messageCount; - CompilationMessage const * messages; - }; - - struct ComputePassDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - ComputePassTimestampWrites const * timestampWrites = nullptr; - }; - - struct DepthStencilState { - ChainedStruct const * nextInChain = nullptr; - TextureFormat format; - Bool depthWriteEnabled = false; - CompareFunction depthCompare = CompareFunction::Undefined; - StencilFaceState stencilFront; - StencilFaceState stencilBack; - uint32_t stencilReadMask = 0xFFFFFFFF; - uint32_t stencilWriteMask = 0xFFFFFFFF; - int32_t depthBias = 0; - float depthBiasSlopeScale = 0.0f; - float depthBiasClamp = 0.0f; - }; - - // Can be chained in FormatCapabilities - struct DrmFormatCapabilities : ChainedStructOut { - DrmFormatCapabilities() { - sType = SType::DrmFormatCapabilities; - } - ~DrmFormatCapabilities(); - DrmFormatCapabilities(const DrmFormatCapabilities&) = delete; - DrmFormatCapabilities& operator=(const DrmFormatCapabilities&) = delete; - DrmFormatCapabilities(DrmFormatCapabilities&&); - DrmFormatCapabilities& operator=(DrmFormatCapabilities&&); - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t )); - alignas(kFirstMemberAlignment) size_t const propertiesCount = {}; - DrmFormatProperties const * const properties = {}; - }; - - struct ExternalTextureDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - TextureView plane0; - TextureView plane1 = nullptr; - Origin2D visibleOrigin; - Extent2D visibleSize; - Bool doYuvToRgbConversionOnly = false; - float const * yuvToRgbConversionMatrix = nullptr; - float const * srcTransferFunctionParameters; - float const * dstTransferFunctionParameters; - float const * gamutConversionMatrix; - Bool flipY = false; - Bool mirrored = false; - ExternalTextureRotation rotation = ExternalTextureRotation::Rotate0Degrees; - }; - - struct FutureWaitInfo { - Future future; - Bool completed = false; - }; - - struct ImageCopyBuffer { - ChainedStruct const * nextInChain = nullptr; - TextureDataLayout layout; - Buffer buffer; - }; - - struct ImageCopyExternalTexture { - ChainedStruct const * nextInChain = nullptr; - ExternalTexture externalTexture; - Origin3D origin; - Extent2D naturalSize; - }; - - struct ImageCopyTexture { - ChainedStruct const * nextInChain = nullptr; - Texture texture; - uint32_t mipLevel = 0; - Origin3D origin; - TextureAspect aspect = TextureAspect::All; - }; - - struct InstanceDescriptor { - ChainedStruct const * nextInChain = nullptr; - InstanceFeatures features; - }; - - // Can be chained in PipelineLayoutDescriptor - struct PipelineLayoutPixelLocalStorage : ChainedStruct { - PipelineLayoutPixelLocalStorage() { - sType = SType::PipelineLayoutPixelLocalStorage; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t )); - alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount = 0; - PipelineLayoutStorageAttachment const * storageAttachments; - }; - - struct ProgrammableStageDescriptor { - ChainedStruct const * nextInChain = nullptr; - ShaderModule module; - char const * entryPoint = nullptr; - size_t constantCount = 0; - ConstantEntry const * constants; - }; - - struct RenderPassColorAttachment { - ChainedStruct const * nextInChain = nullptr; - TextureView view = nullptr; - uint32_t depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; - TextureView resolveTarget = nullptr; - LoadOp loadOp; - StoreOp storeOp; - Color clearValue; - }; - - struct RenderPassStorageAttachment { - ChainedStruct const * nextInChain = nullptr; - uint64_t offset = 0; - TextureView storage; - LoadOp loadOp; - StoreOp storeOp; - Color clearValue; - }; - - struct RequiredLimits { - ChainedStruct const * nextInChain = nullptr; - Limits limits; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryDmaBufDescriptor : ChainedStruct { - SharedTextureMemoryDmaBufDescriptor() { - sType = SType::SharedTextureMemoryDmaBufDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(Extent3D )); - alignas(kFirstMemberAlignment) Extent3D size; - uint32_t drmFormat; - uint64_t drmModifier; - size_t planeCount; - SharedTextureMemoryDmaBufPlane const * planes; - }; - - struct SharedTextureMemoryProperties { - ChainedStructOut * nextInChain = nullptr; - TextureUsage usage; - Extent3D size; - TextureFormat format; - }; - - // Can be chained in SharedTextureMemoryDescriptor - struct SharedTextureMemoryVkImageDescriptor : ChainedStruct { - SharedTextureMemoryVkImageDescriptor() { - sType = SType::SharedTextureMemoryVkImageDescriptor; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t )); - alignas(kFirstMemberAlignment) int32_t vkFormat; - int32_t vkUsageFlags; - Extent3D vkExtent3D; - }; - - struct SupportedLimits { - ChainedStructOut * nextInChain = nullptr; - Limits limits; - }; - - struct TextureDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - TextureUsage usage; - TextureDimension dimension = TextureDimension::e2D; - Extent3D size; - TextureFormat format; - uint32_t mipLevelCount = 1; - uint32_t sampleCount = 1; - size_t viewFormatCount = 0; - TextureFormat const * viewFormats; - }; - - struct VertexBufferLayout { - uint64_t arrayStride; - VertexStepMode stepMode = VertexStepMode::Vertex; - size_t attributeCount; - VertexAttribute const * attributes; - }; - - struct BindGroupLayoutDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - size_t entryCount; - BindGroupLayoutEntry const * entries; - }; - - struct ColorTargetState { - ChainedStruct const * nextInChain = nullptr; - TextureFormat format; - BlendState const * blend = nullptr; - ColorWriteMask writeMask = ColorWriteMask::All; - }; - - struct ComputePipelineDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - PipelineLayout layout = nullptr; - ProgrammableStageDescriptor compute; - }; - - struct DeviceDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - size_t requiredFeatureCount = 0; - FeatureName const * requiredFeatures = nullptr; - RequiredLimits const * requiredLimits = nullptr; - QueueDescriptor defaultQueue; - DeviceLostCallback deviceLostCallback = nullptr; - void * deviceLostUserdata = nullptr; - }; - - struct RenderPassDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - size_t colorAttachmentCount; - RenderPassColorAttachment const * colorAttachments; - RenderPassDepthStencilAttachment const * depthStencilAttachment = nullptr; - QuerySet occlusionQuerySet = nullptr; - RenderPassTimestampWrites const * timestampWrites = nullptr; - }; - - // Can be chained in RenderPassDescriptor - struct RenderPassPixelLocalStorage : ChainedStruct { - RenderPassPixelLocalStorage() { - sType = SType::RenderPassPixelLocalStorage; - } - static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t )); - alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount = 0; - RenderPassStorageAttachment const * storageAttachments; - }; - - struct VertexState { - ChainedStruct const * nextInChain = nullptr; - ShaderModule module; - char const * entryPoint = nullptr; - size_t constantCount = 0; - ConstantEntry const * constants; - size_t bufferCount = 0; - VertexBufferLayout const * buffers; - }; - - struct FragmentState { - ChainedStruct const * nextInChain = nullptr; - ShaderModule module; - char const * entryPoint = nullptr; - size_t constantCount = 0; - ConstantEntry const * constants; - size_t targetCount; - ColorTargetState const * targets; - }; - - struct RenderPipelineDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - PipelineLayout layout = nullptr; - VertexState vertex; - PrimitiveState primitive; - DepthStencilState const * depthStencil = nullptr; - MultisampleState multisample; - FragmentState const * fragment = nullptr; - }; - -} // namespace wgpu +namespace detail { +constexpr size_t ConstexprMax(size_t a, size_t b) { return a > b ? a : b; } +} // namespace detail + +static constexpr uint32_t kArrayLayerCountUndefined = + WGPU_ARRAY_LAYER_COUNT_UNDEFINED; +static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED; +static constexpr uint32_t kDepthSliceUndefined = WGPU_DEPTH_SLICE_UNDEFINED; +static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED; +static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED; +static constexpr uint32_t kMipLevelCountUndefined = + WGPU_MIP_LEVEL_COUNT_UNDEFINED; +static constexpr uint32_t kQuerySetIndexUndefined = + WGPU_QUERY_SET_INDEX_UNDEFINED; +static constexpr size_t kWholeMapSize = WGPU_WHOLE_MAP_SIZE; +static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE; + +enum class WGSLFeatureName : uint32_t { + Undefined = 0x00000000, + ReadonlyAndReadwriteStorageTextures = 0x00000001, + Packed4x8IntegerDotProduct = 0x00000002, + UnrestrictedPointerParameters = 0x00000003, + PointerCompositeAccess = 0x00000004, + ChromiumTestingUnimplemented = 0x000003E8, + ChromiumTestingUnsafeExperimental = 0x000003E9, + ChromiumTestingExperimental = 0x000003EA, + ChromiumTestingShippedWithKillswitch = 0x000003EB, + ChromiumTestingShipped = 0x000003EC, +}; + +enum class AdapterType : uint32_t { + DiscreteGPU = 0x00000001, + IntegratedGPU = 0x00000002, + CPU = 0x00000003, + Unknown = 0x00000004, +}; + +enum class AddressMode : uint32_t { + Undefined = 0x00000000, + ClampToEdge = 0x00000001, + Repeat = 0x00000002, + MirrorRepeat = 0x00000003, +}; + +enum class AlphaMode : uint32_t { + Opaque = 0x00000001, + Premultiplied = 0x00000002, + Unpremultiplied = 0x00000003, +}; + +enum class BackendType : uint32_t { + Undefined = 0x00000000, + Null = 0x00000001, + WebGPU = 0x00000002, + D3D11 = 0x00000003, + D3D12 = 0x00000004, + Metal = 0x00000005, + Vulkan = 0x00000006, + OpenGL = 0x00000007, + OpenGLES = 0x00000008, +}; + +enum class BlendFactor : uint32_t { + Undefined = 0x00000000, + Zero = 0x00000001, + One = 0x00000002, + Src = 0x00000003, + OneMinusSrc = 0x00000004, + SrcAlpha = 0x00000005, + OneMinusSrcAlpha = 0x00000006, + Dst = 0x00000007, + OneMinusDst = 0x00000008, + DstAlpha = 0x00000009, + OneMinusDstAlpha = 0x0000000A, + SrcAlphaSaturated = 0x0000000B, + Constant = 0x0000000C, + OneMinusConstant = 0x0000000D, + Src1 = 0x0000000E, + OneMinusSrc1 = 0x0000000F, + Src1Alpha = 0x00000010, + OneMinusSrc1Alpha = 0x00000011, +}; + +enum class BlendOperation : uint32_t { + Undefined = 0x00000000, + Add = 0x00000001, + Subtract = 0x00000002, + ReverseSubtract = 0x00000003, + Min = 0x00000004, + Max = 0x00000005, +}; + +enum class BufferBindingType : uint32_t { + Undefined = 0x00000000, + Uniform = 0x00000001, + Storage = 0x00000002, + ReadOnlyStorage = 0x00000003, +}; + +enum class BufferMapAsyncStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + ValidationError = 0x00000002, + Unknown = 0x00000003, + DeviceLost = 0x00000004, + DestroyedBeforeCallback = 0x00000005, + UnmappedBeforeCallback = 0x00000006, + MappingAlreadyPending = 0x00000007, + OffsetOutOfRange = 0x00000008, + SizeOutOfRange = 0x00000009, +}; + +enum class BufferMapState : uint32_t { + Unmapped = 0x00000001, + Pending = 0x00000002, + Mapped = 0x00000003, +}; + +enum class CallbackMode : uint32_t { + WaitAnyOnly = 0x00000000, + AllowProcessEvents = 0x00000001, + AllowSpontaneous = 0x00000002, +}; + +enum class CompareFunction : uint32_t { + Undefined = 0x00000000, + Never = 0x00000001, + Less = 0x00000002, + Equal = 0x00000003, + LessEqual = 0x00000004, + Greater = 0x00000005, + NotEqual = 0x00000006, + GreaterEqual = 0x00000007, + Always = 0x00000008, +}; + +enum class CompilationInfoRequestStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Error = 0x00000002, + DeviceLost = 0x00000003, + Unknown = 0x00000004, +}; + +enum class CompilationMessageType : uint32_t { + Error = 0x00000001, + Warning = 0x00000002, + Info = 0x00000003, +}; + +enum class CreatePipelineAsyncStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + ValidationError = 0x00000002, + InternalError = 0x00000003, + DeviceLost = 0x00000004, + DeviceDestroyed = 0x00000005, + Unknown = 0x00000006, +}; + +enum class CullMode : uint32_t { + Undefined = 0x00000000, + None = 0x00000001, + Front = 0x00000002, + Back = 0x00000003, +}; + +enum class DeviceLostReason : uint32_t { + Undefined = 0x00000000, + Destroyed = 0x00000001, +}; + +enum class ErrorFilter : uint32_t { + Validation = 0x00000001, + OutOfMemory = 0x00000002, + Internal = 0x00000003, +}; + +enum class ErrorType : uint32_t { + NoError = 0x00000000, + Validation = 0x00000001, + OutOfMemory = 0x00000002, + Internal = 0x00000003, + Unknown = 0x00000004, + DeviceLost = 0x00000005, +}; + +enum class ExternalTextureRotation : uint32_t { + Rotate0Degrees = 0x00000000, + Rotate90Degrees = 0x00000001, + Rotate180Degrees = 0x00000002, + Rotate270Degrees = 0x00000003, +}; + +enum class FeatureName : uint32_t { + Undefined = 0x00000000, + DepthClipControl = 0x00000001, + Depth32FloatStencil8 = 0x00000002, + TimestampQuery = 0x00000003, + TextureCompressionBC = 0x00000004, + TextureCompressionETC2 = 0x00000005, + TextureCompressionASTC = 0x00000006, + IndirectFirstInstance = 0x00000007, + ShaderF16 = 0x00000008, + RG11B10UfloatRenderable = 0x00000009, + BGRA8UnormStorage = 0x0000000A, + Float32Filterable = 0x0000000B, + DawnInternalUsages = 0x000003EA, + DawnMultiPlanarFormats = 0x000003EB, + DawnNative = 0x000003EC, + ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, + ImplicitDeviceSynchronization = 0x000003EF, + SurfaceCapabilities = 0x000003F0, + TransientAttachments = 0x000003F1, + MSAARenderToSingleSampled = 0x000003F2, + DualSourceBlending = 0x000003F3, + D3D11MultithreadProtected = 0x000003F4, + ANGLETextureSharing = 0x000003F5, + ChromiumExperimentalSubgroups = 0x000003F6, + ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, + PixelLocalStorageCoherent = 0x000003F9, + PixelLocalStorageNonCoherent = 0x000003FA, + Unorm16TextureFormats = 0x000003FB, + Snorm16TextureFormats = 0x000003FC, + MultiPlanarFormatExtendedUsages = 0x000003FD, + MultiPlanarFormatP010 = 0x000003FE, + HostMappedPointer = 0x000003FF, + MultiPlanarRenderTargets = 0x00000400, + MultiPlanarFormatNv12a = 0x00000401, + FramebufferFetch = 0x00000402, + BufferMapExtendedUsages = 0x00000403, + AdapterPropertiesMemoryHeaps = 0x00000404, + AdapterPropertiesD3D = 0x00000405, + AdapterPropertiesVk = 0x00000406, + R8UnormStorage = 0x00000407, + FormatCapabilities = 0x00000408, + DrmFormatCapabilities = 0x00000409, + Norm16TextureFormats = 0x0000040A, + SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, + SharedTextureMemoryAHardwareBuffer = 0x0000044D, + SharedTextureMemoryDmaBuf = 0x0000044E, + SharedTextureMemoryOpaqueFD = 0x0000044F, + SharedTextureMemoryZirconHandle = 0x00000450, + SharedTextureMemoryDXGISharedHandle = 0x00000451, + SharedTextureMemoryD3D11Texture2D = 0x00000452, + SharedTextureMemoryIOSurface = 0x00000453, + SharedTextureMemoryEGLImage = 0x00000454, + SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, + SharedFenceVkSemaphoreSyncFD = 0x000004B1, + SharedFenceVkSemaphoreZirconHandle = 0x000004B2, + SharedFenceDXGISharedHandle = 0x000004B3, + SharedFenceMTLSharedEvent = 0x000004B4, + SharedBufferMemoryD3D12Resource = 0x000004B5, + StaticSamplers = 0x000004B6, +}; + +enum class FilterMode : uint32_t { + Undefined = 0x00000000, + Nearest = 0x00000001, + Linear = 0x00000002, +}; + +enum class FrontFace : uint32_t { + Undefined = 0x00000000, + CCW = 0x00000001, + CW = 0x00000002, +}; + +enum class IndexFormat : uint32_t { + Undefined = 0x00000000, + Uint16 = 0x00000001, + Uint32 = 0x00000002, +}; + +enum class LoadOp : uint32_t { + Undefined = 0x00000000, + Clear = 0x00000001, + Load = 0x00000002, +}; + +enum class LoggingType : uint32_t { + Verbose = 0x00000001, + Info = 0x00000002, + Warning = 0x00000003, + Error = 0x00000004, +}; + +enum class MipmapFilterMode : uint32_t { + Undefined = 0x00000000, + Nearest = 0x00000001, + Linear = 0x00000002, +}; + +enum class PopErrorScopeStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, +}; + +enum class PowerPreference : uint32_t { + Undefined = 0x00000000, + LowPower = 0x00000001, + HighPerformance = 0x00000002, +}; + +enum class PresentMode : uint32_t { + Fifo = 0x00000001, + Immediate = 0x00000003, + Mailbox = 0x00000004, +}; + +enum class PrimitiveTopology : uint32_t { + Undefined = 0x00000000, + PointList = 0x00000001, + LineList = 0x00000002, + LineStrip = 0x00000003, + TriangleList = 0x00000004, + TriangleStrip = 0x00000005, +}; + +enum class QueryType : uint32_t { + Occlusion = 0x00000001, + Timestamp = 0x00000002, +}; + +enum class QueueWorkDoneStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Error = 0x00000002, + Unknown = 0x00000003, + DeviceLost = 0x00000004, +}; + +enum class RequestAdapterStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Unavailable = 0x00000002, + Error = 0x00000003, + Unknown = 0x00000004, +}; + +enum class RequestDeviceStatus : uint32_t { + Success = 0x00000000, + InstanceDropped = 0x00000001, + Error = 0x00000002, + Unknown = 0x00000003, +}; + +enum class SType : uint32_t { + Invalid = 0x00000000, + SurfaceDescriptorFromMetalLayer = 0x00000001, + SurfaceDescriptorFromWindowsHWND = 0x00000002, + SurfaceDescriptorFromXlibWindow = 0x00000003, + SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, + ShaderModuleSPIRVDescriptor = 0x00000005, + ShaderModuleWGSLDescriptor = 0x00000006, + PrimitiveDepthClipControl = 0x00000007, + SurfaceDescriptorFromWaylandSurface = 0x00000008, + SurfaceDescriptorFromAndroidNativeWindow = 0x00000009, + SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, + ExternalTextureBindingEntry = 0x0000000C, + ExternalTextureBindingLayout = 0x0000000D, + SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, + RenderPassDescriptorMaxDrawCount = 0x0000000F, + DepthStencilStateDepthWriteDefinedDawn = 0x00000010, + TextureBindingViewDimensionDescriptor = 0x00000011, + DawnTextureInternalUsageDescriptor = 0x000003E8, + DawnEncoderInternalUsageDescriptor = 0x000003EB, + DawnInstanceDescriptor = 0x000003EC, + DawnCacheDeviceDescriptor = 0x000003ED, + DawnAdapterPropertiesPowerPreference = 0x000003EE, + DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, + DawnTogglesDescriptor = 0x000003F0, + DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, + RequestAdapterOptionsLUID = 0x000003F2, + RequestAdapterOptionsGetGLProc = 0x000003F3, + RequestAdapterOptionsD3D11Device = 0x000003F4, + DawnMultisampleStateRenderToSingleSampled = 0x000003F5, + DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, + RenderPassPixelLocalStorage = 0x000003F7, + PipelineLayoutPixelLocalStorage = 0x000003F8, + BufferHostMappedPointer = 0x000003F9, + DawnExperimentalSubgroupLimits = 0x000003FA, + AdapterPropertiesMemoryHeaps = 0x000003FB, + AdapterPropertiesD3D = 0x000003FC, + AdapterPropertiesVk = 0x000003FD, + DawnComputePipelineFullSubgroups = 0x000003FE, + DawnWireWGSLControl = 0x000003FF, + DawnWGSLBlocklist = 0x00000400, + DrmFormatCapabilities = 0x00000401, + SharedTextureMemoryVkImageDescriptor = 0x0000044C, + SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, + SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, + SharedTextureMemoryDmaBufDescriptor = 0x0000044F, + SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, + SharedTextureMemoryZirconHandleDescriptor = 0x00000451, + SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, + SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, + SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, + SharedTextureMemoryEGLImageDescriptor = 0x00000455, + SharedTextureMemoryInitializedBeginState = 0x000004B0, + SharedTextureMemoryInitializedEndState = 0x000004B1, + SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, + SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, + SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, + SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, + SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, + SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, + SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, + SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, + SharedFenceDXGISharedHandleDescriptor = 0x000004BA, + SharedFenceDXGISharedHandleExportInfo = 0x000004BB, + SharedFenceMTLSharedEventDescriptor = 0x000004BC, + SharedFenceMTLSharedEventExportInfo = 0x000004BD, + SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, + StaticSamplerBindingLayout = 0x000004BF, +}; + +enum class SamplerBindingType : uint32_t { + Undefined = 0x00000000, + Filtering = 0x00000001, + NonFiltering = 0x00000002, + Comparison = 0x00000003, +}; + +enum class SharedFenceType : uint32_t { + Undefined = 0x00000000, + VkSemaphoreOpaqueFD = 0x00000001, + VkSemaphoreSyncFD = 0x00000002, + VkSemaphoreZirconHandle = 0x00000003, + DXGISharedHandle = 0x00000004, + MTLSharedEvent = 0x00000005, +}; + +enum class StencilOperation : uint32_t { + Undefined = 0x00000000, + Keep = 0x00000001, + Zero = 0x00000002, + Replace = 0x00000003, + Invert = 0x00000004, + IncrementClamp = 0x00000005, + DecrementClamp = 0x00000006, + IncrementWrap = 0x00000007, + DecrementWrap = 0x00000008, +}; + +enum class StorageTextureAccess : uint32_t { + Undefined = 0x00000000, + WriteOnly = 0x00000001, + ReadOnly = 0x00000002, + ReadWrite = 0x00000003, +}; + +enum class StoreOp : uint32_t { + Undefined = 0x00000000, + Store = 0x00000001, + Discard = 0x00000002, +}; + +enum class TextureAspect : uint32_t { + Undefined = 0x00000000, + All = 0x00000001, + StencilOnly = 0x00000002, + DepthOnly = 0x00000003, + Plane0Only = 0x00000004, + Plane1Only = 0x00000005, + Plane2Only = 0x00000006, +}; + +enum class TextureDimension : uint32_t { + Undefined = 0x00000000, + e1D = 0x00000001, + e2D = 0x00000002, + e3D = 0x00000003, +}; + +enum class TextureFormat : uint32_t { + Undefined = 0x00000000, + R8Unorm = 0x00000001, + R8Snorm = 0x00000002, + R8Uint = 0x00000003, + R8Sint = 0x00000004, + R16Uint = 0x00000005, + R16Sint = 0x00000006, + R16Float = 0x00000007, + RG8Unorm = 0x00000008, + RG8Snorm = 0x00000009, + RG8Uint = 0x0000000A, + RG8Sint = 0x0000000B, + R32Float = 0x0000000C, + R32Uint = 0x0000000D, + R32Sint = 0x0000000E, + RG16Uint = 0x0000000F, + RG16Sint = 0x00000010, + RG16Float = 0x00000011, + RGBA8Unorm = 0x00000012, + RGBA8UnormSrgb = 0x00000013, + RGBA8Snorm = 0x00000014, + RGBA8Uint = 0x00000015, + RGBA8Sint = 0x00000016, + BGRA8Unorm = 0x00000017, + BGRA8UnormSrgb = 0x00000018, + RGB10A2Uint = 0x00000019, + RGB10A2Unorm = 0x0000001A, + RG11B10Ufloat = 0x0000001B, + RGB9E5Ufloat = 0x0000001C, + RG32Float = 0x0000001D, + RG32Uint = 0x0000001E, + RG32Sint = 0x0000001F, + RGBA16Uint = 0x00000020, + RGBA16Sint = 0x00000021, + RGBA16Float = 0x00000022, + RGBA32Float = 0x00000023, + RGBA32Uint = 0x00000024, + RGBA32Sint = 0x00000025, + Stencil8 = 0x00000026, + Depth16Unorm = 0x00000027, + Depth24Plus = 0x00000028, + Depth24PlusStencil8 = 0x00000029, + Depth32Float = 0x0000002A, + Depth32FloatStencil8 = 0x0000002B, + BC1RGBAUnorm = 0x0000002C, + BC1RGBAUnormSrgb = 0x0000002D, + BC2RGBAUnorm = 0x0000002E, + BC2RGBAUnormSrgb = 0x0000002F, + BC3RGBAUnorm = 0x00000030, + BC3RGBAUnormSrgb = 0x00000031, + BC4RUnorm = 0x00000032, + BC4RSnorm = 0x00000033, + BC5RGUnorm = 0x00000034, + BC5RGSnorm = 0x00000035, + BC6HRGBUfloat = 0x00000036, + BC6HRGBFloat = 0x00000037, + BC7RGBAUnorm = 0x00000038, + BC7RGBAUnormSrgb = 0x00000039, + ETC2RGB8Unorm = 0x0000003A, + ETC2RGB8UnormSrgb = 0x0000003B, + ETC2RGB8A1Unorm = 0x0000003C, + ETC2RGB8A1UnormSrgb = 0x0000003D, + ETC2RGBA8Unorm = 0x0000003E, + ETC2RGBA8UnormSrgb = 0x0000003F, + EACR11Unorm = 0x00000040, + EACR11Snorm = 0x00000041, + EACRG11Unorm = 0x00000042, + EACRG11Snorm = 0x00000043, + ASTC4x4Unorm = 0x00000044, + ASTC4x4UnormSrgb = 0x00000045, + ASTC5x4Unorm = 0x00000046, + ASTC5x4UnormSrgb = 0x00000047, + ASTC5x5Unorm = 0x00000048, + ASTC5x5UnormSrgb = 0x00000049, + ASTC6x5Unorm = 0x0000004A, + ASTC6x5UnormSrgb = 0x0000004B, + ASTC6x6Unorm = 0x0000004C, + ASTC6x6UnormSrgb = 0x0000004D, + ASTC8x5Unorm = 0x0000004E, + ASTC8x5UnormSrgb = 0x0000004F, + ASTC8x6Unorm = 0x00000050, + ASTC8x6UnormSrgb = 0x00000051, + ASTC8x8Unorm = 0x00000052, + ASTC8x8UnormSrgb = 0x00000053, + ASTC10x5Unorm = 0x00000054, + ASTC10x5UnormSrgb = 0x00000055, + ASTC10x6Unorm = 0x00000056, + ASTC10x6UnormSrgb = 0x00000057, + ASTC10x8Unorm = 0x00000058, + ASTC10x8UnormSrgb = 0x00000059, + ASTC10x10Unorm = 0x0000005A, + ASTC10x10UnormSrgb = 0x0000005B, + ASTC12x10Unorm = 0x0000005C, + ASTC12x10UnormSrgb = 0x0000005D, + ASTC12x12Unorm = 0x0000005E, + ASTC12x12UnormSrgb = 0x0000005F, + R16Unorm = 0x00000060, + RG16Unorm = 0x00000061, + RGBA16Unorm = 0x00000062, + R16Snorm = 0x00000063, + RG16Snorm = 0x00000064, + RGBA16Snorm = 0x00000065, + R8BG8Biplanar420Unorm = 0x00000066, + R10X6BG10X6Biplanar420Unorm = 0x00000067, + R8BG8A8Triplanar420Unorm = 0x00000068, +}; + +enum class TextureSampleType : uint32_t { + Undefined = 0x00000000, + Float = 0x00000001, + UnfilterableFloat = 0x00000002, + Depth = 0x00000003, + Sint = 0x00000004, + Uint = 0x00000005, +}; + +enum class TextureViewDimension : uint32_t { + Undefined = 0x00000000, + e1D = 0x00000001, + e2D = 0x00000002, + e2DArray = 0x00000003, + Cube = 0x00000004, + CubeArray = 0x00000005, + e3D = 0x00000006, +}; + +enum class VertexFormat : uint32_t { + Undefined = 0x00000000, + Uint8x2 = 0x00000001, + Uint8x4 = 0x00000002, + Sint8x2 = 0x00000003, + Sint8x4 = 0x00000004, + Unorm8x2 = 0x00000005, + Unorm8x4 = 0x00000006, + Snorm8x2 = 0x00000007, + Snorm8x4 = 0x00000008, + Uint16x2 = 0x00000009, + Uint16x4 = 0x0000000A, + Sint16x2 = 0x0000000B, + Sint16x4 = 0x0000000C, + Unorm16x2 = 0x0000000D, + Unorm16x4 = 0x0000000E, + Snorm16x2 = 0x0000000F, + Snorm16x4 = 0x00000010, + Float16x2 = 0x00000011, + Float16x4 = 0x00000012, + Float32 = 0x00000013, + Float32x2 = 0x00000014, + Float32x3 = 0x00000015, + Float32x4 = 0x00000016, + Uint32 = 0x00000017, + Uint32x2 = 0x00000018, + Uint32x3 = 0x00000019, + Uint32x4 = 0x0000001A, + Sint32 = 0x0000001B, + Sint32x2 = 0x0000001C, + Sint32x3 = 0x0000001D, + Sint32x4 = 0x0000001E, + Unorm10_10_10_2 = 0x0000001F, +}; + +enum class VertexStepMode : uint32_t { + Undefined = 0x00000000, + VertexBufferNotUsed = 0x00000001, + Vertex = 0x00000002, + Instance = 0x00000003, +}; + +enum class WaitStatus : uint32_t { + Success = 0x00000000, + TimedOut = 0x00000001, + UnsupportedTimeout = 0x00000002, + UnsupportedCount = 0x00000003, + UnsupportedMixedSources = 0x00000004, + Unknown = 0x00000005, +}; + +enum class BufferUsage : uint32_t { + None = 0x00000000, + MapRead = 0x00000001, + MapWrite = 0x00000002, + CopySrc = 0x00000004, + CopyDst = 0x00000008, + Index = 0x00000010, + Vertex = 0x00000020, + Uniform = 0x00000040, + Storage = 0x00000080, + Indirect = 0x00000100, + QueryResolve = 0x00000200, +}; + +enum class ColorWriteMask : uint32_t { + None = 0x00000000, + Red = 0x00000001, + Green = 0x00000002, + Blue = 0x00000004, + Alpha = 0x00000008, + All = 0x0000000F, +}; + +enum class HeapProperty : uint32_t { + Undefined = 0x00000000, + DeviceLocal = 0x00000001, + HostVisible = 0x00000002, + HostCoherent = 0x00000004, + HostUncached = 0x00000008, + HostCached = 0x00000010, +}; + +enum class MapMode : uint32_t { + None = 0x00000000, + Read = 0x00000001, + Write = 0x00000002, +}; + +enum class ShaderStage : uint32_t { + None = 0x00000000, + Vertex = 0x00000001, + Fragment = 0x00000002, + Compute = 0x00000004, +}; + +enum class TextureUsage : uint32_t { + None = 0x00000000, + CopySrc = 0x00000001, + CopyDst = 0x00000002, + TextureBinding = 0x00000004, + StorageBinding = 0x00000008, + RenderAttachment = 0x00000010, + TransientAttachment = 0x00000020, + StorageAttachment = 0x00000040, +}; + +using BufferMapCallback = WGPUBufferMapCallback; +using Callback = WGPUCallback; +using CompilationInfoCallback = WGPUCompilationInfoCallback; +using CreateComputePipelineAsyncCallback = + WGPUCreateComputePipelineAsyncCallback; +using CreateRenderPipelineAsyncCallback = WGPUCreateRenderPipelineAsyncCallback; +using DawnLoadCacheDataFunction = WGPUDawnLoadCacheDataFunction; +using DawnStoreCacheDataFunction = WGPUDawnStoreCacheDataFunction; +using DeviceLostCallback = WGPUDeviceLostCallback; +using ErrorCallback = WGPUErrorCallback; +using LoggingCallback = WGPULoggingCallback; +using PopErrorScopeCallback = WGPUPopErrorScopeCallback; +using Proc = WGPUProc; +using QueueWorkDoneCallback = WGPUQueueWorkDoneCallback; +using RequestAdapterCallback = WGPURequestAdapterCallback; +using RequestDeviceCallback = WGPURequestDeviceCallback; + +class Adapter; +class BindGroup; +class BindGroupLayout; +class Buffer; +class CommandBuffer; +class CommandEncoder; +class ComputePassEncoder; +class ComputePipeline; +class Device; +class ExternalTexture; +class Instance; +class PipelineLayout; +class QuerySet; +class Queue; +class RenderBundle; +class RenderBundleEncoder; +class RenderPassEncoder; +class RenderPipeline; +class Sampler; +class ShaderModule; +class SharedBufferMemory; +class SharedFence; +class SharedTextureMemory; +class Surface; +class SwapChain; +class Texture; +class TextureView; + +struct AdapterProperties; +struct AdapterPropertiesD3D; +struct AdapterPropertiesVk; +struct BindGroupEntry; +struct BlendComponent; +struct BufferBindingLayout; +struct BufferDescriptor; +struct BufferHostMappedPointer; +struct BufferMapCallbackInfo; +struct Color; +struct CommandBufferDescriptor; +struct CommandEncoderDescriptor; +struct CompilationInfoCallbackInfo; +struct CompilationMessage; +struct ComputePassTimestampWrites; +struct ConstantEntry; +struct CopyTextureForBrowserOptions; +struct CreateComputePipelineAsyncCallbackInfo; +struct CreateRenderPipelineAsyncCallbackInfo; +struct DawnWGSLBlocklist; +struct DawnAdapterPropertiesPowerPreference; +struct DawnBufferDescriptorErrorInfoFromWireClient; +struct DawnCacheDeviceDescriptor; +struct DawnComputePipelineFullSubgroups; +struct DawnEncoderInternalUsageDescriptor; +struct DawnExperimentalSubgroupLimits; +struct DawnMultisampleStateRenderToSingleSampled; +struct DawnRenderPassColorAttachmentRenderToSingleSampled; +struct DawnShaderModuleSPIRVOptionsDescriptor; +struct DawnTextureInternalUsageDescriptor; +struct DawnTogglesDescriptor; +struct DawnWireWGSLControl; +struct DepthStencilStateDepthWriteDefinedDawn; +struct DrmFormatProperties; +struct Extent2D; +struct Extent3D; +struct ExternalTextureBindingEntry; +struct ExternalTextureBindingLayout; +struct FormatCapabilities; +struct Future; +struct InstanceFeatures; +struct Limits; +struct MemoryHeapInfo; +struct MultisampleState; +struct Origin2D; +struct Origin3D; +struct PipelineLayoutDescriptor; +struct PipelineLayoutStorageAttachment; +struct PopErrorScopeCallbackInfo; +struct PrimitiveDepthClipControl; +struct PrimitiveState; +struct QuerySetDescriptor; +struct QueueDescriptor; +struct QueueWorkDoneCallbackInfo; +struct RenderBundleDescriptor; +struct RenderBundleEncoderDescriptor; +struct RenderPassDepthStencilAttachment; +struct RenderPassDescriptorMaxDrawCount; +struct RenderPassTimestampWrites; +struct RequestAdapterCallbackInfo; +struct RequestAdapterOptions; +struct RequestDeviceCallbackInfo; +struct SamplerBindingLayout; +struct SamplerDescriptor; +struct ShaderModuleSPIRVDescriptor; +struct ShaderModuleWGSLDescriptor; +struct ShaderModuleDescriptor; +struct SharedBufferMemoryBeginAccessDescriptor; +struct SharedBufferMemoryDescriptor; +struct SharedBufferMemoryEndAccessState; +struct SharedBufferMemoryProperties; +struct SharedFenceDXGISharedHandleDescriptor; +struct SharedFenceDXGISharedHandleExportInfo; +struct SharedFenceMTLSharedEventDescriptor; +struct SharedFenceMTLSharedEventExportInfo; +struct SharedFenceDescriptor; +struct SharedFenceExportInfo; +struct SharedFenceVkSemaphoreOpaqueFDDescriptor; +struct SharedFenceVkSemaphoreOpaqueFDExportInfo; +struct SharedFenceVkSemaphoreSyncFDDescriptor; +struct SharedFenceVkSemaphoreSyncFDExportInfo; +struct SharedFenceVkSemaphoreZirconHandleDescriptor; +struct SharedFenceVkSemaphoreZirconHandleExportInfo; +struct SharedTextureMemoryDXGISharedHandleDescriptor; +struct SharedTextureMemoryEGLImageDescriptor; +struct SharedTextureMemoryIOSurfaceDescriptor; +struct SharedTextureMemoryAHardwareBufferDescriptor; +struct SharedTextureMemoryBeginAccessDescriptor; +struct SharedTextureMemoryDescriptor; +struct SharedTextureMemoryDmaBufPlane; +struct SharedTextureMemoryEndAccessState; +struct SharedTextureMemoryOpaqueFDDescriptor; +struct SharedTextureMemoryVkDedicatedAllocationDescriptor; +struct SharedTextureMemoryVkImageLayoutBeginState; +struct SharedTextureMemoryVkImageLayoutEndState; +struct SharedTextureMemoryZirconHandleDescriptor; +struct StaticSamplerBindingLayout; +struct StencilFaceState; +struct StorageTextureBindingLayout; +struct SurfaceDescriptor; +struct SurfaceDescriptorFromAndroidNativeWindow; +struct SurfaceDescriptorFromCanvasHTMLSelector; +struct SurfaceDescriptorFromMetalLayer; +struct SurfaceDescriptorFromWaylandSurface; +struct SurfaceDescriptorFromWindowsHWND; +struct SurfaceDescriptorFromWindowsCoreWindow; +struct SurfaceDescriptorFromWindowsSwapChainPanel; +struct SurfaceDescriptorFromXlibWindow; +struct SwapChainDescriptor; +struct TextureBindingLayout; +struct TextureBindingViewDimensionDescriptor; +struct TextureDataLayout; +struct TextureViewDescriptor; +struct VertexAttribute; +struct AdapterPropertiesMemoryHeaps; +struct BindGroupDescriptor; +struct BindGroupLayoutEntry; +struct BlendState; +struct CompilationInfo; +struct ComputePassDescriptor; +struct DepthStencilState; +struct DrmFormatCapabilities; +struct ExternalTextureDescriptor; +struct FutureWaitInfo; +struct ImageCopyBuffer; +struct ImageCopyExternalTexture; +struct ImageCopyTexture; +struct InstanceDescriptor; +struct PipelineLayoutPixelLocalStorage; +struct ProgrammableStageDescriptor; +struct RenderPassColorAttachment; +struct RenderPassStorageAttachment; +struct RequiredLimits; +struct SharedTextureMemoryDmaBufDescriptor; +struct SharedTextureMemoryProperties; +struct SharedTextureMemoryVkImageDescriptor; +struct SupportedLimits; +struct TextureDescriptor; +struct VertexBufferLayout; +struct BindGroupLayoutDescriptor; +struct ColorTargetState; +struct ComputePipelineDescriptor; +struct DeviceDescriptor; +struct RenderPassDescriptor; +struct RenderPassPixelLocalStorage; +struct VertexState; +struct FragmentState; +struct RenderPipelineDescriptor; + +// Special class for booleans in order to allow implicit conversions. +class Bool { +public: + constexpr Bool() = default; + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction + constexpr Bool(bool value) : mValue(static_cast(value)) {} + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction + Bool(WGPUBool value) : mValue(value) {} + + constexpr operator bool() const { return static_cast(mValue); } + +private: + friend struct std::hash; + // Default to false. + WGPUBool mValue = static_cast(false); +}; + +template class ObjectBase { +public: + ObjectBase() = default; + ObjectBase(CType handle) : mHandle(handle) { + if (mHandle) + Derived::WGPUReference(mHandle); + } + ~ObjectBase() { + if (mHandle) + Derived::WGPURelease(mHandle); + } + + ObjectBase(ObjectBase const &other) : ObjectBase(other.Get()) {} + Derived &operator=(ObjectBase const &other) { + if (&other != this) { + if (mHandle) + Derived::WGPURelease(mHandle); + mHandle = other.mHandle; + if (mHandle) + Derived::WGPUReference(mHandle); + } + + return static_cast(*this); + } + + ObjectBase(ObjectBase &&other) { + mHandle = other.mHandle; + other.mHandle = 0; + } + Derived &operator=(ObjectBase &&other) { + if (&other != this) { + if (mHandle) + Derived::WGPURelease(mHandle); + mHandle = other.mHandle; + other.mHandle = 0; + } + + return static_cast(*this); + } + + ObjectBase(std::nullptr_t) {} + Derived &operator=(std::nullptr_t) { + if (mHandle != nullptr) { + Derived::WGPURelease(mHandle); + mHandle = nullptr; + } + return static_cast(*this); + } + + bool operator==(std::nullptr_t) const { return mHandle == nullptr; } + bool operator!=(std::nullptr_t) const { return mHandle != nullptr; } + + explicit operator bool() const { return mHandle != nullptr; } + CType Get() const { return mHandle; } + CType MoveToCHandle() { + CType result = mHandle; + mHandle = 0; + return result; + } + static Derived Acquire(CType handle) { + Derived result; + result.mHandle = handle; + return result; + } + +protected: + CType mHandle = nullptr; +}; + +class Adapter : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Device CreateDevice(DeviceDescriptor const *descriptor = nullptr) const; + size_t EnumerateFeatures(FeatureName *features) const; + Bool GetFormatCapabilities(TextureFormat format, + FormatCapabilities *capabilities) const; + Instance GetInstance() const; + Bool GetLimits(SupportedLimits *limits) const; + void GetProperties(AdapterProperties *properties) const; + Bool HasFeature(FeatureName feature) const; + void RequestDevice(DeviceDescriptor const *descriptor, + RequestDeviceCallback callback, void *userdata) const; + Future RequestDevice(DeviceDescriptor const *options, + RequestDeviceCallbackInfo callbackInfo) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUAdapter handle); + static void WGPURelease(WGPUAdapter handle); +}; + +class BindGroup : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUBindGroup handle); + static void WGPURelease(WGPUBindGroup handle); +}; + +class BindGroupLayout + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUBindGroupLayout handle); + static void WGPURelease(WGPUBindGroupLayout handle); +}; + +class Buffer : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + void const *GetConstMappedRange(size_t offset = 0, + size_t size = WGPU_WHOLE_MAP_SIZE) const; + BufferMapState GetMapState() const; + void *GetMappedRange(size_t offset = 0, + size_t size = WGPU_WHOLE_MAP_SIZE) const; + uint64_t GetSize() const; + BufferUsage GetUsage() const; + void MapAsync(MapMode mode, size_t offset, size_t size, + BufferMapCallback callback, void *userdata) const; + Future MapAsync(MapMode mode, size_t offset, size_t size, + BufferMapCallbackInfo callbackInfo) const; + void SetLabel(char const *label) const; + void Unmap() const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUBuffer handle); + static void WGPURelease(WGPUBuffer handle); +}; + +class CommandBuffer : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUCommandBuffer handle); + static void WGPURelease(WGPUCommandBuffer handle); +}; + +class CommandEncoder : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + ComputePassEncoder + BeginComputePass(ComputePassDescriptor const *descriptor = nullptr) const; + RenderPassEncoder + BeginRenderPass(RenderPassDescriptor const *descriptor) const; + void ClearBuffer(Buffer const &buffer, uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void CopyBufferToBuffer(Buffer const &source, uint64_t sourceOffset, + Buffer const &destination, uint64_t destinationOffset, + uint64_t size) const; + void CopyBufferToTexture(ImageCopyBuffer const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize) const; + void CopyTextureToBuffer(ImageCopyTexture const *source, + ImageCopyBuffer const *destination, + Extent3D const *copySize) const; + void CopyTextureToTexture(ImageCopyTexture const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize) const; + CommandBuffer + Finish(CommandBufferDescriptor const *descriptor = nullptr) const; + void InjectValidationError(char const *message) const; + void InsertDebugMarker(char const *markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void ResolveQuerySet(QuerySet const &querySet, uint32_t firstQuery, + uint32_t queryCount, Buffer const &destination, + uint64_t destinationOffset) const; + void SetLabel(char const *label) const; + void WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, + uint8_t const *data, uint64_t size) const; + void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUCommandEncoder handle); + static void WGPURelease(WGPUCommandEncoder handle); +}; + +class ComputePassEncoder + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void DispatchWorkgroups(uint32_t workgroupCountX, + uint32_t workgroupCountY = 1, + uint32_t workgroupCountZ = 1) const; + void DispatchWorkgroupsIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void End() const; + void InsertDebugMarker(char const *markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const &group, + size_t dynamicOffsetCount = 0, + uint32_t const *dynamicOffsets = nullptr) const; + void SetLabel(char const *label) const; + void SetPipeline(ComputePipeline const &pipeline) const; + void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUComputePassEncoder handle); + static void WGPURelease(WGPUComputePassEncoder handle); +}; + +class ComputePipeline + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUComputePipeline handle); + static void WGPURelease(WGPUComputePipeline handle); +}; + +class Device : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroup CreateBindGroup(BindGroupDescriptor const *descriptor) const; + BindGroupLayout + CreateBindGroupLayout(BindGroupLayoutDescriptor const *descriptor) const; + Buffer CreateBuffer(BufferDescriptor const *descriptor) const; + CommandEncoder CreateCommandEncoder( + CommandEncoderDescriptor const *descriptor = nullptr) const; + ComputePipeline + CreateComputePipeline(ComputePipelineDescriptor const *descriptor) const; + void CreateComputePipelineAsync(ComputePipelineDescriptor const *descriptor, + CreateComputePipelineAsyncCallback callback, + void *userdata) const; + Future CreateComputePipelineAsync( + ComputePipelineDescriptor const *descriptor, + CreateComputePipelineAsyncCallbackInfo callbackInfo) const; + Buffer CreateErrorBuffer(BufferDescriptor const *descriptor) const; + ExternalTexture CreateErrorExternalTexture() const; + ShaderModule CreateErrorShaderModule(ShaderModuleDescriptor const *descriptor, + char const *errorMessage) const; + Texture CreateErrorTexture(TextureDescriptor const *descriptor) const; + ExternalTexture CreateExternalTexture( + ExternalTextureDescriptor const *externalTextureDescriptor) const; + PipelineLayout + CreatePipelineLayout(PipelineLayoutDescriptor const *descriptor) const; + QuerySet CreateQuerySet(QuerySetDescriptor const *descriptor) const; + RenderBundleEncoder CreateRenderBundleEncoder( + RenderBundleEncoderDescriptor const *descriptor) const; + RenderPipeline + CreateRenderPipeline(RenderPipelineDescriptor const *descriptor) const; + void CreateRenderPipelineAsync(RenderPipelineDescriptor const *descriptor, + CreateRenderPipelineAsyncCallback callback, + void *userdata) const; + Future CreateRenderPipelineAsync( + RenderPipelineDescriptor const *descriptor, + CreateRenderPipelineAsyncCallbackInfo callbackInfo) const; + Sampler CreateSampler(SamplerDescriptor const *descriptor = nullptr) const; + ShaderModule + CreateShaderModule(ShaderModuleDescriptor const *descriptor) const; + SwapChain CreateSwapChain(Surface const &surface, + SwapChainDescriptor const *descriptor) const; + Texture CreateTexture(TextureDescriptor const *descriptor) const; + void Destroy() const; + size_t EnumerateFeatures(FeatureName *features) const; + void ForceLoss(DeviceLostReason type, char const *message) const; + Adapter GetAdapter() const; + Bool GetLimits(SupportedLimits *limits) const; + Queue GetQueue() const; + TextureUsage GetSupportedSurfaceUsage(Surface const &surface) const; + Bool HasFeature(FeatureName feature) const; + SharedBufferMemory ImportSharedBufferMemory( + SharedBufferMemoryDescriptor const *descriptor) const; + SharedFence ImportSharedFence(SharedFenceDescriptor const *descriptor) const; + SharedTextureMemory ImportSharedTextureMemory( + SharedTextureMemoryDescriptor const *descriptor) const; + void InjectError(ErrorType type, char const *message) const; + void PopErrorScope(ErrorCallback oldCallback, void *userdata) const; + Future PopErrorScope(PopErrorScopeCallbackInfo callbackInfo) const; + void PushErrorScope(ErrorFilter filter) const; + void SetDeviceLostCallback(DeviceLostCallback callback, void *userdata) const; + void SetLabel(char const *label) const; + void SetLoggingCallback(LoggingCallback callback, void *userdata) const; + void SetUncapturedErrorCallback(ErrorCallback callback, void *userdata) const; + void Tick() const; + void ValidateTextureDescriptor(TextureDescriptor const *descriptor) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUDevice handle); + static void WGPURelease(WGPUDevice handle); +}; + +class ExternalTexture + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + void Expire() const; + void Refresh() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUExternalTexture handle); + static void WGPURelease(WGPUExternalTexture handle); +}; + +class Instance : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Surface CreateSurface(SurfaceDescriptor const *descriptor) const; + size_t EnumerateWGSLLanguageFeatures(WGSLFeatureName *features) const; + Bool HasWGSLLanguageFeature(WGSLFeatureName feature) const; + void ProcessEvents() const; + void RequestAdapter(RequestAdapterOptions const *options, + RequestAdapterCallback callback, void *userdata) const; + Future RequestAdapter(RequestAdapterOptions const *options, + RequestAdapterCallbackInfo callbackInfo) const; + WaitStatus WaitAny(size_t futureCount, FutureWaitInfo *futures, + uint64_t timeoutNS) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUInstance handle); + static void WGPURelease(WGPUInstance handle); +}; + +class PipelineLayout : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUPipelineLayout handle); + static void WGPURelease(WGPUPipelineLayout handle); +}; + +class QuerySet : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Destroy() const; + uint32_t GetCount() const; + QueryType GetType() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUQuerySet handle); + static void WGPURelease(WGPUQuerySet handle); +}; + +class Queue : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void CopyExternalTextureForBrowser( + ImageCopyExternalTexture const *source, + ImageCopyTexture const *destination, Extent3D const *copySize, + CopyTextureForBrowserOptions const *options) const; + void CopyTextureForBrowser(ImageCopyTexture const *source, + ImageCopyTexture const *destination, + Extent3D const *copySize, + CopyTextureForBrowserOptions const *options) const; + void OnSubmittedWorkDone(QueueWorkDoneCallback callback, + void *userdata) const; + Future OnSubmittedWorkDone(QueueWorkDoneCallbackInfo callbackInfo) const; + void SetLabel(char const *label) const; + void Submit(size_t commandCount, CommandBuffer const *commands) const; + void WriteBuffer(Buffer const &buffer, uint64_t bufferOffset, + void const *data, size_t size) const; + void WriteTexture(ImageCopyTexture const *destination, void const *data, + size_t dataSize, TextureDataLayout const *dataLayout, + Extent3D const *writeSize) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUQueue handle); + static void WGPURelease(WGPUQueue handle); +}; + +class RenderBundle : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderBundle handle); + static void WGPURelease(WGPURenderBundle handle); +}; + +class RenderBundleEncoder + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, + uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, + uint32_t firstIndex = 0, int32_t baseVertex = 0, + uint32_t firstInstance = 0) const; + void DrawIndexedIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void DrawIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + RenderBundle Finish(RenderBundleDescriptor const *descriptor = nullptr) const; + void InsertDebugMarker(char const *markerLabel) const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const &group, + size_t dynamicOffsetCount = 0, + uint32_t const *dynamicOffsets = nullptr) const; + void SetIndexBuffer(Buffer const &buffer, IndexFormat format, + uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void SetLabel(char const *label) const; + void SetPipeline(RenderPipeline const &pipeline) const; + void SetVertexBuffer(uint32_t slot, Buffer const &buffer, uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderBundleEncoder handle); + static void WGPURelease(WGPURenderBundleEncoder handle); +}; + +class RenderPassEncoder + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void BeginOcclusionQuery(uint32_t queryIndex) const; + void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, + uint32_t firstVertex = 0, uint32_t firstInstance = 0) const; + void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, + uint32_t firstIndex = 0, int32_t baseVertex = 0, + uint32_t firstInstance = 0) const; + void DrawIndexedIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void DrawIndirect(Buffer const &indirectBuffer, + uint64_t indirectOffset) const; + void End() const; + void EndOcclusionQuery() const; + void ExecuteBundles(size_t bundleCount, RenderBundle const *bundles) const; + void InsertDebugMarker(char const *markerLabel) const; + void PixelLocalStorageBarrier() const; + void PopDebugGroup() const; + void PushDebugGroup(char const *groupLabel) const; + void SetBindGroup(uint32_t groupIndex, BindGroup const &group, + size_t dynamicOffsetCount = 0, + uint32_t const *dynamicOffsets = nullptr) const; + void SetBlendConstant(Color const *color) const; + void SetIndexBuffer(Buffer const &buffer, IndexFormat format, + uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void SetLabel(char const *label) const; + void SetPipeline(RenderPipeline const &pipeline) const; + void SetScissorRect(uint32_t x, uint32_t y, uint32_t width, + uint32_t height) const; + void SetStencilReference(uint32_t reference) const; + void SetVertexBuffer(uint32_t slot, Buffer const &buffer, uint64_t offset = 0, + uint64_t size = WGPU_WHOLE_SIZE) const; + void SetViewport(float x, float y, float width, float height, float minDepth, + float maxDepth) const; + void WriteTimestamp(QuerySet const &querySet, uint32_t queryIndex) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderPassEncoder handle); + static void WGPURelease(WGPURenderPassEncoder handle); +}; + +class RenderPipeline : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + BindGroupLayout GetBindGroupLayout(uint32_t groupIndex) const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPURenderPipeline handle); + static void WGPURelease(WGPURenderPipeline handle); +}; + +class Sampler : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSampler handle); + static void WGPURelease(WGPUSampler handle); +}; + +class ShaderModule : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void GetCompilationInfo(CompilationInfoCallback callback, + void *userdata) const; + Future GetCompilationInfo(CompilationInfoCallbackInfo callbackInfo) const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUShaderModule handle); + static void WGPURelease(WGPUShaderModule handle); +}; + +class SharedBufferMemory + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Bool + BeginAccess(Buffer const &buffer, + SharedBufferMemoryBeginAccessDescriptor const *descriptor) const; + Buffer CreateBuffer(BufferDescriptor const *descriptor = nullptr) const; + Bool EndAccess(Buffer const &buffer, + SharedBufferMemoryEndAccessState *descriptor) const; + void GetProperties(SharedBufferMemoryProperties *properties) const; + Bool IsDeviceLost() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSharedBufferMemory handle); + static void WGPURelease(WGPUSharedBufferMemory handle); +}; + +class SharedFence : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void ExportInfo(SharedFenceExportInfo *info) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSharedFence handle); + static void WGPURelease(WGPUSharedFence handle); +}; + +class SharedTextureMemory + : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Bool + BeginAccess(Texture const &texture, + SharedTextureMemoryBeginAccessDescriptor const *descriptor) const; + Texture CreateTexture(TextureDescriptor const *descriptor = nullptr) const; + Bool EndAccess(Texture const &texture, + SharedTextureMemoryEndAccessState *descriptor) const; + void GetProperties(SharedTextureMemoryProperties *properties) const; + Bool IsDeviceLost() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSharedTextureMemory handle); + static void WGPURelease(WGPUSharedTextureMemory handle); +}; + +class Surface : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + TextureFormat GetPreferredFormat(Adapter const &adapter) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSurface handle); + static void WGPURelease(WGPUSurface handle); +}; + +class SwapChain : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + Texture GetCurrentTexture() const; + TextureView GetCurrentTextureView() const; + void Present() const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUSwapChain handle); + static void WGPURelease(WGPUSwapChain handle); +}; + +class Texture : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + TextureView + CreateErrorView(TextureViewDescriptor const *descriptor = nullptr) const; + TextureView + CreateView(TextureViewDescriptor const *descriptor = nullptr) const; + void Destroy() const; + uint32_t GetDepthOrArrayLayers() const; + TextureDimension GetDimension() const; + TextureFormat GetFormat() const; + uint32_t GetHeight() const; + uint32_t GetMipLevelCount() const; + uint32_t GetSampleCount() const; + TextureUsage GetUsage() const; + uint32_t GetWidth() const; + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUTexture handle); + static void WGPURelease(WGPUTexture handle); +}; + +class TextureView : public ObjectBase { +public: + using ObjectBase::ObjectBase; + using ObjectBase::operator=; + + void SetLabel(char const *label) const; + +private: + friend ObjectBase; + static void WGPUReference(WGPUTextureView handle); + static void WGPURelease(WGPUTextureView handle); +}; + +Instance CreateInstance(InstanceDescriptor const *descriptor = nullptr); +Bool GetInstanceFeatures(InstanceFeatures *features); +Proc GetProcAddress(Device device, char const *procName); + +struct AdapterProperties { + AdapterProperties() = default; + ~AdapterProperties(); + AdapterProperties(const AdapterProperties &) = delete; + AdapterProperties &operator=(const AdapterProperties &) = delete; + AdapterProperties(AdapterProperties &&); + AdapterProperties &operator=(AdapterProperties &&); + ChainedStructOut *nextInChain = nullptr; + uint32_t const vendorID = {}; + char const *const vendorName = nullptr; + char const *const architecture = nullptr; + uint32_t const deviceID = {}; + char const *const name = nullptr; + char const *const driverDescription = nullptr; + AdapterType const adapterType = {}; + BackendType const backendType = {}; + Bool const compatibilityMode = false; +}; + +// Can be chained in AdapterProperties +struct AdapterPropertiesD3D : ChainedStructOut { + AdapterPropertiesD3D() { sType = SType::AdapterPropertiesD3D; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t shaderModel; +}; + +// Can be chained in AdapterProperties +struct AdapterPropertiesVk : ChainedStructOut { + AdapterPropertiesVk() { sType = SType::AdapterPropertiesVk; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t driverVersion; +}; + +struct BindGroupEntry { + ChainedStruct const *nextInChain = nullptr; + uint32_t binding; + Buffer buffer = nullptr; + uint64_t offset = 0; + uint64_t size = WGPU_WHOLE_SIZE; + Sampler sampler = nullptr; + TextureView textureView = nullptr; +}; + +struct BlendComponent { + BlendOperation operation = BlendOperation::Add; + BlendFactor srcFactor = BlendFactor::One; + BlendFactor dstFactor = BlendFactor::Zero; +}; + +struct BufferBindingLayout { + ChainedStruct const *nextInChain = nullptr; + BufferBindingType type = BufferBindingType::Undefined; + Bool hasDynamicOffset = false; + uint64_t minBindingSize = 0; +}; + +struct BufferDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + BufferUsage usage; + uint64_t size; + Bool mappedAtCreation = false; +}; + +// Can be chained in BufferDescriptor +struct BufferHostMappedPointer : ChainedStruct { + BufferHostMappedPointer() { sType = SType::BufferHostMappedPointer; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *pointer; + Callback disposeCallback; + void *userdata; +}; + +struct BufferMapCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + BufferMapCallback callback; + void *userdata; +}; + +struct Color { + double r; + double g; + double b; + double a; +}; + +struct CommandBufferDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct CommandEncoderDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct CompilationInfoCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + CompilationInfoCallback callback; + void *userdata = nullptr; +}; + +struct CompilationMessage { + ChainedStruct const *nextInChain = nullptr; + char const *message = nullptr; + CompilationMessageType type; + uint64_t lineNum; + uint64_t linePos; + uint64_t offset; + uint64_t length; + uint64_t utf16LinePos; + uint64_t utf16Offset; + uint64_t utf16Length; +}; + +struct ComputePassTimestampWrites { + QuerySet querySet; + uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; +}; + +struct ConstantEntry { + ChainedStruct const *nextInChain = nullptr; + char const *key; + double value; +}; + +struct CopyTextureForBrowserOptions { + ChainedStruct const *nextInChain = nullptr; + Bool flipY = false; + Bool needsColorSpaceConversion = false; + AlphaMode srcAlphaMode = AlphaMode::Unpremultiplied; + float const *srcTransferFunctionParameters = nullptr; + float const *conversionMatrix = nullptr; + float const *dstTransferFunctionParameters = nullptr; + AlphaMode dstAlphaMode = AlphaMode::Unpremultiplied; + Bool internalUsage = false; +}; + +struct CreateComputePipelineAsyncCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + CreateComputePipelineAsyncCallback callback; + void *userdata; +}; + +struct CreateRenderPipelineAsyncCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + CreateRenderPipelineAsyncCallback callback; + void *userdata; +}; + +// Can be chained in InstanceDescriptor +struct DawnWGSLBlocklist : ChainedStruct { + DawnWGSLBlocklist() { sType = SType::DawnWGSLBlocklist; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); + alignas(kFirstMemberAlignment) size_t blocklistedFeatureCount = 0; + const char *const *blocklistedFeatures; +}; + +// Can be chained in AdapterProperties +struct DawnAdapterPropertiesPowerPreference : ChainedStructOut { + DawnAdapterPropertiesPowerPreference() { + sType = SType::DawnAdapterPropertiesPowerPreference; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(PowerPreference)); + alignas(kFirstMemberAlignment) + PowerPreference powerPreference = PowerPreference::Undefined; +}; + +// Can be chained in BufferDescriptor +struct DawnBufferDescriptorErrorInfoFromWireClient : ChainedStruct { + DawnBufferDescriptorErrorInfoFromWireClient() { + sType = SType::DawnBufferDescriptorErrorInfoFromWireClient; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool outOfMemory = false; +}; + +// Can be chained in DeviceDescriptor +struct DawnCacheDeviceDescriptor : ChainedStruct { + DawnCacheDeviceDescriptor() { sType = SType::DawnCacheDeviceDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); + alignas(kFirstMemberAlignment) char const *isolationKey = ""; + DawnLoadCacheDataFunction loadDataFunction = nullptr; + DawnStoreCacheDataFunction storeDataFunction = nullptr; + void *functionUserdata = nullptr; +}; + +// Can be chained in ComputePipelineDescriptor +struct DawnComputePipelineFullSubgroups : ChainedStruct { + DawnComputePipelineFullSubgroups() { + sType = SType::DawnComputePipelineFullSubgroups; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool requiresFullSubgroups = false; +}; + +// Can be chained in CommandEncoderDescriptor +struct DawnEncoderInternalUsageDescriptor : ChainedStruct { + DawnEncoderInternalUsageDescriptor() { + sType = SType::DawnEncoderInternalUsageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool useInternalUsages = false; +}; + +// Can be chained in SupportedLimits +struct DawnExperimentalSubgroupLimits : ChainedStructOut { + DawnExperimentalSubgroupLimits() { + sType = SType::DawnExperimentalSubgroupLimits; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t minSubgroupSize = + WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSubgroupSize = WGPU_LIMIT_U32_UNDEFINED; +}; + +// Can be chained in MultisampleState +struct DawnMultisampleStateRenderToSingleSampled : ChainedStruct { + DawnMultisampleStateRenderToSingleSampled() { + sType = SType::DawnMultisampleStateRenderToSingleSampled; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool enabled = false; +}; + +// Can be chained in RenderPassColorAttachment +struct DawnRenderPassColorAttachmentRenderToSingleSampled : ChainedStruct { + DawnRenderPassColorAttachmentRenderToSingleSampled() { + sType = SType::DawnRenderPassColorAttachmentRenderToSingleSampled; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t implicitSampleCount = 1; +}; + +// Can be chained in ShaderModuleDescriptor +struct DawnShaderModuleSPIRVOptionsDescriptor : ChainedStruct { + DawnShaderModuleSPIRVOptionsDescriptor() { + sType = SType::DawnShaderModuleSPIRVOptionsDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool allowNonUniformDerivatives = false; +}; + +// Can be chained in TextureDescriptor +struct DawnTextureInternalUsageDescriptor : ChainedStruct { + DawnTextureInternalUsageDescriptor() { + sType = SType::DawnTextureInternalUsageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(TextureUsage)); + alignas(kFirstMemberAlignment) + TextureUsage internalUsage = TextureUsage::None; +}; + +// Can be chained in InstanceDescriptor +// Can be chained in RequestAdapterOptions +// Can be chained in DeviceDescriptor +struct DawnTogglesDescriptor : ChainedStruct { + DawnTogglesDescriptor() { sType = SType::DawnTogglesDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); + alignas(kFirstMemberAlignment) size_t enabledToggleCount = 0; + const char *const *enabledToggles; + size_t disabledToggleCount = 0; + const char *const *disabledToggles; +}; + +// Can be chained in InstanceDescriptor +struct DawnWireWGSLControl : ChainedStruct { + DawnWireWGSLControl() { sType = SType::DawnWireWGSLControl; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool enableExperimental = false; + Bool enableUnsafe = false; + Bool enableTesting = false; +}; + +// Can be chained in DepthStencilState +struct DepthStencilStateDepthWriteDefinedDawn : ChainedStruct { + DepthStencilStateDepthWriteDefinedDawn() { + sType = SType::DepthStencilStateDepthWriteDefinedDawn; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool depthWriteDefined; +}; + +struct DrmFormatProperties { + uint64_t modifier; + uint32_t modifierPlaneCount; +}; + +struct Extent2D { + uint32_t width; + uint32_t height; +}; + +struct Extent3D { + uint32_t width; + uint32_t height = 1; + uint32_t depthOrArrayLayers = 1; +}; + +// Can be chained in BindGroupEntry +struct ExternalTextureBindingEntry : ChainedStruct { + ExternalTextureBindingEntry() { sType = SType::ExternalTextureBindingEntry; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(ExternalTexture)); + alignas(kFirstMemberAlignment) ExternalTexture externalTexture; +}; + +// Can be chained in BindGroupLayoutEntry +struct ExternalTextureBindingLayout : ChainedStruct { + ExternalTextureBindingLayout() { + sType = SType::ExternalTextureBindingLayout; + } +}; + +struct FormatCapabilities { + ChainedStructOut *nextInChain = nullptr; +}; + +struct Future { + uint64_t id; +}; + +struct InstanceFeatures { + ChainedStruct const *nextInChain = nullptr; + Bool timedWaitAnyEnable = false; + size_t timedWaitAnyMaxCount = 0; +}; + +struct Limits { + uint32_t maxTextureDimension1D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureDimension2D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureDimension3D = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxTextureArrayLayers = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindGroups = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindGroupsPlusVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxBindingsPerBindGroup = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxDynamicUniformBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxDynamicStorageBuffersPerPipelineLayout = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSampledTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxSamplersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxStorageBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxStorageTexturesPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxUniformBuffersPerShaderStage = WGPU_LIMIT_U32_UNDEFINED; + uint64_t maxUniformBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; + uint64_t maxStorageBufferBindingSize = WGPU_LIMIT_U64_UNDEFINED; + uint32_t minUniformBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; + uint32_t minStorageBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxVertexBuffers = WGPU_LIMIT_U32_UNDEFINED; + uint64_t maxBufferSize = WGPU_LIMIT_U64_UNDEFINED; + uint32_t maxVertexAttributes = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxVertexBufferArrayStride = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxInterStageShaderComponents = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxInterStageShaderVariables = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxColorAttachments = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxColorAttachmentBytesPerSample = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupStorageSize = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeInvocationsPerWorkgroup = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeX = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeY = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupSizeZ = WGPU_LIMIT_U32_UNDEFINED; + uint32_t maxComputeWorkgroupsPerDimension = WGPU_LIMIT_U32_UNDEFINED; +}; + +struct MemoryHeapInfo { + HeapProperty properties; + uint64_t size; +}; + +struct MultisampleState { + ChainedStruct const *nextInChain = nullptr; + uint32_t count = 1; + uint32_t mask = 0xFFFFFFFF; + Bool alphaToCoverageEnabled = false; +}; + +struct Origin2D { + uint32_t x = 0; + uint32_t y = 0; +}; + +struct Origin3D { + uint32_t x = 0; + uint32_t y = 0; + uint32_t z = 0; +}; + +struct PipelineLayoutDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t bindGroupLayoutCount; + BindGroupLayout const *bindGroupLayouts; +}; + +struct PipelineLayoutStorageAttachment { + ChainedStruct const *nextInChain = nullptr; + uint64_t offset = 0; + TextureFormat format; +}; + +struct PopErrorScopeCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + PopErrorScopeCallback callback; + ErrorCallback oldCallback; + void *userdata = nullptr; +}; + +// Can be chained in PrimitiveState +struct PrimitiveDepthClipControl : ChainedStruct { + PrimitiveDepthClipControl() { sType = SType::PrimitiveDepthClipControl; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool unclippedDepth = false; +}; + +struct PrimitiveState { + ChainedStruct const *nextInChain = nullptr; + PrimitiveTopology topology = PrimitiveTopology::TriangleList; + IndexFormat stripIndexFormat = IndexFormat::Undefined; + FrontFace frontFace = FrontFace::CCW; + CullMode cullMode = CullMode::None; +}; + +struct QuerySetDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + QueryType type; + uint32_t count; +}; + +struct QueueDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct QueueWorkDoneCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + QueueWorkDoneCallback callback; + void *userdata; +}; + +struct RenderBundleDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct RenderBundleEncoderDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t colorFormatCount; + TextureFormat const *colorFormats; + TextureFormat depthStencilFormat = TextureFormat::Undefined; + uint32_t sampleCount = 1; + Bool depthReadOnly = false; + Bool stencilReadOnly = false; +}; + +struct RenderPassDepthStencilAttachment { + TextureView view; + LoadOp depthLoadOp = LoadOp::Undefined; + StoreOp depthStoreOp = StoreOp::Undefined; + float depthClearValue = NAN; + Bool depthReadOnly = false; + LoadOp stencilLoadOp = LoadOp::Undefined; + StoreOp stencilStoreOp = StoreOp::Undefined; + uint32_t stencilClearValue = 0; + Bool stencilReadOnly = false; +}; + +// Can be chained in RenderPassDescriptor +struct RenderPassDescriptorMaxDrawCount : ChainedStruct { + RenderPassDescriptorMaxDrawCount() { + sType = SType::RenderPassDescriptorMaxDrawCount; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); + alignas(kFirstMemberAlignment) uint64_t maxDrawCount = 50000000; +}; + +struct RenderPassTimestampWrites { + QuerySet querySet; + uint32_t beginningOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; + uint32_t endOfPassWriteIndex = WGPU_QUERY_SET_INDEX_UNDEFINED; +}; + +struct RequestAdapterCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + RequestAdapterCallback callback; + void *userdata; +}; + +struct RequestAdapterOptions { + ChainedStruct const *nextInChain = nullptr; + Surface compatibleSurface = nullptr; + PowerPreference powerPreference = PowerPreference::Undefined; + BackendType backendType = BackendType::Undefined; + Bool forceFallbackAdapter = false; + Bool compatibilityMode = false; +}; + +struct RequestDeviceCallbackInfo { + ChainedStruct const *nextInChain = nullptr; + CallbackMode mode; + RequestDeviceCallback callback; + void *userdata; +}; + +struct SamplerBindingLayout { + ChainedStruct const *nextInChain = nullptr; + SamplerBindingType type = SamplerBindingType::Undefined; +}; + +struct SamplerDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + AddressMode addressModeU = AddressMode::ClampToEdge; + AddressMode addressModeV = AddressMode::ClampToEdge; + AddressMode addressModeW = AddressMode::ClampToEdge; + FilterMode magFilter = FilterMode::Nearest; + FilterMode minFilter = FilterMode::Nearest; + MipmapFilterMode mipmapFilter = MipmapFilterMode::Nearest; + float lodMinClamp = 0.0f; + float lodMaxClamp = 32.0f; + CompareFunction compare = CompareFunction::Undefined; + uint16_t maxAnisotropy = 1; +}; + +// Can be chained in ShaderModuleDescriptor +struct ShaderModuleSPIRVDescriptor : ChainedStruct { + ShaderModuleSPIRVDescriptor() { sType = SType::ShaderModuleSPIRVDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t codeSize; + uint32_t const *code; +}; + +// Can be chained in ShaderModuleDescriptor +struct ShaderModuleWGSLDescriptor : ChainedStruct { + ShaderModuleWGSLDescriptor() { sType = SType::ShaderModuleWGSLDescriptor; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); + alignas(kFirstMemberAlignment) char const *code; +}; + +struct ShaderModuleDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct SharedBufferMemoryBeginAccessDescriptor { + ChainedStruct const *nextInChain = nullptr; + Bool initialized; + size_t fenceCount; + SharedFence const *fences; + uint64_t const *signaledValues; +}; + +struct SharedBufferMemoryDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct SharedBufferMemoryEndAccessState { + SharedBufferMemoryEndAccessState() = default; + ~SharedBufferMemoryEndAccessState(); + SharedBufferMemoryEndAccessState(const SharedBufferMemoryEndAccessState &) = + delete; + SharedBufferMemoryEndAccessState & + operator=(const SharedBufferMemoryEndAccessState &) = delete; + SharedBufferMemoryEndAccessState(SharedBufferMemoryEndAccessState &&); + SharedBufferMemoryEndAccessState & + operator=(SharedBufferMemoryEndAccessState &&); + ChainedStructOut *nextInChain = nullptr; + Bool const initialized = {}; + size_t const fenceCount = {}; + SharedFence const *const fences = {}; + uint64_t const *const signaledValues = {}; +}; + +struct SharedBufferMemoryProperties { + ChainedStructOut *nextInChain = nullptr; + BufferUsage usage; + uint64_t size; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceDXGISharedHandleDescriptor : ChainedStruct { + SharedFenceDXGISharedHandleDescriptor() { + sType = SType::SharedFenceDXGISharedHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceDXGISharedHandleExportInfo : ChainedStructOut { + SharedFenceDXGISharedHandleExportInfo() { + sType = SType::SharedFenceDXGISharedHandleExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceMTLSharedEventDescriptor : ChainedStruct { + SharedFenceMTLSharedEventDescriptor() { + sType = SType::SharedFenceMTLSharedEventDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *sharedEvent; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceMTLSharedEventExportInfo : ChainedStructOut { + SharedFenceMTLSharedEventExportInfo() { + sType = SType::SharedFenceMTLSharedEventExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *sharedEvent; +}; + +struct SharedFenceDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct SharedFenceExportInfo { + ChainedStructOut *nextInChain = nullptr; + SharedFenceType type; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceVkSemaphoreOpaqueFDDescriptor : ChainedStruct { + SharedFenceVkSemaphoreOpaqueFDDescriptor() { + sType = SType::SharedFenceVkSemaphoreOpaqueFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceVkSemaphoreOpaqueFDExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreOpaqueFDExportInfo() { + sType = SType::SharedFenceVkSemaphoreOpaqueFDExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceVkSemaphoreSyncFDDescriptor : ChainedStruct { + SharedFenceVkSemaphoreSyncFDDescriptor() { + sType = SType::SharedFenceVkSemaphoreSyncFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceVkSemaphoreSyncFDExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreSyncFDExportInfo() { + sType = SType::SharedFenceVkSemaphoreSyncFDExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int)); + alignas(kFirstMemberAlignment) int handle; +}; + +// Can be chained in SharedFenceDescriptor +struct SharedFenceVkSemaphoreZirconHandleDescriptor : ChainedStruct { + SharedFenceVkSemaphoreZirconHandleDescriptor() { + sType = SType::SharedFenceVkSemaphoreZirconHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t handle; +}; + +// Can be chained in SharedFenceExportInfo +struct SharedFenceVkSemaphoreZirconHandleExportInfo : ChainedStructOut { + SharedFenceVkSemaphoreZirconHandleExportInfo() { + sType = SType::SharedFenceVkSemaphoreZirconHandleExportInfo; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t handle; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryDXGISharedHandleDescriptor : ChainedStruct { + SharedTextureMemoryDXGISharedHandleDescriptor() { + sType = SType::SharedTextureMemoryDXGISharedHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; + Bool useKeyedMutex; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryEGLImageDescriptor : ChainedStruct { + SharedTextureMemoryEGLImageDescriptor() { + sType = SType::SharedTextureMemoryEGLImageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *image; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryIOSurfaceDescriptor : ChainedStruct { + SharedTextureMemoryIOSurfaceDescriptor() { + sType = SType::SharedTextureMemoryIOSurfaceDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *ioSurface; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryAHardwareBufferDescriptor : ChainedStruct { + SharedTextureMemoryAHardwareBufferDescriptor() { + sType = SType::SharedTextureMemoryAHardwareBufferDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *handle; +}; + +struct SharedTextureMemoryBeginAccessDescriptor { + ChainedStruct const *nextInChain = nullptr; + Bool concurrentRead; + Bool initialized; + size_t fenceCount; + SharedFence const *fences; + uint64_t const *signaledValues; +}; + +struct SharedTextureMemoryDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +struct SharedTextureMemoryDmaBufPlane { + int fd; + uint64_t offset; + uint32_t stride; +}; + +struct SharedTextureMemoryEndAccessState { + SharedTextureMemoryEndAccessState() = default; + ~SharedTextureMemoryEndAccessState(); + SharedTextureMemoryEndAccessState(const SharedTextureMemoryEndAccessState &) = + delete; + SharedTextureMemoryEndAccessState & + operator=(const SharedTextureMemoryEndAccessState &) = delete; + SharedTextureMemoryEndAccessState(SharedTextureMemoryEndAccessState &&); + SharedTextureMemoryEndAccessState & + operator=(SharedTextureMemoryEndAccessState &&); + ChainedStructOut *nextInChain = nullptr; + Bool const initialized = {}; + size_t const fenceCount = {}; + SharedFence const *const fences = {}; + uint64_t const *const signaledValues = {}; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryOpaqueFDDescriptor : ChainedStruct { + SharedTextureMemoryOpaqueFDDescriptor() { + sType = SType::SharedTextureMemoryOpaqueFDDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void const *)); + alignas(kFirstMemberAlignment) void const *vkImageCreateInfo; + int memoryFD; + uint32_t memoryTypeIndex; + uint64_t allocationSize; + Bool dedicatedAllocation; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryVkDedicatedAllocationDescriptor : ChainedStruct { + SharedTextureMemoryVkDedicatedAllocationDescriptor() { + sType = SType::SharedTextureMemoryVkDedicatedAllocationDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Bool)); + alignas(kFirstMemberAlignment) Bool dedicatedAllocation; +}; + +// Can be chained in SharedTextureMemoryBeginAccessDescriptor +struct SharedTextureMemoryVkImageLayoutBeginState : ChainedStruct { + SharedTextureMemoryVkImageLayoutBeginState() { + sType = SType::SharedTextureMemoryVkImageLayoutBeginState; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); + alignas(kFirstMemberAlignment) int32_t oldLayout; + int32_t newLayout; +}; + +// Can be chained in SharedTextureMemoryEndAccessState +struct SharedTextureMemoryVkImageLayoutEndState : ChainedStructOut { + SharedTextureMemoryVkImageLayoutEndState() { + sType = SType::SharedTextureMemoryVkImageLayoutEndState; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); + alignas(kFirstMemberAlignment) int32_t oldLayout; + int32_t newLayout; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryZirconHandleDescriptor : ChainedStruct { + SharedTextureMemoryZirconHandleDescriptor() { + sType = SType::SharedTextureMemoryZirconHandleDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint32_t)); + alignas(kFirstMemberAlignment) uint32_t memoryFD; + uint64_t allocationSize; +}; + +// Can be chained in BindGroupLayoutEntry +struct StaticSamplerBindingLayout : ChainedStruct { + StaticSamplerBindingLayout() { sType = SType::StaticSamplerBindingLayout; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Sampler)); + alignas(kFirstMemberAlignment) Sampler sampler; +}; + +struct StencilFaceState { + CompareFunction compare = CompareFunction::Always; + StencilOperation failOp = StencilOperation::Keep; + StencilOperation depthFailOp = StencilOperation::Keep; + StencilOperation passOp = StencilOperation::Keep; +}; + +struct StorageTextureBindingLayout { + ChainedStruct const *nextInChain = nullptr; + StorageTextureAccess access = StorageTextureAccess::Undefined; + TextureFormat format = TextureFormat::Undefined; + TextureViewDimension viewDimension = TextureViewDimension::e2D; +}; + +struct SurfaceDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromAndroidNativeWindow : ChainedStruct { + SurfaceDescriptorFromAndroidNativeWindow() { + sType = SType::SurfaceDescriptorFromAndroidNativeWindow; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *window; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromCanvasHTMLSelector : ChainedStruct { + SurfaceDescriptorFromCanvasHTMLSelector() { + sType = SType::SurfaceDescriptorFromCanvasHTMLSelector; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(char const *)); + alignas(kFirstMemberAlignment) char const *selector; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromMetalLayer : ChainedStruct { + SurfaceDescriptorFromMetalLayer() { + sType = SType::SurfaceDescriptorFromMetalLayer; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *layer; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWaylandSurface : ChainedStruct { + SurfaceDescriptorFromWaylandSurface() { + sType = SType::SurfaceDescriptorFromWaylandSurface; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *display; + void *surface; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWindowsHWND : ChainedStruct { + SurfaceDescriptorFromWindowsHWND() { + sType = SType::SurfaceDescriptorFromWindowsHWND; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *hinstance; + void *hwnd; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWindowsCoreWindow : ChainedStruct { + SurfaceDescriptorFromWindowsCoreWindow() { + sType = SType::SurfaceDescriptorFromWindowsCoreWindow; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *coreWindow; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromWindowsSwapChainPanel : ChainedStruct { + SurfaceDescriptorFromWindowsSwapChainPanel() { + sType = SType::SurfaceDescriptorFromWindowsSwapChainPanel; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *swapChainPanel; +}; + +// Can be chained in SurfaceDescriptor +struct SurfaceDescriptorFromXlibWindow : ChainedStruct { + SurfaceDescriptorFromXlibWindow() { + sType = SType::SurfaceDescriptorFromXlibWindow; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(void *)); + alignas(kFirstMemberAlignment) void *display; + uint64_t window; +}; + +struct SwapChainDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureUsage usage; + TextureFormat format; + uint32_t width; + uint32_t height; + PresentMode presentMode; +}; + +struct TextureBindingLayout { + ChainedStruct const *nextInChain = nullptr; + TextureSampleType sampleType = TextureSampleType::Undefined; + TextureViewDimension viewDimension = TextureViewDimension::e2D; + Bool multisampled = false; +}; + +// Can be chained in TextureDescriptor +struct TextureBindingViewDimensionDescriptor : ChainedStruct { + TextureBindingViewDimensionDescriptor() { + sType = SType::TextureBindingViewDimensionDescriptor; + } + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax( + alignof(ChainedStruct), alignof(TextureViewDimension)); + alignas(kFirstMemberAlignment) TextureViewDimension + textureBindingViewDimension = TextureViewDimension::Undefined; +}; + +struct TextureDataLayout { + ChainedStruct const *nextInChain = nullptr; + uint64_t offset = 0; + uint32_t bytesPerRow = WGPU_COPY_STRIDE_UNDEFINED; + uint32_t rowsPerImage = WGPU_COPY_STRIDE_UNDEFINED; +}; + +struct TextureViewDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureFormat format = TextureFormat::Undefined; + TextureViewDimension dimension = TextureViewDimension::Undefined; + uint32_t baseMipLevel = 0; + uint32_t mipLevelCount = WGPU_MIP_LEVEL_COUNT_UNDEFINED; + uint32_t baseArrayLayer = 0; + uint32_t arrayLayerCount = WGPU_ARRAY_LAYER_COUNT_UNDEFINED; + TextureAspect aspect = TextureAspect::All; +}; + +struct VertexAttribute { + VertexFormat format; + uint64_t offset; + uint32_t shaderLocation; +}; + +// Can be chained in AdapterProperties +struct AdapterPropertiesMemoryHeaps : ChainedStructOut { + AdapterPropertiesMemoryHeaps() { + sType = SType::AdapterPropertiesMemoryHeaps; + } + ~AdapterPropertiesMemoryHeaps(); + AdapterPropertiesMemoryHeaps(const AdapterPropertiesMemoryHeaps &) = delete; + AdapterPropertiesMemoryHeaps & + operator=(const AdapterPropertiesMemoryHeaps &) = delete; + AdapterPropertiesMemoryHeaps(AdapterPropertiesMemoryHeaps &&); + AdapterPropertiesMemoryHeaps &operator=(AdapterPropertiesMemoryHeaps &&); + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); + alignas(kFirstMemberAlignment) size_t const heapCount = {}; + MemoryHeapInfo const *const heapInfo = {}; +}; + +struct BindGroupDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + BindGroupLayout layout; + size_t entryCount; + BindGroupEntry const *entries; +}; + +struct BindGroupLayoutEntry { + ChainedStruct const *nextInChain = nullptr; + uint32_t binding; + ShaderStage visibility; + BufferBindingLayout buffer; + SamplerBindingLayout sampler; + TextureBindingLayout texture; + StorageTextureBindingLayout storageTexture; +}; + +struct BlendState { + BlendComponent color; + BlendComponent alpha; +}; + +struct CompilationInfo { + ChainedStruct const *nextInChain = nullptr; + size_t messageCount; + CompilationMessage const *messages; +}; + +struct ComputePassDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + ComputePassTimestampWrites const *timestampWrites = nullptr; +}; + +struct DepthStencilState { + ChainedStruct const *nextInChain = nullptr; + TextureFormat format; + Bool depthWriteEnabled = false; + CompareFunction depthCompare = CompareFunction::Undefined; + StencilFaceState stencilFront; + StencilFaceState stencilBack; + uint32_t stencilReadMask = 0xFFFFFFFF; + uint32_t stencilWriteMask = 0xFFFFFFFF; + int32_t depthBias = 0; + float depthBiasSlopeScale = 0.0f; + float depthBiasClamp = 0.0f; +}; + +// Can be chained in FormatCapabilities +struct DrmFormatCapabilities : ChainedStructOut { + DrmFormatCapabilities() { sType = SType::DrmFormatCapabilities; } + ~DrmFormatCapabilities(); + DrmFormatCapabilities(const DrmFormatCapabilities &) = delete; + DrmFormatCapabilities &operator=(const DrmFormatCapabilities &) = delete; + DrmFormatCapabilities(DrmFormatCapabilities &&); + DrmFormatCapabilities &operator=(DrmFormatCapabilities &&); + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(size_t)); + alignas(kFirstMemberAlignment) size_t const propertiesCount = {}; + DrmFormatProperties const *const properties = {}; +}; + +struct ExternalTextureDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureView plane0; + TextureView plane1 = nullptr; + Origin2D visibleOrigin; + Extent2D visibleSize; + Bool doYuvToRgbConversionOnly = false; + float const *yuvToRgbConversionMatrix = nullptr; + float const *srcTransferFunctionParameters; + float const *dstTransferFunctionParameters; + float const *gamutConversionMatrix; + Bool flipY = false; + Bool mirrored = false; + ExternalTextureRotation rotation = ExternalTextureRotation::Rotate0Degrees; +}; + +struct FutureWaitInfo { + Future future; + Bool completed = false; +}; + +struct ImageCopyBuffer { + ChainedStruct const *nextInChain = nullptr; + TextureDataLayout layout; + Buffer buffer; +}; + +struct ImageCopyExternalTexture { + ChainedStruct const *nextInChain = nullptr; + ExternalTexture externalTexture; + Origin3D origin; + Extent2D naturalSize; +}; + +struct ImageCopyTexture { + ChainedStruct const *nextInChain = nullptr; + Texture texture; + uint32_t mipLevel = 0; + Origin3D origin; + TextureAspect aspect = TextureAspect::All; +}; + +struct InstanceDescriptor { + ChainedStruct const *nextInChain = nullptr; + InstanceFeatures features; +}; + +// Can be chained in PipelineLayoutDescriptor +struct PipelineLayoutPixelLocalStorage : ChainedStruct { + PipelineLayoutPixelLocalStorage() { + sType = SType::PipelineLayoutPixelLocalStorage; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); + alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount = 0; + PipelineLayoutStorageAttachment const *storageAttachments; +}; + +struct ProgrammableStageDescriptor { + ChainedStruct const *nextInChain = nullptr; + ShaderModule module; + char const *entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const *constants; +}; + +struct RenderPassColorAttachment { + ChainedStruct const *nextInChain = nullptr; + TextureView view = nullptr; + uint32_t depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; + TextureView resolveTarget = nullptr; + LoadOp loadOp; + StoreOp storeOp; + Color clearValue; +}; + +struct RenderPassStorageAttachment { + ChainedStruct const *nextInChain = nullptr; + uint64_t offset = 0; + TextureView storage; + LoadOp loadOp; + StoreOp storeOp; + Color clearValue; +}; + +struct RequiredLimits { + ChainedStruct const *nextInChain = nullptr; + Limits limits; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryDmaBufDescriptor : ChainedStruct { + SharedTextureMemoryDmaBufDescriptor() { + sType = SType::SharedTextureMemoryDmaBufDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(Extent3D)); + alignas(kFirstMemberAlignment) Extent3D size; + uint32_t drmFormat; + uint64_t drmModifier; + size_t planeCount; + SharedTextureMemoryDmaBufPlane const *planes; +}; + +struct SharedTextureMemoryProperties { + ChainedStructOut *nextInChain = nullptr; + TextureUsage usage; + Extent3D size; + TextureFormat format; +}; + +// Can be chained in SharedTextureMemoryDescriptor +struct SharedTextureMemoryVkImageDescriptor : ChainedStruct { + SharedTextureMemoryVkImageDescriptor() { + sType = SType::SharedTextureMemoryVkImageDescriptor; + } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(int32_t)); + alignas(kFirstMemberAlignment) int32_t vkFormat; + int32_t vkUsageFlags; + Extent3D vkExtent3D; +}; + +struct SupportedLimits { + ChainedStructOut *nextInChain = nullptr; + Limits limits; +}; + +struct TextureDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + TextureUsage usage; + TextureDimension dimension = TextureDimension::e2D; + Extent3D size; + TextureFormat format; + uint32_t mipLevelCount = 1; + uint32_t sampleCount = 1; + size_t viewFormatCount = 0; + TextureFormat const *viewFormats; +}; + +struct VertexBufferLayout { + uint64_t arrayStride; + VertexStepMode stepMode = VertexStepMode::Vertex; + size_t attributeCount; + VertexAttribute const *attributes; +}; + +struct BindGroupLayoutDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t entryCount; + BindGroupLayoutEntry const *entries; +}; + +struct ColorTargetState { + ChainedStruct const *nextInChain = nullptr; + TextureFormat format; + BlendState const *blend = nullptr; + ColorWriteMask writeMask = ColorWriteMask::All; +}; + +struct ComputePipelineDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + PipelineLayout layout = nullptr; + ProgrammableStageDescriptor compute; +}; + +struct DeviceDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t requiredFeatureCount = 0; + FeatureName const *requiredFeatures = nullptr; + RequiredLimits const *requiredLimits = nullptr; + QueueDescriptor defaultQueue; + DeviceLostCallback deviceLostCallback = nullptr; + void *deviceLostUserdata = nullptr; +}; + +struct RenderPassDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + size_t colorAttachmentCount; + RenderPassColorAttachment const *colorAttachments; + RenderPassDepthStencilAttachment const *depthStencilAttachment = nullptr; + QuerySet occlusionQuerySet = nullptr; + RenderPassTimestampWrites const *timestampWrites = nullptr; +}; + +// Can be chained in RenderPassDescriptor +struct RenderPassPixelLocalStorage : ChainedStruct { + RenderPassPixelLocalStorage() { sType = SType::RenderPassPixelLocalStorage; } + static constexpr size_t kFirstMemberAlignment = + detail::ConstexprMax(alignof(ChainedStruct), alignof(uint64_t)); + alignas(kFirstMemberAlignment) uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount = 0; + RenderPassStorageAttachment const *storageAttachments; +}; + +struct VertexState { + ChainedStruct const *nextInChain = nullptr; + ShaderModule module; + char const *entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const *constants; + size_t bufferCount = 0; + VertexBufferLayout const *buffers; +}; + +struct FragmentState { + ChainedStruct const *nextInChain = nullptr; + ShaderModule module; + char const *entryPoint = nullptr; + size_t constantCount = 0; + ConstantEntry const *constants; + size_t targetCount; + ColorTargetState const *targets; +}; + +struct RenderPipelineDescriptor { + ChainedStruct const *nextInChain = nullptr; + char const *label = nullptr; + PipelineLayout layout = nullptr; + VertexState vertex; + PrimitiveState primitive; + DepthStencilState const *depthStencil = nullptr; + MultisampleState multisample; + FragmentState const *fragment = nullptr; +}; + +} // namespace wgpu namespace wgpu { - template<> - struct IsWGPUBitmask { - static constexpr bool enable = true; - }; - - template<> - struct IsWGPUBitmask { - static constexpr bool enable = true; - }; - - template<> - struct IsWGPUBitmask { - static constexpr bool enable = true; - }; - - template<> - struct IsWGPUBitmask { - static constexpr bool enable = true; - }; - - template<> - struct IsWGPUBitmask { - static constexpr bool enable = true; - }; - - template<> - struct IsWGPUBitmask { - static constexpr bool enable = true; - }; +template <> struct IsWGPUBitmask { + static constexpr bool enable = true; +}; + +template <> struct IsWGPUBitmask { + static constexpr bool enable = true; +}; + +template <> struct IsWGPUBitmask { + static constexpr bool enable = true; +}; + +template <> struct IsWGPUBitmask { + static constexpr bool enable = true; +}; + +template <> struct IsWGPUBitmask { + static constexpr bool enable = true; +}; + +template <> struct IsWGPUBitmask { + static constexpr bool enable = true; +}; } // namespace wgpu namespace std { -// Custom boolean class needs corresponding hash function so that it appears as a transparent bool. -template <> -struct hash { - public: - size_t operator()(const wgpu::Bool &v) const { - return hash()(v); - } +// Custom boolean class needs corresponding hash function so that it appears as +// a transparent bool. +template <> struct hash { +public: + size_t operator()(const wgpu::Bool &v) const { return hash()(v); } }; -} // namespace std +} // namespace std #endif // WEBGPU_CPP_H_ diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu.h b/package/android/cpp/rnskia-android/webgpu/webgpu.h index 1f4d039b42..92fb1248e2 100644 --- a/package/android/cpp/rnskia-android/webgpu/webgpu.h +++ b/package/android/cpp/rnskia-android/webgpu/webgpu.h @@ -6,7 +6,8 @@ // 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 +// 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, @@ -19,37 +20,39 @@ // // 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. +// 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. #ifdef __EMSCRIPTEN__ -#error "Do not include this header. Emscripten already provides headers needed for WebGPU." +#error \ + "Do not include this header. Emscripten already provides headers needed for WebGPU." #endif #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(_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 @@ -67,8 +70,8 @@ #define WGPU_NULLABLE #endif -#include #include +#include #define WGPU_ARRAY_LAYER_COUNT_UNDEFINED UINT32_MAX #define WGPU_COPY_STRIDE_UNDEFINED UINT32_MAX @@ -83,33 +86,41 @@ 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 WGPUExternalTextureImpl* WGPUExternalTexture 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 WGPUSharedBufferMemoryImpl* WGPUSharedBufferMemory WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSharedFenceImpl* WGPUSharedFence WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSharedTextureMemoryImpl* WGPUSharedTextureMemory WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSurfaceImpl* WGPUSurface WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSwapChainImpl* WGPUSwapChain WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureImpl* WGPUTexture WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE; +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 WGPUExternalTextureImpl *WGPUExternalTexture + 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 WGPUSharedBufferMemoryImpl *WGPUSharedBufferMemory + WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedFenceImpl *WGPUSharedFence WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedTextureMemoryImpl *WGPUSharedTextureMemory + WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSurfaceImpl *WGPUSurface WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSwapChainImpl *WGPUSwapChain WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTextureImpl *WGPUTexture WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTextureViewImpl *WGPUTextureView WGPU_OBJECT_ATTRIBUTE; // Structure forward declarations struct WGPUAdapterProperties; @@ -262,1871 +273,1897 @@ struct WGPUFragmentState; struct WGPURenderPipelineDescriptor; typedef enum WGPUWGSLFeatureName { - WGPUWGSLFeatureName_Undefined = 0x00000000, - WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures = 0x00000001, - WGPUWGSLFeatureName_Packed4x8IntegerDotProduct = 0x00000002, - WGPUWGSLFeatureName_UnrestrictedPointerParameters = 0x00000003, - WGPUWGSLFeatureName_PointerCompositeAccess = 0x00000004, - WGPUWGSLFeatureName_ChromiumTestingUnimplemented = 0x000003E8, - WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental = 0x000003E9, - WGPUWGSLFeatureName_ChromiumTestingExperimental = 0x000003EA, - WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch = 0x000003EB, - WGPUWGSLFeatureName_ChromiumTestingShipped = 0x000003EC, - WGPUWGSLFeatureName_Force32 = 0x7FFFFFFF + WGPUWGSLFeatureName_Undefined = 0x00000000, + WGPUWGSLFeatureName_ReadonlyAndReadwriteStorageTextures = 0x00000001, + WGPUWGSLFeatureName_Packed4x8IntegerDotProduct = 0x00000002, + WGPUWGSLFeatureName_UnrestrictedPointerParameters = 0x00000003, + WGPUWGSLFeatureName_PointerCompositeAccess = 0x00000004, + WGPUWGSLFeatureName_ChromiumTestingUnimplemented = 0x000003E8, + WGPUWGSLFeatureName_ChromiumTestingUnsafeExperimental = 0x000003E9, + WGPUWGSLFeatureName_ChromiumTestingExperimental = 0x000003EA, + WGPUWGSLFeatureName_ChromiumTestingShippedWithKillswitch = 0x000003EB, + WGPUWGSLFeatureName_ChromiumTestingShipped = 0x000003EC, + WGPUWGSLFeatureName_Force32 = 0x7FFFFFFF } WGPUWGSLFeatureName WGPU_ENUM_ATTRIBUTE; typedef enum WGPUAdapterType { - WGPUAdapterType_DiscreteGPU = 0x00000001, - WGPUAdapterType_IntegratedGPU = 0x00000002, - WGPUAdapterType_CPU = 0x00000003, - WGPUAdapterType_Unknown = 0x00000004, - WGPUAdapterType_Force32 = 0x7FFFFFFF + WGPUAdapterType_DiscreteGPU = 0x00000001, + WGPUAdapterType_IntegratedGPU = 0x00000002, + WGPUAdapterType_CPU = 0x00000003, + WGPUAdapterType_Unknown = 0x00000004, + WGPUAdapterType_Force32 = 0x7FFFFFFF } WGPUAdapterType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUAddressMode { - WGPUAddressMode_Undefined = 0x00000000, - WGPUAddressMode_ClampToEdge = 0x00000001, - WGPUAddressMode_Repeat = 0x00000002, - WGPUAddressMode_MirrorRepeat = 0x00000003, - WGPUAddressMode_Force32 = 0x7FFFFFFF + WGPUAddressMode_Undefined = 0x00000000, + WGPUAddressMode_ClampToEdge = 0x00000001, + WGPUAddressMode_Repeat = 0x00000002, + WGPUAddressMode_MirrorRepeat = 0x00000003, + WGPUAddressMode_Force32 = 0x7FFFFFFF } WGPUAddressMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUAlphaMode { - WGPUAlphaMode_Opaque = 0x00000001, - WGPUAlphaMode_Premultiplied = 0x00000002, - WGPUAlphaMode_Unpremultiplied = 0x00000003, - WGPUAlphaMode_Force32 = 0x7FFFFFFF + WGPUAlphaMode_Opaque = 0x00000001, + WGPUAlphaMode_Premultiplied = 0x00000002, + WGPUAlphaMode_Unpremultiplied = 0x00000003, + WGPUAlphaMode_Force32 = 0x7FFFFFFF } WGPUAlphaMode 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_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_Undefined = 0x00000000, - WGPUBlendFactor_Zero = 0x00000001, - WGPUBlendFactor_One = 0x00000002, - WGPUBlendFactor_Src = 0x00000003, - WGPUBlendFactor_OneMinusSrc = 0x00000004, - WGPUBlendFactor_SrcAlpha = 0x00000005, - WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, - WGPUBlendFactor_Dst = 0x00000007, - WGPUBlendFactor_OneMinusDst = 0x00000008, - WGPUBlendFactor_DstAlpha = 0x00000009, - WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, - WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, - WGPUBlendFactor_Constant = 0x0000000C, - WGPUBlendFactor_OneMinusConstant = 0x0000000D, - WGPUBlendFactor_Src1 = 0x0000000E, - WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, - WGPUBlendFactor_Src1Alpha = 0x00000010, - WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, - WGPUBlendFactor_Force32 = 0x7FFFFFFF + WGPUBlendFactor_Undefined = 0x00000000, + WGPUBlendFactor_Zero = 0x00000001, + WGPUBlendFactor_One = 0x00000002, + WGPUBlendFactor_Src = 0x00000003, + WGPUBlendFactor_OneMinusSrc = 0x00000004, + WGPUBlendFactor_SrcAlpha = 0x00000005, + WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, + WGPUBlendFactor_Dst = 0x00000007, + WGPUBlendFactor_OneMinusDst = 0x00000008, + WGPUBlendFactor_DstAlpha = 0x00000009, + WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, + WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, + WGPUBlendFactor_Constant = 0x0000000C, + WGPUBlendFactor_OneMinusConstant = 0x0000000D, + WGPUBlendFactor_Src1 = 0x0000000E, + WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, + WGPUBlendFactor_Src1Alpha = 0x00000010, + WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, + WGPUBlendFactor_Force32 = 0x7FFFFFFF } WGPUBlendFactor WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBlendOperation { - WGPUBlendOperation_Undefined = 0x00000000, - WGPUBlendOperation_Add = 0x00000001, - WGPUBlendOperation_Subtract = 0x00000002, - WGPUBlendOperation_ReverseSubtract = 0x00000003, - WGPUBlendOperation_Min = 0x00000004, - WGPUBlendOperation_Max = 0x00000005, - WGPUBlendOperation_Force32 = 0x7FFFFFFF + WGPUBlendOperation_Undefined = 0x00000000, + WGPUBlendOperation_Add = 0x00000001, + WGPUBlendOperation_Subtract = 0x00000002, + WGPUBlendOperation_ReverseSubtract = 0x00000003, + WGPUBlendOperation_Min = 0x00000004, + WGPUBlendOperation_Max = 0x00000005, + 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_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_InstanceDropped = 0x00000001, - WGPUBufferMapAsyncStatus_ValidationError = 0x00000002, - WGPUBufferMapAsyncStatus_Unknown = 0x00000003, - WGPUBufferMapAsyncStatus_DeviceLost = 0x00000004, - WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 0x00000005, - WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 0x00000006, - WGPUBufferMapAsyncStatus_MappingAlreadyPending = 0x00000007, - WGPUBufferMapAsyncStatus_OffsetOutOfRange = 0x00000008, - WGPUBufferMapAsyncStatus_SizeOutOfRange = 0x00000009, - WGPUBufferMapAsyncStatus_Force32 = 0x7FFFFFFF + WGPUBufferMapAsyncStatus_Success = 0x00000000, + WGPUBufferMapAsyncStatus_InstanceDropped = 0x00000001, + WGPUBufferMapAsyncStatus_ValidationError = 0x00000002, + WGPUBufferMapAsyncStatus_Unknown = 0x00000003, + WGPUBufferMapAsyncStatus_DeviceLost = 0x00000004, + WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 0x00000005, + WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 0x00000006, + WGPUBufferMapAsyncStatus_MappingAlreadyPending = 0x00000007, + WGPUBufferMapAsyncStatus_OffsetOutOfRange = 0x00000008, + WGPUBufferMapAsyncStatus_SizeOutOfRange = 0x00000009, + WGPUBufferMapAsyncStatus_Force32 = 0x7FFFFFFF } WGPUBufferMapAsyncStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBufferMapState { - WGPUBufferMapState_Unmapped = 0x00000001, - WGPUBufferMapState_Pending = 0x00000002, - WGPUBufferMapState_Mapped = 0x00000003, - WGPUBufferMapState_Force32 = 0x7FFFFFFF + WGPUBufferMapState_Unmapped = 0x00000001, + WGPUBufferMapState_Pending = 0x00000002, + WGPUBufferMapState_Mapped = 0x00000003, + WGPUBufferMapState_Force32 = 0x7FFFFFFF } WGPUBufferMapState WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCallbackMode { - WGPUCallbackMode_WaitAnyOnly = 0x00000000, - WGPUCallbackMode_AllowProcessEvents = 0x00000001, - WGPUCallbackMode_AllowSpontaneous = 0x00000002, - WGPUCallbackMode_Force32 = 0x7FFFFFFF + WGPUCallbackMode_WaitAnyOnly = 0x00000000, + WGPUCallbackMode_AllowProcessEvents = 0x00000001, + WGPUCallbackMode_AllowSpontaneous = 0x00000002, + WGPUCallbackMode_Force32 = 0x7FFFFFFF } WGPUCallbackMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCompareFunction { - WGPUCompareFunction_Undefined = 0x00000000, - WGPUCompareFunction_Never = 0x00000001, - WGPUCompareFunction_Less = 0x00000002, - WGPUCompareFunction_Equal = 0x00000003, - WGPUCompareFunction_LessEqual = 0x00000004, - WGPUCompareFunction_Greater = 0x00000005, - WGPUCompareFunction_NotEqual = 0x00000006, - WGPUCompareFunction_GreaterEqual = 0x00000007, - WGPUCompareFunction_Always = 0x00000008, - WGPUCompareFunction_Force32 = 0x7FFFFFFF + WGPUCompareFunction_Undefined = 0x00000000, + WGPUCompareFunction_Never = 0x00000001, + WGPUCompareFunction_Less = 0x00000002, + WGPUCompareFunction_Equal = 0x00000003, + WGPUCompareFunction_LessEqual = 0x00000004, + WGPUCompareFunction_Greater = 0x00000005, + WGPUCompareFunction_NotEqual = 0x00000006, + WGPUCompareFunction_GreaterEqual = 0x00000007, + WGPUCompareFunction_Always = 0x00000008, + WGPUCompareFunction_Force32 = 0x7FFFFFFF } WGPUCompareFunction WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCompilationInfoRequestStatus { - WGPUCompilationInfoRequestStatus_Success = 0x00000000, - WGPUCompilationInfoRequestStatus_InstanceDropped = 0x00000001, - WGPUCompilationInfoRequestStatus_Error = 0x00000002, - WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000003, - WGPUCompilationInfoRequestStatus_Unknown = 0x00000004, - WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF + WGPUCompilationInfoRequestStatus_Success = 0x00000000, + WGPUCompilationInfoRequestStatus_InstanceDropped = 0x00000001, + WGPUCompilationInfoRequestStatus_Error = 0x00000002, + WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000003, + WGPUCompilationInfoRequestStatus_Unknown = 0x00000004, + WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF } WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCompilationMessageType { - WGPUCompilationMessageType_Error = 0x00000001, - WGPUCompilationMessageType_Warning = 0x00000002, - WGPUCompilationMessageType_Info = 0x00000003, - WGPUCompilationMessageType_Force32 = 0x7FFFFFFF + WGPUCompilationMessageType_Error = 0x00000001, + WGPUCompilationMessageType_Warning = 0x00000002, + WGPUCompilationMessageType_Info = 0x00000003, + WGPUCompilationMessageType_Force32 = 0x7FFFFFFF } WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCreatePipelineAsyncStatus { - WGPUCreatePipelineAsyncStatus_Success = 0x00000000, - WGPUCreatePipelineAsyncStatus_InstanceDropped = 0x00000001, - WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000002, - WGPUCreatePipelineAsyncStatus_InternalError = 0x00000003, - WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000004, - WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000005, - WGPUCreatePipelineAsyncStatus_Unknown = 0x00000006, - WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF + WGPUCreatePipelineAsyncStatus_Success = 0x00000000, + WGPUCreatePipelineAsyncStatus_InstanceDropped = 0x00000001, + WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000002, + WGPUCreatePipelineAsyncStatus_InternalError = 0x00000003, + WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000004, + WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000005, + WGPUCreatePipelineAsyncStatus_Unknown = 0x00000006, + WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF } WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCullMode { - WGPUCullMode_Undefined = 0x00000000, - WGPUCullMode_None = 0x00000001, - WGPUCullMode_Front = 0x00000002, - WGPUCullMode_Back = 0x00000003, - WGPUCullMode_Force32 = 0x7FFFFFFF + WGPUCullMode_Undefined = 0x00000000, + WGPUCullMode_None = 0x00000001, + WGPUCullMode_Front = 0x00000002, + WGPUCullMode_Back = 0x00000003, + WGPUCullMode_Force32 = 0x7FFFFFFF } WGPUCullMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUDeviceLostReason { - WGPUDeviceLostReason_Undefined = 0x00000000, - WGPUDeviceLostReason_Destroyed = 0x00000001, - WGPUDeviceLostReason_Force32 = 0x7FFFFFFF + WGPUDeviceLostReason_Undefined = 0x00000000, + WGPUDeviceLostReason_Destroyed = 0x00000001, + WGPUDeviceLostReason_Force32 = 0x7FFFFFFF } WGPUDeviceLostReason WGPU_ENUM_ATTRIBUTE; typedef enum WGPUErrorFilter { - WGPUErrorFilter_Validation = 0x00000001, - WGPUErrorFilter_OutOfMemory = 0x00000002, - WGPUErrorFilter_Internal = 0x00000003, - WGPUErrorFilter_Force32 = 0x7FFFFFFF + WGPUErrorFilter_Validation = 0x00000001, + WGPUErrorFilter_OutOfMemory = 0x00000002, + WGPUErrorFilter_Internal = 0x00000003, + 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_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 WGPUExternalTextureRotation { - WGPUExternalTextureRotation_Rotate0Degrees = 0x00000000, - WGPUExternalTextureRotation_Rotate90Degrees = 0x00000001, - WGPUExternalTextureRotation_Rotate180Degrees = 0x00000002, - WGPUExternalTextureRotation_Rotate270Degrees = 0x00000003, - WGPUExternalTextureRotation_Force32 = 0x7FFFFFFF + WGPUExternalTextureRotation_Rotate0Degrees = 0x00000000, + WGPUExternalTextureRotation_Rotate90Degrees = 0x00000001, + WGPUExternalTextureRotation_Rotate180Degrees = 0x00000002, + WGPUExternalTextureRotation_Rotate270Degrees = 0x00000003, + WGPUExternalTextureRotation_Force32 = 0x7FFFFFFF } WGPUExternalTextureRotation 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_DawnInternalUsages = 0x000003EA, - WGPUFeatureName_DawnMultiPlanarFormats = 0x000003EB, - WGPUFeatureName_DawnNative = 0x000003EC, - WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, - WGPUFeatureName_ImplicitDeviceSynchronization = 0x000003EF, - WGPUFeatureName_SurfaceCapabilities = 0x000003F0, - WGPUFeatureName_TransientAttachments = 0x000003F1, - WGPUFeatureName_MSAARenderToSingleSampled = 0x000003F2, - WGPUFeatureName_DualSourceBlending = 0x000003F3, - WGPUFeatureName_D3D11MultithreadProtected = 0x000003F4, - WGPUFeatureName_ANGLETextureSharing = 0x000003F5, - WGPUFeatureName_ChromiumExperimentalSubgroups = 0x000003F6, - WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, - WGPUFeatureName_PixelLocalStorageCoherent = 0x000003F9, - WGPUFeatureName_PixelLocalStorageNonCoherent = 0x000003FA, - WGPUFeatureName_Unorm16TextureFormats = 0x000003FB, - WGPUFeatureName_Snorm16TextureFormats = 0x000003FC, - WGPUFeatureName_MultiPlanarFormatExtendedUsages = 0x000003FD, - WGPUFeatureName_MultiPlanarFormatP010 = 0x000003FE, - WGPUFeatureName_HostMappedPointer = 0x000003FF, - WGPUFeatureName_MultiPlanarRenderTargets = 0x00000400, - WGPUFeatureName_MultiPlanarFormatNv12a = 0x00000401, - WGPUFeatureName_FramebufferFetch = 0x00000402, - WGPUFeatureName_BufferMapExtendedUsages = 0x00000403, - WGPUFeatureName_AdapterPropertiesMemoryHeaps = 0x00000404, - WGPUFeatureName_AdapterPropertiesD3D = 0x00000405, - WGPUFeatureName_AdapterPropertiesVk = 0x00000406, - WGPUFeatureName_R8UnormStorage = 0x00000407, - WGPUFeatureName_FormatCapabilities = 0x00000408, - WGPUFeatureName_DrmFormatCapabilities = 0x00000409, - WGPUFeatureName_Norm16TextureFormats = 0x0000040A, - WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, - WGPUFeatureName_SharedTextureMemoryAHardwareBuffer = 0x0000044D, - WGPUFeatureName_SharedTextureMemoryDmaBuf = 0x0000044E, - WGPUFeatureName_SharedTextureMemoryOpaqueFD = 0x0000044F, - WGPUFeatureName_SharedTextureMemoryZirconHandle = 0x00000450, - WGPUFeatureName_SharedTextureMemoryDXGISharedHandle = 0x00000451, - WGPUFeatureName_SharedTextureMemoryD3D11Texture2D = 0x00000452, - WGPUFeatureName_SharedTextureMemoryIOSurface = 0x00000453, - WGPUFeatureName_SharedTextureMemoryEGLImage = 0x00000454, - WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, - WGPUFeatureName_SharedFenceVkSemaphoreSyncFD = 0x000004B1, - WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle = 0x000004B2, - WGPUFeatureName_SharedFenceDXGISharedHandle = 0x000004B3, - WGPUFeatureName_SharedFenceMTLSharedEvent = 0x000004B4, - WGPUFeatureName_SharedBufferMemoryD3D12Resource = 0x000004B5, - WGPUFeatureName_StaticSamplers = 0x000004B6, - WGPUFeatureName_Force32 = 0x7FFFFFFF + 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_DawnInternalUsages = 0x000003EA, + WGPUFeatureName_DawnMultiPlanarFormats = 0x000003EB, + WGPUFeatureName_DawnNative = 0x000003EC, + WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses = 0x000003EE, + WGPUFeatureName_ImplicitDeviceSynchronization = 0x000003EF, + WGPUFeatureName_SurfaceCapabilities = 0x000003F0, + WGPUFeatureName_TransientAttachments = 0x000003F1, + WGPUFeatureName_MSAARenderToSingleSampled = 0x000003F2, + WGPUFeatureName_DualSourceBlending = 0x000003F3, + WGPUFeatureName_D3D11MultithreadProtected = 0x000003F4, + WGPUFeatureName_ANGLETextureSharing = 0x000003F5, + WGPUFeatureName_ChromiumExperimentalSubgroups = 0x000003F6, + WGPUFeatureName_ChromiumExperimentalSubgroupUniformControlFlow = 0x000003F7, + WGPUFeatureName_PixelLocalStorageCoherent = 0x000003F9, + WGPUFeatureName_PixelLocalStorageNonCoherent = 0x000003FA, + WGPUFeatureName_Unorm16TextureFormats = 0x000003FB, + WGPUFeatureName_Snorm16TextureFormats = 0x000003FC, + WGPUFeatureName_MultiPlanarFormatExtendedUsages = 0x000003FD, + WGPUFeatureName_MultiPlanarFormatP010 = 0x000003FE, + WGPUFeatureName_HostMappedPointer = 0x000003FF, + WGPUFeatureName_MultiPlanarRenderTargets = 0x00000400, + WGPUFeatureName_MultiPlanarFormatNv12a = 0x00000401, + WGPUFeatureName_FramebufferFetch = 0x00000402, + WGPUFeatureName_BufferMapExtendedUsages = 0x00000403, + WGPUFeatureName_AdapterPropertiesMemoryHeaps = 0x00000404, + WGPUFeatureName_AdapterPropertiesD3D = 0x00000405, + WGPUFeatureName_AdapterPropertiesVk = 0x00000406, + WGPUFeatureName_R8UnormStorage = 0x00000407, + WGPUFeatureName_FormatCapabilities = 0x00000408, + WGPUFeatureName_DrmFormatCapabilities = 0x00000409, + WGPUFeatureName_Norm16TextureFormats = 0x0000040A, + WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation = 0x0000044C, + WGPUFeatureName_SharedTextureMemoryAHardwareBuffer = 0x0000044D, + WGPUFeatureName_SharedTextureMemoryDmaBuf = 0x0000044E, + WGPUFeatureName_SharedTextureMemoryOpaqueFD = 0x0000044F, + WGPUFeatureName_SharedTextureMemoryZirconHandle = 0x00000450, + WGPUFeatureName_SharedTextureMemoryDXGISharedHandle = 0x00000451, + WGPUFeatureName_SharedTextureMemoryD3D11Texture2D = 0x00000452, + WGPUFeatureName_SharedTextureMemoryIOSurface = 0x00000453, + WGPUFeatureName_SharedTextureMemoryEGLImage = 0x00000454, + WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD = 0x000004B0, + WGPUFeatureName_SharedFenceVkSemaphoreSyncFD = 0x000004B1, + WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle = 0x000004B2, + WGPUFeatureName_SharedFenceDXGISharedHandle = 0x000004B3, + WGPUFeatureName_SharedFenceMTLSharedEvent = 0x000004B4, + WGPUFeatureName_SharedBufferMemoryD3D12Resource = 0x000004B5, + WGPUFeatureName_StaticSamplers = 0x000004B6, + WGPUFeatureName_Force32 = 0x7FFFFFFF } WGPUFeatureName WGPU_ENUM_ATTRIBUTE; typedef enum WGPUFilterMode { - WGPUFilterMode_Undefined = 0x00000000, - WGPUFilterMode_Nearest = 0x00000001, - WGPUFilterMode_Linear = 0x00000002, - WGPUFilterMode_Force32 = 0x7FFFFFFF + WGPUFilterMode_Undefined = 0x00000000, + WGPUFilterMode_Nearest = 0x00000001, + WGPUFilterMode_Linear = 0x00000002, + WGPUFilterMode_Force32 = 0x7FFFFFFF } WGPUFilterMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUFrontFace { - WGPUFrontFace_Undefined = 0x00000000, - WGPUFrontFace_CCW = 0x00000001, - WGPUFrontFace_CW = 0x00000002, - WGPUFrontFace_Force32 = 0x7FFFFFFF + WGPUFrontFace_Undefined = 0x00000000, + WGPUFrontFace_CCW = 0x00000001, + WGPUFrontFace_CW = 0x00000002, + WGPUFrontFace_Force32 = 0x7FFFFFFF } WGPUFrontFace WGPU_ENUM_ATTRIBUTE; typedef enum WGPUIndexFormat { - WGPUIndexFormat_Undefined = 0x00000000, - WGPUIndexFormat_Uint16 = 0x00000001, - WGPUIndexFormat_Uint32 = 0x00000002, - WGPUIndexFormat_Force32 = 0x7FFFFFFF + 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_Undefined = 0x00000000, + WGPULoadOp_Clear = 0x00000001, + WGPULoadOp_Load = 0x00000002, + WGPULoadOp_Force32 = 0x7FFFFFFF } WGPULoadOp WGPU_ENUM_ATTRIBUTE; typedef enum WGPULoggingType { - WGPULoggingType_Verbose = 0x00000001, - WGPULoggingType_Info = 0x00000002, - WGPULoggingType_Warning = 0x00000003, - WGPULoggingType_Error = 0x00000004, - WGPULoggingType_Force32 = 0x7FFFFFFF + WGPULoggingType_Verbose = 0x00000001, + WGPULoggingType_Info = 0x00000002, + WGPULoggingType_Warning = 0x00000003, + WGPULoggingType_Error = 0x00000004, + WGPULoggingType_Force32 = 0x7FFFFFFF } WGPULoggingType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUMipmapFilterMode { - WGPUMipmapFilterMode_Undefined = 0x00000000, - WGPUMipmapFilterMode_Nearest = 0x00000001, - WGPUMipmapFilterMode_Linear = 0x00000002, - WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF + WGPUMipmapFilterMode_Undefined = 0x00000000, + WGPUMipmapFilterMode_Nearest = 0x00000001, + WGPUMipmapFilterMode_Linear = 0x00000002, + WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF } WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPopErrorScopeStatus { - WGPUPopErrorScopeStatus_Success = 0x00000000, - WGPUPopErrorScopeStatus_InstanceDropped = 0x00000001, - WGPUPopErrorScopeStatus_Force32 = 0x7FFFFFFF + WGPUPopErrorScopeStatus_Success = 0x00000000, + WGPUPopErrorScopeStatus_InstanceDropped = 0x00000001, + WGPUPopErrorScopeStatus_Force32 = 0x7FFFFFFF } WGPUPopErrorScopeStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPowerPreference { - WGPUPowerPreference_Undefined = 0x00000000, - WGPUPowerPreference_LowPower = 0x00000001, - WGPUPowerPreference_HighPerformance = 0x00000002, - WGPUPowerPreference_Force32 = 0x7FFFFFFF + WGPUPowerPreference_Undefined = 0x00000000, + WGPUPowerPreference_LowPower = 0x00000001, + WGPUPowerPreference_HighPerformance = 0x00000002, + WGPUPowerPreference_Force32 = 0x7FFFFFFF } WGPUPowerPreference WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPresentMode { - WGPUPresentMode_Fifo = 0x00000001, - WGPUPresentMode_Immediate = 0x00000003, - WGPUPresentMode_Mailbox = 0x00000004, - WGPUPresentMode_Force32 = 0x7FFFFFFF + WGPUPresentMode_Fifo = 0x00000001, + WGPUPresentMode_Immediate = 0x00000003, + WGPUPresentMode_Mailbox = 0x00000004, + WGPUPresentMode_Force32 = 0x7FFFFFFF } WGPUPresentMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPrimitiveTopology { - WGPUPrimitiveTopology_Undefined = 0x00000000, - WGPUPrimitiveTopology_PointList = 0x00000001, - WGPUPrimitiveTopology_LineList = 0x00000002, - WGPUPrimitiveTopology_LineStrip = 0x00000003, - WGPUPrimitiveTopology_TriangleList = 0x00000004, - WGPUPrimitiveTopology_TriangleStrip = 0x00000005, - WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF + WGPUPrimitiveTopology_Undefined = 0x00000000, + WGPUPrimitiveTopology_PointList = 0x00000001, + WGPUPrimitiveTopology_LineList = 0x00000002, + WGPUPrimitiveTopology_LineStrip = 0x00000003, + WGPUPrimitiveTopology_TriangleList = 0x00000004, + WGPUPrimitiveTopology_TriangleStrip = 0x00000005, + WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF } WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE; typedef enum WGPUQueryType { - WGPUQueryType_Occlusion = 0x00000001, - WGPUQueryType_Timestamp = 0x00000002, - WGPUQueryType_Force32 = 0x7FFFFFFF + WGPUQueryType_Occlusion = 0x00000001, + WGPUQueryType_Timestamp = 0x00000002, + WGPUQueryType_Force32 = 0x7FFFFFFF } WGPUQueryType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUQueueWorkDoneStatus { - WGPUQueueWorkDoneStatus_Success = 0x00000000, - WGPUQueueWorkDoneStatus_InstanceDropped = 0x00000001, - WGPUQueueWorkDoneStatus_Error = 0x00000002, - WGPUQueueWorkDoneStatus_Unknown = 0x00000003, - WGPUQueueWorkDoneStatus_DeviceLost = 0x00000004, - WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF + WGPUQueueWorkDoneStatus_Success = 0x00000000, + WGPUQueueWorkDoneStatus_InstanceDropped = 0x00000001, + WGPUQueueWorkDoneStatus_Error = 0x00000002, + WGPUQueueWorkDoneStatus_Unknown = 0x00000003, + WGPUQueueWorkDoneStatus_DeviceLost = 0x00000004, + WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF } WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPURequestAdapterStatus { - WGPURequestAdapterStatus_Success = 0x00000000, - WGPURequestAdapterStatus_InstanceDropped = 0x00000001, - WGPURequestAdapterStatus_Unavailable = 0x00000002, - WGPURequestAdapterStatus_Error = 0x00000003, - WGPURequestAdapterStatus_Unknown = 0x00000004, - WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF + WGPURequestAdapterStatus_Success = 0x00000000, + WGPURequestAdapterStatus_InstanceDropped = 0x00000001, + WGPURequestAdapterStatus_Unavailable = 0x00000002, + WGPURequestAdapterStatus_Error = 0x00000003, + WGPURequestAdapterStatus_Unknown = 0x00000004, + WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF } WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPURequestDeviceStatus { - WGPURequestDeviceStatus_Success = 0x00000000, - WGPURequestDeviceStatus_InstanceDropped = 0x00000001, - WGPURequestDeviceStatus_Error = 0x00000002, - WGPURequestDeviceStatus_Unknown = 0x00000003, - WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF + WGPURequestDeviceStatus_Success = 0x00000000, + WGPURequestDeviceStatus_InstanceDropped = 0x00000001, + WGPURequestDeviceStatus_Error = 0x00000002, + WGPURequestDeviceStatus_Unknown = 0x00000003, + 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_SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, - WGPUSType_ExternalTextureBindingEntry = 0x0000000C, - WGPUSType_ExternalTextureBindingLayout = 0x0000000D, - WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, - WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, - WGPUSType_DepthStencilStateDepthWriteDefinedDawn = 0x00000010, - WGPUSType_TextureBindingViewDimensionDescriptor = 0x00000011, - WGPUSType_DawnTextureInternalUsageDescriptor = 0x000003E8, - WGPUSType_DawnEncoderInternalUsageDescriptor = 0x000003EB, - WGPUSType_DawnInstanceDescriptor = 0x000003EC, - WGPUSType_DawnCacheDeviceDescriptor = 0x000003ED, - WGPUSType_DawnAdapterPropertiesPowerPreference = 0x000003EE, - WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, - WGPUSType_DawnTogglesDescriptor = 0x000003F0, - WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, - WGPUSType_RequestAdapterOptionsLUID = 0x000003F2, - WGPUSType_RequestAdapterOptionsGetGLProc = 0x000003F3, - WGPUSType_RequestAdapterOptionsD3D11Device = 0x000003F4, - WGPUSType_DawnMultisampleStateRenderToSingleSampled = 0x000003F5, - WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, - WGPUSType_RenderPassPixelLocalStorage = 0x000003F7, - WGPUSType_PipelineLayoutPixelLocalStorage = 0x000003F8, - WGPUSType_BufferHostMappedPointer = 0x000003F9, - WGPUSType_DawnExperimentalSubgroupLimits = 0x000003FA, - WGPUSType_AdapterPropertiesMemoryHeaps = 0x000003FB, - WGPUSType_AdapterPropertiesD3D = 0x000003FC, - WGPUSType_AdapterPropertiesVk = 0x000003FD, - WGPUSType_DawnComputePipelineFullSubgroups = 0x000003FE, - WGPUSType_DawnWireWGSLControl = 0x000003FF, - WGPUSType_DawnWGSLBlocklist = 0x00000400, - WGPUSType_DrmFormatCapabilities = 0x00000401, - WGPUSType_SharedTextureMemoryVkImageDescriptor = 0x0000044C, - WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, - WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, - WGPUSType_SharedTextureMemoryDmaBufDescriptor = 0x0000044F, - WGPUSType_SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, - WGPUSType_SharedTextureMemoryZirconHandleDescriptor = 0x00000451, - WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, - WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, - WGPUSType_SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, - WGPUSType_SharedTextureMemoryEGLImageDescriptor = 0x00000455, - WGPUSType_SharedTextureMemoryInitializedBeginState = 0x000004B0, - WGPUSType_SharedTextureMemoryInitializedEndState = 0x000004B1, - WGPUSType_SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, - WGPUSType_SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, - WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, - WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, - WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, - WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, - WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, - WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, - WGPUSType_SharedFenceDXGISharedHandleDescriptor = 0x000004BA, - WGPUSType_SharedFenceDXGISharedHandleExportInfo = 0x000004BB, - WGPUSType_SharedFenceMTLSharedEventDescriptor = 0x000004BC, - WGPUSType_SharedFenceMTLSharedEventExportInfo = 0x000004BD, - WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, - WGPUSType_StaticSamplerBindingLayout = 0x000004BF, - WGPUSType_Force32 = 0x7FFFFFFF + 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_SurfaceDescriptorFromWindowsCoreWindow = 0x0000000B, + WGPUSType_ExternalTextureBindingEntry = 0x0000000C, + WGPUSType_ExternalTextureBindingLayout = 0x0000000D, + WGPUSType_SurfaceDescriptorFromWindowsSwapChainPanel = 0x0000000E, + WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, + WGPUSType_DepthStencilStateDepthWriteDefinedDawn = 0x00000010, + WGPUSType_TextureBindingViewDimensionDescriptor = 0x00000011, + WGPUSType_DawnTextureInternalUsageDescriptor = 0x000003E8, + WGPUSType_DawnEncoderInternalUsageDescriptor = 0x000003EB, + WGPUSType_DawnInstanceDescriptor = 0x000003EC, + WGPUSType_DawnCacheDeviceDescriptor = 0x000003ED, + WGPUSType_DawnAdapterPropertiesPowerPreference = 0x000003EE, + WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient = 0x000003EF, + WGPUSType_DawnTogglesDescriptor = 0x000003F0, + WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor = 0x000003F1, + WGPUSType_RequestAdapterOptionsLUID = 0x000003F2, + WGPUSType_RequestAdapterOptionsGetGLProc = 0x000003F3, + WGPUSType_RequestAdapterOptionsD3D11Device = 0x000003F4, + WGPUSType_DawnMultisampleStateRenderToSingleSampled = 0x000003F5, + WGPUSType_DawnRenderPassColorAttachmentRenderToSingleSampled = 0x000003F6, + WGPUSType_RenderPassPixelLocalStorage = 0x000003F7, + WGPUSType_PipelineLayoutPixelLocalStorage = 0x000003F8, + WGPUSType_BufferHostMappedPointer = 0x000003F9, + WGPUSType_DawnExperimentalSubgroupLimits = 0x000003FA, + WGPUSType_AdapterPropertiesMemoryHeaps = 0x000003FB, + WGPUSType_AdapterPropertiesD3D = 0x000003FC, + WGPUSType_AdapterPropertiesVk = 0x000003FD, + WGPUSType_DawnComputePipelineFullSubgroups = 0x000003FE, + WGPUSType_DawnWireWGSLControl = 0x000003FF, + WGPUSType_DawnWGSLBlocklist = 0x00000400, + WGPUSType_DrmFormatCapabilities = 0x00000401, + WGPUSType_SharedTextureMemoryVkImageDescriptor = 0x0000044C, + WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0000044D, + WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor = 0x0000044E, + WGPUSType_SharedTextureMemoryDmaBufDescriptor = 0x0000044F, + WGPUSType_SharedTextureMemoryOpaqueFDDescriptor = 0x00000450, + WGPUSType_SharedTextureMemoryZirconHandleDescriptor = 0x00000451, + WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor = 0x00000452, + WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor = 0x00000453, + WGPUSType_SharedTextureMemoryIOSurfaceDescriptor = 0x00000454, + WGPUSType_SharedTextureMemoryEGLImageDescriptor = 0x00000455, + WGPUSType_SharedTextureMemoryInitializedBeginState = 0x000004B0, + WGPUSType_SharedTextureMemoryInitializedEndState = 0x000004B1, + WGPUSType_SharedTextureMemoryVkImageLayoutBeginState = 0x000004B2, + WGPUSType_SharedTextureMemoryVkImageLayoutEndState = 0x000004B3, + WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x000004B4, + WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x000004B5, + WGPUSType_SharedFenceVkSemaphoreSyncFDDescriptor = 0x000004B6, + WGPUSType_SharedFenceVkSemaphoreSyncFDExportInfo = 0x000004B7, + WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor = 0x000004B8, + WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo = 0x000004B9, + WGPUSType_SharedFenceDXGISharedHandleDescriptor = 0x000004BA, + WGPUSType_SharedFenceDXGISharedHandleExportInfo = 0x000004BB, + WGPUSType_SharedFenceMTLSharedEventDescriptor = 0x000004BC, + WGPUSType_SharedFenceMTLSharedEventExportInfo = 0x000004BD, + WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor = 0x000004BE, + WGPUSType_StaticSamplerBindingLayout = 0x000004BF, + 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_Undefined = 0x00000000, + WGPUSamplerBindingType_Filtering = 0x00000001, + WGPUSamplerBindingType_NonFiltering = 0x00000002, + WGPUSamplerBindingType_Comparison = 0x00000003, + WGPUSamplerBindingType_Force32 = 0x7FFFFFFF } WGPUSamplerBindingType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUSharedFenceType { - WGPUSharedFenceType_Undefined = 0x00000000, - WGPUSharedFenceType_VkSemaphoreOpaqueFD = 0x00000001, - WGPUSharedFenceType_VkSemaphoreSyncFD = 0x00000002, - WGPUSharedFenceType_VkSemaphoreZirconHandle = 0x00000003, - WGPUSharedFenceType_DXGISharedHandle = 0x00000004, - WGPUSharedFenceType_MTLSharedEvent = 0x00000005, - WGPUSharedFenceType_Force32 = 0x7FFFFFFF + WGPUSharedFenceType_Undefined = 0x00000000, + WGPUSharedFenceType_VkSemaphoreOpaqueFD = 0x00000001, + WGPUSharedFenceType_VkSemaphoreSyncFD = 0x00000002, + WGPUSharedFenceType_VkSemaphoreZirconHandle = 0x00000003, + WGPUSharedFenceType_DXGISharedHandle = 0x00000004, + WGPUSharedFenceType_MTLSharedEvent = 0x00000005, + WGPUSharedFenceType_Force32 = 0x7FFFFFFF } WGPUSharedFenceType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUStencilOperation { - WGPUStencilOperation_Undefined = 0x00000000, - WGPUStencilOperation_Keep = 0x00000001, - WGPUStencilOperation_Zero = 0x00000002, - WGPUStencilOperation_Replace = 0x00000003, - WGPUStencilOperation_Invert = 0x00000004, - WGPUStencilOperation_IncrementClamp = 0x00000005, - WGPUStencilOperation_DecrementClamp = 0x00000006, - WGPUStencilOperation_IncrementWrap = 0x00000007, - WGPUStencilOperation_DecrementWrap = 0x00000008, - WGPUStencilOperation_Force32 = 0x7FFFFFFF + WGPUStencilOperation_Undefined = 0x00000000, + WGPUStencilOperation_Keep = 0x00000001, + WGPUStencilOperation_Zero = 0x00000002, + WGPUStencilOperation_Replace = 0x00000003, + WGPUStencilOperation_Invert = 0x00000004, + WGPUStencilOperation_IncrementClamp = 0x00000005, + WGPUStencilOperation_DecrementClamp = 0x00000006, + WGPUStencilOperation_IncrementWrap = 0x00000007, + WGPUStencilOperation_DecrementWrap = 0x00000008, + 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_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_Undefined = 0x00000000, + WGPUStoreOp_Store = 0x00000001, + WGPUStoreOp_Discard = 0x00000002, + WGPUStoreOp_Force32 = 0x7FFFFFFF } WGPUStoreOp WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureAspect { - WGPUTextureAspect_Undefined = 0x00000000, - WGPUTextureAspect_All = 0x00000001, - WGPUTextureAspect_StencilOnly = 0x00000002, - WGPUTextureAspect_DepthOnly = 0x00000003, - WGPUTextureAspect_Plane0Only = 0x00000004, - WGPUTextureAspect_Plane1Only = 0x00000005, - WGPUTextureAspect_Plane2Only = 0x00000006, - WGPUTextureAspect_Force32 = 0x7FFFFFFF + WGPUTextureAspect_Undefined = 0x00000000, + WGPUTextureAspect_All = 0x00000001, + WGPUTextureAspect_StencilOnly = 0x00000002, + WGPUTextureAspect_DepthOnly = 0x00000003, + WGPUTextureAspect_Plane0Only = 0x00000004, + WGPUTextureAspect_Plane1Only = 0x00000005, + WGPUTextureAspect_Plane2Only = 0x00000006, + WGPUTextureAspect_Force32 = 0x7FFFFFFF } WGPUTextureAspect WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureDimension { - WGPUTextureDimension_Undefined = 0x00000000, - WGPUTextureDimension_1D = 0x00000001, - WGPUTextureDimension_2D = 0x00000002, - WGPUTextureDimension_3D = 0x00000003, - WGPUTextureDimension_Force32 = 0x7FFFFFFF + WGPUTextureDimension_Undefined = 0x00000000, + WGPUTextureDimension_1D = 0x00000001, + WGPUTextureDimension_2D = 0x00000002, + WGPUTextureDimension_3D = 0x00000003, + 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_R16Unorm = 0x00000060, - WGPUTextureFormat_RG16Unorm = 0x00000061, - WGPUTextureFormat_RGBA16Unorm = 0x00000062, - WGPUTextureFormat_R16Snorm = 0x00000063, - WGPUTextureFormat_RG16Snorm = 0x00000064, - WGPUTextureFormat_RGBA16Snorm = 0x00000065, - WGPUTextureFormat_R8BG8Biplanar420Unorm = 0x00000066, - WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm = 0x00000067, - WGPUTextureFormat_R8BG8A8Triplanar420Unorm = 0x00000068, - WGPUTextureFormat_Force32 = 0x7FFFFFFF + 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_R16Unorm = 0x00000060, + WGPUTextureFormat_RG16Unorm = 0x00000061, + WGPUTextureFormat_RGBA16Unorm = 0x00000062, + WGPUTextureFormat_R16Snorm = 0x00000063, + WGPUTextureFormat_RG16Snorm = 0x00000064, + WGPUTextureFormat_RGBA16Snorm = 0x00000065, + WGPUTextureFormat_R8BG8Biplanar420Unorm = 0x00000066, + WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm = 0x00000067, + WGPUTextureFormat_R8BG8A8Triplanar420Unorm = 0x00000068, + 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_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_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_Unorm10_10_10_2 = 0x0000001F, - WGPUVertexFormat_Force32 = 0x7FFFFFFF + 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_Unorm10_10_10_2 = 0x0000001F, + WGPUVertexFormat_Force32 = 0x7FFFFFFF } WGPUVertexFormat WGPU_ENUM_ATTRIBUTE; typedef enum WGPUVertexStepMode { - WGPUVertexStepMode_Undefined = 0x00000000, - WGPUVertexStepMode_VertexBufferNotUsed = 0x00000001, - WGPUVertexStepMode_Vertex = 0x00000002, - WGPUVertexStepMode_Instance = 0x00000003, - WGPUVertexStepMode_Force32 = 0x7FFFFFFF + WGPUVertexStepMode_Undefined = 0x00000000, + WGPUVertexStepMode_VertexBufferNotUsed = 0x00000001, + WGPUVertexStepMode_Vertex = 0x00000002, + WGPUVertexStepMode_Instance = 0x00000003, + WGPUVertexStepMode_Force32 = 0x7FFFFFFF } WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUWaitStatus { - WGPUWaitStatus_Success = 0x00000000, - WGPUWaitStatus_TimedOut = 0x00000001, - WGPUWaitStatus_UnsupportedTimeout = 0x00000002, - WGPUWaitStatus_UnsupportedCount = 0x00000003, - WGPUWaitStatus_UnsupportedMixedSources = 0x00000004, - WGPUWaitStatus_Unknown = 0x00000005, - WGPUWaitStatus_Force32 = 0x7FFFFFFF + WGPUWaitStatus_Success = 0x00000000, + WGPUWaitStatus_TimedOut = 0x00000001, + WGPUWaitStatus_UnsupportedTimeout = 0x00000002, + WGPUWaitStatus_UnsupportedCount = 0x00000003, + WGPUWaitStatus_UnsupportedMixedSources = 0x00000004, + WGPUWaitStatus_Unknown = 0x00000005, + WGPUWaitStatus_Force32 = 0x7FFFFFFF } WGPUWaitStatus 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_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_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 WGPUHeapProperty { - WGPUHeapProperty_Undefined = 0x00000000, - WGPUHeapProperty_DeviceLocal = 0x00000001, - WGPUHeapProperty_HostVisible = 0x00000002, - WGPUHeapProperty_HostCoherent = 0x00000004, - WGPUHeapProperty_HostUncached = 0x00000008, - WGPUHeapProperty_HostCached = 0x00000010, - WGPUHeapProperty_Force32 = 0x7FFFFFFF + WGPUHeapProperty_Undefined = 0x00000000, + WGPUHeapProperty_DeviceLocal = 0x00000001, + WGPUHeapProperty_HostVisible = 0x00000002, + WGPUHeapProperty_HostCoherent = 0x00000004, + WGPUHeapProperty_HostUncached = 0x00000008, + WGPUHeapProperty_HostCached = 0x00000010, + WGPUHeapProperty_Force32 = 0x7FFFFFFF } WGPUHeapProperty WGPU_ENUM_ATTRIBUTE; typedef WGPUFlags WGPUHeapPropertyFlags WGPU_ENUM_ATTRIBUTE; typedef enum WGPUMapMode { - WGPUMapMode_None = 0x00000000, - WGPUMapMode_Read = 0x00000001, - WGPUMapMode_Write = 0x00000002, - WGPUMapMode_Force32 = 0x7FFFFFFF + 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_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_TransientAttachment = 0x00000020, - WGPUTextureUsage_StorageAttachment = 0x00000040, - WGPUTextureUsage_Force32 = 0x7FFFFFFF + WGPUTextureUsage_None = 0x00000000, + WGPUTextureUsage_CopySrc = 0x00000001, + WGPUTextureUsage_CopyDst = 0x00000002, + WGPUTextureUsage_TextureBinding = 0x00000004, + WGPUTextureUsage_StorageBinding = 0x00000008, + WGPUTextureUsage_RenderAttachment = 0x00000010, + WGPUTextureUsage_TransientAttachment = 0x00000020, + WGPUTextureUsage_StorageAttachment = 0x00000040, + 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 (*WGPUCallback)(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 size_t (*WGPUDawnLoadCacheDataFunction)(void const * key, size_t keySize, void * value, size_t valueSize, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUDawnStoreCacheDataFunction)(void const * key, size_t keySize, void const * value, size_t valueSize, 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 (*WGPULoggingCallback)(WGPULoggingType type, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUPopErrorScopeCallback)(WGPUPopErrorScopeStatus status, WGPUErrorType type, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUBufferMapCallback)(WGPUBufferMapAsyncStatus status, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUCallback)(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 size_t (*WGPUDawnLoadCacheDataFunction)( + void const *key, size_t keySize, void *value, size_t valueSize, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUDawnStoreCacheDataFunction)( + void const *key, size_t keySize, void const *value, size_t valueSize, + 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 (*WGPULoggingCallback)(WGPULoggingType type, char const *message, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUPopErrorScopeCallback)( + WGPUPopErrorScopeStatus status, 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 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; + struct WGPUChainedStruct const *next; + WGPUSType sType; } WGPUChainedStruct WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUChainedStructOut { - struct WGPUChainedStructOut * next; - WGPUSType sType; + 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; - WGPUBool compatibilityMode; + WGPUChainedStructOut *nextInChain; + uint32_t vendorID; + char const *vendorName; + char const *architecture; + uint32_t deviceID; + char const *name; + char const *driverDescription; + WGPUAdapterType adapterType; + WGPUBackendType backendType; + WGPUBool compatibilityMode; } WGPUAdapterProperties WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUAdapterProperties typedef struct WGPUAdapterPropertiesD3D { - WGPUChainedStructOut chain; - uint32_t shaderModel; + WGPUChainedStructOut chain; + uint32_t shaderModel; } WGPUAdapterPropertiesD3D WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUAdapterProperties typedef struct WGPUAdapterPropertiesVk { - WGPUChainedStructOut chain; - uint32_t driverVersion; + WGPUChainedStructOut chain; + uint32_t driverVersion; } WGPUAdapterPropertiesVk 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; + 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; + WGPUBlendOperation operation; + WGPUBlendFactor srcFactor; + WGPUBlendFactor dstFactor; } WGPUBlendComponent WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBufferBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUBufferBindingType type; - WGPUBool hasDynamicOffset; - uint64_t minBindingSize; + 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; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; + WGPUBufferUsageFlags usage; + uint64_t size; + WGPUBool mappedAtCreation; } WGPUBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUBufferDescriptor typedef struct WGPUBufferHostMappedPointer { - WGPUChainedStruct chain; - void * pointer; - WGPUCallback disposeCallback; - void * userdata; + WGPUChainedStruct chain; + void *pointer; + WGPUCallback disposeCallback; + void *userdata; } WGPUBufferHostMappedPointer WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBufferMapCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPUBufferMapCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPUBufferMapCallback callback; + void *userdata; } WGPUBufferMapCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUColor { - double r; - double g; - double b; - double a; + double r; + double g; + double b; + double a; } WGPUColor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCommandBufferDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUCommandBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCommandEncoderDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUCommandEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCompilationInfoCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPUCompilationInfoCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPUCompilationInfoCallback callback; + void *userdata; } WGPUCompilationInfoCallbackInfo 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; + 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; + WGPUQuerySet querySet; + uint32_t beginningOfPassWriteIndex; + uint32_t endOfPassWriteIndex; } WGPUComputePassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUConstantEntry { - WGPUChainedStruct const * nextInChain; - char const * key; - double value; + WGPUChainedStruct const *nextInChain; + char const *key; + double value; } WGPUConstantEntry WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCopyTextureForBrowserOptions { - WGPUChainedStruct const * nextInChain; - WGPUBool flipY; - WGPUBool needsColorSpaceConversion; - WGPUAlphaMode srcAlphaMode; - WGPU_NULLABLE float const * srcTransferFunctionParameters; - WGPU_NULLABLE float const * conversionMatrix; - WGPU_NULLABLE float const * dstTransferFunctionParameters; - WGPUAlphaMode dstAlphaMode; - WGPUBool internalUsage; + WGPUChainedStruct const *nextInChain; + WGPUBool flipY; + WGPUBool needsColorSpaceConversion; + WGPUAlphaMode srcAlphaMode; + WGPU_NULLABLE float const *srcTransferFunctionParameters; + WGPU_NULLABLE float const *conversionMatrix; + WGPU_NULLABLE float const *dstTransferFunctionParameters; + WGPUAlphaMode dstAlphaMode; + WGPUBool internalUsage; } WGPUCopyTextureForBrowserOptions WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCreateComputePipelineAsyncCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPUCreateComputePipelineAsyncCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPUCreateComputePipelineAsyncCallback callback; + void *userdata; } WGPUCreateComputePipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCreateRenderPipelineAsyncCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPUCreateRenderPipelineAsyncCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPUCreateRenderPipelineAsyncCallback callback; + void *userdata; } WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUInstanceDescriptor typedef struct WGPUDawnWGSLBlocklist { - WGPUChainedStruct chain; - size_t blocklistedFeatureCount; - const char* const * blocklistedFeatures; + WGPUChainedStruct chain; + size_t blocklistedFeatureCount; + const char *const *blocklistedFeatures; } WGPUDawnWGSLBlocklist WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUAdapterProperties typedef struct WGPUDawnAdapterPropertiesPowerPreference { - WGPUChainedStructOut chain; - WGPUPowerPreference powerPreference; + WGPUChainedStructOut chain; + WGPUPowerPreference powerPreference; } WGPUDawnAdapterPropertiesPowerPreference WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUBufferDescriptor typedef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient { - WGPUChainedStruct chain; - WGPUBool outOfMemory; + WGPUChainedStruct chain; + WGPUBool outOfMemory; } WGPUDawnBufferDescriptorErrorInfoFromWireClient WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUDeviceDescriptor typedef struct WGPUDawnCacheDeviceDescriptor { - WGPUChainedStruct chain; - char const * isolationKey; - WGPUDawnLoadCacheDataFunction loadDataFunction; - WGPUDawnStoreCacheDataFunction storeDataFunction; - void * functionUserdata; + WGPUChainedStruct chain; + char const *isolationKey; + WGPUDawnLoadCacheDataFunction loadDataFunction; + WGPUDawnStoreCacheDataFunction storeDataFunction; + void *functionUserdata; } WGPUDawnCacheDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUComputePipelineDescriptor typedef struct WGPUDawnComputePipelineFullSubgroups { - WGPUChainedStruct chain; - WGPUBool requiresFullSubgroups; + WGPUChainedStruct chain; + WGPUBool requiresFullSubgroups; } WGPUDawnComputePipelineFullSubgroups WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUCommandEncoderDescriptor typedef struct WGPUDawnEncoderInternalUsageDescriptor { - WGPUChainedStruct chain; - WGPUBool useInternalUsages; + WGPUChainedStruct chain; + WGPUBool useInternalUsages; } WGPUDawnEncoderInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSupportedLimits typedef struct WGPUDawnExperimentalSubgroupLimits { - WGPUChainedStructOut chain; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; + WGPUChainedStructOut chain; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; } WGPUDawnExperimentalSubgroupLimits WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUMultisampleState typedef struct WGPUDawnMultisampleStateRenderToSingleSampled { - WGPUChainedStruct chain; - WGPUBool enabled; + WGPUChainedStruct chain; + WGPUBool enabled; } WGPUDawnMultisampleStateRenderToSingleSampled WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPURenderPassColorAttachment typedef struct WGPUDawnRenderPassColorAttachmentRenderToSingleSampled { - WGPUChainedStruct chain; - uint32_t implicitSampleCount; -} WGPUDawnRenderPassColorAttachmentRenderToSingleSampled WGPU_STRUCTURE_ATTRIBUTE; + WGPUChainedStruct chain; + uint32_t implicitSampleCount; +} WGPUDawnRenderPassColorAttachmentRenderToSingleSampled + WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUShaderModuleDescriptor typedef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor { - WGPUChainedStruct chain; - WGPUBool allowNonUniformDerivatives; + WGPUChainedStruct chain; + WGPUBool allowNonUniformDerivatives; } WGPUDawnShaderModuleSPIRVOptionsDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUTextureDescriptor typedef struct WGPUDawnTextureInternalUsageDescriptor { - WGPUChainedStruct chain; - WGPUTextureUsageFlags internalUsage; + WGPUChainedStruct chain; + WGPUTextureUsageFlags internalUsage; } WGPUDawnTextureInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUInstanceDescriptor // Can be chained in WGPURequestAdapterOptions // Can be chained in WGPUDeviceDescriptor typedef struct WGPUDawnTogglesDescriptor { - WGPUChainedStruct chain; - size_t enabledToggleCount; - const char* const * enabledToggles; - size_t disabledToggleCount; - const char* const * disabledToggles; + WGPUChainedStruct chain; + size_t enabledToggleCount; + const char *const *enabledToggles; + size_t disabledToggleCount; + const char *const *disabledToggles; } WGPUDawnTogglesDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUInstanceDescriptor typedef struct WGPUDawnWireWGSLControl { - WGPUChainedStruct chain; - WGPUBool enableExperimental; - WGPUBool enableUnsafe; - WGPUBool enableTesting; + WGPUChainedStruct chain; + WGPUBool enableExperimental; + WGPUBool enableUnsafe; + WGPUBool enableTesting; } WGPUDawnWireWGSLControl WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUDepthStencilState typedef struct WGPUDepthStencilStateDepthWriteDefinedDawn { - WGPUChainedStruct chain; - WGPUBool depthWriteDefined; + WGPUChainedStruct chain; + WGPUBool depthWriteDefined; } WGPUDepthStencilStateDepthWriteDefinedDawn WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUDrmFormatProperties { - uint64_t modifier; - uint32_t modifierPlaneCount; + uint64_t modifier; + uint32_t modifierPlaneCount; } WGPUDrmFormatProperties WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUExtent2D { - uint32_t width; - uint32_t height; + uint32_t width; + uint32_t height; } WGPUExtent2D WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUExtent3D { - uint32_t width; - uint32_t height; - uint32_t depthOrArrayLayers; + uint32_t width; + uint32_t height; + uint32_t depthOrArrayLayers; } WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUBindGroupEntry typedef struct WGPUExternalTextureBindingEntry { - WGPUChainedStruct chain; - WGPUExternalTexture externalTexture; + WGPUChainedStruct chain; + WGPUExternalTexture externalTexture; } WGPUExternalTextureBindingEntry WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUBindGroupLayoutEntry typedef struct WGPUExternalTextureBindingLayout { - WGPUChainedStruct chain; + WGPUChainedStruct chain; } WGPUExternalTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUFormatCapabilities { - WGPUChainedStructOut * nextInChain; + WGPUChainedStructOut *nextInChain; } WGPUFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUFuture { - uint64_t id; + uint64_t id; } WGPUFuture WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUInstanceFeatures { - WGPUChainedStruct const * nextInChain; - WGPUBool timedWaitAnyEnable; - size_t timedWaitAnyMaxCount; + WGPUChainedStruct const *nextInChain; + WGPUBool timedWaitAnyEnable; + size_t timedWaitAnyMaxCount; } WGPUInstanceFeatures 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; + 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 WGPUMemoryHeapInfo { - WGPUHeapPropertyFlags properties; - uint64_t size; + WGPUHeapPropertyFlags properties; + uint64_t size; } WGPUMemoryHeapInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUMultisampleState { - WGPUChainedStruct const * nextInChain; - uint32_t count; - uint32_t mask; - WGPUBool alphaToCoverageEnabled; + WGPUChainedStruct const *nextInChain; + uint32_t count; + uint32_t mask; + WGPUBool alphaToCoverageEnabled; } WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUOrigin2D { - uint32_t x; - uint32_t y; + uint32_t x; + uint32_t y; } WGPUOrigin2D WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUOrigin3D { - uint32_t x; - uint32_t y; - uint32_t z; + 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; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; + size_t bindGroupLayoutCount; + WGPUBindGroupLayout const *bindGroupLayouts; } WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUPipelineLayoutStorageAttachment { - WGPUChainedStruct const * nextInChain; - uint64_t offset; - WGPUTextureFormat format; + WGPUChainedStruct const *nextInChain; + uint64_t offset; + WGPUTextureFormat format; } WGPUPipelineLayoutStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUPopErrorScopeCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPUPopErrorScopeCallback callback; - WGPUErrorCallback oldCallback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPUPopErrorScopeCallback callback; + WGPUErrorCallback oldCallback; + void *userdata; } WGPUPopErrorScopeCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUPrimitiveState typedef struct WGPUPrimitiveDepthClipControl { - WGPUChainedStruct chain; - WGPUBool unclippedDepth; + WGPUChainedStruct chain; + WGPUBool unclippedDepth; } WGPUPrimitiveDepthClipControl WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUPrimitiveState { - WGPUChainedStruct const * nextInChain; - WGPUPrimitiveTopology topology; - WGPUIndexFormat stripIndexFormat; - WGPUFrontFace frontFace; - WGPUCullMode cullMode; + 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; + 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; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUQueueDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUQueueWorkDoneCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPUQueueWorkDoneCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPUQueueWorkDoneCallback callback; + void *userdata; } WGPUQueueWorkDoneCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderBundleDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + 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; + 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; + 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; + WGPUChainedStruct chain; + uint64_t maxDrawCount; } WGPURenderPassDescriptorMaxDrawCount WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPassTimestampWrites { - WGPUQuerySet querySet; - uint32_t beginningOfPassWriteIndex; - uint32_t endOfPassWriteIndex; + WGPUQuerySet querySet; + uint32_t beginningOfPassWriteIndex; + uint32_t endOfPassWriteIndex; } WGPURenderPassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURequestAdapterCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPURequestAdapterCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPURequestAdapterCallback callback; + void *userdata; } WGPURequestAdapterCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURequestAdapterOptions { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE WGPUSurface compatibleSurface; - WGPUPowerPreference powerPreference; - WGPUBackendType backendType; - WGPUBool forceFallbackAdapter; - WGPUBool compatibilityMode; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE WGPUSurface compatibleSurface; + WGPUPowerPreference powerPreference; + WGPUBackendType backendType; + WGPUBool forceFallbackAdapter; + WGPUBool compatibilityMode; } WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURequestDeviceCallbackInfo { - WGPUChainedStruct const * nextInChain; - WGPUCallbackMode mode; - WGPURequestDeviceCallback callback; - void * userdata; + WGPUChainedStruct const *nextInChain; + WGPUCallbackMode mode; + WGPURequestDeviceCallback callback; + void *userdata; } WGPURequestDeviceCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSamplerBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUSamplerBindingType type; + 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; + 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; // Can be chained in WGPUShaderModuleDescriptor typedef struct WGPUShaderModuleSPIRVDescriptor { - WGPUChainedStruct chain; - uint32_t codeSize; - uint32_t const * code; + 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; + WGPUChainedStruct chain; + char const *code; } WGPUShaderModuleWGSLDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUShaderModuleDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedBufferMemoryBeginAccessDescriptor { - WGPUChainedStruct const * nextInChain; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const * fences; - uint64_t const * signaledValues; + WGPUChainedStruct const *nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const *fences; + uint64_t const *signaledValues; } WGPUSharedBufferMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedBufferMemoryDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUSharedBufferMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedBufferMemoryEndAccessState { - WGPUChainedStructOut * nextInChain; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const * fences; - uint64_t const * signaledValues; + WGPUChainedStructOut *nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const *fences; + uint64_t const *signaledValues; } WGPUSharedBufferMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedBufferMemoryProperties { - WGPUChainedStructOut * nextInChain; - WGPUBufferUsageFlags usage; - uint64_t size; + WGPUChainedStructOut *nextInChain; + WGPUBufferUsageFlags usage; + uint64_t size; } WGPUSharedBufferMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceDescriptor typedef struct WGPUSharedFenceDXGISharedHandleDescriptor { - WGPUChainedStruct chain; - void * handle; + WGPUChainedStruct chain; + void *handle; } WGPUSharedFenceDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceExportInfo typedef struct WGPUSharedFenceDXGISharedHandleExportInfo { - WGPUChainedStructOut chain; - void * handle; + WGPUChainedStructOut chain; + void *handle; } WGPUSharedFenceDXGISharedHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceDescriptor typedef struct WGPUSharedFenceMTLSharedEventDescriptor { - WGPUChainedStruct chain; - void * sharedEvent; + WGPUChainedStruct chain; + void *sharedEvent; } WGPUSharedFenceMTLSharedEventDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceExportInfo typedef struct WGPUSharedFenceMTLSharedEventExportInfo { - WGPUChainedStructOut chain; - void * sharedEvent; + WGPUChainedStructOut chain; + void *sharedEvent; } WGPUSharedFenceMTLSharedEventExportInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedFenceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUSharedFenceDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedFenceExportInfo { - WGPUChainedStructOut * nextInChain; - WGPUSharedFenceType type; + WGPUChainedStructOut *nextInChain; + WGPUSharedFenceType type; } WGPUSharedFenceExportInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceDescriptor typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor { - WGPUChainedStruct chain; - int handle; + WGPUChainedStruct chain; + int handle; } WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceExportInfo typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo { - WGPUChainedStructOut chain; - int handle; + WGPUChainedStructOut chain; + int handle; } WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceDescriptor typedef struct WGPUSharedFenceVkSemaphoreSyncFDDescriptor { - WGPUChainedStruct chain; - int handle; + WGPUChainedStruct chain; + int handle; } WGPUSharedFenceVkSemaphoreSyncFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceExportInfo typedef struct WGPUSharedFenceVkSemaphoreSyncFDExportInfo { - WGPUChainedStructOut chain; - int handle; + WGPUChainedStructOut chain; + int handle; } WGPUSharedFenceVkSemaphoreSyncFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceDescriptor typedef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor { - WGPUChainedStruct chain; - uint32_t handle; + WGPUChainedStruct chain; + uint32_t handle; } WGPUSharedFenceVkSemaphoreZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedFenceExportInfo typedef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo { - WGPUChainedStructOut chain; - uint32_t handle; + WGPUChainedStructOut chain; + uint32_t handle; } WGPUSharedFenceVkSemaphoreZirconHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor { - WGPUChainedStruct chain; - void * handle; - WGPUBool useKeyedMutex; + WGPUChainedStruct chain; + void *handle; + WGPUBool useKeyedMutex; } WGPUSharedTextureMemoryDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryEGLImageDescriptor { - WGPUChainedStruct chain; - void * image; + WGPUChainedStruct chain; + void *image; } WGPUSharedTextureMemoryEGLImageDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryIOSurfaceDescriptor { - WGPUChainedStruct chain; - void * ioSurface; + WGPUChainedStruct chain; + void *ioSurface; } WGPUSharedTextureMemoryIOSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor { - WGPUChainedStruct chain; - void * handle; + WGPUChainedStruct chain; + void *handle; } WGPUSharedTextureMemoryAHardwareBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedTextureMemoryBeginAccessDescriptor { - WGPUChainedStruct const * nextInChain; - WGPUBool concurrentRead; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const * fences; - uint64_t const * signaledValues; + WGPUChainedStruct const *nextInChain; + WGPUBool concurrentRead; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const *fences; + uint64_t const *signaledValues; } WGPUSharedTextureMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedTextureMemoryDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUSharedTextureMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedTextureMemoryDmaBufPlane { - int fd; - uint64_t offset; - uint32_t stride; + int fd; + uint64_t offset; + uint32_t stride; } WGPUSharedTextureMemoryDmaBufPlane WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedTextureMemoryEndAccessState { - WGPUChainedStructOut * nextInChain; - WGPUBool initialized; - size_t fenceCount; - WGPUSharedFence const * fences; - uint64_t const * signaledValues; + WGPUChainedStructOut *nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const *fences; + uint64_t const *signaledValues; } WGPUSharedTextureMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryOpaqueFDDescriptor { - WGPUChainedStruct chain; - void const * vkImageCreateInfo; - int memoryFD; - uint32_t memoryTypeIndex; - uint64_t allocationSize; - WGPUBool dedicatedAllocation; + WGPUChainedStruct chain; + void const *vkImageCreateInfo; + int memoryFD; + uint32_t memoryTypeIndex; + uint64_t allocationSize; + WGPUBool dedicatedAllocation; } WGPUSharedTextureMemoryOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor { - WGPUChainedStruct chain; - WGPUBool dedicatedAllocation; -} WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor WGPU_STRUCTURE_ATTRIBUTE; + WGPUChainedStruct chain; + WGPUBool dedicatedAllocation; +} WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor + WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryBeginAccessDescriptor typedef struct WGPUSharedTextureMemoryVkImageLayoutBeginState { - WGPUChainedStruct chain; - int32_t oldLayout; - int32_t newLayout; + WGPUChainedStruct chain; + int32_t oldLayout; + int32_t newLayout; } WGPUSharedTextureMemoryVkImageLayoutBeginState WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryEndAccessState typedef struct WGPUSharedTextureMemoryVkImageLayoutEndState { - WGPUChainedStructOut chain; - int32_t oldLayout; - int32_t newLayout; + WGPUChainedStructOut chain; + int32_t oldLayout; + int32_t newLayout; } WGPUSharedTextureMemoryVkImageLayoutEndState WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryZirconHandleDescriptor { - WGPUChainedStruct chain; - uint32_t memoryFD; - uint64_t allocationSize; + WGPUChainedStruct chain; + uint32_t memoryFD; + uint64_t allocationSize; } WGPUSharedTextureMemoryZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUBindGroupLayoutEntry typedef struct WGPUStaticSamplerBindingLayout { - WGPUChainedStruct chain; - WGPUSampler sampler; + WGPUChainedStruct chain; + WGPUSampler sampler; } WGPUStaticSamplerBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUStencilFaceState { - WGPUCompareFunction compare; - WGPUStencilOperation failOp; - WGPUStencilOperation depthFailOp; - WGPUStencilOperation passOp; + WGPUCompareFunction compare; + WGPUStencilOperation failOp; + WGPUStencilOperation depthFailOp; + WGPUStencilOperation passOp; } WGPUStencilFaceState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUStorageTextureBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUStorageTextureAccess access; - WGPUTextureFormat format; - WGPUTextureViewDimension viewDimension; + WGPUChainedStruct const *nextInChain; + WGPUStorageTextureAccess access; + WGPUTextureFormat format; + WGPUTextureViewDimension viewDimension; } WGPUStorageTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSurfaceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; } WGPUSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromAndroidNativeWindow { - WGPUChainedStruct chain; - void * window; + WGPUChainedStruct chain; + void *window; } WGPUSurfaceDescriptorFromAndroidNativeWindow WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromCanvasHTMLSelector { - WGPUChainedStruct chain; - char const * selector; + WGPUChainedStruct chain; + char const *selector; } WGPUSurfaceDescriptorFromCanvasHTMLSelector WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromMetalLayer { - WGPUChainedStruct chain; - void * layer; + WGPUChainedStruct chain; + void *layer; } WGPUSurfaceDescriptorFromMetalLayer WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromWaylandSurface { - WGPUChainedStruct chain; - void * display; - void * surface; + WGPUChainedStruct chain; + void *display; + void *surface; } WGPUSurfaceDescriptorFromWaylandSurface WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromWindowsHWND { - WGPUChainedStruct chain; - void * hinstance; - void * hwnd; + WGPUChainedStruct chain; + void *hinstance; + void *hwnd; } WGPUSurfaceDescriptorFromWindowsHWND WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromWindowsCoreWindow { - WGPUChainedStruct chain; - void * coreWindow; + WGPUChainedStruct chain; + void *coreWindow; } WGPUSurfaceDescriptorFromWindowsCoreWindow WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromWindowsSwapChainPanel { - WGPUChainedStruct chain; - void * swapChainPanel; + WGPUChainedStruct chain; + void *swapChainPanel; } WGPUSurfaceDescriptorFromWindowsSwapChainPanel WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromXlibWindow { - WGPUChainedStruct chain; - void * display; - uint64_t window; + WGPUChainedStruct chain; + void *display; + uint64_t window; } WGPUSurfaceDescriptorFromXlibWindow WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSwapChainDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUTextureUsageFlags usage; - WGPUTextureFormat format; - uint32_t width; - uint32_t height; - WGPUPresentMode presentMode; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; + WGPUTextureUsageFlags usage; + WGPUTextureFormat format; + uint32_t width; + uint32_t height; + WGPUPresentMode presentMode; } WGPUSwapChainDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUTextureBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUTextureSampleType sampleType; - WGPUTextureViewDimension viewDimension; - WGPUBool multisampled; + WGPUChainedStruct const *nextInChain; + WGPUTextureSampleType sampleType; + WGPUTextureViewDimension viewDimension; + WGPUBool multisampled; } WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUTextureDescriptor typedef struct WGPUTextureBindingViewDimensionDescriptor { - WGPUChainedStruct chain; - WGPUTextureViewDimension textureBindingViewDimension; + WGPUChainedStruct chain; + WGPUTextureViewDimension textureBindingViewDimension; } WGPUTextureBindingViewDimensionDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUTextureDataLayout { - WGPUChainedStruct const * nextInChain; - uint64_t offset; - uint32_t bytesPerRow; - uint32_t rowsPerImage; + 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; + 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; + WGPUVertexFormat format; + uint64_t offset; + uint32_t shaderLocation; } WGPUVertexAttribute WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUAdapterProperties typedef struct WGPUAdapterPropertiesMemoryHeaps { - WGPUChainedStructOut chain; - size_t heapCount; - WGPUMemoryHeapInfo const * heapInfo; + WGPUChainedStructOut chain; + size_t heapCount; + WGPUMemoryHeapInfo const *heapInfo; } WGPUAdapterPropertiesMemoryHeaps WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBindGroupDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUBindGroupLayout layout; - size_t entryCount; - WGPUBindGroupEntry const * entries; + 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; + 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; + WGPUBlendComponent color; + WGPUBlendComponent alpha; } WGPUBlendState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCompilationInfo { - WGPUChainedStruct const * nextInChain; - size_t messageCount; - WGPUCompilationMessage const * messages; + 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; + 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; + 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; // Can be chained in WGPUFormatCapabilities typedef struct WGPUDrmFormatCapabilities { - WGPUChainedStructOut chain; - size_t propertiesCount; - WGPUDrmFormatProperties const * properties; + WGPUChainedStructOut chain; + size_t propertiesCount; + WGPUDrmFormatProperties const *properties; } WGPUDrmFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUExternalTextureDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUTextureView plane0; - WGPU_NULLABLE WGPUTextureView plane1; - WGPUOrigin2D visibleOrigin; - WGPUExtent2D visibleSize; - WGPUBool doYuvToRgbConversionOnly; - WGPU_NULLABLE float const * yuvToRgbConversionMatrix; - float const * srcTransferFunctionParameters; - float const * dstTransferFunctionParameters; - float const * gamutConversionMatrix; - WGPUBool flipY; - WGPUBool mirrored; - WGPUExternalTextureRotation rotation; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE char const *label; + WGPUTextureView plane0; + WGPU_NULLABLE WGPUTextureView plane1; + WGPUOrigin2D visibleOrigin; + WGPUExtent2D visibleSize; + WGPUBool doYuvToRgbConversionOnly; + WGPU_NULLABLE float const *yuvToRgbConversionMatrix; + float const *srcTransferFunctionParameters; + float const *dstTransferFunctionParameters; + float const *gamutConversionMatrix; + WGPUBool flipY; + WGPUBool mirrored; + WGPUExternalTextureRotation rotation; } WGPUExternalTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUFutureWaitInfo { - WGPUFuture future; - WGPUBool completed; + WGPUFuture future; + WGPUBool completed; } WGPUFutureWaitInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUImageCopyBuffer { - WGPUChainedStruct const * nextInChain; - WGPUTextureDataLayout layout; - WGPUBuffer buffer; + WGPUChainedStruct const *nextInChain; + WGPUTextureDataLayout layout; + WGPUBuffer buffer; } WGPUImageCopyBuffer WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUImageCopyExternalTexture { - WGPUChainedStruct const * nextInChain; - WGPUExternalTexture externalTexture; - WGPUOrigin3D origin; - WGPUExtent2D naturalSize; + WGPUChainedStruct const *nextInChain; + WGPUExternalTexture externalTexture; + WGPUOrigin3D origin; + WGPUExtent2D naturalSize; } WGPUImageCopyExternalTexture WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUImageCopyTexture { - WGPUChainedStruct const * nextInChain; - WGPUTexture texture; - uint32_t mipLevel; - WGPUOrigin3D origin; - WGPUTextureAspect aspect; + WGPUChainedStruct const *nextInChain; + WGPUTexture texture; + uint32_t mipLevel; + WGPUOrigin3D origin; + WGPUTextureAspect aspect; } WGPUImageCopyTexture WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUInstanceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPUInstanceFeatures features; + WGPUChainedStruct const *nextInChain; + WGPUInstanceFeatures features; } WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUPipelineLayoutDescriptor typedef struct WGPUPipelineLayoutPixelLocalStorage { - WGPUChainedStruct chain; - uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount; - WGPUPipelineLayoutStorageAttachment const * storageAttachments; + WGPUChainedStruct chain; + uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount; + WGPUPipelineLayoutStorageAttachment const *storageAttachments; } WGPUPipelineLayoutPixelLocalStorage WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUProgrammableStageDescriptor { - WGPUChainedStruct const * nextInChain; - WGPUShaderModule module; - WGPU_NULLABLE char const * entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; + 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; - uint32_t depthSlice; - WGPU_NULLABLE WGPUTextureView resolveTarget; - WGPULoadOp loadOp; - WGPUStoreOp storeOp; - WGPUColor clearValue; + WGPUChainedStruct const *nextInChain; + WGPU_NULLABLE WGPUTextureView view; + uint32_t depthSlice; + WGPU_NULLABLE WGPUTextureView resolveTarget; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; } WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPassStorageAttachment { - WGPUChainedStruct const * nextInChain; - uint64_t offset; - WGPUTextureView storage; - WGPULoadOp loadOp; - WGPUStoreOp storeOp; - WGPUColor clearValue; + WGPUChainedStruct const *nextInChain; + uint64_t offset; + WGPUTextureView storage; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; } WGPURenderPassStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURequiredLimits { - WGPUChainedStruct const * nextInChain; - WGPULimits limits; + WGPUChainedStruct const *nextInChain; + WGPULimits limits; } WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryDmaBufDescriptor { - WGPUChainedStruct chain; - WGPUExtent3D size; - uint32_t drmFormat; - uint64_t drmModifier; - size_t planeCount; - WGPUSharedTextureMemoryDmaBufPlane const * planes; + WGPUChainedStruct chain; + WGPUExtent3D size; + uint32_t drmFormat; + uint64_t drmModifier; + size_t planeCount; + WGPUSharedTextureMemoryDmaBufPlane const *planes; } WGPUSharedTextureMemoryDmaBufDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSharedTextureMemoryProperties { - WGPUChainedStructOut * nextInChain; - WGPUTextureUsageFlags usage; - WGPUExtent3D size; - WGPUTextureFormat format; + WGPUChainedStructOut *nextInChain; + WGPUTextureUsageFlags usage; + WGPUExtent3D size; + WGPUTextureFormat format; } WGPUSharedTextureMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSharedTextureMemoryDescriptor typedef struct WGPUSharedTextureMemoryVkImageDescriptor { - WGPUChainedStruct chain; - int32_t vkFormat; - int32_t vkUsageFlags; - WGPUExtent3D vkExtent3D; + WGPUChainedStruct chain; + int32_t vkFormat; + int32_t vkUsageFlags; + WGPUExtent3D vkExtent3D; } WGPUSharedTextureMemoryVkImageDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSupportedLimits { - WGPUChainedStructOut * nextInChain; - WGPULimits limits; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; // Can be chained in WGPURenderPassDescriptor typedef struct WGPURenderPassPixelLocalStorage { - WGPUChainedStruct chain; - uint64_t totalPixelLocalStorageSize; - size_t storageAttachmentCount; - WGPURenderPassStorageAttachment const * storageAttachments; + WGPUChainedStruct chain; + uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount; + WGPURenderPassStorageAttachment const *storageAttachments; } WGPURenderPassPixelLocalStorage 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; + 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; + 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; + 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 @@ -2135,625 +2172,1460 @@ extern "C" { #if !defined(WGPU_SKIP_PROCS) -typedef void (*WGPUProcAdapterPropertiesFreeMembers)(WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterPropertiesMemoryHeapsFreeMembers)(WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUInstance (*WGPUProcCreateInstance)(WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDrmFormatCapabilitiesFreeMembers)(WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcGetInstanceFeatures)(WGPUInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryEndAccessStateFreeMembers)(WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryEndAccessStateFreeMembers)(WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterPropertiesFreeMembers)( + WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterPropertiesMemoryHeapsFreeMembers)( + WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUInstance (*WGPUProcCreateInstance)( + WGPUInstanceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDrmFormatCapabilitiesFreeMembers)( + WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcGetInstanceFeatures)(WGPUInstanceFeatures *features) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUProc (*WGPUProcGetProcAddress)( + WGPUDevice device, char const *procName) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryEndAccessStateFreeMembers)( + WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryEndAccessStateFreeMembers)( + WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; // Procs of Adapter -typedef WGPUDevice (*WGPUProcAdapterCreateDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcAdapterGetFormatCapabilities)(WGPUAdapter adapter, WGPUTextureFormat format, WGPUFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUInstance (*WGPUProcAdapterGetInstance)(WGPUAdapter adapter) 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 WGPUFuture (*WGPUProcAdapterRequestDeviceF)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * options, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterReference)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUDevice (*WGPUProcAdapterCreateDevice)( + WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +typedef size_t (*WGPUProcAdapterEnumerateFeatures)( + WGPUAdapter adapter, WGPUFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcAdapterGetFormatCapabilities)( + WGPUAdapter adapter, WGPUTextureFormat format, + WGPUFormatCapabilities *capabilities) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUInstance (*WGPUProcAdapterGetInstance)(WGPUAdapter adapter) + 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 WGPUFuture (*WGPUProcAdapterRequestDeviceF)( + WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *options, + WGPURequestDeviceCallbackInfo callbackInfo) 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; +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; +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 WGPUFuture (*WGPUProcBufferMapAsyncF)(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer buffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; +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 WGPUFuture (*WGPUProcBufferMapAsyncF)( + WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, + WGPUBufferMapCallbackInfo callbackInfo) 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; +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; +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 (*WGPUProcCommandEncoderInjectValidationError)(WGPUCommandEncoder commandEncoder, char const * message) 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 (*WGPUProcCommandEncoderWriteBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) 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; +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 (*WGPUProcCommandEncoderInjectValidationError)( + WGPUCommandEncoder commandEncoder, + char const *message) 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 (*WGPUProcCommandEncoderWriteBuffer)( + WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, + uint8_t const *data, uint64_t size) 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 (*WGPUProcComputePassEncoderWriteTimestamp)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderReference)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderRelease)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +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 (*WGPUProcComputePassEncoderWriteTimestamp)( + WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, + uint32_t queryIndex) 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; +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 WGPUFuture (*WGPUProcDeviceCreateComputePipelineAsyncF)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBuffer (*WGPUProcDeviceCreateErrorBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUExternalTexture (*WGPUProcDeviceCreateErrorExternalTexture)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUShaderModule (*WGPUProcDeviceCreateErrorShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, char const * errorMessage) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTexture (*WGPUProcDeviceCreateErrorTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUExternalTexture (*WGPUProcDeviceCreateExternalTexture)(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) 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 WGPUFuture (*WGPUProcDeviceCreateRenderPipelineAsyncF)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) 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 WGPUSwapChain (*WGPUProcDeviceCreateSwapChain)(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor 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 void (*WGPUProcDeviceForceLoss)(WGPUDevice device, WGPUDeviceLostReason type, char const * message) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUAdapter (*WGPUProcDeviceGetAdapter)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureUsageFlags (*WGPUProcDeviceGetSupportedSurfaceUsage)(WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSharedBufferMemory (*WGPUProcDeviceImportSharedBufferMemory)(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSharedFence (*WGPUProcDeviceImportSharedFence)(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSharedTextureMemory (*WGPUProcDeviceImportSharedTextureMemory)(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceInjectError)(WGPUDevice device, WGPUErrorType type, char const * message) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback oldCallback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUFuture (*WGPUProcDevicePopErrorScopeF)(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetDeviceLostCallback)(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetLoggingCallback)(WGPUDevice device, WGPULoggingCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +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 WGPUFuture (*WGPUProcDeviceCreateComputePipelineAsyncF)( + WGPUDevice device, WGPUComputePipelineDescriptor const *descriptor, + WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBuffer (*WGPUProcDeviceCreateErrorBuffer)( + WGPUDevice device, + WGPUBufferDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUExternalTexture (*WGPUProcDeviceCreateErrorExternalTexture)( + WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUShaderModule (*WGPUProcDeviceCreateErrorShaderModule)( + WGPUDevice device, WGPUShaderModuleDescriptor const *descriptor, + char const *errorMessage) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcDeviceCreateErrorTexture)( + WGPUDevice device, + WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUExternalTexture (*WGPUProcDeviceCreateExternalTexture)( + WGPUDevice device, + WGPUExternalTextureDescriptor const *externalTextureDescriptor) + 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 WGPUFuture (*WGPUProcDeviceCreateRenderPipelineAsyncF)( + WGPUDevice device, WGPURenderPipelineDescriptor const *descriptor, + WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) + 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 WGPUSwapChain (*WGPUProcDeviceCreateSwapChain)( + WGPUDevice device, WGPUSurface surface, + WGPUSwapChainDescriptor 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 void (*WGPUProcDeviceForceLoss)( + WGPUDevice device, WGPUDeviceLostReason type, + char const *message) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUAdapter (*WGPUProcDeviceGetAdapter)(WGPUDevice device) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcDeviceGetLimits)( + WGPUDevice device, WGPUSupportedLimits *limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureUsageFlags (*WGPUProcDeviceGetSupportedSurfaceUsage)( + WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcDeviceHasFeature)( + WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedBufferMemory (*WGPUProcDeviceImportSharedBufferMemory)( + WGPUDevice device, + WGPUSharedBufferMemoryDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedFence (*WGPUProcDeviceImportSharedFence)( + WGPUDevice device, + WGPUSharedFenceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedTextureMemory (*WGPUProcDeviceImportSharedTextureMemory)( + WGPUDevice device, WGPUSharedTextureMemoryDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceInjectError)(WGPUDevice device, WGPUErrorType type, + char const *message) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDevicePopErrorScope)( + WGPUDevice device, WGPUErrorCallback oldCallback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcDevicePopErrorScopeF)( + WGPUDevice device, + WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDevicePushErrorScope)( + WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetDeviceLostCallback)( + WGPUDevice device, WGPUDeviceLostCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const *label) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetLoggingCallback)( + WGPUDevice device, WGPULoggingCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)( + WGPUDevice device, WGPUErrorCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; typedef void (*WGPUProcDeviceTick)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceValidateTextureDescriptor)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceReference)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceValidateTextureDescriptor)( + WGPUDevice device, + WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceReference)(WGPUDevice device) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) + WGPU_FUNCTION_ATTRIBUTE; // Procs of ExternalTexture -typedef void (*WGPUProcExternalTextureDestroy)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureExpire)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureRefresh)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureSetLabel)(WGPUExternalTexture externalTexture, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureReference)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcExternalTextureRelease)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureDestroy)( + WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureExpire)( + WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureRefresh)( + WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureSetLabel)( + WGPUExternalTexture externalTexture, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureReference)( + WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureRelease)( + WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; // Procs of Instance -typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef size_t (*WGPUProcInstanceEnumerateWGSLLanguageFeatures)(WGPUInstance instance, WGPUWGSLFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcInstanceHasWGSLLanguageFeature)(WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture (*WGPUProcInstanceRequestAdapterF)(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUWaitStatus (*WGPUProcInstanceWaitAny)(WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcInstanceReference)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSurface (*WGPUProcInstanceCreateSurface)( + WGPUInstance instance, + WGPUSurfaceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef size_t (*WGPUProcInstanceEnumerateWGSLLanguageFeatures)( + WGPUInstance instance, + WGPUWGSLFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcInstanceHasWGSLLanguageFeature)( + WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture (*WGPUProcInstanceRequestAdapterF)( + WGPUInstance instance, + WGPU_NULLABLE WGPURequestAdapterOptions const *options, + WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUWaitStatus (*WGPUProcInstanceWaitAny)( + WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo *futures, + uint64_t timeoutNS) 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; +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; +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 (*WGPUProcQueueCopyExternalTextureForBrowser)(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueCopyTextureForBrowser)(WGPUQueue queue, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUFuture (*WGPUProcQueueOnSubmittedWorkDoneF)(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) 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 (*WGPUProcQueueCopyExternalTextureForBrowser)( + WGPUQueue queue, WGPUImageCopyExternalTexture const *source, + WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, + WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueCopyTextureForBrowser)( + WGPUQueue queue, WGPUImageCopyTexture const *source, + WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, + WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueOnSubmittedWorkDone)( + WGPUQueue queue, WGPUQueueWorkDoneCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcQueueOnSubmittedWorkDoneF)( + WGPUQueue queue, + WGPUQueueWorkDoneCallbackInfo callbackInfo) 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; +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; +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 (*WGPUProcRenderPassEncoderPixelLocalStorageBarrier)(WGPURenderPassEncoder renderPassEncoder) 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 (*WGPUProcRenderPassEncoderWriteTimestamp)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderReference)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderRelease)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +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 (*WGPUProcRenderPassEncoderPixelLocalStorageBarrier)( + WGPURenderPassEncoder renderPassEncoder) 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 (*WGPUProcRenderPassEncoderWriteTimestamp)( + WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, + uint32_t queryIndex) 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; +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; +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 WGPUFuture (*WGPUProcShaderModuleGetCompilationInfoF)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) 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; +typedef void (*WGPUProcShaderModuleGetCompilationInfo)( + WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcShaderModuleGetCompilationInfoF)( + WGPUShaderModule shaderModule, + WGPUCompilationInfoCallbackInfo callbackInfo) 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 SharedBufferMemory -typedef WGPUBool (*WGPUProcSharedBufferMemoryBeginAccess)(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBuffer (*WGPUProcSharedBufferMemoryCreateBuffer)(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedBufferMemoryEndAccess)(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryGetProperties)(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedBufferMemoryIsDeviceLost)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemorySetLabel)(WGPUSharedBufferMemory sharedBufferMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryReference)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedBufferMemoryRelease)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedBufferMemoryBeginAccess)( + WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, + WGPUSharedBufferMemoryBeginAccessDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBuffer (*WGPUProcSharedBufferMemoryCreateBuffer)( + WGPUSharedBufferMemory sharedBufferMemory, + WGPU_NULLABLE WGPUBufferDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedBufferMemoryEndAccess)( + WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, + WGPUSharedBufferMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryGetProperties)( + WGPUSharedBufferMemory sharedBufferMemory, + WGPUSharedBufferMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedBufferMemoryIsDeviceLost)( + WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemorySetLabel)( + WGPUSharedBufferMemory sharedBufferMemory, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryReference)( + WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryRelease)( + WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; // Procs of SharedFence -typedef void (*WGPUProcSharedFenceExportInfo)(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedFenceReference)(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedFenceRelease)(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceExportInfo)(WGPUSharedFence sharedFence, + WGPUSharedFenceExportInfo *info) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceReference)(WGPUSharedFence sharedFence) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceRelease)(WGPUSharedFence sharedFence) + WGPU_FUNCTION_ATTRIBUTE; // Procs of SharedTextureMemory -typedef WGPUBool (*WGPUProcSharedTextureMemoryBeginAccess)(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTexture (*WGPUProcSharedTextureMemoryCreateTexture)(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedTextureMemoryEndAccess)(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryGetProperties)(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcSharedTextureMemoryIsDeviceLost)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemorySetLabel)(WGPUSharedTextureMemory sharedTextureMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryReference)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSharedTextureMemoryRelease)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedTextureMemoryBeginAccess)( + WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, + WGPUSharedTextureMemoryBeginAccessDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcSharedTextureMemoryCreateTexture)( + WGPUSharedTextureMemory sharedTextureMemory, + WGPU_NULLABLE WGPUTextureDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedTextureMemoryEndAccess)( + WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, + WGPUSharedTextureMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryGetProperties)( + WGPUSharedTextureMemory sharedTextureMemory, + WGPUSharedTextureMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedTextureMemoryIsDeviceLost)( + WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemorySetLabel)( + WGPUSharedTextureMemory sharedTextureMemory, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryReference)( + WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryRelease)( + WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; // Procs of Surface -typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)( + WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) + WGPU_FUNCTION_ATTRIBUTE; // Procs of SwapChain -typedef WGPUTexture (*WGPUProcSwapChainGetCurrentTexture)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureView (*WGPUProcSwapChainGetCurrentTextureView)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSwapChainPresent)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSwapChainReference)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSwapChainRelease)(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcSwapChainGetCurrentTexture)( + WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureView (*WGPUProcSwapChainGetCurrentTextureView)( + WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSwapChainPresent)(WGPUSwapChain swapChain) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSwapChainReference)(WGPUSwapChain swapChain) + WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSwapChainRelease)(WGPUSwapChain swapChain) + WGPU_FUNCTION_ATTRIBUTE; // Procs of Texture -typedef WGPUTextureView (*WGPUProcTextureCreateErrorView)(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -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; +typedef WGPUTextureView (*WGPUProcTextureCreateErrorView)( + WGPUTexture texture, + WGPU_NULLABLE WGPUTextureViewDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +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; +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) +#endif // !defined(WGPU_SKIP_PROCS) #if !defined(WGPU_SKIP_DECLARATIONS) -WGPU_EXPORT void wgpuAdapterPropertiesFreeMembers(WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterPropertiesMemoryHeapsFreeMembers(WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDrmFormatCapabilitiesFreeMembers(WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuGetInstanceFeatures(WGPUInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPU_NULLABLE WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryEndAccessStateFreeMembers(WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryEndAccessStateFreeMembers(WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterPropertiesFreeMembers(WGPUAdapterProperties value) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterPropertiesMemoryHeapsFreeMembers( + WGPUAdapterPropertiesMemoryHeaps value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUInstance +wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDrmFormatCapabilitiesFreeMembers( + WGPUDrmFormatCapabilities value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuGetInstanceFeatures(WGPUInstanceFeatures *features) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPU_NULLABLE WGPUDevice device, + char const *procName) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryEndAccessStateFreeMembers( + WGPUSharedBufferMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryEndAccessStateFreeMembers( + WGPUSharedTextureMemoryEndAccessState value) WGPU_FUNCTION_ATTRIBUTE; // Methods of Adapter -WGPU_EXPORT WGPUDevice wgpuAdapterCreateDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterGetFormatCapabilities(WGPUAdapter adapter, WGPUTextureFormat format, WGPUFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter) 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 WGPUFuture wgpuAdapterRequestDeviceF(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * options, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUDevice wgpuAdapterCreateDevice( + WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures( + WGPUAdapter adapter, WGPUFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuAdapterGetFormatCapabilities( + WGPUAdapter adapter, WGPUTextureFormat format, + WGPUFormatCapabilities *capabilities) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter) + 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 WGPUFuture wgpuAdapterRequestDeviceF( + WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const *options, + WGPURequestDeviceCallbackInfo callbackInfo) 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; +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; +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 WGPUFuture wgpuBufferMapAsyncF(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferSetLabel(WGPUBuffer buffer, char const * label) 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 WGPUFuture wgpuBufferMapAsyncF( + WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, + WGPUBufferMapCallbackInfo callbackInfo) 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; +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 wgpuCommandEncoderInjectValidationError(WGPUCommandEncoder commandEncoder, char const * message) 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 wgpuCommandEncoderWriteBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) 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; +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 wgpuCommandEncoderInjectValidationError( + WGPUCommandEncoder commandEncoder, + char const *message) 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 wgpuCommandEncoderWriteBuffer( + WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, + uint8_t const *data, uint64_t size) 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 wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +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 wgpuComputePassEncoderWriteTimestamp( + WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, + uint32_t queryIndex) 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; +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 WGPUFuture wgpuDeviceCreateComputePipelineAsyncF(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateErrorShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, char const * errorMessage) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTexture wgpuDeviceCreateErrorTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) 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 WGPUFuture wgpuDeviceCreateRenderPipelineAsyncF(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) 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 WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +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 WGPUFuture wgpuDeviceCreateComputePipelineAsyncF( + WGPUDevice device, WGPUComputePipelineDescriptor const *descriptor, + WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer( + WGPUDevice device, + WGPUBufferDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUExternalTexture +wgpuDeviceCreateErrorExternalTexture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateErrorShaderModule( + WGPUDevice device, WGPUShaderModuleDescriptor const *descriptor, + char const *errorMessage) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuDeviceCreateErrorTexture( + WGPUDevice device, + WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture( + WGPUDevice device, + WGPUExternalTextureDescriptor const *externalTextureDescriptor) + 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 WGPUFuture wgpuDeviceCreateRenderPipelineAsyncF( + WGPUDevice device, WGPURenderPipelineDescriptor const *descriptor, + WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) + 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 WGPUSwapChain wgpuDeviceCreateSwapChain( + WGPUDevice device, WGPUSurface surface, + WGPUSwapChainDescriptor 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 void wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, char const * message) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device) 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 WGPUTextureUsageFlags wgpuDeviceGetSupportedSurfaceUsage(WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSharedFence wgpuDeviceImportSharedFence(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, char const * message) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback oldCallback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScopeF(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetDeviceLostCallback(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures( + WGPUDevice device, WGPUFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, + char const *message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device) + 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 WGPUTextureUsageFlags wgpuDeviceGetSupportedSurfaceUsage( + WGPUDevice device, WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuDeviceHasFeature( + WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory( + WGPUDevice device, + WGPUSharedBufferMemoryDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedFence wgpuDeviceImportSharedFence( + WGPUDevice device, + WGPUSharedFenceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory( + WGPUDevice device, WGPUSharedTextureMemoryDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, + char const *message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback oldCallback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScopeF( + WGPUDevice device, + WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDevicePushErrorScope(WGPUDevice device, + WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDeviceSetDeviceLostCallback(WGPUDevice device, + WGPUDeviceLostCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, + WGPUErrorCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT void wgpuDeviceTick(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceValidateTextureDescriptor(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceValidateTextureDescriptor( + WGPUDevice device, + WGPUTextureDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; // Methods of ExternalTexture -WGPU_EXPORT void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureReference(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureReference( + WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) + WGPU_FUNCTION_ATTRIBUTE; // Methods of Instance -WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT size_t wgpuInstanceEnumerateWGSLLanguageFeatures(WGPUInstance instance, WGPUWGSLFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuInstanceHasWGSLLanguageFeature(WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture wgpuInstanceRequestAdapterF(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUWaitStatus wgpuInstanceWaitAny(WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface( + WGPUInstance instance, + WGPUSurfaceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT size_t wgpuInstanceEnumerateWGSLLanguageFeatures( + WGPUInstance instance, + WGPUWGSLFeatureName *features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuInstanceHasWGSLLanguageFeature( + WGPUInstance instance, WGPUWGSLFeatureName feature) 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 WGPUFuture wgpuInstanceRequestAdapterF( + WGPUInstance instance, + WGPU_NULLABLE WGPURequestAdapterOptions const *options, + WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUWaitStatus wgpuInstanceWaitAny( + WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo *futures, + uint64_t timeoutNS) 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; +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; +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 wgpuQueueCopyExternalTextureForBrowser(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueCopyTextureForBrowser(WGPUQueue queue, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUFuture wgpuQueueOnSubmittedWorkDoneF(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) 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 wgpuQueueCopyExternalTextureForBrowser( + WGPUQueue queue, WGPUImageCopyExternalTexture const *source, + WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, + WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueCopyTextureForBrowser( + WGPUQueue queue, WGPUImageCopyTexture const *source, + WGPUImageCopyTexture const *destination, WGPUExtent3D const *copySize, + WGPUCopyTextureForBrowserOptions const *options) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, + WGPUQueueWorkDoneCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuQueueOnSubmittedWorkDoneF( + WGPUQueue queue, + WGPUQueueWorkDoneCallbackInfo callbackInfo) 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; +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; +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 wgpuRenderPassEncoderPixelLocalStorageBarrier(WGPURenderPassEncoder renderPassEncoder) 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 wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +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 wgpuRenderPassEncoderPixelLocalStorageBarrier( + WGPURenderPassEncoder renderPassEncoder) 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 wgpuRenderPassEncoderWriteTimestamp( + WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, + uint32_t queryIndex) 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; +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; +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 WGPUFuture wgpuShaderModuleGetCompilationInfoF(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) 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; +WGPU_EXPORT void +wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, + WGPUCompilationInfoCallback callback, + void *userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuShaderModuleGetCompilationInfoF( + WGPUShaderModule shaderModule, + WGPUCompilationInfoCallbackInfo callbackInfo) 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 SharedBufferMemory -WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryBeginAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBuffer wgpuSharedBufferMemoryCreateBuffer(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryEndAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryGetProperties(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryIsDeviceLost(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryReference(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedBufferMemoryRelease(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryBeginAccess( + WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, + WGPUSharedBufferMemoryBeginAccessDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBuffer wgpuSharedBufferMemoryCreateBuffer( + WGPUSharedBufferMemory sharedBufferMemory, + WGPU_NULLABLE WGPUBufferDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryEndAccess( + WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, + WGPUSharedBufferMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryGetProperties( + WGPUSharedBufferMemory sharedBufferMemory, + WGPUSharedBufferMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryIsDeviceLost( + WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryReference( + WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryRelease( + WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; // Methods of SharedFence -WGPU_EXPORT void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedFenceReference(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedFenceRelease(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, + WGPUSharedFenceExportInfo *info) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSharedFenceReference(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSharedFenceRelease(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; // Methods of SharedTextureMemory -WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryBeginAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTexture wgpuSharedTextureMemoryCreateTexture(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryEndAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryGetProperties(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryIsDeviceLost(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryReference(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSharedTextureMemoryRelease(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryBeginAccess( + WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, + WGPUSharedTextureMemoryBeginAccessDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuSharedTextureMemoryCreateTexture( + WGPUSharedTextureMemory sharedTextureMemory, + WGPU_NULLABLE WGPUTextureDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryEndAccess( + WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, + WGPUSharedTextureMemoryEndAccessState *descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryGetProperties( + WGPUSharedTextureMemory sharedTextureMemory, + WGPUSharedTextureMemoryProperties *properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryIsDeviceLost( + WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, + char const *label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryReference( + WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryRelease( + WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; // Methods of Surface -WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat( + WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; // Methods of SwapChain -WGPU_EXPORT WGPUTexture wgpuSwapChainGetCurrentTexture(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSwapChainPresent(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSwapChainReference(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSwapChainRelease(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuSwapChainGetCurrentTexture(WGPUSwapChain swapChain) + WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView( + WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSwapChainPresent(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSwapChainReference(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void +wgpuSwapChainRelease(WGPUSwapChain swapChain) WGPU_FUNCTION_ATTRIBUTE; // Methods of Texture -WGPU_EXPORT WGPUTextureView wgpuTextureCreateErrorView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -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; +WGPU_EXPORT WGPUTextureView wgpuTextureCreateErrorView( + WGPUTexture texture, + WGPU_NULLABLE WGPUTextureViewDescriptor const *descriptor) + WGPU_FUNCTION_ATTRIBUTE; +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) +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" diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h index 96bbec4f44..49340c3afb 100644 --- a/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h +++ b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_chained_struct.h @@ -1,5 +1,6 @@ #ifdef __EMSCRIPTEN__ -#error "Do not include this header. Emscripten already provides headers needed for WebGPU." +#error \ + "Do not include this header. Emscripten already provides headers needed for WebGPU." #endif #ifndef WEBGPU_CPP_CHAINED_STRUCT_H_ #define WEBGPU_CPP_CHAINED_STRUCT_H_ @@ -7,23 +8,24 @@ #include #include -// This header file declares the ChainedStruct structures separately from the WebGPU -// headers so that dependencies can directly extend structures without including the larger header -// which exposes capabilities that may require correctly set proc tables. +// This header file declares the ChainedStruct structures separately from the +// WebGPU headers so that dependencies can directly extend structures without +// including the larger header which exposes capabilities that may require +// correctly set proc tables. namespace wgpu { - enum class SType : uint32_t; +enum class SType : uint32_t; - struct ChainedStruct { - ChainedStruct const * nextInChain = nullptr; - SType sType = SType(0u); - }; +struct ChainedStruct { + ChainedStruct const *nextInChain = nullptr; + SType sType = SType(0u); +}; - struct ChainedStructOut { - ChainedStructOut * nextInChain = nullptr; - SType sType = SType(0u); - }; +struct ChainedStructOut { + ChainedStructOut *nextInChain = nullptr; + SType sType = SType(0u); +}; -} // namespace wgpu} +} // namespace wgpu #endif // WEBGPU_CPP_CHAINED_STRUCT_H_ diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h index 8bf43fa1f9..2fb01b6c2c 100644 --- a/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h +++ b/package/android/cpp/rnskia-android/webgpu/webgpu_cpp_print.h @@ -11,1881 +11,2062 @@ namespace wgpu { - template - std::basic_ostream& operator<<(std::basic_ostream& o, WGSLFeatureName value) { - switch (value) { - case WGSLFeatureName::Undefined: - o << "WGSLFeatureName::Undefined"; - break; - case WGSLFeatureName::ReadonlyAndReadwriteStorageTextures: - o << "WGSLFeatureName::ReadonlyAndReadwriteStorageTextures"; - break; - case WGSLFeatureName::Packed4x8IntegerDotProduct: - o << "WGSLFeatureName::Packed4x8IntegerDotProduct"; - break; - case WGSLFeatureName::UnrestrictedPointerParameters: - o << "WGSLFeatureName::UnrestrictedPointerParameters"; - break; - case WGSLFeatureName::PointerCompositeAccess: - o << "WGSLFeatureName::PointerCompositeAccess"; - break; - case WGSLFeatureName::ChromiumTestingUnimplemented: - o << "WGSLFeatureName::ChromiumTestingUnimplemented"; - break; - case WGSLFeatureName::ChromiumTestingUnsafeExperimental: - o << "WGSLFeatureName::ChromiumTestingUnsafeExperimental"; - break; - case WGSLFeatureName::ChromiumTestingExperimental: - o << "WGSLFeatureName::ChromiumTestingExperimental"; - break; - case WGSLFeatureName::ChromiumTestingShippedWithKillswitch: - o << "WGSLFeatureName::ChromiumTestingShippedWithKillswitch"; - break; - case WGSLFeatureName::ChromiumTestingShipped: - o << "WGSLFeatureName::ChromiumTestingShipped"; - break; - default: - o << "WGSLFeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, AdapterType value) { - switch (value) { - case AdapterType::DiscreteGPU: - o << "AdapterType::DiscreteGPU"; - break; - case AdapterType::IntegratedGPU: - o << "AdapterType::IntegratedGPU"; - break; - case AdapterType::CPU: - o << "AdapterType::CPU"; - break; - case AdapterType::Unknown: - o << "AdapterType::Unknown"; - break; - default: - o << "AdapterType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, AddressMode value) { - switch (value) { - case AddressMode::Undefined: - o << "AddressMode::Undefined"; - break; - case AddressMode::ClampToEdge: - o << "AddressMode::ClampToEdge"; - break; - case AddressMode::Repeat: - o << "AddressMode::Repeat"; - break; - case AddressMode::MirrorRepeat: - o << "AddressMode::MirrorRepeat"; - break; - default: - o << "AddressMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, AlphaMode value) { - switch (value) { - case AlphaMode::Opaque: - o << "AlphaMode::Opaque"; - break; - case AlphaMode::Premultiplied: - o << "AlphaMode::Premultiplied"; - break; - case AlphaMode::Unpremultiplied: - o << "AlphaMode::Unpremultiplied"; - break; - default: - o << "AlphaMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, BackendType value) { - switch (value) { - case BackendType::Undefined: - o << "BackendType::Undefined"; - break; - case BackendType::Null: - o << "BackendType::Null"; - break; - case BackendType::WebGPU: - o << "BackendType::WebGPU"; - break; - case BackendType::D3D11: - o << "BackendType::D3D11"; - break; - case BackendType::D3D12: - o << "BackendType::D3D12"; - break; - case BackendType::Metal: - o << "BackendType::Metal"; - break; - case BackendType::Vulkan: - o << "BackendType::Vulkan"; - break; - case BackendType::OpenGL: - o << "BackendType::OpenGL"; - break; - case BackendType::OpenGLES: - o << "BackendType::OpenGLES"; - break; - default: - o << "BackendType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, BlendFactor value) { - switch (value) { - case BlendFactor::Undefined: - o << "BlendFactor::Undefined"; - break; - case BlendFactor::Zero: - o << "BlendFactor::Zero"; - break; - case BlendFactor::One: - o << "BlendFactor::One"; - break; - case BlendFactor::Src: - o << "BlendFactor::Src"; - break; - case BlendFactor::OneMinusSrc: - o << "BlendFactor::OneMinusSrc"; - break; - case BlendFactor::SrcAlpha: - o << "BlendFactor::SrcAlpha"; - break; - case BlendFactor::OneMinusSrcAlpha: - o << "BlendFactor::OneMinusSrcAlpha"; - break; - case BlendFactor::Dst: - o << "BlendFactor::Dst"; - break; - case BlendFactor::OneMinusDst: - o << "BlendFactor::OneMinusDst"; - break; - case BlendFactor::DstAlpha: - o << "BlendFactor::DstAlpha"; - break; - case BlendFactor::OneMinusDstAlpha: - o << "BlendFactor::OneMinusDstAlpha"; - break; - case BlendFactor::SrcAlphaSaturated: - o << "BlendFactor::SrcAlphaSaturated"; - break; - case BlendFactor::Constant: - o << "BlendFactor::Constant"; - break; - case BlendFactor::OneMinusConstant: - o << "BlendFactor::OneMinusConstant"; - break; - case BlendFactor::Src1: - o << "BlendFactor::Src1"; - break; - case BlendFactor::OneMinusSrc1: - o << "BlendFactor::OneMinusSrc1"; - break; - case BlendFactor::Src1Alpha: - o << "BlendFactor::Src1Alpha"; - break; - case BlendFactor::OneMinusSrc1Alpha: - o << "BlendFactor::OneMinusSrc1Alpha"; - break; - default: - o << "BlendFactor::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, BlendOperation value) { - switch (value) { - case BlendOperation::Undefined: - o << "BlendOperation::Undefined"; - break; - case BlendOperation::Add: - o << "BlendOperation::Add"; - break; - case BlendOperation::Subtract: - o << "BlendOperation::Subtract"; - break; - case BlendOperation::ReverseSubtract: - o << "BlendOperation::ReverseSubtract"; - break; - case BlendOperation::Min: - o << "BlendOperation::Min"; - break; - case BlendOperation::Max: - o << "BlendOperation::Max"; - break; - default: - o << "BlendOperation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, BufferBindingType value) { - switch (value) { - case BufferBindingType::Undefined: - o << "BufferBindingType::Undefined"; - break; - case BufferBindingType::Uniform: - o << "BufferBindingType::Uniform"; - break; - case BufferBindingType::Storage: - o << "BufferBindingType::Storage"; - break; - case BufferBindingType::ReadOnlyStorage: - o << "BufferBindingType::ReadOnlyStorage"; - break; - default: - o << "BufferBindingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, BufferMapAsyncStatus value) { - switch (value) { - case BufferMapAsyncStatus::Success: - o << "BufferMapAsyncStatus::Success"; - break; - case BufferMapAsyncStatus::InstanceDropped: - o << "BufferMapAsyncStatus::InstanceDropped"; - break; - case BufferMapAsyncStatus::ValidationError: - o << "BufferMapAsyncStatus::ValidationError"; - break; - case BufferMapAsyncStatus::Unknown: - o << "BufferMapAsyncStatus::Unknown"; - break; - case BufferMapAsyncStatus::DeviceLost: - o << "BufferMapAsyncStatus::DeviceLost"; - break; - case BufferMapAsyncStatus::DestroyedBeforeCallback: - o << "BufferMapAsyncStatus::DestroyedBeforeCallback"; - break; - case BufferMapAsyncStatus::UnmappedBeforeCallback: - o << "BufferMapAsyncStatus::UnmappedBeforeCallback"; - break; - case BufferMapAsyncStatus::MappingAlreadyPending: - o << "BufferMapAsyncStatus::MappingAlreadyPending"; - break; - case BufferMapAsyncStatus::OffsetOutOfRange: - o << "BufferMapAsyncStatus::OffsetOutOfRange"; - break; - case BufferMapAsyncStatus::SizeOutOfRange: - o << "BufferMapAsyncStatus::SizeOutOfRange"; - break; - default: - o << "BufferMapAsyncStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, BufferMapState value) { - switch (value) { - case BufferMapState::Unmapped: - o << "BufferMapState::Unmapped"; - break; - case BufferMapState::Pending: - o << "BufferMapState::Pending"; - break; - case BufferMapState::Mapped: - o << "BufferMapState::Mapped"; - break; - default: - o << "BufferMapState::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, CallbackMode value) { - switch (value) { - case CallbackMode::WaitAnyOnly: - o << "CallbackMode::WaitAnyOnly"; - break; - case CallbackMode::AllowProcessEvents: - o << "CallbackMode::AllowProcessEvents"; - break; - case CallbackMode::AllowSpontaneous: - o << "CallbackMode::AllowSpontaneous"; - break; - default: - o << "CallbackMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, CompareFunction value) { - switch (value) { - case CompareFunction::Undefined: - o << "CompareFunction::Undefined"; - break; - case CompareFunction::Never: - o << "CompareFunction::Never"; - break; - case CompareFunction::Less: - o << "CompareFunction::Less"; - break; - case CompareFunction::Equal: - o << "CompareFunction::Equal"; - break; - case CompareFunction::LessEqual: - o << "CompareFunction::LessEqual"; - break; - case CompareFunction::Greater: - o << "CompareFunction::Greater"; - break; - case CompareFunction::NotEqual: - o << "CompareFunction::NotEqual"; - break; - case CompareFunction::GreaterEqual: - o << "CompareFunction::GreaterEqual"; - break; - case CompareFunction::Always: - o << "CompareFunction::Always"; - break; - default: - o << "CompareFunction::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, CompilationInfoRequestStatus value) { - switch (value) { - case CompilationInfoRequestStatus::Success: - o << "CompilationInfoRequestStatus::Success"; - break; - case CompilationInfoRequestStatus::InstanceDropped: - o << "CompilationInfoRequestStatus::InstanceDropped"; - break; - case CompilationInfoRequestStatus::Error: - o << "CompilationInfoRequestStatus::Error"; - break; - case CompilationInfoRequestStatus::DeviceLost: - o << "CompilationInfoRequestStatus::DeviceLost"; - break; - case CompilationInfoRequestStatus::Unknown: - o << "CompilationInfoRequestStatus::Unknown"; - break; - default: - o << "CompilationInfoRequestStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, CompilationMessageType value) { - switch (value) { - case CompilationMessageType::Error: - o << "CompilationMessageType::Error"; - break; - case CompilationMessageType::Warning: - o << "CompilationMessageType::Warning"; - break; - case CompilationMessageType::Info: - o << "CompilationMessageType::Info"; - break; - default: - o << "CompilationMessageType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, CreatePipelineAsyncStatus value) { - switch (value) { - case CreatePipelineAsyncStatus::Success: - o << "CreatePipelineAsyncStatus::Success"; - break; - case CreatePipelineAsyncStatus::InstanceDropped: - o << "CreatePipelineAsyncStatus::InstanceDropped"; - break; - case CreatePipelineAsyncStatus::ValidationError: - o << "CreatePipelineAsyncStatus::ValidationError"; - break; - case CreatePipelineAsyncStatus::InternalError: - o << "CreatePipelineAsyncStatus::InternalError"; - break; - case CreatePipelineAsyncStatus::DeviceLost: - o << "CreatePipelineAsyncStatus::DeviceLost"; - break; - case CreatePipelineAsyncStatus::DeviceDestroyed: - o << "CreatePipelineAsyncStatus::DeviceDestroyed"; - break; - case CreatePipelineAsyncStatus::Unknown: - o << "CreatePipelineAsyncStatus::Unknown"; - break; - default: - o << "CreatePipelineAsyncStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, CullMode value) { - switch (value) { - case CullMode::Undefined: - o << "CullMode::Undefined"; - break; - case CullMode::None: - o << "CullMode::None"; - break; - case CullMode::Front: - o << "CullMode::Front"; - break; - case CullMode::Back: - o << "CullMode::Back"; - break; - default: - o << "CullMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, DeviceLostReason value) { - switch (value) { - case DeviceLostReason::Undefined: - o << "DeviceLostReason::Undefined"; - break; - case DeviceLostReason::Destroyed: - o << "DeviceLostReason::Destroyed"; - break; - default: - o << "DeviceLostReason::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, ErrorFilter value) { - switch (value) { - case ErrorFilter::Validation: - o << "ErrorFilter::Validation"; - break; - case ErrorFilter::OutOfMemory: - o << "ErrorFilter::OutOfMemory"; - break; - case ErrorFilter::Internal: - o << "ErrorFilter::Internal"; - break; - default: - o << "ErrorFilter::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, ErrorType value) { - switch (value) { - case ErrorType::NoError: - o << "ErrorType::NoError"; - break; - case ErrorType::Validation: - o << "ErrorType::Validation"; - break; - case ErrorType::OutOfMemory: - o << "ErrorType::OutOfMemory"; - break; - case ErrorType::Internal: - o << "ErrorType::Internal"; - break; - case ErrorType::Unknown: - o << "ErrorType::Unknown"; - break; - case ErrorType::DeviceLost: - o << "ErrorType::DeviceLost"; - break; - default: - o << "ErrorType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, ExternalTextureRotation value) { - switch (value) { - case ExternalTextureRotation::Rotate0Degrees: - o << "ExternalTextureRotation::Rotate0Degrees"; - break; - case ExternalTextureRotation::Rotate90Degrees: - o << "ExternalTextureRotation::Rotate90Degrees"; - break; - case ExternalTextureRotation::Rotate180Degrees: - o << "ExternalTextureRotation::Rotate180Degrees"; - break; - case ExternalTextureRotation::Rotate270Degrees: - o << "ExternalTextureRotation::Rotate270Degrees"; - break; - default: - o << "ExternalTextureRotation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, FeatureName value) { - switch (value) { - case FeatureName::Undefined: - o << "FeatureName::Undefined"; - break; - case FeatureName::DepthClipControl: - o << "FeatureName::DepthClipControl"; - break; - case FeatureName::Depth32FloatStencil8: - o << "FeatureName::Depth32FloatStencil8"; - break; - case FeatureName::TimestampQuery: - o << "FeatureName::TimestampQuery"; - break; - case FeatureName::TextureCompressionBC: - o << "FeatureName::TextureCompressionBC"; - break; - case FeatureName::TextureCompressionETC2: - o << "FeatureName::TextureCompressionETC2"; - break; - case FeatureName::TextureCompressionASTC: - o << "FeatureName::TextureCompressionASTC"; - break; - case FeatureName::IndirectFirstInstance: - o << "FeatureName::IndirectFirstInstance"; - break; - case FeatureName::ShaderF16: - o << "FeatureName::ShaderF16"; - break; - case FeatureName::RG11B10UfloatRenderable: - o << "FeatureName::RG11B10UfloatRenderable"; - break; - case FeatureName::BGRA8UnormStorage: - o << "FeatureName::BGRA8UnormStorage"; - break; - case FeatureName::Float32Filterable: - o << "FeatureName::Float32Filterable"; - break; - case FeatureName::DawnInternalUsages: - o << "FeatureName::DawnInternalUsages"; - break; - case FeatureName::DawnMultiPlanarFormats: - o << "FeatureName::DawnMultiPlanarFormats"; - break; - case FeatureName::DawnNative: - o << "FeatureName::DawnNative"; - break; - case FeatureName::ChromiumExperimentalTimestampQueryInsidePasses: - o << "FeatureName::ChromiumExperimentalTimestampQueryInsidePasses"; - break; - case FeatureName::ImplicitDeviceSynchronization: - o << "FeatureName::ImplicitDeviceSynchronization"; - break; - case FeatureName::SurfaceCapabilities: - o << "FeatureName::SurfaceCapabilities"; - break; - case FeatureName::TransientAttachments: - o << "FeatureName::TransientAttachments"; - break; - case FeatureName::MSAARenderToSingleSampled: - o << "FeatureName::MSAARenderToSingleSampled"; - break; - case FeatureName::DualSourceBlending: - o << "FeatureName::DualSourceBlending"; - break; - case FeatureName::D3D11MultithreadProtected: - o << "FeatureName::D3D11MultithreadProtected"; - break; - case FeatureName::ANGLETextureSharing: - o << "FeatureName::ANGLETextureSharing"; - break; - case FeatureName::ChromiumExperimentalSubgroups: - o << "FeatureName::ChromiumExperimentalSubgroups"; - break; - case FeatureName::ChromiumExperimentalSubgroupUniformControlFlow: - o << "FeatureName::ChromiumExperimentalSubgroupUniformControlFlow"; - break; - case FeatureName::PixelLocalStorageCoherent: - o << "FeatureName::PixelLocalStorageCoherent"; - break; - case FeatureName::PixelLocalStorageNonCoherent: - o << "FeatureName::PixelLocalStorageNonCoherent"; - break; - case FeatureName::Unorm16TextureFormats: - o << "FeatureName::Unorm16TextureFormats"; - break; - case FeatureName::Snorm16TextureFormats: - o << "FeatureName::Snorm16TextureFormats"; - break; - case FeatureName::MultiPlanarFormatExtendedUsages: - o << "FeatureName::MultiPlanarFormatExtendedUsages"; - break; - case FeatureName::MultiPlanarFormatP010: - o << "FeatureName::MultiPlanarFormatP010"; - break; - case FeatureName::HostMappedPointer: - o << "FeatureName::HostMappedPointer"; - break; - case FeatureName::MultiPlanarRenderTargets: - o << "FeatureName::MultiPlanarRenderTargets"; - break; - case FeatureName::MultiPlanarFormatNv12a: - o << "FeatureName::MultiPlanarFormatNv12a"; - break; - case FeatureName::FramebufferFetch: - o << "FeatureName::FramebufferFetch"; - break; - case FeatureName::BufferMapExtendedUsages: - o << "FeatureName::BufferMapExtendedUsages"; - break; - case FeatureName::AdapterPropertiesMemoryHeaps: - o << "FeatureName::AdapterPropertiesMemoryHeaps"; - break; - case FeatureName::AdapterPropertiesD3D: - o << "FeatureName::AdapterPropertiesD3D"; - break; - case FeatureName::AdapterPropertiesVk: - o << "FeatureName::AdapterPropertiesVk"; - break; - case FeatureName::R8UnormStorage: - o << "FeatureName::R8UnormStorage"; - break; - case FeatureName::FormatCapabilities: - o << "FeatureName::FormatCapabilities"; - break; - case FeatureName::DrmFormatCapabilities: - o << "FeatureName::DrmFormatCapabilities"; - break; - case FeatureName::Norm16TextureFormats: - o << "FeatureName::Norm16TextureFormats"; - break; - case FeatureName::SharedTextureMemoryVkDedicatedAllocation: - o << "FeatureName::SharedTextureMemoryVkDedicatedAllocation"; - break; - case FeatureName::SharedTextureMemoryAHardwareBuffer: - o << "FeatureName::SharedTextureMemoryAHardwareBuffer"; - break; - case FeatureName::SharedTextureMemoryDmaBuf: - o << "FeatureName::SharedTextureMemoryDmaBuf"; - break; - case FeatureName::SharedTextureMemoryOpaqueFD: - o << "FeatureName::SharedTextureMemoryOpaqueFD"; - break; - case FeatureName::SharedTextureMemoryZirconHandle: - o << "FeatureName::SharedTextureMemoryZirconHandle"; - break; - case FeatureName::SharedTextureMemoryDXGISharedHandle: - o << "FeatureName::SharedTextureMemoryDXGISharedHandle"; - break; - case FeatureName::SharedTextureMemoryD3D11Texture2D: - o << "FeatureName::SharedTextureMemoryD3D11Texture2D"; - break; - case FeatureName::SharedTextureMemoryIOSurface: - o << "FeatureName::SharedTextureMemoryIOSurface"; - break; - case FeatureName::SharedTextureMemoryEGLImage: - o << "FeatureName::SharedTextureMemoryEGLImage"; - break; - case FeatureName::SharedFenceVkSemaphoreOpaqueFD: - o << "FeatureName::SharedFenceVkSemaphoreOpaqueFD"; - break; - case FeatureName::SharedFenceVkSemaphoreSyncFD: - o << "FeatureName::SharedFenceVkSemaphoreSyncFD"; - break; - case FeatureName::SharedFenceVkSemaphoreZirconHandle: - o << "FeatureName::SharedFenceVkSemaphoreZirconHandle"; - break; - case FeatureName::SharedFenceDXGISharedHandle: - o << "FeatureName::SharedFenceDXGISharedHandle"; - break; - case FeatureName::SharedFenceMTLSharedEvent: - o << "FeatureName::SharedFenceMTLSharedEvent"; - break; - case FeatureName::SharedBufferMemoryD3D12Resource: - o << "FeatureName::SharedBufferMemoryD3D12Resource"; - break; - case FeatureName::StaticSamplers: - o << "FeatureName::StaticSamplers"; - break; - default: - o << "FeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, FilterMode value) { - switch (value) { - case FilterMode::Undefined: - o << "FilterMode::Undefined"; - break; - case FilterMode::Nearest: - o << "FilterMode::Nearest"; - break; - case FilterMode::Linear: - o << "FilterMode::Linear"; - break; - default: - o << "FilterMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, FrontFace value) { - switch (value) { - case FrontFace::Undefined: - o << "FrontFace::Undefined"; - break; - case FrontFace::CCW: - o << "FrontFace::CCW"; - break; - case FrontFace::CW: - o << "FrontFace::CW"; - break; - default: - o << "FrontFace::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, IndexFormat value) { - switch (value) { - case IndexFormat::Undefined: - o << "IndexFormat::Undefined"; - break; - case IndexFormat::Uint16: - o << "IndexFormat::Uint16"; - break; - case IndexFormat::Uint32: - o << "IndexFormat::Uint32"; - break; - default: - o << "IndexFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, LoadOp value) { - switch (value) { - case LoadOp::Undefined: - o << "LoadOp::Undefined"; - break; - case LoadOp::Clear: - o << "LoadOp::Clear"; - break; - case LoadOp::Load: - o << "LoadOp::Load"; - break; - default: - o << "LoadOp::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, LoggingType value) { - switch (value) { - case LoggingType::Verbose: - o << "LoggingType::Verbose"; - break; - case LoggingType::Info: - o << "LoggingType::Info"; - break; - case LoggingType::Warning: - o << "LoggingType::Warning"; - break; - case LoggingType::Error: - o << "LoggingType::Error"; - break; - default: - o << "LoggingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, MipmapFilterMode value) { - switch (value) { - case MipmapFilterMode::Undefined: - o << "MipmapFilterMode::Undefined"; - break; - case MipmapFilterMode::Nearest: - o << "MipmapFilterMode::Nearest"; - break; - case MipmapFilterMode::Linear: - o << "MipmapFilterMode::Linear"; - break; - default: - o << "MipmapFilterMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, PopErrorScopeStatus value) { - switch (value) { - case PopErrorScopeStatus::Success: - o << "PopErrorScopeStatus::Success"; - break; - case PopErrorScopeStatus::InstanceDropped: - o << "PopErrorScopeStatus::InstanceDropped"; - break; - default: - o << "PopErrorScopeStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, PowerPreference value) { - switch (value) { - case PowerPreference::Undefined: - o << "PowerPreference::Undefined"; - break; - case PowerPreference::LowPower: - o << "PowerPreference::LowPower"; - break; - case PowerPreference::HighPerformance: - o << "PowerPreference::HighPerformance"; - break; - default: - o << "PowerPreference::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, PresentMode value) { - switch (value) { - case PresentMode::Fifo: - o << "PresentMode::Fifo"; - break; - case PresentMode::Immediate: - o << "PresentMode::Immediate"; - break; - case PresentMode::Mailbox: - o << "PresentMode::Mailbox"; - break; - default: - o << "PresentMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, PrimitiveTopology value) { - switch (value) { - case PrimitiveTopology::Undefined: - o << "PrimitiveTopology::Undefined"; - break; - case PrimitiveTopology::PointList: - o << "PrimitiveTopology::PointList"; - break; - case PrimitiveTopology::LineList: - o << "PrimitiveTopology::LineList"; - break; - case PrimitiveTopology::LineStrip: - o << "PrimitiveTopology::LineStrip"; - break; - case PrimitiveTopology::TriangleList: - o << "PrimitiveTopology::TriangleList"; - break; - case PrimitiveTopology::TriangleStrip: - o << "PrimitiveTopology::TriangleStrip"; - break; - default: - o << "PrimitiveTopology::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, QueryType value) { - switch (value) { - case QueryType::Occlusion: - o << "QueryType::Occlusion"; - break; - case QueryType::Timestamp: - o << "QueryType::Timestamp"; - break; - default: - o << "QueryType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, QueueWorkDoneStatus value) { - switch (value) { - case QueueWorkDoneStatus::Success: - o << "QueueWorkDoneStatus::Success"; - break; - case QueueWorkDoneStatus::InstanceDropped: - o << "QueueWorkDoneStatus::InstanceDropped"; - break; - case QueueWorkDoneStatus::Error: - o << "QueueWorkDoneStatus::Error"; - break; - case QueueWorkDoneStatus::Unknown: - o << "QueueWorkDoneStatus::Unknown"; - break; - case QueueWorkDoneStatus::DeviceLost: - o << "QueueWorkDoneStatus::DeviceLost"; - break; - default: - o << "QueueWorkDoneStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, RequestAdapterStatus value) { - switch (value) { - case RequestAdapterStatus::Success: - o << "RequestAdapterStatus::Success"; - break; - case RequestAdapterStatus::InstanceDropped: - o << "RequestAdapterStatus::InstanceDropped"; - break; - case RequestAdapterStatus::Unavailable: - o << "RequestAdapterStatus::Unavailable"; - break; - case RequestAdapterStatus::Error: - o << "RequestAdapterStatus::Error"; - break; - case RequestAdapterStatus::Unknown: - o << "RequestAdapterStatus::Unknown"; - break; - default: - o << "RequestAdapterStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, RequestDeviceStatus value) { - switch (value) { - case RequestDeviceStatus::Success: - o << "RequestDeviceStatus::Success"; - break; - case RequestDeviceStatus::InstanceDropped: - o << "RequestDeviceStatus::InstanceDropped"; - break; - case RequestDeviceStatus::Error: - o << "RequestDeviceStatus::Error"; - break; - case RequestDeviceStatus::Unknown: - o << "RequestDeviceStatus::Unknown"; - break; - default: - o << "RequestDeviceStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, SType value) { - switch (value) { - case SType::Invalid: - o << "SType::Invalid"; - break; - case SType::SurfaceDescriptorFromMetalLayer: - o << "SType::SurfaceDescriptorFromMetalLayer"; - break; - case SType::SurfaceDescriptorFromWindowsHWND: - o << "SType::SurfaceDescriptorFromWindowsHWND"; - break; - case SType::SurfaceDescriptorFromXlibWindow: - o << "SType::SurfaceDescriptorFromXlibWindow"; - break; - case SType::SurfaceDescriptorFromCanvasHTMLSelector: - o << "SType::SurfaceDescriptorFromCanvasHTMLSelector"; - break; - case SType::ShaderModuleSPIRVDescriptor: - o << "SType::ShaderModuleSPIRVDescriptor"; - break; - case SType::ShaderModuleWGSLDescriptor: - o << "SType::ShaderModuleWGSLDescriptor"; - break; - case SType::PrimitiveDepthClipControl: - o << "SType::PrimitiveDepthClipControl"; - break; - case SType::SurfaceDescriptorFromWaylandSurface: - o << "SType::SurfaceDescriptorFromWaylandSurface"; - break; - case SType::SurfaceDescriptorFromAndroidNativeWindow: - o << "SType::SurfaceDescriptorFromAndroidNativeWindow"; - break; - case SType::SurfaceDescriptorFromWindowsCoreWindow: - o << "SType::SurfaceDescriptorFromWindowsCoreWindow"; - break; - case SType::ExternalTextureBindingEntry: - o << "SType::ExternalTextureBindingEntry"; - break; - case SType::ExternalTextureBindingLayout: - o << "SType::ExternalTextureBindingLayout"; - break; - case SType::SurfaceDescriptorFromWindowsSwapChainPanel: - o << "SType::SurfaceDescriptorFromWindowsSwapChainPanel"; - break; - case SType::RenderPassDescriptorMaxDrawCount: - o << "SType::RenderPassDescriptorMaxDrawCount"; - break; - case SType::DepthStencilStateDepthWriteDefinedDawn: - o << "SType::DepthStencilStateDepthWriteDefinedDawn"; - break; - case SType::TextureBindingViewDimensionDescriptor: - o << "SType::TextureBindingViewDimensionDescriptor"; - break; - case SType::DawnTextureInternalUsageDescriptor: - o << "SType::DawnTextureInternalUsageDescriptor"; - break; - case SType::DawnEncoderInternalUsageDescriptor: - o << "SType::DawnEncoderInternalUsageDescriptor"; - break; - case SType::DawnInstanceDescriptor: - o << "SType::DawnInstanceDescriptor"; - break; - case SType::DawnCacheDeviceDescriptor: - o << "SType::DawnCacheDeviceDescriptor"; - break; - case SType::DawnAdapterPropertiesPowerPreference: - o << "SType::DawnAdapterPropertiesPowerPreference"; - break; - case SType::DawnBufferDescriptorErrorInfoFromWireClient: - o << "SType::DawnBufferDescriptorErrorInfoFromWireClient"; - break; - case SType::DawnTogglesDescriptor: - o << "SType::DawnTogglesDescriptor"; - break; - case SType::DawnShaderModuleSPIRVOptionsDescriptor: - o << "SType::DawnShaderModuleSPIRVOptionsDescriptor"; - break; - case SType::RequestAdapterOptionsLUID: - o << "SType::RequestAdapterOptionsLUID"; - break; - case SType::RequestAdapterOptionsGetGLProc: - o << "SType::RequestAdapterOptionsGetGLProc"; - break; - case SType::RequestAdapterOptionsD3D11Device: - o << "SType::RequestAdapterOptionsD3D11Device"; - break; - case SType::DawnMultisampleStateRenderToSingleSampled: - o << "SType::DawnMultisampleStateRenderToSingleSampled"; - break; - case SType::DawnRenderPassColorAttachmentRenderToSingleSampled: - o << "SType::DawnRenderPassColorAttachmentRenderToSingleSampled"; - break; - case SType::RenderPassPixelLocalStorage: - o << "SType::RenderPassPixelLocalStorage"; - break; - case SType::PipelineLayoutPixelLocalStorage: - o << "SType::PipelineLayoutPixelLocalStorage"; - break; - case SType::BufferHostMappedPointer: - o << "SType::BufferHostMappedPointer"; - break; - case SType::DawnExperimentalSubgroupLimits: - o << "SType::DawnExperimentalSubgroupLimits"; - break; - case SType::AdapterPropertiesMemoryHeaps: - o << "SType::AdapterPropertiesMemoryHeaps"; - break; - case SType::AdapterPropertiesD3D: - o << "SType::AdapterPropertiesD3D"; - break; - case SType::AdapterPropertiesVk: - o << "SType::AdapterPropertiesVk"; - break; - case SType::DawnComputePipelineFullSubgroups: - o << "SType::DawnComputePipelineFullSubgroups"; - break; - case SType::DawnWireWGSLControl: - o << "SType::DawnWireWGSLControl"; - break; - case SType::DawnWGSLBlocklist: - o << "SType::DawnWGSLBlocklist"; - break; - case SType::DrmFormatCapabilities: - o << "SType::DrmFormatCapabilities"; - break; - case SType::SharedTextureMemoryVkImageDescriptor: - o << "SType::SharedTextureMemoryVkImageDescriptor"; - break; - case SType::SharedTextureMemoryVkDedicatedAllocationDescriptor: - o << "SType::SharedTextureMemoryVkDedicatedAllocationDescriptor"; - break; - case SType::SharedTextureMemoryAHardwareBufferDescriptor: - o << "SType::SharedTextureMemoryAHardwareBufferDescriptor"; - break; - case SType::SharedTextureMemoryDmaBufDescriptor: - o << "SType::SharedTextureMemoryDmaBufDescriptor"; - break; - case SType::SharedTextureMemoryOpaqueFDDescriptor: - o << "SType::SharedTextureMemoryOpaqueFDDescriptor"; - break; - case SType::SharedTextureMemoryZirconHandleDescriptor: - o << "SType::SharedTextureMemoryZirconHandleDescriptor"; - break; - case SType::SharedTextureMemoryDXGISharedHandleDescriptor: - o << "SType::SharedTextureMemoryDXGISharedHandleDescriptor"; - break; - case SType::SharedTextureMemoryD3D11Texture2DDescriptor: - o << "SType::SharedTextureMemoryD3D11Texture2DDescriptor"; - break; - case SType::SharedTextureMemoryIOSurfaceDescriptor: - o << "SType::SharedTextureMemoryIOSurfaceDescriptor"; - break; - case SType::SharedTextureMemoryEGLImageDescriptor: - o << "SType::SharedTextureMemoryEGLImageDescriptor"; - break; - case SType::SharedTextureMemoryInitializedBeginState: - o << "SType::SharedTextureMemoryInitializedBeginState"; - break; - case SType::SharedTextureMemoryInitializedEndState: - o << "SType::SharedTextureMemoryInitializedEndState"; - break; - case SType::SharedTextureMemoryVkImageLayoutBeginState: - o << "SType::SharedTextureMemoryVkImageLayoutBeginState"; - break; - case SType::SharedTextureMemoryVkImageLayoutEndState: - o << "SType::SharedTextureMemoryVkImageLayoutEndState"; - break; - case SType::SharedFenceVkSemaphoreOpaqueFDDescriptor: - o << "SType::SharedFenceVkSemaphoreOpaqueFDDescriptor"; - break; - case SType::SharedFenceVkSemaphoreOpaqueFDExportInfo: - o << "SType::SharedFenceVkSemaphoreOpaqueFDExportInfo"; - break; - case SType::SharedFenceVkSemaphoreSyncFDDescriptor: - o << "SType::SharedFenceVkSemaphoreSyncFDDescriptor"; - break; - case SType::SharedFenceVkSemaphoreSyncFDExportInfo: - o << "SType::SharedFenceVkSemaphoreSyncFDExportInfo"; - break; - case SType::SharedFenceVkSemaphoreZirconHandleDescriptor: - o << "SType::SharedFenceVkSemaphoreZirconHandleDescriptor"; - break; - case SType::SharedFenceVkSemaphoreZirconHandleExportInfo: - o << "SType::SharedFenceVkSemaphoreZirconHandleExportInfo"; - break; - case SType::SharedFenceDXGISharedHandleDescriptor: - o << "SType::SharedFenceDXGISharedHandleDescriptor"; - break; - case SType::SharedFenceDXGISharedHandleExportInfo: - o << "SType::SharedFenceDXGISharedHandleExportInfo"; - break; - case SType::SharedFenceMTLSharedEventDescriptor: - o << "SType::SharedFenceMTLSharedEventDescriptor"; - break; - case SType::SharedFenceMTLSharedEventExportInfo: - o << "SType::SharedFenceMTLSharedEventExportInfo"; - break; - case SType::SharedBufferMemoryD3D12ResourceDescriptor: - o << "SType::SharedBufferMemoryD3D12ResourceDescriptor"; - break; - case SType::StaticSamplerBindingLayout: - o << "SType::StaticSamplerBindingLayout"; - break; - default: - o << "SType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, SamplerBindingType value) { - switch (value) { - case SamplerBindingType::Undefined: - o << "SamplerBindingType::Undefined"; - break; - case SamplerBindingType::Filtering: - o << "SamplerBindingType::Filtering"; - break; - case SamplerBindingType::NonFiltering: - o << "SamplerBindingType::NonFiltering"; - break; - case SamplerBindingType::Comparison: - o << "SamplerBindingType::Comparison"; - break; - default: - o << "SamplerBindingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, SharedFenceType value) { - switch (value) { - case SharedFenceType::Undefined: - o << "SharedFenceType::Undefined"; - break; - case SharedFenceType::VkSemaphoreOpaqueFD: - o << "SharedFenceType::VkSemaphoreOpaqueFD"; - break; - case SharedFenceType::VkSemaphoreSyncFD: - o << "SharedFenceType::VkSemaphoreSyncFD"; - break; - case SharedFenceType::VkSemaphoreZirconHandle: - o << "SharedFenceType::VkSemaphoreZirconHandle"; - break; - case SharedFenceType::DXGISharedHandle: - o << "SharedFenceType::DXGISharedHandle"; - break; - case SharedFenceType::MTLSharedEvent: - o << "SharedFenceType::MTLSharedEvent"; - break; - default: - o << "SharedFenceType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, StencilOperation value) { - switch (value) { - case StencilOperation::Undefined: - o << "StencilOperation::Undefined"; - break; - case StencilOperation::Keep: - o << "StencilOperation::Keep"; - break; - case StencilOperation::Zero: - o << "StencilOperation::Zero"; - break; - case StencilOperation::Replace: - o << "StencilOperation::Replace"; - break; - case StencilOperation::Invert: - o << "StencilOperation::Invert"; - break; - case StencilOperation::IncrementClamp: - o << "StencilOperation::IncrementClamp"; - break; - case StencilOperation::DecrementClamp: - o << "StencilOperation::DecrementClamp"; - break; - case StencilOperation::IncrementWrap: - o << "StencilOperation::IncrementWrap"; - break; - case StencilOperation::DecrementWrap: - o << "StencilOperation::DecrementWrap"; - break; - default: - o << "StencilOperation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, StorageTextureAccess value) { - switch (value) { - case StorageTextureAccess::Undefined: - o << "StorageTextureAccess::Undefined"; - break; - case StorageTextureAccess::WriteOnly: - o << "StorageTextureAccess::WriteOnly"; - break; - case StorageTextureAccess::ReadOnly: - o << "StorageTextureAccess::ReadOnly"; - break; - case StorageTextureAccess::ReadWrite: - o << "StorageTextureAccess::ReadWrite"; - break; - default: - o << "StorageTextureAccess::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, StoreOp value) { - switch (value) { - case StoreOp::Undefined: - o << "StoreOp::Undefined"; - break; - case StoreOp::Store: - o << "StoreOp::Store"; - break; - case StoreOp::Discard: - o << "StoreOp::Discard"; - break; - default: - o << "StoreOp::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, TextureAspect value) { - switch (value) { - case TextureAspect::Undefined: - o << "TextureAspect::Undefined"; - break; - case TextureAspect::All: - o << "TextureAspect::All"; - break; - case TextureAspect::StencilOnly: - o << "TextureAspect::StencilOnly"; - break; - case TextureAspect::DepthOnly: - o << "TextureAspect::DepthOnly"; - break; - case TextureAspect::Plane0Only: - o << "TextureAspect::Plane0Only"; - break; - case TextureAspect::Plane1Only: - o << "TextureAspect::Plane1Only"; - break; - case TextureAspect::Plane2Only: - o << "TextureAspect::Plane2Only"; - break; - default: - o << "TextureAspect::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, TextureDimension value) { - switch (value) { - case TextureDimension::Undefined: - o << "TextureDimension::Undefined"; - break; - case TextureDimension::e1D: - o << "TextureDimension::e1D"; - break; - case TextureDimension::e2D: - o << "TextureDimension::e2D"; - break; - case TextureDimension::e3D: - o << "TextureDimension::e3D"; - break; - default: - o << "TextureDimension::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, TextureFormat value) { - switch (value) { - case TextureFormat::Undefined: - o << "TextureFormat::Undefined"; - break; - case TextureFormat::R8Unorm: - o << "TextureFormat::R8Unorm"; - break; - case TextureFormat::R8Snorm: - o << "TextureFormat::R8Snorm"; - break; - case TextureFormat::R8Uint: - o << "TextureFormat::R8Uint"; - break; - case TextureFormat::R8Sint: - o << "TextureFormat::R8Sint"; - break; - case TextureFormat::R16Uint: - o << "TextureFormat::R16Uint"; - break; - case TextureFormat::R16Sint: - o << "TextureFormat::R16Sint"; - break; - case TextureFormat::R16Float: - o << "TextureFormat::R16Float"; - break; - case TextureFormat::RG8Unorm: - o << "TextureFormat::RG8Unorm"; - break; - case TextureFormat::RG8Snorm: - o << "TextureFormat::RG8Snorm"; - break; - case TextureFormat::RG8Uint: - o << "TextureFormat::RG8Uint"; - break; - case TextureFormat::RG8Sint: - o << "TextureFormat::RG8Sint"; - break; - case TextureFormat::R32Float: - o << "TextureFormat::R32Float"; - break; - case TextureFormat::R32Uint: - o << "TextureFormat::R32Uint"; - break; - case TextureFormat::R32Sint: - o << "TextureFormat::R32Sint"; - break; - case TextureFormat::RG16Uint: - o << "TextureFormat::RG16Uint"; - break; - case TextureFormat::RG16Sint: - o << "TextureFormat::RG16Sint"; - break; - case TextureFormat::RG16Float: - o << "TextureFormat::RG16Float"; - break; - case TextureFormat::RGBA8Unorm: - o << "TextureFormat::RGBA8Unorm"; - break; - case TextureFormat::RGBA8UnormSrgb: - o << "TextureFormat::RGBA8UnormSrgb"; - break; - case TextureFormat::RGBA8Snorm: - o << "TextureFormat::RGBA8Snorm"; - break; - case TextureFormat::RGBA8Uint: - o << "TextureFormat::RGBA8Uint"; - break; - case TextureFormat::RGBA8Sint: - o << "TextureFormat::RGBA8Sint"; - break; - case TextureFormat::BGRA8Unorm: - o << "TextureFormat::BGRA8Unorm"; - break; - case TextureFormat::BGRA8UnormSrgb: - o << "TextureFormat::BGRA8UnormSrgb"; - break; - case TextureFormat::RGB10A2Uint: - o << "TextureFormat::RGB10A2Uint"; - break; - case TextureFormat::RGB10A2Unorm: - o << "TextureFormat::RGB10A2Unorm"; - break; - case TextureFormat::RG11B10Ufloat: - o << "TextureFormat::RG11B10Ufloat"; - break; - case TextureFormat::RGB9E5Ufloat: - o << "TextureFormat::RGB9E5Ufloat"; - break; - case TextureFormat::RG32Float: - o << "TextureFormat::RG32Float"; - break; - case TextureFormat::RG32Uint: - o << "TextureFormat::RG32Uint"; - break; - case TextureFormat::RG32Sint: - o << "TextureFormat::RG32Sint"; - break; - case TextureFormat::RGBA16Uint: - o << "TextureFormat::RGBA16Uint"; - break; - case TextureFormat::RGBA16Sint: - o << "TextureFormat::RGBA16Sint"; - break; - case TextureFormat::RGBA16Float: - o << "TextureFormat::RGBA16Float"; - break; - case TextureFormat::RGBA32Float: - o << "TextureFormat::RGBA32Float"; - break; - case TextureFormat::RGBA32Uint: - o << "TextureFormat::RGBA32Uint"; - break; - case TextureFormat::RGBA32Sint: - o << "TextureFormat::RGBA32Sint"; - break; - case TextureFormat::Stencil8: - o << "TextureFormat::Stencil8"; - break; - case TextureFormat::Depth16Unorm: - o << "TextureFormat::Depth16Unorm"; - break; - case TextureFormat::Depth24Plus: - o << "TextureFormat::Depth24Plus"; - break; - case TextureFormat::Depth24PlusStencil8: - o << "TextureFormat::Depth24PlusStencil8"; - break; - case TextureFormat::Depth32Float: - o << "TextureFormat::Depth32Float"; - break; - case TextureFormat::Depth32FloatStencil8: - o << "TextureFormat::Depth32FloatStencil8"; - break; - case TextureFormat::BC1RGBAUnorm: - o << "TextureFormat::BC1RGBAUnorm"; - break; - case TextureFormat::BC1RGBAUnormSrgb: - o << "TextureFormat::BC1RGBAUnormSrgb"; - break; - case TextureFormat::BC2RGBAUnorm: - o << "TextureFormat::BC2RGBAUnorm"; - break; - case TextureFormat::BC2RGBAUnormSrgb: - o << "TextureFormat::BC2RGBAUnormSrgb"; - break; - case TextureFormat::BC3RGBAUnorm: - o << "TextureFormat::BC3RGBAUnorm"; - break; - case TextureFormat::BC3RGBAUnormSrgb: - o << "TextureFormat::BC3RGBAUnormSrgb"; - break; - case TextureFormat::BC4RUnorm: - o << "TextureFormat::BC4RUnorm"; - break; - case TextureFormat::BC4RSnorm: - o << "TextureFormat::BC4RSnorm"; - break; - case TextureFormat::BC5RGUnorm: - o << "TextureFormat::BC5RGUnorm"; - break; - case TextureFormat::BC5RGSnorm: - o << "TextureFormat::BC5RGSnorm"; - break; - case TextureFormat::BC6HRGBUfloat: - o << "TextureFormat::BC6HRGBUfloat"; - break; - case TextureFormat::BC6HRGBFloat: - o << "TextureFormat::BC6HRGBFloat"; - break; - case TextureFormat::BC7RGBAUnorm: - o << "TextureFormat::BC7RGBAUnorm"; - break; - case TextureFormat::BC7RGBAUnormSrgb: - o << "TextureFormat::BC7RGBAUnormSrgb"; - break; - case TextureFormat::ETC2RGB8Unorm: - o << "TextureFormat::ETC2RGB8Unorm"; - break; - case TextureFormat::ETC2RGB8UnormSrgb: - o << "TextureFormat::ETC2RGB8UnormSrgb"; - break; - case TextureFormat::ETC2RGB8A1Unorm: - o << "TextureFormat::ETC2RGB8A1Unorm"; - break; - case TextureFormat::ETC2RGB8A1UnormSrgb: - o << "TextureFormat::ETC2RGB8A1UnormSrgb"; - break; - case TextureFormat::ETC2RGBA8Unorm: - o << "TextureFormat::ETC2RGBA8Unorm"; - break; - case TextureFormat::ETC2RGBA8UnormSrgb: - o << "TextureFormat::ETC2RGBA8UnormSrgb"; - break; - case TextureFormat::EACR11Unorm: - o << "TextureFormat::EACR11Unorm"; - break; - case TextureFormat::EACR11Snorm: - o << "TextureFormat::EACR11Snorm"; - break; - case TextureFormat::EACRG11Unorm: - o << "TextureFormat::EACRG11Unorm"; - break; - case TextureFormat::EACRG11Snorm: - o << "TextureFormat::EACRG11Snorm"; - break; - case TextureFormat::ASTC4x4Unorm: - o << "TextureFormat::ASTC4x4Unorm"; - break; - case TextureFormat::ASTC4x4UnormSrgb: - o << "TextureFormat::ASTC4x4UnormSrgb"; - break; - case TextureFormat::ASTC5x4Unorm: - o << "TextureFormat::ASTC5x4Unorm"; - break; - case TextureFormat::ASTC5x4UnormSrgb: - o << "TextureFormat::ASTC5x4UnormSrgb"; - break; - case TextureFormat::ASTC5x5Unorm: - o << "TextureFormat::ASTC5x5Unorm"; - break; - case TextureFormat::ASTC5x5UnormSrgb: - o << "TextureFormat::ASTC5x5UnormSrgb"; - break; - case TextureFormat::ASTC6x5Unorm: - o << "TextureFormat::ASTC6x5Unorm"; - break; - case TextureFormat::ASTC6x5UnormSrgb: - o << "TextureFormat::ASTC6x5UnormSrgb"; - break; - case TextureFormat::ASTC6x6Unorm: - o << "TextureFormat::ASTC6x6Unorm"; - break; - case TextureFormat::ASTC6x6UnormSrgb: - o << "TextureFormat::ASTC6x6UnormSrgb"; - break; - case TextureFormat::ASTC8x5Unorm: - o << "TextureFormat::ASTC8x5Unorm"; - break; - case TextureFormat::ASTC8x5UnormSrgb: - o << "TextureFormat::ASTC8x5UnormSrgb"; - break; - case TextureFormat::ASTC8x6Unorm: - o << "TextureFormat::ASTC8x6Unorm"; - break; - case TextureFormat::ASTC8x6UnormSrgb: - o << "TextureFormat::ASTC8x6UnormSrgb"; - break; - case TextureFormat::ASTC8x8Unorm: - o << "TextureFormat::ASTC8x8Unorm"; - break; - case TextureFormat::ASTC8x8UnormSrgb: - o << "TextureFormat::ASTC8x8UnormSrgb"; - break; - case TextureFormat::ASTC10x5Unorm: - o << "TextureFormat::ASTC10x5Unorm"; - break; - case TextureFormat::ASTC10x5UnormSrgb: - o << "TextureFormat::ASTC10x5UnormSrgb"; - break; - case TextureFormat::ASTC10x6Unorm: - o << "TextureFormat::ASTC10x6Unorm"; - break; - case TextureFormat::ASTC10x6UnormSrgb: - o << "TextureFormat::ASTC10x6UnormSrgb"; - break; - case TextureFormat::ASTC10x8Unorm: - o << "TextureFormat::ASTC10x8Unorm"; - break; - case TextureFormat::ASTC10x8UnormSrgb: - o << "TextureFormat::ASTC10x8UnormSrgb"; - break; - case TextureFormat::ASTC10x10Unorm: - o << "TextureFormat::ASTC10x10Unorm"; - break; - case TextureFormat::ASTC10x10UnormSrgb: - o << "TextureFormat::ASTC10x10UnormSrgb"; - break; - case TextureFormat::ASTC12x10Unorm: - o << "TextureFormat::ASTC12x10Unorm"; - break; - case TextureFormat::ASTC12x10UnormSrgb: - o << "TextureFormat::ASTC12x10UnormSrgb"; - break; - case TextureFormat::ASTC12x12Unorm: - o << "TextureFormat::ASTC12x12Unorm"; - break; - case TextureFormat::ASTC12x12UnormSrgb: - o << "TextureFormat::ASTC12x12UnormSrgb"; - break; - case TextureFormat::R16Unorm: - o << "TextureFormat::R16Unorm"; - break; - case TextureFormat::RG16Unorm: - o << "TextureFormat::RG16Unorm"; - break; - case TextureFormat::RGBA16Unorm: - o << "TextureFormat::RGBA16Unorm"; - break; - case TextureFormat::R16Snorm: - o << "TextureFormat::R16Snorm"; - break; - case TextureFormat::RG16Snorm: - o << "TextureFormat::RG16Snorm"; - break; - case TextureFormat::RGBA16Snorm: - o << "TextureFormat::RGBA16Snorm"; - break; - case TextureFormat::R8BG8Biplanar420Unorm: - o << "TextureFormat::R8BG8Biplanar420Unorm"; - break; - case TextureFormat::R10X6BG10X6Biplanar420Unorm: - o << "TextureFormat::R10X6BG10X6Biplanar420Unorm"; - break; - case TextureFormat::R8BG8A8Triplanar420Unorm: - o << "TextureFormat::R8BG8A8Triplanar420Unorm"; - break; - default: - o << "TextureFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, TextureSampleType value) { - switch (value) { - case TextureSampleType::Undefined: - o << "TextureSampleType::Undefined"; - break; - case TextureSampleType::Float: - o << "TextureSampleType::Float"; - break; - case TextureSampleType::UnfilterableFloat: - o << "TextureSampleType::UnfilterableFloat"; - break; - case TextureSampleType::Depth: - o << "TextureSampleType::Depth"; - break; - case TextureSampleType::Sint: - o << "TextureSampleType::Sint"; - break; - case TextureSampleType::Uint: - o << "TextureSampleType::Uint"; - break; - default: - o << "TextureSampleType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, TextureViewDimension value) { - switch (value) { - case TextureViewDimension::Undefined: - o << "TextureViewDimension::Undefined"; - break; - case TextureViewDimension::e1D: - o << "TextureViewDimension::e1D"; - break; - case TextureViewDimension::e2D: - o << "TextureViewDimension::e2D"; - break; - case TextureViewDimension::e2DArray: - o << "TextureViewDimension::e2DArray"; - break; - case TextureViewDimension::Cube: - o << "TextureViewDimension::Cube"; - break; - case TextureViewDimension::CubeArray: - o << "TextureViewDimension::CubeArray"; - break; - case TextureViewDimension::e3D: - o << "TextureViewDimension::e3D"; - break; - default: - o << "TextureViewDimension::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, VertexFormat value) { - switch (value) { - case VertexFormat::Undefined: - o << "VertexFormat::Undefined"; - break; - case VertexFormat::Uint8x2: - o << "VertexFormat::Uint8x2"; - break; - case VertexFormat::Uint8x4: - o << "VertexFormat::Uint8x4"; - break; - case VertexFormat::Sint8x2: - o << "VertexFormat::Sint8x2"; - break; - case VertexFormat::Sint8x4: - o << "VertexFormat::Sint8x4"; - break; - case VertexFormat::Unorm8x2: - o << "VertexFormat::Unorm8x2"; - break; - case VertexFormat::Unorm8x4: - o << "VertexFormat::Unorm8x4"; - break; - case VertexFormat::Snorm8x2: - o << "VertexFormat::Snorm8x2"; - break; - case VertexFormat::Snorm8x4: - o << "VertexFormat::Snorm8x4"; - break; - case VertexFormat::Uint16x2: - o << "VertexFormat::Uint16x2"; - break; - case VertexFormat::Uint16x4: - o << "VertexFormat::Uint16x4"; - break; - case VertexFormat::Sint16x2: - o << "VertexFormat::Sint16x2"; - break; - case VertexFormat::Sint16x4: - o << "VertexFormat::Sint16x4"; - break; - case VertexFormat::Unorm16x2: - o << "VertexFormat::Unorm16x2"; - break; - case VertexFormat::Unorm16x4: - o << "VertexFormat::Unorm16x4"; - break; - case VertexFormat::Snorm16x2: - o << "VertexFormat::Snorm16x2"; - break; - case VertexFormat::Snorm16x4: - o << "VertexFormat::Snorm16x4"; - break; - case VertexFormat::Float16x2: - o << "VertexFormat::Float16x2"; - break; - case VertexFormat::Float16x4: - o << "VertexFormat::Float16x4"; - break; - case VertexFormat::Float32: - o << "VertexFormat::Float32"; - break; - case VertexFormat::Float32x2: - o << "VertexFormat::Float32x2"; - break; - case VertexFormat::Float32x3: - o << "VertexFormat::Float32x3"; - break; - case VertexFormat::Float32x4: - o << "VertexFormat::Float32x4"; - break; - case VertexFormat::Uint32: - o << "VertexFormat::Uint32"; - break; - case VertexFormat::Uint32x2: - o << "VertexFormat::Uint32x2"; - break; - case VertexFormat::Uint32x3: - o << "VertexFormat::Uint32x3"; - break; - case VertexFormat::Uint32x4: - o << "VertexFormat::Uint32x4"; - break; - case VertexFormat::Sint32: - o << "VertexFormat::Sint32"; - break; - case VertexFormat::Sint32x2: - o << "VertexFormat::Sint32x2"; - break; - case VertexFormat::Sint32x3: - o << "VertexFormat::Sint32x3"; - break; - case VertexFormat::Sint32x4: - o << "VertexFormat::Sint32x4"; - break; - case VertexFormat::Unorm10_10_10_2: - o << "VertexFormat::Unorm10_10_10_2"; - break; - default: - o << "VertexFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, VertexStepMode value) { - switch (value) { - case VertexStepMode::Undefined: - o << "VertexStepMode::Undefined"; - break; - case VertexStepMode::VertexBufferNotUsed: - o << "VertexStepMode::VertexBufferNotUsed"; - break; - case VertexStepMode::Vertex: - o << "VertexStepMode::Vertex"; - break; - case VertexStepMode::Instance: - o << "VertexStepMode::Instance"; - break; - default: - o << "VertexStepMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } - template - std::basic_ostream& operator<<(std::basic_ostream& o, WaitStatus value) { - switch (value) { - case WaitStatus::Success: - o << "WaitStatus::Success"; - break; - case WaitStatus::TimedOut: - o << "WaitStatus::TimedOut"; - break; - case WaitStatus::UnsupportedTimeout: - o << "WaitStatus::UnsupportedTimeout"; - break; - case WaitStatus::UnsupportedCount: - o << "WaitStatus::UnsupportedCount"; - break; - case WaitStatus::UnsupportedMixedSources: - o << "WaitStatus::UnsupportedMixedSources"; - break; - case WaitStatus::Unknown: - o << "WaitStatus::Unknown"; - break; - default: - o << "WaitStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - return o; - } +template +std::basic_ostream & +operator<<(std::basic_ostream &o, WGSLFeatureName value) { + switch (value) { + case WGSLFeatureName::Undefined: + o << "WGSLFeatureName::Undefined"; + break; + case WGSLFeatureName::ReadonlyAndReadwriteStorageTextures: + o << "WGSLFeatureName::ReadonlyAndReadwriteStorageTextures"; + break; + case WGSLFeatureName::Packed4x8IntegerDotProduct: + o << "WGSLFeatureName::Packed4x8IntegerDotProduct"; + break; + case WGSLFeatureName::UnrestrictedPointerParameters: + o << "WGSLFeatureName::UnrestrictedPointerParameters"; + break; + case WGSLFeatureName::PointerCompositeAccess: + o << "WGSLFeatureName::PointerCompositeAccess"; + break; + case WGSLFeatureName::ChromiumTestingUnimplemented: + o << "WGSLFeatureName::ChromiumTestingUnimplemented"; + break; + case WGSLFeatureName::ChromiumTestingUnsafeExperimental: + o << "WGSLFeatureName::ChromiumTestingUnsafeExperimental"; + break; + case WGSLFeatureName::ChromiumTestingExperimental: + o << "WGSLFeatureName::ChromiumTestingExperimental"; + break; + case WGSLFeatureName::ChromiumTestingShippedWithKillswitch: + o << "WGSLFeatureName::ChromiumTestingShippedWithKillswitch"; + break; + case WGSLFeatureName::ChromiumTestingShipped: + o << "WGSLFeatureName::ChromiumTestingShipped"; + break; + default: + o << "WGSLFeatureName::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, AdapterType value) { + switch (value) { + case AdapterType::DiscreteGPU: + o << "AdapterType::DiscreteGPU"; + break; + case AdapterType::IntegratedGPU: + o << "AdapterType::IntegratedGPU"; + break; + case AdapterType::CPU: + o << "AdapterType::CPU"; + break; + case AdapterType::Unknown: + o << "AdapterType::Unknown"; + break; + default: + o << "AdapterType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, AddressMode value) { + switch (value) { + case AddressMode::Undefined: + o << "AddressMode::Undefined"; + break; + case AddressMode::ClampToEdge: + o << "AddressMode::ClampToEdge"; + break; + case AddressMode::Repeat: + o << "AddressMode::Repeat"; + break; + case AddressMode::MirrorRepeat: + o << "AddressMode::MirrorRepeat"; + break; + default: + o << "AddressMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, AlphaMode value) { + switch (value) { + case AlphaMode::Opaque: + o << "AlphaMode::Opaque"; + break; + case AlphaMode::Premultiplied: + o << "AlphaMode::Premultiplied"; + break; + case AlphaMode::Unpremultiplied: + o << "AlphaMode::Unpremultiplied"; + break; + default: + o << "AlphaMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BackendType value) { + switch (value) { + case BackendType::Undefined: + o << "BackendType::Undefined"; + break; + case BackendType::Null: + o << "BackendType::Null"; + break; + case BackendType::WebGPU: + o << "BackendType::WebGPU"; + break; + case BackendType::D3D11: + o << "BackendType::D3D11"; + break; + case BackendType::D3D12: + o << "BackendType::D3D12"; + break; + case BackendType::Metal: + o << "BackendType::Metal"; + break; + case BackendType::Vulkan: + o << "BackendType::Vulkan"; + break; + case BackendType::OpenGL: + o << "BackendType::OpenGL"; + break; + case BackendType::OpenGLES: + o << "BackendType::OpenGLES"; + break; + default: + o << "BackendType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BlendFactor value) { + switch (value) { + case BlendFactor::Undefined: + o << "BlendFactor::Undefined"; + break; + case BlendFactor::Zero: + o << "BlendFactor::Zero"; + break; + case BlendFactor::One: + o << "BlendFactor::One"; + break; + case BlendFactor::Src: + o << "BlendFactor::Src"; + break; + case BlendFactor::OneMinusSrc: + o << "BlendFactor::OneMinusSrc"; + break; + case BlendFactor::SrcAlpha: + o << "BlendFactor::SrcAlpha"; + break; + case BlendFactor::OneMinusSrcAlpha: + o << "BlendFactor::OneMinusSrcAlpha"; + break; + case BlendFactor::Dst: + o << "BlendFactor::Dst"; + break; + case BlendFactor::OneMinusDst: + o << "BlendFactor::OneMinusDst"; + break; + case BlendFactor::DstAlpha: + o << "BlendFactor::DstAlpha"; + break; + case BlendFactor::OneMinusDstAlpha: + o << "BlendFactor::OneMinusDstAlpha"; + break; + case BlendFactor::SrcAlphaSaturated: + o << "BlendFactor::SrcAlphaSaturated"; + break; + case BlendFactor::Constant: + o << "BlendFactor::Constant"; + break; + case BlendFactor::OneMinusConstant: + o << "BlendFactor::OneMinusConstant"; + break; + case BlendFactor::Src1: + o << "BlendFactor::Src1"; + break; + case BlendFactor::OneMinusSrc1: + o << "BlendFactor::OneMinusSrc1"; + break; + case BlendFactor::Src1Alpha: + o << "BlendFactor::Src1Alpha"; + break; + case BlendFactor::OneMinusSrc1Alpha: + o << "BlendFactor::OneMinusSrc1Alpha"; + break; + default: + o << "BlendFactor::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BlendOperation value) { + switch (value) { + case BlendOperation::Undefined: + o << "BlendOperation::Undefined"; + break; + case BlendOperation::Add: + o << "BlendOperation::Add"; + break; + case BlendOperation::Subtract: + o << "BlendOperation::Subtract"; + break; + case BlendOperation::ReverseSubtract: + o << "BlendOperation::ReverseSubtract"; + break; + case BlendOperation::Min: + o << "BlendOperation::Min"; + break; + case BlendOperation::Max: + o << "BlendOperation::Max"; + break; + default: + o << "BlendOperation::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BufferBindingType value) { + switch (value) { + case BufferBindingType::Undefined: + o << "BufferBindingType::Undefined"; + break; + case BufferBindingType::Uniform: + o << "BufferBindingType::Uniform"; + break; + case BufferBindingType::Storage: + o << "BufferBindingType::Storage"; + break; + case BufferBindingType::ReadOnlyStorage: + o << "BufferBindingType::ReadOnlyStorage"; + break; + default: + o << "BufferBindingType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BufferMapAsyncStatus value) { + switch (value) { + case BufferMapAsyncStatus::Success: + o << "BufferMapAsyncStatus::Success"; + break; + case BufferMapAsyncStatus::InstanceDropped: + o << "BufferMapAsyncStatus::InstanceDropped"; + break; + case BufferMapAsyncStatus::ValidationError: + o << "BufferMapAsyncStatus::ValidationError"; + break; + case BufferMapAsyncStatus::Unknown: + o << "BufferMapAsyncStatus::Unknown"; + break; + case BufferMapAsyncStatus::DeviceLost: + o << "BufferMapAsyncStatus::DeviceLost"; + break; + case BufferMapAsyncStatus::DestroyedBeforeCallback: + o << "BufferMapAsyncStatus::DestroyedBeforeCallback"; + break; + case BufferMapAsyncStatus::UnmappedBeforeCallback: + o << "BufferMapAsyncStatus::UnmappedBeforeCallback"; + break; + case BufferMapAsyncStatus::MappingAlreadyPending: + o << "BufferMapAsyncStatus::MappingAlreadyPending"; + break; + case BufferMapAsyncStatus::OffsetOutOfRange: + o << "BufferMapAsyncStatus::OffsetOutOfRange"; + break; + case BufferMapAsyncStatus::SizeOutOfRange: + o << "BufferMapAsyncStatus::SizeOutOfRange"; + break; + default: + o << "BufferMapAsyncStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BufferMapState value) { + switch (value) { + case BufferMapState::Unmapped: + o << "BufferMapState::Unmapped"; + break; + case BufferMapState::Pending: + o << "BufferMapState::Pending"; + break; + case BufferMapState::Mapped: + o << "BufferMapState::Mapped"; + break; + default: + o << "BufferMapState::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, CallbackMode value) { + switch (value) { + case CallbackMode::WaitAnyOnly: + o << "CallbackMode::WaitAnyOnly"; + break; + case CallbackMode::AllowProcessEvents: + o << "CallbackMode::AllowProcessEvents"; + break; + case CallbackMode::AllowSpontaneous: + o << "CallbackMode::AllowSpontaneous"; + break; + default: + o << "CallbackMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, CompareFunction value) { + switch (value) { + case CompareFunction::Undefined: + o << "CompareFunction::Undefined"; + break; + case CompareFunction::Never: + o << "CompareFunction::Never"; + break; + case CompareFunction::Less: + o << "CompareFunction::Less"; + break; + case CompareFunction::Equal: + o << "CompareFunction::Equal"; + break; + case CompareFunction::LessEqual: + o << "CompareFunction::LessEqual"; + break; + case CompareFunction::Greater: + o << "CompareFunction::Greater"; + break; + case CompareFunction::NotEqual: + o << "CompareFunction::NotEqual"; + break; + case CompareFunction::GreaterEqual: + o << "CompareFunction::GreaterEqual"; + break; + case CompareFunction::Always: + o << "CompareFunction::Always"; + break; + default: + o << "CompareFunction::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, + CompilationInfoRequestStatus value) { + switch (value) { + case CompilationInfoRequestStatus::Success: + o << "CompilationInfoRequestStatus::Success"; + break; + case CompilationInfoRequestStatus::InstanceDropped: + o << "CompilationInfoRequestStatus::InstanceDropped"; + break; + case CompilationInfoRequestStatus::Error: + o << "CompilationInfoRequestStatus::Error"; + break; + case CompilationInfoRequestStatus::DeviceLost: + o << "CompilationInfoRequestStatus::DeviceLost"; + break; + case CompilationInfoRequestStatus::Unknown: + o << "CompilationInfoRequestStatus::Unknown"; + break; + default: + o << "CompilationInfoRequestStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast< + typename std::underlying_type::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, CompilationMessageType value) { + switch (value) { + case CompilationMessageType::Error: + o << "CompilationMessageType::Error"; + break; + case CompilationMessageType::Warning: + o << "CompilationMessageType::Warning"; + break; + case CompilationMessageType::Info: + o << "CompilationMessageType::Info"; + break; + default: + o << "CompilationMessageType::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast< + typename std::underlying_type::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, + CreatePipelineAsyncStatus value) { + switch (value) { + case CreatePipelineAsyncStatus::Success: + o << "CreatePipelineAsyncStatus::Success"; + break; + case CreatePipelineAsyncStatus::InstanceDropped: + o << "CreatePipelineAsyncStatus::InstanceDropped"; + break; + case CreatePipelineAsyncStatus::ValidationError: + o << "CreatePipelineAsyncStatus::ValidationError"; + break; + case CreatePipelineAsyncStatus::InternalError: + o << "CreatePipelineAsyncStatus::InternalError"; + break; + case CreatePipelineAsyncStatus::DeviceLost: + o << "CreatePipelineAsyncStatus::DeviceLost"; + break; + case CreatePipelineAsyncStatus::DeviceDestroyed: + o << "CreatePipelineAsyncStatus::DeviceDestroyed"; + break; + case CreatePipelineAsyncStatus::Unknown: + o << "CreatePipelineAsyncStatus::Unknown"; + break; + default: + o << "CreatePipelineAsyncStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast< + typename std::underlying_type::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, CullMode value) { + switch (value) { + case CullMode::Undefined: + o << "CullMode::Undefined"; + break; + case CullMode::None: + o << "CullMode::None"; + break; + case CullMode::Front: + o << "CullMode::Front"; + break; + case CullMode::Back: + o << "CullMode::Back"; + break; + default: + o << "CullMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, DeviceLostReason value) { + switch (value) { + case DeviceLostReason::Undefined: + o << "DeviceLostReason::Undefined"; + break; + case DeviceLostReason::Destroyed: + o << "DeviceLostReason::Destroyed"; + break; + default: + o << "DeviceLostReason::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, ErrorFilter value) { + switch (value) { + case ErrorFilter::Validation: + o << "ErrorFilter::Validation"; + break; + case ErrorFilter::OutOfMemory: + o << "ErrorFilter::OutOfMemory"; + break; + case ErrorFilter::Internal: + o << "ErrorFilter::Internal"; + break; + default: + o << "ErrorFilter::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, ErrorType value) { + switch (value) { + case ErrorType::NoError: + o << "ErrorType::NoError"; + break; + case ErrorType::Validation: + o << "ErrorType::Validation"; + break; + case ErrorType::OutOfMemory: + o << "ErrorType::OutOfMemory"; + break; + case ErrorType::Internal: + o << "ErrorType::Internal"; + break; + case ErrorType::Unknown: + o << "ErrorType::Unknown"; + break; + case ErrorType::DeviceLost: + o << "ErrorType::DeviceLost"; + break; + default: + o << "ErrorType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, + ExternalTextureRotation value) { + switch (value) { + case ExternalTextureRotation::Rotate0Degrees: + o << "ExternalTextureRotation::Rotate0Degrees"; + break; + case ExternalTextureRotation::Rotate90Degrees: + o << "ExternalTextureRotation::Rotate90Degrees"; + break; + case ExternalTextureRotation::Rotate180Degrees: + o << "ExternalTextureRotation::Rotate180Degrees"; + break; + case ExternalTextureRotation::Rotate270Degrees: + o << "ExternalTextureRotation::Rotate270Degrees"; + break; + default: + o << "ExternalTextureRotation::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast< + typename std::underlying_type::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, FeatureName value) { + switch (value) { + case FeatureName::Undefined: + o << "FeatureName::Undefined"; + break; + case FeatureName::DepthClipControl: + o << "FeatureName::DepthClipControl"; + break; + case FeatureName::Depth32FloatStencil8: + o << "FeatureName::Depth32FloatStencil8"; + break; + case FeatureName::TimestampQuery: + o << "FeatureName::TimestampQuery"; + break; + case FeatureName::TextureCompressionBC: + o << "FeatureName::TextureCompressionBC"; + break; + case FeatureName::TextureCompressionETC2: + o << "FeatureName::TextureCompressionETC2"; + break; + case FeatureName::TextureCompressionASTC: + o << "FeatureName::TextureCompressionASTC"; + break; + case FeatureName::IndirectFirstInstance: + o << "FeatureName::IndirectFirstInstance"; + break; + case FeatureName::ShaderF16: + o << "FeatureName::ShaderF16"; + break; + case FeatureName::RG11B10UfloatRenderable: + o << "FeatureName::RG11B10UfloatRenderable"; + break; + case FeatureName::BGRA8UnormStorage: + o << "FeatureName::BGRA8UnormStorage"; + break; + case FeatureName::Float32Filterable: + o << "FeatureName::Float32Filterable"; + break; + case FeatureName::DawnInternalUsages: + o << "FeatureName::DawnInternalUsages"; + break; + case FeatureName::DawnMultiPlanarFormats: + o << "FeatureName::DawnMultiPlanarFormats"; + break; + case FeatureName::DawnNative: + o << "FeatureName::DawnNative"; + break; + case FeatureName::ChromiumExperimentalTimestampQueryInsidePasses: + o << "FeatureName::ChromiumExperimentalTimestampQueryInsidePasses"; + break; + case FeatureName::ImplicitDeviceSynchronization: + o << "FeatureName::ImplicitDeviceSynchronization"; + break; + case FeatureName::SurfaceCapabilities: + o << "FeatureName::SurfaceCapabilities"; + break; + case FeatureName::TransientAttachments: + o << "FeatureName::TransientAttachments"; + break; + case FeatureName::MSAARenderToSingleSampled: + o << "FeatureName::MSAARenderToSingleSampled"; + break; + case FeatureName::DualSourceBlending: + o << "FeatureName::DualSourceBlending"; + break; + case FeatureName::D3D11MultithreadProtected: + o << "FeatureName::D3D11MultithreadProtected"; + break; + case FeatureName::ANGLETextureSharing: + o << "FeatureName::ANGLETextureSharing"; + break; + case FeatureName::ChromiumExperimentalSubgroups: + o << "FeatureName::ChromiumExperimentalSubgroups"; + break; + case FeatureName::ChromiumExperimentalSubgroupUniformControlFlow: + o << "FeatureName::ChromiumExperimentalSubgroupUniformControlFlow"; + break; + case FeatureName::PixelLocalStorageCoherent: + o << "FeatureName::PixelLocalStorageCoherent"; + break; + case FeatureName::PixelLocalStorageNonCoherent: + o << "FeatureName::PixelLocalStorageNonCoherent"; + break; + case FeatureName::Unorm16TextureFormats: + o << "FeatureName::Unorm16TextureFormats"; + break; + case FeatureName::Snorm16TextureFormats: + o << "FeatureName::Snorm16TextureFormats"; + break; + case FeatureName::MultiPlanarFormatExtendedUsages: + o << "FeatureName::MultiPlanarFormatExtendedUsages"; + break; + case FeatureName::MultiPlanarFormatP010: + o << "FeatureName::MultiPlanarFormatP010"; + break; + case FeatureName::HostMappedPointer: + o << "FeatureName::HostMappedPointer"; + break; + case FeatureName::MultiPlanarRenderTargets: + o << "FeatureName::MultiPlanarRenderTargets"; + break; + case FeatureName::MultiPlanarFormatNv12a: + o << "FeatureName::MultiPlanarFormatNv12a"; + break; + case FeatureName::FramebufferFetch: + o << "FeatureName::FramebufferFetch"; + break; + case FeatureName::BufferMapExtendedUsages: + o << "FeatureName::BufferMapExtendedUsages"; + break; + case FeatureName::AdapterPropertiesMemoryHeaps: + o << "FeatureName::AdapterPropertiesMemoryHeaps"; + break; + case FeatureName::AdapterPropertiesD3D: + o << "FeatureName::AdapterPropertiesD3D"; + break; + case FeatureName::AdapterPropertiesVk: + o << "FeatureName::AdapterPropertiesVk"; + break; + case FeatureName::R8UnormStorage: + o << "FeatureName::R8UnormStorage"; + break; + case FeatureName::FormatCapabilities: + o << "FeatureName::FormatCapabilities"; + break; + case FeatureName::DrmFormatCapabilities: + o << "FeatureName::DrmFormatCapabilities"; + break; + case FeatureName::Norm16TextureFormats: + o << "FeatureName::Norm16TextureFormats"; + break; + case FeatureName::SharedTextureMemoryVkDedicatedAllocation: + o << "FeatureName::SharedTextureMemoryVkDedicatedAllocation"; + break; + case FeatureName::SharedTextureMemoryAHardwareBuffer: + o << "FeatureName::SharedTextureMemoryAHardwareBuffer"; + break; + case FeatureName::SharedTextureMemoryDmaBuf: + o << "FeatureName::SharedTextureMemoryDmaBuf"; + break; + case FeatureName::SharedTextureMemoryOpaqueFD: + o << "FeatureName::SharedTextureMemoryOpaqueFD"; + break; + case FeatureName::SharedTextureMemoryZirconHandle: + o << "FeatureName::SharedTextureMemoryZirconHandle"; + break; + case FeatureName::SharedTextureMemoryDXGISharedHandle: + o << "FeatureName::SharedTextureMemoryDXGISharedHandle"; + break; + case FeatureName::SharedTextureMemoryD3D11Texture2D: + o << "FeatureName::SharedTextureMemoryD3D11Texture2D"; + break; + case FeatureName::SharedTextureMemoryIOSurface: + o << "FeatureName::SharedTextureMemoryIOSurface"; + break; + case FeatureName::SharedTextureMemoryEGLImage: + o << "FeatureName::SharedTextureMemoryEGLImage"; + break; + case FeatureName::SharedFenceVkSemaphoreOpaqueFD: + o << "FeatureName::SharedFenceVkSemaphoreOpaqueFD"; + break; + case FeatureName::SharedFenceVkSemaphoreSyncFD: + o << "FeatureName::SharedFenceVkSemaphoreSyncFD"; + break; + case FeatureName::SharedFenceVkSemaphoreZirconHandle: + o << "FeatureName::SharedFenceVkSemaphoreZirconHandle"; + break; + case FeatureName::SharedFenceDXGISharedHandle: + o << "FeatureName::SharedFenceDXGISharedHandle"; + break; + case FeatureName::SharedFenceMTLSharedEvent: + o << "FeatureName::SharedFenceMTLSharedEvent"; + break; + case FeatureName::SharedBufferMemoryD3D12Resource: + o << "FeatureName::SharedBufferMemoryD3D12Resource"; + break; + case FeatureName::StaticSamplers: + o << "FeatureName::StaticSamplers"; + break; + default: + o << "FeatureName::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, FilterMode value) { + switch (value) { + case FilterMode::Undefined: + o << "FilterMode::Undefined"; + break; + case FilterMode::Nearest: + o << "FilterMode::Nearest"; + break; + case FilterMode::Linear: + o << "FilterMode::Linear"; + break; + default: + o << "FilterMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, FrontFace value) { + switch (value) { + case FrontFace::Undefined: + o << "FrontFace::Undefined"; + break; + case FrontFace::CCW: + o << "FrontFace::CCW"; + break; + case FrontFace::CW: + o << "FrontFace::CW"; + break; + default: + o << "FrontFace::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, IndexFormat value) { + switch (value) { + case IndexFormat::Undefined: + o << "IndexFormat::Undefined"; + break; + case IndexFormat::Uint16: + o << "IndexFormat::Uint16"; + break; + case IndexFormat::Uint32: + o << "IndexFormat::Uint32"; + break; + default: + o << "IndexFormat::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, LoadOp value) { + switch (value) { + case LoadOp::Undefined: + o << "LoadOp::Undefined"; + break; + case LoadOp::Clear: + o << "LoadOp::Clear"; + break; + case LoadOp::Load: + o << "LoadOp::Load"; + break; + default: + o << "LoadOp::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, LoggingType value) { + switch (value) { + case LoggingType::Verbose: + o << "LoggingType::Verbose"; + break; + case LoggingType::Info: + o << "LoggingType::Info"; + break; + case LoggingType::Warning: + o << "LoggingType::Warning"; + break; + case LoggingType::Error: + o << "LoggingType::Error"; + break; + default: + o << "LoggingType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, MipmapFilterMode value) { + switch (value) { + case MipmapFilterMode::Undefined: + o << "MipmapFilterMode::Undefined"; + break; + case MipmapFilterMode::Nearest: + o << "MipmapFilterMode::Nearest"; + break; + case MipmapFilterMode::Linear: + o << "MipmapFilterMode::Linear"; + break; + default: + o << "MipmapFilterMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, PopErrorScopeStatus value) { + switch (value) { + case PopErrorScopeStatus::Success: + o << "PopErrorScopeStatus::Success"; + break; + case PopErrorScopeStatus::InstanceDropped: + o << "PopErrorScopeStatus::InstanceDropped"; + break; + default: + o << "PopErrorScopeStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, PowerPreference value) { + switch (value) { + case PowerPreference::Undefined: + o << "PowerPreference::Undefined"; + break; + case PowerPreference::LowPower: + o << "PowerPreference::LowPower"; + break; + case PowerPreference::HighPerformance: + o << "PowerPreference::HighPerformance"; + break; + default: + o << "PowerPreference::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, PresentMode value) { + switch (value) { + case PresentMode::Fifo: + o << "PresentMode::Fifo"; + break; + case PresentMode::Immediate: + o << "PresentMode::Immediate"; + break; + case PresentMode::Mailbox: + o << "PresentMode::Mailbox"; + break; + default: + o << "PresentMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, PrimitiveTopology value) { + switch (value) { + case PrimitiveTopology::Undefined: + o << "PrimitiveTopology::Undefined"; + break; + case PrimitiveTopology::PointList: + o << "PrimitiveTopology::PointList"; + break; + case PrimitiveTopology::LineList: + o << "PrimitiveTopology::LineList"; + break; + case PrimitiveTopology::LineStrip: + o << "PrimitiveTopology::LineStrip"; + break; + case PrimitiveTopology::TriangleList: + o << "PrimitiveTopology::TriangleList"; + break; + case PrimitiveTopology::TriangleStrip: + o << "PrimitiveTopology::TriangleStrip"; + break; + default: + o << "PrimitiveTopology::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, QueryType value) { + switch (value) { + case QueryType::Occlusion: + o << "QueryType::Occlusion"; + break; + case QueryType::Timestamp: + o << "QueryType::Timestamp"; + break; + default: + o << "QueryType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, QueueWorkDoneStatus value) { + switch (value) { + case QueueWorkDoneStatus::Success: + o << "QueueWorkDoneStatus::Success"; + break; + case QueueWorkDoneStatus::InstanceDropped: + o << "QueueWorkDoneStatus::InstanceDropped"; + break; + case QueueWorkDoneStatus::Error: + o << "QueueWorkDoneStatus::Error"; + break; + case QueueWorkDoneStatus::Unknown: + o << "QueueWorkDoneStatus::Unknown"; + break; + case QueueWorkDoneStatus::DeviceLost: + o << "QueueWorkDoneStatus::DeviceLost"; + break; + default: + o << "QueueWorkDoneStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, RequestAdapterStatus value) { + switch (value) { + case RequestAdapterStatus::Success: + o << "RequestAdapterStatus::Success"; + break; + case RequestAdapterStatus::InstanceDropped: + o << "RequestAdapterStatus::InstanceDropped"; + break; + case RequestAdapterStatus::Unavailable: + o << "RequestAdapterStatus::Unavailable"; + break; + case RequestAdapterStatus::Error: + o << "RequestAdapterStatus::Error"; + break; + case RequestAdapterStatus::Unknown: + o << "RequestAdapterStatus::Unknown"; + break; + default: + o << "RequestAdapterStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, RequestDeviceStatus value) { + switch (value) { + case RequestDeviceStatus::Success: + o << "RequestDeviceStatus::Success"; + break; + case RequestDeviceStatus::InstanceDropped: + o << "RequestDeviceStatus::InstanceDropped"; + break; + case RequestDeviceStatus::Error: + o << "RequestDeviceStatus::Error"; + break; + case RequestDeviceStatus::Unknown: + o << "RequestDeviceStatus::Unknown"; + break; + default: + o << "RequestDeviceStatus::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, SType value) { + switch (value) { + case SType::Invalid: + o << "SType::Invalid"; + break; + case SType::SurfaceDescriptorFromMetalLayer: + o << "SType::SurfaceDescriptorFromMetalLayer"; + break; + case SType::SurfaceDescriptorFromWindowsHWND: + o << "SType::SurfaceDescriptorFromWindowsHWND"; + break; + case SType::SurfaceDescriptorFromXlibWindow: + o << "SType::SurfaceDescriptorFromXlibWindow"; + break; + case SType::SurfaceDescriptorFromCanvasHTMLSelector: + o << "SType::SurfaceDescriptorFromCanvasHTMLSelector"; + break; + case SType::ShaderModuleSPIRVDescriptor: + o << "SType::ShaderModuleSPIRVDescriptor"; + break; + case SType::ShaderModuleWGSLDescriptor: + o << "SType::ShaderModuleWGSLDescriptor"; + break; + case SType::PrimitiveDepthClipControl: + o << "SType::PrimitiveDepthClipControl"; + break; + case SType::SurfaceDescriptorFromWaylandSurface: + o << "SType::SurfaceDescriptorFromWaylandSurface"; + break; + case SType::SurfaceDescriptorFromAndroidNativeWindow: + o << "SType::SurfaceDescriptorFromAndroidNativeWindow"; + break; + case SType::SurfaceDescriptorFromWindowsCoreWindow: + o << "SType::SurfaceDescriptorFromWindowsCoreWindow"; + break; + case SType::ExternalTextureBindingEntry: + o << "SType::ExternalTextureBindingEntry"; + break; + case SType::ExternalTextureBindingLayout: + o << "SType::ExternalTextureBindingLayout"; + break; + case SType::SurfaceDescriptorFromWindowsSwapChainPanel: + o << "SType::SurfaceDescriptorFromWindowsSwapChainPanel"; + break; + case SType::RenderPassDescriptorMaxDrawCount: + o << "SType::RenderPassDescriptorMaxDrawCount"; + break; + case SType::DepthStencilStateDepthWriteDefinedDawn: + o << "SType::DepthStencilStateDepthWriteDefinedDawn"; + break; + case SType::TextureBindingViewDimensionDescriptor: + o << "SType::TextureBindingViewDimensionDescriptor"; + break; + case SType::DawnTextureInternalUsageDescriptor: + o << "SType::DawnTextureInternalUsageDescriptor"; + break; + case SType::DawnEncoderInternalUsageDescriptor: + o << "SType::DawnEncoderInternalUsageDescriptor"; + break; + case SType::DawnInstanceDescriptor: + o << "SType::DawnInstanceDescriptor"; + break; + case SType::DawnCacheDeviceDescriptor: + o << "SType::DawnCacheDeviceDescriptor"; + break; + case SType::DawnAdapterPropertiesPowerPreference: + o << "SType::DawnAdapterPropertiesPowerPreference"; + break; + case SType::DawnBufferDescriptorErrorInfoFromWireClient: + o << "SType::DawnBufferDescriptorErrorInfoFromWireClient"; + break; + case SType::DawnTogglesDescriptor: + o << "SType::DawnTogglesDescriptor"; + break; + case SType::DawnShaderModuleSPIRVOptionsDescriptor: + o << "SType::DawnShaderModuleSPIRVOptionsDescriptor"; + break; + case SType::RequestAdapterOptionsLUID: + o << "SType::RequestAdapterOptionsLUID"; + break; + case SType::RequestAdapterOptionsGetGLProc: + o << "SType::RequestAdapterOptionsGetGLProc"; + break; + case SType::RequestAdapterOptionsD3D11Device: + o << "SType::RequestAdapterOptionsD3D11Device"; + break; + case SType::DawnMultisampleStateRenderToSingleSampled: + o << "SType::DawnMultisampleStateRenderToSingleSampled"; + break; + case SType::DawnRenderPassColorAttachmentRenderToSingleSampled: + o << "SType::DawnRenderPassColorAttachmentRenderToSingleSampled"; + break; + case SType::RenderPassPixelLocalStorage: + o << "SType::RenderPassPixelLocalStorage"; + break; + case SType::PipelineLayoutPixelLocalStorage: + o << "SType::PipelineLayoutPixelLocalStorage"; + break; + case SType::BufferHostMappedPointer: + o << "SType::BufferHostMappedPointer"; + break; + case SType::DawnExperimentalSubgroupLimits: + o << "SType::DawnExperimentalSubgroupLimits"; + break; + case SType::AdapterPropertiesMemoryHeaps: + o << "SType::AdapterPropertiesMemoryHeaps"; + break; + case SType::AdapterPropertiesD3D: + o << "SType::AdapterPropertiesD3D"; + break; + case SType::AdapterPropertiesVk: + o << "SType::AdapterPropertiesVk"; + break; + case SType::DawnComputePipelineFullSubgroups: + o << "SType::DawnComputePipelineFullSubgroups"; + break; + case SType::DawnWireWGSLControl: + o << "SType::DawnWireWGSLControl"; + break; + case SType::DawnWGSLBlocklist: + o << "SType::DawnWGSLBlocklist"; + break; + case SType::DrmFormatCapabilities: + o << "SType::DrmFormatCapabilities"; + break; + case SType::SharedTextureMemoryVkImageDescriptor: + o << "SType::SharedTextureMemoryVkImageDescriptor"; + break; + case SType::SharedTextureMemoryVkDedicatedAllocationDescriptor: + o << "SType::SharedTextureMemoryVkDedicatedAllocationDescriptor"; + break; + case SType::SharedTextureMemoryAHardwareBufferDescriptor: + o << "SType::SharedTextureMemoryAHardwareBufferDescriptor"; + break; + case SType::SharedTextureMemoryDmaBufDescriptor: + o << "SType::SharedTextureMemoryDmaBufDescriptor"; + break; + case SType::SharedTextureMemoryOpaqueFDDescriptor: + o << "SType::SharedTextureMemoryOpaqueFDDescriptor"; + break; + case SType::SharedTextureMemoryZirconHandleDescriptor: + o << "SType::SharedTextureMemoryZirconHandleDescriptor"; + break; + case SType::SharedTextureMemoryDXGISharedHandleDescriptor: + o << "SType::SharedTextureMemoryDXGISharedHandleDescriptor"; + break; + case SType::SharedTextureMemoryD3D11Texture2DDescriptor: + o << "SType::SharedTextureMemoryD3D11Texture2DDescriptor"; + break; + case SType::SharedTextureMemoryIOSurfaceDescriptor: + o << "SType::SharedTextureMemoryIOSurfaceDescriptor"; + break; + case SType::SharedTextureMemoryEGLImageDescriptor: + o << "SType::SharedTextureMemoryEGLImageDescriptor"; + break; + case SType::SharedTextureMemoryInitializedBeginState: + o << "SType::SharedTextureMemoryInitializedBeginState"; + break; + case SType::SharedTextureMemoryInitializedEndState: + o << "SType::SharedTextureMemoryInitializedEndState"; + break; + case SType::SharedTextureMemoryVkImageLayoutBeginState: + o << "SType::SharedTextureMemoryVkImageLayoutBeginState"; + break; + case SType::SharedTextureMemoryVkImageLayoutEndState: + o << "SType::SharedTextureMemoryVkImageLayoutEndState"; + break; + case SType::SharedFenceVkSemaphoreOpaqueFDDescriptor: + o << "SType::SharedFenceVkSemaphoreOpaqueFDDescriptor"; + break; + case SType::SharedFenceVkSemaphoreOpaqueFDExportInfo: + o << "SType::SharedFenceVkSemaphoreOpaqueFDExportInfo"; + break; + case SType::SharedFenceVkSemaphoreSyncFDDescriptor: + o << "SType::SharedFenceVkSemaphoreSyncFDDescriptor"; + break; + case SType::SharedFenceVkSemaphoreSyncFDExportInfo: + o << "SType::SharedFenceVkSemaphoreSyncFDExportInfo"; + break; + case SType::SharedFenceVkSemaphoreZirconHandleDescriptor: + o << "SType::SharedFenceVkSemaphoreZirconHandleDescriptor"; + break; + case SType::SharedFenceVkSemaphoreZirconHandleExportInfo: + o << "SType::SharedFenceVkSemaphoreZirconHandleExportInfo"; + break; + case SType::SharedFenceDXGISharedHandleDescriptor: + o << "SType::SharedFenceDXGISharedHandleDescriptor"; + break; + case SType::SharedFenceDXGISharedHandleExportInfo: + o << "SType::SharedFenceDXGISharedHandleExportInfo"; + break; + case SType::SharedFenceMTLSharedEventDescriptor: + o << "SType::SharedFenceMTLSharedEventDescriptor"; + break; + case SType::SharedFenceMTLSharedEventExportInfo: + o << "SType::SharedFenceMTLSharedEventExportInfo"; + break; + case SType::SharedBufferMemoryD3D12ResourceDescriptor: + o << "SType::SharedBufferMemoryD3D12ResourceDescriptor"; + break; + case SType::StaticSamplerBindingLayout: + o << "SType::StaticSamplerBindingLayout"; + break; + default: + o << "SType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, SamplerBindingType value) { + switch (value) { + case SamplerBindingType::Undefined: + o << "SamplerBindingType::Undefined"; + break; + case SamplerBindingType::Filtering: + o << "SamplerBindingType::Filtering"; + break; + case SamplerBindingType::NonFiltering: + o << "SamplerBindingType::NonFiltering"; + break; + case SamplerBindingType::Comparison: + o << "SamplerBindingType::Comparison"; + break; + default: + o << "SamplerBindingType::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, SharedFenceType value) { + switch (value) { + case SharedFenceType::Undefined: + o << "SharedFenceType::Undefined"; + break; + case SharedFenceType::VkSemaphoreOpaqueFD: + o << "SharedFenceType::VkSemaphoreOpaqueFD"; + break; + case SharedFenceType::VkSemaphoreSyncFD: + o << "SharedFenceType::VkSemaphoreSyncFD"; + break; + case SharedFenceType::VkSemaphoreZirconHandle: + o << "SharedFenceType::VkSemaphoreZirconHandle"; + break; + case SharedFenceType::DXGISharedHandle: + o << "SharedFenceType::DXGISharedHandle"; + break; + case SharedFenceType::MTLSharedEvent: + o << "SharedFenceType::MTLSharedEvent"; + break; + default: + o << "SharedFenceType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, StencilOperation value) { + switch (value) { + case StencilOperation::Undefined: + o << "StencilOperation::Undefined"; + break; + case StencilOperation::Keep: + o << "StencilOperation::Keep"; + break; + case StencilOperation::Zero: + o << "StencilOperation::Zero"; + break; + case StencilOperation::Replace: + o << "StencilOperation::Replace"; + break; + case StencilOperation::Invert: + o << "StencilOperation::Invert"; + break; + case StencilOperation::IncrementClamp: + o << "StencilOperation::IncrementClamp"; + break; + case StencilOperation::DecrementClamp: + o << "StencilOperation::DecrementClamp"; + break; + case StencilOperation::IncrementWrap: + o << "StencilOperation::IncrementWrap"; + break; + case StencilOperation::DecrementWrap: + o << "StencilOperation::DecrementWrap"; + break; + default: + o << "StencilOperation::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, StorageTextureAccess value) { + switch (value) { + case StorageTextureAccess::Undefined: + o << "StorageTextureAccess::Undefined"; + break; + case StorageTextureAccess::WriteOnly: + o << "StorageTextureAccess::WriteOnly"; + break; + case StorageTextureAccess::ReadOnly: + o << "StorageTextureAccess::ReadOnly"; + break; + case StorageTextureAccess::ReadWrite: + o << "StorageTextureAccess::ReadWrite"; + break; + default: + o << "StorageTextureAccess::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, StoreOp value) { + switch (value) { + case StoreOp::Undefined: + o << "StoreOp::Undefined"; + break; + case StoreOp::Store: + o << "StoreOp::Store"; + break; + case StoreOp::Discard: + o << "StoreOp::Discard"; + break; + default: + o << "StoreOp::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, TextureAspect value) { + switch (value) { + case TextureAspect::Undefined: + o << "TextureAspect::Undefined"; + break; + case TextureAspect::All: + o << "TextureAspect::All"; + break; + case TextureAspect::StencilOnly: + o << "TextureAspect::StencilOnly"; + break; + case TextureAspect::DepthOnly: + o << "TextureAspect::DepthOnly"; + break; + case TextureAspect::Plane0Only: + o << "TextureAspect::Plane0Only"; + break; + case TextureAspect::Plane1Only: + o << "TextureAspect::Plane1Only"; + break; + case TextureAspect::Plane2Only: + o << "TextureAspect::Plane2Only"; + break; + default: + o << "TextureAspect::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, TextureDimension value) { + switch (value) { + case TextureDimension::Undefined: + o << "TextureDimension::Undefined"; + break; + case TextureDimension::e1D: + o << "TextureDimension::e1D"; + break; + case TextureDimension::e2D: + o << "TextureDimension::e2D"; + break; + case TextureDimension::e3D: + o << "TextureDimension::e3D"; + break; + default: + o << "TextureDimension::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, TextureFormat value) { + switch (value) { + case TextureFormat::Undefined: + o << "TextureFormat::Undefined"; + break; + case TextureFormat::R8Unorm: + o << "TextureFormat::R8Unorm"; + break; + case TextureFormat::R8Snorm: + o << "TextureFormat::R8Snorm"; + break; + case TextureFormat::R8Uint: + o << "TextureFormat::R8Uint"; + break; + case TextureFormat::R8Sint: + o << "TextureFormat::R8Sint"; + break; + case TextureFormat::R16Uint: + o << "TextureFormat::R16Uint"; + break; + case TextureFormat::R16Sint: + o << "TextureFormat::R16Sint"; + break; + case TextureFormat::R16Float: + o << "TextureFormat::R16Float"; + break; + case TextureFormat::RG8Unorm: + o << "TextureFormat::RG8Unorm"; + break; + case TextureFormat::RG8Snorm: + o << "TextureFormat::RG8Snorm"; + break; + case TextureFormat::RG8Uint: + o << "TextureFormat::RG8Uint"; + break; + case TextureFormat::RG8Sint: + o << "TextureFormat::RG8Sint"; + break; + case TextureFormat::R32Float: + o << "TextureFormat::R32Float"; + break; + case TextureFormat::R32Uint: + o << "TextureFormat::R32Uint"; + break; + case TextureFormat::R32Sint: + o << "TextureFormat::R32Sint"; + break; + case TextureFormat::RG16Uint: + o << "TextureFormat::RG16Uint"; + break; + case TextureFormat::RG16Sint: + o << "TextureFormat::RG16Sint"; + break; + case TextureFormat::RG16Float: + o << "TextureFormat::RG16Float"; + break; + case TextureFormat::RGBA8Unorm: + o << "TextureFormat::RGBA8Unorm"; + break; + case TextureFormat::RGBA8UnormSrgb: + o << "TextureFormat::RGBA8UnormSrgb"; + break; + case TextureFormat::RGBA8Snorm: + o << "TextureFormat::RGBA8Snorm"; + break; + case TextureFormat::RGBA8Uint: + o << "TextureFormat::RGBA8Uint"; + break; + case TextureFormat::RGBA8Sint: + o << "TextureFormat::RGBA8Sint"; + break; + case TextureFormat::BGRA8Unorm: + o << "TextureFormat::BGRA8Unorm"; + break; + case TextureFormat::BGRA8UnormSrgb: + o << "TextureFormat::BGRA8UnormSrgb"; + break; + case TextureFormat::RGB10A2Uint: + o << "TextureFormat::RGB10A2Uint"; + break; + case TextureFormat::RGB10A2Unorm: + o << "TextureFormat::RGB10A2Unorm"; + break; + case TextureFormat::RG11B10Ufloat: + o << "TextureFormat::RG11B10Ufloat"; + break; + case TextureFormat::RGB9E5Ufloat: + o << "TextureFormat::RGB9E5Ufloat"; + break; + case TextureFormat::RG32Float: + o << "TextureFormat::RG32Float"; + break; + case TextureFormat::RG32Uint: + o << "TextureFormat::RG32Uint"; + break; + case TextureFormat::RG32Sint: + o << "TextureFormat::RG32Sint"; + break; + case TextureFormat::RGBA16Uint: + o << "TextureFormat::RGBA16Uint"; + break; + case TextureFormat::RGBA16Sint: + o << "TextureFormat::RGBA16Sint"; + break; + case TextureFormat::RGBA16Float: + o << "TextureFormat::RGBA16Float"; + break; + case TextureFormat::RGBA32Float: + o << "TextureFormat::RGBA32Float"; + break; + case TextureFormat::RGBA32Uint: + o << "TextureFormat::RGBA32Uint"; + break; + case TextureFormat::RGBA32Sint: + o << "TextureFormat::RGBA32Sint"; + break; + case TextureFormat::Stencil8: + o << "TextureFormat::Stencil8"; + break; + case TextureFormat::Depth16Unorm: + o << "TextureFormat::Depth16Unorm"; + break; + case TextureFormat::Depth24Plus: + o << "TextureFormat::Depth24Plus"; + break; + case TextureFormat::Depth24PlusStencil8: + o << "TextureFormat::Depth24PlusStencil8"; + break; + case TextureFormat::Depth32Float: + o << "TextureFormat::Depth32Float"; + break; + case TextureFormat::Depth32FloatStencil8: + o << "TextureFormat::Depth32FloatStencil8"; + break; + case TextureFormat::BC1RGBAUnorm: + o << "TextureFormat::BC1RGBAUnorm"; + break; + case TextureFormat::BC1RGBAUnormSrgb: + o << "TextureFormat::BC1RGBAUnormSrgb"; + break; + case TextureFormat::BC2RGBAUnorm: + o << "TextureFormat::BC2RGBAUnorm"; + break; + case TextureFormat::BC2RGBAUnormSrgb: + o << "TextureFormat::BC2RGBAUnormSrgb"; + break; + case TextureFormat::BC3RGBAUnorm: + o << "TextureFormat::BC3RGBAUnorm"; + break; + case TextureFormat::BC3RGBAUnormSrgb: + o << "TextureFormat::BC3RGBAUnormSrgb"; + break; + case TextureFormat::BC4RUnorm: + o << "TextureFormat::BC4RUnorm"; + break; + case TextureFormat::BC4RSnorm: + o << "TextureFormat::BC4RSnorm"; + break; + case TextureFormat::BC5RGUnorm: + o << "TextureFormat::BC5RGUnorm"; + break; + case TextureFormat::BC5RGSnorm: + o << "TextureFormat::BC5RGSnorm"; + break; + case TextureFormat::BC6HRGBUfloat: + o << "TextureFormat::BC6HRGBUfloat"; + break; + case TextureFormat::BC6HRGBFloat: + o << "TextureFormat::BC6HRGBFloat"; + break; + case TextureFormat::BC7RGBAUnorm: + o << "TextureFormat::BC7RGBAUnorm"; + break; + case TextureFormat::BC7RGBAUnormSrgb: + o << "TextureFormat::BC7RGBAUnormSrgb"; + break; + case TextureFormat::ETC2RGB8Unorm: + o << "TextureFormat::ETC2RGB8Unorm"; + break; + case TextureFormat::ETC2RGB8UnormSrgb: + o << "TextureFormat::ETC2RGB8UnormSrgb"; + break; + case TextureFormat::ETC2RGB8A1Unorm: + o << "TextureFormat::ETC2RGB8A1Unorm"; + break; + case TextureFormat::ETC2RGB8A1UnormSrgb: + o << "TextureFormat::ETC2RGB8A1UnormSrgb"; + break; + case TextureFormat::ETC2RGBA8Unorm: + o << "TextureFormat::ETC2RGBA8Unorm"; + break; + case TextureFormat::ETC2RGBA8UnormSrgb: + o << "TextureFormat::ETC2RGBA8UnormSrgb"; + break; + case TextureFormat::EACR11Unorm: + o << "TextureFormat::EACR11Unorm"; + break; + case TextureFormat::EACR11Snorm: + o << "TextureFormat::EACR11Snorm"; + break; + case TextureFormat::EACRG11Unorm: + o << "TextureFormat::EACRG11Unorm"; + break; + case TextureFormat::EACRG11Snorm: + o << "TextureFormat::EACRG11Snorm"; + break; + case TextureFormat::ASTC4x4Unorm: + o << "TextureFormat::ASTC4x4Unorm"; + break; + case TextureFormat::ASTC4x4UnormSrgb: + o << "TextureFormat::ASTC4x4UnormSrgb"; + break; + case TextureFormat::ASTC5x4Unorm: + o << "TextureFormat::ASTC5x4Unorm"; + break; + case TextureFormat::ASTC5x4UnormSrgb: + o << "TextureFormat::ASTC5x4UnormSrgb"; + break; + case TextureFormat::ASTC5x5Unorm: + o << "TextureFormat::ASTC5x5Unorm"; + break; + case TextureFormat::ASTC5x5UnormSrgb: + o << "TextureFormat::ASTC5x5UnormSrgb"; + break; + case TextureFormat::ASTC6x5Unorm: + o << "TextureFormat::ASTC6x5Unorm"; + break; + case TextureFormat::ASTC6x5UnormSrgb: + o << "TextureFormat::ASTC6x5UnormSrgb"; + break; + case TextureFormat::ASTC6x6Unorm: + o << "TextureFormat::ASTC6x6Unorm"; + break; + case TextureFormat::ASTC6x6UnormSrgb: + o << "TextureFormat::ASTC6x6UnormSrgb"; + break; + case TextureFormat::ASTC8x5Unorm: + o << "TextureFormat::ASTC8x5Unorm"; + break; + case TextureFormat::ASTC8x5UnormSrgb: + o << "TextureFormat::ASTC8x5UnormSrgb"; + break; + case TextureFormat::ASTC8x6Unorm: + o << "TextureFormat::ASTC8x6Unorm"; + break; + case TextureFormat::ASTC8x6UnormSrgb: + o << "TextureFormat::ASTC8x6UnormSrgb"; + break; + case TextureFormat::ASTC8x8Unorm: + o << "TextureFormat::ASTC8x8Unorm"; + break; + case TextureFormat::ASTC8x8UnormSrgb: + o << "TextureFormat::ASTC8x8UnormSrgb"; + break; + case TextureFormat::ASTC10x5Unorm: + o << "TextureFormat::ASTC10x5Unorm"; + break; + case TextureFormat::ASTC10x5UnormSrgb: + o << "TextureFormat::ASTC10x5UnormSrgb"; + break; + case TextureFormat::ASTC10x6Unorm: + o << "TextureFormat::ASTC10x6Unorm"; + break; + case TextureFormat::ASTC10x6UnormSrgb: + o << "TextureFormat::ASTC10x6UnormSrgb"; + break; + case TextureFormat::ASTC10x8Unorm: + o << "TextureFormat::ASTC10x8Unorm"; + break; + case TextureFormat::ASTC10x8UnormSrgb: + o << "TextureFormat::ASTC10x8UnormSrgb"; + break; + case TextureFormat::ASTC10x10Unorm: + o << "TextureFormat::ASTC10x10Unorm"; + break; + case TextureFormat::ASTC10x10UnormSrgb: + o << "TextureFormat::ASTC10x10UnormSrgb"; + break; + case TextureFormat::ASTC12x10Unorm: + o << "TextureFormat::ASTC12x10Unorm"; + break; + case TextureFormat::ASTC12x10UnormSrgb: + o << "TextureFormat::ASTC12x10UnormSrgb"; + break; + case TextureFormat::ASTC12x12Unorm: + o << "TextureFormat::ASTC12x12Unorm"; + break; + case TextureFormat::ASTC12x12UnormSrgb: + o << "TextureFormat::ASTC12x12UnormSrgb"; + break; + case TextureFormat::R16Unorm: + o << "TextureFormat::R16Unorm"; + break; + case TextureFormat::RG16Unorm: + o << "TextureFormat::RG16Unorm"; + break; + case TextureFormat::RGBA16Unorm: + o << "TextureFormat::RGBA16Unorm"; + break; + case TextureFormat::R16Snorm: + o << "TextureFormat::R16Snorm"; + break; + case TextureFormat::RG16Snorm: + o << "TextureFormat::RG16Snorm"; + break; + case TextureFormat::RGBA16Snorm: + o << "TextureFormat::RGBA16Snorm"; + break; + case TextureFormat::R8BG8Biplanar420Unorm: + o << "TextureFormat::R8BG8Biplanar420Unorm"; + break; + case TextureFormat::R10X6BG10X6Biplanar420Unorm: + o << "TextureFormat::R10X6BG10X6Biplanar420Unorm"; + break; + case TextureFormat::R8BG8A8Triplanar420Unorm: + o << "TextureFormat::R8BG8A8Triplanar420Unorm"; + break; + default: + o << "TextureFormat::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, TextureSampleType value) { + switch (value) { + case TextureSampleType::Undefined: + o << "TextureSampleType::Undefined"; + break; + case TextureSampleType::Float: + o << "TextureSampleType::Float"; + break; + case TextureSampleType::UnfilterableFloat: + o << "TextureSampleType::UnfilterableFloat"; + break; + case TextureSampleType::Depth: + o << "TextureSampleType::Depth"; + break; + case TextureSampleType::Sint: + o << "TextureSampleType::Sint"; + break; + case TextureSampleType::Uint: + o << "TextureSampleType::Uint"; + break; + default: + o << "TextureSampleType::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, TextureViewDimension value) { + switch (value) { + case TextureViewDimension::Undefined: + o << "TextureViewDimension::Undefined"; + break; + case TextureViewDimension::e1D: + o << "TextureViewDimension::e1D"; + break; + case TextureViewDimension::e2D: + o << "TextureViewDimension::e2D"; + break; + case TextureViewDimension::e2DArray: + o << "TextureViewDimension::e2DArray"; + break; + case TextureViewDimension::Cube: + o << "TextureViewDimension::Cube"; + break; + case TextureViewDimension::CubeArray: + o << "TextureViewDimension::CubeArray"; + break; + case TextureViewDimension::e3D: + o << "TextureViewDimension::e3D"; + break; + default: + o << "TextureViewDimension::" << std::showbase << std::hex + << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, VertexFormat value) { + switch (value) { + case VertexFormat::Undefined: + o << "VertexFormat::Undefined"; + break; + case VertexFormat::Uint8x2: + o << "VertexFormat::Uint8x2"; + break; + case VertexFormat::Uint8x4: + o << "VertexFormat::Uint8x4"; + break; + case VertexFormat::Sint8x2: + o << "VertexFormat::Sint8x2"; + break; + case VertexFormat::Sint8x4: + o << "VertexFormat::Sint8x4"; + break; + case VertexFormat::Unorm8x2: + o << "VertexFormat::Unorm8x2"; + break; + case VertexFormat::Unorm8x4: + o << "VertexFormat::Unorm8x4"; + break; + case VertexFormat::Snorm8x2: + o << "VertexFormat::Snorm8x2"; + break; + case VertexFormat::Snorm8x4: + o << "VertexFormat::Snorm8x4"; + break; + case VertexFormat::Uint16x2: + o << "VertexFormat::Uint16x2"; + break; + case VertexFormat::Uint16x4: + o << "VertexFormat::Uint16x4"; + break; + case VertexFormat::Sint16x2: + o << "VertexFormat::Sint16x2"; + break; + case VertexFormat::Sint16x4: + o << "VertexFormat::Sint16x4"; + break; + case VertexFormat::Unorm16x2: + o << "VertexFormat::Unorm16x2"; + break; + case VertexFormat::Unorm16x4: + o << "VertexFormat::Unorm16x4"; + break; + case VertexFormat::Snorm16x2: + o << "VertexFormat::Snorm16x2"; + break; + case VertexFormat::Snorm16x4: + o << "VertexFormat::Snorm16x4"; + break; + case VertexFormat::Float16x2: + o << "VertexFormat::Float16x2"; + break; + case VertexFormat::Float16x4: + o << "VertexFormat::Float16x4"; + break; + case VertexFormat::Float32: + o << "VertexFormat::Float32"; + break; + case VertexFormat::Float32x2: + o << "VertexFormat::Float32x2"; + break; + case VertexFormat::Float32x3: + o << "VertexFormat::Float32x3"; + break; + case VertexFormat::Float32x4: + o << "VertexFormat::Float32x4"; + break; + case VertexFormat::Uint32: + o << "VertexFormat::Uint32"; + break; + case VertexFormat::Uint32x2: + o << "VertexFormat::Uint32x2"; + break; + case VertexFormat::Uint32x3: + o << "VertexFormat::Uint32x3"; + break; + case VertexFormat::Uint32x4: + o << "VertexFormat::Uint32x4"; + break; + case VertexFormat::Sint32: + o << "VertexFormat::Sint32"; + break; + case VertexFormat::Sint32x2: + o << "VertexFormat::Sint32x2"; + break; + case VertexFormat::Sint32x3: + o << "VertexFormat::Sint32x3"; + break; + case VertexFormat::Sint32x4: + o << "VertexFormat::Sint32x4"; + break; + case VertexFormat::Unorm10_10_10_2: + o << "VertexFormat::Unorm10_10_10_2"; + break; + default: + o << "VertexFormat::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, VertexStepMode value) { + switch (value) { + case VertexStepMode::Undefined: + o << "VertexStepMode::Undefined"; + break; + case VertexStepMode::VertexBufferNotUsed: + o << "VertexStepMode::VertexBufferNotUsed"; + break; + case VertexStepMode::Vertex: + o << "VertexStepMode::Vertex"; + break; + case VertexStepMode::Instance: + o << "VertexStepMode::Instance"; + break; + default: + o << "VertexStepMode::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>( + value); + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, WaitStatus value) { + switch (value) { + case WaitStatus::Success: + o << "WaitStatus::Success"; + break; + case WaitStatus::TimedOut: + o << "WaitStatus::TimedOut"; + break; + case WaitStatus::UnsupportedTimeout: + o << "WaitStatus::UnsupportedTimeout"; + break; + case WaitStatus::UnsupportedCount: + o << "WaitStatus::UnsupportedCount"; + break; + case WaitStatus::UnsupportedMixedSources: + o << "WaitStatus::UnsupportedMixedSources"; + break; + case WaitStatus::Unknown: + o << "WaitStatus::Unknown"; + break; + default: + o << "WaitStatus::" << std::showbase << std::hex << std::setfill('0') + << std::setw(4) + << static_cast::type>(value); + } + return o; +} - template - std::basic_ostream& operator<<(std::basic_ostream& o, BufferUsage value) { - o << "BufferUsage::"; - if (!static_cast(value)) { +template +std::basic_ostream & +operator<<(std::basic_ostream &o, BufferUsage value) { + o << "BufferUsage::"; + if (!static_cast(value)) { // 0 is often explicitly declared as None. o << "None"; - return o; - } + return o; + } - bool moreThanOneBit = !HasZeroOrOneBits(value); - if (moreThanOneBit) { - o << "("; - } + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } - bool first = true; + bool first = true; if (value & BufferUsage::MapRead) { if (!first) { o << "|"; @@ -1967,33 +2148,35 @@ namespace wgpu { value &= ~BufferUsage::QueryResolve; } - if (static_cast(value)) { - if (!first) { - o << "|"; - } - o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - - if (moreThanOneBit) { - o << ")"; + if (static_cast(value)) { + if (!first) { + o << "|"; } - return o; + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) + << static_cast::type>(value); } - template - std::basic_ostream& operator<<(std::basic_ostream& o, ColorWriteMask value) { - o << "ColorWriteMask::"; - if (!static_cast(value)) { + + if (moreThanOneBit) { + o << ")"; + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, ColorWriteMask value) { + o << "ColorWriteMask::"; + if (!static_cast(value)) { // 0 is often explicitly declared as None. o << "None"; - return o; - } + return o; + } - bool moreThanOneBit = !HasZeroOrOneBits(value); - if (moreThanOneBit) { - o << "("; - } + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } - bool first = true; + bool first = true; if (value & ColorWriteMask::Red) { if (!first) { o << "|"; @@ -2035,33 +2218,36 @@ namespace wgpu { value &= ~ColorWriteMask::All; } - if (static_cast(value)) { - if (!first) { - o << "|"; - } - o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - - if (moreThanOneBit) { - o << ")"; + if (static_cast(value)) { + if (!first) { + o << "|"; } - return o; + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) + << static_cast::type>( + value); } - template - std::basic_ostream& operator<<(std::basic_ostream& o, HeapProperty value) { - o << "HeapProperty::"; - if (!static_cast(value)) { + + if (moreThanOneBit) { + o << ")"; + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, HeapProperty value) { + o << "HeapProperty::"; + if (!static_cast(value)) { // 0 is often explicitly declared as None. o << "Undefined"; - return o; - } + return o; + } - bool moreThanOneBit = !HasZeroOrOneBits(value); - if (moreThanOneBit) { - o << "("; - } + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } - bool first = true; + bool first = true; if (value & HeapProperty::DeviceLocal) { if (!first) { o << "|"; @@ -2103,33 +2289,35 @@ namespace wgpu { value &= ~HeapProperty::HostCached; } - if (static_cast(value)) { - if (!first) { - o << "|"; - } - o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - - if (moreThanOneBit) { - o << ")"; + if (static_cast(value)) { + if (!first) { + o << "|"; } - return o; + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) + << static_cast::type>(value); } - template - std::basic_ostream& operator<<(std::basic_ostream& o, MapMode value) { - o << "MapMode::"; - if (!static_cast(value)) { + + if (moreThanOneBit) { + o << ")"; + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, MapMode value) { + o << "MapMode::"; + if (!static_cast(value)) { // 0 is often explicitly declared as None. o << "None"; - return o; - } + return o; + } - bool moreThanOneBit = !HasZeroOrOneBits(value); - if (moreThanOneBit) { - o << "("; - } + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } - bool first = true; + bool first = true; if (value & MapMode::Read) { if (!first) { o << "|"; @@ -2147,33 +2335,35 @@ namespace wgpu { value &= ~MapMode::Write; } - if (static_cast(value)) { - if (!first) { - o << "|"; - } - o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - - if (moreThanOneBit) { - o << ")"; + if (static_cast(value)) { + if (!first) { + o << "|"; } - return o; + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) + << static_cast::type>(value); } - template - std::basic_ostream& operator<<(std::basic_ostream& o, ShaderStage value) { - o << "ShaderStage::"; - if (!static_cast(value)) { + + if (moreThanOneBit) { + o << ")"; + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, ShaderStage value) { + o << "ShaderStage::"; + if (!static_cast(value)) { // 0 is often explicitly declared as None. o << "None"; - return o; - } + return o; + } - bool moreThanOneBit = !HasZeroOrOneBits(value); - if (moreThanOneBit) { - o << "("; - } + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } - bool first = true; + bool first = true; if (value & ShaderStage::Vertex) { if (!first) { o << "|"; @@ -2199,33 +2389,35 @@ namespace wgpu { value &= ~ShaderStage::Compute; } - if (static_cast(value)) { - if (!first) { - o << "|"; - } - o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); - } - - if (moreThanOneBit) { - o << ")"; + if (static_cast(value)) { + if (!first) { + o << "|"; } - return o; + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) + << static_cast::type>(value); } - template - std::basic_ostream& operator<<(std::basic_ostream& o, TextureUsage value) { - o << "TextureUsage::"; - if (!static_cast(value)) { + + if (moreThanOneBit) { + o << ")"; + } + return o; +} +template +std::basic_ostream & +operator<<(std::basic_ostream &o, TextureUsage value) { + o << "TextureUsage::"; + if (!static_cast(value)) { // 0 is often explicitly declared as None. o << "None"; - return o; - } + return o; + } - bool moreThanOneBit = !HasZeroOrOneBits(value); - if (moreThanOneBit) { - o << "("; - } + bool moreThanOneBit = !HasZeroOrOneBits(value); + if (moreThanOneBit) { + o << "("; + } - bool first = true; + bool first = true; if (value & TextureUsage::CopySrc) { if (!first) { o << "|"; @@ -2283,19 +2475,20 @@ namespace wgpu { value &= ~TextureUsage::StorageAttachment; } - if (static_cast(value)) { - if (!first) { - o << "|"; - } - o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast::type>(value); + if (static_cast(value)) { + if (!first) { + o << "|"; } + o << std::showbase << std::hex << std::setfill('0') << std::setw(4) + << static_cast::type>(value); + } - if (moreThanOneBit) { - o << ")"; - } - return o; + if (moreThanOneBit) { + o << ")"; } + return o; +} -} // namespace wgpu +} // namespace wgpu #endif // WEBGPU_CPP_PRINT_H_ diff --git a/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h b/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h index e98c8c5da0..8490375c7d 100644 --- a/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h +++ b/package/android/cpp/rnskia-android/webgpu/webgpu_enum_class_bitmasks.h @@ -3,7 +3,8 @@ // 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 +// 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, @@ -16,146 +17,144 @@ // // 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. +// 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_ENUM_CLASS_BITMASKS_H_ #define WEBGPU_ENUM_CLASS_BITMASKS_H_ #include -// The operators in wgpu:: namespace need be introduced into other namespaces with -// using-declarations for C++ Argument Dependent Lookup to work. -#define WGPU_IMPORT_BITMASK_OPERATORS \ - using wgpu::operator|; \ - using wgpu::operator&; \ - using wgpu::operator^; \ - using wgpu::operator~; \ - using wgpu::operator&=; \ - using wgpu::operator|=; \ - using wgpu::operator^=; \ - using wgpu::HasZeroOrOneBits; +// The operators in wgpu:: namespace need be introduced into other namespaces +// with using-declarations for C++ Argument Dependent Lookup to work. +#define WGPU_IMPORT_BITMASK_OPERATORS \ + using wgpu::operator|; \ + using wgpu::operator&; \ + using wgpu::operator^; \ + using wgpu::operator~; \ + using wgpu::operator&=; \ + using wgpu::operator|=; \ + using wgpu::operator^=; \ + using wgpu::HasZeroOrOneBits; namespace wgpu { -template -struct IsWGPUBitmask { - static constexpr bool enable = false; +template struct IsWGPUBitmask { + static constexpr bool enable = false; }; -template -struct LowerBitmask { - static constexpr bool enable = false; +template struct LowerBitmask { + static constexpr bool enable = false; }; template -struct LowerBitmask::enable>::type> { - static constexpr bool enable = true; - using type = T; - constexpr static T Lower(T t) { return t; } +struct LowerBitmask::enable>::type> { + static constexpr bool enable = true; + using type = T; + constexpr static T Lower(T t) { return t; } }; -template -struct BoolConvertible { - using Integral = typename std::underlying_type::type; +template struct BoolConvertible { + using Integral = typename std::underlying_type::type; - // NOLINTNEXTLINE(runtime/explicit) - explicit constexpr BoolConvertible(Integral value) : value(value) {} - constexpr operator bool() const { return value != 0; } - constexpr operator T() const { return static_cast(value); } + // NOLINTNEXTLINE(runtime/explicit) + explicit constexpr BoolConvertible(Integral value) : value(value) {} + constexpr operator bool() const { return value != 0; } + constexpr operator T() const { return static_cast(value); } - Integral value; + Integral value; }; -template -struct LowerBitmask> { - static constexpr bool enable = true; - using type = T; - static constexpr type Lower(BoolConvertible t) { return t; } +template struct LowerBitmask> { + static constexpr bool enable = true; + using type = T; + static constexpr type Lower(BoolConvertible t) { return t; } }; -template < - typename T1, - typename T2, - typename = typename std::enable_if::enable && LowerBitmask::enable>::type> -constexpr BoolConvertible::type> operator|(T1 left, T2 right) { - using T = typename LowerBitmask::type; - using Integral = typename std::underlying_type::type; - return BoolConvertible(static_cast(LowerBitmask::Lower(left)) | - static_cast(LowerBitmask::Lower(right))); +template ::enable && + LowerBitmask::enable>::type> +constexpr BoolConvertible::type> operator|(T1 left, + T2 right) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible( + static_cast(LowerBitmask::Lower(left)) | + static_cast(LowerBitmask::Lower(right))); } -template < - typename T1, - typename T2, - typename = typename std::enable_if::enable && LowerBitmask::enable>::type> -constexpr BoolConvertible::type> operator&(T1 left, T2 right) { - using T = typename LowerBitmask::type; - using Integral = typename std::underlying_type::type; - return BoolConvertible(static_cast(LowerBitmask::Lower(left)) & - static_cast(LowerBitmask::Lower(right))); +template ::enable && + LowerBitmask::enable>::type> +constexpr BoolConvertible::type> operator&(T1 left, + T2 right) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible( + static_cast(LowerBitmask::Lower(left)) & + static_cast(LowerBitmask::Lower(right))); } -template < - typename T1, - typename T2, - typename = typename std::enable_if::enable && LowerBitmask::enable>::type> -constexpr BoolConvertible::type> operator^(T1 left, T2 right) { - using T = typename LowerBitmask::type; - using Integral = typename std::underlying_type::type; - return BoolConvertible(static_cast(LowerBitmask::Lower(left)) ^ - static_cast(LowerBitmask::Lower(right))); +template ::enable && + LowerBitmask::enable>::type> +constexpr BoolConvertible::type> operator^(T1 left, + T2 right) { + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible( + static_cast(LowerBitmask::Lower(left)) ^ + static_cast(LowerBitmask::Lower(right))); } template constexpr BoolConvertible::type> operator~(T1 t) { - using T = typename LowerBitmask::type; - using Integral = typename std::underlying_type::type; - return BoolConvertible(~static_cast(LowerBitmask::Lower(t))); + using T = typename LowerBitmask::type; + using Integral = typename std::underlying_type::type; + return BoolConvertible(~static_cast(LowerBitmask::Lower(t))); } -template < - typename T, - typename T2, - typename = typename std::enable_if::enable && LowerBitmask::enable>::type> -constexpr T& operator&=(T& l, T2 right) { - T r = LowerBitmask::Lower(right); - l = l & r; - return l; +template ::enable && + LowerBitmask::enable>::type> +constexpr T &operator&=(T &l, T2 right) { + T r = LowerBitmask::Lower(right); + l = l & r; + return l; } -template < - typename T, - typename T2, - typename = typename std::enable_if::enable && LowerBitmask::enable>::type> -constexpr T& operator|=(T& l, T2 right) { - T r = LowerBitmask::Lower(right); - l = l | r; - return l; +template ::enable && + LowerBitmask::enable>::type> +constexpr T &operator|=(T &l, T2 right) { + T r = LowerBitmask::Lower(right); + l = l | r; + return l; } -template < - typename T, - typename T2, - typename = typename std::enable_if::enable && LowerBitmask::enable>::type> -constexpr T& operator^=(T& l, T2 right) { - T r = LowerBitmask::Lower(right); - l = l ^ r; - return l; +template ::enable && + LowerBitmask::enable>::type> +constexpr T &operator^=(T &l, T2 right) { + T r = LowerBitmask::Lower(right); + l = l ^ r; + return l; } -template -constexpr bool HasZeroOrOneBits(T value) { - using Integral = typename std::underlying_type::type; - return (static_cast(value) & (static_cast(value) - 1)) == 0; +template constexpr bool HasZeroOrOneBits(T value) { + using Integral = typename std::underlying_type::type; + return (static_cast(value) & (static_cast(value) - 1)) == + 0; } -} // namespace wgpu +} // namespace wgpu -#endif // WEBGPU_ENUM_CLASS_BITMASKS_H_ +#endif // WEBGPU_ENUM_CLASS_BITMASKS_H_ diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index dffca0c3ce..986321864b 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -30,6 +30,26 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { return jsi::Value::undefined(); } + JSI_HOST_FUNCTION(mapAsync) { + auto mode = static_cast(arguments[0].getNumber()); + auto offset = static_cast(arguments[1].getNumber()); + auto size = static_cast(arguments[2].getNumber()); + auto object = getObject(); + return RNJsi::JsiPromises::createPromiseAsJSIValue( + runtime, [object = std::move(object), mode, offset, + size](jsi::Runtime &runtime, + std::shared_ptr promise) { + object->MapAsync( + mode, offset, size, + [](WGPUBufferMapAsyncStatus status, void *userdata) { + auto promise = + static_cast(userdata); + promise->resolve(jsi::Value::undefined()); + }, + promise.get()); + }); + } + JSI_HOST_FUNCTION(getMappedRange) { size_t offset = static_cast(arguments[0].getNumber()); @@ -49,6 +69,7 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { EXPORT_JSI_API_BRANDNAME(JsiBuffer, Buffer) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiBuffer, unmap), + JSI_EXPORT_FUNC(JsiBuffer, mapAsync), JSI_EXPORT_FUNC(JsiBuffer, getMappedRange)) /** diff --git a/package/cpp/wgpu/JsiGPU.h b/package/cpp/wgpu/JsiGPU.h index 4816bd702b..046f2668bb 100644 --- a/package/cpp/wgpu/JsiGPU.h +++ b/package/cpp/wgpu/JsiGPU.h @@ -26,10 +26,6 @@ class JsiGPU : public JsiSkWrappingSharedPtrHostObject { : JsiSkWrappingSharedPtrHostObject( context, std::make_shared(std::move(m))) {} - JSI_HOST_FUNCTION(getPreferredCanvasFormat) { - return jsi::String::createFromUtf8(runtime, "rgba8unorm"); - } - JSI_HOST_FUNCTION(requestAdapter) { auto defaultOptions = new wgpu::RequestAdapterOptions(); auto options = @@ -46,8 +42,8 @@ class JsiGPU : public JsiSkWrappingSharedPtrHostObject { wgpu::Adapter adapter = nullptr; object->RequestAdapter( nullptr, - [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, const char *message, - void *userdata) { + [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, + const char *message, void *userdata) { if (message != nullptr) { fprintf(stderr, "%s", message); return; @@ -66,6 +62,10 @@ class JsiGPU : public JsiSkWrappingSharedPtrHostObject { }); } + JSI_HOST_FUNCTION(getPreferredCanvasFormat) { + return jsi::String::createFromUtf8(runtime, "rgba8unorm"); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiGPU, GPU) diff --git a/package/cpp/wgpu/JsiWGPUContext.h b/package/cpp/wgpu/JsiWGPUContext.h index 199ac8b8b5..69fde17d49 100644 --- a/package/cpp/wgpu/JsiWGPUContext.h +++ b/package/cpp/wgpu/JsiWGPUContext.h @@ -38,7 +38,8 @@ class JsiWGPUContext : public JsiSkWrappingSharedPtrHostObject { swapChainDesc.width = _width; swapChainDesc.height = _height; swapChainDesc.usage = wgpu::TextureUsage::RenderAttachment; - swapChainDesc.format = wgpu::TextureFormat::RGBA8Unorm; //surface.GetPreferredFormat(adapter); + swapChainDesc.format = + wgpu::TextureFormat::RGBA8Unorm; // surface.GetPreferredFormat(adapter); swapChainDesc.presentMode = wgpu::PresentMode::Fifo; _surface = std::make_shared(surface); _swapChain = std::make_shared( diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index 5d5092dff0..ade249cc92 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -179,7 +179,7 @@ export const generateObject = (object: JSIObject) => { #include #include -#include "webgpu/webgpu_cpp.h" +#include "dawn/webgpu_cpp.h" #include diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 8a5151adc1..092c98c775 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -116,7 +116,7 @@ export const model: JSIObject[] = [ jsi::Runtime &runtime, std::shared_ptr promise) -> void { wgpu::Device device = nullptr; - adapter->RequestDevice( + object->RequestDevice( nullptr, [](WGPURequestDeviceStatus, WGPUDevice cDevice, const char *message, void *userdata) { @@ -242,6 +242,31 @@ export const model: JSIObject[] = [ name: "Buffer", methods: [ { name: "unmap", args: [] }, + { + name: "mapAsync", + args: [ + { + name: "mode", + type: "uint32_t", + } + ], + implementation: `auto mode = static_cast(arguments[0].getNumber()); + auto offset = static_cast(arguments[1].getNumber()); + auto size = static_cast(arguments[2].getNumber()); + auto object = getObject(); + return RNJsi::JsiPromises::createPromiseAsJSIValue( + runtime, + [object = std::move(object), mode, offset, size](jsi::Runtime &runtime, + std::shared_ptr promise) { + object->MapAsync( + mode, offset, size, + [](WGPUBufferMapAsyncStatus status, void *userdata) { + auto promise = static_cast(userdata); + promise->resolve(jsi::Value::undefined()); + }, + promise.get()); + });` + }, { name: "getMappedRange", args: [ From cf70d7bdaec4b7715e21871eefe51602bfebda41 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 19:22:28 +0200 Subject: [PATCH 08/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 39 +++++++++++++++++++--- package/cpp/wgpu/JsiBuffer.h | 3 ++ package/cpp/wgpu/JsiCommandEncoder.h | 16 ++++++++- scripts/generator/model.ts | 12 ++++++- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 0957583121..3f7bd78362 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -17,15 +17,21 @@ const {width, height} = Dimensions.get("window"); async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { const readBuffer = device.createBuffer({ size: byteLength, - usage: 9//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + mappedAtCreation: false }); + if (!readBuffer) { + console.error("Failed to create vertex buffer"); + } const commandEncoder = device.createCommandEncoder(); commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); const gpuCommands = commandEncoder.finish(); device.queue.submit([gpuCommands]); - + console.log("Start reading buffer"); await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ + console.log("End reading buffer"); + const copyArrayBuffer = readBuffer.getMappedRange(); console.log(new Float32Array(copyArrayBuffer)); // For float buffers, adjust as needed readBuffer.unmap(); @@ -40,7 +46,7 @@ context.configure({ format: presentationFormat, alphaMode: 'premultiplied', }); -console.log(cubeVertexArray.byteLength); + // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ size: cubeVertexArray.byteLength, @@ -48,8 +54,24 @@ const verticesBuffer = device.createBuffer({ mappedAtCreation: true, }); +if (!verticesBuffer) { + console.error("Failed to create vertex buffer"); +} + const mappedRange = verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength); new Float32Array(mappedRange).set(cubeVertexArray); +const arrayBuffer = verticesBuffer.getMappedRange(); + +const floatArray = new Float32Array(arrayBuffer); +console.log({floatArray}); // This will log the current state of the buffer to the console + +floatArray.set(cubeVertexArray); + +// Reading the contents back for verification +console.log({floatArray}); // This will log the current state of the buffer to the console +console.log("==="); + + verticesBuffer.unmap(); const pipeline = device.createRenderPipeline({ @@ -122,6 +144,11 @@ const uniformBuffer = device.createBuffer({ mappedAtCreation: false }); +if (!uniformBuffer) { + console.error("Failed to create uniform buffer"); + +} + const uniformBindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ @@ -132,6 +159,10 @@ const uniformBindGroup = device.createBindGroup({ ], }); +if (!uniformBindGroup) { + console.error("Failed to create uniform bind group"); +} + const renderPassDescriptor: GPURenderPassDescriptor = { @@ -194,7 +225,7 @@ function frame() { passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); + //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); console.log("RENDER"); context.present(); diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index 986321864b..eb5cbc44a4 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -44,6 +44,9 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { [](WGPUBufferMapAsyncStatus status, void *userdata) { auto promise = static_cast(userdata); + RNSkLogger::logToConsole( + "Buffer::MapAsync callback status: " + + std::to_string(static_cast(status))); promise->resolve(jsi::Value::undefined()); }, promise.get()); diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index 53ad3ac43b..d61a25216c 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -7,6 +7,7 @@ #include +#include "JsiBuffer.h" #include "JsiCommandBuffer.h" #include "JsiEnums.h" #include "JsiHostObject.h" @@ -44,11 +45,24 @@ class JsiCommandEncoder runtime, std::make_shared(getContext(), ret)); } + JSI_HOST_FUNCTION(copyBufferToBuffer) { + auto source = JsiBuffer::fromValue(runtime, arguments[0]); + auto sourceOffset = static_cast(arguments[1].getNumber()); + auto destination = JsiBuffer::fromValue(runtime, arguments[2]); + auto destinationOffset = static_cast(arguments[3].getNumber()); + auto size = static_cast(arguments[4].getNumber()); + + getObject()->CopyBufferToBuffer(*source, sourceOffset, *destination, + destinationOffset, size); + return jsi::Value::undefined(); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiCommandEncoder, CommandEncoder) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiCommandEncoder, beginRenderPass), - JSI_EXPORT_FUNC(JsiCommandEncoder, finish)) + JSI_EXPORT_FUNC(JsiCommandEncoder, finish), + JSI_EXPORT_FUNC(JsiCommandEncoder, copyBufferToBuffer)) /** * Returns the underlying object from a host object of this type diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 092c98c775..9acca38d36 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -293,7 +293,17 @@ export const model: JSIObject[] = [ name: "CommandEncoder", methods: [ { name: "beginRenderPass", args: [{ name: "descriptor", type: "RenderPassDescriptor" }], returns: "RenderPassEncoder" }, - { name: "finish", args: [], returns: "CommandBuffer" } + { name: "finish", args: [], returns: "CommandBuffer" }, + { + name: "copyBufferToBuffer", + args: [ + { name: "source", type: "Buffer" }, + { name: "sourceOffset", type: "uint32_t" }, + { name: "destination", type: "Buffer" }, + { name: "destinationOffset", type: "uint32_t" }, + { name: "size", type: "uint32_t" } + ], + } ] }, { From 20b75acb41620f62e2f156c662a5b51ef8634dca Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 21:46:13 +0200 Subject: [PATCH 09/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 3f7bd78362..567d6781f6 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -59,17 +59,9 @@ if (!verticesBuffer) { } const mappedRange = verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength); -new Float32Array(mappedRange).set(cubeVertexArray); -const arrayBuffer = verticesBuffer.getMappedRange(); - -const floatArray = new Float32Array(arrayBuffer); -console.log({floatArray}); // This will log the current state of the buffer to the console - -floatArray.set(cubeVertexArray); - -// Reading the contents back for verification -console.log({floatArray}); // This will log the current state of the buffer to the console -console.log("==="); +const result = new Float32Array(mappedRange); +result.set(cubeVertexArray); +console.log(result); verticesBuffer.unmap(); @@ -228,7 +220,7 @@ function frame() { //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); console.log("RENDER"); - context.present(); + //context.present(); // requestAnimationFrame(frame); } frame(); From 21a33bea1a049d170ce4d219bd63a1ad6bed4158 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 1 May 2024 22:06:19 +0200 Subject: [PATCH 10/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 567d6781f6..50eb003dba 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -15,26 +15,28 @@ import { Dimensions } from 'react-native'; const {width, height} = Dimensions.get("window"); async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { - const readBuffer = device.createBuffer({ - size: byteLength, - usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, - mappedAtCreation: false - }); - if (!readBuffer) { - console.error("Failed to create vertex buffer"); - } - - const commandEncoder = device.createCommandEncoder(); - commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); - const gpuCommands = commandEncoder.finish(); - device.queue.submit([gpuCommands]); - console.log("Start reading buffer"); - await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ - console.log("End reading buffer"); - - const copyArrayBuffer = readBuffer.getMappedRange(); - console.log(new Float32Array(copyArrayBuffer)); // For float buffers, adjust as needed - readBuffer.unmap(); + // const readBuffer = device.createBuffer({ + // size: byteLength, + // usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + // mappedAtCreation: false + // }); + // if (!readBuffer) { + // console.error("Failed to create vertex buffer"); + // } + + // const commandEncoder = device.createCommandEncoder(); + // commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); + // const gpuCommands = commandEncoder.finish(); + // device.queue.submit([gpuCommands]); + // console.log("Start reading buffer"); + //const b = buffer.getMappedRange(0, byteLength); + // console.log(new Float32Array(b)); + // //await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ + // console.log("End reading buffer"); + + // //const copyArrayBuffer = readBuffer.getMappedRange(); + // console.log(new Float32Array(copyArrayBuffer)); // For float buffers, adjust as needed + //buffer.unmap(); } export const demo1 = async (context: GPUCanvasContext) => { @@ -57,15 +59,13 @@ const verticesBuffer = device.createBuffer({ if (!verticesBuffer) { console.error("Failed to create vertex buffer"); } - const mappedRange = verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength); + const result = new Float32Array(mappedRange); result.set(cubeVertexArray); -console.log(result); - verticesBuffer.unmap(); - +await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); const pipeline = device.createRenderPipeline({ layout: 'auto', vertex: { From 1cc0db8ef45d49cd95354c443755aa11238b45e8 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 11:38:55 +0200 Subject: [PATCH 11/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 17 +- example/src/Examples/Breathe/demo1/main.ts | 370 +++++++++--------- example/src/Examples/Breathe/demo3.tsx | 40 ++ .../RNSkAndroidPlatformContext.h | 7 +- .../cpp/rnskia-android/RNSkAndroidView.h | 2 +- .../cpp/rnskia-android/WebGPUTriangle.cpp | 14 +- package/cpp/rnskia/RNSkPlatformContext.h | 1 + package/cpp/wgpu/JsiBuffer.h | 1 + package/cpp/wgpu/JsiQueue.h | 23 +- scripts/generator/model.ts | 14 +- 10 files changed, 287 insertions(+), 202 deletions(-) create mode 100644 example/src/Examples/Breathe/demo3.tsx diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 7b3da29368..f112660ebb 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -3,11 +3,19 @@ import { gpu, SkiaDomView, } from "@shopify/react-native-skia"; -import { demo1 } from "./demo1/main"; +import { demo3 } from "./demo3"; -const draw = async (ctx: GPUCanvasContext) => { - await demo1(ctx); - ctx.present(); +const draw = async (context: GPUCanvasContext) => { + const adapter = await gpu.requestAdapter(); + const device = await adapter!.requestDevice(); + const presentationFormat = 'rgba8unorm'; + context.configure({ + device, + format: presentationFormat, + alphaMode: 'premultiplied', + }); + await demo3(context); + context.present(); }; export const Breathe = () => { @@ -15,6 +23,7 @@ export const Breathe = () => { useEffect(() => { setTimeout(() => { const ctx = ref.current!.getWGPUContext(); + draw(ctx); }, 1000); }, []); diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 50eb003dba..92f0f4bd79 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -15,39 +15,31 @@ import { Dimensions } from 'react-native'; const {width, height} = Dimensions.get("window"); async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { - // const readBuffer = device.createBuffer({ - // size: byteLength, - // usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, - // mappedAtCreation: false - // }); - // if (!readBuffer) { - // console.error("Failed to create vertex buffer"); - // } - - // const commandEncoder = device.createCommandEncoder(); - // commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); - // const gpuCommands = commandEncoder.finish(); - // device.queue.submit([gpuCommands]); - // console.log("Start reading buffer"); - //const b = buffer.getMappedRange(0, byteLength); - // console.log(new Float32Array(b)); - // //await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ - // console.log("End reading buffer"); - - // //const copyArrayBuffer = readBuffer.getMappedRange(); - // console.log(new Float32Array(copyArrayBuffer)); // For float buffers, adjust as needed - //buffer.unmap(); + const readBuffer = device.createBuffer({ + size: byteLength, + usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + mappedAtCreation: false + }); + if (!readBuffer) { + console.error("Failed to create vertex buffer"); + } + + const commandEncoder = device.createCommandEncoder(); + commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); + const gpuCommands = commandEncoder.finish(); + device.queue.submit([gpuCommands]); + console.log("Start reading buffer"); + const b = readBuffer.getMappedRange(0, byteLength); + console.log(new Float32Array(b)); + //await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ + console.log("End reading buffer"); + + //const copyArrayBuffer = readBuffer.getMappedRange(); + readBuffer.unmap(); } -export const demo1 = async (context: GPUCanvasContext) => { - const adapter = await gpu.requestAdapter(); - const device = await adapter!.requestDevice(); - const presentationFormat = 'rgba8unorm'; -context.configure({ - device, - format: presentationFormat, - alphaMode: 'premultiplied', -}); +export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { + // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ @@ -66,163 +58,163 @@ result.set(cubeVertexArray); verticesBuffer.unmap(); await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); -const pipeline = device.createRenderPipeline({ - layout: 'auto', - vertex: { - module: device.createShaderModule({ - code: basicVertWGSL, - }), - entryPoint: "main", - buffers: [ - { - arrayStride: cubeVertexSize, - attributes: [ - { - // position - shaderLocation: 0, - offset: cubePositionOffset, - format: 'float32x4', - }, - { - // uv - shaderLocation: 1, - offset: cubeUVOffset, - format: 'float32x2', - }, - ], - }, - ], - }, - fragment: { - module: device.createShaderModule({ - code: vertexPositionColorWGSL, - }), - entryPoint: "main", - targets: [ - { - format: presentationFormat, - }, - ], - }, - primitive: { - topology: 'triangle-list', - - // Backface culling since the cube is solid piece of geometry. - // Faces pointing away from the camera will be occluded by faces - // pointing toward the camera. - cullMode: 'back', - }, - - // Enable depth testing so that the fragment closest to the camera - // is rendered in front. - depthStencil: { - depthWriteEnabled: true, - depthCompare: 'less', - format: 'depth24plus', - }, -}); - -const depthTexture = device.createTexture({ - size: { width, height }, - format: 'depth24plus', - usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, -}); - - -const uniformBufferSize = 4 * 16; // 4x4 matrix -const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: 72,// GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - mappedAtCreation: false -}); - -if (!uniformBuffer) { - console.error("Failed to create uniform buffer"); - -} - -const uniformBindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - buffer: uniformBuffer, - }, - ], -}); - -if (!uniformBindGroup) { - console.error("Failed to create uniform bind group"); -} - - - -const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: undefined, - - clearValue: [0.5, 0.5, 0.5, 1.0], - loadOp: 'clear', - storeOp: 'store', - }, - ], - depthStencilAttachment: { - view: depthTexture.createView(), - - depthClearValue: 1.0, - depthLoadOp: 'clear', - depthStoreOp: 'store', - }, -}; - -const aspect = width / height; -const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); -const modelViewProjectionMatrix = mat4.create(); - -function getTransformationMatrix() { - const viewMatrix = mat4.identity(); - mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); - const now = Date.now() / 1000; - mat4.rotate( - viewMatrix, - vec3.fromValues(Math.sin(now), Math.cos(now), 0), - 1, - viewMatrix - ); - - mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); - return modelViewProjectionMatrix as Float32Array; -} - -function frame() { - const transformationMatrix = getTransformationMatrix(); - device.queue.writeBuffer( - uniformBuffer, - 0, - transformationMatrix.buffer, - transformationMatrix.byteOffset, - transformationMatrix.byteLength - ); - renderPassDescriptor.colorAttachments[0].view = context - .getCurrentTexture() - .createView(); - - const commandEncoder = device.createCommandEncoder(); - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(pipeline); - passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, verticesBuffer); - passEncoder.draw(cubeVertexCount); - passEncoder.end(); - device.queue.submit([commandEncoder.finish()]); - - //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); - - console.log("RENDER"); - //context.present(); - // requestAnimationFrame(frame); -} -frame(); +// const pipeline = device.createRenderPipeline({ +// layout: 'auto', +// vertex: { +// module: device.createShaderModule({ +// code: basicVertWGSL, +// }), +// entryPoint: "main", +// buffers: [ +// { +// arrayStride: cubeVertexSize, +// attributes: [ +// { +// // position +// shaderLocation: 0, +// offset: cubePositionOffset, +// format: 'float32x4', +// }, +// { +// // uv +// shaderLocation: 1, +// offset: cubeUVOffset, +// format: 'float32x2', +// }, +// ], +// }, +// ], +// }, +// fragment: { +// module: device.createShaderModule({ +// code: vertexPositionColorWGSL, +// }), +// entryPoint: "main", +// targets: [ +// { +// format: presentationFormat, +// }, +// ], +// }, +// primitive: { +// topology: 'triangle-list', + +// // Backface culling since the cube is solid piece of geometry. +// // Faces pointing away from the camera will be occluded by faces +// // pointing toward the camera. +// cullMode: 'back', +// }, + +// // Enable depth testing so that the fragment closest to the camera +// // is rendered in front. +// depthStencil: { +// depthWriteEnabled: true, +// depthCompare: 'less', +// format: 'depth24plus', +// }, +// }); + +// const depthTexture = device.createTexture({ +// size: { width, height }, +// format: 'depth24plus', +// usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, +// }); + + +// const uniformBufferSize = 4 * 16; // 4x4 matrix +// const uniformBuffer = device.createBuffer({ +// size: uniformBufferSize, +// usage: 72,// GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, +// mappedAtCreation: false +// }); + +// if (!uniformBuffer) { +// console.error("Failed to create uniform buffer"); + +// } + +// const uniformBindGroup = device.createBindGroup({ +// layout: pipeline.getBindGroupLayout(0), +// entries: [ +// { +// binding: 0, +// buffer: uniformBuffer, +// }, +// ], +// }); + +// if (!uniformBindGroup) { +// console.error("Failed to create uniform bind group"); +// } + + + +// const renderPassDescriptor: GPURenderPassDescriptor = { +// colorAttachments: [ +// { +// view: undefined, + +// clearValue: [0.5, 0.5, 0.5, 1.0], +// loadOp: 'clear', +// storeOp: 'store', +// }, +// ], +// depthStencilAttachment: { +// view: depthTexture.createView(), + +// depthClearValue: 1.0, +// depthLoadOp: 'clear', +// depthStoreOp: 'store', +// }, +// }; + +// const aspect = width / height; +// const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); +// const modelViewProjectionMatrix = mat4.create(); + +// function getTransformationMatrix() { +// const viewMatrix = mat4.identity(); +// mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); +// const now = Date.now() / 1000; +// mat4.rotate( +// viewMatrix, +// vec3.fromValues(Math.sin(now), Math.cos(now), 0), +// 1, +// viewMatrix +// ); + +// mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); +// return modelViewProjectionMatrix as Float32Array; +// } + +// function frame() { +// const transformationMatrix = getTransformationMatrix(); +// device.queue.writeBuffer( +// uniformBuffer, +// 0, +// transformationMatrix.buffer, +// transformationMatrix.byteOffset, +// transformationMatrix.byteLength +// ); +// renderPassDescriptor.colorAttachments[0].view = context +// .getCurrentTexture() +// .createView(); + +// const commandEncoder = device.createCommandEncoder(); +// const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); +// passEncoder.setPipeline(pipeline); +// passEncoder.setBindGroup(0, uniformBindGroup); +// passEncoder.setVertexBuffer(0, verticesBuffer); +// passEncoder.draw(cubeVertexCount); +// passEncoder.end(); +// device.queue.submit([commandEncoder.finish()]); + +// //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); + +// console.log("RENDER"); +// //context.present(); +// // requestAnimationFrame(frame); +// } +// frame(); }; \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx new file mode 100644 index 0000000000..f2742d5299 --- /dev/null +++ b/example/src/Examples/Breathe/demo3.tsx @@ -0,0 +1,40 @@ +import { gpu } from "@shopify/react-native-skia"; + + +const check = () => { + //console.log("check"); + requestAnimationFrame(check); +} + +export const demo3 = async(context: GPUCanvasContext) => { + const adapter = await gpu.requestAdapter(); + const device = await adapter!.requestDevice(); + // Create an array of data + const data = new Float32Array([1.0, 2.0, 3.0, 4.0]); + + // Create a GPU buffer and store data + const gpuBuffer = device.createBuffer({ + size: data.byteLength, + usage: 9//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + , + mappedAtCreation: false + }); + + // Copy data to the GPU buffer + device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); + console.log("DONE0"); + device.queue.onSubmittedWorkDone(); + check(); + // Read data back from the GPU buffer + console.log("DONE1"); + // gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ + // device.queue.onSubmittedWorkDone(); + // console.log("DONE2"); + + // const arrayBuffer = gpuBuffer.getMappedRange(); + // const readData = new Float32Array(arrayBuffer); + + // // Output the read data + // console.log('Data read from the buffer:', readData); + // gpuBuffer.unmap(); + }; \ No newline at end of file diff --git a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h index 1929208657..c579562cf7 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h @@ -73,13 +73,15 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { wgpu::SurfaceDescriptor surfaceDesc = {}; surfaceDesc.nextInChain = &androidSurfaceDesc; - auto instance = wgpu::CreateInstance(nullptr); - auto surface = instance.CreateSurface(&surfaceDesc); + _instance = wgpu::CreateInstance(nullptr); + auto surface = _instance.CreateSurface(&surfaceDesc); _descriptors[nativeId] = std::make_tuple( std::make_shared(surface), width, height); } + wgpu::Instance getInstance() { return _instance; } + virtual std::tuple, int, int> getSurfaceDescriptor(int nativeId) override { auto it = _descriptors.find(nativeId); @@ -94,6 +96,7 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { JniPlatformContext *_jniPlatformContext; std::map, int, int>> _descriptors; + wgpu::Instance _instance; }; } // namespace RNSkia diff --git a/package/android/cpp/rnskia-android/RNSkAndroidView.h b/package/android/cpp/rnskia-android/RNSkAndroidView.h index 398138adf7..7c71050645 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidView.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidView.h @@ -67,7 +67,7 @@ class RNSkAndroidView : public T, public RNSkBaseAndroidView { T::getPlatformContext()->registerSurfaceDescriptor(nativeId, _window, width, height); - // runTriangleDemo(_window, width, height); + //runTriangleDemo(_window, width, height); } float getPixelDensity() override { diff --git a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp index 7b832a1f6e..2206828304 100644 --- a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp +++ b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp @@ -236,7 +236,19 @@ fn fs_main() -> @location(0) vec4f { std::vector commands; commands.push_back(command); queue.Submit(commands.size(), commands.data()); - + bool done = false; + queue.OnSubmittedWorkDone( + [](WGPUQueueWorkDoneStatus status, void *userdata) { + RNSkia::RNSkLogger::logToConsole("Queue work done"); + auto done = static_cast(userdata); + *done = true; + }, + &done); + RNSkia::RNSkLogger::logToConsole("Preprocess events"); + while(!done) { + instance.ProcessEvents(); + } + RNSkia::RNSkLogger::logToConsole("Present"); swapChain.Present(); // surface.release(); diff --git a/package/cpp/rnskia/RNSkPlatformContext.h b/package/cpp/rnskia/RNSkPlatformContext.h index cf57fa1cfb..a6b1e5fa04 100644 --- a/package/cpp/rnskia/RNSkPlatformContext.h +++ b/package/cpp/rnskia/RNSkPlatformContext.h @@ -178,6 +178,7 @@ class RNSkPlatformContext { int height) = 0; virtual std::tuple, int, int> getSurfaceDescriptor(int nativeId) = 0; + virtual wgpu::Instance getInstance() = 0; /** * Starts (if not started) a loop that will call back on display sync diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index eb5cbc44a4..c9def41d66 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -39,6 +39,7 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { runtime, [object = std::move(object), mode, offset, size](jsi::Runtime &runtime, std::shared_ptr promise) { + RNSkLogger::logToConsole("Buffer::MapAsync start"); object->MapAsync( mode, offset, size, [](WGPUBufferMapAsyncStatus status, void *userdata) { diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 2032276c25..fd620306e1 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include #include "dawn/webgpu_cpp.h" @@ -38,6 +41,23 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { return jsi::Value::undefined(); } +JSI_HOST_FUNCTION(onSubmittedWorkDone) { + bool done = false; + getObject()->OnSubmittedWorkDone( + [](WGPUQueueWorkDoneStatus status, void *userdata) { + RNSkia::RNSkLogger::logToConsole("Queue work done"); + auto done = static_cast(userdata); + *done = true; + }, + &done); + RNSkia::RNSkLogger::logToConsole("Preprocess events"); + // while(!done) { + // getContext()->getInstance().ProcessEvents(); + // } + RNSkia::RNSkLogger::logToConsole("Postprocess events"); + return jsi::Value::undefined(); +} + JSI_HOST_FUNCTION(writeBuffer) { auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); @@ -52,7 +72,8 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { EXPORT_JSI_API_BRANDNAME(JsiQueue, Queue) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiQueue, submit), - JSI_EXPORT_FUNC(JsiQueue, writeBuffer)) + JSI_EXPORT_FUNC(JsiQueue, writeBuffer), + JSI_EXPORT_FUNC(JsiQueue, onSubmittedWorkDone)) /** * Returns the underlying object from a host object of this type diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 9acca38d36..eed746a5d6 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -255,13 +255,19 @@ export const model: JSIObject[] = [ auto size = static_cast(arguments[2].getNumber()); auto object = getObject(); return RNJsi::JsiPromises::createPromiseAsJSIValue( - runtime, - [object = std::move(object), mode, offset, size](jsi::Runtime &runtime, - std::shared_ptr promise) { + runtime, [object = std::move(object), mode, offset, + size](jsi::Runtime &runtime, + std::shared_ptr promise) { + RNSkLogger::logToConsole( + "Buffer::MapAsync start" ); object->MapAsync( mode, offset, size, [](WGPUBufferMapAsyncStatus status, void *userdata) { - auto promise = static_cast(userdata); + auto promise = + static_cast(userdata); + RNSkLogger::logToConsole( + "Buffer::MapAsync callback status: " + + std::to_string(static_cast(status))); promise->resolve(jsi::Value::undefined()); }, promise.get()); From 10f6de2b2c0076e650ffc34478b8dd308204a217 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 11:43:49 +0200 Subject: [PATCH 12/63] :wrench: --- example/src/Examples/Breathe/demo3.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index f2742d5299..a0a233c91a 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -2,7 +2,6 @@ import { gpu } from "@shopify/react-native-skia"; const check = () => { - //console.log("check"); requestAnimationFrame(check); } From 71261391717cec82811bce01eceb04f8dc869a97 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 14:15:32 +0200 Subject: [PATCH 13/63] :wrench: --- example/src/Examples/Breathe/demo3.tsx | 2 ++ .../RNSkAndroidPlatformContext.h | 8 +++-- package/cpp/rnskia/RNSkManager.cpp | 3 +- package/cpp/wgpu/JsiQueue.h | 35 ++++++++++++------- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index a0a233c91a..ae5dc09666 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -1,4 +1,5 @@ import { gpu } from "@shopify/react-native-skia"; +import { runOnUI } from "@shopify/react-native-skia/src/external/reanimated/moduleWrapper"; const check = () => { @@ -23,6 +24,7 @@ export const demo3 = async(context: GPUCanvasContext) => { device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); console.log("DONE0"); device.queue.onSubmittedWorkDone(); + check(); // Read data back from the GPU buffer console.log("DONE1"); diff --git a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h index c579562cf7..4f30973cbb 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h @@ -27,6 +27,10 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { : RNSkPlatformContext(runtime, jsCallInvoker, jniPlatformContext->getPixelDensity()), _jniPlatformContext(jniPlatformContext) { + wgpu::InstanceDescriptor instanceDesc; + instanceDesc.features.timedWaitAnyEnable = true; + instanceDesc.features.timedWaitAnyMaxCount = 64; + _instance = wgpu::CreateInstance(&instanceDesc); // Hook onto the notify draw loop callback in the platform context jniPlatformContext->setOnNotifyDrawLoop( [this]() { notifyDrawLoop(false); }); @@ -72,8 +76,6 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { wgpu::SurfaceDescriptor surfaceDesc = {}; surfaceDesc.nextInChain = &androidSurfaceDesc; - - _instance = wgpu::CreateInstance(nullptr); auto surface = _instance.CreateSurface(&surfaceDesc); _descriptors[nativeId] = std::make_tuple( @@ -96,7 +98,7 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { JniPlatformContext *_jniPlatformContext; std::map, int, int>> _descriptors; - wgpu::Instance _instance; + wgpu::Instance _instance = nullptr; }; } // namespace RNSkia diff --git a/package/cpp/rnskia/RNSkManager.cpp b/package/cpp/rnskia/RNSkManager.cpp index aeaff1ceba..7e35ea1f01 100644 --- a/package/cpp/rnskia/RNSkManager.cpp +++ b/package/cpp/rnskia/RNSkManager.cpp @@ -70,8 +70,7 @@ void RNSkManager::setSkiaView(size_t nativeId, std::shared_ptr view) { void RNSkManager::installBindings() { // Create the API objects and install it on the global object in the // provided runtime. - auto instance = wgpuCreateInstance(nullptr); - auto gpu = std::make_shared(_platformContext, instance); + auto gpu = std::make_shared(_platformContext, _platformContext->getInstance()); _jsRuntime->global().setProperty( *_jsRuntime, "GPU", jsi::Object::createFromHostObject(*_jsRuntime, std::move(gpu))); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index fd620306e1..adb4dbedc6 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -43,19 +43,28 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(onSubmittedWorkDone) { bool done = false; - getObject()->OnSubmittedWorkDone( - [](WGPUQueueWorkDoneStatus status, void *userdata) { - RNSkia::RNSkLogger::logToConsole("Queue work done"); - auto done = static_cast(userdata); - *done = true; - }, - &done); - RNSkia::RNSkLogger::logToConsole("Preprocess events"); - // while(!done) { - // getContext()->getInstance().ProcessEvents(); - // } - RNSkia::RNSkLogger::logToConsole("Postprocess events"); - return jsi::Value::undefined(); + // Define the callback function + auto callback = [](WGPUQueueWorkDoneStatus status, void *userdata) { + RNSkia::RNSkLogger::logToConsole("Status: %d", status); + auto done = static_cast(userdata); + *done = true; + }; + // Create QueueWorkDoneCallbackInfo struct + wgpu::QueueWorkDoneCallbackInfo callbackInfo = { + nullptr, // userdata is not used in the callback + wgpu::CallbackMode::WaitAnyOnly, // Callback mode + callback, // Callback function + &done // Userdata (pointer to 'done' variable) + }; + + // Call OnSubmittedWorkDone with the proper argument + wgpu::Future future = getObject()->OnSubmittedWorkDone(callbackInfo); + // Setup wait information and wait + wgpu::FutureWaitInfo waitInfo = {future}; + RNSkia::RNSkLogger::logToConsole("before WaitAny"); + getContext()->getInstance().WaitAny(1, &waitInfo, UINT64_MAX); + RNSkia::RNSkLogger::logToConsole("after WaitAny"); + return jsi::Value::undefined(); } JSI_HOST_FUNCTION(writeBuffer) { From 9babaee257eb55722f208d78a3aaeca701238025 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 14:57:29 +0200 Subject: [PATCH 14/63] :wrench: --- example/src/Examples/Breathe/demo3.tsx | 33 +++++--------- .../cpp/rnskia-android/RNSkAndroidView.h | 2 +- .../cpp/rnskia-android/WebGPUTriangle.cpp | 2 +- package/cpp/rnskia/RNSkManager.cpp | 3 +- package/cpp/wgpu/JsiBuffer.h | 41 ++++++++++------- package/cpp/wgpu/JsiQueue.h | 32 +------------ scripts/generator/model.ts | 45 ++++++++++++------- 7 files changed, 69 insertions(+), 89 deletions(-) diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index ae5dc09666..5d86efacf9 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -1,41 +1,28 @@ import { gpu } from "@shopify/react-native-skia"; -import { runOnUI } from "@shopify/react-native-skia/src/external/reanimated/moduleWrapper"; - - -const check = () => { - requestAnimationFrame(check); -} export const demo3 = async(context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); - const device = await adapter!.requestDevice(); + const device = await adapter.requestDevice(); // Create an array of data const data = new Float32Array([1.0, 2.0, 3.0, 4.0]); // Create a GPU buffer and store data const gpuBuffer = device.createBuffer({ size: data.byteLength, - usage: 9//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, - , + usage: 9, //GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST mappedAtCreation: false }); - // Copy data to the GPU buffer - device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); - console.log("DONE0"); - device.queue.onSubmittedWorkDone(); - check(); - // Read data back from the GPU buffer - console.log("DONE1"); - // gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ - // device.queue.onSubmittedWorkDone(); - // console.log("DONE2"); + // Copy data to the GPU buffer + await device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); - // const arrayBuffer = gpuBuffer.getMappedRange(); - // const readData = new Float32Array(arrayBuffer); + await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ + console.log("mapAsync done"); + const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); + const readData = new Float32Array(arrayBuffer); // // Output the read data - // console.log('Data read from the buffer:', readData); - // gpuBuffer.unmap(); + console.log('Data read from the buffer:', readData); + gpuBuffer.unmap(); }; \ No newline at end of file diff --git a/package/android/cpp/rnskia-android/RNSkAndroidView.h b/package/android/cpp/rnskia-android/RNSkAndroidView.h index 7c71050645..398138adf7 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidView.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidView.h @@ -67,7 +67,7 @@ class RNSkAndroidView : public T, public RNSkBaseAndroidView { T::getPlatformContext()->registerSurfaceDescriptor(nativeId, _window, width, height); - //runTriangleDemo(_window, width, height); + // runTriangleDemo(_window, width, height); } float getPixelDensity() override { diff --git a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp index 2206828304..a74c546825 100644 --- a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp +++ b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp @@ -245,7 +245,7 @@ fn fs_main() -> @location(0) vec4f { }, &done); RNSkia::RNSkLogger::logToConsole("Preprocess events"); - while(!done) { + while (!done) { instance.ProcessEvents(); } RNSkia::RNSkLogger::logToConsole("Present"); diff --git a/package/cpp/rnskia/RNSkManager.cpp b/package/cpp/rnskia/RNSkManager.cpp index 7e35ea1f01..2aa430d318 100644 --- a/package/cpp/rnskia/RNSkManager.cpp +++ b/package/cpp/rnskia/RNSkManager.cpp @@ -70,7 +70,8 @@ void RNSkManager::setSkiaView(size_t nativeId, std::shared_ptr view) { void RNSkManager::installBindings() { // Create the API objects and install it on the global object in the // provided runtime. - auto gpu = std::make_shared(_platformContext, _platformContext->getInstance()); + auto gpu = std::make_shared(_platformContext, + _platformContext->getInstance()); _jsRuntime->global().setProperty( *_jsRuntime, "GPU", jsi::Object::createFromHostObject(*_jsRuntime, std::move(gpu))); diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index c9def41d66..12359c715d 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -35,22 +35,27 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { auto offset = static_cast(arguments[1].getNumber()); auto size = static_cast(arguments[2].getNumber()); auto object = getObject(); + auto instance = getContext()->getInstance(); return RNJsi::JsiPromises::createPromiseAsJSIValue( - runtime, [object = std::move(object), mode, offset, - size](jsi::Runtime &runtime, - std::shared_ptr promise) { + runtime, [object = std::move(object), mode, offset, size, + instance = std::move(instance)]( + jsi::Runtime &runtime, + std::shared_ptr promise) { RNSkLogger::logToConsole("Buffer::MapAsync start"); - object->MapAsync( - mode, offset, size, - [](WGPUBufferMapAsyncStatus status, void *userdata) { - auto promise = - static_cast(userdata); - RNSkLogger::logToConsole( - "Buffer::MapAsync callback status: " + - std::to_string(static_cast(status))); - promise->resolve(jsi::Value::undefined()); - }, - promise.get()); + auto callback = [](WGPUBufferMapAsyncStatus status, void *userdata) { + RNSkLogger::logToConsole("Buffer::MapAsync callback status: " + + std::to_string(static_cast(status))); + auto promise = static_cast(userdata); + promise->resolve(jsi::Value::undefined()); + }; + wgpu::BufferMapCallbackInfo callbackInfo = { + nullptr, wgpu::CallbackMode::WaitAnyOnly, callback, + promise.get()}; + wgpu::Future future = + object->MapAsync(mode, offset, size, callbackInfo); + wgpu::FutureWaitInfo waitInfo = {future}; + RNSkia::RNSkLogger::logToConsole("before WaitAny"); + instance.WaitAny(1, &waitInfo, UINT64_MAX); }); } @@ -58,12 +63,18 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); - auto data = getObject()->GetMappedRange(offset, size); + void *data = getObject()->GetMappedRange(offset, size); + if (data == nullptr) { + throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); + } auto arrayBufferCtor = runtime.global().getPropertyAsFunction(runtime, "ArrayBuffer"); auto o = arrayBufferCtor.callAsConstructor(runtime, static_cast(size)) .getObject(runtime); + if (!o.isArrayBuffer(runtime)) { + throw jsi::JSError(runtime, "ArrayBuffer constructor failed"); + } auto buf = o.getArrayBuffer(runtime); memcpy(buf.data(runtime), data, size); return o; diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index adb4dbedc6..2032276c25 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -2,9 +2,6 @@ #include #include #include -#include -#include -#include #include "dawn/webgpu_cpp.h" @@ -41,32 +38,6 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { return jsi::Value::undefined(); } -JSI_HOST_FUNCTION(onSubmittedWorkDone) { - bool done = false; - // Define the callback function - auto callback = [](WGPUQueueWorkDoneStatus status, void *userdata) { - RNSkia::RNSkLogger::logToConsole("Status: %d", status); - auto done = static_cast(userdata); - *done = true; - }; - // Create QueueWorkDoneCallbackInfo struct - wgpu::QueueWorkDoneCallbackInfo callbackInfo = { - nullptr, // userdata is not used in the callback - wgpu::CallbackMode::WaitAnyOnly, // Callback mode - callback, // Callback function - &done // Userdata (pointer to 'done' variable) - }; - - // Call OnSubmittedWorkDone with the proper argument - wgpu::Future future = getObject()->OnSubmittedWorkDone(callbackInfo); - // Setup wait information and wait - wgpu::FutureWaitInfo waitInfo = {future}; - RNSkia::RNSkLogger::logToConsole("before WaitAny"); - getContext()->getInstance().WaitAny(1, &waitInfo, UINT64_MAX); - RNSkia::RNSkLogger::logToConsole("after WaitAny"); - return jsi::Value::undefined(); -} - JSI_HOST_FUNCTION(writeBuffer) { auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); @@ -81,8 +52,7 @@ JSI_HOST_FUNCTION(onSubmittedWorkDone) { EXPORT_JSI_API_BRANDNAME(JsiQueue, Queue) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiQueue, submit), - JSI_EXPORT_FUNC(JsiQueue, writeBuffer), - JSI_EXPORT_FUNC(JsiQueue, onSubmittedWorkDone)) + JSI_EXPORT_FUNC(JsiQueue, writeBuffer)) /** * Returns the underlying object from a host object of this type diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index eed746a5d6..fa8f1de654 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -250,27 +250,30 @@ export const model: JSIObject[] = [ type: "uint32_t", } ], - implementation: `auto mode = static_cast(arguments[0].getNumber()); + implementation: ` auto mode = static_cast(arguments[0].getNumber()); auto offset = static_cast(arguments[1].getNumber()); auto size = static_cast(arguments[2].getNumber()); auto object = getObject(); + auto instance = getContext()->getInstance(); return RNJsi::JsiPromises::createPromiseAsJSIValue( runtime, [object = std::move(object), mode, offset, - size](jsi::Runtime &runtime, + size, instance = std::move(instance)](jsi::Runtime &runtime, std::shared_ptr promise) { - RNSkLogger::logToConsole( - "Buffer::MapAsync start" ); - object->MapAsync( - mode, offset, size, - [](WGPUBufferMapAsyncStatus status, void *userdata) { - auto promise = - static_cast(userdata); - RNSkLogger::logToConsole( - "Buffer::MapAsync callback status: " + - std::to_string(static_cast(status))); - promise->resolve(jsi::Value::undefined()); - }, - promise.get()); + RNSkLogger::logToConsole("Buffer::MapAsync start"); + auto callback = [](WGPUBufferMapAsyncStatus status, void *userdata) { + RNSkLogger::logToConsole( + "Buffer::MapAsync callback status: " + + std::to_string(static_cast(status))); + auto promise = + static_cast(userdata); + promise->resolve(jsi::Value::undefined()); + }; + wgpu::BufferMapCallbackInfo callbackInfo = {nullptr, wgpu::CallbackMode::WaitAnyOnly, callback, + promise.get()}; + wgpu::Future future = object->MapAsync(mode, offset, size, callbackInfo); + wgpu::FutureWaitInfo waitInfo = {future}; + RNSkia::RNSkLogger::logToConsole("before WaitAny"); + instance.WaitAny(1, &waitInfo, UINT64_MAX); });` }, { @@ -282,10 +285,18 @@ export const model: JSIObject[] = [ implementation: ` size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); - auto data = getObject()->GetMappedRange(offset, size); + void * data = getObject()->GetMappedRange(offset, size); + if (data == nullptr) { + throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); + } auto arrayBufferCtor = runtime.global().getPropertyAsFunction(runtime, "ArrayBuffer"); - auto o = arrayBufferCtor.callAsConstructor(runtime, static_cast(size)).getObject(runtime); + auto o = + arrayBufferCtor.callAsConstructor(runtime, static_cast(size)) + .getObject(runtime); + if (!o.isArrayBuffer(runtime)) { + throw jsi::JSError(runtime, "ArrayBuffer constructor failed"); + } auto buf = o.getArrayBuffer(runtime); memcpy(buf.data(runtime), data, size); return o;` From 6963a6c64b96474551b1ebd79e09345fc29ab7a6 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 15:02:39 +0200 Subject: [PATCH 15/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 4 +- example/src/Examples/Breathe/demo1/main.ts | 349 ++++++++++----------- example/src/Examples/Breathe/demo2.ts | 10 +- example/src/Examples/Breathe/demo3.tsx | 2 +- 4 files changed, 180 insertions(+), 185 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index f112660ebb..1ce6124792 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -4,6 +4,8 @@ import { SkiaDomView, } from "@shopify/react-native-skia"; import { demo3 } from "./demo3"; +import { demo2 } from "./demo2"; +import { demo1 } from "./demo1/main"; const draw = async (context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); @@ -14,7 +16,7 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: 'premultiplied', }); - await demo3(context); + await demo1(device, context); context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 92f0f4bd79..1e91f26a72 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -9,34 +9,33 @@ import { } from './cube'; import {basicVertWGSL, vertexPositionColorWGSL} from './shaders'; -import { gpu } from '@shopify/react-native-skia'; import { Dimensions } from 'react-native'; const {width, height} = Dimensions.get("window"); -async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { - const readBuffer = device.createBuffer({ - size: byteLength, - usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, - mappedAtCreation: false - }); - if (!readBuffer) { - console.error("Failed to create vertex buffer"); - } +// async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { +// const readBuffer = device.createBuffer({ +// size: byteLength, +// usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, +// mappedAtCreation: false +// }); +// if (!readBuffer) { +// console.error("Failed to create vertex buffer"); +// } - const commandEncoder = device.createCommandEncoder(); - commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); - const gpuCommands = commandEncoder.finish(); - device.queue.submit([gpuCommands]); - console.log("Start reading buffer"); - const b = readBuffer.getMappedRange(0, byteLength); - console.log(new Float32Array(b)); - //await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ - console.log("End reading buffer"); - - //const copyArrayBuffer = readBuffer.getMappedRange(); - readBuffer.unmap(); -} +// const commandEncoder = device.createCommandEncoder(); +// commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); +// const gpuCommands = commandEncoder.finish(); +// device.queue.submit([gpuCommands]); +// console.log("Start reading buffer"); +// const b = readBuffer.getMappedRange(0, byteLength); +// console.log(new Float32Array(b)); +// //await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ +// console.log("End reading buffer"); + +// //const copyArrayBuffer = readBuffer.getMappedRange(); +// readBuffer.unmap(); +// } export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { @@ -57,164 +56,164 @@ const result = new Float32Array(mappedRange); result.set(cubeVertexArray); verticesBuffer.unmap(); -await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); -// const pipeline = device.createRenderPipeline({ -// layout: 'auto', -// vertex: { -// module: device.createShaderModule({ -// code: basicVertWGSL, -// }), -// entryPoint: "main", -// buffers: [ -// { -// arrayStride: cubeVertexSize, -// attributes: [ -// { -// // position -// shaderLocation: 0, -// offset: cubePositionOffset, -// format: 'float32x4', -// }, -// { -// // uv -// shaderLocation: 1, -// offset: cubeUVOffset, -// format: 'float32x2', -// }, -// ], -// }, -// ], -// }, -// fragment: { -// module: device.createShaderModule({ -// code: vertexPositionColorWGSL, -// }), -// entryPoint: "main", -// targets: [ -// { -// format: presentationFormat, -// }, -// ], -// }, -// primitive: { -// topology: 'triangle-list', - -// // Backface culling since the cube is solid piece of geometry. -// // Faces pointing away from the camera will be occluded by faces -// // pointing toward the camera. -// cullMode: 'back', -// }, - -// // Enable depth testing so that the fragment closest to the camera -// // is rendered in front. -// depthStencil: { -// depthWriteEnabled: true, -// depthCompare: 'less', -// format: 'depth24plus', -// }, -// }); - -// const depthTexture = device.createTexture({ -// size: { width, height }, -// format: 'depth24plus', -// usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, -// }); - - -// const uniformBufferSize = 4 * 16; // 4x4 matrix -// const uniformBuffer = device.createBuffer({ -// size: uniformBufferSize, -// usage: 72,// GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, -// mappedAtCreation: false -// }); - -// if (!uniformBuffer) { -// console.error("Failed to create uniform buffer"); +//await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); +const pipeline = device.createRenderPipeline({ + layout: 'auto', + vertex: { + module: device.createShaderModule({ + code: basicVertWGSL, + }), + entryPoint: "main", + buffers: [ + { + arrayStride: cubeVertexSize, + attributes: [ + { + // position + shaderLocation: 0, + offset: cubePositionOffset, + format: 'float32x4', + }, + { + // uv + shaderLocation: 1, + offset: cubeUVOffset, + format: 'float32x2', + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: vertexPositionColorWGSL, + }), + entryPoint: "main", + targets: [ + { + format: 'rgba8unorm', + }, + ], + }, + primitive: { + topology: 'triangle-list', + + // Backface culling since the cube is solid piece of geometry. + // Faces pointing away from the camera will be occluded by faces + // pointing toward the camera. + cullMode: 'back', + }, + + // Enable depth testing so that the fragment closest to the camera + // is rendered in front. + depthStencil: { + depthWriteEnabled: true, + depthCompare: 'less', + format: 'depth24plus', + }, +}); -// } +const depthTexture = device.createTexture({ + size: { width, height }, + format: 'depth24plus', + usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, +}); -// const uniformBindGroup = device.createBindGroup({ -// layout: pipeline.getBindGroupLayout(0), -// entries: [ -// { -// binding: 0, -// buffer: uniformBuffer, -// }, -// ], -// }); - -// if (!uniformBindGroup) { -// console.error("Failed to create uniform bind group"); -// } +const uniformBufferSize = 4 * 16; // 4x4 matrix +const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: 72,// GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + mappedAtCreation: false +}); +if (!uniformBuffer) { + console.error("Failed to create uniform buffer"); -// const renderPassDescriptor: GPURenderPassDescriptor = { -// colorAttachments: [ -// { -// view: undefined, - -// clearValue: [0.5, 0.5, 0.5, 1.0], -// loadOp: 'clear', -// storeOp: 'store', -// }, -// ], -// depthStencilAttachment: { -// view: depthTexture.createView(), - -// depthClearValue: 1.0, -// depthLoadOp: 'clear', -// depthStoreOp: 'store', -// }, -// }; - -// const aspect = width / height; -// const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); -// const modelViewProjectionMatrix = mat4.create(); - -// function getTransformationMatrix() { -// const viewMatrix = mat4.identity(); -// mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); -// const now = Date.now() / 1000; -// mat4.rotate( -// viewMatrix, -// vec3.fromValues(Math.sin(now), Math.cos(now), 0), -// 1, -// viewMatrix -// ); - -// mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); -// return modelViewProjectionMatrix as Float32Array; -// } +} -// function frame() { -// const transformationMatrix = getTransformationMatrix(); -// device.queue.writeBuffer( -// uniformBuffer, -// 0, -// transformationMatrix.buffer, -// transformationMatrix.byteOffset, -// transformationMatrix.byteLength -// ); -// renderPassDescriptor.colorAttachments[0].view = context -// .getCurrentTexture() -// .createView(); +const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + }, + ], +}); -// const commandEncoder = device.createCommandEncoder(); -// const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); -// passEncoder.setPipeline(pipeline); -// passEncoder.setBindGroup(0, uniformBindGroup); -// passEncoder.setVertexBuffer(0, verticesBuffer); -// passEncoder.draw(cubeVertexCount); -// passEncoder.end(); -// device.queue.submit([commandEncoder.finish()]); - -// //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); - -// console.log("RENDER"); -// //context.present(); -// // requestAnimationFrame(frame); -// } -// frame(); +if (!uniformBindGroup) { + console.error("Failed to create uniform bind group"); +} + + + +const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, + + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: 'clear', + storeOp: 'store', + }, + ], + depthStencilAttachment: { + view: depthTexture.createView(), + + depthClearValue: 1.0, + depthLoadOp: 'clear', + depthStoreOp: 'store', + }, +}; + +const aspect = width / height; +const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); +const modelViewProjectionMatrix = mat4.create(); + +function getTransformationMatrix() { + const viewMatrix = mat4.identity(); + mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); + const now = Date.now() / 1000; + mat4.rotate( + viewMatrix, + vec3.fromValues(Math.sin(now), Math.cos(now), 0), + 1, + viewMatrix + ); + + mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); + return modelViewProjectionMatrix as Float32Array; +} + +function frame() { + const transformationMatrix = getTransformationMatrix(); + device.queue.writeBuffer( + uniformBuffer, + 0, + transformationMatrix.buffer, + transformationMatrix.byteOffset, + transformationMatrix.byteLength + ); + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + + const commandEncoder = device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, verticesBuffer); + passEncoder.draw(cubeVertexCount); + passEncoder.end(); + device.queue.submit([commandEncoder.finish()]); + + //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); + + console.log("RENDER"); + //context.present(); + // requestAnimationFrame(frame); +} +frame(); }; \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo2.ts b/example/src/Examples/Breathe/demo2.ts index 11aa8d5c10..1b73d46f4f 100644 --- a/example/src/Examples/Breathe/demo2.ts +++ b/example/src/Examples/Breathe/demo2.ts @@ -20,15 +20,9 @@ fn main() -> @location(0) vec4f { }`; -export const demo2 = async(context: GPUCanvasContext) => { - const adapter = await gpu.requestAdapter(); - const device = await adapter!.requestDevice(); +export const demo2 = async(device, context: GPUCanvasContext) => { const presentationFormat = 'rgba8unorm'; - context.configure({ - device, - format: presentationFormat, - alphaMode: 'premultiplied', - }); + const pipeline = device.createRenderPipeline({ layout: 'auto', diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index 5d86efacf9..a8906ed223 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -15,7 +15,7 @@ export const demo3 = async(context: GPUCanvasContext) => { // Copy data to the GPU buffer - await device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); + device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ console.log("mapAsync done"); From 0c1ebc4584081e35eb34ea2b9610027830975e79 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 15:05:13 +0200 Subject: [PATCH 16/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- example/src/Examples/Breathe/demo3.tsx | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 1ce6124792..e43583b63c 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -16,7 +16,7 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: 'premultiplied', }); - await demo1(device, context); + await demo3(device, context); context.present(); }; diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index a8906ed223..9e6578cc1f 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -1,8 +1,4 @@ -import { gpu } from "@shopify/react-native-skia"; - -export const demo3 = async(context: GPUCanvasContext) => { - const adapter = await gpu.requestAdapter(); - const device = await adapter.requestDevice(); +export const demo3 = async(device: GPUDevice, context: GPUCanvasContext) => { // Create an array of data const data = new Float32Array([1.0, 2.0, 3.0, 4.0]); @@ -19,10 +15,10 @@ export const demo3 = async(context: GPUCanvasContext) => { await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ console.log("mapAsync done"); - const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); + const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); const readData = new Float32Array(arrayBuffer); // // Output the read data - console.log('Data read from the buffer:', readData); - gpuBuffer.unmap(); + console.log('Data read from the buffer:', readData); + gpuBuffer.unmap(); }; \ No newline at end of file From 0a09666d25088daf96ec9377507ede0d7777b4bc Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 15:35:50 +0200 Subject: [PATCH 17/63] :wrench: --- example/src/Examples/Breathe/demo3.tsx | 2 +- package/cpp/wgpu/JsiQueue.h | 29 +++++++++++++++++++++++++- scripts/generator/model.ts | 29 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index 9e6578cc1f..8ccb6a765d 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -12,7 +12,7 @@ export const demo3 = async(device: GPUDevice, context: GPUCanvasContext) => { // Copy data to the GPU buffer device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); - + await device.queue.onSubmittedWorkDone(); await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ console.log("mapAsync done"); const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 2032276c25..b17511f5f3 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -48,11 +48,38 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { return jsi::Value::undefined(); } + JSI_HOST_FUNCTION(onSubmittedWorkDone) { + + auto object = getObject(); + auto instance = getContext()->getInstance(); + return RNJsi::JsiPromises::createPromiseAsJSIValue( + runtime, [object = std::move(object), instance = std::move(instance)]( + jsi::Runtime &runtime, + std::shared_ptr promise) { + RNSkLogger::logToConsole("onSubmittedWorkDone start"); + auto callback = [](WGPUQueueWorkDoneStatus status, void *userdata) { + RNSkLogger::logToConsole( + "Buffer::onSubmittedWorkDone callback status: " + + std::to_string(static_cast(status))); + auto promise = static_cast(userdata); + promise->resolve(jsi::Value::undefined()); + RNSkLogger::logToConsole("onSubmittedWorkDone end"); + }; + wgpu::QueueWorkDoneCallbackInfo callbackInfo = { + nullptr, wgpu::CallbackMode::WaitAnyOnly, callback, + promise.get()}; + wgpu::Future future = object->OnSubmittedWorkDone(callbackInfo); + wgpu::FutureWaitInfo waitInfo = {future}; + instance.WaitAny(1, &waitInfo, UINT64_MAX); + }); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiQueue, Queue) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiQueue, submit), - JSI_EXPORT_FUNC(JsiQueue, writeBuffer)) + JSI_EXPORT_FUNC(JsiQueue, writeBuffer), + JSI_EXPORT_FUNC(JsiQueue, onSubmittedWorkDone)) /** * Returns the underlying object from a host object of this type diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index fa8f1de654..688e62b9c1 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -360,6 +360,35 @@ export const model: JSIObject[] = [ getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); `, + }, + { + name: "onSubmittedWorkDone", + args: [], + implementation: ` + auto object = getObject(); + auto instance = getContext()->getInstance(); + return RNJsi::JsiPromises::createPromiseAsJSIValue( + runtime, [object = std::move(object), + instance = std::move(instance)]( + jsi::Runtime &runtime, + std::shared_ptr promise) { + RNSkLogger::logToConsole("onSubmittedWorkDone start"); + auto callback = [](WGPUQueueWorkDoneStatus status, void *userdata) { + RNSkLogger::logToConsole("Buffer::onSubmittedWorkDone callback status: " + + std::to_string(static_cast(status))); + auto promise = static_cast(userdata); + promise->resolve(jsi::Value::undefined()); + RNSkLogger::logToConsole("onSubmittedWorkDone end"); + }; + wgpu::QueueWorkDoneCallbackInfo callbackInfo = { + nullptr, wgpu::CallbackMode::WaitAnyOnly, callback, + promise.get()}; + wgpu::Future future = + object->OnSubmittedWorkDone(callbackInfo); + wgpu::FutureWaitInfo waitInfo = {future}; + instance.WaitAny(1, &waitInfo, UINT64_MAX); + }); + ` } ] }, From 1bf58eb5024df48babb10a3108e873a7289e344a Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 16:22:26 +0200 Subject: [PATCH 18/63] :wrench: --- example/src/Examples/Breathe/demo3.tsx | 2 +- package/cpp/wgpu/JsiBuffer.h | 35 ++++++++++++++++---------- scripts/generator/model.ts | 5 +++- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index 8ccb6a765d..9e6578cc1f 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -12,7 +12,7 @@ export const demo3 = async(device: GPUDevice, context: GPUCanvasContext) => { // Copy data to the GPU buffer device.queue.writeBuffer(gpuBuffer, 0, data.buffer, 0, data.byteLength); - await device.queue.onSubmittedWorkDone(); + await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ console.log("mapAsync done"); const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index 12359c715d..56a2fe05da 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -18,6 +18,21 @@ namespace RNSkia { namespace jsi = facebook::jsi; +struct GPUBuffer : jsi::MutableBuffer { + GPUBuffer(void* data, size_t size) : _data(data), _size(size) {} + + size_t size() const override { + return _size; + } + + uint8_t *data() override { + return reinterpret_cast(_data); + } + + void* _data; + size_t _size; +}; + class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { public: JsiBuffer(std::shared_ptr context, wgpu::Buffer m) @@ -60,24 +75,18 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(getMappedRange) { - size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); - void *data = getObject()->GetMappedRange(offset, size); + auto usage = getObject()->GetUsage(); + void *data = (usage & wgpu::BufferUsage::MapWrite) + ? getObject()->GetMappedRange(offset, size) + : const_cast(getObject()->GetConstMappedRange(offset, size)); if (data == nullptr) { throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); } - auto arrayBufferCtor = - runtime.global().getPropertyAsFunction(runtime, "ArrayBuffer"); - auto o = - arrayBufferCtor.callAsConstructor(runtime, static_cast(size)) - .getObject(runtime); - if (!o.isArrayBuffer(runtime)) { - throw jsi::JSError(runtime, "ArrayBuffer constructor failed"); - } - auto buf = o.getArrayBuffer(runtime); - memcpy(buf.data(runtime), data, size); - return o; + auto buf = std::make_shared(data, size); + auto val = jsi::ArrayBuffer(runtime, buf); + return val; } // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 688e62b9c1..18d55e21a7 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -285,7 +285,10 @@ export const model: JSIObject[] = [ implementation: ` size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); - void * data = getObject()->GetMappedRange(offset, size); + auto usage = getObject()->GetUsage(); + void *data = (usage & wgpu::BufferUsage::MapWrite) + ? getObject()->GetMappedRange(offset, size) + : const_cast(getObject()->GetConstMappedRange(offset, size)); if (data == nullptr) { throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); } From c24b06c1569c1b510b9fbf49f93ee74de9d04243 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 16:30:04 +0200 Subject: [PATCH 19/63] :wrench: --- package/cpp/wgpu/JsiAdapter.h | 1 + package/cpp/wgpu/JsiBindGroup.h | 1 + package/cpp/wgpu/JsiBindGroupDescriptor.h | 1 + package/cpp/wgpu/JsiBindGroupEntry.h | 1 + package/cpp/wgpu/JsiBindGroupLayout.h | 1 + package/cpp/wgpu/JsiBlendComponent.h | 1 + package/cpp/wgpu/JsiBlendState.h | 1 + package/cpp/wgpu/JsiBuffer.h | 26 +++++-------------- package/cpp/wgpu/JsiBufferDescriptor.h | 1 + package/cpp/wgpu/JsiColor.h | 1 + package/cpp/wgpu/JsiColorTargetState.h | 1 + package/cpp/wgpu/JsiCommandBuffer.h | 1 + package/cpp/wgpu/JsiCommandEncoder.h | 1 + .../cpp/wgpu/JsiCommandEncoderDescriptor.h | 1 + package/cpp/wgpu/JsiContext.h | 1 + package/cpp/wgpu/JsiDepthStencilState.h | 1 + package/cpp/wgpu/JsiDevice.h | 1 + package/cpp/wgpu/JsiDeviceDescriptor.h | 1 + package/cpp/wgpu/JsiExtent3D.h | 1 + package/cpp/wgpu/JsiFragmentState.h | 1 + package/cpp/wgpu/JsiGPU.h | 1 + package/cpp/wgpu/JsiMultisampleState.h | 1 + package/cpp/wgpu/JsiPrimitiveState.h | 1 + package/cpp/wgpu/JsiQueue.h | 1 + .../cpp/wgpu/JsiRenderPassColorAttachment.h | 1 + .../JsiRenderPassDepthStencilAttachment.h | 1 + package/cpp/wgpu/JsiRenderPassDescriptor.h | 1 + package/cpp/wgpu/JsiRenderPassEncoder.h | 1 + package/cpp/wgpu/JsiRenderPipeline.h | 1 + .../cpp/wgpu/JsiRenderPipelineDescriptor.h | 1 + package/cpp/wgpu/JsiRequestAdapterOptions.h | 1 + package/cpp/wgpu/JsiShaderModule.h | 1 + .../cpp/wgpu/JsiShaderModuleWGSLDescriptor.h | 1 + package/cpp/wgpu/JsiStencilFaceState.h | 1 + package/cpp/wgpu/JsiTexture.h | 1 + package/cpp/wgpu/JsiTextureDescriptor.h | 1 + package/cpp/wgpu/JsiTextureView.h | 1 + package/cpp/wgpu/JsiVertexAttribute.h | 1 + package/cpp/wgpu/JsiVertexBufferLayout.h | 1 + package/cpp/wgpu/JsiVertexState.h | 1 + package/cpp/wgpu/MutableJSIBuffer.h | 24 +++++++++++++++++ scripts/generator/generateObject.ts | 1 + scripts/generator/model.ts | 14 +++------- 43 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 package/cpp/wgpu/MutableJSIBuffer.h diff --git a/package/cpp/wgpu/JsiAdapter.h b/package/cpp/wgpu/JsiAdapter.h index fab6d26c20..08f33b496e 100644 --- a/package/cpp/wgpu/JsiAdapter.h +++ b/package/cpp/wgpu/JsiAdapter.h @@ -13,6 +13,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroup.h b/package/cpp/wgpu/JsiBindGroup.h index 37db693610..542f00fc1b 100644 --- a/package/cpp/wgpu/JsiBindGroup.h +++ b/package/cpp/wgpu/JsiBindGroup.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroupDescriptor.h b/package/cpp/wgpu/JsiBindGroupDescriptor.h index 41fdf0dff7..f5d423c2b4 100644 --- a/package/cpp/wgpu/JsiBindGroupDescriptor.h +++ b/package/cpp/wgpu/JsiBindGroupDescriptor.h @@ -13,6 +13,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index 42e92d845d..3cb767098f 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroupLayout.h b/package/cpp/wgpu/JsiBindGroupLayout.h index da74b486c3..0a9a7b841a 100644 --- a/package/cpp/wgpu/JsiBindGroupLayout.h +++ b/package/cpp/wgpu/JsiBindGroupLayout.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBlendComponent.h b/package/cpp/wgpu/JsiBlendComponent.h index 09bafb4d91..2a332690f5 100644 --- a/package/cpp/wgpu/JsiBlendComponent.h +++ b/package/cpp/wgpu/JsiBlendComponent.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBlendState.h b/package/cpp/wgpu/JsiBlendState.h index fb2e6ee5a3..d9910d2b9b 100644 --- a/package/cpp/wgpu/JsiBlendState.h +++ b/package/cpp/wgpu/JsiBlendState.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index 56a2fe05da..ff2244dc6b 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" @@ -18,21 +19,6 @@ namespace RNSkia { namespace jsi = facebook::jsi; -struct GPUBuffer : jsi::MutableBuffer { - GPUBuffer(void* data, size_t size) : _data(data), _size(size) {} - - size_t size() const override { - return _size; - } - - uint8_t *data() override { - return reinterpret_cast(_data); - } - - void* _data; - size_t _size; -}; - class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { public: JsiBuffer(std::shared_ptr context, wgpu::Buffer m) @@ -75,16 +61,18 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(getMappedRange) { + size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); auto usage = getObject()->GetUsage(); - void *data = (usage & wgpu::BufferUsage::MapWrite) - ? getObject()->GetMappedRange(offset, size) - : const_cast(getObject()->GetConstMappedRange(offset, size)); + void *data = (usage & wgpu::BufferUsage::MapWrite) + ? getObject()->GetMappedRange(offset, size) + : const_cast( + getObject()->GetConstMappedRange(offset, size)); if (data == nullptr) { throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); } - auto buf = std::make_shared(data, size); + auto buf = std::make_shared(data, size); auto val = jsi::ArrayBuffer(runtime, buf); return val; } diff --git a/package/cpp/wgpu/JsiBufferDescriptor.h b/package/cpp/wgpu/JsiBufferDescriptor.h index 5cc589fc3d..36914efcdd 100644 --- a/package/cpp/wgpu/JsiBufferDescriptor.h +++ b/package/cpp/wgpu/JsiBufferDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiColor.h b/package/cpp/wgpu/JsiColor.h index bd35f8efb7..1adf5c9998 100644 --- a/package/cpp/wgpu/JsiColor.h +++ b/package/cpp/wgpu/JsiColor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiColorTargetState.h b/package/cpp/wgpu/JsiColorTargetState.h index 3f826c126a..5d7f52380f 100644 --- a/package/cpp/wgpu/JsiColorTargetState.h +++ b/package/cpp/wgpu/JsiColorTargetState.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiCommandBuffer.h b/package/cpp/wgpu/JsiCommandBuffer.h index 9e02da6381..44c7b48286 100644 --- a/package/cpp/wgpu/JsiCommandBuffer.h +++ b/package/cpp/wgpu/JsiCommandBuffer.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index d61a25216c..bcc45275ca 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -15,6 +15,7 @@ #include "JsiRenderPassDescriptor.h" #include "JsiRenderPassEncoder.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiCommandEncoderDescriptor.h b/package/cpp/wgpu/JsiCommandEncoderDescriptor.h index 441d240378..7ab08c9509 100644 --- a/package/cpp/wgpu/JsiCommandEncoderDescriptor.h +++ b/package/cpp/wgpu/JsiCommandEncoderDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiContext.h b/package/cpp/wgpu/JsiContext.h index 121ad43efe..2e30b3d315 100644 --- a/package/cpp/wgpu/JsiContext.h +++ b/package/cpp/wgpu/JsiContext.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiDepthStencilState.h b/package/cpp/wgpu/JsiDepthStencilState.h index dd71230e03..58105e00c4 100644 --- a/package/cpp/wgpu/JsiDepthStencilState.h +++ b/package/cpp/wgpu/JsiDepthStencilState.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiStencilFaceState.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index 3597e31641..06e1b1a7f0 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -24,6 +24,7 @@ #include "JsiSkHostObjects.h" #include "JsiTexture.h" #include "JsiTextureDescriptor.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiDeviceDescriptor.h b/package/cpp/wgpu/JsiDeviceDescriptor.h index 62385308cf..3cfdbea4cf 100644 --- a/package/cpp/wgpu/JsiDeviceDescriptor.h +++ b/package/cpp/wgpu/JsiDeviceDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiExtent3D.h b/package/cpp/wgpu/JsiExtent3D.h index dfa20e4855..c547def623 100644 --- a/package/cpp/wgpu/JsiExtent3D.h +++ b/package/cpp/wgpu/JsiExtent3D.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiFragmentState.h b/package/cpp/wgpu/JsiFragmentState.h index a9bcd470a6..b056fdece8 100644 --- a/package/cpp/wgpu/JsiFragmentState.h +++ b/package/cpp/wgpu/JsiFragmentState.h @@ -13,6 +13,7 @@ #include "JsiPromises.h" #include "JsiShaderModule.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiGPU.h b/package/cpp/wgpu/JsiGPU.h index 046f2668bb..8b697de7c5 100644 --- a/package/cpp/wgpu/JsiGPU.h +++ b/package/cpp/wgpu/JsiGPU.h @@ -13,6 +13,7 @@ #include "JsiPromises.h" #include "JsiRequestAdapterOptions.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiMultisampleState.h b/package/cpp/wgpu/JsiMultisampleState.h index 5bbe814f2f..f92f5efa88 100644 --- a/package/cpp/wgpu/JsiMultisampleState.h +++ b/package/cpp/wgpu/JsiMultisampleState.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiPrimitiveState.h b/package/cpp/wgpu/JsiPrimitiveState.h index 94f497072d..f7a8ae95f0 100644 --- a/package/cpp/wgpu/JsiPrimitiveState.h +++ b/package/cpp/wgpu/JsiPrimitiveState.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index b17511f5f3..2e41ad2770 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPassColorAttachment.h b/package/cpp/wgpu/JsiRenderPassColorAttachment.h index d46e68974f..f249658a0f 100644 --- a/package/cpp/wgpu/JsiRenderPassColorAttachment.h +++ b/package/cpp/wgpu/JsiRenderPassColorAttachment.h @@ -13,6 +13,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiTextureView.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h b/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h index d6b863130b..18e52500f2 100644 --- a/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h +++ b/package/cpp/wgpu/JsiRenderPassDepthStencilAttachment.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiTextureView.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPassDescriptor.h b/package/cpp/wgpu/JsiRenderPassDescriptor.h index 1eb756f490..ae517b8084 100644 --- a/package/cpp/wgpu/JsiRenderPassDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPassDescriptor.h @@ -13,6 +13,7 @@ #include "JsiRenderPassColorAttachment.h" #include "JsiRenderPassDepthStencilAttachment.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index df83e45b8e..efe728a899 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -14,6 +14,7 @@ #include "JsiPromises.h" #include "JsiRenderPipeline.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPipeline.h b/package/cpp/wgpu/JsiRenderPipeline.h index 0a31d484a0..290e489a7a 100644 --- a/package/cpp/wgpu/JsiRenderPipeline.h +++ b/package/cpp/wgpu/JsiRenderPipeline.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h index 2db8a2e3b4..4772df570b 100644 --- a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h @@ -16,6 +16,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiVertexState.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRequestAdapterOptions.h b/package/cpp/wgpu/JsiRequestAdapterOptions.h index 1a81544928..90e4925ac6 100644 --- a/package/cpp/wgpu/JsiRequestAdapterOptions.h +++ b/package/cpp/wgpu/JsiRequestAdapterOptions.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiShaderModule.h b/package/cpp/wgpu/JsiShaderModule.h index 007a43580a..ef5dcf593a 100644 --- a/package/cpp/wgpu/JsiShaderModule.h +++ b/package/cpp/wgpu/JsiShaderModule.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h b/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h index 47214b0f98..ee552b8601 100644 --- a/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h +++ b/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiStencilFaceState.h b/package/cpp/wgpu/JsiStencilFaceState.h index f8845317a8..43fd7c80e0 100644 --- a/package/cpp/wgpu/JsiStencilFaceState.h +++ b/package/cpp/wgpu/JsiStencilFaceState.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiTexture.h b/package/cpp/wgpu/JsiTexture.h index a04e278f30..fa397b985d 100644 --- a/package/cpp/wgpu/JsiTexture.h +++ b/package/cpp/wgpu/JsiTexture.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiTextureView.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiTextureDescriptor.h b/package/cpp/wgpu/JsiTextureDescriptor.h index f92ec6514d..e3f3fe29ff 100644 --- a/package/cpp/wgpu/JsiTextureDescriptor.h +++ b/package/cpp/wgpu/JsiTextureDescriptor.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiTextureView.h b/package/cpp/wgpu/JsiTextureView.h index 7e12eb5500..5b481d15d5 100644 --- a/package/cpp/wgpu/JsiTextureView.h +++ b/package/cpp/wgpu/JsiTextureView.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiVertexAttribute.h b/package/cpp/wgpu/JsiVertexAttribute.h index 7b661714e0..a45efd3387 100644 --- a/package/cpp/wgpu/JsiVertexAttribute.h +++ b/package/cpp/wgpu/JsiVertexAttribute.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiVertexBufferLayout.h b/package/cpp/wgpu/JsiVertexBufferLayout.h index c57666ba62..c2346ea55b 100644 --- a/package/cpp/wgpu/JsiVertexBufferLayout.h +++ b/package/cpp/wgpu/JsiVertexBufferLayout.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiVertexAttribute.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiVertexState.h b/package/cpp/wgpu/JsiVertexState.h index b05de0b85d..928c5a60a5 100644 --- a/package/cpp/wgpu/JsiVertexState.h +++ b/package/cpp/wgpu/JsiVertexState.h @@ -13,6 +13,7 @@ #include "JsiShaderModule.h" #include "JsiSkHostObjects.h" #include "JsiVertexBufferLayout.h" +#include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/MutableJSIBuffer.h b/package/cpp/wgpu/MutableJSIBuffer.h new file mode 100644 index 0000000000..1d29ebb6ce --- /dev/null +++ b/package/cpp/wgpu/MutableJSIBuffer.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +struct MutableJSIBuffer : jsi::MutableBuffer { + MutableJSIBuffer(void *data, size_t size) : _data(data), _size(size) {} + + size_t size() const override { return _size; } + + uint8_t *data() override { return reinterpret_cast(_data); } + + void *_data; + size_t _size; +}; + +} // namespace RNSkia \ No newline at end of file diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index ade249cc92..b7819b80ea 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -188,6 +188,7 @@ export const generateObject = (object: JSIObject) => { #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "RNSkPlatformContext.h" +#include "MutableJSIBuffer.h" #include "JsiEnums.h" ${computeDependencies(object)} diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 18d55e21a7..0b69fdae35 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -292,17 +292,9 @@ export const model: JSIObject[] = [ if (data == nullptr) { throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); } - auto arrayBufferCtor = - runtime.global().getPropertyAsFunction(runtime, "ArrayBuffer"); - auto o = - arrayBufferCtor.callAsConstructor(runtime, static_cast(size)) - .getObject(runtime); - if (!o.isArrayBuffer(runtime)) { - throw jsi::JSError(runtime, "ArrayBuffer constructor failed"); - } - auto buf = o.getArrayBuffer(runtime); - memcpy(buf.data(runtime), data, size); - return o;` + auto buf = std::make_shared(data, size); + auto val = jsi::ArrayBuffer(runtime, buf); + return val;` } ] }, From 91fe6c609a4e450609e86e4a1e7b28fa61464da0 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 16:59:18 +0200 Subject: [PATCH 20/63] :wrench: --- example/src/Examples/Breathe/demo3.tsx | 4 ++-- package/cpp/wgpu/JsiBuffer.h | 1 + package/cpp/wgpu/JsiQueue.h | 2 +- scripts/generator/model.ts | 13 ++++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index 9e6578cc1f..79ab715a2d 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -1,6 +1,6 @@ export const demo3 = async(device: GPUDevice, context: GPUCanvasContext) => { // Create an array of data - const data = new Float32Array([1.0, 2.0, 3.0, 4.0]); + const data = new Uint32Array([1.0, 2.0, 3.0, 4.0]); // Create a GPU buffer and store data const gpuBuffer = device.createBuffer({ @@ -16,7 +16,7 @@ export const demo3 = async(device: GPUDevice, context: GPUCanvasContext) => { await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ console.log("mapAsync done"); const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); - const readData = new Float32Array(arrayBuffer); + const readData = new Uint32Array(arrayBuffer); // // Output the read data console.log('Data read from the buffer:', readData); diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index ff2244dc6b..e8bd285c15 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -74,6 +74,7 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { } auto buf = std::make_shared(data, size); auto val = jsi::ArrayBuffer(runtime, buf); + auto d = val.data(runtime); return val; } diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 2e41ad2770..0287a032e7 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -44,7 +44,7 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); - auto size = static_cast(arguments[3].getNumber()); + auto size = static_cast(arguments[4].getNumber()); getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 0b69fdae35..d3407874e7 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -286,15 +286,18 @@ export const model: JSIObject[] = [ size_t offset = static_cast(arguments[0].getNumber()); size_t size = static_cast(arguments[1].getNumber()); auto usage = getObject()->GetUsage(); - void *data = (usage & wgpu::BufferUsage::MapWrite) - ? getObject()->GetMappedRange(offset, size) - : const_cast(getObject()->GetConstMappedRange(offset, size)); + void *data = (usage & wgpu::BufferUsage::MapWrite) + ? getObject()->GetMappedRange(offset, size) + : const_cast( + getObject()->GetConstMappedRange(offset, size)); if (data == nullptr) { throw jsi::JSError(runtime, "Buffer::GetMappedRange failed"); } auto buf = std::make_shared(data, size); auto val = jsi::ArrayBuffer(runtime, buf); - return val;` + auto d = val.data(runtime); + return val; + ` } ] }, @@ -351,7 +354,7 @@ export const model: JSIObject[] = [ auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); - auto size = static_cast(arguments[3].getNumber()); + auto size = static_cast(arguments[4].getNumber()); getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); `, From 18a2ab4160d3d91acd1ab7545adeb14f598cad0f Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 17:03:05 +0200 Subject: [PATCH 21/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- example/src/Examples/Breathe/demo1/main.ts | 48 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index e43583b63c..1ce6124792 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -16,7 +16,7 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: 'premultiplied', }); - await demo3(device, context); + await demo1(device, context); context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 1e91f26a72..5297c6832a 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -13,29 +13,29 @@ import { Dimensions } from 'react-native'; const {width, height} = Dimensions.get("window"); -// async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { -// const readBuffer = device.createBuffer({ -// size: byteLength, -// usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, -// mappedAtCreation: false -// }); -// if (!readBuffer) { -// console.error("Failed to create vertex buffer"); -// } - -// const commandEncoder = device.createCommandEncoder(); -// commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); -// const gpuCommands = commandEncoder.finish(); -// device.queue.submit([gpuCommands]); -// console.log("Start reading buffer"); -// const b = readBuffer.getMappedRange(0, byteLength); -// console.log(new Float32Array(b)); -// //await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength);//GPUMapMode.READ -// console.log("End reading buffer"); - -// //const copyArrayBuffer = readBuffer.getMappedRange(); -// readBuffer.unmap(); -// } +async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { + const readBuffer = device.createBuffer({ + size: byteLength, + usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, + mappedAtCreation: false + }); + if (!readBuffer) { + console.error("Failed to create vertex buffer"); + } + + const commandEncoder = device.createCommandEncoder(); + commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); + const gpuCommands = commandEncoder.finish(); + device.queue.submit([gpuCommands]); + console.log("Start reading buffer"); + await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength); + + const b = readBuffer.getMappedRange(0, byteLength);//GPUMapMode.READ + console.log(new Float32Array(b)); + console.log("End reading buffer"); + + readBuffer.unmap(); +} export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { @@ -56,7 +56,7 @@ const result = new Float32Array(mappedRange); result.set(cubeVertexArray); verticesBuffer.unmap(); -//await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); +await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); const pipeline = device.createRenderPipeline({ layout: 'auto', vertex: { From 3a171e98abf3023fa9c090517a502fcad316844f Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 2 May 2024 21:12:36 +0200 Subject: [PATCH 22/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 76 +++++----------------- example/src/Examples/Breathe/demo3.tsx | 2 +- 2 files changed, 18 insertions(+), 60 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 5297c6832a..62a2266789 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -13,33 +13,8 @@ import { Dimensions } from 'react-native'; const {width, height} = Dimensions.get("window"); -async function readGPUBuffer(device: GPUDevice, buffer: GPUBuffer, byteLength: number) { - const readBuffer = device.createBuffer({ - size: byteLength, - usage: 9,//GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, - mappedAtCreation: false - }); - if (!readBuffer) { - console.error("Failed to create vertex buffer"); - } - - const commandEncoder = device.createCommandEncoder(); - commandEncoder.copyBufferToBuffer(buffer, 0, readBuffer, 0, byteLength); - const gpuCommands = commandEncoder.finish(); - device.queue.submit([gpuCommands]); - console.log("Start reading buffer"); - await readBuffer.mapAsync(1, 0, cubeVertexArray.byteLength); - - const b = readBuffer.getMappedRange(0, byteLength);//GPUMapMode.READ - console.log(new Float32Array(b)); - console.log("End reading buffer"); - - readBuffer.unmap(); -} - export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { - // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ size: cubeVertexArray.byteLength, @@ -47,16 +22,9 @@ const verticesBuffer = device.createBuffer({ mappedAtCreation: true, }); -if (!verticesBuffer) { - console.error("Failed to create vertex buffer"); -} -const mappedRange = verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength); - -const result = new Float32Array(mappedRange); -result.set(cubeVertexArray); - +new Float32Array(verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength)).set(cubeVertexArray); verticesBuffer.unmap(); -await readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); + const pipeline = device.createRenderPipeline({ layout: 'auto', vertex: { @@ -119,39 +87,28 @@ const depthTexture = device.createTexture({ usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, }); - const uniformBufferSize = 4 * 16; // 4x4 matrix const uniformBuffer = device.createBuffer({ size: uniformBufferSize, - usage: 72,// GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - mappedAtCreation: false + usage: 72,//GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + mappedAtCreation: false, }); -if (!uniformBuffer) { - console.error("Failed to create uniform buffer"); - -} - const uniformBindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ { binding: 0, + buffer: uniformBuffer, }, ], }); -if (!uniformBindGroup) { - console.error("Failed to create uniform bind group"); -} - - - const renderPassDescriptor: GPURenderPassDescriptor = { colorAttachments: [ { - view: undefined, + view: undefined, // Assigned later clearValue: [0.5, 0.5, 0.5, 1.0], loadOp: 'clear', @@ -182,12 +139,18 @@ function getTransformationMatrix() { viewMatrix ); - mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); - return modelViewProjectionMatrix as Float32Array; + mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); + + return modelViewProjectionMatrix as Float32Array; } function frame() { const transformationMatrix = getTransformationMatrix(); + console.log({ + b: transformationMatrix.buffer, + o: transformationMatrix.byteOffset, + l: transformationMatrix.byteLength, + }) device.queue.writeBuffer( uniformBuffer, 0, @@ -207,13 +170,8 @@ function frame() { passEncoder.draw(cubeVertexCount); passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - - //readGPUBuffer(device, verticesBuffer, cubeVertexArray.byteLength); - - console.log("RENDER"); - //context.present(); - // requestAnimationFrame(frame); + console.log("frame"); + requestAnimationFrame(frame); } -frame(); - +requestAnimationFrame(frame); }; \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo3.tsx b/example/src/Examples/Breathe/demo3.tsx index 79ab715a2d..4fc9a392cf 100644 --- a/example/src/Examples/Breathe/demo3.tsx +++ b/example/src/Examples/Breathe/demo3.tsx @@ -16,7 +16,7 @@ export const demo3 = async(device: GPUDevice, context: GPUCanvasContext) => { await gpuBuffer.mapAsync(1, 0, data.byteLength); // GPUMapMode.READ console.log("mapAsync done"); const arrayBuffer = gpuBuffer.getMappedRange(0, data.byteLength); - const readData = new Uint32Array(arrayBuffer); + const readData = new Float32Array(arrayBuffer); // // Output the read data console.log('Data read from the buffer:', readData); From 6bbb378a725b15919f3fae97f0a5a991423526a4 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 3 May 2024 09:09:41 +0200 Subject: [PATCH 23/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 24 ++++++------- package/cpp/wgpu/JsiBindGroupEntry.h | 16 +++++++++ package/cpp/wgpu/JsiBuffer.h | 1 + package/cpp/wgpu/JsiCommandEncoder.h | 7 ++++ package/cpp/wgpu/JsiDevice.h | 21 ++++++++++++ package/cpp/wgpu/JsiRenderPassEncoder.h | 27 ++++++++++++++- package/cpp/wgpu/JsiRenderPipeline.h | 3 ++ package/cpp/wgpu/JsiTexture.h | 3 ++ scripts/generator/generateObject.ts | 7 +++- scripts/generator/model.ts | 39 +++++++++++++--------- 10 files changed, 118 insertions(+), 30 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 62a2266789..0c7e8e3b50 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -24,7 +24,6 @@ const verticesBuffer = device.createBuffer({ new Float32Array(verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength)).set(cubeVertexArray); verticesBuffer.unmap(); - const pipeline = device.createRenderPipeline({ layout: 'auto', vertex: { @@ -93,14 +92,14 @@ const uniformBuffer = device.createBuffer({ usage: 72,//GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, mappedAtCreation: false, }); - const uniformBindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ { binding: 0, - buffer: uniformBuffer, + offset: 0, + size: uniformBufferSize, }, ], }); @@ -144,34 +143,33 @@ function getTransformationMatrix() { return modelViewProjectionMatrix as Float32Array; } -function frame() { +async function frame() { const transformationMatrix = getTransformationMatrix(); - console.log({ - b: transformationMatrix.buffer, - o: transformationMatrix.byteOffset, - l: transformationMatrix.byteLength, - }) device.queue.writeBuffer( uniformBuffer, 0, transformationMatrix.buffer, - transformationMatrix.byteOffset, + 0, transformationMatrix.byteLength ); + renderPassDescriptor.colorAttachments[0].view = context .getCurrentTexture() .createView(); const commandEncoder = device.createCommandEncoder(); const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + //passEncoder.pushDebugGroup("mygroupmarker"); passEncoder.setPipeline(pipeline); passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, verticesBuffer); + passEncoder.setVertexBuffer(0, verticesBuffer, 0, cubeVertexArray.byteLength); passEncoder.draw(cubeVertexCount); + //passEncoder.popDebugGroup(); passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - console.log("frame"); - requestAnimationFrame(frame); + await device.queue.onSubmittedWorkDone(); + console.log("DONE!"); + //requestAnimationFrame(frame); } requestAnimationFrame(frame); }; \ No newline at end of file diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index 3cb767098f..e08627bb17 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -58,6 +58,22 @@ class JsiBindGroupEntry throw jsi::JSError(runtime, "Missing mandatory prop buffer in BindGroupEntry"); } + if (obj.hasProperty(runtime, "size")) { + auto size = obj.getProperty(runtime, "size"); + + object->size = static_cast(size.getNumber()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop size in BindGroupEntry"); + } + if (obj.hasProperty(runtime, "offset")) { + auto offset = obj.getProperty(runtime, "offset"); + + object->offset = static_cast(offset.getNumber()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop offset in BindGroupEntry"); + } return object; } } diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index e8bd285c15..4a9247906a 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -28,6 +28,7 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(unmap) { getObject()->Unmap(); + return jsi::Value::undefined(); } diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index bcc45275ca..711c56ddd2 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -35,6 +35,9 @@ class JsiCommandEncoder auto descriptor = JsiRenderPassDescriptor::fromValue(runtime, arguments[0]); auto ret = getObject()->BeginRenderPass(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "beginRenderPass returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -42,6 +45,9 @@ class JsiCommandEncoder JSI_HOST_FUNCTION(finish) { auto ret = getObject()->Finish(); + if (ret == nullptr) { + throw jsi::JSError(runtime, "finish returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -55,6 +61,7 @@ class JsiCommandEncoder getObject()->CopyBufferToBuffer(*source, sourceOffset, *destination, destinationOffset, size); + return jsi::Value::undefined(); } diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index 06e1b1a7f0..53e06d24e5 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -41,6 +41,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_PROPERTY_GET(queue) { auto ret = getObject()->GetQueue(); + if (ret == nullptr) { + throw jsi::JSError(runtime, "getQueue returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -49,6 +52,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { auto descriptor = JsiBindGroupDescriptor::fromValue(runtime, arguments[0]); auto ret = getObject()->CreateBindGroup(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createBindGroup returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -58,6 +64,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JsiRenderPipelineDescriptor::fromValue(runtime, arguments[0]); auto ret = getObject()->CreateRenderPipeline(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createRenderPipeline returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -70,6 +79,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { auto baseModuleDescriptor = new wgpu::ShaderModuleDescriptor(); baseModuleDescriptor->nextInChain = &moduleDescriptorNext; auto ret = getObject()->CreateShaderModule(baseModuleDescriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createShaderModule returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -82,6 +94,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { : defaultDescriptor; auto ret = getObject()->CreateCommandEncoder(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createCommandEncoder returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -90,6 +105,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { auto descritor = JsiBufferDescriptor::fromValue(runtime, arguments[0]); auto ret = getObject()->CreateBuffer(descritor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createBuffer returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } @@ -98,6 +116,9 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { auto descriptor = JsiTextureDescriptor::fromValue(runtime, arguments[0]); auto ret = getObject()->CreateTexture(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createTexture returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index efe728a899..7f043c2146 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -34,6 +34,7 @@ class JsiRenderPassEncoder auto pipeline = JsiRenderPipeline::fromValue(runtime, arguments[0]); getObject()->SetPipeline(*pipeline); + return jsi::Value::undefined(); } @@ -53,12 +54,29 @@ class JsiRenderPassEncoder : defaultFirstInstance; getObject()->Draw(vertexCount, instanceCount, firstVertex, firstInstance); + return jsi::Value::undefined(); } JSI_HOST_FUNCTION(end) { getObject()->End(); + + return jsi::Value::undefined(); + } + + JSI_HOST_FUNCTION(pushDebugGroup) { + auto label = strdup(arguments[0].asString(runtime).utf8(runtime).c_str()); + + getObject()->PushDebugGroup(label); + + return jsi::Value::undefined(); + } + + JSI_HOST_FUNCTION(popDebugGroup) { + + getObject()->PopDebugGroup(); + return jsi::Value::undefined(); } @@ -73,7 +91,12 @@ class JsiRenderPassEncoder JSI_HOST_FUNCTION(setVertexBuffer) { auto slot = static_cast(arguments[0].getNumber()); auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); - getObject()->SetVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); + auto offset = static_cast(arguments[2].getNumber()); + auto size = static_cast(arguments[3].getNumber()); + RNSkLogger::logToConsole( + "RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, + buffer != nullptr, offset, size); + getObject()->SetVertexBuffer(slot, *buffer); return jsi::Value::undefined(); } @@ -83,6 +106,8 @@ class JsiRenderPassEncoder JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiRenderPassEncoder, setPipeline), JSI_EXPORT_FUNC(JsiRenderPassEncoder, draw), JSI_EXPORT_FUNC(JsiRenderPassEncoder, end), + JSI_EXPORT_FUNC(JsiRenderPassEncoder, pushDebugGroup), + JSI_EXPORT_FUNC(JsiRenderPassEncoder, popDebugGroup), JSI_EXPORT_FUNC(JsiRenderPassEncoder, setBindGroup), JSI_EXPORT_FUNC(JsiRenderPassEncoder, setVertexBuffer)) diff --git a/package/cpp/wgpu/JsiRenderPipeline.h b/package/cpp/wgpu/JsiRenderPipeline.h index 290e489a7a..4748d57270 100644 --- a/package/cpp/wgpu/JsiRenderPipeline.h +++ b/package/cpp/wgpu/JsiRenderPipeline.h @@ -32,6 +32,9 @@ class JsiRenderPipeline auto index = static_cast(arguments[0].getNumber()); auto ret = getObject()->GetBindGroupLayout(index); + if (ret == nullptr) { + throw jsi::JSError(runtime, "getBindGroupLayout returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/package/cpp/wgpu/JsiTexture.h b/package/cpp/wgpu/JsiTexture.h index fa397b985d..3ff9c7d023 100644 --- a/package/cpp/wgpu/JsiTexture.h +++ b/package/cpp/wgpu/JsiTexture.h @@ -29,6 +29,9 @@ class JsiTexture : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(createView) { auto ret = getObject()->CreateView(); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createView returned null"); + } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), ret)); } diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index b7819b80ea..c4cb9b24db 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -26,10 +26,12 @@ for (int i = 0; i < jsiArraySize; i++) { let unwrap = ''; if (arg.type === "bool") { unwrap = `${name}.asBool()`; + } else if (arg.type === "string") { + unwrap = `strdup(arguments[${index}].asString(runtime).utf8(runtime).c_str())`; } else if (isNumberType(arg.type)) { unwrap = unWrapType(`arguments[${index}]`, arg.type, false); } else if (isEnum(arg.type)) { - unwrap = `get${arg.type}(arguments[${index}].asString().utf8(runtime).c_str())`; + unwrap = `get${arg.type}(arguments[${index}].asString(runtime).utf8(runtime).c_str())`; } else { const name = objectName(arg.type); const className = `Jsi${name}`; @@ -108,6 +110,9 @@ const generatorMethod = (method: Method) => { args.filter(arg => arg.baseType).map(arg => baseType(arg)) } ${returns ? 'auto ret = ' : ''}getObject()->${_.upperFirst(_.camelCase(method.name))}(${argList(args)}); + ${returns ? `if (ret == nullptr) { + throw jsi::JSError(runtime, "${method.name} returned null"); + }` : ""} return ${wrapReturnValue(returns)}; } `; diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index d3407874e7..03e507628e 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -21,7 +21,6 @@ export interface Property { name: string; type: string; optional?: boolean; - default?: string; pointer?: boolean; } @@ -29,8 +28,8 @@ export interface JSIObject { name: string; host?: string; methods?: Method[]; - defaultProperties?: string; properties?: Property[]; + defaultProperties?: string; iterable?: string; } @@ -216,7 +215,9 @@ export const model: JSIObject[] = [ name: "BindGroupEntry", properties: [ { name: "binding", type: "uint32_t" }, - { name: "buffer", type: "Buffer" } + { name: "buffer", type: "Buffer" }, + { name: "size", type: "uint32_t" }, + { name: "offset", type: "uint32_t" } ] }, { @@ -235,7 +236,7 @@ export const model: JSIObject[] = [ properties: [ { name: "size", type: "uint64_t" }, {"name": "usage", "type": "BufferUsage"}, - {"name": "mappedAtCreation", "type": "bool", "default": "false"} + {"name": "mappedAtCreation", "type": "bool"} ] }, { @@ -372,7 +373,7 @@ export const model: JSIObject[] = [ std::shared_ptr promise) { RNSkLogger::logToConsole("onSubmittedWorkDone start"); auto callback = [](WGPUQueueWorkDoneStatus status, void *userdata) { - RNSkLogger::logToConsole("Buffer::onSubmittedWorkDone callback status: " + + RNSkLogger::logToConsole("onSubmittedWorkDone callback status: " + std::to_string(static_cast(status))); auto promise = static_cast(userdata); promise->resolve(jsi::Value::undefined()); @@ -422,6 +423,11 @@ export const model: JSIObject[] = [ name: "end", args: [], }, + { + name: "pushDebugGroup", + args: [{ name: "label", type: "string" }] + }, + { name: "popDebugGroup", args: [] }, { name: "setBindGroup", args: [ @@ -441,12 +447,15 @@ export const model: JSIObject[] = [ args: [ { name: "slot", type: "uint32_t" }, { name: "buffer", type: "Buffer" }, - {name: "offset", "type": "uint64_t", "defaultAtomicValue": "0"}, - {name: "size", "type": "uint64_t", "defaultAtomicValue": "0xFFFFFFFFFFFFFFFF"} + {name: "offset", "type": "uint64_t"}, + {name: "size", "type": "uint64_t"} ], implementation: `auto slot = static_cast(arguments[0].getNumber()); auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); - getObject()->SetVertexBuffer(slot, *buffer, 0, 0xFFFFFFFFFFFFFFFF); + auto offset = static_cast(arguments[2].getNumber()); + auto size = static_cast(arguments[3].getNumber()); + RNSkLogger::logToConsole("RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, buffer != nullptr, offset, size); + getObject()->SetVertexBuffer(slot, *buffer); return jsi::Value::undefined();` } ] @@ -588,15 +597,15 @@ object->sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, name: "DepthStencilState", properties: [ {"name": "format", "type": "TextureFormat"}, - {"name": "depthWriteEnabled", "type": "bool", "optional": true, "default": "false"}, - {"name": "depthCompare", "type": "CompareFunction", "optional": true, "default": "undefined"}, + {"name": "depthWriteEnabled", "type": "bool", "optional": true,}, + {"name": "depthCompare", "type": "CompareFunction", "optional": true }, {"name": "stencilFront", "type": "StencilFaceState", "optional": true}, {"name": "stencilBack", "type": "StencilFaceState", "optional": true}, - {"name": "stencilReadMask", "type": "uint32_t", "optional": true, "default": "0xFFFFFFFF"}, - {"name": "stencilWriteMask", "type": "uint32_t", "optional": true, "default": "0xFFFFFFFF"}, - {"name": "depthBias", "type": "int32_t", "optional": true, "default": "0"}, - {"name": "depthBiasSlopeScale", "type": "float", "optional": true, "default": "0.0f"}, - {"name": "depthBiasClamp", "type": "float", "optional": true, "default": "0.0f" } + {"name": "stencilReadMask", "type": "uint32_t", "optional": true }, + {"name": "stencilWriteMask", "type": "uint32_t", "optional": true}, + {"name": "depthBias", "type": "int32_t", "optional": true, }, + {"name": "depthBiasSlopeScale", "type": "float", "optional": true, }, + {"name": "depthBiasClamp", "type": "float", "optional": true } ] }, { From 046eff494a10fe7bfbd68456cc9cb60055c18e0c Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 3 May 2024 09:18:17 +0200 Subject: [PATCH 24/63] :wrench: --- example/src/Examples/Breathe/demo1/backup.ts | 175 +++++++++++ example/src/Examples/Breathe/demo1/main.ts | 310 +++++++++---------- 2 files changed, 321 insertions(+), 164 deletions(-) create mode 100644 example/src/Examples/Breathe/demo1/backup.ts diff --git a/example/src/Examples/Breathe/demo1/backup.ts b/example/src/Examples/Breathe/demo1/backup.ts new file mode 100644 index 0000000000..0c7e8e3b50 --- /dev/null +++ b/example/src/Examples/Breathe/demo1/backup.ts @@ -0,0 +1,175 @@ +import { mat4, vec3 } from 'wgpu-matrix'; + +import { + cubeVertexArray, + cubeVertexSize, + cubeUVOffset, + cubePositionOffset, + cubeVertexCount, +} from './cube'; + +import {basicVertWGSL, vertexPositionColorWGSL} from './shaders'; +import { Dimensions } from 'react-native'; + +const {width, height} = Dimensions.get("window"); + +export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { + +// Create a vertex buffer from the cube data. +const verticesBuffer = device.createBuffer({ + size: cubeVertexArray.byteLength, + usage: 32,//GPUBufferUsage.VERTEX, + mappedAtCreation: true, +}); + +new Float32Array(verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength)).set(cubeVertexArray); +verticesBuffer.unmap(); +const pipeline = device.createRenderPipeline({ + layout: 'auto', + vertex: { + module: device.createShaderModule({ + code: basicVertWGSL, + }), + entryPoint: "main", + buffers: [ + { + arrayStride: cubeVertexSize, + attributes: [ + { + // position + shaderLocation: 0, + offset: cubePositionOffset, + format: 'float32x4', + }, + { + // uv + shaderLocation: 1, + offset: cubeUVOffset, + format: 'float32x2', + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: vertexPositionColorWGSL, + }), + entryPoint: "main", + targets: [ + { + format: 'rgba8unorm', + }, + ], + }, + primitive: { + topology: 'triangle-list', + + // Backface culling since the cube is solid piece of geometry. + // Faces pointing away from the camera will be occluded by faces + // pointing toward the camera. + cullMode: 'back', + }, + + // Enable depth testing so that the fragment closest to the camera + // is rendered in front. + depthStencil: { + depthWriteEnabled: true, + depthCompare: 'less', + format: 'depth24plus', + }, +}); + +const depthTexture = device.createTexture({ + size: { width, height }, + format: 'depth24plus', + usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, +}); + +const uniformBufferSize = 4 * 16; // 4x4 matrix +const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: 72,//GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + mappedAtCreation: false, +}); +const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + offset: 0, + size: uniformBufferSize, + }, + ], +}); + +const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: 'clear', + storeOp: 'store', + }, + ], + depthStencilAttachment: { + view: depthTexture.createView(), + + depthClearValue: 1.0, + depthLoadOp: 'clear', + depthStoreOp: 'store', + }, +}; + +const aspect = width / height; +const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); +const modelViewProjectionMatrix = mat4.create(); + +function getTransformationMatrix() { + const viewMatrix = mat4.identity(); + mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); + const now = Date.now() / 1000; + mat4.rotate( + viewMatrix, + vec3.fromValues(Math.sin(now), Math.cos(now), 0), + 1, + viewMatrix + ); + + mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); + + return modelViewProjectionMatrix as Float32Array; +} + +async function frame() { + const transformationMatrix = getTransformationMatrix(); + device.queue.writeBuffer( + uniformBuffer, + 0, + transformationMatrix.buffer, + 0, + transformationMatrix.byteLength + ); + + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + + const commandEncoder = device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + //passEncoder.pushDebugGroup("mygroupmarker"); + passEncoder.setPipeline(pipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, verticesBuffer, 0, cubeVertexArray.byteLength); + passEncoder.draw(cubeVertexCount); + //passEncoder.popDebugGroup(); + passEncoder.end(); + device.queue.submit([commandEncoder.finish()]); + await device.queue.onSubmittedWorkDone(); + console.log("DONE!"); + //requestAnimationFrame(frame); +} +requestAnimationFrame(frame); +}; \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 0c7e8e3b50..2e4b024c0c 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -1,175 +1,157 @@ -import { mat4, vec3 } from 'wgpu-matrix'; +import { Dimensions } from "react-native"; +import { mat4, vec3 } from "wgpu-matrix"; -import { - cubeVertexArray, - cubeVertexSize, - cubeUVOffset, - cubePositionOffset, - cubeVertexCount, -} from './cube'; +export const basicVertWGSL = `struct Uniforms { + modelViewProjectionMatrix : mat4x4f, +} +@binding(0) @group(0) var uniforms : Uniforms; -import {basicVertWGSL, vertexPositionColorWGSL} from './shaders'; -import { Dimensions } from 'react-native'; +struct VertexOutput { + @builtin(position) Position : vec4f, + @location(0) fragUV : vec2f, + @location(1) fragPosition: vec4f, +} -const {width, height} = Dimensions.get("window"); +@vertex +fn main( + @location(0) position : vec4f, + @location(1) uv : vec2f +) -> VertexOutput { + var output : VertexOutput; + output.Position = uniforms.modelViewProjectionMatrix * position; + output.fragUV = uv; + output.fragPosition = 0.5 * (position + vec4(1.0, 1.0, 1.0, 1.0)); + return output; +}`; + +const triangleVertWGSL = `struct Uniforms { + modelViewProjectionMatrix : mat4x4f, +} +@binding(0) @group(0) var uniforms : Uniforms; + +@vertex +fn main( + @builtin(vertex_index) VertexIndex : u32 +) -> @builtin(position) vec4f { + var pos = array( + vec2(0.0, 0.5), + vec2(-0.5, -0.5), + vec2(0.5, -0.5) + ); -export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { + var p = vec4f(pos[VertexIndex], 0.0, 1.0); + return uniforms.modelViewProjectionMatrix * p; +} +`; -// Create a vertex buffer from the cube data. -const verticesBuffer = device.createBuffer({ - size: cubeVertexArray.byteLength, - usage: 32,//GPUBufferUsage.VERTEX, - mappedAtCreation: true, -}); - -new Float32Array(verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength)).set(cubeVertexArray); -verticesBuffer.unmap(); -const pipeline = device.createRenderPipeline({ - layout: 'auto', - vertex: { - module: device.createShaderModule({ - code: basicVertWGSL, - }), - entryPoint: "main", - buffers: [ - { - arrayStride: cubeVertexSize, - attributes: [ - { - // position - shaderLocation: 0, - offset: cubePositionOffset, - format: 'float32x4', - }, - { - // uv - shaderLocation: 1, - offset: cubeUVOffset, - format: 'float32x2', - }, - ], - }, - ], - }, - fragment: { - module: device.createShaderModule({ - code: vertexPositionColorWGSL, - }), - entryPoint: "main", - targets: [ - { - format: 'rgba8unorm', - }, - ], - }, - primitive: { - topology: 'triangle-list', - - // Backface culling since the cube is solid piece of geometry. - // Faces pointing away from the camera will be occluded by faces - // pointing toward the camera. - cullMode: 'back', - }, - - // Enable depth testing so that the fragment closest to the camera - // is rendered in front. - depthStencil: { - depthWriteEnabled: true, - depthCompare: 'less', - format: 'depth24plus', - }, -}); - -const depthTexture = device.createTexture({ - size: { width, height }, - format: 'depth24plus', - usage: 16,//GPUTextureUsage.RENDER_ATTACHMENT, -}); - -const uniformBufferSize = 4 * 16; // 4x4 matrix -const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: 72,//GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - mappedAtCreation: false, -}); -const uniformBindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - buffer: uniformBuffer, - offset: 0, - size: uniformBufferSize, - }, - ], -}); +const redFragWGSL = `@fragment +fn main() -> @location(0) vec4f { + return vec4(1.0, 0.0, 1.0, 1.0); +}`; -const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: undefined, // Assigned later +const { width, height } = Dimensions.get("window"); - clearValue: [0.5, 0.5, 0.5, 1.0], - loadOp: 'clear', - storeOp: 'store', +export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { + const presentationFormat = "rgba8unorm"; + + const pipeline = device.createRenderPipeline({ + layout: "auto", + vertex: { + module: device.createShaderModule({ + code: triangleVertWGSL, + }), + entryPoint: "main", }, - ], - depthStencilAttachment: { - view: depthTexture.createView(), - - depthClearValue: 1.0, - depthLoadOp: 'clear', - depthStoreOp: 'store', - }, -}; + fragment: { + module: device.createShaderModule({ + code: redFragWGSL, + }), + entryPoint: "main", + targets: [ + { + format: presentationFormat, + }, + ], + }, + primitive: { + topology: "triangle-list", + }, + }); -const aspect = width / height; -const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); -const modelViewProjectionMatrix = mat4.create(); - -function getTransformationMatrix() { - const viewMatrix = mat4.identity(); - mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); - const now = Date.now() / 1000; - mat4.rotate( - viewMatrix, - vec3.fromValues(Math.sin(now), Math.cos(now), 0), + const aspect = width / height; + const projectionMatrix = mat4.perspective( + (2 * Math.PI) / 5, + aspect, 1, - viewMatrix + 100.0 ); - - mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); - - return modelViewProjectionMatrix as Float32Array; -} - -async function frame() { - const transformationMatrix = getTransformationMatrix(); - device.queue.writeBuffer( - uniformBuffer, - 0, - transformationMatrix.buffer, - 0, - transformationMatrix.byteLength - ); - - renderPassDescriptor.colorAttachments[0].view = context - .getCurrentTexture() - .createView(); - - const commandEncoder = device.createCommandEncoder(); - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - //passEncoder.pushDebugGroup("mygroupmarker"); - passEncoder.setPipeline(pipeline); - passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, verticesBuffer, 0, cubeVertexArray.byteLength); - passEncoder.draw(cubeVertexCount); - //passEncoder.popDebugGroup(); - passEncoder.end(); - device.queue.submit([commandEncoder.finish()]); - await device.queue.onSubmittedWorkDone(); - console.log("DONE!"); - //requestAnimationFrame(frame); -} -requestAnimationFrame(frame); -}; \ No newline at end of file + const modelViewProjectionMatrix = mat4.create(); + + function getTransformationMatrix() { + const viewMatrix = mat4.identity(); + mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); + const now = Date.now() / 1000; + mat4.rotate( + viewMatrix, + vec3.fromValues(Math.sin(now), Math.cos(now), 0), + 1, + viewMatrix + ); + + mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); + + return modelViewProjectionMatrix as Float32Array; + } + const uniformBufferSize = 4 * 16; // 4x4 matrix + const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: 72, //GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + mappedAtCreation: false, + }); + + function frame() { + const transformationMatrix = getTransformationMatrix(); + const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + offset: 0, + size: uniformBufferSize, + }, + ], + }); + device.queue.writeBuffer( + uniformBuffer, + 0, + transformationMatrix.buffer, + 0, + transformationMatrix.byteLength + ); + const commandEncoder = device.createCommandEncoder(); + const textureView = context.getCurrentTexture().createView(); + + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: textureView, + clearValue: [0.3, 0.6, 1.0, 1], + loadOp: "clear", + storeOp: "store", + }, + ], + }; + + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.draw(3); + passEncoder.end(); + + device.queue.submit([commandEncoder.finish()]); + console.log("RENDER"); + requestAnimationFrame(frame); + } + frame(); +}; From d81e8b2caa5f6b2b87ccdca351a7481cbe4bd84f Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 3 May 2024 09:23:30 +0200 Subject: [PATCH 25/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 2e4b024c0c..e253fa4a03 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -109,19 +109,21 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { mappedAtCreation: false, }); + const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + offset: 0, + size: uniformBufferSize, + }, + ], + }); + function frame() { const transformationMatrix = getTransformationMatrix(); - const uniformBindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - buffer: uniformBuffer, - offset: 0, - size: uniformBufferSize, - }, - ], - }); + device.queue.writeBuffer( uniformBuffer, 0, @@ -150,7 +152,7 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - console.log("RENDER"); + context.present(); requestAnimationFrame(frame); } frame(); From 9a0dd5a984120bc55f494ac719cdc8eaaa84b372 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 3 May 2024 14:12:58 +0200 Subject: [PATCH 26/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 18 +- example/src/Examples/Breathe/demo1/main.ts | 181 +++++++++++---------- 2 files changed, 101 insertions(+), 98 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 1ce6124792..240ecd4107 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -1,8 +1,6 @@ -import React, { useEffect, useRef } from "react"; -import { - gpu, - SkiaDomView, -} from "@shopify/react-native-skia"; +import React, { useEffect, useRef } from "react"; +import { gpu, SkiaDomView } from "@shopify/react-native-skia"; + import { demo3 } from "./demo3"; import { demo2 } from "./demo2"; import { demo1 } from "./demo1/main"; @@ -10,11 +8,11 @@ import { demo1 } from "./demo1/main"; const draw = async (context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); const device = await adapter!.requestDevice(); - const presentationFormat = 'rgba8unorm'; + const presentationFormat = "rgba8unorm"; context.configure({ device, format: presentationFormat, - alphaMode: 'premultiplied', + alphaMode: "premultiplied", }); await demo1(device, context); context.present(); @@ -25,11 +23,9 @@ export const Breathe = () => { useEffect(() => { setTimeout(() => { const ctx = ref.current!.getWGPUContext(); - + draw(ctx); }, 1000); }, []); - return ( - - ); + return ; }; diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index e253fa4a03..95a1bef4cf 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -1,75 +1,64 @@ -import { Dimensions } from "react-native"; import { mat4, vec3 } from "wgpu-matrix"; +import { Dimensions } from "react-native"; -export const basicVertWGSL = `struct Uniforms { - modelViewProjectionMatrix : mat4x4f, -} -@binding(0) @group(0) var uniforms : Uniforms; - -struct VertexOutput { - @builtin(position) Position : vec4f, - @location(0) fragUV : vec2f, - @location(1) fragPosition: vec4f, -} - -@vertex -fn main( - @location(0) position : vec4f, - @location(1) uv : vec2f -) -> VertexOutput { - var output : VertexOutput; - output.Position = uniforms.modelViewProjectionMatrix * position; - output.fragUV = uv; - output.fragPosition = 0.5 * (position + vec4(1.0, 1.0, 1.0, 1.0)); - return output; -}`; - -const triangleVertWGSL = `struct Uniforms { - modelViewProjectionMatrix : mat4x4f, -} -@binding(0) @group(0) var uniforms : Uniforms; - -@vertex -fn main( - @builtin(vertex_index) VertexIndex : u32 -) -> @builtin(position) vec4f { - var pos = array( - vec2(0.0, 0.5), - vec2(-0.5, -0.5), - vec2(0.5, -0.5) - ); - - var p = vec4f(pos[VertexIndex], 0.0, 1.0); - return uniforms.modelViewProjectionMatrix * p; -} -`; - -const redFragWGSL = `@fragment -fn main() -> @location(0) vec4f { - return vec4(1.0, 0.0, 1.0, 1.0); -}`; +import { + cubeVertexArray, + cubeVertexSize, + cubeUVOffset, + cubePositionOffset, + cubeVertexCount, +} from "./cube"; +import { basicVertWGSL, vertexPositionColorWGSL } from "./shaders"; const { width, height } = Dimensions.get("window"); export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { - const presentationFormat = "rgba8unorm"; + // Create a vertex buffer from the cube data. + const verticesBuffer = device.createBuffer({ + size: cubeVertexArray.byteLength, + usage: 32, //GPUBufferUsage.VERTEX, + mappedAtCreation: true, + }); + new Float32Array( + verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength) + ).set(cubeVertexArray); + verticesBuffer.unmap(); const pipeline = device.createRenderPipeline({ layout: "auto", vertex: { module: device.createShaderModule({ - code: triangleVertWGSL, + code: basicVertWGSL, }), entryPoint: "main", + buffers: [ + { + arrayStride: cubeVertexSize, + attributes: [ + { + // position + shaderLocation: 0, + offset: cubePositionOffset, + format: "float32x4", + }, + { + // uv + shaderLocation: 1, + offset: cubeUVOffset, + format: "float32x2", + }, + ], + }, + ], }, fragment: { module: device.createShaderModule({ - code: redFragWGSL, + code: vertexPositionColorWGSL, }), entryPoint: "main", targets: [ { - format: presentationFormat, + format: "rgba8unorm", }, ], }, @@ -78,6 +67,42 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { }, }); + const depthTexture = device.createTexture({ + size: { width, height }, + format: "depth24plus", + usage: 16, //GPUTextureUsage.RENDER_ATTACHMENT, + }); + + const uniformBufferSize = 4 * 16; // 4x4 matrix + const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: 72, //GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + mappedAtCreation: false, + }); + const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + offset: 0, + size: uniformBufferSize, + }, + ], + }); + + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: "clear", + storeOp: "store", + }, + ], + }; + const aspect = width / height; const projectionMatrix = mat4.perspective( (2 * Math.PI) / 5, @@ -102,28 +127,9 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { return modelViewProjectionMatrix as Float32Array; } - const uniformBufferSize = 4 * 16; // 4x4 matrix - const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: 72, //GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - mappedAtCreation: false, - }); - const uniformBindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - buffer: uniformBuffer, - offset: 0, - size: uniformBufferSize, - }, - ], - }); - - function frame() { + async function frame() { const transformationMatrix = getTransformationMatrix(); - device.queue.writeBuffer( uniformBuffer, 0, @@ -131,29 +137,30 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { 0, transformationMatrix.byteLength ); - const commandEncoder = device.createCommandEncoder(); - const textureView = context.getCurrentTexture().createView(); - const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: textureView, - clearValue: [0.3, 0.6, 1.0, 1], - loadOp: "clear", - storeOp: "store", - }, - ], - }; + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + const commandEncoder = device.createCommandEncoder(); const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + //passEncoder.pushDebugGroup("mygroupmarker"); passEncoder.setPipeline(pipeline); passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.draw(3); + passEncoder.setVertexBuffer( + 0, + verticesBuffer, + 0, + cubeVertexArray.byteLength + ); + passEncoder.draw(cubeVertexCount); + //passEncoder.popDebugGroup(); passEncoder.end(); - device.queue.submit([commandEncoder.finish()]); + await device.queue.onSubmittedWorkDone(); context.present(); + console.log("DONE!"); requestAnimationFrame(frame); } - frame(); + requestAnimationFrame(frame); }; From 5fbbad16412ea06273f9ae198257beb88f2ab5fe Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 3 May 2024 17:19:28 +0200 Subject: [PATCH 27/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 5 +- example/src/Examples/Breathe/demo1/demo4.ts | 238 ++++++++++++++++++ example/src/Examples/Breathe/demo1/main.ts | 17 +- example/src/Examples/Breathe/demo1/shaders.ts | 3 +- package/cpp/wgpu/JsiQueue.h | 2 +- package/cpp/wgpu/JsiRenderPassDescriptor.h | 8 +- package/cpp/wgpu/JsiWGPUContext.h | 1 + 7 files changed, 265 insertions(+), 9 deletions(-) create mode 100644 example/src/Examples/Breathe/demo1/demo4.ts diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 240ecd4107..441cb385c9 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -4,6 +4,7 @@ import { gpu, SkiaDomView } from "@shopify/react-native-skia"; import { demo3 } from "./demo3"; import { demo2 } from "./demo2"; import { demo1 } from "./demo1/main"; +import { demo4 } from "./demo1/demo4"; const draw = async (context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); @@ -14,8 +15,8 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: "premultiplied", }); - await demo1(device, context); - context.present(); + await demo4(device, context); + //context.present(); }; export const Breathe = () => { diff --git a/example/src/Examples/Breathe/demo1/demo4.ts b/example/src/Examples/Breathe/demo1/demo4.ts new file mode 100644 index 0000000000..ff1f19ee43 --- /dev/null +++ b/example/src/Examples/Breathe/demo1/demo4.ts @@ -0,0 +1,238 @@ +import { mat4, vec3 } from "wgpu-matrix"; +import { Dimensions } from "react-native"; + +import { + cubeVertexArray, + cubeVertexSize, + cubeUVOffset, + cubePositionOffset, + cubeVertexCount, +} from "./cube"; +import { basicVertWGSL, vertexPositionColorWGSL } from "./shaders"; + +const { width, height } = Dimensions.get("window"); + +export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { + // Create a vertex buffer from the cube data. + const verticesBuffer = device.createBuffer({ + size: cubeVertexArray.byteLength, + usage: 32, //GPUBufferUsage.VERTEX, + mappedAtCreation: true, + }); + + new Float32Array( + verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength) + ).set(cubeVertexArray); + verticesBuffer.unmap(); + const pipeline = device.createRenderPipeline({ + layout: "auto", + vertex: { + module: device.createShaderModule({ + code: basicVertWGSL, + }), + entryPoint: "main", + buffers: [ + { + arrayStride: cubeVertexSize, + attributes: [ + { + // position + shaderLocation: 0, + offset: cubePositionOffset, + format: "float32x4", + }, + { + // uv + shaderLocation: 1, + offset: cubeUVOffset, + format: "float32x2", + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: vertexPositionColorWGSL, + }), + entryPoint: "main", + targets: [ + { + format: "rgba8unorm", + }, + ], + }, + primitive: { + topology: "triangle-list", + + // Backface culling since the cube is solid piece of geometry. + // Faces pointing away from the camera will be occluded by faces + // pointing toward the camera. + cullMode: "back", + }, + + // Enable depth testing so that the fragment closest to the camera + // is rendered in front. + // depthStencil: { + // depthWriteEnabled: true, + // depthCompare: "less", + // format: "depth24plus", + // }, + }); + + // const depthTexture = device.createTexture({ + // size: { width, height }, + // format: "depth24plus", + // usage: GPUTextureUsage.RENDER_ATTACHMENT, + // }); + + const matrixSize = 4 * 16; // 4x4 matrix + const offset = 256; // uniformBindGroup offset must be 256-byte aligned + const uniformBufferSize = offset + matrixSize; + + const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: 72, //GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + mappedAtCreation: false, + }); + + const uniformBindGroup1 = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + offset: 0, + size: matrixSize, + }, + ], + }); + + const uniformBindGroup2 = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + buffer: uniformBuffer, + offset: offset, + size: matrixSize, + }, + ], + }); + + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: "clear", + storeOp: "store", + }, + ], + // depthStencilAttachment: { + // view: depthTexture.createView(), + + // depthClearValue: 1.0, + // depthLoadOp: "clear", + // depthStoreOp: "store", + // }, + }; + + const aspect = width / height; + const projectionMatrix = mat4.perspective( + (2 * Math.PI) / 5, + aspect, + 1, + 100.0 + ); + + const modelMatrix1 = mat4.translation(vec3.create(-2, 0, 0)); + const modelMatrix2 = mat4.translation(vec3.create(2, 0, 0)); + const modelViewProjectionMatrix1 = mat4.create() as Float32Array; + const modelViewProjectionMatrix2 = mat4.create() as Float32Array; + const viewMatrix = mat4.translation(vec3.fromValues(0, 0, -7)); + + const tmpMat41 = mat4.create(); + const tmpMat42 = mat4.create(); + + function updateTransformationMatrix() { + const now = Date.now() / 1000; + + mat4.rotate( + modelMatrix1, + vec3.fromValues(Math.sin(now), Math.cos(now), 0), + 1, + tmpMat41 + ); + mat4.rotate( + modelMatrix2, + vec3.fromValues(Math.cos(now), Math.sin(now), 0), + 1, + tmpMat42 + ); + + mat4.multiply(viewMatrix, tmpMat41, modelViewProjectionMatrix1); + mat4.multiply( + projectionMatrix, + modelViewProjectionMatrix1, + modelViewProjectionMatrix1 + ); + mat4.multiply(viewMatrix, tmpMat42, modelViewProjectionMatrix2); + mat4.multiply( + projectionMatrix, + modelViewProjectionMatrix2, + modelViewProjectionMatrix2 + ); + } + + async function frame() { + updateTransformationMatrix(); + console.log({modelViewProjectionMatrix1, modelViewProjectionMatrix2}); + console.log({ byteOffset: modelViewProjectionMatrix1.byteOffset }); + console.log({ byteOffset2: modelViewProjectionMatrix2.byteOffset }); + console.log({ length: modelViewProjectionMatrix1.byteLength }); + console.log({ length2: modelViewProjectionMatrix2.byteLength }); + device.queue.writeBuffer( + uniformBuffer, + 0, + modelViewProjectionMatrix1.buffer, + modelViewProjectionMatrix1.byteOffset, + modelViewProjectionMatrix1.byteLength + ); + device.queue.writeBuffer( + uniformBuffer, + offset, + modelViewProjectionMatrix2.buffer, + modelViewProjectionMatrix2.byteOffset, + modelViewProjectionMatrix2.byteLength + ); + + + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + + const commandEncoder = device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.setVertexBuffer(0, verticesBuffer, + 0, + cubeVertexArray.byteLength); + + // Bind the bind group (with the transformation matrix) for + // each cube, and draw. + passEncoder.setBindGroup(0, uniformBindGroup1); + passEncoder.draw(cubeVertexCount); + + passEncoder.setBindGroup(0, uniformBindGroup2); + passEncoder.draw(cubeVertexCount); + + passEncoder.end(); + device.queue.submit([commandEncoder.finish()]); + await device.queue.onSubmittedWorkDone(); + context.present(); + requestAnimationFrame(frame); + } + requestAnimationFrame(frame); +}; diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 95a1bef4cf..6fb60e015b 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -62,8 +62,14 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { }, ], }, + // depthStencil: { + // depthWriteEnabled: true, + // depthCompare: "less", + // format: "depth24plus", + // }, primitive: { topology: "triangle-list", + cullMode: "back", }, }); @@ -101,6 +107,13 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { storeOp: "store", }, ], + // depthStencilAttachment: { + // view: depthTexture.createView(), + + // depthClearValue: 1.0, + // depthLoadOp: 'clear', + // depthStoreOp: 'store', + // }, }; const aspect = width / height; @@ -128,7 +141,7 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { return modelViewProjectionMatrix as Float32Array; } - async function frame() { + function frame() { const transformationMatrix = getTransformationMatrix(); device.queue.writeBuffer( uniformBuffer, @@ -157,7 +170,7 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { //passEncoder.popDebugGroup(); passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - await device.queue.onSubmittedWorkDone(); + //await device.queue.onSubmittedWorkDone(); context.present(); console.log("DONE!"); requestAnimationFrame(frame); diff --git a/example/src/Examples/Breathe/demo1/shaders.ts b/example/src/Examples/Breathe/demo1/shaders.ts index ee8ad26a64..020f74384e 100644 --- a/example/src/Examples/Breathe/demo1/shaders.ts +++ b/example/src/Examples/Breathe/demo1/shaders.ts @@ -27,4 +27,5 @@ fn main( output.fragUV = uv; output.fragPosition = 0.5 * (position + vec4(1.0, 1.0, 1.0, 1.0)); return output; -}`; \ No newline at end of file +} +`; diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 0287a032e7..c55d693f68 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -40,10 +40,10 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(writeBuffer) { - auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); + auto offset2 = static_cast(arguments[3].getNumber()); auto size = static_cast(arguments[4].getNumber()); getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); diff --git a/package/cpp/wgpu/JsiRenderPassDescriptor.h b/package/cpp/wgpu/JsiRenderPassDescriptor.h index ae517b8084..338b443a15 100644 --- a/package/cpp/wgpu/JsiRenderPassDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPassDescriptor.h @@ -68,10 +68,12 @@ class JsiRenderPassDescriptor if (obj.hasProperty(runtime, "depthStencilAttachment")) { auto depthStencilAttachment = obj.getProperty(runtime, "depthStencilAttachment"); - - object->depthStencilAttachment = - JsiRenderPassDepthStencilAttachment::fromValue( + RNSkLogger::logToConsole("depthStencilAttachment"); + auto att = JsiRenderPassDepthStencilAttachment::fromValue( runtime, depthStencilAttachment); + + RNSkLogger::logToConsole("depthStencilAttachment: %d", att->view != nullptr); + object->depthStencilAttachment = att; } return object; } diff --git a/package/cpp/wgpu/JsiWGPUContext.h b/package/cpp/wgpu/JsiWGPUContext.h index 69fde17d49..799dc353c1 100644 --- a/package/cpp/wgpu/JsiWGPUContext.h +++ b/package/cpp/wgpu/JsiWGPUContext.h @@ -41,6 +41,7 @@ class JsiWGPUContext : public JsiSkWrappingSharedPtrHostObject { swapChainDesc.format = wgpu::TextureFormat::RGBA8Unorm; // surface.GetPreferredFormat(adapter); swapChainDesc.presentMode = wgpu::PresentMode::Fifo; + // swapChainDesc.compositingAlphaMode = wgpu::CompositingAlphaMode::PreMultiplied; _surface = std::make_shared(surface); _swapChain = std::make_shared( device->CreateSwapChain(surface, &swapChainDesc)); From eb7fb33e1676017f2762e9f101737b4dc21f6a63 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 13:11:42 +0200 Subject: [PATCH 28/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 3 +- example/src/Examples/Breathe/demo1/demo4.ts | 5 - example/src/Examples/Breathe/demo1/demo5.ts | 219 ++++++++++++++++++ example/src/Examples/Breathe/demo1/shaders.ts | 27 +++ package/cpp/rnskia/RNSkManager.cpp | 4 + package/cpp/wgpu/JsiBuffer.h | 6 +- package/cpp/wgpu/JsiConstants.h | 100 ++++++++ package/cpp/wgpu/JsiQueue.h | 7 +- package/cpp/wgpu/JsiRenderPassDescriptor.h | 8 +- package/cpp/wgpu/JsiWGPUContext.h | 3 +- scripts/generator/constants.ts | 67 ++++++ scripts/generator/model.ts | 4 +- scripts/generator/webgpu-bindings.ts | 2 + 13 files changed, 435 insertions(+), 20 deletions(-) create mode 100644 example/src/Examples/Breathe/demo1/demo5.ts create mode 100644 package/cpp/wgpu/JsiConstants.h create mode 100644 scripts/generator/constants.ts diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 441cb385c9..0fa8debc58 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -5,6 +5,7 @@ import { demo3 } from "./demo3"; import { demo2 } from "./demo2"; import { demo1 } from "./demo1/main"; import { demo4 } from "./demo1/demo4"; +import { demo5 } from "./demo1/demo5"; const draw = async (context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); @@ -15,7 +16,7 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: "premultiplied", }); - await demo4(device, context); + await demo5(device, context); //context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/demo4.ts b/example/src/Examples/Breathe/demo1/demo4.ts index ff1f19ee43..5c1716fdd9 100644 --- a/example/src/Examples/Breathe/demo1/demo4.ts +++ b/example/src/Examples/Breathe/demo1/demo4.ts @@ -188,11 +188,6 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { async function frame() { updateTransformationMatrix(); - console.log({modelViewProjectionMatrix1, modelViewProjectionMatrix2}); - console.log({ byteOffset: modelViewProjectionMatrix1.byteOffset }); - console.log({ byteOffset2: modelViewProjectionMatrix2.byteOffset }); - console.log({ length: modelViewProjectionMatrix1.byteLength }); - console.log({ length2: modelViewProjectionMatrix2.byteLength }); device.queue.writeBuffer( uniformBuffer, 0, diff --git a/example/src/Examples/Breathe/demo1/demo5.ts b/example/src/Examples/Breathe/demo1/demo5.ts new file mode 100644 index 0000000000..da050cf593 --- /dev/null +++ b/example/src/Examples/Breathe/demo1/demo5.ts @@ -0,0 +1,219 @@ +import { mat4, vec3 } from "wgpu-matrix"; +import { Dimensions } from "react-native"; + +import { + cubeVertexArray, + cubeVertexSize, + cubeUVOffset, + cubePositionOffset, + cubeVertexCount, +} from "./cube"; +import { basicVertWGSL, instancedVertWGSL, vertexPositionColorWGSL } from "./shaders"; + +const { width, height } = Dimensions.get("window"); + +export const demo5 = async (device: GPUDevice, context: GPUCanvasContext) => { + +// Create a vertex buffer from the cube data. +const verticesBuffer = device.createBuffer({ + size: cubeVertexArray.byteLength, + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true, +}); +new Float32Array(verticesBuffer.getMappedRange()).set(cubeVertexArray); +verticesBuffer.unmap(); + +const pipeline = device.createRenderPipeline({ + layout: 'auto', + vertex: { + module: device.createShaderModule({ + code: instancedVertWGSL, + }), + entryPoint: "main", + buffers: [ + { + arrayStride: cubeVertexSize, + attributes: [ + { + // position + shaderLocation: 0, + offset: cubePositionOffset, + format: 'float32x4', + }, + { + // uv + shaderLocation: 1, + offset: cubeUVOffset, + format: 'float32x2', + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: vertexPositionColorWGSL, + }), + entryPoint: "main", + targets: [ + { + format: 'rgba8unorm', + }, + ], + }, + primitive: { + topology: 'triangle-list', + + // Backface culling since the cube is solid piece of geometry. + // Faces pointing away from the camera will be occluded by faces + // pointing toward the camera. + cullMode: 'back', + }, + + // Enable depth testing so that the fragment closest to the camera + // is rendered in front. + depthStencil: { + depthWriteEnabled: true, + depthCompare: 'less', + format: 'depth24plus', + }, +}); + +const depthTexture = device.createTexture({ + size: { width, height }, + format: 'depth24plus', + usage: GPUTextureUsage.RENDER_ATTACHMENT, +}); + +const xCount = 4; +const yCount = 4; +const numInstances = xCount * yCount; +const matrixFloatCount = 16; // 4x4 matrix +const matrixSize = 4 * matrixFloatCount; +const uniformBufferSize = numInstances * matrixSize; + +// Allocate a buffer large enough to hold transforms for every +// instance. +const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, +}); + +const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: uniformBuffer, + }, + }, + ], +}); + +const aspect = width / height; +const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); + +type Mat4 = mat4.default; +const modelMatrices = new Array(numInstances); +const mvpMatricesData = new Float32Array(matrixFloatCount * numInstances); + +const step = 4.0; + +// Initialize the matrix data for every instance. +let m = 0; +for (let x = 0; x < xCount; x++) { + for (let y = 0; y < yCount; y++) { + modelMatrices[m] = mat4.translation( + vec3.fromValues( + step * (x - xCount / 2 + 0.5), + step * (y - yCount / 2 + 0.5), + 0 + ) + ); + m++; + } +} + +const viewMatrix = mat4.translation(vec3.fromValues(0, 0, -12)); + +const tmpMat4 = mat4.create(); + +// Update the transformation matrix data for each instance. +function updateTransformationMatrix() { + const now = Date.now() / 1000; + + let m = 0, + i = 0; + for (let x = 0; x < xCount; x++) { + for (let y = 0; y < yCount; y++) { + mat4.rotate( + modelMatrices[i], + vec3.fromValues( + Math.sin((x + 0.5) * now), + Math.cos((y + 0.5) * now), + 0 + ), + 1, + tmpMat4 + ); + + mat4.multiply(viewMatrix, tmpMat4, tmpMat4); + mat4.multiply(projectionMatrix, tmpMat4, tmpMat4); + + mvpMatricesData.set(tmpMat4, m); + + i++; + m += matrixFloatCount; + } + } +} + +const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: 'clear', + storeOp: 'store', + }, + ], + // depthStencilAttachment: { + // view: depthTexture.createView(), + + // depthClearValue: 1.0, + // depthLoadOp: 'clear', + // depthStoreOp: 'store', + // }, +}; + +function frame() { + // Update the matrix data. + updateTransformationMatrix(); + device.queue.writeBuffer( + uniformBuffer, + 0, + mvpMatricesData.buffer, + mvpMatricesData.byteOffset, + mvpMatricesData.byteLength + ); + + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + + const commandEncoder = device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, verticesBuffer); + passEncoder.draw(cubeVertexCount, numInstances, 0, 0); + passEncoder.end(); + device.queue.submit([commandEncoder.finish()]); + context.present(); + requestAnimationFrame(frame); +} +requestAnimationFrame(frame); + +}; diff --git a/example/src/Examples/Breathe/demo1/shaders.ts b/example/src/Examples/Breathe/demo1/shaders.ts index 020f74384e..fb456d2698 100644 --- a/example/src/Examples/Breathe/demo1/shaders.ts +++ b/example/src/Examples/Breathe/demo1/shaders.ts @@ -29,3 +29,30 @@ fn main( return output; } `; + +export const instancedVertWGSL = ` +struct Uniforms { + modelViewProjectionMatrix : array, +} + +@binding(0) @group(0) var uniforms : Uniforms; + +struct VertexOutput { + @builtin(position) Position : vec4f, + @location(0) fragUV : vec2f, + @location(1) fragPosition: vec4f, +} + +@vertex +fn main( + @builtin(instance_index) instanceIdx : u32, + @location(0) position : vec4f, + @location(1) uv : vec2f +) -> VertexOutput { + var output : VertexOutput; + output.Position = uniforms.modelViewProjectionMatrix[instanceIdx] * position; + output.fragUV = uv; + output.fragPosition = 0.5 * (position + vec4(1.0)); + return output; +} +`; diff --git a/package/cpp/rnskia/RNSkManager.cpp b/package/cpp/rnskia/RNSkManager.cpp index 2aa430d318..9e155934bc 100644 --- a/package/cpp/rnskia/RNSkManager.cpp +++ b/package/cpp/rnskia/RNSkManager.cpp @@ -5,6 +5,7 @@ #include +#include "JsiConstants.h" #include "JsiGPU.h" #include "JsiSkApi.h" #include "RNSkJsiViewApi.h" @@ -72,6 +73,9 @@ void RNSkManager::installBindings() { // provided runtime. auto gpu = std::make_shared(_platformContext, _platformContext->getInstance()); + + installConstants(*_jsRuntime); + _jsRuntime->global().setProperty( *_jsRuntime, "GPU", jsi::Object::createFromHostObject(*_jsRuntime, std::move(gpu))); diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index 4a9247906a..c234a54b2b 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -63,8 +63,10 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(getMappedRange) { - size_t offset = static_cast(arguments[0].getNumber()); - size_t size = static_cast(arguments[1].getNumber()); + size_t offset = + count > 0 ? static_cast(arguments[0].getNumber()) : 0; + size_t size = count > 1 ? static_cast(arguments[1].getNumber()) + : getObject()->GetSize(); auto usage = getObject()->GetUsage(); void *data = (usage & wgpu::BufferUsage::MapWrite) ? getObject()->GetMappedRange(offset, size) diff --git a/package/cpp/wgpu/JsiConstants.h b/package/cpp/wgpu/JsiConstants.h new file mode 100644 index 0000000000..023225be67 --- /dev/null +++ b/package/cpp/wgpu/JsiConstants.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dawn/webgpu_cpp.h" + +namespace RNSkia { + +void installConstants(jsi::Runtime &runtime) { + + jsi::Object GPUBufferUsage(runtime); + GPUBufferUsage.setProperty( + runtime, "MAP_READ", + jsi::Value(static_cast(wgpu::BufferUsage::MapRead))); + GPUBufferUsage.setProperty( + runtime, "MAP_WRITE", + jsi::Value(static_cast(wgpu::BufferUsage::MapWrite))); + GPUBufferUsage.setProperty( + runtime, "COPY_SRC", + jsi::Value(static_cast(wgpu::BufferUsage::CopySrc))); + GPUBufferUsage.setProperty( + runtime, "COPY_DST", + jsi::Value(static_cast(wgpu::BufferUsage::CopyDst))); + GPUBufferUsage.setProperty( + runtime, "INDEX", + jsi::Value(static_cast(wgpu::BufferUsage::Index))); + GPUBufferUsage.setProperty( + runtime, "VERTEX", + jsi::Value(static_cast(wgpu::BufferUsage::Vertex))); + GPUBufferUsage.setProperty( + runtime, "UNIFORM", + jsi::Value(static_cast(wgpu::BufferUsage::Uniform))); + GPUBufferUsage.setProperty( + runtime, "STORAGE", + jsi::Value(static_cast(wgpu::BufferUsage::Storage))); + GPUBufferUsage.setProperty( + runtime, "INDIRECT", + jsi::Value(static_cast(wgpu::BufferUsage::Indirect))); + GPUBufferUsage.setProperty( + runtime, "QUERY_RESOLVE", + jsi::Value(static_cast(wgpu::BufferUsage::QueryResolve))); + runtime.global().setProperty(runtime, "GPUBufferUsage", GPUBufferUsage); + + jsi::Object GPUColorWrite(runtime); + GPUBufferUsage.setProperty( + runtime, "RED", + jsi::Value(static_cast(wgpu::ColorWriteMask::Red))); + GPUBufferUsage.setProperty( + runtime, "GREEN", + jsi::Value(static_cast(wgpu::ColorWriteMask::Green))); + GPUBufferUsage.setProperty( + runtime, "BLUE", + jsi::Value(static_cast(wgpu::ColorWriteMask::Blue))); + GPUBufferUsage.setProperty( + runtime, "ALPHA", + jsi::Value(static_cast(wgpu::ColorWriteMask::Alpha))); + GPUBufferUsage.setProperty( + runtime, "ALL", + jsi::Value(static_cast(wgpu::ColorWriteMask::All))); + runtime.global().setProperty(runtime, "GPUColorWrite", GPUColorWrite); + + jsi::Object GPUMapMode(runtime); + GPUBufferUsage.setProperty( + runtime, "READ", jsi::Value(static_cast(wgpu::MapMode::Read))); + GPUBufferUsage.setProperty( + runtime, "WRITE", jsi::Value(static_cast(wgpu::MapMode::Write))); + runtime.global().setProperty(runtime, "GPUMapMode", GPUMapMode); + + jsi::Object GPUShaderStage(runtime); + GPUBufferUsage.setProperty( + runtime, "VERTEX", + jsi::Value(static_cast(wgpu::ShaderStage::Vertex))); + GPUBufferUsage.setProperty( + runtime, "FRAGMENT", + jsi::Value(static_cast(wgpu::ShaderStage::Fragment))); + GPUBufferUsage.setProperty( + runtime, "COMPUTE", + jsi::Value(static_cast(wgpu::ShaderStage::Compute))); + runtime.global().setProperty(runtime, "GPUShaderStage", GPUShaderStage); + + jsi::Object GPUTextureUsage(runtime); + GPUBufferUsage.setProperty( + runtime, "COPY_SRC", + jsi::Value(static_cast(wgpu::TextureUsage::CopySrc))); + GPUBufferUsage.setProperty( + runtime, "COPY_DST", + jsi::Value(static_cast(wgpu::TextureUsage::CopyDst))); + GPUBufferUsage.setProperty( + runtime, "TEXTURE_BINDING", + jsi::Value(static_cast(wgpu::TextureUsage::TextureBinding))); + GPUBufferUsage.setProperty( + runtime, "STORAGE_BINDING", + jsi::Value(static_cast(wgpu::TextureUsage::StorageBinding))); + GPUBufferUsage.setProperty( + runtime, "RENDER_ATTACHMENT", + jsi::Value(static_cast(wgpu::TextureUsage::RenderAttachment))); + runtime.global().setProperty(runtime, "GPUTextureUsage", GPUTextureUsage); +} + +} // namespace RNSkia \ No newline at end of file diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index c55d693f68..65641dc524 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -40,10 +40,10 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(writeBuffer) { + auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); - auto offset2 = static_cast(arguments[3].getNumber()); auto size = static_cast(arguments[4].getNumber()); getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); return jsi::Value::undefined(); @@ -59,9 +59,8 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { std::shared_ptr promise) { RNSkLogger::logToConsole("onSubmittedWorkDone start"); auto callback = [](WGPUQueueWorkDoneStatus status, void *userdata) { - RNSkLogger::logToConsole( - "Buffer::onSubmittedWorkDone callback status: " + - std::to_string(static_cast(status))); + RNSkLogger::logToConsole("onSubmittedWorkDone callback status: " + + std::to_string(static_cast(status))); auto promise = static_cast(userdata); promise->resolve(jsi::Value::undefined()); RNSkLogger::logToConsole("onSubmittedWorkDone end"); diff --git a/package/cpp/wgpu/JsiRenderPassDescriptor.h b/package/cpp/wgpu/JsiRenderPassDescriptor.h index 338b443a15..ae517b8084 100644 --- a/package/cpp/wgpu/JsiRenderPassDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPassDescriptor.h @@ -68,12 +68,10 @@ class JsiRenderPassDescriptor if (obj.hasProperty(runtime, "depthStencilAttachment")) { auto depthStencilAttachment = obj.getProperty(runtime, "depthStencilAttachment"); - RNSkLogger::logToConsole("depthStencilAttachment"); - auto att = JsiRenderPassDepthStencilAttachment::fromValue( + + object->depthStencilAttachment = + JsiRenderPassDepthStencilAttachment::fromValue( runtime, depthStencilAttachment); - - RNSkLogger::logToConsole("depthStencilAttachment: %d", att->view != nullptr); - object->depthStencilAttachment = att; } return object; } diff --git a/package/cpp/wgpu/JsiWGPUContext.h b/package/cpp/wgpu/JsiWGPUContext.h index 799dc353c1..748c08b6ea 100644 --- a/package/cpp/wgpu/JsiWGPUContext.h +++ b/package/cpp/wgpu/JsiWGPUContext.h @@ -41,7 +41,8 @@ class JsiWGPUContext : public JsiSkWrappingSharedPtrHostObject { swapChainDesc.format = wgpu::TextureFormat::RGBA8Unorm; // surface.GetPreferredFormat(adapter); swapChainDesc.presentMode = wgpu::PresentMode::Fifo; - // swapChainDesc.compositingAlphaMode = wgpu::CompositingAlphaMode::PreMultiplied; + // swapChainDesc.compositingAlphaMode = + // wgpu::CompositingAlphaMode::PreMultiplied; _surface = std::make_shared(surface); _swapChain = std::make_shared( device->CreateSwapChain(surface, &swapChainDesc)); diff --git a/scripts/generator/constants.ts b/scripts/generator/constants.ts new file mode 100644 index 0000000000..ca300731e7 --- /dev/null +++ b/scripts/generator/constants.ts @@ -0,0 +1,67 @@ +import _ from "lodash"; + +const aliases: Record = { ColorWrite: "ColorWriteMask" }; + +const mapKey = (name: string) => { + const result = name.substring(3); + return aliases[result] ?? result; +} + +const constants: Record> = { + GPUBufferUsage: { + MAP_READ: 1, + MAP_WRITE: 2, + COPY_SRC: 4, + COPY_DST: 8, + INDEX: 16, + VERTEX: 32, + UNIFORM: 64, + STORAGE: 128, + INDIRECT: 256, + QUERY_RESOLVE: 512, + }, + GPUColorWrite: { + RED: 1, + GREEN: 2, + BLUE: 4, + ALPHA: 8, + ALL: 15, + }, + GPUMapMode: { + READ: 1, + WRITE: 2, + }, + GPUShaderStage: { + VERTEX: 1, + FRAGMENT: 2, + COMPUTE: 4, + }, + GPUTextureUsage: { + COPY_SRC: 1, + COPY_DST: 2, + TEXTURE_BINDING: 4, + STORAGE_BINDING: 8, + RENDER_ATTACHMENT: 16, + }, +} + +export const generateConstants = () => { + return `#pragma once + + #include + + #include "dawn/webgpu_cpp.h" + +namespace RNSkia { + +void installConstants (jsi::Runtime &runtime) { + ${Object.keys(constants).map((key) => { + return ` +jsi::Object ${key}(runtime); +${Object.keys(constants[key]).map((constant) => `GPUBufferUsage.setProperty(runtime, "${constant}", jsi::Value(static_cast(wgpu::${mapKey(key)}::${_.upperFirst(_.camelCase(constant))})));`).join('\n')} +runtime.global().setProperty(runtime, "${key}", ${key});`; + }).join('\n')} +} + +}`; +}; \ No newline at end of file diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 03e507628e..2129790136 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -284,8 +284,8 @@ export const model: JSIObject[] = [ {"name": "size", "type": "size_t", "defaultAtomicValue": "SIZE_MAX"} ], implementation: ` - size_t offset = static_cast(arguments[0].getNumber()); - size_t size = static_cast(arguments[1].getNumber()); + size_t offset = count > 0 ? static_cast(arguments[0].getNumber()) : 0; + size_t size = count > 1 ? static_cast(arguments[1].getNumber()) : getObject()->GetSize(); auto usage = getObject()->GetUsage(); void *data = (usage & wgpu::BufferUsage::MapWrite) ? getObject()->GetMappedRange(offset, size) diff --git a/scripts/generator/webgpu-bindings.ts b/scripts/generator/webgpu-bindings.ts index f2fb171cce..a748e00302 100644 --- a/scripts/generator/webgpu-bindings.ts +++ b/scripts/generator/webgpu-bindings.ts @@ -4,8 +4,10 @@ import { writeFileSync } from "fs"; import { generateObject } from "./generateObject"; import { model } from "./model"; import { enums, generateEnums } from "./enums"; +import { generateConstants } from "./constants"; writeFileSync(`package/cpp/wgpu/JsiEnums.h`, generateEnums(enums)); +writeFileSync(`package/cpp/wgpu/JsiConstants.h`, generateConstants()); model.forEach((object) => { const result = generateObject(object); From cc6f782364fc105b22fd0e731b4765ddf3783af9 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 13:24:51 +0200 Subject: [PATCH 29/63] :wrench: --- package/cpp/wgpu/JsiBindGroupEntry.h | 47 ++++++++++++++------------- scripts/generator/generateObject.ts | 3 ++ scripts/generator/model.ts | 48 +++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 24 deletions(-) diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index e08627bb17..bd419635b9 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -31,9 +31,6 @@ class JsiBindGroupEntry // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiBindGroupEntry, BindGroupEntry) - /** - * Returns the underlying object from a host object of this type - */ static wgpu::BindGroupEntry *fromValue(jsi::Runtime &runtime, const jsi::Value &raw) { const auto &obj = raw.asObject(runtime); @@ -50,29 +47,33 @@ class JsiBindGroupEntry throw jsi::JSError(runtime, "Missing mandatory prop binding in BindGroupEntry"); } - if (obj.hasProperty(runtime, "buffer")) { - auto buffer = obj.getProperty(runtime, "buffer"); + if (obj.hasProperty(runtime, "resource") && + obj.getProperty(runtime, "resource").isObject()) { + auto resource = obj.getProperty(runtime, "resource").asObject(runtime); + if (resource.hasProperty(runtime, "buffer")) { + auto buffer = resource.getProperty(runtime, "buffer"); - object->buffer = *JsiBuffer::fromValue(runtime, buffer); - } else { - throw jsi::JSError(runtime, - "Missing mandatory prop buffer in BindGroupEntry"); - } - if (obj.hasProperty(runtime, "size")) { - auto size = obj.getProperty(runtime, "size"); + object->buffer = *JsiBuffer::fromValue(runtime, buffer); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop buffer in BindGroupEntry"); + } + if (resource.hasProperty(runtime, "size")) { + auto size = resource.getProperty(runtime, "size"); - object->size = static_cast(size.getNumber()); - } else { - throw jsi::JSError(runtime, - "Missing mandatory prop size in BindGroupEntry"); - } - if (obj.hasProperty(runtime, "offset")) { - auto offset = obj.getProperty(runtime, "offset"); + object->size = static_cast(size.getNumber()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop size in BindGroupEntry"); + } + if (resource.hasProperty(runtime, "offset")) { + auto offset = resource.getProperty(runtime, "offset"); - object->offset = static_cast(offset.getNumber()); - } else { - throw jsi::JSError(runtime, - "Missing mandatory prop offset in BindGroupEntry"); + object->offset = static_cast(offset.getNumber()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop offset in BindGroupEntry"); + } } return object; } diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index c4cb9b24db..ec41b50e0c 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -219,6 +219,7 @@ ${className}(std::shared_ptr context, ${objectName} m) ${nonMemberMethods.filter(m => !m.member).map(method => `JSI_EXPORT_FUNC(${className}, ${_.camelCase(method.name)})`).join(",\n ")} )` : ''} + ${object.fromValueImpl ? object.fromValueImpl : ` /** * Returns the underlying object from a host object of this type */ @@ -233,6 +234,8 @@ ${className}(std::shared_ptr context, ${objectName} m) "Expected a ${className} object, but got a " + raw.toString(runtime).utf8(runtime));`} } } + `} + }; } // namespace RNSkia `; diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 2129790136..855f9e7580 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -30,6 +30,7 @@ export interface JSIObject { methods?: Method[]; properties?: Property[]; defaultProperties?: string; + fromValueImpl?: string; iterable?: string; } @@ -218,7 +219,52 @@ export const model: JSIObject[] = [ { name: "buffer", type: "Buffer" }, { name: "size", type: "uint32_t" }, { name: "offset", type: "uint32_t" } - ] + ], + fromValueImpl: `static wgpu::BindGroupEntry *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { +const auto &obj = raw.asObject(runtime); +if (obj.isHostObject(runtime)) { +return obj.asHostObject(runtime)->getObject().get(); +} else { +auto object = new wgpu::BindGroupEntry(); + +if (obj.hasProperty(runtime, "binding")) { +auto binding = obj.getProperty(runtime, "binding"); + +object->binding = static_cast(binding.getNumber()); +} else { +throw jsi::JSError(runtime, +"Missing mandatory prop binding in BindGroupEntry"); +} +if (obj.hasProperty(runtime, "resource") && obj.getProperty(runtime, "resource").isObject()) { +auto resource = obj.getProperty(runtime, "resource").asObject(runtime); +if (resource.hasProperty(runtime, "buffer")) { +auto buffer = resource.getProperty(runtime, "buffer"); + +object->buffer = *JsiBuffer::fromValue(runtime, buffer); +} else { +throw jsi::JSError(runtime, +"Missing mandatory prop buffer in BindGroupEntry"); +} +if (resource.hasProperty(runtime, "size")) { +auto size = resource.getProperty(runtime, "size"); + +object->size = static_cast(size.getNumber()); +} else { +throw jsi::JSError(runtime, +"Missing mandatory prop size in BindGroupEntry"); +} +if (resource.hasProperty(runtime, "offset")) { +auto offset = resource.getProperty(runtime, "offset"); + +object->offset = static_cast(offset.getNumber()); +} else { +throw jsi::JSError(runtime, +"Missing mandatory prop offset in BindGroupEntry"); +} +} +return object; +}}` }, { name: "BindGroup" From 373b9681d8b1007dc0674a2693dc6f9bb59272f0 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 13:31:45 +0200 Subject: [PATCH 30/63] :wrench: --- package/cpp/wgpu/JsiRenderPassEncoder.h | 8 +++++--- scripts/generator/model.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index 7f043c2146..f6c1433356 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -91,12 +91,14 @@ class JsiRenderPassEncoder JSI_HOST_FUNCTION(setVertexBuffer) { auto slot = static_cast(arguments[0].getNumber()); auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); - auto offset = static_cast(arguments[2].getNumber()); - auto size = static_cast(arguments[3].getNumber()); + auto offset = + count > 2 ? static_cast(arguments[2].getNumber()) : 0; + auto size = count > 3 ? static_cast(arguments[3].getNumber()) + : buffer->GetSize(); RNSkLogger::logToConsole( "RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, buffer != nullptr, offset, size); - getObject()->SetVertexBuffer(slot, *buffer); + getObject()->SetVertexBuffer(slot, *buffer, offset, size); return jsi::Value::undefined(); } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 855f9e7580..3826630ea2 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -498,10 +498,12 @@ return object; ], implementation: `auto slot = static_cast(arguments[0].getNumber()); auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); - auto offset = static_cast(arguments[2].getNumber()); - auto size = static_cast(arguments[3].getNumber()); - RNSkLogger::logToConsole("RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, buffer != nullptr, offset, size); - getObject()->SetVertexBuffer(slot, *buffer); + auto offset = count > 2 ? static_cast(arguments[2].getNumber()) : 0; + auto size = count > 3 ? static_cast(arguments[3].getNumber()) : buffer->GetSize(); + RNSkLogger::logToConsole( + "RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, + buffer != nullptr, offset, size); + getObject()->SetVertexBuffer(slot, *buffer, offset, size); return jsi::Value::undefined();` } ] From acdca3a53b2d5779bf68302ed0f3fe8c225f110c Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 13:41:15 +0200 Subject: [PATCH 31/63] :wrench: --- example/src/Examples/Breathe/demo1/demo5.ts | 22 ++++++++++----------- package/cpp/wgpu/JsiBindGroupEntry.h | 6 ++---- package/cpp/wgpu/JsiBufferDescriptor.h | 4 ---- scripts/generator/model.ts | 8 +++----- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo5.ts b/example/src/Examples/Breathe/demo1/demo5.ts index da050cf593..2253b5e21b 100644 --- a/example/src/Examples/Breathe/demo1/demo5.ts +++ b/example/src/Examples/Breathe/demo1/demo5.ts @@ -8,7 +8,7 @@ import { cubePositionOffset, cubeVertexCount, } from "./cube"; -import { basicVertWGSL, instancedVertWGSL, vertexPositionColorWGSL } from "./shaders"; +import { instancedVertWGSL, vertexPositionColorWGSL } from "./shaders"; const { width, height } = Dimensions.get("window"); @@ -72,18 +72,18 @@ const pipeline = device.createRenderPipeline({ // Enable depth testing so that the fragment closest to the camera // is rendered in front. - depthStencil: { - depthWriteEnabled: true, - depthCompare: 'less', - format: 'depth24plus', - }, + // depthStencil: { + // depthWriteEnabled: true, + // depthCompare: 'less', + // format: 'depth24plus', + // }, }); -const depthTexture = device.createTexture({ - size: { width, height }, - format: 'depth24plus', - usage: GPUTextureUsage.RENDER_ATTACHMENT, -}); +// const depthTexture = device.createTexture({ +// size: { width, height }, +// format: 'depth24plus', +// usage: GPUTextureUsage.RENDER_ATTACHMENT, +// }); const xCount = 4; const yCount = 4; diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index bd419635b9..2aeafb61a7 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -63,16 +63,14 @@ class JsiBindGroupEntry object->size = static_cast(size.getNumber()); } else { - throw jsi::JSError(runtime, - "Missing mandatory prop size in BindGroupEntry"); + object->size = object->buffer.GetSize(); } if (resource.hasProperty(runtime, "offset")) { auto offset = resource.getProperty(runtime, "offset"); object->offset = static_cast(offset.getNumber()); } else { - throw jsi::JSError(runtime, - "Missing mandatory prop offset in BindGroupEntry"); + object->offset = 0; } } return object; diff --git a/package/cpp/wgpu/JsiBufferDescriptor.h b/package/cpp/wgpu/JsiBufferDescriptor.h index 36914efcdd..4328505ad6 100644 --- a/package/cpp/wgpu/JsiBufferDescriptor.h +++ b/package/cpp/wgpu/JsiBufferDescriptor.h @@ -62,10 +62,6 @@ class JsiBufferDescriptor object->mappedAtCreation = static_cast(mappedAtCreation.getBool()); - } else { - throw jsi::JSError( - runtime, - "Missing mandatory prop mappedAtCreation in BufferDescriptor"); } return object; } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 3826630ea2..d00d113989 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -251,16 +251,14 @@ auto size = resource.getProperty(runtime, "size"); object->size = static_cast(size.getNumber()); } else { -throw jsi::JSError(runtime, -"Missing mandatory prop size in BindGroupEntry"); + object->size = object->buffer.GetSize(); } if (resource.hasProperty(runtime, "offset")) { auto offset = resource.getProperty(runtime, "offset"); object->offset = static_cast(offset.getNumber()); } else { -throw jsi::JSError(runtime, -"Missing mandatory prop offset in BindGroupEntry"); + object->offset = 0; } } return object; @@ -282,7 +280,7 @@ return object; properties: [ { name: "size", type: "uint64_t" }, {"name": "usage", "type": "BufferUsage"}, - {"name": "mappedAtCreation", "type": "bool"} + {"name": "mappedAtCreation", "type": "bool", optional: true }, ] }, { From dc3278603c68002233b37225486f9935b055c460 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 14:20:23 +0200 Subject: [PATCH 32/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- example/src/Examples/Breathe/demo1/demo4.ts | 22 ++--- example/src/Examples/Breathe/demo1/main.ts | 6 +- package/cpp/wgpu/JsiConstants.h | 98 ++++++--------------- package/cpp/wgpu/JsiQueue.h | 4 +- scripts/generator/constants.ts | 2 +- scripts/generator/model.ts | 3 +- 7 files changed, 47 insertions(+), 90 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 0fa8debc58..1d0f9b6d0c 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -16,7 +16,7 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: "premultiplied", }); - await demo5(device, context); + await demo4(device, context); //context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/demo4.ts b/example/src/Examples/Breathe/demo1/demo4.ts index 5c1716fdd9..057a110b11 100644 --- a/example/src/Examples/Breathe/demo1/demo4.ts +++ b/example/src/Examples/Breathe/demo1/demo4.ts @@ -89,11 +89,9 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { const matrixSize = 4 * 16; // 4x4 matrix const offset = 256; // uniformBindGroup offset must be 256-byte aligned const uniformBufferSize = offset + matrixSize; - const uniformBuffer = device.createBuffer({ size: uniformBufferSize, - usage: 72, //GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - mappedAtCreation: false, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); const uniformBindGroup1 = device.createBindGroup({ @@ -101,9 +99,11 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { entries: [ { binding: 0, - buffer: uniformBuffer, - offset: 0, - size: matrixSize, + resource: { + buffer: uniformBuffer, + offset: offset, + size: matrixSize, + } }, ], }); @@ -113,9 +113,11 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { entries: [ { binding: 0, - buffer: uniformBuffer, - offset: offset, - size: matrixSize, + resource: { + buffer: uniformBuffer, + offset: offset, + size: matrixSize, + } }, ], }); @@ -225,7 +227,7 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - await device.queue.onSubmittedWorkDone(); + //await device.queue.onSubmittedWorkDone(); context.present(); requestAnimationFrame(frame); } diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 6fb60e015b..112c238b3a 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -16,7 +16,7 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ size: cubeVertexArray.byteLength, - usage: 32, //GPUBufferUsage.VERTEX, + usage: GPUBufferUsage.VERTEX, mappedAtCreation: true, }); @@ -76,13 +76,13 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { const depthTexture = device.createTexture({ size: { width, height }, format: "depth24plus", - usage: 16, //GPUTextureUsage.RENDER_ATTACHMENT, + usage: GPUTextureUsage.RENDER_ATTACHMENT, }); const uniformBufferSize = 4 * 16; // 4x4 matrix const uniformBuffer = device.createBuffer({ size: uniformBufferSize, - usage: 72, //GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, mappedAtCreation: false, }); const uniformBindGroup = device.createBindGroup({ diff --git a/package/cpp/wgpu/JsiConstants.h b/package/cpp/wgpu/JsiConstants.h index 023225be67..40b8355b32 100644 --- a/package/cpp/wgpu/JsiConstants.h +++ b/package/cpp/wgpu/JsiConstants.h @@ -9,91 +9,43 @@ namespace RNSkia { void installConstants(jsi::Runtime &runtime) { jsi::Object GPUBufferUsage(runtime); - GPUBufferUsage.setProperty( - runtime, "MAP_READ", - jsi::Value(static_cast(wgpu::BufferUsage::MapRead))); - GPUBufferUsage.setProperty( - runtime, "MAP_WRITE", - jsi::Value(static_cast(wgpu::BufferUsage::MapWrite))); - GPUBufferUsage.setProperty( - runtime, "COPY_SRC", - jsi::Value(static_cast(wgpu::BufferUsage::CopySrc))); - GPUBufferUsage.setProperty( - runtime, "COPY_DST", - jsi::Value(static_cast(wgpu::BufferUsage::CopyDst))); - GPUBufferUsage.setProperty( - runtime, "INDEX", - jsi::Value(static_cast(wgpu::BufferUsage::Index))); - GPUBufferUsage.setProperty( - runtime, "VERTEX", - jsi::Value(static_cast(wgpu::BufferUsage::Vertex))); - GPUBufferUsage.setProperty( - runtime, "UNIFORM", - jsi::Value(static_cast(wgpu::BufferUsage::Uniform))); - GPUBufferUsage.setProperty( - runtime, "STORAGE", - jsi::Value(static_cast(wgpu::BufferUsage::Storage))); - GPUBufferUsage.setProperty( - runtime, "INDIRECT", - jsi::Value(static_cast(wgpu::BufferUsage::Indirect))); - GPUBufferUsage.setProperty( - runtime, "QUERY_RESOLVE", - jsi::Value(static_cast(wgpu::BufferUsage::QueryResolve))); + GPUBufferUsage.setProperty(runtime, "MAP_READ", jsi::Value(1)); + GPUBufferUsage.setProperty(runtime, "MAP_WRITE", jsi::Value(2)); + GPUBufferUsage.setProperty(runtime, "COPY_SRC", jsi::Value(4)); + GPUBufferUsage.setProperty(runtime, "COPY_DST", jsi::Value(8)); + GPUBufferUsage.setProperty(runtime, "INDEX", jsi::Value(16)); + GPUBufferUsage.setProperty(runtime, "VERTEX", jsi::Value(32)); + GPUBufferUsage.setProperty(runtime, "UNIFORM", jsi::Value(64)); + GPUBufferUsage.setProperty(runtime, "STORAGE", jsi::Value(128)); + GPUBufferUsage.setProperty(runtime, "INDIRECT", jsi::Value(256)); + GPUBufferUsage.setProperty(runtime, "QUERY_RESOLVE", jsi::Value(512)); runtime.global().setProperty(runtime, "GPUBufferUsage", GPUBufferUsage); jsi::Object GPUColorWrite(runtime); - GPUBufferUsage.setProperty( - runtime, "RED", - jsi::Value(static_cast(wgpu::ColorWriteMask::Red))); - GPUBufferUsage.setProperty( - runtime, "GREEN", - jsi::Value(static_cast(wgpu::ColorWriteMask::Green))); - GPUBufferUsage.setProperty( - runtime, "BLUE", - jsi::Value(static_cast(wgpu::ColorWriteMask::Blue))); - GPUBufferUsage.setProperty( - runtime, "ALPHA", - jsi::Value(static_cast(wgpu::ColorWriteMask::Alpha))); - GPUBufferUsage.setProperty( - runtime, "ALL", - jsi::Value(static_cast(wgpu::ColorWriteMask::All))); + GPUColorWrite.setProperty(runtime, "RED", jsi::Value(1)); + GPUColorWrite.setProperty(runtime, "GREEN", jsi::Value(2)); + GPUColorWrite.setProperty(runtime, "BLUE", jsi::Value(4)); + GPUColorWrite.setProperty(runtime, "ALPHA", jsi::Value(8)); + GPUColorWrite.setProperty(runtime, "ALL", jsi::Value(15)); runtime.global().setProperty(runtime, "GPUColorWrite", GPUColorWrite); jsi::Object GPUMapMode(runtime); - GPUBufferUsage.setProperty( - runtime, "READ", jsi::Value(static_cast(wgpu::MapMode::Read))); - GPUBufferUsage.setProperty( - runtime, "WRITE", jsi::Value(static_cast(wgpu::MapMode::Write))); + GPUMapMode.setProperty(runtime, "READ", jsi::Value(1)); + GPUMapMode.setProperty(runtime, "WRITE", jsi::Value(2)); runtime.global().setProperty(runtime, "GPUMapMode", GPUMapMode); jsi::Object GPUShaderStage(runtime); - GPUBufferUsage.setProperty( - runtime, "VERTEX", - jsi::Value(static_cast(wgpu::ShaderStage::Vertex))); - GPUBufferUsage.setProperty( - runtime, "FRAGMENT", - jsi::Value(static_cast(wgpu::ShaderStage::Fragment))); - GPUBufferUsage.setProperty( - runtime, "COMPUTE", - jsi::Value(static_cast(wgpu::ShaderStage::Compute))); + GPUShaderStage.setProperty(runtime, "VERTEX", jsi::Value(1)); + GPUShaderStage.setProperty(runtime, "FRAGMENT", jsi::Value(2)); + GPUShaderStage.setProperty(runtime, "COMPUTE", jsi::Value(4)); runtime.global().setProperty(runtime, "GPUShaderStage", GPUShaderStage); jsi::Object GPUTextureUsage(runtime); - GPUBufferUsage.setProperty( - runtime, "COPY_SRC", - jsi::Value(static_cast(wgpu::TextureUsage::CopySrc))); - GPUBufferUsage.setProperty( - runtime, "COPY_DST", - jsi::Value(static_cast(wgpu::TextureUsage::CopyDst))); - GPUBufferUsage.setProperty( - runtime, "TEXTURE_BINDING", - jsi::Value(static_cast(wgpu::TextureUsage::TextureBinding))); - GPUBufferUsage.setProperty( - runtime, "STORAGE_BINDING", - jsi::Value(static_cast(wgpu::TextureUsage::StorageBinding))); - GPUBufferUsage.setProperty( - runtime, "RENDER_ATTACHMENT", - jsi::Value(static_cast(wgpu::TextureUsage::RenderAttachment))); + GPUTextureUsage.setProperty(runtime, "COPY_SRC", jsi::Value(1)); + GPUTextureUsage.setProperty(runtime, "COPY_DST", jsi::Value(2)); + GPUTextureUsage.setProperty(runtime, "TEXTURE_BINDING", jsi::Value(4)); + GPUTextureUsage.setProperty(runtime, "STORAGE_BINDING", jsi::Value(8)); + GPUTextureUsage.setProperty(runtime, "RENDER_ATTACHMENT", jsi::Value(16)); runtime.global().setProperty(runtime, "GPUTextureUsage", GPUTextureUsage); } diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 65641dc524..ca9420f84d 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -44,8 +44,10 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); + auto offset2 = static_cast(arguments[3].getNumber()); auto size = static_cast(arguments[4].getNumber()); - getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); + getObject()->WriteBuffer(*buffer, offset, data.data(runtime) + offset2, + size); return jsi::Value::undefined(); } diff --git a/scripts/generator/constants.ts b/scripts/generator/constants.ts index ca300731e7..a812a46a57 100644 --- a/scripts/generator/constants.ts +++ b/scripts/generator/constants.ts @@ -58,7 +58,7 @@ void installConstants (jsi::Runtime &runtime) { ${Object.keys(constants).map((key) => { return ` jsi::Object ${key}(runtime); -${Object.keys(constants[key]).map((constant) => `GPUBufferUsage.setProperty(runtime, "${constant}", jsi::Value(static_cast(wgpu::${mapKey(key)}::${_.upperFirst(_.camelCase(constant))})));`).join('\n')} +${Object.keys(constants[key]).map((constant) => `${key}.setProperty(runtime, "${constant}", jsi::Value(${constants[key][constant]}));`).join('\n')} runtime.global().setProperty(runtime, "${key}", ${key});`; }).join('\n')} } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index d00d113989..ac09771c0d 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -399,8 +399,9 @@ return object; auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); + auto offset2 = static_cast(arguments[3].getNumber()); auto size = static_cast(arguments[4].getNumber()); - getObject()->WriteBuffer(*buffer, offset, data.data(runtime), size); + getObject()->WriteBuffer(*buffer, offset, data.data(runtime) + offset2, size); return jsi::Value::undefined(); `, }, From ea52ae6036f58da82debfd60c2cbd91d8d10ce46 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 14:24:26 +0200 Subject: [PATCH 33/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 1d0f9b6d0c..0fa8debc58 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -16,7 +16,7 @@ const draw = async (context: GPUCanvasContext) => { format: presentationFormat, alphaMode: "premultiplied", }); - await demo4(device, context); + await demo5(device, context); //context.present(); }; From 82324b6168b0aee0f3661a27e4893cd7cdad09df Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 16:37:21 +0200 Subject: [PATCH 34/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 1 + example/src/Examples/Breathe/demo1/demo5.ts | 2 +- example/src/Examples/Breathe/demo6/main.ts | 425 ++++++++++++++++++ .../src/Examples/Breathe/demo6/particle.ts | 137 ++++++ .../Examples/Breathe/demo6/probabilityMap.ts | 55 +++ example/src/Examples/Breathe/demo6/webgpu.png | Bin 0 -> 38482 bytes package/cpp/wgpu/JsiRenderPassEncoder.h | 21 +- scripts/generator/model.ts | 8 + 8 files changed, 647 insertions(+), 2 deletions(-) create mode 100644 example/src/Examples/Breathe/demo6/main.ts create mode 100644 example/src/Examples/Breathe/demo6/particle.ts create mode 100644 example/src/Examples/Breathe/demo6/probabilityMap.ts create mode 100644 example/src/Examples/Breathe/demo6/webgpu.png diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 0fa8debc58..cafb585ab4 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -6,6 +6,7 @@ import { demo2 } from "./demo2"; import { demo1 } from "./demo1/main"; import { demo4 } from "./demo1/demo4"; import { demo5 } from "./demo1/demo5"; +//import { demo6 } from "./demo6/main"; const draw = async (context: GPUCanvasContext) => { const adapter = await gpu.requestAdapter(); diff --git a/example/src/Examples/Breathe/demo1/demo5.ts b/example/src/Examples/Breathe/demo1/demo5.ts index 2253b5e21b..3907d027d4 100644 --- a/example/src/Examples/Breathe/demo1/demo5.ts +++ b/example/src/Examples/Breathe/demo1/demo5.ts @@ -111,7 +111,7 @@ const uniformBindGroup = device.createBindGroup({ ], }); -const aspect = width / height; +const aspect = (width / height); const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); type Mat4 = mat4.default; diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts new file mode 100644 index 0000000000..911376476b --- /dev/null +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -0,0 +1,425 @@ +import { mat4, vec3 } from 'wgpu-matrix'; +import { probabilityMapWGSL } from './probabilityMap'; +import { particleWGSL } from './particle'; +import { Dimensions } from 'react-native'; + +const {width, height} = Dimensions.get('window'); +const canvas = {width, height}; +const numParticles = 50000; +const particlePositionOffset = 0; +const particleColorOffset = 4 * 4; +const particleInstanceByteSize = + 3 * 4 + // position + 1 * 4 + // lifetime + 4 * 4 + // color + 3 * 4 + // velocity + 1 * 4 + // padding + 0; +const presentationFormat = 'rgba8unorm'; + +export const demo6 = (device: GPUDevice, context: GPUCanvasContext) => { +const particlesBuffer = device.createBuffer({ + size: numParticles * particleInstanceByteSize, + usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, +}); + +const renderPipeline = device.createRenderPipeline({ + layout: 'auto', + vertex: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: 'vs_main', + buffers: [ + { + // instanced particles buffer + arrayStride: particleInstanceByteSize, + stepMode: 'instance', + attributes: [ + { + // position + shaderLocation: 0, + offset: particlePositionOffset, + format: 'float32x3', + }, + { + // color + shaderLocation: 1, + offset: particleColorOffset, + format: 'float32x4', + }, + ], + }, + { + // quad vertex buffer + arrayStride: 2 * 4, // vec2f + stepMode: 'vertex', + attributes: [ + { + // vertex positions + shaderLocation: 2, + offset: 0, + format: 'float32x2', + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: 'fs_main', + targets: [ + { + format: presentationFormat, + blend: { + color: { + srcFactor: 'src-alpha', + dstFactor: 'one', + operation: 'add', + }, + alpha: { + srcFactor: 'zero', + dstFactor: 'one', + operation: 'add', + }, + }, + }, + ], + }, + primitive: { + topology: 'triangle-list', + }, + + depthStencil: { + depthWriteEnabled: false, + depthCompare: 'less', + format: 'depth24plus', + }, +}); + +const depthTexture = device.createTexture({ + size: [canvas.width, canvas.height], + format: 'depth24plus', + usage: GPUTextureUsage.RENDER_ATTACHMENT, +}); + +const uniformBufferSize = + 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f + 3 * 4 + // right : vec3f + 4 + // padding + 3 * 4 + // up : vec3f + 4 + // padding + 0; +const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, +}); + +const uniformBindGroup = device.createBindGroup({ + layout: renderPipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: uniformBuffer, + }, + }, + ], +}); + +const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + clearValue: [0, 0, 0, 1], + loadOp: 'clear', + storeOp: 'store', + }, + ], + depthStencilAttachment: { + view: depthTexture.createView(), + + depthClearValue: 1.0, + depthLoadOp: 'clear', + depthStoreOp: 'store', + }, +}; + +////////////////////////////////////////////////////////////////////////////// +// Quad vertex buffer +////////////////////////////////////////////////////////////////////////////// +const quadVertexBuffer = device.createBuffer({ + size: 6 * 2 * 4, // 6x vec2f + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true, +}); +// prettier-ignore +const vertexData = [ + -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, +]; +new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); +quadVertexBuffer.unmap(); + +////////////////////////////////////////////////////////////////////////////// +// Texture +////////////////////////////////////////////////////////////////////////////// +let texture: GPUTexture; +let textureWidth = 1; +let textureHeight = 1; +let numMipLevels = 1; +{ + const response = await fetch('../../assets/img/webgpu.png'); + const imageBitmap = await createImageBitmap(await response.blob()); + + // Calculate number of mip levels required to generate the probability map + while ( + textureWidth < imageBitmap.width || + textureHeight < imageBitmap.height + ) { + textureWidth *= 2; + textureHeight *= 2; + numMipLevels++; + } + texture = device.createTexture({ + size: [imageBitmap.width, imageBitmap.height, 1], + mipLevelCount: numMipLevels, + format: 'rgba8unorm', + usage: + GPUTextureUsage.TEXTURE_BINDING | + GPUTextureUsage.STORAGE_BINDING | + GPUTextureUsage.COPY_DST | + GPUTextureUsage.RENDER_ATTACHMENT, + }); + device.queue.copyExternalImageToTexture( + { source: imageBitmap }, + { texture: texture }, + [imageBitmap.width, imageBitmap.height] + ); +} + +////////////////////////////////////////////////////////////////////////////// +// Probability map generation +// The 0'th mip level of texture holds the color data and spawn-probability in +// the alpha channel. The mip levels 1..N are generated to hold spawn +// probabilities up to the top 1x1 mip level. +////////////////////////////////////////////////////////////////////////////// +{ + const probabilityMapImportLevelPipeline = device.createComputePipeline({ + layout: 'auto', + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: 'import_level', + }, + }); + const probabilityMapExportLevelPipeline = device.createComputePipeline({ + layout: 'auto', + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: 'export_level', + }, + }); + + const probabilityMapUBOBufferSize = + 1 * 4 + // stride + 3 * 4 + // padding + 0; + const probabilityMapUBOBuffer = device.createBuffer({ + size: probabilityMapUBOBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); + const buffer_a = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + const buffer_b = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + device.queue.writeBuffer( + probabilityMapUBOBuffer, + 0, + new Int32Array([textureWidth]) + ); + const commandEncoder = device.createCommandEncoder(); + for (let level = 0; level < numMipLevels; level++) { + const levelWidth = textureWidth >> level; + const levelHeight = textureHeight >> level; + const pipeline = + level == 0 + ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) + : probabilityMapExportLevelPipeline.getBindGroupLayout(0); + const probabilityMapBindGroup = device.createBindGroup({ + layout: pipeline, + entries: [ + { + // ubo + binding: 0, + resource: { buffer: probabilityMapUBOBuffer }, + }, + { + // buf_in + binding: 1, + resource: { buffer: level & 1 ? buffer_a : buffer_b }, + }, + { + // buf_out + binding: 2, + resource: { buffer: level & 1 ? buffer_b : buffer_a }, + }, + { + // tex_in / tex_out + binding: 3, + resource: texture.createView({ + format: 'rgba8unorm', + dimension: '2d', + baseMipLevel: level, + mipLevelCount: 1, + }), + }, + ], + }); + if (level == 0) { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapImportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); + passEncoder.end(); + } else { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapExportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); + passEncoder.end(); + } + } + device.queue.submit([commandEncoder.finish()]); +} + +////////////////////////////////////////////////////////////////////////////// +// Simulation compute pipeline +////////////////////////////////////////////////////////////////////////////// +const simulationParams = { + simulate: true, + deltaTime: 0.04, +}; + +const simulationUBOBufferSize = + 1 * 4 + // deltaTime + 3 * 4 + // padding + 4 * 4 + // seed + 0; +const simulationUBOBuffer = device.createBuffer({ + size: simulationUBOBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, +}); + +const computePipeline = device.createComputePipeline({ + layout: 'auto', + compute: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: 'simulate', + }, +}); +const computeBindGroup = device.createBindGroup({ + layout: computePipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: simulationUBOBuffer, + }, + }, + { + binding: 1, + resource: { + buffer: particlesBuffer, + offset: 0, + size: numParticles * particleInstanceByteSize, + }, + }, + { + binding: 2, + resource: texture.createView(), + }, + ], +}); + +const aspect = canvas.width / canvas.height; +const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); +const view = mat4.create(); +const mvp = mat4.create(); + +function frame() { + device.queue.writeBuffer( + simulationUBOBuffer, + 0, + new Float32Array([ + simulationParams.simulate ? simulationParams.deltaTime : 0.0, + 0.0, + 0.0, + 0.0, // padding + Math.random() * 100, + Math.random() * 100, // seed.xy + 1 + Math.random(), + 1 + Math.random(), // seed.zw + ]) + ); + + mat4.identity(view); + mat4.translate(view, vec3.fromValues(0, 0, -3), view); + mat4.rotateX(view, Math.PI * -0.2, view); + mat4.multiply(projection, view, mvp); + + // prettier-ignore + device.queue.writeBuffer( + uniformBuffer, + 0, + new Float32Array([ + // modelViewProjectionMatrix + mvp[0], mvp[1], mvp[2], mvp[3], + mvp[4], mvp[5], mvp[6], mvp[7], + mvp[8], mvp[9], mvp[10], mvp[11], + mvp[12], mvp[13], mvp[14], mvp[15], + + view[0], view[4], view[8], // right + + 0, // padding + + view[1], view[5], view[9], // up + + 0, // padding + ]) + ); + const swapChainTexture = context.getCurrentTexture(); + // prettier-ignore + renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); + + const commandEncoder = device.createCommandEncoder(); + { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(computePipeline); + passEncoder.setBindGroup(0, computeBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); + passEncoder.end(); + } + { + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(renderPipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, particlesBuffer); + passEncoder.setVertexBuffer(1, quadVertexBuffer); + passEncoder.draw(6, numParticles, 0, 0); + passEncoder.end(); + } + + device.queue.submit([commandEncoder.finish()]); + context.present(); + requestAnimationFrame(frame); +} +requestAnimationFrame(frame); + +} \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo6/particle.ts b/example/src/Examples/Breathe/demo6/particle.ts new file mode 100644 index 0000000000..7ea7c888dd --- /dev/null +++ b/example/src/Examples/Breathe/demo6/particle.ts @@ -0,0 +1,137 @@ +export const particleWGSL = `//////////////////////////////////////////////////////////////////////////////// +// Utilities +//////////////////////////////////////////////////////////////////////////////// +var rand_seed : vec2f; + +fn init_rand(invocation_id : u32, seed : vec4f) { + rand_seed = seed.xz; + rand_seed = fract(rand_seed * cos(35.456+f32(invocation_id) * seed.yw)); + rand_seed = fract(rand_seed * cos(41.235+f32(invocation_id) * seed.xw)); +} + +fn rand() -> f32 { + rand_seed.x = fract(cos(dot(rand_seed, vec2f(23.14077926, 232.61690225))) * 136.8168); + rand_seed.y = fract(cos(dot(rand_seed, vec2f(54.47856553, 345.84153136))) * 534.7645); + return rand_seed.y; +} + +//////////////////////////////////////////////////////////////////////////////// +// Vertex shader +//////////////////////////////////////////////////////////////////////////////// +struct RenderParams { + modelViewProjectionMatrix : mat4x4f, + right : vec3f, + up : vec3f +} +@binding(0) @group(0) var render_params : RenderParams; + +struct VertexInput { + @location(0) position : vec3f, + @location(1) color : vec4f, + @location(2) quad_pos : vec2f, // -1..+1 +} + +struct VertexOutput { + @builtin(position) position : vec4f, + @location(0) color : vec4f, + @location(1) quad_pos : vec2f, // -1..+1 +} + +@vertex +fn vs_main(in : VertexInput) -> VertexOutput { + var quad_pos = mat2x3f(render_params.right, render_params.up) * in.quad_pos; + var position = in.position + quad_pos * 0.01; + var out : VertexOutput; + out.position = render_params.modelViewProjectionMatrix * vec4f(position, 1.0); + out.color = in.color; + out.quad_pos = in.quad_pos; + return out; +} + +//////////////////////////////////////////////////////////////////////////////// +// Fragment shader +//////////////////////////////////////////////////////////////////////////////// +@fragment +fn fs_main(in : VertexOutput) -> @location(0) vec4f { + var color = in.color; + // Apply a circular particle alpha mask + color.a = color.a * max(1.0 - length(in.quad_pos), 0.0); + return color; +} + +//////////////////////////////////////////////////////////////////////////////// +// Simulation Compute shader +//////////////////////////////////////////////////////////////////////////////// +struct SimulationParams { + deltaTime : f32, + seed : vec4f, +} + +struct Particle { + position : vec3f, + lifetime : f32, + color : vec4f, + velocity : vec3f, +} + +struct Particles { + particles : array, +} + +@binding(0) @group(0) var sim_params : SimulationParams; +@binding(1) @group(0) var data : Particles; +@binding(2) @group(0) var texture : texture_2d; + +@compute @workgroup_size(64) +fn simulate(@builtin(global_invocation_id) global_invocation_id : vec3u) { + let idx = global_invocation_id.x; + + init_rand(idx, sim_params.seed); + + var particle = data.particles[idx]; + + // Apply gravity + particle.velocity.z = particle.velocity.z - sim_params.deltaTime * 0.5; + + // Basic velocity integration + particle.position = particle.position + sim_params.deltaTime * particle.velocity; + + // Age each particle. Fade out before vanishing. + particle.lifetime = particle.lifetime - sim_params.deltaTime; + particle.color.a = smoothstep(0.0, 0.5, particle.lifetime); + + // If the lifetime has gone negative, then the particle is dead and should be + // respawned. + if (particle.lifetime < 0.0) { + // Use the probability map to find where the particle should be spawned. + // Starting with the 1x1 mip level. + var coord : vec2i; + for (var level = u32(textureNumLevels(texture) - 1); level > 0; level--) { + // Load the probability value from the mip-level + // Generate a random number and using the probabilty values, pick the + // next texel in the next largest mip level: + // + // 0.0 probabilites.r probabilites.g probabilites.b 1.0 + // | | | | | + // | TOP-LEFT | TOP-RIGHT | BOTTOM-LEFT | BOTTOM_RIGHT | + // + let probabilites = textureLoad(texture, coord, level); + let value = vec4f(rand()); + let mask = (value >= vec4f(0.0, probabilites.xyz)) & (value < probabilites); + coord = coord * 2; + coord.x = coord.x + select(0, 1, any(mask.yw)); // x y + coord.y = coord.y + select(0, 1, any(mask.zw)); // z w + } + let uv = vec2f(coord) / vec2f(textureDimensions(texture)); + particle.position = vec3f((uv - 0.5) * 3.0 * vec2f(1.0, -1.0), 0.0); + particle.color = textureLoad(texture, coord, 0); + particle.velocity.x = (rand() - 0.5) * 0.1; + particle.velocity.y = (rand() - 0.5) * 0.1; + particle.velocity.z = rand() * 0.3; + particle.lifetime = 0.5 + rand() * 3.0; + } + + // Store the new particle value + data.particles[idx] = particle; +} +`; \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo6/probabilityMap.ts b/example/src/Examples/Breathe/demo6/probabilityMap.ts new file mode 100644 index 0000000000..14493e5b17 --- /dev/null +++ b/example/src/Examples/Breathe/demo6/probabilityMap.ts @@ -0,0 +1,55 @@ +export const probabilityMapWGSL = `struct UBO { + width : u32, +} + +struct Buffer { + weights : array, +} + +@binding(0) @group(0) var ubo : UBO; +@binding(1) @group(0) var buf_in : Buffer; +@binding(2) @group(0) var buf_out : Buffer; +@binding(3) @group(0) var tex_in : texture_2d; +@binding(3) @group(0) var tex_out : texture_storage_2d; + + +//////////////////////////////////////////////////////////////////////////////// +// import_level +// +// Loads the alpha channel from a texel of the source image, and writes it to +// the buf_out.weights. +//////////////////////////////////////////////////////////////////////////////// +@compute @workgroup_size(64) +fn import_level(@builtin(global_invocation_id) coord : vec3u) { + _ = &buf_in; + let offset = coord.x + coord.y * ubo.width; + buf_out.weights[offset] = textureLoad(tex_in, vec2i(coord.xy), 0).w; +} + +//////////////////////////////////////////////////////////////////////////////// +// export_level +// +// Loads 4 f32 weight values from buf_in.weights, and stores summed value into +// buf_out.weights, along with the calculated 'probabilty' vec4 values into the +// mip level of tex_out. See simulate() in particle.wgsl to understand the +// probability logic. +//////////////////////////////////////////////////////////////////////////////// +@compute @workgroup_size(64) +fn export_level(@builtin(global_invocation_id) coord : vec3u) { + if (all(coord.xy < vec2u(textureDimensions(tex_out)))) { + let dst_offset = coord.x + coord.y * ubo.width; + let src_offset = coord.x*2u + coord.y*2u * ubo.width; + + let a = buf_in.weights[src_offset + 0u]; + let b = buf_in.weights[src_offset + 1u]; + let c = buf_in.weights[src_offset + 0u + ubo.width]; + let d = buf_in.weights[src_offset + 1u + ubo.width]; + let sum = dot(vec4f(a, b, c, d), vec4f(1.0)); + + buf_out.weights[dst_offset] = sum / 4.0; + + let probabilities = vec4f(a, a+b, a+b+c, sum) / max(sum, 0.0001); + textureStore(tex_out, vec2i(coord.xy), probabilities); + } +} +`; \ No newline at end of file diff --git a/example/src/Examples/Breathe/demo6/webgpu.png b/example/src/Examples/Breathe/demo6/webgpu.png new file mode 100644 index 0000000000000000000000000000000000000000..a44b73ead9903e05cae19355b54ad274ed8147ea GIT binary patch literal 38482 zcmeFZbzGG1+Alf`ozfk{(B0iIG$`Fj4&4pXUD6;R$WYQLEmD$#NH+*l(jciI?$KYZ zwcfS&UhBN)J)iT(8a@Lv&wbtBtK%LXh|_qeh>byx0RRB7m6ae`000pF5(q#;f&aMh zoB0L+&_@L57|O8Ty!rq&ffKi6;jdA#zhT zInH9OojTG8SLj3%=8)ykJi?k}DZ70W+Iz^4;@5WmCIR9n~t6vwNYc&%UzbSbN`i(1kMHB4?k*sS39`{ zhur(tLR?8+sPViYOxt~;cElH2(%oBHXm+|<)`y8`Mwgkfc6};<5B&04`1{Q?+2pLo zxvSa5?kq;Pam`7=N`XGxP~EcXd^XZGZ1SU~HYJd2VI5!xn=1to)?ve0F$$pwhYfZp$%>8eHWe zha;Bg_SQd{jXgSh)4kz~Tw(&zOghKx!lsH*cXgecmAb^yjKS7GBh!ngQiJ$w&acgm zS8LpNsr>A*OxRDey1#GVA5$FbvP7;gCmZn8lA2ATMDgs2aaqateaCR{N4UTLc1}~{ zXo;LqRE@ufAR&1euL^f%&*#>bTJCb z49~QxXQouR-ljp>Z1mJ&!VZ;-vsyKCOAd9#rCG-Ia}JI*t&>)dLT&cu99`dB^R(@* zzl-pF@R)lrk?*~D!gIj`r&k{ulnOHS4O{jds<;|M%CLi-mc3h7uZ1^KRG11p4ritx zN^Pb&2(>?VZTC5FZvA*>HQSYS`K+$H!C}L3_LDKooBDeLffqHGxA-z{T1__W23{id zpLA8FWfg03Txoa9GpBREQdh*|lUYyZ9>IvLkk8Q@R!-mea0ct?uw9$gJg@rt;DGqY zbf%|KM|ZnNckS|to^wLb=BGz(A&7k=*!9W^;9jxK%L6bm=uO$?UzL(=(ZQ~UO zr!(zh?vwbBK6*P5TX?BRj#Fio^0-j#9@am_)jJIel_i{ZO4rvHnxqKY?&rG z>&LBW9(yz77gqt_I@k9ljy>6gk3C=28D|EKzAo7I5|hjQI`djV?4HYVqt9#=I?m@+ z^w--~_i7WFNQzs|d2jlYB`}fqFCl5_snKF%T**O zY3@7eL$L{YzenSK`yJzZLVf$kv0cT5`@r;%F;AnwZb`#IJLf}-H{E0{pM#T@3ewjV zCxY8Y>SR2BJZ$_f*1mI(+bsR{qsAAtC`&A0$qOJafr_Z7BDX7;kI`FF5gzU}jJ8RVaWaf^weAb8zm~IY1W3p-w*q@*b3kiE?$~Q@!R!$pQimUj60R21J%;}JB7VM+EhEe&V&Efr4VZ{{^V~v(Jv*kh4 zu8{<^>Yg7$l(M*QP!_SHWZkM1ucc5>bN+_IoKm%C#@*6fSHHuQxeX`FG6w$KK?>Hn6Z1=xHtYB0HzH$td+5YsxzgK%B^s5Hj%^~u)xlR7z z_Uz=_Jd+jRG+t75O4L(AU6gdDQJdIvP>NDvnmjafrQ#^qMVscGl-DV@foNrL2&%Y1 z;5hc;Os7HdSPSF8$5=UuhBWLgx9l92@Wv_Q^@8G=_`EH$s!bUB0Zht5wRR7GEZw>Kc>$f-p$aPQ=E^k{= ztJEWXM_RF_hBhRSh5v~Qb^pCz88?B-7^`b-XOPSFpjHfR@O`mmg*-WfZfFg@#sslx zbY-0gj7spJhp=MIOKC6WU60(@vkdZNGimv{15Mct7>TKfPG(msX*;4%CWuiFSxNpI zT|Rysh4RNU6TqS=hFzM?BG&HM%m=azr5EgvPs+ywQ?yJ6>lvfX@h9R2D(yYrysx3f zXO#X@9oe=lP_*dL9voro(nk%PS2qe>70Xq#e4IjP*nS2}cE)`6m|6?7RC~@eAmuBO zpM^4~*|o)-;i0BRTFz<*>W#Zt8ul9E2U5K<*`1MtaPmr{bvwXoPdeZRdJL$P(21Rx zs%3qbpzAYMi-oX?v|US(=4N=y6URz!*%aP5O<40MPS`l0Un$NK`)q7PA}o{|7`5ft zi~P)Int>7*J93Wp_~;3C3I@!C*;x%+K1O>F#DvafH}s%t7;%6P)5AkHJHLQAv}DX) zeq>BwI&y-m84`sZgHIiidBiZtF(5JZC1Gk16ENr}8EQDWS-|BinDZi2!XOIs{n9E~ zos7*;2W|m2Ayc2eY9GD1Qu<;n^j5*cnx9J^IDM*`hoa^+dHETcm4bQSC18S)(jc(! zZGJr&Szk%9N*-i^u$PA-HaBqr^6;OP!2U9&h3e%0Pd9V(loCma^Gzj8D z)d5Z(d2A|Vfu4v{J`)^>207#qX6s&|B~Nihyy=>iK}!vNlaKJFdMy7%uHYsM zMrP(oCE03Kk*8~4g@!l5nk_oY7gFuG2XBQ1I93BkqpM}ei0As}lSE~*2t&zd1{WYY zRE<{z?!iBL^%Zedo`-o2cGdWp17;|^_EP;(qqmev@zJ8+;uE1dJkciqkjkP$VNeQP zER{2bm2q>^v-GyNW9X9PS)q7`9af9BBKu9K_u}}6Km5jAtbQ-Kw*#r6X}=&zj-s!s z^g#qNjv}tbZV*s*}~C!Np}Al4I(@A`}@I zZXeJ&yK1)Y0&qc-eV9J%P{BUk&ma(oZ~tiSRLasaZfado$7y4jF(hO<`E<*cg7^$P z){l{TTQ(T06_b7X{WQ4u3ML!hO(61?{t@vopa$k&K(O(p6LC?U8n+TdX_<{Uru#EH z`jn#Zqs1URPPO)Nvm&6#WEml-!Z;`*jnc73Hp+P;68UXy4Thx}dm6iwnW5Hb9q2rQ zlA(gapf6D4IlUAb1-AgoXku7J?`r5CUJ(ifzC#GnMaW=%>d<(s`UoqTNbAOOuh}sTrgw{zKHjL?*ml|v4raur@RfUN-Z0TA zycSoOW+k&igVmp**0%asZQ^^I5Ts2ja&{|*tig1F9VtH5XWT}?)a9ZtdM-$NSA#e6 zVk}!fbND+qINu{auQ1KhmmUTHqvq_RX#r(c*8Xg*wJxd7zcoCZ+PE5}q@?uvWgICY1CZ zPfC(89#|qsUek?87#@)`N+ZuEHX(Xev-FuIc9c{~AT#PKZi0UTcDVIXj(m>n(Uj;* zltIMPmlqGZ$f&~gT^@UdqW4G6(@5I6lQ?jkAZGVvma7D^EnQ?pjX&1C*FcYxl^w68 zI>RFD9sbIM_BT+Csd4N*az1 zA&|Ux;JXQq$Nj>SgwNcLGY*q|$d?i-ElF!irc;EXkWG?E4ks_X1UCoZlYLe77;YOE z8F=*Dc7+;%ujNVY3Z|Hx^C2(Une zhgSD?(uHDB@l8(j5d)r76+3zE`rCsKb`du3-!)2mN-q(;FDg&fQ?AD`kyX6o$9@xg zc2DY4GO_~6(|^?#t4s_F(3YApc%owPjVJ7J2?b7kB*XY}m`&Y)0Kk8wXN@IJB4s~k zKSwC2)#r)PZ2_$8cDLS$u~aqKl2As)iyIL+)8Dcxs1K5C{)!6bgQexOpk^nR{8mpJ zYq2<*-5sVCMk3HkC_90BOWfov4+=nxn=FR;<|G*oM(!)}MnFYa!&(ALA=Ib=m^h!D zzRKQs$db_o8Fc0;8(<$dC#Na= zJER4RB59Y(0%!1hCD4XiKM~t&z&K9nUTb5Wc3^s?qxx!AaWF0pXx&+VuM*=23w056Ng**?Vz=G5^slMs% z1Ki!AWXWtho#seLJ|thiH!5hhq2k&?uTtYT zzCktmDIb2zfL{4#I$ z6qkiXa1ENV7|-`_yrb)O1SY-Kou;mES~Rd#?=kOG*|FZhJi`m!DI^!Iw`+JBY)oxc zfNP3fIx)pbBBnsJL1$RFkoJZ6gMtpTtU(QkvnqxVl(%Ou0C zq1?CohxDIDdT=-^s@k)G@2<>OafshVB=Jfk+y5tWB_&1ftIpw!8?|L{x9Xg*>X0xjvgB#Sd)9N@__}fB5 zZ~caM%4N-@LO>GrPR2g_dZ`=M=}vWuvJx>quSbZr-0WYhULQ7w5P!Wkt?o=;m^v0h z9&P`Y@txZdpdwZG!M9XJ=Qzf4HtBcSM8q-3fE~Q@3`?KQBZVpuw`3PC>v7=Pq8N+o zV|86^c5n+&Wk^20Qa@SxBk4^gf!#1I$;9^tdt-pHSf@|(OpfmCr?)MDe30xl^;wv? zlJ4tz9d!M|^B5G9*(YXnaykES0nD&$`+G=e5hb%+X9!dNv4Vibn z@WJ88av|^#CE+1?bxkc8gT(X!K!Xs`bD+_?%vk}8mf?0h*FnFQh_0nBOqf6CnqUC7 zN>}vom_Jtdn2D3qetv=$hkr2`&o->tCoZX)Z95z{XI-VQ6vfc!OzFKXkY77XP-YtX_nhyw>FWUi&Z#P zq+V&vP|~R;Ff>YS%RKCVBaQ#Ek_`ndCBnOlWAXN3lrjyaSuG~@+UGQEb1V$~yTzTQ zk@6%39j)liUdp~zwqn#aWS-Ed`DiOGPsAqN8@WRWF8(4~a+pDv`<6}Y#z_7({xO~i zMvw75|2Ve|sh{&r@kvi{+KMw!)VZ0CWujswH}TEOuJl}u>xFZGDzq3t@X>$yE^lbz zRxNH`Vx{7JXdq{A$(NFr$)`bvXh?STgD_o_emY9MJbuuDJEF0v*@XJSv@3RxQs9y9 z$hm20Au3-Te)J0-iqWK_HiyTH>yv%U4Du@GXa>r9`<0U(ChP^`K=P&y2{mEW3?>qh zuDPtVE$mh)Fz*YLr)Bi`iwN5lQ7WI*NhY}ZwIAo=ts7y?lv#*h6SK$;pStK?9%-i` z*ok0~arZXtU#PjTXVTea@0K1FtsXp29Vc6@HRTs?xmxnf&J25Ysqn$I{J7vfX;RJ@ z&aFo0nZTnML4UI`BWdUcT^Lid@9=2R_m+gOZJz1fipG<1ySV}~Wd~@b$hw^bh;O1a zJLVoesY8WUrn9zh{&?+G7(+4ZzTrYIrlTmLLmy$bqd=n^!<3o^t=Rn78<>A%+a8C| z^bNr%Z#pS*r_mBZtNbnzrw!r^N!sIeOXh0grPJw@h7NMLwjv5YVp8`|Vpc5h9qgm8Ac)QJP<=!}d#&z}=AC73^Zr_l zd_(``TuKyF>BZyx9G4RG7Z#wgnNWKD(5=Fwk8B)zHjba=E-U%~n48OFdZ=yfbnYLr z3v)~!7aL#)5yz(r%9ypwggPFW7vbL0mj;|55y^c}DQV^#8E#qqCu18nkWZ#;Wn@t&{QFcCmr^3_0ex^Ejdl>Ic~!NLoe z_ROd%Val2DqBqHSfRvudsDB^&6WsD!6#cm^OsU>dx%xFyL=unXYQ39>E`jX_`T6v?OOe+v)yu_abET>F`&UGazvEm~ zgg3U4hQ1krSm$`w@j4IL`EPTQsxi7AMDcABG?>$wi{BDIS!MgPJz%bdYV ziJRz1cco+&26M;Zcd%!SdKEACmQ^1QtihO(BuyFX)Tv_yL*q~85{mbEHOA{I^l8nT zb@U(-g$%{u%eql!p+d}Oc03P8HrHFraFDFE@qb(T`o;4%1nsdRrzq?Wqyt0JZ68&N5bizfje+L8nGr~1 zqTTV%y64Z7!5I~)^=WfPsQKhmMwp?TM1bf~a@R5{LV7D64UbV`<&H`y19KU@xtL0N zq-+!c<4cHaM4704-3Q+l-*42SmMG?=mdY61->cidSH1k;e_5#C6F;H(b~Y^aMk_Nc zP;7p(GId~yJH4R)o^$bILZX}sIXVWzJ|Uf+<<~eCTA;hm4~Iu(8bh`1<`fA}7bs$xU4*=?Fbyq^uxIeqY|*(~F6`NON2Yex|#Uw_ZVqqLj1YzCvgZ34Khhhy?w8 z`82BkfkCAw*34`WFRLsxY@g6 zPlI0A+gyH>oM)&r$k(4W?WTXI3JuK-H=)PqL4I>jZnz8@XN;#AJqyTUNwDf$&-+<_ zSt?z9DYIhab~5_Av-mjhG@j~Z{{7jL>ru?$rR`MP+{9S-;nV$coR>}HWNP6=CD?fa zvmB1IZ?fCZ*D&D54Z?9_fT6|GZ;N`v>Lx*%!Gb6zPAv|UIr;wOzCV~83GDZ4>_ zq&0VhbL~M)RrUrWjlY7d7`P|G=%#KQx6YtpY$PZ^h@2iNuZV(USnXUGX5^-X#9t(s zk~{uI7b!OpDRHo>L(?x?8p4p8F@C=P%#_r(c~d3f7$_2w}% z;pJluGY4Ec z)NF^rv;!+TS*k1&CD`Ex1^t8;FkWiJ%d2!Rvb$cw05$5km{}pTUB}kdCKd#!6g}p# zJ$BoaO|-g)I+Ht9QGIhGu+voFry45EdiikgRa?F=evgJ*i2-S+wMy+C=rF-kyY;ac z?w0W4`|Zi2k>tii$Grs(Ud15v3!$ z+B?3~(|LHxsl?xw{^r9oIa#~L$NhFA_UDz#PhIniEhHwh6}~Ib%w}HaE29P_Ww|M* z9uPKlm)A!*JQI0}nuN*RGUXnypRX%$k#MDWM;N0T>`Ns#JA_Drk%X|`(euqt^s*?K zZoe%JCuwEd3yHfcFrzQ8Gjc#N%@c3Rjbe(ewxJ%K`8qY1)(3-5x&bL0xKRR?|GMlL z%u>kmoo&?EEB4xwzA)vb=@V8(qJ$hpB{yexrhQ_H&*zML)Yt94I2e|ier;sM)UONM zc}t6@M>GqFCu{|yD54om8evCN!G@=1Q*l~ptGa8LG<#^|H%#3Pv_CKl%y@^Y?ij%!SY0VHBM1Z87|@zWmpNAs7hzDj3AbLr$w6J zaE$uO^7p#_g_0{QI758uCQJwd7)2jok~yNrCH)vHGAld&DiRKqCAl;2LYxyd4)p zZh`;Vbx|@Kd6R(EFcBDRN_B(zn$x1!H6CN}qVTJl%-#%v`CF0^4x%%(SR(e6d!|nTpXI^QW^tc zpU}*ZYpq5=6mwMj0fr_6#8Zt^u8;Wda7*mYFSquQ7J}J)-Gx?~SE=1f5M^KyRmwE^ zmc0(wEOdyPS0%HSSWmY<$Ukm7{yxslkkhftF(-zdQ7c)e3SnWvr!kRpE+oV92RMP0 z3e}u4g`OE~oRgv$t}ZF|4179CcdaH9l`ojbj?n0|*C553>@J`ca6WvOpd(Pnur?ez zx&UKotaq?#`Ru8=^bJt+=8AKomG+eDI}PDr*f2xca7kUHw4q9T+iFA9cU zSVcW?lY3z@^)M}$bfU*oWilA{M}1ji$3iPC9!&Z|iavF5WMU9KjukSZ8zNbTE6?;~ z5MW2W(WZbh?RoCmkAWdtspRACH$6XoU^b*|k-FYVHP+qZ(6Bb&0{{q-_HuF>%5rjl z+>Qjl2`MiqRYK{l24U1AZPij8%0tknltNKM`0uQlb=kwCru6J)d$&qMCQ4|P-Q5XI zFmdkL^{7npyuICska}rwg@l;oNm$OhN+!UAsL!t5*TiCOj}asFo>tg=q=z|Vr7AP_ z2U_T2b%7%Rx|HGlY7&{IW4)e1t8a&{Uz2|L(sjK{t`X0O7zjS2oW@S@i}16Vo)S4B zP&AO&iv1ABgyoQO1OMn_)HQDu2UDESa*Ox8AJ4L3<*mnqSMi1TLvh9Nm6}~CzJ?o} z1BNvM24#=#``k2*M?CT!2$k7sqxd1icCdJI_I|s0C7#s6^T?Qx{@OKhmJ1;LcQ7$fDUtdmNK2BE;TP_|E5fLtKUM^l<4mbse zr@xDrg&&8DC*4no-!LFhPb&|5H!piv7tl{k3rkmTF9|Rhz7F~w+|AC_%hl7))$LCf zE}p+z0&WwoKbN_9IJvq0b|YL(b@hL~$T8;D09_V8S^aQa)>enMHpp@fAkpqADGP!3@cs11iDl%Jc!LfF!Z zLx|tXM!S~mRKWf5NPU&}v3LR3aWSpv+<`8QWIoGiS4N&zn? z_Ab`0zMg*(>%f_4ds+PSIFBG7A3q-tFCQS-61WdU zBDwgNM4kjsO3R`e$JTiT@SAI#53^H4A^ZDSxf}Ry4Jt z?!UeJ?X8pjuWAVb{k84amWLM3a7Ce(iW<7Vq=qB^1I17DKPb5Vbx8gHJLc~s{{j8k z$HcjQwzfaKCjM8;68#7Fio*j-U0qbk-qXv~!~b9K_^*Z~YGL(TDp~!CZ|gst{oA7b zKdEW|av_2X{~L;@tBsehg$Go|7M{5hV40tT2uS0P&J2Rji@e-C{2=DvO9ji{%iwDV zg=hNzKIQ&-nEbtRo)$jPe^AZJ&cekO3ZHj=?^}Ne`_EM7vEUKn=CLQwv{7y5rdWnocX{@=^O{|72_3kpJ^0^C9z!h(D}98i&; z?S`M*nnQ%whF3_0+nV3n`nUe@Kj`JZt%U!I%2uu}K2Q&@fAqAQg$KNtdBMw|1lY#I z)fr^r=H_H?^{a(&`M6mBJ`es`-auZipualjzrxrW>S6z10_<%Wnm>=H(Nxv=sSm8u{OO^xsuaKnFes z3Gl%+{6oEeY+V1fJ^kLXAirgg0z5T;%_6@}L89$(A!tir7*PjRL-zO=!U;ZZ_zYl%?lPo}>|1kNt z?E4>c{l{GYmIeMT;{Qa~f6Vo7S>WFy{!euMzh*9szdo9Wy1>t;zVHv;Q#8`E;2+wf zSgI;Q06%_y!QPam!>^#bDH(bK0GI?np9p~5JW}{YR4-+9dDLwTWDEg*f7&PW000P} z43W|CTRL3z_oJNm-@QHQeHe=5i%-u`>!3BmsT$7U_{@3W$&}Bh1&=J{sS*10{@8&oyg0`~6n@0nMm&vF3L@@7X6U*P*fh&mPu8H^Cbc*K@#GjGR~{`;}Rt=Lf!= zRNr5{5lUtwPpc!B;;QW0U8{6&qcEsSiHptnWaC^;QxV2wml~-1)qm2DHx;D? zAommCjDx(^;{APlNz7q0h0&5D5gv;Q5FpJviFm4K_u69(L{ZG&U9~ zB%-S}gfT(usX5opuBu>D(-2{4c+0(GDADfS?3bjLITQxKi&X1AV2s-v1TYvsMZ{{h zA7?yfQu)Us;F+_*RPFX+l>ZIIx{vvlNQfzB;LGBg=1NK_PZt{2oCTc3&uMsg=&=ne zi?3oAhaAhQ78=P%hX|{~vr*ONiW_kaDv;I#ulEArM1u_9`3&YJ`ISHXK;~SUn0j0n zyFL4@4y6k)mc3PQ5cqf_I*%Q55ZQy#tNPl_QP#9f@4+Mg-TN$Q6Or7KP>7$OGlbyY*=9b5m4DYkS?ur#j zuX}l%#ScW9^&HRnfr9af9QIhhn#=8xK=n6)_t2WQ}Z^yNNR1X%Q(z2Nc;hZ z8^G`GQ(c!4ar*jsh#eDwlx3wzB^aD0pFZZXdDhPUx$;A)zaF+pCCCOUd5Tc*)B>@( z51S+-O162aV8)vsoK`RpaoI1rvvp2f6JK;P*Nq^V_BMIVfU_9^BMm?*oEVQ77rRwG zNPa9XnM@WW@U>HYIy&p>HKDp$ZkW8t-HORcGCshK02rnps@?Gt0%>dwt`Ccfv6U75 zcty$qk1<=;BC;USWLt9+^q%&#IIA8_Q*AJK(Y`*~v4fbqxEmz@ofxrT8E)v};fJ-w zHJ2Wsf`+UmxXYhs0`e&ETG=&-fbx(=x9t%__G7z#Vwdwp|23NS(+w$_wE-*5eW zT6~(C6#`_g?FH&y zi`(R*HKBe5ueV^UF6mYfaWb_+Lvr|msd>1hTk>a#0SFKXW9!Sh)a@7>i--{Zx*;v& zk%nVCM`silv@c$8)gG51tvhi^(-;vmgFV7J&RCE4O(2)CEOT{tvQaUCJn62N#`W45 z>{peTtOx+^Q`~xeGhe*aS1t$n>YI~A<5Z3-6H{G9;d1wJmU((0EjA!f9pJ>v6TK{< z41t7Z7B^QP=gD2#X;LI$_mshtkE^=L53Wpbp6p@Z!3SHhB}vkp$D!+r1!-~4J$OM! z@+DJb>r+;*a;CM@GOfIO(y&LD)Jywc!@cLQf)h9JZA`T{*Z{rfYfGAIlp|hhtg+9_ z7nduU+i+KX!h@Sh_SF(D{1`XEYt`<9?I&={TU!&$VW7Duse zA6zL5UPEGM>pgj@Mz&*Fiyee@1h)av{!8swcE|Q0B#u-6pCOj%S^b9ihD6m5tzgg2 z(X{B7xuj0BToA!p_F0MguOtPYeJj+M*|bLqt{h7bea`Yd@owS+GV}hdoe2hdgzcb@j~HpSgcNb6kYR*n;jl) zUf}gKMOM~)Jiyhqt8^f^Mg2U`^iW+v=VwW6K=)H`MaE-!LVUb$B<*a*ta?T75h1_BLyeFFfy?soCY8~1itA|k5y{7 zr>y&wg_ux5o-jrm!dXcGe6w_m=^ho*SBYal+!6#-5#wXX@k3jvTaJp&NMC-vJ3V1c zRVw#FCO4s&%=tB88ygTcKwv=?p1ZEETu8uLoSYQ7y}3Gkj8yG48&YrJx_KkX1uI4- zUCP0w(6tcVW6(t%3Z3^}#!W4ERHB%>!u%MFws7qTHq%Y!1xKWFv8*75d>0Hv_#G+F{d^i*WvNa;8oZ*t@C%Yf#&IPcrc110uUIlA)qAblIpzA=tPRf7v3ix%trnc#9_rHWEP5RhRA+? z#jWux%8-dr@l%=W-Bt^cXD*(5++?Pi#Vr?A#lOBa}6to<^3$VvNxbl}1#tVV4wTXRGd zZFTyF-k`NwnU8oiHFI85XKYu#B)mn66hd%&1Bmgi!b`0;6xDkRMctLRZ|x2Ys_$<` zm_xYS&eI0YGb0E~q2KVhDYa7Ip{G|RkJ%1ZH?u>uibaGG}ZTH2)_6L*N)2r-PjmAuqoU!P@-0+9v=`&PKx?s z+F22zQsdJZU)8arA)%uiN7IcVWc4OnQa8-~UWezAUHQ|FRp65emoTuFEJ|Agd^qWN z&g!4~r4k+&@;SH*lXFXurj~CU89yE9nF&x+V(id}Gsj~oY~R$amJm+fx6s}zY->^) z1sbzh`ufGrXp~qa4_{c3Enwx%IV(X_HkMxakBL1tQzrQFvXR^lt?jZK$-u0a=kdzq z9Qn;|vf9sx;6v%ESWby0Tz*#=P%F-_c&Ys1TRU8YFrB&sJI5LX$w&TNx98KCrwwpF zOWQtIa9~Ub(_D8Bx`ve4O-0Ymh&!NE5hc7L4>d*%IC%g$S|o%WWB}9xAEd{*^OHzJ z;>*43Q%m#tc$SJUzU#TbqXDny_HpgRi>LA_-Uvm{pbP}JVN~UO4Ld;6f*17^-eJu*m8}R?9fA;gCH(@Yogy6q zJ-D781on~|uAM zFP3s2G7c&;QY+pf#VUoF_;kdnisoLPepq9IbE+FZRy+i*+cX`2e1KSuYFr>%Flp&a6&%$#~>M7$r(GrQ+k`esBAZhtT)hec;k4ju$t>cF&m{Ndw$q-H48*>H} zDFm))@gE}m+*9>v>kAe0qwAH|q(UgAtKyI?AZE0~ z*H6#c?1YOqKEq7aQEAk=aW)<9Nb;cB1UvVnA;Ij+G#n?vbx)4J3-y?o(tMwA|DR0)EDld{jG}3x#+-0Xs$YxZ*5hlh$D<+Ysb*U6iLcy8HR6{xpEu0t5ogY* zt4QAmb>*rZ<8o&oJb2~}G&eC{n-Ktm33ih7U$r>mc+2g7<9fNu4tp+-0kLpSC>2bC zJ3UgJaS+Q1V=6kkkZ7%7J!?;qx4UzU+p#yFQ857SgN)}Bm9~xMKMqgTG73nlRwtueHO9N^B970JfplYqDzlM# zdH@p@j*2B;#?sCBO)+KUC(r70SC=T|)8YEYqBu)v`Kd8d;v zu;ONk^D5wgFfpZ(wB=QzqzxPC^b^6XC1Ds63^y%KyN9kV69KFht%o(|IoWH24Bi@_ z=+T?A6j0#Hlmr^}>a~C89D%&Utd7kfLtOE*qs5Lea-_cZgf4yn)_uyqtV~T1q9r&Qgj^naxp5A4V|8CW=6+&d7c$>Y@dUg_vZ*6=}@b*}TM1 z=ugxh5ahH;$-#&|=Ve^*cQAUAs&;|sx-n=3q3`3Qu7Ga$wv%EX%4>0{JJ~*EMCwr3 zn=_anl&-U80C1u&Aixh0kfNjL@vmc|H32^~q4kGbU@i8_E%Y$^^-Nj4J8fXf;kO9cU?ze{-r{c!F$l06?WELpM z#ao?v*K3h0GB%JYN_d(Nmb^v+<*Suoi(^r0@k5H<8r<|$EY%3#f_A_+Z-m7ca3}ONljv%9jm9gc2Tb z7r10)-6{sv6L#x-%p2kCu(rf%d*Dn=k8dw>&GN;V|AnNm~Fya8j zh|p4}>>Hym^F8e;H4eJ9$jl!k>=iM*8wiUIqiYy{%J2iA0=RpENUB2$QQ1sO=QEtE zSiSE*Wqszs*l~+=F{DLt9lar)0l0xr(@AkX8^28s!srlgy^Z@Mz<#)OvnQq2{F%J6h&Vf^eOMiA5HjL^=U)((4_@QOnG^d zC@^qS!R=mcFLd+Y>y*x3bDf+Z8;l62<`6Ve_%Y5k^VA@LD%0X5dR}8hDxL0E)6Pje zf2rM!5uG;#aDA0%HI@vy#rvEDuguYVunfSK4GniCcPx^lcL-vGoaf5w~6Fi4|e0|@(k0I8Ss4VMNJ7RvdFq+FvQ-mChJBSER zBs#>8Koqzt<}2<_IPZrJh|qH8gmn)s$%6P}E^%q#Y@%_G<;!&`9zYH^Xcn%tLrDx)&bf zfg{#gTM`)IfwV~N->RdMXo-~=r(4&h`%{|B8{pU)FKm{&8d``~;>K>B{5-Ua%#}+k zJyfW$WEvHb8>uVY?Q1)Hgf7huKN7ebqa-LL5hu;ow>SzmzwO{qKE~mT!Qt%7a>2E? zv=hF#P-n|?Sug1WrAZ)~EQzH@tvY;Hy`P_Qtp3E$r|OON8eUmURRFA2B06wQE8&Rz#R19|72%Bj2>{_NRMx%KMekr7hC`S9f3i7S;EKJ2MO*AR&!3(ka~` zf^>HyWdK8W4Iv299TL(tfHYDgDUzZBl0!E`cii*&KF|Fd?(^LFbsr9Et-aQ}-nI5V zd&38DjKivtRdikZZ4NL3^T@>5KNvV#Ud{L$Gj7qZ@CzQl#eo^0Exd}W0m z#Cti@7(ukZ52Qp3!LYXK3K<1Dxvr^AyzNRMjG=Xu&8{l^{$THZz|EC-WK=<6iRycU z2*5EpMkuRReg@%{KQ$Va#nA)+c~f`3G%%DBV=>;wDHR0W%7Oin;Hz& z(~0{;3!eio}0z1OU&!JfOL?mIn(Gs7%1w7`X0fCt(!a) zq;|2Xjon&J5Fs3uI+g$AW54#CLX53NBZG9}qlw`KEF^QGnwav?_mh#s7vn~qAsiAI zr_Xb8&2>MD{9`{1{F8pi0cMXg3T^CRNDIPlp7#tSP)h(dX&h;(uFeJkw5_dnNu+*?mW=2)(Gl|3? z^Hv1552_$lhW&FKU!|l(+;6|#M=MyTiXGmqt=gO?j zU|GPAh=pSHJw})PGWn(NSOPUCe$W|S(c;eN!}0;~-qG}pGLvzb8IZ%!xuf%|__&b~ z%@o$y!&_y3-!e>4;+0~0-b*?b5SDFBvFIv%2HocL_^J9^l+*q>+n1^F$IZmgq|a*f z+2BC{yxJSJ>*C05?=kn}D1WqbH<&ixc>gay;`8_VC~|@ZQjg^bBtL4~J^Qi@%0SZz z3c~98zzJ2QGX1@T{1*Q&`;sl`xhC11@h}6$W20QatGqLIHw_`$@_%6_Lv)JrKX<;- z)vml$BG(oyocpApBq}J5#NE4k2_{TCc{3&27%`BH^JxR3oYi)9s!o17qRqhU-U*sB z`CjlY`?5-u|1l>x5yecR6go}%hy(l6K&6SFD}iv)w zw?vdonlDd)%`x8&q$PV!-2cN%ruV0tdKq_KEP>i*pa=!B)8b_zb*m(K=7>q8VRAIj1^D87 zQk0qZIEYtIp6iJqG_XA^Pm(xB@~r?rfmDsMG88{W{j(9Pa9+$Eh|=gSvyEk3nGIVS zNck6)k=uK~U7noWaX(lx$Hwct&S~NRKYEg*9t&A07fV!7>JH80xJO|BtPTE_y17pw zMy}P5#kKvC3;Za@ZUrBOi7C&7f*uxVutu`o4El0T5q4BRS0N>a`*NP!l?1(I0WsR4 zc+McoP?|H5=IpU{In^)8i2;SgvW5Q6APYF*1rM2qYbqQfc)^J`cop4&hlo z)0HBdvxufQ$C2~RwcGh>kfb}ebMfJ*#`vkP9%Bm8QxJjSPLvUZ$Z)9d-8}bujl$$Q zKLl>G-Id@RnF!98E27oczOpP@5v11}4iq9U@Yh-D(`o~bL zEtT>Gsk0)nF*U#wH?*Qaix1ZzJSH;LIL6L~VO(vFVbq^=Y z+q)30*V+&wajXM9(qbqC~B{6iqONlOE%R2|( zkiEy5arhvIBPZTw#h3{4GWZ@}5E9*DhFV49d@zR`8%vP|{3pG($m3Itg_sB^GWlia z!{-!u%?u?hEPbO{`ODd|w;>q|$lfzbll2vRQ`;HD(Gku}(of4LEQLNcO$wW((CUx> z&q6=71d<>GffLW{K3GnhGHrLI+Fqw zNBVnE*h;!`%|IxD%PNNsM0>;Mz|MxqSDA-xsFyA|T1noG`Bi@?GoR#Y#mwsuFMzZQ ztSB{&e_P{}GMIe)4uzRZJoKID`@Y2&sGNL|KsVuIF5=`8qo?wXh7yZZ4M+M;cy$(K zuj)_nd2aL|+DRREv%*J;_56=K30O#8)9^`0Y&3ri!RCL=0cg&dCDM`T^!Z#Q6PLC& zu*%zoq`MgaL}K{QboIv|tuG4@mIfIN!iZbSZp3e9nGR~L{>F+_Vi2&bgF~akz#OjB znLN2{PlE~83I2H> zQ%n;IJJhWQtf|5Js>rntkQ>_4CydZzLwjH;|0mm;{F0&vcuk%oIU1oOfdb;5DVvC$ z!k;%U=G}G!F(_+ojQ~>1MeH6gbm*jzaCajSQjAvLYYM}wN+e;ipd> z+?h%_{c5)1y^}4|8uc_3g|hFW0_MKKENO_@8x&KW;An?X6A@40?HI)r-z)5IVS zu!*`1X*0zl;OOPS$lkU&tFe__{!d&4#U`k_Cn`7mU7?$N~R-%uhJkS^#399NcB+oE3bC-}J(WbY3LpV}%i z1<65K(g)&GhVmjy(e=q9T9`Pej`*m>dAiNtxq0;Gr+e-D_w zvi}V?+S#y8)XFI=ssU9nVhz-%_mvTaZ-JZS07Mkte-6r#7d4UoJ*o3G1Z~*+;sfOQ z9+ZHKDCw-=KLKOPv9RDgF$&Ca5VJupyMI;#mY^2yIt+wsbRkJA?SldioOIY&;C1H$ zq$!otKkr%AmM-O(3Pks7#;*uu`8H-304rGkNuq0K`EQ04MjWqDeCCqcs9`VrbSh?K zA6u*<`D0N|AXHtq$#XBVw&bk^r7;^aXI@<^QPCR9aLzm`rtO>=W(__OpIH{-%2%anIn5+}ycLh=;6czdkr57j#aONX*lLCk9sIxo_mZ#~Nr zD}BE9-IZuR)A;?nf@gU#_*|sG@NFkZ32uR_Fcf6O_@jZMfXe|)_L&2*=*wA3OAW{v z(SiF}hf;N;i8IcMq7u-4=8Ifv1ZMF6lz)2$`7GZrp=wVgmI?Hu$zsAzA+g{E_=-tj z8Gm+PB~-4^_p21fo(^-&dm7(RyOl(F9V9aY*<57Ke5K0U{@)mZb8|H&K&Yh_FVxF< z<&sZR4n^3|jV!ounLg20k81o|OALyxx3iJWCNfsP;DCb9AgwHKFSv*me*y3~`yYZ3 z2etpYe5YfoJ`ney=Bl}h3stFW=70i|F69qC2N7}*g-Q@eIj7)^-V)YRAiY%30MdmC zg)Q^^hZU(f7=sfs;1_Q8jw#W>9}3x3kmN#b!t5`R;fp`<02i=7icn>Z4AqEH01~9Y zQEZR)AIaqlvIx1om@*qq3j|c|XB`C!G%FzXD1j5Icz_9HkbHe++)8?16Ch_Y{8!P& zaFrL9=zkD|Q(GpjNXD>Qkn8$Lk?BeGE_@^z`YnC22%0aHTSE}~rrNEP%j-NPY}vEK z4aCa)@^;N$Ns8?E^K^euF{J)S%P;Po9%hjLWrjY$fcnmQl!F%y9s%aV1Q3m?@w-yj zr0`)u4-qbBS8B+vRY?^vftcHU2#bt)Cn`18Kc9%PB8BPic4cYpo9VQQ0lgqj)iWjbi}Pi2fJ2Od$PU$@1zQeeT0N@0(BRe8?x(lBUZ7S^WCl zOg$OR%Gw8QEmW6em@5!AW!8I>*B{dXmi_Q_qFDL!<`LlLEGau+qBe$hn!YpWk1Iro zMsjTFCRx}?G5mk&^T!7*34jW{ZZt!+MONx_F;a{gaNSf$W_+W^p|zU|5DBh8;-9c4hR&W%&N)pI7t%{zvAD-nH%{s z74-4aJEWxLzUp-YZ@7Ts>44McR9`ufP|}ME5OBS75Ef zaBC2a9Y2uJ*T}33JR}Q1Z$VfK4nlXgdtU#&TR|S6RTfYkD%9)ko*OS|*^}v0VbJ~Q z>lWC>RPK+24^~va&tQ8VX!WK$u$(B7bV>T+UK5ig-z8c7R++6+N_xKjMo+FY#D6KnC}6a-ep|hW#KFmK~hs{0DVA)Zd!N8MVHg-ZVx_ zUp~iSSj_Hg;lP#elcQ5w-CNhCxbD@{&Xa3N33a>rL%Hju0XkatyBaE2%<#Aa?=$ym zLTj68e*)(^uLLA@*Soa{$t5vlA3#se@vGlwyt9e?-hzr1=*p|#%Dri=mjVPVgB#eN zf4vt6lJ&$t13Js-ABhXTl zXio!Dd}sKs0AEhTK$Q;zU@1tVIt^y9IV(@uZ>+A86w_Z_I#>t?ybcnr{^o5@PB0OU z1kMa@YA>(fIDpkWr9Tfax7e=j^PK@|Z2CqI(DbX+i$*mlT6C7x@biLP>h8L1jb1sR zUna#0PGLLub9~P^I~)Bsx`1aqhiwkCvo^jd-?NYegd@Gf*%2A`<1CDlRTnr)9xMEu z0+mt{+HC3o$~4VgpiU*?;KUdVrF|mlgeO(lz?SlH*6SDTcXa-m&o~)Q7O)<~Vy&qV ze}2PE!kNOE;@@h2(S)RZBKAip@_`H;Q{i9Y4^mLwIr~Vn$uDHd`CC$5$gs8JOBBG) zl9B}v32IcWGfhzC-Zv@RKvWee*tQ^jJevW}OuZkVe_!0*GWAE z!vFbk&#dc8RwAt~#gIbOSgc(xwAiNIjf}5%rOnq!J-Ql@V&WVU`y?+20vv*0MW!ky z6|<|zxjl{Ri~m2QA;M{S-_oW^$;v5Ry>QPwZV3mY?uqFKhJf<2#_ORFAong(S;`n@ zYV+>?a|%8UOgI_A)>=4b4}3eMAAt-MZ^wlBIQ6jf-!i_^$F(`2N9n1X{TlJ)@r@@r zz)=)pLR~VpjC_Fp*&nJz2rIaDRaJ#z&gVZmo(l$&h>jX)fc;(u{0>E?Xa%Wj`_YXC z{bE<+26S7zVAf=v6rPCBAvNZ{NK&UUJY|7f!tanT6|cQIDd_;JmEFe)Wa{h=h*T8& zn8OQcEHc$3IQ>X}1%92C#edQl@@37ua^tMr2huGgw5MVw@ld$OQnY`(V$Iyyf!F>F z2g(I}De{TYeJY?s5mQgfgQMK92^pujbRGxo1672=6LR1sFcl;NjK_=7Y^Mk=a+9Ph zrv93(CGVIR?+Gv%36N-xy$EE+f5=y-8)gZoLm|RCzbwB{GypPJ8`q!9ZJeI3+ll%$ zEv^BWYrB|oB>(ZgRMFKP$Xa_UCw|8(fnT*BRdE8qn&71$C(et}Wj1Cj7W^7EK*g!M z2(0PhcHo|_ABnUpvo0D6u|TQzmFaNyAJtjCAO#)}PmZQTy`@7RW{0tV0RVIu(z0>6 z+6!bjX+<4C0>z5R!O&%z;8XkL=+&5l2v$JH_(U_t%Hl#cz6abq1uu7uO(=bex|3c6v%HENJ;hX|7(vJ8Uwk6KBadsf{EZl0mu}1+4F2(v zk>Z3qx8j75MDOVUtvtXjOIJ*7-DpK1>~lqtTc8LRyK zMAvrYBNHpIi}x-nq^aq=79l7yn(yYg-##_#7nA)_!6Z%|Fbu1IpTHSJpF^Jshyev= z>?zY#7Ci$wo;spdN@FbUqkEqxb$@OiHWzC(A$M~0u2@^(c)y1^Oizs5#od8Wp+u1Z zV@1p2A2{%)X1Z4L@{<#Hl(en7&m)*_Rp_U{uE58>e<=kGS8QvrYe3n79f6N#UdM_T z)rONU&jP#iAUtv-?V7bv*ahAB=1=eVFin}ld;F#rTmx~4 zT-FEmTH1IH+@N2hgP%WoOfD&t(pQCP9Nz6G9(;yj_9^R;sUzQ6@|^rw+b;jWUW_gw z(j2wBn6Z!`3+{Rv#`p7qFi_|d-`}U!A<+rqSW=+sQ2y)iyl{k zTVeQDH!WdxVeDbN!U&#-`>;hS>>J{safI%*)O`-^a7Nq_96m$2K3R#FmgF}?K?_Ka z=r5i|l_JquEjFy6mq=c8@pT)R8yN?tV?PRSd(BmPP_kxEEhjmTo_65C^f|ko=^@}$cFuDPy(BF%9`%fJA zKfR_bO`9j>pM~)*6;X_+V8{L1fL_T$C_~W&eAR>*H0_@f zsp|Hu3cE&z4ddLAx9(fSX5)~W`K?$CH6hv1X1h&wlNzEaWV?x=8x=%Y=&#i=re+xo z3LG>IC~9hcF@(HwmOzQ19Oc@Z&NW?rC;|JlDo8|w*L?QaBdLoxKZv&;4Lgk@M={vb z{vuWLYlBEdg`Oqv_I86WA0LVxO16G!clXscT#dvI#u7ca(~_$iyDYwF=W>&l33-pO zs7VC2_DI=#ro5u-jg!7{!~d7?o#LlWeGbU?fMO+`xS70We5HxcAt^Sx<6*fQSZ_tj zW{7R$n_|FZdTV#8wce2*wj)KWo9K1L0MXVza1+C+T`}cif@}p_ao{}S1D<5CW)F_} z{S&X3NN=)NN#AgIVclWJX!L3aq zA>S%Kr&oKA`b5h71(~enApX!tyBwO3N1{^?B&5yCpA?o9R=4Rp?SO?~^NHg?u}{-W zhGDkVSO+7ko3_Yo;>Q@~dHwi)qOPh|;GyH?hu7vA55h4Y)on2kTc&_d9f0lx`a+(( z_Kw5R`RgXQF>xs(Kf39%KOP;`v6MSRS@)Y#u)G#-cXZfIWi$kfV`7r2#=f61ZC3{R z2cX+s1>}Bf_DHZ$@|;~qpt;(;MUJR;-+@l;*k!H^37iC}_U)Esc7I28J@ouSI;h9CndWzgNpTC~eIN=7wzC1Uk#su!eukUvsBDd{_zbtN76- zg6bB_(wBowB;-8a5(Qs+K5_9rv&&OKzai_LXR6nTOR6EDb*nv$>mU=|BSsS5ZkEJe*NbN^P~8V6H1GkUOE zeOMXP!gy#_=)SQ)1t85@mn(}}bGOG(&F-|K1I8}yHe@w+7ky*icy1(QwFA!99=ZN} zsxZ34-&3>GvHZ5UQN-}h)}XRGX3#L43(-`IZPGg6sImkR(mJWvLmHwZQ#ioJFocCo z>^81g`q^b|hASn|f7n3xaH6-17|TcT81JUsFGg{}YfOzzgFYbYAR)#b*d%E=XI&%@x@( z)+i})ii4jId~Tf5^emyKrx^FIEs-Qfy&i?|o*#i0qPqP+f*q>_*J1fl)Udi+XkD$JzN8QKp|#AHaiJT@et0WIa=0@uHgfUb_?vi7 z)SM>c%Qo9R@u*Or#^}~5UOIbv$bvG8<*y}OS(eq%b^Swm!iOARZoa=GATwW_ru^*~ zdj&qU2f7Q?^YbwULZE3!fdYRJYe&p(*GYrrJvkb@K!G}{KBX(wqZ<4>PG2`=YMpY? zpQXxEw`eN)3{@x@oD!>tj4#-I2w1Hb?0~+-sS(;To!9(860+eZy7U_Lahh`mpXTuX z!U9D(;Sw9|ned^-c2NO6Y2S*IDPp2Fq>!FR~0E0@Psd zZa>2NCQJF_7xR-}9Roj4Um*=zXOBt7_P+%^@%=?fQqhUm!8c!_PR&bdZ-Pt~gO z#_HVksx4l494fQS@~WFa$^o(PHddT;!fm|IIe^-3S9afm?SUvgkJeVbtm(W8c@Zjm zl3W*KE^Hl3^>yl=qE=~b3>4hYWG*}ukj#BaB28q8 zw<2wxapt*!iUfyA98?_|-TU-8z96q=>oGO6MOYBtYRymfH|?X4;{|06v!3UH!z$n zqqiOmETD%Su{Z611uGa^ot0(RR>9|!H(l&(ZVNkE0_zFTBe}Y%u^t}5Q^9C=km%PM zqHfWFf5KA~8K~?Etl%e?kxl2}EHmC$^Tw2p`&y{T`g`eq6VWB;EibJ7ue@~Ko0Uka zFn8#st*tse<0e9(mC)$N?v4J2YN#zTkD=$&E*VgUfj*C|$XE3{{~?JOw^IgTx!K;M zFCJ%2|FsIGrr>MrH?jNe;)lrTFpZv?&FPGK$i1}kSC$h^Hk?0iM3g8)IxG|MkuOO@ z$o+&5F;U%qgGse!k7^vfp_haMnRid#W0uA7&$*GwKJ=;OJrl+e9v_#D*v-PXF>$~s zgd*D~23$`-nl~NW7CKu;R*w6`^n_cRZfQRk(fIQ-4y9sN^m3O|s1W6~B*<-70{CH% zMd)=FGa1Hx(g=wdp8t?9;czWDMExDtFblla-|Ob&2oIe1TM0hMbj={;9D9XfJ5quS zLDX&bz7FH)FpL7e6KL_0=n^L`tU2<%A~+I7spHWrw_Lx1{MEuHxOS;AZcq)0kosiiDB* z3umzNbQ3aF#5D26s>Qtd2Xi`t0n>nIFufwDD1QIWrMvM(j2%|Sp%p3 z&PP>*>>PVWZ+jU@(`sY+d#7gKxT?(xShxzh^@6m>ZA8AdeBN;{wNmw=oDmt-sHSac z_LGRS+`U3TJ|MuY3!9GlBgdisHS4WEEgTze!(^j#l+VKW9lp^e|CST2!}Faoy%DZe zd`M{}{+eNb6cF+^0LA?B(qb-h4#c${wDF|Y%OJ|kr<=6pi(X9%=QM^@^VGc|f!ZE! zlljrz7$||t)<22eG`5>%z+}PQjU-tS2kDphebnhZ#m!Q4xl%O z(QKh{A%_J_%CmsDj+SU2u*B6jj*^SIdme5vKbc9Kg@AM1vyS#hk->AOH@vR0HTrwq z->qB>$Y6fv?fj)h5!1(giAuPal6)NhHd$W1v=m5}+01n8jDUqss~t9oz^Dmkv`(fg$7ljjSg9VA;r zu0;Vdz36ukSp5|F4&M63mp~d{wmDv77mG{2)pNZI+nE6CCHq)Esik$xflPke5jyj@ zP}z}{S!06R_c)?7;-Op=K?xb<_tE?gDf}CCEmuDi`5orXJYbyipw{ zpkFzGXkcCak7@LC81D~0u$%1&#z1D56A2$52PG2m{E`WF{H{6rwTPO1&XBWB89m`M z9pMb?bl&{FrQ&xLbx?-=BC?}=4W7p;N4QxKG*&3xBlrt^6*){tUH;jQj$M-vekXU3KIN}@}!)TNF z&wnY(swbpG-POacD^ZaT2@xO+UALhTJ!O8fDjZwGnprZOlNl(Srtc21j#a@hJL)Fg zOToNs68_wcv0!)YM)F5sq1xxNRc8>chO6D^kUO4!MO4QUrSdvsb>PdLFZ6QUvP$^J z?y6ADR{Ro>}g# zZZ*v2PeZL3GYxoa3lVVOgPeY=zyo;KE*4f?fc?wgJ%EmqoA{yFs;=7$ntgbY3G zPR5^a@j<&Ba!+#4`mooZ=EE~Jz#$pheQ`CLKx{sJt}y=72)@L7S~tiXePoNgsBd+v z!Gsuz~e8uJ;-_hQ3&?4*siky#%HS*(c)!H9oFu>M&+XvWZkdrH)^_Hctk0&W#Vi5*H4f^1m-d{7#3*wJqS zw^&(tDSsgJjZ;&b^)0PNY3PB+gp;(bOme}UD=Z){s`#5qZhvyt_SZK&05|-9i{y?b!_PG=rGnkq!8OZ#>CwbgO9kR`m7|ea>mP-|8hV%9lfS|72`D+t%`Kv9Rjso0~@P{&@6seczhut(SO&6PwV3J!eP*(+;xGE7Oa1Xj~ zcQP*OpIrY|609Ev7$&#H-&5NeHNDU9`66oHy1kgK20>}eej^Q`2ARx90E2r5a+mI!`Wu`@J$|ZNqNDV0RTz4bw?- zhtH7BPz=Argz1g+JahIoFCj*7 zwR*RTW#0L5)c!b#_R!|RKEL*X5_Yxb8ODAtpm0!9#u62f)pVX>+2hEn61LlcmT#E0 z{?_LhLE7N64z?X(%;jVOb@7tlB0Q`fnFCDo^Jwp%9AzKpNIJNsbpXL?$GE*Rh&BGk z24$U&w!kyrJZTzt@FS_|@v6G{8aH{c8eeX*Edw}ae&#KEXXHo5B0_=);AnO*m5MUt#`o%W$%Ea}UtM`C!>Y553;+XQg; z3-17y5s1w4suvraRxuCc6HF1q|ICsPp1&Jli8BnLxb`S>Q)5i9PeQ%PUZ?Max!AtN zDfoOQT%V)HLY4>G>siY7ceS1RM;@5fdwTZpee`r}y-)+pcYS$>5GRFxBM!M4_W?^b ze2!=u+YGqy}X=@@S}4P&}OQ?ZEAUez<}rIHVH)OAlAI)ua$iWuf*;-KOSZj_K5Nf&Rx~J^%c9 zUmN9-A9n`o+i8P|J<7)-0K2A2hI;xkaDj5d7|t1c)y#c6c2&;T5cLb55plH-{-M9k z_tCDVYb2R>Xz@9W3r)`nY)z=QiB&OkTsnt&HU!@OP;#3qzxEFhK&PhtLev=SI72d58d&uWab>6$z}!)`5Yg*RlKp@W;+lUvpk$#>tz|iHENmtU%CE; zK13OPGXwVJuQA_e42|~eH*OB5wYn{DOC@aAa~_@U1aB6n$e2dLUV271Han zZEk{^p^8br9m)=OiS)MZ6Kqj#>b#QXTN!3Jj6%|uicYt! zql25l!sE8|gKG_g@{6P)3 zp()~c*Dq=^!Ld&5c0cwr; zyY^M)^Zb#9Hnuh0!WKi(U1h4ChrPR<$2i*B(jfkywVR5p7ZR?7hY6+!Wzd2|@8#Nq z=IyMDYWe6Hy&IiOJvY@BPxL8eMGEJ6_l z=PIpf$Ccd-6i-3-beE)u&*HAQ!0ha{BPuB2d_Joe8!TG<0xrSFyf7wepC(bK)_ z#XOhTZAaG6Jys^`=JVBh28NT1(i;?^`GNydsI>L?$^!pPgq-DlwD-U;h|>}Kf; z&GKvB822f>8P#4ZKcnfPB4Amp^E4Hme9T3U+DvJR7tFMn+a>YxkmoVfF2^aL z`2+jA6pb#kkyABHp1LJUy&p#t;CY%zE&+2IBV)(i(k;!C_B%A#J%2(tTM?oizSEI0 zYjZnVr-dS9^tS={_F$PV|I95B`SnrfN0$ycY)S(X# zp53@rebG#B{S+eh=_c8#Y0=9vl}^3(hbhs;aM&M{k3DgLG$CetVY^Q|-^XAtr>R@z zOW{iypls=TmePA1;aTc3j}LY7Md7_`mQ!Add+&G03!ZbaFpF{p2Kz*HQv0*IEN?(a zCBWsF2aqmJ*D8EyF!d$*z5j;+aY?PWHd^=r2O&}AB_Y|?&1sf$uESPKwNFCYs~xHs z0(>Kai3@!A502~gWMTO$XxX)*rc?LOgdirrp+^33>`c4#ZX?iEuT1dY=XD$j_F{LJ z`H~YKsWp>yh0e?oc-Qc9TLPg$A95YbAHJB+2&`}M zI{>X%hgg-U>YQ%A0;sj(6WLz#`lYkK31NH7Ptux}au+pzCS2a&K};NXhdNR$`95%f zPJ`Qr%*lOmQZfYMmtAh(KJw*AP_Rb^5Xw5}b=_boym(gA@*^P{wy3@t0u}WW`Ir;J zb9i%UHo)m#-$yA!y~1w7 z3VNYWVGcv^3_O?XoSq}<>pXU4IRnAD+;-W(Z-M(cB&N%PK1b|><3sL#C_xUvW3_f- z)S`y#n~_(&5SrC^ZsG#M0)bk^O=&4Uu;KM>(mD5(BhYFfMlFkCggiE{6yz`w%3FMd zLTs*j8{yA7mFA_SC$w-(Fz>OmfZBtCw>YiSnwtN$zZ*M&W&V~{ZXxF^%I-0%d;sq4pEo1Zgz%%e=Hcr+lJet?g?gB2vjVabu{bwl7 zrw$Sn^fF~7EiprESY1mF0$Kv6tISy!yqOb^0$*K}7FJ;#j1?;8?+<7z!P#(1=e&B9 z;30KWmWbaRG96DRZtkJ?YSnK>O(n5sh$iOH#d05F3q?2vU5qa5KQDY-!xc!#I$%Tg z5Lxc-aL{kAIJoqO9SJDOZf@G+3hJcCy1CwG$LybMJhGTiZMJ)6v8rNwNzf4DpMV{?(fgL^HyEv>Ig6GB`lT#r{^^NC^f_{dsdNp?z_ z(|2l?@~{D@S%Hgf%%oF3)h>Ud3OB^Q#XO{S+<(&lOrlB1iwb@mkYR*$B(ti0+~;?y=s8r19<>R z0c!*A&||iHoWo-A4~tp#>2;)!%+#V4UobF|rY3^EUsA}2G21W{CblX-(->Zmq+9Fa z!1!@VDfE?vB5;Y5h(*GQHAd^@z)~%_sU#1nZdlF=b;02lBXke zw})KP`hKeA?2>bUtcsDUshG<3cP(WJMFbhhly5s;_vcTX=J0OzQpgVH&9`pMwy@@X0NZGV-r**x2T$o<@7uvNVaRb6NJ{(=+z z+Z$#TBV~X6$!P=Uf#H(mgWWa0y(&B264JR~4*KG#ro(5O2}ch~^$iuPGf~d6h_6*O zw1}zma@Yu}NLyUa=BA&NkJr`rrIF*ag}}_)mqEPYSygksRmM!)%><3p zY0V+!%CCgmH-5{o$~uyjL|C8YIs&$h>V>GeHzmFZa-tI42Tn!@)-jN%$eyUV)$ zkk3@vP$x9wwrH~E+ttBfQ`PN1TRLmO*?NqszA!Pn;_priBV- z6a@?3yVn&-<|TT5vT?JZC2%~V(#wc4`2NvhX?=sYq*|90Yo~8wZMCuncec6X%hzEs zg32ZZK6H5#$A=?h?ss{n^zM!uJeNhqE^Fac@z`tU&4d}A(KeR{^VxLwk}9*cKj+W0 zDm}Ywy4|aOb0yfZ{rhUIt@CWvy(y2mk~92js;Py^c0*k;J|Vn*Us$%`qP{0}aeZ!uNfSf?Hb(hwe%Sjuh@^m!nT5 z{eDfIYgaQoAojHkt_ECgd{w%&ot|8W7T-BKgdKiFBY8hJ)zT8 zC#&9eHKQDpTf;KQVR%G2yc^RbODi8W)8AK7zoT?YwQcDgfs^=?60~TT(m|ddOR76Z+w)4KL{z-dl4rBQBwozsP#eE$v+<4<0a`Zs1f%}jqmp1UB8A_X(% zgKHjBnKbiuJ${*?qV%=Gg6KabR=nHmxOkwTL^eqxP_@y>xM5H(dh~d`On zn0frowN0FU`5$b~e7cYSAx5pePRdVc^tttO@?;-}+$N7o)v=W5KRPO}C1IlqbZvB+QLx^ms2WGwW<7gJb$yUqb0?l42(m)}v8)Tq zvv~>|W0oHEO0Ln}J##5F2OS0Xv(d8kQKu@FX-j`;3Uzagm;Ul^v2ReN;YOl+2rWs`j^Aqv<_0Db9zQ z3JIlAIeM$&4553bC)6y`Ib>M7@s@~agVv{pdpZl|tNes2*Ue03a}r;S7KwtHx6{A1 zSfuNU*bN3m?kv2*6PiOQbF3dchFE4Qlr_Klns|MztGXWKEQ<}=6}qohe)&|A$0f~j z>awMQdkEDpyyWUg`e~8Zz^7F6@V+^u&1U>z14bj~jl?4xGO79X$CyS;?)Pq+97c264Ez+%K-jJkFT*vV}TQJFnO)N^Jcm`}9Qgo%_FP6Yj0Zg2q>F<4MSH-s~K=+R&daSj==Dzjn6C zE$*JZFJsc1+a!||y}rV<&1%*k?68>B^U`W6SU-QGGVE-X_zX;;mR)skTzp+xxG|8R z#?izko;|f0a-$g2AE?xHMbz0jjPI>Cg=t*-gL8Te;~l3ZzV9v>#yw^MW&D7r3} zH9;7A-DNW2Ocm<>Y?rdRVI`tW@~qldBIWo#p5kejKzHy|apO-8v-B@SMMqcq(CY)w zfTzs~JE6AujyG{42|;oDF9QzIb>aIjovrKxOz7V9{{3ftV=*^Ab05DS-oW!%9YurX zY&E@dVKu9MnX)M}eXh}LG_yGK#lvaFGHw6Hcy8|OU#EEH-#?lycZvHxz>Q_B@B7ZL zonC%&wsN`ApSy98d|JJgz2|UKfjhQoo`*H(6cPa7(@nHNb5uaV=$+`?TvDfYO^14z z?5TLN%))@H?aN6&uj)FQD#1k0ET&q&swowT?u;VExd6_{0j+e;x?+=<&RY^%f?(i) z4=0nZ+&ha&!CX`Bl<&P6r1mdloldRgCTm%w#r!E{8XjmX*$X`jncBufSH)7BVl3#i z)~S1*-N~GOo<4u1sIt0BI`>Sr(mw@9nDphfi@ljY^U|qRwd2^|^D)11`kC)mX3Te$ zsmDYKcZ9(@`uf3itmAB0_I~b_XRvR~QLF=)!nI?{C>iRJpAd!)dU#slzC@>~Ix5yH{2v{a>dMooWk;K(Tr+$*_?q8k#H(!g%k_`p& zW$kZ@JL~x*D(a zkyEvo!(v6<*|>#>^WeSGo||eDmHaeN?%{0Lby6`wmmPBP&M(M&9Oatctba4dhf!+c zA7bC_BWP@%^nGQLhRWYer`@K)rfR2j<1CkRn#>s!BmCdJw;}0ew(w5=4X5rXx`bV= z)98Nd+R0~BXleMk-|k)T;*WE2?su8q*ucrT|9|`n@^1;Z$_>RVREB_C06`!XMNNeo IdF!zM14p*&djJ3c literal 0 HcmV?d00001 diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index f6c1433356..3b434fe574 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -102,6 +102,23 @@ class JsiRenderPassEncoder return jsi::Value::undefined(); } + JSI_HOST_FUNCTION(dispatchWorkgroups) { + auto workgroupCountX = static_cast(arguments[0].getNumber()); + uint32_t defaultWorkgroupCountY = 1; + auto workgroupCountY = count > 1 + ? static_cast(arguments[1].getNumber()) + : defaultWorkgroupCountY; + uint32_t defaultWorkgroupCountZ = 1; + auto workgroupCountZ = count > 2 + ? static_cast(arguments[2].getNumber()) + : defaultWorkgroupCountZ; + + getObject()->DispatchWorkgroups(workgroupCountX, workgroupCountY, + workgroupCountZ); + + return jsi::Value::undefined(); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiRenderPassEncoder, RenderPassEncoder) @@ -111,7 +128,9 @@ class JsiRenderPassEncoder JSI_EXPORT_FUNC(JsiRenderPassEncoder, pushDebugGroup), JSI_EXPORT_FUNC(JsiRenderPassEncoder, popDebugGroup), JSI_EXPORT_FUNC(JsiRenderPassEncoder, setBindGroup), - JSI_EXPORT_FUNC(JsiRenderPassEncoder, setVertexBuffer)) + JSI_EXPORT_FUNC(JsiRenderPassEncoder, setVertexBuffer), + JSI_EXPORT_FUNC(JsiRenderPassEncoder, + dispatchWorkgroups)) /** * Returns the underlying object from a host object of this type diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index ac09771c0d..cef8a5e5e8 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -504,6 +504,14 @@ return object; buffer != nullptr, offset, size); getObject()->SetVertexBuffer(slot, *buffer, offset, size); return jsi::Value::undefined();` + }, + { + name: "dispatchWorkgroups", + args: [ + {"name": "workgroupCountX", "type": "uint32_t"}, + {"name": "workgroupCountY", "type": "uint32_t", "defaultAtomicValue": "1", optional: true}, + {"name": "workgroupCountZ", "type": "uint32_t", "defaultAtomicValue": "1", optional: true} + ] } ] }, From b16e69fba9d9d9beb404352b950da500996bf11d Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 17:31:38 +0200 Subject: [PATCH 35/63] :wrench: --- package/cpp/wgpu/JsiAdapter.h | 1 + package/cpp/wgpu/JsiBindGroup.h | 1 + package/cpp/wgpu/JsiBindGroupDescriptor.h | 1 + package/cpp/wgpu/JsiBindGroupEntry.h | 46 +++++--- package/cpp/wgpu/JsiBindGroupLayout.h | 1 + package/cpp/wgpu/JsiBlendComponent.h | 1 + package/cpp/wgpu/JsiBlendState.h | 1 + package/cpp/wgpu/JsiBuffer.h | 1 + package/cpp/wgpu/JsiBufferDescriptor.h | 1 + package/cpp/wgpu/JsiColor.h | 1 + package/cpp/wgpu/JsiColorTargetState.h | 1 + package/cpp/wgpu/JsiCommandBuffer.h | 1 + package/cpp/wgpu/JsiCommandEncoder.h | 1 + .../cpp/wgpu/JsiCommandEncoderDescriptor.h | 1 + package/cpp/wgpu/JsiContext.h | 1 + package/cpp/wgpu/JsiDepthStencilState.h | 1 + package/cpp/wgpu/JsiDevice.h | 1 + package/cpp/wgpu/JsiDeviceDescriptor.h | 1 + package/cpp/wgpu/JsiExtent3D.h | 1 + package/cpp/wgpu/JsiFragmentState.h | 1 + package/cpp/wgpu/JsiGPU.h | 1 + package/cpp/wgpu/JsiMultisampleState.h | 1 + package/cpp/wgpu/JsiPrimitiveState.h | 1 + package/cpp/wgpu/JsiQueue.h | 1 + package/cpp/wgpu/JsiRenderPassDescriptor.h | 1 + package/cpp/wgpu/JsiRenderPassEncoder.h | 22 +--- package/cpp/wgpu/JsiRenderPipeline.h | 1 + .../cpp/wgpu/JsiRenderPipelineDescriptor.h | 1 + package/cpp/wgpu/JsiRequestAdapterOptions.h | 1 + package/cpp/wgpu/JsiShaderModule.h | 1 + .../cpp/wgpu/JsiShaderModuleWGSLDescriptor.h | 1 + package/cpp/wgpu/JsiStencilFaceState.h | 1 + package/cpp/wgpu/JsiTextureDescriptor.h | 1 + package/cpp/wgpu/JsiTextureView.h | 1 + package/cpp/wgpu/JsiVertexAttribute.h | 1 + package/cpp/wgpu/JsiVertexBufferLayout.h | 1 + package/cpp/wgpu/JsiVertexState.h | 1 + scripts/generator/generateObject.ts | 1 + scripts/generator/model.ts | 106 +++++++++--------- 39 files changed, 121 insertions(+), 89 deletions(-) diff --git a/package/cpp/wgpu/JsiAdapter.h b/package/cpp/wgpu/JsiAdapter.h index 08f33b496e..240149e7d6 100644 --- a/package/cpp/wgpu/JsiAdapter.h +++ b/package/cpp/wgpu/JsiAdapter.h @@ -13,6 +13,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroup.h b/package/cpp/wgpu/JsiBindGroup.h index 542f00fc1b..fa9328d472 100644 --- a/package/cpp/wgpu/JsiBindGroup.h +++ b/package/cpp/wgpu/JsiBindGroup.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroupDescriptor.h b/package/cpp/wgpu/JsiBindGroupDescriptor.h index f5d423c2b4..195b692087 100644 --- a/package/cpp/wgpu/JsiBindGroupDescriptor.h +++ b/package/cpp/wgpu/JsiBindGroupDescriptor.h @@ -13,6 +13,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index 2aeafb61a7..794c81d106 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" @@ -47,31 +48,40 @@ class JsiBindGroupEntry throw jsi::JSError(runtime, "Missing mandatory prop binding in BindGroupEntry"); } + if (obj.hasProperty(runtime, "resource") && obj.getProperty(runtime, "resource").isObject()) { auto resource = obj.getProperty(runtime, "resource").asObject(runtime); - if (resource.hasProperty(runtime, "buffer")) { - auto buffer = resource.getProperty(runtime, "buffer"); - - object->buffer = *JsiBuffer::fromValue(runtime, buffer); + if (resource.isHostObject(runtime)) { + object->textureView = *JsiTextureView::fromValue( + runtime, obj.getProperty(runtime, "resource")); } else { - throw jsi::JSError(runtime, - "Missing mandatory prop buffer in BindGroupEntry"); - } - if (resource.hasProperty(runtime, "size")) { - auto size = resource.getProperty(runtime, "size"); + if (resource.hasProperty(runtime, "buffer")) { + auto buffer = resource.getProperty(runtime, "buffer"); - object->size = static_cast(size.getNumber()); - } else { - object->size = object->buffer.GetSize(); - } - if (resource.hasProperty(runtime, "offset")) { - auto offset = resource.getProperty(runtime, "offset"); + object->buffer = *JsiBuffer::fromValue(runtime, buffer); + } else { + throw jsi::JSError( + runtime, "Missing mandatory prop buffer in BindGroupEntry"); + } + if (resource.hasProperty(runtime, "size")) { + auto size = resource.getProperty(runtime, "size"); - object->offset = static_cast(offset.getNumber()); - } else { - object->offset = 0; + object->size = static_cast(size.getNumber()); + } else { + object->size = object->buffer.GetSize(); + } + if (resource.hasProperty(runtime, "offset")) { + auto offset = resource.getProperty(runtime, "offset"); + + object->offset = static_cast(offset.getNumber()); + } else { + object->offset = 0; + } } + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop binding in BindGroupEntry"); } return object; } diff --git a/package/cpp/wgpu/JsiBindGroupLayout.h b/package/cpp/wgpu/JsiBindGroupLayout.h index 0a9a7b841a..b7316ce482 100644 --- a/package/cpp/wgpu/JsiBindGroupLayout.h +++ b/package/cpp/wgpu/JsiBindGroupLayout.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBlendComponent.h b/package/cpp/wgpu/JsiBlendComponent.h index 2a332690f5..72d97d9651 100644 --- a/package/cpp/wgpu/JsiBlendComponent.h +++ b/package/cpp/wgpu/JsiBlendComponent.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBlendState.h b/package/cpp/wgpu/JsiBlendState.h index d9910d2b9b..b61b70c433 100644 --- a/package/cpp/wgpu/JsiBlendState.h +++ b/package/cpp/wgpu/JsiBlendState.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index c234a54b2b..97d4cdd504 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiBufferDescriptor.h b/package/cpp/wgpu/JsiBufferDescriptor.h index 4328505ad6..17ddea0236 100644 --- a/package/cpp/wgpu/JsiBufferDescriptor.h +++ b/package/cpp/wgpu/JsiBufferDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiColor.h b/package/cpp/wgpu/JsiColor.h index 1adf5c9998..91bf26e898 100644 --- a/package/cpp/wgpu/JsiColor.h +++ b/package/cpp/wgpu/JsiColor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiColorTargetState.h b/package/cpp/wgpu/JsiColorTargetState.h index 5d7f52380f..f803df01ff 100644 --- a/package/cpp/wgpu/JsiColorTargetState.h +++ b/package/cpp/wgpu/JsiColorTargetState.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiCommandBuffer.h b/package/cpp/wgpu/JsiCommandBuffer.h index 44c7b48286..038081d49c 100644 --- a/package/cpp/wgpu/JsiCommandBuffer.h +++ b/package/cpp/wgpu/JsiCommandBuffer.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index 711c56ddd2..b5ebbfbd27 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -15,6 +15,7 @@ #include "JsiRenderPassDescriptor.h" #include "JsiRenderPassEncoder.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiCommandEncoderDescriptor.h b/package/cpp/wgpu/JsiCommandEncoderDescriptor.h index 7ab08c9509..683c4dac59 100644 --- a/package/cpp/wgpu/JsiCommandEncoderDescriptor.h +++ b/package/cpp/wgpu/JsiCommandEncoderDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiContext.h b/package/cpp/wgpu/JsiContext.h index 2e30b3d315..aeef7f278d 100644 --- a/package/cpp/wgpu/JsiContext.h +++ b/package/cpp/wgpu/JsiContext.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiDepthStencilState.h b/package/cpp/wgpu/JsiDepthStencilState.h index 58105e00c4..13875a9f2a 100644 --- a/package/cpp/wgpu/JsiDepthStencilState.h +++ b/package/cpp/wgpu/JsiDepthStencilState.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiStencilFaceState.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index 53e06d24e5..bf5065a981 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -24,6 +24,7 @@ #include "JsiSkHostObjects.h" #include "JsiTexture.h" #include "JsiTextureDescriptor.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiDeviceDescriptor.h b/package/cpp/wgpu/JsiDeviceDescriptor.h index 3cfdbea4cf..8ed757b5a4 100644 --- a/package/cpp/wgpu/JsiDeviceDescriptor.h +++ b/package/cpp/wgpu/JsiDeviceDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiExtent3D.h b/package/cpp/wgpu/JsiExtent3D.h index c547def623..9f4ebbd4a3 100644 --- a/package/cpp/wgpu/JsiExtent3D.h +++ b/package/cpp/wgpu/JsiExtent3D.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiFragmentState.h b/package/cpp/wgpu/JsiFragmentState.h index b056fdece8..b7d7faf081 100644 --- a/package/cpp/wgpu/JsiFragmentState.h +++ b/package/cpp/wgpu/JsiFragmentState.h @@ -13,6 +13,7 @@ #include "JsiPromises.h" #include "JsiShaderModule.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiGPU.h b/package/cpp/wgpu/JsiGPU.h index 8b697de7c5..ba049ccecb 100644 --- a/package/cpp/wgpu/JsiGPU.h +++ b/package/cpp/wgpu/JsiGPU.h @@ -13,6 +13,7 @@ #include "JsiPromises.h" #include "JsiRequestAdapterOptions.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiMultisampleState.h b/package/cpp/wgpu/JsiMultisampleState.h index f92f5efa88..114436f421 100644 --- a/package/cpp/wgpu/JsiMultisampleState.h +++ b/package/cpp/wgpu/JsiMultisampleState.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiPrimitiveState.h b/package/cpp/wgpu/JsiPrimitiveState.h index f7a8ae95f0..6983ae81d4 100644 --- a/package/cpp/wgpu/JsiPrimitiveState.h +++ b/package/cpp/wgpu/JsiPrimitiveState.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index ca9420f84d..78cdc32736 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPassDescriptor.h b/package/cpp/wgpu/JsiRenderPassDescriptor.h index ae517b8084..7bcf8ebdc1 100644 --- a/package/cpp/wgpu/JsiRenderPassDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPassDescriptor.h @@ -13,6 +13,7 @@ #include "JsiRenderPassColorAttachment.h" #include "JsiRenderPassDepthStencilAttachment.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index 3b434fe574..2066831853 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -14,6 +14,7 @@ #include "JsiPromises.h" #include "JsiRenderPipeline.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" @@ -102,23 +103,6 @@ class JsiRenderPassEncoder return jsi::Value::undefined(); } - JSI_HOST_FUNCTION(dispatchWorkgroups) { - auto workgroupCountX = static_cast(arguments[0].getNumber()); - uint32_t defaultWorkgroupCountY = 1; - auto workgroupCountY = count > 1 - ? static_cast(arguments[1].getNumber()) - : defaultWorkgroupCountY; - uint32_t defaultWorkgroupCountZ = 1; - auto workgroupCountZ = count > 2 - ? static_cast(arguments[2].getNumber()) - : defaultWorkgroupCountZ; - - getObject()->DispatchWorkgroups(workgroupCountX, workgroupCountY, - workgroupCountZ); - - return jsi::Value::undefined(); - } - // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiRenderPassEncoder, RenderPassEncoder) @@ -128,9 +112,7 @@ class JsiRenderPassEncoder JSI_EXPORT_FUNC(JsiRenderPassEncoder, pushDebugGroup), JSI_EXPORT_FUNC(JsiRenderPassEncoder, popDebugGroup), JSI_EXPORT_FUNC(JsiRenderPassEncoder, setBindGroup), - JSI_EXPORT_FUNC(JsiRenderPassEncoder, setVertexBuffer), - JSI_EXPORT_FUNC(JsiRenderPassEncoder, - dispatchWorkgroups)) + JSI_EXPORT_FUNC(JsiRenderPassEncoder, setVertexBuffer)) /** * Returns the underlying object from a host object of this type diff --git a/package/cpp/wgpu/JsiRenderPipeline.h b/package/cpp/wgpu/JsiRenderPipeline.h index 4748d57270..74c3397d69 100644 --- a/package/cpp/wgpu/JsiRenderPipeline.h +++ b/package/cpp/wgpu/JsiRenderPipeline.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h index 4772df570b..d783a85c1f 100644 --- a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h @@ -15,6 +15,7 @@ #include "JsiPrimitiveState.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "JsiVertexState.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" diff --git a/package/cpp/wgpu/JsiRequestAdapterOptions.h b/package/cpp/wgpu/JsiRequestAdapterOptions.h index 90e4925ac6..c87cf3dda9 100644 --- a/package/cpp/wgpu/JsiRequestAdapterOptions.h +++ b/package/cpp/wgpu/JsiRequestAdapterOptions.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiShaderModule.h b/package/cpp/wgpu/JsiShaderModule.h index ef5dcf593a..581742dfc0 100644 --- a/package/cpp/wgpu/JsiShaderModule.h +++ b/package/cpp/wgpu/JsiShaderModule.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h b/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h index ee552b8601..0afb97c35f 100644 --- a/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h +++ b/package/cpp/wgpu/JsiShaderModuleWGSLDescriptor.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiStencilFaceState.h b/package/cpp/wgpu/JsiStencilFaceState.h index 43fd7c80e0..87782d87d1 100644 --- a/package/cpp/wgpu/JsiStencilFaceState.h +++ b/package/cpp/wgpu/JsiStencilFaceState.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiTextureDescriptor.h b/package/cpp/wgpu/JsiTextureDescriptor.h index e3f3fe29ff..8bd9c3c72a 100644 --- a/package/cpp/wgpu/JsiTextureDescriptor.h +++ b/package/cpp/wgpu/JsiTextureDescriptor.h @@ -12,6 +12,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiTextureView.h b/package/cpp/wgpu/JsiTextureView.h index 5b481d15d5..ae09da78cd 100644 --- a/package/cpp/wgpu/JsiTextureView.h +++ b/package/cpp/wgpu/JsiTextureView.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiVertexAttribute.h b/package/cpp/wgpu/JsiVertexAttribute.h index a45efd3387..bce09e2d65 100644 --- a/package/cpp/wgpu/JsiVertexAttribute.h +++ b/package/cpp/wgpu/JsiVertexAttribute.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" diff --git a/package/cpp/wgpu/JsiVertexBufferLayout.h b/package/cpp/wgpu/JsiVertexBufferLayout.h index c2346ea55b..7242d3f37e 100644 --- a/package/cpp/wgpu/JsiVertexBufferLayout.h +++ b/package/cpp/wgpu/JsiVertexBufferLayout.h @@ -11,6 +11,7 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "JsiVertexAttribute.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" diff --git a/package/cpp/wgpu/JsiVertexState.h b/package/cpp/wgpu/JsiVertexState.h index 928c5a60a5..8c5b6b74bc 100644 --- a/package/cpp/wgpu/JsiVertexState.h +++ b/package/cpp/wgpu/JsiVertexState.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiShaderModule.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "JsiVertexBufferLayout.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" diff --git a/scripts/generator/generateObject.ts b/scripts/generator/generateObject.ts index ec41b50e0c..e7e84c7fce 100644 --- a/scripts/generator/generateObject.ts +++ b/scripts/generator/generateObject.ts @@ -192,6 +192,7 @@ export const generateObject = (object: JSIObject) => { #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureView.h" #include "RNSkPlatformContext.h" #include "MutableJSIBuffer.h" #include "JsiEnums.h" diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index cef8a5e5e8..9f4f16ec7a 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -220,49 +220,61 @@ export const model: JSIObject[] = [ { name: "size", type: "uint32_t" }, { name: "offset", type: "uint32_t" } ], - fromValueImpl: `static wgpu::BindGroupEntry *fromValue(jsi::Runtime &runtime, - const jsi::Value &raw) { -const auto &obj = raw.asObject(runtime); -if (obj.isHostObject(runtime)) { -return obj.asHostObject(runtime)->getObject().get(); -} else { -auto object = new wgpu::BindGroupEntry(); - -if (obj.hasProperty(runtime, "binding")) { -auto binding = obj.getProperty(runtime, "binding"); - -object->binding = static_cast(binding.getNumber()); -} else { -throw jsi::JSError(runtime, -"Missing mandatory prop binding in BindGroupEntry"); -} -if (obj.hasProperty(runtime, "resource") && obj.getProperty(runtime, "resource").isObject()) { -auto resource = obj.getProperty(runtime, "resource").asObject(runtime); -if (resource.hasProperty(runtime, "buffer")) { -auto buffer = resource.getProperty(runtime, "buffer"); - -object->buffer = *JsiBuffer::fromValue(runtime, buffer); -} else { -throw jsi::JSError(runtime, -"Missing mandatory prop buffer in BindGroupEntry"); -} -if (resource.hasProperty(runtime, "size")) { -auto size = resource.getProperty(runtime, "size"); - -object->size = static_cast(size.getNumber()); -} else { - object->size = object->buffer.GetSize(); -} -if (resource.hasProperty(runtime, "offset")) { -auto offset = resource.getProperty(runtime, "offset"); - -object->offset = static_cast(offset.getNumber()); -} else { - object->offset = 0; -} -} -return object; -}}` + fromValueImpl: ` + static wgpu::BindGroupEntry *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + auto object = new wgpu::BindGroupEntry(); + + if (obj.hasProperty(runtime, "binding")) { + auto binding = obj.getProperty(runtime, "binding"); + + object->binding = static_cast(binding.getNumber()); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop binding in BindGroupEntry"); + } + + if (obj.hasProperty(runtime, "resource") && + obj.getProperty(runtime, "resource").isObject()) { + auto resource = obj.getProperty(runtime, "resource").asObject(runtime); + if (resource.isHostObject(runtime)) { + object->textureView = *JsiTextureView::fromValue( + runtime, obj.getProperty(runtime, "resource")); + } else { + if (resource.hasProperty(runtime, "buffer")) { + auto buffer = resource.getProperty(runtime, "buffer"); + + object->buffer = *JsiBuffer::fromValue(runtime, buffer); + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop buffer in BindGroupEntry"); + } + if (resource.hasProperty(runtime, "size")) { + auto size = resource.getProperty(runtime, "size"); + + object->size = static_cast(size.getNumber()); + } else { + object->size = object->buffer.GetSize(); + } + if (resource.hasProperty(runtime, "offset")) { + auto offset = resource.getProperty(runtime, "offset"); + + object->offset = static_cast(offset.getNumber()); + } else { + object->offset = 0; + } + } + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop binding in BindGroupEntry"); + } + return object; + } + }` }, { name: "BindGroup" @@ -505,14 +517,6 @@ return object; getObject()->SetVertexBuffer(slot, *buffer, offset, size); return jsi::Value::undefined();` }, - { - name: "dispatchWorkgroups", - args: [ - {"name": "workgroupCountX", "type": "uint32_t"}, - {"name": "workgroupCountY", "type": "uint32_t", "defaultAtomicValue": "1", optional: true}, - {"name": "workgroupCountZ", "type": "uint32_t", "defaultAtomicValue": "1", optional: true} - ] - } ] }, { From 8a7e0543c6df792d3acb0e72e52c977a25be50d2 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 4 May 2024 19:25:16 +0200 Subject: [PATCH 36/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 16 ++-- package/cpp/wgpu/JsiCommandEncoder.h | 15 +++ package/cpp/wgpu/JsiComputePassDescriptor.h | 52 ++++++++++ package/cpp/wgpu/JsiComputePassEncoder.h | 52 ++++++++++ package/cpp/wgpu/JsiComputePipeline.h | 49 ++++++++++ .../cpp/wgpu/JsiComputePipelineDescriptor.h | 70 ++++++++++++++ package/cpp/wgpu/JsiDevice.h | 27 +++++- package/cpp/wgpu/JsiPipelineLayout.h | 49 ++++++++++ .../cpp/wgpu/JsiProgrammableStageDescriptor.h | 74 +++++++++++++++ package/cpp/wgpu/JsiSamplerDescriptor.h | 95 +++++++++++++++++++ scripts/generator/model.ts | 59 ++++++++++++ 11 files changed, 551 insertions(+), 7 deletions(-) create mode 100644 package/cpp/wgpu/JsiComputePassDescriptor.h create mode 100644 package/cpp/wgpu/JsiComputePassEncoder.h create mode 100644 package/cpp/wgpu/JsiComputePipeline.h create mode 100644 package/cpp/wgpu/JsiComputePipelineDescriptor.h create mode 100644 package/cpp/wgpu/JsiPipelineLayout.h create mode 100644 package/cpp/wgpu/JsiProgrammableStageDescriptor.h create mode 100644 package/cpp/wgpu/JsiSamplerDescriptor.h diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index cafb585ab4..e10e7aa915 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useRef } from "react"; -import { gpu, SkiaDomView } from "@shopify/react-native-skia"; +import { gpu, SkiaDomView, useImage } from "@shopify/react-native-skia"; import { demo3 } from "./demo3"; import { demo2 } from "./demo2"; @@ -8,7 +8,8 @@ import { demo4 } from "./demo1/demo4"; import { demo5 } from "./demo1/demo5"; //import { demo6 } from "./demo6/main"; -const draw = async (context: GPUCanvasContext) => { +const draw = async (context: GPUCanvasContext, image: Uint8Array) => { + console.log({image: image.subarray(0, 100)}); const adapter = await gpu.requestAdapter(); const device = await adapter!.requestDevice(); const presentationFormat = "rgba8unorm"; @@ -22,13 +23,16 @@ const draw = async (context: GPUCanvasContext) => { }; export const Breathe = () => { + const image = useImage(require("./demo6/webgpu.png")); const ref = useRef(null); useEffect(() => { setTimeout(() => { - const ctx = ref.current!.getWGPUContext(); - - draw(ctx); + if (image && ref.current) { + const ctx = ref.current.getWGPUContext(); + const buffer = image.readPixels()!.buffer; + draw(ctx, new Uint8Array(buffer)); + } }, 1000); - }, []); + }, [image]); return ; }; diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index b5ebbfbd27..99a3dd9876 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -9,6 +9,8 @@ #include "JsiBuffer.h" #include "JsiCommandBuffer.h" +#include "JsiComputePassDescriptor.h" +#include "JsiComputePassEncoder.h" #include "JsiEnums.h" #include "JsiHostObject.h" #include "JsiPromises.h" @@ -53,6 +55,18 @@ class JsiCommandEncoder runtime, std::make_shared(getContext(), ret)); } + JSI_HOST_FUNCTION(beginComputePass) { + auto descriptor = + JsiComputePassDescriptor::fromValue(runtime, arguments[0]); + + auto ret = getObject()->BeginComputePass(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "beginComputePass returned null"); + } + return jsi::Object::createFromHostObject( + runtime, std::make_shared(getContext(), ret)); + } + JSI_HOST_FUNCTION(copyBufferToBuffer) { auto source = JsiBuffer::fromValue(runtime, arguments[0]); auto sourceOffset = static_cast(arguments[1].getNumber()); @@ -71,6 +85,7 @@ class JsiCommandEncoder JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiCommandEncoder, beginRenderPass), JSI_EXPORT_FUNC(JsiCommandEncoder, finish), + JSI_EXPORT_FUNC(JsiCommandEncoder, beginComputePass), JSI_EXPORT_FUNC(JsiCommandEncoder, copyBufferToBuffer)) /** diff --git a/package/cpp/wgpu/JsiComputePassDescriptor.h b/package/cpp/wgpu/JsiComputePassDescriptor.h new file mode 100644 index 0000000000..4738ef61ff --- /dev/null +++ b/package/cpp/wgpu/JsiComputePassDescriptor.h @@ -0,0 +1,52 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiComputePassDescriptor + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiComputePassDescriptor(std::shared_ptr context, + wgpu::ComputePassDescriptor m) + : JsiSkWrappingSharedPtrHostObject( + context, + std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiComputePassDescriptor, ComputePassDescriptor) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::ComputePassDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + throw jsi::JSError( + runtime, "Expected a JsiComputePassDescriptor object, but got a " + + raw.toString(runtime).utf8(runtime)); + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiComputePassEncoder.h b/package/cpp/wgpu/JsiComputePassEncoder.h new file mode 100644 index 0000000000..95afba85fa --- /dev/null +++ b/package/cpp/wgpu/JsiComputePassEncoder.h @@ -0,0 +1,52 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiComputePassEncoder + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiComputePassEncoder(std::shared_ptr context, + wgpu::ComputePassEncoder m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) { + } + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiComputePassEncoder, ComputePassEncoder) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::ComputePassEncoder *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + throw jsi::JSError(runtime, + "Expected a JsiComputePassEncoder object, but got a " + + raw.toString(runtime).utf8(runtime)); + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiComputePipeline.h b/package/cpp/wgpu/JsiComputePipeline.h new file mode 100644 index 0000000000..c7276c40fc --- /dev/null +++ b/package/cpp/wgpu/JsiComputePipeline.h @@ -0,0 +1,49 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiComputePipeline + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiComputePipeline(std::shared_ptr context, + wgpu::ComputePipeline m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiComputePipeline, ComputePipeline) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::ComputePipeline *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + throw jsi::JSError(runtime, + "Expected a JsiComputePipeline object, but got a " + + raw.toString(runtime).utf8(runtime)); + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiComputePipelineDescriptor.h b/package/cpp/wgpu/JsiComputePipelineDescriptor.h new file mode 100644 index 0000000000..d85670a088 --- /dev/null +++ b/package/cpp/wgpu/JsiComputePipelineDescriptor.h @@ -0,0 +1,70 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPipelineLayout.h" +#include "JsiProgrammableStageDescriptor.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiComputePipelineDescriptor + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiComputePipelineDescriptor(std::shared_ptr context, + wgpu::ComputePipelineDescriptor m) + : JsiSkWrappingSharedPtrHostObject( + context, + std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiComputePipelineDescriptor, + ComputePipelineDescriptor) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::ComputePipelineDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + auto object = new wgpu::ComputePipelineDescriptor(); + + if (obj.hasProperty(runtime, "layout")) { + auto layout = obj.getProperty(runtime, "layout"); + + object->layout = *JsiPipelineLayout::fromValue(runtime, layout); + } + if (obj.hasProperty(runtime, "compute")) { + auto compute = obj.getProperty(runtime, "compute"); + + object->compute = + *JsiProgrammableStageDescriptor::fromValue(runtime, compute); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop compute in ComputePipelineDescriptor"); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index bf5065a981..f796e01c46 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -13,12 +13,15 @@ #include "JsiBufferDescriptor.h" #include "JsiCommandEncoder.h" #include "JsiCommandEncoderDescriptor.h" +#include "JsiComputePipeline.h" +#include "JsiComputePipelineDescriptor.h" #include "JsiEnums.h" #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiQueue.h" #include "JsiRenderPipeline.h" #include "JsiRenderPipelineDescriptor.h" +#include "JsiSamplerDescriptor.h" #include "JsiShaderModule.h" #include "JsiShaderModuleWGSLDescriptor.h" #include "JsiSkHostObjects.h" @@ -49,6 +52,14 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { runtime, std::make_shared(getContext(), ret)); } + JSI_HOST_FUNCTION(createSampler) { + auto descriptor = JsiSamplerDescriptor::fromValue(runtime, arguments[0]); + + getObject()->CreateSampler(descriptor); + + return jsi::Value::undefined(); + } + JSI_HOST_FUNCTION(createBindGroup) { auto descriptor = JsiBindGroupDescriptor::fromValue(runtime, arguments[0]); @@ -72,6 +83,18 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { runtime, std::make_shared(getContext(), ret)); } + JSI_HOST_FUNCTION(createComputePipeline) { + auto descriptor = + JsiComputePipelineDescriptor::fromValue(runtime, arguments[0]); + + auto ret = getObject()->CreateComputePipeline(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createComputePipeline returned null"); + } + return jsi::Object::createFromHostObject( + runtime, std::make_shared(getContext(), ret)); + } + JSI_HOST_FUNCTION(createShaderModule) { auto moduleDescriptor = JsiShaderModuleWGSLDescriptor::fromValue(runtime, arguments[0]); @@ -128,8 +151,10 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiDevice, queue)) - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiDevice, createBindGroup), + JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiDevice, createSampler), + JSI_EXPORT_FUNC(JsiDevice, createBindGroup), JSI_EXPORT_FUNC(JsiDevice, createRenderPipeline), + JSI_EXPORT_FUNC(JsiDevice, createComputePipeline), JSI_EXPORT_FUNC(JsiDevice, createShaderModule), JSI_EXPORT_FUNC(JsiDevice, createCommandEncoder), JSI_EXPORT_FUNC(JsiDevice, createBuffer), diff --git a/package/cpp/wgpu/JsiPipelineLayout.h b/package/cpp/wgpu/JsiPipelineLayout.h new file mode 100644 index 0000000000..0f84da7eb9 --- /dev/null +++ b/package/cpp/wgpu/JsiPipelineLayout.h @@ -0,0 +1,49 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiPipelineLayout + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiPipelineLayout(std::shared_ptr context, + wgpu::PipelineLayout m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiPipelineLayout, PipelineLayout) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::PipelineLayout *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + throw jsi::JSError(runtime, + "Expected a JsiPipelineLayout object, but got a " + + raw.toString(runtime).utf8(runtime)); + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiProgrammableStageDescriptor.h b/package/cpp/wgpu/JsiProgrammableStageDescriptor.h new file mode 100644 index 0000000000..544640b33e --- /dev/null +++ b/package/cpp/wgpu/JsiProgrammableStageDescriptor.h @@ -0,0 +1,74 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiShaderModule.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiProgrammableStageDescriptor : public JsiSkWrappingSharedPtrHostObject< + wgpu::ProgrammableStageDescriptor> { +public: + JsiProgrammableStageDescriptor(std::shared_ptr context, + wgpu::ProgrammableStageDescriptor m) + : JsiSkWrappingSharedPtrHostObject( + context, + std::make_shared(std::move(m))) { + } + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiProgrammableStageDescriptor, + ProgrammableStageDescriptor) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::ProgrammableStageDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + auto object = new wgpu::ProgrammableStageDescriptor(); + + if (obj.hasProperty(runtime, "module")) { + auto module = obj.getProperty(runtime, "module"); + + object->module = *JsiShaderModule::fromValue(runtime, module); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop module in ProgrammableStageDescriptor"); + } + if (obj.hasProperty(runtime, "entryPoint")) { + auto entryPoint = obj.getProperty(runtime, "entryPoint"); + + object->entryPoint = + strdup(entryPoint.getString(runtime).utf8(runtime).c_str()); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop entryPoint in ProgrammableStageDescriptor"); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiSamplerDescriptor.h b/package/cpp/wgpu/JsiSamplerDescriptor.h new file mode 100644 index 0000000000..773eecf8a3 --- /dev/null +++ b/package/cpp/wgpu/JsiSamplerDescriptor.h @@ -0,0 +1,95 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiSamplerDescriptor + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiSamplerDescriptor(std::shared_ptr context, + wgpu::SamplerDescriptor m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiSamplerDescriptor, SamplerDescriptor) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::SamplerDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + auto object = new wgpu::SamplerDescriptor(); + + if (obj.hasProperty(runtime, "addressModeU")) { + auto addressModeU = obj.getProperty(runtime, "addressModeU"); + + object->addressModeU = getAddressMode( + addressModeU.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "addressModeV")) { + auto addressModeV = obj.getProperty(runtime, "addressModeV"); + + object->addressModeV = getAddressMode( + addressModeV.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "addressModeW")) { + auto addressModeW = obj.getProperty(runtime, "addressModeW"); + + object->addressModeW = getAddressMode( + addressModeW.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "magFilter")) { + auto magFilter = obj.getProperty(runtime, "magFilter"); + + object->magFilter = + getFilterMode(magFilter.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "minFilter")) { + auto minFilter = obj.getProperty(runtime, "minFilter"); + + object->minFilter = + getFilterMode(minFilter.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "mipmapFilter")) { + auto mipmapFilter = obj.getProperty(runtime, "mipmapFilter"); + + object->mipmapFilter = getMipmapFilterMode( + mipmapFilter.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "lodMinClamp")) { + auto lodMinClamp = obj.getProperty(runtime, "lodMinClamp"); + + object->lodMinClamp = static_cast(lodMinClamp.getNumber()); + } + if (obj.hasProperty(runtime, "lodMaxClamp")) { + auto lodMaxClamp = obj.getProperty(runtime, "lodMaxClamp"); + + object->lodMaxClamp = static_cast(lodMaxClamp.getNumber()); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 9f4f16ec7a..a081e43c20 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -21,6 +21,7 @@ export interface Property { name: string; type: string; optional?: boolean; + defaultAtomicValue?: string; pointer?: boolean; } @@ -138,6 +139,19 @@ export const model: JSIObject[] = [ } ] }, + { + name: "SamplerDescriptor", + properties: [ + { name: "addressModeU", type: "AddressMode", "optional": true, "defaultAtomicValue": "clamp-to-edge" }, + { name: "addressModeV", type: "AddressMode", "optional": true, "defaultAtomicValue": "clamp-to-edge" }, + { name: "addressModeW", type: "AddressMode", "optional": true, "defaultAtomicValue": "clamp-to-edge" }, + { name: "magFilter", type: "FilterMode", "optional": true, "defaultAtomicValue": "nearest" }, + { name: "minFilter", type: "FilterMode", "optional": true, "defaultAtomicValue": "nearest" }, + { name: "mipmapFilter", type: "MipmapFilterMode", "optional": true, "defaultAtomicValue": "nearest" }, + { name: "lodMinClamp", type: "float", "optional": true, "defaultAtomicValue": "0.0f" }, + { name: "lodMaxClamp", type: "float", "optional": true, "defaultAtomicValue": "32.0f" } + ] + }, { name: "Device", methods: [ @@ -147,6 +161,12 @@ export const model: JSIObject[] = [ returns: "Queue", member: "queue" }, + { + name: "createSampler", + args: [ + { name: "descriptor", type: "SamplerDescriptor" } + ], + }, { name: "createBindGroup", args: [{ @@ -163,6 +183,14 @@ export const model: JSIObject[] = [ }], returns: "RenderPipeline", }, + { + name: "createComputePipeline", + args: [{ + name: "descriptor", + type: "ComputePipelineDescriptor", + }], + returns: "ComputePipeline", + }, { name: "createShaderModule", args: [{ @@ -361,11 +389,22 @@ export const model: JSIObject[] = [ { "name": "CommandEncoderDescriptor" }, + { + "name": "ComputePassDescriptor" + }, + { + name: "ComputePassEncoder", + }, { name: "CommandEncoder", methods: [ { name: "beginRenderPass", args: [{ name: "descriptor", type: "RenderPassDescriptor" }], returns: "RenderPassEncoder" }, { name: "finish", args: [], returns: "CommandBuffer" }, + { + name: "beginComputePass", + args: [{ name: "descriptor", type: "ComputePassDescriptor" }], + returns: "ComputePassEncoder" + }, { name: "copyBufferToBuffer", args: [ @@ -465,6 +504,20 @@ export const model: JSIObject[] = [ {"name": "fragment", "type": "FragmentState", "optional": true, pointer: true} ] }, + { + name: "ComputePipelineDescriptor", + properties: [ + {"name": "layout", "type": "PipelineLayout", "optional": true}, + {"name": "compute", "type": "ProgrammableStageDescriptor"} + ] + }, + { + name: "ProgrammableStageDescriptor", + properties: [ + {name: "module", type: "ShaderModule" }, + { name: "entryPoint", type: "string" } + ] + }, { name: "RenderPassEncoder", methods: [ @@ -707,5 +760,11 @@ object->sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, { name: "mask", type: "uint32_t", optional: true }, { name: "alphaToCoverageEnabled", type: "bool", optional: true } ] + }, + { + name: "ComputePipeline" + }, + { + name: "PipelineLayout" } ]; \ No newline at end of file From e4a436f2f4a5336da5b9693112d52e67660db43e Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sun, 5 May 2024 10:56:24 +0200 Subject: [PATCH 37/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 19 ++-- example/src/Examples/Breathe/demo1/demo7.ts | 102 ++++++++++++++++++++ package/cpp/wgpu/JsiImageCopyTexture.h | 84 ++++++++++++++++ package/cpp/wgpu/JsiImageDataLayout.h | 64 ++++++++++++ package/cpp/wgpu/JsiQueue.h | 22 +++++ package/cpp/wgpu/JsiTextureDataLayout.h | 64 ++++++++++++ scripts/generator/model.ts | 94 ++++++++++++++++++ 7 files changed, 443 insertions(+), 6 deletions(-) create mode 100644 example/src/Examples/Breathe/demo1/demo7.ts create mode 100644 package/cpp/wgpu/JsiImageCopyTexture.h create mode 100644 package/cpp/wgpu/JsiImageDataLayout.h create mode 100644 package/cpp/wgpu/JsiTextureDataLayout.h diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index e10e7aa915..19a321ec0d 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { gpu, SkiaDomView, useImage } from "@shopify/react-native-skia"; import { demo3 } from "./demo3"; @@ -6,10 +6,10 @@ import { demo2 } from "./demo2"; import { demo1 } from "./demo1/main"; import { demo4 } from "./demo1/demo4"; import { demo5 } from "./demo1/demo5"; +import { demo7 } from "./demo1/demo7"; //import { demo6 } from "./demo6/main"; const draw = async (context: GPUCanvasContext, image: Uint8Array) => { - console.log({image: image.subarray(0, 100)}); const adapter = await gpu.requestAdapter(); const device = await adapter!.requestDevice(); const presentationFormat = "rgba8unorm"; @@ -18,19 +18,26 @@ const draw = async (context: GPUCanvasContext, image: Uint8Array) => { format: presentationFormat, alphaMode: "premultiplied", }); - await demo5(device, context); + await demo5(device, context, image); //context.present(); }; +const usePixels = (mod: number) => { + const image = useImage(mod); + if (!image) { + return null; + } + return image.readPixels() as Uint8Array; +}; + export const Breathe = () => { - const image = useImage(require("./demo6/webgpu.png")); + const image = usePixels(require("./demo6/webgpu.png")); const ref = useRef(null); useEffect(() => { setTimeout(() => { if (image && ref.current) { const ctx = ref.current.getWGPUContext(); - const buffer = image.readPixels()!.buffer; - draw(ctx, new Uint8Array(buffer)); + draw(ctx, image); } }, 1000); }, [image]); diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts new file mode 100644 index 0000000000..595c1de7bd --- /dev/null +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -0,0 +1,102 @@ +import { Dimensions } from "react-native"; + +const { width, height } = Dimensions.get("window"); + +export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textureData: Uint8Array) => { + + const swapChainFormat = 'bgra8unorm'; + + const vertexShaderModule = device.createShaderModule({ + code: ` + @vertex + fn main( @location(0) position: vec2f) -> @builtin(position) vec4f { + return vec4f(position, 0.0, 1.0); + } + `, + }); + + const fragmentShaderModule = device.createShaderModule({ + code: ` +@group(0) @binding(0) var mySampler: sampler; +@group(0) @binding(1) var myTexture: texture_2d; + + @fragment + fn main(@location(0) fragUV: vec2f) -> @location(0) vec4f { + return textureSample(myTexture, mySampler, fragUV); + } + `, + }); + + const pipeline = device.createRenderPipeline({ + layout: "auto", + vertex: { + module: vertexShaderModule, + entryPoint: 'main', + }, + fragment: { + module: fragmentShaderModule, + entryPoint: 'main', + targets: [ + { + format: swapChainFormat, + }, + ], + }, + primitive: { + topology: 'triangle-list', + }, + }); + + const texture = device.createTexture({ + size: { + width: width, + height: height, + depthOrArrayLayers: 1, + }, + format: 'rgba8unorm', + usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT, + }); + + const textureView = texture.createView(); + + + device.queue.writeTexture( + { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, + textureData.buffer, + { + offset: 0, + bytesPerRow: 4 * width, + rowsPerImage: height, + }, + { width, height } + ); + + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: context.getCurrentTexture().createView(), + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: 'clear', + storeOp: 'store', + }, + ], + }; + + const commandEncoder = device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.setBindGroup(0, device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: textureView, + }, + ], + })); + passEncoder.draw(3, 1, 0, 0); + passEncoder.end(); + + device.queue.submit([commandEncoder.finish()]); + context.present(); +}; \ No newline at end of file diff --git a/package/cpp/wgpu/JsiImageCopyTexture.h b/package/cpp/wgpu/JsiImageCopyTexture.h new file mode 100644 index 0000000000..9dfa3c70a6 --- /dev/null +++ b/package/cpp/wgpu/JsiImageCopyTexture.h @@ -0,0 +1,84 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiExtent3D.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTexture.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiImageCopyTexture + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiImageCopyTexture(std::shared_ptr context, + wgpu::ImageCopyTexture m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiImageCopyTexture, ImageCopyTexture) + + static wgpu::ImageCopyTexture *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + auto object = new wgpu::ImageCopyTexture(); + + if (obj.hasProperty(runtime, "texture")) { + auto texture = obj.getProperty(runtime, "texture"); + + object->texture = *JsiTexture::fromValue(runtime, texture); + } else { + throw jsi::JSError( + runtime, "Missing mandatory prop texture in ImageCopyTexture"); + } + if (obj.hasProperty(runtime, "mipLevel")) { + auto mipLevel = obj.getProperty(runtime, "mipLevel"); + + object->mipLevel = static_cast(mipLevel.getNumber()); + } + if (obj.hasProperty(runtime, "origin")) { + auto origin = obj.getProperty(runtime, "origin").asObject(runtime); + auto x = origin.hasProperty(runtime, "x") + ? origin.getProperty(runtime, "x").getNumber() + : 0; + auto y = origin.hasProperty(runtime, "y") + ? origin.getProperty(runtime, "y").getNumber() + : 0; + auto z = origin.hasProperty(runtime, "z") + ? origin.getProperty(runtime, "z").getNumber() + : 0; + object->origin = {static_cast(x), static_cast(y), + static_cast(z)}; + } else { + throw jsi::JSError(runtime, + "Missing mandatory prop origin in ImageCopyTexture"); + } + if (obj.hasProperty(runtime, "aspect")) { + auto aspect = obj.getProperty(runtime, "aspect"); + + object->aspect = + getTextureAspect(aspect.getString(runtime).utf8(runtime).c_str()); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiImageDataLayout.h b/package/cpp/wgpu/JsiImageDataLayout.h new file mode 100644 index 0000000000..55a9fe44fb --- /dev/null +++ b/package/cpp/wgpu/JsiImageDataLayout.h @@ -0,0 +1,64 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiImageDataLayout + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiImageDataLayout(std::shared_ptr context, + wgpu::ImageDataLayout m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiImageDataLayout, ImageDataLayout) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::TextureDataLayout *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + auto object = new wgpu::TextureDataLayout(); + + if (obj.hasProperty(runtime, "offset")) { + auto offset = obj.getProperty(runtime, "offset"); + + object->offset = static_cast(offset.getNumber()); + } + if (obj.hasProperty(runtime, "bytes per row")) { + auto bytesPerRow = obj.getProperty(runtime, "bytes per row"); + + object->bytesPerRow = static_cast(bytesPerRow.getNumber()); + } + if (obj.hasProperty(runtime, "rows per image")) { + auto rowsPerImage = obj.getProperty(runtime, "rows per image"); + + object->rowsPerImage = static_cast(rowsPerImage.getNumber()); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 78cdc32736..3075f7d410 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -9,9 +9,12 @@ #include "JsiCommandBuffer.h" #include "JsiEnums.h" +#include "JsiExtent3D.h" #include "JsiHostObject.h" +#include "JsiImageCopyTexture.h" #include "JsiPromises.h" #include "JsiSkHostObjects.h" +#include "JsiTextureDataLayout.h" #include "JsiTextureView.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" @@ -40,6 +43,24 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { return jsi::Value::undefined(); } + JSI_HOST_FUNCTION(writeTexture) { + auto destination = JsiImageCopyTexture::fromValue(runtime, arguments[0]); + if (!arguments[1].isObject()) { + throw jsi::JSError(runtime, "writeTexture: data must be an ArrayBuffer"); + } + if (!arguments[1].getObject(runtime).isArrayBuffer(runtime)) { + throw jsi::JSError(runtime, "Expected an ArrayBuffer"); + } + auto data = arguments[1].getObject(runtime).getArrayBuffer(runtime); + auto dataLayout = JsiTextureDataLayout::fromValue(runtime, arguments[2]); + auto size = JsiExtent3D::fromValue(runtime, arguments[3]); + + getObject()->WriteTexture(destination, data.data(runtime), + data.size(runtime), dataLayout, size); + + return jsi::Value::undefined(); + } + JSI_HOST_FUNCTION(writeBuffer) { auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); @@ -81,6 +102,7 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { EXPORT_JSI_API_BRANDNAME(JsiQueue, Queue) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiQueue, submit), + JSI_EXPORT_FUNC(JsiQueue, writeTexture), JSI_EXPORT_FUNC(JsiQueue, writeBuffer), JSI_EXPORT_FUNC(JsiQueue, onSubmittedWorkDone)) diff --git a/package/cpp/wgpu/JsiTextureDataLayout.h b/package/cpp/wgpu/JsiTextureDataLayout.h new file mode 100644 index 0000000000..241ca0ee48 --- /dev/null +++ b/package/cpp/wgpu/JsiTextureDataLayout.h @@ -0,0 +1,64 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiTextureDataLayout + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiTextureDataLayout(std::shared_ptr context, + wgpu::TextureDataLayout m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiTextureDataLayout, TextureDataLayout) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::TextureDataLayout *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + auto object = new wgpu::TextureDataLayout(); + + if (obj.hasProperty(runtime, "offset")) { + auto offset = obj.getProperty(runtime, "offset"); + + object->offset = static_cast(offset.getNumber()); + } + if (obj.hasProperty(runtime, "bytes per row")) { + auto bytesPerRow = obj.getProperty(runtime, "bytes per row"); + + object->bytesPerRow = static_cast(bytesPerRow.getNumber()); + } + if (obj.hasProperty(runtime, "rows per image")) { + auto rowsPerImage = obj.getProperty(runtime, "rows per image"); + + object->rowsPerImage = static_cast(rowsPerImage.getNumber()); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index a081e43c20..d15951e339 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -152,6 +152,63 @@ export const model: JSIObject[] = [ { name: "lodMaxClamp", type: "float", "optional": true, "defaultAtomicValue": "32.0f" } ] }, + { + name: "ImageCopyTexture", + properties: [ + { name: "texture", type: "Texture" }, + { name: "mipLevel", type: "uint32_t", optional: true, defaultAtomicValue: "0" }, + { name: "origin", type: "Extent3D" }, + { name: "aspect", type: "TextureAspect", optional: true, defaultAtomicValue: "wgpu:TextureAspect::All" } + ], + fromValueImpl: ` static wgpu::ImageCopyTexture *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { +const auto &obj = raw.asObject(runtime); +if (obj.isHostObject(runtime)) { +return obj.asHostObject(runtime)->getObject().get(); +} else { +auto object = new wgpu::ImageCopyTexture(); + +if (obj.hasProperty(runtime, "texture")) { +auto texture = obj.getProperty(runtime, "texture"); + +object->texture = *JsiTexture::fromValue(runtime, texture); +} else { +throw jsi::JSError( +runtime, "Missing mandatory prop texture in ImageCopyTexture"); +} +if (obj.hasProperty(runtime, "mipLevel")) { +auto mipLevel = obj.getProperty(runtime, "mipLevel"); + +object->mipLevel = static_cast(mipLevel.getNumber()); +} +if (obj.hasProperty(runtime, "origin")) { +auto origin = obj.getProperty(runtime, "origin").asObject(runtime); +auto x = origin.hasProperty(runtime, "x") ? origin.getProperty(runtime, "x").getNumber() : 0; +auto y = origin.hasProperty(runtime, "y") ? origin.getProperty(runtime, "y").getNumber() : 0; +auto z = origin.hasProperty(runtime, "z") ? origin.getProperty(runtime, "z").getNumber() : 0; +object->origin = { static_cast(x), static_cast(y), static_cast(z) }; +} else { +throw jsi::JSError(runtime, +"Missing mandatory prop origin in ImageCopyTexture"); +} +if (obj.hasProperty(runtime, "aspect")) { +auto aspect = obj.getProperty(runtime, "aspect"); + +object->aspect = +getTextureAspect(aspect.getString(runtime).utf8(runtime).c_str()); +} +return object; +} +}` + }, + { + name: "TextureDataLayout", + properties: [ + {"name": "offset", "type": "uint64_t", "defaultAtomicValue": "0", optional: true }, + {"name": "bytes per row", "type": "uint32_t", optional: true, "defaultAtomicValue": "WGPU_COPY_STRIDE_UNDEFINED"}, + {"name": "rows per image", "type": "uint32_t", optional: true, "defaultAtomicValue": "WGPU_COPY_STRIDE_UNDEFINED"} + ] + }, { name: "Device", methods: [ @@ -438,6 +495,43 @@ export const model: JSIObject[] = [ getObject()->Submit(commandBuffers.size(), commandBuffers.data()); return jsi::Value::undefined();` }, + + { + name: "writeTexture", + args: [ + { + name: "destination", + type: "ImageCopyTexture" + }, + // { + // name: "data", + // type: "ArrayBuffer" + // }, + { + name: "dataLayout", + type: "TextureDataLayout" + }, + { + name: "size", + type: "Extent3D" + } + ], + implementation: ` auto destination = JsiImageCopyTexture::fromValue(runtime, arguments[0]); + if (!arguments[1].isObject()) { + throw jsi::JSError(runtime, "writeTexture: data must be an ArrayBuffer"); + } + if (!arguments[1].getObject(runtime).isArrayBuffer(runtime)) { + throw jsi::JSError(runtime, "Expected an ArrayBuffer"); + } + auto data = arguments[1].getObject(runtime).getArrayBuffer(runtime); + auto dataLayout = JsiTextureDataLayout::fromValue(runtime, arguments[2]); + auto size = JsiExtent3D::fromValue(runtime, arguments[3]); + + getObject()->WriteTexture(destination, data.data(runtime), + data.size(runtime), dataLayout, size); + + return jsi::Value::undefined();` + }, { name: "writeBuffer", args: [ From a1225e4fe2eb80e1c1629f1fbdb1ea7fe51df6f1 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 08:47:08 +0200 Subject: [PATCH 38/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 3 +- example/src/Examples/Breathe/demo1/demo7.ts | 12 +++++- package/cpp/wgpu/JsiBindGroupEntry.h | 15 ++++++- package/cpp/wgpu/JsiDevice.h | 10 +++-- package/cpp/wgpu/JsiSampler.h | 46 +++++++++++++++++++++ scripts/generator/model.ts | 17 ++++++-- 6 files changed, 93 insertions(+), 10 deletions(-) create mode 100644 package/cpp/wgpu/JsiSampler.h diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 19a321ec0d..b587288472 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -18,7 +18,8 @@ const draw = async (context: GPUCanvasContext, image: Uint8Array) => { format: presentationFormat, alphaMode: "premultiplied", }); - await demo5(device, context, image); + //await demo5(device, context, image); + await demo7(device, context, image); //context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 595c1de7bd..35872b2511 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -81,7 +81,13 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur }, ], }; - + const sampler = device.createSampler({ + addressModeU: "repeat", + addressModeV: "repeat", + magFilter: "linear", + minFilter: "linear", + mipmapFilter: "linear", + }); const commandEncoder = device.createCommandEncoder(); const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); passEncoder.setPipeline(pipeline); @@ -92,6 +98,10 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur binding: 0, resource: textureView, }, + { + binding: 1, + resource: sampler, + }, ], })); passEncoder.draw(3, 1, 0, 0); diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index 794c81d106..a1f863ab31 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -11,6 +11,7 @@ #include "JsiEnums.h" #include "JsiHostObject.h" #include "JsiPromises.h" +#include "JsiSampler.h" #include "JsiSkHostObjects.h" #include "JsiTextureView.h" #include "MutableJSIBuffer.h" @@ -53,8 +54,18 @@ class JsiBindGroupEntry obj.getProperty(runtime, "resource").isObject()) { auto resource = obj.getProperty(runtime, "resource").asObject(runtime); if (resource.isHostObject(runtime)) { - object->textureView = *JsiTextureView::fromValue( - runtime, obj.getProperty(runtime, "resource")); + if (auto textureView = reinterpret_cast( + resource.asHostObject(runtime).get())) { + object->textureView = *JsiTextureView::fromValue( + runtime, obj.getProperty(runtime, "resource")); + } else if (auto sampler = reinterpret_cast( + resource.asHostObject(runtime).get())) { + object->sampler = *JsiSampler::fromValue( + runtime, obj.getProperty(runtime, "resource")); + } else { + throw jsi::JSError(runtime, "Missing mandatory prop textureView or " + "sampler in BindGroupEntry"); + } } else { if (resource.hasProperty(runtime, "buffer")) { auto buffer = resource.getProperty(runtime, "buffer"); diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index f796e01c46..05ceae5317 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -21,6 +21,7 @@ #include "JsiQueue.h" #include "JsiRenderPipeline.h" #include "JsiRenderPipelineDescriptor.h" +#include "JsiSampler.h" #include "JsiSamplerDescriptor.h" #include "JsiShaderModule.h" #include "JsiShaderModuleWGSLDescriptor.h" @@ -55,9 +56,12 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_HOST_FUNCTION(createSampler) { auto descriptor = JsiSamplerDescriptor::fromValue(runtime, arguments[0]); - getObject()->CreateSampler(descriptor); - - return jsi::Value::undefined(); + auto ret = getObject()->CreateSampler(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createSampler returned null"); + } + return jsi::Object::createFromHostObject( + runtime, std::make_shared(getContext(), ret)); } JSI_HOST_FUNCTION(createBindGroup) { diff --git a/package/cpp/wgpu/JsiSampler.h b/package/cpp/wgpu/JsiSampler.h new file mode 100644 index 0000000000..6f0062713c --- /dev/null +++ b/package/cpp/wgpu/JsiSampler.h @@ -0,0 +1,46 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiSampler : public JsiSkWrappingSharedPtrHostObject { +public: + JsiSampler(std::shared_ptr context, wgpu::Sampler m) + : JsiSkWrappingSharedPtrHostObject( + context, std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiSampler, Sampler) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::Sampler *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime)->getObject().get(); + } else { + throw jsi::JSError(runtime, "Expected a JsiSampler object, but got a " + + raw.toString(runtime).utf8(runtime)); + } + } +}; +} // namespace RNSkia diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index d15951e339..ed192adab9 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -223,6 +223,7 @@ return object; args: [ { name: "descriptor", type: "SamplerDescriptor" } ], + returns: "Sampler" }, { name: "createBindGroup", @@ -303,7 +304,9 @@ return object; { name: "binding", type: "uint32_t" }, { name: "buffer", type: "Buffer" }, { name: "size", type: "uint32_t" }, - { name: "offset", type: "uint32_t" } + { name: "offset", type: "uint32_t" }, + { name: "sampler", type: "Sampler" }, // dummy + ], fromValueImpl: ` static wgpu::BindGroupEntry *fromValue(jsi::Runtime &runtime, @@ -327,8 +330,13 @@ return object; obj.getProperty(runtime, "resource").isObject()) { auto resource = obj.getProperty(runtime, "resource").asObject(runtime); if (resource.isHostObject(runtime)) { - object->textureView = *JsiTextureView::fromValue( - runtime, obj.getProperty(runtime, "resource")); + if (auto textureView = reinterpret_cast(resource.asHostObject(runtime).get())) { + object->textureView = *JsiTextureView::fromValue(runtime, obj.getProperty(runtime, "resource")); + } else if (auto sampler = reinterpret_cast(resource.asHostObject(runtime).get())) { + object->sampler = *JsiSampler::fromValue(runtime, obj.getProperty(runtime, "resource")); + } else { + throw jsi::JSError(runtime, "Missing mandatory prop textureView or sampler in BindGroupEntry"); + } } else { if (resource.hasProperty(runtime, "buffer")) { auto buffer = resource.getProperty(runtime, "buffer"); @@ -860,5 +868,8 @@ object->sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, }, { name: "PipelineLayout" + }, + { + name: "Sampler" } ]; \ No newline at end of file From 8790a45dffd7b0a36a821cf3935dac4ea1dd24c2 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 08:56:00 +0200 Subject: [PATCH 39/63] :wrench: --- package/cpp/wgpu/JsiBindGroupEntry.h | 8 ++++---- scripts/generator/model.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/cpp/wgpu/JsiBindGroupEntry.h b/package/cpp/wgpu/JsiBindGroupEntry.h index a1f863ab31..eeea78cd68 100644 --- a/package/cpp/wgpu/JsiBindGroupEntry.h +++ b/package/cpp/wgpu/JsiBindGroupEntry.h @@ -54,12 +54,12 @@ class JsiBindGroupEntry obj.getProperty(runtime, "resource").isObject()) { auto resource = obj.getProperty(runtime, "resource").asObject(runtime); if (resource.isHostObject(runtime)) { - if (auto textureView = reinterpret_cast( - resource.asHostObject(runtime).get())) { + if (auto textureView = dynamic_pointer_cast( + resource.asHostObject(runtime))) { object->textureView = *JsiTextureView::fromValue( runtime, obj.getProperty(runtime, "resource")); - } else if (auto sampler = reinterpret_cast( - resource.asHostObject(runtime).get())) { + } else if (auto sampler = dynamic_pointer_cast( + resource.asHostObject(runtime))) { object->sampler = *JsiSampler::fromValue( runtime, obj.getProperty(runtime, "resource")); } else { diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index ed192adab9..51896dfd58 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -330,9 +330,9 @@ return object; obj.getProperty(runtime, "resource").isObject()) { auto resource = obj.getProperty(runtime, "resource").asObject(runtime); if (resource.isHostObject(runtime)) { - if (auto textureView = reinterpret_cast(resource.asHostObject(runtime).get())) { + if (auto textureView = dynamic_pointer_cast(resource.asHostObject(runtime))) { object->textureView = *JsiTextureView::fromValue(runtime, obj.getProperty(runtime, "resource")); - } else if (auto sampler = reinterpret_cast(resource.asHostObject(runtime).get())) { + } else if (auto sampler = dynamic_pointer_cast(resource.asHostObject(runtime))) { object->sampler = *JsiSampler::fromValue(runtime, obj.getProperty(runtime, "resource")); } else { throw jsi::JSError(runtime, "Missing mandatory prop textureView or sampler in BindGroupEntry"); From 372d89f8f852289e56b85c8204139edf8d67eeb2 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 09:33:08 +0200 Subject: [PATCH 40/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 250 ++++++++++++-------- 1 file changed, 150 insertions(+), 100 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 35872b2511..ba6e80dfbe 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -3,110 +3,160 @@ import { Dimensions } from "react-native"; const { width, height } = Dimensions.get("window"); export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textureData: Uint8Array) => { - - const swapChainFormat = 'bgra8unorm'; - - const vertexShaderModule = device.createShaderModule({ - code: ` - @vertex - fn main( @location(0) position: vec2f) -> @builtin(position) vec4f { - return vec4f(position, 0.0, 1.0); - } - `, - }); - - const fragmentShaderModule = device.createShaderModule({ - code: ` -@group(0) @binding(0) var mySampler: sampler; -@group(0) @binding(1) var myTexture: texture_2d; - - @fragment - fn main(@location(0) fragUV: vec2f) -> @location(0) vec4f { - return textureSample(myTexture, mySampler, fragUV); - } - `, - }); - - const pipeline = device.createRenderPipeline({ - layout: "auto", - vertex: { - module: vertexShaderModule, - entryPoint: 'main', - }, - fragment: { - module: fragmentShaderModule, - entryPoint: 'main', - targets: [ - { - format: swapChainFormat, - }, - ], - }, - primitive: { - topology: 'triangle-list', - }, - }); - - const texture = device.createTexture({ - size: { - width: width, - height: height, - depthOrArrayLayers: 1, - }, - format: 'rgba8unorm', - usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT, - }); - - const textureView = texture.createView(); - - - device.queue.writeTexture( - { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, - textureData.buffer, - { - offset: 0, - bytesPerRow: 4 * width, - rowsPerImage: height, - }, - { width, height } - ); - - const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: context.getCurrentTexture().createView(), - clearValue: [0.5, 0.5, 0.5, 1.0], - loadOp: 'clear', - storeOp: 'store', - }, - ], + + const presentationFormat = 'bgra8unorm'; + + const pixels = new Uint8Array(256 * 256 * 4); + pixels.fill(255); + let i = 0; + for (let x = 0; x < 256 * 4; x++) { + for (let y = 0; y < 256 * 4; y++) { + pixels[i++] = (x * y) % 255; + } + } + + context.configure({ + device, + format: presentationFormat, + }); + + const module = device.createShaderModule({ + label: 'our hardcoded textured quad shaders', + code: ` + struct OurVertexShaderOutput { + @builtin(position) position: vec4f, + @location(0) texcoord: vec2f, }; + + @vertex fn vs( + @builtin(vertex_index) vertexIndex : u32 + ) -> OurVertexShaderOutput { + let pos = array( + // 1st triangle + vec2f( 0.0, 0.0), // center + vec2f( 1.0, 0.0), // right, center + vec2f( 0.0, 1.0), // center, top + + // 2st triangle + vec2f( 0.0, 1.0), // center, top + vec2f( 1.0, 0.0), // right, center + vec2f( 1.0, 1.0), // right, top + ); + + var vsOutput: OurVertexShaderOutput; + let xy = pos[vertexIndex]; + vsOutput.position = vec4f(xy, 0.0, 1.0); + vsOutput.texcoord = xy; + return vsOutput; + } + + @group(0) @binding(0) var ourSampler: sampler; + @group(0) @binding(1) var ourTexture: texture_2d; + + @fragment fn fs(fsInput: OurVertexShaderOutput) -> @location(0) vec4f { + return textureSample(ourTexture, ourSampler, fsInput.texcoord); + } + `, + }); + + const pipeline = device.createRenderPipeline({ + label: 'hardcoded textured quad pipeline', + layout: 'auto', + vertex: { + module, + entryPoint: "vs" + }, + fragment: { + module, + targets: [{ format: presentationFormat }], + entryPoint: "fs" + }, + primitive: { + topology: "triangle-list", + }, + }); + + const url = + 'https://webgpufundamentals.org/webgpu/resources/images/f-texture.png'; + const texture = device.createTexture({ + label: url, + format: 'rgba8unorm', + size: { width: 256, height: 256 }, + usage: + GPUTextureUsage.TEXTURE_BINDING | + GPUTextureUsage.COPY_DST | + GPUTextureUsage.RENDER_ATTACHMENT, + }); + device.queue.writeTexture( + { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, + pixels.buffer, + { + offset: 0, + bytesPerRow: 4 * 256, + rowsPerImage: 256, + }, + { width: 256, height: 256 } + ); + + const bindGroups: GPUBindGroup[] = []; + for (let i = 0; i < 8; ++i) { const sampler = device.createSampler({ - addressModeU: "repeat", - addressModeV: "repeat", - magFilter: "linear", - minFilter: "linear", - mipmapFilter: "linear", + addressModeU: i & 1 ? 'repeat' : 'clamp-to-edge', + addressModeV: i & 2 ? 'repeat' : 'clamp-to-edge', + magFilter: i & 4 ? 'linear' : 'nearest', }); - const commandEncoder = device.createCommandEncoder(); - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(pipeline); - passEncoder.setBindGroup(0, device.createBindGroup({ + + const bindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ - { - binding: 0, - resource: textureView, - }, - { - binding: 1, - resource: sampler, - }, + { binding: 0, resource: sampler }, + { binding: 1, resource: texture.createView() }, ], - })); - passEncoder.draw(3, 1, 0, 0); - passEncoder.end(); - - device.queue.submit([commandEncoder.finish()]); - context.present(); + }); + bindGroups.push(bindGroup); + } + + const renderPassDescriptor: GPURenderPassDescriptor = { + label: 'our basic canvas renderPass', + colorAttachments: [ + { + // view: <- to be filled out when we render + clearValue: [0.3, 0.3, 0.3, 1], + loadOp: 'clear', + storeOp: 'store', + }, + ], + }; + + const settings = { + addressModeU: 'repeat', + addressModeV: 'repeat', + magFilter: 'linear', + }; + + function render() { + const ndx = + (settings.addressModeU === 'repeat' ? 1 : 0) + + (settings.addressModeV === 'repeat' ? 2 : 0) + + (settings.magFilter === 'linear' ? 4 : 0); + const bindGroup = bindGroups[ndx]; + + // Get the current texture from the canvas context and + // set it as the texture to render to. + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + + const encoder = device.createCommandEncoder(); + const pass = encoder.beginRenderPass(renderPassDescriptor); + pass.setPipeline(pipeline); + pass.setBindGroup(0, bindGroup); + pass.draw(6); // call our vertex shader 6 times + pass.end(); + + const commandBuffer = encoder.finish(); + device.queue.submit([commandBuffer]); + } + + render(); }; \ No newline at end of file From 829b718f3d2b9423aea768acd1a3a3e5886bc461 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 09:42:25 +0200 Subject: [PATCH 41/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index ba6e80dfbe..5908b0ec95 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -156,6 +156,7 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur const commandBuffer = encoder.finish(); device.queue.submit([commandBuffer]); + context.present(); } render(); From 32ffe28aef5298f9845998865629f53e25209eeb Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 10:10:32 +0200 Subject: [PATCH 42/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 21 +++------------- package/cpp/wgpu/JsiFragmentState.h | 1 + package/cpp/wgpu/JsiQueue.h | 28 +++++++++++++++++++++ package/cpp/wgpu/JsiVertexState.h | 1 + 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 5908b0ec95..003458dea1 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -98,12 +98,10 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur { width: 256, height: 256 } ); - const bindGroups: GPUBindGroup[] = []; - for (let i = 0; i < 8; ++i) { const sampler = device.createSampler({ - addressModeU: i & 1 ? 'repeat' : 'clamp-to-edge', - addressModeV: i & 2 ? 'repeat' : 'clamp-to-edge', - magFilter: i & 4 ? 'linear' : 'nearest', + addressModeU: 0 & 1 ? 'repeat' : 'clamp-to-edge', + addressModeV: 0 & 2 ? 'repeat' : 'clamp-to-edge', + magFilter: 0 & 4 ? 'linear' : 'nearest', }); const bindGroup = device.createBindGroup({ @@ -113,8 +111,7 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur { binding: 1, resource: texture.createView() }, ], }); - bindGroups.push(bindGroup); - } + const renderPassDescriptor: GPURenderPassDescriptor = { label: 'our basic canvas renderPass', @@ -128,18 +125,8 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur ], }; - const settings = { - addressModeU: 'repeat', - addressModeV: 'repeat', - magFilter: 'linear', - }; function render() { - const ndx = - (settings.addressModeU === 'repeat' ? 1 : 0) + - (settings.addressModeV === 'repeat' ? 2 : 0) + - (settings.magFilter === 'linear' ? 4 : 0); - const bindGroup = bindGroups[ndx]; // Get the current texture from the canvas context and // set it as the texture to render to. diff --git a/package/cpp/wgpu/JsiFragmentState.h b/package/cpp/wgpu/JsiFragmentState.h index b7d7faf081..39b6aa82c4 100644 --- a/package/cpp/wgpu/JsiFragmentState.h +++ b/package/cpp/wgpu/JsiFragmentState.h @@ -57,6 +57,7 @@ class JsiFragmentState object->entryPoint = strdup(entryPoint.getString(runtime).utf8(runtime).c_str()); + RNSkLogger::logToConsole("entryPoint: %s", object->entryPoint); } else { throw jsi::JSError( runtime, "Missing mandatory prop entryPoint in FragmentState"); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 3075f7d410..b7e952c16a 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -54,6 +54,34 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { auto data = arguments[1].getObject(runtime).getArrayBuffer(runtime); auto dataLayout = JsiTextureDataLayout::fromValue(runtime, arguments[2]); auto size = JsiExtent3D::fromValue(runtime, arguments[3]); + + // Log destination details + RNSkLogger::logToConsole("writeTexture: Destination texture mip level: " + std::to_string(destination->mipLevel)); + RNSkLogger::logToConsole("writeTexture: Destination texture aspect: " + std::to_string(static_cast(destination->aspect))); + + // Log data layout details + RNSkLogger::logToConsole("writeTexture: Data layout offset: " + std::to_string(dataLayout->offset)); + RNSkLogger::logToConsole("writeTexture: Data layout bytes per row: " + std::to_string(dataLayout->bytesPerRow)); + RNSkLogger::logToConsole("writeTexture: Data layout rows per image: " + std::to_string(dataLayout->rowsPerImage)); + + // Log size details + RNSkLogger::logToConsole("writeTexture: Size width: " + std::to_string(size->width)); + RNSkLogger::logToConsole("writeTexture: Size height: " + std::to_string(size->height)); + + // Log the size of the data + RNSkLogger::logToConsole("writeTexture: Data size: " + std::to_string(data.size(runtime))); + + // Log the first few bytes of the data + dataLayout->offset = 0; + dataLayout->bytesPerRow = 1024; + dataLayout->rowsPerImage = 256; + constexpr int maxBytesToLog = 256; + std::string dataPreview = "writeTexture: Data content: "; + auto dataSize = data.size(runtime); + for (int i = 0; i < maxBytesToLog; ++i) { + dataPreview += std::to_string(static_cast(data.data(runtime)[i])) + " "; + } + RNSkLogger::logToConsole(dataPreview); getObject()->WriteTexture(destination, data.data(runtime), data.size(runtime), dataLayout, size); diff --git a/package/cpp/wgpu/JsiVertexState.h b/package/cpp/wgpu/JsiVertexState.h index 8c5b6b74bc..b8cf8961b5 100644 --- a/package/cpp/wgpu/JsiVertexState.h +++ b/package/cpp/wgpu/JsiVertexState.h @@ -57,6 +57,7 @@ class JsiVertexState object->entryPoint = strdup(entryPoint.getString(runtime).utf8(runtime).c_str()); + RNSkLogger::logToConsole("entryPoint: %s", object->entryPoint); } else { throw jsi::JSError(runtime, "Missing mandatory prop entryPoint in VertexState"); From 6b4d5a396aca1c8328b2b4c32dc52874974d4608 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 12:25:57 +0200 Subject: [PATCH 43/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 2 +- package/cpp/wgpu/JsiFragmentState.h | 1 - package/cpp/wgpu/JsiQueue.h | 28 --------------------- package/cpp/wgpu/JsiTextureDataLayout.h | 8 +++--- package/cpp/wgpu/JsiVertexState.h | 1 - scripts/generator/model.ts | 7 +++--- 6 files changed, 8 insertions(+), 39 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 003458dea1..d93d37fc19 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -54,7 +54,7 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur @group(0) @binding(1) var ourTexture: texture_2d; @fragment fn fs(fsInput: OurVertexShaderOutput) -> @location(0) vec4f { - return textureSample(ourTexture, ourSampler, fsInput.texcoord); + return textureSample(ourTexture, ourSampler, fsInput.texcoord);// vec4(1.0, 0.0, 0.0, 1.0); } `, }); diff --git a/package/cpp/wgpu/JsiFragmentState.h b/package/cpp/wgpu/JsiFragmentState.h index 39b6aa82c4..b7d7faf081 100644 --- a/package/cpp/wgpu/JsiFragmentState.h +++ b/package/cpp/wgpu/JsiFragmentState.h @@ -57,7 +57,6 @@ class JsiFragmentState object->entryPoint = strdup(entryPoint.getString(runtime).utf8(runtime).c_str()); - RNSkLogger::logToConsole("entryPoint: %s", object->entryPoint); } else { throw jsi::JSError( runtime, "Missing mandatory prop entryPoint in FragmentState"); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index b7e952c16a..3075f7d410 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -54,34 +54,6 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { auto data = arguments[1].getObject(runtime).getArrayBuffer(runtime); auto dataLayout = JsiTextureDataLayout::fromValue(runtime, arguments[2]); auto size = JsiExtent3D::fromValue(runtime, arguments[3]); - - // Log destination details - RNSkLogger::logToConsole("writeTexture: Destination texture mip level: " + std::to_string(destination->mipLevel)); - RNSkLogger::logToConsole("writeTexture: Destination texture aspect: " + std::to_string(static_cast(destination->aspect))); - - // Log data layout details - RNSkLogger::logToConsole("writeTexture: Data layout offset: " + std::to_string(dataLayout->offset)); - RNSkLogger::logToConsole("writeTexture: Data layout bytes per row: " + std::to_string(dataLayout->bytesPerRow)); - RNSkLogger::logToConsole("writeTexture: Data layout rows per image: " + std::to_string(dataLayout->rowsPerImage)); - - // Log size details - RNSkLogger::logToConsole("writeTexture: Size width: " + std::to_string(size->width)); - RNSkLogger::logToConsole("writeTexture: Size height: " + std::to_string(size->height)); - - // Log the size of the data - RNSkLogger::logToConsole("writeTexture: Data size: " + std::to_string(data.size(runtime))); - - // Log the first few bytes of the data - dataLayout->offset = 0; - dataLayout->bytesPerRow = 1024; - dataLayout->rowsPerImage = 256; - constexpr int maxBytesToLog = 256; - std::string dataPreview = "writeTexture: Data content: "; - auto dataSize = data.size(runtime); - for (int i = 0; i < maxBytesToLog; ++i) { - dataPreview += std::to_string(static_cast(data.data(runtime)[i])) + " "; - } - RNSkLogger::logToConsole(dataPreview); getObject()->WriteTexture(destination, data.data(runtime), data.size(runtime), dataLayout, size); diff --git a/package/cpp/wgpu/JsiTextureDataLayout.h b/package/cpp/wgpu/JsiTextureDataLayout.h index 241ca0ee48..fd1f9db4c6 100644 --- a/package/cpp/wgpu/JsiTextureDataLayout.h +++ b/package/cpp/wgpu/JsiTextureDataLayout.h @@ -47,13 +47,13 @@ class JsiTextureDataLayout object->offset = static_cast(offset.getNumber()); } - if (obj.hasProperty(runtime, "bytes per row")) { - auto bytesPerRow = obj.getProperty(runtime, "bytes per row"); + if (obj.hasProperty(runtime, "bytesPerRow")) { + auto bytesPerRow = obj.getProperty(runtime, "bytesPerRow"); object->bytesPerRow = static_cast(bytesPerRow.getNumber()); } - if (obj.hasProperty(runtime, "rows per image")) { - auto rowsPerImage = obj.getProperty(runtime, "rows per image"); + if (obj.hasProperty(runtime, "rowsPerImage")) { + auto rowsPerImage = obj.getProperty(runtime, "rowsPerImage"); object->rowsPerImage = static_cast(rowsPerImage.getNumber()); } diff --git a/package/cpp/wgpu/JsiVertexState.h b/package/cpp/wgpu/JsiVertexState.h index b8cf8961b5..8c5b6b74bc 100644 --- a/package/cpp/wgpu/JsiVertexState.h +++ b/package/cpp/wgpu/JsiVertexState.h @@ -57,7 +57,6 @@ class JsiVertexState object->entryPoint = strdup(entryPoint.getString(runtime).utf8(runtime).c_str()); - RNSkLogger::logToConsole("entryPoint: %s", object->entryPoint); } else { throw jsi::JSError(runtime, "Missing mandatory prop entryPoint in VertexState"); diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 51896dfd58..c6be280670 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -205,8 +205,8 @@ return object; name: "TextureDataLayout", properties: [ {"name": "offset", "type": "uint64_t", "defaultAtomicValue": "0", optional: true }, - {"name": "bytes per row", "type": "uint32_t", optional: true, "defaultAtomicValue": "WGPU_COPY_STRIDE_UNDEFINED"}, - {"name": "rows per image", "type": "uint32_t", optional: true, "defaultAtomicValue": "WGPU_COPY_STRIDE_UNDEFINED"} + {"name": "bytesPerRow", "type": "uint32_t", optional: true, "defaultAtomicValue": "WGPU_COPY_STRIDE_UNDEFINED"}, + {"name": "rowsPerImage", "type": "uint32_t", optional: true, "defaultAtomicValue": "WGPU_COPY_STRIDE_UNDEFINED"} ] }, { @@ -535,8 +535,7 @@ return object; auto dataLayout = JsiTextureDataLayout::fromValue(runtime, arguments[2]); auto size = JsiExtent3D::fromValue(runtime, arguments[3]); - getObject()->WriteTexture(destination, data.data(runtime), - data.size(runtime), dataLayout, size); + getObject()->WriteTexture(destination, data.data(runtime), data.size(runtime), dataLayout, size); return jsi::Value::undefined();` }, From 9a8b5a438f728219753cd582098c34cc1d4dd5ec Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 12:28:30 +0200 Subject: [PATCH 44/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index d93d37fc19..0f97e85acc 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -4,7 +4,7 @@ const { width, height } = Dimensions.get("window"); export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textureData: Uint8Array) => { - const presentationFormat = 'bgra8unorm'; + const presentationFormat = 'rgba8unorm'; const pixels = new Uint8Array(256 * 256 * 4); pixels.fill(255); From ed9ddd11a711f8dd0458027822fbdf72a346071e Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 12:53:51 +0200 Subject: [PATCH 45/63] :wrenhc: --- example/src/Examples/Breathe/Breathe.tsx | 6 +++--- example/src/Examples/Breathe/demo1/demo7.ts | 24 +++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index b587288472..34d3c30b71 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -6,10 +6,10 @@ import { demo2 } from "./demo2"; import { demo1 } from "./demo1/main"; import { demo4 } from "./demo1/demo4"; import { demo5 } from "./demo1/demo5"; -import { demo7 } from "./demo1/demo7"; +import { Bitmap, demo7 } from "./demo1/demo7"; //import { demo6 } from "./demo6/main"; -const draw = async (context: GPUCanvasContext, image: Uint8Array) => { +const draw = async (context: GPUCanvasContext, image: Bitmap) => { const adapter = await gpu.requestAdapter(); const device = await adapter!.requestDevice(); const presentationFormat = "rgba8unorm"; @@ -28,7 +28,7 @@ const usePixels = (mod: number) => { if (!image) { return null; } - return image.readPixels() as Uint8Array; + return new Bitmap(image.readPixels() as Uint8Array, image.width(), image.height()); }; export const Breathe = () => { diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 0f97e85acc..382b2929bd 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -2,18 +2,14 @@ import { Dimensions } from "react-native"; const { width, height } = Dimensions.get("window"); -export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textureData: Uint8Array) => { +export class Bitmap { + constructor(public data: Uint8Array, public width: number, public height: number) {} +} + +export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: Bitmap) => { const presentationFormat = 'rgba8unorm'; - const pixels = new Uint8Array(256 * 256 * 4); - pixels.fill(255); - let i = 0; - for (let x = 0; x < 256 * 4; x++) { - for (let y = 0; y < 256 * 4; y++) { - pixels[i++] = (x * y) % 255; - } - } context.configure({ device, @@ -81,7 +77,7 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur const texture = device.createTexture({ label: url, format: 'rgba8unorm', - size: { width: 256, height: 256 }, + size: { width: img.width, height: img.height }, usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | @@ -89,13 +85,13 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, textur }); device.queue.writeTexture( { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, - pixels.buffer, + img.data.buffer, { offset: 0, - bytesPerRow: 4 * 256, - rowsPerImage: 256, + bytesPerRow: 4 * img.width, + rowsPerImage: img.height, }, - { width: 256, height: 256 } + { width: img.width, height: img.height } ); const sampler = device.createSampler({ From a912788b682672d2199ec33be5a344703bf23b2f Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 13:01:11 +0200 Subject: [PATCH 46/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 382b2929bd..98b3e4c883 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -3,7 +3,23 @@ import { Dimensions } from "react-native"; const { width, height } = Dimensions.get("window"); export class Bitmap { - constructor(public data: Uint8Array, public width: number, public height: number) {} + constructor(public data: Uint8Array, public width: number, public height: number) { + this.flipYAxis(); + } + flipYAxis(): void { + const rowLength = this.width * 4; // 4 bytes per pixel (RGBA8) + const tempRow = new Uint8Array(rowLength); + + for (let y = 0; y < this.height / 2; y++) { + const topRowIndex = y * rowLength; + const bottomRowIndex = (this.height - y - 1) * rowLength; + + // Swap rows + tempRow.set(this.data.subarray(topRowIndex, topRowIndex + rowLength)); + this.data.copyWithin(topRowIndex, bottomRowIndex, bottomRowIndex + rowLength); + this.data.set(tempRow, bottomRowIndex); + } + } } export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: Bitmap) => { From d955da6b962c357a8b58ccf822a1ff0065e94da9 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 13:24:47 +0200 Subject: [PATCH 47/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 98b3e4c883..2965cea3da 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -44,15 +44,14 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B @builtin(vertex_index) vertexIndex : u32 ) -> OurVertexShaderOutput { let pos = array( - // 1st triangle - vec2f( 0.0, 0.0), // center - vec2f( 1.0, 0.0), // right, center - vec2f( 0.0, 1.0), // center, top - - // 2st triangle - vec2f( 0.0, 1.0), // center, top - vec2f( 1.0, 0.0), // right, center - vec2f( 1.0, 1.0), // right, top + vec2f(-1.0, -1.0), // bottom left + vec2f( 1.0, -1.0), // bottom right + vec2f(-1.0, 1.0), // top left + + // 2nd triangle + vec2f(-1.0, 1.0), // top left + vec2f( 1.0, -1.0), // bottom right + vec2f( 1.0, 1.0) // top right ); var vsOutput: OurVertexShaderOutput; @@ -66,7 +65,10 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B @group(0) @binding(1) var ourTexture: texture_2d; @fragment fn fs(fsInput: OurVertexShaderOutput) -> @location(0) vec4f { - return textureSample(ourTexture, ourSampler, fsInput.texcoord);// vec4(1.0, 0.0, 0.0, 1.0); + // Assuming fsInput.texcoord ranges from 0 to 1 + //vec2f texCoord = 1.0 + fsInput.texcoord / 2.0; + return textureSample(ourTexture, ourSampler, (fsInput.texcoord / 2.0)+0.5); + } `, }); From 03bb730bc7ef88b0c26c38a0c246e6d771f21fab Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 18:28:32 +0200 Subject: [PATCH 48/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 3 +- example/src/Examples/Breathe/demo6/main.ts | 712 +++++++++--------- package/cpp/wgpu/JsiCommandEncoder.h | 5 +- package/cpp/wgpu/JsiComputePassEncoder.h | 45 ++ package/cpp/wgpu/JsiComputePipeline.h | 14 + .../cpp/wgpu/JsiComputePipelineDescriptor.h | 11 +- package/cpp/wgpu/JsiDevice.h | 13 +- .../cpp/wgpu/JsiPipelineLayoutDescriptor.h | 72 ++ package/cpp/wgpu/JsiQueue.h | 6 +- scripts/generator/model.ts | 103 ++- 10 files changed, 615 insertions(+), 369 deletions(-) create mode 100644 package/cpp/wgpu/JsiPipelineLayoutDescriptor.h diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 34d3c30b71..beebd75bfd 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -7,6 +7,7 @@ import { demo1 } from "./demo1/main"; import { demo4 } from "./demo1/demo4"; import { demo5 } from "./demo1/demo5"; import { Bitmap, demo7 } from "./demo1/demo7"; +import { demo6 } from "./demo6/main"; //import { demo6 } from "./demo6/main"; const draw = async (context: GPUCanvasContext, image: Bitmap) => { @@ -19,7 +20,7 @@ const draw = async (context: GPUCanvasContext, image: Bitmap) => { alphaMode: "premultiplied", }); //await demo5(device, context, image); - await demo7(device, context, image); + await demo6(device, context, image); //context.present(); }; diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index 911376476b..0b5abd693c 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -1,10 +1,14 @@ -import { mat4, vec3 } from 'wgpu-matrix'; -import { probabilityMapWGSL } from './probabilityMap'; -import { particleWGSL } from './particle'; -import { Dimensions } from 'react-native'; +/* eslint-disable camelcase */ +import { mat4, vec3 } from "wgpu-matrix"; +import { Dimensions } from "react-native"; -const {width, height} = Dimensions.get('window'); -const canvas = {width, height}; +import type { Bitmap } from "../demo1/demo7"; + +import { probabilityMapWGSL } from "./probabilityMap"; +import { particleWGSL } from "./particle"; + +const { width, height } = Dimensions.get("window"); +const canvas = { width, height }; const numParticles = 50000; const particlePositionOffset = 0; const particleColorOffset = 4 * 4; @@ -15,367 +19,376 @@ const particleInstanceByteSize = 3 * 4 + // velocity 1 * 4 + // padding 0; -const presentationFormat = 'rgba8unorm'; +const presentationFormat = "rgba8unorm"; -export const demo6 = (device: GPUDevice, context: GPUCanvasContext) => { -const particlesBuffer = device.createBuffer({ - size: numParticles * particleInstanceByteSize, - usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, -}); +export const demo6 = ( + device: GPUDevice, + context: GPUCanvasContext, + bitmap: Bitmap +) => { + const particlesBuffer = device.createBuffer({ + size: numParticles * particleInstanceByteSize, + usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, + }); -const renderPipeline = device.createRenderPipeline({ - layout: 'auto', - vertex: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: 'vs_main', - buffers: [ - { - // instanced particles buffer - arrayStride: particleInstanceByteSize, - stepMode: 'instance', - attributes: [ - { - // position - shaderLocation: 0, - offset: particlePositionOffset, - format: 'float32x3', - }, - { - // color - shaderLocation: 1, - offset: particleColorOffset, - format: 'float32x4', - }, - ], - }, - { - // quad vertex buffer - arrayStride: 2 * 4, // vec2f - stepMode: 'vertex', - attributes: [ - { - // vertex positions - shaderLocation: 2, - offset: 0, - format: 'float32x2', - }, - ], - }, - ], - }, - fragment: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: 'fs_main', - targets: [ - { - format: presentationFormat, - blend: { - color: { - srcFactor: 'src-alpha', - dstFactor: 'one', - operation: 'add', - }, - alpha: { - srcFactor: 'zero', - dstFactor: 'one', - operation: 'add', + const renderPipeline = device.createRenderPipeline({ + layout: "auto", + vertex: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "vs_main", + buffers: [ + { + // instanced particles buffer + arrayStride: particleInstanceByteSize, + stepMode: "instance", + attributes: [ + { + // position + shaderLocation: 0, + offset: particlePositionOffset, + format: "float32x3", + }, + { + // color + shaderLocation: 1, + offset: particleColorOffset, + format: "float32x4", + }, + ], + }, + { + // quad vertex buffer + arrayStride: 2 * 4, // vec2f + stepMode: "vertex", + attributes: [ + { + // vertex positions + shaderLocation: 2, + offset: 0, + format: "float32x2", + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "fs_main", + targets: [ + { + format: presentationFormat, + blend: { + color: { + srcFactor: "src-alpha", + dstFactor: "one", + operation: "add", + }, + alpha: { + srcFactor: "zero", + dstFactor: "one", + operation: "add", + }, }, }, - }, - ], - }, - primitive: { - topology: 'triangle-list', - }, + ], + }, + primitive: { + topology: "triangle-list", + }, - depthStencil: { - depthWriteEnabled: false, - depthCompare: 'less', - format: 'depth24plus', - }, -}); + // depthStencil: { + // depthWriteEnabled: false, + // depthCompare: 'less', + // format: 'depth24plus', + // }, + }); -const depthTexture = device.createTexture({ - size: [canvas.width, canvas.height], - format: 'depth24plus', - usage: GPUTextureUsage.RENDER_ATTACHMENT, -}); + // const depthTexture = device.createTexture({ + // size: [canvas.width, canvas.height], + // format: 'depth24plus', + // usage: GPUTextureUsage.RENDER_ATTACHMENT, + // }); -const uniformBufferSize = - 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f - 3 * 4 + // right : vec3f - 4 + // padding - 3 * 4 + // up : vec3f - 4 + // padding - 0; -const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, -}); + const uniformBufferSize = + 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f + 3 * 4 + // right : vec3f + 4 + // padding + 3 * 4 + // up : vec3f + 4 + // padding + 0; + const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); -const uniformBindGroup = device.createBindGroup({ - layout: renderPipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: uniformBuffer, + const uniformBindGroup = device.createBindGroup({ + layout: renderPipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: uniformBuffer, + }, }, - }, - ], -}); + ], + }); -const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: undefined, // Assigned later - clearValue: [0, 0, 0, 1], - loadOp: 'clear', - storeOp: 'store', - }, - ], - depthStencilAttachment: { - view: depthTexture.createView(), + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + clearValue: [0, 0, 0, 1], + loadOp: "clear", + storeOp: "store", + }, + ], + // depthStencilAttachment: { + // view: depthTexture.createView(), - depthClearValue: 1.0, - depthLoadOp: 'clear', - depthStoreOp: 'store', - }, -}; + // depthClearValue: 1.0, + // depthLoadOp: 'clear', + // depthStoreOp: 'store', + // }, + }; -////////////////////////////////////////////////////////////////////////////// -// Quad vertex buffer -////////////////////////////////////////////////////////////////////////////// -const quadVertexBuffer = device.createBuffer({ - size: 6 * 2 * 4, // 6x vec2f - usage: GPUBufferUsage.VERTEX, - mappedAtCreation: true, -}); -// prettier-ignore -const vertexData = [ + ////////////////////////////////////////////////////////////////////////////// + // Quad vertex buffer + ////////////////////////////////////////////////////////////////////////////// + const quadVertexBuffer = device.createBuffer({ + size: 6 * 2 * 4, // 6x vec2f + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true, + }); + // prettier-ignore + const vertexData = [ -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, ]; -new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); -quadVertexBuffer.unmap(); + new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); + quadVertexBuffer.unmap(); -////////////////////////////////////////////////////////////////////////////// -// Texture -////////////////////////////////////////////////////////////////////////////// -let texture: GPUTexture; -let textureWidth = 1; -let textureHeight = 1; -let numMipLevels = 1; -{ - const response = await fetch('../../assets/img/webgpu.png'); - const imageBitmap = await createImageBitmap(await response.blob()); + ////////////////////////////////////////////////////////////////////////////// + // Texture + ////////////////////////////////////////////////////////////////////////////// + //let texture: GPUTexture; + let textureWidth = 1; + let textureHeight = 1; + let numMipLevels = 1; // Calculate number of mip levels required to generate the probability map - while ( - textureWidth < imageBitmap.width || - textureHeight < imageBitmap.height - ) { + while (textureWidth < bitmap.width || textureHeight < bitmap.height) { textureWidth *= 2; textureHeight *= 2; numMipLevels++; } - texture = device.createTexture({ - size: [imageBitmap.width, imageBitmap.height, 1], + const texture = device.createTexture({ + size: { width: bitmap.width, height: bitmap.height }, mipLevelCount: numMipLevels, - format: 'rgba8unorm', + format: "rgba8unorm", usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT, }); - device.queue.copyExternalImageToTexture( - { source: imageBitmap }, - { texture: texture }, - [imageBitmap.width, imageBitmap.height] + device.queue.writeTexture( + { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, + bitmap.data.buffer, + { + offset: 0, + bytesPerRow: 4 * bitmap.width, + rowsPerImage: bitmap.height, + }, + { width: bitmap.width, height: bitmap.height } ); -} -////////////////////////////////////////////////////////////////////////////// -// Probability map generation -// The 0'th mip level of texture holds the color data and spawn-probability in -// the alpha channel. The mip levels 1..N are generated to hold spawn -// probabilities up to the top 1x1 mip level. -////////////////////////////////////////////////////////////////////////////// -{ - const probabilityMapImportLevelPipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: 'import_level', - }, - }); - const probabilityMapExportLevelPipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: 'export_level', - }, - }); + console.log("Step 0"); + ////////////////////////////////////////////////////////////////////////////// + // Probability map generation + // The 0'th mip level of texture holds the color data and spawn-probability in + // the alpha channel. The mip levels 1..N are generated to hold spawn + // probabilities up to the top 1x1 mip level. + ////////////////////////////////////////////////////////////////////////////// + { + const probabilityMapImportLevelPipeline = device.createComputePipeline({ + layout: "auto", + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: "import_level", + }, + }); + const probabilityMapExportLevelPipeline = device.createComputePipeline({ + layout: "auto", + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: "export_level", + }, + }); + const probabilityMapUBOBufferSize = + 1 * 4 + // stride + 3 * 4 + // padding + 0; + const probabilityMapUBOBuffer = device.createBuffer({ + size: probabilityMapUBOBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); + console.log("probabilityMapUBOBuffer created"); + const buffer_a = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + console.log("buffer_a created"); + const buffer_b = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + console.log("buffer_b created"); + device.queue.writeBuffer( + probabilityMapUBOBuffer, + 0, + new Int32Array([textureWidth]).buffer + ); + console.log("writeBuffer done"); + const commandEncoder = device.createCommandEncoder(); + for (let level = 0; level < numMipLevels; level++) { + const levelWidth = textureWidth >> level; + const levelHeight = textureHeight >> level; + const pipeline = + level === 0 + ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) + : probabilityMapExportLevelPipeline.getBindGroupLayout(0); + const texOut = texture.createView({ + format: "rgba8unorm", + dimension: "2d", + baseMipLevel: level, + mipLevelCount: 1, + }); + console.log("Step 2.5"); + const probabilityMapBindGroup = device.createBindGroup({ + layout: pipeline, + entries: [ + { + // ubo + binding: 0, + resource: { buffer: probabilityMapUBOBuffer }, + }, + { + // buf_in + binding: 1, + resource: { buffer: level & 1 ? buffer_a : buffer_b }, + }, + { + // buf_out + binding: 2, + resource: { buffer: level & 1 ? buffer_b : buffer_a }, + }, + { + // tex_in / tex_out + binding: 3, + resource: texOut, + }, + ], + }); + console.log("Step 3"); + if (level === 0) { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapImportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); + passEncoder.end(); + } else { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapExportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); + passEncoder.end(); + } + } + device.queue.submit([commandEncoder.finish()]); + } - const probabilityMapUBOBufferSize = - 1 * 4 + // stride + // ////////////////////////////////////////////////////////////////////////////// + // // Simulation compute pipeline + // ////////////////////////////////////////////////////////////////////////////// + const simulationParams = { + simulate: true, + deltaTime: 0.04, + }; + + const simulationUBOBufferSize = + 1 * 4 + // deltaTime 3 * 4 + // padding + 4 * 4 + // seed 0; - const probabilityMapUBOBuffer = device.createBuffer({ - size: probabilityMapUBOBufferSize, + const simulationUBOBuffer = device.createBuffer({ + size: simulationUBOBufferSize, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); - const buffer_a = device.createBuffer({ - size: textureWidth * textureHeight * 4, - usage: GPUBufferUsage.STORAGE, - }); - const buffer_b = device.createBuffer({ - size: textureWidth * textureHeight * 4, - usage: GPUBufferUsage.STORAGE, + + const computePipeline = device.createComputePipeline({ + layout: "auto", + compute: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "simulate", + }, }); - device.queue.writeBuffer( - probabilityMapUBOBuffer, - 0, - new Int32Array([textureWidth]) - ); - const commandEncoder = device.createCommandEncoder(); - for (let level = 0; level < numMipLevels; level++) { - const levelWidth = textureWidth >> level; - const levelHeight = textureHeight >> level; - const pipeline = - level == 0 - ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) - : probabilityMapExportLevelPipeline.getBindGroupLayout(0); - const probabilityMapBindGroup = device.createBindGroup({ - layout: pipeline, - entries: [ - { - // ubo - binding: 0, - resource: { buffer: probabilityMapUBOBuffer }, - }, - { - // buf_in - binding: 1, - resource: { buffer: level & 1 ? buffer_a : buffer_b }, - }, - { - // buf_out - binding: 2, - resource: { buffer: level & 1 ? buffer_b : buffer_a }, + const computeBindGroup = device.createBindGroup({ + layout: computePipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: simulationUBOBuffer, }, - { - // tex_in / tex_out - binding: 3, - resource: texture.createView({ - format: 'rgba8unorm', - dimension: '2d', - baseMipLevel: level, - mipLevelCount: 1, - }), + }, + { + binding: 1, + resource: { + buffer: particlesBuffer, + offset: 0, + size: numParticles * particleInstanceByteSize, }, - ], - }); - if (level == 0) { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(probabilityMapImportLevelPipeline); - passEncoder.setBindGroup(0, probabilityMapBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); - passEncoder.end(); - } else { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(probabilityMapExportLevelPipeline); - passEncoder.setBindGroup(0, probabilityMapBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); - passEncoder.end(); - } - } - device.queue.submit([commandEncoder.finish()]); -} - -////////////////////////////////////////////////////////////////////////////// -// Simulation compute pipeline -////////////////////////////////////////////////////////////////////////////// -const simulationParams = { - simulate: true, - deltaTime: 0.04, -}; - -const simulationUBOBufferSize = - 1 * 4 + // deltaTime - 3 * 4 + // padding - 4 * 4 + // seed - 0; -const simulationUBOBuffer = device.createBuffer({ - size: simulationUBOBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, -}); - -const computePipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: 'simulate', - }, -}); -const computeBindGroup = device.createBindGroup({ - layout: computePipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: simulationUBOBuffer, }, - }, - { - binding: 1, - resource: { - buffer: particlesBuffer, - offset: 0, - size: numParticles * particleInstanceByteSize, + { + binding: 2, + resource: texture.createView(), }, - }, - { - binding: 2, - resource: texture.createView(), - }, - ], -}); + ], + }); -const aspect = canvas.width / canvas.height; -const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); -const view = mat4.create(); -const mvp = mat4.create(); + const aspect = canvas.width / canvas.height; + const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); + const view = mat4.create(); + const mvp = mat4.create(); -function frame() { - device.queue.writeBuffer( - simulationUBOBuffer, - 0, - new Float32Array([ - simulationParams.simulate ? simulationParams.deltaTime : 0.0, - 0.0, - 0.0, - 0.0, // padding - Math.random() * 100, - Math.random() * 100, // seed.xy - 1 + Math.random(), - 1 + Math.random(), // seed.zw - ]) - ); + function frame() { + device.queue.writeBuffer( + simulationUBOBuffer, + 0, + new Float32Array([ + simulationParams.simulate ? simulationParams.deltaTime : 0.0, + 0.0, + 0.0, + 0.0, // padding + Math.random() * 100, + Math.random() * 100, // seed.xy + 1 + Math.random(), + 1 + Math.random(), // seed.zw + ]).buffer + ); - mat4.identity(view); - mat4.translate(view, vec3.fromValues(0, 0, -3), view); - mat4.rotateX(view, Math.PI * -0.2, view); - mat4.multiply(projection, view, mvp); + mat4.identity(view); + mat4.translate(view, vec3.fromValues(0, 0, -3), view); + mat4.rotateX(view, Math.PI * -0.2, view); + mat4.multiply(projection, view, mvp); - // prettier-ignore - device.queue.writeBuffer( + // prettier-ignore + device.queue.writeBuffer( uniformBuffer, 0, new Float32Array([ @@ -392,34 +405,33 @@ function frame() { view[1], view[5], view[9], // up 0, // padding - ]) + ]).buffer ); - const swapChainTexture = context.getCurrentTexture(); - // prettier-ignore - renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); + const swapChainTexture = context.getCurrentTexture(); + // prettier-ignore + renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); - const commandEncoder = device.createCommandEncoder(); - { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(computePipeline); - passEncoder.setBindGroup(0, computeBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); - passEncoder.end(); - } - { - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(renderPipeline); - passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, particlesBuffer); - passEncoder.setVertexBuffer(1, quadVertexBuffer); - passEncoder.draw(6, numParticles, 0, 0); - passEncoder.end(); - } + const commandEncoder = device.createCommandEncoder(); + { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(computePipeline); + passEncoder.setBindGroup(0, computeBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); + passEncoder.end(); + } + { + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(renderPipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, particlesBuffer); + passEncoder.setVertexBuffer(1, quadVertexBuffer); + passEncoder.draw(6, numParticles, 0, 0); + passEncoder.end(); + } - device.queue.submit([commandEncoder.finish()]); - context.present(); + device.queue.submit([commandEncoder.finish()]); + context.present(); + requestAnimationFrame(frame); + } requestAnimationFrame(frame); -} -requestAnimationFrame(frame); - -} \ No newline at end of file +}; diff --git a/package/cpp/wgpu/JsiCommandEncoder.h b/package/cpp/wgpu/JsiCommandEncoder.h index 99a3dd9876..6ffda6ab9e 100644 --- a/package/cpp/wgpu/JsiCommandEncoder.h +++ b/package/cpp/wgpu/JsiCommandEncoder.h @@ -56,8 +56,11 @@ class JsiCommandEncoder } JSI_HOST_FUNCTION(beginComputePass) { + + auto defaultDescriptor = new wgpu::ComputePassDescriptor(); auto descriptor = - JsiComputePassDescriptor::fromValue(runtime, arguments[0]); + count > 0 ? JsiComputePassDescriptor::fromValue(runtime, arguments[0]) + : defaultDescriptor; auto ret = getObject()->BeginComputePass(descriptor); if (ret == nullptr) { diff --git a/package/cpp/wgpu/JsiComputePassEncoder.h b/package/cpp/wgpu/JsiComputePassEncoder.h index 95afba85fa..8701206580 100644 --- a/package/cpp/wgpu/JsiComputePassEncoder.h +++ b/package/cpp/wgpu/JsiComputePassEncoder.h @@ -7,6 +7,8 @@ #include +#include "JsiBindGroup.h" +#include "JsiComputePipeline.h" #include "JsiEnums.h" #include "JsiHostObject.h" #include "JsiPromises.h" @@ -29,9 +31,52 @@ class JsiComputePassEncoder context, std::make_shared(std::move(m))) { } + JSI_HOST_FUNCTION(setPipeline) { + auto pipeline = JsiComputePipeline::fromValue(runtime, arguments[0]); + + getObject()->SetPipeline(*pipeline); + + return jsi::Value::undefined(); + } + + JSI_HOST_FUNCTION(setBindGroup) { + auto index = static_cast(arguments[0].getNumber()); + auto bindGroup = JsiBindGroup::fromValue(runtime, arguments[1]); + // auto dynamicOffsetCount = static_cast(arguments[2].getNumber()); + getObject()->SetBindGroup(index, *bindGroup, 0, nullptr); + return jsi::Value::undefined(); + } + + JSI_HOST_FUNCTION(dispatchWorkgroups) { + auto x = static_cast(arguments[0].getNumber()); + uint32_t defaultY = 1; + auto y = + count > 1 ? static_cast(arguments[1].getNumber()) : defaultY; + uint32_t defaultZ = 1; + auto z = + count > 2 ? static_cast(arguments[2].getNumber()) : defaultZ; + + getObject()->DispatchWorkgroups(x, y, z); + + return jsi::Value::undefined(); + } + + JSI_HOST_FUNCTION(end) { + + getObject()->End(); + + return jsi::Value::undefined(); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiComputePassEncoder, ComputePassEncoder) + JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiComputePassEncoder, setPipeline), + JSI_EXPORT_FUNC(JsiComputePassEncoder, setBindGroup), + JSI_EXPORT_FUNC(JsiComputePassEncoder, + dispatchWorkgroups), + JSI_EXPORT_FUNC(JsiComputePassEncoder, end)) + /** * Returns the underlying object from a host object of this type */ diff --git a/package/cpp/wgpu/JsiComputePipeline.h b/package/cpp/wgpu/JsiComputePipeline.h index c7276c40fc..9b50ab66f6 100644 --- a/package/cpp/wgpu/JsiComputePipeline.h +++ b/package/cpp/wgpu/JsiComputePipeline.h @@ -7,6 +7,7 @@ #include +#include "JsiBindGroupLayout.h" #include "JsiEnums.h" #include "JsiHostObject.h" #include "JsiPromises.h" @@ -28,9 +29,22 @@ class JsiComputePipeline : JsiSkWrappingSharedPtrHostObject( context, std::make_shared(std::move(m))) {} + JSI_HOST_FUNCTION(getBindGroupLayout) { + auto index = static_cast(arguments[0].getNumber()); + + auto ret = getObject()->GetBindGroupLayout(index); + if (ret == nullptr) { + throw jsi::JSError(runtime, "getBindGroupLayout returned null"); + } + return jsi::Object::createFromHostObject( + runtime, std::make_shared(getContext(), ret)); + } + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead EXPORT_JSI_API_BRANDNAME(JsiComputePipeline, ComputePipeline) + JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiComputePipeline, getBindGroupLayout)) + /** * Returns the underlying object from a host object of this type */ diff --git a/package/cpp/wgpu/JsiComputePipelineDescriptor.h b/package/cpp/wgpu/JsiComputePipelineDescriptor.h index d85670a088..b68e9c92aa 100644 --- a/package/cpp/wgpu/JsiComputePipelineDescriptor.h +++ b/package/cpp/wgpu/JsiComputePipelineDescriptor.h @@ -35,9 +35,6 @@ class JsiComputePipelineDescriptor EXPORT_JSI_API_BRANDNAME(JsiComputePipelineDescriptor, ComputePipelineDescriptor) - /** - * Returns the underlying object from a host object of this type - */ static wgpu::ComputePipelineDescriptor *fromValue(jsi::Runtime &runtime, const jsi::Value &raw) { const auto &obj = raw.asObject(runtime); @@ -48,11 +45,11 @@ class JsiComputePipelineDescriptor } else { auto object = new wgpu::ComputePipelineDescriptor(); - if (obj.hasProperty(runtime, "layout")) { - auto layout = obj.getProperty(runtime, "layout"); + // if (obj.hasProperty(runtime, "layout")) { + // auto layout = obj.getProperty(runtime, "layout"); - object->layout = *JsiPipelineLayout::fromValue(runtime, layout); - } + // object->layout = *JsiPipelineLayout::fromValue(runtime, layout); + // } if (obj.hasProperty(runtime, "compute")) { auto compute = obj.getProperty(runtime, "compute"); diff --git a/package/cpp/wgpu/JsiDevice.h b/package/cpp/wgpu/JsiDevice.h index 05ceae5317..9300e93bb0 100644 --- a/package/cpp/wgpu/JsiDevice.h +++ b/package/cpp/wgpu/JsiDevice.h @@ -17,6 +17,7 @@ #include "JsiComputePipelineDescriptor.h" #include "JsiEnums.h" #include "JsiHostObject.h" +#include "JsiPipelineLayoutDescriptor.h" #include "JsiPromises.h" #include "JsiQueue.h" #include "JsiRenderPipeline.h" @@ -53,6 +54,15 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { runtime, std::make_shared(getContext(), ret)); } + JSI_HOST_FUNCTION(createPipelineLayout) { + auto descriptor = + JsiPipelineLayoutDescriptor::fromValue(runtime, arguments[0]); + + getObject()->CreatePipelineLayout(descriptor); + + return jsi::Value::undefined(); + } + JSI_HOST_FUNCTION(createSampler) { auto descriptor = JsiSamplerDescriptor::fromValue(runtime, arguments[0]); @@ -155,7 +165,8 @@ class JsiDevice : public JsiSkWrappingSharedPtrHostObject { JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiDevice, queue)) - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiDevice, createSampler), + JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiDevice, createPipelineLayout), + JSI_EXPORT_FUNC(JsiDevice, createSampler), JSI_EXPORT_FUNC(JsiDevice, createBindGroup), JSI_EXPORT_FUNC(JsiDevice, createRenderPipeline), JSI_EXPORT_FUNC(JsiDevice, createComputePipeline), diff --git a/package/cpp/wgpu/JsiPipelineLayoutDescriptor.h b/package/cpp/wgpu/JsiPipelineLayoutDescriptor.h new file mode 100644 index 0000000000..316a9d9541 --- /dev/null +++ b/package/cpp/wgpu/JsiPipelineLayoutDescriptor.h @@ -0,0 +1,72 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiBindGroupLayout.h" +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiPipelineLayoutDescriptor + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiPipelineLayoutDescriptor(std::shared_ptr context, + wgpu::PipelineLayoutDescriptor m) + : JsiSkWrappingSharedPtrHostObject( + context, + std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiPipelineLayoutDescriptor, + PipelineLayoutDescriptor) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::PipelineLayoutDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + auto object = new wgpu::PipelineLayoutDescriptor(); + + if (obj.hasProperty(runtime, "bindGroupLayouts")) { + auto bindGroupLayouts = obj.getProperty(runtime, "bindGroupLayouts"); + auto jsiArray0 = bindGroupLayouts.asObject(runtime).asArray(runtime); + auto jsiArray0Size = static_cast(jsiArray0.size(runtime)); + auto array0 = new std::vector(); + array0->reserve(jsiArray0Size); + for (int i = 0; i < jsiArray0Size; i++) { + auto element = JsiBindGroupLayout::fromValue( + runtime, jsiArray0.getValueAtIndex(runtime, i)); + array0->push_back(*element); + } + + object->bindGroupLayoutCount = jsiArray0Size; + object->bindGroupLayouts = array0->data(); + } else { + throw jsi::JSError(runtime, "Missing mandatory prop bindGroupLayouts " + "in PipelineLayoutDescriptor"); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 3075f7d410..6a6d814107 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -66,8 +66,10 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); - auto offset2 = static_cast(arguments[3].getNumber()); - auto size = static_cast(arguments[4].getNumber()); + auto offset2 = + count > 3 ? static_cast(arguments[3].getNumber()) : 0; + auto size = count > 4 ? static_cast(arguments[4].getNumber()) + : buffer->GetSize(); getObject()->WriteBuffer(*buffer, offset, data.data(runtime) + offset2, size); return jsi::Value::undefined(); diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index c6be280670..da621e4652 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -218,6 +218,12 @@ return object; returns: "Queue", member: "queue" }, + { + name: "createPipelineLayout", + args: [ + { name: "descriptor", type: "PipelineLayoutDescriptor" } + ], + }, { name: "createSampler", args: [ @@ -459,6 +465,40 @@ return object; }, { name: "ComputePassEncoder", + methods: [ + { + name: "setPipeline", + args: [ + { name: "pipeline", type: "ComputePipeline" } + ] + }, + { + name: "setBindGroup", + args: [ + { name: "index", type: "uint32_t" }, + { name: "bindGroup", type: "BindGroup" }, + { name: "dynamicOffsetCount", "type": "size_t", "defaultAtomicValue": "0"}, + // { name: "dynamicOffsets", "type": "uint32_t*", "defaultAtomicValue": "nullptr"} + ], + implementation: `auto index = static_cast(arguments[0].getNumber()); + auto bindGroup = JsiBindGroup::fromValue(runtime, arguments[1]); + //auto dynamicOffsetCount = static_cast(arguments[2].getNumber()); + getObject()->SetBindGroup(index, *bindGroup, 0, nullptr); + return jsi::Value::undefined();` + }, + { + name: "dispatchWorkgroups", + args: [ + { name: "x", type: "uint32_t" }, + { name: "y", type: "uint32_t", optional: true, defaultAtomicValue: "1" }, + { name: "z", type: "uint32_t", optional: true, defaultAtomicValue: "1" } + ], + }, + { + name: "end", + args: [] + } + ] }, { name: "CommandEncoder", @@ -467,8 +507,20 @@ return object; { name: "finish", args: [], returns: "CommandBuffer" }, { name: "beginComputePass", - args: [{ name: "descriptor", type: "ComputePassDescriptor" }], - returns: "ComputePassEncoder" + args: [{ name: "descriptor", type: "ComputePassDescriptor", optional: true }], + returns: "ComputePassEncoder", + implementation: ` + auto defaultDescriptor = new wgpu::ComputePassDescriptor(); + auto descriptor = + count > 0 ? JsiComputePassDescriptor::fromValue(runtime, arguments[0]) + : defaultDescriptor; + + auto ret = getObject()->BeginComputePass(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "beginComputePass returned null"); + } + return jsi::Object::createFromHostObject( + runtime, std::make_shared(getContext(), ret));` }, { name: "copyBufferToBuffer", @@ -551,8 +603,8 @@ return object; auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); - auto offset2 = static_cast(arguments[3].getNumber()); - auto size = static_cast(arguments[4].getNumber()); + auto offset2 = count > 3 ? static_cast(arguments[3].getNumber()) : 0; + auto size = count > 4 ? static_cast(arguments[4].getNumber()) : buffer->GetSize(); getObject()->WriteBuffer(*buffer, offset, data.data(runtime) + offset2, size); return jsi::Value::undefined(); `, @@ -610,7 +662,35 @@ return object; properties: [ {"name": "layout", "type": "PipelineLayout", "optional": true}, {"name": "compute", "type": "ProgrammableStageDescriptor"} - ] + ], + fromValueImpl: `static wgpu::ComputePipelineDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { +const auto &obj = raw.asObject(runtime); +if (obj.isHostObject(runtime)) { +return obj.asHostObject(runtime) +->getObject() +.get(); +} else { +auto object = new wgpu::ComputePipelineDescriptor(); + +// if (obj.hasProperty(runtime, "layout")) { +// auto layout = obj.getProperty(runtime, "layout"); + +// object->layout = *JsiPipelineLayout::fromValue(runtime, layout); +// } +if (obj.hasProperty(runtime, "compute")) { +auto compute = obj.getProperty(runtime, "compute"); + +object->compute = +*JsiProgrammableStageDescriptor::fromValue(runtime, compute); +} else { +throw jsi::JSError( +runtime, +"Missing mandatory prop compute in ComputePipelineDescriptor"); +} +return object; +} +}` }, { name: "ProgrammableStageDescriptor", @@ -863,10 +943,19 @@ object->sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, ] }, { - name: "ComputePipeline" + name: "ComputePipeline", + methods: [ + { name: "getBindGroupLayout", args: [{ name: "index", type: "uint32_t" }], returns: "BindGroupLayout" } + ] }, { - name: "PipelineLayout" + name: "PipelineLayout", + }, + { + name: "PipelineLayoutDescriptor", + properties: [ + { name: "bindGroupLayouts", type: "BindGroupLayout[]"} + ] }, { name: "Sampler" From 8952c4b8d12d3c9f057a5eceede1397c91045226 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 18:58:31 +0200 Subject: [PATCH 49/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 1 + example/src/Examples/Breathe/demo6/main.ts | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 2965cea3da..eecf46a756 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -30,6 +30,7 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B context.configure({ device, format: presentationFormat, + alphaMode: 'premultiplied', }); const module = device.createShaderModule({ diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index 0b5abd693c..a4b079ee42 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -205,7 +205,6 @@ export const demo6 = ( { width: bitmap.width, height: bitmap.height } ); - console.log("Step 0"); ////////////////////////////////////////////////////////////////////////////// // Probability map generation // The 0'th mip level of texture holds the color data and spawn-probability in @@ -235,23 +234,19 @@ export const demo6 = ( size: probabilityMapUBOBufferSize, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); - console.log("probabilityMapUBOBuffer created"); const buffer_a = device.createBuffer({ size: textureWidth * textureHeight * 4, usage: GPUBufferUsage.STORAGE, }); - console.log("buffer_a created"); const buffer_b = device.createBuffer({ size: textureWidth * textureHeight * 4, usage: GPUBufferUsage.STORAGE, }); - console.log("buffer_b created"); device.queue.writeBuffer( probabilityMapUBOBuffer, 0, new Int32Array([textureWidth]).buffer ); - console.log("writeBuffer done"); const commandEncoder = device.createCommandEncoder(); for (let level = 0; level < numMipLevels; level++) { const levelWidth = textureWidth >> level; @@ -266,7 +261,6 @@ export const demo6 = ( baseMipLevel: level, mipLevelCount: 1, }); - console.log("Step 2.5"); const probabilityMapBindGroup = device.createBindGroup({ layout: pipeline, entries: [ @@ -292,7 +286,6 @@ export const demo6 = ( }, ], }); - console.log("Step 3"); if (level === 0) { const passEncoder = commandEncoder.beginComputePass(); passEncoder.setPipeline(probabilityMapImportLevelPipeline); From 983289bcbb00118b7cdcd5a62b1305c04829c8ed Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 6 May 2024 19:25:47 +0200 Subject: [PATCH 50/63] :wrench: --- example/src/Examples/Breathe/demo6/main.ts | 230 +++++++++--------- .../cpp/wgpu/JsiComputePipelineDescriptor.h | 8 +- 2 files changed, 124 insertions(+), 114 deletions(-) diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index a4b079ee42..cd843203c1 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -9,30 +9,34 @@ import { particleWGSL } from "./particle"; const { width, height } = Dimensions.get("window"); const canvas = { width, height }; -const numParticles = 50000; -const particlePositionOffset = 0; -const particleColorOffset = 4 * 4; -const particleInstanceByteSize = - 3 * 4 + // position - 1 * 4 + // lifetime - 4 * 4 + // color - 3 * 4 + // velocity - 1 * 4 + // padding - 0; const presentationFormat = "rgba8unorm"; export const demo6 = ( device: GPUDevice, context: GPUCanvasContext, - bitmap: Bitmap + imageBitmap: Bitmap ) => { + + + const numParticles = 50000; + const particlePositionOffset = 0; + const particleColorOffset = 4 * 4; + const particleInstanceByteSize = + 3 * 4 + // position + 1 * 4 + // lifetime + 4 * 4 + // color + 3 * 4 + // velocity + 1 * 4 + // padding + 0; + + const particlesBuffer = device.createBuffer({ size: numParticles * particleInstanceByteSize, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, }); - + const renderPipeline = device.createRenderPipeline({ - layout: "auto", + layout: 'auto', vertex: { module: device.createShaderModule({ code: particleWGSL, @@ -42,32 +46,32 @@ export const demo6 = ( { // instanced particles buffer arrayStride: particleInstanceByteSize, - stepMode: "instance", + stepMode: 'instance', attributes: [ { // position shaderLocation: 0, offset: particlePositionOffset, - format: "float32x3", + format: 'float32x3', }, { // color shaderLocation: 1, offset: particleColorOffset, - format: "float32x4", + format: 'float32x4', }, ], }, { // quad vertex buffer arrayStride: 2 * 4, // vec2f - stepMode: "vertex", + stepMode: 'vertex', attributes: [ { // vertex positions shaderLocation: 2, offset: 0, - format: "float32x2", + format: 'float32x2', }, ], }, @@ -83,36 +87,36 @@ export const demo6 = ( format: presentationFormat, blend: { color: { - srcFactor: "src-alpha", - dstFactor: "one", - operation: "add", + srcFactor: 'src-alpha', + dstFactor: 'one', + operation: 'add', }, alpha: { - srcFactor: "zero", - dstFactor: "one", - operation: "add", + srcFactor: 'zero', + dstFactor: 'one', + operation: 'add', }, }, }, ], }, primitive: { - topology: "triangle-list", + topology: 'triangle-list', }, - + // depthStencil: { // depthWriteEnabled: false, // depthCompare: 'less', // format: 'depth24plus', // }, }); - + // const depthTexture = device.createTexture({ - // size: [canvas.width, canvas.height], + // size: { width: canvas.width, height: canvas.height }, // format: 'depth24plus', // usage: GPUTextureUsage.RENDER_ATTACHMENT, // }); - + const uniformBufferSize = 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f 3 * 4 + // right : vec3f @@ -124,7 +128,7 @@ export const demo6 = ( size: uniformBufferSize, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); - + const uniformBindGroup = device.createBindGroup({ layout: renderPipeline.getBindGroupLayout(0), entries: [ @@ -136,25 +140,25 @@ export const demo6 = ( }, ], }); - + const renderPassDescriptor: GPURenderPassDescriptor = { colorAttachments: [ { view: undefined, // Assigned later clearValue: [0, 0, 0, 1], - loadOp: "clear", - storeOp: "store", + loadOp: 'clear', + storeOp: 'store', }, ], // depthStencilAttachment: { // view: depthTexture.createView(), - + // depthClearValue: 1.0, // depthLoadOp: 'clear', // depthStoreOp: 'store', // }, }; - + ////////////////////////////////////////////////////////////////////////////// // Quad vertex buffer ////////////////////////////////////////////////////////////////////////////// @@ -165,46 +169,50 @@ export const demo6 = ( }); // prettier-ignore const vertexData = [ - -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, -]; + -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, + ]; new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); quadVertexBuffer.unmap(); - + ////////////////////////////////////////////////////////////////////////////// // Texture ////////////////////////////////////////////////////////////////////////////// - //let texture: GPUTexture; + let texture: GPUTexture; let textureWidth = 1; let textureHeight = 1; let numMipLevels = 1; - - // Calculate number of mip levels required to generate the probability map - while (textureWidth < bitmap.width || textureHeight < bitmap.height) { - textureWidth *= 2; - textureHeight *= 2; - numMipLevels++; + { + // Calculate number of mip levels required to generate the probability map + while ( + textureWidth < imageBitmap.width || + textureHeight < imageBitmap.height + ) { + textureWidth *= 2; + textureHeight *= 2; + numMipLevels++; + } + texture = device.createTexture({ + size: { width: imageBitmap.width, height: imageBitmap.height }, + mipLevelCount: numMipLevels, + format: 'rgba8unorm', + usage: + GPUTextureUsage.TEXTURE_BINDING | + GPUTextureUsage.STORAGE_BINDING | + GPUTextureUsage.COPY_DST | + GPUTextureUsage.RENDER_ATTACHMENT, + }); + device.queue.writeTexture( + { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, + imageBitmap.data.buffer, + { + offset: 0, + bytesPerRow: 4 * imageBitmap.width, + rowsPerImage: imageBitmap.height, + }, + { width: imageBitmap.width, height: imageBitmap.height } + ); } - const texture = device.createTexture({ - size: { width: bitmap.width, height: bitmap.height }, - mipLevelCount: numMipLevels, - format: "rgba8unorm", - usage: - GPUTextureUsage.TEXTURE_BINDING | - GPUTextureUsage.STORAGE_BINDING | - GPUTextureUsage.COPY_DST | - GPUTextureUsage.RENDER_ATTACHMENT, - }); - device.queue.writeTexture( - { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, - bitmap.data.buffer, - { - offset: 0, - bytesPerRow: 4 * bitmap.width, - rowsPerImage: bitmap.height, - }, - { width: bitmap.width, height: bitmap.height } - ); - + ////////////////////////////////////////////////////////////////////////////// // Probability map generation // The 0'th mip level of texture holds the color data and spawn-probability in @@ -213,19 +221,20 @@ export const demo6 = ( ////////////////////////////////////////////////////////////////////////////// { const probabilityMapImportLevelPipeline = device.createComputePipeline({ - layout: "auto", + layout: 'auto', compute: { module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: "import_level", + entryPoint: 'import_level', }, }); const probabilityMapExportLevelPipeline = device.createComputePipeline({ - layout: "auto", + layout: 'auto', compute: { module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: "export_level", + entryPoint: 'export_level', }, }); + const probabilityMapUBOBufferSize = 1 * 4 + // stride 3 * 4 + // padding @@ -252,15 +261,9 @@ export const demo6 = ( const levelWidth = textureWidth >> level; const levelHeight = textureHeight >> level; const pipeline = - level === 0 + level == 0 ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) : probabilityMapExportLevelPipeline.getBindGroupLayout(0); - const texOut = texture.createView({ - format: "rgba8unorm", - dimension: "2d", - baseMipLevel: level, - mipLevelCount: 1, - }); const probabilityMapBindGroup = device.createBindGroup({ layout: pipeline, entries: [ @@ -282,11 +285,16 @@ export const demo6 = ( { // tex_in / tex_out binding: 3, - resource: texOut, + resource: texture.createView({ + format: 'rgba8unorm', + dimension: '2d', + baseMipLevel: level, + mipLevelCount: 1, + }), }, ], }); - if (level === 0) { + if (level == 0) { const passEncoder = commandEncoder.beginComputePass(); passEncoder.setPipeline(probabilityMapImportLevelPipeline); passEncoder.setBindGroup(0, probabilityMapBindGroup); @@ -302,15 +310,15 @@ export const demo6 = ( } device.queue.submit([commandEncoder.finish()]); } - - // ////////////////////////////////////////////////////////////////////////////// - // // Simulation compute pipeline - // ////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////////// + // Simulation compute pipeline + ////////////////////////////////////////////////////////////////////////////// const simulationParams = { simulate: true, deltaTime: 0.04, }; - + const simulationUBOBufferSize = 1 * 4 + // deltaTime 3 * 4 + // padding @@ -321,13 +329,14 @@ export const demo6 = ( usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); + const computePipeline = device.createComputePipeline({ - layout: "auto", + layout: 'auto', compute: { module: device.createShaderModule({ code: particleWGSL, }), - entryPoint: "simulate", + entryPoint: 'simulate', }, }); const computeBindGroup = device.createBindGroup({ @@ -353,12 +362,12 @@ export const demo6 = ( }, ], }); - + const aspect = canvas.width / canvas.height; const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); const view = mat4.create(); const mvp = mat4.create(); - + function frame() { device.queue.writeBuffer( simulationUBOBuffer, @@ -374,36 +383,36 @@ export const demo6 = ( 1 + Math.random(), // seed.zw ]).buffer ); - + mat4.identity(view); mat4.translate(view, vec3.fromValues(0, 0, -3), view); mat4.rotateX(view, Math.PI * -0.2, view); mat4.multiply(projection, view, mvp); - + // prettier-ignore device.queue.writeBuffer( - uniformBuffer, - 0, - new Float32Array([ - // modelViewProjectionMatrix - mvp[0], mvp[1], mvp[2], mvp[3], - mvp[4], mvp[5], mvp[6], mvp[7], - mvp[8], mvp[9], mvp[10], mvp[11], - mvp[12], mvp[13], mvp[14], mvp[15], - - view[0], view[4], view[8], // right - - 0, // padding - - view[1], view[5], view[9], // up - - 0, // padding - ]).buffer - ); + uniformBuffer, + 0, + new Float32Array([ + // modelViewProjectionMatrix + mvp[0], mvp[1], mvp[2], mvp[3], + mvp[4], mvp[5], mvp[6], mvp[7], + mvp[8], mvp[9], mvp[10], mvp[11], + mvp[12], mvp[13], mvp[14], mvp[15], + + view[0], view[4], view[8], // right + + 0, // padding + + view[1], view[5], view[9], // up + + 0, // padding + ]).buffer + ); const swapChainTexture = context.getCurrentTexture(); // prettier-ignore renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); - + const commandEncoder = device.createCommandEncoder(); { const passEncoder = commandEncoder.beginComputePass(); @@ -421,10 +430,11 @@ export const demo6 = ( passEncoder.draw(6, numParticles, 0, 0); passEncoder.end(); } - + device.queue.submit([commandEncoder.finish()]); context.present(); requestAnimationFrame(frame); } requestAnimationFrame(frame); + }; diff --git a/package/cpp/wgpu/JsiComputePipelineDescriptor.h b/package/cpp/wgpu/JsiComputePipelineDescriptor.h index b68e9c92aa..dd5cfd872e 100644 --- a/package/cpp/wgpu/JsiComputePipelineDescriptor.h +++ b/package/cpp/wgpu/JsiComputePipelineDescriptor.h @@ -45,11 +45,11 @@ class JsiComputePipelineDescriptor } else { auto object = new wgpu::ComputePipelineDescriptor(); - // if (obj.hasProperty(runtime, "layout")) { - // auto layout = obj.getProperty(runtime, "layout"); + if (obj.hasProperty(runtime, "layout")) { + auto layout = obj.getProperty(runtime, "layout"); - // object->layout = *JsiPipelineLayout::fromValue(runtime, layout); - // } + object->layout = nullptr;// *JsiPipelineLayout::fromValue(runtime, layout); + } if (obj.hasProperty(runtime, "compute")) { auto compute = obj.getProperty(runtime, "compute"); From f2e998a4aca17282f0f8eb8db08f37b7b5dc3854 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 7 May 2024 08:20:01 +0200 Subject: [PATCH 51/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- .../cpp/wgpu/JsiComputePipelineDescriptor.h | 8 +- package/cpp/wgpu/JsiQueue.h | 1 - package/cpp/wgpu/JsiRenderPassEncoder.h | 4 +- package/cpp/wgpu/JsiTexture.h | 7 +- package/cpp/wgpu/JsiTextureViewDescriptor.h | 75 +++++++++++++++++++ scripts/generator/model.ts | 28 ++++++- 7 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 package/cpp/wgpu/JsiTextureViewDescriptor.h diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index beebd75bfd..3ae411920c 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -20,7 +20,7 @@ const draw = async (context: GPUCanvasContext, image: Bitmap) => { alphaMode: "premultiplied", }); //await demo5(device, context, image); - await demo6(device, context, image); + await demo5(device, context, image); //context.present(); }; diff --git a/package/cpp/wgpu/JsiComputePipelineDescriptor.h b/package/cpp/wgpu/JsiComputePipelineDescriptor.h index dd5cfd872e..b68e9c92aa 100644 --- a/package/cpp/wgpu/JsiComputePipelineDescriptor.h +++ b/package/cpp/wgpu/JsiComputePipelineDescriptor.h @@ -45,11 +45,11 @@ class JsiComputePipelineDescriptor } else { auto object = new wgpu::ComputePipelineDescriptor(); - if (obj.hasProperty(runtime, "layout")) { - auto layout = obj.getProperty(runtime, "layout"); + // if (obj.hasProperty(runtime, "layout")) { + // auto layout = obj.getProperty(runtime, "layout"); - object->layout = nullptr;// *JsiPipelineLayout::fromValue(runtime, layout); - } + // object->layout = *JsiPipelineLayout::fromValue(runtime, layout); + // } if (obj.hasProperty(runtime, "compute")) { auto compute = obj.getProperty(runtime, "compute"); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index 6a6d814107..caf7d14b47 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -62,7 +62,6 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(writeBuffer) { - auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); diff --git a/package/cpp/wgpu/JsiRenderPassEncoder.h b/package/cpp/wgpu/JsiRenderPassEncoder.h index 2066831853..31448ee95b 100644 --- a/package/cpp/wgpu/JsiRenderPassEncoder.h +++ b/package/cpp/wgpu/JsiRenderPassEncoder.h @@ -96,9 +96,7 @@ class JsiRenderPassEncoder count > 2 ? static_cast(arguments[2].getNumber()) : 0; auto size = count > 3 ? static_cast(arguments[3].getNumber()) : buffer->GetSize(); - RNSkLogger::logToConsole( - "RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, - buffer != nullptr, offset, size); + getObject()->SetVertexBuffer(slot, *buffer, offset, size); return jsi::Value::undefined(); } diff --git a/package/cpp/wgpu/JsiTexture.h b/package/cpp/wgpu/JsiTexture.h index 3ff9c7d023..a3135d2594 100644 --- a/package/cpp/wgpu/JsiTexture.h +++ b/package/cpp/wgpu/JsiTexture.h @@ -12,6 +12,7 @@ #include "JsiPromises.h" #include "JsiSkHostObjects.h" #include "JsiTextureView.h" +#include "JsiTextureViewDescriptor.h" #include "MutableJSIBuffer.h" #include "RNSkLog.h" #include "RNSkPlatformContext.h" @@ -27,8 +28,12 @@ class JsiTexture : public JsiSkWrappingSharedPtrHostObject { context, std::make_shared(std::move(m))) {} JSI_HOST_FUNCTION(createView) { + auto defaultDescriptor = nullptr; + auto descriptor = + count > 0 ? JsiTextureViewDescriptor::fromValue(runtime, arguments[0]) + : defaultDescriptor; - auto ret = getObject()->CreateView(); + auto ret = getObject()->CreateView(descriptor); if (ret == nullptr) { throw jsi::JSError(runtime, "createView returned null"); } diff --git a/package/cpp/wgpu/JsiTextureViewDescriptor.h b/package/cpp/wgpu/JsiTextureViewDescriptor.h new file mode 100644 index 0000000000..99fc1dde3a --- /dev/null +++ b/package/cpp/wgpu/JsiTextureViewDescriptor.h @@ -0,0 +1,75 @@ +#pragma once +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +#include + +#include "JsiEnums.h" +#include "JsiHostObject.h" +#include "JsiPromises.h" +#include "JsiSkHostObjects.h" +#include "JsiTextureView.h" +#include "MutableJSIBuffer.h" +#include "RNSkLog.h" +#include "RNSkPlatformContext.h" + +namespace RNSkia { + +namespace jsi = facebook::jsi; + +class JsiTextureViewDescriptor + : public JsiSkWrappingSharedPtrHostObject { +public: + JsiTextureViewDescriptor(std::shared_ptr context, + wgpu::TextureViewDescriptor m) + : JsiSkWrappingSharedPtrHostObject( + context, + std::make_shared(std::move(m))) {} + + // TODO: this fix, use JSI_EXPORT_PROPERTY_GETTERS instead + EXPORT_JSI_API_BRANDNAME(JsiTextureViewDescriptor, TextureViewDescriptor) + + /** + * Returns the underlying object from a host object of this type + */ + static wgpu::TextureViewDescriptor *fromValue(jsi::Runtime &runtime, + const jsi::Value &raw) { + const auto &obj = raw.asObject(runtime); + if (obj.isHostObject(runtime)) { + return obj.asHostObject(runtime) + ->getObject() + .get(); + } else { + auto object = new wgpu::TextureViewDescriptor(); + + if (obj.hasProperty(runtime, "format")) { + auto format = obj.getProperty(runtime, "format"); + + object->format = + getTextureFormat(format.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "dimension")) { + auto dimension = obj.getProperty(runtime, "dimension"); + + object->dimension = getTextureViewDimension( + dimension.getString(runtime).utf8(runtime).c_str()); + } + if (obj.hasProperty(runtime, "baseMipLevel")) { + auto baseMipLevel = obj.getProperty(runtime, "baseMipLevel"); + + object->baseMipLevel = static_cast(baseMipLevel.getNumber()); + } + if (obj.hasProperty(runtime, "mipLevelCount")) { + auto mipLevelCount = obj.getProperty(runtime, "mipLevelCount"); + + object->mipLevelCount = + static_cast(mipLevelCount.getNumber()); + } + return object; + } + } +}; +} // namespace RNSkia diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index da621e4652..ac12347758 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -745,9 +745,7 @@ return object; auto buffer = JsiBuffer::fromValue(runtime, arguments[1]); auto offset = count > 2 ? static_cast(arguments[2].getNumber()) : 0; auto size = count > 3 ? static_cast(arguments[3].getNumber()) : buffer->GetSize(); - RNSkLogger::logToConsole( - "RenderPassEncoder::setVertexBuffer(%d, %p, %d, %d)", slot, - buffer != nullptr, offset, size); + getObject()->SetVertexBuffer(slot, *buffer, offset, size); return jsi::Value::undefined();` }, @@ -813,7 +811,29 @@ object->sType = wgpu::SType::ShaderModuleWGSLDescriptor;`, { name: "Texture", methods: [ - { name: "createView", args: [], returns: "TextureView"} + { name: "createView", args: [ + { name: "descriptor", type: "TextureViewDescriptor", optional: true } + ], returns: "TextureView", + implementation: ` auto defaultDescriptor = nullptr; + auto descriptor = + count > 0 ? JsiTextureViewDescriptor::fromValue(runtime, arguments[0]) + : defaultDescriptor; + + auto ret = getObject()->CreateView(descriptor); + if (ret == nullptr) { + throw jsi::JSError(runtime, "createView returned null"); + } + return jsi::Object::createFromHostObject( + runtime, std::make_shared(getContext(), ret));`} + ] + }, + { + name: "TextureViewDescriptor", + properties: [ + {"name": "format", "type": "TextureFormat" , "optional": true}, + {"name": "dimension", "type": "TextureViewDimension", "optional": true}, + {"name": "baseMipLevel", "type": "uint32_t", "optional": true}, + {"name": "mipLevelCount", "type": "uint32_t", "optional": true} ] }, { From 48d2a423e3e95413bed1043a3fab29438de5e54b Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 7 May 2024 08:42:16 +0200 Subject: [PATCH 52/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- package/cpp/wgpu/JsiGPU.h | 5 +++++ package/cpp/wgpu/JsiQueue.h | 1 + scripts/generator/model.ts | 5 +++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 3ae411920c..beebd75bfd 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -20,7 +20,7 @@ const draw = async (context: GPUCanvasContext, image: Bitmap) => { alphaMode: "premultiplied", }); //await demo5(device, context, image); - await demo5(device, context, image); + await demo6(device, context, image); //context.present(); }; diff --git a/package/cpp/wgpu/JsiGPU.h b/package/cpp/wgpu/JsiGPU.h index ba049ccecb..17392f8b46 100644 --- a/package/cpp/wgpu/JsiGPU.h +++ b/package/cpp/wgpu/JsiGPU.h @@ -57,6 +57,11 @@ class JsiGPU : public JsiSkWrappingSharedPtrHostObject { if (adapter == nullptr) { promise->resolve(jsi::Value::null()); } else { + device.SetUncapturedErrorCallback( + [](WGPUErrorType type, const char *message, void *userdata) { + RNSkLogger::logToConsole("Error: %s", message); + }, + nullptr); promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), std::move(adapter)))); diff --git a/package/cpp/wgpu/JsiQueue.h b/package/cpp/wgpu/JsiQueue.h index caf7d14b47..6a6d814107 100644 --- a/package/cpp/wgpu/JsiQueue.h +++ b/package/cpp/wgpu/JsiQueue.h @@ -62,6 +62,7 @@ class JsiQueue : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(writeBuffer) { + auto buffer = JsiBuffer::fromValue(runtime, arguments[0]); auto offset = static_cast(arguments[1].getNumber()); auto data = arguments[2].getObject(runtime).getArrayBuffer(runtime); diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index ac12347758..49a9735189 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -74,6 +74,11 @@ export const model: JSIObject[] = [ if (adapter == nullptr) { promise->resolve(jsi::Value::null()); } else { + device.SetUncapturedErrorCallback( + [](WGPUErrorType type, const char *message, void *userdata) { + RNSkLogger::logToConsole("Error: %s", message); + }, + nullptr); promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), std::move(adapter)))); From 62c36cbf2ce87577976fd49a2a914d9153d3300d Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 7 May 2024 10:12:56 +0200 Subject: [PATCH 53/63] :wrench: --- example/src/Examples/Breathe/demo1/main.ts | 10 +++++----- example/src/Examples/Breathe/demo6/main.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/main.ts b/example/src/Examples/Breathe/demo1/main.ts index 112c238b3a..1bbae5a160 100644 --- a/example/src/Examples/Breathe/demo1/main.ts +++ b/example/src/Examples/Breathe/demo1/main.ts @@ -73,11 +73,11 @@ export const demo1 = async (device: GPUDevice, context: GPUCanvasContext) => { }, }); - const depthTexture = device.createTexture({ - size: { width, height }, - format: "depth24plus", - usage: GPUTextureUsage.RENDER_ATTACHMENT, - }); + // const depthTexture = device.createTexture({ + // size: { width, height }, + // format: "depth24plus", + // usage: GPUTextureUsage.RENDER_ATTACHMENT, + // }); const uniformBufferSize = 4 * 16; // 4x4 matrix const uniformBuffer = device.createBuffer({ diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index cd843203c1..ec2961a1ef 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -433,7 +433,7 @@ export const demo6 = ( device.queue.submit([commandEncoder.finish()]); context.present(); - requestAnimationFrame(frame); + // requestAnimationFrame(frame); } requestAnimationFrame(frame); From 6ca8b9472550988bab9913b233eb8998cb0ef1ba Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 7 May 2024 11:08:45 +0200 Subject: [PATCH 54/63] :wrenchj: --- example/src/Examples/Breathe/demo6/main.ts | 1 + package/cpp/wgpu/JsiAdapter.h | 5 +++++ package/cpp/wgpu/JsiGPU.h | 5 ----- scripts/generator/model.ts | 10 +++++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index ec2961a1ef..0d3345e4a2 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -264,6 +264,7 @@ export const demo6 = ( level == 0 ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) : probabilityMapExportLevelPipeline.getBindGroupLayout(0); + console.log({ level }); const probabilityMapBindGroup = device.createBindGroup({ layout: pipeline, entries: [ diff --git a/package/cpp/wgpu/JsiAdapter.h b/package/cpp/wgpu/JsiAdapter.h index 240149e7d6..75ea668ec6 100644 --- a/package/cpp/wgpu/JsiAdapter.h +++ b/package/cpp/wgpu/JsiAdapter.h @@ -57,6 +57,11 @@ class JsiAdapter : public JsiSkWrappingSharedPtrHostObject { if (device == nullptr) { promise->resolve(jsi::Value::null()); } else { + device.SetUncapturedErrorCallback( + [](WGPUErrorType type, const char *message, void *userdata) { + RNSkLogger::logToConsole("Error: %s", message); + }, + nullptr); promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), std::move(device)))); diff --git a/package/cpp/wgpu/JsiGPU.h b/package/cpp/wgpu/JsiGPU.h index 17392f8b46..ba049ccecb 100644 --- a/package/cpp/wgpu/JsiGPU.h +++ b/package/cpp/wgpu/JsiGPU.h @@ -57,11 +57,6 @@ class JsiGPU : public JsiSkWrappingSharedPtrHostObject { if (adapter == nullptr) { promise->resolve(jsi::Value::null()); } else { - device.SetUncapturedErrorCallback( - [](WGPUErrorType type, const char *message, void *userdata) { - RNSkLogger::logToConsole("Error: %s", message); - }, - nullptr); promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), std::move(adapter)))); diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 49a9735189..4c5866c3a1 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -74,11 +74,6 @@ export const model: JSIObject[] = [ if (adapter == nullptr) { promise->resolve(jsi::Value::null()); } else { - device.SetUncapturedErrorCallback( - [](WGPUErrorType type, const char *message, void *userdata) { - RNSkLogger::logToConsole("Error: %s", message); - }, - nullptr); promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), std::move(adapter)))); @@ -136,6 +131,11 @@ export const model: JSIObject[] = [ if (device == nullptr) { promise->resolve(jsi::Value::null()); } else { + device.SetUncapturedErrorCallback( + [](WGPUErrorType type, const char *message, void *userdata) { + RNSkLogger::logToConsole("Error: %s", message); + }, + nullptr); promise->resolve(jsi::Object::createFromHostObject( runtime, std::make_shared(std::move(context), std::move(device)))); From 38a7dc7c0f20aa75089baa543df36e8d01efdf14 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 7 May 2024 11:18:33 +0200 Subject: [PATCH 55/63] :wrench: --- example/src/Examples/Breathe/demo6/main.ts | 793 +++++++++++---------- 1 file changed, 398 insertions(+), 395 deletions(-) diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index 0d3345e4a2..b3fc9c4090 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -17,425 +17,428 @@ export const demo6 = ( imageBitmap: Bitmap ) => { +const numParticles = 50000; +const particlePositionOffset = 0; +const particleColorOffset = 4 * 4; +const particleInstanceByteSize = + 3 * 4 + // position + 1 * 4 + // lifetime + 4 * 4 + // color + 3 * 4 + // velocity + 1 * 4 + // padding + 0; - const numParticles = 50000; - const particlePositionOffset = 0; - const particleColorOffset = 4 * 4; - const particleInstanceByteSize = - 3 * 4 + // position - 1 * 4 + // lifetime - 4 * 4 + // color - 3 * 4 + // velocity - 1 * 4 + // padding - 0; - - const particlesBuffer = device.createBuffer({ - size: numParticles * particleInstanceByteSize, - usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, - }); - - const renderPipeline = device.createRenderPipeline({ - layout: 'auto', - vertex: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: "vs_main", - buffers: [ - { - // instanced particles buffer - arrayStride: particleInstanceByteSize, - stepMode: 'instance', - attributes: [ - { - // position - shaderLocation: 0, - offset: particlePositionOffset, - format: 'float32x3', - }, - { - // color - shaderLocation: 1, - offset: particleColorOffset, - format: 'float32x4', - }, - ], - }, - { - // quad vertex buffer - arrayStride: 2 * 4, // vec2f - stepMode: 'vertex', - attributes: [ - { - // vertex positions - shaderLocation: 2, - offset: 0, - format: 'float32x2', - }, - ], - }, - ], - }, - fragment: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: "fs_main", - targets: [ - { - format: presentationFormat, - blend: { - color: { - srcFactor: 'src-alpha', - dstFactor: 'one', - operation: 'add', - }, - alpha: { - srcFactor: 'zero', - dstFactor: 'one', - operation: 'add', - }, - }, - }, - ], - }, - primitive: { - topology: 'triangle-list', - }, - - // depthStencil: { - // depthWriteEnabled: false, - // depthCompare: 'less', - // format: 'depth24plus', - // }, - }); - - // const depthTexture = device.createTexture({ - // size: { width: canvas.width, height: canvas.height }, - // format: 'depth24plus', - // usage: GPUTextureUsage.RENDER_ATTACHMENT, - // }); - - const uniformBufferSize = - 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f - 3 * 4 + // right : vec3f - 4 + // padding - 3 * 4 + // up : vec3f - 4 + // padding - 0; - const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - }); - - const uniformBindGroup = device.createBindGroup({ - layout: renderPipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: uniformBuffer, - }, - }, - ], - }); - - const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: undefined, // Assigned later - clearValue: [0, 0, 0, 1], - loadOp: 'clear', - storeOp: 'store', - }, - ], - // depthStencilAttachment: { - // view: depthTexture.createView(), - - // depthClearValue: 1.0, - // depthLoadOp: 'clear', - // depthStoreOp: 'store', - // }, - }; - - ////////////////////////////////////////////////////////////////////////////// - // Quad vertex buffer - ////////////////////////////////////////////////////////////////////////////// - const quadVertexBuffer = device.createBuffer({ - size: 6 * 2 * 4, // 6x vec2f - usage: GPUBufferUsage.VERTEX, - mappedAtCreation: true, - }); - // prettier-ignore - const vertexData = [ - -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, - ]; - new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); - quadVertexBuffer.unmap(); - - ////////////////////////////////////////////////////////////////////////////// - // Texture - ////////////////////////////////////////////////////////////////////////////// - let texture: GPUTexture; - let textureWidth = 1; - let textureHeight = 1; - let numMipLevels = 1; - { - // Calculate number of mip levels required to generate the probability map - while ( - textureWidth < imageBitmap.width || - textureHeight < imageBitmap.height - ) { - textureWidth *= 2; - textureHeight *= 2; - numMipLevels++; - } - texture = device.createTexture({ - size: { width: imageBitmap.width, height: imageBitmap.height }, - mipLevelCount: numMipLevels, - format: 'rgba8unorm', - usage: - GPUTextureUsage.TEXTURE_BINDING | - GPUTextureUsage.STORAGE_BINDING | - GPUTextureUsage.COPY_DST | - GPUTextureUsage.RENDER_ATTACHMENT, - }); - device.queue.writeTexture( - { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, - imageBitmap.data.buffer, +context.configure({ + device, + format: presentationFormat, + alphaMode: 'premultiplied', +}); + +const particlesBuffer = device.createBuffer({ + size: numParticles * particleInstanceByteSize, + usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, +}); + +const renderPipeline = device.createRenderPipeline({ + layout: 'auto', + vertex: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "vs_main", + buffers: [ { - offset: 0, - bytesPerRow: 4 * imageBitmap.width, - rowsPerImage: imageBitmap.height, - }, - { width: imageBitmap.width, height: imageBitmap.height } - ); - } - - ////////////////////////////////////////////////////////////////////////////// - // Probability map generation - // The 0'th mip level of texture holds the color data and spawn-probability in - // the alpha channel. The mip levels 1..N are generated to hold spawn - // probabilities up to the top 1x1 mip level. - ////////////////////////////////////////////////////////////////////////////// - { - const probabilityMapImportLevelPipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: 'import_level', - }, - }); - const probabilityMapExportLevelPipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: 'export_level', - }, - }); - - const probabilityMapUBOBufferSize = - 1 * 4 + // stride - 3 * 4 + // padding - 0; - const probabilityMapUBOBuffer = device.createBuffer({ - size: probabilityMapUBOBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - }); - const buffer_a = device.createBuffer({ - size: textureWidth * textureHeight * 4, - usage: GPUBufferUsage.STORAGE, - }); - const buffer_b = device.createBuffer({ - size: textureWidth * textureHeight * 4, - usage: GPUBufferUsage.STORAGE, - }); - device.queue.writeBuffer( - probabilityMapUBOBuffer, - 0, - new Int32Array([textureWidth]).buffer - ); - const commandEncoder = device.createCommandEncoder(); - for (let level = 0; level < numMipLevels; level++) { - const levelWidth = textureWidth >> level; - const levelHeight = textureHeight >> level; - const pipeline = - level == 0 - ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) - : probabilityMapExportLevelPipeline.getBindGroupLayout(0); - console.log({ level }); - const probabilityMapBindGroup = device.createBindGroup({ - layout: pipeline, - entries: [ + // instanced particles buffer + arrayStride: particleInstanceByteSize, + stepMode: 'instance', + attributes: [ { - // ubo - binding: 0, - resource: { buffer: probabilityMapUBOBuffer }, + // position + shaderLocation: 0, + offset: particlePositionOffset, + format: 'float32x3', }, { - // buf_in - binding: 1, - resource: { buffer: level & 1 ? buffer_a : buffer_b }, - }, - { - // buf_out - binding: 2, - resource: { buffer: level & 1 ? buffer_b : buffer_a }, + // color + shaderLocation: 1, + offset: particleColorOffset, + format: 'float32x4', }, + ], + }, + { + // quad vertex buffer + arrayStride: 2 * 4, // vec2f + stepMode: 'vertex', + attributes: [ { - // tex_in / tex_out - binding: 3, - resource: texture.createView({ - format: 'rgba8unorm', - dimension: '2d', - baseMipLevel: level, - mipLevelCount: 1, - }), + // vertex positions + shaderLocation: 2, + offset: 0, + format: 'float32x2', }, ], - }); - if (level == 0) { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(probabilityMapImportLevelPipeline); - passEncoder.setBindGroup(0, probabilityMapBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); - passEncoder.end(); - } else { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(probabilityMapExportLevelPipeline); - passEncoder.setBindGroup(0, probabilityMapBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); - passEncoder.end(); - } - } - device.queue.submit([commandEncoder.finish()]); + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "fs_main", + targets: [ + { + format: presentationFormat, + blend: { + color: { + srcFactor: 'src-alpha', + dstFactor: 'one', + operation: 'add', + }, + alpha: { + srcFactor: 'zero', + dstFactor: 'one', + operation: 'add', + }, + }, + }, + ], + }, + primitive: { + topology: 'triangle-list', + }, + + // depthStencil: { + // depthWriteEnabled: false, + // depthCompare: 'less', + // format: 'depth24plus', + // }, +}); + +// const depthTexture = device.createTexture({ +// size: [canvas.width, canvas.height], +// format: 'depth24plus', +// usage: GPUTextureUsage.RENDER_ATTACHMENT, +// }); + +const uniformBufferSize = + 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f + 3 * 4 + // right : vec3f + 4 + // padding + 3 * 4 + // up : vec3f + 4 + // padding + 0; +const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, +}); + +const uniformBindGroup = device.createBindGroup({ + layout: renderPipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: uniformBuffer, + }, + }, + ], +}); + +const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + clearValue: [0, 0, 0, 1], + loadOp: 'clear', + storeOp: 'store', + }, + ], + // depthStencilAttachment: { + // view: depthTexture.createView(), + + // depthClearValue: 1.0, + // depthLoadOp: 'clear', + // depthStoreOp: 'store', + // }, +}; + +////////////////////////////////////////////////////////////////////////////// +// Quad vertex buffer +////////////////////////////////////////////////////////////////////////////// +const quadVertexBuffer = device.createBuffer({ + size: 6 * 2 * 4, // 6x vec2f + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true, +}); +// prettier-ignore +const vertexData = [ + -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, +]; +new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); +quadVertexBuffer.unmap(); + +////////////////////////////////////////////////////////////////////////////// +// Texture +////////////////////////////////////////////////////////////////////////////// +let texture: GPUTexture; +let textureWidth = 1; +let textureHeight = 1; +let numMipLevels = 1; +{ + // Calculate number of mip levels required to generate the probability map + while ( + textureWidth < imageBitmap.width || + textureHeight < imageBitmap.height + ) { + textureWidth *= 2; + textureHeight *= 2; + numMipLevels++; } - - ////////////////////////////////////////////////////////////////////////////// - // Simulation compute pipeline - ////////////////////////////////////////////////////////////////////////////// - const simulationParams = { - simulate: true, - deltaTime: 0.04, - }; - - const simulationUBOBufferSize = - 1 * 4 + // deltaTime - 3 * 4 + // padding - 4 * 4 + // seed - 0; - const simulationUBOBuffer = device.createBuffer({ - size: simulationUBOBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + texture = device.createTexture({ + size: { width: imageBitmap.width, height: imageBitmap.height }, + mipLevelCount: numMipLevels, + format: 'rgba8unorm', + usage: + GPUTextureUsage.TEXTURE_BINDING | + GPUTextureUsage.STORAGE_BINDING | + GPUTextureUsage.COPY_DST | + GPUTextureUsage.RENDER_ATTACHMENT, }); + device.queue.writeTexture( + { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, + imageBitmap.data.buffer, + { + offset: 0, + bytesPerRow: 4 * imageBitmap.width, + rowsPerImage: imageBitmap.height, + }, + { width: imageBitmap.width, height: imageBitmap.height } + ); +} - - const computePipeline = device.createComputePipeline({ +////////////////////////////////////////////////////////////////////////////// +// Probability map generation +// The 0'th mip level of texture holds the color data and spawn-probability in +// the alpha channel. The mip levels 1..N are generated to hold spawn +// probabilities up to the top 1x1 mip level. +////////////////////////////////////////////////////////////////////////////// +{ + const probabilityMapImportLevelPipeline = device.createComputePipeline({ layout: 'auto', compute: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: 'simulate', + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: 'import_level', }, }); - const computeBindGroup = device.createBindGroup({ - layout: computePipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: simulationUBOBuffer, + const probabilityMapExportLevelPipeline = device.createComputePipeline({ + layout: 'auto', + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: 'export_level', + }, + }); + + const probabilityMapUBOBufferSize = + 1 * 4 + // stride + 3 * 4 + // padding + 0; + const probabilityMapUBOBuffer = device.createBuffer({ + size: probabilityMapUBOBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); + const buffer_a = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + const buffer_b = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + device.queue.writeBuffer( + probabilityMapUBOBuffer, + 0, + new Int32Array([textureWidth]).buffer + ); + const commandEncoder = device.createCommandEncoder(); + for (let level = 0; level < numMipLevels; level++) { + const levelWidth = textureWidth >> level; + const levelHeight = textureHeight >> level; + const pipeline = + level == 0 + ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) + : probabilityMapExportLevelPipeline.getBindGroupLayout(0); + const probabilityMapBindGroup = device.createBindGroup({ + layout: pipeline, + entries: [ + { + // ubo + binding: 0, + resource: { buffer: probabilityMapUBOBuffer }, }, - }, - { - binding: 1, - resource: { - buffer: particlesBuffer, - offset: 0, - size: numParticles * particleInstanceByteSize, + { + // buf_in + binding: 1, + resource: { buffer: level & 1 ? buffer_a : buffer_b }, }, - }, - { - binding: 2, - resource: texture.createView(), - }, - ], - }); - - const aspect = canvas.width / canvas.height; - const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); - const view = mat4.create(); - const mvp = mat4.create(); - - function frame() { - device.queue.writeBuffer( - simulationUBOBuffer, - 0, - new Float32Array([ - simulationParams.simulate ? simulationParams.deltaTime : 0.0, - 0.0, - 0.0, - 0.0, // padding - Math.random() * 100, - Math.random() * 100, // seed.xy - 1 + Math.random(), - 1 + Math.random(), // seed.zw - ]).buffer - ); - - mat4.identity(view); - mat4.translate(view, vec3.fromValues(0, 0, -3), view); - mat4.rotateX(view, Math.PI * -0.2, view); - mat4.multiply(projection, view, mvp); - - // prettier-ignore - device.queue.writeBuffer( - uniformBuffer, - 0, - new Float32Array([ - // modelViewProjectionMatrix - mvp[0], mvp[1], mvp[2], mvp[3], - mvp[4], mvp[5], mvp[6], mvp[7], - mvp[8], mvp[9], mvp[10], mvp[11], - mvp[12], mvp[13], mvp[14], mvp[15], - - view[0], view[4], view[8], // right - - 0, // padding - - view[1], view[5], view[9], // up - - 0, // padding - ]).buffer - ); - const swapChainTexture = context.getCurrentTexture(); - // prettier-ignore - renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); - - const commandEncoder = device.createCommandEncoder(); - { + { + // buf_out + binding: 2, + resource: { buffer: level & 1 ? buffer_b : buffer_a }, + }, + { + // tex_in / tex_out + binding: 3, + resource: texture.createView({ + format: 'rgba8unorm', + dimension: '2d', + baseMipLevel: level, + mipLevelCount: 1, + }), + }, + ], + }); + if (level == 0) { const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(computePipeline); - passEncoder.setBindGroup(0, computeBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); + passEncoder.setPipeline(probabilityMapImportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); passEncoder.end(); - } - { - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(renderPipeline); - passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, particlesBuffer); - passEncoder.setVertexBuffer(1, quadVertexBuffer); - passEncoder.draw(6, numParticles, 0, 0); + } else { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapExportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); passEncoder.end(); } - - device.queue.submit([commandEncoder.finish()]); - context.present(); - // requestAnimationFrame(frame); } + device.queue.submit([commandEncoder.finish()]); +} + +////////////////////////////////////////////////////////////////////////////// +// Simulation compute pipeline +////////////////////////////////////////////////////////////////////////////// +const simulationParams = { + simulate: true, + deltaTime: 0.04, +}; + +const simulationUBOBufferSize = + 1 * 4 + // deltaTime + 3 * 4 + // padding + 4 * 4 + // seed + 0; +const simulationUBOBuffer = device.createBuffer({ + size: simulationUBOBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, +}); + +const computePipeline = device.createComputePipeline({ + layout: 'auto', + compute: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: 'simulate', + }, +}); +const computeBindGroup = device.createBindGroup({ + layout: computePipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: simulationUBOBuffer, + }, + }, + { + binding: 1, + resource: { + buffer: particlesBuffer, + offset: 0, + size: numParticles * particleInstanceByteSize, + }, + }, + { + binding: 2, + resource: texture.createView(), + }, + ], +}); + +const aspect = canvas.width / canvas.height; +const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); +const view = mat4.create(); +const mvp = mat4.create(); + +function frame() { + device.queue.writeBuffer( + simulationUBOBuffer, + 0, + new Float32Array([ + simulationParams.simulate ? simulationParams.deltaTime : 0.0, + 0.0, + 0.0, + 0.0, // padding + Math.random() * 100, + Math.random() * 100, // seed.xy + 1 + Math.random(), + 1 + Math.random(), // seed.zw + ]).buffer + ); + + mat4.identity(view); + mat4.translate(view, vec3.fromValues(0, 0, -3), view); + mat4.rotateX(view, Math.PI, view); + mat4.multiply(projection, view, mvp); + + // prettier-ignore + device.queue.writeBuffer( + uniformBuffer, + 0, + new Float32Array([ + // modelViewProjectionMatrix + mvp[0], mvp[1], mvp[2], mvp[3], + mvp[4], mvp[5], mvp[6], mvp[7], + mvp[8], mvp[9], mvp[10], mvp[11], + mvp[12], mvp[13], mvp[14], mvp[15], + + view[0], view[4], view[8], // right + + 0, // padding + + view[1], view[5], view[9], // up + + 0, // padding + ]).buffer + ); + const swapChainTexture = context.getCurrentTexture(); + // prettier-ignore + renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); + + const commandEncoder = device.createCommandEncoder(); + { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(computePipeline); + passEncoder.setBindGroup(0, computeBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); + passEncoder.end(); + } + { + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(renderPipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, particlesBuffer); + passEncoder.setVertexBuffer(1, quadVertexBuffer); + passEncoder.draw(6, numParticles, 0, 0); + passEncoder.end(); + } + + device.queue.submit([commandEncoder.finish()]); + context.present(); requestAnimationFrame(frame); +} +requestAnimationFrame(frame); }; From f299e9b67cd2fe2c9f1909f7336835f9912df7b4 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 7 May 2024 11:25:40 +0200 Subject: [PATCH 56/63] :wrench: --- package/cpp/wgpu/JsiTextureDescriptor.h | 10 ++++++++++ scripts/generator/model.ts | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package/cpp/wgpu/JsiTextureDescriptor.h b/package/cpp/wgpu/JsiTextureDescriptor.h index 8bd9c3c72a..b4541b838f 100644 --- a/package/cpp/wgpu/JsiTextureDescriptor.h +++ b/package/cpp/wgpu/JsiTextureDescriptor.h @@ -68,6 +68,16 @@ class JsiTextureDescriptor throw jsi::JSError(runtime, "Missing mandatory prop usage in TextureDescriptor"); } + if (obj.hasProperty(runtime, "mipLevelCount")) { + auto mipLevelCount = obj.getProperty(runtime, "mipLevelCount"); + + object->mipLevelCount = + static_cast(mipLevelCount.getNumber()); + } else { + throw jsi::JSError( + runtime, + "Missing mandatory prop mipLevelCount in TextureDescriptor"); + } return object; } } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 4c5866c3a1..2b04cd14a7 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -388,7 +388,8 @@ return object; properties: [ { name: "size", type: "Extent3D" }, { name: "format", type: "TextureFormat" }, - { name: "usage", type: "TextureUsage" } + { name: "usage", type: "TextureUsage" }, + { name: "mipLevelCount", type: "uint32_t" } ] }, { From c8c1f24f28197ae60ee01f39576dfa83b28f3cb4 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 14 May 2024 13:58:05 +0200 Subject: [PATCH 57/63] :wrench: --- example/src/App.tsx | 8 +- example/src/Examples/Breathe/Breathe.tsx | 8 +- example/src/Examples/Breathe/demo1/demo5.ts | 373 +++++----- example/src/Examples/Breathe/demo1/demo7.ts | 75 +- example/src/Examples/Breathe/demo6/main.ts | 741 +++++++++---------- example/src/Examples/Breathe/demo6/react.png | Bin 0 -> 20214 bytes example/src/Examples/Breathe/demo6/test.png | Bin 0 -> 89351 bytes 7 files changed, 611 insertions(+), 594 deletions(-) create mode 100644 example/src/Examples/Breathe/demo6/react.png create mode 100644 example/src/Examples/Breathe/demo6/test.png diff --git a/example/src/App.tsx b/example/src/App.tsx index 9635e09778..416a0d252b 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -123,7 +123,13 @@ const App = () => { }} /> - + null, + }} + /> diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index beebd75bfd..21b4db5fb5 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -29,11 +29,15 @@ const usePixels = (mod: number) => { if (!image) { return null; } - return new Bitmap(image.readPixels() as Uint8Array, image.width(), image.height()); + return new Bitmap( + image.readPixels() as Uint8Array, + image.width(), + image.height() + ); }; export const Breathe = () => { - const image = usePixels(require("./demo6/webgpu.png")); + const image = usePixels(require("./demo6/react.png")); const ref = useRef(null); useEffect(() => { setTimeout(() => { diff --git a/example/src/Examples/Breathe/demo1/demo5.ts b/example/src/Examples/Breathe/demo1/demo5.ts index 3907d027d4..36d66bc2bc 100644 --- a/example/src/Examples/Breathe/demo1/demo5.ts +++ b/example/src/Examples/Breathe/demo1/demo5.ts @@ -13,207 +13,210 @@ import { instancedVertWGSL, vertexPositionColorWGSL } from "./shaders"; const { width, height } = Dimensions.get("window"); export const demo5 = async (device: GPUDevice, context: GPUCanvasContext) => { - -// Create a vertex buffer from the cube data. -const verticesBuffer = device.createBuffer({ - size: cubeVertexArray.byteLength, - usage: GPUBufferUsage.VERTEX, - mappedAtCreation: true, -}); -new Float32Array(verticesBuffer.getMappedRange()).set(cubeVertexArray); -verticesBuffer.unmap(); - -const pipeline = device.createRenderPipeline({ - layout: 'auto', - vertex: { - module: device.createShaderModule({ - code: instancedVertWGSL, - }), - entryPoint: "main", - buffers: [ - { - arrayStride: cubeVertexSize, - attributes: [ - { - // position - shaderLocation: 0, - offset: cubePositionOffset, - format: 'float32x4', - }, - { - // uv - shaderLocation: 1, - offset: cubeUVOffset, - format: 'float32x2', - }, - ], - }, - ], - }, - fragment: { - module: device.createShaderModule({ - code: vertexPositionColorWGSL, - }), - entryPoint: "main", - targets: [ + // Create a vertex buffer from the cube data. + const verticesBuffer = device.createBuffer({ + size: cubeVertexArray.byteLength, + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true, + }); + new Float32Array(verticesBuffer.getMappedRange()).set(cubeVertexArray); + verticesBuffer.unmap(); + + const pipeline = device.createRenderPipeline({ + layout: "auto", + vertex: { + module: device.createShaderModule({ + code: instancedVertWGSL, + }), + entryPoint: "main", + buffers: [ + { + arrayStride: cubeVertexSize, + attributes: [ + { + // position + shaderLocation: 0, + offset: cubePositionOffset, + format: "float32x4", + }, + { + // uv + shaderLocation: 1, + offset: cubeUVOffset, + format: "float32x2", + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: vertexPositionColorWGSL, + }), + entryPoint: "main", + targets: [ + { + format: "rgba8unorm", + }, + ], + }, + primitive: { + topology: "triangle-list", + + // Backface culling since the cube is solid piece of geometry. + // Faces pointing away from the camera will be occluded by faces + // pointing toward the camera. + cullMode: "back", + }, + + // Enable depth testing so that the fragment closest to the camera + // is rendered in front. + // depthStencil: { + // depthWriteEnabled: true, + // depthCompare: 'less', + // format: 'depth24plus', + // }, + }); + + // const depthTexture = device.createTexture({ + // size: { width, height }, + // format: 'depth24plus', + // usage: GPUTextureUsage.RENDER_ATTACHMENT, + // }); + + const xCount = 4; + const yCount = 4; + const numInstances = xCount * yCount; + const matrixFloatCount = 16; // 4x4 matrix + const matrixSize = 4 * matrixFloatCount; + const uniformBufferSize = numInstances * matrixSize; + + // Allocate a buffer large enough to hold transforms for every + // instance. + const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); + + const uniformBindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ { - format: 'rgba8unorm', + binding: 0, + resource: { + buffer: uniformBuffer, + }, }, ], - }, - primitive: { - topology: 'triangle-list', - - // Backface culling since the cube is solid piece of geometry. - // Faces pointing away from the camera will be occluded by faces - // pointing toward the camera. - cullMode: 'back', - }, - - // Enable depth testing so that the fragment closest to the camera - // is rendered in front. - // depthStencil: { - // depthWriteEnabled: true, - // depthCompare: 'less', - // format: 'depth24plus', - // }, -}); - -// const depthTexture = device.createTexture({ -// size: { width, height }, -// format: 'depth24plus', -// usage: GPUTextureUsage.RENDER_ATTACHMENT, -// }); - -const xCount = 4; -const yCount = 4; -const numInstances = xCount * yCount; -const matrixFloatCount = 16; // 4x4 matrix -const matrixSize = 4 * matrixFloatCount; -const uniformBufferSize = numInstances * matrixSize; - -// Allocate a buffer large enough to hold transforms for every -// instance. -const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, -}); - -const uniformBindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: uniformBuffer, - }, - }, - ], -}); - -const aspect = (width / height); -const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); - -type Mat4 = mat4.default; -const modelMatrices = new Array(numInstances); -const mvpMatricesData = new Float32Array(matrixFloatCount * numInstances); - -const step = 4.0; - -// Initialize the matrix data for every instance. -let m = 0; -for (let x = 0; x < xCount; x++) { - for (let y = 0; y < yCount; y++) { - modelMatrices[m] = mat4.translation( - vec3.fromValues( - step * (x - xCount / 2 + 0.5), - step * (y - yCount / 2 + 0.5), - 0 - ) - ); - m++; - } -} - -const viewMatrix = mat4.translation(vec3.fromValues(0, 0, -12)); + }); + + const aspect = width / height; + const projectionMatrix = mat4.perspective( + (2 * Math.PI) / 5, + aspect, + 1, + 100.0 + ); -const tmpMat4 = mat4.create(); + type Mat4 = mat4.default; + const modelMatrices = new Array(numInstances); + const mvpMatricesData = new Float32Array(matrixFloatCount * numInstances); -// Update the transformation matrix data for each instance. -function updateTransformationMatrix() { - const now = Date.now() / 1000; + const step = 4.0; - let m = 0, - i = 0; + // Initialize the matrix data for every instance. + let m = 0; for (let x = 0; x < xCount; x++) { for (let y = 0; y < yCount; y++) { - mat4.rotate( - modelMatrices[i], + modelMatrices[m] = mat4.translation( vec3.fromValues( - Math.sin((x + 0.5) * now), - Math.cos((y + 0.5) * now), + step * (x - xCount / 2 + 0.5), + step * (y - yCount / 2 + 0.5), 0 - ), - 1, - tmpMat4 + ) ); - - mat4.multiply(viewMatrix, tmpMat4, tmpMat4); - mat4.multiply(projectionMatrix, tmpMat4, tmpMat4); - - mvpMatricesData.set(tmpMat4, m); - - i++; - m += matrixFloatCount; + m++; } } -} -const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: undefined, // Assigned later + const viewMatrix = mat4.translation(vec3.fromValues(0, 0, -12)); + + const tmpMat4 = mat4.create(); + + // Update the transformation matrix data for each instance. + function updateTransformationMatrix() { + const now = Date.now() / 1000; + + let m = 0, + i = 0; + for (let x = 0; x < xCount; x++) { + for (let y = 0; y < yCount; y++) { + mat4.rotate( + modelMatrices[i], + vec3.fromValues( + Math.sin((x + 0.5) * now), + Math.cos((y + 0.5) * now), + 0 + ), + 1, + tmpMat4 + ); + + mat4.multiply(viewMatrix, tmpMat4, tmpMat4); + mat4.multiply(projectionMatrix, tmpMat4, tmpMat4); + + mvpMatricesData.set(tmpMat4, m); + + i++; + m += matrixFloatCount; + } + } + } - clearValue: [0.5, 0.5, 0.5, 1.0], - loadOp: 'clear', - storeOp: 'store', - }, - ], - // depthStencilAttachment: { - // view: depthTexture.createView(), - - // depthClearValue: 1.0, - // depthLoadOp: 'clear', - // depthStoreOp: 'store', - // }, -}; + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later -function frame() { - // Update the matrix data. - updateTransformationMatrix(); - device.queue.writeBuffer( - uniformBuffer, - 0, - mvpMatricesData.buffer, - mvpMatricesData.byteOffset, - mvpMatricesData.byteLength - ); + clearValue: [0.5, 0.5, 0.5, 1.0], + loadOp: "clear", + storeOp: "store", + }, + ], + // depthStencilAttachment: { + // view: depthTexture.createView(), + + // depthClearValue: 1.0, + // depthLoadOp: 'clear', + // depthStoreOp: 'store', + // }, + }; + + function frame() { + // Update the matrix data. + updateTransformationMatrix(); + device.queue.writeBuffer( + uniformBuffer, + 0, + mvpMatricesData.buffer, + mvpMatricesData.byteOffset, + mvpMatricesData.byteLength + ); - renderPassDescriptor.colorAttachments[0].view = context - .getCurrentTexture() - .createView(); - - const commandEncoder = device.createCommandEncoder(); - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(pipeline); - passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, verticesBuffer); - passEncoder.draw(cubeVertexCount, numInstances, 0, 0); - passEncoder.end(); - device.queue.submit([commandEncoder.finish()]); - context.present(); + renderPassDescriptor.colorAttachments[0].view = context + .getCurrentTexture() + .createView(); + + const commandEncoder = device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, verticesBuffer); + passEncoder.draw(cubeVertexCount, numInstances, 0, 0); + passEncoder.end(); + device.queue.submit([commandEncoder.finish()]); + context.present(); + requestAnimationFrame(frame); + } requestAnimationFrame(frame); -} -requestAnimationFrame(frame); - }; diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index eecf46a756..ad6d643bc9 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -3,38 +3,48 @@ import { Dimensions } from "react-native"; const { width, height } = Dimensions.get("window"); export class Bitmap { - constructor(public data: Uint8Array, public width: number, public height: number) { + constructor( + public data: Uint8Array, + public width: number, + public height: number + ) { this.flipYAxis(); } flipYAxis(): void { const rowLength = this.width * 4; // 4 bytes per pixel (RGBA8) const tempRow = new Uint8Array(rowLength); - + for (let y = 0; y < this.height / 2; y++) { const topRowIndex = y * rowLength; const bottomRowIndex = (this.height - y - 1) * rowLength; // Swap rows tempRow.set(this.data.subarray(topRowIndex, topRowIndex + rowLength)); - this.data.copyWithin(topRowIndex, bottomRowIndex, bottomRowIndex + rowLength); + this.data.copyWithin( + topRowIndex, + bottomRowIndex, + bottomRowIndex + rowLength + ); this.data.set(tempRow, bottomRowIndex); } } } -export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: Bitmap) => { - - const presentationFormat = 'rgba8unorm'; - +export const demo7 = async ( + device: GPUDevice, + context: GPUCanvasContext, + img: Bitmap +) => { + const presentationFormat = "rgba8unorm"; context.configure({ device, format: presentationFormat, - alphaMode: 'premultiplied', + alphaMode: "premultiplied", }); const module = device.createShaderModule({ - label: 'our hardcoded textured quad shaders', + label: "our hardcoded textured quad shaders", code: ` struct OurVertexShaderOutput { @builtin(position) position: vec4f, @@ -75,16 +85,16 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B }); const pipeline = device.createRenderPipeline({ - label: 'hardcoded textured quad pipeline', - layout: 'auto', + label: "hardcoded textured quad pipeline", + layout: "auto", vertex: { module, - entryPoint: "vs" + entryPoint: "vs", }, fragment: { module, targets: [{ format: presentationFormat }], - entryPoint: "fs" + entryPoint: "fs", }, primitive: { topology: "triangle-list", @@ -92,10 +102,10 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B }); const url = - 'https://webgpufundamentals.org/webgpu/resources/images/f-texture.png'; + "https://webgpufundamentals.org/webgpu/resources/images/f-texture.png"; const texture = device.createTexture({ label: url, - format: 'rgba8unorm', + format: "rgba8unorm", size: { width: img.width, height: img.height }, usage: GPUTextureUsage.TEXTURE_BINDING | @@ -113,36 +123,33 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B { width: img.width, height: img.height } ); - const sampler = device.createSampler({ - addressModeU: 0 & 1 ? 'repeat' : 'clamp-to-edge', - addressModeV: 0 & 2 ? 'repeat' : 'clamp-to-edge', - magFilter: 0 & 4 ? 'linear' : 'nearest', - }); - - const bindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { binding: 0, resource: sampler }, - { binding: 1, resource: texture.createView() }, - ], - }); + const sampler = device.createSampler({ + addressModeU: 0 & 1 ? "repeat" : "clamp-to-edge", + addressModeV: 0 & 2 ? "repeat" : "clamp-to-edge", + magFilter: 0 & 4 ? "linear" : "nearest", + }); + const bindGroup = device.createBindGroup({ + layout: pipeline.getBindGroupLayout(0), + entries: [ + { binding: 0, resource: sampler }, + { binding: 1, resource: texture.createView() }, + ], + }); const renderPassDescriptor: GPURenderPassDescriptor = { - label: 'our basic canvas renderPass', + label: "our basic canvas renderPass", colorAttachments: [ { // view: <- to be filled out when we render clearValue: [0.3, 0.3, 0.3, 1], - loadOp: 'clear', - storeOp: 'store', + loadOp: "clear", + storeOp: "store", }, ], }; - function render() { - // Get the current texture from the canvas context and // set it as the texture to render to. renderPassDescriptor.colorAttachments[0].view = context @@ -162,4 +169,4 @@ export const demo7 = async (device: GPUDevice, context: GPUCanvasContext, img: B } render(); -}; \ No newline at end of file +}; diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index b3fc9c4090..1fce45bc1a 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -16,385 +16,383 @@ export const demo6 = ( context: GPUCanvasContext, imageBitmap: Bitmap ) => { - -const numParticles = 50000; -const particlePositionOffset = 0; -const particleColorOffset = 4 * 4; -const particleInstanceByteSize = - 3 * 4 + // position - 1 * 4 + // lifetime - 4 * 4 + // color - 3 * 4 + // velocity - 1 * 4 + // padding - 0; - + const numParticles = 50000; + const particlePositionOffset = 0; + const particleColorOffset = 4 * 4; + const particleInstanceByteSize = + 3 * 4 + // position + 1 * 4 + // lifetime + 4 * 4 + // color + 3 * 4 + // velocity + 1 * 4 + // padding + 0; -context.configure({ - device, - format: presentationFormat, - alphaMode: 'premultiplied', -}); + context.configure({ + device, + format: presentationFormat, + alphaMode: "premultiplied", + }); -const particlesBuffer = device.createBuffer({ - size: numParticles * particleInstanceByteSize, - usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, -}); + const particlesBuffer = device.createBuffer({ + size: numParticles * particleInstanceByteSize, + usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, + }); -const renderPipeline = device.createRenderPipeline({ - layout: 'auto', - vertex: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: "vs_main", - buffers: [ - { - // instanced particles buffer - arrayStride: particleInstanceByteSize, - stepMode: 'instance', - attributes: [ - { - // position - shaderLocation: 0, - offset: particlePositionOffset, - format: 'float32x3', - }, - { - // color - shaderLocation: 1, - offset: particleColorOffset, - format: 'float32x4', - }, - ], - }, - { - // quad vertex buffer - arrayStride: 2 * 4, // vec2f - stepMode: 'vertex', - attributes: [ - { - // vertex positions - shaderLocation: 2, - offset: 0, - format: 'float32x2', - }, - ], - }, - ], - }, - fragment: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: "fs_main", - targets: [ - { - format: presentationFormat, - blend: { - color: { - srcFactor: 'src-alpha', - dstFactor: 'one', - operation: 'add', - }, - alpha: { - srcFactor: 'zero', - dstFactor: 'one', - operation: 'add', + const renderPipeline = device.createRenderPipeline({ + layout: "auto", + vertex: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "vs_main", + buffers: [ + { + // instanced particles buffer + arrayStride: particleInstanceByteSize, + stepMode: "instance", + attributes: [ + { + // position + shaderLocation: 0, + offset: particlePositionOffset, + format: "float32x3", + }, + { + // color + shaderLocation: 1, + offset: particleColorOffset, + format: "float32x4", + }, + ], + }, + { + // quad vertex buffer + arrayStride: 2 * 4, // vec2f + stepMode: "vertex", + attributes: [ + { + // vertex positions + shaderLocation: 2, + offset: 0, + format: "float32x2", + }, + ], + }, + ], + }, + fragment: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "fs_main", + targets: [ + { + format: presentationFormat, + blend: { + color: { + srcFactor: "src-alpha", + dstFactor: "one", + operation: "add", + }, + alpha: { + srcFactor: "zero", + dstFactor: "one", + operation: "add", + }, }, }, - }, - ], - }, - primitive: { - topology: 'triangle-list', - }, + ], + }, + primitive: { + topology: "triangle-list", + }, - // depthStencil: { - // depthWriteEnabled: false, - // depthCompare: 'less', - // format: 'depth24plus', - // }, -}); + // depthStencil: { + // depthWriteEnabled: false, + // depthCompare: 'less', + // format: 'depth24plus', + // }, + }); -// const depthTexture = device.createTexture({ -// size: [canvas.width, canvas.height], -// format: 'depth24plus', -// usage: GPUTextureUsage.RENDER_ATTACHMENT, -// }); + // const depthTexture = device.createTexture({ + // size: [canvas.width, canvas.height], + // format: 'depth24plus', + // usage: GPUTextureUsage.RENDER_ATTACHMENT, + // }); -const uniformBufferSize = - 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f - 3 * 4 + // right : vec3f - 4 + // padding - 3 * 4 + // up : vec3f - 4 + // padding - 0; -const uniformBuffer = device.createBuffer({ - size: uniformBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, -}); + const uniformBufferSize = + 4 * 4 * 4 + // modelViewProjectionMatrix : mat4x4f + 3 * 4 + // right : vec3f + 4 + // padding + 3 * 4 + // up : vec3f + 4 + // padding + 0; + const uniformBuffer = device.createBuffer({ + size: uniformBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); -const uniformBindGroup = device.createBindGroup({ - layout: renderPipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: uniformBuffer, + const uniformBindGroup = device.createBindGroup({ + layout: renderPipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: uniformBuffer, + }, }, - }, - ], -}); + ], + }); -const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: undefined, // Assigned later - clearValue: [0, 0, 0, 1], - loadOp: 'clear', - storeOp: 'store', - }, - ], - // depthStencilAttachment: { - // view: depthTexture.createView(), + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: undefined, // Assigned later + clearValue: [0, 0, 0, 1], + loadOp: "clear", + storeOp: "store", + }, + ], + // depthStencilAttachment: { + // view: depthTexture.createView(), - // depthClearValue: 1.0, - // depthLoadOp: 'clear', - // depthStoreOp: 'store', - // }, -}; + // depthClearValue: 1.0, + // depthLoadOp: 'clear', + // depthStoreOp: 'store', + // }, + }; -////////////////////////////////////////////////////////////////////////////// -// Quad vertex buffer -////////////////////////////////////////////////////////////////////////////// -const quadVertexBuffer = device.createBuffer({ - size: 6 * 2 * 4, // 6x vec2f - usage: GPUBufferUsage.VERTEX, - mappedAtCreation: true, -}); -// prettier-ignore -const vertexData = [ + ////////////////////////////////////////////////////////////////////////////// + // Quad vertex buffer + ////////////////////////////////////////////////////////////////////////////// + const quadVertexBuffer = device.createBuffer({ + size: 6 * 2 * 4, // 6x vec2f + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true, + }); + // prettier-ignore + const vertexData = [ -1.0, -1.0, +1.0, -1.0, -1.0, +1.0, -1.0, +1.0, +1.0, -1.0, +1.0, +1.0, ]; -new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); -quadVertexBuffer.unmap(); + new Float32Array(quadVertexBuffer.getMappedRange()).set(vertexData); + quadVertexBuffer.unmap(); -////////////////////////////////////////////////////////////////////////////// -// Texture -////////////////////////////////////////////////////////////////////////////// -let texture: GPUTexture; -let textureWidth = 1; -let textureHeight = 1; -let numMipLevels = 1; -{ - // Calculate number of mip levels required to generate the probability map - while ( - textureWidth < imageBitmap.width || - textureHeight < imageBitmap.height - ) { - textureWidth *= 2; - textureHeight *= 2; - numMipLevels++; + ////////////////////////////////////////////////////////////////////////////// + // Texture + ////////////////////////////////////////////////////////////////////////////// + let texture: GPUTexture; + let textureWidth = 1; + let textureHeight = 1; + let numMipLevels = 1; + { + // Calculate number of mip levels required to generate the probability map + while ( + textureWidth < imageBitmap.width || + textureHeight < imageBitmap.height + ) { + textureWidth *= 2; + textureHeight *= 2; + numMipLevels++; + } + texture = device.createTexture({ + size: { width: imageBitmap.width, height: imageBitmap.height }, + mipLevelCount: numMipLevels, + format: "rgba8unorm", + usage: + GPUTextureUsage.TEXTURE_BINDING | + GPUTextureUsage.STORAGE_BINDING | + GPUTextureUsage.COPY_DST | + GPUTextureUsage.RENDER_ATTACHMENT, + }); + device.queue.writeTexture( + { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, + imageBitmap.data.buffer, + { + offset: 0, + bytesPerRow: 4 * imageBitmap.width, + rowsPerImage: imageBitmap.height, + }, + { width: imageBitmap.width, height: imageBitmap.height } + ); } - texture = device.createTexture({ - size: { width: imageBitmap.width, height: imageBitmap.height }, - mipLevelCount: numMipLevels, - format: 'rgba8unorm', - usage: - GPUTextureUsage.TEXTURE_BINDING | - GPUTextureUsage.STORAGE_BINDING | - GPUTextureUsage.COPY_DST | - GPUTextureUsage.RENDER_ATTACHMENT, - }); - device.queue.writeTexture( - { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, - imageBitmap.data.buffer, - { - offset: 0, - bytesPerRow: 4 * imageBitmap.width, - rowsPerImage: imageBitmap.height, - }, - { width: imageBitmap.width, height: imageBitmap.height } - ); -} -////////////////////////////////////////////////////////////////////////////// -// Probability map generation -// The 0'th mip level of texture holds the color data and spawn-probability in -// the alpha channel. The mip levels 1..N are generated to hold spawn -// probabilities up to the top 1x1 mip level. -////////////////////////////////////////////////////////////////////////////// -{ - const probabilityMapImportLevelPipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: 'import_level', - }, - }); - const probabilityMapExportLevelPipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ code: probabilityMapWGSL }), - entryPoint: 'export_level', - }, - }); + ////////////////////////////////////////////////////////////////////////////// + // Probability map generation + // The 0'th mip level of texture holds the color data and spawn-probability in + // the alpha channel. The mip levels 1..N are generated to hold spawn + // probabilities up to the top 1x1 mip level. + ////////////////////////////////////////////////////////////////////////////// + { + const probabilityMapImportLevelPipeline = device.createComputePipeline({ + layout: "auto", + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: "import_level", + }, + }); + const probabilityMapExportLevelPipeline = device.createComputePipeline({ + layout: "auto", + compute: { + module: device.createShaderModule({ code: probabilityMapWGSL }), + entryPoint: "export_level", + }, + }); - const probabilityMapUBOBufferSize = - 1 * 4 + // stride + const probabilityMapUBOBufferSize = + 1 * 4 + // stride + 3 * 4 + // padding + 0; + const probabilityMapUBOBuffer = device.createBuffer({ + size: probabilityMapUBOBufferSize, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, + }); + const buffer_a = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + const buffer_b = device.createBuffer({ + size: textureWidth * textureHeight * 4, + usage: GPUBufferUsage.STORAGE, + }); + device.queue.writeBuffer( + probabilityMapUBOBuffer, + 0, + new Int32Array([textureWidth]).buffer + ); + const commandEncoder = device.createCommandEncoder(); + for (let level = 0; level < numMipLevels; level++) { + const levelWidth = textureWidth >> level; + const levelHeight = textureHeight >> level; + const pipeline = + level == 0 + ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) + : probabilityMapExportLevelPipeline.getBindGroupLayout(0); + const probabilityMapBindGroup = device.createBindGroup({ + layout: pipeline, + entries: [ + { + // ubo + binding: 0, + resource: { buffer: probabilityMapUBOBuffer }, + }, + { + // buf_in + binding: 1, + resource: { buffer: level & 1 ? buffer_a : buffer_b }, + }, + { + // buf_out + binding: 2, + resource: { buffer: level & 1 ? buffer_b : buffer_a }, + }, + { + // tex_in / tex_out + binding: 3, + resource: texture.createView({ + format: "rgba8unorm", + dimension: "2d", + baseMipLevel: level, + mipLevelCount: 1, + }), + }, + ], + }); + if (level == 0) { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapImportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); + passEncoder.end(); + } else { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(probabilityMapExportLevelPipeline); + passEncoder.setBindGroup(0, probabilityMapBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); + passEncoder.end(); + } + } + device.queue.submit([commandEncoder.finish()]); + } + + ////////////////////////////////////////////////////////////////////////////// + // Simulation compute pipeline + ////////////////////////////////////////////////////////////////////////////// + const simulationParams = { + simulate: true, + deltaTime: 0.04, + }; + + const simulationUBOBufferSize = + 1 * 4 + // deltaTime 3 * 4 + // padding + 4 * 4 + // seed 0; - const probabilityMapUBOBuffer = device.createBuffer({ - size: probabilityMapUBOBufferSize, + const simulationUBOBuffer = device.createBuffer({ + size: simulationUBOBufferSize, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); - const buffer_a = device.createBuffer({ - size: textureWidth * textureHeight * 4, - usage: GPUBufferUsage.STORAGE, - }); - const buffer_b = device.createBuffer({ - size: textureWidth * textureHeight * 4, - usage: GPUBufferUsage.STORAGE, + + const computePipeline = device.createComputePipeline({ + layout: "auto", + compute: { + module: device.createShaderModule({ + code: particleWGSL, + }), + entryPoint: "simulate", + }, }); - device.queue.writeBuffer( - probabilityMapUBOBuffer, - 0, - new Int32Array([textureWidth]).buffer - ); - const commandEncoder = device.createCommandEncoder(); - for (let level = 0; level < numMipLevels; level++) { - const levelWidth = textureWidth >> level; - const levelHeight = textureHeight >> level; - const pipeline = - level == 0 - ? probabilityMapImportLevelPipeline.getBindGroupLayout(0) - : probabilityMapExportLevelPipeline.getBindGroupLayout(0); - const probabilityMapBindGroup = device.createBindGroup({ - layout: pipeline, - entries: [ - { - // ubo - binding: 0, - resource: { buffer: probabilityMapUBOBuffer }, - }, - { - // buf_in - binding: 1, - resource: { buffer: level & 1 ? buffer_a : buffer_b }, - }, - { - // buf_out - binding: 2, - resource: { buffer: level & 1 ? buffer_b : buffer_a }, + const computeBindGroup = device.createBindGroup({ + layout: computePipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: simulationUBOBuffer, }, - { - // tex_in / tex_out - binding: 3, - resource: texture.createView({ - format: 'rgba8unorm', - dimension: '2d', - baseMipLevel: level, - mipLevelCount: 1, - }), + }, + { + binding: 1, + resource: { + buffer: particlesBuffer, + offset: 0, + size: numParticles * particleInstanceByteSize, }, - ], - }); - if (level == 0) { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(probabilityMapImportLevelPipeline); - passEncoder.setBindGroup(0, probabilityMapBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); - passEncoder.end(); - } else { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(probabilityMapExportLevelPipeline); - passEncoder.setBindGroup(0, probabilityMapBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(levelWidth / 64), levelHeight); - passEncoder.end(); - } - } - device.queue.submit([commandEncoder.finish()]); -} - -////////////////////////////////////////////////////////////////////////////// -// Simulation compute pipeline -////////////////////////////////////////////////////////////////////////////// -const simulationParams = { - simulate: true, - deltaTime: 0.04, -}; - -const simulationUBOBufferSize = - 1 * 4 + // deltaTime - 3 * 4 + // padding - 4 * 4 + // seed - 0; -const simulationUBOBuffer = device.createBuffer({ - size: simulationUBOBufferSize, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, -}); - -const computePipeline = device.createComputePipeline({ - layout: 'auto', - compute: { - module: device.createShaderModule({ - code: particleWGSL, - }), - entryPoint: 'simulate', - }, -}); -const computeBindGroup = device.createBindGroup({ - layout: computePipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: simulationUBOBuffer, }, - }, - { - binding: 1, - resource: { - buffer: particlesBuffer, - offset: 0, - size: numParticles * particleInstanceByteSize, + { + binding: 2, + resource: texture.createView(), }, - }, - { - binding: 2, - resource: texture.createView(), - }, - ], -}); + ], + }); -const aspect = canvas.width / canvas.height; -const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); -const view = mat4.create(); -const mvp = mat4.create(); + const aspect = canvas.width / canvas.height; + const projection = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 100.0); + const view = mat4.create(); + const mvp = mat4.create(); -function frame() { - device.queue.writeBuffer( - simulationUBOBuffer, - 0, - new Float32Array([ - simulationParams.simulate ? simulationParams.deltaTime : 0.0, - 0.0, - 0.0, - 0.0, // padding - Math.random() * 100, - Math.random() * 100, // seed.xy - 1 + Math.random(), - 1 + Math.random(), // seed.zw - ]).buffer - ); + function frame() { + device.queue.writeBuffer( + simulationUBOBuffer, + 0, + new Float32Array([ + simulationParams.simulate ? simulationParams.deltaTime : 0.0, + 0.0, + 0.0, + 0.0, // padding + Math.random() * 100, + Math.random() * 100, // seed.xy + 1 + Math.random(), + 1 + Math.random(), // seed.zw + ]).buffer + ); - mat4.identity(view); - mat4.translate(view, vec3.fromValues(0, 0, -3), view); - mat4.rotateX(view, Math.PI, view); - mat4.multiply(projection, view, mvp); + mat4.identity(view); + mat4.translate(view, vec3.fromValues(0, 0, -3), view); + mat4.rotateX(view, Math.PI, view); + mat4.multiply(projection, view, mvp); - // prettier-ignore - device.queue.writeBuffer( + // prettier-ignore + device.queue.writeBuffer( uniformBuffer, 0, new Float32Array([ @@ -413,32 +411,31 @@ function frame() { 0, // padding ]).buffer ); - const swapChainTexture = context.getCurrentTexture(); - // prettier-ignore - renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); + const swapChainTexture = context.getCurrentTexture(); + // prettier-ignore + renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); - const commandEncoder = device.createCommandEncoder(); - { - const passEncoder = commandEncoder.beginComputePass(); - passEncoder.setPipeline(computePipeline); - passEncoder.setBindGroup(0, computeBindGroup); - passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); - passEncoder.end(); - } - { - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(renderPipeline); - passEncoder.setBindGroup(0, uniformBindGroup); - passEncoder.setVertexBuffer(0, particlesBuffer); - passEncoder.setVertexBuffer(1, quadVertexBuffer); - passEncoder.draw(6, numParticles, 0, 0); - passEncoder.end(); - } + const commandEncoder = device.createCommandEncoder(); + { + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(computePipeline); + passEncoder.setBindGroup(0, computeBindGroup); + passEncoder.dispatchWorkgroups(Math.ceil(numParticles / 64)); + passEncoder.end(); + } + { + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(renderPipeline); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, particlesBuffer); + passEncoder.setVertexBuffer(1, quadVertexBuffer); + passEncoder.draw(6, numParticles, 0, 0); + passEncoder.end(); + } - device.queue.submit([commandEncoder.finish()]); - context.present(); + device.queue.submit([commandEncoder.finish()]); + context.present(); + requestAnimationFrame(frame); + } requestAnimationFrame(frame); -} -requestAnimationFrame(frame); - }; diff --git a/example/src/Examples/Breathe/demo6/react.png b/example/src/Examples/Breathe/demo6/react.png new file mode 100644 index 0000000000000000000000000000000000000000..06568a5233f158a17f516616115555a06c8a9f99 GIT binary patch literal 20214 zcmdqIg;&(i_xQgoAt4e{f(XJ2NGm0|NFya6NT-yU(jlNU zEFBUHEU?7J_v!2X`5%7g{5XfRusb_5&pUVS%)R$;Ha9K$+QWz?&rAMw%+1>XDnQvcYi75V3lnypOx-NzbRX+2VDR7i*wUe>9w%l>bK0v2h>g} zzxQ1&>vQ7%@C8{ejKnl!Z|0%mILb;Zao(_bZ=U_Qvrujm^Rm97zGibQRvw9w-+Tv5 z^ZyS&oh`AT=3nwq%#;RCmT24h>Y)@q{l=N25J&F?p}24C+h`VVSNASq2=L8bHsl%zFzfx4u2sUrmIIh1^0q6h;CJ;Fz zs8W&k0`C#bONQU0xB3d6FcVy@6*(h zrr5Ppax;6N6F2pP(VlM!^8FK*2?5*MM=7YkkCyV(84)I$U_{EFnI&jNVYKp2iIpG^ zRi_{zf=3q7OVC0c+UGF%Uzl9lo|YxM2nX<4IS=qzAZBb!|LF$K{lT@atx(Hw!?Zzs z+RI|NKl;x1`wuIb06}CoDRCgjPR22j4aWEZyBfVe2osKzyya=nW0Yeww<#4c?*Y17 zab9bS^NCWw-i{v&#$V();Fd4NJlps?W4K8=2h17+h>uhrzY6cVGRT%u-Bn7wdrWGV zVn$*bvA=^f?XnHmt&c7cSNK3_9pZlADnLPfitRY_lCe ze9z{sSEAT}eaJXL8={i3{(%)Kvg1}SGvH75zh?8vs`t1d%CK9pi`r5ue-eqV$yHNK zgEv%;ydAMgQdRA?_DNri!1sB&+e?cC32S_a#YU}Pk#0{I z?srzLPI=QQJ43~b-8t7l?=NCD%$^HgJGkN0q-tJJ^hVU`dKMRl%Sk2^)V7&#DrR%X z`baPT!n|0K{}SxOL@9XG&-pj7U}cxcBcf?8cNA^W0-oOI(@mTa z#oQGUZ8GVqQLlFV_Sx+A!Y&{0`r+O>SN^m39B=G*iFPD5xW*6F9WbAdeKS0tGhG8O zO?LH$0P>2a2FdC87ryVf9oM9ZhG7>|)Mkws(ig_RidYKBi(%Iv!Qr`Ye+v5Sbu<<* z(%+Z>Z3zm3wuHr;h5WEc%xN{`cWR7st;$mUp);YG$W2C^)1f8E^+E+q1tE%~%Hclg z)NDPu)LYnI3#l8_zwYglBJ{^KzHJSnRk$sFYw2GnnQ98sNcHb&8^xn`PB26Vw=U=t zOP^yLK?fhn>1kED^$su9Zaw9hF!mAx+WJg*>!JNjKahsDhy6Gd_lj6Ow}s?*e)L{( zcr+arNo?DQg^TKvb$AUqRJ^g+_kX$@^jFIAE4h_bZlseq*G z;4yVz9uU~dNKTXyuB#3_{(Dg<9KZGlasMojaKMv@aEiMy7}UUTMdwy)G2}aHfqv;F zq*dJ5c{>iapnVZ?X_L5!@D3wBNg#V2u%L;WHA_1c@&65Vue*^LccIW`j=s(~rU#6X ztxalYWiI_rUThvg(f>(?8;yF;QYuPCFb?c^!*FTQ08y65$)rO6LWkdRJyHuDj@QzV zNdV=0OXnqQ1reKGa$*<#heBv`<4VW`DTrk}RN|+9iYG`cj%=Sr!8vru$FSuO$Z7l{`4d*}qSiead`(N81xiG24 zCa(y&ooA2o_XXd`h7*5VX(Rm3-TR47^~uc4CUMfzD|{ixp!{&)@ntPOrKSh&>4S=6 zOu+WftgFO2ZR2Y7jwGo{kL_~MQ=&wcRNN?i`;CMm#1=cS;XX!Zf*RVv;yRj>X;|{J ziq`&kwNKj0XXrszMQ7&@__j5{glTlbZ?l#3F0h#1ZApE`pz-K@DU(z3-JBG%2)p*O zE|jLtDAethygZeFzJbSKFtPh44Kv7xnhG?z_<+mD3-ZA8+V8r{V@GzJp1{;$_e|ps~LJ7m*iI%bZD6b0hE1cKc$3& zhwZrM3Fy~dV8w2&Hjj<;)f{8LEA%-3U4nmlfa@XDBypa!4w@B!5seyPkcXc<{jtWm z$m*~m%`KbGCQYIuVqgr3FG<6GdHg@xoVq4)S7h$g;2F28nLf zGlynEBnxxYGHLsYF5EnTcnx|d_j-#1|)_WdcpI1IEV1dJ4wsYukV^PLFi5k=zNd|Hs^tDKkNFt7uO%eodF{#6{n{o- zA`jIILYhIyybg;|LA+iig^u-&k1q1#rpVPbB?Qp7BksX-u(<5suOa%G1c+B;H=DPe zT1PrQU52oF0PjeC7c43>H_Oy~uDe!luvX6Wh4SAXUF1GGY!`(&k=rd6BL!oVqHa?O zfJ4)b&fQ+7DuX>esfT(Ko`#xzVA1#|PVepm=>D+uka?45N2}We%Bd}3DCqnF8JzPR zE=rZ6_ogZ^#8DtoCn@KbfE+-VHWAc-o=JBHn7ahmdw0qa+!N*>&;jCzX6hI<5j(Ot?Il<$O|{3u*74V zWvS*n(EJZ^5qbDQ^Pw5Im>+&{J&lJslScKG__-*dWEon+JZir(B^%8{1xtU}~fKa|;Gxaa05h8zU8{bufYh z_QT7|Wi?oY_5hhQ<_owQt;?}f`OoK1R?cP)2uM*OR-4^oGh%y5cVOG}6OYH&!}e5d zi4w@GqX(PIqc9z^#bgeW6sTo}fP#z1>AWk1Ysc0{=|05ww&5>^M#ag_@~_;Cgt{N zJ3vv#PDnTI9f#XCca}E2uGZBx0SM)7*%winH*xAe`4l`sH?@6qN%E6`)5g4&aVd6t z{rtQnDcYM9FYrzJM$B9BT-LnGb?>sFbm-OFqI>({J;Bbw^|Ybg-Z;0jG9Qbja>zs=IqlvPTo^(X*SG=j( z6i)eSD*LR$bhn9beXGucD`U!wK%WmGq$%B#T^F;lqqapq7+Qv2MYr=sN2Fb3N*U;q z|F~bq7O@>6+;qFe8>tWrE{fTl!waviSQ1h~HudhYx5ND5B2e$2h-12`GrI3VvK^=_Hm*}}RswgcJ zdk`lvs!!VCy^LK*9wW>%G{dEFn+1@i#@^1)iauJJfAu!;qmB*bOW%(pJ95ij7aEgr zJpva{zc^`Y6Tn@w7D+;WTCRPiBL44^&hqd2|CK>}{>!D!kW3NV%(;ti1X_&t%s_CX z(D!*~zhiW%0G_pw7}4DZrySRoAOAjBrgLgzFil5aY(Lb5f5sJ78rz6!_7RIr+I%T^ zo3h5eHcw@gD^hKxY5n^LH;`HyaJibOOnRJo&AXRpwDnV^rPxy5o%!87S`zNRRz4Tw zaE7y}#Pq2g0wb1GHql8kzqOPxl_LR1kaaeRF(+{ z$>XJL;lZ!jsRVuu5tTPnTV4ARbn|UiP=g!d(=qJ*xF6$s8&Q)vZA_gZF{3IO4_c?t z;JVP-QD_8T7v04|KJ_PS8T!h8>EVpM5+1I;`;77ja7^ky;N2Px6xnF=Inyk#oFt^E zJx(TE7cDSmN2qYe)UDMNPZ^z(>XKHfedMFUaOG4ReY~2l1L%T9E0qCs&`S>XbuG*n zvs`?6rN9Fhrgm~X93tA&R_Q)*C#9d#M?mK>pG-|}Wk7mPx#d$QQ@}vh2H=M%+BxlbL2gv@0HG$yrg^IbDOWg&&M^6jQQUTegxT- z`FJ5mT#4YZ&BCfa+u?RqtCjrbp>d*Hv6)wfms|env)5>)Y?&EtZxMEV1~-#@*tH`Y zqLK-TFbx%m#q0ho7wW~Lm(FL!L*rwTp*gFxPpiSERY#bx&*^V7{*>|*_G|z69_t_- zt>2Lw(0L3>eM1HW=?aG69sSZZH9BgvsidJ|Gp?_xbO_~-tWUo51e;FhovEI#|5C!+l*vUxJ zfe%U1b5(|-J%o|uGw{u4ENo}|iNY-vN>f?S8qCS$lOk(47I7{;8U5q+xzNey%6xdo z!&PmmPPz|2``1G7m>aV7k6zf6nb)Lc`{snQDml9-Rim?B9%4H(cKaVcQFx{3+N-$v zlMwC7vw?Tsy%RQ>HM-+@-NPnJ*Fdcye?zC3;v;aqOFZi;9E+Rp)Blrn;h=SIwu1S^ za|rkCvInAJtxOMF&nD!t)5%;kw){aneXoPos;ApU$-p@W(1gr(z5DnFL|JLY*zpp8y_K_#S_ta*ao(QJia(OK|7=ykUKkxl6WuAP{p(S< zzrEb@ld#9WFofDVv2;#t%D!rsxb?HE1C;O)#7!;2g+21<-BfRZXE1sg1a-ZexZqu_ z%%#Ngk9<=gtEE2}ep#uwoALn!|L21G^zHW&TK8Q1A>}+&)53|QtMKig!7LlMR1%j* zGHf0_Cd4F$b{|4<;_F%rI#txK97|D6?jf0EXF zlg>%u!By{F%~sUqcB20iPCaj1?1jMV5SlvO$^oXE}bPvh0#*SEFd#o^voRnnu7SE%OvLON;D_hqWvZHN zg#=X=Z9Us0ym>F zrDce9YZ2=|{cvC7U)CTN_!CMBvTNR``$1*DmE0yP;MD$^ZlAV+H<%b}8T6c#msr?xsnt&Gp3snC{=N_11-2qdaD9UrBsQa;RQS;7>Dyxe#Ml>w)@ zbgyc(2NtU_Q{9li2AB3;j=P9PpmY3uh$$3Qv@Ghs9yk&@WcqR+`S=utQ{2}6K^vHp ziG>a>3OTdcpf3~O?J4FUn7a;Q`JNb8HjCT3I+Rf5dYx2K+5U;>)GgPkGBzdk(*{2V z&VIoOj-jl04S$PYTmHAj_NPjq#cx97y3=M5wza%a+>p$G?-75D(}(DY7EDS8Y8Y?} zf6humbtsQvaJj%0>`UOrXma`cBjxjMnIwAGNM(88Mi|QPgGHvt<%~r>N0_cPpj8kt zTA;_;V}Eku{Q0e?_KIbEb12g1`&9dzZf@&op54zIrf1X-^~-V8|JwVeNi(RXa^zKw zgJ9=OP~tmpXBTPNL8lHfU&bZX6W6*SgAy90-=AyGa@;J>i8p6`%9!Oy1c5kXQRsm{ zGTUXr8nRO_WWzCD&tPAE3RSN`sOXPVSnTt(@DgPwKFhA8UU_x-rZT-fZTQWpq!#nf>h;<`?XPpqIBfx8>3rU#k^7 zL@D<5;z@I0xuH+8zE_G|FgXaO=DJ}6%3Fw{)#o*j!s|I(PU}`nPL9@v>@Us#5 zL?9T{zHR#+;wWrsdc-j}eNcWM9Y3G)kU#CC!#yp~i|QXc%^Z{uZE+9x1L>T@32v}Z zxj=ruKPp03`vbY<+BT5o$w=cst@x(>z+LyyG0|B5e#A@p=u~-WRYnBON6?aP)m4H$ zWJ4FNd~u|_nIabSIx(*+9abbqnGq?Jeh9g>Zdvv?8ZK*IWAO$6}m$ZF?$+8*p`y|*KtOb5?jS-|!WbH(( z*TI?SJ{p;kXVhV^ThmC~v-`e9#P2PBOYF?Lg2Y>Lj4EJcZV^upxwJ-capFdVi-7oH zZ=w+I=~JGWgEZ(IPCe!`_t>%SOSYt3WwymjEuIXQN5$zuT!VfU<=`a9QoCUE)yXSV zpxnndHzXdt@U9-dCBL~p=u8Yv%1V`1RnIQL=kD`8C2GwMrp(Q1=m`2G6J_$a;7wB# zc?-eD8*8sHeVJp0*e2v@4dheb)cWs!_#tD%3u`6HsdeRz&;9zN&rR~lIh=F;I)Q*C z_{4T^#|Y`kkBuvlM(9#Evx-d zdp&}Er5d-N>eBTo{>g-PhKl3YMD9ADI$l{;#$!m zYqAF`o9s?-zTpstg9MQ z>8|OshT9BZCQ+AT?>YMYT-5x((1EA}lhLojkf|3=wwe}q*_UDjRlYaQ$+aqkeAJ~B z9eqSLvW_hzBO3I=A$|uXcf*l&ip0dGb0EmKjP$}`cI+P-`ceK~jGdU`*A-)%*!?15 z?ZlI?-8lJKr6gFg>*E~(8GVO2JHVfvp9o!^yVM6G=f0qe7f(jk+e6$s*)UOn$>1N7 zQgXNP$6e~zC#0w1{GqZ0f0ZAXb9LOA&z?DBPz(6AmxXBaUHYxP4oTmh9;nS{^iSNI zp^E9adke)-{%GY%xY&$z|K?o7DlXM-F9B33E0Rz$KS9uK&4zvND0u^Cu@6}DtwPfui>j!9&!fu__5QjH0&_>0}%Q~{JE`%-U#k1p9$;VGZ*q^vIoQow- zjLw{oLS`a^^8fvyy*C%d#O-?r1cG0K*1W8#0bRso}37MsaZ>g=rpqS-XjbfbecpB{TzhlQ#T+gm6**398sWfK@R1a6 z8zPZJhg1JlPF#s}=qSN3DHpNQXO{shvu4BF9);{YB{^;pcAUsga(naBgjD+dB3Gpd zBSNZpp|1`kip8eh`nyUb0>jzJr7O87bTDbBHMh{8 zAtyfE(KKyhsP3~8$3iP8#ig=HR1q_2vfFLQ?UN26k;1q)Na6|&Tyx_ymEnRLyJH2# zDZ2^Cli>d4&_MVi&=rO_OvIt|OToWrz7zw!KOqu1N)|FaT08J5r#JI5Pu3r%7;gNG zb25-1Y@2{L$5QC@G>Bi*+H(WTQ1iGmm`nz>Kq|Ru6?khLnowbK%c6wZF378_kT?H`z_f zz><5zT4h@_TIpmDU}LA;bEws$R*wG6;Gv?x>MG+zptA4A47{sw!0aM zM?_@INDk5PU71;>i@ZAg;rwX*^v%9$8f1)mOs#(x%iQi%?rVaz&ALvu(9V+G+w3w5m(wye#j~+d_Cs z+%2fsLhaabC1`V`8oVWys4>!^@qYGP>@DsQ9Qu>-q01_Y^_Ld}~ZuX6*5ll>Ulb%Tj zLJ|HD(9T<6cRn-6k#z=S)v3xxPYgTj z<+gm12Wp51GMybcR(d@`)wB>UGQR&I< zz9URC?_iQxu;OHY)JWEd9?6g7zw9mZ>(<#FfnjOQ?KHjJUCQneK-^g*Rya?>W+nbp ztSqjp&@g$=r0S5@+_C2ZUEHkk)ddL8f1bYX_{M=>BTGfyJ`OPI38FQeq8}cfgbs2L zy`%fKN{23OH}w4=U@=0iPb}*tM|8f{r|g#0zw9%M4j+E#7o6es8jEBm!GJ*SDeY$$ z24QQFO!YwuQY?E`aj$ASJLD12IHF|m#yS~q5 z6It~Uf}L}DAJ{qDafGj9cC%%I2&r?i&jk}CBW&L3E9`E}74ADI1Aa}zh^ePvOaav& zme6KjRQbq()`~jIg|94KhpE`z8!iWxXr>yEWaJc+^kjPZR$zxq4gajngVHwGJx}W^ z4HLg=S+qYAznF5?0qioMYR)l@->Jf)X^Qr%b;+|?tzt3og=Y~rikU(KMu^XE+QkkN zQ+y(TbUSft9llEAw$ug!lr9p58i9b?4G9`C8_2dPF6v2YKz-_Z=#xo>9{ zL=x^n0l7Kpb*lzjWRhhAyC=7mcZj->ST<~vyVsW;)A?Mtq5?E|3{95ZJ}F~gYiqWB zM4J{zD4CtUnl5+NE7$Pf4ll0j$c=EBNWn=`u{rrWct&xk{)sdGYfAE$j5m+f1krN6 z5EUB(nj5e|h^rskCyfz(9E$}9;@${Wxt2*@h)GqA|M)z*S`{_3_qogVIPZC8E_VYL zpzGu3O706G+U^qA4O7ch%1LuMlSbBTj>8 zQZ7+n?nP(idu%&9|8Xo;IODW@+9R0X{yQo<*zwic{Yg4Nd^$Gd0^5`u!{KA{gV~G% znZ)P9IptR5=`PwuBT_P34^Tnt*tedU)W4Qs!#&Uhiodahk^wwLXWAIU0U-9aje+Wi}&Z) zcvBt{GjC|%%P(AfFji@BdKrcAF^EO1*zfMixFEt!{1x@XVmJ7Y8qF-C<(bN$B7bKK zoL~!eVONae`!;Kx{24gcF?%<@^f@c*NlV_FBs>3fr@U6y9eV>`Bf|)KH@ItU{<-eq z0k8ln($_M{EM!pcMlSR6{Hd)|ir}pM?E!`TTE>?oi}39MsLi-fr`G%#JQyA%F;fgR zaZN0)5Ff$i(fYMn{T@O5Lvt)QFN|d_6xFBj6X(cNzzN-@p%0ty)_G%bnxjwi8Myz= zo!6At>lX-Z|^`R5!?PS72e$(`4t|}mX&>i1&1^Z0<%E;E1CYDw!fs)C##@@V9 zA#%Ups4PK%<8I2}2s?2|{YnQ14mmC2C( zNF%%c%6#TYs2BIX*n`AbGa>o32dvO%NU`{dtjts=#7+j`@rG@=WbM@oF*?O)FJ>v+z{VByIn34*le|M4#tI8;j&JIvp zE+!~X3CL)ZE#iER^?xw#xZ97MTin~+4Jm9vPh{_)nJpzXKSv|B`*jxQP-*8(n{-<& zKWf3me(#`U6a)H`RM^{m6y4ND&~g>mcw_wE{oxn6xrhG$Fszo1fkvbw5L;k1ejIv! zg_c=|&@g@_SqpT)lyli2oh&fN6ZR0T(egwvk? zTu{Q!2p3%9M-S5J@?1t$anh%Wo@shd z#_jw{TGLm96nW~G92c?oz_N212s8a{=kL7A2+DTDCLrxYSnzxcTEp8U)=uKsiz5sh zrt0mm(Ys>m{Sf%x=4f-J`JJJmSt+`M8 zEA>9nSmnT<^johR{6QQUX!ALcB{wl8?+Nef3Xu8Qw@wTjDX?&d@n!Oi$!=mzTORKG z3kq!oP$nYuZv^aob+Gkz$G3B}H^1Bvyg_@hsxWsAn#7m6C$If+DW2w-{6SRp^~I2_ z_^M`0&n>FgDr`>c4qtZ#CK3p5a=jkNt3QtI(J;q3_Y4z4vYZlK7fzi6^gDAa^Bs^x z!%x5#QXHt6#)ode9z+LuW;eC6FF{CN^W$#XI-8#<5i}A}wPq@bH^Ycm$l%#g)F4rl zp(0rGoQ^f;V?6<4W&s~*M!gu@DpH7Hn-bG2hDHCqS;N`lZ*)ifE<1RRTV37x`RsyH zi}XyM_A@*!_RZj~@8+=S&Lf=5i)DXbF3rHr^p?WX>IYN($SksUDUJTs43Xt#6MQPHD6xTaJku{TqrAeA>0GxL4nyQ0g<( zm?EU!Nf&K@Hi!L=K0*B%j)?hj_#3TOOAL2=Ihrhe={b!(wUPF|12r=MLW+8tY^|ym zmL+5=`ADCJ;{Oe$php=SV0|52MV~F@BrZZ66&!i2WyVn3e(3NaQm=H(5XlS>j3vbm zd=nr-bXBIoql+X2@%h;=?Ds~bIT`LF+l644bsFO9N3VlIcihY(t8W6xPL$smtn)x^ zOJ&mb&sfKArm#*EJ<0|ZaS5k`=dUkSVOG%KpAuL?9vOF5@!)LMPM}hl&y%BZtMBMsYNL#qOA0=B$4T@`YOX=LrJ*YKyF$5czuX=JSvGue04E8C0u%4FLgWykqt_<<%lq!N%W#rcen; z2=u?IFCiZZ_R<3BYEj0hDPMoL$|L&=sv5>EW!1o8J;&sJSbvx!7YARziBCCD@zM_u z*2{XYt_STCHep4N7na>j$*ML6LBaKA5tLGA#jc9 z?>Ec$*(_!kw5as7#sXbIIc@qFWFO?-ui;pgZu$;=(>C-SF(Im)4C>bo-)uQscJ9m7 zL>;H=DK^$z-Cstl*Ys>`gWzQ`QTG%BRP1ib(bDH)ZTq_;I??kX3vUu%K^*{&(&%RZ zxMxoo!tiC|&qp#fuixc1M|un|oICuAd+DQU@W^DiSZ-1+VXLAy_#_l2{s1EzcuJ5f-atv(txi(Cu!#6P8EGDDl_Y)-ZY5v(bR9qH+tkaR#}LB4G=8_h4CV6b z=BXkWYIK{VQ$<*S;Vks`n9a{4Vv^5lx&yWuQh6^gV3TNJQF?P5sWd7W`^Xl>`X_;I z=hzhDMy(f2JJ5+7tyB7!eTsaPO1ZTUxA}C+x%Dn+q<;OnWS*WY)oc*9K)dnyOLV3& zcO$YbJ-k)(p1Vnp`NG-V6-@dQTcyO(-P-MzD<<)+6b?W<+K5RJ-2U37gr9vIKPWza znew|hh#`II4nrYrq>ZR&nB`|CJZn8W#8L3M3X8uiw>Qr079&X5q|Jo%FpX%QfXuw) ztKp#3ZmkMVn~EbyT8G&4J(M=zM!mmu-7nWnbRT;mn=iUKAwhF-gy@WS0=!HiR~~N1 znN0scZn8XR>N`Fef2e;(lLw`)G?!BCn$)(jh%kOs&OO@M7<0$YDFZ$awc~`&0^Cql z;RLB-7V5y^YtevV2h|4AQ8KWIQlWmsE#^JpCZleSD!_qO zFzbaUqME-v<$f3~Gig*q&yC~+uX!iFI}F^4%kcMVOJL#FS-( zfALefO`rSpAq1p(@40cJ0lBcfo885LMjNCO7kHRP`ux?(uxgmne=N)C_o(=$-o-Y@ zO1uW;?36>SR+e;54n}H%LN`I|`<&+ctt(pXYp^3do)ki!oyyN{86uvtFce6B*jp^y z5}L$l2|6Tlf&|l?PO$8^m&47vn!8a+@n`P0Uqn1pt{#>bSqdSz7fQ6=Wx8!q2G4QJK-p6%bgjS$zVei>&8^)L@>KZvtc6r_opV`LVxaj9lCIM zK~yU_q>0tXh@vv_K{Ha-m^vuk?KUorim4ydu(wECTABTdw2*e~ZQ0O+!@$n?F}Fw` zV-gE{;2^sjF#q>wW%3UGeGN3j7=Q^zzM-D`Z?2EpztWn3*i-W2`?tfFjpGRS+$D51 ztx-XXH>rO;1SBpATR5RVA0fb#IL=v@bHoPdJl|TLndFEbSloUfbX)v3=v;EulGe+9 z?JQuR3_-tc^D95)GnZZ6ERX%clrcRfYOF$xAGNfrczu9@kRZC}%?F_}f+XBO7ioTA z&lcO;TKA7Z`wyY<-gHVffqHj5*c!PRB%@7Pnb0v2pRDQU_LB1 zM9L4Ud=CwKrjz){_##iR8VMjnIl@;r;;pKgNvc>P(cAnaP>5S&M={1v2zRLbKLk0F zGB5;!!6fnel^9cyZ(``wq(8&zcSf?R=*6p_&c>Gh#Y(a#<9l!ahR6$X14GE7iF?Ty z!p{MkgwZ?Fj&!~?5%Z_loFLzApis*Gp|30fy7xGLRnpCJBzas>;|6$1AJbGPOU9|g z#lff72CyY?eL>pZSBg0ImPPOL$u+>`i+-4HdrBy|8&5mwM&TawT(b~Qa{LbUk)(~q zo3*{9L$h`YPQYjs!FS?g>!Zdonk|^9`?qfHw_hC3}_?mSr~Vi^2zdT18EhJBBdrK<4S{iiQ5(SM@WFMA9&mUH}X z-xbeV@0B#%vUCiZAS=+lbs>=lFZV#_(%$(1H+;e^YHuY*({*mL>TDCQ4ay7YiXYre zjND9R<*H4JkNn|uMAR?8Mu^VH+#cP&!24rutZ*-TZqLXa2mBb&@Y*6(=KnVd>5D>l zbAVdw9n9?gmpk>``1&)4Gn>DH*@MqUU!$)lS?CYG-%*sIBkbiBz^`5W=50dxdzNO)lEYC`z@e-6tKgY zg7_6z@kRq<^`{+<`#W1^ywedG@Z(P1H5sDr@_=gnkB}=^{q-7b?YvN*6QG=cs}a zA6~uGsm@9arm|pGhbp7?i}tVlA}f~}K>hl|lre3YXm$@x9I&&sP;9olGqA8`Ic>g00ulrA2+UM(8XKx z6BE0T`wNl+ZS8WNpO06XKD%_>p?ctmZggIRYrw?cU1nS9lmBm|LudK`a%K4q;^+#+ zY4|i%3^q^+VHL9CI0D-_MKT(W9b=7-OlZAjKeX@gDuTASfx#ZL_&5A2~9@SWe2VpE$A^DMd@RB>TH2&c3<#&3EQ|48-nL#6fn= zq4tFBj;*m`pxFv=&X@exFB<&d)>R8@lJrbT^2~zYCil(^QZy-%(guu6KNk1Y4xZKu zL3@F%4j_L^%?rk$`uY5)HFv)_ALM27Qwd}eY^1M@-}ovq#i<2=BU>LW!d+gTwhupC4g<|O5wKmdEu&Z9@f|-5Rl{g z^)O)y2J`cVu!Rw&^P)cl+qK>hxR_r{zL>lE>5B4dVzP{!~&!ffTaNnAF;pvllDcePFL9i zfF#!y?tW-4p;Ld9N|w!lE0Lsny<_k9&AVjz+-80;UJs~u`Nv{@jL!!7YzkwWpeHh# zg&t2uAH42i(p(74xz-1v*n|hz9ONCXH0`Y(a#rbTxv15EzVLwm$Ez!~4u4AkwVlkI z(Qekslq=2#-{?NljQh9ai&qGQ+X>X#o%{Q}n_RNHpk7z zNonDkgB0DkG?2RdBVo&!uS5NPPBp`LjFn!H#WTb@r}1S{haA5oSOoCZMr8HxO$7>9 zRe-kyTGP?~dL;sX?~phh5c_1Zm43yjTV8^*Wh@yJ>|xYC^ne|6sUx+XZwFoAU%E3Q zwELlRe+(Pcj76y4G2@UIVfK&gJ{yAzGbdQ1hpi1|vuX*C5g+~m>KO{pnL7i%iHIEh zyJo(>6RPwxmyiY_QE!6(SR$tAZ4Pn#BY7GN*z+d@YXOUgSNcDr`K&T7=sPWme+K5y zMZ2#^2;b>ft$`4#5uiZFi%13-K32HuQ!3ojm}{9OWjsb$y-t(vf9CdCu-L`BioCcq z#&n>TN4_=HhGhjpm9AU(+x+j;nPrxHi%e6hIqiYc#ZK_e;-XSOen5fRW9h_#INY42 zKIwcKdB*N~9%>-Cl{a|Qr6YTnZL8*OJ}y$&%$#;Q5GZiK197Cj&BC;*svD?8HD@qU-YJSW9(b)Ai$eXw`h^6oQ2QdjoIzS- zJ}r)a-QIk{azE@&Ik}=rBG*Ux%P>%N>ik*s(ErtqC22_>xWnIEZ@KF=Gk0yy(Pg*2 zJ#8p_CjPJYZrqXO`yJH>wgP3)KAFJFr1jjF+1a^lmnYcMt$#EM_`mhm2{&caBW6JC z{*RH96sN+?42#cB)?tqPf6#Odte=MWANS8J%CRAr;~E@?JMMiaa3hKFxybR-absNW zvsL-KiDG)D{}pV3IDuQP{sgVJ(Qx5t5}E54sszG?Yc^WgJCt~r9al5mE?D??!Ju0* zGOmTnP<4?jqeHeY2!H8Y0q)lz+}XSc3aa@<_Ri~{c`eGMc)$>5AO-=icG$;lDEb3w0&5470&qD{q_zdOb*t`;K7* zdkWr+KjLVeRW>TX#eV=i?-IRYl6iR=>L- zCUUIa9W%;S9Zh`h?s`49LgM1vM;x{*gRn5s&ZM07g&LGoTxj9G@M$su#^Quu8McCj z9E{@I1HzGV=C|#5(5-A!&M!rZr<`8tu^2b9^#LV<|B5G_0NQ9P2<($Ff_1@TPdg@p z!#VZ9i|{gRt|$jn_OA_OdIb~0i5qC@#@zW@^RDT3Fp>FkQ9Xx%`K3tOu%`D(s$h_b zeCq*FgcC}m`sr}-snaU_;n zC^grVALH<737|ZB24_1a|F6aU7#oBXN6y=^t%rt3wg(o+Trj$QW@E7XX`uYS41}Y} zm#g$b>U5Y|>A92?|I^ft_r*HoL50Em+kux~#hpuyg~64S|B7NK_nxuNJ#)0_Aw07R;j#>%7xS$SDbCzCf*PfE*`%*sm)3h_6K_ z-3strbd5!Si)FO3yr~(e3<%J9HU#-9Q_77jqz$hOU8XFIeL0CnnA*I$e7IYc{6-om z4YqJwNJfkt>Y%$?%uL3JAcxf>Nn>CNA<0nBDb18VzB%G2sV2oeIL^ikqC>?We*!6&xn(i+d5w7?oORtduy6(2su}im z_9D!rh}hR8sANh^K&AcY9@d1(!JY)4nZCw7jPg=82}8Du3PG$2MKU0nmiLi6>vO{g zCz9#czR!gwb;@Dd5@}HGnVs`_o3c@(Q$NZc8C4#me&Q*pg8q&^1;mkvD+@;};)3mqd5^orSVLPI_9(lffr;X`R{K9atA;V&Xz()EK<*BnPc} z04t!M_UaFNv{U3TTdFJ9`m7|l3NZ=fIIVpJL0L}TkDoURg2GJilFrhae-Nek%>f~C zm0(0Ln~Xf1yrC}Uz@9&XWuvwzy!l2<=*+-PxoTEzmPKYDMND}Iz#G2G6>fcIM!X_d z&Y^&?gDgK)Ufa`>pBMhN@$H$*LuToG7DmLM$zqL83){St-m3A2SVe0IXz~MNc~~-) z)6*^QB5K5>J#*)C_X#8A4WfLh)qc~RlWlaa-#+w#yOgGE3@YI~6b;xY$Lg!iVrg(i ze8*#@p;ddf4m4E1hKK#FO&b*rqv<>62M9Vwcv9_hkjG`!7p`rF=#8SJ^5MrsuE|$bD zrixCh)Lt>f*omdBA*~QGrrO4m(IU1)wG||_H`XC<=FEq9|9C&aeXeuv>t4?Ddv48E z20qFy9-Ei_cD4Jhm4Np>VgIg4KT*_xBMPE@Nt7vu=dA<5$5~Lo-R}CyjU>k^{ysEJ z4231X94Ua6!$Yr)FO$%0tTVAvfqI89|C1R_s~LhACP5Wj!3K0)zRzom$@P^u4=u&O0V$87ej<$8v{G3jB=%$jC`_K+WhGD4%#}| zjOF*OOkJwPCw6P6QdI{`rNO4x6N3->qnb&vn|O_)46SB-gx-uqN5S?&sizVqELHAt zMu-d!;I;5k#pHYx= z+NEP}Z$EN^o%7)Qj}c8EhC(!G3)6`fnwsw@^V`|n>Gk@Y(j7op=~=+1?T>3*1`u?H z+$dVjHb`5Sa#mCw!)@ z)y{m$b^x%ZOEFi9xStNuT#?jRX0M0*qSMiLVF^T?zorb`b!_k4 zZ4Om<++dqA%|~i7nTai`0JVJ0=-8d&8Dbqg?TJ5-lIOAaF;{=}(0g9947Fz8MgJ)w zhJ;6@d>Y)2bSKY7wzpSqcB^T5IeD#!Wj8=&A_aTZ99&Mmn|%x0L!KA=>qkBs7Qie4 z_~_!>;>gT;ZLt@@mTp~NljFy;^=45Gj_JB~f-MHoSyocG`^H@+5wDL0oP2hN44|tt znIOYoPkM7CD)fld=K4n=6uK+Vn8te`CeClX{w5rLzzYr zA^^F%K$mrhOV_H#Wa$eZ$v6CD=X`C40ISn>r6N^0C~#g73q9yj`lR&9puwlh7UCI=1NHOT;G z=jp)i(zCZQxfCeTp?~Z%=^C(_p6K9NapFUApqtI|3CFaF3wD08D`$p-|*-A z@aV5*IFC6(zv$Q(y2TAMpUSIGLid&@p+7jX`iXT_P*E2&V)<2R$`st5z;_*=mP-Cb zLMgiwtKKMp!(bG>PCw|XN*P`b;@TLu?oVqqYwwDaqWp0T!JbmX8~C1xN!zlCzNln_ z$&-uArXDZ`=n?r>nKw4(ocd5f6l!cV4S{?0&Bi@_p#|JK8Y@-P-O~Bat#aINLd^Vv zKS!jTZ;c*2xLC$jWV?qDj|np-uUmM#TMgL%tA^EUxS1sQdX<)cV9=$qhOV`LlaiRr ze8#yYPSSVhJM>str@ z%&#ZT4CUm;Ga7&MlB6FhRdP1b#MR*F$HW2upvi9-&a1>-YHkidSkvgAH zmtJ$D_$^hrD8~(Zzun^4b06O4mz;(~5IIYH{td?(xVW>>HuViXl|Zd+YrIhp3)1Gh zi$7VJC4;Ke1YT}tyD%xNHf;}ke&tIrhs^9b<`D_N@SjyF zToCOF=Jr<1&dBhTy)D%>k?|_AEiq(sw%|}rx}~;sV7_~xt}(k1(|+(Wbu9Taqu}5sksG(69cP-#Li5KZoQ95WF^gWk z^Y~t{B#Ib8nOG|Jk<2HX9-=oo!rWD~k;37PaFIrEvHUsX)~7yI$Zyc7z&IamC*5zX zU5k<9dE^b#aWl@Pnp(T@`O$cpJ?Zn*Tkq2ErcAXMohX#jI-%gT?Y&S^>RjRBJ4(DJ z{CKA3D)K7+Lu9k89`~reY1bNhLLMQHp;u{!X^(U6b^UX>$s-Ee0v=fv4e7K9O>Q8O z6}lIP5UM)J$S0t*s=@YnB&~P%1AZw!Hts6IH#4wE$>uk1Nk8cDu!?Kc-f(Q%c3^Vq if3&as--Y#F23x}isV2T9ny_}Fc{qpqhoA8 z_!me`Vb4-Fk4mO z^#?EPz1x{mzD2V0$K7v7+A65NMpETTeCLX!BKq1HO7-=HvBVqc-@l0>xnk;Gj?UBE zmP_$|@?VM2YZyIj*}iDHcndGC7M_muGV{t~akcnI1G=;a+aFkhn$PV}wTI`vbYKQo zdOFu3-vJqPjyP~$77?gUz|a=T;UA0Cgh*V_wk=@Xjn4#R4u9l{ujx?P#Ug)!WAgW6 zVlU>7fLq?C3w=E4W_BhWNUt`8;T|+X@XEOr=(_UKuWF*8Ybpg@}3(7k=-^RH(S;+c&)o-V8~K=`5N`}VRU1T*zB9HhkHEKwL%9Q`)g)%%b0r;U&jDB zZ{@P_wei`r7(D~&g(PBj3EyEsNoXvY@?7ZGyQ2SY=_#@biFR1QO1qh7IN>&je_riH z{^$g)fXsw=b;+i#>=qvH8o^mzX-67{r`6Zx)4Ug@+7@mU4fIShM8L82_kpvG9w3 z_ZAME0TlH!*8bg1d2PToTvt8oO2k-O`f>{Xly37kbc%j)EobMk!6Yzq7a5dl#^+K? z&C^;@D(KB7`C+B5f8rQ@)Mg@azous>uqYM=n}}v~S1mIgulP6dv*#drLxhAvjEYg} zpgemHQ>5NV>PiwRRh?`F=Q!SAfi2(*_QNRwnx+Sza_e@#Hw88sGKY*#3e0!_wx3ue z1m)>J`7Tb<_)QDUlxUc7JsAGTH4y-Qex}oEe==&9OErvduzMkDlO!h{{mH%-pFZx~ zIo7eFj`%Ld_m6au zb(T{zCA2!a2TI1eX%%4FFsR^}w64TBJ?|m8TZVd6i7&CCOn9?~M~cY9W8CSBNmxN$fGv z(j}C8lgk>Vo5@^-mPaw4EDWhTvP+ryZIXp!?o9&2dWj*uJ=E#wgY@VW*YtpFEAe`Y zPEN1i1s}TEow7GjPrOuFW#Aaq6M{H zd4`G?@ZSut0!8%CJC2`xq!0e4!?9`>-_STO*FW*j{zfm1aic$d6V&E^e61P|SCxCm z1T-MVQ*x|uU^6x{9XEvG(LV?}u#83fPHP&WxiZHo#Rqs&pRb?L`jRJGPq{ zwYpD0L?>Tu`=2q%7?+pG#=h4Vu59^5z^5&O-$VGc&WO{^Y9*kDl6k1zvK z`!*J!cHDN#Zl^6h;I#|NcUE_{Ic;@WPW)PR(z}eIw+zRW-~UlK1`I^E(FTI2%Vd^J zEosWuUxl7bNw|}zh-Ue=+IMiO<8MH>gjDV9a*oKY>X)8(oN-(JQ^r}8S=d^3c2qHm zOb{!P_^SwfNg*stNa~V03Qql-bRJtFuF#saw?t4CoXos-#a`W-#fzG z8{!00c)S?eLH?mtnTyy#dO4vIi*k8Gg4RB>$_q$e`S=fXTs1~xWt&2EI^yLlhb#?4 z9Y?(7Kk%VEq4g!7n}^~Di-}5&9}BU?LwI2C*?L}?VL*&1)bA{$LKLbM>Xu~tI8LAL z=4%75xvB5azc<&4NTWQv)ti{;ih8%Y)^$zqIUrQm;DhE1!I)?MZHtU|(TG?E7dzJ6 z?q6aWagPquYZ)}Knou>yq6+;LI_BXut%82T4GLg^GfEm z9v+t}hz!oxneBX=hS%HCUDYKl?9dYBm{0f3d%();J$j|1>5gl4LxFo~Br)xbs!4I9>meQt%fT|j=mO}5xJzVUSJV;4 z_XP8Bck$T@JC0}9)9;;MgpA@4;on+WN!FA}`Do(Pa0V|d6~#8GRgxPmmaM0(Xg8lt zi&VfxM1IgomOFC0D$7JD>N6SeH0P=fb>SL4yhzgWaB0yeQ;@yX4OMh`HEO>pf>x2V z`BW()jWM%}Hhql@r`JSGgsXv8cXo1DG#k3CNo2Lb@^bd~*nEf1*eLKKc6@M?W(Bng zQ!#hRIJx&?;`=qiEniT2wZBwvL3&rSm!4{{y|$29^8fF(N`Z&|;<2BFc}&ho1*D~4ZoVGwd6n{OOq6j-x?$1etVn3zJaO)~??uNC zXWI0`9pLOg@;{UW$FpIE4K{NcvLZuvcBcvAw%H#s9?;Li5|*gm2)%i1qVE6as-3)=6faK2qW zICkqTHNu{9roRaprXBHs-(v?|Q(Z4H1`~j?!hPCr3eg?_@Y-tc35CUW2e@rLgu5kc zC|kn}rz`{2qPpPJxl?1!ZK3d)FFyq9Mmp%|2B^=rb=qkgx^o;*KeZ}T&4qb&iTf)B zcJ&xIR!Fl_(J>IUw1Hjgpx8S|ai=D?Q zYQ@C{;hI{36XFs@wnN-SlZfr&{{MMu)O9fjQ;D~C$> zC;;Z9nd?Bb3p`KOb#{dM`L@@PxXV`O7?l`%Sy$-odXxZVFBWJ7haUpUA(oeF`zMo=(YnaRMs*zo65F2 zn`C&PDul7;AjfjA(flT`THEPVA{rXDWz#p=UHtxE4yT1u>szDt`XM!lD_BL@D|fE<=d7dLd@3V5!(?5&?}CNQ8l`Khbk^{EbW*u7xH zHy}A|bq!*GZ~9NqP(c7w)wzQc7Yuh^@5EG|GNGw_G3ThZ@0U=6XN4tXw6&dafIWpR zYu#WC8~~I}xzSBM(g31S2Ko*82y5_9L|iG~-~i!5?ov+mX6cCX)+l5$S!KI|!Rg$t z;BA0741fvex#X1EcQ0IZSRmKsWHb|1bLJ2DBeSDYEl&x;2Y>lfgMa3X=Tp?&B}3nPP(;tSvw6Wv^YFL3!bY5%B=iK*8^Z1xV1+irVD zF}k=%l?cwuzuZJKz{hXKWuE0B6ms4>W@DDF`$Crmls-}1PQZe4VMpT^mi!2->O<|V z$xrx2&)@lw)^xJzNfGiwi!~QEpppUQT9N$8o1kO>o_-h8q0ZlwH>>##g+=Dk$f~RD zV5Pfcea0R&rKx=E59%DquUHy|a-R!xm0d}U>HijEihhe?zFtgkn!`Wu z1mAOd3>p=Ox8zL5V#w+l%>8V#FXnZ^CE~$fWWIjqY(HSP((OYLdDvIb1)8LeIIY5_ zHjAxuwXtw#@-9HzR#;<=aC`*BS~~`C64$hIx<<@LB0GYk4@x#!cDWBj+E+V@JYrXb zdAnK{H^-o@cI$8BWx%6s^`^V?FjW5-=JHcKB*{;i|r1XcK>& z^jecPUT))Bs%@Dgf}S*5$w!q(L@W{?LwNWqlf4xGT%r@D8 z!gbx%7xxy@phOE5So*<;LX%>A^D<;yL}iE`!LC5gARyP9T|9x+@_Ea&J9LsEt~qsJ zMXG0m=U>6A&m7)=bq$|CocUs03^J;4>t2w9rG#IqPOC|RyXE|pnY#51Vqc;Jaqg*d z8#V^$i20}*C<^~YrkXs7ykv6g63Lr@CggsdjF~vW#tu7_dNcBIoJ#+*dSjp)LcW7n z57fMF?wk0sVCzd2Rh$!8X|~O3jQ5+7->%j<1|3G_fC;FDVVR2`9=b5@-Q8< z6(%M~F4@8u)r75Dj!)8%-yLO!EnW5hE3TQkFc%DgBhYNY0gnPGG2!{3)Qn8-l)RAg zdTRI=v1>ot(ufOL#%hLLx%>bMYcAslv9dpgOFHM445)t^Sh%-lx{lMvUsJaJC|9hA z?c7a^_^tLSTQFdu8xO!^8_6TSATC9!PzqJ^h&m)IGOM`I)!^us>{{y>b9yii(rE=yiWfsc`){wMnl$Nw>i zv*sjewh;ZX+GF)&<-mcNk`bowJSDmWSou`6!ealu>*sY5rcbRW8cE^Ael{_!olC?2 z2zx`buNK6wye}Oe3idLg4Qh9fFo(nUfF_uwzd5C7J-SOa$ozcR!I*07;Rj>YSmB;r z=}gU34sd)uBx=1M9g# zTJZ1g7GnmU0}a5Q%b9;>_5Km&BC8W@CVZC>vQF+e%BzUkz=;D-xGa?Zgz|Y!Wt01S zCg6)5ukzklMKl~HtnTC(X_e5xA%5(KVJqga+HP&S6!A!_)r1yj2WPvqc8(3LUKts~ z57INX8&7t;!~--W!~QH(P$7bua-LN5`Bz`PAJxfjM4h8~CJNG#Ub;`y_+}qS8rczJ z%6F>oBg}CKW1EB$2n+juD%INz_Pr8y;BkBWGi&`~$I0=HQn0h^n&alr{0-U1DRyIQ zSUr~pAVqxlP`L#-oyfQhxI|pBv5F*I8u75w;m>^mT%Srx7oxBIrP# zGKSQvA0^z#M(^W|35`+t4>Qy(5tUtbO^@hzrK-)`JV(T}7(5&KId`9~CJoIu5I5=X z|FR>KnH_It(mHV~yP4jNAS;z^$vAqsq#BS6TE2PyW`{$5x(`MreYJY=YQlXzz0*Ou zabf({$4KW>o4_Bj^YYu0wwBMLrQT1P)wF)bffmYcosGNtzKjs1Ossn(<)7*gykB#; z`Oq}5TMv&WS){*P++EcDLE>KCB`L=&09FOIf7_Gx>agxx>fizp=|N!Q#i9j0(G*-{ znaW1Vn82C2!?$An`(NU-;P;g7fWO0}4PjeES33q0CO76T%%K-rm!!qlZcW&g*HJDA z(26uW+4QjoNhCYOl08iu^<6xnXSXqDh1ejCaO06Ux726q@PCGdE$ozyHg+a*aw4gA zNYj;E_|MI^vG)H_rcO+pEUUl`2MQcNU!5! z;@yz|OL6xhuymdovU0~#4@-qU&D6a7)npqJEZ?F!6r`Z{xJr#DTkE0ysV==h9fx6% zeRxX^MTCa$q+@qwH5BV->_3o4AsM*fYdyzQX>xTc zyzf1x3=nS+>9|)4bTYK(0ZC>2?&Jf0jL_^xRo{G(RXD9P{c}k%`ajVIOpIA1YR9dr zqa&*F`sjoZ#ZL=oF5~#({m;B6%dH~9hD#zbyX~F-K9eO>^*Dn-d z#q*R06rKysa!ph3xCu!K%}-fAcB>j8nHYNO@Y2{cvli;;U);!sS0pvnF4y*Texq(@ z6F+fZy^r_>Vk_;3O#xmaZHGxTP<>sgTTA~VD#0}Fbn0r*@m?-9;zmzI}!It&#b z?G$w0>$$YZ?dl71_m?A=@Idb*a&9b`R{D!|XRbtr5UG16{j6{a{oakgjKA`4I-Zry z5@mQICDc|mb`P4 z49CRZ=3g>-Vlg(orcP|+#xhZc^tjGZpZTVoG>cLX_^1pqN6`9PAYvHm3pviY-s^1g zTuOuO_TkI+Rkep%dD*9jX3x8fT$_QeJm-DT@hhGlhs8|2LpP7s1ij>9U%KW>$-~ur zS#HSM4b{B+)1As&>&#({$;&$4x=h_4xOIi4STVQBXBLDCn~7At5y*SOw#JAyfG#7D z7?)9))JEV)g3oS<(aT=xjkb+BAs2Um(^p@kMJMO%I6q&muj{mZl2ezQaGYu1C-#r@ z+f$@U#{ip60|ks*ACGHvI9k`mBYHDQ2vg9h6&&Q@I)Z*ZdNila(jzpuJ$dxOemjJD zg1$d?KOLXQ_$5V_`1`q@G{eVdHimC}ds1|D!sgVk;w}WgR`A9#>w=|k6Vg&2w{F-v zu>F$|kmWXd3F?>|r%vd-FTIf)M_|*pR~X3Ey$&Y$d11C#c9XXwJs#)H;9O zMqWW2@5=}7)guhu2_}+Eq9h`5YTK+@AAwyo0&npY2~w$gTa4=mqunreYdAPO)fTtU z1>4x;Z{i?YIx6+Jl2pG}r59~ zoOuE%KV82U>0q50rhbeX)&t};S+3dS&Z$DbPh~Idn5Oc(*Z~D0iK%XrIJpN_x9*y@ z3%!?Hd*9^BOP`T#Xlo8xglDfsv_N~PH}OyT7}CK}i(8wu=#mrKGBI-o*O5XdjU?xR zR&Kc!VsF^B)%Cy7R||aw_WMbdWP>pcv`miX<;-5AoDl>OU1@+KLyF9`>O?`*mp;|u zkFC>R*`z28{sil>&6(}~PxA@KoWHoj_~0#JK;sd6Qe_(Ai5sL|HH88XRLL4YaklQE z9*DRHx^*cXCQ9Z=UzrO!yOa%0j3gMjM*pkrJ&>+?804r*R8jenK{V&!s?RjCZbVle@*FNUzCyF<7V$p#M z$32u}wZYqbWP|An(`2$}kZ_EGajU4FCp%`D$Gi&9{d^T`kZooVEt-Ub*hBES;HEDe z(&be<)dGJ!YfHX#k-0qyg~(I_t|x}Ob2HU;y~wAHOyN&q?67Fi-@=g;R<1EcAbsY^ zgx+7HwY?)x>b)bmVM$atcR1!Q{oV<882e9Cw{PA{gs|x_v-xDrxq_Y4YbYSbO?9xo zkxO>-QhNK~ z`8RV|ncfqSMluDDcMES})RhYHbVGz!#5O-M~$+H(c@*PPQF z(+zd~tYeSOoYCDy-@^&D-=&~S8xdyJ0IO2ma8d91YtnF}t=&*4*(^Q~RpYU_P;BG# z#C@l2`H|7+lTM?NXM<{j)3UQ?OeSx4xp8e>xndm+sXgTddt0Y}2C}~tm0GV-2_YJ} zLPq8-^LU!+YY7<4(_jBFrpihc%&;~sW-B|PK6|dU5HP@5!_fW~Ttw_Kz}2vUzLEt% zwO*?^-_aE*ud+I|Mt?JWAPiJEPeS{!qX1;y2g==GvrtS9+;zj-58dBw z>yA8Oc}i&u4_#GsvKl6=mEx2c@;zes2g&2nSg&n1Jf!1ssqce$#KwQQOeygFFORp&*^=HQJ&KZ`>*oPQdo0&RZ-#4JYB}3QYIHeWnJ~6xQS&jt zSH4J=OS2004~sDA5rOWJoCI^biNv_$FJTJ9I+-no-;hhki1L!GyFs-3L|^Pq)oJ(I zTVAsrWpcWFgn7hKRuB6$nH~HzntEEcjLSr#rN)~<2Nv*OkJRzz~6+19NdW2f7o2^ zxd6)RuO=vgk^v$aRE109ct(Ai`i+ECqO$ZSs-{L)8wa?YtdV~-4acH8L%tg-C~7yH zzkgM0kB$z-reB@#z`0UU+O6G6i>+AGpC98(b&JaYEeEpX8zKR>bV#?J3ASmWaKO4m z_n)(dP>mBju_<-vib3ygwe5h`;@@e|k!qrHwzHw1U1n#Z{QU_NxbtkABxaQu3zv>T zMZdEno!Tl#dI$UahvdeTgO{6KzBS_sf}8evlQSisuA+*1OA@ zBMr%MBz1F!4(#At6Hwm6;aPX3oVZn>ERALbJ(`Nz90c~ydmeZzEjW^oeUA2n32HmNi!r|&$T3&7wD}@gy z?fk9ZkJ=jOmPH#yKbCuAd>twT{jnx+6f$fYEPnlmWMS>W>MqNRz2~WY-r<7Y6l)Ns zjHYmmD*8^R!T8ER1FX;((yyMjEOmY|Z#l_V)6M1EcYA6nzFI18ByKhTIeI^>K&Y2Y zzWpWaa!)?;M{LHSkxHRr;fanfpWhRPL1XqRHV;m)sl!nL8z~{MWz%rQz^JGvrOV-% z!dDz(#FQ?RzAE4)rW$;hX;nQ?@r`Gf80Iwp6>Q`gp z*|>640u{`C&NUxCgv}lr?-lV4*t*~MESb~eeR8X=Fw`~owpBrhQ65dncDj|oAjyi!?~DU$#zFP zda7#`qr&u4q{S&|hUo%+uB#@#_-rC2!(7vm9)7>ZQJuT|6pX2~!a_4WXhk@F`>D0N zlWk$%d|~OYx{-J}vbx{~aSec-C)*{v;y&za`eSA}Kl}VP-aOVnts>O+VTx2^-q?}@ z^rv5?t%Bl4Qp_-tyqCQ(z$Bi_i1_zzVS8_gRdr*uEg&Xf-cz>^c13;M;_c(Nb|z8l zZ}2WlBlp9BtY1ri)LL3tQc?ZT&P2z2b0;Qb^9U%k>PO>xiMd$EtQ!Xwc95;@`okDE z86s3v+*ECD^RN$5z6?ycqJS2A8^9l!RIA0)AYwi?U7k@}p!OBT)fqI9Z1T6FuF z{jfipIo^~xh%szwq1jB#HIa{0?Bld_0DKbKO&a7-(1eY%RT$##<}~sn$(t|m=+=u| z)q*&imHcVJ{fq0YJ*Klgmv8~fNynMd3Q!p8&|wL2Y|oli7u|F4yTbMpVDJ+D{}t_1 z3^-=gp6wwWnIV}`#NL@l_zQ_-tw5-0bXLkiW;+Gb+40;Tz$P(N$1#`t#{^1HD8)ZE z;ZMSoJvfj;vS)W+9AEYf;!tt(?d1Hig`}9Co{TMxYcm0jYCB*tuISYmV`3gW$a}t? zJQr`3MUz#!hwo+Izt={mko7q)recl0!63=PqX~}T;IJgnz$Y*T2Emy+Kr|qLnsg4w zd_*sUrNEbRn`nkBFfwNEgnLP#p^?9lbJ|2rxk&RHzDTyq*qPU6y#)TBs@({G_aj?O z*lIExv+J_x;5@6l*kgN{3NH(^{p|+*p|P~-Er9`@K`N6|j;=YM$LBo;>YsAPjyd_L zZzq1EoF5qifSZMZ<#07WbyR$hvS0EeBgRPjVnU1?+&Q$=YubC31MQD^h+2m&0mK-T z%bGiElIXf#A)df4u?xd zRTQZcSlC=MTwtrN$s`T)4S&0AHWT3@k zyB#dU#EKcn@ZbAQyf|W|)fxrw^5tNUd*Ajkx44UF=y}J^Pt&-P!@243KyfG^EUpBI zQbK6I&b|@vTdCTl%$2k!^|f|fc_{akhAt-9Poj|IV@#>4>FYV|18b!AE$Fwi%w63< z0=Z-Kw^tZaj9@x@==#+2#$?f+uE4m!YV;Jl@y!D$>7$5jDdE4M-2GYmWqrFhvcu3Y?WB3OO%{jVP_7b z7;Q{Uwwze@y&Hk8&vWk7<{nI&2j(#O`D2C=FE(eZcRFkyCpqT37eP%S>I%XL&y|C6 z$RX^}j&XTVsD>ZBRcEucZuBc@0 zHExrd<`%xP{^nY}WLN;ND&IMWCo?#eFD64X@lEQ_J}*(%^x`1*L432*NaJ-b_n#I=mu}$g zo5mO&=`vMfT+~`0AhC5k2ro>OD4jC>?_hzTf_NNzTNu$vv&RLZzybACFE46sRy(qE zJ^kfIP)~?gajQsNb;tvG7n>P+FC_X!SxVazo?4O3*x%0m7`};0sc>xu0qAdt>R~YqK9I_>AODb+PCc7?p#4Oxy7@X$&Gc~Q~Mdj2^O zcDbBeNA1xnhtk@-&o+1G0_=UTl(_o*H;RRV@CySK@x-5Yh0c0Xc#Moge-%-z!ds5H zEor~nTw7<{WBO|^L;v%IX%=jQNV}TGb193xMs;1^4|wLB(Wg}QkG&7J{gL9x$Ej;c zW86@oj(XDhvX)y(uWaFT5WVto7=LTS^&~RhDiyT+3pmp28{p;SFZl#kTK>sC`eOTh zVFc4viAJo)9^dzC z`9l#Bur@zAs(b7hef)#+#+LBxC;wUw1G@OGgLSkR@Du}7!@`IYAE9kuIOa9M z3TU+=Jv0et4&43mdvW6&Hv|bEwOgAPRD7VHn$5d8SpQPg+#@+82oX8+IjD-t2KW%h zVBVU=4kxuk4!vf}t|NrK9rkj~9o+YinT1pW3jGjWepgCz?aw)5%SZH3R@y@9>mt~T@J>h!O(Aukz>bE4MtdzAt%K|lRQf@5~;^}XZ2 zm$_tblGT^nmCtN5Gr%beWnf8W{oh+faS3e<>qt8JzT5TAs@ ze?Hh2;}B{ZI^fnlv(Lh1uq5jjNk(18uCpLLo7paBdRYn}$N8g>j*lfDfBp>6k{CQ4wrvN$*84>%mcxu_w5Id=F zc`YU;x^i5?M&gyrG@Mpi$e0-VbO#l`?fP&BnFW|^qL^)EuW4mdy=e_|fV-wKvKlDz z;;J+NlpYsGpX+Yu&*l1w@g0n^DFfFcM%rE)7$_Iz}kf+?gIqsBfU4*|Y}J zSd8mizcSu$EQf-l2iW`6S0!ZElHw9wez}c+s8|oFXP;r z!A)n96z0!Ist1`G`y^%E3LGrgL=&hNJ#JVW-Nk5C+#hZB$!I7WQ@EWM633hrz^g$2 zI7@V4;%igZ;Z2BmiP?UhR+o{X#!6Op8Oxi)C*u8|s?>f^gHV4{x^-=REN&~aRE=OeWT0$X;=Del>2m<+D>V6~j9PhzoPQ6}jzr5Z>NQTmo0l-nKyiQ*<%^{dVSRn z<=8CmFXi9f&W&-LL_@MgM&6m@eum5E2m$v@%bU6P@{y~{ZCj_En9#cu?0bASed&(> zN;=!AAY^@_Waz|}uU%V{s-9&ubNHonU}&eyk9TjN&)>^Mb*7T*=)ykL9qm2(t^n`9 z{o)Y5$mbqWnxzELsC$YVSE89s2XUmuWauNcsCw4~yT^uRu3$#ub&dN+It~NaWC%rZ z0zo-81a&wH4{`p*GD&pgo-ala>pnCmvIwbb^*69((t z-M5D$%P*|TFS_+EjP+~SU533)<13W6ZxBZeqY;DUs^raW0@o3%;DL(F)(`Hg#AO-pALM-HyGsbN0K=Goa(W%WEAYSK@v(J=az(Q{R;> zkagLfmu6*b&Qyycz(xI1qW`c`0L zdL=6Opc50lezbTu6;ynLsZ7JXzy}>;ae0`|{^)A1Gw7+4;vPCFz9Q`t9W7%hWUfDS_A{X+2OMAzNfX*A zN#JzZ-4MVuHN{ES*z!WZ))i|yDKs_0#kR43RdniPe_m1uG4J;(euyCLI=`cNZDM+? zB>kS@G)dl-tJ#<|;%tU)#M0FTuek9X5~Clr8r#%URB3#V6K;-aPYE?~MU~S(#lT<#lO)-&8dX^piSzBWdb2oP|Ddz5IP2gDqr)qv z54pS%5m$J|8?~Ka0{mN>R7|+Y>~>BCaYN`{pY3s2_nlAgbG95P;0Xp8j@HWGCNEwY zzoMh>_0FydlW}tsDogt7ptbq{Lp@xcHqwKK-&A{HT64@+=6zC7ITPSNkfqrO4Q6op zqc#J!4)?bJ!zU=H21E9ymhD!S(X<3I+s!MG!wH=+K!B_9i33)6kA}ZBBsyXy6BSVH znt^R(--_VyI7V*|Sj?1wiXA5x3bf2q-B&v?Y^z6dMf7N}FB%B&mX}Jq9slRNKwbFa zREao-C!FnBuwB3No5-^QF8cKBmoA*$tD#&uO|_?4b7ab|W49rf`25d}|RJMGl$uY+(!3xOOxei;|hQ9pU)7SdbGN@6#dmrvABkxLB z+tkN+@Ag*a%7C3?lFlRIkW0HJ zkH=z|zP{gAS^YztJzbiTqL-RfxGR-(Ab~H9;IyI3R;3bhDIXHDY}&B+)LLix)q9st zvaY88Cye<^BhIN$=xPjlie&0ievMO7c*H}j$9ZYTD<9Z<%qc4-#)yuJy`Sp4S12cjwe9h_AGe?CeWY8#kMlnHjg-n2NNj6JN{U{8RM`ljM|G#K3g-gg@VWp zVNXrEA74*pR(5HFXeI1}W3JYj^z4p&f~Ru54)#)G<8;h z%8$pEL+oN^>m*u!XCI0pNOBT~&5aWqGHL>{ElxhW$!;^<9FA51zB)>yUt2{s=p!IS zqMs^tpTGS+QuIT0q5BEiCKqRMIT^*yISw_dxT4x!Z*-USOV8g_8*$yEF08jch`nbz zofwu)ZCXI^w9>Sm>+w4le{p=41Hr3{rFXZWIaLU#5s)} z+A8M%?Hvx-P$8C#^$mvcKRJ5n3Wxz9wYvU&iESAvTs&cPc?bYz00;5uBYk)j zbjvQElqw|&jyOM_2 zRLtPsRqXFFRd(jS$!VMTP0?nV$Y9%`+vLa{jtya>0xcLpI1tLM6j`l~YBV{yc}Bu2 zY$o}3w~S5=F135oX0*}&sA+;XmUZTYth!~6hWvZvw%rB25tMlUU)8)v0o!m*K1qvt zP=_gm9qCaKve(>6D>88AoW;QeEqo+#6~CL(BDR1iX z^F_0IwG|lISZ85d+@jCvE@x!nc z)@wt+|4-MbqcOs&&GUGmnX}?pwWPP3FR=1GBqN@JsB`rURbRXO6krTSTG(v`8{Qfh zY9Y3oPuB$3#vI@7Fr-emp`1wvfY_8Y%)Z}bVqQl)B)y}l?mg!-q}a<$9{rCOtyacU zdT^uU4}=EiEA@>!ag2Kbq(kZ|E93q0mBs+Jxhm;$nt}Q?Ub8>-B1*DYVH>V}uN(@~ z>;39Q=$9ybx{3|Ytf5JBFHvz5|3$-HQQLAWM=C>(Onnry+oO$5rVe8#6V6Njokdw9 zVfQ>b7KD?vZU8#D%?iu`Z#avDvdr(C`q`Fl*;G}>vt@1Lv+F1eq?GD?%ktqP3-i)_ zCZq;)VolI9tV0mPdMLU@Vv(p=6)lC^)#jQ02>+E$>W(|@bNW&$a*@@N@z7k%RU_&b zB_A~CVZmDD?BwOr|A=wc3Fb^13xiKx9N_>eSktRCGv5(eN)`z~_%8leuS$MLXIZDSy50_*n zoe6|R=U)Hhozh8_^)DP=Juw1S2)2$af|3n9@YD@K`p3-`>@?7yglVEI$bRYg2~Xm- z3XRip&YJn@&mW{5v(h!yjnqHI5;mmtq_-L~t!%eje6sJ)YDma~g<|Q0-%MVoR31&(u3}bt4$Z>n{)b)? zw|AFX25E8erxG&FV*nPn>SQiFe2};dqQ{@Mt*b^4C97XVX$n-iF_e}Nb@i>i!bw^C z4v}xv;#RU5{yDLJ<(p;84-ee00P4HE*>u}_PVk86QmJ!TcLi55D zWH2{$yr0NW7vG^V0>}s(IM{g1opIXek)$%+XEIKLRD=;{ooX}M(Gb;{cd8#eCyq*< z{eJ1ydUm2?C@$t6TF{jyWeo(Sc^;aoC2}+UGD7M6U}?ph77%PhwJ+Z|sNY>V1jq23 zJN-8n--N_WZ%L;E@J~EG`tXR+FB>;G(Dq+JD!8LaL?zao_@UHtU&3iClm9-9NtY^f zwwSEI1kTNq6-`dK7YAP#<*c^}Ec0=`Ph7w9u&@GMviQvy`}=3V+T_as1SF6L(0PrP zcCHb0Me1^H^Ypgl;6ne6T9USnIR5TFnH7U!?{U=U|AfZ#W+Z{xHk@;iT9Tp7Mv?^$ z3PVfljb9%TesgVna~K)i^A6>F=SL>tJ5F*}eTd$IIoDJx0j4}+fXrTqri-^!3aBeX z-O_er3-#A@T}+9#xEirU~m^5~jvgsH$kjc(}kO$%RwhlfEZ8t|VwG|6CQkQ}~ zz2Dq0xlv@~H#FLq(Of}SB;q_Jm3)mi9R|w z{>*7ik%|?A_(iimmyU>gQ3G@5$us^y%)U&C*0u+hVY0{fPE#Wx`+Q!aPSkTXlS_UM zswC`A4WxYTV>Gj7{xBiSH2Pc6$o!1h0<`Mk;)^(CVF+uT0 zKl$ho-18(SZexbPI-dY{yVyIrZ z)aiS_p;k#7JLsQSEapg;aCAZ^zs4!>cYfFSQ9|i4u?4$i-OSShkNNPmSMRjbq6+3b z9HDYwHa||uK#6wFEQ$WUEWdTrwX!k1)OPEho2CTPtN?-?K{5pD5x3cCjfkU!Ayoy_ z=7z<~9=6d*AT;;bA=;(zb7c7-#h*(<|EKc(g2NC%q+F^I!I6q&;&9T}?q)neo7IZT zT?(y!NAH*a(<5zAnB8^oi`m+s$;TO*(NK~2RX*v~eUF-TrtwhYtw%>b1S8Fd1Lc1Q zk%WPit+g?&1Of)(E#7V4<}O9HKQTqMkrs`lr4oFz5e}P6kGtTb&zHp1@@7^TA;klT z`PeG{%KEQMM(;b_BsELeiEdKL)M&R)AOLl`_`C9sWX06-FPl)@S9`~S$)H=K6g#h7 zsm&v~tN-qg8l2?*A4^vm)`Z&kr9ryefs`C_NT-T)3LZk55hC5)(lAmwq(lW7-5sM_ zx*6RYoqNZ5-it4M+_l~JKYn$4K3jo2lj&+0)rU9$)H1-{LyfSh z+TOc&($#)KW_blw4759i2^kkkq9&ZxB!tqh7pON$ywB14JnLfmdN9#OP5|Cf>J$GLVg?jesY01 zK=q&-n9Fc>`_X6Eb%c1BbMA>q1}r}P=2)}!+sNLauT{7&J5J+w8X862#5Ch3#Zvyf z4K19aVQ7w6(n1SJ>)LibRFha+BSj+=JH=^9KXk@BpPZPN8tYA;Gl3mB0Z6tu5HWH~F z4SjMkg*bUB_$tl75vwf5D=2UfbJumC(;Og!+X?9@`LCY@-hH@_UqxeDBheBksCJXE zcOP&)-2Y8)2{0MBC2@Nde4(U7Cl38Ak)M!Xua?T&NiJHbtvqD~bO>)Gx9$STqaarTK=YoCYdcUs0fHZrpKjO0)_GmvJ zG{tL=9)lBmXE8$acAU_ESL=T6kA&;&nf>Qb2ZvbOXtRF)0mtE+hK}UG&(z+T(a#PQ zn-l`s{vR=ty+-0kxsHW0_vHVjQ{V~lZNqZu=4US)6=4(IQ3g6Ov&G;_d?x(di7%Gj z*HMNp>?9YoHdWa)I!#Hluj_)Sn@uwN)?kzTl{>6g+CuL#5`5u7R^Vrnx}%Ts#c*zU z84sz-e4ij0?;(OZzNu>~fg~+o-pD}tcJukPI+?wlxO+WDTbE?oA-uw;q2oZ$L_Pm- z27?w-mn?r#TCv^RPWCJjISto@Fd$fa_KCq;M-s0GHevAZ^F*^UpwD}ccQB8td|kDZ zeXhuy2rhh4{TC0?h#QV|Or)ZnZHQ|=p0CT;?BK8$%wxD}^T5$&SQmGnFpw!bZxu%H z1tY#%TlF^KyDEEOT(h}dY7&=JZS>6_#^pNZo5@h;Uma^0BQd$J4w9wVXw9Y|f>bzp zEgA2qDO}H%A5??)vucLx;^$~M6EF4;3+Bd)`=7di0U}NUKbbetHElFLO$8t(bacy? zD*g$hiDijBtjw_4T@7&&EV0LkidUL%Q!H7?+gLcr1J(lJ?+`zhfbf`}VPIYpZD~qg zF2q=7s+EH91iZ+xf=BMEy8W41C}Z{Jr(efFM6vA$G9+6womBlb=Y8sxN~hkTTu?T8CK1YjB%yP);e+3A`uiXwWzNG2oRSC8vBGgaVbxF)fDB0| z=|&^11g8r&W9AvVFaeLwndD9q`P1m$<9&_PzDCZjB0pu@Z0x3fbn}v3OA!@(!E}Bg z$5tUK)1oh9j{bp)+;MZ!T4kDAl*W+UKkz(&5lY9rwe^%zlk>v^km$!nrLwarao4Y({q_%?WMv_dBuPSmUu<#Vi0d5wVL^31oy_rRR7ZNBdzv`rS+R z{8>p8P8){nV3=Cvr)$}OYsE2rUUSk_dXSC5-TR|(R-YkmGrLo|L$KZ#<^sZDIjYtq z-%q=&FP6Ji|1Kk3_h~^XT-1weM%V9W{&$T;){t^o8&2YVy=LHt)v3NdQU;Dq^ zk|s6ht9mw!J5+80;!3xBJRQdPN5+NBYFC(@EyiFt2Giy_E_n&?@Ctu(8RnYhHc(;p zd*SPQ!!t&W_~=|OnV`bm0zaP3sk$2Js7?2Q!W8<``_#v~KA8A3jCNF;|#|0TVDT7|IBO!ohKFg@;(TaCUqty#0| z*eNB8PID#)uUwa&bueK!YeMD3jXlU6XfI}`FDx_FpTiy=*#Q%BZb z+vMr;Lr}XV-m2#o(zYM@52Kg*-xRO()L5(mgYoPggw%p2Cmz{t$~az=Z=l53+0pM* zi?`X>^o&qep=m6#a6nnL?8En}NVC|b`~%Tl#oq6_J< zb}{h?iytFNB5Zu5+9!wA;VoLG+KD9r6Qq}h<_1|;&DZZ4n$*rByd?65K@it_UXRX- ziT~{rNDS1qd5bhLf1|aE%e@x$ff2o%cFt?{C~&JxsE$@Q*Y937V{cBtiXx9Sd*rSv z%2;~(_aaFW`*I>mSY(}NK5eF`k)tk!=bKiP@0rU-Y^ERg>jiz>aaev7V~h;G_r%%9 zVMbkIzcEmF$m(42jdUhDtf#K>mmOUMuQ4(GgZ{mB9`Un)pOvCzXIXlH$EozEI)o~i zL$CVM-n?dB;8o%ect~}29p%)hyA;V9QC?dr>)%dym##>1s`;aGp6KYSwVfnOd)#YM zbMy;#xLs!OsUvfyxWzjmvgr_(wdS=yl7k+YaaoJ>ik>p&eCZOTC zdeea+8D87k!RAp0e7v(YtM69^#)vU1@Jl!u3~N8+&Th9%lr$cVXSmP>@H+p9-JVlx zS9&2@QGOLniFM&@|Fi?6fZ{+36t!Ee9;VL8)-mU{J~5xZHEM6#s(~NLu9TexaTe+X zr{x#`SJuiB^Jt8Oy^pX1PqvTUBxB>?suV{}S_)sjNiu6YUM(?*Y#yjERd^J9v26kT z*0zhJDPN2gO(m1_dt8V~Z`wK0i|3RWDKs&IO;M`RVF38A4557tuLm>~I8?P>D(D`Y zy#Nhlzk)lSr=hfsjY;N@!J#nDw0=4BwCoaOlfe;Z-BZatn|o@WPyAJ2e$jK;JsM13 zJdx^SvqY@)!IpNpTIh#xnzLJx2b~M~(J4=Jm5xpSm-rY`_J)}7Cad0p{D30HKdlvw z*V#MtQryq#1K~NVgpX|adP4K%zkKU;(iKlhhTapYsrDqF3^g>*A+s^qI=DzP zJElliXi9=o%e;9R7SMD!`dZLfTDt#Sw>Cys?EI<4zYfP9D>FoM;&uO$Z-Wp0Tg_#z z60iS!JCg&E957~Uk+Y1K1$FxVdYg-%FHi6+W<_597RBh}wCY2`{h3SV2x66v*&&`{ z(;FQ$NkUtH?CXBaEl$lb4s`R5sF{N%-oqvDkzFYJa5obB3>EB<_KHn^scgxGiKMTA zQPY^Y2>Hb|w#N7;Ru7!+fKw%0D6DYG(R~CK$MGl%=$jRfW}pANH&s|~-b!u!MMDzEP$(V8rKCm=lRDkCH`*||B%9iu&9G;$ zbp_Ag0$Re?+~FCH#y6)aNf$(m=ELU)Qu5oA+PP#nG1}LL_?Tza>%4G@_~sqpNJJ;9 zzy}VaFs}U7bR>i=2$>N=8U%u!l6LJ#dZ=#+lXo0we;Zi)(7b(h=TxO+4YImrTu}!P za@9HT)4?;ojjr@qO;;WWqy_Y4vOr@6DLgzHA`G3sS45c9yHaL3Hu=GOyM*L@!>Z5H z9M9!vv+ceI4iDlGDv^mQg1=7RGVGSKDj#>Q^xs%iZ*GV019EiWVSaaAx|UK#XZ_Ok z8p(n0W`F8(_x%458hRb*kL9JVXo`MHCqT|G&cqhzX3Fe1sIL)2h5_a&x!ws*7VSgY z#1fBjSM|=Nug2N%d(4UE86oWFI|mdx(%dv8u_xQ(@pHYpQoYDIr@<2@YGH>LfBAq= zQPY6s{UI;dr_RBV-M1#MHvg5qT2>yWc(n9l$6nCM}U4&L3JaeH>Tz)qqUIy*b#(PTwQiMBDVIqn|?_TdNL! zY=DCIe5jbL#m`oJoQ^V0U>AsR3t;N7XZDD<#M9 zJ@76rwZW`cTiQ$c0?ENdAkcH3-DAp_J)K152g(jy>`l+s>s5aW2sD`JN$ zC6_ip=X6*t+FWw-^)-9_mZ4i^9&G9saPDcFOm{_-Hmc8SW!pkgGwR5TxL%!?XI8d# zBfF!d-%rp@dzlaTI4WuCkl>1nWCE@{6@@@tq{;8c5?OKhuNF7@)KJ7V=H}0wsy$y( z+YYC+B9$z2c$0jJcrJ7MWzW}c$>}-sz=X6z;*1=gkU;mygo(KLKfb>kcR`Xp5X(QB zFfOIswjn8CUE8eQLdoZ&0J-5_;o5I~EXK+SNxoJ(D)E%d*~mIa!FmPyt~9^z8a*c~ zJ@c%(iz8cuc6LpH7p0po?KxJqBKF3fFeMb_{$#hoJq<+XAbBs48$`$U<&8YQvQw+` z?rt_8+K)48D{$ORU8O9v_1tR#p`v>6M1-jV1bhqh}4GAP&G~GhnqIyfPPgFSNF|q2uz_|5?(97mmT@@RW(x zdIsv=JU_EmVl7o+*V>L)4intR|6fSGpY%{2m{aP<8WIE?K|eY)S9neF6l6CxF`d)J zU-ma|l6opIn7i*iS7^(rLJ5b1<7`c3$wsq^EXP~nL*H}0gbpP`G3tw#RGjg|G&IVg zckcTTN0U0bj2@AmK<=ucfCr~jpKm47D&nfb(4RwSBSN=t%sZAo^>J8jtE9os zOSVB9X}LSj>*TJ=uxlXa*-Y*A(~cBFh$3UYB4Au?Mm1~& z!h1r8&ridYTt*A3W@ZZd-zQDNkEekvjRZUJrc-Gz@NMtr5?8mZRmRS&U*Ze#M*fIlYSSR zA(Ddn@9G1a20t>%A0dnmJX9^8#agQ<<3rHPe5oszc-+>YB`0vwtXy&yW@>@vF zU$VBhe8G1=eN^*itxsLa-l^`DdlB+CNX4`+bf zg2#Ivg%g1u*X@2q0z^pir?%RU#D9+d_m=1L5I8pI2-njkzPz%BwJ5?Y{WrN#P;^z)kJ&Ly6u|9FhPWn~=8Azzb(O z3y_%(g4KnA@d~d?wHDO=GzMec&iaWfNB&eo%yd_hMP8*hw%ZZwPr)(f4E+W67ov>` z$33@QniZ2j$1V_xq{pb4$zBr+1NCu^oYh1gCTZ^XwaT!M z1aC+*T}TS`Z@%-7)em>IgVBZFc%a;Sesd*=sUy{%WLvkIUO9GqrPWRkzJqzXsk#Kg zqIjB;mYjyXwkx&arz1Qhf)eSV0QHnR$#tV=4E3Ve4)w7MBf#K!p0Kiu3ksU-^YH;y z(bDyG-ZIjVlzf)r3cT6z6k*tFKb9;n8dTYShr;Ci@(rAm& zLSI73<6_v|o2yN0YxC~5kK83o^mPg2ndzfquij6s-6Cs1E!I0J?thB205y=ubHBKA zxJP1jhZE3|WH;eg3#J-zHWQO~<3LMB-N3Zt&Em=!dnKS5|m=&SKJw z%Bk-t=d0gL!_Tz2&X9p^(Jv6T5++(lv|Mu^_ z0Z*LB5p{kLmrLjqK{JflzP6-Kp15KZXm=oU#aV&$6!^c^Gb&ki?`M~LS^m2#!qH^H zs`KYHXS<;gvj@>#RO{JTQiQisUR#7ZJtAk8Gq5$>uh#i??L{rvS&;Ym}5U;SZbTZ>WE${wyvFh80UK$*&FQl4=`GL=sm$S2qSNV75EOFv}AIo23 zkQ4dZi?|VrW-&_T?N9T%&y%{y9|y_EvJq{ZOfzG+{xc4n@)yvbYRZH)&sBsn3N%|i zsM{^1^W_6DRnzm6J%|#&l@rx!#`#Em07TL<!sJQ4Nr=%4rezR8Vjj95x3nFLK;jl!y2t zHPx@pACTl~A<5ZMs=tvoQ*(#rVIh{E5`+!C7+XCVcK!bL-;#Nz1vZ1Y@3WSa5m}8& zKmN^nDjq0NI43fY(5?CSS84oLn^5UZ;iN5I3q^BH-sZ_-gUF4zGn(%;>M-M|^*o{> z00UX)_CnOJ}L;?M7L$x z_cNG}wZ-2%@Kj_5EH4$p!h>T#>RlhMWHp)BMX87OH~zbS1J%J={$*31y6Z>z2B5! z&;WHsoY4TdU8qQD70RfJSa~~3!u)#Qnwtr%2wGic9b$xakOYRRj*KM~VlA-A7_?7Z zj-#!*(F|m5%5bI_0X;a2YCw@v=fzQ@780(XT(iPtqj8UR5pfOZj)Q$qfaX;~1nU zYN{4D(l{wQU6q`?FVgj)`8o>FwlaE*LRAE&hlu z{m7Br-KK~)xoFx$^GhlZ>^9(FL{uA5o3;9Y_d^iPQ?Wv!3rI2H08G@s#60BFY*9Fb zbs9`c;d;vaw6-q8y|kI4*jj8kjNls|;M;_RBj05TzE#)qjcVcyC~u_F$m76Vfr16k zB0V=0-KtSB3_O}A7oPDA(6C$4kcQrRAr>zrK5JI}h&RKYCP@4#>tB;MmDy9g!o}`F zrE=ACL(XcW6f)okoWnaDhesc^#xmiuW=_9f^Ms1-a(I_2-KlXHm@@6^=Wn#jnBK-3mmn@MUw2n+L;pn9tf3*(xe z!ePIe4wT+qal(5jOZ;=U=7TCXTVsX|$FZn}p)47vg>Q0@4Y!2=i=cF&ip6a+b5}*S zr_Bq0>_)TKF?##MAeqq#_Upp_t8Gq%{3?ROzNEb)IZN+{U2CRdz-&v}y}&owEcwTT zrw|Md6cC02X&W$1=`r>cr<^4tuJG@5`<7HlIdjT(t#O(x2H~t4;9tYVrDwt7uCZE} zLoGSdFLd>PcW0Gi^~(D*-`O1Si%3V&#DO*0AGHiVvg5si9dXev)kI3&cvu%6d+vB% z{<_Z@Cc2vX;k_{IJ3MwgcPz_#>A535AA!8Nekw+uu)y2ZXN9kGS(J3>D86ro3gros#=E!3MW5 zlp0lh=AneiRvH#{KQ1IMeOTz7=EMY8L0CxJ3qds4AxrSFKS!s{ozfSyzz<{pctKzz z=|VHyJ7jh=si180^%a-@?csJ2NcOq_R4&^EVilk^yQ5Y@nyi4DbNlLy#PC{^6&N1J zmxrjxMILHVkyb|wjAL*Q4Ii54F3+VeSjGY^>#rRZLp&GLq}k*b=3{s4 z6+BLC!COQt5{v(~y?}Z3{y5XbG~9{(5lTgGqEOB_3RGrZhE_?eZr&mWsFw;>EW6pM z4G5ZB#8F@8366dxss-Jh$^_srWltyebDjs6VLNd>Q+-d{-2V*Yypw74%ppKD!Q-=l zm;a#H@-~5&_G}k{0%rzQCmTO-#q_MnUmRY}B=FtEZ}0TJNAQ9GY}S><>Tn%a=WFac z9deWaa7jBkr4#;AX`uH37sjEuYTLfw{;KP5lxW#?69@9A(Y^@PhJ8LtpNucjw2`>d zJ^GDr!*SXAt!iVpm#WyWgxj6yarei5;_1ClKR)mtSqA)1u*o42@C;Rou2h9tFP{HQ z2<|KdH63TXS1!^m=yR&BdLh?nNY1?Cu}I0a03+4_90WwTTVE|Hj$0UHi*VsJ)GAcU z8h4(eh$rn-AbVBT#iM!Ic|(7I`^>@B1btTh8Ep)ds#ky1Hz48HH#Q%Sx<$!=m@&rQ zifUVb6XS}omgNY`b^Palq=Q4Eka7uNbg{7&MmuB+@FVK-?*ipVsbQdc|C~ zZ?C`1p1kBcU)J*aDPd>ntO&qdzhW=>)YXN(@E(vqUqj!rZuf4cCXYaO9bB zL#7w6FGro*v_+M>*umDv!}y=0t&%M>Lj3g#gG9qi~5^7mdID} zHzg1UP5DNO<9$SN}o6Vo|!ciL4@`m9-`zeTKEiwVlw zF4$=ZDUdPR6V#ife3wn0os!%nv^KsNlOj~J8=F|38_r52aXj<)~r?!4s5E_ffSg0ED3MdJxq3_@PqaNRwkkRPa%MJEuq&NWF+L$Ij#a7mkF6hw4$#ag_qNk=dJ>Z_}V9oTy)M zKwykKO|~uTem@CzX(Bp#W>2+}YmSq*9qTj1-t^a!+D;D=tm}6JRk}w>7WM}sVl|@4 zQJ$!HuMT!{DOq!1P~Vz1c`Rf$t7=+c*)E>?*n{n4$C-<*G;YmA%PhJx0)( z$bzv0T2PaeUgQeFOfFj3;D@7)4K;jpIt{>8PcDi%vbq-(&RIoY?AH}NkZ7h$6Gcf^ zyCXg+8)M?-@;edvoj)S0WF14(&T70Cd&t9L0&HXC5;ChyA$VZ(7?Rfhx=(+*L@;`c zc`FB1R>(fCc)_y1X-M)ur5QfWEgMKawjCNyv=+Rt((X39lBx8&Btf6BnUoX@-0`D9 zf5ZjctEOlZgMLXEIgR6SGHb?Cjf!G%b5^cbGk2OqQMn|%;i{~;78W4D`swD>QG%EA zq95-;%TDX<+fMw9P%m$FmzNd5a8&9!`z3#iV9 zXJ)@C=dS^&dPGrUiyqgB0g8HxR@L{x)qj0?uUP{7i_L@Jo2g2w?*HY^Jn`Ey?btLS z+E)dmR2(+%s0-c+18&!jfP)$`SxSW?%48fnu@mC1iKM;u?$9p^{Y8ZsT-nXfbz#+C zsiprGyv=Gh*W57GaUjK#exQq9EHVA;?0;mU1KL&YvNB*@ptMRN7OrQ6u*1T8c;$E~ zKZ2>dJY8l)sk-2eVP6<&vzEA8((AA~wTM)}&^cCvBbq{JP*^i9ET{FLC=KY?qUA({ zit>IE5740M+H10k68p^ox%ux}cz)haz1*G+WSgmy39U_BJkq~$?t1zh>~cz6*Qqg} zMJkb}?+dh?_UP{@sM1&k;U)n!C>OMce1f#@b4hN6GB;uR!bs}_(`?9a_D=Hj z{}9_IA-%gzd<;a6YqBf<|)ixAx zqR(D?@SRXI@EKXVo4bZJLE^wozHEHj;+HvVrkAEz^yhtd;O|GX&R^fJ=WWHS&oER6 zEWJC7IwN9i`tdW0=FD!8+armado6P5;Fx}`vEd&0zx8E(Rp6pZ;4=e$@2)&W$ zmXAHS?<7WFF!Wn9b{OL$wMMCa3I`y^lSOknX$&irO+sk%9om| zGp}L*jz(+CD~Gac$nl*P(r5LLiQ+)9OS?_DtU6qu_!v~PjX}am*67!4JN(<JRfcp=_}Ck2a#fu=Z{fX3u?aNfOI^8uCXVwsS8-_1EHS z3?JE*!5A>X2u`Pg!W;!K@+O#A?yE*vJgqgmO)Rte_NN|;t@YvcNLX}KVELL3_;p== zC@{lI>%Mz?*85t3U+mBWdR$Ci_r8*KWs9r&{G5NbPd7XA^*NSKkL8H13y;6zi$~eb z|H>Om2Q$d@3&hVM=ZE7k?L5qdw^xH_?ruF5$&@+<7lGmoIEqS#BsQ@o^PG2~EpU3X zGUWg(m&uXMveCSGm^lJeD>h?sXVT=uy+15vuY;>to(V|bA2P_C`Yv}=G_{E$C#fqL z@~TpMB- z(sn_L0~2qM7vx&yZ$I~Ii7DJjJQRBdDjtpHM z-FY#b&xp6)lT*Q!`Leq`fj+=my|}W+ZHx=AUtKJi!FVU(TEzMHD(CAB6+on2a>!Pu zOef1+iQGTEulYN4!RU?^Vb{Cb=IUbVxg9^c166MSLzoDV%_it>c=Ah`Di&Mmcj^LK zB*+DmDC`1moDtJZRvw9r1k#h)Z(RpoqHiPZQpv|zD|7j?sDv5txgqU~Wzw;e*Zut9 zC`oe@+_xrW-t1AY8p!t&dyW`()kXI_=O)(+kcO4!3^B$C5CiDNh%2O&XCubjb93E& z+Q2>BFX?*1!(ljs7t9GsC>?-krL2hdwsUPK_G#^Y1|is7-Lxxa3`=`6B~`?Qtar)( z-ayM$sYIdq6fn>h7`bEy3s5%; zT@a2>p~n76?c&=TCv zMYc@IV$$8Nye}#&3U(=jlUmpu_jn(#o)7&^R(us^xus2U&E5e0+I|EHv&Lz=`B-+Pv?GU~o8-de<6J`#rkr91;s`mp{%%1*bA zW3MikKye;h=ob!KvYM3lNkut~j?0oWH$kG95QiL@jk(EQLeRzUP#|q4iIx5syELBc zZnNtZ<7FCe#^p~yqY}4rHq1-+4QuKbPeko@_L|j|(Z+ADW|$-g08Ce6o;P>$JUV${2ZKTa#z|RTqv8Jc_u8pUmqbmi;2v|;OD&7 znH7GSu42M~@q_ZvNsurcBOA{p&_NFFQRMM6^sd4tk`bHWJYPis+9>ESXb!imI@7~@ zl$5@H(YN%~f=Q88!|q&Zt#L~fA6hl*LV9+ftl@DcN`B7+aM5k+Xxqf`4_xhCwMvEX zsztx-Z`h`O_5P4=Kp|(DQ9jQ-0&7NPi!czK4!YF#{_XyUjJ1M9walMP?J;SxXB)< ze^ID3ftxL2-syUP5xrS*w07{c1_BBE z58Soi1*|;*RG(hS?$~!R=C+qxL>PbLciiwFBwTcwyd|c1!mLo1!^V50N-(lsmL$i@ zn{d2LpZqJDhl&E!H7?YSPHX0y+h|U+Hl5_A;a(T5XzyH{{duX0Xt0ExRxDC`P-&6e)=rQ@$s2^X}-ohWYB@sR{5Y83cKBgPiSIC4BaktVsOV zf!9>ixH~1sANLOIagsMHVyzef1G2KZkI`~n%anC@)ooR-+cP%wc9urkn;#sn`N~_G zgg#`!CT~fgyPpm|g|_b7*O`;UBD!q|3B%sUoHvyBnJbBr5}zb#-#2n`TVnk3>dhz@ zwrJZoYNMVg#!XM~d;Mdr*gg}~FSEM&mqem$y?COp3ur`dJ^C6j@^t<4Q324XMGBQ0 z+Adddwd|pJn666Law2nVHE5VqC=NI^yfR9bC3iXY?0u(1cBaBnChUIc+}ytV-np$h z(Sp4kVv%95IA>>K>}|H_jy&+&fsD!o{$>$oyyHN$^}__L_LX!$Haq(m^H=nL0|Kw2 z$W6?qiI2Bi^}!K{OHvrB>jqY%{DY|13S9*TIxlkGlg0Y3-ZokIzaz(Rooz9g>1E{{3RZ|p4`eL=Aet_1WwqrI)pK4`!uzDo zD>=FYq zPCv{N6(c7JX#y()APsNxl4Oh+jV}fVUm18u<^QVQaV~9RNj*Pn?%MfJPK5+Okz8Ma ziRJ(zlXs~6!*AIfcuv~V*>=yAJAQMCy-m`_$ih`Z?`YHdu37VUuN+EbnpAUd>zGc;nIw%9hiBg|76p~*vH?LtNQdhyt5{}RvzE=7)7G1WO2hP# zwKECNMz*{kMxG!~&dG#CT)VtQmrrlVs0NQVX681McK(dzA8g|UU2|D1T|eUiEOBE- z=HpX8{mv-5<`pW)H0W0-D?eT~3Fvp}+|`h)>hvuwXQID2a#3(fBUTDMid~e1 z0(KjC?p`@ZNmtR?I)YtuN9`+DTzXTYJDz66K4Me~A1dP#CG=~L3f_y-$K`DQLTNgT z(4`-~3mKOG=U^bYj`80z^~!l1q9p`2#BZqFX04cR*p>hTVQ14=WMS$8-+@j;SeQUhdx zpF6pCBqqa%_FDku@5O!Tytx`#JAR#d7-+K&HR8~x1>9|LI@e6PGAKzbA;3f7@n*=0}E@oX)*a=RiBJf~tx~y5NkL@6IeRVD}G2o*N zO%m6msD^W=y!rHXX>JX#9QtC3C`3}Ws`|~1dvQc%O{sAJuAOpGB)R$eX&#=~l#gMH z!0P*euD`wLVkM6TkL!)T?JK(l$)FRf0K_jU{B1PM^F;VRrp z0ShA=M$w^&;I9Pw!$yA3D6%Sgr_~#ivb<~Wy^NH$eR1tt*STc#Kd$^ppLEm`{9nmB zLM2*X5Of4eC0(XE;GA4oV<{;gY};z?P_a&y^KRGGPrg!c|5YYmA{~_ceAexHZoS!s zT8vKBhUkIWNAwYeA7m|O-^G|*Ec6oLA;f(_qnTqx@o>*JOBL>(CZ|fpWkiJv^`csC zG3fW%sIC2$DI4zeb9Bu%!W`gNTP#vi`_kW~g4t4GdPhoBP;qzSq?A^{DOat(%dN zf}VI~1n?gYf9uPp!7CJ>-5yA*%gF3#)^IRQZg0Gtz4cDVVPM5Y4xON;wr8zPTO<#v zt{)BG+vj(`)onxnJ9hvt=CUxlQ10EG;#FtY)rF8F(B2rRnFH=xmit5@XI6_|2C_ZJ z`fJ=iM-v7o|J-z;kVeE& z|E#?q=bOoMUbERzy|@}Ffae6_A@I=R;dpIwi`)0W7ZP6`T_d|J+q6h;f} ze}&fW`%+E4(mcFe-FtOy8*y}!}_QwMV5b^e@@;6b*FHH1{M8TuiQ+f?)-~C8W z_LG-^rQfDBIYJdqe_VI!vfmWe3nd$G7Ym7fmnsdY^WF{=pgodX%#_A}2N zzKQ&LJWh>=?sv&f@Rs?V{hNVQD_d7MCk`+|_i&$jLkUKKS~*e4bYl1Q`}nn?J4Yy2 zhe$AFsgXUDZ)vc({O^aBtt_{EC(LATcLlYVMHkI;#0r?7bKF!sdGxfYeO62F)N)$q z4xLijW5CR$40=X(ucR~X3afX1>*{i$@$G#D-Ty0blsImHW(llz&gsaM}OQJhf*#o~@@i5C_ z5O)sF22F;N#;Lcu&wFTkwr*TcS`9iVw%+|#nJ@RpQR(^t|Dv+nDq~yeQ=H%_G<8t1plPSXk zB`o}w9wsE({ftCHOwjN7l1Vaa zNOXkN`b%6rr!MY8T^F4hq0J{%Lv6!q7Rj!?BAMK-i~hydwyWKu_y)hb2T&4rz-K; z$bwMpxliECI}ck^yjAzDa#D{b{l?4E=4kMp#E>0Dc~5PXVEh-~V5g zLiX_`oc;Ol2_%yyTO8PBug@$``<3L|&k_3q#(ibZ>{+J&{2xtU85Y(1bxosypmZZr zN`rK#guu`t%>dHfHH3g5CEXz)-QCU5-3>!`=fJ$<@Bh5lx%hrKbKg7GUVE+8`qObo zTLyP~fw`E-z=n+I3%OnW7Q;~eIpem+(^9>F!n3N5?W6nCXKZKQek*Y5oG1)`IcU^Q z(_UQk0bSb!+g|6gCzy(pu|~&0~WTrb<~;2uAH>wU|T*nxQb16S^C84 z^xN@%JqiF&^i&It2D4564pTM z2OK>b>X_Kpf_>HehQdd`d4LhURddW6o1kA>9%SiMVnFYol8>I32%! zVu8?roMG`mkdEP*o4LZ3WRE&3S--y4HAGt91})!%WI%QI}$?om40#P&8BZU1oj!TL&g4INju9s-l-PEMD_Ms3YE zB980V*E+Sh4@bzOB}6BzRzchDT}aa|A1`}LAFRvz&HmwTPt&B;@Dk!H*_g19P9zYP z@mMi#`3+t!y z%9`zboqDrF?sQ0*^4cSYz6zY1^2HWzeI?9kP{j(uP2CZ*8q+*^L+>@Mkss2ek%@&3gr4vw-nr&Q3 zI){eZXF1s6^gTZOo0ilm^xBN^t=1_@T_N3*vJkE&Eq_bvM8+}41wlBVms40uYUJDf znfJ5dsxFl~N-pb#KI!nbtt`Krn_RgA@b?94;+9qh*-L8*&bb!3a|ZI3S7^}fs(V;i zPdSBo6mJGttIArRF8h5W{#;C7-F**ec<-M+%DNvK%y1k5N>r2VvkXAS*|02=zU!;3 zesN!4*2R-cY`5c~SEc2%pJYw}IgL0m7?7_mTrQopui;B^89~TDQ!~2Y)EPFEfN)d# zfPJs;wf0IxG}3-*^}nqV-ap%A&T{dbdEndCeKxAjh~`4Ot<3p|eWci+Bk5`WKN>ahk~;lP>|+R;@2puzZb5v|0b=%OGC5%NZ#?-C*5hkoC+(q$~yTZ zEQp-ae8+pSipB5)J*$Xpy<4+_Z1{>Sl^z_ApZRRc999wBc|g{sR?ZHuo&Ossue5W+ z4BZi4FcqC5o_^Uq_?^C06wgU^(V{qUvu}oZPd{)2WqSWNx}27SIc;VWhV;e34$&jC!S4(1>1?;3lPAVa4-J6A!(2Ma*B__8z>ExAWC_KF zzP|3iH_T$9COn%7{-)@{f)-BQhx&BHXBxo-D$LW{XuAK*r0*0fc$Z}-Q*D$iSFSsH zwLLsw`OvB3RG9lDM*VVNt&hn}wQ;xi`gxm)#VZuPYW^=%MQ_0>m?}0W98nVd3xkrG zf4`bf5FZo?>Jsal@C%#jdIz@&1B0z=ZnWWVR-Ewsv&%O^alr{m;8Gc&&LVnyC{3f0U z{KsUsu8LzCFYzsueri6K2EW?F)-D5znk&4xRgUvTx&9j|!&Ps_cRF+qcw!;j+^$LK z-aASI(x-=sQc4GId+Xm?!c9=X@Ys#gbYz<{W!AHJ_uN!`(Co@0!MgoTgl5fiByWI@ z^ZjqTnm_ZkF*$q{jnvphsR?VIRd!g#?y$5h2;&7oyN zlM+!)Qzl((aj}oRzAnngz#d>kS{m%?{@N;Dd~reES0tvicW( zbTIRXy7+ZNJy7@JgZXNC$!<4mh@lN60ARV?*Uj0m!Z>G(?bF9} z*t*RCAZz_!3|&uv@y;=rI=Fmr(K?7d6?A1`b(YJX;g-;v^ybz72=4i`NJ|rZMJ?4-P2%&j+P76$Is~h35`0kdbXaZ zfs#PDZWDc*yg}o4bR8pBN$cC=-Q9nvIW@7n$5RW8-SIuu(hkx(CwAWVuRBMrUFK1J z1o_^PLV}XqH_|+Y6KHIkuLv}UWU73{{=e$cHcUFOi%%;iwbaSamK>d(^-2}@ZR_z7 z0XXvcN00zN&JS5w+iq`tdu$*=FmRehoQ3^*`o@!y%g0RO_(#*%%1@yc%=HS;lgIsZ zLAT(|;)c9adbuxn*7Rhy4xcg`?tLGSsPNHR*9N`;^BbL`b_Y@c53z#Qlmn(A+JW1L zprrwmP9ezOrk=p#S^$POQ`S8xb8Do;zwjRC`#@Xw9?!@`r6JT*X*h z^{*1UH#t=YjR>(UeT;4U6N#Jx1G<4C-zQGq=+(NT=w(lRnao(iF8 zJZLLOh^xh(T} zYi#`s?fK`2GHFhmb$#x?jc=JSiJ;b7=y6aJzdUU@A;Q~Er+FOSEnYYn(aX2%{`Bt@ zz;74aUaR9cu2+vnZV=w%#=^~Ncn7QdgC)~G#Q0HttEBCWxp-_Dd1Q+1yqUKy75+OW zhavT(UVx8S(_a++2`TIxF|ncD@1f?Uk*bcd?xRGD_ohrKGzy>E8NwB8iO3x#1Gtr##;O6KHRZ36)YF5IRb_CM zs^}f?Fe%DI@P-fnG7~Y2AnFQ$ncUCy_ZH}&Q}1X|UuK&|orihNUrUzC5$H0b^U3<~ zihL(JOxwz9^fY@b7iU5NoW&mMNv||}xEgDa=cX^Jk+#8jFb3{#5X2FV)dI-xGVC40 z4G$Xd3;4}10)8Y)7)PXR$6QK-9D+SU$aC4Ia2Ac$>yo?Jb})`1`MtqUa3|D%6ls_v z6y%G!AzBcXj<*Es8%m}6x*-xoeKpjmBogfkZg~KJ@fmCv1^_sLHs@D+%=0Iix-VC; z*jaXl3(C#Pa_wa{7p}A^V>)2?UgurPOAYSOB)?a=Uv39fr0{%hz#X1xLj!#Y!TZRde%skAvW^SwRX%ai-;AFU7!H|mYklp#hq^BT5u z{lYsp;^60+N548ZQzu|FTl8A7?e3XFEb!Xx&^2FaMjCKf`2OxMbRlccKCYZxAeTlV zFa7rXNTNitrF;ri=DT(5w%Z;Px|B4*M;S2AaX1zC$9gm~Nf@&wM0u83V5AgiL;;dNU2O%$S6 z_q9BpwMmuGZ=#~S-T#!#Z=)#>^WmQWf&KaPKgt`7t<~`(6WUcI?#md3QaWUTxPfwO zlgW$}cWZ2w4#qUP^}a^Izf;UR2CmCdJ^sh^_BgE))(_u{@lwDzyaelGmK8k*=x^uq z2Pk439O*w+NVCL=Kyi=qoBwJWRIG?Mw8sOFFeGhFDIFsA6`dsf7;32bFYc$&!v^Vp z=xRyOQ~iu(_}cr{gTGgzE{ImAr1OLe5zL%Nk<# zTV!Wd%1t3iY&cU?ejuZtTr=M`{^EtRM45(^kS2v=YK_hj|K{ez&QnAClqj_GJ??((~1lX8^2EFbPNnlq{8 zey7h3P5_&^z3L&mp1z#gX2N!yyYD)p&U`9#;lhd>_4RHG&G)b7s$UqSk0%LzBc0>z z69v|Om@#ObY~3?FXHeEXmk^hX^?zYehh~5DaKFlOaOLD{zmjCIcW<5MfS=n?cxpX^ z51Xe)VVLL{3_#eBHGWA+8bs6G-FGhVT9Z)FlaALu_&nVIi0_D)ot8fw?rS~E{aGNa z+P-Ebj7PWIziAD{^dXebq*dpLYAh#%o@ZZUiLB#3?}&XC^zMjr%qeN`B!ns%d6;lm zi@5w!fb6IAjr_=r*6Xv`()`z~1z8^HJmU8JcCpT>>(0kd_15?GVUpn;I!%#ZpFDyg zfyRBRK$Aop+V<=As?GBbc*BYVlbl~q{jU)CUb?PYKqY?$I&X+gyV{w{*=GS5uDLTg zd(&OI9KQrbJq=msTDIKk(+e)vn&&lJl<4R$TfZu_4%fF?Vj?oqUH{dd#t_IWVz&+( z)VB6<15LI;d>#!Rl=`11R-K~k0wwL|AF>84wryH$7Qa!rx0~#nyjZmCUbyN!d2b6I zkGlP%xUIsi!!^hL`MuKlYawqa7!6xnO)6qh(+T30|MCEOd_WghAX$r0Jo1pZb%^;T zzPeK9Cq-_4DS5vLjcx?2p@#>pubpnq;R$W0|7+^S+8iL#!qRrYS&&iS} zt7LFM&|ze!h4n?!hE7LE>%=DWX%G+()O4UvQZX467jn6rIbvsagi z^S9mlz>-T8u+=RE#wSw==CALZpu^5Kce3jPKUFV8*9MZdnUWt!&c(P%MiM6UJ!1Wk3| ze5Y2zLW-Lw?pIVu<>S-A$JGkk%nYNDP5-)6y!Y&L>uh|0l=<(%5LcHn-c@ax*SQs~ zewq$KqhVE>%J+0@p`zsX89Yu(P-EUyqcryiNVSKWzhvToCJPh*Zvm3CzJD8tM1 z3hBDdc1y%n%~z>b-gb0Z7CQPq@% zNCII53<)Z{aAbV^_sVd9hvotH%l`m{Piy{<#~OjUB*xIx5AJ=k(MEOC-3z#zCSS-{ zw!sUIoIrn{aW81}&d1~9qT|>3q4!+D1wF~ThE2cxDl)9PLk-%;nlKq4`0cS;);_I~ zI+8voP)`NCNjjM|ZBO#PN%zLx`^jxR#?qg`mdvGLK}NC{YC4>v=Z%k;x}F2r(tHFo z_a0mqDy*fzH|WqoqTbj4w{{KZT!T0!O|qh1QC}r=FviRFzqde2PN>M@%WxiM`=Wmt zpYJOm?~7FL>PDMP&M>F$@}WxV_UMME3UJ5b4$S>j`ej`XNvfboj;~atNlvs>iC}N> zfUW~qw--x51{m7EB>pNkse`A^$NJ&58Ko9EX$iLT!vx3IhuHAXK;y)pDaT)gh`n=J zC>*;*@Y8j7St|5s7>+`}Fz{9*VMcuxrP z{3dr?=8LB*Wmr$>4P@)lt=4-MWcr2&iqgk}c1A`F={zP)XNSBA>jw*?^FTpg!;SSZ z6+N6wxv7lNgA%wDo$|iBo6&R$OW&|WhKp-^4e8N!*JXT%;RDP0%1xqa>h$6TeuEw8 zd+y~_9`T`1!gSlep5DHn@&zRM0!uwp+XEO^;c)gP3V5l+HXpoa-JSeNO?=I06d>(% zFe~-AcJ_R5h~-v=skSm{Nw@cEu2Fhk-z@Kk6oN-^j?^EV*pto$SHIOcx3gY84mvV+ zQ39PBue8X$LTwXIUQv5uRqjvaqwIL9M0RyG%)KM#XkjlxNVMy$e zk9_uL1q>Q^KGO{jvQ6 z=QxY=OOxkU{C38cN!3T|i0zWyq@ijYwuF*0xMAwQhpHEZfR#I|jrNh`28pm=Lhkj) z?f!>a`|8yx@v4oLhk&>A$x9pTT&@!DspDvOuNG|EAQ|FYj&DP|T!kxWThH=957O&t z3A#eziyv46a<4F>@=WuS6Efr+u18Ny~3AEw<#afn(ng1_y(51sSw z4VLzQ`2BL`T;nwyr)^Z?F0FkvLtJBR4UKzHc5Ib`bRM zg}2wwMqq|0{o8e|V_;LtSiNPX5{{3N?=BbH&MdAI6X+#4GQ)Uws!CM9e`CPmt2JUx z;cIumZF$@s)51GQcsvuNE3}Oba@Mp_=9(dr^eJvwsa+7nGq)>BvoW!sD0%n|m4d3u z#*T$?2&dCOY&Hm)1~1@`Bo5|z#QMyBx=mO>bjD9~F;f`PtoVlUh2>bQ-HEwXiaBNZ z0Fk}R>z=I<8#WLBxbX4(u*m9rxC-ceL6G(l=B9R>-7sx3^-;6ao#43OILBr$HSb`5 zmHX+n7Lirf4>oa*;iKQ~?Y4zSiVd@!Q}kyT*@U4?hVPhRm5s7a%oJA%s6X{@n{jhr zViq6Jf%Y-MRm%oCIycc_I9gjhiSdO2Bw@v#T0V~JSp}9AQ0l5JW{(sa-l~;{p}(b; zjHgem96If^yA-#(jVUpPKmCr#2`%yWRrg8A`d4Dy(}DkkBB(;4aQWRSqp{bR9|v0P z8j@4i2#v+7c6|iqBdLvRU#(2382WxsWiO1#aP}z2oCrFmrZsHjQciBb4HxfSkis~e z-U@5VfCi_y0auLsy-PQH{2K9 zbM^Cj&hL0mdHT*>sJ{D+gNIDm!Hcs{mqkiFlbP zm6x5?wbw3pXQtT#AZNsA4-1`oxjGrRl)Ti%Oq;{I@!N2t* z2V%&zBn?y&aTi^_S)M?LLsJxgmT;Ef?5tB(cR%Q<+;h+;88}yQ^PB0b!Y&C16C2TK z5A4S4-q4l7A=y(>Vnti4O-uMdMyvo1x{BqoXY+@GyZyOcA)YsK5{fY zn}5-}u-S38Mn7zL#NM?s;psd%pX0LPWjY_PG` zZhjCi#az=@O0fCPtGp)ov0%)&<8_Q5-Pq;y3`e3@xV_|fhJD;oD|O?FQ@MLX|4q26 znT;)Ii~igrjwm=OEnOJe5KVEI)B`(CqcHz%3D2AWVHlfSsuP)mzz38nL5Nz%*D&h3DKtHUh?#tHGY=hpzmG@ZEogI>H9@yeU*uIXiW8kxLM%$hcPE(r(rDyOP~AG zVybj((C;KPSO{G3_1ZqE=igDjp527q?ZS?d5MX#HUORRkuOm6M*1M8iyX*}2j(Fst zr`uCQqiJ2}10oS^i( zo0eAOllygHdFItaA;(`7ocwh?QSbNb$ReNh%}Zk5w3;u-asrMezhS~KVUoJ=oP00Z zfbi0v2|6e|>0_fB{4U9ku2M5)6t?S#Whgxf_P~b9Q@h$pX3>}0BKeT&Ql-6#M)1{} zkG$lWtU}tf9SfMnxR&jhlSWu*`*0T?^?3gHz6C7|K@*w&{3_T2Ph1xa8frba$Apdh!>(R;t|LHnf_YHlaD^$=O$nZ@(ow8+_)n;`GDv$- z`b#;dg~_HWIty!kL_AC4)IL-L)PGHBA(dRl5h&VZ6x*Csm>|>}sj~TMKG@BLYF@H# z&!gP4hhVky?|Ro~#*~CFK5+2Ihe?=u#JI$dX^xbcR_Va4sx-h-N1yNY?r|RfeLh1% z*mp!Y_VQ+gvh0;d<`2#y<*3}17Nhrz9ObWuG*M`lD?glbXmB!K=jNy<=2ZV^!I8_ zwMtg);kZzX0GYj3BW!(7o#&1}9Oo`5nm~X5uGWNF_`HA>=j5-~fp*nSHw^xWF4b(T zWBSiTc@m@+i*YW(5Y=;HJ@8wz48+N=!VhXREDqHKz-I=*myPoM4ANN|8aX|=nUJ$w z3^OCDtMCPk2|&rj2fO(GPRQ?!jF<1eOc$RgpoR8m9}rfV85*TR5x_eKhsyU@T&^R% z?UvHtHZN5;_3zns;D4s|!JwLTAoMK5ABX;@WB^3gzUr~j{Lek>6Sf=RZ9~;ocAAQv zMD`(no3dK{m!=!F8|Y?%q%zu&X|+#c}r-`RpW zllS~0HrweHOSxIj`#>vf+oG=7RzU&DEiN=+d`z&J`cuskDCn~2OjjJO8?U)<6RqnM zzGOTeT_mqltQkqLsP31fp+yt4p5DG7P`nQGk+byJF1bX6w!Ah<_e+X|ln_~=H8EUR zphi=-i~bzO(Io)ISpFoSI0H{qd}3vK=n}={*rC>+P)h!GPjwOm35Es3aF)-QUhGj3 zP{Mg%zph^kxytp+oliNWVRUaL5o3St);{{}!W>oTxQF01i*Mjxv=lVU0klVq>%UG@ z0lt}31qq$Kn$$QpInnMCFX&N9?XgB{GyM}fagvugt0(oATWn%^(M*m}nD!JW{1Vo2q=fYVIB7I0{}QR^H}U-;k+dWQ_I1 zYr-vj(4h@;Q4swD5GT5NkJqKOgnzkYaOO=J{KmW_LvvsJ8zWi3@b=OQt90q%Xsx9a z0W*DS{G!>nd&7Go_yq>|!-xb7JH>NCL2@kt!pd;mtk^BqS*N)Z%|1AMsyV3qxmWQIOX~o}Mvjwr0 z5}+Dt!iaWpo6nxp=9Xtmz_}RO7%m~6XrNQv_be7@8Vi&Sx_q?>L!Fg!F~LRVjcEFc zN{6PPkrv4kXxh<{E&iRvA_b*MLugT|{!3212KFdLrvWz+` ztd@sye_hmc4%|;wa!@ zz0MOtb|4wv0AuRtAsAKzGJDsTsI zIdbkXI5hg+kY2Or)6^~@KeWR3v+`Rni{#1iaVYN=(f@ZS{jaMX$$*dM&Z+}{V* zt5O~sL9Botz4d33@73)wjzp%EQ$9~b=~1T+DEdNEMN$>KW5B%NH1i@_)`{@CM1Umn^K}V}T&To)-n58F>MxA4tS9-R95xN#m%V0k)r=B9bKvF2ZRZD^ z{cbA&(>O^5Ehh5P^WWEJVmrr>F0j~MeRGUy#ukt&?z%_D5m#o$HCZh}w3*dx){ypF z`3zrZRSxeTV?Am~?uO=f$rHD;oyI>oMu5;E+m#J9;a#tX{ zf9pFgrY_S(sFEL6M!Ibj$f#vS&xB0&EY}=l{|VF9aF9*J3!fqFUS;Q;BSAs;cf2P{ zvFY!~uJT*UN6!IF!EQF2Au@dMlnBmoPDvzB8iR+rkji*U2RR^8yKwjQ$-j6S3>!Hc z-U6|aFEeYE2q{GjIwTQM(rWV?-kp$&B{8Z|+4GdSgvij_vE(@ z08cXe;)x?7)&C_YSn0iJ76R1pTkti+xZ{BD&^HT0Tnsubcyr}dQmji<>vg2%xrELI z+OxLWu4(c!_avx{CRp=qg*4`!y>a_>QCpycE$O|$ z9Op&lDFg)V=d;?Mv_ynNb`z?)SR)|1%SReUQ-W$NTHlvB%6X=ueUG2AgNBq(Xj1nx zZy8Q9vxkWf!D{41&mTde2KNoYAl-W{op$^eccQ>-35_nRopT^}_RjlSnzI5r#HePB z8;pc2m)4?yRt$*_O+f3Z%%_ckd8Zw%GP^BO*Y^tw{^h>%4b^)FrRvuehLAg9g}ko}S;G$n6+0 z4@O2fg|PY^b50ZlkLBxe78H+Vj8%Fq+_k_#k5yoq&E|Zdh?x#N6@XWQVa(t6x4?#o zFar`#0;$k12+BWw0ivv3Rh!AafG>YzduUoA1}F9C;)!D<%G)fR3IVVEeh(Z|iVcan zAo4Bu=A?E?{6+TuRvWhSW5OmDMG&S~Zh2!6=&*j2hrFir^5PcRR@;WP&<` zQJu0uaeA$<13~#F@G^!CE`amaDR+M! z-DSLQTd3FqqogxN1aVr>X?Ez!uATqJe_s!6%hwL0kZA&c5guXINDj(iB=fA6NXPOH zn4xgyMOFQ+U^1TK)g|I{EO-nKuIg)#7`GeWW{RlmCX64~a$0H0H8e@r$r#9KImP+x z`L|(Be_f;^%r|4MTeM$c``_1w#omj;`Lv=LpV-2Y(q0ve<^IOPQrnQ7cq0`3CzY^( zmslvW#)cL(h59WTI9Eele+V@dJ4QD9voGUf%t(D;)>3(F&Lw~pxQHh1{$~$?Hb%C& z+aPUeExfVFl)Wl)6?u`-*CP&>Eb;bJ`DcC`IM*r@v(+Qtqw>I8z~jLRZ#O$wnt<(N*{NVrRWBN(yZ zQoq>a?gAuld36~B=@nL;-^aIlgN)B8KYghv7xSyEzScYvbrV-gD{FSB=HJ@INo8vK zN^eZAr!BBpgejDf>h6D|6GP3rB)fK8{T^nA){m^wy3ktm#zt?@L3(GNcT#dkdC|U; zuo*3*=OxyH)FUtLJ9WeB$itQsQnG*Hi?1{z4D5uF>tpX`n}Zqu6eZOiF$OKJpl@GJ{vgEtv3t2H@ z;6@Jb4`ZA$OO4xlZ!AHN)kIXJ*bLlg)_G%omHf7&z_CeN398?>A<42%cpXn3p8?6N zCN}Ud4BCXfz8HsLC(k+(I2cUk$sZG!q>GC&8YLo)d4@XLl+xk>YBmLXj@>1(nJ{Y{ zMeWw7Ge?T<0uXjyl8(SKNvVz2mTWGpV{2e22SUcNr1 zuYOq;(cFt{4flK`=G?;OIBxb_?j@pZ=mOjnj8(ca9XI|j8{6EAI-w>qcC+FK&1t=| zY|R-G%PL|w=fCj3>vG1iD##Zv`l1|~x(fUL**`zPj}9**MpG(=TEiLK*8R6F_T-#j z$nB4a8&2RCWh(G_E^gka*w4A3pHcMVR?>5f8SF_g%+yDk2RxVQ!!DHG2tmr}?};S` zE^pd}qk07cRhM@{OvaXeQ(u3q1SN0$Ui-cqU8OJ%Kcxg}KyFh+`dGP{^mVGIEobB`dKnV|?h`5&L za`MVbCP(J&YLzI%BY#G1r~;XML_Ak?l>qj#EcxGU?Oxsc0D+#lPv#pn;=DdQJGRxF z**?LomUNrdE$b^$iLMSy=qJiX(Irtihr1s&ErJ!lreHphe5I59?nNo{$$6?`+&=5tc|jbq zK%XG&S-i^Sr?&?5$r}{zHrB|#R7vcf`xhHn$Gba(ab9|UD*69l+>F+%%EMTzc*>d< zQBGMBCLwpLFjqCB58-&Fn9KdUrPwKzJT$$Hb4k{4&s|t3hMQgOre&Rpr@&K8Yw4o} z#a&yn;Bc#Q7CPqUKhaN@uN zqG5 z{i#Ut<9dA3f;b)_-sOp-9qig__GY?4pZ9z+;o$wRtNuNs4!a~Ls=FW7hC+W@u9l$2tN*oagVWyfwrF6!3+8 zuu#-!F1>##Mt(&<^?otTdjA!Jb&7Ah>L=d0!www|O1s?H)!&~GvePBWdGmikh8Bs>`h+cZ}sn%;24 z1n&`mPBYGv9Z;dN`J#BbWDZq$_oe2opo4$I z&JKs#uRDgSDImauO35>vwqIiFZ$UFUci)S?UQbeul^BY4Ixoneo;7~)Wm#q%l{BfB z0CS#V$#rtVb&aoc@OHHS7r>ODXUfcs4Zh~uwiqJsgiua_bsy{qM(qZW zT?TX$E-$tzAUVJ~UQfY3KEcbOE^yt4WIW%c9t>}SF~yRf!lIOK9=LMkofHG?f?3}9 zFYl-@A$=@9_|Q3vE~n)m8RpcuD3&P&2IDs;FT~2tXz|7~xNK^lf1TyUrKZAMHW2E@ zO9{Q-Z;h7lTe3JOyPj{`F^*V;(DheMCN*;ODHb<&u|n_EBK{SWu&Mhy1_UyaGl*_% zselhT)mhBJ7wM6qv)XD^>|o*+HPKwAUAB7r%J)!QmwQrJqqUKrD#u z&P%4n{AumhH;+x=eAFziS8$)nS+AU)2m68h-2{lfO1sy-ca3$nHIvBA!4t^+p_)$g z|C(W2od0F3lZUMSw}CS08>$>xRjuo$|AUt2ZqL*jiEf>R7hdTTKCVQ zsaj89u;Cd0>1-DL>!b_v7Om>hYoSYwY=u-A731RLM8r5K4d>q>HD5(t*=h=?&vvm_ zws9<%d94N6LgUHP{i^8>TRo|V^)W@$2c;60LsK4FzomZq`Jtn0j++Z@rw0Z{!HG^{ zdgOv(0^^&+y7GF$moq0;Xb&MK3|YUX;s*#}J#yl`LNR^oiT4r%WaVvrGDN<&J^9s~ zP3eGyWe$b6ARjL*jVtTwBO+JQUgH^#29Jf(8Q&CSpeDa}*LgFYdPs>?uhBu7b$&x+O8C%iH+mF1UURa%{fG&*I1)-wLprw?#^(+SLiks9R zY)dtL;+s5rXC}QDz-r^HYrIMN23|e;cli($V;(#W{in8jAHV zeZ)&1_|ZYZFtk^ab{}Mm=|^HERr@}5DTt9Pn`oMm#ls~*!{e>!PlCIC`+Rl9qtFg} zb7`F|xu@>iRq0bZg^``-H~-E_CV??v0psNpzX{fJ&4KoiaiWXehr4qo%U9*<30j;I ziCs#q?a|(YlE>5}Ep4i*MiQnQJv>%K6o79LH+jhYwglRk-dO8rHxIGUg@!K8QHbOT zXdrySlECrv{-~p%-G37oco7^5BT|=|1>$Q)Jnjc3oGGWAO1o;%g^Ap zEMZ!0Nzwn!?z-TLAZv_P35}1e52QwyWTHSTh{#z<=#kIxU=0{=GFGDkkpnMTO))69 zaO&~%UQIBn;Is?(%X|GL8=nTwL1Z@+T8)>lJt{Vc9NEGutF;Ddb0635sErx)*+q>9 z9`5TTz*o&`lzuMKE_E^s?-c$z3M0Z{#(zLA9BK>>Xw4;E+d0vysS=3acnx;{YoPmgX{GIR@=y#&~mm3r zKz^7TpaYj748ZFLZGRpOe5jD}&dC!ygN6>dXp^P}G^jLY{Ee`>|4h%0G)V1vW8qqp z3tr>Tsx49ukh^VZ(+BFeYf4d!4p~)KA1P~0XM#CepGP&4k8}_I5V*=)m>|#R5LEL= zPk}Z7UWyM?;L0qm#nqikc{`qby80qbvnsInwoLpxXLHX43H~s){@!*#m0DzU@;h&Z zDx-h534THYK%$j@FfxdjgDDvu3%WKqhi5s!zbV1GZk>}AzsDs7z|XL+c5z~W+GuYx z5>UKrhn8a)%+JuW5wB4qtax;pL-Vvq-i;*QFbASCkiI`{P-$H$T{lqdwb3#hZa%JI zp1Zao?H7@-VV|gprzGQRtUq6wbq^2)a$7Hk#_zHAaxC5PU1C}XkD2qI#$qerKKW|+ zHtHSs+#|AW#hniuw3bEE%JX}Cp3q3(Z&L~q_y>-|tJ~KvhEaL}RgVi%G#Z3U#SP?C z8l{p1=yW0BO6g_M4%+&thA07x#3Ki&A9f(sk2exoZ@dn}L$J9v3$CXbeNAA4&2))d%c>KCi4z`qt?0|m`5zxCNTsLe1`(=A$k+S@=b7)7az_VypF z4=u%lvwCrK06H@jN>I!X`)rU7pgb=^Yue{j+nFtRNN9S!D4=R&S0 zH$8n+b9?1~MemGxqT8wrinR=J*V%fOxA(d-mFLqUwkKc@;+$)w?Q=!44fWFdrWSts z8d1O;?Nh<=RM=!-&QH(8Ec7RoY*>>nXRSCd*1~^0SNqdmiBNXUe?^x4G(UW>$@X5h z+wu?Y;#HrDj^VJP10tQ*UhZU)KBcKAyVoZJLW)6IiS0aE3s`V zaw)-BE;gE=@Juk2k@6KQGD5D^uJ+-U3v)%Ho;&>(nqgkC0kG3ldZ1CYlKhT$485}j zdliIkOAYMNG;iVzvFX9Uc>cum%d}DFR)wijrK}zI<0dBPn#4_0C+6c4`g`*_DxLy; zJ@hb{RT;hi-z;|E*nw>O5#+hvDT@+dg;e#_0aeR9)~QSI;tu`B2^@GGUb`^^*U8c9@)Q6JUdjiD2qt_ zvf~z$(^Dff*wYqb0?a;V159OoV~PgOFI+y+%sae-;#`5B!k|ZPC6Ucx@m5#j7 zXU`B0ljv#*SI@G-i94^IKeG?)L|GaV$}e!M?`+{q-Qs?J&DaG;{1PfM+wXYGEB)$j z8_+fb@q5>rbY-fCYI&a>M~;G}J1ml5rEr}~wPy~1Z6BF-Q$Z%dg|?b5pCxTt~>}yh#M2 zm~TWN7@V>XXbCph2Hv5(yH#V4BlIlEU|dV=I=dvN7wOh+;I>Uf@>z#433OE~yYAzq zUZZLO6isLjf_h7vZIiQ(tIih7x1}GiUms^~l~-f>O#TRYih0&G{=Q~IYC)f_?zVWv zs0PWACoc;Uy`j3Bm5aNQ8jt?h0TR8OaSCI;xGM-4<(V?0$Rg2*7a_R*B@m+@``JX_ z)tSxgq1kb`-6b^enn6l1>N1$30Ucc1jYyx(yI*t}^CegKP8b>avY@x}Ofp!8^z{T4 zt#1RhtNX@7-Awu|hh|-R7H(9p*w(10Ou0u7nh+tvBsd5wL0F%1V6bt<5iK+4%rorP zKXYfOI>uSHHKY+S87HCRlFIVJT(LRkq%wWxO*1o8m-Js71>3oRA#LGr-+l~3R7dfv z1MrfU)Ce!^ILmUHA5`_3$JX9H3MSD5CFW>E{VZcZaX%{Ma224pPixa(mgWAi3m|Y3 zA1~5YVhJ^k6Sxq^6N}nz({QeBZxSz=gO{h`Ng%HFpB}z#(JgA(#OxbEBe6|-%xpuC zffNgDA(1AnJ2Lt44PjW1v*f-dt1GNHNqD2~={;*WuJ?Gb_ z`2XD{Ksf9QP96<=zj9=y96Ti)wve>UU>`t;K`SmD61O|Hp+U;YbAnl{7i^~>HQTOy z&1CU(<5Uq5S^aK=QY_?$5zj(obYeYHYXa2(Z^qq4^tOWBhP$Q4@y}D_vkwQ>&e;V= z7$^&uHaj9K7e#Z#12<%|#e`+q zV8T+eo-;RLX1F$r3EhpxBaRj3IvI`$j%m)a+~MOnq@qzz%c=XhoC4pMj~bG=b(#=W z&0h6L(J_TAj|}k!jOGoYJUh)gY$&Qul&1^&G?31tXF8Q>JpS}ao%kF5jIwg^#X5nV zm_bv$6Jf;&fQsZ%EMz?V{G#m;=fOh;$(a&0bzDoA1RdXj>lp>@1FfR}UP-Ta1}{tR zS^W`-I=&N`yIGAd*zY0x`!7r0wFiT|S)o|~gcq3_%X~nObSFjJnL?`K`mSO~z1(zf zr$|oSL3-f2=6(%DR-u4&ma&E!sxUb}SxGe6tfrhulH@qmAVS;f_d%^E^b!QoIUczs zM@5gcE23;{Ub0GMcE9ZsoEt}hCy@mmPeo5nffAf3=zZ;_$~QBw^yHn{Ih9g@R^#&J zGCdVloc#oo0Io31h=2Gx0A9>tLe`ZtdMvQ=-aZa^laDgDL930+KVMtphkV&^Y~@2H z?Ye91XcZ4;G&mpzk%4=%FZjOnx8ztX1`U1HVD?(S9u1nB`s8l)K-1j(Vh!=byIp>yuw?|<)o_yFwL=bXLY^~PGZ z%iN>J|3N$1(y6jKpdB3 zQQ*1e&&c}atETSOcYCwDWU^$`VUtR-f_oPr^`e>{&qeTEH9N?rJFaWmK&zyB^PPvb zb*$)TwIJp%P`PHAm%aSHrJ=+_=;UfantV?I+l^Mz6@nEvEaSq=-vg}0o>V6=S@VTY zTivAFJ!>TJrpWMdm6ydvI3^NWtjYxkt&=xZOw#}qyR_<0X8y0GB=7~MG+L}UQ%~Q^ z)GB$YU^L43AhegGpPed-Vk0_HWe_>|OJ411_9N+1?P*Hu?ccOUiW`qv(ez?W5px%Q z#jq{g{iakELRU~rUrJ$ZE{>a!^Na+L5N?p+N3hy+`CJ$L{T4wy5A1z(!`>Q zu9Nzu14s>y1$w&$7S+$yU*t+Q)D7N}Rtn6UarZ6rx!1GRp6rQ>rVdl^pfvZi4MW&usTyz#Qe)<6DfKe~f<8~;IcWaH%`#c6)<5KKv6h{Ej0 zto?y=89sj*ALox2XIw|Ov9G1W1k=LISJZthjqe?*sGrOmg`SK|UpWz;5(wVu_6%N$ zYOcu*ra7pY`*0ncIKa~&!~3#H{e5wrO)Vx<4l6q?Iu*B^J`%VihQbmai5KPMBkT@>(AN(yo=*nFh85JXI(gA z#Q*L7DRA(NjwRP%RDIjbX!Dgn(JeoQI-ySA_l;|NmXv;11JVUetjoXl69N#vlMS9i z?ltnQy0=;Fz)iL))O0SlG>hV7qkf`F#8g35kAl#4-Fdfgg;d0gEbtn_+2i7HgP&mF z;!=<+OWaN2q;YnA=xzEDtIdWX=PoP$jgfo|?ep>L2u z+}xhc+_OH2-dWM5eDUHk)^JM#Ru>cdGoGl)&=2Kw;6!LpackaDH|J1uM*DRJ00n77 ze`ejS<9xiD8Azw??^GNLBAxky;FB#imfYF!aZ);5y_DPhS9cyz{p}tV zXwZMD0BDip;`JsdPwRkxH`zENh>&op)9M2 zG=TEW=wXY~4BXa$OaewEx?+iyp<`gKr}8_QDABWcPTY2U$=zE5;vpw!c*xqyW4KZO zCIN2BF%4SJ27EV*cQ7b_H4Ee z$LUj|8fmy$BrxjF22su5wUkt#9~3Lj%E@n8p42B!hGkxql!=>4;nZwp+Jc9b)`xIL zUDqPxWVd+G?qy{nNR%|=+O;eH4?U!2LUTH6C5z`jm1lFGbtMoM9Ybp{LWY$o;?VBMQ(O^O>14!qj&gG2OW?!|Q=xs?$5i~W;tY#}r zGLAY4u^er$?eb1{090Mr?H)bH((B2}bZTO|C~8m*NK6!b)MEwjP~NaF_dLRN9HaEh z;@mj(MNrb}7#s;8d=z8GDgA6h_O>fH)}LNyv658o{vJ*LVfu3V=RFyKfkL2*p}B0; z=3Q?j*4+Q}sTW9g48IZ=5-+^2eseE9(;aOrwrxW8Y`rf0_!w=Tmgs)Qrn%T6V;W*7 z!bvdyVg9lV?&q?Y_FI9|kA^mh`>|%YpR{YPjN>n{=GLGwJ}b%BpdrUa$EF3tk!kiT zU`vO}Ht$H4>}?M()X$#pORs-cBO4?k_DaT~+}@n{HyO#Ob^of1;nU*{OVW1*VZcZ; zeumH0-S+c~*k0h<1a!_lxJMsD?+FL1*69Br|5s$#A_j**(M5x5o#Q6i5L!_G9Vao3 z%ZQWK-XLcId)=4tfPD7H&goP{GPqDBxNW`CD=6*p&nTBiBBZ!oqM1?X!%gs!r=Rr? z?43p3>?!9cc@j=o5{;cx&o{Tk`dsRAL`sZfNLz>hs9rHU&IG&BT1;>FH)23Ixn^rq zxBL0_^bN|G>&Qz#WjV$t9l{XDRg~DaJ~_L7E*(Ci0PBOwHL6F z?JTP17D))z+A*5`L7US3Z^?lx7aEs~czQ3seGa5xeUA}_6C;LmcqX_f&%;Z873?@5 znVD~dt$fd8icwv=%iH^j@$(-Xf4(p8?am5jUf!{^%#{*G#!7to;>IlhOTy?qE@?}_ zJWfi=B$v7+)`i7Y-jm6Kt?>wkOkvW?ueBiAZ!KGVONu?4j7FDNXM)0l3TX61H;mq) zj!ycdMm>6rgj5ynYkxq_9(88rDGZV;U_PgL@(aFFl9~tJ;?rfI?kx;gw^&VeugXt`sih!>HsXt5`g)*8<*%4qfp=26{m!Q z6dhQ)5CBe!Vg>BPu5tAn(pT7>djd&?297YC@fa~{$zZ`15-L}!g)2It6nmtCThQIT3EE6)%hb)rq~AGQ|K z34^^JDOPDah>0Tqpm;xaw%a6V?Lv*A@4`E!fm4-5QcBn@7ZD`8Sof^uxB`D&O`qI} z%4{McQSgT^l*O@j)49pQXr?0_;+)H|wYWZ2YU+LnpJS74ekqWADRyl{94#M^7wE&G zd2N+QwfgQng5{G{$Nf(ogl|wnfXnR9D94re8B5r{{IVmICz6Q9KDnq2aGm6>!2v4~ zEZ|$SUWi78h!Fv2sTSU-&!zQK{caBgC@xGG1|q#yhjd=;%hk#SYvs%j7^}`8M;@qBMjc$ zz_yDCQ@)FrF~p2dFE4Yzi0X>E+wM1fWnd5rsQ#mR$?k^%7}tk4QvQC`(>d;pVRu*@ zR95<`Pf?ve``94IL^@EwMJ)f7=H^6H3@Is6K0pJs1N0|cLqMwaHsu3^^SO?MyJFL8 zcJDZKb#>xG$6*_WsdA^C#FFN3xqNKpPFP~H%p68u9D%NXPKBN;^PQ5rC1qkthK$_D6)q)lFZQd zh>Uol(UtwJ-dPs_5-T!H?ig!dsStxFNzs8zV>?$*^+_8vZ)pc*D;V8QE!03Ar?{-Q zHrN&+!yue5ug~<$+WUU#{tmr|`(P{j7-Lo)>zz{XZQe}|iaYXQXH>quCH}_-UeF?I z%g_zVt~h&t7sO9JAv`|&*57E-bmwkL{eaCY(-p^_f&rBU4 zZ+=P~{`~%RF@Y_G!H@M+4$-pNYndteglA{BdrA5lQ+Wq11Jy6a^bLn7+r^;?D>*ai zX0mK!cvJFB%bWRvl~4{$QFri9Wz(nJ|DU(QYcbrvo4oHUUtIOKD8%4>n$TvISkkHv zst>P?x?z!AXEt@r;CVfxvaYLdt{%-%Jl*(<%s@5+SJq{`&SW@&gS~PrNH1JD>*7_@ zqhbk<{v~cIi4wB>nVg7Rv*0#SP_CjkE=)r<0*)`DKKIQb1z7&&$5{Afqmm~3H&YDn z7ICk5mS%;XZ-EZhWj?)Ty_^8Pj$z z<@Jdk$JiHhq+`f?KldwYcD5D_JU(%vUY*b+`(t0tPr45j9wWaV`wUvp8-*A}C2=0&ILKTSQE6#IW{)Q4GPX{Fd>2Bcf>|V(ucDe| z8X3p$Z4e>X*R?c9w}@j}u`N%btD{*>SvudcI1FYBCBxg++lk<}TZrkm8S7emURfad zG)OgkWy&ow3d*H9>`YV*(V&a(p)+}a~T&PN5%YEV~HhqCp< zM@0;W;oo~YJI%1xnE)`}17l}I9$mVoE<6rOy?Fy%?SUy;P4C_M(5z+8jV_6ciI%F- zj~T;luN6QIBesulFmy1-gOf~)ac!WdSVTlP!Sk|`u+3crr?*OJN?IyyFbEU8lyln$ z9sj2N{?~U~5`t!a>YGtWzfnfPWg>C+OC5ng!-|l-gM19H3C2z_H~VrOgpN5u!;S6p z?+(5@Tdv*?iPUR4mr(r^+A_rdzgi#UsC6}sUl92wxG`Vj@=unLer>6ImOeYLUaP69 z_*D&N{fLO(Zhe=t0+%WxE-fwtHdBsdjk9EN7X8;um$sRYPtAttkeEKjUWzT6y=2g! z?~Ne8L=mnap8_vM7So;t+B&Y5va8XQgTp*&V`|H>Qt+g9Zdr$6QEUjTGy;?A=OXzF z&ElyZX_J%D1qRNo6UDCXRNH{@=~Chah39tvNRvZ`9Cl8!a?BuC~Kdh_m2CrOKQ{axvDJTr3s zDOoQ+Ga;Z;O#*cy(9JI)bAl-WX}5V{MZ8|ti;(!D1b>(R>y>|EnwVt9iHB_b`k=Vk z>pMCZMqjIx=}+;ULAc!|(_Y-2e(H74@8y#o=rtJO{V>K7jP!l@>uB{BJy%{H4GFk! z;*i|en*j4poZuX}9o@sbpE^y3lihhXf7hQHeHB(ZRMV;*Wvlz8=rirN4xS0NHOE%E z^3z+lqk_s*;Z7DHesr`RgI3%{6Af3Bbpnigtk3SvNVoJcPIM35uNwQb=wW1hTY(Kx z{6Rdp0e|^A@_>gg=@X&P>S_v!BmO+PvTMw`{Jqc3RiFCb!L*uM7J*Eg{ERkoLzUVu z8eI{v@VaF^9stp2I}`1FRS&;Oj}>B#dZDATFl#^?t2>)4eE>yfn&FSh!z6<))Dmnvs+# zu?Q}{dA*N`sw1Ug&zm0(ug&8&r0a6vAts+>Yzy6BmpE06Dao_>C(PQXhw-ekBK$P0 zp|&h3(`Z;MX=_@#nZ~Kv^)IJnx?6-=f-~9e!@YH#`L|YEY9lg+UIB2*gP5jeZnKe} zzXm5&<|c;k{OzU=AyQxJ6OKMJdi+U9rtIpiL6`Jca3kX~ql&GF8#j4jg|x7-JIKYF}~++_Cs@!%o$7x$h5r76pomR_%Wg6thD*!oCuRJ;4^7c* z)^#8E0djR}-C+J$H3!H-N|D^>nWph6-spBp1LZuA=LJn+ZS#tKvWVnYbkmWhwr^K^lVsxT-|qYz>H9i)WoMeRnV`Ws zFw+oqB~G8OW~z^j96nW#DW6neO5LSRcTcDKVvad=#`v=N(Mt8IZ)I$v2gUgy>eiOo zq4mHuJm+L)(s@LJUVSiF^Lay1ya_ zG5VL%5t(nuw%muX#P@Y!@2I%+c5FD-4jJV2i`HBcA%^%g0uY20hp?QBXtUfxb=~Q^ zC>t0Yd`riD>7rMEU*ON7863FLz1A+>h(A9NK_0uy=*ViIre3UZZlO-mSeB{NE5<-U zV;D(gMdsr(wuX<2nLX^NIvmo4ym}i1(^HtUcwFwwn@46nu>QNhGxU(_x$9M)i5#I; zVaEuId01a5nsoe0{37jN5upBL2k)k5XJ5+>*>}9Okt-j?nzf5m))u~s{Uz+E|+>BgD?*RD+{(h`o$?G5v zcRTEPuIJu*pFMGOE7r@^j!+{X^1c<4xPm(>{$m!g{$-46^&esPJyS@`zMB%&nI5*< zp6bUXONsVnC}YTu7fr#k}sbJ=*tpm!!2L@tzj+SA;(>j)*UA3kmOg^SzMO)E-JKrO3#{=SAq|8UjIf9hI_yz1HL2&6){YS)Z- z2eFj<+)=AAp%m<&Z?lja@T|An`aF(p@5Q^k#L3^KLt&;oz(3mov{za_1`&OyRX&f1 z$Ea8~Xcemb+wDzK%0D_MYMzH$p>5myw&NT`OHKB82{p#7sis_{0rqiipg zb#uk}ulc4`9LPt32uJOj5!So%+P(hp z`|kCRft`r!R|}MeGckO7Gz3VsVOgk&TMY(<-`%(FH_@zw%dRZMRu6lKs_kV~plpjCC`#2l;&UG8+039d ziqo|p(e`f)cnjPDAGjO%53-o5>q3q>|F#!F1jT<;4F}3ysghBXLC4Kg29ioSEHd7+ z+L@?{sF%upyogHz#a!cv!gs^S93yv6$0KqPO#8)f7N10Fz!d9reJ#C`^V?qC-m@NH zVp-3H?%tVbEdR3W^VOHD;^#hgTJG6Zxj^0sy@C)Wm_?YCJENae%Ye z&G3P3R$O`~>js#5CRGfKQC*2|V+bSN{Mj}yl*+-Hf@L4&j z8>#$in);TQg?SqS2EG6W#V#+;i*L|g}rl~umQFTPL;EA z4FWchJy1RC#(P0Ai(0i-AT=Po{D^qbV8c`RKF~FnsXphvttr zGxMI?`(t=%44domBnt7edxBHsHDXWHMTf9%nfY2^tpV3$$px_>iwit4>qGgbwlm~= zu;BHdU@pA7Z^HzdB3je@d#h&~AN1YcTs#?PLE~ZwEV!Fsd$3lc3@mQ{ZYiy%s=1Rt zdZ8?#rtus&Vdbl88Viv6nW#Dl?&J}uh#@X&a@FY#;_|FSD1VKpomlW0VsI^)k7m~X zT8Hw}a_U0pl%$}eqf;+K$XK7sySSqC0ptYx(l^i7+)Qshz zOCymXGaTcy&^r+Th15T8j9ly1{fM9Nt$^$}vGK8+e+V zgQ6s_k23>a_?Nqr`BG;8DhuHE9~r%}g_?xG?Us>$A9juyB{ZV|_a{2YKG@Gh=zi+vJfkGrl8|>FJpdj$^+*hkXzj4Qb3nBr!Va#;wU2B#>1PFpSQa z`lgx=?PnkYolZQwRX{7k*yfC$xiMo%{WD0{PihjS&a#aBln4e7h$ZYf>zm`7SS&Za z$x<-OJvyM4ABApBd?PCGHy@tmLpzsmNSa`G;{2k%6fR7aU)Q^YCd%tCZyX@~<&X{6 zl%vYhf??&p@Hf`VDxddmOW_rLwZ7O>9kk&!QE&I(xeHb>xiu{;@^u+%_%C?&-Z%$G zu61I)MR$EI25@cKXo3zkTt{A=!Nrjr(9N$FB$~{MTuth z4{q!}(gqaY+K;hS`qb%l<=FgK6Px4Tk?$~G%{Lzyp|uv%I$c-PJQldLerdaM_|I~R zI-_<^c^*;|AFk0u%xLM2%&p*cnBjJ`WVdQdRPg$-`ZAE|ZbF-R_l2z6emIf$peK2eV`!MKCXo60h;mWsM^Z#iPCre0w zlN9$Lnn}?wcq(}@f?kuin<7{4zPC~Le z`!rN^@<02GSX!XYKhWgbzvyiyPevK?YjsK#tx8i$LnfGYklo8_Nvx=^AOBQP^ZR&F z*-zIL&$s7c1ATp58`?NdzgYcc4W>BGgT8vKh^(US_ok6-H?j79^JcvbN6U+oEJ41i z{Wy`*&Zu9t+cs+Mg;vQ#vNlB-47iiNORGE+rJ_n(q7&|Ui-akO3#7VFmH8g{5ajgb zXGnh|s%2O(a+Wlx-@KrMe5$x8Oq#Mu4Ah!qSy!LLlH<<>)8!=ui6!Q}Ni{voPLh`3 z(};xlP7Y2=Sl8;jXC--`q)@s#n|;0EFcSOq2TSLQFsS^UYvIjkLF%h=z@vQ4`*C8(qEffU znQ`ly;TGp`;pKSv)d7giHw!ue!{ssS9@_m6_8C}3yzudx0dLk$=ioWkF z-$>@dd5g4`w}NbQqCGR_8k|1_@a5B~5=U2FCwGMMr)$B^DGz7`ej_Og; z2@^yAN!g4_(qXh8Ssp_im!Fuj%;)A&NM^>Q1T{0c^X9*T|ZPgxeC;Vqh1sDs4mt7shb@-75O4K z=y_arFSnd27TKBxn>P4Al1&gr3wP6G0zjs`hk}|arQ?~x<}kSsyMi}(k!&fN{%au6 zv1(JBaY}DQ*Lr#V4sjB@mzx^}YhbN6YfxPLR&If~{fbuKmQT^p#HL`W<^-}dW7jOU zt|;R7%jm1}@3M$j_S{qp#Y(>TSJErbMF{~t-yRP78d5e!5p)hDcPAiO64DHJn%%Oc)+?Fmz7iY`#C30dVs8H|pUo8QD!qG#1Jelnuo z1m5%!u`qJW+JsxuL%KUd8EluVFBM!ZDqCwa8bDu zmoxH)>T36Qzqvt01T`p8OLXVNRtn8N#305lopy1^Edk34Tff%5_+zRl2>|fcA;wGZ zfc3MY8S=M-Wt7E_wsC3}T8#()?Os&SYq89Jonq9@u@PPD28^uva9DY<6 z%^(gqo_gxRj-p4JO8n{6Lh@FS z{?jhLy;XxX97Vr|xuNmyhwPvvPDbq!@;{z~>0F{gsmPJj0%ZR6Gpd4pDQ?;4FBgsL z8kYE(pJw=8uK7z~olm_?ZdtwFuAGC@FU6TNU0~#JjdAD5m95a#AxLE>b(g8gf+nyR zT3~$p>P|G`JI1rDi(uz{-M}+NEh6i=4mO|FX;G?vB?7o^T#(oJZLG2c)A6feX%v&a z^bY}r=m#7g1-hP+`2y}<0wx8XT5ez-Mxg3`#y-4Jei8P5+V!qu2|iF ztBD_sIUKmqUH$i0kg2V z6rkW;_06iFeqOIfMzk}$%S^#> zqvRyJ~8CN9QPQ_u@GVv|#K zlrj9k&}ZNwYnjm4z7Z57AaDkD3(! z=f!43(s;JBUNksgcI3&3C~{8-`8s9%g3g6@UUcyDUdE<&EscBD+u?ilO)&80t||sE z$q2r2x)?(&AaLwVp)52GQM#Z$JWuehpmY*i_R*!N4>W=#JZtG6cAWe@JIG*hDf>wf z(DihG;nQW5v%L4518v5Aw=D&JUpWe2Y+9<*tAs zGFjsnzGi`wWtB~*i*_tI$+K+fP%#a=5+bn|AnX|C*=|=XeBJRk$~{{L+gB{Q=*wmS zpWYEpvh!ozA)zx*pAxk{{j`;78U7AnEYgp;kv{-JA;s~rlxPZdl8_-d^nHGuU6{B+ z{ky0DYS(GQo@9&=K6n4&)n*m}uLUrdwc}ceu)byfZnc%`b=NA|9o1#XA&Z!*a+i3_ zpyaxrw=Cz!tNnHJ97!MjvcWrG1&L_x;WCxFkT(*GyX24a=wa2LCzr;cjq?=$z!4Ssi54Ey?~ z^dtB*tz^?7#6@YcB(km|Rz!|PE&+hqQ(Xw-9c;(NKIPbt;pA`zsi~1>Qzl28_}R5y zB+v1+vdOCPBvkamv?>Pb5=rB=EL^f7diiEwoQm8JdVCb8H)aSr#v^SR7|5fpqTeRu zDu}G|(z{f4eSXhrxs2RhStLNy{PfrhgOx?fm-N7H##4_sAzx}ya;&lM?}Yj4DGf0H0@>J2Y( z@fZyCI~@`oTgu#1FNZ&gE z2)y06!h~R1!lfilHa9tE%}0 zu|{Y8*@2^h?e~mleiW?j9pH1PW_It4iL+%5@ zcXb$x7%e@*04A6P!N}N^Wkx6xM|TMgJaeKX3S!z;ocm^HjT+5JiIgC90N^KMRJs>I z$odi|R!0s)&M~&N12q>L)|BYatioVT^7^A#^RhYpm<5KZFBNnxD}0!c>$k~4>?6Z~ ztA%&woDEEkYm!}=mtpmxdI{2^xJjw(;Bug46&Jl$iCla-IrGVqE5o0W_J>;p751Pw z4xGh!V$P?*@EAvv?J*@kR!Gsgzgo)_`Ch#=ncvs+={42dBUj0r?3bWa5K=t5KN)Rk z$+>=F+5SF}Gy@|3IHl9zi5->8_Y&N+5jW+sHQt8kr9}^kl;AW9WkeLHnKZ7EyB`r0EwGfccn>+JHJ3gkM5A7- z)U(e2VC6+!R8w#%?isMNlS$UgL9>_|hdJ6Ew%}CVyq9$!j<07%M3d>+DbK2mV+xXz zUhhTon3;edNGOPfMrq(SbW2Vtw-SqYWgB#C9;-FF@uD-5R-YJ+LF3&Kdd zCl=O#n036%T)o${rah=w*YHi60hoa-Ci~&Y6pJD7L0O_+AUB`41R9yhJT2clIY+2z ziTOC7)nVCc%yWz#g<8`~V{OQnssKRWD8G(g@Rf;Mo|Dr)Z9)zCXjLLht99<==(&@r zsg>oGOYbDFZKX?zetSyUOiYmE7!-W_DK1qZeh6(X$zV*5h9ylPohIh?&B*}poMlVH z8PerJDVeI}46RAN%0H4yK2+Qj`i+$K&#C>7j#>yPJ5ol!qzI(*feIH}v0vCU%F^K$ z7`k+N8VJ$p-MYjv5eyI~H~vL0X5T88!}oD?Y$wMKY)tsP6Ye1JPT5DZbjt#1WPT&x?22;QBJL3$LfWFVa4NdpIor8tJD!7m8&IcW_V;rqF; z)BfqlJ&;>Wkvhk`CBRBo_evF6GhLb)>-h`ePxOvHs(VuB1*6?5^Fi|Im|>$&URhAU z|Mdn%#h>5adp`O}UG!yko&wZ@t4cgl>$~2T!KfgM1y|U-s3@%T>5b8gA192-+e^1n zQ;CB_$qvO9g-4WBp9Qe$rVy{cR7zNU5yKYTQ_@ccGS|XV zZO3dfd(AYk`OY2zUKL>Y#k(oEJJsoZOoH5Ev~U9Bm0Ne8036mz_{pijYrt^U%cfrT znqDF>5AJL{tpk^J;^q0dle>(_cm|MuspU;Kw$`&~`2TK(PGrN<{$gO<&TrQI3~S=` z{kPb@JIh@;6;!(7+>m{3<#_zAA{1NV+isb z>s~5=a&$a!Lj1ujRIReXSc;L3q?nbtJIZVGIfmO~1|OR~z@z*O3=k1Z`){?vFXe?5 zzI@!@c6p}sSI$6-@p?;Rb*V8A_GeONw$iYzj2-dqvETT8+U^&IWH&$Wy8idc3SJi0 zzn`2i0tGa+c%Qo+GkZ8^f^tk31vsc@m;?Qmx>*3wp06hU$ ztF5hT*jf|7KUL!_2|-G6*3eU3caNbBw%s?sjf+$C`VmvYp%whAwJdl(O$m?^P*}8N zI1_fPK2?QyXC7_aW;v3N=F+Z6Z#G8mMG?4MT%ToM^+An+eQ43Gah}uVP%z7(216vJn#(9PQc2ci)gPznKiG5kML3BX=z%2O@fssNH0$dA?{ z!aa--#FQiu=jbWx|8N$dF`Wo0gcg^&y~)!?Rb=_d=zTD{SEG#7gm=e<6f2rbu~6@U zk=06h&XZG_7>Hk~j*s8R&3rT?mz+pPsYLsCGCv7XUDeSi*s2)H9u?PC{QA2DoBmsz zziO+l* z$(N^~kMR=mvC~`9lT3^+e}4!5kmUlD%h(y;2bC;rhNCL>;J*)Y!1(e5yk6vF!0h*Z z6`+KHrzgPAF@7f=NNxE<;GF4Jkg(w9ZK5!ak3;6CL@d*qNFN{qh8B(VlNz(qorkCJW}JA?7^#JTt7lRJv1`im~( zok4nGw5Nk@NTY`y8G(?&Sx9@}nT54`Dd-#5$W91IRruG|UD#2$+*z@~6Ft9E)n3xc z+#Z3{3(g8%FK-HK*t%TQdVli0+cXxFRaft>SDq{KHe0RYH&0EG?V$n)iKmR^E=0ZVaM zBjNd@cRv}<#@~pHDTX7~n{B>j(DBOBU26C%+Vz6)?9=TCQhsj5nh?lJSwFc|IHJtQ zJvO0eKvANoi2;`=6!Fj=@NH1wr;s;a`T9W>hO-e%%YOcQB(4SrG3+a=65mq@RJhjq?m*xYtMZ~3kvZy}jTZg}Wjr^V`LW*JYYn_-%H2*uHy zp49RdM(a-uVGY*6?Ct^Yv9_h&Syl=6e>)8;5B`PjE^ky3S7!nyUtf}`WR zUJ2O9$-aHLZ~SJ7fz+R zk#tj)*dUO~5kG8QTPBe5qHTDeg1_-TY0pgC{8^B)^VttA<5SzQkkiG5v6S23!Bk?D z;r1cvUfVEt{^6g3Emd{gEw~WTx0_q4QoZt1^Yqzn z)iRqi)e5m$7>Y)oiEwi9=Ld-fF!-6CDOhG z#6X>6%nnVT-y_ji18Zf2U~|xck|&MfEzV7kepZK#c2`u6THqwO zpJO@8C+{$UQuDFf$n2+{oX@-0e0?V#fwxI4&SP0aFWc#0vnSY~ihg4Ml;~yN$!-@$ zg_doW%$ac(Rt<>0+3E3plf!)Qx@9G{f9D@Cm0BhJopg({1B7{dw{rZiXqcbiAOc2~ zTU`Bi&*EF6wBl-FGjD%I{6_CtNFbG)$v@o*(uoxEnlXH~sv+imS#A^HtAdBeQOobG zaH6SIzs~Z-O`{IiwEq|zS$NQtEAm=d6wUJ*kolq1H67U^U3l`F9nsmLZR?8@I|XMZIg zlHL@>e&pq{l#-8QDn_Z^#Ix$6)oS~`djZRB#C7S4?>>}!Jt=_y;%y*5Xg05U(M4@c z+=#4)zaaSWrk6=#^9L=A=o<6PF!qJ69Bsz2bG|Es-_u7{tlM7&)C@-~3P%r@%-fi* zs8GX1LRkW-XPYW573S7j1;#l;8hg9G!OXNe%#Peeq+;xUIkGxDpM+$v=GGV$TcwRa!1^yvwOLF`$)JuIi~N|B^f zrA@PKK{52{2^Q;2tScVNusrVUe@%B_o0p5jy|kH|nd2k=Bl}eu(uRN(+SSoQrT)!2 zG)I5O{%xVfs>MyWb%!o7v9zvfq6TD`#Qft$q$vMJf|yWI1<;m&5<)!uc47mu}# zCw$gk{>U}GdjKy0GPy2h+PSYRgui$ccQYmSzn%@GNFi*=|HIRHM>VxQZyy9fl%gQg zi-LflAV@EXh|;8}RHaHs>AfZt0YM-XkxoE*m);YagkI%_-XZi7dP0&ne(!yM>-?Ln zbKlB@ASF|$n=7+ zabe^#yR&PC{$_1pC}JjZucydd)}!!9D0SBDhL>MXN3lflWO;_xIbLZ z;6DFUs}>>+TQ527F*||B?085?FG?f!_GDY0JWAwWT1dVa&(c_WU@%pR4aQKK)L5-r z(P1h^j#M<*PP8JkNvg6EZ5ZA&r#KZ#CQ?Om|BeI;wr6mzNmUh!;s@OV6k+ZZKi%I|L47R zIreU@hh1AbS&W*!?Fx_>DvKAE6TA;B8HQ4+lK?+wb;0?$?tE%}h^@;fGNoV}H$$xr zPVw~Fo-&QJg4H(Xo*MLhHY*+9{!711G5hqP^uBg{q_Yph93M=hN`p1&3KaU3jiHnG zpEmnJem~V8>(co$-xk9NZ}Cm(?q4LAtGtcWgz5xC90FR>j0fE~! zkV)Q3b8*TA!~uih=Ulak1Dn++Fx@a&&8dK2>DUfJQRP&Ed0zCR`Y+CC{#{LuXvtl$ zU^-T~FL#M4&2$V3rnFj9*D_$JG1L+ph=~?jRK;`N@k4d8=4co?v_pO*O0?ZB86}f+(=hz;dwH*FABeFov z{xH2LY`a%#+Fx1DYS5cE+0xdpzH>*I@fjoS+RW%Ze2x6yEMJ&uCb^qXPV#hs(Sxhsy23E0c z@f!_jqT)d`u*gaJ)yaJl-6ocXKAYCqlt0}SrI44Xx<(fD*6G3IJhQo}|8vSBT;oH0 z20i{B(pAQ5(J3E1jOMw`(7_tLO|jZ|VsSmBps!Frt0Q+Qi9S^NvE5TV=I307Z<=w9*w-2Nd93asTH~`tJm@pt+{5t--_UOuQ*Qr6olYa4pfwKd zX~~Y{4TVKWt-ubSq|sk!NUX^PVdmm5UIF<#j=YYQ`%b4Q84v_vb>5p%%r+v~&8nxY1L>F>3bxsR_9}bYUrO#=+9#l1pN>q`R|MYB7 zBY;Izd+|SWVSXZKE66%jm$7#+8`HyYK+le7(%jHbDmSw=FSyw@G0SafJ-DY>?Z#S+ z@m?U>S^k-Ddm#`y?{LGR=BJ>95SMEj`j>Ii4}e7wykGr`TiZS7?wJ%H$)*i=#%@Nt z8FH63QIl7SJ?hSN5rOIaTeVTU$K}_G8<1v#YbVOhYI9Lf3S=4m-akxV*V~Y+vcA3_ zQ5q_&lWO=V;@`QV76m8;0sDF3b#tJ8@Kt$*O>2nLkB(9thW_Q?tJ_j{F1VNES#FOG z>(K138uu9N0#EVFtzf@57YjN8umz#XP&837!BJUpH8RSyXY`iw97H$DcicO0e%{~y zYZnoxa#i(Kq<2*Oeb7^&b>1jhPY5@4$MZpI#{iG(iPas{K)!7K{Ng zQfxhZ*4GcmJtMiCjXJ)$GDK3=*S?_S6aF2SnxDeCyIrps{ok^Dg!iUT=yPCA$$5OO zeQ+bzFEC~?Pm+(UMzk66lS%w~8>wAIlE zUYl;$R>RtVPX)BU5!`PrnUUojhrl-7)6Fg4-FQWb!bkP5xaxh*FfXq@6*pabV>HzOIl) z!e@1&_ndimwoSGgdHIdYZ;vl@;^9S(J1@s%D)BYOCt-anC_T`EbEanQzX_TP;x^D( z22^&iY?i$Y=2Z*k}-)3mg`U4GtVUqJbxDSV~Mi^r8k(bMS(iR040` zuDF#jqTFmV9jgWPdj}qXtpFUVsbVd&cGiv__QkomT0hmiS795k+pnPdAI(Pne;P(T z`tl(B2LpPghi8su?L!Vl#{Gi2)M|dzH2SvFdB&A;RbmON( z-=9+FgY=GQw={;?@6D}%q9r}bVW zkkfbpHGnBVp`y_FvyLQRu=8&uT99kR<$a&&*89P~_oRJn>$nUYSaR<;*OtJ0GxL;8 zAX^KQ&RU*I3Jy3gqJ0KL`t3Z~unvt`XKz~R+?3bDvcCcg=`I_ANoT6C!1QYq>zW-X zoYv~81Zf0T$YcD?*f~7LavoIKR2>u8fkf(F+B0stZF&1Xs%(peSO(%dj-7wQ64#@q zO4S=aj&9ZRT$q_XE2r|g$Yu58G1stjiDM__ zr5+{gYR!c9@H^^bE`*yNFWeuoFV!4QzYv@D_^)S799UU&U8pzXBOEG;Rk&UwxgFWL zA9PwGLX}OC6L02T_gZPrE=#P9z=4x~c$bR~ukqoC=me8Q@-df(>Mmc6A|2{T^NfTh z_Hg9*;CrUx9-4S!>|9*m8BC!-{KpsPMf!{MDU}W>-WkD^VX!=HK-msSi~ezXkOA4~ zb&YbqVpgyP&2YdqkeH8 zqG%tQ4irdV>hM&R66A_tvl(ZSHvGG1aJl1&22Aoq+u)h88EnR0*4?@6AHndiWhj+!43;nEPw7CC6+2J+V{aYC;8>tL(|&yBzcX|2UcO)xiPN+#w~0 zA4SEr_DXCW?LXzuTE>DIx`N1qC%(gGq32Da;)Kd_{Y{;XTZvkl*rNo%d;j z#i|YYdW1$i{yq@17jSopk2?=gTRF`Q4_W3b9B@M)0UMa?jF2)F{!qvf4A2mtZ0ru? zWwX@SJP1Vj@ZFw4+7}O3G(fh@MF*SoCY{)#wXR0?vuXPO8Lmt zBVgt9eaJE%bezt*`dvx^8R=Ck%CfK~sG7o$b{AHe>%EIZo5>vFGnDn^lU zOSYm`-^VInztB>Pk+L1uf&PuLtK*#nh9yFqx*Z`(I$Goj^YFB!fUN~}XjQnoXZQrd zr$RumiN5@NL^I(B`bdQ@N#4GKxLFu%W%~&_Cp9$C#J)CLzHOohw>O(Ckr`fe&>(^4 zl*@X(p9CZ=3gX5Mf(7Ss#(}!sBivl4<{BMmYA6*yz*m)YbH2V0M~_a}dKl5kqGfx} zYGo>z|4P5jOp!$0m&74Ks}?tqVfBOM<1e9&9^Kq#v{Yy&5*q+?;<~XK5E?%H9P4$Z zRMF39D7>S8c(X}b%O{MZoj*38M$P`8l(@&Ug4Yvb888|twL6le^od3*Tk^(Ilr_h9 zTq5=!3dEe1Z7Q8vopX*xGid(PHS`rkqPbAy5j&e7neoi5?m?=N)AgSKsLS_EebQ3$7h)!@h z_CNxE4pIc0N$b7-sUg(o}K1$`XgcsAs#BMs(m$mYdcom6oe- zE4w=>=8e6!GpxSj#VNc>Pu4GUygDSdH~bqZt%FR8!HjIOPGpsaZ70BaB<-SCTL@&L z@=~fd?P{u$G7ED_?8y-?6Jd^X>m#@kEiX;b371}x&g0NF(vzdp zyERug!dh?ex^{L1;QMB^ses{_Do4a4&MHj!(pceQA37z+Kfe|=!5k9?26NoF+>6vG%!dHsVJ zdkpQg&Z%mbq8IcaKwKc@qIPAx-`HA%JHPzS6{#EQl4H_^i&M{zXfsl0LOYYq*qX)% zl*?o1cPP`AV%d4EG1NcmN@Mh159yEL@15)2~|m%;GJ2??3A|xHR5dVERwvO3~U9 zARNoMTzl|p^0e!sD9oQ9COdVT+=kvGZr$dk(krqqqA57O%|okq+szj`VZeQIS&YUm zo0>R^W9ZHURYCyM$3#1O2CzmzoJjC@ZVUMA@RpcpaaIbjg^HRHjZ?pQ7|M-43oX0N ze5;k^D|G{I=HOgi-s37uXs(9iBy!p(bV-wo3V{F^ing!c5$Y1)@bL=tA)>l?9UI zUbS5NjE}gCp7t8sgU-N>CXfXjeV)5F!4hUgCbhV*5hYo?R*^A16x zDUw7VpO*%=C6pZf_`N&rIuQ(l^S`<9eNzDIt(%i4wEFH9F0|~ysSP&>2)bDIHsxrh zPK%SAobC2{q2wts^VOY3nuKBnbAHfuOSP3W&xZ_Rm3#0zY6%+{mgkmedZkKpm~f_K zLTmKb{*Q?4l_UCVk1Ud2BzM0FAXSBXEjymI^>4Ao)9SVfD{EQay4|hb!K?c4zTrc% zO5nH}Hd87zEkFp+Uuwn%6Bf%Y7Kfo2<3PCIoKqR)Xzid6l?LK`9upFmk1emE*=^1a zhxR)g;?4PwCQ`BmeTAlNTpxMJ-wOv#xfTrMHl#@4A1r_=fxN71CcpjQ%EtfJVYA0e zU~i?!cGLO1n-_BW*MVy)e8sXDMM2M}XH14GX(Pt~)Ug6Qm0i)y_%$Q%>4mUfg*90M zGNu6fdRz_ir-%m#Uo1WIxy!qEHbsqD+zrlV<oT$etiVmGJ=16up0VE@G5+!@GrVmv`^r3;Egb23; zBponX=<#8Ne*D$5j)#sFRj=iGDti>UYD7(G)e8QGMIs0JD`9{Rcy$UMq;YNP{$dU~ z%Y-6#M3{!PV|P#}TR8}BWUFe#{<4rQMt&I11+MiP{{t%Yu1`)jYajKEI5Np{e|*^_ z586i@99w{rA9)=4W*W$PHL12FBx9O017gozjgud)6>@cM;(%YWGjSu>InJy39TnI~ zQz1x@@JO4WHco?~_VPcUb=~HXB+lBpX4Teguer%`HNY`v{#BU6rk|({V4^Q48$Ivk z+lAv4FAv{rgz|KE@*l*WcWL`0xxjHz(W{aaNIqO1B$WP0vxx<9^>5P#)lC4&o{_T) zJ;1dc9AkU~Kw01mZT1iFo)RRsH9zX&N**=9jB?#s1@{Dh-U6z(gX>)c%5^Hr2_hd* z68dWI^7EtE^y*nk3KEk?4iHr4Xz1&gU10Xkr~?}v2;%q~JCEweLM@6gr0z32oJI1skC6rRhST$t+i)lRFSh@xZb(2+F6;HB^O z!d{%k*q*XnXT^SQx;#Jh;G9vAP?MUMJ8uwFwxML2JmKjz&AeLCa(sZKotb}JdBa%i zKq)%RF^90+m}i1xKhr>8)cx0|>LJMCz*Ryf^*Y7JX#|6uNeRLUfO&lB%U!Ib~^oZ#9svGs2OijiRb&-Y%NvZ|yv0X2zF$qjZ*WQL#r0)Z; z5N2wVe~*$WVZqS1iPB1 z7RIxr%hCVoqT%vww!Q(ei-dV}Tkl?OH2hVV{c67uJ&RRk0&VFwjhnz|$tT0vU+8KF zq@St9M-&V!-xq57fwA*QncvQpbzV5o4S%T z^>AVo2C6$*Bv1E4iIa82daOT^h<9z#FuO^xB|Q}R8WL{Rj$rni7gTBzZ3(6%O9(&H z>%ZHR%9{O?N8Uy;QSf~h;S8^;Ojeaf_@%iql)#A?4En5J7LLHfCW)275F0^cU&yy1rZXf7Ea#$;^TmfsJ=32y`TH;t`ArGR+R1MDx~=Zn$H z!~>23aQ4J)-L=8_X#3D1LZ4)O%OtV`w2%H``Zejx^>YTq(@3vbjwJ^4yjGW5o<-0t< zjf@*{pJFF=!5~;1@L9;-&3a*=?3s;qfx)%mu)8J3Cfcxh)z9R~PmyZIzi=wX27O~3{MYuOQs z`9J}>(5C+qyzt*EUjaw_+Cy-?MkW5b6$i>MC9!oYV=O-}RPlS`B%7?L31SSQx=R(S zdlYQj+euD=S^vfX?7taq**;+{J#|3ZVYSMA1SHxO5oH%Q164PG7OxPlfMhR=l|`&HPNKCyO?^hu_c1ogwLmK3Z+3b>JkulEwj7XL9fv2|h_@3xLU~1_ zWSR+?9a8 zeVd5KdPaZ6pWlFGuHiAf_K73>3B8kb;S244)2*{*Ky}|OEqt3XOQC=53BlCF9pu2M z$?pF-3Fr@mTO?TwMx9yW!u`5w_fBS8XY}CC3{C1#^MxleZL?dqjfXF~jn}IVp)-G_ ziUhzaal&Jj?*68TYg7D4AMRLQO7;frXCPksEHQSRAG$DO0+WXTqnA8}VLE(WmPI<@ z3vkj4Tl%NlN2`#o^d2>)J|&OoyL57WS4EH=H}+-~{eplfT6} z`*>_j`$Wk41eCnEw|(p|9zcyNIk7iV%e$k}dWZX$PKJH7*pJfBDT^R>ctgf!%N~_J zCPS)N_}k)c0yR6?VhRSaw-aFJK5RSJrK~jg<%r*H6#sATF%n8RSKNb=JL(%4mCdW*S7i5H`W$f_;BNrNF8rRO4b z4Q7~9FsHo}Gm*D*fzOhVU}u;Zu% zL`iUY-vsp^312AkTtE$^ihSN3TlE~fm&qBd9W5FFWQW+ClSyTpTN`A6IB`xW5^FZ- zorXK_r4yy=*y$T{VaG~pRUY3=tIauXfQ_u4{mcN(UtWx;zSE8$xh##bG}A|Uw8$J7 zmixeuJz42@Khgz>VwMvE#8*AY$An7W8_&jO{qSvvN`0g{w)(3UsE z+bk#YZW;Hapha^YgFLBYO!CXRvbnq9gKxfJPZBhBVSR?<)ACa;ZM7ehKUP`^_wd1` zP0-bylthx>6A~jmcxd@k{>!a+5j~N@`SqKZB=zNKm2Lrlw6PO>Ke)PPv`@F6#wtGB zbG#=luxCa5HRngBz#2nBT+hGJ0@)1~B;g%pCQm042v=W9WgaNkR3&I=dGJJ5Q>*Xi zI=VEfasPTT%l(@LUyHIt)H+J!@z=qrd+R0=UIw7aa)QKw&zQlNz1(VK_w6H(G`M-P*};hru$$| zzo*53%48v*5c(rpL+Xb`YsC_vEP-@Gks?NOT#w^qCif`&pgGA^&{D|6MySIrc6=9o zL?OODBr_@fw-zG8I{)~L5_BL0Tp<(<>efCl;XA9x*a`#zY`v~LDmmGh3q}ANlK)(f zKe~^QshHrW0iBP(+^rh4YGcq*M}55U2? z`7i?iz0?#fhR%cgJQhp2=yn8+CIiY{L?4*@#}4CbmOBt@TLQ<60Oj3P~ti3X%BtX^rb}V1h3XR>RFCw zMB5y|e_Jf6sl^8EwS(dC&m_&T_apc{7f(Ma4SX(@vK8orOgD}kUu-I0E3WnB1kJ@_A ze_51U`SK=ie%CizAdI;Jq5Ymc%UijT@QJ89dtORM%)(cxXSDp7@6FXiD<$U!kWJv^ zJ^ZTAGI*RQh&x#Ydtbi_A)Gc`Ph7%N+$SAr5YXn?l!x_gddS8U!NBfj_CBjuB+19e ziU(ItdT|4XIu$c@uk;?7SvF-tpSyG5QtFRD@PB~L&c=T5f!C}~Y{>^wMYks-D|jxH z&1JN~{_hc=NIL#0hbXLR>c9e7(T#J|e6gppp!v1_$JHmn(C)g#s!sj6Tm?+jG`o#Ak!=m@DG8<^Bi|n`1Vw5f1 z6s;>0=lKQ&Qt5!4k^*l<24JQ(03}im|>}vz%1qpkAAPMtk401@! zyjSI#BxlPF$RB>v+p+tWk~8X_zT7I0Do6M?GYij4cP&2ec-gNcssw~kI4pFZr&Ii# z>fEAj<%<;gePhEBo;G*aTu#UT^*dX$+DOMe#leDb-x#-0$o31M-lxklG* ze>i;U5KbgMMgA{v=`0cI!4xZ7K=RpoZ0tP$CDiskri-OM`hde@tts*dsS8seZx;0y3968lXz(Qk^(b|#7Bac>R=MO?NAA}8Rs*jAWAx@#yDH@Z4~`p& zboDJuZ)`XRxWd_r0xZh6N+&MW`@`zhI30{c+PZLXi{h-bl_*i9910^~Gr|a!kiQ=t z6suPu{DMT6x{n2j(hJrfp*XbDYjzzTv3$r8f|J)Llzcg!10@MfxV<_ot?Hj6&n~Gs z-Vn4ly#JiyntkZici$z&_EgL0Z6T0hh#+9`63N@magBBW!>TMb&&NJ@<4@+Gcf0LJ$mh&}JmkRd;^TylNR!&W> zQAn7NKb|KSl>6_HlM27cUk~JeZWE*nu`7FOdX1`w7Wd*A^;4Z6o&D1NYF#_6bf+ns zuPilBT{yROYpzra64dOcII^K`utU$(q=LXd26fk7>aa3!Z!yn|IwsP`kC$Dl& z8AFG5aF1j@{F8bm;aZ?ivilJ_>^YyRI!2^}&Fx&I!faNDhzKlBqV$m1ixnUavM?e3 zPKxNHQ8%~W(bcoqB%dYYcM?3Q>`}Ouk%6c6dxa1oAwQ;5 zRMm&V8YfE==(T_&f;hog*D+~0Y!FgXtxGem&#sLdQosHC0&g(Br3}ySShy4s#^I_8o zVEjpS!G>6Ffd=?)o>@c&gsuMBasi;G&dqtakO~#22k0Ma#gw4cxx;asf4h>HOUtFi zH~?Z&4*?km5N@oG;o^Kp-?o~x>;G@SQP< z#-7UrE=l1RUEsr3&;4K2|0i&3y;#I%-zb{6jRtGA#FG`dJm&BsGo@3O?dsSFc^F0| zd*Z^r8tOTe>_}tEr0D1mM2Z9QvmRa#5|0SIij|7U<1hlJ;@!=YLmZb zY=$VB{k?7*(73nG2Q;_(FG3%|<&>aPG_F%OZqmJ@!`!7V%&PcxE7J92^uh=^gQau@ zH}7{5;+(Y0pgU<>Hg{ zjHa?D@-vy2h}y8uB^tg2XGq|TP(axcnD1>}<*{da8bFI4gc;_zcG*Y3(%7{*_9aOEAP zWz5B~1@qLh(yXEVuJ6e2a!&2x=C~9&o*pV&8cBlG-+0k&jN_AN%2cm`H%8{TB4iXc zIlL6sUxj=+;o4LV&G=OFi{I*D3KixqPh7l+*F*d-+)48~uWEYUOK$fFw(qk!0~xy= zY~k0C-Sw?9jTKqZAE6Y3sl9{bpC)PIuKX^+C zKmf77jj{>za5-Hk+jbRyxD#mD5}+(^?-4p@hq2@lkP<(HkI4f`OIkLT#*${a&o%Y8 z*P54(^ajUpqRdAH1CK(dO_&Oma2bVC$VqLr0c&>?d#TM#yOx<}A3*!ai~{Wb6|Wg4 z$Zhl>nyzrqJO{r|*T3pd`}~tJ#X^Q-)v-t{ml4(y5I)v!Uy**AI1reExot{ zeuqGG40njabpVMa0M0gGWfqO~FDqeVh#J`eA8`>~x43NsSOqyymPNb6GQ&uev?lp) zO@3W}DauUCs|nwat#UJ8v_>t&+?%9f19v+V-(%`l<@u&mcbuwPvWk{g?@EUO2$?qj?$g?(4x2dHnc#C5U^Adhr@X(JW}x$cY2BT3$o{UI zv#Q0|bELRhaoI50gjA+;Q`B6u1_hj2Qt@*wl?P;Jg+XU}o+2(no&u=ppq&2sR%Wl6 z9bd~mq%M^2idjc<TbPZA2b zYJy8c#op>aeJ$2l%eVc!YNei8`Q^qS-nMz7==7IDa=|BWw`25?^PYf<&F``|OqGZX zPqx3kba>#~E3-j7hN~5Zf3Vr$e4b3F)pd0kIz8>Jb#a6+BM;#6$71m~z6{0p{#@X6 zcYG#t#1&N~x0OxK(7oyWQt{-WZXk#f^8RlhpabSO^){dbkKO1 z%56cRw#3qEem`Y&-C_6}Qd?H*8-m|tnBOtEYpc<5xJeiSah1ygZF${Lm_HMS9=kVb zK{HUGA!~PqX1cWFW9>qeWo98)3)d7xP`t-iqe-C|kdB}Y&5~?KJzCsqS^a*>4jz{u z8TtIlz30oome)`1W}H*=vsi_V(T4fv2D9DGBftKc^&8mnaDI-4D$9-N#b=K^(!VU4 zz|N~;0P^c{h$fnm5e7D=&k*|_*v_u&pDo^&Mp{m`|0^$XyH*kbS{8bJH-AD-&7(?I z0=0DSnFgK;A~1C^$l?Axxtw?~-5YOJUAJrw$a`5xT$nhw&gk^M*;vjlg>0GMgfx;3 zC%Mch+sRkFLawdy<^NwB--%fVmxNcifdaqPsjGlGx1a{oJ zf6Hi8P2P@wkn5~X8aBbU0hMRIHQa(&%#ppQ1F@IR9vklc!FCD%(mssXbC&gqo>=_( zx;H{^!1b)D6+~02#N*sSvnt{;y*~eMuCzKcu?#N!I1C3~b@{O0qYx)ut^B4ENG)5l zES(bN+9`9BnK!{b3#hIZ8&}0QY!l?D;9J{26=*8`mi|NU9|k6C-scI9#`{{{I=0-S z-xo;kUgroH=asR4w?G^=#!U)@&N@9%3dJSv1!N#-Hq)c&rZa!czM{Wr9f`18Ky<66 z7n`kxXQP!nUuL8)raVuqPCtYIyFJy#iK#D1V)OtxafG;d7J0jpia+|}AW_&NH%}w= zn;7JY7eCQrh2`!Zgm96JpmAc?eL#AHBB23znRr!qi-I!dYR5P-D=O*4?@gGcK%*rPm}YG8R5klV03Y zY`>+g|L1-vW*zxE>Z_$OEpo3l{9sC%-6y0|Cirg9gw@fG8GriRW@hWuL94N38Q=xr z{QjPDDogS&1b5B*=C}E0JAK=cRZG?5DqfJ9jUycY>ZgYZV=VqQGBTgX8!!}1%<*|j zX@A$2+C8GMffy%;ziZ_$lY~fv4!A}hRtx`*Vpk+eEzC) ziKWfN3YgNRt9WI}1&#HcsG5xn-4}pV|U}lbEd%4gU`k+>`z;_o9$G*@ydGncRD+k1X!ma{26VzS-AEJSSrLV3B zN-XeR>WZ_{Z)-}9dt>i$yUa(+b`iCPr_KsLwg!f_FSNzf<@u;b&+^tiu4Grfhz}{V z=TEt$+s%#F$02)j(N!xWe?M@dF;40sd_s{!Rr4DE*Q-o8gL14kCv^2g6L6% z8TfG$T&nPq*H_+6)UTW!&><_4$5%d^l8EPn7!eLlPx*qN=oW=yF2|L=KCicb3VdSzC(7KjZS}-fgiGs z7kYIrEd!<|_JzKkaLJ$e&bGi1#mhk6kEC`v@&JD8Tz_{nJPBKa1kf`C(r-|sc+fdSzGb3{VS*}V*xgd z6Z(zhWL3lROfGpL`m>u4D$o?wBsVD?K@gh!GBQMw_0m(G-E4f{>nSp(-YwJQ%spdv zG4b(b3$8smd(K7SGDge~=vx$x3TVj0V%eQ77PSz!l_Fuo`Hor(3nHyL)bWy@whxk| zwT>#UWbpBXc|Iq9V~Di186yv)umsCdL9Sa7$Cmd0ylle=i{Pupn<1ado~}t`io<@Ng`zPj)`aE%t%LW^E=@^ zut(XFermvAG4c^|5c=s>4<)X9r$&G4G#-pODxhjmhkYv59;IQyZ$ip&<#123ab+&> zH8Sgrq1~;cHLBW9@w%bk9Kf zmCBXj*T(exO~2N!M_#+>qvD&D?c{uJ7K{LK$-WpxTSu{R*s zwYBNK^ci*^j_k*5V!C3ms@gX+5v%6Hh&10pUl^h#9I=BJ6G=skU2>S-JnFIWDq=(` z8LWOYYhCB2TdNZ7Z>wxkK(d^!r^4Spxtxuiq5hN1lTkxBmyf+j#lhdoVZm}R8XP!& z9AoEw-%G0L)^`~e`d-7;SQlhtnpvj!qWPPr7x6I4oZNq|Ywd87z#3=i6tISa91Y`v zvD1Va0#^@cr4(^Hx1Pgpyn7668S;+Xy(uzG<<_~H z9)=3ml!+Q;8*8#%km<0+%D)9rvW@J|?6EBF8A}S-?T6#k!im@@iRj7K;9D$@_q(?J znWRKzw0urlt6hCf6|xSeSL3;o!)Cjkk5YUrEMiUFXnXk^aZdnfEyn_Y+)4f8n{M^0L)X|;UB)w>8>#KasPR9oxras6&RR$BY{>`RHau?Cry&0sz z{58NX`G!qD8_A0?Mb4J{Jgwgtl2Ffx9u(5cyX5X&(?PryDwts^+4sYitd}1COP&kz zoDTkTE{U!&7IMpFe!}u7Q!agmEIQ?yk1}j-jz^C-H!yCngL2=tSho%rrw$uwT6VvY z(bo^xN3Gj>*k?&l!BVT%1`|yp&mBOW1+mRV5_vB}n&j@|`5EQjk^Zv-?$LK4JvYwU&$1>}BN7bdR z?2p0Fy?B~)(J9qwkJOeOBR4a=TQL~#zFM`$JnW;%7O_m* zw-`d%pqJi$9wXZ>To>MH|dhyH)84sOAh_#Og-saEvs4iyyQ7kI= z_#pl9arbS>Kjia;*hGzC5r`;6~<0?`lQJi_0O;0=(QuvhM8My@5YCkn9!K~ zc7FG2#`L$9dx~b9SphbL5#m}Tq~I!v+7~bh)i><5w_U$B+h5**f)k&V;olVeudCGj;>TxwJ54Mp;i>7%8?-Dw|5@_Ot^+? zo7OO%3JAFU)kKX_uS^2aqa5oWzf zNa}<)g_rw{uG1QR77!{7Xr$dsKXXCX+)H!;=O_XuZ>&>VAy>d8Z|Ce|uhPr~7x$i`}#?l}Az_ z6RFr13#wS5MsfJcR&|Hwi1s7w#z+_1%pq~tkg;-y{@X@h>DoxzqV*bOg-%(k-%c32 z+vMj75AW*-DM!n`&*`YUYsV(wV2lfZ({;Io5GDLBH}8R7W!Wl)NP()C>T3_sHQtH&7=%(7rqralR8+g6x7 zcMS(+L(Se)fOJPS>iU6qR>8Z#w(fbiIAl0e30Rr=H*){iaz}#BlIX6kv{kkx%s&GV zk!48-Z=so%!C;WH93L0Iu>ZfBu04_~38)wePo;i%3*xlbfA zHup1D6q#&M2t%dNH<|k|nfqvLNem;GjbZMy*=)A2e&_t&|KER}_kBK}=lMME`#gK7 z-WEOgnD=Wx;0HA6C6|g^Eu?tsqpbxGpWB~nMzw>bvO6DPGb&@Z>kEi0(6hkLDIGL* z(YNJ-?6I;FY}v6GpkBXs2wu>e<{z6s5pgRJwADHN5hL)w>XGp`Za!X-0VHM>JX-j5 zdiS{EcCPr~o96vb8xwRj3R^BOeezw4!8 zLFbKflJ`+y-Vuw(_ow2XSf1!XAy+<)Xyiy^eaK&3r+l1Hm>3I{DB2(prDVR!k zcusnO9LDZ!!)`l`$hd*2(TqsNVK!j+x<+in{uf3Pq&Iw|LU40dvnL0>HJ_HaIA9}1 zQpOTzcrAs8wxp9OGiRLDx?h5O*4nIy&nbrf4aW+cZ=W*CL;=!Bq zXI{H%%Jetrj3=SiFOMNx8~j@`7Z0LWAJ=NHeCI?#)>?pk*X*RjZaA1~hFr0*Ztl4rFWvrPy>kH6ft`qkFW5Lw!3S6KNm(h%uzMs7ZRhsOg;u1m&y4mGfDYT_?lD;XmWVvX|?5vV; zxf>n&Ija8A#$^^NeS3Uqf8Hat7g+}~jXV(C>KUb$UDSuCHH=CFqk2o(`LQarSTU|J~m)b0MRco-7=+i;j(2h9{Tls2$n`3#a<7!BZdm4Htj z>9Md0r8F=wu<6wL*VxHxwwTt_eMxDh=!_UHJRx~&_3$&rQsBZ1*Uz?hVf%HtDVb^c z<`nJb6nO)TOZErg&CeEEX6L%D7lQL+pzXz1td6PIKgXdGVJlBN1P0k^C4*0xwg2y1 z0`YX`%Hgj~^3b(Y`N1+n&&G^HPfD8{By(Kl&e5pH?bwvrwo1i@j>)=oLm~d~zB6si zDaYUFIESLN2@yBRy!&3_ec1Az!tQfgx_a6A!_cxWfxJr9Q(*K!ZRlHNvql-Bmbp-% z6@;ycbS;$u);Qq~7tt$<=MrD5Dkul2LXM+v;3bT;kn|8%P(rFp5T6FeY=bWX_K;HX~yQXzvzC~qgf1%Ma z&?z`bIu$E54*o(!lR~&^XPh(*Y6`?OMKSr z9`goC>c43XPF(mUmb2cVbvDZ-(T1*bi6Dvy%7`pi_vdw)*3s{TFA)HCA+`OY)r27) zR^3Z5%9TT|Dfet+k6*Yy5XfBDzp+B_ zLaHGzN7^AbCiO+$iM~hud0s7UtfcF%-I>Cda=zJKP$scEh+X+rceb(X8$#-?^^<)~ z$W-2K%gH+R(m4V?O(g|NukyA80SNMZW^;g_{7g#P4Kximr;=H#t=6#bKVdop7%EKavr zw7nw0rIIBt##>)R!85Cjb7{U-U>EO;l;J9|3hCBtmD6U_P6VmevJi9*K4RYfp~w$f z4&T-rdJVxq!`ef-0&oxbsyFvQ&iYw3V+F-6 z%-UTQ<#nZLL)&bZDovS{$e&@Zo=Kg7!U%+S!oc9rpVZS6L6=3DhZcRLj#NS#_br-J zdHR9%25V2;At8$zdh+of<+0R=n%Bqo2y@2W)m>6QPCeFzTST3Gg4(Up%pU;xIM>q}|=G@VLKL zGU|gw-HCZwkjLh`YbIWTOCam`wN(ESnoC6)055TOhbHa%ImznFOMWLeKg9s*{k%{L zmN99=tLYqfYeBEbA>NH%FAGAQu7@y@rp&G|{umArK(+o3|WKY}oc)uROhKucb?-DLtL#R(85K8_-loWgV8mVcR9c zfFs0%Cd3QKdA0No<8@|N3*l?1!_Cz27nGgh&i3?OQRnYu~pOv)XD0 zTUrUT$CH_Mv8$=5&r9npOU2?0_NxX1P<;07J>x*Oxe0SuUeBgawO(S_Us8|XGI-q% z))f8|tnf)7ODbg2nA%+mq!hH+#s`Se{9gzuemE!2e6%Gjvpba}q2^&ktk=#{K0{)( zUF)j62L+jpqqWUN!P6O)x4K7WOQV~&m$)UT6*h~e92kw{&x;mGPpWA>eKS1USb+7o z=j?rrqWbu)0r1`V1Ph9u4Y7yKVvCF+iM|{W3%b9 zcs=MgTY58x74s^)zY)?>G&OdQ0Pqa>zvPXezB74`1X3RixD&eW;Ouy$GZ*>Vg6mjE zqpw5+mF+9$)D`n}%p}}jWU5dxBpKILtoaBm2a3mUuvCw!sYh4n-pG1?@W{buzRM3hNgqo>`y%OT;Kkg2`Xuy2tN^hj1m^Kfy zthAz|^3LLti`Pec!^}{>s+!Rrrp*0_IT^UAkQ{b$qb+aao?203UzkWc{@ML43OU?mig0~=Wm<<}`CcyN*rcfMX0UByP0VLd7{|D8{_&B> z+G3VG!+4o{4t8e~ANaX*{LhFlGK+cb7nzT3hBcZgwf4c) zBy>`1gkSs0wDEBT-t=e~4xs3c7M8PJf~6EZtWC5j4$A*Mu+#q)PYubd9CcgW`L;3` zx)lAv@wm*e3c@?sE4QtjQO{LOYkyE58|N+4yciwr&7z|rd4{z_rLlcUp7esmxn$48 zjpX%|u~@yoioPVjck=oUB-@jXICjlVz!anD!1KRUqa7?56Ct=$$-oFuwUD7rqe)1- zgQ;?^?2FBNq~7!lr#s50AUqdj;=e5?oftp8cH#-GAM-`?gT+T{1qexx*YC`#!u{;O z?Z?QA5jdx5T}j{^+$FoF>Ctl#O>QkRCKv%CKOe)PyfY7nUyxD=Eh^f7Pwj}tCqQhK zuEp^5McD!H9^!+b6pNvSrm*b&%&IGv8G<#m{q_tHhl{&FQHptF<2%^EhBO4iY_^;~ zlAxp=jf6nX*S2y6#8+fMLjQ0HIn)Rw~&&s?n>&mI+@I8TZyim=E8wHvom1aF+sL8cd*N<~HUo%SOz;xJGzeGXp-$ zvyFVYqDpp8KAFmXiM4V9#NV`zw1&DjEQ6wrnyEh~7sc7tVyRjaf%w?gL@M~zE(C+W zdp?Bu2i$x&pP?SLft4)lqHeiWD;FX&i9Y*}cdNv=*K3XS36=3*Dei=JmvM$Mi*$7xX)!=A;r@ z?@om*f3Wpm-@uBqO$HTyAMwv>^stA>-+AFv5n@DoxKvu*G2#z%+f{v=ae=utY{^a~ z#PVK+ymSK%j|gLK;Cxj(>AZ}Y<3*H-=@DWQwrKg5?+A8=4VKO$(D;#YPAgsFpC`V_KmEQ)o*%M8;OdXF90LAPsn9>fI|2qA@*^!Y+wl81DN~zoMxIEp{+XY)mbS%0nD}F97hH#BMschDl8+F<0C`7oZrji(nr>l}s;FCQo_f}>`Ir-V9 zX)|LkWTKl@c1iSg!x@#?ElL^==ls=<%v`3vWzD)A1&ld;%KRl+fOf<(+Mrl0nb>?Y VD?adn{jQyL{hH&|^8a`z{13@MeZ&9& literal 0 HcmV?d00001 From a53fdd724a53b3267a1b1d618abd3169bb099463 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 15 May 2024 19:57:50 +0200 Subject: [PATCH 58/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 48 +++++++++++++-- example/src/Examples/Breathe/demo2.ts | 58 +++++++++---------- example/src/Examples/Breathe/demo6/main.ts | 17 ++++-- .../cpp/rnskia-android/RNSkAndroidView.h | 3 +- .../cpp/rnskia-android/WebGPUTriangle.cpp | 6 +- .../cpp/rnskia-android/WebGPUTriangle.h | 9 ++- 6 files changed, 99 insertions(+), 42 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 21b4db5fb5..be949379aa 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -1,5 +1,9 @@ import React, { useEffect, useRef, useState } from "react"; import { gpu, SkiaDomView, useImage } from "@shopify/react-native-skia"; +import { View } from "react-native"; +import { Gesture, GestureDetector } from "react-native-gesture-handler"; +import { useSharedValue, withSpring } from "react-native-reanimated"; +import type { SharedValue } from "react-native-reanimated"; import { demo3 } from "./demo3"; import { demo2 } from "./demo2"; @@ -8,9 +12,28 @@ import { demo4 } from "./demo1/demo4"; import { demo5 } from "./demo1/demo5"; import { Bitmap, demo7 } from "./demo1/demo7"; import { demo6 } from "./demo6/main"; + +const sf = 300; +const springConfig = (velocity: number) => { + "worklet"; + return { + mass: 1, + damping: 1, + stiffness: 100, + overshootClamping: false, + restDisplacementThreshold: 0.01, + restSpeedThreshold: 2, + velocity, + }; +}; //import { demo6 } from "./demo6/main"; -const draw = async (context: GPUCanvasContext, image: Bitmap) => { +const draw = async ( + context: GPUCanvasContext, + image: Bitmap, + rotateX: SharedValue, + rotateY: SharedValue +) => { const adapter = await gpu.requestAdapter(); const device = await adapter!.requestDevice(); const presentationFormat = "rgba8unorm"; @@ -20,7 +43,7 @@ const draw = async (context: GPUCanvasContext, image: Bitmap) => { alphaMode: "premultiplied", }); //await demo5(device, context, image); - await demo6(device, context, image); + await demo6(device, context, image, rotateX, rotateY); //context.present(); }; @@ -38,14 +61,31 @@ const usePixels = (mod: number) => { export const Breathe = () => { const image = usePixels(require("./demo6/react.png")); + const rotateX = useSharedValue(0); + const rotateY = useSharedValue(0); const ref = useRef(null); + const gesture = Gesture.Pan() + .onChange((event) => { + rotateY.value += event.changeX / sf; + rotateX.value -= event.changeY / sf; + }) + .onEnd(({ velocityX, velocityY }) => { + rotateX.value = withSpring(0, springConfig(velocityY / sf)); + rotateY.value = withSpring(0, springConfig(velocityX / sf)); + }); useEffect(() => { setTimeout(() => { if (image && ref.current) { const ctx = ref.current.getWGPUContext(); - draw(ctx, image); + draw(ctx, image, rotateX, rotateY); } }, 1000); }, [image]); - return ; + return ( + + + + + + ); }; diff --git a/example/src/Examples/Breathe/demo2.ts b/example/src/Examples/Breathe/demo2.ts index 1b73d46f4f..6b5b0d6eb5 100644 --- a/example/src/Examples/Breathe/demo2.ts +++ b/example/src/Examples/Breathe/demo2.ts @@ -19,24 +19,22 @@ fn main() -> @location(0) vec4f { return vec4(0.3, 0.6, 1.0, 1.0); }`; +export const demo2 = async (device, context: GPUCanvasContext) => { + const presentationFormat = "rgba8unorm"; -export const demo2 = async(device, context: GPUCanvasContext) => { - const presentationFormat = 'rgba8unorm'; - - const pipeline = device.createRenderPipeline({ - layout: 'auto', + layout: "auto", vertex: { module: device.createShaderModule({ code: triangleVertWGSL, }), - entryPoint: 'main', + entryPoint: "main", }, fragment: { module: device.createShaderModule({ code: redFragWGSL, }), - entryPoint: 'main', + entryPoint: "main", targets: [ { format: presentationFormat, @@ -44,28 +42,28 @@ export const demo2 = async(device, context: GPUCanvasContext) => { ], }, primitive: { - topology: 'triangle-list', + topology: "triangle-list", }, }); - - const commandEncoder = device.createCommandEncoder(); - const textureView = context.getCurrentTexture().createView(); - - const renderPassDescriptor: GPURenderPassDescriptor = { - colorAttachments: [ - { - view: textureView, - clearValue: [1.0, 0.0, 1.0, 1], - loadOp: 'clear', - storeOp: 'store', - }, - ], - }; - - const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); - passEncoder.setPipeline(pipeline); - passEncoder.draw(3); - passEncoder.end(); - - device.queue.submit([commandEncoder.finish()]); - }; \ No newline at end of file + + const commandEncoder = device.createCommandEncoder(); + const textureView = context.getCurrentTexture().createView(); + + const renderPassDescriptor: GPURenderPassDescriptor = { + colorAttachments: [ + { + view: textureView, + clearValue: [1.0, 0.0, 1.0, 1], + loadOp: "clear", + storeOp: "store", + }, + ], + }; + + const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); + passEncoder.setPipeline(pipeline); + passEncoder.draw(3); + passEncoder.end(); + + device.queue.submit([commandEncoder.finish()]); +}; diff --git a/example/src/Examples/Breathe/demo6/main.ts b/example/src/Examples/Breathe/demo6/main.ts index 1fce45bc1a..568ffd1b5b 100644 --- a/example/src/Examples/Breathe/demo6/main.ts +++ b/example/src/Examples/Breathe/demo6/main.ts @@ -1,6 +1,8 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable camelcase */ import { mat4, vec3 } from "wgpu-matrix"; import { Dimensions } from "react-native"; +import type { SharedValue } from "react-native-reanimated"; import type { Bitmap } from "../demo1/demo7"; @@ -14,9 +16,11 @@ const presentationFormat = "rgba8unorm"; export const demo6 = ( device: GPUDevice, context: GPUCanvasContext, - imageBitmap: Bitmap + imageBitmap: Bitmap, + rotateX: SharedValue, + rotateY: SharedValue ) => { - const numParticles = 50000; + const numParticles = 10000; const particlePositionOffset = 0; const particleColorOffset = 4 * 4; const particleInstanceByteSize = @@ -388,7 +392,8 @@ export const demo6 = ( mat4.identity(view); mat4.translate(view, vec3.fromValues(0, 0, -3), view); - mat4.rotateX(view, Math.PI, view); + mat4.rotateX(view, Math.PI + rotateX.value, view); + mat4.rotateY(view, rotateY.value, view); mat4.multiply(projection, view, mvp); // prettier-ignore @@ -412,8 +417,9 @@ export const demo6 = ( ]).buffer ); const swapChainTexture = context.getCurrentTexture(); - // prettier-ignore - renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(); + // @ts-expect-error + renderPassDescriptor.colorAttachments[0].view = + swapChainTexture.createView(); const commandEncoder = device.createCommandEncoder(); { @@ -434,6 +440,7 @@ export const demo6 = ( } device.queue.submit([commandEncoder.finish()]); + // @ts-expect-error context.present(); requestAnimationFrame(frame); } diff --git a/package/android/cpp/rnskia-android/RNSkAndroidView.h b/package/android/cpp/rnskia-android/RNSkAndroidView.h index 398138adf7..171fbf5230 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidView.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidView.h @@ -9,6 +9,7 @@ #include "WebGPUTriangle.h" #include + namespace RNSkia { class RNSkBaseAndroidView { @@ -66,7 +67,7 @@ class RNSkAndroidView : public T, public RNSkBaseAndroidView { auto nativeId = getSkiaView()->getNativeId(); T::getPlatformContext()->registerSurfaceDescriptor(nativeId, _window, width, height); - + //RNSkLogger::logToConsole("Surface size changed: %d, %d", isVulkanSupported()); // runTriangleDemo(_window, width, height); } diff --git a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp index a74c546825..1f83d29a91 100644 --- a/package/android/cpp/rnskia-android/WebGPUTriangle.cpp +++ b/package/android/cpp/rnskia-android/WebGPUTriangle.cpp @@ -9,6 +9,8 @@ using namespace wgpu; +namespace RNSkia { + void runTriangleDemo(void *window, int width, int height) { RNSkia::RNSkLogger::logToConsole("width: %d, height: %d", width, height); auto instance = CreateInstance(nullptr); @@ -254,4 +256,6 @@ fn fs_main() -> @location(0) vec4f { // surface.release(); // glfwDestroyWindow(window); // glfwTerminate(); -} \ No newline at end of file +} + +} // namespace RNSkia \ No newline at end of file diff --git a/package/android/cpp/rnskia-android/WebGPUTriangle.h b/package/android/cpp/rnskia-android/WebGPUTriangle.h index a29cc10965..4434929e2d 100644 --- a/package/android/cpp/rnskia-android/WebGPUTriangle.h +++ b/package/android/cpp/rnskia-android/WebGPUTriangle.h @@ -1,8 +1,15 @@ +#pragma once + #include #include #include #define WEBGPU_CPP_IMPLEMENTATION -void runTriangleDemo(void *surface, int width, int height); \ No newline at end of file +namespace RNSkia { + + +void runTriangleDemo(void *surface, int width, int height); + +} // namespace RNSkia \ No newline at end of file From bc9bab8d534f859373b403c2fd3807dcb8b68567 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 15 May 2024 22:04:34 +0200 Subject: [PATCH 59/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- example/src/Examples/Breathe/demo1/demo4.ts | 112 +++++------------- .../cpp/rnskia-android/RNSkAndroidView.h | 6 +- .../cpp/rnskia-android/WebGPUTriangle.h | 1 - package/cpp/wgpu/JsiTextureDescriptor.h | 4 - scripts/generator/model.ts | 2 +- 6 files changed, 32 insertions(+), 95 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index be949379aa..5f4498295c 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -43,7 +43,7 @@ const draw = async ( alphaMode: "premultiplied", }); //await demo5(device, context, image); - await demo6(device, context, image, rotateX, rotateY); + await demo4(device, context, image, rotateX, rotateY); //context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/demo4.ts b/example/src/Examples/Breathe/demo1/demo4.ts index 057a110b11..4162afe59a 100644 --- a/example/src/Examples/Breathe/demo1/demo4.ts +++ b/example/src/Examples/Breathe/demo1/demo4.ts @@ -11,19 +11,21 @@ import { import { basicVertWGSL, vertexPositionColorWGSL } from "./shaders"; const { width, height } = Dimensions.get("window"); +const presentationFormat = "rgba8unorm"; +const aspect = width / height; export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { + // Create a vertex buffer from the cube data. + // Create a vertex buffer from the cube data. const verticesBuffer = device.createBuffer({ size: cubeVertexArray.byteLength, - usage: 32, //GPUBufferUsage.VERTEX, + usage: GPUBufferUsage.VERTEX, mappedAtCreation: true, }); - - new Float32Array( - verticesBuffer.getMappedRange(0, cubeVertexArray.byteLength) - ).set(cubeVertexArray); + new Float32Array(verticesBuffer.getMappedRange()).set(cubeVertexArray); verticesBuffer.unmap(); + const pipeline = device.createRenderPipeline({ layout: "auto", vertex: { @@ -58,7 +60,7 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { entryPoint: "main", targets: [ { - format: "rgba8unorm", + format: presentationFormat, }, ], }, @@ -86,38 +88,20 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { // usage: GPUTextureUsage.RENDER_ATTACHMENT, // }); - const matrixSize = 4 * 16; // 4x4 matrix - const offset = 256; // uniformBindGroup offset must be 256-byte aligned - const uniformBufferSize = offset + matrixSize; + const uniformBufferSize = 4 * 16; // 4x4 matrix const uniformBuffer = device.createBuffer({ size: uniformBufferSize, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, }); - const uniformBindGroup1 = device.createBindGroup({ + const uniformBindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ { binding: 0, resource: { buffer: uniformBuffer, - offset: offset, - size: matrixSize, - } - }, - ], - }); - - const uniformBindGroup2 = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), - entries: [ - { - binding: 0, - resource: { - buffer: uniformBuffer, - offset: offset, - size: matrixSize, - } + }, }, ], }); @@ -141,71 +125,39 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { // }, }; - const aspect = width / height; const projectionMatrix = mat4.perspective( (2 * Math.PI) / 5, aspect, 1, 100.0 ); + const modelViewProjectionMatrix = mat4.create(); - const modelMatrix1 = mat4.translation(vec3.create(-2, 0, 0)); - const modelMatrix2 = mat4.translation(vec3.create(2, 0, 0)); - const modelViewProjectionMatrix1 = mat4.create() as Float32Array; - const modelViewProjectionMatrix2 = mat4.create() as Float32Array; - const viewMatrix = mat4.translation(vec3.fromValues(0, 0, -7)); - - const tmpMat41 = mat4.create(); - const tmpMat42 = mat4.create(); - - function updateTransformationMatrix() { + function getTransformationMatrix() { + const viewMatrix = mat4.identity(); + mat4.translate(viewMatrix, vec3.fromValues(0, 0, -4), viewMatrix); const now = Date.now() / 1000; - mat4.rotate( - modelMatrix1, + viewMatrix, vec3.fromValues(Math.sin(now), Math.cos(now), 0), 1, - tmpMat41 - ); - mat4.rotate( - modelMatrix2, - vec3.fromValues(Math.cos(now), Math.sin(now), 0), - 1, - tmpMat42 + viewMatrix ); - mat4.multiply(viewMatrix, tmpMat41, modelViewProjectionMatrix1); - mat4.multiply( - projectionMatrix, - modelViewProjectionMatrix1, - modelViewProjectionMatrix1 - ); - mat4.multiply(viewMatrix, tmpMat42, modelViewProjectionMatrix2); - mat4.multiply( - projectionMatrix, - modelViewProjectionMatrix2, - modelViewProjectionMatrix2 - ); + mat4.multiply(projectionMatrix, viewMatrix, modelViewProjectionMatrix); + + return modelViewProjectionMatrix as Float32Array; } - async function frame() { - updateTransformationMatrix(); + function frame() { + const transformationMatrix = getTransformationMatrix(); device.queue.writeBuffer( uniformBuffer, 0, - modelViewProjectionMatrix1.buffer, - modelViewProjectionMatrix1.byteOffset, - modelViewProjectionMatrix1.byteLength + transformationMatrix.buffer, + transformationMatrix.byteOffset, + transformationMatrix.byteLength ); - device.queue.writeBuffer( - uniformBuffer, - offset, - modelViewProjectionMatrix2.buffer, - modelViewProjectionMatrix2.byteOffset, - modelViewProjectionMatrix2.byteLength - ); - - renderPassDescriptor.colorAttachments[0].view = context .getCurrentTexture() .createView(); @@ -213,21 +165,11 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { const commandEncoder = device.createCommandEncoder(); const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); passEncoder.setPipeline(pipeline); - passEncoder.setVertexBuffer(0, verticesBuffer, - 0, - cubeVertexArray.byteLength); - - // Bind the bind group (with the transformation matrix) for - // each cube, and draw. - passEncoder.setBindGroup(0, uniformBindGroup1); - passEncoder.draw(cubeVertexCount); - - passEncoder.setBindGroup(0, uniformBindGroup2); + passEncoder.setBindGroup(0, uniformBindGroup); + passEncoder.setVertexBuffer(0, verticesBuffer); passEncoder.draw(cubeVertexCount); - passEncoder.end(); device.queue.submit([commandEncoder.finish()]); - //await device.queue.onSubmittedWorkDone(); context.present(); requestAnimationFrame(frame); } diff --git a/package/android/cpp/rnskia-android/RNSkAndroidView.h b/package/android/cpp/rnskia-android/RNSkAndroidView.h index 171fbf5230..6926e83459 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidView.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidView.h @@ -9,7 +9,6 @@ #include "WebGPUTriangle.h" #include - namespace RNSkia { class RNSkBaseAndroidView { @@ -67,8 +66,9 @@ class RNSkAndroidView : public T, public RNSkBaseAndroidView { auto nativeId = getSkiaView()->getNativeId(); T::getPlatformContext()->registerSurfaceDescriptor(nativeId, _window, width, height); - //RNSkLogger::logToConsole("Surface size changed: %d, %d", isVulkanSupported()); - // runTriangleDemo(_window, width, height); + // RNSkLogger::logToConsole("Surface size changed: %d, %d", + // isVulkanSupported()); + // runTriangleDemo(_window, width, height); } float getPixelDensity() override { diff --git a/package/android/cpp/rnskia-android/WebGPUTriangle.h b/package/android/cpp/rnskia-android/WebGPUTriangle.h index 4434929e2d..0248532910 100644 --- a/package/android/cpp/rnskia-android/WebGPUTriangle.h +++ b/package/android/cpp/rnskia-android/WebGPUTriangle.h @@ -9,7 +9,6 @@ namespace RNSkia { - void runTriangleDemo(void *surface, int width, int height); } // namespace RNSkia \ No newline at end of file diff --git a/package/cpp/wgpu/JsiTextureDescriptor.h b/package/cpp/wgpu/JsiTextureDescriptor.h index b4541b838f..ada5b524f6 100644 --- a/package/cpp/wgpu/JsiTextureDescriptor.h +++ b/package/cpp/wgpu/JsiTextureDescriptor.h @@ -73,10 +73,6 @@ class JsiTextureDescriptor object->mipLevelCount = static_cast(mipLevelCount.getNumber()); - } else { - throw jsi::JSError( - runtime, - "Missing mandatory prop mipLevelCount in TextureDescriptor"); } return object; } diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 2b04cd14a7..744bc6ce1e 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -389,7 +389,7 @@ return object; { name: "size", type: "Extent3D" }, { name: "format", type: "TextureFormat" }, { name: "usage", type: "TextureUsage" }, - { name: "mipLevelCount", type: "uint32_t" } + { name: "mipLevelCount", type: "uint32_t", optional: true } ] }, { From e41884576a827f41e698ffa1d62f2be8483229a6 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 15 May 2024 22:19:42 +0200 Subject: [PATCH 60/63] :wrench: --- example/src/Examples/Breathe/demo1/demo4.ts | 32 +++++++++---------- package/cpp/wgpu/JsiRenderPassDescriptor.h | 9 ------ .../cpp/wgpu/JsiRenderPipelineDescriptor.h | 7 ---- scripts/generator/model.ts | 4 +-- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo4.ts b/example/src/Examples/Breathe/demo1/demo4.ts index 4162afe59a..27700586cc 100644 --- a/example/src/Examples/Breathe/demo1/demo4.ts +++ b/example/src/Examples/Breathe/demo1/demo4.ts @@ -75,18 +75,18 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { // Enable depth testing so that the fragment closest to the camera // is rendered in front. - // depthStencil: { - // depthWriteEnabled: true, - // depthCompare: "less", - // format: "depth24plus", - // }, + depthStencil: { + depthWriteEnabled: true, + depthCompare: "less", + format: "depth24plus", + }, }); - // const depthTexture = device.createTexture({ - // size: { width, height }, - // format: "depth24plus", - // usage: GPUTextureUsage.RENDER_ATTACHMENT, - // }); + const depthTexture = device.createTexture({ + size: { width, height }, + format: "depth24plus", + usage: GPUTextureUsage.RENDER_ATTACHMENT, + }); const uniformBufferSize = 4 * 16; // 4x4 matrix const uniformBuffer = device.createBuffer({ @@ -116,13 +116,13 @@ export const demo4 = async (device: GPUDevice, context: GPUCanvasContext) => { storeOp: "store", }, ], - // depthStencilAttachment: { - // view: depthTexture.createView(), + depthStencilAttachment: { + view: depthTexture.createView(), - // depthClearValue: 1.0, - // depthLoadOp: "clear", - // depthStoreOp: "store", - // }, + depthClearValue: 1.0, + depthLoadOp: "clear", + depthStoreOp: "store", + }, }; const projectionMatrix = mat4.perspective( diff --git a/package/cpp/wgpu/JsiRenderPassDescriptor.h b/package/cpp/wgpu/JsiRenderPassDescriptor.h index 7bcf8ebdc1..3ad36b0505 100644 --- a/package/cpp/wgpu/JsiRenderPassDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPassDescriptor.h @@ -11,7 +11,6 @@ #include "JsiHostObject.h" #include "JsiPromises.h" #include "JsiRenderPassColorAttachment.h" -#include "JsiRenderPassDepthStencilAttachment.h" #include "JsiSkHostObjects.h" #include "JsiTextureView.h" #include "MutableJSIBuffer.h" @@ -66,14 +65,6 @@ class JsiRenderPassDescriptor runtime, "Missing mandatory prop colorAttachments in RenderPassDescriptor"); } - if (obj.hasProperty(runtime, "depthStencilAttachment")) { - auto depthStencilAttachment = - obj.getProperty(runtime, "depthStencilAttachment"); - - object->depthStencilAttachment = - JsiRenderPassDepthStencilAttachment::fromValue( - runtime, depthStencilAttachment); - } return object; } } diff --git a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h index d783a85c1f..0983f4d308 100644 --- a/package/cpp/wgpu/JsiRenderPipelineDescriptor.h +++ b/package/cpp/wgpu/JsiRenderPipelineDescriptor.h @@ -7,7 +7,6 @@ #include -#include "JsiDepthStencilState.h" #include "JsiEnums.h" #include "JsiFragmentState.h" #include "JsiHostObject.h" @@ -69,12 +68,6 @@ class JsiRenderPipelineDescriptor runtime, "Missing mandatory prop primitive in RenderPipelineDescriptor"); } - if (obj.hasProperty(runtime, "depthStencil")) { - auto depthStencil = obj.getProperty(runtime, "depthStencil"); - - object->depthStencil = - JsiDepthStencilState::fromValue(runtime, depthStencil); - } if (obj.hasProperty(runtime, "multisample")) { auto multisample = obj.getProperty(runtime, "multisample"); diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 744bc6ce1e..7b0926a37b 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -658,7 +658,7 @@ return object; properties: [ {"name": "vertex", "type": "VertexState"}, {"name": "primitive", "type": "PrimitiveState"}, - {"name": "depthStencil", "type": "DepthStencilState", "optional": true, pointer: true}, + // {"name": "depthStencil", "type": "DepthStencilState", "optional": true, pointer: true}, {"name": "multisample", "type": "MultisampleState", "optional": true }, {"name": "fragment", "type": "FragmentState", "optional": true, pointer: true} ] @@ -761,7 +761,7 @@ return object; name: "RenderPassDescriptor", properties: [ {"name": "colorAttachments", "type": "RenderPassColorAttachment[]"}, - {"name": "depthStencilAttachment", "type": "RenderPassDepthStencilAttachment", "optional": true, pointer: true} + // {"name": "depthStencilAttachment", "type": "RenderPassDepthStencilAttachment", "optional": true, pointer: true} ] }, { From d008c33ed52f22a5ca59fab9748ec6d783713079 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 16 May 2024 13:49:53 +0200 Subject: [PATCH 61/63] :wrench: --- example/src/Examples/Breathe/Breathe.tsx | 2 +- example/src/Examples/Breathe/demo1/demo7.ts | 226 ++++++++++---------- package/cpp/wgpu/JsiBuffer.h | 9 +- scripts/generator/model.ts | 7 +- 4 files changed, 123 insertions(+), 121 deletions(-) diff --git a/example/src/Examples/Breathe/Breathe.tsx b/example/src/Examples/Breathe/Breathe.tsx index 5f4498295c..9c51add014 100644 --- a/example/src/Examples/Breathe/Breathe.tsx +++ b/example/src/Examples/Breathe/Breathe.tsx @@ -43,7 +43,7 @@ const draw = async ( alphaMode: "premultiplied", }); //await demo5(device, context, image); - await demo4(device, context, image, rotateX, rotateY); + await demo7(device, context, image, rotateX, rotateY); //context.present(); }; diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index ad6d643bc9..e15ed51ca9 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -37,136 +37,134 @@ export const demo7 = async ( ) => { const presentationFormat = "rgba8unorm"; - context.configure({ - device, - format: presentationFormat, - alphaMode: "premultiplied", - }); - - const module = device.createShaderModule({ - label: "our hardcoded textured quad shaders", - code: ` - struct OurVertexShaderOutput { - @builtin(position) position: vec4f, - @location(0) texcoord: vec2f, - }; - - @vertex fn vs( - @builtin(vertex_index) vertexIndex : u32 - ) -> OurVertexShaderOutput { - let pos = array( - vec2f(-1.0, -1.0), // bottom left - vec2f( 1.0, -1.0), // bottom right - vec2f(-1.0, 1.0), // top left - - // 2nd triangle - vec2f(-1.0, 1.0), // top left - vec2f( 1.0, -1.0), // bottom right - vec2f( 1.0, 1.0) // top right - ); - - var vsOutput: OurVertexShaderOutput; - let xy = pos[vertexIndex]; - vsOutput.position = vec4f(xy, 0.0, 1.0); - vsOutput.texcoord = xy; - return vsOutput; - } - - @group(0) @binding(0) var ourSampler: sampler; - @group(0) @binding(1) var ourTexture: texture_2d; - - @fragment fn fs(fsInput: OurVertexShaderOutput) -> @location(0) vec4f { - // Assuming fsInput.texcoord ranges from 0 to 1 - //vec2f texCoord = 1.0 + fsInput.texcoord / 2.0; - return textureSample(ourTexture, ourSampler, (fsInput.texcoord / 2.0)+0.5); + const dispatchCount = [4, 3, 2]; + const workgroupSize = [2, 3, 4]; + + // multiply all elements of an array + const arrayProd = (arr) => arr.reduce((a, b) => a * b); + + const numThreadsPerWorkgroup = arrayProd(workgroupSize); + + const code = /* wgsl */ ` + // NOTE!: vec3u is padded to by 4 bytes + @group(0) @binding(0) var workgroupResult: array; + @group(0) @binding(1) var localResult: array; + @group(0) @binding(2) var globalResult: array; + + @compute @workgroup_size(${workgroupSize}) fn computeSomething( + @builtin(workgroup_id) workgroup_id : vec3, + @builtin(local_invocation_id) local_invocation_id : vec3, + @builtin(global_invocation_id) global_invocation_id : vec3, + @builtin(local_invocation_index) local_invocation_index: u32, + @builtin(num_workgroups) num_workgroups: vec3 + ) { + // workgroup_index is similar to local_invocation_index except for + // workgroups, not threads inside a workgroup. + // It is not a builtin so we compute it ourselves. + + let workgroup_index = + workgroup_id.x + + workgroup_id.y * num_workgroups.x + + workgroup_id.z * num_workgroups.x * num_workgroups.y; + + // global_invocation_index is like local_invocation_index + // except linear across all invocations across all dispatched + // workgroups. It is not a builtin so we compute it ourselves. + + let global_invocation_index = + workgroup_index * ${numThreadsPerWorkgroup} + + local_invocation_index; + + // now we can write each of these builtins to our buffers. + workgroupResult[global_invocation_index] = workgroup_id; + localResult[global_invocation_index] = local_invocation_id; + globalResult[global_invocation_index] = global_invocation_id; + } + `; - } - `, - }); + const module = device.createShaderModule({ code }); - const pipeline = device.createRenderPipeline({ - label: "hardcoded textured quad pipeline", + const pipeline = device.createComputePipeline({ + label: "compute pipeline", layout: "auto", - vertex: { + compute: { module, - entryPoint: "vs", - }, - fragment: { - module, - targets: [{ format: presentationFormat }], - entryPoint: "fs", - }, - primitive: { - topology: "triangle-list", + entryPoint: "computeSomething", }, }); - const url = - "https://webgpufundamentals.org/webgpu/resources/images/f-texture.png"; - const texture = device.createTexture({ - label: url, - format: "rgba8unorm", - size: { width: img.width, height: img.height }, - usage: - GPUTextureUsage.TEXTURE_BINDING | - GPUTextureUsage.COPY_DST | - GPUTextureUsage.RENDER_ATTACHMENT, - }); - device.queue.writeTexture( - { texture: texture, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } }, - img.data.buffer, - { - offset: 0, - bytesPerRow: 4 * img.width, - rowsPerImage: img.height, - }, - { width: img.width, height: img.height } - ); + const numWorkgroups = arrayProd(dispatchCount); + const numResults = numWorkgroups * numThreadsPerWorkgroup; + const size = numResults * 4 * 4; // vec3f * u32 - const sampler = device.createSampler({ - addressModeU: 0 & 1 ? "repeat" : "clamp-to-edge", - addressModeV: 0 & 2 ? "repeat" : "clamp-to-edge", - magFilter: 0 & 4 ? "linear" : "nearest", - }); + let usage = GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC; + const workgroupBuffer = device.createBuffer({ size, usage }); + const localBuffer = device.createBuffer({ size, usage }); + const globalBuffer = device.createBuffer({ size, usage }); + + usage = GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST; + const workgroupReadBuffer = device.createBuffer({ size, usage }); + const localReadBuffer = device.createBuffer({ size, usage }); + const globalReadBuffer = device.createBuffer({ size, usage }); const bindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0), entries: [ - { binding: 0, resource: sampler }, - { binding: 1, resource: texture.createView() }, + { binding: 0, resource: { buffer: workgroupBuffer } }, + { binding: 1, resource: { buffer: localBuffer } }, + { binding: 2, resource: { buffer: globalBuffer } }, ], }); - const renderPassDescriptor: GPURenderPassDescriptor = { - label: "our basic canvas renderPass", - colorAttachments: [ - { - // view: <- to be filled out when we render - clearValue: [0.3, 0.3, 0.3, 1], - loadOp: "clear", - storeOp: "store", - }, - ], + // Encode commands to do the computation + const encoder = device.createCommandEncoder(); + const pass = encoder.beginComputePass(); + + pass.setPipeline(pipeline); + pass.setBindGroup(0, bindGroup); + pass.dispatchWorkgroups(...dispatchCount); + pass.end(); + + encoder.copyBufferToBuffer(workgroupBuffer, 0, workgroupReadBuffer, 0, size); + encoder.copyBufferToBuffer(localBuffer, 0, localReadBuffer, 0, size); + encoder.copyBufferToBuffer(globalBuffer, 0, globalReadBuffer, 0, size); + + // Finish encoding and submit the commands + const commandBuffer = encoder.finish(); + device.queue.submit([commandBuffer]); + + // Read the results + await Promise.all([ + workgroupReadBuffer.mapAsync(GPUMapMode.READ), + localReadBuffer.mapAsync(GPUMapMode.READ), + globalReadBuffer.mapAsync(GPUMapMode.READ), + ]); + + const workgroup = new Uint32Array(workgroupReadBuffer.getMappedRange()); + const local = new Uint32Array(localReadBuffer.getMappedRange()); + const global = new Uint32Array(globalReadBuffer.getMappedRange()); + + const get3 = (arr, i) => { + const off = i * 4; + return `${arr[off]}, ${arr[off + 1]}, ${arr[off + 2]}`; }; - function render() { - // Get the current texture from the canvas context and - // set it as the texture to render to. - renderPassDescriptor.colorAttachments[0].view = context - .getCurrentTexture() - .createView(); - - const encoder = device.createCommandEncoder(); - const pass = encoder.beginRenderPass(renderPassDescriptor); - pass.setPipeline(pipeline); - pass.setBindGroup(0, bindGroup); - pass.draw(6); // call our vertex shader 6 times - pass.end(); - - const commandBuffer = encoder.finish(); - device.queue.submit([commandBuffer]); - context.present(); + for (let i = 0; i < numResults; ++i) { + if (i % numThreadsPerWorkgroup === 0) { + console.log(`\ +--------------------------------------- +global local global dispatch: ${ + i / numThreadsPerWorkgroup + } +invoc. workgroup invoc. invoc. +index id id id +---------------------------------------`); + } + console.log( + `${i.toString().padStart(3)}: ${get3(workgroup, i)} ${get3( + local, + i + )} ${get3(global, i)}` + ); } - - render(); }; diff --git a/package/cpp/wgpu/JsiBuffer.h b/package/cpp/wgpu/JsiBuffer.h index 97d4cdd504..81d7231d71 100644 --- a/package/cpp/wgpu/JsiBuffer.h +++ b/package/cpp/wgpu/JsiBuffer.h @@ -34,10 +34,13 @@ class JsiBuffer : public JsiSkWrappingSharedPtrHostObject { } JSI_HOST_FUNCTION(mapAsync) { - auto mode = static_cast(arguments[0].getNumber()); - auto offset = static_cast(arguments[1].getNumber()); - auto size = static_cast(arguments[2].getNumber()); + auto object = getObject(); + auto mode = static_cast(arguments[0].getNumber()); + auto offset = + count > 1 ? static_cast(arguments[1].getNumber()) : 0; + auto size = count > 2 ? static_cast(arguments[2].getNumber()) + : getObject()->GetSize(); auto instance = getContext()->getInstance(); return RNJsi::JsiPromises::createPromiseAsJSIValue( runtime, [object = std::move(object), mode, offset, size, diff --git a/scripts/generator/model.ts b/scripts/generator/model.ts index 7b0926a37b..20eccaefa5 100644 --- a/scripts/generator/model.ts +++ b/scripts/generator/model.ts @@ -412,10 +412,11 @@ return object; type: "uint32_t", } ], - implementation: ` auto mode = static_cast(arguments[0].getNumber()); - auto offset = static_cast(arguments[1].getNumber()); - auto size = static_cast(arguments[2].getNumber()); + implementation: ` auto object = getObject(); + auto mode = static_cast(arguments[0].getNumber()); + auto offset = count > 1 ? static_cast(arguments[1].getNumber()) : 0; + auto size = count > 2 ? static_cast(arguments[2].getNumber()) : getObject()->GetSize(); auto instance = getContext()->getInstance(); return RNJsi::JsiPromises::createPromiseAsJSIValue( runtime, [object = std::move(object), mode, offset, From a0cf4606fcec9a944d21c550ae8e1674f0f844ca Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 16 May 2024 14:16:35 +0200 Subject: [PATCH 62/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 258 +++++++++++--------- 1 file changed, 142 insertions(+), 116 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index e15ed51ca9..320f5df499 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -37,134 +37,160 @@ export const demo7 = async ( ) => { const presentationFormat = "rgba8unorm"; - const dispatchCount = [4, 3, 2]; - const workgroupSize = [2, 3, 4]; - - // multiply all elements of an array - const arrayProd = (arr) => arr.reduce((a, b) => a * b); - - const numThreadsPerWorkgroup = arrayProd(workgroupSize); - - const code = /* wgsl */ ` - // NOTE!: vec3u is padded to by 4 bytes - @group(0) @binding(0) var workgroupResult: array; - @group(0) @binding(1) var localResult: array; - @group(0) @binding(2) var globalResult: array; - - @compute @workgroup_size(${workgroupSize}) fn computeSomething( - @builtin(workgroup_id) workgroup_id : vec3, - @builtin(local_invocation_id) local_invocation_id : vec3, - @builtin(global_invocation_id) global_invocation_id : vec3, - @builtin(local_invocation_index) local_invocation_index: u32, - @builtin(num_workgroups) num_workgroups: vec3 - ) { - // workgroup_index is similar to local_invocation_index except for - // workgroups, not threads inside a workgroup. - // It is not a builtin so we compute it ourselves. - - let workgroup_index = - workgroup_id.x + - workgroup_id.y * num_workgroups.x + - workgroup_id.z * num_workgroups.x * num_workgroups.y; - - // global_invocation_index is like local_invocation_index - // except linear across all invocations across all dispatched - // workgroups. It is not a builtin so we compute it ourselves. - - let global_invocation_index = - workgroup_index * ${numThreadsPerWorkgroup} + - local_invocation_index; - - // now we can write each of these builtins to our buffers. - workgroupResult[global_invocation_index] = workgroup_id; - localResult[global_invocation_index] = local_invocation_id; - globalResult[global_invocation_index] = global_invocation_id; + // First Matrix + + const rows1 = 128; + const columns1 = 128; + const firstMatrix = new Float32Array(rows1 * columns1 + 2); + firstMatrix[0] = rows1; + firstMatrix[1] = columns1; + for (let i = 2; i < firstMatrix.length; i++) { + firstMatrix[i] = Math.random(); } - `; - const module = device.createShaderModule({ code }); + const gpuBufferFirstMatrix = device.createBuffer({ + mappedAtCreation: true, + size: firstMatrix.byteLength, + usage: GPUBufferUsage.STORAGE, + }); + const arrayBufferFirstMatrix = gpuBufferFirstMatrix.getMappedRange(); + new Float32Array(arrayBufferFirstMatrix).set(firstMatrix); + gpuBufferFirstMatrix.unmap(); + + // Second Matrix + + const rows2 = 128; + const columns2 = 128; + const secondMatrix = new Float32Array(rows2 * columns2 + 2); + secondMatrix[0] = rows2; + secondMatrix[1] = columns2; + for (let i = 2; i < secondMatrix.length; i++) { + secondMatrix[i] = Math.random(); + } - const pipeline = device.createComputePipeline({ - label: "compute pipeline", + const gpuBufferSecondMatrix = device.createBuffer({ + mappedAtCreation: true, + size: secondMatrix.byteLength, + usage: GPUBufferUsage.STORAGE, + }); + const arrayBufferSecondMatrix = gpuBufferSecondMatrix.getMappedRange(); + new Float32Array(arrayBufferSecondMatrix).set(secondMatrix); + gpuBufferSecondMatrix.unmap(); + + // Result Matrix + + const resultMatrixBufferSize = + Float32Array.BYTES_PER_ELEMENT * (2 + firstMatrix[0] * secondMatrix[1]); + const resultMatrixBuffer = device.createBuffer({ + size: resultMatrixBufferSize, + usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC, + }); + + // Compute shader code + + const shaderModule = device.createShaderModule({ + code: ` + struct Matrix { + size : vec2, + numbers: array, + } + + @group(0) @binding(0) var firstMatrix : Matrix; + @group(0) @binding(1) var secondMatrix : Matrix; + @group(0) @binding(2) var resultMatrix : Matrix; + + @compute @workgroup_size(8, 8) + fn main(@builtin(global_invocation_id) global_id : vec3) { + // Guard against out-of-bounds work group sizes + if (global_id.x >= u32(firstMatrix.size.x) || global_id.y >= u32(secondMatrix.size.y)) { + return; + } + + resultMatrix.size = vec2(firstMatrix.size.x, secondMatrix.size.y); + + let resultCell = vec2(global_id.x, global_id.y); + var result = 0.0; + for (var i = 0u; i < u32(firstMatrix.size.y); i = i + 1u) { + let a = i + resultCell.x * u32(firstMatrix.size.y); + let b = resultCell.y + i * u32(secondMatrix.size.y); + result = result + firstMatrix.numbers[a] * secondMatrix.numbers[b]; + } + + let index = resultCell.y + resultCell.x * u32(secondMatrix.size.y); + resultMatrix.numbers[index] = result; + } + `, + }); + + // Pipeline setup + + const computePipeline = device.createComputePipeline({ layout: "auto", compute: { - module, - entryPoint: "computeSomething", + module: shaderModule, + entryPoint: "main", }, }); - const numWorkgroups = arrayProd(dispatchCount); - const numResults = numWorkgroups * numThreadsPerWorkgroup; - const size = numResults * 4 * 4; // vec3f * u32 - - let usage = GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC; - const workgroupBuffer = device.createBuffer({ size, usage }); - const localBuffer = device.createBuffer({ size, usage }); - const globalBuffer = device.createBuffer({ size, usage }); - - usage = GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST; - const workgroupReadBuffer = device.createBuffer({ size, usage }); - const localReadBuffer = device.createBuffer({ size, usage }); - const globalReadBuffer = device.createBuffer({ size, usage }); + // Bind group const bindGroup = device.createBindGroup({ - layout: pipeline.getBindGroupLayout(0), + layout: computePipeline.getBindGroupLayout(0 /* index */), entries: [ - { binding: 0, resource: { buffer: workgroupBuffer } }, - { binding: 1, resource: { buffer: localBuffer } }, - { binding: 2, resource: { buffer: globalBuffer } }, + { + binding: 0, + resource: { + buffer: gpuBufferFirstMatrix, + }, + }, + { + binding: 1, + resource: { + buffer: gpuBufferSecondMatrix, + }, + }, + { + binding: 2, + resource: { + buffer: resultMatrixBuffer, + }, + }, ], }); - // Encode commands to do the computation - const encoder = device.createCommandEncoder(); - const pass = encoder.beginComputePass(); - - pass.setPipeline(pipeline); - pass.setBindGroup(0, bindGroup); - pass.dispatchWorkgroups(...dispatchCount); - pass.end(); - - encoder.copyBufferToBuffer(workgroupBuffer, 0, workgroupReadBuffer, 0, size); - encoder.copyBufferToBuffer(localBuffer, 0, localReadBuffer, 0, size); - encoder.copyBufferToBuffer(globalBuffer, 0, globalReadBuffer, 0, size); - - // Finish encoding and submit the commands - const commandBuffer = encoder.finish(); - device.queue.submit([commandBuffer]); - - // Read the results - await Promise.all([ - workgroupReadBuffer.mapAsync(GPUMapMode.READ), - localReadBuffer.mapAsync(GPUMapMode.READ), - globalReadBuffer.mapAsync(GPUMapMode.READ), - ]); - - const workgroup = new Uint32Array(workgroupReadBuffer.getMappedRange()); - const local = new Uint32Array(localReadBuffer.getMappedRange()); - const global = new Uint32Array(globalReadBuffer.getMappedRange()); - - const get3 = (arr, i) => { - const off = i * 4; - return `${arr[off]}, ${arr[off + 1]}, ${arr[off + 2]}`; - }; - - for (let i = 0; i < numResults; ++i) { - if (i % numThreadsPerWorkgroup === 0) { - console.log(`\ ---------------------------------------- -global local global dispatch: ${ - i / numThreadsPerWorkgroup - } -invoc. workgroup invoc. invoc. -index id id id ----------------------------------------`); - } - console.log( - `${i.toString().padStart(3)}: ${get3(workgroup, i)} ${get3( - local, - i - )} ${get3(global, i)}` - ); - } + // Commands submission + + const commandEncoder = device.createCommandEncoder(); + + const passEncoder = commandEncoder.beginComputePass(); + passEncoder.setPipeline(computePipeline); + passEncoder.setBindGroup(0, bindGroup); + const workgroupCountX = Math.ceil(rows1 / 8); + const workgroupCountY = Math.ceil(columns2 / 8); + passEncoder.dispatchWorkgroups(workgroupCountX, workgroupCountY); + passEncoder.end(); + + // Get a GPU buffer for reading in an unmapped state. + const gpuReadBuffer = device.createBuffer({ + size: resultMatrixBufferSize, + usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ, + }); + + // Encode commands for copying buffer to buffer. + commandEncoder.copyBufferToBuffer( + resultMatrixBuffer /* source buffer */, + 0 /* source offset */, + gpuReadBuffer /* destination buffer */, + 0 /* destination offset */, + resultMatrixBufferSize /* size */ + ); + + // Submit GPU commands. + const gpuCommands = commandEncoder.finish(); + device.queue.submit([gpuCommands]); + + // Read buffer. + await gpuReadBuffer.mapAsync(GPUMapMode.READ); + const arrayBuffer = gpuReadBuffer.getMappedRange(); + console.log(new Float32Array(arrayBuffer)); }; From 525b313f35dea9c2e69aba4ebc9c648a823307b2 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 16 May 2024 14:53:54 +0200 Subject: [PATCH 63/63] :wrench: --- example/src/Examples/Breathe/demo1/demo7.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/example/src/Examples/Breathe/demo1/demo7.ts b/example/src/Examples/Breathe/demo1/demo7.ts index 320f5df499..b782cc0ce7 100644 --- a/example/src/Examples/Breathe/demo1/demo7.ts +++ b/example/src/Examples/Breathe/demo1/demo7.ts @@ -39,8 +39,8 @@ export const demo7 = async ( // First Matrix - const rows1 = 128; - const columns1 = 128; + const rows1 = 512; + const columns1 = 512; const firstMatrix = new Float32Array(rows1 * columns1 + 2); firstMatrix[0] = rows1; firstMatrix[1] = columns1; @@ -59,11 +59,9 @@ export const demo7 = async ( // Second Matrix - const rows2 = 128; - const columns2 = 128; - const secondMatrix = new Float32Array(rows2 * columns2 + 2); - secondMatrix[0] = rows2; - secondMatrix[1] = columns2; + const secondMatrix = new Float32Array(rows1 * columns1 + 2); + secondMatrix[0] = rows1; + secondMatrix[1] = columns1; for (let i = 2; i < secondMatrix.length; i++) { secondMatrix[i] = Math.random(); }