Skip to main content

alpha2_native_gpu/
lifetime.rs

1//! Decoder-surface lifetime contract used by import implementations.
2
3use std::fmt::Debug;
4
5/// Identity used to prevent imported texture reuse across decoder generations.
6#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
7pub struct SurfaceIdentity {
8    /// Decoder or pool generation.
9    pub generation: u64,
10    /// Backend-native picture identity.
11    pub picture: u64,
12}
13
14/// Native backing retained until every sampling submission has completed.
15pub trait NativeSurfaceLease: Debug + Send + Sync + 'static {
16    /// Cache identity for the retained picture.
17    fn identity(&self) -> SurfaceIdentity;
18    /// Approximate bytes reserved from the native surface budget.
19    fn retained_bytes(&self) -> u64;
20}