diff --git a/src/generated_struct_info32.json b/src/generated_struct_info32.json index f639fa494c65..298880664099 100644 --- a/src/generated_struct_info32.json +++ b/src/generated_struct_info32.json @@ -782,10 +782,11 @@ "patch": 2 }, "WGPUAdapterProperties": { - "__size__": 36, + "__size__": 40, "adapterType": 28, "architecture": 12, "backendType": 32, + "compatibilityMode": 36, "deviceID": 16, "driverDescription": 24, "name": 20, @@ -890,14 +891,17 @@ "nextInChain": 0 }, "WGPUCompilationMessage": { - "__size__": 48, + "__size__": 72, "length": 40, "lineNum": 16, "linePos": 24, "message": 4, "nextInChain": 0, "offset": 32, - "type": 8 + "type": 8, + "utf16Length": 64, + "utf16LinePos": 48, + "utf16Offset": 56 }, "WGPUComputePassDescriptor": { "__size__": 16, @@ -940,8 +944,10 @@ "stencilWriteMask": 52 }, "WGPUDeviceDescriptor": { - "__size__": 28, + "__size__": 36, "defaultQueue": 20, + "deviceLostCallback": 28, + "deviceLostUserdata": 32, "label": 4, "nextInChain": 0, "requiredFeatures": 12, @@ -983,35 +989,38 @@ "nextInChain": 0 }, "WGPULimits": { - "__size__": 120, + "__size__": 144, "maxBindGroups": 16, - "maxColorAttachments": 92, - "maxComputeInvocationsPerWorkgroup": 100, - "maxComputeWorkgroupSizeX": 104, - "maxComputeWorkgroupSizeY": 108, - "maxComputeWorkgroupSizeZ": 112, - "maxComputeWorkgroupStorageSize": 96, - "maxComputeWorkgroupsPerDimension": 116, - "maxDynamicStorageBuffersPerPipelineLayout": 24, - "maxDynamicUniformBuffersPerPipelineLayout": 20, - "maxInterStageShaderComponents": 84, - "maxInterStageShaderVariables": 88, - "maxSampledTexturesPerShaderStage": 28, - "maxSamplersPerShaderStage": 32, - "maxStorageBufferBindingSize": 56, - "maxStorageBuffersPerShaderStage": 36, - "maxStorageTexturesPerShaderStage": 40, + "maxBindingsPerBindGroup": 20, + "maxBufferSize": 88, + "maxColorAttachmentBytesPerSample": 116, + "maxColorAttachments": 112, + "maxComputeInvocationsPerWorkgroup": 124, + "maxComputeWorkgroupSizeX": 128, + "maxComputeWorkgroupSizeY": 132, + "maxComputeWorkgroupSizeZ": 136, + "maxComputeWorkgroupStorageSize": 120, + "maxComputeWorkgroupsPerDimension": 140, + "maxDynamicStorageBuffersPerPipelineLayout": 28, + "maxDynamicUniformBuffersPerPipelineLayout": 24, + "maxInterStageShaderComponents": 104, + "maxInterStageShaderVariables": 108, + "maxSampledTexturesPerShaderStage": 32, + "maxSamplersPerShaderStage": 36, + "maxStorageBufferBindingSize": 64, + "maxStorageBuffersPerShaderStage": 40, + "maxStorageTexturesPerShaderStage": 44, "maxTextureArrayLayers": 12, "maxTextureDimension1D": 0, "maxTextureDimension2D": 4, "maxTextureDimension3D": 8, - "maxUniformBufferBindingSize": 48, - "maxUniformBuffersPerShaderStage": 44, - "maxVertexAttributes": 76, - "maxVertexBufferArrayStride": 80, - "maxVertexBuffers": 72, - "minStorageBufferOffsetAlignment": 68, - "minUniformBufferOffsetAlignment": 64 + "maxUniformBufferBindingSize": 56, + "maxUniformBuffersPerShaderStage": 48, + "maxVertexAttributes": 96, + "maxVertexBufferArrayStride": 100, + "maxVertexBuffers": 80, + "minStorageBufferOffsetAlignment": 76, + "minUniformBufferOffsetAlignment": 72 }, "WGPUMultisampleState": { "__size__": 16, @@ -1139,13 +1148,14 @@ }, "WGPURequestAdapterOptions": { "__size__": 16, + "compatibilityMode": 13, "compatibleSurface": 4, "forceFallbackAdapter": 12, "nextInChain": 0, "powerPreference": 8 }, "WGPURequiredLimits": { - "__size__": 128, + "__size__": 152, "limits": 8, "nextInChain": 0 }, @@ -1183,7 +1193,7 @@ "WGPUShaderModuleWGSLDescriptor": { "__size__": 12, "chain": 0, - "source": 8 + "code": 8 }, "WGPUStencilFaceState": { "__size__": 16, @@ -1200,7 +1210,7 @@ "viewDimension": 12 }, "WGPUSupportedLimits": { - "__size__": 128, + "__size__": 152, "limits": 8, "nextInChain": 0 }, diff --git a/src/generated_struct_info64.json b/src/generated_struct_info64.json index d100046cbc4b..66c9cb79d123 100644 --- a/src/generated_struct_info64.json +++ b/src/generated_struct_info64.json @@ -782,10 +782,11 @@ "patch": 2 }, "WGPUAdapterProperties": { - "__size__": 64, + "__size__": 72, "adapterType": 56, "architecture": 24, "backendType": 60, + "compatibilityMode": 64, "deviceID": 32, "driverDescription": 48, "name": 40, @@ -890,14 +891,17 @@ "nextInChain": 0 }, "WGPUCompilationMessage": { - "__size__": 56, + "__size__": 80, "length": 48, "lineNum": 24, "linePos": 32, "message": 8, "nextInChain": 0, "offset": 40, - "type": 16 + "type": 16, + "utf16Length": 72, + "utf16LinePos": 56, + "utf16Offset": 64 }, "WGPUComputePassDescriptor": { "__size__": 32, @@ -940,8 +944,10 @@ "stencilWriteMask": 56 }, "WGPUDeviceDescriptor": { - "__size__": 56, + "__size__": 72, "defaultQueue": 40, + "deviceLostCallback": 56, + "deviceLostUserdata": 64, "label": 8, "nextInChain": 0, "requiredFeatures": 24, @@ -983,35 +989,38 @@ "nextInChain": 0 }, "WGPULimits": { - "__size__": 120, + "__size__": 144, "maxBindGroups": 16, - "maxColorAttachments": 92, - "maxComputeInvocationsPerWorkgroup": 100, - "maxComputeWorkgroupSizeX": 104, - "maxComputeWorkgroupSizeY": 108, - "maxComputeWorkgroupSizeZ": 112, - "maxComputeWorkgroupStorageSize": 96, - "maxComputeWorkgroupsPerDimension": 116, - "maxDynamicStorageBuffersPerPipelineLayout": 24, - "maxDynamicUniformBuffersPerPipelineLayout": 20, - "maxInterStageShaderComponents": 84, - "maxInterStageShaderVariables": 88, - "maxSampledTexturesPerShaderStage": 28, - "maxSamplersPerShaderStage": 32, - "maxStorageBufferBindingSize": 56, - "maxStorageBuffersPerShaderStage": 36, - "maxStorageTexturesPerShaderStage": 40, + "maxBindingsPerBindGroup": 20, + "maxBufferSize": 88, + "maxColorAttachmentBytesPerSample": 116, + "maxColorAttachments": 112, + "maxComputeInvocationsPerWorkgroup": 124, + "maxComputeWorkgroupSizeX": 128, + "maxComputeWorkgroupSizeY": 132, + "maxComputeWorkgroupSizeZ": 136, + "maxComputeWorkgroupStorageSize": 120, + "maxComputeWorkgroupsPerDimension": 140, + "maxDynamicStorageBuffersPerPipelineLayout": 28, + "maxDynamicUniformBuffersPerPipelineLayout": 24, + "maxInterStageShaderComponents": 104, + "maxInterStageShaderVariables": 108, + "maxSampledTexturesPerShaderStage": 32, + "maxSamplersPerShaderStage": 36, + "maxStorageBufferBindingSize": 64, + "maxStorageBuffersPerShaderStage": 40, + "maxStorageTexturesPerShaderStage": 44, "maxTextureArrayLayers": 12, "maxTextureDimension1D": 0, "maxTextureDimension2D": 4, "maxTextureDimension3D": 8, - "maxUniformBufferBindingSize": 48, - "maxUniformBuffersPerShaderStage": 44, - "maxVertexAttributes": 76, - "maxVertexBufferArrayStride": 80, - "maxVertexBuffers": 72, - "minStorageBufferOffsetAlignment": 68, - "minUniformBufferOffsetAlignment": 64 + "maxUniformBufferBindingSize": 56, + "maxUniformBuffersPerShaderStage": 48, + "maxVertexAttributes": 96, + "maxVertexBufferArrayStride": 100, + "maxVertexBuffers": 80, + "minStorageBufferOffsetAlignment": 76, + "minUniformBufferOffsetAlignment": 72 }, "WGPUMultisampleState": { "__size__": 24, @@ -1139,13 +1148,14 @@ }, "WGPURequestAdapterOptions": { "__size__": 24, + "compatibilityMode": 21, "compatibleSurface": 8, "forceFallbackAdapter": 20, "nextInChain": 0, "powerPreference": 16 }, "WGPURequiredLimits": { - "__size__": 128, + "__size__": 152, "limits": 8, "nextInChain": 0 }, @@ -1183,7 +1193,7 @@ "WGPUShaderModuleWGSLDescriptor": { "__size__": 24, "chain": 0, - "source": 16 + "code": 16 }, "WGPUStencilFaceState": { "__size__": 16, @@ -1200,7 +1210,7 @@ "viewDimension": 16 }, "WGPUSupportedLimits": { - "__size__": 128, + "__size__": 152, "limits": 8, "nextInChain": 0 }, @@ -1270,10 +1280,10 @@ "shaderLocation": 16 }, "WGPUVertexBufferLayout": { - "__size__": 24, + "__size__": 32, "arrayStride": 0, - "attributeCount": 12, - "attributes": 16, + "attributeCount": 16, + "attributes": 24, "stepMode": 8 }, "WGPUVertexState": { diff --git a/src/library_sigs.js b/src/library_sigs.js index 16652976e3b0..cb118833b50e 100644 --- a/src/library_sigs.js +++ b/src/library_sigs.js @@ -1541,6 +1541,7 @@ sigs = { wgpuBindGroupSetLabel__sig: 'vpp', wgpuBufferDestroy__sig: 'vp', wgpuBufferGetConstMappedRange__sig: 'pppp', + wgpuBufferGetMapState__sig: 'ip', wgpuBufferGetMappedRange__sig: 'pppp', wgpuBufferGetSize__sig: 'jp', wgpuBufferGetUsage__sig: 'ip', @@ -1578,7 +1579,7 @@ sigs = { wgpuComputePassEncoderPushDebugGroup__sig: 'vpp', wgpuComputePassEncoderReference__sig: 'vp', wgpuComputePassEncoderRelease__sig: 'vp', - wgpuComputePassEncoderSetBindGroup__sig: 'vpipip', + wgpuComputePassEncoderSetBindGroup__sig: 'vpippp', wgpuComputePassEncoderSetLabel__sig: 'vpp', wgpuComputePassEncoderSetPipeline__sig: 'vpp', wgpuComputePassEncoderWriteTimestamp__sig: 'vppi', @@ -1607,11 +1608,10 @@ sigs = { wgpuDeviceGetLimits__sig: 'ipp', wgpuDeviceGetQueue__sig: 'pp', wgpuDeviceHasFeature__sig: 'ipi', - wgpuDevicePopErrorScope__sig: 'ippp', + wgpuDevicePopErrorScope__sig: 'vppp', wgpuDevicePushErrorScope__sig: 'vpi', wgpuDeviceReference__sig: 'vp', wgpuDeviceRelease__sig: 'vp', - wgpuDeviceSetDeviceLostCallback__sig: 'vppp', wgpuDeviceSetLabel__sig: 'vpp', wgpuDeviceSetUncapturedErrorCallback__sig: 'vppp', wgpuGetProcAddress__sig: 'ppp', @@ -1633,7 +1633,7 @@ sigs = { wgpuQueueReference__sig: 'vp', wgpuQueueRelease__sig: 'vp', wgpuQueueSetLabel__sig: 'vpp', - wgpuQueueSubmit__sig: 'vpip', + wgpuQueueSubmit__sig: 'vppp', wgpuQueueWriteBuffer__sig: 'vppjpp', wgpuQueueWriteTexture__sig: 'vpppppp', wgpuRenderBundleEncoderDraw__sig: 'vpiiii', @@ -1646,13 +1646,14 @@ sigs = { wgpuRenderBundleEncoderPushDebugGroup__sig: 'vpp', wgpuRenderBundleEncoderReference__sig: 'vp', wgpuRenderBundleEncoderRelease__sig: 'vp', - wgpuRenderBundleEncoderSetBindGroup__sig: 'vpipip', + 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', wgpuRenderPassEncoderBeginPipelineStatisticsQuery__sig: 'vppi', wgpuRenderPassEncoderDraw__sig: 'vpiiii', @@ -1662,13 +1663,13 @@ sigs = { wgpuRenderPassEncoderEnd__sig: 'vp', wgpuRenderPassEncoderEndOcclusionQuery__sig: 'vp', wgpuRenderPassEncoderEndPipelineStatisticsQuery__sig: 'vp', - wgpuRenderPassEncoderExecuteBundles__sig: 'vpip', + wgpuRenderPassEncoderExecuteBundles__sig: 'vppp', wgpuRenderPassEncoderInsertDebugMarker__sig: 'vpp', wgpuRenderPassEncoderPopDebugGroup__sig: 'vp', wgpuRenderPassEncoderPushDebugGroup__sig: 'vpp', wgpuRenderPassEncoderReference__sig: 'vp', wgpuRenderPassEncoderRelease__sig: 'vp', - wgpuRenderPassEncoderSetBindGroup__sig: 'vpipip', + wgpuRenderPassEncoderSetBindGroup__sig: 'vpippp', wgpuRenderPassEncoderSetBlendConstant__sig: 'vpp', wgpuRenderPassEncoderSetIndexBuffer__sig: 'vppijj', wgpuRenderPassEncoderSetLabel__sig: 'vpp', diff --git a/src/library_webgpu.js b/src/library_webgpu.js index da0afd6fd13e..7a8566b87272 100644 --- a/src/library_webgpu.js +++ b/src/library_webgpu.js @@ -87,7 +87,14 @@ wgpu${type}Release: function(id) { WebGPU.mgr${type}.release(id) },`; }, BufferMapAsyncStatus: { Success: 0, - Error: 1, + ValidationError: 1, + Unknown: 2, + DeviceLost: 3, + DestroyedBeforeCallback: 4, + UnmappedBeforeCallback: 5, + MappingAlreadyPending: 6, + OffsetOutOfRange: 7, + SizeOutOfRange: 8, }, ErrorType: { NoError: 0, @@ -318,6 +325,11 @@ var LibraryWebGPU = { 'rgba8unorm': 0x12, 'bgra8unorm': 0x17, }, + BufferMapState: { + 'unmapped': 0, + 'pending': 1, + 'mapped': 2, + }, // This section is auto-generated. See system/include/webgpu/README.md for details. AddressMode: [ @@ -353,6 +365,11 @@ var LibraryWebGPU = { 'storage', 'read-only-storage', ], + BufferMapState: [ + 'unmapped', + 'pending', + 'mapped', + ], CompareFunction: [ undefined, 'never', @@ -382,6 +399,7 @@ var LibraryWebGPU = { ErrorFilter: [ 'validation', 'out-of-memory', + 'internal', ], FeatureName: [ undefined, @@ -393,6 +411,10 @@ var LibraryWebGPU = { 'texture-compression-etc2', 'texture-compression-astc', 'indirect-first-instance', + 'shader-f16', + 'rg11b10ufloat-renderable', + 'bgra8unorm-storage', + 'float32filterable', ], FilterMode: [ 'nearest', @@ -412,6 +434,10 @@ var LibraryWebGPU = { 'clear', 'load', ], + MipmapFilterMode: [ + 'nearest', + 'linear', + ], PipelineStatisticName: [ 'vertex-shader-invocations', 'clipper-invocations', @@ -470,12 +496,6 @@ var LibraryWebGPU = { 'stencil-only', 'depth-only', ], - TextureComponentType: [ - 'float', - 'sint', - 'uint', - 'depth-comparison', - ], TextureDimension: [ '1d', '2d', @@ -716,6 +736,7 @@ var LibraryWebGPU = { setLimitValueU32('maxTextureDimension3D', {{{ C_STRUCTS.WGPULimits.maxTextureDimension3D }}}); setLimitValueU32('maxTextureArrayLayers', {{{ C_STRUCTS.WGPULimits.maxTextureArrayLayers }}}); setLimitValueU32('maxBindGroups', {{{ C_STRUCTS.WGPULimits.maxBindGroups }}}); + setLimitValueU32('maxBindingsPerBindGroup', {{{ C_STRUCTS.WGPULimits.maxBindingsPerBindGroup }}}); setLimitValueU32('maxDynamicUniformBuffersPerPipelineLayout', {{{ C_STRUCTS.WGPULimits.maxDynamicUniformBuffersPerPipelineLayout }}}); setLimitValueU32('maxDynamicStorageBuffersPerPipelineLayout', {{{ C_STRUCTS.WGPULimits.maxDynamicStorageBuffersPerPipelineLayout }}}); setLimitValueU32('maxSampledTexturesPerShaderStage', {{{ C_STRUCTS.WGPULimits.maxSampledTexturesPerShaderStage }}}); @@ -730,11 +751,13 @@ var LibraryWebGPU = { setLimitValueU64('maxStorageBufferBindingSize', {{{ C_STRUCTS.WGPULimits.maxStorageBufferBindingSize }}}); setLimitValueU32('maxVertexBuffers', {{{ C_STRUCTS.WGPULimits.maxVertexBuffers }}}); + setLimitValueU32('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 }}}); @@ -799,21 +822,6 @@ var LibraryWebGPU = { device.label = UTF8ToString(labelPtr); }, - wgpuDeviceSetDeviceLostCallback__deps: ['$callUserCallback'], - wgpuDeviceSetDeviceLostCallback: function(deviceId, callback, userdata) { - var deviceWrapper = WebGPU.mgrDevice.objects[deviceId]; - {{{ gpu.makeCheckDefined('deviceWrapper') }}} - if (!deviceWrapper.lostCallback) { - // device.lost hasn't been registered yet - register it. - deviceWrapper.object["lost"].then((info) => deviceWrapper.lostCallback(info)); - } - deviceWrapper.lostCallback = (info) => { - // This will skip the callback if the runtime is no longer alive. - callUserCallback(() => WebGPU.errorCallback(callback, WebGPU.DeviceLostReason[info.reason], - info.message, userdata)); - }; - }, - wgpuDeviceSetUncapturedErrorCallback__deps: ['$callUserCallback'], wgpuDeviceSetUncapturedErrorCallback: function(deviceId, callback, userdata) { var device = WebGPU.mgrDevice.get(deviceId); @@ -919,7 +927,7 @@ var LibraryWebGPU = { {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.magFilter) }}}], "minFilter": WebGPU.FilterMode[ {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSamplerDescriptor.minFilter) }}}], - "mipmapFilter": WebGPU.FilterMode[ + "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') }}}, @@ -1431,7 +1439,7 @@ var LibraryWebGPU = { break; } case {{{ gpu.SType.ShaderModuleWGSLDescriptor }}}: { - var sourcePtr = {{{ makeGetValue('nextInChainPtr', C_STRUCTS.WGPUShaderModuleWGSLDescriptor.source, '*') }}}; + var sourcePtr = {{{ makeGetValue('nextInChainPtr', C_STRUCTS.WGPUShaderModuleWGSLDescriptor.code, '*') }}}; if (sourcePtr) { desc["code"] = UTF8ToString(sourcePtr); } @@ -1865,6 +1873,11 @@ var LibraryWebGPU = { return data; }, + wgpuBufferGetMapState: function(bufferId) { + var buffer = WebGPU.mgrBuffer.get(bufferId); + return WebGPU.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', 'memalign', 'free'], @@ -1930,7 +1943,7 @@ var LibraryWebGPU = { {{{ runtimeKeepalivePop() }}} callUserCallback(() => { // TODO(kainino0x): Figure out how to pick other error status values. - {{{ makeDynCall('vii', 'callback') }}}({{{ gpu.BufferMapAsyncStatus.Error }}}, userdata); + {{{ makeDynCall('vii', 'callback') }}}({{{ gpu.BufferMapAsyncStatus.ValidationError }}}, userdata); }); }); }, @@ -2248,10 +2261,16 @@ var LibraryWebGPU = { var encoder = WebGPU.mgrRenderPassEncoder.get(encoderId); encoder["insertDebugMarker"](UTF8ToString(markerLabelPtr)); }, + wgpuRenderPassEncoderEnd: function(encoderId) { + var encoder = WebGPU.mgrRenderPassEncoder.get(encoderId); + encoder["end"](); + }, - wgpuRenderPassEncoderEnd: function(passId) { - var pass = WebGPU.mgrRenderPassEncoder.get(passId); - pass["end"](); + // Render bundle + + wgpuRenderBundleSetLabel: function(bundleId, labelPtr) { + var bundle = WebGPU.mgrRenderBundle.get(bundleId); + bundle.label = UTF8ToString(labelPtr); }, // Render bundle encoder @@ -2470,6 +2489,7 @@ var LibraryWebGPU = { {{{ 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: function(adapterId, limitsOutPtr) { @@ -2555,6 +2575,9 @@ var LibraryWebGPU = { 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); } @@ -2565,6 +2588,12 @@ var LibraryWebGPU = { 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.DeviceLostReason[info.reason], info.message, deviceLostUserdataPtr)); + }); + } {{{ makeDynCall('viiii', 'callback') }}}({{{ gpu.RequestDeviceStatus.Success }}}, deviceId, 0, userdata); }); }, function(ex) { diff --git a/src/struct_info.json b/src/struct_info.json index c85030bd5cae..8f67bba96887 100644 --- a/src/struct_info.json +++ b/src/struct_info.json @@ -1204,7 +1204,8 @@ "name", "driverDescription", "adapterType", - "backendType" + "backendType", + "compatibilityMode" ], "WGPUBindGroupEntry": [ "nextInChain", @@ -1254,7 +1255,10 @@ "lineNum", "linePos", "offset", - "length" + "length", + "utf16LinePos", + "utf16Offset", + "utf16Length" ], "WGPUComputePassTimestampWrite": [ "querySet", @@ -1280,6 +1284,7 @@ "maxTextureDimension3D", "maxTextureArrayLayers", "maxBindGroups", + "maxBindingsPerBindGroup", "maxDynamicUniformBuffersPerPipelineLayout", "maxDynamicStorageBuffersPerPipelineLayout", "maxSampledTexturesPerShaderStage", @@ -1292,11 +1297,13 @@ "minUniformBufferOffsetAlignment", "minStorageBufferOffsetAlignment", "maxVertexBuffers", + "maxBufferSize", "maxVertexAttributes", "maxVertexBufferArrayStride", "maxInterStageShaderComponents", "maxInterStageShaderVariables", "maxColorAttachments", + "maxColorAttachmentBytesPerSample", "maxComputeWorkgroupStorageSize", "maxComputeInvocationsPerWorkgroup", "maxComputeWorkgroupSizeX", @@ -1382,7 +1389,8 @@ "nextInChain", "compatibleSurface", "powerPreference", - "forceFallbackAdapter" + "forceFallbackAdapter", + "compatibilityMode" ], "WGPUSamplerBindingLayout": [ "nextInChain", @@ -1413,7 +1421,7 @@ ], "WGPUShaderModuleWGSLDescriptor": [ "chain", - "source" + "code" ], "WGPUStencilFaceState": [ "compare", @@ -1592,7 +1600,9 @@ "requiredFeaturesCount", "requiredFeatures", "requiredLimits", - "defaultQueue" + "defaultQueue", + "deviceLostCallback", + "deviceLostUserdata" ], "WGPURenderPassDescriptor": [ "nextInChain", diff --git a/system/include/webgpu/README.md b/system/include/webgpu/README.md index 6b4e07ec0d50..d60bc70f0efc 100644 --- a/system/include/webgpu/README.md +++ b/system/include/webgpu/README.md @@ -16,5 +16,25 @@ Dawn additionally autogenerates two "snippets" that are used in Emscripten: - `library_webgpu_enum_tables.js`, which is pasted into [`library_webgpu.js`](../../../src/library_webgpu.js) - `webgpu_struct_info.json`, which is pasted into [`struct_info.json`](../../../src/struct_info.json). -Once that's done, you need to run `./tools/gen_struct_info.py` to update +Once that's done, you need to run `./tools/gen_struct_info.py` and `./tools/gen_sig_info.py` to update the auto-generated files. + +## Testing + +There is a `browser.test_webgpu_basic_rendering` with minimal WebGPU API testing that can be handy to test manually before making a contribution. + +``` +test/runner browser.test_webgpu_basic_rendering +``` + +You may need to specify extra browser cmd args to assign the WebGPU supported browser, which is needed if you work on linux where WebGPU is not enabled by default in chrome at present. + +``` +test/runner browser.test_webgpu_basic_rendering --browser="google-chrome-unstable --enable-unsafe-webgpu --enable-features=Vulkan,UseSkiaRenderer" +``` + +Alternatively you can test your emscripten updates by building the source file, and then serve (e.g. use node http-server) and view in browser to make sure things work fine. + +``` +emcc test/webgpu_basic_rendering.cpp -sUSE_WEBGPU -o path/to/index.html +``` diff --git a/system/include/webgpu/webgpu.h b/system/include/webgpu/webgpu.h index 44cef56afbae..4831ed036679 100644 --- a/system/include/webgpu/webgpu.h +++ b/system/include/webgpu/webgpu.h @@ -48,6 +48,22 @@ # 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 #include @@ -62,29 +78,94 @@ typedef uint32_t WGPUFlags; -typedef struct WGPUAdapterImpl* WGPUAdapter; -typedef struct WGPUBindGroupImpl* WGPUBindGroup; -typedef struct WGPUBindGroupLayoutImpl* WGPUBindGroupLayout; -typedef struct WGPUBufferImpl* WGPUBuffer; -typedef struct WGPUCommandBufferImpl* WGPUCommandBuffer; -typedef struct WGPUCommandEncoderImpl* WGPUCommandEncoder; -typedef struct WGPUComputePassEncoderImpl* WGPUComputePassEncoder; -typedef struct WGPUComputePipelineImpl* WGPUComputePipeline; -typedef struct WGPUDeviceImpl* WGPUDevice; -typedef struct WGPUInstanceImpl* WGPUInstance; -typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout; -typedef struct WGPUQuerySetImpl* WGPUQuerySet; -typedef struct WGPUQueueImpl* WGPUQueue; -typedef struct WGPURenderBundleImpl* WGPURenderBundle; -typedef struct WGPURenderBundleEncoderImpl* WGPURenderBundleEncoder; -typedef struct WGPURenderPassEncoderImpl* WGPURenderPassEncoder; -typedef struct WGPURenderPipelineImpl* WGPURenderPipeline; -typedef struct WGPUSamplerImpl* WGPUSampler; -typedef struct WGPUShaderModuleImpl* WGPUShaderModule; -typedef struct WGPUSurfaceImpl* WGPUSurface; -typedef struct WGPUSwapChainImpl* WGPUSwapChain; -typedef struct WGPUTextureImpl* WGPUTexture; -typedef struct WGPUTextureViewImpl* WGPUTextureView; +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 WGPUAdapterProperties; +struct WGPUBindGroupEntry; +struct WGPUBlendComponent; +struct WGPUBufferBindingLayout; +struct WGPUBufferDescriptor; +struct WGPUColor; +struct WGPUCommandBufferDescriptor; +struct WGPUCommandEncoderDescriptor; +struct WGPUCompilationMessage; +struct WGPUComputePassTimestampWrite; +struct WGPUConstantEntry; +struct WGPUExtent3D; +struct WGPUInstanceDescriptor; +struct WGPULimits; +struct WGPUMultisampleState; +struct WGPUOrigin3D; +struct WGPUPipelineLayoutDescriptor; +struct WGPUPrimitiveDepthClipControl; +struct WGPUPrimitiveState; +struct WGPUQuerySetDescriptor; +struct WGPUQueueDescriptor; +struct WGPURenderBundleDescriptor; +struct WGPURenderBundleEncoderDescriptor; +struct WGPURenderPassDepthStencilAttachment; +struct WGPURenderPassDescriptorMaxDrawCount; +struct WGPURenderPassTimestampWrite; +struct WGPURequestAdapterOptions; +struct WGPUSamplerBindingLayout; +struct WGPUSamplerDescriptor; +struct WGPUShaderModuleDescriptor; +struct WGPUShaderModuleSPIRVDescriptor; +struct WGPUShaderModuleWGSLDescriptor; +struct WGPUStencilFaceState; +struct WGPUStorageTextureBindingLayout; +struct WGPUSurfaceDescriptor; +struct WGPUSurfaceDescriptorFromCanvasHTMLSelector; +struct WGPUSwapChainDescriptor; +struct WGPUTextureBindingLayout; +struct WGPUTextureDataLayout; +struct WGPUTextureViewDescriptor; +struct WGPUVertexAttribute; +struct WGPUBindGroupDescriptor; +struct WGPUBindGroupLayoutEntry; +struct WGPUBlendState; +struct WGPUCompilationInfo; +struct WGPUComputePassDescriptor; +struct WGPUDepthStencilState; +struct WGPUImageCopyBuffer; +struct WGPUImageCopyTexture; +struct WGPUProgrammableStageDescriptor; +struct WGPURenderPassColorAttachment; +struct WGPURequiredLimits; +struct WGPUSupportedLimits; +struct WGPUTextureDescriptor; +struct WGPUVertexBufferLayout; +struct WGPUBindGroupLayoutDescriptor; +struct WGPUColorTargetState; +struct WGPUComputePipelineDescriptor; +struct WGPUDeviceDescriptor; +struct WGPURenderPassDescriptor; +struct WGPUVertexState; +struct WGPUFragmentState; +struct WGPURenderPipelineDescriptor; typedef enum WGPUAdapterType { WGPUAdapterType_DiscreteGPU = 0x00000000, @@ -92,14 +173,14 @@ typedef enum WGPUAdapterType { WGPUAdapterType_CPU = 0x00000002, WGPUAdapterType_Unknown = 0x00000003, WGPUAdapterType_Force32 = 0x7FFFFFFF -} WGPUAdapterType; +} WGPUAdapterType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUAddressMode { WGPUAddressMode_Repeat = 0x00000000, WGPUAddressMode_MirrorRepeat = 0x00000001, WGPUAddressMode_ClampToEdge = 0x00000002, WGPUAddressMode_Force32 = 0x7FFFFFFF -} WGPUAddressMode; +} WGPUAddressMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBackendType { WGPUBackendType_Null = 0x00000000, @@ -111,7 +192,7 @@ typedef enum WGPUBackendType { WGPUBackendType_OpenGL = 0x00000006, WGPUBackendType_OpenGLES = 0x00000007, WGPUBackendType_Force32 = 0x7FFFFFFF -} WGPUBackendType; +} WGPUBackendType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBlendFactor { WGPUBlendFactor_Zero = 0x00000000, @@ -128,7 +209,7 @@ typedef enum WGPUBlendFactor { WGPUBlendFactor_Constant = 0x0000000B, WGPUBlendFactor_OneMinusConstant = 0x0000000C, WGPUBlendFactor_Force32 = 0x7FFFFFFF -} WGPUBlendFactor; +} WGPUBlendFactor WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBlendOperation { WGPUBlendOperation_Add = 0x00000000, @@ -137,7 +218,7 @@ typedef enum WGPUBlendOperation { WGPUBlendOperation_Min = 0x00000003, WGPUBlendOperation_Max = 0x00000004, WGPUBlendOperation_Force32 = 0x7FFFFFFF -} WGPUBlendOperation; +} WGPUBlendOperation WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBufferBindingType { WGPUBufferBindingType_Undefined = 0x00000000, @@ -145,17 +226,27 @@ typedef enum WGPUBufferBindingType { WGPUBufferBindingType_Storage = 0x00000002, WGPUBufferBindingType_ReadOnlyStorage = 0x00000003, WGPUBufferBindingType_Force32 = 0x7FFFFFFF -} WGPUBufferBindingType; +} WGPUBufferBindingType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBufferMapAsyncStatus { WGPUBufferMapAsyncStatus_Success = 0x00000000, - WGPUBufferMapAsyncStatus_Error = 0x00000001, + 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; +} WGPUBufferMapAsyncStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBufferMapState { + WGPUBufferMapState_Unmapped = 0x00000000, + WGPUBufferMapState_Pending = 0x00000001, + WGPUBufferMapState_Mapped = 0x00000002, + WGPUBufferMapState_Force32 = 0x7FFFFFFF +} WGPUBufferMapState WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCompareFunction { WGPUCompareFunction_Undefined = 0x00000000, @@ -168,7 +259,7 @@ typedef enum WGPUCompareFunction { WGPUCompareFunction_NotEqual = 0x00000007, WGPUCompareFunction_Always = 0x00000008, WGPUCompareFunction_Force32 = 0x7FFFFFFF -} WGPUCompareFunction; +} WGPUCompareFunction WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCompilationInfoRequestStatus { WGPUCompilationInfoRequestStatus_Success = 0x00000000, @@ -176,57 +267,60 @@ typedef enum WGPUCompilationInfoRequestStatus { WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000002, WGPUCompilationInfoRequestStatus_Unknown = 0x00000003, WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF -} WGPUCompilationInfoRequestStatus; +} WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCompilationMessageType { WGPUCompilationMessageType_Error = 0x00000000, WGPUCompilationMessageType_Warning = 0x00000001, WGPUCompilationMessageType_Info = 0x00000002, WGPUCompilationMessageType_Force32 = 0x7FFFFFFF -} WGPUCompilationMessageType; +} WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUComputePassTimestampLocation { WGPUComputePassTimestampLocation_Beginning = 0x00000000, WGPUComputePassTimestampLocation_End = 0x00000001, WGPUComputePassTimestampLocation_Force32 = 0x7FFFFFFF -} WGPUComputePassTimestampLocation; +} WGPUComputePassTimestampLocation WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCreatePipelineAsyncStatus { WGPUCreatePipelineAsyncStatus_Success = 0x00000000, - WGPUCreatePipelineAsyncStatus_Error = 0x00000001, - WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000002, - WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000003, - WGPUCreatePipelineAsyncStatus_Unknown = 0x00000004, + WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000001, + WGPUCreatePipelineAsyncStatus_InternalError = 0x00000002, + WGPUCreatePipelineAsyncStatus_DeviceLost = 0x00000003, + WGPUCreatePipelineAsyncStatus_DeviceDestroyed = 0x00000004, + WGPUCreatePipelineAsyncStatus_Unknown = 0x00000005, WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF -} WGPUCreatePipelineAsyncStatus; +} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUCullMode { WGPUCullMode_None = 0x00000000, WGPUCullMode_Front = 0x00000001, WGPUCullMode_Back = 0x00000002, WGPUCullMode_Force32 = 0x7FFFFFFF -} WGPUCullMode; +} WGPUCullMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUDeviceLostReason { WGPUDeviceLostReason_Undefined = 0x00000000, WGPUDeviceLostReason_Destroyed = 0x00000001, WGPUDeviceLostReason_Force32 = 0x7FFFFFFF -} WGPUDeviceLostReason; +} WGPUDeviceLostReason WGPU_ENUM_ATTRIBUTE; typedef enum WGPUErrorFilter { WGPUErrorFilter_Validation = 0x00000000, WGPUErrorFilter_OutOfMemory = 0x00000001, + WGPUErrorFilter_Internal = 0x00000002, WGPUErrorFilter_Force32 = 0x7FFFFFFF -} WGPUErrorFilter; +} WGPUErrorFilter WGPU_ENUM_ATTRIBUTE; typedef enum WGPUErrorType { WGPUErrorType_NoError = 0x00000000, WGPUErrorType_Validation = 0x00000001, WGPUErrorType_OutOfMemory = 0x00000002, - WGPUErrorType_Unknown = 0x00000003, - WGPUErrorType_DeviceLost = 0x00000004, + WGPUErrorType_Internal = 0x00000003, + WGPUErrorType_Unknown = 0x00000004, + WGPUErrorType_DeviceLost = 0x00000005, WGPUErrorType_Force32 = 0x7FFFFFFF -} WGPUErrorType; +} WGPUErrorType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUFeatureName { WGPUFeatureName_Undefined = 0x00000000, @@ -238,34 +332,44 @@ typedef enum WGPUFeatureName { WGPUFeatureName_TextureCompressionETC2 = 0x00000006, WGPUFeatureName_TextureCompressionASTC = 0x00000007, WGPUFeatureName_IndirectFirstInstance = 0x00000008, + WGPUFeatureName_ShaderF16 = 0x00000009, + WGPUFeatureName_RG11B10UfloatRenderable = 0x0000000A, + WGPUFeatureName_BGRA8UnormStorage = 0x0000000B, + WGPUFeatureName_Float32Filterable = 0x0000000C, WGPUFeatureName_Force32 = 0x7FFFFFFF -} WGPUFeatureName; +} WGPUFeatureName WGPU_ENUM_ATTRIBUTE; typedef enum WGPUFilterMode { WGPUFilterMode_Nearest = 0x00000000, WGPUFilterMode_Linear = 0x00000001, WGPUFilterMode_Force32 = 0x7FFFFFFF -} WGPUFilterMode; +} WGPUFilterMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUFrontFace { WGPUFrontFace_CCW = 0x00000000, WGPUFrontFace_CW = 0x00000001, WGPUFrontFace_Force32 = 0x7FFFFFFF -} WGPUFrontFace; +} WGPUFrontFace WGPU_ENUM_ATTRIBUTE; typedef enum WGPUIndexFormat { WGPUIndexFormat_Undefined = 0x00000000, WGPUIndexFormat_Uint16 = 0x00000001, WGPUIndexFormat_Uint32 = 0x00000002, WGPUIndexFormat_Force32 = 0x7FFFFFFF -} WGPUIndexFormat; +} WGPUIndexFormat WGPU_ENUM_ATTRIBUTE; typedef enum WGPULoadOp { WGPULoadOp_Undefined = 0x00000000, WGPULoadOp_Clear = 0x00000001, WGPULoadOp_Load = 0x00000002, WGPULoadOp_Force32 = 0x7FFFFFFF -} WGPULoadOp; +} WGPULoadOp WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUMipmapFilterMode { + WGPUMipmapFilterMode_Nearest = 0x00000000, + WGPUMipmapFilterMode_Linear = 0x00000001, + WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF +} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPipelineStatisticName { WGPUPipelineStatisticName_VertexShaderInvocations = 0x00000000, @@ -274,21 +378,21 @@ typedef enum WGPUPipelineStatisticName { WGPUPipelineStatisticName_FragmentShaderInvocations = 0x00000003, WGPUPipelineStatisticName_ComputeShaderInvocations = 0x00000004, WGPUPipelineStatisticName_Force32 = 0x7FFFFFFF -} WGPUPipelineStatisticName; +} WGPUPipelineStatisticName WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPowerPreference { WGPUPowerPreference_Undefined = 0x00000000, WGPUPowerPreference_LowPower = 0x00000001, WGPUPowerPreference_HighPerformance = 0x00000002, WGPUPowerPreference_Force32 = 0x7FFFFFFF -} WGPUPowerPreference; +} WGPUPowerPreference WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPresentMode { WGPUPresentMode_Immediate = 0x00000000, WGPUPresentMode_Mailbox = 0x00000001, WGPUPresentMode_Fifo = 0x00000002, WGPUPresentMode_Force32 = 0x7FFFFFFF -} WGPUPresentMode; +} WGPUPresentMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUPrimitiveTopology { WGPUPrimitiveTopology_PointList = 0x00000000, @@ -297,14 +401,14 @@ typedef enum WGPUPrimitiveTopology { WGPUPrimitiveTopology_TriangleList = 0x00000003, WGPUPrimitiveTopology_TriangleStrip = 0x00000004, WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF -} WGPUPrimitiveTopology; +} WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE; typedef enum WGPUQueryType { WGPUQueryType_Occlusion = 0x00000000, WGPUQueryType_PipelineStatistics = 0x00000001, WGPUQueryType_Timestamp = 0x00000002, WGPUQueryType_Force32 = 0x7FFFFFFF -} WGPUQueryType; +} WGPUQueryType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUQueueWorkDoneStatus { WGPUQueueWorkDoneStatus_Success = 0x00000000, @@ -312,13 +416,13 @@ typedef enum WGPUQueueWorkDoneStatus { WGPUQueueWorkDoneStatus_Unknown = 0x00000002, WGPUQueueWorkDoneStatus_DeviceLost = 0x00000003, WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF -} WGPUQueueWorkDoneStatus; +} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPURenderPassTimestampLocation { WGPURenderPassTimestampLocation_Beginning = 0x00000000, WGPURenderPassTimestampLocation_End = 0x00000001, WGPURenderPassTimestampLocation_Force32 = 0x7FFFFFFF -} WGPURenderPassTimestampLocation; +} WGPURenderPassTimestampLocation WGPU_ENUM_ATTRIBUTE; typedef enum WGPURequestAdapterStatus { WGPURequestAdapterStatus_Success = 0x00000000, @@ -326,14 +430,14 @@ typedef enum WGPURequestAdapterStatus { WGPURequestAdapterStatus_Error = 0x00000002, WGPURequestAdapterStatus_Unknown = 0x00000003, WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF -} WGPURequestAdapterStatus; +} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPURequestDeviceStatus { WGPURequestDeviceStatus_Success = 0x00000000, WGPURequestDeviceStatus_Error = 0x00000001, WGPURequestDeviceStatus_Unknown = 0x00000002, WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF -} WGPURequestDeviceStatus; +} WGPURequestDeviceStatus WGPU_ENUM_ATTRIBUTE; typedef enum WGPUSType { WGPUSType_Invalid = 0x00000000, @@ -343,7 +447,7 @@ typedef enum WGPUSType { WGPUSType_PrimitiveDepthClipControl = 0x00000007, WGPUSType_RenderPassDescriptorMaxDrawCount = 0x0000000F, WGPUSType_Force32 = 0x7FFFFFFF -} WGPUSType; +} WGPUSType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUSamplerBindingType { WGPUSamplerBindingType_Undefined = 0x00000000, @@ -351,7 +455,7 @@ typedef enum WGPUSamplerBindingType { WGPUSamplerBindingType_NonFiltering = 0x00000002, WGPUSamplerBindingType_Comparison = 0x00000003, WGPUSamplerBindingType_Force32 = 0x7FFFFFFF -} WGPUSamplerBindingType; +} WGPUSamplerBindingType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUStencilOperation { WGPUStencilOperation_Keep = 0x00000000, @@ -363,42 +467,34 @@ typedef enum WGPUStencilOperation { WGPUStencilOperation_IncrementWrap = 0x00000006, WGPUStencilOperation_DecrementWrap = 0x00000007, WGPUStencilOperation_Force32 = 0x7FFFFFFF -} WGPUStencilOperation; +} WGPUStencilOperation WGPU_ENUM_ATTRIBUTE; typedef enum WGPUStorageTextureAccess { WGPUStorageTextureAccess_Undefined = 0x00000000, WGPUStorageTextureAccess_WriteOnly = 0x00000001, WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF -} WGPUStorageTextureAccess; +} WGPUStorageTextureAccess WGPU_ENUM_ATTRIBUTE; typedef enum WGPUStoreOp { WGPUStoreOp_Undefined = 0x00000000, WGPUStoreOp_Store = 0x00000001, WGPUStoreOp_Discard = 0x00000002, WGPUStoreOp_Force32 = 0x7FFFFFFF -} WGPUStoreOp; +} WGPUStoreOp WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureAspect { WGPUTextureAspect_All = 0x00000000, WGPUTextureAspect_StencilOnly = 0x00000001, WGPUTextureAspect_DepthOnly = 0x00000002, WGPUTextureAspect_Force32 = 0x7FFFFFFF -} WGPUTextureAspect; - -typedef enum WGPUTextureComponentType { - WGPUTextureComponentType_Float = 0x00000000, - WGPUTextureComponentType_Sint = 0x00000001, - WGPUTextureComponentType_Uint = 0x00000002, - WGPUTextureComponentType_DepthComparison = 0x00000003, - WGPUTextureComponentType_Force32 = 0x7FFFFFFF -} WGPUTextureComponentType; +} WGPUTextureAspect WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureDimension { WGPUTextureDimension_1D = 0x00000000, WGPUTextureDimension_2D = 0x00000001, WGPUTextureDimension_3D = 0x00000002, WGPUTextureDimension_Force32 = 0x7FFFFFFF -} WGPUTextureDimension; +} WGPUTextureDimension WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureFormat { WGPUTextureFormat_Undefined = 0x00000000, @@ -497,7 +593,7 @@ typedef enum WGPUTextureFormat { WGPUTextureFormat_ASTC12x12Unorm = 0x0000005D, WGPUTextureFormat_ASTC12x12UnormSrgb = 0x0000005E, WGPUTextureFormat_Force32 = 0x7FFFFFFF -} WGPUTextureFormat; +} WGPUTextureFormat WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureSampleType { WGPUTextureSampleType_Undefined = 0x00000000, @@ -507,7 +603,7 @@ typedef enum WGPUTextureSampleType { WGPUTextureSampleType_Sint = 0x00000004, WGPUTextureSampleType_Uint = 0x00000005, WGPUTextureSampleType_Force32 = 0x7FFFFFFF -} WGPUTextureSampleType; +} WGPUTextureSampleType WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureViewDimension { WGPUTextureViewDimension_Undefined = 0x00000000, @@ -518,7 +614,7 @@ typedef enum WGPUTextureViewDimension { WGPUTextureViewDimension_CubeArray = 0x00000005, WGPUTextureViewDimension_3D = 0x00000006, WGPUTextureViewDimension_Force32 = 0x7FFFFFFF -} WGPUTextureViewDimension; +} WGPUTextureViewDimension WGPU_ENUM_ATTRIBUTE; typedef enum WGPUVertexFormat { WGPUVertexFormat_Undefined = 0x00000000, @@ -553,14 +649,14 @@ typedef enum WGPUVertexFormat { WGPUVertexFormat_Sint32x3 = 0x0000001D, WGPUVertexFormat_Sint32x4 = 0x0000001E, WGPUVertexFormat_Force32 = 0x7FFFFFFF -} WGPUVertexFormat; +} WGPUVertexFormat WGPU_ENUM_ATTRIBUTE; typedef enum WGPUVertexStepMode { WGPUVertexStepMode_Vertex = 0x00000000, WGPUVertexStepMode_Instance = 0x00000001, WGPUVertexStepMode_VertexBufferNotUsed = 0x00000002, WGPUVertexStepMode_Force32 = 0x7FFFFFFF -} WGPUVertexStepMode; +} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE; typedef enum WGPUBufferUsage { WGPUBufferUsage_None = 0x00000000, @@ -575,8 +671,8 @@ typedef enum WGPUBufferUsage { WGPUBufferUsage_Indirect = 0x00000100, WGPUBufferUsage_QueryResolve = 0x00000200, WGPUBufferUsage_Force32 = 0x7FFFFFFF -} WGPUBufferUsage; -typedef WGPUFlags WGPUBufferUsageFlags; +} WGPUBufferUsage WGPU_ENUM_ATTRIBUTE; +typedef WGPUFlags WGPUBufferUsageFlags WGPU_ENUM_ATTRIBUTE; typedef enum WGPUColorWriteMask { WGPUColorWriteMask_None = 0x00000000, @@ -586,16 +682,16 @@ typedef enum WGPUColorWriteMask { WGPUColorWriteMask_Alpha = 0x00000008, WGPUColorWriteMask_All = 0x0000000F, WGPUColorWriteMask_Force32 = 0x7FFFFFFF -} WGPUColorWriteMask; -typedef WGPUFlags WGPUColorWriteMaskFlags; +} 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; -typedef WGPUFlags WGPUMapModeFlags; +} WGPUMapMode WGPU_ENUM_ATTRIBUTE; +typedef WGPUFlags WGPUMapModeFlags WGPU_ENUM_ATTRIBUTE; typedef enum WGPUShaderStage { WGPUShaderStage_None = 0x00000000, @@ -603,8 +699,8 @@ typedef enum WGPUShaderStage { WGPUShaderStage_Fragment = 0x00000002, WGPUShaderStage_Compute = 0x00000004, WGPUShaderStage_Force32 = 0x7FFFFFFF -} WGPUShaderStage; -typedef WGPUFlags WGPUShaderStageFlags; +} WGPUShaderStage WGPU_ENUM_ATTRIBUTE; +typedef WGPUFlags WGPUShaderStageFlags WGPU_ENUM_ATTRIBUTE; typedef enum WGPUTextureUsage { WGPUTextureUsage_None = 0x00000000, @@ -614,18 +710,29 @@ typedef enum WGPUTextureUsage { WGPUTextureUsage_StorageBinding = 0x00000008, WGPUTextureUsage_RenderAttachment = 0x00000010, WGPUTextureUsage_Force32 = 0x7FFFFFFF -} WGPUTextureUsage; -typedef WGPUFlags WGPUTextureUsageFlags; +} 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; +} WGPUChainedStruct WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUChainedStructOut { struct WGPUChainedStructOut * next; WGPUSType sType; -} WGPUChainedStructOut; +} WGPUChainedStructOut WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUAdapterProperties { WGPUChainedStructOut * nextInChain; @@ -637,87 +744,91 @@ typedef struct WGPUAdapterProperties { char const * driverDescription; WGPUAdapterType adapterType; WGPUBackendType backendType; -} WGPUAdapterProperties; + bool compatibilityMode; +} WGPUAdapterProperties WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBindGroupEntry { WGPUChainedStruct const * nextInChain; uint32_t binding; - WGPUBuffer buffer; // nullable + WGPU_NULLABLE WGPUBuffer buffer; uint64_t offset; uint64_t size; - WGPUSampler sampler; // nullable - WGPUTextureView textureView; // nullable -} WGPUBindGroupEntry; + WGPU_NULLABLE WGPUSampler sampler; + WGPU_NULLABLE WGPUTextureView textureView; +} WGPUBindGroupEntry WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBlendComponent { WGPUBlendOperation operation; WGPUBlendFactor srcFactor; WGPUBlendFactor dstFactor; -} WGPUBlendComponent; +} WGPUBlendComponent WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBufferBindingLayout { WGPUChainedStruct const * nextInChain; WGPUBufferBindingType type; bool hasDynamicOffset; uint64_t minBindingSize; -} WGPUBufferBindingLayout; +} WGPUBufferBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBufferDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUBufferUsageFlags usage; uint64_t size; bool mappedAtCreation; -} WGPUBufferDescriptor; +} WGPUBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUColor { double r; double g; double b; double a; -} WGPUColor; +} WGPUColor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCommandBufferDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable -} WGPUCommandBufferDescriptor; + WGPU_NULLABLE char const * label; +} WGPUCommandBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCommandEncoderDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable -} WGPUCommandEncoderDescriptor; + WGPU_NULLABLE char const * label; +} WGPUCommandEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCompilationMessage { WGPUChainedStruct const * nextInChain; - char const * message; // nullable + WGPU_NULLABLE char const * message; WGPUCompilationMessageType type; uint64_t lineNum; uint64_t linePos; uint64_t offset; uint64_t length; -} WGPUCompilationMessage; + uint64_t utf16LinePos; + uint64_t utf16Offset; + uint64_t utf16Length; +} WGPUCompilationMessage WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUComputePassTimestampWrite { WGPUQuerySet querySet; uint32_t queryIndex; WGPUComputePassTimestampLocation location; -} WGPUComputePassTimestampWrite; +} WGPUComputePassTimestampWrite WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUConstantEntry { WGPUChainedStruct const * nextInChain; char const * key; double value; -} WGPUConstantEntry; +} WGPUConstantEntry WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUExtent3D { uint32_t width; uint32_t height; uint32_t depthOrArrayLayers; -} WGPUExtent3D; +} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUInstanceDescriptor { WGPUChainedStruct const * nextInChain; -} WGPUInstanceDescriptor; +} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPULimits { uint32_t maxTextureDimension1D; @@ -725,6 +836,7 @@ typedef struct WGPULimits { uint32_t maxTextureDimension3D; uint32_t maxTextureArrayLayers; uint32_t maxBindGroups; + uint32_t maxBindingsPerBindGroup; uint32_t maxDynamicUniformBuffersPerPipelineLayout; uint32_t maxDynamicStorageBuffersPerPipelineLayout; uint32_t maxSampledTexturesPerShaderStage; @@ -737,44 +849,46 @@ typedef struct WGPULimits { 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; +} WGPULimits WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUMultisampleState { WGPUChainedStruct const * nextInChain; uint32_t count; uint32_t mask; bool alphaToCoverageEnabled; -} WGPUMultisampleState; +} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUOrigin3D { uint32_t x; uint32_t y; uint32_t z; -} WGPUOrigin3D; +} WGPUOrigin3D WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUPipelineLayoutDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - uint32_t bindGroupLayoutCount; + WGPU_NULLABLE char const * label; + size_t bindGroupLayoutCount; WGPUBindGroupLayout const * bindGroupLayouts; -} WGPUPipelineLayoutDescriptor; +} WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUPrimitiveState typedef struct WGPUPrimitiveDepthClipControl { WGPUChainedStruct chain; bool unclippedDepth; -} WGPUPrimitiveDepthClipControl; +} WGPUPrimitiveDepthClipControl WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUPrimitiveState { WGPUChainedStruct const * nextInChain; @@ -782,37 +896,37 @@ typedef struct WGPUPrimitiveState { WGPUIndexFormat stripIndexFormat; WGPUFrontFace frontFace; WGPUCullMode cullMode; -} WGPUPrimitiveState; +} WGPUPrimitiveState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUQuerySetDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUQueryType type; uint32_t count; WGPUPipelineStatisticName const * pipelineStatistics; - uint32_t pipelineStatisticsCount; -} WGPUQuerySetDescriptor; + size_t pipelineStatisticsCount; +} WGPUQuerySetDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUQueueDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable -} WGPUQueueDescriptor; + WGPU_NULLABLE char const * label; +} WGPUQueueDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderBundleDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable -} WGPURenderBundleDescriptor; + WGPU_NULLABLE char const * label; +} WGPURenderBundleDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderBundleEncoderDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - uint32_t colorFormatsCount; + WGPU_NULLABLE char const * label; + size_t colorFormatsCount; WGPUTextureFormat const * colorFormats; WGPUTextureFormat depthStencilFormat; uint32_t sampleCount; bool depthReadOnly; bool stencilReadOnly; -} WGPURenderBundleEncoderDescriptor; +} WGPURenderBundleEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPassDepthStencilAttachment { WGPUTextureView view; @@ -824,117 +938,118 @@ typedef struct WGPURenderPassDepthStencilAttachment { WGPUStoreOp stencilStoreOp; uint32_t stencilClearValue; bool stencilReadOnly; -} WGPURenderPassDepthStencilAttachment; +} WGPURenderPassDepthStencilAttachment WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPURenderPassDescriptor typedef struct WGPURenderPassDescriptorMaxDrawCount { WGPUChainedStruct chain; uint64_t maxDrawCount; -} WGPURenderPassDescriptorMaxDrawCount; +} WGPURenderPassDescriptorMaxDrawCount WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPassTimestampWrite { WGPUQuerySet querySet; uint32_t queryIndex; WGPURenderPassTimestampLocation location; -} WGPURenderPassTimestampWrite; +} WGPURenderPassTimestampWrite WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURequestAdapterOptions { WGPUChainedStruct const * nextInChain; - WGPUSurface compatibleSurface; // nullable + WGPU_NULLABLE WGPUSurface compatibleSurface; WGPUPowerPreference powerPreference; bool forceFallbackAdapter; -} WGPURequestAdapterOptions; + bool compatibilityMode; +} WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSamplerBindingLayout { WGPUChainedStruct const * nextInChain; WGPUSamplerBindingType type; -} WGPUSamplerBindingLayout; +} WGPUSamplerBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSamplerDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUAddressMode addressModeU; WGPUAddressMode addressModeV; WGPUAddressMode addressModeW; WGPUFilterMode magFilter; WGPUFilterMode minFilter; - WGPUFilterMode mipmapFilter; + WGPUMipmapFilterMode mipmapFilter; float lodMinClamp; float lodMaxClamp; WGPUCompareFunction compare; uint16_t maxAnisotropy; -} WGPUSamplerDescriptor; +} WGPUSamplerDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUShaderModuleDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable -} WGPUShaderModuleDescriptor; + WGPU_NULLABLE char const * label; +} WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUShaderModuleDescriptor typedef struct WGPUShaderModuleSPIRVDescriptor { WGPUChainedStruct chain; uint32_t codeSize; uint32_t const * code; -} WGPUShaderModuleSPIRVDescriptor; +} WGPUShaderModuleSPIRVDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUShaderModuleDescriptor typedef struct WGPUShaderModuleWGSLDescriptor { WGPUChainedStruct chain; - char const * source; -} WGPUShaderModuleWGSLDescriptor; + char const * code; +} WGPUShaderModuleWGSLDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUStencilFaceState { WGPUCompareFunction compare; WGPUStencilOperation failOp; WGPUStencilOperation depthFailOp; WGPUStencilOperation passOp; -} WGPUStencilFaceState; +} WGPUStencilFaceState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUStorageTextureBindingLayout { WGPUChainedStruct const * nextInChain; WGPUStorageTextureAccess access; WGPUTextureFormat format; WGPUTextureViewDimension viewDimension; -} WGPUStorageTextureBindingLayout; +} WGPUStorageTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSurfaceDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable -} WGPUSurfaceDescriptor; + WGPU_NULLABLE char const * label; +} WGPUSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; // Can be chained in WGPUSurfaceDescriptor typedef struct WGPUSurfaceDescriptorFromCanvasHTMLSelector { WGPUChainedStruct chain; char const * selector; -} WGPUSurfaceDescriptorFromCanvasHTMLSelector; +} WGPUSurfaceDescriptorFromCanvasHTMLSelector WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSwapChainDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUTextureUsageFlags usage; WGPUTextureFormat format; uint32_t width; uint32_t height; WGPUPresentMode presentMode; -} WGPUSwapChainDescriptor; +} WGPUSwapChainDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUTextureBindingLayout { WGPUChainedStruct const * nextInChain; WGPUTextureSampleType sampleType; WGPUTextureViewDimension viewDimension; bool multisampled; -} WGPUTextureBindingLayout; +} WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUTextureDataLayout { WGPUChainedStruct const * nextInChain; uint64_t offset; uint32_t bytesPerRow; uint32_t rowsPerImage; -} WGPUTextureDataLayout; +} WGPUTextureDataLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUTextureViewDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUTextureFormat format; WGPUTextureViewDimension dimension; uint32_t baseMipLevel; @@ -942,21 +1057,21 @@ typedef struct WGPUTextureViewDescriptor { uint32_t baseArrayLayer; uint32_t arrayLayerCount; WGPUTextureAspect aspect; -} WGPUTextureViewDescriptor; +} WGPUTextureViewDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUVertexAttribute { WGPUVertexFormat format; uint64_t offset; uint32_t shaderLocation; -} WGPUVertexAttribute; +} WGPUVertexAttribute WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBindGroupDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUBindGroupLayout layout; - uint32_t entryCount; + size_t entryCount; WGPUBindGroupEntry const * entries; -} WGPUBindGroupDescriptor; +} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBindGroupLayoutEntry { WGPUChainedStruct const * nextInChain; @@ -966,25 +1081,25 @@ typedef struct WGPUBindGroupLayoutEntry { WGPUSamplerBindingLayout sampler; WGPUTextureBindingLayout texture; WGPUStorageTextureBindingLayout storageTexture; -} WGPUBindGroupLayoutEntry; +} WGPUBindGroupLayoutEntry WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBlendState { WGPUBlendComponent color; WGPUBlendComponent alpha; -} WGPUBlendState; +} WGPUBlendState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUCompilationInfo { WGPUChainedStruct const * nextInChain; - uint32_t messageCount; + size_t messageCount; WGPUCompilationMessage const * messages; -} WGPUCompilationInfo; +} WGPUCompilationInfo WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUComputePassDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - uint32_t timestampWriteCount; + WGPU_NULLABLE char const * label; + size_t timestampWriteCount; WGPUComputePassTimestampWrite const * timestampWrites; -} WGPUComputePassDescriptor; +} WGPUComputePassDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUDepthStencilState { WGPUChainedStruct const * nextInChain; @@ -998,13 +1113,13 @@ typedef struct WGPUDepthStencilState { int32_t depthBias; float depthBiasSlopeScale; float depthBiasClamp; -} WGPUDepthStencilState; +} WGPUDepthStencilState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUImageCopyBuffer { WGPUChainedStruct const * nextInChain; WGPUTextureDataLayout layout; WGPUBuffer buffer; -} WGPUImageCopyBuffer; +} WGPUImageCopyBuffer WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUImageCopyTexture { WGPUChainedStruct const * nextInChain; @@ -1012,612 +1127,605 @@ typedef struct WGPUImageCopyTexture { uint32_t mipLevel; WGPUOrigin3D origin; WGPUTextureAspect aspect; -} WGPUImageCopyTexture; +} WGPUImageCopyTexture WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUProgrammableStageDescriptor { WGPUChainedStruct const * nextInChain; WGPUShaderModule module; char const * entryPoint; - uint32_t constantCount; + size_t constantCount; WGPUConstantEntry const * constants; -} WGPUProgrammableStageDescriptor; +} WGPUProgrammableStageDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPassColorAttachment { - WGPUTextureView view; // nullable - WGPUTextureView resolveTarget; // nullable + WGPU_NULLABLE WGPUTextureView view; + WGPU_NULLABLE WGPUTextureView resolveTarget; WGPULoadOp loadOp; WGPUStoreOp storeOp; WGPUColor clearValue; -} WGPURenderPassColorAttachment; +} WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURequiredLimits { WGPUChainedStruct const * nextInChain; WGPULimits limits; -} WGPURequiredLimits; +} WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSupportedLimits { WGPUChainedStructOut * nextInChain; WGPULimits limits; -} WGPUSupportedLimits; +} WGPUSupportedLimits WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUTextureDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable + WGPU_NULLABLE char const * label; WGPUTextureUsageFlags usage; WGPUTextureDimension dimension; WGPUExtent3D size; WGPUTextureFormat format; uint32_t mipLevelCount; uint32_t sampleCount; - uint32_t viewFormatCount; + size_t viewFormatCount; WGPUTextureFormat const * viewFormats; -} WGPUTextureDescriptor; +} WGPUTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUVertexBufferLayout { uint64_t arrayStride; WGPUVertexStepMode stepMode; - uint32_t attributeCount; + size_t attributeCount; WGPUVertexAttribute const * attributes; -} WGPUVertexBufferLayout; +} WGPUVertexBufferLayout WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUBindGroupLayoutDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - uint32_t entryCount; + WGPU_NULLABLE char const * label; + size_t entryCount; WGPUBindGroupLayoutEntry const * entries; -} WGPUBindGroupLayoutDescriptor; +} WGPUBindGroupLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUColorTargetState { WGPUChainedStruct const * nextInChain; WGPUTextureFormat format; - WGPUBlendState const * blend; // nullable + WGPU_NULLABLE WGPUBlendState const * blend; WGPUColorWriteMaskFlags writeMask; -} WGPUColorTargetState; +} WGPUColorTargetState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUComputePipelineDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - WGPUPipelineLayout layout; // nullable + WGPU_NULLABLE char const * label; + WGPU_NULLABLE WGPUPipelineLayout layout; WGPUProgrammableStageDescriptor compute; -} WGPUComputePipelineDescriptor; +} WGPUComputePipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUDeviceDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - uint32_t requiredFeaturesCount; + WGPU_NULLABLE char const * label; + size_t requiredFeaturesCount; WGPUFeatureName const * requiredFeatures; - WGPURequiredLimits const * requiredLimits; // nullable + WGPU_NULLABLE WGPURequiredLimits const * requiredLimits; WGPUQueueDescriptor defaultQueue; -} WGPUDeviceDescriptor; + WGPUDeviceLostCallback deviceLostCallback; + void * deviceLostUserdata; +} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPassDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - uint32_t colorAttachmentCount; + WGPU_NULLABLE char const * label; + size_t colorAttachmentCount; WGPURenderPassColorAttachment const * colorAttachments; - WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; // nullable - WGPUQuerySet occlusionQuerySet; // nullable - uint32_t timestampWriteCount; + WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; + WGPU_NULLABLE WGPUQuerySet occlusionQuerySet; + size_t timestampWriteCount; WGPURenderPassTimestampWrite const * timestampWrites; -} WGPURenderPassDescriptor; +} WGPURenderPassDescriptor WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUVertexState { WGPUChainedStruct const * nextInChain; WGPUShaderModule module; char const * entryPoint; - uint32_t constantCount; + size_t constantCount; WGPUConstantEntry const * constants; - uint32_t bufferCount; + size_t bufferCount; WGPUVertexBufferLayout const * buffers; -} WGPUVertexState; +} WGPUVertexState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUFragmentState { WGPUChainedStruct const * nextInChain; WGPUShaderModule module; char const * entryPoint; - uint32_t constantCount; + size_t constantCount; WGPUConstantEntry const * constants; - uint32_t targetCount; + size_t targetCount; WGPUColorTargetState const * targets; -} WGPUFragmentState; +} WGPUFragmentState WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPURenderPipelineDescriptor { WGPUChainedStruct const * nextInChain; - char const * label; // nullable - WGPUPipelineLayout layout; // nullable + WGPU_NULLABLE char const * label; + WGPU_NULLABLE WGPUPipelineLayout layout; WGPUVertexState vertex; WGPUPrimitiveState primitive; - WGPUDepthStencilState const * depthStencil; // nullable + WGPU_NULLABLE WGPUDepthStencilState const * depthStencil; WGPUMultisampleState multisample; - WGPUFragmentState const * fragment; // nullable -} WGPURenderPipelineDescriptor; + WGPU_NULLABLE WGPUFragmentState const * fragment; +} WGPURenderPipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; #ifdef __cplusplus extern "C" { #endif -typedef void (*WGPUBufferMapCallback)(WGPUBufferMapAsyncStatus status, void * userdata); -typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, WGPUCompilationInfo const * compilationInfo, void * userdata); -typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, char const * message, void * userdata); -typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, char const * message, void * userdata); -typedef void (*WGPUDeviceLostCallback)(WGPUDeviceLostReason reason, char const * message, void * userdata); -typedef void (*WGPUErrorCallback)(WGPUErrorType type, char const * message, void * userdata); -typedef void (*WGPUProc)(void); -typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, void * userdata); -typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, char const * message, void * userdata); -typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata); - #if !defined(WGPU_SKIP_PROCS) -typedef WGPUInstance (*WGPUProcCreateInstance)(WGPUInstanceDescriptor const * descriptor); -typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName); +typedef WGPUInstance (*WGPUProcCreateInstance)(WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; // Procs of Adapter -typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName * features); -typedef bool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimits * limits); -typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter adapter, WGPUAdapterProperties * properties); -typedef bool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature); -typedef void (*WGPUProcAdapterRequestDevice)(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata); -typedef void (*WGPUProcAdapterReference)(WGPUAdapter adapter); -typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter); +typedef size_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; +typedef bool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter adapter, WGPUAdapterProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +typedef bool (*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); -typedef void (*WGPUProcBindGroupReference)(WGPUBindGroup bindGroup); -typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup 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); -typedef void (*WGPUProcBindGroupLayoutReference)(WGPUBindGroupLayout bindGroupLayout); -typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout 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); -typedef void const * (*WGPUProcBufferGetConstMappedRange)(WGPUBuffer buffer, size_t offset, size_t size); -typedef void * (*WGPUProcBufferGetMappedRange)(WGPUBuffer buffer, size_t offset, size_t size); -typedef uint64_t (*WGPUProcBufferGetSize)(WGPUBuffer buffer); -typedef WGPUBufferUsage (*WGPUProcBufferGetUsage)(WGPUBuffer buffer); -typedef void (*WGPUProcBufferMapAsync)(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata); -typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer buffer, char const * label); -typedef void (*WGPUProcBufferUnmap)(WGPUBuffer buffer); -typedef void (*WGPUProcBufferReference)(WGPUBuffer buffer); -typedef void (*WGPUProcBufferRelease)(WGPUBuffer 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); -typedef void (*WGPUProcCommandBufferReference)(WGPUCommandBuffer commandBuffer); -typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer 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, WGPUComputePassDescriptor const * descriptor /* nullable */); -typedef WGPURenderPassEncoder (*WGPUProcCommandEncoderBeginRenderPass)(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor); -typedef void (*WGPUProcCommandEncoderClearBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size); -typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size); -typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); -typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize); -typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); -typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor /* nullable */); -typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder commandEncoder, char const * markerLabel); -typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEncoder); -typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder commandEncoder, char const * groupLabel); -typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset); -typedef void (*WGPUProcCommandEncoderSetLabel)(WGPUCommandEncoder commandEncoder, char const * label); -typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -typedef void (*WGPUProcCommandEncoderReference)(WGPUCommandEncoder commandEncoder); -typedef void (*WGPUProcCommandEncoderRelease)(WGPUCommandEncoder 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 (*WGPUProcComputePassEncoderBeginPipelineStatisticsQuery)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ); -typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder computePassEncoder); -typedef void (*WGPUProcComputePassEncoderEndPipelineStatisticsQuery)(WGPUComputePassEncoder computePassEncoder); -typedef void (*WGPUProcComputePassEncoderInsertDebugMarker)(WGPUComputePassEncoder computePassEncoder, char const * markerLabel); -typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder computePassEncoder); -typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, char const * groupLabel); -typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); -typedef void (*WGPUProcComputePassEncoderSetLabel)(WGPUComputePassEncoder computePassEncoder, char const * label); -typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline); -typedef void (*WGPUProcComputePassEncoderWriteTimestamp)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -typedef void (*WGPUProcComputePassEncoderReference)(WGPUComputePassEncoder computePassEncoder); -typedef void (*WGPUProcComputePassEncoderRelease)(WGPUComputePassEncoder computePassEncoder); +typedef void (*WGPUProcComputePassEncoderBeginPipelineStatisticsQuery)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderEndPipelineStatisticsQuery)(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); -typedef void (*WGPUProcComputePipelineSetLabel)(WGPUComputePipeline computePipeline, char const * label); -typedef void (*WGPUProcComputePipelineReference)(WGPUComputePipeline computePipeline); -typedef void (*WGPUProcComputePipelineRelease)(WGPUComputePipeline 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); -typedef WGPUBindGroupLayout (*WGPUProcDeviceCreateBindGroupLayout)(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor); -typedef WGPUBuffer (*WGPUProcDeviceCreateBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor); -typedef WGPUCommandEncoder (*WGPUProcDeviceCreateCommandEncoder)(WGPUDevice device, WGPUCommandEncoderDescriptor const * descriptor /* nullable */); -typedef WGPUComputePipeline (*WGPUProcDeviceCreateComputePipeline)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor); -typedef void (*WGPUProcDeviceCreateComputePipelineAsync)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata); -typedef WGPUPipelineLayout (*WGPUProcDeviceCreatePipelineLayout)(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor); -typedef WGPUQuerySet (*WGPUProcDeviceCreateQuerySet)(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor); -typedef WGPURenderBundleEncoder (*WGPUProcDeviceCreateRenderBundleEncoder)(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor); -typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor); -typedef void (*WGPUProcDeviceCreateRenderPipelineAsync)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata); -typedef WGPUSampler (*WGPUProcDeviceCreateSampler)(WGPUDevice device, WGPUSamplerDescriptor const * descriptor /* nullable */); -typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor); -typedef WGPUSwapChain (*WGPUProcDeviceCreateSwapChain)(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor const * descriptor); -typedef WGPUTexture (*WGPUProcDeviceCreateTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor); -typedef void (*WGPUProcDeviceDestroy)(WGPUDevice device); -typedef size_t (*WGPUProcDeviceEnumerateFeatures)(WGPUDevice device, WGPUFeatureName * features); -typedef bool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits); -typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device); -typedef bool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature); -typedef bool (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback callback, void * userdata); -typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter); -typedef void (*WGPUProcDeviceSetDeviceLostCallback)(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata); -typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, char const * label); -typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice device, WGPUErrorCallback callback, void * userdata); -typedef void (*WGPUProcDeviceReference)(WGPUDevice device); -typedef void (*WGPUProcDeviceRelease)(WGPUDevice 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 bool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef bool (*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); -typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance instance); -typedef void (*WGPUProcInstanceRequestAdapter)(WGPUInstance instance, WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata); -typedef void (*WGPUProcInstanceReference)(WGPUInstance instance); -typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance); +typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceRequestAdapter)(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceReference)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; // Procs of PipelineLayout -typedef void (*WGPUProcPipelineLayoutSetLabel)(WGPUPipelineLayout pipelineLayout, char const * label); -typedef void (*WGPUProcPipelineLayoutReference)(WGPUPipelineLayout pipelineLayout); -typedef void (*WGPUProcPipelineLayoutRelease)(WGPUPipelineLayout 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); -typedef uint32_t (*WGPUProcQuerySetGetCount)(WGPUQuerySet querySet); -typedef WGPUQueryType (*WGPUProcQuerySetGetType)(WGPUQuerySet querySet); -typedef void (*WGPUProcQuerySetSetLabel)(WGPUQuerySet querySet, char const * label); -typedef void (*WGPUProcQuerySetReference)(WGPUQuerySet querySet); -typedef void (*WGPUProcQuerySetRelease)(WGPUQuerySet 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, uint64_t signalValue, WGPUQueueWorkDoneCallback callback, void * userdata); -typedef void (*WGPUProcQueueSetLabel)(WGPUQueue queue, char const * label); -typedef void (*WGPUProcQueueSubmit)(WGPUQueue queue, uint32_t commandCount, WGPUCommandBuffer const * commands); -typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size); -typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize); -typedef void (*WGPUProcQueueReference)(WGPUQueue queue); -typedef void (*WGPUProcQueueRelease)(WGPUQueue queue); +typedef void (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, uint64_t signalValue, 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 (*WGPUProcRenderBundleReference)(WGPURenderBundle renderBundle); -typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle 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); -typedef void (*WGPUProcRenderBundleEncoderDrawIndexed)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance); -typedef void (*WGPUProcRenderBundleEncoderDrawIndexedIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -typedef void (*WGPUProcRenderBundleEncoderDrawIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderBundleDescriptor const * descriptor /* nullable */); -typedef void (*WGPUProcRenderBundleEncoderInsertDebugMarker)(WGPURenderBundleEncoder renderBundleEncoder, char const * markerLabel); -typedef void (*WGPUProcRenderBundleEncoderPopDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder); -typedef void (*WGPUProcRenderBundleEncoderPushDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder, char const * groupLabel); -typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); -typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size); -typedef void (*WGPUProcRenderBundleEncoderSetLabel)(WGPURenderBundleEncoder renderBundleEncoder, char const * label); -typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline); -typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); -typedef void (*WGPUProcRenderBundleEncoderReference)(WGPURenderBundleEncoder renderBundleEncoder); -typedef void (*WGPUProcRenderBundleEncoderRelease)(WGPURenderBundleEncoder 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); -typedef void (*WGPUProcRenderPassEncoderBeginPipelineStatisticsQuery)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -typedef void (*WGPUProcRenderPassEncoderDraw)(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); -typedef void (*WGPUProcRenderPassEncoderDrawIndexed)(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance); -typedef void (*WGPUProcRenderPassEncoderDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -typedef void (*WGPUProcRenderPassEncoderDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -typedef void (*WGPUProcRenderPassEncoderEnd)(WGPURenderPassEncoder renderPassEncoder); -typedef void (*WGPUProcRenderPassEncoderEndOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder); -typedef void (*WGPUProcRenderPassEncoderEndPipelineStatisticsQuery)(WGPURenderPassEncoder renderPassEncoder); -typedef void (*WGPUProcRenderPassEncoderExecuteBundles)(WGPURenderPassEncoder renderPassEncoder, uint32_t bundlesCount, WGPURenderBundle const * bundles); -typedef void (*WGPUProcRenderPassEncoderInsertDebugMarker)(WGPURenderPassEncoder renderPassEncoder, char const * markerLabel); -typedef void (*WGPUProcRenderPassEncoderPopDebugGroup)(WGPURenderPassEncoder renderPassEncoder); -typedef void (*WGPUProcRenderPassEncoderPushDebugGroup)(WGPURenderPassEncoder renderPassEncoder, char const * groupLabel); -typedef void (*WGPUProcRenderPassEncoderSetBindGroup)(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); -typedef void (*WGPUProcRenderPassEncoderSetBlendConstant)(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color); -typedef void (*WGPUProcRenderPassEncoderSetIndexBuffer)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size); -typedef void (*WGPUProcRenderPassEncoderSetLabel)(WGPURenderPassEncoder renderPassEncoder, char const * label); -typedef void (*WGPUProcRenderPassEncoderSetPipeline)(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline); -typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height); -typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference); -typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); -typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); -typedef void (*WGPUProcRenderPassEncoderWriteTimestamp)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -typedef void (*WGPUProcRenderPassEncoderReference)(WGPURenderPassEncoder renderPassEncoder); -typedef void (*WGPUProcRenderPassEncoderRelease)(WGPURenderPassEncoder renderPassEncoder); +typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderBeginPipelineStatisticsQuery)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, 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 (*WGPUProcRenderPassEncoderEndPipelineStatisticsQuery)(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); -typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline renderPipeline, char const * label); -typedef void (*WGPUProcRenderPipelineReference)(WGPURenderPipeline renderPipeline); -typedef void (*WGPUProcRenderPipelineRelease)(WGPURenderPipeline 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); -typedef void (*WGPUProcSamplerReference)(WGPUSampler sampler); -typedef void (*WGPUProcSamplerRelease)(WGPUSampler 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); -typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, char const * label); -typedef void (*WGPUProcShaderModuleReference)(WGPUShaderModule shaderModule); -typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule 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 WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter); -typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface); -typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface); +typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; // Procs of SwapChain -typedef WGPUTextureView (*WGPUProcSwapChainGetCurrentTextureView)(WGPUSwapChain swapChain); -typedef void (*WGPUProcSwapChainPresent)(WGPUSwapChain swapChain); -typedef void (*WGPUProcSwapChainReference)(WGPUSwapChain swapChain); -typedef void (*WGPUProcSwapChainRelease)(WGPUSwapChain swapChain); +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, WGPUTextureViewDescriptor const * descriptor /* nullable */); -typedef void (*WGPUProcTextureDestroy)(WGPUTexture texture); -typedef uint32_t (*WGPUProcTextureGetDepthOrArrayLayers)(WGPUTexture texture); -typedef WGPUTextureDimension (*WGPUProcTextureGetDimension)(WGPUTexture texture); -typedef WGPUTextureFormat (*WGPUProcTextureGetFormat)(WGPUTexture texture); -typedef uint32_t (*WGPUProcTextureGetHeight)(WGPUTexture texture); -typedef uint32_t (*WGPUProcTextureGetMipLevelCount)(WGPUTexture texture); -typedef uint32_t (*WGPUProcTextureGetSampleCount)(WGPUTexture texture); -typedef WGPUTextureUsage (*WGPUProcTextureGetUsage)(WGPUTexture texture); -typedef uint32_t (*WGPUProcTextureGetWidth)(WGPUTexture texture); -typedef void (*WGPUProcTextureSetLabel)(WGPUTexture texture, char const * label); -typedef void (*WGPUProcTextureReference)(WGPUTexture texture); -typedef void (*WGPUProcTextureRelease)(WGPUTexture 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); -typedef void (*WGPUProcTextureViewReference)(WGPUTextureView textureView); -typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView textureView); +typedef void (*WGPUProcTextureViewSetLabel)(WGPUTextureView textureView, char const * label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureViewReference)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; #endif // !defined(WGPU_SKIP_PROCS) #if !defined(WGPU_SKIP_DECLARATIONS) -WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descriptor); -WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUDevice device, char const * procName); +WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUDevice device, char const * procName) WGPU_FUNCTION_ATTRIBUTE; // Methods of Adapter -WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features); -WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits); -WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties); -WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature); -WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata); -WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter); -WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter); +WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT bool 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_EXPORT void wgpuBindGroupReference(WGPUBindGroup bindGroup); -WGPU_EXPORT void wgpuBindGroupRelease(WGPUBindGroup 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_EXPORT void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout); -WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout 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_EXPORT void const * wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size); -WGPU_EXPORT void * wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size); -WGPU_EXPORT uint64_t wgpuBufferGetSize(WGPUBuffer buffer); -WGPU_EXPORT WGPUBufferUsage wgpuBufferGetUsage(WGPUBuffer buffer); -WGPU_EXPORT void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata); -WGPU_EXPORT void wgpuBufferSetLabel(WGPUBuffer buffer, char const * label); -WGPU_EXPORT void wgpuBufferUnmap(WGPUBuffer buffer); -WGPU_EXPORT void wgpuBufferReference(WGPUBuffer buffer); -WGPU_EXPORT void wgpuBufferRelease(WGPUBuffer 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_EXPORT void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer); -WGPU_EXPORT void wgpuCommandBufferRelease(WGPUCommandBuffer 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, WGPUComputePassDescriptor const * descriptor /* nullable */); -WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor); -WGPU_EXPORT void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size); -WGPU_EXPORT void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size); -WGPU_EXPORT void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); -WGPU_EXPORT void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize); -WGPU_EXPORT void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); -WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor /* nullable */); -WGPU_EXPORT void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, char const * markerLabel); -WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder); -WGPU_EXPORT void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, char const * groupLabel); -WGPU_EXPORT void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset); -WGPU_EXPORT void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, char const * label); -WGPU_EXPORT void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -WGPU_EXPORT void wgpuCommandEncoderReference(WGPUCommandEncoder commandEncoder); -WGPU_EXPORT void wgpuCommandEncoderRelease(WGPUCommandEncoder 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 wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ); -WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -WGPU_EXPORT void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder); -WGPU_EXPORT void wgpuComputePassEncoderEndPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder); -WGPU_EXPORT void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, char const * markerLabel); -WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder); -WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, char const * groupLabel); -WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); -WGPU_EXPORT void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, char const * label); -WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline); -WGPU_EXPORT void wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -WGPU_EXPORT void wgpuComputePassEncoderReference(WGPUComputePassEncoder computePassEncoder); -WGPU_EXPORT void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder); +WGPU_EXPORT void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderEndPipelineStatisticsQuery(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_EXPORT void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, char const * label); -WGPU_EXPORT void wgpuComputePipelineReference(WGPUComputePipeline computePipeline); -WGPU_EXPORT void wgpuComputePipelineRelease(WGPUComputePipeline 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_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor); -WGPU_EXPORT WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor); -WGPU_EXPORT WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, WGPUCommandEncoderDescriptor const * descriptor /* nullable */); -WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor); -WGPU_EXPORT void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata); -WGPU_EXPORT WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor); -WGPU_EXPORT WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor); -WGPU_EXPORT WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor); -WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor); -WGPU_EXPORT void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata); -WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPUSamplerDescriptor const * descriptor /* nullable */); -WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor); -WGPU_EXPORT WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor const * descriptor); -WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor); -WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device); -WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName * features); -WGPU_EXPORT bool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits); -WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device); -WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature); -WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata); -WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter); -WGPU_EXPORT void wgpuDeviceSetDeviceLostCallback(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata); -WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, char const * label); -WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata); -WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device); -WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice 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 bool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT bool 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_EXPORT void wgpuInstanceProcessEvents(WGPUInstance instance); -WGPU_EXPORT void wgpuInstanceRequestAdapter(WGPUInstance instance, WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata); -WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance); -WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance); +WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceProcessEvents(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceRequestAdapter(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; // Methods of PipelineLayout -WGPU_EXPORT void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, char const * label); -WGPU_EXPORT void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout); -WGPU_EXPORT void wgpuPipelineLayoutRelease(WGPUPipelineLayout 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_EXPORT uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet); -WGPU_EXPORT WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet); -WGPU_EXPORT void wgpuQuerySetSetLabel(WGPUQuerySet querySet, char const * label); -WGPU_EXPORT void wgpuQuerySetReference(WGPUQuerySet querySet); -WGPU_EXPORT void wgpuQuerySetRelease(WGPUQuerySet 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, uint64_t signalValue, WGPUQueueWorkDoneCallback callback, void * userdata); -WGPU_EXPORT void wgpuQueueSetLabel(WGPUQueue queue, char const * label); -WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, uint32_t commandCount, WGPUCommandBuffer const * commands); -WGPU_EXPORT void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size); -WGPU_EXPORT void wgpuQueueWriteTexture(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize); -WGPU_EXPORT void wgpuQueueReference(WGPUQueue queue); -WGPU_EXPORT void wgpuQueueRelease(WGPUQueue queue); +WGPU_EXPORT void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, uint64_t signalValue, 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 wgpuRenderBundleReference(WGPURenderBundle renderBundle); -WGPU_EXPORT void wgpuRenderBundleRelease(WGPURenderBundle 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_EXPORT void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance); -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -WGPU_EXPORT WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderBundleDescriptor const * descriptor /* nullable */); -WGPU_EXPORT void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, char const * markerLabel); -WGPU_EXPORT void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder); -WGPU_EXPORT void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, char const * groupLabel); -WGPU_EXPORT void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); -WGPU_EXPORT void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size); -WGPU_EXPORT void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, char const * label); -WGPU_EXPORT void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline); -WGPU_EXPORT void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); -WGPU_EXPORT void wgpuRenderBundleEncoderReference(WGPURenderBundleEncoder renderBundleEncoder); -WGPU_EXPORT void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder 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_EXPORT void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -WGPU_EXPORT void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance); -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -WGPU_EXPORT void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset); -WGPU_EXPORT void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder); -WGPU_EXPORT void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder); -WGPU_EXPORT void wgpuRenderPassEncoderEndPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder); -WGPU_EXPORT void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, uint32_t bundlesCount, WGPURenderBundle const * bundles); -WGPU_EXPORT void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, char const * markerLabel); -WGPU_EXPORT void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder); -WGPU_EXPORT void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, char const * groupLabel); -WGPU_EXPORT void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); -WGPU_EXPORT void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color); -WGPU_EXPORT void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size); -WGPU_EXPORT void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, char const * label); -WGPU_EXPORT void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline); -WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height); -WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference); -WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); -WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); -WGPU_EXPORT void wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); -WGPU_EXPORT void wgpuRenderPassEncoderReference(WGPURenderPassEncoder renderPassEncoder); -WGPU_EXPORT void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder); +WGPU_EXPORT void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderBeginPipelineStatisticsQuery(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, 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 wgpuRenderPassEncoderEndPipelineStatisticsQuery(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_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, char const * label); -WGPU_EXPORT void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline); -WGPU_EXPORT void wgpuRenderPipelineRelease(WGPURenderPipeline 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_EXPORT void wgpuSamplerReference(WGPUSampler sampler); -WGPU_EXPORT void wgpuSamplerRelease(WGPUSampler 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_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char const * label); -WGPU_EXPORT void wgpuShaderModuleReference(WGPUShaderModule shaderModule); -WGPU_EXPORT void wgpuShaderModuleRelease(WGPUShaderModule 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 WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter); -WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface); -WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface); +WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; // Methods of SwapChain -WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView(WGPUSwapChain swapChain); -WGPU_EXPORT void wgpuSwapChainPresent(WGPUSwapChain swapChain); -WGPU_EXPORT void wgpuSwapChainReference(WGPUSwapChain swapChain); -WGPU_EXPORT void wgpuSwapChainRelease(WGPUSwapChain swapChain); +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, WGPUTextureViewDescriptor const * descriptor /* nullable */); -WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture); -WGPU_EXPORT uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture); -WGPU_EXPORT WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture); -WGPU_EXPORT WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture); -WGPU_EXPORT uint32_t wgpuTextureGetHeight(WGPUTexture texture); -WGPU_EXPORT uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture); -WGPU_EXPORT uint32_t wgpuTextureGetSampleCount(WGPUTexture texture); -WGPU_EXPORT WGPUTextureUsage wgpuTextureGetUsage(WGPUTexture texture); -WGPU_EXPORT uint32_t wgpuTextureGetWidth(WGPUTexture texture); -WGPU_EXPORT void wgpuTextureSetLabel(WGPUTexture texture, char const * label); -WGPU_EXPORT void wgpuTextureReference(WGPUTexture texture); -WGPU_EXPORT void wgpuTextureRelease(WGPUTexture 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_EXPORT void wgpuTextureViewReference(WGPUTextureView textureView); -WGPU_EXPORT void wgpuTextureViewRelease(WGPUTextureView 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) diff --git a/system/include/webgpu/webgpu_cpp.h b/system/include/webgpu/webgpu_cpp.h index 2086a1741da3..f98cf5f5a49f 100644 --- a/system/include/webgpu/webgpu_cpp.h +++ b/system/include/webgpu/webgpu_cpp.h @@ -199,11 +199,20 @@ namespace wgpu { enum class BufferMapAsyncStatus : uint32_t { Success = 0x00000000, - Error = 0x00000001, + ValidationError = 0x00000001, Unknown = 0x00000002, DeviceLost = 0x00000003, DestroyedBeforeCallback = 0x00000004, UnmappedBeforeCallback = 0x00000005, + MappingAlreadyPending = 0x00000006, + OffsetOutOfRange = 0x00000007, + SizeOutOfRange = 0x00000008, + }; + + enum class BufferMapState : uint32_t { + Unmapped = 0x00000000, + Pending = 0x00000001, + Mapped = 0x00000002, }; enum class CompareFunction : uint32_t { @@ -238,10 +247,11 @@ namespace wgpu { enum class CreatePipelineAsyncStatus : uint32_t { Success = 0x00000000, - Error = 0x00000001, - DeviceLost = 0x00000002, - DeviceDestroyed = 0x00000003, - Unknown = 0x00000004, + ValidationError = 0x00000001, + InternalError = 0x00000002, + DeviceLost = 0x00000003, + DeviceDestroyed = 0x00000004, + Unknown = 0x00000005, }; enum class CullMode : uint32_t { @@ -258,14 +268,16 @@ namespace wgpu { enum class ErrorFilter : uint32_t { Validation = 0x00000000, OutOfMemory = 0x00000001, + Internal = 0x00000002, }; enum class ErrorType : uint32_t { NoError = 0x00000000, Validation = 0x00000001, OutOfMemory = 0x00000002, - Unknown = 0x00000003, - DeviceLost = 0x00000004, + Internal = 0x00000003, + Unknown = 0x00000004, + DeviceLost = 0x00000005, }; enum class FeatureName : uint32_t { @@ -278,6 +290,10 @@ namespace wgpu { TextureCompressionETC2 = 0x00000006, TextureCompressionASTC = 0x00000007, IndirectFirstInstance = 0x00000008, + ShaderF16 = 0x00000009, + RG11B10UfloatRenderable = 0x0000000A, + BGRA8UnormStorage = 0x0000000B, + Float32Filterable = 0x0000000C, }; enum class FilterMode : uint32_t { @@ -302,6 +318,11 @@ namespace wgpu { Load = 0x00000002, }; + enum class MipmapFilterMode : uint32_t { + Nearest = 0x00000000, + Linear = 0x00000001, + }; + enum class PipelineStatisticName : uint32_t { VertexShaderInvocations = 0x00000000, ClipperInvocations = 0x00000001, @@ -405,13 +426,6 @@ namespace wgpu { DepthOnly = 0x00000002, }; - enum class TextureComponentType : uint32_t { - Float = 0x00000000, - Sint = 0x00000001, - Uint = 0x00000002, - DepthComparison = 0x00000003, - }; - enum class TextureDimension : uint32_t { e1D = 0x00000000, e2D = 0x00000001, @@ -781,11 +795,17 @@ namespace wgpu { CType Get() const { return mHandle; } + // TODO(dawn:1639) Deprecate Release after uses have been removed. CType Release() { CType result = mHandle; mHandle = 0; return result; } + CType MoveToCHandle() { + CType result = mHandle; + mHandle = 0; + return result; + } static Derived Acquire(CType handle) { Derived result; result.mHandle = handle; @@ -848,6 +868,7 @@ namespace wgpu { 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; @@ -913,7 +934,7 @@ namespace wgpu { void InsertDebugMarker(char const * markerLabel) const; void PopDebugGroup() const; void PushDebugGroup(char const * groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) 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; @@ -963,9 +984,8 @@ namespace wgpu { bool GetLimits(SupportedLimits * limits) const; Queue GetQueue() const; bool HasFeature(FeatureName feature) const; - bool PopErrorScope(ErrorCallback callback, void * userdata) const; + void PopErrorScope(ErrorCallback callback, void * userdata) const; void PushErrorScope(ErrorFilter filter) const; - void SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const; void SetLabel(char const * label) const; void SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const; @@ -1026,7 +1046,7 @@ namespace wgpu { void OnSubmittedWorkDone(uint64_t signalValue, QueueWorkDoneCallback callback, void * userdata) const; void SetLabel(char const * label) const; - void Submit(uint32_t commandCount, CommandBuffer const * commands) 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; @@ -1041,6 +1061,7 @@ namespace wgpu { using ObjectBase::ObjectBase; using ObjectBase::operator=; + void SetLabel(char const * label) const; private: friend ObjectBase; @@ -1061,7 +1082,7 @@ namespace wgpu { void InsertDebugMarker(char const * markerLabel) const; void PopDebugGroup() const; void PushDebugGroup(char const * groupLabel) const; - void SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) 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; @@ -1087,11 +1108,11 @@ namespace wgpu { void End() const; void EndOcclusionQuery() const; void EndPipelineStatisticsQuery() const; - void ExecuteBundles(uint32_t bundlesCount, RenderBundle const * bundles) 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, uint32_t dynamicOffsetCount = 0, uint32_t const * dynamicOffsets = nullptr) 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; @@ -1236,6 +1257,7 @@ namespace wgpu { char const * driverDescription; AdapterType adapterType; BackendType backendType; + bool compatibilityMode = false; }; struct BindGroupEntry { @@ -1294,6 +1316,9 @@ namespace wgpu { uint64_t linePos; uint64_t offset; uint64_t length; + uint64_t utf16LinePos; + uint64_t utf16Offset; + uint64_t utf16Length; }; struct ComputePassTimestampWrite { @@ -1324,6 +1349,7 @@ namespace wgpu { uint32_t maxTextureDimension3D = WGPU_LIMIT_U32_UNDEFINED; uint32_t maxTextureArrayLayers = WGPU_LIMIT_U32_UNDEFINED; uint32_t maxBindGroups = 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; @@ -1336,11 +1362,13 @@ namespace wgpu { 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; @@ -1365,7 +1393,7 @@ namespace wgpu { struct PipelineLayoutDescriptor { ChainedStruct const * nextInChain = nullptr; char const * label = nullptr; - uint32_t bindGroupLayoutCount; + size_t bindGroupLayoutCount; BindGroupLayout const * bindGroupLayouts; }; @@ -1392,7 +1420,7 @@ namespace wgpu { QueryType type; uint32_t count; PipelineStatisticName const * pipelineStatistics; - uint32_t pipelineStatisticsCount = 0; + size_t pipelineStatisticsCount = 0; }; struct QueueDescriptor { @@ -1408,7 +1436,7 @@ namespace wgpu { struct RenderBundleEncoderDescriptor { ChainedStruct const * nextInChain = nullptr; char const * label = nullptr; - uint32_t colorFormatsCount; + size_t colorFormatsCount; TextureFormat const * colorFormats; TextureFormat depthStencilFormat = TextureFormat::Undefined; uint32_t sampleCount = 1; @@ -1420,7 +1448,7 @@ namespace wgpu { TextureView view; LoadOp depthLoadOp = LoadOp::Undefined; StoreOp depthStoreOp = StoreOp::Undefined; - float depthClearValue = 0; + float depthClearValue = NAN; bool depthReadOnly = false; LoadOp stencilLoadOp = LoadOp::Undefined; StoreOp stencilStoreOp = StoreOp::Undefined; @@ -1448,6 +1476,7 @@ namespace wgpu { Surface compatibleSurface = nullptr; PowerPreference powerPreference = PowerPreference::Undefined; bool forceFallbackAdapter = false; + bool compatibilityMode = false; }; struct SamplerBindingLayout { @@ -1463,9 +1492,9 @@ namespace wgpu { AddressMode addressModeW = AddressMode::ClampToEdge; FilterMode magFilter = FilterMode::Nearest; FilterMode minFilter = FilterMode::Nearest; - FilterMode mipmapFilter = FilterMode::Nearest; + MipmapFilterMode mipmapFilter = MipmapFilterMode::Nearest; float lodMinClamp = 0.0f; - float lodMaxClamp = 1000.0f; + float lodMaxClamp = 32.0f; CompareFunction compare = CompareFunction::Undefined; uint16_t maxAnisotropy = 1; }; @@ -1491,7 +1520,7 @@ namespace wgpu { sType = SType::ShaderModuleWGSLDescriptor; } static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct), alignof(char const * )); - alignas(kFirstMemberAlignment) char const * source; + alignas(kFirstMemberAlignment) char const * code; }; struct StencilFaceState { @@ -1568,7 +1597,7 @@ namespace wgpu { ChainedStruct const * nextInChain = nullptr; char const * label = nullptr; BindGroupLayout layout; - uint32_t entryCount; + size_t entryCount; BindGroupEntry const * entries; }; @@ -1589,22 +1618,22 @@ namespace wgpu { struct CompilationInfo { ChainedStruct const * nextInChain = nullptr; - uint32_t messageCount; + size_t messageCount; CompilationMessage const * messages; }; struct ComputePassDescriptor { ChainedStruct const * nextInChain = nullptr; char const * label = nullptr; - uint32_t timestampWriteCount = 0; + size_t timestampWriteCount = 0; ComputePassTimestampWrite const * timestampWrites; }; struct DepthStencilState { ChainedStruct const * nextInChain = nullptr; TextureFormat format; - bool depthWriteEnabled = false; - CompareFunction depthCompare = CompareFunction::Always; + bool depthWriteEnabled; + CompareFunction depthCompare; StencilFaceState stencilFront; StencilFaceState stencilBack; uint32_t stencilReadMask = 0xFFFFFFFF; @@ -1632,7 +1661,7 @@ namespace wgpu { ChainedStruct const * nextInChain = nullptr; ShaderModule module; char const * entryPoint; - uint32_t constantCount = 0; + size_t constantCount = 0; ConstantEntry const * constants; }; @@ -1663,21 +1692,21 @@ namespace wgpu { TextureFormat format; uint32_t mipLevelCount = 1; uint32_t sampleCount = 1; - uint32_t viewFormatCount = 0; + size_t viewFormatCount = 0; TextureFormat const * viewFormats; }; struct VertexBufferLayout { uint64_t arrayStride; VertexStepMode stepMode = VertexStepMode::Vertex; - uint32_t attributeCount; + size_t attributeCount; VertexAttribute const * attributes; }; struct BindGroupLayoutDescriptor { ChainedStruct const * nextInChain = nullptr; char const * label = nullptr; - uint32_t entryCount; + size_t entryCount; BindGroupLayoutEntry const * entries; }; @@ -1698,20 +1727,22 @@ namespace wgpu { struct DeviceDescriptor { ChainedStruct const * nextInChain = nullptr; char const * label = nullptr; - uint32_t requiredFeaturesCount = 0; + size_t requiredFeaturesCount = 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; - uint32_t colorAttachmentCount; + size_t colorAttachmentCount; RenderPassColorAttachment const * colorAttachments; RenderPassDepthStencilAttachment const * depthStencilAttachment = nullptr; QuerySet occlusionQuerySet = nullptr; - uint32_t timestampWriteCount = 0; + size_t timestampWriteCount = 0; RenderPassTimestampWrite const * timestampWrites; }; @@ -1719,9 +1750,9 @@ namespace wgpu { ChainedStruct const * nextInChain = nullptr; ShaderModule module; char const * entryPoint; - uint32_t constantCount = 0; + size_t constantCount = 0; ConstantEntry const * constants; - uint32_t bufferCount = 0; + size_t bufferCount = 0; VertexBufferLayout const * buffers; }; @@ -1729,9 +1760,9 @@ namespace wgpu { ChainedStruct const * nextInChain = nullptr; ShaderModule module; char const * entryPoint; - uint32_t constantCount = 0; + size_t constantCount = 0; ConstantEntry const * constants; - uint32_t targetCount; + size_t targetCount; ColorTargetState const * targets; }; diff --git a/system/lib/webgpu/webgpu_cpp.cpp b/system/lib/webgpu/webgpu_cpp.cpp index 4945cb606f81..df0583329eb4 100644 --- a/system/lib/webgpu/webgpu_cpp.cpp +++ b/system/lib/webgpu/webgpu_cpp.cpp @@ -1,5 +1,10 @@ #include "webgpu/webgpu_cpp.h" +#ifdef __GNUC__ +// error: 'offsetof' within non-standard-layout type 'wgpu::XXX' is conditionally-supported +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + namespace wgpu { // AdapterType @@ -81,11 +86,23 @@ namespace wgpu { 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::Error) == WGPUBufferMapAsyncStatus_Error, "value mismatch for BufferMapAsyncStatus::Error"); + 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"); // CompareFunction @@ -135,7 +152,8 @@ namespace wgpu { 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::Error) == WGPUCreatePipelineAsyncStatus_Error, "value mismatch for CreatePipelineAsyncStatus::Error"); + 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"); @@ -164,6 +182,7 @@ namespace wgpu { 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 @@ -173,6 +192,7 @@ namespace wgpu { 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"); @@ -190,6 +210,10 @@ namespace wgpu { 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 @@ -225,6 +249,14 @@ namespace wgpu { 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::Nearest) == WGPUMipmapFilterMode_Nearest, "value mismatch for MipmapFilterMode::Nearest"); + static_assert(static_cast(MipmapFilterMode::Linear) == WGPUMipmapFilterMode_Linear, "value mismatch for MipmapFilterMode::Linear"); + // PipelineStatisticName static_assert(sizeof(PipelineStatisticName) == sizeof(WGPUPipelineStatisticName), "sizeof mismatch for PipelineStatisticName"); @@ -373,16 +405,6 @@ namespace wgpu { 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"); - // TextureComponentType - - static_assert(sizeof(TextureComponentType) == sizeof(WGPUTextureComponentType), "sizeof mismatch for TextureComponentType"); - static_assert(alignof(TextureComponentType) == alignof(WGPUTextureComponentType), "alignof mismatch for TextureComponentType"); - - static_assert(static_cast(TextureComponentType::Float) == WGPUTextureComponentType_Float, "value mismatch for TextureComponentType::Float"); - static_assert(static_cast(TextureComponentType::Sint) == WGPUTextureComponentType_Sint, "value mismatch for TextureComponentType::Sint"); - static_assert(static_cast(TextureComponentType::Uint) == WGPUTextureComponentType_Uint, "value mismatch for TextureComponentType::Uint"); - static_assert(static_cast(TextureComponentType::DepthComparison) == WGPUTextureComponentType_DepthComparison, "value mismatch for TextureComponentType::DepthComparison"); - // TextureDimension static_assert(sizeof(TextureDimension) == sizeof(WGPUTextureDimension), "sizeof mismatch for TextureDimension"); @@ -658,6 +680,8 @@ namespace wgpu { "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 @@ -774,6 +798,12 @@ namespace wgpu { "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"); // ComputePassTimestampWrite @@ -834,6 +864,8 @@ namespace wgpu { "offsetof mismatch for Limits::maxTextureArrayLayers"); static_assert(offsetof(Limits, maxBindGroups) == offsetof(WGPULimits, maxBindGroups), "offsetof mismatch for Limits::maxBindGroups"); + 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), @@ -858,6 +890,8 @@ namespace wgpu { "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), @@ -868,6 +902,8 @@ namespace wgpu { "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), @@ -1062,6 +1098,8 @@ namespace wgpu { "offsetof mismatch for RequestAdapterOptions::powerPreference"); 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 @@ -1128,8 +1166,8 @@ namespace wgpu { static_assert(sizeof(ShaderModuleWGSLDescriptor) == sizeof(WGPUShaderModuleWGSLDescriptor), "sizeof mismatch for ShaderModuleWGSLDescriptor"); static_assert(alignof(ShaderModuleWGSLDescriptor) == alignof(WGPUShaderModuleWGSLDescriptor), "alignof mismatch for ShaderModuleWGSLDescriptor"); - static_assert(offsetof(ShaderModuleWGSLDescriptor, source) == offsetof(WGPUShaderModuleWGSLDescriptor, source), - "offsetof mismatch for ShaderModuleWGSLDescriptor::source"); + static_assert(offsetof(ShaderModuleWGSLDescriptor, code) == offsetof(WGPUShaderModuleWGSLDescriptor, code), + "offsetof mismatch for ShaderModuleWGSLDescriptor::code"); // StencilFaceState @@ -1540,6 +1578,10 @@ namespace wgpu { "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 @@ -1646,7 +1688,7 @@ namespace wgpu { return result; } void Adapter::RequestDevice(DeviceDescriptor const * descriptor, RequestDeviceCallback callback, void * userdata) const { - wgpuAdapterRequestDevice(Get(), reinterpret_cast(descriptor), callback, reinterpret_cast(userdata)); + wgpuAdapterRequestDevice(Get(), reinterpret_cast(descriptor), callback, userdata); } void Adapter::WGPUReference(WGPUAdapter handle) { if (handle != nullptr) { @@ -1709,6 +1751,10 @@ namespace wgpu { 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; @@ -1722,7 +1768,7 @@ namespace wgpu { 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, reinterpret_cast(userdata)); + wgpuBufferMapAsync(Get(), static_cast(mode), offset, size, callback, userdata); } void Buffer::SetLabel(char const * label) const { wgpuBufferSetLabel(Get(), reinterpret_cast(label)); @@ -1850,7 +1896,7 @@ namespace wgpu { void ComputePassEncoder::PushDebugGroup(char const * groupLabel) const { wgpuComputePassEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); } - void ComputePassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { + 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 { @@ -1922,7 +1968,7 @@ namespace wgpu { return ComputePipeline::Acquire(result); } void Device::CreateComputePipelineAsync(ComputePipelineDescriptor const * descriptor, CreateComputePipelineAsyncCallback callback, void * userdata) const { - wgpuDeviceCreateComputePipelineAsync(Get(), reinterpret_cast(descriptor), callback, reinterpret_cast(userdata)); + wgpuDeviceCreateComputePipelineAsync(Get(), reinterpret_cast(descriptor), callback, userdata); } PipelineLayout Device::CreatePipelineLayout(PipelineLayoutDescriptor const * descriptor) const { auto result = wgpuDeviceCreatePipelineLayout(Get(), reinterpret_cast(descriptor)); @@ -1941,7 +1987,7 @@ namespace wgpu { return RenderPipeline::Acquire(result); } void Device::CreateRenderPipelineAsync(RenderPipelineDescriptor const * descriptor, CreateRenderPipelineAsyncCallback callback, void * userdata) const { - wgpuDeviceCreateRenderPipelineAsync(Get(), reinterpret_cast(descriptor), callback, reinterpret_cast(userdata)); + wgpuDeviceCreateRenderPipelineAsync(Get(), reinterpret_cast(descriptor), callback, userdata); } Sampler Device::CreateSampler(SamplerDescriptor const * descriptor) const { auto result = wgpuDeviceCreateSampler(Get(), reinterpret_cast(descriptor)); @@ -1978,21 +2024,17 @@ namespace wgpu { auto result = wgpuDeviceHasFeature(Get(), static_cast(feature)); return result; } - bool Device::PopErrorScope(ErrorCallback callback, void * userdata) const { - auto result = wgpuDevicePopErrorScope(Get(), callback, reinterpret_cast(userdata)); - 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::SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const { - wgpuDeviceSetDeviceLostCallback(Get(), callback, reinterpret_cast(userdata)); - } void Device::SetLabel(char const * label) const { wgpuDeviceSetLabel(Get(), reinterpret_cast(label)); } void Device::SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const { - wgpuDeviceSetUncapturedErrorCallback(Get(), callback, reinterpret_cast(userdata)); + wgpuDeviceSetUncapturedErrorCallback(Get(), callback, userdata); } void Device::WGPUReference(WGPUDevice handle) { if (handle != nullptr) { @@ -2018,7 +2060,7 @@ namespace wgpu { wgpuInstanceProcessEvents(Get()); } void Instance::RequestAdapter(RequestAdapterOptions const * options, RequestAdapterCallback callback, void * userdata) const { - wgpuInstanceRequestAdapter(Get(), reinterpret_cast(options), callback, reinterpret_cast(userdata)); + wgpuInstanceRequestAdapter(Get(), reinterpret_cast(options), callback, userdata); } void Instance::WGPUReference(WGPUInstance handle) { if (handle != nullptr) { @@ -2086,12 +2128,12 @@ namespace wgpu { static_assert(alignof(Queue) == alignof(WGPUQueue), "alignof mismatch for Queue"); void Queue::OnSubmittedWorkDone(uint64_t signalValue, QueueWorkDoneCallback callback, void * userdata) const { - wgpuQueueOnSubmittedWorkDone(Get(), signalValue, callback, reinterpret_cast(userdata)); + wgpuQueueOnSubmittedWorkDone(Get(), signalValue, callback, userdata); } void Queue::SetLabel(char const * label) const { wgpuQueueSetLabel(Get(), reinterpret_cast(label)); } - void Queue::Submit(uint32_t commandCount, CommandBuffer const * commands) const { + 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 { @@ -2116,6 +2158,9 @@ namespace wgpu { 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); @@ -2157,7 +2202,7 @@ namespace wgpu { void RenderBundleEncoder::PushDebugGroup(char const * groupLabel) const { wgpuRenderBundleEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); } - void RenderBundleEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { + 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 { @@ -2215,8 +2260,8 @@ namespace wgpu { void RenderPassEncoder::EndPipelineStatisticsQuery() const { wgpuRenderPassEncoderEndPipelineStatisticsQuery(Get()); } - void RenderPassEncoder::ExecuteBundles(uint32_t bundlesCount, RenderBundle const * bundles) const { - wgpuRenderPassEncoderExecuteBundles(Get(), bundlesCount, reinterpret_cast(bundles)); + 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)); @@ -2227,7 +2272,7 @@ namespace wgpu { void RenderPassEncoder::PushDebugGroup(char const * groupLabel) const { wgpuRenderPassEncoderPushDebugGroup(Get(), reinterpret_cast(groupLabel)); } - void RenderPassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const { + 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 { @@ -2316,7 +2361,7 @@ namespace wgpu { static_assert(alignof(ShaderModule) == alignof(WGPUShaderModule), "alignof mismatch for ShaderModule"); void ShaderModule::GetCompilationInfo(CompilationInfoCallback callback, void * userdata) const { - wgpuShaderModuleGetCompilationInfo(Get(), callback, reinterpret_cast(userdata)); + wgpuShaderModuleGetCompilationInfo(Get(), callback, userdata); } void ShaderModule::SetLabel(char const * label) const { wgpuShaderModuleSetLabel(Get(), reinterpret_cast(label)); @@ -2463,4 +2508,4 @@ namespace wgpu { return reinterpret_cast(result); } -} \ No newline at end of file +} diff --git a/test/webgpu_basic_rendering.cpp b/test/webgpu_basic_rendering.cpp index 7db32b61e8e3..29d2eda91f04 100644 --- a/test/webgpu_basic_rendering.cpp +++ b/test/webgpu_basic_rendering.cpp @@ -75,7 +75,7 @@ void init() { wgpu::ShaderModule shaderModule{}; { wgpu::ShaderModuleWGSLDescriptor wgslDesc{}; - wgslDesc.source = shaderCode; + wgslDesc.code = shaderCode; wgpu::ShaderModuleDescriptor descriptor{}; descriptor.nextInChain = &wgslDesc;