mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
webgpu: Update to wgpu 0.20 (#32173)
* Update wgpu to 0.20 * good expectations * Throw TypeError in configure on unsupported format instead of panic * Expect * `into_command_buffer_id`,`into_command_encoder_id`
This commit is contained in:
parent
5298ccb0eb
commit
c4f8599404
21 changed files with 1552 additions and 852 deletions
|
@ -208,14 +208,19 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-configure>
|
||||
fn Configure(&self, descriptor: &GPUCanvasConfiguration) {
|
||||
fn Configure(&self, descriptor: &GPUCanvasConfiguration) -> Fallible<()> {
|
||||
// Step 1 is let
|
||||
// Step 2
|
||||
// TODO: device features
|
||||
let format = match descriptor.format {
|
||||
GPUTextureFormat::Rgba8unorm | GPUTextureFormat::Rgba8unorm_srgb => ImageFormat::RGBA8,
|
||||
GPUTextureFormat::Bgra8unorm | GPUTextureFormat::Bgra8unorm_srgb => ImageFormat::BGRA8,
|
||||
_ => panic!("SwapChain format({:?}) not supported", descriptor.format), // TODO: Better handling
|
||||
_ => {
|
||||
return Err(Error::Type(format!(
|
||||
"SwapChain format({:?}) not supported",
|
||||
descriptor.format
|
||||
)))
|
||||
},
|
||||
};
|
||||
|
||||
// Step 3
|
||||
|
@ -287,6 +292,7 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
.set(Some(&descriptor.device.CreateTexture(&text_desc).unwrap()));
|
||||
|
||||
self.webrender_image.set(Some(receiver.recv().unwrap()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-unconfigure>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue