pub struct WgpuCustomContext {
pub device: Arc<Device>,
/* private fields */
}Expand description
Host-owned recording context. Producers record work; only the renderer submits.
Fields§
§device: Arc<Device>Device on which producer pipelines and buffers must be created.
Implementations§
Source§impl WgpuCustomContext
impl WgpuCustomContext
Sourcepub fn cache_key(&self) -> usize
pub fn cache_key(&self) -> usize
Queue-scoped cache identity; cached output retains the device and queue.
Sourcepub fn create_output(
&self,
extent: Size<DevicePixels>,
) -> Result<WgpuCustomOutput>
pub fn create_output( &self, extent: Size<DevicePixels>, ) -> Result<WgpuCustomOutput>
Allocate a host-device output with straight-alpha encoded-sRGB RGBA8 channels.
Sourcepub fn image_upload_context(&self) -> WgpuImageUploadContext
pub fn image_upload_context(&self) -> WgpuImageUploadContext
Owned worker-safe handles for allocating and filling image staging data. The worker cannot submit work on the renderer queue.
Sourcepub fn create_image_output(
&self,
data: &ImageTextureData,
) -> Result<WgpuCustomOutput>
pub fn create_image_output( &self, data: &ImageTextureData, ) -> Result<WgpuCustomOutput>
Synchronous convenience route. Media workers normally stage first and
call adopt_image_upload during host preparation instead.
Sourcepub fn adopt_image_upload(
&self,
staged: &WgpuStagedImage,
) -> Result<WgpuCustomOutput>
pub fn adopt_image_upload( &self, staged: &WgpuStagedImage, ) -> Result<WgpuCustomOutput>
Record copies of already-filled buffers. No texture allocation or pixel copying occurs here. A staged image may be adopted again after abandonment.
Sourcepub fn adopt_image_upload_with_guard(
&self,
staged: &WgpuStagedImage,
guard: Option<Arc<dyn Send + Sync>>,
) -> Result<WgpuCustomOutput>
pub fn adopt_image_upload_with_guard( &self, staged: &WgpuStagedImage, guard: Option<Arc<dyn Send + Sync>>, ) -> Result<WgpuCustomOutput>
Retain an admission lease until GPU completion, or release it when this recording is abandoned. Staging resources have their own completion guard.
Sourcepub fn record<T>(
&self,
encode: impl FnOnce(&mut CommandEncoder) -> Result<T>,
) -> Result<T>
pub fn record<T>( &self, encode: impl FnOnce(&mut CommandEncoder) -> Result<T>, ) -> Result<T>
Record preparation commands. Do not submit work or wait on the GPU here. An encoding error invalidates this transaction, including commands recorded earlier.
Sourcepub fn can_reuse(&self, output: &WgpuCustomOutput) -> bool
pub fn can_reuse(&self, output: &WgpuCustomOutput) -> bool
Whether output is submitted, local to this recording, or staged earlier in this host batch.
Trait Implementations§
Source§impl Drop for WgpuCustomContext
impl Drop for WgpuCustomContext
Auto Trait Implementations§
impl !Freeze for WgpuCustomContext
impl !RefUnwindSafe for WgpuCustomContext
impl !UnwindSafe for WgpuCustomContext
impl Send for WgpuCustomContext
impl Sync for WgpuCustomContext
impl Unpin for WgpuCustomContext
impl UnsafeUnpin for WgpuCustomContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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