pub(crate) struct WGPU {
receiver: GenericReceiver<WebGPURequest>,
sender: GenericSender<WebGPURequest>,
pub(crate) script_sender: GenericSender<WebGPUMsg>,
pub(crate) global: Arc<Global>,
devices: Arc<Mutex<FxHashMap<DeviceId, DeviceScope>>>,
pub(crate) paint_api: CrossProcessPaintApi,
pub(crate) webrender_external_image_id_manager: WebRenderExternalImageIdManager,
pub(crate) wgpu_image_map: WebGpuExternalImageMap,
pub(crate) poller: Poller,
compute_passes: FxHashMap<ComputePassId, ComputePass>,
render_passes: FxHashMap<RenderPassId, RenderPass>,
}Fields§
§receiver: GenericReceiver<WebGPURequest>§sender: GenericSender<WebGPURequest>§script_sender: GenericSender<WebGPUMsg>§global: Arc<Global>§devices: Arc<Mutex<FxHashMap<DeviceId, DeviceScope>>>§paint_api: CrossProcessPaintApi§webrender_external_image_id_manager: WebRenderExternalImageIdManager§wgpu_image_map: WebGpuExternalImageMap§poller: PollerProvides access to poller thread
compute_passes: FxHashMap<ComputePassId, ComputePass>Store compute passes
render_passes: FxHashMap<RenderPassId, RenderPass>Store render passes
Implementations§
Source§impl WGPU
impl WGPU
pub(crate) fn new( receiver: GenericReceiver<WebGPURequest>, sender: GenericSender<WebGPURequest>, script_sender: GenericSender<WebGPUMsg>, paint_api: CrossProcessPaintApi, webrender_external_image_id_manager: WebRenderExternalImageIdManager, wgpu_image_map: WebGpuExternalImageMap, ) -> Self
pub(crate) fn run(&mut self)
fn maybe_dispatch_wgpu_error<E: WebGpuError>( &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)
Source§impl WGPU
impl WGPU
pub(crate) fn create_context( &self, context_id: WebGPUContextId, size: DeviceIntSize, buffer_ids: ArrayVec<BufferId, PRESENTATION_BUFFER_COUNT>, )
pub(crate) fn set_image_key( &self, context_id: WebGPUContextId, image_key: ImageKey, )
pub(crate) fn get_image( &self, context_id: WebGPUContextId, pending_texture: Option<PendingTexture>, sender: GenericSender<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,
command_buffer_id: CommandBufferId,
staging_buffer: StagingBuffer,
config: ContextConfiguration,
callback: impl FnOnce(StagingBuffer) + Send + 'static,
)
fn texture_download( &self, texture_id: TextureId, encoder_id: CommandEncoderId, command_buffer_id: CommandBufferId, 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 UnsafeUnpin 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