pub(crate) struct WGPU {
receiver: IpcReceiver<WebGPURequest>,
sender: IpcSender<WebGPURequest>,
pub(crate) script_sender: IpcSender<WebGPUMsg>,
pub(crate) global: Arc<Global>,
devices: Arc<Mutex<FxHashMap<DeviceId, DeviceScope>>>,
error_command_encoders: FxHashMap<CommandEncoderId, String>,
pub(crate) compositor_api: CrossProcessCompositorApi,
pub(crate) external_images: Arc<Mutex<WebRenderExternalImageRegistry>>,
pub(crate) wgpu_image_map: WGPUImageMap,
pub(crate) poller: Poller,
compute_passes: FxHashMap<ComputePassId, Pass<ComputePass>>,
render_passes: FxHashMap<RenderPassId, Pass<RenderPass>>,
}Fields§
§receiver: IpcReceiver<WebGPURequest>§sender: IpcSender<WebGPURequest>§script_sender: IpcSender<WebGPUMsg>§global: Arc<Global>§devices: Arc<Mutex<FxHashMap<DeviceId, DeviceScope>>>§error_command_encoders: FxHashMap<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)
compositor_api: CrossProcessCompositorApi§external_images: Arc<Mutex<WebRenderExternalImageRegistry>>§wgpu_image_map: WGPUImageMap§poller: PollerProvides access to poller thread
compute_passes: FxHashMap<ComputePassId, Pass<ComputePass>>Store compute passes
render_passes: FxHashMap<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>, compositor_api: CrossProcessCompositorApi, 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 get_image( &self, context_id: WebGPUContextId, pending_texture: Option<PendingTexture>, sender: IpcSender<SharedSnapshot>, )
Sourcepub(crate) fn present(
&self,
context_id: WebGPUContextId,
pending_texture: Option<PendingTexture>,
size: Size2D<u32>,
canvas_epoch: Epoch,
)
pub(crate) fn present( &self, context_id: WebGPUContextId, pending_texture: Option<PendingTexture>, size: Size2D<u32>, canvas_epoch: Epoch, )
Read the texture to the staging buffer, map it to CPU memory, and update the image in WebRender when complete.
Sourcefn texture_download(
&self,
texture_id: TextureId,
encoder_id: CommandEncoderId,
staging_buffer: StagingBuffer,
config: ContextConfiguration,
callback: impl FnOnce(StagingBuffer) + Send + 'static,
)
fn texture_download( &self, texture_id: TextureId, encoder_id: CommandEncoderId, staging_buffer: StagingBuffer, config: ContextConfiguration, callback: impl FnOnce(StagingBuffer) + Send + 'static, )
Copies data from provided texture using encoder_id to the provided StagingBuffer.
callback is guaranteed to be called.
Returns a StagingBuffer with the StagingBufferState::Mapped state
on success or StagingBufferState::Available on failure.
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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