mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
55
Cargo.lock
generated
55
Cargo.lock
generated
|
@ -1134,8 +1134,9 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu?rev=32e70bc1635905c508d408eb1cf22b2aa062ffe1#32e70bc1635905c508d408eb1cf22b2aa062ffe1"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b28bfe653d79bd16c77f659305b195b82bb5ce0c0eb2a4846b82ddbd77586813"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"libloading 0.8.3",
|
"libloading 0.8.3",
|
||||||
|
@ -1348,6 +1349,15 @@ dependencies = [
|
||||||
"libloading 0.8.3",
|
"libloading 0.8.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "document-features"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95"
|
||||||
|
dependencies = [
|
||||||
|
"litrs",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dom_struct"
|
name = "dom_struct"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
@ -2226,9 +2236,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-descriptor"
|
name = "gpu-descriptor"
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c"
|
checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"gpu-descriptor-types",
|
"gpu-descriptor-types",
|
||||||
|
@ -2237,9 +2247,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-descriptor-types"
|
name = "gpu-descriptor-types"
|
||||||
version = "0.1.2"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c"
|
checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
]
|
]
|
||||||
|
@ -3537,6 +3547,12 @@ version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da"
|
checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "litrs"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
|
@ -3714,9 +3730,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "metal"
|
name = "metal"
|
||||||
version = "0.27.0"
|
version = "0.28.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25"
|
checksum = "5637e166ea14be6063a3f8ba5ccb9a4159df7d8f6d61c02fc3d480b1f90dcfcb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"block",
|
"block",
|
||||||
|
@ -3885,8 +3901,9 @@ checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu?rev=32e70bc1635905c508d408eb1cf22b2aa062ffe1#32e70bc1635905c508d408eb1cf22b2aa062ffe1"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e536ae46fcab0876853bd4a632ede5df4b1c2527a58f6c5a4150fe86be858231"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
|
@ -7186,14 +7203,16 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-core"
|
name = "wgpu-core"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu?rev=32e70bc1635905c508d408eb1cf22b2aa062ffe1#32e70bc1635905c508d408eb1cf22b2aa062ffe1"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac6a86eaa5e763e59c73cf9e97d55fffd4dfda69fd8bda19589fcf851ddfef1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-vec",
|
"bit-vec",
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
|
"document-features",
|
||||||
"indexmap 2.2.6",
|
"indexmap 2.2.6",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
|
@ -7212,8 +7231,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-hal"
|
name = "wgpu-hal"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu?rev=32e70bc1635905c508d408eb1cf22b2aa062ffe1#32e70bc1635905c508d408eb1cf22b2aa062ffe1"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4d71c8ae05170583049b65ee562fd839fdc0b3e9ddb84f4e40c9d5f8ea0d4c8c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_system_properties",
|
"android_system_properties",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
|
@ -7231,7 +7251,7 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.8.3",
|
"libloading 0.8.3",
|
||||||
"log",
|
"log",
|
||||||
"metal 0.27.0",
|
"metal 0.28.0",
|
||||||
"naga",
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -7250,8 +7270,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu?rev=32e70bc1635905c508d408eb1cf22b2aa062ffe1#32e70bc1635905c508d408eb1cf22b2aa062ffe1"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1353d9a46bff7f955a680577f34c69122628cc2076e1d6f3a9be6ef00ae793ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
|
|
@ -125,8 +125,8 @@ webpki-roots = "0.25"
|
||||||
webrender = { git = "https://github.com/servo/webrender", branch = "0.64", features = ["capture"] }
|
webrender = { git = "https://github.com/servo/webrender", branch = "0.64", features = ["capture"] }
|
||||||
webrender_api = { git = "https://github.com/servo/webrender", branch = "0.64" }
|
webrender_api = { git = "https://github.com/servo/webrender", branch = "0.64" }
|
||||||
webrender_traits = { path = "components/shared/webrender" }
|
webrender_traits = { path = "components/shared/webrender" }
|
||||||
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "32e70bc1635905c508d408eb1cf22b2aa062ffe1" }
|
wgpu-core = "0.20"
|
||||||
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "32e70bc1635905c508d408eb1cf22b2aa062ffe1" }
|
wgpu-types = "0.20"
|
||||||
winapi = "0.3"
|
winapi = "0.3"
|
||||||
xi-unicode = "0.1.0"
|
xi-unicode = "0.1.0"
|
||||||
xml5ever = "0.18"
|
xml5ever = "0.18"
|
||||||
|
|
|
@ -268,7 +268,8 @@ impl GPUBufferMethods for GPUBuffer {
|
||||||
buffer_id: self.buffer.0,
|
buffer_id: self.buffer.0,
|
||||||
device_id: self.device.id().0,
|
device_id: self.device.id().0,
|
||||||
host_map,
|
host_map,
|
||||||
map_range: map_range.clone(),
|
offset,
|
||||||
|
size: Some(range_size),
|
||||||
},
|
},
|
||||||
)) {
|
)) {
|
||||||
warn!(
|
warn!(
|
||||||
|
|
|
@ -208,14 +208,19 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-configure>
|
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-configure>
|
||||||
fn Configure(&self, descriptor: &GPUCanvasConfiguration) {
|
fn Configure(&self, descriptor: &GPUCanvasConfiguration) -> Fallible<()> {
|
||||||
// Step 1 is let
|
// Step 1 is let
|
||||||
// Step 2
|
// Step 2
|
||||||
// TODO: device features
|
// TODO: device features
|
||||||
let format = match descriptor.format {
|
let format = match descriptor.format {
|
||||||
GPUTextureFormat::Rgba8unorm | GPUTextureFormat::Rgba8unorm_srgb => ImageFormat::RGBA8,
|
GPUTextureFormat::Rgba8unorm | GPUTextureFormat::Rgba8unorm_srgb => ImageFormat::RGBA8,
|
||||||
GPUTextureFormat::Bgra8unorm | GPUTextureFormat::Bgra8unorm_srgb => ImageFormat::BGRA8,
|
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
|
// Step 3
|
||||||
|
@ -287,6 +292,7 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
||||||
.set(Some(&descriptor.device.CreateTexture(&text_desc).unwrap()));
|
.set(Some(&descriptor.device.CreateTexture(&text_desc).unwrap()));
|
||||||
|
|
||||||
self.webrender_image.set(Some(receiver.recv().unwrap()));
|
self.webrender_image.set(Some(receiver.recv().unwrap()));
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-unconfigure>
|
/// <https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-unconfigure>
|
||||||
|
|
|
@ -393,7 +393,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
||||||
.expect("Failed to send Finish");
|
.expect("Failed to send Finish");
|
||||||
|
|
||||||
*self.state.borrow_mut() = GPUCommandEncoderState::Closed;
|
*self.state.borrow_mut() = GPUCommandEncoderState::Closed;
|
||||||
let buffer = webgpu::WebGPUCommandBuffer(self.encoder.0.transmute());
|
let buffer = webgpu::WebGPUCommandBuffer(self.encoder.0.into_command_buffer_id());
|
||||||
GPUCommandBuffer::new(
|
GPUCommandBuffer::new(
|
||||||
&self.global(),
|
&self.global(),
|
||||||
self.channel.clone(),
|
self.channel.clone(),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use webgpu::wgpu::command::{compute_ffi as wgpu_comp, ComputePass};
|
use webgpu::wgpu::command::{compute_commands as wgpu_comp, ComputePass};
|
||||||
use webgpu::{WebGPU, WebGPURequest};
|
use webgpu::{WebGPU, WebGPURequest};
|
||||||
|
|
||||||
use super::bindings::error::Fallible;
|
use super::bindings::error::Fallible;
|
||||||
|
@ -120,15 +120,12 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
||||||
if let Some(compute_pass) = self.compute_pass.borrow_mut().as_mut() {
|
if let Some(compute_pass) = self.compute_pass.borrow_mut().as_mut() {
|
||||||
unsafe {
|
|
||||||
wgpu_comp::wgpu_compute_pass_set_bind_group(
|
wgpu_comp::wgpu_compute_pass_set_bind_group(
|
||||||
compute_pass,
|
compute_pass,
|
||||||
index,
|
index,
|
||||||
bind_group.id().0,
|
bind_group.id().0,
|
||||||
dynamic_offsets.as_ptr(),
|
&dynamic_offsets,
|
||||||
dynamic_offsets.len(),
|
|
||||||
)
|
)
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -718,7 +718,9 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
layout,
|
layout,
|
||||||
stage: wgpu_pipe::ProgrammableStageDescriptor {
|
stage: wgpu_pipe::ProgrammableStageDescriptor {
|
||||||
module: descriptor.compute.module.id().0,
|
module: descriptor.compute.module.id().0,
|
||||||
entry_point: Cow::Owned(descriptor.compute.entryPoint.to_string()),
|
entry_point: Some(Cow::Owned(descriptor.compute.entryPoint.to_string())),
|
||||||
|
constants: Cow::Owned(HashMap::new()),
|
||||||
|
zero_initialize_workgroup_memory: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -921,7 +923,11 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
vertex: wgpu_pipe::VertexState {
|
vertex: wgpu_pipe::VertexState {
|
||||||
stage: wgpu_pipe::ProgrammableStageDescriptor {
|
stage: wgpu_pipe::ProgrammableStageDescriptor {
|
||||||
module: descriptor.vertex.parent.module.id().0,
|
module: descriptor.vertex.parent.module.id().0,
|
||||||
entry_point: Cow::Owned(descriptor.vertex.parent.entryPoint.to_string()),
|
entry_point: Some(Cow::Owned(
|
||||||
|
descriptor.vertex.parent.entryPoint.to_string(),
|
||||||
|
)),
|
||||||
|
constants: Cow::Owned(HashMap::new()),
|
||||||
|
zero_initialize_workgroup_memory: true,
|
||||||
},
|
},
|
||||||
buffers: Cow::Owned(
|
buffers: Cow::Owned(
|
||||||
descriptor
|
descriptor
|
||||||
|
@ -955,7 +961,9 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
.map(|stage| wgpu_pipe::FragmentState {
|
.map(|stage| wgpu_pipe::FragmentState {
|
||||||
stage: wgpu_pipe::ProgrammableStageDescriptor {
|
stage: wgpu_pipe::ProgrammableStageDescriptor {
|
||||||
module: stage.parent.module.id().0,
|
module: stage.parent.module.id().0,
|
||||||
entry_point: Cow::Owned(stage.parent.entryPoint.to_string()),
|
entry_point: Some(Cow::Owned(stage.parent.entryPoint.to_string())),
|
||||||
|
constants: Cow::Owned(HashMap::new()),
|
||||||
|
zero_initialize_workgroup_memory: true,
|
||||||
},
|
},
|
||||||
targets: Cow::Owned(
|
targets: Cow::Owned(
|
||||||
stage
|
stage
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use webgpu::wgpu::command::{render_ffi as wgpu_render, RenderPass};
|
use webgpu::wgpu::command::{render_commands as wgpu_render, RenderPass};
|
||||||
use webgpu::{wgt, WebGPU, WebGPURequest};
|
use webgpu::{wgt, WebGPU, WebGPURequest};
|
||||||
|
|
||||||
use super::bindings::codegen::Bindings::WebGPUBinding::GPUIndexFormat;
|
use super::bindings::codegen::Bindings::WebGPUBinding::GPUIndexFormat;
|
||||||
|
@ -86,15 +86,12 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
fn SetBindGroup(&self, index: u32, bind_group: &GPUBindGroup, dynamic_offsets: Vec<u32>) {
|
||||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||||
unsafe {
|
|
||||||
wgpu_render::wgpu_render_pass_set_bind_group(
|
wgpu_render::wgpu_render_pass_set_bind_group(
|
||||||
render_pass,
|
render_pass,
|
||||||
index,
|
index,
|
||||||
bind_group.id().0,
|
bind_group.id().0,
|
||||||
dynamic_offsets.as_ptr(),
|
&dynamic_offsets,
|
||||||
dynamic_offsets.len(),
|
|
||||||
)
|
)
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,13 +283,7 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
||||||
fn ExecuteBundles(&self, bundles: Vec<DomRoot<GPURenderBundle>>) {
|
fn ExecuteBundles(&self, bundles: Vec<DomRoot<GPURenderBundle>>) {
|
||||||
let bundle_ids = bundles.iter().map(|b| b.id().0).collect::<Vec<_>>();
|
let bundle_ids = bundles.iter().map(|b| b.id().0).collect::<Vec<_>>();
|
||||||
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
if let Some(render_pass) = self.render_pass.borrow_mut().as_mut() {
|
||||||
unsafe {
|
wgpu_render::wgpu_render_pass_execute_bundles(render_pass, &bundle_ids)
|
||||||
wgpu_render::wgpu_render_pass_execute_bundles(
|
|
||||||
render_pass,
|
|
||||||
bundle_ids.as_ptr(),
|
|
||||||
bundle_ids.len(),
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1048,6 +1048,7 @@ interface GPUCanvasContext {
|
||||||
|
|
||||||
// Calling configure() a second time invalidates the previous one,
|
// Calling configure() a second time invalidates the previous one,
|
||||||
// and all of the textures it's produced.
|
// and all of the textures it's produced.
|
||||||
|
[Throws]
|
||||||
undefined configure(GPUCanvasConfiguration descriptor);
|
undefined configure(GPUCanvasConfiguration descriptor);
|
||||||
undefined unconfigure();
|
undefined unconfigure();
|
||||||
|
|
||||||
|
|
|
@ -2125,7 +2125,7 @@ impl ScriptThread {
|
||||||
WebGPUMsg::FreeCommandBuffer(id) => self
|
WebGPUMsg::FreeCommandBuffer(id) => self
|
||||||
.gpu_id_hub
|
.gpu_id_hub
|
||||||
.lock()
|
.lock()
|
||||||
.kill_command_buffer_id(id.transmute()),
|
.kill_command_buffer_id(id.into_command_encoder_id()),
|
||||||
WebGPUMsg::FreeSampler(id) => self.gpu_id_hub.lock().kill_sampler_id(id),
|
WebGPUMsg::FreeSampler(id) => self.gpu_id_hub.lock().kill_sampler_id(id),
|
||||||
WebGPUMsg::FreeShaderModule(id) => self.gpu_id_hub.lock().kill_shader_module_id(id),
|
WebGPUMsg::FreeShaderModule(id) => self.gpu_id_hub.lock().kill_shader_module_id(id),
|
||||||
WebGPUMsg::FreeRenderBundle(id) => self.gpu_id_hub.lock().kill_render_bundle_id(id),
|
WebGPUMsg::FreeRenderBundle(id) => self.gpu_id_hub.lock().kill_render_bundle_id(id),
|
||||||
|
|
|
@ -81,7 +81,8 @@ pub enum WebGPURequest {
|
||||||
buffer_id: id::BufferId,
|
buffer_id: id::BufferId,
|
||||||
device_id: id::DeviceId,
|
device_id: id::DeviceId,
|
||||||
host_map: HostMap,
|
host_map: HostMap,
|
||||||
map_range: std::ops::Range<u64>,
|
offset: u64,
|
||||||
|
size: Option<u64>,
|
||||||
},
|
},
|
||||||
CommandEncoderFinish {
|
CommandEncoderFinish {
|
||||||
command_encoder_id: id::CommandEncoderId,
|
command_encoder_id: id::CommandEncoderId,
|
||||||
|
@ -407,7 +408,8 @@ impl WGPU {
|
||||||
buffer_id,
|
buffer_id,
|
||||||
device_id,
|
device_id,
|
||||||
host_map,
|
host_map,
|
||||||
map_range,
|
offset,
|
||||||
|
size,
|
||||||
} => {
|
} => {
|
||||||
let glob = Arc::clone(&self.global);
|
let glob = Arc::clone(&self.global);
|
||||||
let resp_sender = sender.clone();
|
let resp_sender = sender.clone();
|
||||||
|
@ -447,7 +449,12 @@ impl WGPU {
|
||||||
callback: Some(callback),
|
callback: Some(callback),
|
||||||
};
|
};
|
||||||
let global = &self.global;
|
let global = &self.global;
|
||||||
let result = gfx_select!(buffer_id => global.buffer_map_async(buffer_id, map_range, operation));
|
let result = gfx_select!(buffer_id => global.buffer_map_async(
|
||||||
|
buffer_id,
|
||||||
|
offset,
|
||||||
|
size,
|
||||||
|
operation
|
||||||
|
));
|
||||||
if let Err(ref e) = result {
|
if let Err(ref e) = result {
|
||||||
if let Err(w) = sender.send(Some(Err(format!("{:?}", e)))) {
|
if let Err(w) = sender.send(Some(Err(format!("{:?}", e)))) {
|
||||||
warn!("Failed to send BufferMapAsync Response ({:?})", w);
|
warn!("Failed to send BufferMapAsync Response ({:?})", w);
|
||||||
|
@ -839,7 +846,7 @@ impl WGPU {
|
||||||
WebGPURequest::DropCommandBuffer(id) => {
|
WebGPURequest::DropCommandBuffer(id) => {
|
||||||
self.error_command_encoders
|
self.error_command_encoders
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.remove(&id.transmute());
|
.remove(&id.into_command_encoder_id());
|
||||||
let global = &self.global;
|
let global = &self.global;
|
||||||
gfx_select!(id => global.command_buffer_drop(id));
|
gfx_select!(id => global.command_buffer_drop(id));
|
||||||
if let Err(e) = self.script_sender.send(WebGPUMsg::FreeCommandBuffer(id)) {
|
if let Err(e) = self.script_sender.send(WebGPUMsg::FreeCommandBuffer(id)) {
|
||||||
|
@ -1004,7 +1011,7 @@ impl WGPU {
|
||||||
let cmd_id = command_buffers.iter().find(|id| {
|
let cmd_id = command_buffers.iter().find(|id| {
|
||||||
self.error_command_encoders
|
self.error_command_encoders
|
||||||
.borrow()
|
.borrow()
|
||||||
.contains_key(&id.transmute())
|
.contains_key(&id.into_command_encoder_id())
|
||||||
});
|
});
|
||||||
let result = if cmd_id.is_some() {
|
let result = if cmd_id.is_some() {
|
||||||
Err(String::from("Invalid command buffer submitted"))
|
Err(String::from("Invalid command buffer submitted"))
|
||||||
|
@ -1108,7 +1115,7 @@ impl WGPU {
|
||||||
));
|
));
|
||||||
let _ = gfx_select!(queue_id => global.queue_submit(
|
let _ = gfx_select!(queue_id => global.queue_submit(
|
||||||
queue_id,
|
queue_id,
|
||||||
&[encoder_id.transmute()]
|
&[encoder_id.into_command_buffer_id()]
|
||||||
));
|
));
|
||||||
|
|
||||||
let glob = Arc::clone(&self.global);
|
let glob = Arc::clone(&self.global);
|
||||||
|
@ -1161,7 +1168,8 @@ impl WGPU {
|
||||||
host: HostMap::Read,
|
host: HostMap::Read,
|
||||||
callback: Some(callback),
|
callback: Some(callback),
|
||||||
};
|
};
|
||||||
let _ = gfx_select!(buffer_id => global.buffer_map_async(buffer_id, 0..buffer_size, map_op));
|
let _ = gfx_select!(buffer_id
|
||||||
|
=> global.buffer_map_async(buffer_id, 0, Some(buffer_size), map_op));
|
||||||
},
|
},
|
||||||
WebGPURequest::UnmapBuffer {
|
WebGPURequest::UnmapBuffer {
|
||||||
buffer_id,
|
buffer_id,
|
||||||
|
@ -1458,3 +1466,21 @@ pub struct PresentationData {
|
||||||
image_desc: ImageDescriptor,
|
image_desc: ImageDescriptor,
|
||||||
image_data: ImageData,
|
image_data: ImageData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait Transmute<U: id::Marker> {
|
||||||
|
fn transmute(self) -> id::Id<U>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Transmute<id::markers::Queue> for id::Id<id::markers::Device> {
|
||||||
|
fn transmute(self) -> id::Id<id::markers::Queue> {
|
||||||
|
// if this is removed next one should be removed too.
|
||||||
|
self.into_queue_id()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Transmute<id::markers::Device> for id::Id<id::markers::Queue> {
|
||||||
|
fn transmute(self) -> id::Id<id::markers::Device> {
|
||||||
|
// SAFETY: This is safe because queue_id = device_id in wgpu
|
||||||
|
unsafe { id::Id::from_raw(self.into_raw()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,2 +1,6 @@
|
||||||
[canvas_clear.https.html]
|
[canvas_clear.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_colorspace_rgba16float.https.html]
|
[canvas_colorspace_rgba16float.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_complex_rgba16float_copy.https.html]
|
[canvas_complex_rgba16float_copy.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_complex_rgba16float_draw.https.html]
|
[canvas_complex_rgba16float_draw.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_complex_rgba16float_store.https.html]
|
[canvas_complex_rgba16float_store.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_composite_alpha_rgba16float_opaque_copy.https.html]
|
[canvas_composite_alpha_rgba16float_opaque_copy.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_composite_alpha_rgba16float_opaque_draw.https.html]
|
[canvas_composite_alpha_rgba16float_opaque_draw.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_composite_alpha_rgba16float_premultiplied_copy.https.html]
|
[canvas_composite_alpha_rgba16float_premultiplied_copy.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[canvas_composite_alpha_rgba16float_premultiplied_draw.https.html]
|
[canvas_composite_alpha_rgba16float_premultiplied_draw.https.html]
|
||||||
expected: CRASH
|
expected:
|
||||||
|
if os == "win": CRASH
|
||||||
|
if os == "linux" and debug: CRASH
|
||||||
|
if os == "linux" and not debug: TIMEOUT
|
||||||
|
if os == "mac": CRASH
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue