Struct webgpu::wgpu_thread::WGPU
source · pub(crate) struct WGPU {Show 13 fields
receiver: IpcReceiver<WebGPURequest>,
sender: IpcSender<WebGPURequest>,
pub(crate) script_sender: IpcSender<WebGPUMsg>,
pub(crate) global: Arc<Global>,
devices: Arc<Mutex<HashMap<DeviceId, DeviceScope>>>,
error_command_encoders: HashMap<CommandEncoderId, String>,
pub(crate) webrender_api: Arc<Mutex<RenderApi>>,
pub(crate) webrender_document: DocumentId,
pub(crate) external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
pub(crate) wgpu_image_map: WGPUImageMap,
pub(crate) poller: Poller,
compute_passes: HashMap<ComputePassId, Pass<ComputePass>>,
render_passes: HashMap<RenderPassId, Pass<RenderPass>>,
}
Fields§
§receiver: IpcReceiver<WebGPURequest>
§sender: IpcSender<WebGPURequest>
§script_sender: IpcSender<WebGPUMsg>
§global: Arc<Global>
§devices: Arc<Mutex<HashMap<DeviceId, DeviceScope>>>
§error_command_encoders: HashMap<CommandEncoderId, String>
This stores first error on command encoder, because wgpu does not invalidate command encoder object (this is also reused for invalidation of command buffers)
webrender_api: Arc<Mutex<RenderApi>>
§webrender_document: DocumentId
§external_images: Arc<Mutex<WebrenderExternalImageRegistry>>
§wgpu_image_map: WGPUImageMap
§poller: Poller
Provides access to poller thread
compute_passes: HashMap<ComputePassId, Pass<ComputePass>>
Store compute passes
render_passes: HashMap<RenderPassId, Pass<RenderPass>>
Store render passes
Implementations§
source§impl WGPU
impl WGPU
pub(crate) fn new( receiver: IpcReceiver<WebGPURequest>, sender: IpcSender<WebGPURequest>, script_sender: IpcSender<WebGPUMsg>, webrender_api_sender: RenderApiSender, webrender_document: DocumentId, external_images: Arc<Mutex<WebrenderExternalImageRegistry>>, wgpu_image_map: WGPUImageMap, ) -> Self
pub(crate) fn run(&mut self)
fn maybe_dispatch_wgpu_error<E: Error + 'static>( &mut self, device_id: DeviceId, error: Option<E>, )
sourcefn maybe_dispatch_error(&mut self, device_id: DeviceId, error: Option<Error>)
fn maybe_dispatch_error(&mut self, device_id: DeviceId, error: Option<Error>)
Dispatches error (if there is any)
sourcefn dispatch_error(&mut self, device_id: DeviceId, error: Error)
fn dispatch_error(&mut self, device_id: DeviceId, error: Error)
fn encoder_record_error<U, T: Debug>( &mut self, encoder_id: CommandEncoderId, result: &Result<U, T>, )
source§impl WGPU
impl WGPU
pub(crate) fn create_context( &self, context_id: WebGPUContextId, image_key: ImageKey, size: DeviceIntSize, buffer_ids: ArrayVec<BufferId, PRESENTATION_BUFFER_COUNT>, )
pub(crate) fn update_context( &self, context_id: WebGPUContextId, size: DeviceIntSize, config: Option<ContextConfiguration>, )
sourcepub(crate) fn swapchain_present(
&mut self,
context_id: WebGPUContextId,
encoder_id: Id<CommandEncoder>,
texture_id: Id<Texture>,
) -> Result<(), Box<dyn Error>>
pub(crate) fn swapchain_present( &mut self, context_id: WebGPUContextId, encoder_id: Id<CommandEncoder>, texture_id: Id<Texture>, ) -> Result<(), Box<dyn Error>>
Copies data async from provided texture using encoder_id to available staging presentation buffer
pub(crate) fn destroy_context(&mut self, context_id: WebGPUContextId)
Auto Trait Implementations§
impl !Freeze for WGPU
impl !RefUnwindSafe for WGPU
impl Send for WGPU
impl !Sync for WGPU
impl Unpin for WGPU
impl !UnwindSafe for WGPU
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert