chore: Update wgpu (#33506)

* Update wgpu

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* use all backends at runtime

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* clean up some adapter stuff

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* flakes

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-09-21 06:20:18 +02:00 committed by GitHub
parent 28d28d0a0a
commit 24ad2a0526
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 206 additions and 361 deletions

View file

@ -47,7 +47,7 @@ use crate::dom::errorevent::ErrorEvent;
use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::identityhub::Identities;
use crate::dom::identityhub::IdentityHub;
use crate::dom::messageevent::MessageEvent;
use crate::dom::worker::{TrustedWorkerAddress, Worker};
use crate::dom::workerglobalscope::WorkerGlobalScope;
@ -253,7 +253,7 @@ impl DedicatedWorkerGlobalScope {
closing: Arc<AtomicBool>,
image_cache: Arc<dyn ImageCache>,
browsing_context: Option<BrowsingContextId>,
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
control_receiver: Receiver<DedicatedWorkerControlMsg>,
) -> DedicatedWorkerGlobalScope {
DedicatedWorkerGlobalScope {
@ -291,7 +291,7 @@ impl DedicatedWorkerGlobalScope {
closing: Arc<AtomicBool>,
image_cache: Arc<dyn ImageCache>,
browsing_context: Option<BrowsingContextId>,
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
control_receiver: Receiver<DedicatedWorkerControlMsg>,
) -> DomRoot<DedicatedWorkerGlobalScope> {
let cx = runtime.cx();
@ -330,7 +330,7 @@ impl DedicatedWorkerGlobalScope {
closing: Arc<AtomicBool>,
image_cache: Arc<dyn ImageCache>,
browsing_context: Option<BrowsingContextId>,
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
control_receiver: Receiver<DedicatedWorkerControlMsg>,
context_sender: Sender<ContextForRequestInterrupt>,
can_gc: CanGc,

View file

@ -102,7 +102,7 @@ use crate::dom::gamepad::{contains_user_gesture, Gamepad};
use crate::dom::gamepadevent::GamepadEventType;
use crate::dom::gpudevice::GPUDevice;
use crate::dom::htmlscriptelement::{ScriptId, SourceCode};
use crate::dom::identityhub::Identities;
use crate::dom::identityhub::IdentityHub;
use crate::dom::imagebitmap::ImageBitmap;
use crate::dom::messageevent::MessageEvent;
use crate::dom::messageport::MessagePort;
@ -325,7 +325,7 @@ pub struct GlobalScope {
/// Identity Manager for WebGPU resources
#[ignore_malloc_size_of = "defined in wgpu"]
#[no_trace]
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
/// WebGPU devices
gpu_devices: DomRefCell<HashMapTracedValues<WebGPUDevice, WeakRef<GPUDevice>>>,
@ -768,7 +768,7 @@ impl GlobalScope {
microtask_queue: Rc<MicrotaskQueue>,
is_headless: bool,
user_agent: Cow<'static, str>,
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
inherited_secure_context: Option<bool>,
) -> Self {
Self {
@ -3154,7 +3154,7 @@ impl GlobalScope {
None
}
pub fn wgpu_id_hub(&self) -> Arc<Identities> {
pub fn wgpu_id_hub(&self) -> Arc<IdentityHub> {
self.gpu_id_hub.clone()
}

View file

@ -111,7 +111,7 @@ impl GPUMethods for GPU {
Some(GPUPowerPreference::High_performance) => PowerPreference::HighPerformance,
None => PowerPreference::default(),
};
let ids = global.wgpu_id_hub().create_adapter_ids();
let ids = global.wgpu_id_hub().create_adapter_id();
let script_to_constellation_chan = global.script_to_constellation_chan();
if script_to_constellation_chan
@ -147,8 +147,7 @@ impl AsyncWGPUListener for GPU {
adapter.channel,
DOMString::from(format!(
"{} ({:?})",
adapter.adapter_info.name,
adapter.adapter_id.0.backend()
adapter.adapter_info.name, adapter.adapter_id.0
)),
Heap::default(),
adapter.features,

View file

@ -140,14 +140,8 @@ impl GPUAdapterMethods for GPUAdapter {
label: Some(descriptor.parent.label.to_string()),
memory_hints: MemoryHints::MemoryUsage,
};
let device_id = self
.global()
.wgpu_id_hub()
.create_device_id(self.adapter.0.backend());
let queue_id = self
.global()
.wgpu_id_hub()
.create_queue_id(self.adapter.0.backend());
let device_id = self.global().wgpu_id_hub().create_device_id();
let queue_id = self.global().wgpu_id_hub().create_queue_id();
let pipeline_id = self.global().pipeline_id();
if self
.channel
@ -222,11 +216,9 @@ impl AsyncWGPUListener for GPUAdapter {
RequestDeviceError::UnsupportedFeature(f).to_string(),
))
},
WebGPUResponse::Device((
_,
_,
Err(RequestDeviceError::LimitsExceeded(_) | RequestDeviceError::InvalidAdapter),
)) => promise.reject_error(Error::Operation),
WebGPUResponse::Device((_, _, Err(RequestDeviceError::LimitsExceeded(_)))) => {
promise.reject_error(Error::Operation)
},
WebGPUResponse::Device((device_id, queue_id, Err(e))) => {
let device = GPUDevice::new(
&self.global(),

View file

@ -90,10 +90,7 @@ impl GPUBindGroup {
entries: Cow::Owned(entries),
};
let bind_group_id = device
.global()
.wgpu_id_hub()
.create_bind_group_id(device.id().0.backend());
let bind_group_id = device.global().wgpu_id_hub().create_bind_group_id();
device
.channel()
.0

View file

@ -89,10 +89,7 @@ impl GPUBindGroupLayout {
},
};
let bind_group_layout_id = device
.global()
.wgpu_id_hub()
.create_bind_group_layout_id(device.id().0.backend());
let bind_group_layout_id = device.global().wgpu_id_hub().create_bind_group_layout_id();
device
.channel()
.0

View file

@ -142,10 +142,7 @@ impl GPUBuffer {
usage: wgt::BufferUsages::from_bits_retain(descriptor.usage),
mapped_at_creation: descriptor.mappedAtCreation,
};
let id = device
.global()
.wgpu_id_hub()
.create_buffer_id(device.id().0.backend());
let id = device.global().wgpu_id_hub().create_buffer_id();
device
.channel()

View file

@ -145,10 +145,7 @@ impl GPUCanvasContext {
pub fn send_swap_chain_present(&self) {
let texture_id = self.texture_id().unwrap().0;
let encoder_id = self
.global()
.wgpu_id_hub()
.create_command_encoder_id(texture_id.backend());
let encoder_id = self.global().wgpu_id_hub().create_command_encoder_id();
if let Err(e) = self.channel.0.send(WebGPURequest::SwapChainPresent {
context_id: self.context_id,
texture_id,
@ -258,11 +255,7 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
let mut buffer_ids = ArrayVec::<id::BufferId, PRESENTATION_BUFFER_COUNT>::new();
for _ in 0..PRESENTATION_BUFFER_COUNT {
buffer_ids.push(
self.global()
.wgpu_id_hub()
.create_buffer_id(configuration.device.id().0.backend()),
);
buffer_ids.push(self.global().wgpu_id_hub().create_buffer_id());
}
self.channel

View file

@ -85,10 +85,7 @@ impl GPUCommandEncoder {
device: &GPUDevice,
descriptor: &GPUCommandEncoderDescriptor,
) -> DomRoot<GPUCommandEncoder> {
let command_encoder_id = device
.global()
.wgpu_id_hub()
.create_command_encoder_id(device.id().0.backend());
let command_encoder_id = device.global().wgpu_id_hub().create_command_encoder_id();
device
.channel()
.0
@ -129,10 +126,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
&self,
descriptor: &GPUComputePassDescriptor,
) -> DomRoot<GPUComputePassEncoder> {
let compute_pass_id = self
.global()
.wgpu_id_hub()
.create_compute_pass_id(self.device.id().0.backend());
let compute_pass_id = self.global().wgpu_id_hub().create_compute_pass_id();
if let Err(e) = self.channel.0.send(WebGPURequest::BeginComputePass {
command_encoder_id: self.id().0,
@ -197,10 +191,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
}))
})
.collect::<Fallible<Vec<_>>>()?;
let render_pass_id = self
.global()
.wgpu_id_hub()
.create_render_pass_id(self.device.id().0.backend());
let render_pass_id = self.global().wgpu_id_hub().create_render_pass_id();
if let Err(e) = self.channel.0.send(WebGPURequest::BeginRenderPass {
command_encoder_id: self.id().0,

View file

@ -74,10 +74,7 @@ impl GPUComputePipeline {
descriptor: &GPUComputePipelineDescriptor,
async_sender: Option<IpcSender<WebGPUResponse>>,
) -> WebGPUComputePipeline {
let compute_pipeline_id = device
.global()
.wgpu_id_hub()
.create_compute_pipeline_id(device.id().0.backend());
let compute_pipeline_id = device.global().wgpu_id_hub().create_compute_pipeline_id();
let (layout, implicit_ids, _) = device.get_pipeline_layout_data(&descriptor.parent.layout);
@ -117,10 +114,7 @@ impl GPUComputePipelineMethods for GPUComputePipeline {
/// <https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout>
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
let id = self
.global()
.wgpu_id_hub()
.create_bind_group_layout_id(self.compute_pipeline.0.backend());
let id = self.global().wgpu_id_hub().create_bind_group_layout_id();
if let Err(e) = self
.channel

View file

@ -216,18 +216,12 @@ impl GPUDevice {
if let GPUPipelineLayoutOrGPUAutoLayoutMode::GPUPipelineLayout(ref layout) = layout {
(Some(layout.id().0), None, layout.bind_group_layouts())
} else {
let layout_id = self
.global()
.wgpu_id_hub()
.create_pipeline_layout_id(self.device.0.backend());
let layout_id = self.global().wgpu_id_hub().create_pipeline_layout_id();
let max_bind_grps = self.limits.MaxBindGroups();
let mut bgls = Vec::with_capacity(max_bind_grps as usize);
let mut bgl_ids = Vec::with_capacity(max_bind_grps as usize);
for _ in 0..max_bind_grps {
let bgl = self
.global()
.wgpu_id_hub()
.create_bind_group_layout_id(self.device.0.backend());
let bgl = self.global().wgpu_id_hub().create_bind_group_layout_id();
bgls.push(webgpu::WebGPUBindGroupLayout(bgl));
bgl_ids.push(bgl);
}

View file

@ -92,10 +92,7 @@ impl GPUPipelineLayout {
push_constant_ranges: Cow::Owned(vec![]),
};
let pipeline_layout_id = device
.global()
.wgpu_id_hub()
.create_pipeline_layout_id(device.id().0.backend());
let pipeline_layout_id = device.global().wgpu_id_hub().create_pipeline_layout_id();
device
.channel()
.0

View file

@ -197,7 +197,6 @@ impl GPUQueueMethods for GPUQueue {
.send(WebGPURequest::QueueOnSubmittedWorkDone {
sender,
queue_id: self.queue.0,
device_id: self.device.borrow().as_ref().unwrap().id().0,
})
{
warn!("QueueOnSubmittedWorkDone failed with {e}")

View file

@ -143,7 +143,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
wgpu_bundle::wgpu_render_bundle_set_bind_group(
encoder,
index,
bind_group.id().0,
Some(bind_group.id().0),
dynamic_offsets.as_ptr(),
dynamic_offsets.len(),
)
@ -255,10 +255,7 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
label: (&descriptor.parent).into(),
};
let encoder = self.render_bundle_encoder.borrow_mut().take().unwrap();
let render_bundle_id = self
.global()
.wgpu_id_hub()
.create_render_bundle_id(self.device.id().0.backend());
let render_bundle_id = self.global().wgpu_id_hub().create_render_bundle_id();
self.channel
.0

View file

@ -74,10 +74,7 @@ impl GPURenderPipeline {
descriptor: RenderPipelineDescriptor<'static>,
async_sender: Option<IpcSender<WebGPUResponse>>,
) -> Fallible<WebGPURenderPipeline> {
let render_pipeline_id = device
.global()
.wgpu_id_hub()
.create_render_pipeline_id(device.id().0.backend());
let render_pipeline_id = device.global().wgpu_id_hub().create_render_pipeline_id();
device
.channel()
@ -108,10 +105,7 @@ impl GPURenderPipelineMethods for GPURenderPipeline {
/// <https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout>
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
let id = self
.global()
.wgpu_id_hub()
.create_bind_group_layout_id(self.render_pipeline.0.backend());
let id = self.global().wgpu_id_hub().create_bind_group_layout_id();
if let Err(e) = self
.channel

View file

@ -76,10 +76,7 @@ impl GPUSampler {
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createsampler>
pub fn create(device: &GPUDevice, descriptor: &GPUSamplerDescriptor) -> DomRoot<GPUSampler> {
let sampler_id = device
.global()
.wgpu_id_hub()
.create_sampler_id(device.id().0.backend());
let sampler_id = device.global().wgpu_id_hub().create_sampler_id();
let compare_enable = descriptor.compare.is_some();
let desc = SamplerDescriptor {
label: (&descriptor.parent).into(),

View file

@ -82,10 +82,7 @@ impl GPUShaderModule {
descriptor: RootedTraceableBox<GPUShaderModuleDescriptor>,
comp: InRealm,
) -> DomRoot<GPUShaderModule> {
let program_id = device
.global()
.wgpu_id_hub()
.create_shader_module_id(device.id().0.backend());
let program_id = device.global().wgpu_id_hub().create_shader_module_id();
let promise = Promise::new_in_current_realm(comp);
let shader_module = GPUShaderModule::new(
&device.global(),

View file

@ -149,10 +149,7 @@ impl GPUTexture {
.collect::<Fallible<_>>()?,
};
let texture_id = device
.global()
.wgpu_id_hub()
.create_texture_id(device.id().0.backend());
let texture_id = device.global().wgpu_id_hub().create_texture_id();
device
.channel()
@ -228,10 +225,7 @@ impl GPUTextureMethods for GPUTexture {
None
};
let texture_view_id = self
.global()
.wgpu_id_hub()
.create_texture_view_id(self.device.id().0.backend());
let texture_view_id = self.global().wgpu_id_hub().create_texture_view_id();
self.channel
.0

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use smallvec::SmallVec;
use webgpu::identity::{ComputePass, ComputePassId, RenderPass, RenderPassId};
use webgpu::wgc::id::markers::{
Adapter, BindGroup, BindGroupLayout, Buffer, CommandEncoder, ComputePipeline, Device,
@ -15,7 +14,6 @@ use webgpu::wgc::id::{
ShaderModuleId, TextureId, TextureViewId,
};
use webgpu::wgc::identity::IdentityManager;
use webgpu::wgt::Backend;
#[derive(Debug)]
pub struct IdentityHub {
@ -39,7 +37,7 @@ pub struct IdentityHub {
}
impl IdentityHub {
fn new() -> Self {
pub fn new() -> Self {
IdentityHub {
adapters: IdentityManager::new(),
devices: IdentityManager::new(),
@ -62,205 +60,140 @@ impl IdentityHub {
}
}
#[derive(Debug)]
pub struct Identities {
#[cfg(any(target_os = "linux", target_os = "windows"))]
vk_hub: IdentityHub,
#[cfg(target_os = "windows")]
dx12_hub: IdentityHub,
#[cfg(any(target_os = "ios", target_os = "macos"))]
metal_hub: IdentityHub,
#[cfg(any(target_os = "linux", target_os = "windows"))]
gl_hub: IdentityHub,
dummy_hub: IdentityHub,
}
impl Identities {
pub fn new() -> Self {
Identities {
#[cfg(any(target_os = "linux", target_os = "windows"))]
vk_hub: IdentityHub::new(),
#[cfg(target_os = "windows")]
dx12_hub: IdentityHub::new(),
#[cfg(any(target_os = "ios", target_os = "macos"))]
metal_hub: IdentityHub::new(),
#[cfg(any(target_os = "linux", target_os = "windows"))]
gl_hub: IdentityHub::new(),
dummy_hub: IdentityHub::new(),
}
}
fn select(&self, backend: Backend) -> &IdentityHub {
match backend {
#[cfg(any(target_os = "linux", target_os = "windows"))]
Backend::Vulkan => &self.vk_hub,
#[cfg(target_os = "windows")]
Backend::Dx12 => &self.dx12_hub,
#[cfg(any(target_os = "ios", target_os = "macos"))]
Backend::Metal => &self.metal_hub,
#[cfg(any(target_os = "linux", target_os = "windows"))]
Backend::Gl => &self.gl_hub,
_ => &self.dummy_hub,
}
}
fn hubs(&self) -> Vec<(&IdentityHub, Backend)> {
vec![
#[cfg(any(target_os = "linux", target_os = "windows"))]
(&self.vk_hub, Backend::Vulkan),
#[cfg(target_os = "windows")]
(&self.dx12_hub, Backend::Dx12),
#[cfg(any(target_os = "ios", target_os = "macos"))]
(&self.metal_hub, Backend::Metal),
#[cfg(any(target_os = "linux", target_os = "windows"))]
(&self.gl_hub, Backend::Gl),
(&self.dummy_hub, Backend::Empty),
]
}
pub fn create_device_id(&self, backend: Backend) -> DeviceId {
self.select(backend).devices.process(backend)
impl IdentityHub {
pub fn create_device_id(&self) -> DeviceId {
self.devices.process()
}
pub fn free_device_id(&self, id: DeviceId) {
self.select(id.backend()).devices.free(id);
self.devices.free(id);
}
pub fn create_queue_id(&self, backend: Backend) -> QueueId {
self.select(backend).queues.process(backend)
pub fn create_queue_id(&self) -> QueueId {
self.queues.process()
}
pub fn free_queue_id(&self, id: QueueId) {
self.select(id.backend()).queues.free(id);
self.queues.free(id);
}
pub fn create_adapter_ids(&self) -> SmallVec<[AdapterId; 4]> {
let mut ids = SmallVec::new();
for hubs in self.hubs() {
ids.push(hubs.0.adapters.process(hubs.1));
}
ids
pub fn create_adapter_id(&self) -> AdapterId {
self.adapters.process()
}
pub fn free_adapter_id(&self, id: AdapterId) {
self.select(id.backend()).adapters.free(id);
self.adapters.free(id);
}
pub fn create_buffer_id(&self, backend: Backend) -> BufferId {
self.select(backend).buffers.process(backend)
pub fn create_buffer_id(&self) -> BufferId {
self.buffers.process()
}
pub fn free_buffer_id(&self, id: BufferId) {
self.select(id.backend()).buffers.free(id);
self.buffers.free(id);
}
pub fn create_bind_group_id(&self, backend: Backend) -> BindGroupId {
self.select(backend).bind_groups.process(backend)
pub fn create_bind_group_id(&self) -> BindGroupId {
self.bind_groups.process()
}
pub fn free_bind_group_id(&self, id: BindGroupId) {
self.select(id.backend()).bind_groups.free(id);
self.bind_groups.free(id);
}
pub fn create_bind_group_layout_id(&self, backend: Backend) -> BindGroupLayoutId {
self.select(backend).bind_group_layouts.process(backend)
pub fn create_bind_group_layout_id(&self) -> BindGroupLayoutId {
self.bind_group_layouts.process()
}
pub fn free_bind_group_layout_id(&self, id: BindGroupLayoutId) {
self.select(id.backend()).bind_group_layouts.free(id);
self.bind_group_layouts.free(id);
}
pub fn create_compute_pipeline_id(&self, backend: Backend) -> ComputePipelineId {
self.select(backend).compute_pipelines.process(backend)
pub fn create_compute_pipeline_id(&self) -> ComputePipelineId {
self.compute_pipelines.process()
}
pub fn free_compute_pipeline_id(&self, id: ComputePipelineId) {
self.select(id.backend()).compute_pipelines.free(id);
self.compute_pipelines.free(id);
}
pub fn create_pipeline_layout_id(&self, backend: Backend) -> PipelineLayoutId {
self.select(backend).pipeline_layouts.process(backend)
pub fn create_pipeline_layout_id(&self) -> PipelineLayoutId {
self.pipeline_layouts.process()
}
pub fn free_pipeline_layout_id(&self, id: PipelineLayoutId) {
self.select(id.backend()).pipeline_layouts.free(id);
self.pipeline_layouts.free(id);
}
pub fn create_shader_module_id(&self, backend: Backend) -> ShaderModuleId {
self.select(backend).shader_modules.process(backend)
pub fn create_shader_module_id(&self) -> ShaderModuleId {
self.shader_modules.process()
}
pub fn free_shader_module_id(&self, id: ShaderModuleId) {
self.select(id.backend()).shader_modules.free(id);
self.shader_modules.free(id);
}
pub fn create_command_encoder_id(&self, backend: Backend) -> CommandEncoderId {
self.select(backend).command_encoders.process(backend)
pub fn create_command_encoder_id(&self) -> CommandEncoderId {
self.command_encoders.process()
}
pub fn free_command_buffer_id(&self, id: CommandEncoderId) {
self.select(id.backend()).command_encoders.free(id);
self.command_encoders.free(id);
}
pub fn create_sampler_id(&self, backend: Backend) -> SamplerId {
self.select(backend).samplers.process(backend)
pub fn create_sampler_id(&self) -> SamplerId {
self.samplers.process()
}
pub fn free_sampler_id(&self, id: SamplerId) {
self.select(id.backend()).samplers.free(id);
self.samplers.free(id);
}
pub fn create_render_pipeline_id(&self, backend: Backend) -> RenderPipelineId {
self.select(backend).render_pipelines.process(backend)
pub fn create_render_pipeline_id(&self) -> RenderPipelineId {
self.render_pipelines.process()
}
pub fn free_render_pipeline_id(&self, id: RenderPipelineId) {
self.select(id.backend()).render_pipelines.free(id);
self.render_pipelines.free(id);
}
pub fn create_texture_id(&self, backend: Backend) -> TextureId {
self.select(backend).textures.process(backend)
pub fn create_texture_id(&self) -> TextureId {
self.textures.process()
}
pub fn free_texture_id(&self, id: TextureId) {
self.select(id.backend()).textures.free(id);
self.textures.free(id);
}
pub fn create_texture_view_id(&self, backend: Backend) -> TextureViewId {
self.select(backend).texture_views.process(backend)
pub fn create_texture_view_id(&self) -> TextureViewId {
self.texture_views.process()
}
pub fn free_texture_view_id(&self, id: TextureViewId) {
self.select(id.backend()).texture_views.free(id);
self.texture_views.free(id);
}
pub fn create_render_bundle_id(&self, backend: Backend) -> RenderBundleId {
self.select(backend).render_bundles.process(backend)
pub fn create_render_bundle_id(&self) -> RenderBundleId {
self.render_bundles.process()
}
pub fn free_render_bundle_id(&self, id: RenderBundleId) {
self.select(id.backend()).render_bundles.free(id);
self.render_bundles.free(id);
}
pub fn create_compute_pass_id(&self, backend: Backend) -> ComputePassId {
self.select(backend).compute_passes.process(backend)
pub fn create_compute_pass_id(&self) -> ComputePassId {
self.compute_passes.process()
}
pub fn free_compute_pass_id(&self, id: ComputePassId) {
self.select(id.backend()).compute_passes.free(id);
self.compute_passes.free(id);
}
pub fn create_render_pass_id(&self, backend: Backend) -> RenderPassId {
self.select(backend).render_passes.process(backend)
pub fn create_render_pass_id(&self) -> RenderPassId {
self.render_passes.process()
}
pub fn free_render_pass_id(&self, id: RenderPassId) {
self.select(id.backend()).render_passes.free(id);
}
}
impl Default for Identities {
fn default() -> Self {
Self::new()
self.render_passes.free(id);
}
}

View file

@ -39,7 +39,7 @@ use crate::dom::eventtarget::EventTarget;
use crate::dom::extendableevent::ExtendableEvent;
use crate::dom::extendablemessageevent::ExtendableMessageEvent;
use crate::dom::globalscope::GlobalScope;
use crate::dom::identityhub::Identities;
use crate::dom::identityhub::IdentityHub;
use crate::dom::worker::TrustedWorkerAddress;
use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::fetch::load_whole_resource;
@ -241,7 +241,7 @@ impl ServiceWorkerGlobalScope {
runtime,
from_devtools_receiver,
closing,
Arc::new(Identities::new()),
Arc::new(IdentityHub::new()),
),
task_queue: TaskQueue::new(receiver, own_sender.clone()),
own_sender,

View file

@ -123,7 +123,7 @@ use crate::dom::hashchangeevent::HashChangeEvent;
use crate::dom::history::History;
use crate::dom::htmlcollection::{CollectionFilter, HTMLCollection};
use crate::dom::htmliframeelement::HTMLIFrameElement;
use crate::dom::identityhub::Identities;
use crate::dom::identityhub::IdentityHub;
use crate::dom::location::Location;
use crate::dom::mediaquerylist::{MediaQueryList, MediaQueryListMatchState};
use crate::dom::mediaquerylistevent::MediaQueryListEvent;
@ -2558,7 +2558,7 @@ impl Window {
replace_surrogates: bool,
user_agent: Cow<'static, str>,
player_context: WindowGLContext,
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
inherited_secure_context: Option<bool>,
) -> DomRoot<Self> {
let error_reporter = CSSErrorReporter {

View file

@ -45,7 +45,7 @@ use crate::dom::bindings::trace::RootedTraceableBox;
use crate::dom::crypto::Crypto;
use crate::dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;
use crate::dom::globalscope::GlobalScope;
use crate::dom::identityhub::Identities;
use crate::dom::identityhub::IdentityHub;
use crate::dom::performance::Performance;
use crate::dom::promise::Promise;
use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
@ -140,7 +140,7 @@ impl WorkerGlobalScope {
runtime: Runtime,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
closing: Arc<AtomicBool>,
gpu_id_hub: Arc<Identities>,
gpu_id_hub: Arc<IdentityHub>,
) -> Self {
// Install a pipeline-namespace in the current thread.
PipelineNamespace::auto_install();

View file

@ -22,7 +22,7 @@ use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::dom::identityhub::Identities;
use crate::dom::identityhub::IdentityHub;
use crate::dom::paintworkletglobalscope::{PaintWorkletGlobalScope, PaintWorkletTask};
use crate::dom::testworkletglobalscope::{TestWorkletGlobalScope, TestWorkletTask};
use crate::dom::worklet::WorkletExecutor;
@ -164,7 +164,7 @@ pub struct WorkletGlobalScopeInit {
/// An optional string allowing the user agent to be set for testing
pub user_agent: Cow<'static, str>,
/// Identity manager for WebGPU resources
pub gpu_id_hub: Arc<Identities>,
pub gpu_id_hub: Arc<IdentityHub>,
/// Is considered secure
pub inherited_secure_context: Option<bool>,
}