Expand description
dawn-sys provides unsafe Rust bindings for Dawn, the open-source and cross-platform implementation of the WebGPU standard that powers Google Chrome, Microsoft Edge, and other Chromium-based browsers. More precisely, it provides:
- Unsafe bindings to
webgpu.h, which is a one-to-one mapping of the WebGPU IDL. This crate mainly exposes bindings generated usingrust-bindgenbut also revamps some details for a more handy API. - Pre-built Dawn binaries (
webgpu_dawn.dll), kindly provided by Mārtiņš Možeiko’sbuild-dawnautomation on GitHub Actions that rebuilds the Dawn binaries once per week. This crate contains a build script that handles chores like copying necessary binaries to the output directory, making everything ready out of the box.
If you are looking for safe and idiomatic Rust wrappers for Dawn or webgpu.h, you should consider dawn-rs instead of this crate, which provides higher-level and more “Rust-style” abstractions based on this crate. If you are just looking for a higher-level graphics API wrapper and guarenteed consistent behavior and performance with mainstream browsers (Google Chrome, Microsoft Edge, …) isn’t one your major concerns, please also try wgpu before reaching for dawn-rs or dawn-sys. wgpu is another open source and cross-platform implementation of the WebGPU specification that is fully written in Rust and is used in Mozilla Firefox, Servo and Deno for WebGPU support. It also serves as the de-facto standard of high-level, cross-platform graphics development in the Rust ecosystem.
This crate is still a work in progress. USE AT YOUR OWN RISK. It should serve in most common cases but may lack certain APIs or fail on corner cases. The aforementioned wgpu crate is way more mature and should always be considered ahead of this crate.
This crate is currently Windows-only. Given the cross-platform capabilities of Dawn, it is planned to eventually support macOS, Linux and web in the long term, but it is not currently a key focus of the maintainer of this crate. If you’d like to help, you are welcome to open an issue for further discussion.
This crate assumes your familiarity with GPU development using webgpu.h, the WebGPU C API. Because of this (and also considering that currently a large part of webgpu.h APIs have still not been documented yet :(), this crate is not providing rustdoc for a large part of its exported items except for those that have been well documented in webgpu.h and those that are re-exported in dawn-rs. Completing the missing docs in webgpu.h is not currently a key focus of the maintainer of this crate. If you’d like to help, please contribute to WebGPU-Headers and this crate will follow upstream updates.
This crate is licensed under the BSD-3-Clause license, aligning to Dawn and WebGPU-Headers. This whole repository is also licensed under the GNU General Public License, Version 3.0, see README.md at the repository root.
This crate welcomes all kind of contributions. Open an issue or PR at any time for bugfixes or feature requests.
Structs§
- WGPU
Adapter Info - WGPU
Adapter Type Iter - An iterator over the variants of WGPUAdapterType
- WGPU
Address Mode Iter - An iterator over the variants of WGPUAddressMode
- WGPU
Backend Type Iter - An iterator over the variants of WGPUBackendType
- WGPU
Bind Group Descriptor - WGPU
Bind Group Entry - WGPU
Bind Group Layout Descriptor - WGPU
Bind Group Layout Entry - WGPU
Blend Component - WGPU
Blend Factor Iter - An iterator over the variants of WGPUBlendFactor
- WGPU
Blend Operation Iter - An iterator over the variants of WGPUBlendOperation
- WGPU
Blend State - WGPU
Buffer Binding Layout - WGPU
Buffer Binding Type Iter - An iterator over the variants of WGPUBufferBindingType
- WGPU
Buffer Descriptor - WGPU
Buffer MapCallback Info - WGPU
Buffer MapState Iter - An iterator over the variants of WGPUBufferMapState
- WGPU
Buffer Usage - WGPU
Callback Mode Iter - An iterator over the variants of WGPUCallbackMode
- WGPU
Chained Struct - WGPU
Color - WGPU
Color Target State - WGPU
Color Write Mask - WGPU
Command Buffer Descriptor - WGPU
Command Encoder Descriptor - WGPU
Compare Function Iter - An iterator over the variants of WGPUCompareFunction
- WGPU
Compilation Info - WGPU
Compilation Info Callback Info - WGPU
Compilation Info Request Status Iter - An iterator over the variants of WGPUCompilationInfoRequestStatus
- WGPU
Compilation Message - WGPU
Compilation Message Type Iter - An iterator over the variants of WGPUCompilationMessageType
- WGPU
Composite Alpha Mode Iter - An iterator over the variants of WGPUCompositeAlphaMode
- WGPU
Compute Pass Descriptor - WGPU
Compute Pipeline Descriptor - WGPU
Compute State - WGPU
Constant Entry - WGPU
Create Compute Pipeline Async Callback Info - WGPU
Create Pipeline Async Status Iter - An iterator over the variants of WGPUCreatePipelineAsyncStatus
- WGPU
Create Render Pipeline Async Callback Info - WGPU
Cull Mode Iter - An iterator over the variants of WGPUCullMode
- WGPU
Depth Stencil State - WGPU
Device Descriptor - WGPU
Device Lost Callback Info - WGPU
Device Lost Reason Iter - An iterator over the variants of WGPUDeviceLostReason
- WGPU
Error Filter Iter - An iterator over the variants of WGPUErrorFilter
- WGPU
Error Type Iter - An iterator over the variants of WGPUErrorType
- WGPU
Extent3D - WGPU
Feature Level Iter - An iterator over the variants of WGPUFeatureLevel
- WGPU
Feature Name Iter - An iterator over the variants of WGPUFeatureName
- WGPU
Filter Mode Iter - An iterator over the variants of WGPUFilterMode
- WGPU
Fragment State - WGPU
Front Face Iter - An iterator over the variants of WGPUFrontFace
- WGPU
Future - WGPU
Future Wait Info - WGPU
Index Format Iter - An iterator over the variants of WGPUIndexFormat
- WGPU
Instance Descriptor - WGPU
Instance Feature Name Iter - An iterator over the variants of WGPUInstanceFeatureName
- WGPU
Instance Limits - WGPU
Limits - WGPU
Load OpIter - An iterator over the variants of WGPULoadOp
- WGPU
MapAsync Status Iter - An iterator over the variants of WGPUMapAsyncStatus
- WGPU
MapMode - WGPU
Mipmap Filter Mode Iter - An iterator over the variants of WGPUMipmapFilterMode
- WGPU
Multisample State - WGPU
Optional Bool Iter - An iterator over the variants of WGPUOptionalBool
- WGPU
Origin3D - WGPU
Pass Timestamp Writes - WGPU
Pipeline Layout Descriptor - WGPU
PopError Scope Callback Info - WGPU
PopError Scope Status Iter - An iterator over the variants of WGPUPopErrorScopeStatus
- WGPU
Power Preference Iter - An iterator over the variants of WGPUPowerPreference
- WGPU
Predefined Color Space Iter - An iterator over the variants of WGPUPredefinedColorSpace
- WGPU
Present Mode Iter - An iterator over the variants of WGPUPresentMode
- WGPU
Primitive State - WGPU
Primitive Topology Iter - An iterator over the variants of WGPUPrimitiveTopology
- WGPU
Query SetDescriptor - WGPU
Query Type Iter - An iterator over the variants of WGPUQueryType
- WGPU
Queue Descriptor - WGPU
Queue Work Done Callback Info - WGPU
Queue Work Done Status Iter - An iterator over the variants of WGPUQueueWorkDoneStatus
- WGPU
Render Bundle Descriptor - WGPU
Render Bundle Encoder Descriptor - WGPU
Render Pass Color Attachment - WGPU
Render Pass Depth Stencil Attachment - WGPU
Render Pass Descriptor - WGPU
Render Pass MaxDraw Count - WGPU
Render Pipeline Descriptor - WGPU
Request Adapter Callback Info - WGPU
Request Adapter Options - WGPU
Request Adapter Status Iter - An iterator over the variants of WGPURequestAdapterStatus
- WGPU
Request Adapter WebXR Options - WGPU
Request Device Callback Info - WGPU
Request Device Status Iter - An iterator over the variants of WGPURequestDeviceStatus
- WGPUS
Type Iter - An iterator over the variants of WGPUSType
- WGPU
Sampler Binding Layout - WGPU
Sampler Binding Type Iter - An iterator over the variants of WGPUSamplerBindingType
- WGPU
Sampler Descriptor - WGPU
Shader Module Descriptor - WGPU
Shader SourceSPIRV - WGPU
Shader SourceWGSL - WGPU
Shader Stage - WGPU
Status Iter - An iterator over the variants of WGPUStatus
- WGPU
Stencil Face State - WGPU
Stencil Operation Iter - An iterator over the variants of WGPUStencilOperation
- WGPU
Storage Texture Access Iter - An iterator over the variants of WGPUStorageTextureAccess
- WGPU
Storage Texture Binding Layout - WGPU
Store OpIter - An iterator over the variants of WGPUStoreOp
- WGPU
String View - WGPU
Supported Features - WGPU
Supported Instance Features - WGPU
SupportedWGSL Language Features - WGPU
Surface Capabilities - WGPU
Surface Color Management - WGPU
Surface Configuration - WGPU
Surface Descriptor - WGPU
Surface GetCurrent Texture Status Iter - An iterator over the variants of WGPUSurfaceGetCurrentTextureStatus
- WGPU
Surface Source Android Native Window - WGPU
Surface Source Metal Layer - WGPU
Surface Source Wayland Surface - WGPU
Surface Source WindowsHWND - WGPU
Surface SourceXCB Window - WGPU
Surface Source Xlib Window - WGPU
Surface Texture - WGPU
Texel Copy Buffer Info - WGPU
Texel Copy Buffer Layout - WGPU
Texel Copy Texture Info - WGPU
Texture Aspect Iter - An iterator over the variants of WGPUTextureAspect
- WGPU
Texture Binding Layout - WGPU
Texture Descriptor - WGPU
Texture Dimension Iter - An iterator over the variants of WGPUTextureDimension
- WGPU
Texture Format Iter - An iterator over the variants of WGPUTextureFormat
- WGPU
Texture Sample Type Iter - An iterator over the variants of WGPUTextureSampleType
- WGPU
Texture Usage - WGPU
Texture View Descriptor - WGPU
Texture View Dimension Iter - An iterator over the variants of WGPUTextureViewDimension
- WGPU
Tone Mapping Mode Iter - An iterator over the variants of WGPUToneMappingMode
- WGPU
Uncaptured Error Callback Info - WGPU
Vertex Attribute - WGPU
Vertex Buffer Layout - WGPU
Vertex Format Iter - An iterator over the variants of WGPUVertexFormat
- WGPU
Vertex State - WGPU
Vertex Step Mode Iter - An iterator over the variants of WGPUVertexStepMode
- WGPUWGSL
Language Feature Name Iter - An iterator over the variants of WGPUWGSLLanguageFeatureName
- WGPU
Wait Status Iter - An iterator over the variants of WGPUWaitStatus
Enums§
- WGPU
Adapter Type - WGPU
Address Mode - WGPU
Backend Type - WGPU
Blend Factor - WGPU
Blend Operation - WGPU
Buffer Binding Type - WGPU
Buffer MapState - WGPU
Callback Mode - WGPU
Compare Function - WGPU
Compilation Info Request Status - WGPU
Compilation Message Type - WGPU
Composite Alpha Mode - WGPU
Create Pipeline Async Status - WGPU
Cull Mode - WGPU
Device Lost Reason - WGPU
Error Filter - WGPU
Error Type - WGPU
Feature Level - WGPU
Feature Name - WGPU
Filter Mode - WGPU
Front Face - WGPU
Index Format - WGPU
Instance Feature Name - WGPU
Load Op - WGPU
MapAsync Status - WGPU
Mipmap Filter Mode - WGPU
Optional Bool - WGPU
PopError Scope Status - WGPU
Power Preference - WGPU
Predefined Color Space - WGPU
Present Mode - WGPU
Primitive Topology - WGPU
Query Type - WGPU
Queue Work Done Status - WGPU
Request Adapter Status - WGPU
Request Device Status - WGPUS
Type - WGPU
Sampler Binding Type - WGPU
Status - WGPU
Stencil Operation - WGPU
Storage Texture Access - WGPU
Store Op - WGPU
Surface GetCurrent Texture Status - WGPU
Texture Aspect - WGPU
Texture Dimension - WGPU
Texture Format - WGPU
Texture Sample Type - WGPU
Texture View Dimension - WGPU
Tone Mapping Mode - WGPU
Vertex Format - WGPU
Vertex Step Mode - WGPUWGSL
Language Feature Name - WGPU
Wait Status
Constants§
- WGPU_
ARRAY_ LAYER_ COUNT_ UNDEFINED - Indicates no array layer count is specified.
- WGPU_
COPY_ STRIDE_ UNDEFINED - Indicates no copy stride is specified.
- WGPU_
DEPTH_ CLEAR_ VALUE_ UNDEFINED - Indicates no depth clear value is specified.
- WGPU_
DEPTH_ SLICE_ UNDEFINED - Indicates no depth slice is specified.
- WGPU_
FALSE falsevalue ofWGPUBool.- WGPU_
LIMIT_ U32_ UNDEFINED - For
u32limits, indicates no limit value is specified. - WGPU_
LIMIT_ U64_ UNDEFINED - For
u64limits, indicates no limit value is specified. - WGPU_
MIP_ LEVEL_ COUNT_ UNDEFINED - Indicates no mip level count is specified.
- WGPU_
QUERY_ SET_ INDEX_ UNDEFINED - Indicates no query set index is specified.
- WGPU_
STRLEN - Sentinel value used in
WGPUStringView. - WGPU_
TRUE truevalue ofWGPUBool.- WGPU_
WHOLE_ MAP_ SIZE - Indicates a size extending to the end of the buffer.
- WGPU_
WHOLE_ SIZE - Indicates a size extending to the end of the buffer.
Functions§
- wgpu
Adapter ⚠AddRef - wgpu
Adapter ⚠GetFeatures - wgpu
Adapter ⚠GetInfo - wgpu
Adapter ⚠GetLimits - wgpu
Adapter ⚠HasFeature - wgpu
Adapter ⚠Release - wgpu
Adapter ⚠Request Device - wgpu
Bind ⚠Group AddRef - wgpu
Bind ⚠Group Layout AddRef - wgpu
Bind ⚠Group Layout Release - wgpu
Bind ⚠Group Layout SetLabel - wgpu
Bind ⚠Group Release - wgpu
Bind ⚠Group SetLabel - wgpu
Buffer ⚠AddRef - wgpu
Buffer ⚠Destroy - wgpu
Buffer ⚠GetConst Mapped Range - wgpu
Buffer ⚠GetMap State - wgpu
Buffer ⚠GetMapped Range - wgpu
Buffer ⚠GetSize - wgpu
Buffer ⚠GetUsage - wgpu
Buffer ⚠MapAsync - wgpu
Buffer ⚠Read Mapped Range - wgpu
Buffer ⚠Release - wgpu
Buffer ⚠SetLabel - wgpu
Buffer ⚠Unmap - wgpu
Buffer ⚠Write Mapped Range - wgpu
Command ⚠Buffer AddRef - wgpu
Command ⚠Buffer Release - wgpu
Command ⚠Buffer SetLabel - wgpu
Command ⚠Encoder AddRef - wgpu
Command ⚠Encoder Begin Compute Pass - wgpu
Command ⚠Encoder Begin Render Pass - wgpu
Command ⚠Encoder Clear Buffer - wgpu
Command ⚠Encoder Copy Buffer ToBuffer - wgpu
Command ⚠Encoder Copy Buffer ToTexture - wgpu
Command ⚠Encoder Copy Texture ToBuffer - wgpu
Command ⚠Encoder Copy Texture ToTexture - wgpu
Command ⚠Encoder Finish - wgpu
Command ⚠Encoder Insert Debug Marker - wgpu
Command ⚠Encoder PopDebug Group - wgpu
Command ⚠Encoder Push Debug Group - wgpu
Command ⚠Encoder Release - wgpu
Command ⚠Encoder Resolve Query Set - wgpu
Command ⚠Encoder SetLabel - wgpu
Command ⚠Encoder Write Timestamp - wgpu
Compute ⚠Pass Encoder AddRef - wgpu
Compute ⚠Pass Encoder Dispatch Workgroups - wgpu
Compute ⚠Pass Encoder Dispatch Workgroups Indirect - wgpu
Compute ⚠Pass Encoder End - wgpu
Compute ⚠Pass Encoder Insert Debug Marker - wgpu
Compute ⚠Pass Encoder PopDebug Group - wgpu
Compute ⚠Pass Encoder Push Debug Group - wgpu
Compute ⚠Pass Encoder Release - wgpu
Compute ⚠Pass Encoder SetBind Group - wgpu
Compute ⚠Pass Encoder SetLabel - wgpu
Compute ⚠Pass Encoder SetPipeline - wgpu
Compute ⚠Pipeline AddRef - wgpu
Compute ⚠Pipeline GetBind Group Layout - wgpu
Compute ⚠Pipeline Release - wgpu
Compute ⚠Pipeline SetLabel - wgpu
Create ⚠Instance - wgpu
Device ⚠AddRef - wgpu
Device ⚠Create Bind Group - wgpu
Device ⚠Create Bind Group Layout - wgpu
Device ⚠Create Buffer - wgpu
Device ⚠Create Command Encoder - wgpu
Device ⚠Create Compute Pipeline - wgpu
Device ⚠Create Compute Pipeline Async - wgpu
Device ⚠Create Pipeline Layout - wgpu
Device ⚠Create Query Set - wgpu
Device ⚠Create Render Bundle Encoder - wgpu
Device ⚠Create Render Pipeline - wgpu
Device ⚠Create Render Pipeline Async - wgpu
Device ⚠Create Sampler - wgpu
Device ⚠Create Shader Module - wgpu
Device ⚠Create Texture - wgpu
Device ⚠Destroy - wgpu
Device ⚠GetAdapter Info - wgpu
Device ⚠GetFeatures - wgpu
Device ⚠GetLimits - wgpu
Device ⚠GetLost Future - wgpu
Device ⚠GetQueue - wgpu
Device ⚠HasFeature - wgpu
Device ⚠PopError Scope - wgpu
Device ⚠Push Error Scope - wgpu
Device ⚠Release - wgpu
Device ⚠SetLabel - wgpu
GetInstance ⚠Features - wgpu
GetInstance ⚠Limits - wgpu
HasInstance ⚠Feature - wgpu
Instance ⚠AddRef - wgpu
Instance ⚠Create Surface - wgpu
Instance ⚠GetWGSL Language Features - wgpu
Instance ⚠HasWGSL Language Feature - wgpu
Instance ⚠Process Events - wgpu
Instance ⚠Release - wgpu
Instance ⚠Request Adapter - wgpu
Instance ⚠Wait Any - wgpu
Pipeline ⚠Layout AddRef - wgpu
Pipeline ⚠Layout Release - wgpu
Pipeline ⚠Layout SetLabel - wgpu
Query ⚠SetAdd Ref - wgpu
Query ⚠SetDestroy - wgpu
Query ⚠SetGet Count - wgpu
Query ⚠SetGet Type - wgpu
Query ⚠SetRelease - wgpu
Query ⚠SetSet Label - wgpu
Queue ⚠AddRef - wgpu
Queue ⚠OnSubmitted Work Done - wgpu
Queue ⚠Release - wgpu
Queue ⚠SetLabel - wgpu
Queue ⚠Submit - wgpu
Queue ⚠Write Buffer - wgpu
Queue ⚠Write Texture - wgpu
Render ⚠Bundle AddRef - wgpu
Render ⚠Bundle Encoder AddRef - wgpu
Render ⚠Bundle Encoder Draw - wgpu
Render ⚠Bundle Encoder Draw Indexed - wgpu
Render ⚠Bundle Encoder Draw Indexed Indirect - wgpu
Render ⚠Bundle Encoder Draw Indirect - wgpu
Render ⚠Bundle Encoder Finish - wgpu
Render ⚠Bundle Encoder Insert Debug Marker - wgpu
Render ⚠Bundle Encoder PopDebug Group - wgpu
Render ⚠Bundle Encoder Push Debug Group - wgpu
Render ⚠Bundle Encoder Release - wgpu
Render ⚠Bundle Encoder SetBind Group - wgpu
Render ⚠Bundle Encoder SetIndex Buffer - wgpu
Render ⚠Bundle Encoder SetLabel - wgpu
Render ⚠Bundle Encoder SetPipeline - wgpu
Render ⚠Bundle Encoder SetVertex Buffer - wgpu
Render ⚠Bundle Release - wgpu
Render ⚠Bundle SetLabel - wgpu
Render ⚠Pass Encoder AddRef - wgpu
Render ⚠Pass Encoder Begin Occlusion Query - wgpu
Render ⚠Pass Encoder Draw - wgpu
Render ⚠Pass Encoder Draw Indexed - wgpu
Render ⚠Pass Encoder Draw Indexed Indirect - wgpu
Render ⚠Pass Encoder Draw Indirect - wgpu
Render ⚠Pass Encoder End - wgpu
Render ⚠Pass Encoder EndOcclusion Query - wgpu
Render ⚠Pass Encoder Execute Bundles - wgpu
Render ⚠Pass Encoder Insert Debug Marker - wgpu
Render ⚠Pass Encoder PopDebug Group - wgpu
Render ⚠Pass Encoder Push Debug Group - wgpu
Render ⚠Pass Encoder Release - wgpu
Render ⚠Pass Encoder SetBind Group - wgpu
Render ⚠Pass Encoder SetBlend Constant - wgpu
Render ⚠Pass Encoder SetIndex Buffer - wgpu
Render ⚠Pass Encoder SetLabel - wgpu
Render ⚠Pass Encoder SetPipeline - wgpu
Render ⚠Pass Encoder SetScissor Rect - wgpu
Render ⚠Pass Encoder SetStencil Reference - wgpu
Render ⚠Pass Encoder SetVertex Buffer - wgpu
Render ⚠Pass Encoder SetViewport - wgpu
Render ⚠Pipeline AddRef - wgpu
Render ⚠Pipeline GetBind Group Layout - wgpu
Render ⚠Pipeline Release - wgpu
Render ⚠Pipeline SetLabel - wgpu
Sampler ⚠AddRef - wgpu
Sampler ⚠Release - wgpu
Sampler ⚠SetLabel - wgpu
Shader ⚠Module AddRef - wgpu
Shader ⚠Module GetCompilation Info - wgpu
Shader ⚠Module Release - wgpu
Shader ⚠Module SetLabel - wgpu
Surface ⚠AddRef - wgpu
Surface ⚠Configure - wgpu
Surface ⚠GetCapabilities - wgpu
Surface ⚠GetCurrent Texture - wgpu
Surface ⚠Present - wgpu
Surface ⚠Release - wgpu
Surface ⚠SetLabel - wgpu
Surface ⚠Unconfigure - wgpu
Texture ⚠AddRef - wgpu
Texture ⚠Create View - wgpu
Texture ⚠Destroy - wgpu
Texture ⚠GetDepth OrArray Layers - wgpu
Texture ⚠GetDimension - wgpu
Texture ⚠GetFormat - wgpu
Texture ⚠GetHeight - wgpu
Texture ⚠GetMip Level Count - wgpu
Texture ⚠GetSample Count - wgpu
Texture ⚠GetUsage - wgpu
Texture ⚠GetWidth - wgpu
Texture ⚠Release - wgpu
Texture ⚠SetLabel - wgpu
Texture ⚠View AddRef - wgpu
Texture ⚠View Release - wgpu
Texture ⚠View SetLabel
Type Aliases§
- WGPU
Adapter - WGPU
Bind Group - WGPU
Bind Group Layout - WGPU
Bool - WGPU
Buffer - WGPU
Buffer MapCallback - WGPU
Command Buffer - WGPU
Command Encoder - WGPU
Compilation Info Callback - WGPU
Compute Pass Encoder - WGPU
Compute Pipeline - WGPU
Create Compute Pipeline Async Callback - WGPU
Create Render Pipeline Async Callback - WGPU
Device - WGPU
Device Lost Callback - WGPU
Flags - WGPU
Instance - WGPU
Pipeline Layout - WGPU
PopError Scope Callback - WGPU
Query Set - WGPU
Queue - WGPU
Queue Work Done Callback - WGPU
Render Bundle - WGPU
Render Bundle Encoder - WGPU
Render Pass Encoder - WGPU
Render Pipeline - WGPU
Request Adapter Callback - WGPU
Request Device Callback - WGPU
Sampler - WGPU
Shader Module - WGPU
Surface - WGPU
Texture - WGPU
Texture View - WGPU
Uncaptured Error Callback