mirror of
https://github.com/servo/servo.git
synced 2025-06-11 10:00:18 +00:00
Proper GPUDevice cleanup (#32520)
* Make device cleanup right * Use weakref for GPUDevice in globalscope * No need to destroy device on drop * DeviceReason early return * make remove_gpu_device to be the only way to remove device
This commit is contained in:
parent
256c55eb81
commit
bf99cf7f30
6 changed files with 89 additions and 43 deletions
|
@ -92,7 +92,7 @@ use style::dom::OpaqueNode;
|
|||
use style::thread_state::{self, ThreadState};
|
||||
use time::precise_time_ns;
|
||||
use url::Position;
|
||||
use webgpu::WebGPUMsg;
|
||||
use webgpu::{WebGPUDevice, WebGPUMsg};
|
||||
use webrender_api::DocumentId;
|
||||
use webrender_traits::WebRenderScriptApi;
|
||||
|
||||
|
@ -2423,7 +2423,14 @@ impl ScriptThread {
|
|||
fn handle_msg_from_webgpu_server(&self, msg: WebGPUMsg) {
|
||||
match msg {
|
||||
WebGPUMsg::FreeAdapter(id) => self.gpu_id_hub.lock().kill_adapter_id(id),
|
||||
WebGPUMsg::FreeDevice(id) => self.gpu_id_hub.lock().kill_device_id(id),
|
||||
WebGPUMsg::FreeDevice {
|
||||
device_id,
|
||||
pipeline_id,
|
||||
} => {
|
||||
self.gpu_id_hub.lock().kill_device_id(device_id);
|
||||
let global = self.documents.borrow().find_global(pipeline_id).unwrap();
|
||||
global.remove_gpu_device(WebGPUDevice(device_id));
|
||||
},
|
||||
WebGPUMsg::FreeBuffer(id) => self.gpu_id_hub.lock().kill_buffer_id(id),
|
||||
WebGPUMsg::FreePipelineLayout(id) => self.gpu_id_hub.lock().kill_pipeline_layout_id(id),
|
||||
WebGPUMsg::FreeComputePipeline(id) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue