pub struct ContextData {
image_key: Option<ImageKey>,
size: DeviceIntSize,
inactive_staging_buffers: ArrayVec<StagingBuffer, PRESENTATION_BUFFER_COUNT>,
presentation: Option<PresentationStagingBuffer>,
next_epoch: Epoch,
}Expand description
The embedder process-side representation of what is the GPUCanvasContext in script.
Fields§
§image_key: Option<ImageKey>The ImageKey of the WebRender image associated with this context.
size: DeviceIntSizeThe current size of this context.
inactive_staging_buffers: ArrayVec<StagingBuffer, PRESENTATION_BUFFER_COUNT>Staging buffers that are not actively used.
Staging buffer here are either StagingBufferState::Unassigned or StagingBufferState::Available.
They are removed from here when they are in process of being mapped or are already mapped.
presentation: Option<PresentationStagingBuffer>The PresentationStagingBuffer of the most recent presentation. This will
be None directly after initialization, as clearing is handled completely in
the ScriptThread.
next_epoch: EpochNext epoch to be used
Implementations§
Source§impl ContextData
impl ContextData
fn new( global: &Arc<Global>, buffer_ids: ArrayVec<BufferId, PRESENTATION_BUFFER_COUNT>, size: DeviceIntSize, ) -> Self
Sourcefn get_or_make_available_buffer(
&mut self,
config: &ContextConfiguration,
) -> Option<StagingBuffer>
fn get_or_make_available_buffer( &mut self, config: &ContextConfiguration, ) -> Option<StagingBuffer>
Returns None if no staging buffer is unused or failure when making it available
Sourcefn destroy(
self,
script_sender: &GenericSender<WebGPUMsg>,
paint_api: &CrossProcessPaintApi,
)
fn destroy( self, script_sender: &GenericSender<WebGPUMsg>, paint_api: &CrossProcessPaintApi, )
Destroy the context that this ContextData represents,
freeing all of its buffers, and deleting the associated WebRender image.
Sourcefn next_epoch(&mut self) -> Epoch
fn next_epoch(&mut self) -> Epoch
Advance the Epoch and return the new one.
Sourcefn replace_presentation(&mut self, presentation: PresentationStagingBuffer)
fn replace_presentation(&mut self, presentation: PresentationStagingBuffer)
If the given PresentationStagingBuffer is for a newer presentation, replace the existing
one. Deallocate the older one by calling Self::return_staging_buffer on it.
fn clear_presentation(&mut self)
fn return_staging_buffer(&mut self, staging_buffer: StagingBuffer)
Auto Trait Implementations§
impl Freeze for ContextData
impl !RefUnwindSafe for ContextData
impl Send for ContextData
impl Sync for ContextData
impl Unpin for ContextData
impl UnsafeUnpin for ContextData
impl !UnwindSafe for ContextData
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
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>
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>
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 more