use super::*;
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, PartialEq)]
pub struct GpuTextureHandle {
#[get(type(copy))]
pub(crate) texture_id: u64,
#[get(type(copy))]
pub(crate) device_id: u64,
#[get(type(copy))]
pub(crate) generation: u64,
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(copy))]
pub(crate) format: GpuTextureFormat,
#[get(type(copy))]
pub(crate) fence_value: u64,
#[get(type(copy))]
pub(crate) origin_top_left: bool,
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct GpuCompositeDescriptor {
#[get(type(copy))]
pub(crate) rect: Rect,
#[get(type(copy))]
pub(crate) handle: GpuTextureHandle,
#[get(type(copy))]
pub(crate) z_layer: i32,
#[get(type(copy))]
pub(crate) preserve_alpha: bool,
}
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct GpuCompositeTarget {
#[get(type(copy))]
pub(crate) handle: GpuTextureHandle,
#[get(type(copy))]
pub(crate) viewport_rect: Rect,
#[get(type(copy))]
pub(crate) world_revision: u64,
#[get(type(copy))]
pub(crate) presented_world_revision: u64,
#[get(type(copy))]
pub(crate) hud_revision: u64,
#[get(type(copy))]
pub(crate) presented_hud_revision: u64,
#[get(type(copy))]
pub(crate) submitted_fence: u64,
#[get(type(copy))]
pub(crate) completed_fence: u64,
#[get(type(copy))]
pub(crate) zero_readback_presents: u64,
#[get(type(copy))]
pub(crate) hud_only_reuses: u64,
}
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct PooledRenderBufferSlot {
pub(crate) pixels: Vec<u8>,
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(copy))]
pub(crate) fence_id: u64,
#[get(type(copy))]
pub(crate) in_flight: bool,
#[get(type(copy))]
pub(crate) checked_out: bool,
#[get(type(copy))]
pub(crate) generation: u64,
}
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, New, PartialEq)]
pub struct RenderBufferPoolStats {
#[get(type(copy))]
pub(crate) capacity: usize,
#[get(type(copy))]
pub(crate) in_flight_slots: usize,
#[get(type(copy))]
pub(crate) free_slots: usize,
#[get(type(copy))]
pub(crate) reuse_hits: u64,
#[get(type(copy))]
pub(crate) backing_allocations: u64,
#[get(type(copy))]
pub(crate) backpressure_rejections: u64,
}
#[derive(Clone, Data, Debug, Default)]
pub(crate) struct RenderBufferPoolState {
pub(crate) slots: Vec<PooledRenderBufferSlot>,
#[get(type(copy))]
pub(crate) completed_fence: u64,
#[get(type(copy))]
pub(crate) reuse_hits: u64,
#[get(type(copy))]
pub(crate) backing_allocations: u64,
#[get(type(copy))]
pub(crate) backpressure_rejections: u64,
}
#[derive(Clone, CustomDebug, Data)]
pub struct RenderBufferPool {
#[debug(skip)]
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) state: Rc<RefCell<RenderBufferPoolState>>,
}
#[derive(CustomDebug, Data)]
pub struct PooledFrameLease {
#[debug(skip)]
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) state: Rc<RefCell<RenderBufferPoolState>>,
#[get(type(copy))]
pub(crate) slot_index: usize,
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(copy))]
pub(crate) fence_id: u64,
#[get(type(copy))]
pub(crate) generation: u64,
pub(crate) pixels: Vec<u8>,
#[get(type(copy))]
pub(crate) released: bool,
}