diff --git a/ChangeLog.md b/ChangeLog.md index 880a74f4757c5..b2220bbeae3d3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -26,6 +26,8 @@ See docs/process.md for more on how version tagging works. - Node: v10.19.0 -> v12.22.9 - Chrome: v70 -> v74 - Firefox: v55 -> v65 +- `-sUSE_WEBGPU` was removed in favor of the external port Emdawnwebgpu which + are used via `--use-port=emdawnwebgpu`. See 4.0.10 release notes for details. 4.0.15 - 09/17/25 ----------------- diff --git a/embuilder.py b/embuilder.py index 77c3da6998266..44015263a6c4e 100755 --- a/embuilder.py +++ b/embuilder.py @@ -100,8 +100,6 @@ 'libunwind-legacyexcept', 'libunwind-wasmexcept', 'libnoexit', - 'libwebgpu', - 'libwebgpu_cpp', 'bullet', ] diff --git a/site/source/docs/tools_reference/settings_reference.rst b/site/source/docs/tools_reference/settings_reference.rst index 80f9b3eb5e488..234be3ecc43bd 100644 --- a/site/source/docs/tools_reference/settings_reference.rst +++ b/site/source/docs/tools_reference/settings_reference.rst @@ -891,10 +891,9 @@ Default value: false USE_WEBGPU ========== -Enables the built-in implementation of ````. -Deprecated: Please try migrating to ``--use-port=emdawnwebgpu``, +This option has been removed in favor of ``--use-port=emdawnwebgpu``, which implements a newer, incompatible version of webgpu.h (see -tools/ports/emdawnwebgpu.py for more info). +``tools/ports/emdawnwebgpu.py`` for more info). .. note:: This setting is deprecated diff --git a/src/closure-externs/webgpu-externs.js b/src/closure-externs/webgpu-externs.js deleted file mode 100644 index 9dc1a6943ed51..0000000000000 --- a/src/closure-externs/webgpu-externs.js +++ /dev/null @@ -1,577 +0,0 @@ -/* - * WebGPU globals - * Generated using https://github.com/kainino0x/webidl-to-closure-externs - * against the spec's WebIDL: https://gpuweb.github.io/gpuweb/webgpu.idl - */ - -/** @type {?GPU} */ -Navigator.prototype.gpu; - -/** @type {?GPU} */ -WorkerNavigator.prototype.gpu; - -const GPUBufferUsage = {}; -/** @type {number} */ -GPUBufferUsage.MAP_READ; -/** @type {number} */ -GPUBufferUsage.MAP_WRITE; -/** @type {number} */ -GPUBufferUsage.COPY_SRC; -/** @type {number} */ -GPUBufferUsage.COPY_DST; -/** @type {number} */ -GPUBufferUsage.INDEX; -/** @type {number} */ -GPUBufferUsage.VERTEX; -/** @type {number} */ -GPUBufferUsage.UNIFORM; -/** @type {number} */ -GPUBufferUsage.STORAGE; -/** @type {number} */ -GPUBufferUsage.INDIRECT; -/** @type {number} */ -GPUBufferUsage.QUERY_RESOLVE; - -const GPUMapMode = {}; -/** @type {number} */ -GPUMapMode.READ; -/** @type {number} */ -GPUMapMode.WRITE; - -const GPUTextureUsage = {}; -/** @type {number} */ -GPUTextureUsage.COPY_SRC; -/** @type {number} */ -GPUTextureUsage.COPY_DST; -/** @type {number} */ -GPUTextureUsage.TEXTURE_BINDING; -/** @type {number} */ -GPUTextureUsage.STORAGE_BINDING; -/** @type {number} */ -GPUTextureUsage.RENDER_ATTACHMENT; - -const GPUShaderStage = {}; -/** @type {number} */ -GPUShaderStage.VERTEX; -/** @type {number} */ -GPUShaderStage.FRAGMENT; -/** @type {number} */ -GPUShaderStage.COMPUTE; - -const GPUColorWrite = {}; -/** @type {number} */ -GPUColorWrite.RED; -/** @type {number} */ -GPUColorWrite.GREEN; -/** @type {number} */ -GPUColorWrite.BLUE; -/** @type {number} */ -GPUColorWrite.ALPHA; -/** @type {number} */ -GPUColorWrite.ALL; - -/** @constructor */ -function GPUSupportedLimits() {} -/** @type {number} */ -GPUSupportedLimits.prototype.maxTextureDimension1D; -/** @type {number} */ -GPUSupportedLimits.prototype.maxTextureDimension2D; -/** @type {number} */ -GPUSupportedLimits.prototype.maxTextureDimension3D; -/** @type {number} */ -GPUSupportedLimits.prototype.maxTextureArrayLayers; -/** @type {number} */ -GPUSupportedLimits.prototype.maxBindGroups; -/** @type {number} */ -GPUSupportedLimits.prototype.maxBindGroupsPlusVertexBuffers; -/** @type {number} */ -GPUSupportedLimits.prototype.maxBindingsPerBindGroup; -/** @type {number} */ -GPUSupportedLimits.prototype.maxDynamicUniformBuffersPerPipelineLayout; -/** @type {number} */ -GPUSupportedLimits.prototype.maxDynamicStorageBuffersPerPipelineLayout; -/** @type {number} */ -GPUSupportedLimits.prototype.maxSampledTexturesPerShaderStage; -/** @type {number} */ -GPUSupportedLimits.prototype.maxSamplersPerShaderStage; -/** @type {number} */ -GPUSupportedLimits.prototype.maxStorageBuffersPerShaderStage; -/** @type {number} */ -GPUSupportedLimits.prototype.maxStorageTexturesPerShaderStage; -/** @type {number} */ -GPUSupportedLimits.prototype.maxUniformBuffersPerShaderStage; -/** @type {number} */ -GPUSupportedLimits.prototype.maxUniformBufferBindingSize; -/** @type {number} */ -GPUSupportedLimits.prototype.maxStorageBufferBindingSize; -/** @type {number} */ -GPUSupportedLimits.prototype.minUniformBufferOffsetAlignment; -/** @type {number} */ -GPUSupportedLimits.prototype.minStorageBufferOffsetAlignment; -/** @type {number} */ -GPUSupportedLimits.prototype.maxVertexBuffers; -/** @type {number} */ -GPUSupportedLimits.prototype.maxBufferSize; -/** @type {number} */ -GPUSupportedLimits.prototype.maxVertexAttributes; -/** @type {number} */ -GPUSupportedLimits.prototype.maxVertexBufferArrayStride; -/** @type {number} */ -GPUSupportedLimits.prototype.maxInterStageShaderComponents; -/** @type {number} */ -GPUSupportedLimits.prototype.maxInterStageShaderVariables; -/** @type {number} */ -GPUSupportedLimits.prototype.maxColorAttachments; -/** @type {number} */ -GPUSupportedLimits.prototype.maxColorAttachmentBytesPerSample; -/** @type {number} */ -GPUSupportedLimits.prototype.maxComputeWorkgroupStorageSize; -/** @type {number} */ -GPUSupportedLimits.prototype.maxComputeInvocationsPerWorkgroup; -/** @type {number} */ -GPUSupportedLimits.prototype.maxComputeWorkgroupSizeX; -/** @type {number} */ -GPUSupportedLimits.prototype.maxComputeWorkgroupSizeY; -/** @type {number} */ -GPUSupportedLimits.prototype.maxComputeWorkgroupSizeZ; -/** @type {number} */ -GPUSupportedLimits.prototype.maxComputeWorkgroupsPerDimension; - -/** @constructor */ -function GPUSupportedFeatures() {} -/** @type {number} */ -GPUSupportedFeatures.prototype.size; -/** @return {!Iterable} */ -GPUSupportedFeatures.prototype.entries = function() {}; -/** @return {!Iterable} */ -GPUSupportedFeatures.prototype.keys = function() {}; -/** @return {!Iterable} */ -GPUSupportedFeatures.prototype.values = function() {}; -/** @return {undefined} */ -GPUSupportedFeatures.prototype.forEach = function() {}; -/** @return {boolean} */ -GPUSupportedFeatures.prototype.has = function() {}; - -/** @constructor */ -function WGSLLanguageFeatures() {} -/** @type {number} */ -WGSLLanguageFeatures.prototype.size; -/** @return {!Iterable} */ -WGSLLanguageFeatures.prototype.entries = function() {}; -/** @return {!Iterable} */ -WGSLLanguageFeatures.prototype.keys = function() {}; -/** @return {!Iterable} */ -WGSLLanguageFeatures.prototype.values = function() {}; -/** @return {undefined} */ -WGSLLanguageFeatures.prototype.forEach = function() {}; -/** @return {boolean} */ -WGSLLanguageFeatures.prototype.has = function() {}; - -/** @constructor */ -function GPUAdapterInfo() {} -/** @type {string} */ -GPUAdapterInfo.prototype.vendor; -/** @type {string} */ -GPUAdapterInfo.prototype.architecture; -/** @type {string} */ -GPUAdapterInfo.prototype.device; -/** @type {string} */ -GPUAdapterInfo.prototype.description; - -/** @constructor */ -function GPU() {} -/** @return {!Promise} */ -GPU.prototype.requestAdapter = function() {}; -/** @return {string} */ -GPU.prototype.getPreferredCanvasFormat = function() {}; -/** @type {!WGSLLanguageFeatures} */ -GPU.prototype.wgslLanguageFeatures; - -/** @constructor */ -function GPUAdapter() {} -/** @type {!GPUSupportedFeatures} */ -GPUAdapter.prototype.features; -/** @type {!GPUSupportedLimits} */ -GPUAdapter.prototype.limits; -/** @type {boolean} */ -GPUAdapter.prototype.isFallbackAdapter; -/** @return {!Promise} */ -GPUAdapter.prototype.requestDevice = function() {}; -/** @return {!Promise} */ -GPUAdapter.prototype.requestAdapterInfo = function() {}; -/** @type {!GPUAdapterInfo} */ -GPUAdapter.prototype.info; - -/** @constructor */ -function GPUDevice() {} -/** @type {string} */ -GPUDevice.prototype.label; -/** @type {!GPUSupportedFeatures} */ -GPUDevice.prototype.features; -/** @type {!GPUSupportedLimits} */ -GPUDevice.prototype.limits; -/** @type {!GPUQueue} */ -GPUDevice.prototype.queue; -/** @return {undefined} */ -GPUDevice.prototype.destroy = function() {}; -/** @return {!GPUBuffer} */ -GPUDevice.prototype.createBuffer = function() {}; -/** @return {!GPUTexture} */ -GPUDevice.prototype.createTexture = function() {}; -/** @return {!GPUSampler} */ -GPUDevice.prototype.createSampler = function() {}; -/** @return {!GPUExternalTexture} */ -GPUDevice.prototype.importExternalTexture = function() {}; -/** @return {!GPUBindGroupLayout} */ -GPUDevice.prototype.createBindGroupLayout = function() {}; -/** @return {!GPUPipelineLayout} */ -GPUDevice.prototype.createPipelineLayout = function() {}; -/** @return {!GPUBindGroup} */ -GPUDevice.prototype.createBindGroup = function() {}; -/** @return {!GPUShaderModule} */ -GPUDevice.prototype.createShaderModule = function() {}; -/** @return {!GPUComputePipeline} */ -GPUDevice.prototype.createComputePipeline = function() {}; -/** @return {!GPURenderPipeline} */ -GPUDevice.prototype.createRenderPipeline = function() {}; -/** @return {!Promise} */ -GPUDevice.prototype.createComputePipelineAsync = function() {}; -/** @return {!Promise} */ -GPUDevice.prototype.createRenderPipelineAsync = function() {}; -/** @return {!GPUCommandEncoder} */ -GPUDevice.prototype.createCommandEncoder = function() {}; -/** @return {!GPURenderBundleEncoder} */ -GPUDevice.prototype.createRenderBundleEncoder = function() {}; -/** @return {!GPUQuerySet} */ -GPUDevice.prototype.createQuerySet = function() {}; -/** @type {!Promise} */ -GPUDevice.prototype.lost; -/** @return {undefined} */ -GPUDevice.prototype.pushErrorScope = function() {}; -/** @return {!Promise} */ -GPUDevice.prototype.popErrorScope = function() {}; -/** @type {!Function} */ -GPUDevice.prototype.onuncapturederror; -/** @type {!GPUAdapterInfo} */ -GPUDevice.prototype.adapterInfo; - -/** @constructor */ -function GPUBuffer() {} -/** @type {string} */ -GPUBuffer.prototype.label; -/** @type {number} */ -GPUBuffer.prototype.size; -/** @type {number} */ -GPUBuffer.prototype.usage; -/** @type {string} */ -GPUBuffer.prototype.mapState; -/** @return {!Promise} */ -GPUBuffer.prototype.mapAsync = function() {}; -/** @return {!ArrayBuffer} */ -GPUBuffer.prototype.getMappedRange = function() {}; -/** @return {undefined} */ -GPUBuffer.prototype.unmap = function() {}; -/** @return {undefined} */ -GPUBuffer.prototype.destroy = function() {}; - -/** @constructor */ -function GPUTexture() {} -/** @type {string} */ -GPUTexture.prototype.label; -/** @return {!GPUTextureView} */ -GPUTexture.prototype.createView = function() {}; -/** @return {undefined} */ -GPUTexture.prototype.destroy = function() {}; -/** @type {number} */ -GPUTexture.prototype.width; -/** @type {number} */ -GPUTexture.prototype.height; -/** @type {number} */ -GPUTexture.prototype.depthOrArrayLayers; -/** @type {number} */ -GPUTexture.prototype.mipLevelCount; -/** @type {number} */ -GPUTexture.prototype.sampleCount; -/** @type {string} */ -GPUTexture.prototype.dimension; -/** @type {string} */ -GPUTexture.prototype.format; -/** @type {number} */ -GPUTexture.prototype.usage; - -/** @constructor */ -function GPUTextureView() {} -/** @type {string} */ -GPUTextureView.prototype.label; - -/** @constructor */ -function GPUExternalTexture() {} -/** @type {string} */ -GPUExternalTexture.prototype.label; - -/** @constructor */ -function GPUSampler() {} -/** @type {string} */ -GPUSampler.prototype.label; - -/** @constructor */ -function GPUBindGroupLayout() {} -/** @type {string} */ -GPUBindGroupLayout.prototype.label; - -/** @constructor */ -function GPUBindGroup() {} -/** @type {string} */ -GPUBindGroup.prototype.label; - -/** @constructor */ -function GPUPipelineLayout() {} -/** @type {string} */ -GPUPipelineLayout.prototype.label; - -/** @constructor */ -function GPUShaderModule() {} -/** @type {string} */ -GPUShaderModule.prototype.label; -/** @return {!Promise} */ -GPUShaderModule.prototype.getCompilationInfo = function() {}; - -/** @constructor */ -function GPUCompilationMessage() {} -/** @type {string} */ -GPUCompilationMessage.prototype.message; -/** @type {string} */ -GPUCompilationMessage.prototype.type; -/** @type {number} */ -GPUCompilationMessage.prototype.lineNum; -/** @type {number} */ -GPUCompilationMessage.prototype.linePos; -/** @type {number} */ -GPUCompilationMessage.prototype.offset; -/** @type {number} */ -GPUCompilationMessage.prototype.length; - -/** @constructor */ -function GPUCompilationInfo() {} -/** @type {!Array} */ -GPUCompilationInfo.prototype.messages; - -/** @constructor */ -function GPUPipelineError() {} -/** @type {string} */ -GPUPipelineError.prototype.reason; - -/** @constructor */ -function GPUComputePipeline() {} -/** @type {string} */ -GPUComputePipeline.prototype.label; -/** @return {!GPUBindGroupLayout} */ -GPUComputePipeline.prototype.getBindGroupLayout = function() {}; - -/** @constructor */ -function GPURenderPipeline() {} -/** @type {string} */ -GPURenderPipeline.prototype.label; -/** @return {!GPUBindGroupLayout} */ -GPURenderPipeline.prototype.getBindGroupLayout = function() {}; - -/** @constructor */ -function GPUCommandBuffer() {} -/** @type {string} */ -GPUCommandBuffer.prototype.label; - -/** @constructor */ -function GPUCommandEncoder() {} -/** @type {string} */ -GPUCommandEncoder.prototype.label; -/** @return {undefined} */ -GPUCommandEncoder.prototype.pushDebugGroup = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.popDebugGroup = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.insertDebugMarker = function() {}; -/** @return {!GPURenderPassEncoder} */ -GPUCommandEncoder.prototype.beginRenderPass = function() {}; -/** @return {!GPUComputePassEncoder} */ -GPUCommandEncoder.prototype.beginComputePass = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.copyBufferToBuffer = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.copyBufferToTexture = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.copyTextureToBuffer = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.copyTextureToTexture = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.clearBuffer = function() {}; -/** @return {undefined} */ -GPUCommandEncoder.prototype.resolveQuerySet = function() {}; -/** @return {!GPUCommandBuffer} */ -GPUCommandEncoder.prototype.finish = function() {}; - -/** @constructor */ -function GPUComputePassEncoder() {} -/** @type {string} */ -GPUComputePassEncoder.prototype.label; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.pushDebugGroup = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.popDebugGroup = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.insertDebugMarker = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.setBindGroup = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.setBindGroup = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.setPipeline = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.dispatchWorkgroups = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.dispatchWorkgroupsIndirect = function() {}; -/** @return {undefined} */ -GPUComputePassEncoder.prototype.end = function() {}; - -/** @constructor */ -function GPURenderPassEncoder() {} -/** @type {string} */ -GPURenderPassEncoder.prototype.label; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.pushDebugGroup = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.popDebugGroup = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.insertDebugMarker = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setBindGroup = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setBindGroup = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setPipeline = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setIndexBuffer = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setVertexBuffer = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.draw = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.drawIndexed = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.drawIndirect = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.drawIndexedIndirect = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setViewport = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setScissorRect = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setBlendConstant = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.setStencilReference = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.beginOcclusionQuery = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.endOcclusionQuery = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.executeBundles = function() {}; -/** @return {undefined} */ -GPURenderPassEncoder.prototype.end = function() {}; - -/** @constructor */ -function GPURenderBundle() {} -/** @type {string} */ -GPURenderBundle.prototype.label; - -/** @constructor */ -function GPURenderBundleEncoder() {} -/** @type {string} */ -GPURenderBundleEncoder.prototype.label; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.pushDebugGroup = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.popDebugGroup = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.insertDebugMarker = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.setBindGroup = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.setBindGroup = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.setPipeline = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.setIndexBuffer = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.setVertexBuffer = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.draw = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.drawIndexed = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.drawIndirect = function() {}; -/** @return {undefined} */ -GPURenderBundleEncoder.prototype.drawIndexedIndirect = function() {}; -/** @return {!GPURenderBundle} */ -GPURenderBundleEncoder.prototype.finish = function() {}; - -/** @constructor */ -function GPUQueue() {} -/** @type {string} */ -GPUQueue.prototype.label; -/** @return {undefined} */ -GPUQueue.prototype.submit = function() {}; -/** @return {!Promise} */ -GPUQueue.prototype.onSubmittedWorkDone = function() {}; -/** @return {undefined} */ -GPUQueue.prototype.writeBuffer = function() {}; -/** @return {undefined} */ -GPUQueue.prototype.writeTexture = function() {}; -/** @return {undefined} */ -GPUQueue.prototype.copyExternalImageToTexture = function() {}; - -/** @constructor */ -function GPUQuerySet() {} -/** @type {string} */ -GPUQuerySet.prototype.label; -/** @return {undefined} */ -GPUQuerySet.prototype.destroy = function() {}; -/** @type {string} */ -GPUQuerySet.prototype.type; -/** @type {number} */ -GPUQuerySet.prototype.count; - -/** @constructor */ -function GPUCanvasContext() {} -/** @type {!HTMLCanvasElement|!OffscreenCanvas} */ -GPUCanvasContext.prototype.canvas; -/** @return {undefined} */ -GPUCanvasContext.prototype.configure = function() {}; -/** @return {undefined} */ -GPUCanvasContext.prototype.unconfigure = function() {}; -/** @return {!GPUTexture} */ -GPUCanvasContext.prototype.getCurrentTexture = function() {}; - -/** @constructor */ -function GPUDeviceLostInfo() {} -/** @type {string} */ -GPUDeviceLostInfo.prototype.reason; -/** @type {string} */ -GPUDeviceLostInfo.prototype.message; - -/** @constructor */ -function GPUError() {} -/** @type {string} */ -GPUError.prototype.message; - -/** @constructor */ -function GPUValidationError() {} - -/** @constructor */ -function GPUOutOfMemoryError() {} - -/** @constructor */ -function GPUInternalError() {} - -/** @constructor */ -function GPUUncapturedErrorEvent() {} -/** @type {!GPUError} */ -GPUUncapturedErrorEvent.prototype.error; diff --git a/src/jsifier.mjs b/src/jsifier.mjs index 8a6064c56dba1..a685125d04561 100644 --- a/src/jsifier.mjs +++ b/src/jsifier.mjs @@ -202,7 +202,6 @@ const checkDependenciesSkip = new Set([ const checkDependenciesIgnore = new Set([ // These are added in bulk to whole library files are so are not precise '$PThread', - '$WebGPU', '$SDL', '$GLUT', '$GLEW', diff --git a/src/lib/libhtml5_webgpu.js b/src/lib/libhtml5_webgpu.js deleted file mode 100644 index 22710ac4d050e..0000000000000 --- a/src/lib/libhtml5_webgpu.js +++ /dev/null @@ -1,92 +0,0 @@ -{{{ - // Helper functions for code generation -const html5_gpu = { - makeImportExport: (snake_case, CamelCase) => { - return ` -LibraryHTML5WebGPU.emscripten_webgpu_import_${snake_case}__deps = ['$WebGPU', '$JsValStore']; -LibraryHTML5WebGPU.emscripten_webgpu_import_${snake_case} = (handle) => - WebGPU.mgr${CamelCase}.create(JsValStore.get(handle)); - -LibraryHTML5WebGPU.emscripten_webgpu_export_${snake_case}__deps = ['$WebGPU', '$JsValStore']; -LibraryHTML5WebGPU.emscripten_webgpu_export_${snake_case} = (handle) => - JsValStore.add(WebGPU.mgr${CamelCase}.get(handle));` - }, -}; -}}} - - -var LibraryHTML5WebGPU = { - $JsValStore: { - values: {}, - next_id: 1, - - add(js_val) { - var id; - do { - id = JsValStore.next_id++; - if (JsValStore.next_id > 2147483647) JsValStore.next_id = 1; // Wraparound signed int32. - } while (id in JsValStore.values); - - JsValStore.values[id] = js_val; - return id; - }, - remove(id) { -#if ASSERTIONS - assert(id in JsValStore.values); -#endif - delete JsValStore.values[id]; - }, - get(id) { -#if ASSERTIONS - assert(id === 0 || id in JsValStore.values); -#endif - return JsValStore.values[id]; - }, - }, - - emscripten_webgpu_release_js_handle__deps: ['$JsValStore'], - emscripten_webgpu_release_js_handle: (id) => JsValStore.remove(id), - - emscripten_webgpu_get_device__deps: ['$WebGPU'], - emscripten_webgpu_get_device: () => { -#if ASSERTIONS - assert(Module['preinitializedWebGPUDevice']); -#endif - if (WebGPU.preinitializedDeviceId === undefined) { - var device = Module['preinitializedWebGPUDevice']; - var deviceWrapper = { queueId: WebGPU.mgrQueue.create(device["queue"]) }; - WebGPU.preinitializedDeviceId = WebGPU.mgrDevice.create(device, deviceWrapper); - } - WebGPU.mgrDevice.reference(WebGPU.preinitializedDeviceId); - return WebGPU.preinitializedDeviceId; - }, -}; - -{{{ html5_gpu.makeImportExport('surface', 'Surface') }}} -{{{ html5_gpu.makeImportExport('swap_chain', 'SwapChain') }}} - -{{{ html5_gpu.makeImportExport('device', 'Device') }}} -{{{ html5_gpu.makeImportExport('queue', 'Queue') }}} - -{{{ html5_gpu.makeImportExport('command_buffer', 'CommandBuffer') }}} -{{{ html5_gpu.makeImportExport('command_encoder', 'CommandEncoder') }}} -{{{ html5_gpu.makeImportExport('render_pass_encoder', 'RenderPassEncoder') }}} -{{{ html5_gpu.makeImportExport('compute_pass_encoder', 'ComputePassEncoder') }}} - -{{{ html5_gpu.makeImportExport('bind_group', 'BindGroup') }}} -{{{ html5_gpu.makeImportExport('buffer', 'Buffer') }}} -{{{ html5_gpu.makeImportExport('sampler', 'Sampler') }}} -{{{ html5_gpu.makeImportExport('texture', 'Texture') }}} -{{{ html5_gpu.makeImportExport('texture_view', 'TextureView') }}} -{{{ html5_gpu.makeImportExport('query_set', 'QuerySet') }}} - -{{{ html5_gpu.makeImportExport('bind_group_layout', 'BindGroupLayout') }}} -{{{ html5_gpu.makeImportExport('pipeline_layout', 'PipelineLayout') }}} -{{{ html5_gpu.makeImportExport('render_pipeline', 'RenderPipeline') }}} -{{{ html5_gpu.makeImportExport('compute_pipeline', 'ComputePipeline') }}} -{{{ html5_gpu.makeImportExport('shader_module', 'ShaderModule') }}} - -{{{ html5_gpu.makeImportExport('render_bundle_encoder', 'RenderBundleEncoder') }}} -{{{ html5_gpu.makeImportExport('render_bundle', 'RenderBundle') }}} - -addToLibrary(LibraryHTML5WebGPU); diff --git a/src/lib/libsigs.js b/src/lib/libsigs.js index 46c2e1df16f08..6b3f035f054b3 100644 --- a/src/lib/libsigs.js +++ b/src/lib/libsigs.js @@ -891,50 +891,6 @@ sigs = { emscripten_webgl_get_vertex_attrib_o__sig: 'iii', emscripten_webgl_get_vertex_attrib_v__sig: 'iiipii', emscripten_webgl_make_context_current__sig: 'ip', - emscripten_webgpu_export_bind_group__sig: 'ip', - emscripten_webgpu_export_bind_group_layout__sig: 'ip', - emscripten_webgpu_export_buffer__sig: 'ip', - emscripten_webgpu_export_command_buffer__sig: 'ip', - emscripten_webgpu_export_command_encoder__sig: 'ip', - emscripten_webgpu_export_compute_pass_encoder__sig: 'ip', - emscripten_webgpu_export_compute_pipeline__sig: 'ip', - emscripten_webgpu_export_device__sig: 'ip', - emscripten_webgpu_export_pipeline_layout__sig: 'ip', - emscripten_webgpu_export_query_set__sig: 'ip', - emscripten_webgpu_export_queue__sig: 'ip', - emscripten_webgpu_export_render_bundle__sig: 'ip', - emscripten_webgpu_export_render_bundle_encoder__sig: 'ip', - emscripten_webgpu_export_render_pass_encoder__sig: 'ip', - emscripten_webgpu_export_render_pipeline__sig: 'ip', - emscripten_webgpu_export_sampler__sig: 'ip', - emscripten_webgpu_export_shader_module__sig: 'ip', - emscripten_webgpu_export_surface__sig: 'ip', - emscripten_webgpu_export_swap_chain__sig: 'ip', - emscripten_webgpu_export_texture__sig: 'ip', - emscripten_webgpu_export_texture_view__sig: 'ip', - emscripten_webgpu_get_device__sig: 'p', - emscripten_webgpu_import_bind_group__sig: 'pi', - emscripten_webgpu_import_bind_group_layout__sig: 'pi', - emscripten_webgpu_import_buffer__sig: 'pi', - emscripten_webgpu_import_command_buffer__sig: 'pi', - emscripten_webgpu_import_command_encoder__sig: 'pi', - emscripten_webgpu_import_compute_pass_encoder__sig: 'pi', - emscripten_webgpu_import_compute_pipeline__sig: 'pi', - emscripten_webgpu_import_device__sig: 'pi', - emscripten_webgpu_import_pipeline_layout__sig: 'pi', - emscripten_webgpu_import_query_set__sig: 'pi', - emscripten_webgpu_import_queue__sig: 'pi', - emscripten_webgpu_import_render_bundle__sig: 'pi', - emscripten_webgpu_import_render_bundle_encoder__sig: 'pi', - emscripten_webgpu_import_render_pass_encoder__sig: 'pi', - emscripten_webgpu_import_render_pipeline__sig: 'pi', - emscripten_webgpu_import_sampler__sig: 'pi', - emscripten_webgpu_import_shader_module__sig: 'pi', - emscripten_webgpu_import_surface__sig: 'pi', - emscripten_webgpu_import_swap_chain__sig: 'pi', - emscripten_webgpu_import_texture__sig: 'pi', - emscripten_webgpu_import_texture_view__sig: 'pi', - emscripten_webgpu_release_js_handle__sig: 'vi', emscripten_websocket_close__sig: 'iiip', emscripten_websocket_deinitialize__sig: 'v', emscripten_websocket_delete__sig: 'ii', @@ -1555,195 +1511,6 @@ sigs = { uuid_unparse_lower__sig: 'vpp', uuid_unparse_upper__sig: 'vpp', uuid_variant__sig: 'ip', - wgpuAdapterEnumerateFeatures__sig: 'ppp', - wgpuAdapterGetInfo__sig: 'vpp', - wgpuAdapterGetLimits__sig: 'ipp', - wgpuAdapterGetProperties__sig: 'vpp', - wgpuAdapterHasFeature__sig: 'ipi', - wgpuAdapterPropertiesFreeMembers__sig: 'vp', - wgpuAdapterReference__sig: 'vp', - wgpuAdapterRelease__sig: 'vp', - wgpuAdapterRequestDevice__sig: 'vpppp', - wgpuBindGroupLayoutReference__sig: 'vp', - wgpuBindGroupLayoutRelease__sig: 'vp', - wgpuBindGroupLayoutSetLabel__sig: 'vpp', - wgpuBindGroupReference__sig: 'vp', - wgpuBindGroupRelease__sig: 'vp', - wgpuBindGroupSetLabel__sig: 'vpp', - wgpuBufferDestroy__sig: 'vp', - wgpuBufferGetConstMappedRange__sig: 'pppp', - wgpuBufferGetMapState__sig: 'ip', - wgpuBufferGetMappedRange__sig: 'pppp', - wgpuBufferGetSize__sig: 'jp', - wgpuBufferGetUsage__sig: 'ip', - wgpuBufferMapAsync__sig: 'vpipppp', - wgpuBufferReference__sig: 'vp', - wgpuBufferRelease__sig: 'vp', - wgpuBufferSetLabel__sig: 'vpp', - wgpuBufferUnmap__sig: 'vp', - wgpuCommandBufferReference__sig: 'vp', - wgpuCommandBufferRelease__sig: 'vp', - wgpuCommandBufferSetLabel__sig: 'vpp', - wgpuCommandEncoderBeginComputePass__sig: 'ppp', - wgpuCommandEncoderBeginRenderPass__sig: 'ppp', - wgpuCommandEncoderClearBuffer__sig: 'vppjj', - wgpuCommandEncoderCopyBufferToBuffer__sig: 'vppjpjj', - wgpuCommandEncoderCopyBufferToTexture__sig: 'vpppp', - wgpuCommandEncoderCopyTextureToBuffer__sig: 'vpppp', - wgpuCommandEncoderCopyTextureToTexture__sig: 'vpppp', - wgpuCommandEncoderFinish__sig: 'ppp', - wgpuCommandEncoderInsertDebugMarker__sig: 'vpp', - wgpuCommandEncoderPopDebugGroup__sig: 'vp', - wgpuCommandEncoderPushDebugGroup__sig: 'vpp', - wgpuCommandEncoderReference__sig: 'vp', - wgpuCommandEncoderRelease__sig: 'vp', - wgpuCommandEncoderResolveQuerySet__sig: 'vppiipj', - wgpuCommandEncoderSetLabel__sig: 'vpp', - wgpuCommandEncoderWriteTimestamp__sig: 'vppi', - wgpuComputePassEncoderDispatchWorkgroups__sig: 'vpiii', - wgpuComputePassEncoderDispatchWorkgroupsIndirect__sig: 'vppj', - wgpuComputePassEncoderEnd__sig: 'vp', - wgpuComputePassEncoderInsertDebugMarker__sig: 'vpp', - wgpuComputePassEncoderPopDebugGroup__sig: 'vp', - wgpuComputePassEncoderPushDebugGroup__sig: 'vpp', - wgpuComputePassEncoderReference__sig: 'vp', - wgpuComputePassEncoderRelease__sig: 'vp', - wgpuComputePassEncoderSetBindGroup__sig: 'vpippp', - wgpuComputePassEncoderSetLabel__sig: 'vpp', - wgpuComputePassEncoderSetPipeline__sig: 'vpp', - wgpuComputePassEncoderWriteTimestamp__sig: 'vppi', - wgpuComputePipelineGetBindGroupLayout__sig: 'ppi', - wgpuComputePipelineReference__sig: 'vp', - wgpuComputePipelineRelease__sig: 'vp', - wgpuComputePipelineSetLabel__sig: 'vpp', - wgpuDeviceCreateBindGroup__sig: 'ppp', - wgpuDeviceCreateBindGroupLayout__sig: 'ppp', - wgpuDeviceCreateBuffer__sig: 'ppp', - wgpuDeviceCreateCommandEncoder__sig: 'ppp', - wgpuDeviceCreateComputePipeline__sig: 'ppp', - wgpuDeviceCreateComputePipelineAsync__sig: 'vpppp', - wgpuDeviceCreatePipelineLayout__sig: 'ppp', - wgpuDeviceCreateQuerySet__sig: 'ppp', - wgpuDeviceCreateRenderBundleEncoder__sig: 'ppp', - wgpuDeviceCreateRenderPipeline__sig: 'ppp', - wgpuDeviceCreateRenderPipelineAsync__sig: 'vpppp', - wgpuDeviceCreateSampler__sig: 'ppp', - wgpuDeviceCreateShaderModule__sig: 'ppp', - wgpuDeviceCreateSwapChain__sig: 'pppp', - wgpuDeviceCreateTexture__sig: 'ppp', - wgpuDeviceDestroy__sig: 'vp', - wgpuDeviceEnumerateFeatures__sig: 'ppp', - wgpuDeviceGetLimits__sig: 'ipp', - wgpuDeviceGetQueue__sig: 'pp', - wgpuDeviceHasFeature__sig: 'ipi', - wgpuDevicePopErrorScope__sig: 'vppp', - wgpuDevicePushErrorScope__sig: 'vpi', - wgpuDeviceReference__sig: 'vp', - wgpuDeviceRelease__sig: 'vp', - wgpuDeviceSetLabel__sig: 'vpp', - wgpuDeviceSetUncapturedErrorCallback__sig: 'vppp', - wgpuGetInstanceFeatures__sig: 'ip', - wgpuGetProcAddress__sig: 'ppp', - wgpuInstanceCreateSurface__sig: 'ppp', - wgpuInstanceHasWGSLLanguageFeature__sig: 'ipi', - wgpuInstanceProcessEvents__sig: 'vp', - wgpuInstanceRequestAdapter__sig: 'vpppp', - wgpuPipelineLayoutReference__sig: 'vp', - wgpuPipelineLayoutRelease__sig: 'vp', - wgpuPipelineLayoutSetLabel__sig: 'vpp', - wgpuQuerySetDestroy__sig: 'vp', - wgpuQuerySetGetCount__sig: 'ip', - wgpuQuerySetGetType__sig: 'ip', - wgpuQuerySetReference__sig: 'vp', - wgpuQuerySetRelease__sig: 'vp', - wgpuQuerySetSetLabel__sig: 'vpp', - wgpuQueueOnSubmittedWorkDone__sig: 'vppp', - wgpuQueueReference__sig: 'vp', - wgpuQueueRelease__sig: 'vp', - wgpuQueueSetLabel__sig: 'vpp', - wgpuQueueSubmit__sig: 'vppp', - wgpuQueueWriteBuffer__sig: 'vppjpp', - wgpuQueueWriteTexture__sig: 'vpppppp', - wgpuRenderBundleEncoderDraw__sig: 'vpiiii', - wgpuRenderBundleEncoderDrawIndexed__sig: 'vpiiiii', - wgpuRenderBundleEncoderDrawIndexedIndirect__sig: 'vppj', - wgpuRenderBundleEncoderDrawIndirect__sig: 'vppj', - wgpuRenderBundleEncoderFinish__sig: 'ppp', - wgpuRenderBundleEncoderInsertDebugMarker__sig: 'vpp', - wgpuRenderBundleEncoderPopDebugGroup__sig: 'vp', - wgpuRenderBundleEncoderPushDebugGroup__sig: 'vpp', - wgpuRenderBundleEncoderReference__sig: 'vp', - wgpuRenderBundleEncoderRelease__sig: 'vp', - wgpuRenderBundleEncoderSetBindGroup__sig: 'vpippp', - wgpuRenderBundleEncoderSetIndexBuffer__sig: 'vppijj', - wgpuRenderBundleEncoderSetLabel__sig: 'vpp', - wgpuRenderBundleEncoderSetPipeline__sig: 'vpp', - wgpuRenderBundleEncoderSetVertexBuffer__sig: 'vpipjj', - wgpuRenderBundleReference__sig: 'vp', - wgpuRenderBundleRelease__sig: 'vp', - wgpuRenderBundleSetLabel__sig: 'vpp', - wgpuRenderPassEncoderBeginOcclusionQuery__sig: 'vpi', - wgpuRenderPassEncoderDraw__sig: 'vpiiii', - wgpuRenderPassEncoderDrawIndexed__sig: 'vpiiiii', - wgpuRenderPassEncoderDrawIndexedIndirect__sig: 'vppj', - wgpuRenderPassEncoderDrawIndirect__sig: 'vppj', - wgpuRenderPassEncoderEnd__sig: 'vp', - wgpuRenderPassEncoderEndOcclusionQuery__sig: 'vp', - wgpuRenderPassEncoderExecuteBundles__sig: 'vppp', - wgpuRenderPassEncoderInsertDebugMarker__sig: 'vpp', - wgpuRenderPassEncoderPopDebugGroup__sig: 'vp', - wgpuRenderPassEncoderPushDebugGroup__sig: 'vpp', - wgpuRenderPassEncoderReference__sig: 'vp', - wgpuRenderPassEncoderRelease__sig: 'vp', - wgpuRenderPassEncoderSetBindGroup__sig: 'vpippp', - wgpuRenderPassEncoderSetBlendConstant__sig: 'vpp', - wgpuRenderPassEncoderSetIndexBuffer__sig: 'vppijj', - wgpuRenderPassEncoderSetLabel__sig: 'vpp', - wgpuRenderPassEncoderSetPipeline__sig: 'vpp', - wgpuRenderPassEncoderSetScissorRect__sig: 'vpiiii', - wgpuRenderPassEncoderSetStencilReference__sig: 'vpi', - wgpuRenderPassEncoderSetVertexBuffer__sig: 'vpipjj', - wgpuRenderPassEncoderSetViewport__sig: 'vpffffff', - wgpuRenderPassEncoderWriteTimestamp__sig: 'vppi', - wgpuRenderPipelineGetBindGroupLayout__sig: 'ppi', - wgpuRenderPipelineReference__sig: 'vp', - wgpuRenderPipelineRelease__sig: 'vp', - wgpuRenderPipelineSetLabel__sig: 'vpp', - wgpuSamplerReference__sig: 'vp', - wgpuSamplerRelease__sig: 'vp', - wgpuSamplerSetLabel__sig: 'vpp', - wgpuShaderModuleGetCompilationInfo__sig: 'vppp', - wgpuShaderModuleReference__sig: 'vp', - wgpuShaderModuleRelease__sig: 'vp', - wgpuShaderModuleSetLabel__sig: 'vpp', - wgpuSurfaceConfigure__sig: 'vpp', - wgpuSurfaceGetCurrentTexture__sig: 'vpp', - wgpuSurfaceGetPreferredFormat__sig: 'ipp', - wgpuSurfacePresent__sig: 'vp', - wgpuSurfaceReference__sig: 'vp', - wgpuSurfaceRelease__sig: 'vp', - wgpuSurfaceUnconfigure__sig: 'vp', - wgpuSwapChainGetCurrentTexture__sig: 'pp', - wgpuSwapChainGetCurrentTextureView__sig: 'pp', - wgpuSwapChainPresent__sig: 'vp', - wgpuSwapChainReference__sig: 'vp', - wgpuSwapChainRelease__sig: 'vp', - wgpuTextureCreateView__sig: 'ppp', - wgpuTextureDestroy__sig: 'vp', - wgpuTextureGetDepthOrArrayLayers__sig: 'ip', - wgpuTextureGetDimension__sig: 'ip', - wgpuTextureGetFormat__sig: 'ip', - wgpuTextureGetHeight__sig: 'ip', - wgpuTextureGetMipLevelCount__sig: 'ip', - wgpuTextureGetSampleCount__sig: 'ip', - wgpuTextureGetUsage__sig: 'ip', - wgpuTextureGetWidth__sig: 'ip', - wgpuTextureReference__sig: 'vp', - wgpuTextureRelease__sig: 'vp', - wgpuTextureSetLabel__sig: 'vpp', - wgpuTextureViewReference__sig: 'vp', - wgpuTextureViewRelease__sig: 'vp', - wgpuTextureViewSetLabel__sig: 'vpp', zoomSurface__sig: 'ppddi', } diff --git a/src/lib/libwebgpu.js b/src/lib/libwebgpu.js deleted file mode 100644 index 153681e861474..0000000000000 --- a/src/lib/libwebgpu.js +++ /dev/null @@ -1,2909 +0,0 @@ -/** - * @license - * Copyright 2019 The Emscripten Authors - * SPDX-License-Identifier: MIT - */ - -/* - * WebGPU support. - * - * **IMPORTANT NOTICE:** - * These bindings are **deprecated and unmaintained** and will be removed. - * Please see system/include/webgpu/README.md for more information. - * - * This file and system/lib/webgpu/webgpu.cpp together implement the - * to-be-standardized C header on top of the - * browser's native JS WebGPU implementation. This allows applications targeting - * wgpu-native (https://github.com/gfx-rs/wgpu-native) or - * Dawn (https://dawn.googlesource.com/dawn/) to also target the Web with the - * same graphics API and fairly minimal changes - similar to OpenGL ES 2.0/3.0 - * on WebGL 1.0/2.0. - * - * To test this, run the following tests: - * - test/runner.py 'other.test_webgpu*' - * - EMTEST_BROWSER="/path/to/chrome --user-data-dir=chromeuserdata --enable-unsafe-webgpu" \ - * test/runner.py 'browser.test_webgpu*' - */ - -{{{ - // Helper functions for code generation - const gpu = { - makeInitManager: function(type) { - return `WebGPU.mgr${type} = new Manager();`; - }, - - makeReferenceRelease: function(type) { - return ` -wgpu${type}Reference: (id) => WebGPU.mgr${type}.reference(id), -wgpu${type}Release: (id) => WebGPU.mgr${type}.release(id),`; - }, - - convertSentinelToUndefined: function(name) { - return `if (${name} == -1) ${name} = undefined;`; - }, - - makeGetBool: function(struct, offset) { - return `!!(${makeGetValue(struct, offset, 'u32')})`; - }, - makeGetU32: function(struct, offset) { - return makeGetValue(struct, offset, 'u32'); - }, - makeGetU64: function(struct, offset) { - var l = makeGetValue(struct, offset, 'u32'); - var h = makeGetValue(`(${struct} + 4)`, offset, 'u32') - return `${h} * 0x100000000 + ${l}` - }, - makeCheck: function(str) { - if (!ASSERTIONS) return ''; - return `assert(${str});`; - }, - makeCheckDefined: function(name) { - return this.makeCheck(`typeof ${name} != "undefined"`); - }, - makeCheckDescriptor: function(descriptor) { - // Assert descriptor is non-null, then that its nextInChain is null. - // For descriptors that aren't the first in the chain (e.g - // ShaderModuleSPIRVDescriptor), there is no .nextInChain pointer, but - // instead a ChainedStruct object: .chain. So we need to check if - // .chain.nextInChain is null. As long as nextInChain and chain are always - // the first member in the struct, descriptor.nextInChain and - // descriptor.chain.nextInChain should have the same offset (0) to the - // descriptor pointer and we can check it to be null. - var OffsetOfNextInChainMember = 0; - return this.makeCheck(descriptor) + this.makeCheck(makeGetValue(descriptor, OffsetOfNextInChainMember, '*') + ' === 0'); - }, - - // Compile-time table for enum integer values used with templating. - // Must be in sync with webgpu.h. - // TODO: Generate this to keep it in sync with webgpu.h - COPY_STRIDE_UNDEFINED: 0xFFFFFFFF, - LIMIT_U32_UNDEFINED: 0xFFFFFFFF, - MIP_LEVEL_COUNT_UNDEFINED: 0xFFFFFFFF, - ARRAY_LAYER_COUNT_UNDEFINED: 0xFFFFFFFF, - AdapterType: { - CPU: 3, - Unknown: 4, - }, - BackendType: { - WebGPU: 2, - }, - BufferMapAsyncStatus: { - Success: 0, - ValidationError: 1, - Unknown: 2, - DeviceLost: 3, - DestroyedBeforeCallback: 4, - UnmappedBeforeCallback: 5, - MappingAlreadyPending: 6, - OffsetOutOfRange: 7, - SizeOutOfRange: 8, - }, - CompilationInfoRequestStatus: { - Success: 0, - Error: 1, - DeviceLost: 2, - Unknown: 3, - }, - CompositeAlphaMode: { - Auto: 0, - Opaque: 1, - Premultiplied: 2, - }, - CreatePipelineAsyncStatus: { - Success: 0, - ValidationError: 1, - InternalError: 2, - DeviceLost: 3, - DeviceDestroyed: 4, - Unknown: 5, - }, - ErrorType: { - NoError: 0, - Validation: 1, - OutOfMemory: 2, - Internal: 3, - Unknown: 4, - DeviceLost: 5, - }, - PresentMode: { - Fifo: 1, - Immediate: 3, - Mailbox: 4, - }, - LoadOp: { - Undefined: 0, - Clear: 1, - Load: 2, - }, - StoreOp: { - Undefined: 0, - Store: 1, - Discard: 2, - }, - MapMode: { - None: 0, - Read: 1, - Write: 2 - }, - RequestAdapterStatus: { - Success: 0, - Unavailable: 1, - Error: 2, - Unknown: 3, - }, - RequestDeviceStatus: { - Success: 0, - Error: 1, - Unknown: 1, - }, - SType: { - SurfaceDescriptorFromCanvasHTMLSelector: 0x4, - ShaderModuleSPIRVDescriptor: 0x5, - ShaderModuleWGSLDescriptor: 0x6, - PrimitiveDepthClipControl: 0x7, - RenderPassDescriptorMaxDrawCount: 0xF, - TextureBindingViewDimensionDescriptor: 0x11, - }, - SurfaceGetCurrentTextureStatus: { - Success: 0, - DeviceLost: 5, - }, - QueueWorkDoneStatus: { - Success: 0, - Error: 1, - Unknown: 2, - DeviceLost: 3, - }, - TextureFormat: { - Undefined: 0, - }, - VertexStepMode: { - Undefined: 0, - VertexBufferNotUsed: 1, - Vertex: 2, - Instance: 3, - }, - }; -}}} - -var LibraryWebGPU = { - $WebGPU__postset: 'WebGPU.initManagers();', - $WebGPU__deps: ['$stackSave', '$stackRestore', '$stringToUTF8OnStack'], - $WebGPU: { - errorCallback: (callback, type, message, userdata) => { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack(message); - {{{ makeDynCall('vipp', 'callback') }}}(type, messagePtr, userdata); - stackRestore(sp); - }, - - initManagers: () => { -#if ASSERTIONS - assert(!WebGPU.mgrDevice, 'initManagers already called'); -#endif - - /** @constructor */ - function Manager() { - this.objects = {}; - this.nextId = 1; - this.create = function(object, wrapper = {}) { - var id = this.nextId++; - {{{ gpu.makeCheck("typeof this.objects[id] == 'undefined'") }}} - wrapper.refcount = 1; - wrapper.object = object; - this.objects[id] = wrapper; - return id; - }; - this.get = function(id) { - if (!id) return undefined; - var o = this.objects[id]; - {{{ gpu.makeCheckDefined('o') }}} - return o.object; - }; - this.reference = function(id) { - var o = this.objects[id]; - {{{ gpu.makeCheckDefined('o') }}} - o.refcount++; - }; - this.release = function(id) { - var o = this.objects[id]; - {{{ gpu.makeCheckDefined('o') }}} - {{{ gpu.makeCheck('o.refcount > 0') }}} - o.refcount--; - if (o.refcount <= 0) { - delete this.objects[id]; - } - }; - } - - {{{ gpu.makeInitManager('Surface') }}} - {{{ gpu.makeInitManager('SwapChain') }}} - - {{{ gpu.makeInitManager('Adapter') }}} - // TODO: Release() the device's default queue when the device is freed. - {{{ gpu.makeInitManager('Device') }}} - {{{ gpu.makeInitManager('Queue') }}} - - {{{ gpu.makeInitManager('CommandBuffer') }}} - {{{ gpu.makeInitManager('CommandEncoder') }}} - {{{ gpu.makeInitManager('RenderPassEncoder') }}} - {{{ gpu.makeInitManager('ComputePassEncoder') }}} - - {{{ gpu.makeInitManager('BindGroup') }}} - {{{ gpu.makeInitManager('Buffer') }}} - {{{ gpu.makeInitManager('Sampler') }}} - {{{ gpu.makeInitManager('Texture') }}} - {{{ gpu.makeInitManager('TextureView') }}} - {{{ gpu.makeInitManager('QuerySet') }}} - - {{{ gpu.makeInitManager('BindGroupLayout') }}} - {{{ gpu.makeInitManager('PipelineLayout') }}} - {{{ gpu.makeInitManager('RenderPipeline') }}} - {{{ gpu.makeInitManager('ComputePipeline') }}} - {{{ gpu.makeInitManager('ShaderModule') }}} - - {{{ gpu.makeInitManager('RenderBundleEncoder') }}} - {{{ gpu.makeInitManager('RenderBundle') }}} - }, - - makeColor: (ptr) => { - return { - "r": {{{ makeGetValue('ptr', 0, 'double') }}}, - "g": {{{ makeGetValue('ptr', 8, 'double') }}}, - "b": {{{ makeGetValue('ptr', 16, 'double') }}}, - "a": {{{ makeGetValue('ptr', 24, 'double') }}}, - }; - }, - - makeExtent3D: (ptr) => { - return { - "width": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUExtent3D.width) }}}, - "height": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUExtent3D.height) }}}, - "depthOrArrayLayers": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUExtent3D.depthOrArrayLayers) }}}, - }; - }, - - makeOrigin3D: (ptr) => { - return { - "x": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUOrigin3D.x) }}}, - "y": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUOrigin3D.y) }}}, - "z": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUOrigin3D.z) }}}, - }; - }, - - makeImageCopyTexture: (ptr) => { - {{{ gpu.makeCheckDescriptor('ptr') }}} - return { - "texture": WebGPU.mgrTexture.get( - {{{ makeGetValue('ptr', C_STRUCTS.WGPUImageCopyTexture.texture, '*') }}}), - "mipLevel": {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUImageCopyTexture.mipLevel) }}}, - "origin": WebGPU.makeOrigin3D(ptr + {{{ C_STRUCTS.WGPUImageCopyTexture.origin }}}), - "aspect": WebGPU.TextureAspect[{{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUImageCopyTexture.aspect) }}}], - }; - }, - - makeTextureDataLayout: (ptr) => { - {{{ gpu.makeCheckDescriptor('ptr') }}} - var bytesPerRow = {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUTextureDataLayout.bytesPerRow) }}}; - var rowsPerImage = {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUTextureDataLayout.rowsPerImage) }}}; - return { - "offset": {{{ gpu.makeGetU64('ptr', C_STRUCTS.WGPUTextureDataLayout.offset) }}}, - "bytesPerRow": bytesPerRow === {{{ gpu.COPY_STRIDE_UNDEFINED }}} ? undefined : bytesPerRow, - "rowsPerImage": rowsPerImage === {{{ gpu.COPY_STRIDE_UNDEFINED }}} ? undefined : rowsPerImage, - }; - }, - - makeImageCopyBuffer: (ptr) => { - {{{ gpu.makeCheckDescriptor('ptr') }}} - var layoutPtr = ptr + {{{ C_STRUCTS.WGPUImageCopyBuffer.layout }}}; - var bufferCopyView = WebGPU.makeTextureDataLayout(layoutPtr); - bufferCopyView["buffer"] = WebGPU.mgrBuffer.get( - {{{ makeGetValue('ptr', C_STRUCTS.WGPUImageCopyBuffer.buffer, '*') }}}); - return bufferCopyView; - }, - - makePipelineConstants: (constantCount, constantsPtr) => { - if (!constantCount) return; - var constants = {}; - for (var i = 0; i < constantCount; ++i) { - var entryPtr = constantsPtr + {{{ C_STRUCTS.WGPUConstantEntry.__size__ }}} * i; - var key = UTF8ToString({{{ makeGetValue('entryPtr', C_STRUCTS.WGPUConstantEntry.key, '*') }}}); - constants[key] = {{{ makeGetValue('entryPtr', C_STRUCTS.WGPUConstantEntry.value, 'double') }}}; - } - return constants; - }, - - makePipelineLayout: (layoutPtr) => { - if (!layoutPtr) return 'auto'; - return WebGPU.mgrPipelineLayout.get(layoutPtr); - }, - - makeProgrammableStageDescriptor: (ptr) => { - if (!ptr) return undefined; - {{{ gpu.makeCheckDescriptor('ptr') }}} - var desc = { - "module": WebGPU.mgrShaderModule.get( - {{{ makeGetValue('ptr', C_STRUCTS.WGPUProgrammableStageDescriptor.module, '*') }}}), - "constants": WebGPU.makePipelineConstants( - {{{ gpu.makeGetU32('ptr', C_STRUCTS.WGPUProgrammableStageDescriptor.constantCount) }}}, - {{{ makeGetValue('ptr', C_STRUCTS.WGPUProgrammableStageDescriptor.constants, '*') }}}), - }; - var entryPointPtr = {{{ makeGetValue('ptr', C_STRUCTS.WGPUProgrammableStageDescriptor.entryPoint, '*') }}}; - if (entryPointPtr) desc["entryPoint"] = UTF8ToString(entryPointPtr); - return desc; - }, - - fillLimitStruct: (limits, supportedLimitsOutPtr) => { - var limitsOutPtr = supportedLimitsOutPtr + {{{ C_STRUCTS.WGPUSupportedLimits.limits }}}; - - function setLimitValueU32(name, limitOffset) { - var limitValue = limits[name]; - {{{ makeSetValue('limitsOutPtr', 'limitOffset', 'limitValue', 'i32') }}}; - } - function setLimitValueU64(name, limitOffset) { - var limitValue = limits[name]; - {{{ makeSetValue('limitsOutPtr', 'limitOffset', 'limitValue', 'i64') }}}; - } - - setLimitValueU32('maxTextureDimension1D', {{{ C_STRUCTS.WGPULimits.maxTextureDimension1D }}}); - setLimitValueU32('maxTextureDimension2D', {{{ C_STRUCTS.WGPULimits.maxTextureDimension2D }}}); - setLimitValueU32('maxTextureDimension3D', {{{ C_STRUCTS.WGPULimits.maxTextureDimension3D }}}); - setLimitValueU32('maxTextureArrayLayers', {{{ C_STRUCTS.WGPULimits.maxTextureArrayLayers }}}); - setLimitValueU32('maxBindGroups', {{{ C_STRUCTS.WGPULimits.maxBindGroups }}}); - setLimitValueU32('maxBindGroupsPlusVertexBuffers', {{{ C_STRUCTS.WGPULimits.maxBindGroupsPlusVertexBuffers }}}); - setLimitValueU32('maxBindingsPerBindGroup', {{{ C_STRUCTS.WGPULimits.maxBindingsPerBindGroup }}}); - setLimitValueU32('maxDynamicUniformBuffersPerPipelineLayout', {{{ C_STRUCTS.WGPULimits.maxDynamicUniformBuffersPerPipelineLayout }}}); - setLimitValueU32('maxDynamicStorageBuffersPerPipelineLayout', {{{ C_STRUCTS.WGPULimits.maxDynamicStorageBuffersPerPipelineLayout }}}); - setLimitValueU32('maxSampledTexturesPerShaderStage', {{{ C_STRUCTS.WGPULimits.maxSampledTexturesPerShaderStage }}}); - setLimitValueU32('maxSamplersPerShaderStage', {{{ C_STRUCTS.WGPULimits.maxSamplersPerShaderStage }}}); - setLimitValueU32('maxStorageBuffersPerShaderStage', {{{ C_STRUCTS.WGPULimits.maxStorageBuffersPerShaderStage }}}); - setLimitValueU32('maxStorageTexturesPerShaderStage', {{{ C_STRUCTS.WGPULimits.maxStorageTexturesPerShaderStage }}}); - setLimitValueU32('maxUniformBuffersPerShaderStage', {{{ C_STRUCTS.WGPULimits.maxUniformBuffersPerShaderStage }}}); - setLimitValueU32('minUniformBufferOffsetAlignment', {{{ C_STRUCTS.WGPULimits.minUniformBufferOffsetAlignment }}}); - setLimitValueU32('minStorageBufferOffsetAlignment', {{{ C_STRUCTS.WGPULimits.minStorageBufferOffsetAlignment }}}); - - setLimitValueU64('maxUniformBufferBindingSize', {{{ C_STRUCTS.WGPULimits.maxUniformBufferBindingSize }}}); - setLimitValueU64('maxStorageBufferBindingSize', {{{ C_STRUCTS.WGPULimits.maxStorageBufferBindingSize }}}); - - setLimitValueU32('maxVertexBuffers', {{{ C_STRUCTS.WGPULimits.maxVertexBuffers }}}); - setLimitValueU64('maxBufferSize', {{{ C_STRUCTS.WGPULimits.maxBufferSize }}}); - setLimitValueU32('maxVertexAttributes', {{{ C_STRUCTS.WGPULimits.maxVertexAttributes }}}); - setLimitValueU32('maxVertexBufferArrayStride', {{{ C_STRUCTS.WGPULimits.maxVertexBufferArrayStride }}}); - setLimitValueU32('maxInterStageShaderComponents', {{{ C_STRUCTS.WGPULimits.maxInterStageShaderComponents }}}); - setLimitValueU32('maxInterStageShaderVariables', {{{ C_STRUCTS.WGPULimits.maxInterStageShaderVariables }}}); - setLimitValueU32('maxColorAttachments', {{{ C_STRUCTS.WGPULimits.maxColorAttachments }}}); - setLimitValueU32('maxColorAttachmentBytesPerSample', {{{ C_STRUCTS.WGPULimits.maxColorAttachmentBytesPerSample }}}); - setLimitValueU32('maxComputeWorkgroupStorageSize', {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupStorageSize }}}); - setLimitValueU32('maxComputeInvocationsPerWorkgroup', {{{ C_STRUCTS.WGPULimits.maxComputeInvocationsPerWorkgroup }}}); - setLimitValueU32('maxComputeWorkgroupSizeX', {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupSizeX }}}); - setLimitValueU32('maxComputeWorkgroupSizeY', {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupSizeY }}}); - setLimitValueU32('maxComputeWorkgroupSizeZ', {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupSizeZ }}}); - setLimitValueU32('maxComputeWorkgroupsPerDimension', {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupsPerDimension }}}); - }, - - // Map from enum string back to enum number, for callbacks. - Int_BufferMapState: { - 'unmapped': 1, - 'pending': 2, - 'mapped': 3, - }, - Int_CompilationMessageType : { - 'error': 1, - 'warning': 2, - 'info': 3, - }, - Int_DeviceLostReason: { - 'undefined': 1, - 'unknown': 1, - 'destroyed': 2, - }, - Int_PreferredFormat: { - 'rgba8unorm': 0x12, - 'bgra8unorm': 0x17, - }, - - // Map from enum number to enum string. - // This section is auto-generated. See system/include/webgpu/README.md for details. - WGSLFeatureName: [ - undefined, - 'readonly_and_readwrite_storage_textures', - 'packed_4x8_integer_dot_product', - 'unrestricted_pointer_parameters', - 'pointer_composite_access', - ], - AddressMode: [ - undefined, - 'clamp-to-edge', - 'repeat', - 'mirror-repeat', - ], - AlphaMode: [ - undefined, // "Auto" uses the default (which is always opaque according to the spec's IDL) - 'opaque', - 'premultiplied', - ], - BlendFactor: [ - undefined, - 'zero', - 'one', - 'src', - 'one-minus-src', - 'src-alpha', - 'one-minus-src-alpha', - 'dst', - 'one-minus-dst', - 'dst-alpha', - 'one-minus-dst-alpha', - 'src-alpha-saturated', - 'constant', - 'one-minus-constant', - ], - BlendOperation: [ - undefined, - 'add', - 'subtract', - 'reverse-subtract', - 'min', - 'max', - ], - BufferBindingType: [ - undefined, - 'uniform', - 'storage', - 'read-only-storage', - ], - BufferMapState: { - 1: 'unmapped', - 2: 'pending', - 3: 'mapped', - }, - CompareFunction: [ - undefined, - 'never', - 'less', - 'equal', - 'less-equal', - 'greater', - 'not-equal', - 'greater-equal', - 'always', - ], - CompilationInfoRequestStatus: [ - 'success', - 'error', - 'device-lost', - 'unknown', - ], - CullMode: [ - undefined, - 'none', - 'front', - 'back', - ], - ErrorFilter: { - 1: 'validation', - 2: 'out-of-memory', - 3: 'internal', - }, - FeatureName: [ - undefined, - 'depth-clip-control', - 'depth32float-stencil8', - 'timestamp-query', - 'texture-compression-bc', - 'texture-compression-etc2', - 'texture-compression-astc', - 'indirect-first-instance', - 'shader-f16', - 'rg11b10ufloat-renderable', - 'bgra8unorm-storage', - 'float32-filterable', - ], - FilterMode: [ - undefined, - 'nearest', - 'linear', - ], - FrontFace: [ - undefined, - 'ccw', - 'cw', - ], - IndexFormat: [ - undefined, - 'uint16', - 'uint32', - ], - LoadOp: [ - undefined, - 'clear', - 'load', - ], - MipmapFilterMode: [ - undefined, - 'nearest', - 'linear', - ], - PowerPreference: [ - undefined, - 'low-power', - 'high-performance', - ], - PrimitiveTopology: [ - undefined, - 'point-list', - 'line-list', - 'line-strip', - 'triangle-list', - 'triangle-strip', - ], - QueryType: { - 1: 'occlusion', - 2: 'timestamp', - }, - SamplerBindingType: [ - undefined, - 'filtering', - 'non-filtering', - 'comparison', - ], - StencilOperation: [ - undefined, - 'keep', - 'zero', - 'replace', - 'invert', - 'increment-clamp', - 'decrement-clamp', - 'increment-wrap', - 'decrement-wrap', - ], - StorageTextureAccess: [ - undefined, - 'write-only', - 'read-only', - 'read-write', - ], - StoreOp: [ - undefined, - 'store', - 'discard', - ], - TextureAspect: [ - undefined, - 'all', - 'stencil-only', - 'depth-only', - ], - TextureDimension: [ - undefined, - '1d', - '2d', - '3d', - ], - TextureFormat: [ - undefined, - 'r8unorm', - 'r8snorm', - 'r8uint', - 'r8sint', - 'r16uint', - 'r16sint', - 'r16float', - 'rg8unorm', - 'rg8snorm', - 'rg8uint', - 'rg8sint', - 'r32float', - 'r32uint', - 'r32sint', - 'rg16uint', - 'rg16sint', - 'rg16float', - 'rgba8unorm', - 'rgba8unorm-srgb', - 'rgba8snorm', - 'rgba8uint', - 'rgba8sint', - 'bgra8unorm', - 'bgra8unorm-srgb', - 'rgb10a2uint', - 'rgb10a2unorm', - 'rg11b10ufloat', - 'rgb9e5ufloat', - 'rg32float', - 'rg32uint', - 'rg32sint', - 'rgba16uint', - 'rgba16sint', - 'rgba16float', - 'rgba32float', - 'rgba32uint', - 'rgba32sint', - 'stencil8', - 'depth16unorm', - 'depth24plus', - 'depth24plus-stencil8', - 'depth32float', - 'depth32float-stencil8', - 'bc1-rgba-unorm', - 'bc1-rgba-unorm-srgb', - 'bc2-rgba-unorm', - 'bc2-rgba-unorm-srgb', - 'bc3-rgba-unorm', - 'bc3-rgba-unorm-srgb', - 'bc4-r-unorm', - 'bc4-r-snorm', - 'bc5-rg-unorm', - 'bc5-rg-snorm', - 'bc6h-rgb-ufloat', - 'bc6h-rgb-float', - 'bc7-rgba-unorm', - 'bc7-rgba-unorm-srgb', - 'etc2-rgb8unorm', - 'etc2-rgb8unorm-srgb', - 'etc2-rgb8a1unorm', - 'etc2-rgb8a1unorm-srgb', - 'etc2-rgba8unorm', - 'etc2-rgba8unorm-srgb', - 'eac-r11unorm', - 'eac-r11snorm', - 'eac-rg11unorm', - 'eac-rg11snorm', - 'astc-4x4-unorm', - 'astc-4x4-unorm-srgb', - 'astc-5x4-unorm', - 'astc-5x4-unorm-srgb', - 'astc-5x5-unorm', - 'astc-5x5-unorm-srgb', - 'astc-6x5-unorm', - 'astc-6x5-unorm-srgb', - 'astc-6x6-unorm', - 'astc-6x6-unorm-srgb', - 'astc-8x5-unorm', - 'astc-8x5-unorm-srgb', - 'astc-8x6-unorm', - 'astc-8x6-unorm-srgb', - 'astc-8x8-unorm', - 'astc-8x8-unorm-srgb', - 'astc-10x5-unorm', - 'astc-10x5-unorm-srgb', - 'astc-10x6-unorm', - 'astc-10x6-unorm-srgb', - 'astc-10x8-unorm', - 'astc-10x8-unorm-srgb', - 'astc-10x10-unorm', - 'astc-10x10-unorm-srgb', - 'astc-12x10-unorm', - 'astc-12x10-unorm-srgb', - 'astc-12x12-unorm', - 'astc-12x12-unorm-srgb', - ], - TextureSampleType: [ - undefined, - 'float', - 'unfilterable-float', - 'depth', - 'sint', - 'uint', - ], - TextureViewDimension: [ - undefined, - '1d', - '2d', - '2d-array', - 'cube', - 'cube-array', - '3d', - ], - VertexFormat: [ - undefined, - 'uint8x2', - 'uint8x4', - 'sint8x2', - 'sint8x4', - 'unorm8x2', - 'unorm8x4', - 'snorm8x2', - 'snorm8x4', - 'uint16x2', - 'uint16x4', - 'sint16x2', - 'sint16x4', - 'unorm16x2', - 'unorm16x4', - 'snorm16x2', - 'snorm16x4', - 'float16x2', - 'float16x4', - 'float32', - 'float32x2', - 'float32x3', - 'float32x4', - 'uint32', - 'uint32x2', - 'uint32x3', - 'uint32x4', - 'sint32', - 'sint32x2', - 'sint32x3', - 'sint32x4', - 'unorm10-10-10-2', - ], - VertexStepMode: [ - undefined, - 'vertex-buffer-not-used', - 'vertex', - 'instance', - ], - }, - - // Non-method functions - - wgpuGetInstanceFeatures: (featuresPtr) => { - abort('TODO: wgpuGetInstanceFeatures unimplemented'); - return 0; - }, - - wgpuGetProcAddress: (device, procName) => { - abort('TODO(#11526): wgpuGetProcAddress unimplemented'); - return 0; - }, - - // *Reference/*Release - - {{{ gpu.makeReferenceRelease('Surface') }}} - {{{ gpu.makeReferenceRelease('SwapChain') }}} - - {{{ gpu.makeReferenceRelease('Adapter') }}} - {{{ gpu.makeReferenceRelease('Device') }}} - {{{ gpu.makeReferenceRelease('Queue') }}} - - {{{ gpu.makeReferenceRelease('CommandBuffer') }}} - {{{ gpu.makeReferenceRelease('CommandEncoder') }}} - {{{ gpu.makeReferenceRelease('RenderPassEncoder') }}} - {{{ gpu.makeReferenceRelease('ComputePassEncoder') }}} - - {{{ gpu.makeReferenceRelease('BindGroup') }}} - {{{ gpu.makeReferenceRelease('Buffer') }}} - {{{ gpu.makeReferenceRelease('Sampler') }}} - {{{ gpu.makeReferenceRelease('Texture') }}} - {{{ gpu.makeReferenceRelease('TextureView') }}} - {{{ gpu.makeReferenceRelease('QuerySet') }}} - - {{{ gpu.makeReferenceRelease('BindGroupLayout') }}} - {{{ gpu.makeReferenceRelease('PipelineLayout') }}} - {{{ gpu.makeReferenceRelease('RenderPipeline') }}} - {{{ gpu.makeReferenceRelease('ComputePipeline') }}} - {{{ gpu.makeReferenceRelease('ShaderModule') }}} - - {{{ gpu.makeReferenceRelease('RenderBundleEncoder') }}} - {{{ gpu.makeReferenceRelease('RenderBundle') }}} - - // *Destroy - - wgpuBufferDestroy: (bufferId) => { - var bufferWrapper = WebGPU.mgrBuffer.objects[bufferId]; - {{{ gpu.makeCheckDefined('bufferWrapper') }}} - if (bufferWrapper.onUnmap) { - for (var f of bufferWrapper.onUnmap) { - f(); - } - bufferWrapper.onUnmap = undefined; - } - - WebGPU.mgrBuffer.get(bufferId).destroy(); - }, - wgpuTextureDestroy: (textureId) => WebGPU.mgrTexture.get(textureId).destroy(), - wgpuQuerySetDestroy: (querySetId) => WebGPU.mgrQuerySet.get(querySetId).destroy(), - - // wgpuDevice - - wgpuDeviceEnumerateFeatures: (deviceId, featuresOutPtr) => { - var offset = 0; - var numFeatures = 0; - var device = WebGPU.mgrDevice.get(deviceId); - device.features.forEach(feature => { - var featureEnumValue = WebGPU.FeatureNameString2Enum[feature]; - if (featureEnumValue !== undefined) { - if (featuresOutPtr !== 0) { - {{{ makeSetValue('featuresOutPtr', 'offset', 'featureEnumValue', 'i32') }}}; - offset += 4; - } - numFeatures++; - } - }); - return numFeatures; - }, - - wgpuDeviceDestroy: (deviceId) => WebGPU.mgrDevice.get(deviceId).destroy(), - - wgpuDeviceGetLimits: (deviceId, limitsOutPtr) => { - var device = WebGPU.mgrDevice.objects[deviceId].object; - WebGPU.fillLimitStruct(device.limits, limitsOutPtr); - return 1; - }, - - wgpuDeviceGetQueue: (deviceId) => { - var queueId = WebGPU.mgrDevice.objects[deviceId].queueId; -#if ASSERTIONS - assert(queueId, 'wgpuDeviceGetQueue: queue was missing or null'); -#endif - // Returns a new reference to the existing queue. - WebGPU.mgrQueue.reference(queueId); - return queueId; - }, - - wgpuDeviceHasFeature: (deviceId, featureEnumValue) => { - var device = WebGPU.mgrDevice.get(deviceId); - return device.features.has(WebGPU.FeatureName[featureEnumValue]); - }, - - wgpuDevicePushErrorScope: (deviceId, filter) => { - var device = WebGPU.mgrDevice.get(deviceId); - device.pushErrorScope(WebGPU.ErrorFilter[filter]); - }, - - wgpuDevicePopErrorScope__deps: ['$callUserCallback'], - wgpuDevicePopErrorScope: (deviceId, callback, userdata) => { - var device = WebGPU.mgrDevice.get(deviceId); - {{{ runtimeKeepalivePush() }}} - device.popErrorScope().then((gpuError) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - if (!gpuError) { - {{{ makeDynCall('vipp', 'callback') }}}( - {{{ gpu.ErrorType.NoError }}}, 0, userdata); - } else if (gpuError instanceof GPUOutOfMemoryError) { - {{{ makeDynCall('vipp', 'callback') }}}( - {{{ gpu.ErrorType.OutOfMemory }}}, 0, userdata); - } else { -#if ASSERTIONS - // TODO: Implement GPUInternalError - assert(gpuError instanceof GPUValidationError); -#endif - WebGPU.errorCallback(callback, {{{ gpu.ErrorType.Validation }}}, gpuError.message, userdata); - } - }); - }, (ex) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - // TODO: This can mean either the device was lost or the error scope stack was empty. Figure - // out how to synthesize the DeviceLost error type. (Could be by simply tracking the error - // scope depth, but that isn't ideal.) - WebGPU.errorCallback(callback, {{{ gpu.ErrorType.Unknown }}}, ex.message, userdata); - }); - }); - }, - - wgpuDeviceSetLabel: (deviceId, labelPtr) => { - var device = WebGPU.mgrDevice.get(deviceId); - device.label = UTF8ToString(labelPtr); - }, - - wgpuDeviceSetUncapturedErrorCallback__deps: ['$callUserCallback'], - wgpuDeviceSetUncapturedErrorCallback: (deviceId, callback, userdata) => { - var device = WebGPU.mgrDevice.get(deviceId); - device.onuncapturederror = function(ev) { - // This will skip the callback if the runtime is no longer alive. - callUserCallback(() => { - // WGPUErrorType type, const char* message, void* userdata - var Validation = 0x00000001; - var OutOfMemory = 0x00000002; - var type; -#if ASSERTIONS - assert(typeof GPUValidationError != 'undefined'); - assert(typeof GPUOutOfMemoryError != 'undefined'); -#endif - if (ev.error instanceof GPUValidationError) type = Validation; - else if (ev.error instanceof GPUOutOfMemoryError) type = OutOfMemory; - // TODO: Implement GPUInternalError - - WebGPU.errorCallback(callback, type, ev.error.message, userdata); - }); - }; - }, - - // wgpuDeviceCreate* - - wgpuDeviceCreateCommandEncoder: (deviceId, descriptor) => { - var desc; - if (descriptor) { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - desc = { - "label": undefined, - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUCommandEncoderDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - } - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrCommandEncoder.create(device.createCommandEncoder(desc)); - }, - - wgpuDeviceCreateBuffer: (deviceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - var mappedAtCreation = {{{ gpu.makeGetBool('descriptor', C_STRUCTS.WGPUBufferDescriptor.mappedAtCreation) }}}; - - var desc = { - "label": undefined, - "usage": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUBufferDescriptor.usage) }}}, - "size": {{{ gpu.makeGetU64('descriptor', C_STRUCTS.WGPUBufferDescriptor.size) }}}, - "mappedAtCreation": mappedAtCreation, - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUBufferDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - var device = WebGPU.mgrDevice.get(deviceId); - var bufferWrapper = {}; - var id = WebGPU.mgrBuffer.create(device.createBuffer(desc), bufferWrapper); - if (mappedAtCreation) { - bufferWrapper.mapMode = {{{ gpu.MapMode.Write }}}; - bufferWrapper.onUnmap = []; - } - return id; - }, - - wgpuDeviceCreateTexture: (deviceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - var desc = { - "label": undefined, - "size": WebGPU.makeExtent3D(descriptor + {{{ C_STRUCTS.WGPUTextureDescriptor.size }}}), - "mipLevelCount": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.mipLevelCount) }}}, - "sampleCount": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.sampleCount) }}}, - "dimension": WebGPU.TextureDimension[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.dimension) }}}], - "format": WebGPU.TextureFormat[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.format) }}}], - "usage": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.usage) }}}, - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUTextureDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - var viewFormatCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.viewFormatCount) }}}; - if (viewFormatCount) { - var viewFormatsPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUTextureDescriptor.viewFormats, '*') }}}; - // viewFormatsPtr pointer to an array of TextureFormat which is an enum of size uint32_t - desc['viewFormats'] = Array.from({{{ makeHEAPView('32', 'viewFormatsPtr', 'viewFormatsPtr + viewFormatCount * 4') }}}, - format => WebGPU.TextureFormat[format]); - } - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrTexture.create(device.createTexture(desc)); - }, - - wgpuDeviceCreateSampler: (deviceId, descriptor) => { - var desc; - if (descriptor) { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - desc = { - "label": undefined, - "addressModeU": WebGPU.AddressMode[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.addressModeU) }}}], - "addressModeV": WebGPU.AddressMode[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.addressModeV) }}}], - "addressModeW": WebGPU.AddressMode[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.addressModeW) }}}], - "magFilter": WebGPU.FilterMode[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.magFilter) }}}], - "minFilter": WebGPU.FilterMode[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.minFilter) }}}], - "mipmapFilter": WebGPU.MipmapFilterMode[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.mipmapFilter) }}}], - "lodMinClamp": {{{ makeGetValue('descriptor', C_STRUCTS.WGPUSamplerDescriptor.lodMinClamp, 'float') }}}, - "lodMaxClamp": {{{ makeGetValue('descriptor', C_STRUCTS.WGPUSamplerDescriptor.lodMaxClamp, 'float') }}}, - "compare": WebGPU.CompareFunction[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.compare) }}}], - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUSamplerDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - } - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrSampler.create(device.createSampler(desc)); - }, - - wgpuDeviceCreateBindGroupLayout: (deviceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - function makeBufferEntry(entryPtr) { - {{{ gpu.makeCheck('entryPtr') }}} - - var typeInt = - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBufferBindingLayout.type) }}}; - if (!typeInt) return undefined; - - return { - "type": WebGPU.BufferBindingType[typeInt], - "hasDynamicOffset": - {{{ gpu.makeGetBool('entryPtr', C_STRUCTS.WGPUBufferBindingLayout.hasDynamicOffset) }}}, - "minBindingSize": - {{{ gpu.makeGetU64('entryPtr', C_STRUCTS.WGPUBufferBindingLayout.minBindingSize) }}}, - }; - } - - function makeSamplerEntry(entryPtr) { - {{{ gpu.makeCheck('entryPtr') }}} - - var typeInt = - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUSamplerBindingLayout.type) }}}; - if (!typeInt) return undefined; - - return { - "type": WebGPU.SamplerBindingType[typeInt], - }; - } - - function makeTextureEntry(entryPtr) { - {{{ gpu.makeCheck('entryPtr') }}} - - var sampleTypeInt = - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUTextureBindingLayout.sampleType) }}}; - if (!sampleTypeInt) return undefined; - - return { - "sampleType": WebGPU.TextureSampleType[sampleTypeInt], - "viewDimension": WebGPU.TextureViewDimension[ - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUTextureBindingLayout.viewDimension) }}}], - "multisampled": - {{{ gpu.makeGetBool('entryPtr', C_STRUCTS.WGPUTextureBindingLayout.multisampled) }}}, - }; - } - - function makeStorageTextureEntry(entryPtr) { - {{{ gpu.makeCheck('entryPtr') }}} - - var accessInt = - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUStorageTextureBindingLayout.access) }}} - if (!accessInt) return undefined; - - return { - "access": WebGPU.StorageTextureAccess[accessInt], - "format": WebGPU.TextureFormat[ - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUStorageTextureBindingLayout.format) }}}], - "viewDimension": WebGPU.TextureViewDimension[ - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUStorageTextureBindingLayout.viewDimension) }}}], - }; - } - - function makeEntry(entryPtr) { - {{{ gpu.makeCheck('entryPtr') }}} - - return { - "binding": - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBindGroupLayoutEntry.binding) }}}, - "visibility": - {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBindGroupLayoutEntry.visibility) }}}, - "buffer": makeBufferEntry(entryPtr + {{{ C_STRUCTS.WGPUBindGroupLayoutEntry.buffer }}}), - "sampler": makeSamplerEntry(entryPtr + {{{ C_STRUCTS.WGPUBindGroupLayoutEntry.sampler }}}), - "texture": makeTextureEntry(entryPtr + {{{ C_STRUCTS.WGPUBindGroupLayoutEntry.texture }}}), - "storageTexture": makeStorageTextureEntry(entryPtr + {{{ C_STRUCTS.WGPUBindGroupLayoutEntry.storageTexture }}}), - }; - } - - function makeEntries(count, entriesPtrs) { - var entries = []; - for (var i = 0; i < count; ++i) { - entries.push(makeEntry(entriesPtrs + - {{{ C_STRUCTS.WGPUBindGroupLayoutEntry.__size__ }}} * i)); - } - return entries; - } - - var desc = { - "entries": makeEntries( - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUBindGroupLayoutDescriptor.entryCount) }}}, - {{{ makeGetValue('descriptor', C_STRUCTS.WGPUBindGroupLayoutDescriptor.entries, '*') }}} - ), - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUBindGroupLayoutDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrBindGroupLayout.create(device.createBindGroupLayout(desc)); - }, - - wgpuDeviceCreateBindGroup__deps: ['$readI53FromI64'], - wgpuDeviceCreateBindGroup: (deviceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - function makeEntry(entryPtr) { - {{{ gpu.makeCheck('entryPtr') }}} - - var bufferId = {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBindGroupEntry.buffer) }}}; - var samplerId = {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBindGroupEntry.sampler) }}}; - var textureViewId = {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBindGroupEntry.textureView) }}}; -#if ASSERTIONS - assert((bufferId !== 0) + (samplerId !== 0) + (textureViewId !== 0) === 1); -#endif - - var binding = {{{ gpu.makeGetU32('entryPtr', C_STRUCTS.WGPUBindGroupEntry.binding) }}}; - - if (bufferId) { - var size = {{{ makeGetValue('entryPtr', C_STRUCTS.WGPUBindGroupEntry.size, 'i53') }}}; - {{{ gpu.convertSentinelToUndefined('size') }}} - - return { - "binding": binding, - "resource": { - "buffer": WebGPU.mgrBuffer.get(bufferId), - "offset": {{{ gpu.makeGetU64('entryPtr', C_STRUCTS.WGPUBindGroupEntry.offset) }}}, - "size": size - }, - }; - } else if (samplerId) { - return { - "binding": binding, - "resource": WebGPU.mgrSampler.get(samplerId), - }; - } else { - return { - "binding": binding, - "resource": WebGPU.mgrTextureView.get(textureViewId), - }; - } - } - - function makeEntries(count, entriesPtrs) { - var entries = []; - for (var i = 0; i < count; ++i) { - entries.push(makeEntry(entriesPtrs + - {{{C_STRUCTS.WGPUBindGroupEntry.__size__}}} * i)); - } - return entries; - } - - var desc = { - "label": undefined, - "layout": WebGPU.mgrBindGroupLayout.get( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPUBindGroupDescriptor.layout, '*') }}}), - "entries": makeEntries( - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUBindGroupDescriptor.entryCount) }}}, - {{{ makeGetValue('descriptor', C_STRUCTS.WGPUBindGroupDescriptor.entries, '*') }}} - ), - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUBindGroupDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrBindGroup.create(device.createBindGroup(desc)); - }, - - wgpuDeviceCreatePipelineLayout: (deviceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - var bglCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUPipelineLayoutDescriptor.bindGroupLayoutCount) }}}; - var bglPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUPipelineLayoutDescriptor.bindGroupLayouts, '*') }}}; - var bgls = []; - for (var i = 0; i < bglCount; ++i) { - bgls.push(WebGPU.mgrBindGroupLayout.get( - {{{ makeGetValue('bglPtr', `${POINTER_SIZE} * i`, '*') }}})); - } - var desc = { - "label": undefined, - "bindGroupLayouts": bgls, - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUPipelineLayoutDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrPipelineLayout.create(device.createPipelineLayout(desc)); - }, - - wgpuDeviceCreateQuerySet: (deviceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - var desc = { - "type": WebGPU.QueryType[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUQuerySetDescriptor.type) }}}], - "count": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUQuerySetDescriptor.count) }}}, - }; - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrQuerySet.create(device.createQuerySet(desc)); - }, - - wgpuDeviceCreateRenderBundleEncoder: (deviceId, descriptor) => { - {{{ gpu.makeCheck('descriptor') }}} - - function makeRenderBundleEncoderDescriptor(descriptor) { - {{{ gpu.makeCheck('descriptor') }}} - - function makeColorFormats(count, formatsPtr) { - var formats = []; - for (var i = 0; i < count; ++i, formatsPtr += 4) { - // format could be undefined - formats.push(WebGPU.TextureFormat[{{{ gpu.makeGetU32('formatsPtr', 0) }}}]); - } - return formats; - } - - var desc = { - "label": undefined, - "colorFormats": makeColorFormats( - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.colorFormatCount) }}}, - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.colorFormats, '*') }}}), - "depthStencilFormat": WebGPU.TextureFormat[{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.depthStencilFormat) }}}], - "sampleCount": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.sampleCount) }}}, - "depthReadOnly": {{{ gpu.makeGetBool('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.depthReadOnly) }}}, - "stencilReadOnly": {{{ gpu.makeGetBool('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.stencilReadOnly) }}}, - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderBundleEncoderDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - return desc; - } - - var desc = makeRenderBundleEncoderDescriptor(descriptor); - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrRenderBundleEncoder.create(device.createRenderBundleEncoder(desc)); - }, - - $generateComputePipelineDesc__internal: true, - $generateComputePipelineDesc: (descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - - var desc = { - "label": undefined, - "layout": WebGPU.makePipelineLayout( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPUComputePipelineDescriptor.layout, '*') }}}), - "compute": WebGPU.makeProgrammableStageDescriptor( - descriptor + {{{ C_STRUCTS.WGPUComputePipelineDescriptor.compute }}}), - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUComputePipelineDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - return desc; - }, - - wgpuDeviceCreateComputePipeline__deps: ['$generateComputePipelineDesc'], - wgpuDeviceCreateComputePipeline: (deviceId, descriptor) => { - var desc = generateComputePipelineDesc(descriptor); - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrComputePipeline.create(device.createComputePipeline(desc)); - }, - - wgpuDeviceCreateComputePipelineAsync__deps: ['$callUserCallback', '$stringToUTF8OnStack', '$generateComputePipelineDesc'], - wgpuDeviceCreateComputePipelineAsync: (deviceId, descriptor, callback, userdata) => { - var desc = generateComputePipelineDesc(descriptor); - var device = WebGPU.mgrDevice.get(deviceId); - {{{ runtimeKeepalivePush() }}} - device.createComputePipelineAsync(desc).then((pipeline) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var pipelineId = WebGPU.mgrComputePipeline.create(pipeline); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.Success }}}, pipelineId, 0, userdata); - }); - }, (pipelineError) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack(pipelineError.message); - if (pipelineError.reason === 'validation') { - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.ValidationError }}}, 0, messagePtr, userdata); - } else if (pipelineError.reason === 'internal') { - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.InternalError }}}, 0, messagePtr, userdata); - } else { - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.Unknown }}}, 0, messagePtr, userdata); - } - stackRestore(sp); - }); - }); - }, - - $generateRenderPipelineDesc__internal: true, - $generateRenderPipelineDesc: (descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - function makePrimitiveState(rsPtr) { - if (!rsPtr) return undefined; - {{{ gpu.makeCheck('rsPtr') }}} - - // TODO: This small hack assumes that there's only one type that can be in the chain of - // WGPUPrimitiveState. The correct thing would be to traverse the chain, but unclippedDepth - // is going to move into the core object soon, so we'll just do this for now. See: - // https://github.com/webgpu-native/webgpu-headers/issues/212#issuecomment-1682801259 - var nextInChainPtr = {{{ makeGetValue('rsPtr', C_STRUCTS.WGPUPrimitiveState.nextInChain, '*') }}}; - var sType = nextInChainPtr ? {{{ gpu.makeGetU32('nextInChainPtr', C_STRUCTS.WGPUChainedStruct.sType) }}} : 0; - - return { - "topology": WebGPU.PrimitiveTopology[ - {{{ gpu.makeGetU32('rsPtr', C_STRUCTS.WGPUPrimitiveState.topology) }}}], - "stripIndexFormat": WebGPU.IndexFormat[ - {{{ gpu.makeGetU32('rsPtr', C_STRUCTS.WGPUPrimitiveState.stripIndexFormat) }}}], - "frontFace": WebGPU.FrontFace[ - {{{ gpu.makeGetU32('rsPtr', C_STRUCTS.WGPUPrimitiveState.frontFace) }}}], - "cullMode": WebGPU.CullMode[ - {{{ gpu.makeGetU32('rsPtr', C_STRUCTS.WGPUPrimitiveState.cullMode) }}}], - "unclippedDepth": sType === {{{ gpu.SType.PrimitiveDepthClipControl }}} && {{{ gpu.makeGetBool('nextInChainPtr', C_STRUCTS.WGPUPrimitiveDepthClipControl.unclippedDepth) }}}, - }; - } - - function makeBlendComponent(bdPtr) { - if (!bdPtr) return undefined; - return { - "operation": WebGPU.BlendOperation[ - {{{ gpu.makeGetU32('bdPtr', C_STRUCTS.WGPUBlendComponent.operation) }}}], - "srcFactor": WebGPU.BlendFactor[ - {{{ gpu.makeGetU32('bdPtr', C_STRUCTS.WGPUBlendComponent.srcFactor) }}}], - "dstFactor": WebGPU.BlendFactor[ - {{{ gpu.makeGetU32('bdPtr', C_STRUCTS.WGPUBlendComponent.dstFactor) }}}], - }; - } - - function makeBlendState(bsPtr) { - if (!bsPtr) return undefined; - return { - "alpha": makeBlendComponent(bsPtr + {{{ C_STRUCTS.WGPUBlendState.alpha }}}), - "color": makeBlendComponent(bsPtr + {{{ C_STRUCTS.WGPUBlendState.color }}}), - }; - } - - function makeColorState(csPtr) { - {{{ gpu.makeCheckDescriptor('csPtr') }}} - var formatInt = {{{ gpu.makeGetU32('csPtr', C_STRUCTS.WGPUColorTargetState.format) }}}; - return formatInt === {{{ gpu.TextureFormat.Undefined }}} ? undefined : { - "format": WebGPU.TextureFormat[formatInt], - "blend": makeBlendState({{{ makeGetValue('csPtr', C_STRUCTS.WGPUColorTargetState.blend, '*') }}}), - "writeMask": {{{ gpu.makeGetU32('csPtr', C_STRUCTS.WGPUColorTargetState.writeMask) }}}, - }; - } - - function makeColorStates(count, csArrayPtr) { - var states = []; - for (var i = 0; i < count; ++i) { - states.push(makeColorState(csArrayPtr + {{{ C_STRUCTS.WGPUColorTargetState.__size__ }}} * i)); - } - return states; - } - - function makeStencilStateFace(ssfPtr) { - {{{ gpu.makeCheck('ssfPtr') }}} - return { - "compare": WebGPU.CompareFunction[ - {{{ gpu.makeGetU32('ssfPtr', C_STRUCTS.WGPUStencilFaceState.compare) }}}], - "failOp": WebGPU.StencilOperation[ - {{{ gpu.makeGetU32('ssfPtr', C_STRUCTS.WGPUStencilFaceState.failOp) }}}], - "depthFailOp": WebGPU.StencilOperation[ - {{{ gpu.makeGetU32('ssfPtr', C_STRUCTS.WGPUStencilFaceState.depthFailOp) }}}], - "passOp": WebGPU.StencilOperation[ - {{{ gpu.makeGetU32('ssfPtr', C_STRUCTS.WGPUStencilFaceState.passOp) }}}], - }; - } - - function makeDepthStencilState(dssPtr) { - if (!dssPtr) return undefined; - - {{{ gpu.makeCheck('dssPtr') }}} - return { - "format": WebGPU.TextureFormat[ - {{{ gpu.makeGetU32('dssPtr', C_STRUCTS.WGPUDepthStencilState.format) }}}], - "depthWriteEnabled": {{{ gpu.makeGetBool('dssPtr', C_STRUCTS.WGPUDepthStencilState.depthWriteEnabled) }}}, - "depthCompare": WebGPU.CompareFunction[ - {{{ gpu.makeGetU32('dssPtr', C_STRUCTS.WGPUDepthStencilState.depthCompare) }}}], - "stencilFront": makeStencilStateFace(dssPtr + {{{ C_STRUCTS.WGPUDepthStencilState.stencilFront }}}), - "stencilBack": makeStencilStateFace(dssPtr + {{{ C_STRUCTS.WGPUDepthStencilState.stencilBack }}}), - "stencilReadMask": {{{ gpu.makeGetU32('dssPtr', C_STRUCTS.WGPUDepthStencilState.stencilReadMask) }}}, - "stencilWriteMask": {{{ gpu.makeGetU32('dssPtr', C_STRUCTS.WGPUDepthStencilState.stencilWriteMask) }}}, - "depthBias": {{{ makeGetValue('dssPtr', C_STRUCTS.WGPUDepthStencilState.depthBias, 'i32') }}}, - "depthBiasSlopeScale": {{{ makeGetValue('dssPtr', C_STRUCTS.WGPUDepthStencilState.depthBiasSlopeScale, 'float') }}}, - "depthBiasClamp": {{{ makeGetValue('dssPtr', C_STRUCTS.WGPUDepthStencilState.depthBiasClamp, 'float') }}}, - }; - } - - function makeVertexAttribute(vaPtr) { - {{{ gpu.makeCheck('vaPtr') }}} - return { - "format": WebGPU.VertexFormat[ - {{{ gpu.makeGetU32('vaPtr', C_STRUCTS.WGPUVertexAttribute.format) }}}], - "offset": {{{ gpu.makeGetU64('vaPtr', C_STRUCTS.WGPUVertexAttribute.offset) }}}, - "shaderLocation": {{{ gpu.makeGetU32('vaPtr', C_STRUCTS.WGPUVertexAttribute.shaderLocation) }}}, - }; - } - - function makeVertexAttributes(count, vaArrayPtr) { - var vas = []; - for (var i = 0; i < count; ++i) { - vas.push(makeVertexAttribute(vaArrayPtr + i * {{{ C_STRUCTS.WGPUVertexAttribute.__size__ }}})); - } - return vas; - } - - function makeVertexBuffer(vbPtr) { - if (!vbPtr) return undefined; - var stepModeInt = {{{ gpu.makeGetU32('vbPtr', C_STRUCTS.WGPUVertexBufferLayout.stepMode) }}}; - return stepModeInt === {{{ gpu.VertexStepMode.VertexBufferNotUsed }}} ? null : { - "arrayStride": {{{ gpu.makeGetU64('vbPtr', C_STRUCTS.WGPUVertexBufferLayout.arrayStride) }}}, - "stepMode": WebGPU.VertexStepMode[stepModeInt], - "attributes": makeVertexAttributes( - {{{ gpu.makeGetU32('vbPtr', C_STRUCTS.WGPUVertexBufferLayout.attributeCount) }}}, - {{{ makeGetValue('vbPtr', C_STRUCTS.WGPUVertexBufferLayout.attributes, '*') }}}), - }; - } - - function makeVertexBuffers(count, vbArrayPtr) { - if (!count) return undefined; - - var vbs = []; - for (var i = 0; i < count; ++i) { - vbs.push(makeVertexBuffer(vbArrayPtr + i * {{{ C_STRUCTS.WGPUVertexBufferLayout.__size__ }}})); - } - return vbs; - } - - function makeVertexState(viPtr) { - if (!viPtr) return undefined; - {{{ gpu.makeCheckDescriptor('viPtr') }}} - var desc = { - "module": WebGPU.mgrShaderModule.get( - {{{ makeGetValue('viPtr', C_STRUCTS.WGPUVertexState.module, '*') }}}), - "constants": WebGPU.makePipelineConstants( - {{{ gpu.makeGetU32('viPtr', C_STRUCTS.WGPUVertexState.constantCount) }}}, - {{{ makeGetValue('viPtr', C_STRUCTS.WGPUVertexState.constants, '*') }}}), - "buffers": makeVertexBuffers( - {{{ gpu.makeGetU32('viPtr', C_STRUCTS.WGPUVertexState.bufferCount) }}}, - {{{ makeGetValue('viPtr', C_STRUCTS.WGPUVertexState.buffers, '*') }}}), - }; - var entryPointPtr = {{{ makeGetValue('viPtr', C_STRUCTS.WGPUVertexState.entryPoint, '*') }}}; - if (entryPointPtr) desc["entryPoint"] = UTF8ToString(entryPointPtr); - return desc; - } - - function makeMultisampleState(msPtr) { - if (!msPtr) return undefined; - {{{ gpu.makeCheckDescriptor('msPtr') }}} - return { - "count": {{{ gpu.makeGetU32('msPtr', C_STRUCTS.WGPUMultisampleState.count) }}}, - "mask": {{{ gpu.makeGetU32('msPtr', C_STRUCTS.WGPUMultisampleState.mask) }}}, - "alphaToCoverageEnabled": {{{ gpu.makeGetBool('msPtr', C_STRUCTS.WGPUMultisampleState.alphaToCoverageEnabled) }}}, - }; - } - - function makeFragmentState(fsPtr) { - if (!fsPtr) return undefined; - {{{ gpu.makeCheckDescriptor('fsPtr') }}} - var desc = { - "module": WebGPU.mgrShaderModule.get( - {{{ makeGetValue('fsPtr', C_STRUCTS.WGPUFragmentState.module, '*') }}}), - "constants": WebGPU.makePipelineConstants( - {{{ gpu.makeGetU32('fsPtr', C_STRUCTS.WGPUFragmentState.constantCount) }}}, - {{{ makeGetValue('fsPtr', C_STRUCTS.WGPUFragmentState.constants, '*') }}}), - "targets": makeColorStates( - {{{ gpu.makeGetU32('fsPtr', C_STRUCTS.WGPUFragmentState.targetCount) }}}, - {{{ makeGetValue('fsPtr', C_STRUCTS.WGPUFragmentState.targets, '*') }}}), - }; - var entryPointPtr = {{{ makeGetValue('fsPtr', C_STRUCTS.WGPUFragmentState.entryPoint, '*') }}}; - if (entryPointPtr) desc["entryPoint"] = UTF8ToString(entryPointPtr); - return desc; - } - - var desc = { - "label": undefined, - "layout": WebGPU.makePipelineLayout( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPipelineDescriptor.layout, '*') }}}), - "vertex": makeVertexState( - descriptor + {{{ C_STRUCTS.WGPURenderPipelineDescriptor.vertex }}}), - "primitive": makePrimitiveState( - descriptor + {{{ C_STRUCTS.WGPURenderPipelineDescriptor.primitive }}}), - "depthStencil": makeDepthStencilState( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPipelineDescriptor.depthStencil, '*') }}}), - "multisample": makeMultisampleState( - descriptor + {{{ C_STRUCTS.WGPURenderPipelineDescriptor.multisample }}}), - "fragment": makeFragmentState( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPipelineDescriptor.fragment, '*') }}}), - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPipelineDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - return desc; - }, - - wgpuDeviceCreateRenderPipeline__deps: ['$generateRenderPipelineDesc'], - wgpuDeviceCreateRenderPipeline: (deviceId, descriptor) => { - var desc = generateRenderPipelineDesc(descriptor); - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrRenderPipeline.create(device.createRenderPipeline(desc)); - }, - - wgpuDeviceCreateRenderPipelineAsync__deps: ['$callUserCallback', '$stringToUTF8OnStack', '$generateRenderPipelineDesc'], - wgpuDeviceCreateRenderPipelineAsync: (deviceId, descriptor, callback, userdata) => { - var desc = generateRenderPipelineDesc(descriptor); - var device = WebGPU.mgrDevice.get(deviceId); - {{{ runtimeKeepalivePush() }}} - device.createRenderPipelineAsync(desc).then((pipeline) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var pipelineId = WebGPU.mgrRenderPipeline.create(pipeline); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.Success }}}, pipelineId, 0, userdata); - }); - }, (pipelineError) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack(pipelineError.message); - if (pipelineError.reason === 'validation') { - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.ValidationError }}}, 0, messagePtr, userdata); - } else if (pipelineError.reason === 'internal') { - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.InternalError }}}, 0, messagePtr, userdata); - } else { - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.CreatePipelineAsyncStatus.Unknown }}}, 0, messagePtr, userdata); - } - stackRestore(sp); - }); - }); - }, - - wgpuDeviceCreateShaderModule: (deviceId, descriptor) => { - {{{ gpu.makeCheck('descriptor') }}} - var nextInChainPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUShaderModuleDescriptor.nextInChain, '*') }}}; -#if ASSERTIONS - assert(nextInChainPtr !== 0); -#endif - var sType = {{{ gpu.makeGetU32('nextInChainPtr', C_STRUCTS.WGPUChainedStruct.sType) }}}; - - var desc = { - "label": undefined, - "code": "", - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUShaderModuleDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - switch (sType) { - case {{{ gpu.SType.ShaderModuleSPIRVDescriptor }}}: { - var count = {{{ gpu.makeGetU32('nextInChainPtr', C_STRUCTS.WGPUShaderModuleSPIRVDescriptor.codeSize) }}}; - var start = {{{ makeGetValue('nextInChainPtr', C_STRUCTS.WGPUShaderModuleSPIRVDescriptor.code, '*') }}}; - var offset = {{{ getHeapOffset('start', 'u32') }}}; -#if PTHREADS - // Chrome can't currently handle a SharedArrayBuffer view here, so make a copy. - desc["code"] = HEAPU32.slice(offset, offset + count); -#else - desc["code"] = HEAPU32.subarray(offset, offset + count); -#endif - break; - } - case {{{ gpu.SType.ShaderModuleWGSLDescriptor }}}: { - var sourcePtr = {{{ makeGetValue('nextInChainPtr', C_STRUCTS.WGPUShaderModuleWGSLDescriptor.code, '*') }}}; - if (sourcePtr) { - desc["code"] = UTF8ToString(sourcePtr); - } - break; - } -#if ASSERTIONS - default: abort('unrecognized ShaderModule sType'); -#endif - } - - var device = WebGPU.mgrDevice.get(deviceId); - return WebGPU.mgrShaderModule.create(device.createShaderModule(desc)); - }, - - // wgpuQuerySet - - wgpuQuerySetGetCount: (querySetId) => { - var querySet = WebGPU.mgrQuerySet.get(querySetId); - return querySet.count; - }, - - wgpuQuerySetGetType: (querySetId, labelPtr) => { - var querySet = WebGPU.mgrQuerySet.get(querySetId); - return querySet.type; - }, - - wgpuQuerySetSetLabel: (querySetId, labelPtr) => { - var querySet = WebGPU.mgrQuerySet.get(querySetId); - querySet.label = UTF8ToString(labelPtr); - }, - - // wgpuQueue - - wgpuQueueSetLabel: (queueId, labelPtr) => { - var queue = WebGPU.mgrQueue.get(queueId); - queue.label = UTF8ToString(labelPtr); - }, - - wgpuQueueSubmit: (queueId, commandCount, commands) => { -#if ASSERTIONS - assert(commands % 4 === 0); -#endif - var queue = WebGPU.mgrQueue.get(queueId); - var cmds = Array.from({{{ makeHEAPView(`${POINTER_BITS}`, 'commands', `commands + commandCount * ${POINTER_SIZE}`)}}}, - (id) => WebGPU.mgrCommandBuffer.get(id)); - queue.submit(cmds); - }, - - wgpuQueueOnSubmittedWorkDone__deps: ['$callUserCallback'], - wgpuQueueOnSubmittedWorkDone: (queueId, callback, userdata) => { - var queue = WebGPU.mgrQueue.get(queueId); - - {{{ runtimeKeepalivePush() }}} - queue.onSubmittedWorkDone().then(() => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - {{{ makeDynCall('vip', 'callback') }}}({{{ gpu.QueueWorkDoneStatus.Success }}}, userdata); - }); - }, () => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - {{{ makeDynCall('vip', 'callback') }}}({{{ gpu.QueueWorkDoneStatus.Error }}}, userdata); - }); - }); - }, - - wgpuQueueWriteBuffer: (queueId, bufferId, bufferOffset, data, size) => { - var queue = WebGPU.mgrQueue.get(queueId); - var buffer = WebGPU.mgrBuffer.get(bufferId); - // There is a size limitation for ArrayBufferView. Work around by passing in a subarray - // instead of the whole heap. crbug.com/1201109 - var subarray = HEAPU8.subarray(data, data + size); - queue.writeBuffer(buffer, bufferOffset, subarray, 0, size); - }, - - wgpuQueueWriteTexture: (queueId, - destinationPtr, data, dataSize, dataLayoutPtr, writeSizePtr) => { - var queue = WebGPU.mgrQueue.get(queueId); - - var destination = WebGPU.makeImageCopyTexture(destinationPtr); - var dataLayout = WebGPU.makeTextureDataLayout(dataLayoutPtr); - var writeSize = WebGPU.makeExtent3D(writeSizePtr); - // This subarray isn't strictly necessary, but helps work around an issue - // where Chromium makes a copy of the entire heap. crbug.com/1134457 - var subarray = HEAPU8.subarray(data, data + dataSize); - queue.writeTexture(destination, subarray, dataLayout, writeSize); - }, - - // wgpuCommandEncoder - - wgpuCommandEncoderBeginComputePass: (encoderId, descriptor) => { - var desc; - - function makeComputePassTimestampWrites(twPtr) { - if (twPtr === 0) return undefined; - - return { - "querySet": WebGPU.mgrQuerySet.get( - {{{ makeGetValue('twPtr', C_STRUCTS.WGPUComputePassTimestampWrites.querySet, '*') }}}), - "beginningOfPassWriteIndex": {{{ gpu.makeGetU32('twPtr', C_STRUCTS.WGPUComputePassTimestampWrites.beginningOfPassWriteIndex) }}}, - "endOfPassWriteIndex": {{{ gpu.makeGetU32('twPtr', C_STRUCTS.WGPUComputePassTimestampWrites.endOfPassWriteIndex) }}}, - }; - } - - if (descriptor) { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - desc = { - "label": undefined, - "timestampWrites": makeComputePassTimestampWrites( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPUComputePassDescriptor.timestampWrites, '*') }}}), - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUComputePassDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - } - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - return WebGPU.mgrComputePassEncoder.create(commandEncoder.beginComputePass(desc)); - }, - - wgpuCommandEncoderBeginRenderPass: (encoderId, descriptor) => { - {{{ gpu.makeCheck('descriptor') }}} - - function makeColorAttachment(caPtr) { - var viewPtr = {{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.view) }}}; - if (viewPtr === 0) { - // view could be undefined. - return undefined; - } - - var depthSlice = {{{ makeGetValue('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.depthSlice, 'i32') }}}; - {{{ gpu.convertSentinelToUndefined('depthSlice') }}} - - var loadOpInt = {{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.loadOp) }}}; - #if ASSERTIONS - assert(loadOpInt !== {{{ gpu.LoadOp.Undefined }}}); - #endif - - var storeOpInt = {{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.storeOp) }}}; - #if ASSERTIONS - assert(storeOpInt !== {{{ gpu.StoreOp.Undefined }}}); - #endif - - var clearValue = WebGPU.makeColor(caPtr + {{{ C_STRUCTS.WGPURenderPassColorAttachment.clearValue }}}); - - return { - "view": WebGPU.mgrTextureView.get(viewPtr), - "depthSlice": depthSlice, - "resolveTarget": WebGPU.mgrTextureView.get( - {{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.resolveTarget) }}}), - "clearValue": clearValue, - "loadOp": WebGPU.LoadOp[loadOpInt], - "storeOp": WebGPU.StoreOp[storeOpInt], - }; - } - - function makeColorAttachments(count, caPtr) { - var attachments = []; - for (var i = 0; i < count; ++i) { - attachments.push(makeColorAttachment(caPtr + {{{ C_STRUCTS.WGPURenderPassColorAttachment.__size__ }}} * i)); - } - return attachments; - } - - function makeDepthStencilAttachment(dsaPtr) { - if (dsaPtr === 0) return undefined; - - return { - "view": WebGPU.mgrTextureView.get( - {{{ gpu.makeGetU32('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.view) }}}), - "depthClearValue": {{{ makeGetValue('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.depthClearValue, 'float') }}}, - "depthLoadOp": WebGPU.LoadOp[ - {{{ gpu.makeGetU32('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.depthLoadOp) }}}], - "depthStoreOp": WebGPU.StoreOp[ - {{{ gpu.makeGetU32('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.depthStoreOp) }}}], - "depthReadOnly": {{{ gpu.makeGetBool('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.depthReadOnly) }}}, - "stencilClearValue": {{{ gpu.makeGetU32('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.stencilClearValue) }}}, - "stencilLoadOp": WebGPU.LoadOp[ - {{{ gpu.makeGetU32('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.stencilLoadOp) }}}], - "stencilStoreOp": WebGPU.StoreOp[ - {{{ gpu.makeGetU32('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.stencilStoreOp) }}}], - "stencilReadOnly": {{{ gpu.makeGetBool('dsaPtr', C_STRUCTS.WGPURenderPassDepthStencilAttachment.stencilReadOnly) }}}, - }; - } - - function makeRenderPassTimestampWrites(twPtr) { - if (twPtr === 0) return undefined; - - return { - "querySet": WebGPU.mgrQuerySet.get( - {{{ makeGetValue('twPtr', C_STRUCTS.WGPURenderPassTimestampWrites.querySet, '*') }}}), - "beginningOfPassWriteIndex": {{{ gpu.makeGetU32('twPtr', C_STRUCTS.WGPURenderPassTimestampWrites.beginningOfPassWriteIndex) }}}, - "endOfPassWriteIndex": {{{ gpu.makeGetU32('twPtr', C_STRUCTS.WGPURenderPassTimestampWrites.endOfPassWriteIndex) }}}, - }; - } - - function makeRenderPassDescriptor(descriptor) { - {{{ gpu.makeCheck('descriptor') }}} - var nextInChainPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPassDescriptor.nextInChain, '*') }}}; - - var maxDrawCount = undefined; - if (nextInChainPtr !== 0) { - var sType = {{{ gpu.makeGetU32('nextInChainPtr', C_STRUCTS.WGPUChainedStruct.sType) }}}; -#if ASSERTIONS - assert(sType === {{{ gpu.SType.RenderPassDescriptorMaxDrawCount }}}); - assert(0 === {{{ makeGetValue('nextInChainPtr', C_STRUCTS.WGPUChainedStruct.next, '*') }}}); -#endif - var renderPassDescriptorMaxDrawCount = nextInChainPtr; - {{{ gpu.makeCheckDescriptor('renderPassDescriptorMaxDrawCount') }}} - maxDrawCount = {{{ gpu.makeGetU64('renderPassDescriptorMaxDrawCount', C_STRUCTS.WGPURenderPassDescriptorMaxDrawCount.maxDrawCount) }}}; - } - - var desc = { - "label": undefined, - "colorAttachments": makeColorAttachments( - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPURenderPassDescriptor.colorAttachmentCount) }}}, - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPassDescriptor.colorAttachments, '*') }}}), - "depthStencilAttachment": makeDepthStencilAttachment( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPassDescriptor.depthStencilAttachment, '*') }}}), - "occlusionQuerySet": WebGPU.mgrQuerySet.get( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPassDescriptor.occlusionQuerySet, '*') }}}), - "timestampWrites": makeRenderPassTimestampWrites( - {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPassDescriptor.timestampWrites, '*') }}}), - "maxDrawCount": maxDrawCount, - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderPassDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - - return desc; - } - - var desc = makeRenderPassDescriptor(descriptor); - - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - return WebGPU.mgrRenderPassEncoder.create(commandEncoder.beginRenderPass(desc)); - }, - - wgpuCommandEncoderClearBuffer: (encoderId, bufferId, offset, size) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - {{{ gpu.convertSentinelToUndefined('size') }}} - - var buffer = WebGPU.mgrBuffer.get(bufferId); - commandEncoder.clearBuffer(buffer, offset, size); - }, - - wgpuCommandEncoderCopyBufferToBuffer: (encoderId, srcId, srcOffset, dstId, dstOffset, size) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - var src = WebGPU.mgrBuffer.get(srcId); - var dst = WebGPU.mgrBuffer.get(dstId); - commandEncoder.copyBufferToBuffer(src, srcOffset, dst, dstOffset, size); - }, - - wgpuCommandEncoderCopyBufferToTexture: (encoderId, srcPtr, dstPtr, copySizePtr) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - var copySize = WebGPU.makeExtent3D(copySizePtr); - commandEncoder.copyBufferToTexture( - WebGPU.makeImageCopyBuffer(srcPtr), WebGPU.makeImageCopyTexture(dstPtr), copySize); - }, - - wgpuCommandEncoderCopyTextureToBuffer: (encoderId, srcPtr, dstPtr, copySizePtr) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - var copySize = WebGPU.makeExtent3D(copySizePtr); - commandEncoder.copyTextureToBuffer( - WebGPU.makeImageCopyTexture(srcPtr), WebGPU.makeImageCopyBuffer(dstPtr), copySize); - }, - - wgpuCommandEncoderCopyTextureToTexture: (encoderId, srcPtr, dstPtr, copySizePtr) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - var copySize = WebGPU.makeExtent3D(copySizePtr); - commandEncoder.copyTextureToTexture( - WebGPU.makeImageCopyTexture(srcPtr), WebGPU.makeImageCopyTexture(dstPtr), copySize); - }, - - wgpuCommandEncoderResolveQuerySet: (encoderId, querySetId, firstQuery, queryCount, - destinationId, destinationOffset) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - var querySet = WebGPU.mgrQuerySet.get(querySetId); - var destination = WebGPU.mgrBuffer.get(destinationId); - - commandEncoder.resolveQuerySet(querySet, firstQuery, queryCount, destination, destinationOffset); - }, - - wgpuCommandEncoderWriteTimestamp: (encoderId, querySetId, queryIndex) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - var querySet = WebGPU.mgrQuerySet.get(querySetId); - commandEncoder.writeTimestamp(querySet, queryIndex); - }, - - wgpuCommandEncoderPushDebugGroup: (encoderId, groupLabelPtr) => { - var encoder = WebGPU.mgrCommandEncoder.get(encoderId); - encoder.pushDebugGroup(UTF8ToString(groupLabelPtr)); - }, - wgpuCommandEncoderPopDebugGroup: (encoderId) => { - var encoder = WebGPU.mgrCommandEncoder.get(encoderId); - encoder.popDebugGroup(); - }, - wgpuCommandEncoderInsertDebugMarker: (encoderId, markerLabelPtr) => { - var encoder = WebGPU.mgrCommandEncoder.get(encoderId); - encoder.insertDebugMarker(UTF8ToString(markerLabelPtr)); - }, - - wgpuCommandEncoderFinish: (encoderId, descriptor) => { - // TODO: Use the descriptor. - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - return WebGPU.mgrCommandBuffer.create(commandEncoder.finish()); - }, - - wgpuCommandEncoderSetLabel: (encoderId, labelPtr) => { - var commandEncoder = WebGPU.mgrCommandEncoder.get(encoderId); - commandEncoder.label = UTF8ToString(labelPtr); - }, - - // wgpuCommandBuffer - - wgpuCommandBufferSetLabel: (commandBufferId, labelPtr) => { - var commandBuffer = WebGPU.mgrCommandBuffer.get(commandBufferId); - commandBuffer.label = UTF8ToString(labelPtr); - }, - - // wgpuPipelineLayout - - wgpuPipelineLayoutSetLabel: (pipelineLayoutId, labelPtr) => { - var pipelineLayout = WebGPU.mgrPipelineLayout.get(pipelineLayoutId); - pipelineLayout.label = UTF8ToString(labelPtr); - }, - - // wgpuShaderModule - - wgpuShaderModuleGetCompilationInfo__deps: ['$callUserCallback', '$stringToUTF8', '$lengthBytesUTF8', 'malloc', 'free'], - wgpuShaderModuleGetCompilationInfo: (shaderModuleId, callback, userdata) => { - var shaderModule = WebGPU.mgrShaderModule.get(shaderModuleId); - {{{ runtimeKeepalivePush() }}} - shaderModule.getCompilationInfo().then((compilationInfo) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var compilationMessagesPtr = _malloc({{{ C_STRUCTS.WGPUCompilationMessage.__size__ }}} * compilationInfo.messages.length); - var messageStringPtrs = []; // save these to free later - for (var i = 0; i < compilationInfo.messages.length; ++i) { - var compilationMessage = compilationInfo.messages[i]; - var compilationMessagePtr = compilationMessagesPtr + {{{ C_STRUCTS.WGPUCompilationMessage.__size__ }}} * i; - var messageSize = lengthBytesUTF8(compilationMessage.message) + 1; - var messagePtr = _malloc(messageSize); - messageStringPtrs.push(messagePtr); - stringToUTF8(compilationMessage.message, messagePtr, messageSize); - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.message, 'messagePtr', '*') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.type, 'WebGPU.Int_CompilationMessageType[compilationMessage.type]', 'i32') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.lineNum, 'compilationMessage.lineNum', 'i64') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.linePos, 'compilationMessage.linePos', 'i64') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.offset, 'compilationMessage.offset', 'i64') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.length, 'compilationMessage.length', 'i64') }}}; - // TODO: Convert JavaScript's UTF-16-code-unit offsets to UTF-8-code-unit offsets. - // https://github.com/webgpu-native/webgpu-headers/issues/246 - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.utf16LinePos, 'compilationMessage.linePos', 'i64') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.utf16Offset, 'compilationMessage.offset', 'i64') }}}; - {{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.utf16Length, 'compilationMessage.length', 'i64') }}}; - } - var compilationInfoPtr = _malloc({{{ C_STRUCTS.WGPUCompilationInfo.__size__ }}}); - {{{ makeSetValue('compilationInfoPtr', C_STRUCTS.WGPUCompilationInfo.messageCount, 'compilationInfo.messages.length', '*') }}} - {{{ makeSetValue('compilationInfoPtr', C_STRUCTS.WGPUCompilationInfo.messages, 'compilationMessagesPtr', '*') }}}; - - {{{ makeDynCall('vipp', 'callback') }}}({{{ gpu.CompilationInfoRequestStatus.Success }}}, compilationInfoPtr, userdata); - - messageStringPtrs.forEach((ptr) => { - _free(ptr); - }); - _free(compilationMessagesPtr); - _free(compilationInfoPtr); - }); - }); - }, - wgpuShaderModuleSetLabel: (shaderModuleId, labelPtr) => { - var shaderModule = WebGPU.mgrShaderModule.get(shaderModuleId); - shaderModule.label = UTF8ToString(labelPtr); - }, - - // wgpuComputePipeline - - wgpuComputePipelineGetBindGroupLayout: (pipelineId, groupIndex) => { - var pipeline = WebGPU.mgrComputePipeline.get(pipelineId); - return WebGPU.mgrBindGroupLayout.create(pipeline.getBindGroupLayout(groupIndex)); - }, - wgpuComputePipelineSetLabel: (pipelineId, labelPtr) => { - var pipeline = WebGPU.mgrComputePipeline.get(pipelineId); - pipeline.label = UTF8ToString(labelPtr); - }, - - // wgpuRenderPipeline - - wgpuRenderPipelineGetBindGroupLayout: (pipelineId, groupIndex) => { - var pipeline = WebGPU.mgrRenderPipeline.get(pipelineId); - return WebGPU.mgrBindGroupLayout.create(pipeline.getBindGroupLayout(groupIndex)); - }, - wgpuRenderPipelineSetLabel: (pipelineId, labelPtr) => { - var pipeline = WebGPU.mgrRenderPipeline.get(pipelineId); - pipeline.label = UTF8ToString(labelPtr); - }, - - // wgpuBindGroup - - wgpuBindGroupSetLabel: (bindGroupId, labelPtr) => { - var bindGroup = WebGPU.mgrBindGroup.get(bindGroupId); - bindGroup.label = UTF8ToString(labelPtr); - }, - - // wgpuBindGroupLayout - - wgpuBindGroupLayoutSetLabel: (bindGroupLayoutId, labelPtr) => { - var bindGroupLayout = WebGPU.mgrBindGroupLayout.get(bindGroupLayoutId); - bindGroupLayout.label = UTF8ToString(labelPtr); - }, - - // wgpuBuffer - - // In webgpu.h offset and size are passed in as size_t. - // And library_webgpu assumes that size_t is always 32bit in emscripten. - wgpuBufferGetConstMappedRange__deps: ['$warnOnce', 'memalign', 'free'], - wgpuBufferGetConstMappedRange: (bufferId, offset, size) => { - var bufferWrapper = WebGPU.mgrBuffer.objects[bufferId]; - {{{ gpu.makeCheckDefined('bufferWrapper') }}} - - if (size === 0) warnOnce('getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE'); - - {{{ gpu.convertSentinelToUndefined('size') }}} - - var mapped; - try { - mapped = bufferWrapper.object.getMappedRange(offset, size); - } catch (ex) { -#if ASSERTIONS - err(`wgpuBufferGetConstMappedRange(${offset}, ${size}) failed: ${ex}`); -#endif - // TODO(kainino0x): Somehow inject a validation error? - return 0; - } - var data = _memalign(16, mapped.byteLength); - HEAPU8.set(new Uint8Array(mapped), data); - bufferWrapper.onUnmap.push(() => _free(data)); - return data; - }, - - wgpuBufferGetMapState: (bufferId) => { - var buffer = WebGPU.mgrBuffer.get(bufferId); - return WebGPU.Int_BufferMapState[buffer.mapState]; - }, - - // In webgpu.h offset and size are passed in as size_t. - // And library_webgpu assumes that size_t is always 32bit in emscripten. - wgpuBufferGetMappedRange__deps: ['$warnOnce', '$zeroMemory', 'memalign', 'free'], - wgpuBufferGetMappedRange: (bufferId, offset, size) => { - var bufferWrapper = WebGPU.mgrBuffer.objects[bufferId]; - {{{ gpu.makeCheckDefined('bufferWrapper') }}} - - if (size === 0) warnOnce('getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE'); - - {{{ gpu.convertSentinelToUndefined('size') }}} - - if (bufferWrapper.mapMode !== {{{ gpu.MapMode.Write }}}) { -#if ASSERTIONS - abort("GetMappedRange called, but buffer not mapped for writing"); -#endif - // TODO(kainino0x): Somehow inject a validation error? - return 0; - } - - var mapped; - try { - mapped = bufferWrapper.object.getMappedRange(offset, size); - } catch (ex) { -#if ASSERTIONS - err(`wgpuBufferGetMappedRange(${offset}, ${size}) failed: ${ex}`); -#endif - // TODO(kainino0x): Somehow inject a validation error? - return 0; - } - - var data = _memalign(16, mapped.byteLength); - zeroMemory(data, mapped.byteLength); - bufferWrapper.onUnmap.push(() => { - new Uint8Array(mapped).set(HEAPU8.subarray(data, data + mapped.byteLength)); - _free(data); - }); - return data; - }, - - // In webgpu.h offset and size are passed in as size_t. - // And library_webgpu assumes that size_t is always 32bit in emscripten. - wgpuBufferMapAsync__deps: ['$callUserCallback'], - wgpuBufferMapAsync: (bufferId, mode, offset, size, callback, userdata) => { - var bufferWrapper = WebGPU.mgrBuffer.objects[bufferId]; - {{{ gpu.makeCheckDefined('bufferWrapper') }}} - bufferWrapper.mapMode = mode; - bufferWrapper.onUnmap = []; - var buffer = bufferWrapper.object; - - {{{ gpu.convertSentinelToUndefined('size') }}} - - // `callback` takes (WGPUBufferMapAsyncStatus status, void * userdata) - - {{{ runtimeKeepalivePush() }}} - buffer.mapAsync(mode, offset, size).then(() => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - {{{ makeDynCall('vip', 'callback') }}}({{{ gpu.BufferMapAsyncStatus.Success }}}, userdata); - }); - }, () => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - // TODO(kainino0x): Figure out how to pick other error status values. - {{{ makeDynCall('vip', 'callback') }}}({{{ gpu.BufferMapAsyncStatus.ValidationError }}}, userdata); - }); - }); - }, - - wgpuBufferGetSize: (bufferId) => { - var buffer = WebGPU.mgrBuffer.get(bufferId); - // 64-bit - return buffer.size; - }, - - wgpuBufferGetUsage: (bufferId) => { - var buffer = WebGPU.mgrBuffer.get(bufferId); - return buffer.usage; - }, - - wgpuBufferSetLabel: (bufferId, labelPtr) => { - var buffer = WebGPU.mgrBuffer.get(bufferId); - buffer.label = UTF8ToString(labelPtr); - }, - - wgpuBufferUnmap: (bufferId) => { - var bufferWrapper = WebGPU.mgrBuffer.objects[bufferId]; - {{{ gpu.makeCheckDefined('bufferWrapper') }}} - - if (!bufferWrapper.onUnmap) { - // Already unmapped - return; - } - - for (var f of bufferWrapper.onUnmap) { - f(); - } - bufferWrapper.onUnmap = undefined; - - bufferWrapper.object.unmap(); - }, - - // wgpuTexture - - wgpuTextureGetDepthOrArrayLayers: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return texture.depthOrArrayLayers; - }, - - wgpuTextureGetDimension: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return WebGPU.TextureDimension.indexOf(texture.dimension); - }, - - wgpuTextureGetFormat: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - // Should return the enum integer instead of string. - return WebGPU.TextureFormat.indexOf(texture.format); - }, - - wgpuTextureGetHeight: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return texture.height; - }, - - wgpuTextureGetMipLevelCount: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return texture.mipLevelCount; - }, - - wgpuTextureGetSampleCount: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return texture.sampleCount; - }, - - wgpuTextureGetUsage: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return texture.usage; - }, - - wgpuTextureGetWidth: (textureId) => { - var texture = WebGPU.mgrTexture.get(textureId); - return texture.width; - }, - - wgpuTextureSetLabel: (textureId, labelPtr) => { - var texture = WebGPU.mgrTexture.get(textureId); - texture.label = UTF8ToString(labelPtr); - }, - - wgpuTextureCreateView: (textureId, descriptor) => { - var desc; - if (descriptor) { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - var mipLevelCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.mipLevelCount) }}}; - var arrayLayerCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.arrayLayerCount) }}}; - desc = { - "format": WebGPU.TextureFormat[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.format) }}}], - "dimension": WebGPU.TextureViewDimension[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.dimension) }}}], - "baseMipLevel": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.baseMipLevel) }}}, - "mipLevelCount": mipLevelCount === {{{ gpu.MIP_LEVEL_COUNT_UNDEFINED }}} ? undefined : mipLevelCount, - "baseArrayLayer": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.baseArrayLayer) }}}, - "arrayLayerCount": arrayLayerCount === {{{ gpu.ARRAY_LAYER_COUNT_UNDEFINED }}} ? undefined : arrayLayerCount, - "aspect": WebGPU.TextureAspect[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.aspect) }}}], - }; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - } - - var texture = WebGPU.mgrTexture.get(textureId); - return WebGPU.mgrTextureView.create(texture.createView(desc)); - }, - - // wgpuTextureView - - wgpuTextureViewSetLabel: (textureViewId, labelPtr) => { - var textureView = WebGPU.mgrTextureView.get(textureViewId); - textureView.label = UTF8ToString(labelPtr); - }, - - // wgpuComputePass - - wgpuComputePassEncoderSetBindGroup: (passId, groupIndex, groupId, dynamicOffsetCount, dynamicOffsetsPtr) => { - var pass = WebGPU.mgrComputePassEncoder.get(passId); - var group = WebGPU.mgrBindGroup.get(groupId); - if (dynamicOffsetCount == 0) { - pass.setBindGroup(groupIndex, group); - } else { - var offsets = []; - for (var i = 0; i < dynamicOffsetCount; i++, dynamicOffsetsPtr += 4) { - offsets.push({{{ gpu.makeGetU32('dynamicOffsetsPtr', 0) }}}); - } - pass.setBindGroup(groupIndex, group, offsets); - } - }, - wgpuComputePassEncoderSetLabel: (passId, labelPtr) => { - var pass = WebGPU.mgrComputePassEncoder.get(passId); - pass.label = UTF8ToString(labelPtr); - }, - wgpuComputePassEncoderSetPipeline: (passId, pipelineId) => { - var pass = WebGPU.mgrComputePassEncoder.get(passId); - var pipeline = WebGPU.mgrComputePipeline.get(pipelineId); - pass.setPipeline(pipeline); - }, - - wgpuComputePassEncoderDispatchWorkgroups: (passId, x, y, z) => { - var pass = WebGPU.mgrComputePassEncoder.get(passId); - pass.dispatchWorkgroups(x, y, z); - }, - wgpuComputePassEncoderDispatchWorkgroupsIndirect: (passId, indirectBufferId, indirectOffset) => { - var indirectBuffer = WebGPU.mgrBuffer.get(indirectBufferId); - var pass = WebGPU.mgrComputePassEncoder.get(passId); - pass.dispatchWorkgroupsIndirect(indirectBuffer, indirectOffset); - }, - - wgpuComputePassEncoderWriteTimestamp: (encoderId, querySetId, queryIndex) => { - var pass = WebGPU.mgrComputePassEncoder.get(encoderId); - var querySet = WebGPU.mgrQuerySet.get(querySetId); - pass.writeTimestamp(querySet, queryIndex); - }, - - wgpuComputePassEncoderPushDebugGroup: (encoderId, groupLabelPtr) => { - var encoder = WebGPU.mgrComputePassEncoder.get(encoderId); - encoder.pushDebugGroup(UTF8ToString(groupLabelPtr)); - }, - wgpuComputePassEncoderPopDebugGroup: (encoderId) => { - var encoder = WebGPU.mgrComputePassEncoder.get(encoderId); - encoder.popDebugGroup(); - }, - wgpuComputePassEncoderInsertDebugMarker: (encoderId, markerLabelPtr) => { - var encoder = WebGPU.mgrComputePassEncoder.get(encoderId); - encoder.insertDebugMarker(UTF8ToString(markerLabelPtr)); - }, - - wgpuComputePassEncoderEnd: (passId) => { - var pass = WebGPU.mgrComputePassEncoder.get(passId); - pass.end(); - }, - - // wgpuRenderPass - - wgpuRenderPassEncoderSetLabel: (passId, labelPtr) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.label = UTF8ToString(labelPtr); - }, - - wgpuRenderPassEncoderSetBindGroup: (passId, groupIndex, groupId, dynamicOffsetCount, dynamicOffsetsPtr) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - var group = WebGPU.mgrBindGroup.get(groupId); - if (dynamicOffsetCount == 0) { - pass.setBindGroup(groupIndex, group); - } else { - var offsets = []; - for (var i = 0; i < dynamicOffsetCount; i++, dynamicOffsetsPtr += 4) { - offsets.push({{{ gpu.makeGetU32('dynamicOffsetsPtr', 0) }}}); - } - pass.setBindGroup(groupIndex, group, offsets); - } - }, - wgpuRenderPassEncoderSetBlendConstant: (passId, colorPtr) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - var color = WebGPU.makeColor(colorPtr); - pass.setBlendConstant(color); - }, - wgpuRenderPassEncoderSetIndexBuffer: (passId, bufferId, format, offset, size) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - var buffer = WebGPU.mgrBuffer.get(bufferId); - {{{ gpu.convertSentinelToUndefined('size') }}} - pass.setIndexBuffer(buffer, WebGPU.IndexFormat[format], offset, size); - }, - wgpuRenderPassEncoderSetPipeline: (passId, pipelineId) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - var pipeline = WebGPU.mgrRenderPipeline.get(pipelineId); - pass.setPipeline(pipeline); - }, - wgpuRenderPassEncoderSetScissorRect: (passId, x, y, w, h) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.setScissorRect(x, y, w, h); - }, - wgpuRenderPassEncoderSetViewport: (passId, x, y, w, h, minDepth, maxDepth) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.setViewport(x, y, w, h, minDepth, maxDepth); - }, - wgpuRenderPassEncoderSetStencilReference: (passId, reference) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.setStencilReference(reference); - }, - wgpuRenderPassEncoderSetVertexBuffer: (passId, slot, bufferId, offset, size) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - var buffer = WebGPU.mgrBuffer.get(bufferId); - {{{ gpu.convertSentinelToUndefined('size') }}} - pass.setVertexBuffer(slot, buffer, offset, size); - }, - - wgpuRenderPassEncoderDraw: (passId, vertexCount, instanceCount, firstVertex, firstInstance) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.draw(vertexCount, instanceCount, firstVertex, firstInstance); - }, - wgpuRenderPassEncoderDrawIndexed: (passId, indexCount, instanceCount, firstIndex, baseVertex, firstInstance) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.drawIndexed(indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - }, - wgpuRenderPassEncoderDrawIndirect: (passId, indirectBufferId, indirectOffset) => { - var indirectBuffer = WebGPU.mgrBuffer.get(indirectBufferId); - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.drawIndirect(indirectBuffer, indirectOffset); - }, - wgpuRenderPassEncoderDrawIndexedIndirect: (passId, indirectBufferId, indirectOffset) => { - var indirectBuffer = WebGPU.mgrBuffer.get(indirectBufferId); - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.drawIndexedIndirect(indirectBuffer, indirectOffset); - }, - - wgpuRenderPassEncoderExecuteBundles: (passId, count, bundlesPtr) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - -#if ASSERTIONS - assert(bundlesPtr % 4 === 0); -#endif - - var bundles = Array.from({{{ makeHEAPView(`${POINTER_BITS}`, 'bundlesPtr', `bundlesPtr + count * ${POINTER_SIZE}`) }}}, - (id) => WebGPU.mgrRenderBundle.get(id)); - pass.executeBundles(bundles); - }, - - wgpuRenderPassEncoderBeginOcclusionQuery: (passId, queryIndex) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.beginOcclusionQuery(queryIndex); - }, - wgpuRenderPassEncoderEndOcclusionQuery: (passId) => { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass.endOcclusionQuery(); - }, - - wgpuRenderPassEncoderWriteTimestamp: (encoderId, querySetId, queryIndex) => { - var pass = WebGPU.mgrRenderPassEncoder.get(encoderId); - var querySet = WebGPU.mgrQuerySet.get(querySetId); - pass.writeTimestamp(querySet, queryIndex); - }, - - wgpuRenderPassEncoderPushDebugGroup: (encoderId, groupLabelPtr) => { - var encoder = WebGPU.mgrRenderPassEncoder.get(encoderId); - encoder.pushDebugGroup(UTF8ToString(groupLabelPtr)); - }, - wgpuRenderPassEncoderPopDebugGroup: (encoderId) => { - var encoder = WebGPU.mgrRenderPassEncoder.get(encoderId); - encoder.popDebugGroup(); - }, - wgpuRenderPassEncoderInsertDebugMarker: (encoderId, markerLabelPtr) => { - var encoder = WebGPU.mgrRenderPassEncoder.get(encoderId); - encoder.insertDebugMarker(UTF8ToString(markerLabelPtr)); - }, - wgpuRenderPassEncoderEnd: (encoderId) => { - var encoder = WebGPU.mgrRenderPassEncoder.get(encoderId); - encoder.end(); - }, - - // Render bundle - - wgpuRenderBundleSetLabel: (bundleId, labelPtr) => { - var bundle = WebGPU.mgrRenderBundle.get(bundleId); - bundle.label = UTF8ToString(labelPtr); - }, - - // Render bundle encoder - - wgpuRenderBundleEncoderSetLabel: (bundleId, labelPtr) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - pass.label = UTF8ToString(labelPtr); - }, - - wgpuRenderBundleEncoderSetBindGroup: (bundleId, groupIndex, groupId, dynamicOffsetCount, dynamicOffsetsPtr) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - var group = WebGPU.mgrBindGroup.get(groupId); - if (dynamicOffsetCount == 0) { - pass.setBindGroup(groupIndex, group); - } else { - var offsets = []; - for (var i = 0; i < dynamicOffsetCount; i++, dynamicOffsetsPtr += 4) { - offsets.push({{{ gpu.makeGetU32('dynamicOffsetsPtr', 0) }}}); - } - pass.setBindGroup(groupIndex, group, offsets); - } - }, - wgpuRenderBundleEncoderSetIndexBuffer: (bundleId, bufferId, format, offset, size) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - var buffer = WebGPU.mgrBuffer.get(bufferId); - {{{ gpu.convertSentinelToUndefined('size') }}} - pass.setIndexBuffer(buffer, WebGPU.IndexFormat[format], offset, size); - }, - wgpuRenderBundleEncoderSetPipeline: (bundleId, pipelineId) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - var pipeline = WebGPU.mgrRenderPipeline.get(pipelineId); - pass.setPipeline(pipeline); - }, - wgpuRenderBundleEncoderSetVertexBuffer: (bundleId, slot, bufferId, offset, size) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - var buffer = WebGPU.mgrBuffer.get(bufferId); - {{{ gpu.convertSentinelToUndefined('size') }}} - pass.setVertexBuffer(slot, buffer, offset, size); - }, - - wgpuRenderBundleEncoderDraw: (bundleId, vertexCount, instanceCount, firstVertex, firstInstance) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - pass.draw(vertexCount, instanceCount, firstVertex, firstInstance); - }, - wgpuRenderBundleEncoderDrawIndexed: (bundleId, indexCount, instanceCount, firstIndex, baseVertex, firstInstance) => { - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - pass.drawIndexed(indexCount, instanceCount, firstIndex, baseVertex, firstInstance); - }, - wgpuRenderBundleEncoderDrawIndirect: (bundleId, indirectBufferId, indirectOffset) => { - var indirectBuffer = WebGPU.mgrBuffer.get(indirectBufferId); - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - pass.drawIndirect(indirectBuffer, indirectOffset); - }, - wgpuRenderBundleEncoderDrawIndexedIndirect: (bundleId, indirectBufferId, indirectOffset) => { - var indirectBuffer = WebGPU.mgrBuffer.get(indirectBufferId); - var pass = WebGPU.mgrRenderBundleEncoder.get(bundleId); - pass.drawIndexedIndirect(indirectBuffer, indirectOffset); - }, - - wgpuRenderBundleEncoderPushDebugGroup: (encoderId, groupLabelPtr) => { - var encoder = WebGPU.mgrRenderBundleEncoder.get(encoderId); - encoder.pushDebugGroup(UTF8ToString(groupLabelPtr)); - }, - wgpuRenderBundleEncoderPopDebugGroup: (encoderId) => { - var encoder = WebGPU.mgrRenderBundleEncoder.get(encoderId); - encoder.popDebugGroup(); - }, - wgpuRenderBundleEncoderInsertDebugMarker: (encoderId, markerLabelPtr) => { - var encoder = WebGPU.mgrRenderBundleEncoder.get(encoderId); - encoder.insertDebugMarker(UTF8ToString(markerLabelPtr)); - }, - - wgpuRenderBundleEncoderFinish: (bundleId, descriptor) => { - var desc; - if (descriptor) { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - desc = {}; - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPURenderBundleDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - } - var encoder = WebGPU.mgrRenderBundleEncoder.get(bundleId); - return WebGPU.mgrRenderBundle.create(encoder.finish(desc)); - }, - - // Instance - - wgpuInstanceCreateSurface__deps: ['$findCanvasEventTarget'], - wgpuInstanceCreateSurface: (instanceId, descriptor) => { - {{{ gpu.makeCheck('descriptor') }}} - {{{ gpu.makeCheck('instanceId === 1, "WGPUInstance must be created by wgpuCreateInstance"') }}} - var nextInChainPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUSurfaceDescriptor.nextInChain, '*') }}}; -#if ASSERTIONS - assert(nextInChainPtr !== 0); - assert({{{ gpu.SType.SurfaceDescriptorFromCanvasHTMLSelector }}} === - {{{ gpu.makeGetU32('nextInChainPtr', C_STRUCTS.WGPUChainedStruct.sType) }}}); -#endif - var descriptorFromCanvasHTMLSelector = nextInChainPtr; - - {{{ gpu.makeCheckDescriptor('descriptorFromCanvasHTMLSelector') }}} - var selectorPtr = {{{ makeGetValue('descriptorFromCanvasHTMLSelector', C_STRUCTS.WGPUSurfaceDescriptorFromCanvasHTMLSelector.selector, '*') }}}; - {{{ gpu.makeCheck('selectorPtr') }}} - var canvas = findCanvasEventTarget(selectorPtr); -#if OFFSCREENCANVAS_SUPPORT - if (canvas.offscreenCanvas) canvas = canvas.offscreenCanvas; -#endif - var context = canvas.getContext('webgpu'); -#if ASSERTIONS - assert(context); -#endif - if (!context) return 0; - - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUSurfaceDescriptor.label, '*') }}}; - if (labelPtr) context.surfaceLabelWebGPU = UTF8ToString(labelPtr); - - return WebGPU.mgrSurface.create(context); - }, - - wgpuInstanceHasWGSLLanguageFeature: (instance, featureEnumValue) => { - if (!('wgslLanguageFeatures' in navigator["gpu"])) { - return false; - } - return navigator["gpu"]["wgslLanguageFeatures"].has(WebGPU.WGSLFeatureName[featureEnumValue]); - }, - - wgpuInstanceProcessEvents: (instance) => { - // TODO: This could probably be emulated with ASYNCIFY. -#if ASSERTIONS - abort('wgpuInstanceProcessEvents is unsupported (use requestAnimationFrame via html5.h instead)'); -#endif - }, - - wgpuInstanceRequestAdapter__deps: ['$callUserCallback', '$stringToUTF8OnStack'], - wgpuInstanceRequestAdapter: (instanceId, options, callback, userdata) => { - {{{ gpu.makeCheck('instanceId === 1, "WGPUInstance must be created by wgpuCreateInstance"') }}} - - var opts; - if (options) { - {{{ gpu.makeCheckDescriptor('options') }}} - opts = { - "powerPreference": WebGPU.PowerPreference[ - {{{ gpu.makeGetU32('options', C_STRUCTS.WGPURequestAdapterOptions.powerPreference) }}}], - "forceFallbackAdapter": - {{{ gpu.makeGetBool('options', C_STRUCTS.WGPURequestAdapterOptions.forceFallbackAdapter) }}}, - }; - } - - if (!('gpu' in navigator)) { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack('WebGPU not available on this browser (navigator.gpu is not available)'); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestAdapterStatus.Unavailable }}}, 0, messagePtr, userdata); - stackRestore(sp); - return; - } - - {{{ runtimeKeepalivePush() }}} - navigator["gpu"]["requestAdapter"](opts).then((adapter) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - if (adapter) { - var adapterId = WebGPU.mgrAdapter.create(adapter); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestAdapterStatus.Success }}}, adapterId, 0, userdata); - } else { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack('WebGPU not available on this system (requestAdapter returned null)'); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestAdapterStatus.Unavailable }}}, 0, messagePtr, userdata); - stackRestore(sp); - } - }); - }, (ex) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack(ex.message); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestAdapterStatus.Error }}}, 0, messagePtr, userdata); - stackRestore(sp); - }); - }); - }, - - // WGPUAdapter - - wgpuAdapterEnumerateFeatures: (adapterId, featuresOutPtr) => { - var offset = 0; - var numFeatures = 0; - var adapter = WebGPU.mgrAdapter.get(adapterId); - adapter.features.forEach(feature => { - var featureEnumValue = WebGPU.FeatureNameString2Enum[feature]; - if (featureEnumValue !== undefined) { - if (featuresOutPtr !== 0) { - {{{ makeSetValue('featuresOutPtr', 'offset', 'featureEnumValue', 'i32') }}}; - offset += 4; - } - numFeatures++; - } - }); - return numFeatures; - }, - - wgpuAdapterGetInfo__deps: ['$stringToNewUTF8'], - wgpuAdapterGetInfo: (adapterId, info) => { - var adapter = WebGPU.mgrAdapter.get(adapterId); - {{{ gpu.makeCheckDescriptor('info') }}} - - var vendorPtr = stringToNewUTF8(adapter.info.vendor); - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.vendor, 'vendorPtr', '*') }}}; - var architecturePtr = stringToNewUTF8(adapter.info.architecture); - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.architecture, 'architecturePtr', '*') }}}; - var devicePtr = stringToNewUTF8(adapter.info.device); - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.device, 'devicePtr', '*') }}}; - var descriptionPtr = stringToNewUTF8(adapter.info.description); - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.description, 'descriptionPtr', '*') }}}; - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.backendType, gpu.BackendType.WebGPU, 'i32') }}}; - var adapterType = adapter.isFallbackAdapter ? {{{ gpu.AdapterType.CPU }}} : {{{ gpu.AdapterType.Unknown }}}; - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.adapterType, 'adapterType', 'i32') }}}; - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.vendorID, '0', 'i32') }}}; - {{{ makeSetValue('info', C_STRUCTS.WGPUAdapterInfo.deviceID, '0', 'i32') }}}; - }, - - wgpuAdapterGetProperties__deps: ['$warnOnce'], - wgpuAdapterGetProperties: (adapterId, properties) => { - warnOnce('wgpuAdapterGetProperties is deprecated, use wgpuAdapterGetInfo instead'); - - {{{ gpu.makeCheckDescriptor('properties') }}} - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.vendorID, '0', 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.vendorName, '0', 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.architecture, '0', 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.deviceID, '0', 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.name, '0', 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.driverDescription, '0', 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.adapterType, gpu.AdapterType.Unknown, 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.backendType, gpu.BackendType.WebGPU, 'i32') }}}; - {{{ makeSetValue('properties', C_STRUCTS.WGPUAdapterProperties.compatibilityMode, '0', 'i32') }}}; - }, - - wgpuAdapterGetLimits: (adapterId, limitsOutPtr) => { - var adapter = WebGPU.mgrAdapter.get(adapterId); - WebGPU.fillLimitStruct(adapter.limits, limitsOutPtr); - return 1; - }, - - wgpuAdapterHasFeature: (adapterId, featureEnumValue) => { - var adapter = WebGPU.mgrAdapter.get(adapterId); - return adapter.features.has(WebGPU.FeatureName[featureEnumValue]); - }, - - wgpuAdapterRequestDevice__deps: ['$callUserCallback', '$stringToUTF8OnStack'], - wgpuAdapterRequestDevice: (adapterId, descriptor, callback, userdata) => { - var adapter = WebGPU.mgrAdapter.get(adapterId); - - var desc = {}; - if (descriptor) { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - var requiredFeatureCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUDeviceDescriptor.requiredFeatureCount) }}}; - if (requiredFeatureCount) { - var requiredFeaturesPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUDeviceDescriptor.requiredFeatures, '*') }}}; - // requiredFeaturesPtr is a pointer to an array of FeatureName which is an enum of size uint32_t - desc["requiredFeatures"] = Array.from({{{ makeHEAPView('U32', 'requiredFeaturesPtr', `requiredFeaturesPtr + requiredFeatureCount * 4`) }}}, - (feature) => WebGPU.FeatureName[feature]); - } - var requiredLimitsPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUDeviceDescriptor.requiredLimits, '*') }}}; - if (requiredLimitsPtr) { - {{{ gpu.makeCheckDescriptor('requiredLimitsPtr') }}} - var limitsPtr = requiredLimitsPtr + {{{ C_STRUCTS.WGPURequiredLimits.limits }}}; - var requiredLimits = {}; - function setLimitU32IfDefined(name, limitOffset) { - var ptr = limitsPtr + limitOffset; - var value = {{{ gpu.makeGetU32('ptr', 0) }}}; - if (value != {{{ gpu.LIMIT_U32_UNDEFINED }}}) { - requiredLimits[name] = value; - } - } - function setLimitU64IfDefined(name, limitOffset) { - var ptr = limitsPtr + limitOffset; - // Handle WGPU_LIMIT_U64_UNDEFINED. - var limitPart1 = {{{ gpu.makeGetU32('ptr', 0) }}}; - var limitPart2 = {{{ gpu.makeGetU32('ptr', 4) }}}; - if (limitPart1 != 0xFFFFFFFF || limitPart2 != 0xFFFFFFFF) { - requiredLimits[name] = {{{ gpu.makeGetU64('ptr', 0) }}} - } - } - - setLimitU32IfDefined("maxTextureDimension1D", {{{ C_STRUCTS.WGPULimits.maxTextureDimension1D }}}); - setLimitU32IfDefined("maxTextureDimension2D", {{{ C_STRUCTS.WGPULimits.maxTextureDimension2D }}}); - setLimitU32IfDefined("maxTextureDimension3D", {{{ C_STRUCTS.WGPULimits.maxTextureDimension3D }}}); - setLimitU32IfDefined("maxTextureArrayLayers", {{{ C_STRUCTS.WGPULimits.maxTextureArrayLayers }}}); - setLimitU32IfDefined("maxBindGroups", {{{ C_STRUCTS.WGPULimits.maxBindGroups }}}); - setLimitU32IfDefined('maxBindGroupsPlusVertexBuffers', {{{ C_STRUCTS.WGPULimits.maxBindGroupsPlusVertexBuffers }}}); - setLimitU32IfDefined("maxDynamicUniformBuffersPerPipelineLayout", {{{ C_STRUCTS.WGPULimits.maxDynamicUniformBuffersPerPipelineLayout }}}); - setLimitU32IfDefined("maxDynamicStorageBuffersPerPipelineLayout", {{{ C_STRUCTS.WGPULimits.maxDynamicStorageBuffersPerPipelineLayout }}}); - setLimitU32IfDefined("maxSampledTexturesPerShaderStage", {{{ C_STRUCTS.WGPULimits.maxSampledTexturesPerShaderStage }}}); - setLimitU32IfDefined("maxSamplersPerShaderStage", {{{ C_STRUCTS.WGPULimits.maxSamplersPerShaderStage }}}); - setLimitU32IfDefined("maxStorageBuffersPerShaderStage", {{{ C_STRUCTS.WGPULimits.maxStorageBuffersPerShaderStage }}}); - setLimitU32IfDefined("maxStorageTexturesPerShaderStage", {{{ C_STRUCTS.WGPULimits.maxStorageTexturesPerShaderStage }}}); - setLimitU32IfDefined("maxUniformBuffersPerShaderStage", {{{ C_STRUCTS.WGPULimits.maxUniformBuffersPerShaderStage }}}); - setLimitU32IfDefined("minUniformBufferOffsetAlignment", {{{ C_STRUCTS.WGPULimits.minUniformBufferOffsetAlignment }}}); - setLimitU32IfDefined("minStorageBufferOffsetAlignment", {{{ C_STRUCTS.WGPULimits.minStorageBufferOffsetAlignment }}}); - setLimitU64IfDefined("maxUniformBufferBindingSize", {{{ C_STRUCTS.WGPULimits.maxUniformBufferBindingSize }}}); - setLimitU64IfDefined("maxStorageBufferBindingSize", {{{ C_STRUCTS.WGPULimits.maxStorageBufferBindingSize }}}); - setLimitU32IfDefined("maxVertexBuffers", {{{ C_STRUCTS.WGPULimits.maxVertexBuffers }}}); - setLimitU64IfDefined("maxBufferSize", {{{ C_STRUCTS.WGPULimits.maxBufferSize }}}); - setLimitU32IfDefined("maxVertexAttributes", {{{ C_STRUCTS.WGPULimits.maxVertexAttributes }}}); - setLimitU32IfDefined("maxVertexBufferArrayStride", {{{ C_STRUCTS.WGPULimits.maxVertexBufferArrayStride }}}); - setLimitU32IfDefined("maxInterStageShaderComponents", {{{ C_STRUCTS.WGPULimits.maxInterStageShaderComponents }}}); - setLimitU32IfDefined("maxInterStageShaderVariables", {{{ C_STRUCTS.WGPULimits.maxInterStageShaderVariables }}}); - setLimitU32IfDefined("maxColorAttachments", {{{ C_STRUCTS.WGPULimits.maxColorAttachments }}}); - setLimitU32IfDefined("maxColorAttachmentBytesPerSample", {{{ C_STRUCTS.WGPULimits.maxColorAttachmentBytesPerSample }}}); - setLimitU32IfDefined("maxComputeWorkgroupStorageSize", {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupStorageSize }}}); - setLimitU32IfDefined("maxComputeInvocationsPerWorkgroup", {{{ C_STRUCTS.WGPULimits.maxComputeInvocationsPerWorkgroup }}}); - setLimitU32IfDefined("maxComputeWorkgroupSizeX", {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupSizeX }}}); - setLimitU32IfDefined("maxComputeWorkgroupSizeY", {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupSizeY }}}); - setLimitU32IfDefined("maxComputeWorkgroupSizeZ", {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupSizeZ }}}); - setLimitU32IfDefined("maxComputeWorkgroupsPerDimension", {{{ C_STRUCTS.WGPULimits.maxComputeWorkgroupsPerDimension }}}); - desc["requiredLimits"] = requiredLimits; - } - - var defaultQueuePtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUDeviceDescriptor.defaultQueue, '*') }}}; - if (defaultQueuePtr) { - var defaultQueueDesc = {}; - var labelPtr = {{{ makeGetValue('defaultQueuePtr', C_STRUCTS.WGPUQueueDescriptor.label, '*') }}}; - if (labelPtr) defaultQueueDesc["label"] = UTF8ToString(labelPtr); - desc["defaultQueue"] = defaultQueueDesc; - } - - var deviceLostCallbackPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUDeviceDescriptor.deviceLostCallback, '*') }}}; - var deviceLostUserdataPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUDeviceDescriptor.deviceLostUserdata, '*') }}}; - - var labelPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUDeviceDescriptor.label, '*') }}}; - if (labelPtr) desc["label"] = UTF8ToString(labelPtr); - } - - {{{ runtimeKeepalivePush() }}} - adapter.requestDevice(desc).then((device) => { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var deviceWrapper = { queueId: WebGPU.mgrQueue.create(device.queue) }; - var deviceId = WebGPU.mgrDevice.create(device, deviceWrapper); - if (deviceLostCallbackPtr) { - device.lost.then((info) => { - callUserCallback(() => WebGPU.errorCallback(deviceLostCallbackPtr, - WebGPU.Int_DeviceLostReason[info.reason], info.message, deviceLostUserdataPtr)); - }); - } - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestDeviceStatus.Success }}}, deviceId, 0, userdata); - }); - }, function(ex) { - {{{ runtimeKeepalivePop() }}} - callUserCallback(() => { - var sp = stackSave(); - var messagePtr = stringToUTF8OnStack(ex.message); - {{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestDeviceStatus.Error }}}, 0, messagePtr, userdata); - stackRestore(sp); - }); - }); - }, - - // WGPUAdapterProperties - - wgpuAdapterPropertiesFreeMembers: (value) => { - // wgpuAdapterGetProperties doesn't currently allocate anything. - }, - - // WGPUSampler - - wgpuSamplerSetLabel: (samplerId, labelPtr) => { - var sampler = WebGPU.mgrSampler.get(samplerId); - sampler.label = UTF8ToString(labelPtr); - }, - - // WGPUSurface - - wgpuSurfaceConfigure: (surfaceId, config) => { - {{{ gpu.makeCheckDescriptor('config') }}} - var deviceId = {{{ makeGetValue('config', C_STRUCTS.WGPUSurfaceConfiguration.device, '*') }}}; - var context = WebGPU.mgrSurface.get(surfaceId); - -#if ASSERTIONS - assert({{{ gpu.PresentMode.Fifo }}} === - {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.presentMode) }}}); -#endif - - var canvasSize = [ - {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.width) }}}, - {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.height) }}} - ]; - - if (canvasSize[0] !== 0) { - context["canvas"]["width"] = canvasSize[0]; - } - - if (canvasSize[1] !== 0) { - context["canvas"]["height"] = canvasSize[1]; - } - - var configuration = { - "device": WebGPU.mgrDevice.get(deviceId), - "format": WebGPU.TextureFormat[ - {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.format) }}}], - "usage": {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.usage) }}}, - "alphaMode": WebGPU.AlphaMode[ - {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.alphaMode) }}}], - }; - - var viewFormatCount = {{{ gpu.makeGetU32('config', C_STRUCTS.WGPUSurfaceConfiguration.viewFormatCount) }}}; - - if (viewFormatCount) { - var viewFormats = {{{ makeGetValue('config', C_STRUCTS.WGPUSurfaceConfiguration.viewFormats, '*') }}}; - // viewFormats pointer to an array of TextureFormat which is an enum of size uint32_t - configuration['viewFormats'] = Array.from({{{ makeHEAPView('32', 'viewFormats', 'viewFormats + viewFormatCount * 4') }}}, - format => WebGPU.TextureFormat[format]); - } - - context.configure(configuration); - }, - - wgpuSurfaceGetCurrentTexture: (surfaceId, surfaceTexturePtr) => { - {{{ gpu.makeCheck('surfaceTexturePtr') }}} - var context = WebGPU.mgrSurface.get(surfaceId); - - try { - var texture = WebGPU.mgrTexture.create(context.getCurrentTexture()); - {{{ makeSetValue('surfaceTexturePtr', C_STRUCTS.WGPUSurfaceTexture.texture, 'texture', '*') }}}; - {{{ makeSetValue('surfaceTexturePtr', C_STRUCTS.WGPUSurfaceTexture.suboptimal, '0', 'i32') }}}; - {{{ makeSetValue('surfaceTexturePtr', C_STRUCTS.WGPUSurfaceTexture.status, - gpu.SurfaceGetCurrentTextureStatus.Success, 'i32') }}}; - } catch (ex) { -#if ASSERTIONS - err(`wgpuSurfaceGetCurrentTexture() failed: ${ex}`); -#endif - {{{ makeSetValue('surfaceTexturePtr', C_STRUCTS.WGPUSurfaceTexture.texture, '0', '*') }}}; - {{{ makeSetValue('surfaceTexturePtr', C_STRUCTS.WGPUSurfaceTexture.suboptimal, '0', 'i32') }}}; - // TODO(https://github.com/webgpu-native/webgpu-headers/issues/291): What should the status be here? - {{{ makeSetValue('surfaceTexturePtr', C_STRUCTS.WGPUSurfaceTexture.status, - gpu.SurfaceGetCurrentTextureStatus.DeviceLost, 'i32') }}}; - } - }, - - wgpuSurfaceGetPreferredFormat: (surfaceId, adapterId) => { - var format = navigator["gpu"]["getPreferredCanvasFormat"](); - return WebGPU.Int_PreferredFormat[format]; - }, - - wgpuSurfacePresent: (surfaceId) => { - // TODO: This could probably be emulated with ASYNCIFY. - abort('wgpuSurfacePresent is unsupported (use requestAnimationFrame via html5.h instead)'); - }, - - wgpuSurfaceUnconfigure: (surfaceId) => { - var context = WebGPU.mgrSurface.get(surfaceId); - context.unconfigure(); - }, - - // WGPUSwapChain - - wgpuDeviceCreateSwapChain: (deviceId, surfaceId, descriptor) => { - {{{ gpu.makeCheckDescriptor('descriptor') }}} - var device = WebGPU.mgrDevice.get(deviceId); - var context = WebGPU.mgrSurface.get(surfaceId); - -#if ASSERTIONS - assert({{{ gpu.PresentMode.Fifo }}} === - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.presentMode) }}}); -#endif - - var canvasSize = [ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.width) }}}, - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.height) }}} - ]; - - if (canvasSize[0] !== 0) { - context["canvas"]["width"] = canvasSize[0]; - } - - if (canvasSize[1] !== 0) { - context["canvas"]["height"] = canvasSize[1]; - } - - var configuration = { - "device": device, - "format": WebGPU.TextureFormat[ - {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.format) }}}], - "usage": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.usage) }}}, - "alphaMode": "opaque", - }; - context.configure(configuration); - - return WebGPU.mgrSwapChain.create(context); - }, - - wgpuSwapChainGetCurrentTexture: (swapChainId) => { - var context = WebGPU.mgrSwapChain.get(swapChainId); - return WebGPU.mgrTexture.create(context.getCurrentTexture()); - }, - wgpuSwapChainGetCurrentTextureView: (swapChainId) => { - var context = WebGPU.mgrSwapChain.get(swapChainId); - return WebGPU.mgrTextureView.create(context.getCurrentTexture().createView()); - }, - wgpuSwapChainPresent: (swapChainId) => { - // TODO: This could probably be emulated with ASYNCIFY. - abort('wgpuSwapChainPresent is unsupported (use requestAnimationFrame via html5.h instead)'); - }, -}; - -// Inverted index used by EnumerateFeatures/HasFeature -LibraryWebGPU.$WebGPU.FeatureNameString2Enum = {}; -for (var value in LibraryWebGPU.$WebGPU.FeatureName) { - LibraryWebGPU.$WebGPU.FeatureNameString2Enum[LibraryWebGPU.$WebGPU.FeatureName[value]] = value; -} - -for (const key of Object.keys(LibraryWebGPU)) { - if (typeof LibraryWebGPU[key] === 'function') { - const sig = LibraryManager.library[key + '__sig']; - if (sig?.includes('j')) { - LibraryManager.library[key + '__i53abi'] = true; - } - } -} - -autoAddDeps(LibraryWebGPU, '$WebGPU'); -addToLibrary(LibraryWebGPU); diff --git a/src/modules.mjs b/src/modules.mjs index ba09df7ddb7da..2afa10b963979 100644 --- a/src/modules.mjs +++ b/src/modules.mjs @@ -183,11 +183,6 @@ function calculateLibraries() { libraries.push('libglemu.js'); } - if (USE_WEBGPU) { - libraries.push('libwebgpu.js'); - libraries.push('libhtml5_webgpu.js'); - } - if (!STRICT) { libraries.push('liblegacy.js'); } diff --git a/src/settings.js b/src/settings.js index 8932d170240d8..87909d08a7857 100644 --- a/src/settings.js +++ b/src/settings.js @@ -581,10 +581,9 @@ var GL_FFP_ONLY = false; // [link] var GL_PREINITIALIZED_CONTEXT = false; -// Enables the built-in implementation of ````. -// Deprecated: Please try migrating to ``--use-port=emdawnwebgpu``, +// This option has been removed in favor of ``--use-port=emdawnwebgpu``, // which implements a newer, incompatible version of webgpu.h (see -// tools/ports/emdawnwebgpu.py for more info). +// ``tools/ports/emdawnwebgpu.py`` for more info). // [link] // [deprecated] var USE_WEBGPU = false; diff --git a/src/struct_info_generated.json b/src/struct_info_generated.json index d19c5424c9107..dfaa02c13a096 100644 --- a/src/struct_info_generated.json +++ b/src/struct_info_generated.json @@ -892,604 +892,6 @@ "minor": 1, "patch": 2 }, - "WGPUAdapterInfo": { - "__size__": 36, - "adapterType": 24, - "architecture": 8, - "backendType": 20, - "description": 16, - "device": 12, - "deviceID": 32, - "nextInChain": 0, - "vendor": 4, - "vendorID": 28 - }, - "WGPUAdapterProperties": { - "__size__": 40, - "adapterType": 28, - "architecture": 12, - "backendType": 32, - "compatibilityMode": 36, - "deviceID": 16, - "driverDescription": 24, - "name": 20, - "nextInChain": 0, - "vendorID": 4, - "vendorName": 8 - }, - "WGPUBindGroupDescriptor": { - "__size__": 20, - "entries": 16, - "entryCount": 12, - "label": 4, - "layout": 8, - "nextInChain": 0 - }, - "WGPUBindGroupEntry": { - "__size__": 40, - "binding": 4, - "buffer": 8, - "nextInChain": 0, - "offset": 16, - "sampler": 32, - "size": 24, - "textureView": 36 - }, - "WGPUBindGroupLayoutDescriptor": { - "__size__": 16, - "entries": 12, - "entryCount": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPUBindGroupLayoutEntry": { - "__size__": 80, - "binding": 4, - "buffer": 16, - "nextInChain": 0, - "sampler": 40, - "storageTexture": 64, - "texture": 48, - "visibility": 8 - }, - "WGPUBlendComponent": { - "__size__": 12, - "dstFactor": 8, - "operation": 0, - "srcFactor": 4 - }, - "WGPUBlendState": { - "__size__": 24, - "alpha": 12, - "color": 0 - }, - "WGPUBufferBindingLayout": { - "__size__": 24, - "hasDynamicOffset": 8, - "minBindingSize": 16, - "nextInChain": 0, - "type": 4 - }, - "WGPUBufferDescriptor": { - "__size__": 32, - "label": 4, - "mappedAtCreation": 24, - "nextInChain": 0, - "size": 16, - "usage": 8 - }, - "WGPUBufferMapCallbackInfo": { - "__size__": 16, - "callback": 8, - "mode": 4, - "nextInChain": 0, - "userdata": 12 - }, - "WGPUChainedStruct": { - "__size__": 8, - "next": 0, - "sType": 4 - }, - "WGPUColor": { - "__size__": 32, - "a": 24, - "b": 16, - "g": 8, - "r": 0 - }, - "WGPUColorTargetState": { - "__size__": 16, - "blend": 8, - "format": 4, - "nextInChain": 0, - "writeMask": 12 - }, - "WGPUCommandBufferDescriptor": { - "__size__": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPUCommandEncoderDescriptor": { - "__size__": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPUCompilationInfo": { - "__size__": 12, - "messageCount": 4, - "messages": 8, - "nextInChain": 0 - }, - "WGPUCompilationMessage": { - "__size__": 72, - "length": 40, - "lineNum": 16, - "linePos": 24, - "message": 4, - "nextInChain": 0, - "offset": 32, - "type": 8, - "utf16Length": 64, - "utf16LinePos": 48, - "utf16Offset": 56 - }, - "WGPUComputePassDescriptor": { - "__size__": 12, - "label": 4, - "nextInChain": 0, - "timestampWrites": 8 - }, - "WGPUComputePassTimestampWrites": { - "__size__": 12, - "beginningOfPassWriteIndex": 4, - "endOfPassWriteIndex": 8, - "querySet": 0 - }, - "WGPUComputePipelineDescriptor": { - "__size__": 32, - "compute": 12, - "label": 4, - "layout": 8, - "nextInChain": 0 - }, - "WGPUConstantEntry": { - "__size__": 16, - "key": 4, - "nextInChain": 0, - "value": 8 - }, - "WGPUDepthStencilState": { - "__size__": 68, - "depthBias": 56, - "depthBiasClamp": 64, - "depthBiasSlopeScale": 60, - "depthCompare": 12, - "depthWriteEnabled": 8, - "format": 4, - "nextInChain": 0, - "stencilBack": 32, - "stencilFront": 16, - "stencilReadMask": 48, - "stencilWriteMask": 52 - }, - "WGPUDeviceDescriptor": { - "__size__": 36, - "defaultQueue": 20, - "deviceLostCallback": 28, - "deviceLostUserdata": 32, - "label": 4, - "nextInChain": 0, - "requiredFeatureCount": 8, - "requiredFeatures": 12, - "requiredLimits": 16 - }, - "WGPUExtent3D": { - "__size__": 12, - "depthOrArrayLayers": 8, - "height": 4, - "width": 0 - }, - "WGPUFragmentState": { - "__size__": 28, - "constantCount": 12, - "constants": 16, - "entryPoint": 8, - "module": 4, - "nextInChain": 0, - "targetCount": 20, - "targets": 24 - }, - "WGPUFuture": { - "__size__": 8, - "id": 0 - }, - "WGPUFutureWaitInfo": { - "__size__": 16, - "completed": 8, - "future": 0 - }, - "WGPUImageCopyBuffer": { - "__size__": 40, - "buffer": 32, - "layout": 8, - "nextInChain": 0 - }, - "WGPUImageCopyTexture": { - "__size__": 28, - "aspect": 24, - "mipLevel": 8, - "nextInChain": 0, - "origin": 12, - "texture": 4 - }, - "WGPUInstanceDescriptor": { - "__size__": 16, - "features": 4, - "nextInChain": 0 - }, - "WGPUInstanceFeatures": { - "__size__": 12, - "nextInChain": 0, - "timedWaitAnyEnable": 4, - "timedWaitAnyMaxCount": 8 - }, - "WGPULimits": { - "__size__": 144, - "maxBindGroups": 16, - "maxBindGroupsPlusVertexBuffers": 20, - "maxBindingsPerBindGroup": 24, - "maxBufferSize": 88, - "maxColorAttachmentBytesPerSample": 116, - "maxColorAttachments": 112, - "maxComputeInvocationsPerWorkgroup": 124, - "maxComputeWorkgroupSizeX": 128, - "maxComputeWorkgroupSizeY": 132, - "maxComputeWorkgroupSizeZ": 136, - "maxComputeWorkgroupStorageSize": 120, - "maxComputeWorkgroupsPerDimension": 140, - "maxDynamicStorageBuffersPerPipelineLayout": 32, - "maxDynamicUniformBuffersPerPipelineLayout": 28, - "maxInterStageShaderComponents": 104, - "maxInterStageShaderVariables": 108, - "maxSampledTexturesPerShaderStage": 36, - "maxSamplersPerShaderStage": 40, - "maxStorageBufferBindingSize": 64, - "maxStorageBuffersPerShaderStage": 44, - "maxStorageTexturesPerShaderStage": 48, - "maxTextureArrayLayers": 12, - "maxTextureDimension1D": 0, - "maxTextureDimension2D": 4, - "maxTextureDimension3D": 8, - "maxUniformBufferBindingSize": 56, - "maxUniformBuffersPerShaderStage": 52, - "maxVertexAttributes": 96, - "maxVertexBufferArrayStride": 100, - "maxVertexBuffers": 80, - "minStorageBufferOffsetAlignment": 76, - "minUniformBufferOffsetAlignment": 72 - }, - "WGPUMultisampleState": { - "__size__": 16, - "alphaToCoverageEnabled": 12, - "count": 4, - "mask": 8, - "nextInChain": 0 - }, - "WGPUOrigin3D": { - "__size__": 12, - "x": 0, - "y": 4, - "z": 8 - }, - "WGPUPipelineLayoutDescriptor": { - "__size__": 16, - "bindGroupLayoutCount": 8, - "bindGroupLayouts": 12, - "label": 4, - "nextInChain": 0 - }, - "WGPUPrimitiveDepthClipControl": { - "__size__": 12, - "chain": 0, - "unclippedDepth": 8 - }, - "WGPUPrimitiveState": { - "__size__": 20, - "cullMode": 16, - "frontFace": 12, - "nextInChain": 0, - "stripIndexFormat": 8, - "topology": 4 - }, - "WGPUProgrammableStageDescriptor": { - "__size__": 20, - "constantCount": 12, - "constants": 16, - "entryPoint": 8, - "module": 4, - "nextInChain": 0 - }, - "WGPUQuerySetDescriptor": { - "__size__": 16, - "count": 12, - "label": 4, - "nextInChain": 0, - "type": 8 - }, - "WGPUQueueDescriptor": { - "__size__": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPUQueueWorkDoneCallbackInfo": { - "__size__": 16, - "callback": 8, - "mode": 4, - "nextInChain": 0, - "userdata": 12 - }, - "WGPURenderBundleDescriptor": { - "__size__": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPURenderBundleEncoderDescriptor": { - "__size__": 32, - "colorFormatCount": 8, - "colorFormats": 12, - "depthReadOnly": 24, - "depthStencilFormat": 16, - "label": 4, - "nextInChain": 0, - "sampleCount": 20, - "stencilReadOnly": 28 - }, - "WGPURenderPassColorAttachment": { - "__size__": 56, - "clearValue": 24, - "depthSlice": 8, - "loadOp": 16, - "nextInChain": 0, - "resolveTarget": 12, - "storeOp": 20, - "view": 4 - }, - "WGPURenderPassDepthStencilAttachment": { - "__size__": 36, - "depthClearValue": 12, - "depthLoadOp": 4, - "depthReadOnly": 16, - "depthStoreOp": 8, - "stencilClearValue": 28, - "stencilLoadOp": 20, - "stencilReadOnly": 32, - "stencilStoreOp": 24, - "view": 0 - }, - "WGPURenderPassDescriptor": { - "__size__": 28, - "colorAttachmentCount": 8, - "colorAttachments": 12, - "depthStencilAttachment": 16, - "label": 4, - "nextInChain": 0, - "occlusionQuerySet": 20, - "timestampWrites": 24 - }, - "WGPURenderPassDescriptorMaxDrawCount": { - "__size__": 16, - "chain": 0, - "maxDrawCount": 8 - }, - "WGPURenderPassTimestampWrites": { - "__size__": 12, - "beginningOfPassWriteIndex": 4, - "endOfPassWriteIndex": 8, - "querySet": 0 - }, - "WGPURenderPipelineDescriptor": { - "__size__": 84, - "depthStencil": 60, - "fragment": 80, - "label": 4, - "layout": 8, - "multisample": 64, - "nextInChain": 0, - "primitive": 40, - "vertex": 12 - }, - "WGPURequestAdapterCallbackInfo": { - "__size__": 16, - "callback": 8, - "mode": 4, - "nextInChain": 0, - "userdata": 12 - }, - "WGPURequestAdapterOptions": { - "__size__": 24, - "backendType": 12, - "compatibilityMode": 20, - "compatibleSurface": 4, - "forceFallbackAdapter": 16, - "nextInChain": 0, - "powerPreference": 8 - }, - "WGPURequiredLimits": { - "__size__": 152, - "limits": 8, - "nextInChain": 0 - }, - "WGPUSamplerBindingLayout": { - "__size__": 8, - "nextInChain": 0, - "type": 4 - }, - "WGPUSamplerDescriptor": { - "__size__": 48, - "addressModeU": 8, - "addressModeV": 12, - "addressModeW": 16, - "compare": 40, - "label": 4, - "lodMaxClamp": 36, - "lodMinClamp": 32, - "magFilter": 20, - "maxAnisotropy": 44, - "minFilter": 24, - "mipmapFilter": 28, - "nextInChain": 0 - }, - "WGPUShaderModuleDescriptor": { - "__size__": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPUShaderModuleSPIRVDescriptor": { - "__size__": 16, - "chain": 0, - "code": 12, - "codeSize": 8 - }, - "WGPUShaderModuleWGSLDescriptor": { - "__size__": 12, - "chain": 0, - "code": 8 - }, - "WGPUStencilFaceState": { - "__size__": 16, - "compare": 0, - "depthFailOp": 8, - "failOp": 4, - "passOp": 12 - }, - "WGPUStorageTextureBindingLayout": { - "__size__": 16, - "access": 4, - "format": 8, - "nextInChain": 0, - "viewDimension": 12 - }, - "WGPUSupportedLimits": { - "__size__": 152, - "limits": 8, - "nextInChain": 0 - }, - "WGPUSurfaceCapabilities": { - "__size__": 28, - "alphaModeCount": 20, - "alphaModes": 24, - "formatCount": 4, - "formats": 8, - "nextInChain": 0, - "presentModeCount": 12, - "presentModes": 16 - }, - "WGPUSurfaceConfiguration": { - "__size__": 40, - "alphaMode": 24, - "device": 4, - "format": 8, - "height": 32, - "nextInChain": 0, - "presentMode": 36, - "usage": 12, - "viewFormatCount": 16, - "viewFormats": 20, - "width": 28 - }, - "WGPUSurfaceDescriptor": { - "__size__": 8, - "label": 4, - "nextInChain": 0 - }, - "WGPUSurfaceDescriptorFromCanvasHTMLSelector": { - "__size__": 12, - "chain": 0, - "selector": 8 - }, - "WGPUSurfaceTexture": { - "__size__": 12, - "status": 8, - "suboptimal": 4, - "texture": 0 - }, - "WGPUSwapChainDescriptor": { - "__size__": 28, - "format": 12, - "height": 20, - "label": 4, - "nextInChain": 0, - "presentMode": 24, - "usage": 8, - "width": 16 - }, - "WGPUTextureBindingLayout": { - "__size__": 16, - "multisampled": 12, - "nextInChain": 0, - "sampleType": 4, - "viewDimension": 8 - }, - "WGPUTextureBindingViewDimensionDescriptor": { - "__size__": 12, - "chain": 0, - "textureBindingViewDimension": 8 - }, - "WGPUTextureDataLayout": { - "__size__": 24, - "bytesPerRow": 16, - "nextInChain": 0, - "offset": 8, - "rowsPerImage": 20 - }, - "WGPUTextureDescriptor": { - "__size__": 48, - "dimension": 12, - "format": 28, - "label": 4, - "mipLevelCount": 32, - "nextInChain": 0, - "sampleCount": 36, - "size": 16, - "usage": 8, - "viewFormatCount": 40, - "viewFormats": 44 - }, - "WGPUTextureViewDescriptor": { - "__size__": 36, - "arrayLayerCount": 28, - "aspect": 32, - "baseArrayLayer": 24, - "baseMipLevel": 16, - "dimension": 12, - "format": 8, - "label": 4, - "mipLevelCount": 20, - "nextInChain": 0 - }, - "WGPUVertexAttribute": { - "__size__": 24, - "format": 0, - "offset": 8, - "shaderLocation": 16 - }, - "WGPUVertexBufferLayout": { - "__size__": 24, - "arrayStride": 0, - "attributeCount": 12, - "attributes": 16, - "stepMode": 8 - }, - "WGPUVertexState": { - "__size__": 28, - "bufferCount": 20, - "buffers": 24, - "constantCount": 12, - "constants": 16, - "entryPoint": 8, - "module": 4, - "nextInChain": 0 - }, "WebAudioParamDescriptor": { "__size__": 16, "automationRate": 12, diff --git a/src/struct_info_generated_wasm64.json b/src/struct_info_generated_wasm64.json index 13d51209247f5..0398afa7afc2f 100644 --- a/src/struct_info_generated_wasm64.json +++ b/src/struct_info_generated_wasm64.json @@ -892,604 +892,6 @@ "minor": 1, "patch": 2 }, - "WGPUAdapterInfo": { - "__size__": 56, - "adapterType": 44, - "architecture": 16, - "backendType": 40, - "description": 32, - "device": 24, - "deviceID": 52, - "nextInChain": 0, - "vendor": 8, - "vendorID": 48 - }, - "WGPUAdapterProperties": { - "__size__": 72, - "adapterType": 56, - "architecture": 24, - "backendType": 60, - "compatibilityMode": 64, - "deviceID": 32, - "driverDescription": 48, - "name": 40, - "nextInChain": 0, - "vendorID": 8, - "vendorName": 16 - }, - "WGPUBindGroupDescriptor": { - "__size__": 40, - "entries": 32, - "entryCount": 24, - "label": 8, - "layout": 16, - "nextInChain": 0 - }, - "WGPUBindGroupEntry": { - "__size__": 56, - "binding": 8, - "buffer": 16, - "nextInChain": 0, - "offset": 24, - "sampler": 40, - "size": 32, - "textureView": 48 - }, - "WGPUBindGroupLayoutDescriptor": { - "__size__": 32, - "entries": 24, - "entryCount": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPUBindGroupLayoutEntry": { - "__size__": 104, - "binding": 8, - "buffer": 16, - "nextInChain": 0, - "sampler": 40, - "storageTexture": 80, - "texture": 56, - "visibility": 12 - }, - "WGPUBlendComponent": { - "__size__": 12, - "dstFactor": 8, - "operation": 0, - "srcFactor": 4 - }, - "WGPUBlendState": { - "__size__": 24, - "alpha": 12, - "color": 0 - }, - "WGPUBufferBindingLayout": { - "__size__": 24, - "hasDynamicOffset": 12, - "minBindingSize": 16, - "nextInChain": 0, - "type": 8 - }, - "WGPUBufferDescriptor": { - "__size__": 40, - "label": 8, - "mappedAtCreation": 32, - "nextInChain": 0, - "size": 24, - "usage": 16 - }, - "WGPUBufferMapCallbackInfo": { - "__size__": 32, - "callback": 16, - "mode": 8, - "nextInChain": 0, - "userdata": 24 - }, - "WGPUChainedStruct": { - "__size__": 16, - "next": 0, - "sType": 8 - }, - "WGPUColor": { - "__size__": 32, - "a": 24, - "b": 16, - "g": 8, - "r": 0 - }, - "WGPUColorTargetState": { - "__size__": 32, - "blend": 16, - "format": 8, - "nextInChain": 0, - "writeMask": 24 - }, - "WGPUCommandBufferDescriptor": { - "__size__": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPUCommandEncoderDescriptor": { - "__size__": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPUCompilationInfo": { - "__size__": 24, - "messageCount": 8, - "messages": 16, - "nextInChain": 0 - }, - "WGPUCompilationMessage": { - "__size__": 80, - "length": 48, - "lineNum": 24, - "linePos": 32, - "message": 8, - "nextInChain": 0, - "offset": 40, - "type": 16, - "utf16Length": 72, - "utf16LinePos": 56, - "utf16Offset": 64 - }, - "WGPUComputePassDescriptor": { - "__size__": 24, - "label": 8, - "nextInChain": 0, - "timestampWrites": 16 - }, - "WGPUComputePassTimestampWrites": { - "__size__": 16, - "beginningOfPassWriteIndex": 8, - "endOfPassWriteIndex": 12, - "querySet": 0 - }, - "WGPUComputePipelineDescriptor": { - "__size__": 64, - "compute": 24, - "label": 8, - "layout": 16, - "nextInChain": 0 - }, - "WGPUConstantEntry": { - "__size__": 24, - "key": 8, - "nextInChain": 0, - "value": 16 - }, - "WGPUDepthStencilState": { - "__size__": 72, - "depthBias": 60, - "depthBiasClamp": 68, - "depthBiasSlopeScale": 64, - "depthCompare": 16, - "depthWriteEnabled": 12, - "format": 8, - "nextInChain": 0, - "stencilBack": 36, - "stencilFront": 20, - "stencilReadMask": 52, - "stencilWriteMask": 56 - }, - "WGPUDeviceDescriptor": { - "__size__": 72, - "defaultQueue": 40, - "deviceLostCallback": 56, - "deviceLostUserdata": 64, - "label": 8, - "nextInChain": 0, - "requiredFeatureCount": 16, - "requiredFeatures": 24, - "requiredLimits": 32 - }, - "WGPUExtent3D": { - "__size__": 12, - "depthOrArrayLayers": 8, - "height": 4, - "width": 0 - }, - "WGPUFragmentState": { - "__size__": 56, - "constantCount": 24, - "constants": 32, - "entryPoint": 16, - "module": 8, - "nextInChain": 0, - "targetCount": 40, - "targets": 48 - }, - "WGPUFuture": { - "__size__": 8, - "id": 0 - }, - "WGPUFutureWaitInfo": { - "__size__": 16, - "completed": 8, - "future": 0 - }, - "WGPUImageCopyBuffer": { - "__size__": 40, - "buffer": 32, - "layout": 8, - "nextInChain": 0 - }, - "WGPUImageCopyTexture": { - "__size__": 40, - "aspect": 32, - "mipLevel": 16, - "nextInChain": 0, - "origin": 20, - "texture": 8 - }, - "WGPUInstanceDescriptor": { - "__size__": 32, - "features": 8, - "nextInChain": 0 - }, - "WGPUInstanceFeatures": { - "__size__": 24, - "nextInChain": 0, - "timedWaitAnyEnable": 8, - "timedWaitAnyMaxCount": 16 - }, - "WGPULimits": { - "__size__": 144, - "maxBindGroups": 16, - "maxBindGroupsPlusVertexBuffers": 20, - "maxBindingsPerBindGroup": 24, - "maxBufferSize": 88, - "maxColorAttachmentBytesPerSample": 116, - "maxColorAttachments": 112, - "maxComputeInvocationsPerWorkgroup": 124, - "maxComputeWorkgroupSizeX": 128, - "maxComputeWorkgroupSizeY": 132, - "maxComputeWorkgroupSizeZ": 136, - "maxComputeWorkgroupStorageSize": 120, - "maxComputeWorkgroupsPerDimension": 140, - "maxDynamicStorageBuffersPerPipelineLayout": 32, - "maxDynamicUniformBuffersPerPipelineLayout": 28, - "maxInterStageShaderComponents": 104, - "maxInterStageShaderVariables": 108, - "maxSampledTexturesPerShaderStage": 36, - "maxSamplersPerShaderStage": 40, - "maxStorageBufferBindingSize": 64, - "maxStorageBuffersPerShaderStage": 44, - "maxStorageTexturesPerShaderStage": 48, - "maxTextureArrayLayers": 12, - "maxTextureDimension1D": 0, - "maxTextureDimension2D": 4, - "maxTextureDimension3D": 8, - "maxUniformBufferBindingSize": 56, - "maxUniformBuffersPerShaderStage": 52, - "maxVertexAttributes": 96, - "maxVertexBufferArrayStride": 100, - "maxVertexBuffers": 80, - "minStorageBufferOffsetAlignment": 76, - "minUniformBufferOffsetAlignment": 72 - }, - "WGPUMultisampleState": { - "__size__": 24, - "alphaToCoverageEnabled": 16, - "count": 8, - "mask": 12, - "nextInChain": 0 - }, - "WGPUOrigin3D": { - "__size__": 12, - "x": 0, - "y": 4, - "z": 8 - }, - "WGPUPipelineLayoutDescriptor": { - "__size__": 32, - "bindGroupLayoutCount": 16, - "bindGroupLayouts": 24, - "label": 8, - "nextInChain": 0 - }, - "WGPUPrimitiveDepthClipControl": { - "__size__": 24, - "chain": 0, - "unclippedDepth": 16 - }, - "WGPUPrimitiveState": { - "__size__": 24, - "cullMode": 20, - "frontFace": 16, - "nextInChain": 0, - "stripIndexFormat": 12, - "topology": 8 - }, - "WGPUProgrammableStageDescriptor": { - "__size__": 40, - "constantCount": 24, - "constants": 32, - "entryPoint": 16, - "module": 8, - "nextInChain": 0 - }, - "WGPUQuerySetDescriptor": { - "__size__": 24, - "count": 20, - "label": 8, - "nextInChain": 0, - "type": 16 - }, - "WGPUQueueDescriptor": { - "__size__": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPUQueueWorkDoneCallbackInfo": { - "__size__": 32, - "callback": 16, - "mode": 8, - "nextInChain": 0, - "userdata": 24 - }, - "WGPURenderBundleDescriptor": { - "__size__": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPURenderBundleEncoderDescriptor": { - "__size__": 48, - "colorFormatCount": 16, - "colorFormats": 24, - "depthReadOnly": 40, - "depthStencilFormat": 32, - "label": 8, - "nextInChain": 0, - "sampleCount": 36, - "stencilReadOnly": 44 - }, - "WGPURenderPassColorAttachment": { - "__size__": 72, - "clearValue": 40, - "depthSlice": 16, - "loadOp": 32, - "nextInChain": 0, - "resolveTarget": 24, - "storeOp": 36, - "view": 8 - }, - "WGPURenderPassDepthStencilAttachment": { - "__size__": 40, - "depthClearValue": 16, - "depthLoadOp": 8, - "depthReadOnly": 20, - "depthStoreOp": 12, - "stencilClearValue": 32, - "stencilLoadOp": 24, - "stencilReadOnly": 36, - "stencilStoreOp": 28, - "view": 0 - }, - "WGPURenderPassDescriptor": { - "__size__": 56, - "colorAttachmentCount": 16, - "colorAttachments": 24, - "depthStencilAttachment": 32, - "label": 8, - "nextInChain": 0, - "occlusionQuerySet": 40, - "timestampWrites": 48 - }, - "WGPURenderPassDescriptorMaxDrawCount": { - "__size__": 24, - "chain": 0, - "maxDrawCount": 16 - }, - "WGPURenderPassTimestampWrites": { - "__size__": 16, - "beginningOfPassWriteIndex": 8, - "endOfPassWriteIndex": 12, - "querySet": 0 - }, - "WGPURenderPipelineDescriptor": { - "__size__": 144, - "depthStencil": 104, - "fragment": 136, - "label": 8, - "layout": 16, - "multisample": 112, - "nextInChain": 0, - "primitive": 80, - "vertex": 24 - }, - "WGPURequestAdapterCallbackInfo": { - "__size__": 32, - "callback": 16, - "mode": 8, - "nextInChain": 0, - "userdata": 24 - }, - "WGPURequestAdapterOptions": { - "__size__": 32, - "backendType": 20, - "compatibilityMode": 28, - "compatibleSurface": 8, - "forceFallbackAdapter": 24, - "nextInChain": 0, - "powerPreference": 16 - }, - "WGPURequiredLimits": { - "__size__": 152, - "limits": 8, - "nextInChain": 0 - }, - "WGPUSamplerBindingLayout": { - "__size__": 16, - "nextInChain": 0, - "type": 8 - }, - "WGPUSamplerDescriptor": { - "__size__": 56, - "addressModeU": 16, - "addressModeV": 20, - "addressModeW": 24, - "compare": 48, - "label": 8, - "lodMaxClamp": 44, - "lodMinClamp": 40, - "magFilter": 28, - "maxAnisotropy": 52, - "minFilter": 32, - "mipmapFilter": 36, - "nextInChain": 0 - }, - "WGPUShaderModuleDescriptor": { - "__size__": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPUShaderModuleSPIRVDescriptor": { - "__size__": 32, - "chain": 0, - "code": 24, - "codeSize": 16 - }, - "WGPUShaderModuleWGSLDescriptor": { - "__size__": 24, - "chain": 0, - "code": 16 - }, - "WGPUStencilFaceState": { - "__size__": 16, - "compare": 0, - "depthFailOp": 8, - "failOp": 4, - "passOp": 12 - }, - "WGPUStorageTextureBindingLayout": { - "__size__": 24, - "access": 8, - "format": 12, - "nextInChain": 0, - "viewDimension": 16 - }, - "WGPUSupportedLimits": { - "__size__": 152, - "limits": 8, - "nextInChain": 0 - }, - "WGPUSurfaceCapabilities": { - "__size__": 56, - "alphaModeCount": 40, - "alphaModes": 48, - "formatCount": 8, - "formats": 16, - "nextInChain": 0, - "presentModeCount": 24, - "presentModes": 32 - }, - "WGPUSurfaceConfiguration": { - "__size__": 56, - "alphaMode": 40, - "device": 8, - "format": 16, - "height": 48, - "nextInChain": 0, - "presentMode": 52, - "usage": 20, - "viewFormatCount": 24, - "viewFormats": 32, - "width": 44 - }, - "WGPUSurfaceDescriptor": { - "__size__": 16, - "label": 8, - "nextInChain": 0 - }, - "WGPUSurfaceDescriptorFromCanvasHTMLSelector": { - "__size__": 24, - "chain": 0, - "selector": 16 - }, - "WGPUSurfaceTexture": { - "__size__": 16, - "status": 12, - "suboptimal": 8, - "texture": 0 - }, - "WGPUSwapChainDescriptor": { - "__size__": 40, - "format": 20, - "height": 28, - "label": 8, - "nextInChain": 0, - "presentMode": 32, - "usage": 16, - "width": 24 - }, - "WGPUTextureBindingLayout": { - "__size__": 24, - "multisampled": 16, - "nextInChain": 0, - "sampleType": 8, - "viewDimension": 12 - }, - "WGPUTextureBindingViewDimensionDescriptor": { - "__size__": 24, - "chain": 0, - "textureBindingViewDimension": 16 - }, - "WGPUTextureDataLayout": { - "__size__": 24, - "bytesPerRow": 16, - "nextInChain": 0, - "offset": 8, - "rowsPerImage": 20 - }, - "WGPUTextureDescriptor": { - "__size__": 64, - "dimension": 20, - "format": 36, - "label": 8, - "mipLevelCount": 40, - "nextInChain": 0, - "sampleCount": 44, - "size": 24, - "usage": 16, - "viewFormatCount": 48, - "viewFormats": 56 - }, - "WGPUTextureViewDescriptor": { - "__size__": 48, - "arrayLayerCount": 36, - "aspect": 40, - "baseArrayLayer": 32, - "baseMipLevel": 24, - "dimension": 20, - "format": 16, - "label": 8, - "mipLevelCount": 28, - "nextInChain": 0 - }, - "WGPUVertexAttribute": { - "__size__": 24, - "format": 0, - "offset": 8, - "shaderLocation": 16 - }, - "WGPUVertexBufferLayout": { - "__size__": 32, - "arrayStride": 0, - "attributeCount": 16, - "attributes": 24, - "stepMode": 8 - }, - "WGPUVertexState": { - "__size__": 56, - "bufferCount": 40, - "buffers": 48, - "constantCount": 24, - "constants": 32, - "entryPoint": 16, - "module": 8, - "nextInChain": 0 - }, "WebAudioParamDescriptor": { "__size__": 16, "automationRate": 12, diff --git a/src/struct_info_webgpu.json b/src/struct_info_webgpu.json deleted file mode 100644 index ffbfad3ccf0fc..0000000000000 --- a/src/struct_info_webgpu.json +++ /dev/null @@ -1,536 +0,0 @@ -[ - // =========================================== - // WebGPU - // NOTE: This file is auto-generated. - // See system/include/webgpu/README.md for details. - // =========================================== - { - "file": "webgpu/webgpu.h", - "defines": [], - "structs": { - "WGPUChainedStruct": [ - "next", - "sType" - ], - "WGPUAdapterInfo": [ - "nextInChain", - "vendor", - "architecture", - "device", - "description", - "backendType", - "adapterType", - "vendorID", - "deviceID" - ], - "WGPUAdapterProperties": [ - "nextInChain", - "vendorID", - "vendorName", - "architecture", - "deviceID", - "name", - "driverDescription", - "adapterType", - "backendType", - "compatibilityMode" - ], - "WGPUBindGroupEntry": [ - "nextInChain", - "binding", - "buffer", - "offset", - "size", - "sampler", - "textureView" - ], - "WGPUBlendComponent": [ - "operation", - "srcFactor", - "dstFactor" - ], - "WGPUBufferBindingLayout": [ - "nextInChain", - "type", - "hasDynamicOffset", - "minBindingSize" - ], - "WGPUBufferDescriptor": [ - "nextInChain", - "label", - "usage", - "size", - "mappedAtCreation" - ], - "WGPUBufferMapCallbackInfo": [ - "nextInChain", - "mode", - "callback", - "userdata" - ], - "WGPUColor": [ - "r", - "g", - "b", - "a" - ], - "WGPUCommandBufferDescriptor": [ - "nextInChain", - "label" - ], - "WGPUCommandEncoderDescriptor": [ - "nextInChain", - "label" - ], - "WGPUCompilationMessage": [ - "nextInChain", - "message", - "type", - "lineNum", - "linePos", - "offset", - "length", - "utf16LinePos", - "utf16Offset", - "utf16Length" - ], - "WGPUComputePassTimestampWrites": [ - "querySet", - "beginningOfPassWriteIndex", - "endOfPassWriteIndex" - ], - "WGPUConstantEntry": [ - "nextInChain", - "key", - "value" - ], - "WGPUExtent3D": [ - "width", - "height", - "depthOrArrayLayers" - ], - "WGPUFuture": [ - "id" - ], - "WGPUInstanceFeatures": [ - "nextInChain", - "timedWaitAnyEnable", - "timedWaitAnyMaxCount" - ], - "WGPULimits": [ - "maxTextureDimension1D", - "maxTextureDimension2D", - "maxTextureDimension3D", - "maxTextureArrayLayers", - "maxBindGroups", - "maxBindGroupsPlusVertexBuffers", - "maxBindingsPerBindGroup", - "maxDynamicUniformBuffersPerPipelineLayout", - "maxDynamicStorageBuffersPerPipelineLayout", - "maxSampledTexturesPerShaderStage", - "maxSamplersPerShaderStage", - "maxStorageBuffersPerShaderStage", - "maxStorageTexturesPerShaderStage", - "maxUniformBuffersPerShaderStage", - "maxUniformBufferBindingSize", - "maxStorageBufferBindingSize", - "minUniformBufferOffsetAlignment", - "minStorageBufferOffsetAlignment", - "maxVertexBuffers", - "maxBufferSize", - "maxVertexAttributes", - "maxVertexBufferArrayStride", - "maxInterStageShaderComponents", - "maxInterStageShaderVariables", - "maxColorAttachments", - "maxColorAttachmentBytesPerSample", - "maxComputeWorkgroupStorageSize", - "maxComputeInvocationsPerWorkgroup", - "maxComputeWorkgroupSizeX", - "maxComputeWorkgroupSizeY", - "maxComputeWorkgroupSizeZ", - "maxComputeWorkgroupsPerDimension" - ], - "WGPUMultisampleState": [ - "nextInChain", - "count", - "mask", - "alphaToCoverageEnabled" - ], - "WGPUOrigin3D": [ - "x", - "y", - "z" - ], - "WGPUPipelineLayoutDescriptor": [ - "nextInChain", - "label", - "bindGroupLayoutCount", - "bindGroupLayouts" - ], - "WGPUPrimitiveDepthClipControl": [ - "chain", - "unclippedDepth" - ], - "WGPUPrimitiveState": [ - "nextInChain", - "topology", - "stripIndexFormat", - "frontFace", - "cullMode" - ], - "WGPUQuerySetDescriptor": [ - "nextInChain", - "label", - "type", - "count" - ], - "WGPUQueueDescriptor": [ - "nextInChain", - "label" - ], - "WGPUQueueWorkDoneCallbackInfo": [ - "nextInChain", - "mode", - "callback", - "userdata" - ], - "WGPURenderBundleDescriptor": [ - "nextInChain", - "label" - ], - "WGPURenderBundleEncoderDescriptor": [ - "nextInChain", - "label", - "colorFormatCount", - "colorFormats", - "depthStencilFormat", - "sampleCount", - "depthReadOnly", - "stencilReadOnly" - ], - "WGPURenderPassDepthStencilAttachment": [ - "view", - "depthLoadOp", - "depthStoreOp", - "depthClearValue", - "depthReadOnly", - "stencilLoadOp", - "stencilStoreOp", - "stencilClearValue", - "stencilReadOnly" - ], - "WGPURenderPassDescriptorMaxDrawCount": [ - "chain", - "maxDrawCount" - ], - "WGPURenderPassTimestampWrites": [ - "querySet", - "beginningOfPassWriteIndex", - "endOfPassWriteIndex" - ], - "WGPURequestAdapterCallbackInfo": [ - "nextInChain", - "mode", - "callback", - "userdata" - ], - "WGPURequestAdapterOptions": [ - "nextInChain", - "compatibleSurface", - "powerPreference", - "backendType", - "forceFallbackAdapter", - "compatibilityMode" - ], - "WGPUSamplerBindingLayout": [ - "nextInChain", - "type" - ], - "WGPUSamplerDescriptor": [ - "nextInChain", - "label", - "addressModeU", - "addressModeV", - "addressModeW", - "magFilter", - "minFilter", - "mipmapFilter", - "lodMinClamp", - "lodMaxClamp", - "compare", - "maxAnisotropy" - ], - "WGPUShaderModuleSPIRVDescriptor": [ - "chain", - "codeSize", - "code" - ], - "WGPUShaderModuleWGSLDescriptor": [ - "chain", - "code" - ], - "WGPUShaderModuleDescriptor": [ - "nextInChain", - "label" - ], - "WGPUStencilFaceState": [ - "compare", - "failOp", - "depthFailOp", - "passOp" - ], - "WGPUStorageTextureBindingLayout": [ - "nextInChain", - "access", - "format", - "viewDimension" - ], - "WGPUSurfaceCapabilities": [ - "nextInChain", - "formatCount", - "formats", - "presentModeCount", - "presentModes", - "alphaModeCount", - "alphaModes" - ], - "WGPUSurfaceConfiguration": [ - "nextInChain", - "device", - "format", - "usage", - "viewFormatCount", - "viewFormats", - "alphaMode", - "width", - "height", - "presentMode" - ], - "WGPUSurfaceDescriptor": [ - "nextInChain", - "label" - ], - "WGPUSurfaceDescriptorFromCanvasHTMLSelector": [ - "chain", - "selector" - ], - "WGPUSurfaceTexture": [ - "texture", - "suboptimal", - "status" - ], - "WGPUSwapChainDescriptor": [ - "nextInChain", - "label", - "usage", - "format", - "width", - "height", - "presentMode" - ], - "WGPUTextureBindingLayout": [ - "nextInChain", - "sampleType", - "viewDimension", - "multisampled" - ], - "WGPUTextureBindingViewDimensionDescriptor": [ - "chain", - "textureBindingViewDimension" - ], - "WGPUTextureDataLayout": [ - "nextInChain", - "offset", - "bytesPerRow", - "rowsPerImage" - ], - "WGPUTextureViewDescriptor": [ - "nextInChain", - "label", - "format", - "dimension", - "baseMipLevel", - "mipLevelCount", - "baseArrayLayer", - "arrayLayerCount", - "aspect" - ], - "WGPUVertexAttribute": [ - "format", - "offset", - "shaderLocation" - ], - "WGPUBindGroupDescriptor": [ - "nextInChain", - "label", - "layout", - "entryCount", - "entries" - ], - "WGPUBindGroupLayoutEntry": [ - "nextInChain", - "binding", - "visibility", - "buffer", - "sampler", - "texture", - "storageTexture" - ], - "WGPUBlendState": [ - "color", - "alpha" - ], - "WGPUCompilationInfo": [ - "nextInChain", - "messageCount", - "messages" - ], - "WGPUComputePassDescriptor": [ - "nextInChain", - "label", - "timestampWrites" - ], - "WGPUDepthStencilState": [ - "nextInChain", - "format", - "depthWriteEnabled", - "depthCompare", - "stencilFront", - "stencilBack", - "stencilReadMask", - "stencilWriteMask", - "depthBias", - "depthBiasSlopeScale", - "depthBiasClamp" - ], - "WGPUFutureWaitInfo": [ - "future", - "completed" - ], - "WGPUImageCopyBuffer": [ - "nextInChain", - "layout", - "buffer" - ], - "WGPUImageCopyTexture": [ - "nextInChain", - "texture", - "mipLevel", - "origin", - "aspect" - ], - "WGPUInstanceDescriptor": [ - "nextInChain", - "features" - ], - "WGPUProgrammableStageDescriptor": [ - "nextInChain", - "module", - "entryPoint", - "constantCount", - "constants" - ], - "WGPURenderPassColorAttachment": [ - "nextInChain", - "view", - "depthSlice", - "resolveTarget", - "loadOp", - "storeOp", - "clearValue" - ], - "WGPURequiredLimits": [ - "nextInChain", - "limits" - ], - "WGPUSupportedLimits": [ - "nextInChain", - "limits" - ], - "WGPUTextureDescriptor": [ - "nextInChain", - "label", - "usage", - "dimension", - "size", - "format", - "mipLevelCount", - "sampleCount", - "viewFormatCount", - "viewFormats" - ], - "WGPUVertexBufferLayout": [ - "arrayStride", - "stepMode", - "attributeCount", - "attributes" - ], - "WGPUBindGroupLayoutDescriptor": [ - "nextInChain", - "label", - "entryCount", - "entries" - ], - "WGPUColorTargetState": [ - "nextInChain", - "format", - "blend", - "writeMask" - ], - "WGPUComputePipelineDescriptor": [ - "nextInChain", - "label", - "layout", - "compute" - ], - "WGPUDeviceDescriptor": [ - "nextInChain", - "label", - "requiredFeatureCount", - "requiredFeatures", - "requiredLimits", - "defaultQueue", - "deviceLostCallback", - "deviceLostUserdata" - ], - "WGPURenderPassDescriptor": [ - "nextInChain", - "label", - "colorAttachmentCount", - "colorAttachments", - "depthStencilAttachment", - "occlusionQuerySet", - "timestampWrites" - ], - "WGPUVertexState": [ - "nextInChain", - "module", - "entryPoint", - "constantCount", - "constants", - "bufferCount", - "buffers" - ], - "WGPUFragmentState": [ - "nextInChain", - "module", - "entryPoint", - "constantCount", - "constants", - "targetCount", - "targets" - ], - "WGPURenderPipelineDescriptor": [ - "nextInChain", - "label", - "layout", - "vertex", - "primitive", - "depthStencil", - "multisample", - "fragment" - ] - } - } -] diff --git a/system/include/emscripten/html5_webgpu.h b/system/include/emscripten/html5_webgpu.h deleted file mode 100644 index d96ba619656e3..0000000000000 --- a/system/include/emscripten/html5_webgpu.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 The Emscripten Authors. All rights reserved. - * Emscripten is available under two separate licenses, the MIT license and the - * University of Illinois/NCSA Open Source License. Both these licenses can be - * found in the LICENSE file. - */ - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -WGPUDevice emscripten_webgpu_get_device(void); - -void emscripten_webgpu_release_js_handle(int js_handle); - -#define WEBGPU_MAKE_IMPORT_EXPORT(snake_case, CamelCase) \ - WGPU##CamelCase emscripten_webgpu_import_##snake_case(int); \ - int emscripten_webgpu_export_##snake_case(WGPU##CamelCase); - -WEBGPU_MAKE_IMPORT_EXPORT(surface, Surface) -WEBGPU_MAKE_IMPORT_EXPORT(swap_chain, SwapChain) - -WEBGPU_MAKE_IMPORT_EXPORT(device, Device) -WEBGPU_MAKE_IMPORT_EXPORT(queue, Queue) - -WEBGPU_MAKE_IMPORT_EXPORT(command_buffer, CommandBuffer) -WEBGPU_MAKE_IMPORT_EXPORT(command_encoder, CommandEncoder) -WEBGPU_MAKE_IMPORT_EXPORT(render_pass_encoder, RenderPassEncoder) -WEBGPU_MAKE_IMPORT_EXPORT(compute_pass_encoder, ComputePassEncoder) - -WEBGPU_MAKE_IMPORT_EXPORT(bind_group, BindGroup) -WEBGPU_MAKE_IMPORT_EXPORT(buffer, Buffer) -WEBGPU_MAKE_IMPORT_EXPORT(sampler, Sampler) -WEBGPU_MAKE_IMPORT_EXPORT(texture, Texture) -WEBGPU_MAKE_IMPORT_EXPORT(texture_view, TextureView) -WEBGPU_MAKE_IMPORT_EXPORT(query_set, QuerySet) - -WEBGPU_MAKE_IMPORT_EXPORT(bind_group_layout, BindGroupLayout) -WEBGPU_MAKE_IMPORT_EXPORT(pipeline_layout, PipelineLayout) -WEBGPU_MAKE_IMPORT_EXPORT(render_pipeline, RenderPipeline) -WEBGPU_MAKE_IMPORT_EXPORT(compute_pipeline, ComputePipeline) -WEBGPU_MAKE_IMPORT_EXPORT(shader_module, ShaderModule) - -WEBGPU_MAKE_IMPORT_EXPORT(render_bundle_encoder, RenderBundleEncoder) -WEBGPU_MAKE_IMPORT_EXPORT(render_bundle, RenderBundle) - -#undef WEBGPU_MAKE_IMPORT_EXPORT - -#ifdef __cplusplus -} // ~extern "C" -#endif diff --git a/system/include/webgpu/README.md b/system/include/webgpu/README.md deleted file mode 100644 index b553653c9963e..0000000000000 --- a/system/include/webgpu/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# WebGPU Bindings - -**IMPORTANT NOTICE:** - -Emscripten's WebGPU bindings `-sUSE_WEBGPU` are **deprecated and unmaintained** -and will be removed. Please migrate to Emdawnwebgpu via -[`--use-port=emdawnwebgpu`](../../../tools/ports/emdawnwebgpu.py): - -> Emdawnwebgpu is a fork of Emscripten's original `USE_WEBGPU`, implementing a -> newer, more stable version of the standardized webgpu.h interface. If you -> find issues, verify in the latest nightly release -> () and file feedback with Dawn. -> (Emdawnwebgpu is maintained as part of Dawn, the open-source WebGPU -> implementation used by Chromium, but it is still cross-browser.) - -(Information about maintaining the `USE_WEBGPU` bindings has been removed, -since they won't be maintained anymore.) diff --git a/system/include/webgpu/webgpu.h b/system/include/webgpu/webgpu.h deleted file mode 100644 index 9908947ae00ad..0000000000000 --- a/system/include/webgpu/webgpu.h +++ /dev/null @@ -1,1893 +0,0 @@ -// BSD 3-Clause License -// -// Copyright (c) 2019, "WebGPU native" developers -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef WEBGPU_H_ -#define WEBGPU_H_ - -#if defined(WGPU_SHARED_LIBRARY) -# if defined(_WIN32) -# if defined(WGPU_IMPLEMENTATION) -# define WGPU_EXPORT __declspec(dllexport) -# else -# define WGPU_EXPORT __declspec(dllimport) -# endif -# else // defined(_WIN32) -# if defined(WGPU_IMPLEMENTATION) -# define WGPU_EXPORT __attribute__((visibility("default"))) -# else -# define WGPU_EXPORT -# endif -# endif // defined(_WIN32) -#else // defined(WGPU_SHARED_LIBRARY) -# define WGPU_EXPORT -#endif // defined(WGPU_SHARED_LIBRARY) - -#if !defined(WGPU_OBJECT_ATTRIBUTE) -#define WGPU_OBJECT_ATTRIBUTE -#endif -#if !defined(WGPU_ENUM_ATTRIBUTE) -#define WGPU_ENUM_ATTRIBUTE -#endif -#if !defined(WGPU_STRUCTURE_ATTRIBUTE) -#define WGPU_STRUCTURE_ATTRIBUTE -#endif -#if !defined(WGPU_FUNCTION_ATTRIBUTE) -#define WGPU_FUNCTION_ATTRIBUTE -#endif -#if !defined(WGPU_NULLABLE) -#define WGPU_NULLABLE -#endif - -#include -#include - -#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED 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 WGPUInstanceImpl* WGPUInstance WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUQuerySetImpl* WGPUQuerySet WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUQueueImpl* WGPUQueue WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderBundleImpl* WGPURenderBundle WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderBundleEncoderImpl* WGPURenderBundleEncoder WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderPassEncoderImpl* WGPURenderPassEncoder WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPURenderPipelineImpl* WGPURenderPipeline WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSamplerImpl* WGPUSampler WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUShaderModuleImpl* WGPUShaderModule WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSurfaceImpl* WGPUSurface WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUSwapChainImpl* WGPUSwapChain WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureImpl* WGPUTexture WGPU_OBJECT_ATTRIBUTE; -typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE; - -// Structure forward declarations -struct WGPUAdapterInfo; -struct WGPUAdapterProperties; -struct WGPUBindGroupEntry; -struct WGPUBlendComponent; -struct WGPUBufferBindingLayout; -struct WGPUBufferDescriptor; -struct WGPUBufferMapCallbackInfo; -struct WGPUColor; -struct WGPUCommandBufferDescriptor; -struct WGPUCommandEncoderDescriptor; -struct WGPUCompilationMessage; -struct WGPUComputePassTimestampWrites; -struct WGPUConstantEntry; -struct WGPUExtent3D; -struct WGPUFuture; -struct WGPUInstanceFeatures; -struct WGPULimits; -struct WGPUMultisampleState; -struct WGPUOrigin3D; -struct WGPUPipelineLayoutDescriptor; -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 WGPUSamplerBindingLayout; -struct WGPUSamplerDescriptor; -struct WGPUShaderModuleSPIRVDescriptor; -struct WGPUShaderModuleWGSLDescriptor; -struct WGPUShaderModuleDescriptor; -struct WGPUStencilFaceState; -struct WGPUStorageTextureBindingLayout; -struct WGPUSurfaceCapabilities; -struct WGPUSurfaceConfiguration; -struct WGPUSurfaceDescriptor; -struct WGPUSurfaceDescriptorFromCanvasHTMLSelector; -struct WGPUSurfaceTexture; -struct WGPUSwapChainDescriptor; -struct WGPUTextureBindingLayout; -struct WGPUTextureBindingViewDimensionDescriptor; -struct WGPUTextureDataLayout; -struct WGPUTextureViewDescriptor; -struct WGPUVertexAttribute; -struct WGPUBindGroupDescriptor; -struct WGPUBindGroupLayoutEntry; -struct WGPUBlendState; -struct WGPUCompilationInfo; -struct WGPUComputePassDescriptor; -struct WGPUDepthStencilState; -struct WGPUFutureWaitInfo; -struct WGPUImageCopyBuffer; -struct WGPUImageCopyTexture; -struct WGPUInstanceDescriptor; -struct WGPUProgrammableStageDescriptor; -struct WGPURenderPassColorAttachment; -struct WGPURequiredLimits; -struct WGPUSupportedLimits; -struct WGPUTextureDescriptor; -struct WGPUVertexBufferLayout; -struct WGPUBindGroupLayoutDescriptor; -struct WGPUColorTargetState; -struct WGPUComputePipelineDescriptor; -struct WGPUDeviceDescriptor; -struct WGPURenderPassDescriptor; -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_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 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_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_ValidationError = 0x00000001, - WGPUBufferMapAsyncStatus_Unknown = 0x00000002, - WGPUBufferMapAsyncStatus_DeviceLost = 0x00000003, - WGPUBufferMapAsyncStatus_DestroyedBeforeCallback = 0x00000004, - WGPUBufferMapAsyncStatus_UnmappedBeforeCallback = 0x00000005, - WGPUBufferMapAsyncStatus_MappingAlreadyPending = 0x00000006, - WGPUBufferMapAsyncStatus_OffsetOutOfRange = 0x00000007, - WGPUBufferMapAsyncStatus_SizeOutOfRange = 0x00000008, - WGPUBufferMapAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUBufferMapAsyncStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUBufferMapState { - WGPUBufferMapState_Unmapped = 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_Error = 0x00000001, - WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000002, - WGPUCompilationInfoRequestStatus_Unknown = 0x00000003, - 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 WGPUCompositeAlphaMode { - WGPUCompositeAlphaMode_Auto = 0x00000000, - WGPUCompositeAlphaMode_Opaque = 0x00000001, - WGPUCompositeAlphaMode_Premultiplied = 0x00000002, - WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003, - WGPUCompositeAlphaMode_Inherit = 0x00000004, - WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF -} WGPUCompositeAlphaMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCreatePipelineAsyncStatus { - WGPUCreatePipelineAsyncStatus_Success = 0x00000000, - WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000001, - WGPUCreatePipelineAsyncStatus_InternalError = 0x00000002, - WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000003, - WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000004, - WGPUCreatePipelineAsyncStatus_Unknown = 0x00000005, - WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUCullMode { - WGPUCullMode_Undefined = 0x00000000, - WGPUCullMode_None = 0x00000001, - WGPUCullMode_Front = 0x00000002, - WGPUCullMode_Back = 0x00000003, - WGPUCullMode_Force32 = 0x7FFFFFFF -} WGPUCullMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUDeviceLostReason { - WGPUDeviceLostReason_Undefined = 0x00000001, - WGPUDeviceLostReason_Unknown = 0x00000001, - WGPUDeviceLostReason_Destroyed = 0x00000002, - 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 WGPUFeatureName { - WGPUFeatureName_Undefined = 0x00000000, - WGPUFeatureName_DepthClipControl = 0x00000001, - WGPUFeatureName_Depth32FloatStencil8 = 0x00000002, - WGPUFeatureName_TimestampQuery = 0x00000003, - WGPUFeatureName_TextureCompressionBC = 0x00000004, - WGPUFeatureName_TextureCompressionETC2 = 0x00000005, - WGPUFeatureName_TextureCompressionASTC = 0x00000006, - WGPUFeatureName_IndirectFirstInstance = 0x00000007, - WGPUFeatureName_ShaderF16 = 0x00000008, - WGPUFeatureName_RG11B10UfloatRenderable = 0x00000009, - WGPUFeatureName_BGRA8UnormStorage = 0x0000000A, - WGPUFeatureName_Float32Filterable = 0x0000000B, - WGPUFeatureName_Force32 = 0x7FFFFFFF -} WGPUFeatureName WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUFilterMode { - WGPUFilterMode_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 WGPUMipmapFilterMode { - WGPUMipmapFilterMode_Undefined = 0x00000000, - WGPUMipmapFilterMode_Nearest = 0x00000001, - WGPUMipmapFilterMode_Linear = 0x00000002, - WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF -} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPowerPreference { - WGPUPowerPreference_Undefined = 0x00000000, - WGPUPowerPreference_LowPower = 0x00000001, - WGPUPowerPreference_HighPerformance = 0x00000002, - WGPUPowerPreference_Force32 = 0x7FFFFFFF -} WGPUPowerPreference WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUPresentMode { - WGPUPresentMode_Fifo = 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_Error = 0x00000001, - WGPUQueueWorkDoneStatus_Unknown = 0x00000002, - WGPUQueueWorkDoneStatus_DeviceLost = 0x00000003, - WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF -} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPURequestAdapterStatus { - WGPURequestAdapterStatus_Success = 0x00000000, - WGPURequestAdapterStatus_Unavailable = 0x00000001, - WGPURequestAdapterStatus_Error = 0x00000002, - WGPURequestAdapterStatus_Unknown = 0x00000003, - WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF -} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPURequestDeviceStatus { - WGPURequestDeviceStatus_Success = 0x00000000, - WGPURequestDeviceStatus_Error = 0x00000001, - WGPURequestDeviceStatus_Unknown = 0x00000002, - WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF -} WGPURequestDeviceStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUSType { - WGPUSType_Invalid = 0x00000000, - WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, - WGPUSType_ShaderModuleSPIRVDescriptor = 0x00000005, - WGPUSType_ShaderModuleWGSLDescriptor = 0x00000006, - WGPUSType_PrimitiveDepthClipControl = 0x00000007, - WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, - WGPUSType_TextureBindingViewDimensionDescriptor = 0x00000011, - WGPUSType_Force32 = 0x7FFFFFFF -} WGPUSType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUSamplerBindingType { - WGPUSamplerBindingType_Undefined = 0x00000000, - WGPUSamplerBindingType_Filtering = 0x00000001, - WGPUSamplerBindingType_NonFiltering = 0x00000002, - WGPUSamplerBindingType_Comparison = 0x00000003, - WGPUSamplerBindingType_Force32 = 0x7FFFFFFF -} WGPUSamplerBindingType WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUStencilOperation { - WGPUStencilOperation_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 WGPUSurfaceGetCurrentTextureStatus { - WGPUSurfaceGetCurrentTextureStatus_Success = 0x00000000, - WGPUSurfaceGetCurrentTextureStatus_Timeout = 0x00000001, - WGPUSurfaceGetCurrentTextureStatus_Outdated = 0x00000002, - WGPUSurfaceGetCurrentTextureStatus_Lost = 0x00000003, - WGPUSurfaceGetCurrentTextureStatus_OutOfMemory = 0x00000004, - WGPUSurfaceGetCurrentTextureStatus_DeviceLost = 0x00000005, - WGPUSurfaceGetCurrentTextureStatus_Force32 = 0x7FFFFFFF -} WGPUSurfaceGetCurrentTextureStatus WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureAspect { - WGPUTextureAspect_Undefined = 0x00000000, - WGPUTextureAspect_All = 0x00000001, - WGPUTextureAspect_StencilOnly = 0x00000002, - WGPUTextureAspect_DepthOnly = 0x00000003, - 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_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 WGPUMapMode { - WGPUMapMode_None = 0x00000000, - WGPUMapMode_Read = 0x00000001, - WGPUMapMode_Write = 0x00000002, - WGPUMapMode_Force32 = 0x7FFFFFFF -} WGPUMapMode WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUMapModeFlags WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUShaderStage { - WGPUShaderStage_None = 0x00000000, - WGPUShaderStage_Vertex = 0x00000001, - WGPUShaderStage_Fragment = 0x00000002, - WGPUShaderStage_Compute = 0x00000004, - WGPUShaderStage_Force32 = 0x7FFFFFFF -} WGPUShaderStage WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUShaderStageFlags WGPU_ENUM_ATTRIBUTE; - -typedef enum WGPUTextureUsage { - WGPUTextureUsage_None = 0x00000000, - WGPUTextureUsage_CopySrc = 0x00000001, - WGPUTextureUsage_CopyDst = 0x00000002, - WGPUTextureUsage_TextureBinding = 0x00000004, - WGPUTextureUsage_StorageBinding = 0x00000008, - WGPUTextureUsage_RenderAttachment = 0x00000010, - WGPUTextureUsage_Force32 = 0x7FFFFFFF -} WGPUTextureUsage WGPU_ENUM_ATTRIBUTE; -typedef WGPUFlags WGPUTextureUsageFlags WGPU_ENUM_ATTRIBUTE; - -typedef void (*WGPUBufferMapCallback)(WGPUBufferMapAsyncStatus status, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, struct WGPUCompilationInfo const * compilationInfo, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUDeviceLostCallback)(WGPUDeviceLostReason reason, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUErrorCallback)(WGPUErrorType type, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProc)(void) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata) WGPU_FUNCTION_ATTRIBUTE; - -typedef struct WGPUChainedStruct { - struct WGPUChainedStruct const * next; - WGPUSType sType; -} WGPUChainedStruct WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUChainedStructOut { - struct WGPUChainedStructOut * next; - WGPUSType sType; -} WGPUChainedStructOut WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUAdapterInfo { - WGPUChainedStructOut * nextInChain; - char const * vendor; - char const * architecture; - char const * device; - char const * description; - WGPUBackendType backendType; - WGPUAdapterType adapterType; - uint32_t vendorID; - uint32_t deviceID; -} WGPUAdapterInfo 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; - -typedef struct WGPUBindGroupEntry { - WGPUChainedStruct const * nextInChain; - uint32_t binding; - WGPU_NULLABLE WGPUBuffer buffer; - uint64_t offset; - uint64_t size; - WGPU_NULLABLE WGPUSampler sampler; - WGPU_NULLABLE WGPUTextureView textureView; -} WGPUBindGroupEntry WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBlendComponent { - WGPUBlendOperation operation; - WGPUBlendFactor srcFactor; - WGPUBlendFactor dstFactor; -} WGPUBlendComponent WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBufferBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUBufferBindingType type; - WGPUBool hasDynamicOffset; - uint64_t minBindingSize; -} WGPUBufferBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBufferDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUBufferUsageFlags usage; - uint64_t size; - WGPUBool mappedAtCreation; -} WGPUBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct 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 WGPUCompilationMessage { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * message; - WGPUCompilationMessageType type; - uint64_t lineNum; - uint64_t linePos; - uint64_t offset; - uint64_t length; - uint64_t utf16LinePos; - uint64_t utf16Offset; - uint64_t utf16Length; -} WGPUCompilationMessage WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUComputePassTimestampWrites { - WGPUQuerySet querySet; - uint32_t beginningOfPassWriteIndex; - uint32_t endOfPassWriteIndex; -} WGPUComputePassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUConstantEntry { - WGPUChainedStruct const * nextInChain; - char const * key; - double value; -} WGPUConstantEntry WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUExtent3D { - uint32_t width; - uint32_t height; - uint32_t depthOrArrayLayers; -} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct 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 WGPUMultisampleState { - WGPUChainedStruct const * nextInChain; - uint32_t count; - uint32_t mask; - WGPUBool alphaToCoverageEnabled; -} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUOrigin3D { - uint32_t x; - uint32_t y; - uint32_t z; -} WGPUOrigin3D WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUPipelineLayoutDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t bindGroupLayoutCount; - WGPUBindGroupLayout const * bindGroupLayouts; -} WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUPrimitiveState -typedef struct WGPUPrimitiveDepthClipControl { - WGPUChainedStruct chain; - WGPUBool unclippedDepth; -} WGPUPrimitiveDepthClipControl WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUPrimitiveState { - WGPUChainedStruct const * nextInChain; - WGPUPrimitiveTopology topology; - WGPUIndexFormat stripIndexFormat; - WGPUFrontFace frontFace; - WGPUCullMode cullMode; -} WGPUPrimitiveState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUQuerySetDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUQueryType type; - uint32_t count; -} WGPUQuerySetDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUQueueDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPUQueueDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct 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 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 WGPUStencilFaceState { - WGPUCompareFunction compare; - WGPUStencilOperation failOp; - WGPUStencilOperation depthFailOp; - WGPUStencilOperation passOp; -} WGPUStencilFaceState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUStorageTextureBindingLayout { - WGPUChainedStruct const * nextInChain; - WGPUStorageTextureAccess access; - WGPUTextureFormat format; - WGPUTextureViewDimension viewDimension; -} WGPUStorageTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceCapabilities { - WGPUChainedStructOut * nextInChain; - size_t formatCount; - WGPUTextureFormat const * formats; - size_t presentModeCount; - WGPUPresentMode const * presentModes; - size_t alphaModeCount; - WGPUCompositeAlphaMode const * alphaModes; -} WGPUSurfaceCapabilities WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceConfiguration { - WGPUChainedStruct const * nextInChain; - WGPUDevice device; - WGPUTextureFormat format; - WGPUTextureUsageFlags usage; - size_t viewFormatCount; - WGPUTextureFormat const * viewFormats; - WGPUCompositeAlphaMode alphaMode; - uint32_t width; - uint32_t height; - WGPUPresentMode presentMode; -} WGPUSurfaceConfiguration WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; -} WGPUSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -// Can be chained in WGPUSurfaceDescriptor -typedef struct WGPUSurfaceDescriptorFromCanvasHTMLSelector { - WGPUChainedStruct chain; - char const * selector; -} WGPUSurfaceDescriptorFromCanvasHTMLSelector WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSurfaceTexture { - WGPUTexture texture; - WGPUBool suboptimal; - WGPUSurfaceGetCurrentTextureStatus status; -} WGPUSurfaceTexture 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; - -typedef struct WGPUBindGroupDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUBindGroupLayout layout; - size_t entryCount; - WGPUBindGroupEntry const * entries; -} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBindGroupLayoutEntry { - WGPUChainedStruct const * nextInChain; - uint32_t binding; - WGPUShaderStageFlags visibility; - WGPUBufferBindingLayout buffer; - WGPUSamplerBindingLayout sampler; - WGPUTextureBindingLayout texture; - WGPUStorageTextureBindingLayout storageTexture; -} WGPUBindGroupLayoutEntry WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBlendState { - WGPUBlendComponent color; - WGPUBlendComponent alpha; -} WGPUBlendState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUCompilationInfo { - WGPUChainedStruct const * nextInChain; - size_t messageCount; - WGPUCompilationMessage const * messages; -} WGPUCompilationInfo WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUComputePassDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPU_NULLABLE WGPUComputePassTimestampWrites const * timestampWrites; -} WGPUComputePassDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUDepthStencilState { - WGPUChainedStruct const * nextInChain; - WGPUTextureFormat format; - WGPUBool depthWriteEnabled; - WGPUCompareFunction depthCompare; - WGPUStencilFaceState stencilFront; - WGPUStencilFaceState stencilBack; - uint32_t stencilReadMask; - uint32_t stencilWriteMask; - int32_t depthBias; - float depthBiasSlopeScale; - float depthBiasClamp; -} WGPUDepthStencilState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct 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 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; - -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 WGPURequiredLimits { - WGPUChainedStruct const * nextInChain; - WGPULimits limits; -} WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSupportedLimits { - WGPUChainedStructOut * nextInChain; - WGPULimits limits; -} WGPUSupportedLimits WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUTextureDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPUTextureUsageFlags usage; - WGPUTextureDimension dimension; - WGPUExtent3D size; - WGPUTextureFormat format; - uint32_t mipLevelCount; - uint32_t sampleCount; - size_t viewFormatCount; - WGPUTextureFormat const * viewFormats; -} WGPUTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUVertexBufferLayout { - uint64_t arrayStride; - WGPUVertexStepMode stepMode; - size_t attributeCount; - WGPUVertexAttribute const * attributes; -} WGPUVertexBufferLayout WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUBindGroupLayoutDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t entryCount; - WGPUBindGroupLayoutEntry const * entries; -} WGPUBindGroupLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUColorTargetState { - WGPUChainedStruct const * nextInChain; - WGPUTextureFormat format; - WGPU_NULLABLE WGPUBlendState const * blend; - WGPUColorWriteMaskFlags writeMask; -} WGPUColorTargetState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUComputePipelineDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPU_NULLABLE WGPUPipelineLayout layout; - WGPUProgrammableStageDescriptor compute; -} WGPUComputePipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUDeviceDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t requiredFeatureCount; - WGPUFeatureName const * requiredFeatures; - WGPU_NULLABLE WGPURequiredLimits const * requiredLimits; - WGPUQueueDescriptor defaultQueue; - WGPUDeviceLostCallback deviceLostCallback; - void * deviceLostUserdata; -} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPassDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - size_t colorAttachmentCount; - WGPURenderPassColorAttachment const * colorAttachments; - WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; - WGPU_NULLABLE WGPUQuerySet occlusionQuerySet; - WGPU_NULLABLE WGPURenderPassTimestampWrites const * timestampWrites; -} WGPURenderPassDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUVertexState { - WGPUChainedStruct const * nextInChain; - WGPUShaderModule module; - WGPU_NULLABLE char const * entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; - size_t bufferCount; - WGPUVertexBufferLayout const * buffers; -} WGPUVertexState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUFragmentState { - WGPUChainedStruct const * nextInChain; - WGPUShaderModule module; - WGPU_NULLABLE char const * entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; - size_t targetCount; - WGPUColorTargetState const * targets; -} WGPUFragmentState WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPURenderPipelineDescriptor { - WGPUChainedStruct const * nextInChain; - WGPU_NULLABLE char const * label; - WGPU_NULLABLE WGPUPipelineLayout layout; - WGPUVertexState vertex; - WGPUPrimitiveState primitive; - WGPU_NULLABLE WGPUDepthStencilState const * depthStencil; - WGPUMultisampleState multisample; - WGPU_NULLABLE WGPUFragmentState const * fragment; -} WGPURenderPipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(WGPU_SKIP_PROCS) - -typedef void (*WGPUProcAdapterInfoFreeMembers)(WGPUAdapterInfo value) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterPropertiesFreeMembers)(WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUInstance (*WGPUProcCreateInstance)(WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcGetInstanceFeatures)(WGPUInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceCapabilitiesFreeMembers)(WGPUSurfaceCapabilities value) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Adapter -typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterGetInfo)(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter adapter, WGPUAdapterProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterRequestDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterReference)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of BindGroup -typedef void (*WGPUProcBindGroupSetLabel)(WGPUBindGroup bindGroup, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupReference)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of BindGroupLayout -typedef void (*WGPUProcBindGroupLayoutSetLabel)(WGPUBindGroupLayout bindGroupLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupLayoutReference)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Buffer -typedef void (*WGPUProcBufferDestroy)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void const * (*WGPUProcBufferGetConstMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBufferMapState (*WGPUProcBufferGetMapState)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void * (*WGPUProcBufferGetMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef uint64_t (*WGPUProcBufferGetSize)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBufferUsageFlags (*WGPUProcBufferGetUsage)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferMapAsync)(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer buffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferUnmap)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferReference)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcBufferRelease)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of CommandBuffer -typedef void (*WGPUProcCommandBufferSetLabel)(WGPUCommandBuffer commandBuffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandBufferReference)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of CommandEncoder -typedef WGPUComputePassEncoder (*WGPUProcCommandEncoderBeginComputePass)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderPassEncoder (*WGPUProcCommandEncoderBeginRenderPass)(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderClearBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder commandEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder commandEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderSetLabel)(WGPUCommandEncoder commandEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderReference)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcCommandEncoderRelease)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of ComputePassEncoder -typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderInsertDebugMarker)(WGPUComputePassEncoder computePassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderSetLabel)(WGPUComputePassEncoder computePassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*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 WGPUPipelineLayout (*WGPUProcDeviceCreatePipelineLayout)(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQuerySet (*WGPUProcDeviceCreateQuerySet)(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderBundleEncoder (*WGPUProcDeviceCreateRenderBundleEncoder)(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceCreateRenderPipelineAsync)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUSampler (*WGPUProcDeviceCreateSampler)(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef 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 WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceReference)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Instance -typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef 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 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 (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueSetLabel)(WGPUQueue queue, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueSubmit)(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueReference)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcQueueRelease)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderBundle -typedef void (*WGPUProcRenderBundleSetLabel)(WGPURenderBundle renderBundle, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleReference)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderBundleEncoder -typedef void (*WGPUProcRenderBundleEncoderDraw)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderDrawIndexed)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderDrawIndexedIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderDrawIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderInsertDebugMarker)(WGPURenderBundleEncoder renderBundleEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderPopDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderPushDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetLabel)(WGPURenderBundleEncoder renderBundleEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderReference)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderBundleEncoderRelease)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of RenderPassEncoder -typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDraw)(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDrawIndexed)(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderEnd)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderEndOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderExecuteBundles)(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderInsertDebugMarker)(WGPURenderPassEncoder renderPassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderPopDebugGroup)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderPushDebugGroup)(WGPURenderPassEncoder renderPassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetBindGroup)(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetBlendConstant)(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetIndexBuffer)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetLabel)(WGPURenderPassEncoder renderPassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetPipeline)(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*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 void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, char const * label) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcShaderModuleReference)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of Surface -typedef void (*WGPUProcSurfaceConfigure)(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceGetCapabilities)(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceGetCurrentTexture)(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE; -typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfacePresent)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceUnconfigure)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; - -// Procs of 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 (*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 wgpuAdapterInfoFreeMembers(WGPUAdapterInfo value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterPropertiesFreeMembers(WGPUAdapterProperties value) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) 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 wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities value) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Adapter -WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of BindGroup -WGPU_EXPORT void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupReference(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupRelease(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of BindGroupLayout -WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Buffer -WGPU_EXPORT void wgpuBufferDestroy(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void const * wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void * wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint64_t wgpuBufferGetSize(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBufferUsageFlags wgpuBufferGetUsage(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferSetLabel(WGPUBuffer buffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferUnmap(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferReference(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuBufferRelease(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of CommandBuffer -WGPU_EXPORT void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of CommandEncoder -WGPU_EXPORT WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of ComputePassEncoder -WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void 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 WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT 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 WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Instance -WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT 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 void wgpuInstanceReference(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of PipelineLayout -WGPU_EXPORT void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of QuerySet -WGPU_EXPORT void wgpuQuerySetDestroy(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQuerySetSetLabel(WGPUQuerySet querySet, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQuerySetReference(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQuerySetRelease(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Queue -WGPU_EXPORT void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueSetLabel(WGPUQueue queue, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueWriteTexture(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueReference(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuQueueRelease(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderBundle -WGPU_EXPORT void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleReference(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderBundleEncoder -WGPU_EXPORT void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of RenderPassEncoder -WGPU_EXPORT void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, char const * markerLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, char const * groupLabel) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void 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 void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char const * label) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuShaderModuleReference(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of Surface -WGPU_EXPORT void wgpuSurfaceConfigure(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfacePresent(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceUnconfigure(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; - -// Methods of 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 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/system/include/webgpu/webgpu_cpp.h b/system/include/webgpu/webgpu_cpp.h deleted file mode 100644 index 046ee39526e83..0000000000000 --- a/system/include/webgpu/webgpu_cpp.h +++ /dev/null @@ -1,1895 +0,0 @@ -// Copyright 2024 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_CPP_H_ -#define WEBGPU_CPP_H_ - -#include "webgpu/webgpu.h" -#include "webgpu/webgpu_cpp_chained_struct.h" -#include "webgpu/webgpu_enum_class_bitmasks.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, - }; - - 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 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, - }; - - 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, - ValidationError = 0x00000001, - Unknown = 0x00000002, - DeviceLost = 0x00000003, - DestroyedBeforeCallback = 0x00000004, - UnmappedBeforeCallback = 0x00000005, - MappingAlreadyPending = 0x00000006, - OffsetOutOfRange = 0x00000007, - SizeOutOfRange = 0x00000008, - }; - - 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, - Error = 0x00000001, - DeviceLost = 0x00000002, - Unknown = 0x00000003, - }; - - enum class CompilationMessageType : uint32_t { - Error = 0x00000001, - Warning = 0x00000002, - Info = 0x00000003, - }; - - enum class CompositeAlphaMode : uint32_t { - Auto = 0x00000000, - Opaque = 0x00000001, - Premultiplied = 0x00000002, - Unpremultiplied = 0x00000003, - Inherit = 0x00000004, - }; - - enum class CreatePipelineAsyncStatus : uint32_t { - Success = 0x00000000, - ValidationError = 0x00000001, - InternalError = 0x00000002, - DeviceLost = 0x00000003, - DeviceDestroyed = 0x00000004, - Unknown = 0x00000005, - }; - - enum class CullMode : uint32_t { - Undefined = 0x00000000, - None = 0x00000001, - Front = 0x00000002, - Back = 0x00000003, - }; - - enum class DeviceLostReason : uint32_t { - Undefined = 0x00000001, - Unknown = 0x00000001, - Destroyed = 0x00000002, - }; - - 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 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, - }; - - 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 MipmapFilterMode : uint32_t { - Undefined = 0x00000000, - Nearest = 0x00000001, - Linear = 0x00000002, - }; - - 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, - 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, - SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, - ShaderModuleSPIRVDescriptor = 0x00000005, - ShaderModuleWGSLDescriptor = 0x00000006, - PrimitiveDepthClipControl = 0x00000007, - RenderPassDescriptorMaxDrawCount = 0x0000000F, - TextureBindingViewDimensionDescriptor = 0x00000011, - }; - - enum class SamplerBindingType : uint32_t { - Undefined = 0x00000000, - Filtering = 0x00000001, - NonFiltering = 0x00000002, - Comparison = 0x00000003, - }; - - 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 SurfaceGetCurrentTextureStatus : uint32_t { - Success = WGPUSurfaceGetCurrentTextureStatus_Success, - Timeout = WGPUSurfaceGetCurrentTextureStatus_Timeout, - Outdated = WGPUSurfaceGetCurrentTextureStatus_Outdated, - Lost = WGPUSurfaceGetCurrentTextureStatus_Lost, - OutOfMemory = WGPUSurfaceGetCurrentTextureStatus_OutOfMemory, - DeviceLost = WGPUSurfaceGetCurrentTextureStatus_DeviceLost, - }; - - enum class TextureAspect : uint32_t { - Undefined = 0x00000000, - All = 0x00000001, - StencilOnly = 0x00000002, - DepthOnly = 0x00000003, - }; - - 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, - }; - - 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 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, - }; - - - using BufferMapCallback = WGPUBufferMapCallback; - using CompilationInfoCallback = WGPUCompilationInfoCallback; - using CreateComputePipelineAsyncCallback = WGPUCreateComputePipelineAsyncCallback; - using CreateRenderPipelineAsyncCallback = WGPUCreateRenderPipelineAsyncCallback; - using DeviceLostCallback = WGPUDeviceLostCallback; - using ErrorCallback = WGPUErrorCallback; - 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 Instance; - class PipelineLayout; - class QuerySet; - class Queue; - class RenderBundle; - class RenderBundleEncoder; - class RenderPassEncoder; - class RenderPipeline; - class Sampler; - class ShaderModule; - class Surface; - class SwapChain; - class Texture; - class TextureView; - - struct AdapterInfo; - struct AdapterProperties; - struct BindGroupEntry; - struct BlendComponent; - struct BufferBindingLayout; - struct BufferDescriptor; - struct BufferMapCallbackInfo; - struct Color; - struct CommandBufferDescriptor; - struct CommandEncoderDescriptor; - struct CompilationMessage; - struct ComputePassTimestampWrites; - struct ConstantEntry; - struct Extent3D; - struct Future; - struct InstanceFeatures; - struct Limits; - struct MultisampleState; - struct Origin3D; - struct PipelineLayoutDescriptor; - 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 StencilFaceState; - struct StorageTextureBindingLayout; - struct SurfaceCapabilities; - struct SurfaceConfiguration; - struct SurfaceDescriptor; - struct SurfaceDescriptorFromCanvasHTMLSelector; - struct SurfaceTexture; - struct SwapChainDescriptor; - struct TextureBindingLayout; - struct TextureBindingViewDimensionDescriptor; - struct TextureDataLayout; - struct TextureViewDescriptor; - struct VertexAttribute; - struct BindGroupDescriptor; - struct BindGroupLayoutEntry; - struct BlendState; - struct CompilationInfo; - struct ComputePassDescriptor; - struct DepthStencilState; - struct FutureWaitInfo; - struct ImageCopyBuffer; - struct ImageCopyTexture; - struct InstanceDescriptor; - struct ProgrammableStageDescriptor; - struct RenderPassColorAttachment; - struct RequiredLimits; - struct SupportedLimits; - struct TextureDescriptor; - struct VertexBufferLayout; - struct BindGroupLayoutDescriptor; - struct ColorTargetState; - struct ComputePipelineDescriptor; - struct DeviceDescriptor; - struct RenderPassDescriptor; - 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=; - - size_t EnumerateFeatures(FeatureName * features) const; - void GetInfo(AdapterInfo * info) 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; - 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 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 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; - 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; - Bool GetLimits(SupportedLimits * limits) const; - Queue GetQueue() const; - Bool HasFeature(FeatureName feature) const; - void PopErrorScope(ErrorCallback callback, void * userdata) const; - void PushErrorScope(ErrorFilter filter) const; - void SetLabel(char const * label) const; - void SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const; - - private: - friend ObjectBase; - static void WGPUReference(WGPUDevice handle); - static void WGPURelease(WGPUDevice handle); - }; - - class Instance : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - Surface CreateSurface(SurfaceDescriptor const * descriptor) const; - Bool HasWGSLLanguageFeature(WGSLFeatureName feature) const; - void ProcessEvents() const; - void RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallback callback, void * userdata) 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 OnSubmittedWorkDone(QueueWorkDoneCallback callback, void * userdata) 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 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 Surface : public ObjectBase { - public: - using ObjectBase::ObjectBase; - using ObjectBase::operator=; - - void Configure(SurfaceConfiguration const * config) const; - void GetCapabilities(Adapter const& adapter, SurfaceCapabilities * capabilities) const; - void GetCurrentTexture(SurfaceTexture * surfaceTexture) const; - TextureFormat GetPreferredFormat(Adapter const& adapter) const; - void Present() const; - void Unconfigure() 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 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 AdapterInfo { - AdapterInfo() = default; - ~AdapterInfo(); - AdapterInfo(const AdapterInfo&) = delete; - AdapterInfo& operator=(const AdapterInfo&) = delete; - AdapterInfo(AdapterInfo&&); - AdapterInfo& operator=(AdapterInfo&&); - ChainedStructOut * nextInChain = nullptr; - char const * const vendor = nullptr; - char const * const architecture = nullptr; - char const * const device = nullptr; - char const * const description = nullptr; - BackendType const backendType = {}; - AdapterType const adapterType = {}; - uint32_t const vendorID = {}; - uint32_t const deviceID = {}; - }; - - 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 = 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; - }; - - 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 Extent3D { - uint32_t width; - uint32_t height = 1; - uint32_t depthOrArrayLayers = 1; - }; - - 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 MultisampleState { - ChainedStruct const * nextInChain = nullptr; - uint32_t count = 1; - uint32_t mask = 0xFFFFFFFF; - Bool alphaToCoverageEnabled = false; - }; - - 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; - }; - - // 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 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 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 SurfaceCapabilities { - SurfaceCapabilities() = default; - ~SurfaceCapabilities(); - SurfaceCapabilities(const SurfaceCapabilities&) = delete; - SurfaceCapabilities& operator=(const SurfaceCapabilities&) = delete; - SurfaceCapabilities(SurfaceCapabilities&&); - SurfaceCapabilities& operator=(SurfaceCapabilities&&); - ChainedStructOut * nextInChain = nullptr; - size_t const formatCount = {}; - TextureFormat const * const formats = {}; - size_t const presentModeCount = {}; - PresentMode const * const presentModes = {}; - size_t const alphaModeCount = {}; - CompositeAlphaMode const * const alphaModes = {}; - }; - - struct SurfaceConfiguration { - ChainedStruct const * nextInChain = nullptr; - Device device; - TextureFormat format; - TextureUsage usage = TextureUsage::RenderAttachment; - size_t viewFormatCount = 0; - TextureFormat const * viewFormats; - CompositeAlphaMode alphaMode = CompositeAlphaMode::Auto; - uint32_t width; - uint32_t height; - PresentMode presentMode = PresentMode::Fifo; - }; - - struct SurfaceDescriptor { - ChainedStruct const * nextInChain = nullptr; - char const * label = nullptr; - }; - - // 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; - }; - - struct SurfaceTexture { - Texture texture; - Bool suboptimal; - SurfaceGetCurrentTextureStatus status; - }; - - 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; - }; - - 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 FutureWaitInfo { - Future future; - Bool completed = false; - }; - - struct ImageCopyBuffer { - ChainedStruct const * nextInChain = nullptr; - TextureDataLayout layout; - Buffer buffer; - }; - - 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; - }; - - 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 RequiredLimits { - ChainedStruct const * nextInChain = nullptr; - Limits limits; - }; - - 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; - }; - - 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; - }; - -} // 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); - } -}; -} // namespace std - -#endif // WEBGPU_CPP_H_ diff --git a/system/include/webgpu/webgpu_cpp_chained_struct.h b/system/include/webgpu/webgpu_cpp_chained_struct.h deleted file mode 100644 index bb3a1be124fcc..0000000000000 --- a/system/include/webgpu/webgpu_cpp_chained_struct.h +++ /dev/null @@ -1,26 +0,0 @@ -#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/system/include/webgpu/webgpu_enum_class_bitmasks.h b/system/include/webgpu/webgpu_enum_class_bitmasks.h deleted file mode 100644 index e98c8c5da066c..0000000000000 --- a/system/include/webgpu/webgpu_enum_class_bitmasks.h +++ /dev/null @@ -1,161 +0,0 @@ -// 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/system/lib/webgpu/README.md b/system/lib/webgpu/README.md deleted file mode 100644 index 870814b414d51..0000000000000 --- a/system/lib/webgpu/README.md +++ /dev/null @@ -1,2 +0,0 @@ -These files are generated by Dawn (Chromium's WebGPU library). -See [`system/include/webgpu/`](../../include/webgpu/) for info. diff --git a/system/lib/webgpu/webgpu.cpp b/system/lib/webgpu/webgpu.cpp deleted file mode 100644 index e65fbe2d5bbce..0000000000000 --- a/system/lib/webgpu/webgpu.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2024 The Emscripten Authors. All rights reserved. -// Emscripten is available under two separate licenses, the MIT license and the -// University of Illinois/NCSA Open Source License. Both these licenses can be -// found in the LICENSE file. - -// -// This file and library_webgpu.js together implement . -// - -#include - -#include -#include -#include - -// -// WebGPU function definitions, with methods organized by "class". Note these -// don't need to be extern "C" because they are already declared in webgpu.h. -// - -// Standalone (non-method) functions - -WGPUInstance wgpuCreateInstance(const WGPUInstanceDescriptor* descriptor) { - assert(descriptor == nullptr); // descriptor not implemented yet - return reinterpret_cast(1); -} - -// Instance - -void wgpuInstanceReference(WGPUInstance) { /* no-op for now */ } -void wgpuInstanceRelease(WGPUInstance) { /* no-op for now */ } - -// WGPUSurface - -void wgpuSurfaceGetCapabilities(WGPUSurface surface, - WGPUAdapter adapter, - WGPUSurfaceCapabilities* capabilities) { - assert(capabilities->nextInChain == nullptr); // TODO: Return WGPUStatus_Error - - static constexpr std::array kSurfaceFormatsRGBAFirst = { - WGPUTextureFormat_RGBA8Unorm, - WGPUTextureFormat_BGRA8Unorm, - WGPUTextureFormat_RGBA16Float, - }; - static constexpr std::array kSurfaceFormatsBGRAFirst = { - WGPUTextureFormat_BGRA8Unorm, - WGPUTextureFormat_RGBA8Unorm, - WGPUTextureFormat_RGBA16Float, - }; - WGPUTextureFormat preferredFormat = wgpuSurfaceGetPreferredFormat(surface, adapter); - switch (preferredFormat) { - case WGPUTextureFormat_RGBA8Unorm: - capabilities->formatCount = kSurfaceFormatsRGBAFirst.size(); - capabilities->formats = kSurfaceFormatsRGBAFirst.data(); - break; - case WGPUTextureFormat_BGRA8Unorm: - capabilities->formatCount = kSurfaceFormatsBGRAFirst.size(); - capabilities->formats = kSurfaceFormatsBGRAFirst.data(); - break; - default: - assert(false); - } - - { - static constexpr WGPUPresentMode kPresentMode = WGPUPresentMode_Fifo; - capabilities->presentModeCount = 1; - capabilities->presentModes = &kPresentMode; - } - - { - static constexpr std::array kAlphaModes = { - WGPUCompositeAlphaMode_Opaque, - WGPUCompositeAlphaMode_Premultiplied, - }; - capabilities->alphaModeCount = kAlphaModes.size(); - capabilities->alphaModes = kAlphaModes.data(); - } -}; - -// WGPUSurfaceCapabilities - -void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities value) { - // wgpuSurfaceCapabilities doesn't currently allocate anything. -} - -// WGPUAdapterInfo - -void wgpuAdapterInfoFreeMembers(WGPUAdapterInfo value) { - free(const_cast(value.vendor)); - free(const_cast(value.architecture)); - free(const_cast(value.device)); - free(const_cast(value.description)); -} diff --git a/system/lib/webgpu/webgpu_cpp.cpp b/system/lib/webgpu/webgpu_cpp.cpp deleted file mode 100644 index 19c1d74cb16d6..0000000000000 --- a/system/lib/webgpu/webgpu_cpp.cpp +++ /dev/null @@ -1,2916 +0,0 @@ -// Copyright 2024 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. - -#include - -#include "webgpu/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"); - - // 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"); - - // 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"); - - // 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::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::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"); - - // CompositeAlphaMode - - static_assert(sizeof(CompositeAlphaMode) == sizeof(WGPUCompositeAlphaMode), "sizeof mismatch for CompositeAlphaMode"); - static_assert(alignof(CompositeAlphaMode) == alignof(WGPUCompositeAlphaMode), "alignof mismatch for CompositeAlphaMode"); - - static_assert(static_cast(CompositeAlphaMode::Auto) == WGPUCompositeAlphaMode_Auto, "value mismatch for CompositeAlphaMode::Auto"); - static_assert(static_cast(CompositeAlphaMode::Opaque) == WGPUCompositeAlphaMode_Opaque, "value mismatch for CompositeAlphaMode::Opaque"); - static_assert(static_cast(CompositeAlphaMode::Premultiplied) == WGPUCompositeAlphaMode_Premultiplied, "value mismatch for CompositeAlphaMode::Premultiplied"); - static_assert(static_cast(CompositeAlphaMode::Unpremultiplied) == WGPUCompositeAlphaMode_Unpremultiplied, "value mismatch for CompositeAlphaMode::Unpremultiplied"); - static_assert(static_cast(CompositeAlphaMode::Inherit) == WGPUCompositeAlphaMode_Inherit, "value mismatch for CompositeAlphaMode::Inherit"); - - // 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::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::Unknown) == WGPUDeviceLostReason_Unknown, "value mismatch for DeviceLostReason::Unknown"); - 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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::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::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::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::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::RenderPassDescriptorMaxDrawCount) == WGPUSType_RenderPassDescriptorMaxDrawCount, "value mismatch for SType::RenderPassDescriptorMaxDrawCount"); - static_assert(static_cast(SType::TextureBindingViewDimensionDescriptor) == WGPUSType_TextureBindingViewDimensionDescriptor, "value mismatch for SType::TextureBindingViewDimensionDescriptor"); - - // 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"); - - // 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"); - - // SurfaceGetCurrentTextureStatus - - static_assert(sizeof(SurfaceGetCurrentTextureStatus) == sizeof(WGPUSurfaceGetCurrentTextureStatus), "sizeof mismatch for SurfaceGetCurrentTextureStatus"); - static_assert(alignof(SurfaceGetCurrentTextureStatus) == alignof(WGPUSurfaceGetCurrentTextureStatus), "alignof mismatch for SurfaceGetCurrentTextureStatus"); - - static_assert(static_cast(SurfaceGetCurrentTextureStatus::Success) == WGPUSurfaceGetCurrentTextureStatus_Success, "value mismatch for SurfaceGetCurrentTextureStatus::Success"); - static_assert(static_cast(SurfaceGetCurrentTextureStatus::Timeout) == WGPUSurfaceGetCurrentTextureStatus_Timeout, "value mismatch for SurfaceGetCurrentTextureStatus::Timeout"); - static_assert(static_cast(SurfaceGetCurrentTextureStatus::Outdated) == WGPUSurfaceGetCurrentTextureStatus_Outdated, "value mismatch for SurfaceGetCurrentTextureStatus::Outdated"); - static_assert(static_cast(SurfaceGetCurrentTextureStatus::Lost) == WGPUSurfaceGetCurrentTextureStatus_Lost, "value mismatch for SurfaceGetCurrentTextureStatus::Lost"); - static_assert(static_cast(SurfaceGetCurrentTextureStatus::OutOfMemory) == WGPUSurfaceGetCurrentTextureStatus_OutOfMemory, "value mismatch for SurfaceGetCurrentTextureStatus::OutOfMemory"); - static_assert(static_cast(SurfaceGetCurrentTextureStatus::DeviceLost) == WGPUSurfaceGetCurrentTextureStatus_DeviceLost, "value mismatch for SurfaceGetCurrentTextureStatus::DeviceLost"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // AdapterInfo - - static_assert(sizeof(AdapterInfo) == sizeof(WGPUAdapterInfo), "sizeof mismatch for AdapterInfo"); - static_assert(alignof(AdapterInfo) == alignof(WGPUAdapterInfo), "alignof mismatch for AdapterInfo"); - - static_assert(offsetof(AdapterInfo, nextInChain) == offsetof(WGPUAdapterInfo, nextInChain), - "offsetof mismatch for AdapterInfo::nextInChain"); - static_assert(offsetof(AdapterInfo, vendor) == offsetof(WGPUAdapterInfo, vendor), - "offsetof mismatch for AdapterInfo::vendor"); - static_assert(offsetof(AdapterInfo, architecture) == offsetof(WGPUAdapterInfo, architecture), - "offsetof mismatch for AdapterInfo::architecture"); - static_assert(offsetof(AdapterInfo, device) == offsetof(WGPUAdapterInfo, device), - "offsetof mismatch for AdapterInfo::device"); - static_assert(offsetof(AdapterInfo, description) == offsetof(WGPUAdapterInfo, description), - "offsetof mismatch for AdapterInfo::description"); - static_assert(offsetof(AdapterInfo, backendType) == offsetof(WGPUAdapterInfo, backendType), - "offsetof mismatch for AdapterInfo::backendType"); - static_assert(offsetof(AdapterInfo, adapterType) == offsetof(WGPUAdapterInfo, adapterType), - "offsetof mismatch for AdapterInfo::adapterType"); - static_assert(offsetof(AdapterInfo, vendorID) == offsetof(WGPUAdapterInfo, vendorID), - "offsetof mismatch for AdapterInfo::vendorID"); - static_assert(offsetof(AdapterInfo, deviceID) == offsetof(WGPUAdapterInfo, deviceID), - "offsetof mismatch for AdapterInfo::deviceID"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - -template - static T& AsNonConstReference(const T& value) { - return const_cast(value); - } - - // SurfaceCapabilities - SurfaceCapabilities::~SurfaceCapabilities() { - if (this->formats != nullptr || this->presentModes != nullptr || this->alphaModes != nullptr) { - wgpuSurfaceCapabilitiesFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(SurfaceCapabilities& value) { - SurfaceCapabilities defaultValue{}; - AsNonConstReference(value.formatCount) = defaultValue.formatCount; - AsNonConstReference(value.formats) = defaultValue.formats; - AsNonConstReference(value.presentModeCount) = defaultValue.presentModeCount; - AsNonConstReference(value.presentModes) = defaultValue.presentModes; - AsNonConstReference(value.alphaModeCount) = defaultValue.alphaModeCount; - AsNonConstReference(value.alphaModes) = defaultValue.alphaModes; - } - - SurfaceCapabilities::SurfaceCapabilities(SurfaceCapabilities&& rhs) - : formatCount(rhs.formatCount), - formats(rhs.formats), - presentModeCount(rhs.presentModeCount), - presentModes(rhs.presentModes), - alphaModeCount(rhs.alphaModeCount), - alphaModes(rhs.alphaModes){ - Reset(rhs); - } - - SurfaceCapabilities& SurfaceCapabilities::operator=(SurfaceCapabilities&& rhs) { - if (&rhs == this) { - return *this; - } - this->~SurfaceCapabilities(); - AsNonConstReference(this->formatCount) = std::move(rhs.formatCount); - AsNonConstReference(this->formats) = std::move(rhs.formats); - AsNonConstReference(this->presentModeCount) = std::move(rhs.presentModeCount); - AsNonConstReference(this->presentModes) = std::move(rhs.presentModes); - AsNonConstReference(this->alphaModeCount) = std::move(rhs.alphaModeCount); - AsNonConstReference(this->alphaModes) = std::move(rhs.alphaModes); - Reset(rhs); - return *this; - } - - static_assert(sizeof(SurfaceCapabilities) == sizeof(WGPUSurfaceCapabilities), "sizeof mismatch for SurfaceCapabilities"); - static_assert(alignof(SurfaceCapabilities) == alignof(WGPUSurfaceCapabilities), "alignof mismatch for SurfaceCapabilities"); - static_assert(offsetof(SurfaceCapabilities, nextInChain) == offsetof(WGPUSurfaceCapabilities, nextInChain), - "offsetof mismatch for SurfaceCapabilities::nextInChain"); - static_assert(offsetof(SurfaceCapabilities, formatCount) == offsetof(WGPUSurfaceCapabilities, formatCount), - "offsetof mismatch for SurfaceCapabilities::formatCount"); - static_assert(offsetof(SurfaceCapabilities, formats) == offsetof(WGPUSurfaceCapabilities, formats), - "offsetof mismatch for SurfaceCapabilities::formats"); - static_assert(offsetof(SurfaceCapabilities, presentModeCount) == offsetof(WGPUSurfaceCapabilities, presentModeCount), - "offsetof mismatch for SurfaceCapabilities::presentModeCount"); - static_assert(offsetof(SurfaceCapabilities, presentModes) == offsetof(WGPUSurfaceCapabilities, presentModes), - "offsetof mismatch for SurfaceCapabilities::presentModes"); - static_assert(offsetof(SurfaceCapabilities, alphaModeCount) == offsetof(WGPUSurfaceCapabilities, alphaModeCount), - "offsetof mismatch for SurfaceCapabilities::alphaModeCount"); - static_assert(offsetof(SurfaceCapabilities, alphaModes) == offsetof(WGPUSurfaceCapabilities, alphaModes), - "offsetof mismatch for SurfaceCapabilities::alphaModes"); - - // SurfaceConfiguration - - static_assert(sizeof(SurfaceConfiguration) == sizeof(WGPUSurfaceConfiguration), "sizeof mismatch for SurfaceConfiguration"); - static_assert(alignof(SurfaceConfiguration) == alignof(WGPUSurfaceConfiguration), "alignof mismatch for SurfaceConfiguration"); - static_assert(offsetof(SurfaceConfiguration, nextInChain) == offsetof(WGPUSurfaceConfiguration, nextInChain), - "offsetof mismatch for SurfaceConfiguration::nextInChain"); - static_assert(offsetof(SurfaceConfiguration, device) == offsetof(WGPUSurfaceConfiguration, device), - "offsetof mismatch for SurfaceConfiguration::device"); - static_assert(offsetof(SurfaceConfiguration, format) == offsetof(WGPUSurfaceConfiguration, format), - "offsetof mismatch for SurfaceConfiguration::format"); - static_assert(offsetof(SurfaceConfiguration, usage) == offsetof(WGPUSurfaceConfiguration, usage), - "offsetof mismatch for SurfaceConfiguration::usage"); - static_assert(offsetof(SurfaceConfiguration, viewFormatCount) == offsetof(WGPUSurfaceConfiguration, viewFormatCount), - "offsetof mismatch for SurfaceConfiguration::viewFormatCount"); - static_assert(offsetof(SurfaceConfiguration, viewFormats) == offsetof(WGPUSurfaceConfiguration, viewFormats), - "offsetof mismatch for SurfaceConfiguration::viewFormats"); - static_assert(offsetof(SurfaceConfiguration, alphaMode) == offsetof(WGPUSurfaceConfiguration, alphaMode), - "offsetof mismatch for SurfaceConfiguration::alphaMode"); - static_assert(offsetof(SurfaceConfiguration, width) == offsetof(WGPUSurfaceConfiguration, width), - "offsetof mismatch for SurfaceConfiguration::width"); - static_assert(offsetof(SurfaceConfiguration, height) == offsetof(WGPUSurfaceConfiguration, height), - "offsetof mismatch for SurfaceConfiguration::height"); - static_assert(offsetof(SurfaceConfiguration, presentMode) == offsetof(WGPUSurfaceConfiguration, presentMode), - "offsetof mismatch for SurfaceConfiguration::presentMode"); - - // 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"); - - // 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"); - - // SurfaceTexture - - static_assert(sizeof(SurfaceTexture) == sizeof(WGPUSurfaceTexture), "sizeof mismatch for SurfaceTexture"); - static_assert(alignof(SurfaceTexture) == alignof(WGPUSurfaceTexture), "alignof mismatch for SurfaceTexture"); - static_assert(offsetof(SurfaceTexture, texture) == offsetof(WGPUSurfaceTexture, texture), - "offsetof mismatch for SurfaceTexture::texture"); - static_assert(offsetof(SurfaceTexture, suboptimal) == offsetof(WGPUSurfaceTexture, suboptimal), - "offsetof mismatch for SurfaceTexture::suboptimal"); - static_assert(offsetof(SurfaceTexture, status) == offsetof(WGPUSurfaceTexture, status), - "offsetof mismatch for SurfaceTexture::status"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // 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"); - - // AdapterInfo implementation - AdapterInfo::~AdapterInfo() { - if (this->vendor != nullptr || this->architecture != nullptr || this->device != nullptr || this->description != nullptr) { - wgpuAdapterInfoFreeMembers( - *reinterpret_cast(this)); - } - } - - static void Reset(AdapterInfo& value) { - AdapterInfo defaultValue{}; - AsNonConstReference(value.vendor) = defaultValue.vendor; - AsNonConstReference(value.architecture) = defaultValue.architecture; - AsNonConstReference(value.device) = defaultValue.device; - AsNonConstReference(value.description) = defaultValue.description; - AsNonConstReference(value.backendType) = defaultValue.backendType; - AsNonConstReference(value.adapterType) = defaultValue.adapterType; - AsNonConstReference(value.vendorID) = defaultValue.vendorID; - AsNonConstReference(value.deviceID) = defaultValue.deviceID; - } - - AdapterInfo::AdapterInfo(AdapterInfo&& rhs) - : vendor(rhs.vendor), - architecture(rhs.architecture), - device(rhs.device), - description(rhs.description), - backendType(rhs.backendType), - adapterType(rhs.adapterType), - vendorID(rhs.vendorID), - deviceID(rhs.deviceID){ - Reset(rhs); - } - - AdapterInfo& AdapterInfo::operator=(AdapterInfo&& rhs) { - if (&rhs == this) { - return *this; - } - this->~AdapterInfo(); - AsNonConstReference(this->vendor) = std::move(rhs.vendor); - AsNonConstReference(this->architecture) = std::move(rhs.architecture); - AsNonConstReference(this->device) = std::move(rhs.device); - AsNonConstReference(this->description) = std::move(rhs.description); - AsNonConstReference(this->backendType) = std::move(rhs.backendType); - AsNonConstReference(this->adapterType) = std::move(rhs.adapterType); - AsNonConstReference(this->vendorID) = std::move(rhs.vendorID); - AsNonConstReference(this->deviceID) = std::move(rhs.deviceID); - Reset(rhs); - return *this; - } - - // 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; - } - - - - // Adapter - - static_assert(sizeof(Adapter) == sizeof(WGPUAdapter), "sizeof mismatch for Adapter"); - static_assert(alignof(Adapter) == alignof(WGPUAdapter), "alignof mismatch for Adapter"); - - size_t Adapter::EnumerateFeatures(FeatureName * features) const { - auto result = wgpuAdapterEnumerateFeatures(Get(), reinterpret_cast(features)); - return result; - } - void Adapter::GetInfo(AdapterInfo * info) const { - *info = AdapterInfo(); - wgpuAdapterGetInfo(Get(), reinterpret_cast(info)); - } - 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); - } - 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); - } - 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::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::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); - } - 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); - } - 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; - } - 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); - } - Bool Device::HasFeature(FeatureName feature) const { - auto result = wgpuDeviceHasFeature(Get(), static_cast(feature)); - return result; - } - void Device::PopErrorScope(ErrorCallback callback, void * userdata) const { - wgpuDevicePopErrorScope(Get(), callback, userdata); - } - void Device::PushErrorScope(ErrorFilter filter) const { - wgpuDevicePushErrorScope(Get(), static_cast(filter)); - } - void Device::SetLabel(char const * label) const { - wgpuDeviceSetLabel(Get(), reinterpret_cast(label)); - } - void Device::SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const { - wgpuDeviceSetUncapturedErrorCallback(Get(), callback, userdata); - } - void Device::WGPUReference(WGPUDevice handle) { - if (handle != nullptr) { - wgpuDeviceReference(handle); - } - } - void Device::WGPURelease(WGPUDevice handle) { - if (handle != nullptr) { - wgpuDeviceRelease(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); - } - 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); - } - 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::OnSubmittedWorkDone(QueueWorkDoneCallback callback, void * userdata) const { - wgpuQueueOnSubmittedWorkDone(Get(), callback, userdata); - } - 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::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); - } - 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); - } - } - - // Surface - - static_assert(sizeof(Surface) == sizeof(WGPUSurface), "sizeof mismatch for Surface"); - static_assert(alignof(Surface) == alignof(WGPUSurface), "alignof mismatch for Surface"); - - void Surface::Configure(SurfaceConfiguration const * config) const { - wgpuSurfaceConfigure(Get(), reinterpret_cast(config)); - } - void Surface::GetCapabilities(Adapter const& adapter, SurfaceCapabilities * capabilities) const { - *capabilities = SurfaceCapabilities(); - wgpuSurfaceGetCapabilities(Get(), adapter.Get(), reinterpret_cast(capabilities)); - } - void Surface::GetCurrentTexture(SurfaceTexture * surfaceTexture) const { - wgpuSurfaceGetCurrentTexture(Get(), reinterpret_cast(surfaceTexture)); - } - TextureFormat Surface::GetPreferredFormat(Adapter const& adapter) const { - auto result = wgpuSurfaceGetPreferredFormat(Get(), adapter.Get()); - return static_cast(result); - } - void Surface::Present() const { - wgpuSurfacePresent(Get()); - } - void Surface::Unconfigure() const { - wgpuSurfaceUnconfigure(Get()); - } - 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::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/test/test_other.py b/test/test_other.py index 86d4797bfafed..806588e154a5f 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -9299,7 +9299,6 @@ def test_standalone_system_headers(self, prefix): # any errors or warnings. cxx_only = header in [ 'wire.h', 'val.h', 'bind.h', - 'webgpu_cpp.h', 'webgpu_cpp_chained_struct.h', 'webgpu_enum_class_bitmasks.h', # Some headers are not yet C compatible 'arm_neon.h', ] diff --git a/test/test_sanity.py b/test/test_sanity.py index 1fcfae216597e..a7380d709bccf 100644 --- a/test/test_sanity.py +++ b/test/test_sanity.py @@ -759,11 +759,11 @@ def test_embuilder(self): def test_embuilder_wildcards(self): restore_and_set_up() - glob_match = os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libwebgpu*.a') - self.run_process([EMBUILDER, 'clear', 'libwebgpu*']) + glob_match = os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libemmall*.a') + self.run_process([EMBUILDER, 'clear', 'libemmall*']) self.assertFalse(glob.glob(glob_match)) - self.run_process([EMBUILDER, 'build', 'libwebgpu*']) - self.assertGreater(len(glob.glob(glob_match)), 3) + self.run_process([EMBUILDER, 'build', 'libemmall*']) + self.assertEqual(len(glob.glob(glob_match)), 1) def test_embuilder_with_use_port_syntax(self): restore_and_set_up() diff --git a/tools/building.py b/tools/building.py index 69e0fec9f9a69..d1a63c7c5e9c2 100644 --- a/tools/building.py +++ b/tools/building.py @@ -560,9 +560,6 @@ def closure_compiler(filename, advanced=True, extra_closure_args=None): if settings.MODULARIZE and settings.ENVIRONMENT_MAY_BE_WEB and not settings.EXPORT_ES6: CLOSURE_EXTERNS += [path_from_root('src/closure-externs/modularize-externs.js')] - if settings.USE_WEBGPU: - CLOSURE_EXTERNS += [path_from_root('src/closure-externs/webgpu-externs.js')] - # Closure compiler needs to know about all exports that come from the wasm module, because to optimize for small code size, # the exported symbols are added to global scope via a foreach loop in a way that evades Closure's static analysis. With an explicit # externs file for the exports, Closure is able to reason about the exports. diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py index b7adf76d08568..74081adafb29a 100755 --- a/tools/gen_struct_info.py +++ b/tools/gen_struct_info.py @@ -98,7 +98,6 @@ utils.path_from_root('src/struct_info.json'), utils.path_from_root('src/struct_info_internal.json'), utils.path_from_root('src/struct_info_cxx.json'), - utils.path_from_root('src/struct_info_webgpu.json'), ] diff --git a/tools/link.py b/tools/link.py index 7845e22637828..ecde9225c3004 100644 --- a/tools/link.py +++ b/tools/link.py @@ -39,7 +39,7 @@ from .shared import in_temp, safe_copy, do_replace from .shared import DEBUG, WINDOWS, DYLIB_EXTENSIONS from .shared import unsuffixed, unsuffixed_basename, get_file_suffix -from .settings import settings, default_setting, user_settings, JS_ONLY_SETTINGS, DEPRECATED_SETTINGS +from .settings import settings, default_setting, user_settings, JS_ONLY_SETTINGS, DEPRECATED_SETTINGS, REMOVED_SETTINGS from .minimal_runtime_shell import generate_minimal_runtime_html logger = logging.getLogger('link') @@ -799,6 +799,10 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915 if s in user_settings: diagnostics.warning('deprecated', f'{s} is deprecated ({reason}). Please open a bug if you have a continuing need for this setting') + for s, reason in REMOVED_SETTINGS.items(): + if s in user_settings: + raise Exception(f'{s} has been removed ({reason}).') + # Set the EXPORT_ES6 default early since it affects the setting of the # default oformat below. if settings.WASM_ESM_INTEGRATION or settings.SOURCE_PHASE_IMPORTS or settings.MODULARIZE == 'instance': diff --git a/tools/maint/gen_sig_info.py b/tools/maint/gen_sig_info.py index 7d3b3fe4ed28b..1088dc74759b8 100755 --- a/tools/maint/gen_sig_info.py +++ b/tools/maint/gen_sig_info.py @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -100,7 +99,6 @@ #include #include #include -#include ''' % os.path.basename(__file__) cxx_header = '''/* Auto-generated by %s */ @@ -399,7 +397,7 @@ def main(args): extract_sig_info(sig_info, {'LEGACY_GL_EMULATION': 1}, ['-DGLES']) extract_sig_info(sig_info, {'USE_GLFW': 2, 'FULL_ES3': 1, 'MAX_WEBGL_VERSION': 2}) extract_sig_info(sig_info, {'STANDALONE_WASM': 1}) - extract_sig_info(sig_info, {'MAIN_MODULE': 2, 'RELOCATABLE': 1, 'USE_WEBGPU': 1, 'ASYNCIFY': 1}) + extract_sig_info(sig_info, {'MAIN_MODULE': 2, 'RELOCATABLE': 1, 'ASYNCIFY': 1}) write_sig_library(args.output, sig_info) if args.update: diff --git a/tools/settings.py b/tools/settings.py index a5e1c5c332f3e..4691cbb0c2999 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -123,11 +123,14 @@ 'CLOSURE_WARNINGS': 'use -Wclosure/-Wno-closure instead', 'LEGALIZE_JS_FFI': 'to disable JS type legalization use `-sWASM_BIGINT` or `-sSTANDALONE_WASM`', 'ASYNCIFY_EXPORTS': 'please use JSPI_EXPORTS instead', - 'USE_WEBGPU': 'please try migrating to --use-port=emdawnwebgpu, which implements a newer, incompatible version of webgpu.h (see tools/ports/emdawnwebgpu.py for more info)', 'LINKABLE': 'scheduled for removal in favor of SIDE_MODULE/MAIN_MODULE (https://github.com/emscripten-core/emscripten/issues/25262)', 'RELOCATABLE': 'scheduled for removal in favor of SIDE_MODULE/MAIN_MODULE (https://github.com/emscripten-core/emscripten/issues/25262)', } +REMOVED_SETTINGS = { + 'USE_WEBGPU': 'replaced by --use-port=emdawnwebgpu, which implements a newer but incompatible version of webgpu.h - see tools/ports/emdawnwebgpu.py', +} + # Settings that don't need to be externalized when serializing to json because they # are not used by the JS compiler. INTERNAL_SETTINGS = { diff --git a/tools/system_libs.py b/tools/system_libs.py index 54296e0923bf4..34b9a34023eb1 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -1947,21 +1947,6 @@ def get_default_variation(cls, **kwargs): ) -class libwebgpu(MTLibrary): - name = 'libwebgpu' - - src_dir = 'system/lib/webgpu' - src_files = ['webgpu.cpp'] - - -class libwebgpu_cpp(MTLibrary): - name = 'libwebgpu_cpp' - - cflags = ['-std=c++11'] - src_dir = 'system/lib/webgpu' - src_files = ['webgpu_cpp.cpp'] - - class libembind(MTLibrary): name = 'libembind' never_force = True @@ -2425,11 +2410,6 @@ def add_sanitizer_libs(): else: add_library('libsockets') - if settings.USE_WEBGPU: - add_library('libwebgpu') - if settings.LINK_AS_CXX: - add_library('libwebgpu_cpp') - if settings.WASM_WORKERS and (not settings.SINGLE_FILE and not settings.RELOCATABLE and not settings.PROXY_TO_WORKER):