Chromium's WebGPU implementation and Dawn's API try to closely follow changes to the WebGPU specification. When the WebGPU IDL changes, as best as possible Chromium and Dawn will support both the "old" and the "new" version of the IDL at the same time so prototypes can be updated. In JS, uses of the "old" path will result in a console warning, while when using Dawn directly, the "old" path will print a warning to stderr.
Note that all changes to Dawn's API make it closer to webgpu.h
that we hope will allow applications to target both Dawn, and wgpu in native before being compiled in WASM. Emscripten will also be updated from the "old" to the "new" API but won't have the smooth transition since developers control which version of emscripten they use.
A couple weeks after an update like this one, the "old" version will be removed. This means that the "old" version of the items below will start being removed from Chromium/Dawn starting on 2020-05-12.
GPUDevice
.createQueue()
-> .defaultQueue
WebGPU PR
No changes for JS: .createQueue()
was already removed from Chromium so this is only a Dawn API change.
BindGroup[Layout]Binding
-> BindGroup[Layout]Entry
WebGPU PR
No changes for JS.
The name of structure has been updated in Dawn's API. The only change needed is replacing references to wgpu::BindGroupLayoutBinding
to wgpu::BindGroupLayoutEntry
and references to wgpu::BindGroupBinding
to wgpu::BindGroupEntry
.
BindGroup[Layout]Descriptor
.bindings
-> .entries
WebGPU PR
In JS the dictionary member name needs to be updated:
Likewise when using Dawn's API changes are needed:
BindGroupLayoutEntry.textureDimension
-> viewDimension
WebGPU PR
In JS the dictionary member name needs to be updated:
Likewise when using Dawn's API changes are needed:
rowPitch
and imageHeight
WebGPU PR
They are now called bytesPerRow
and rowsPerImage
respectively. In JS the member of dictionaries needs to be updated.
Likewise in Dawn's API uses of wgpu::BufferCopyView
must be updated:
wgpu::ShaderModuleDescriptor
WebGPU PR
Dawn is looking to support both SPIR-V and WGSL at the same time. This will be done by using the "chained structure" extension mechanism. Ingestion of SPIR-V will be moved to a chained structure.
WebGPU PR
Defaults were added to the draw commands so that in JS pass.draw(3, 1, 0, 0)
can be written pass.draw(3)
and pass.drawIndexed(3, 1, 0, 0, 0)
can be written pass.drawIndexed(3)
. Similar defaults are added to Dawn's C++ API.
WebGPU PR
GPUSamplerDescriptor.compare
is now optional and must be set if and only if the sampler is a comparison sampler meant to be used with the new "comparison-sampler"
binding type. Likewise in Dawn's C++ API where wgpu::SamplerDescriptor::compare
default to wgpu::CompareFunction::Undefined
which represents the member not being set.
size
for GPURenderEncoderBase.set[Vertex|Index]Buffer
WebGPU PR
Calls to GPURenderEncoderBase.setVertexBuffer
and GPURenderEncoderBase.setIndexBuffer
now take an additional and optional size argument. If left to the default value of 0, size
represents the entire length of the buffer after offset
. Similar defaults are added to Dawn's C++ API.
WebGPU PR
This adds a couple new GPUBindingType
and GPUBindGroupLayoutEntry.storageTextureFormat
. No changes needed to update your code.
GPUBuffer.setSubData
removalWe're waiting for discussions around writeBuffer
to finish in the group before removing GPUBuffer.setSubData
in Chromium and wgpu::Buffer::SetSubData
in Dawn.
GPUShaderModuleDescriptor.code
being WGSL instead of SPIRVWebGPU PR
Chromium's WGSL implementation isn't complete enough to be useful to write applications so GPUShaderModuleDescriptor.code
still only allows Uint32Array
containing SPIRV.
GPUTextureDescriptor.arrayLayerCount
in size.depth
WebGPU PR
This isn't implemented in Dawn yet. In JS texture creation needs to be updated (but there will be another PSA before the "old" path is removed).
WebGPU PR
They aren't implemented in Chromium/Dawn yet.
They aren't implemented in Chromium/Dawn yet.