mod cache;
mod cleanup;
mod manager;
mod resource;
#[cfg(test)]
mod tests;
mod upload;
use crate::{RenderResources, RendererError, RendererResult};
use dear_imgui_rs::{
TextureId,
render::{SnapshotTextureId, TextureFeedback, TextureOp, TextureRequest, TextureUploadRect},
texture::{TextureFormat as ImGuiTextureFormat, TextureRect},
};
use std::{collections::HashMap, num::NonZeroU64};
use wgpu::*;
pub(crate) use cleanup::ManagedRequestOutcome;
pub(crate) use manager::WgpuTextureManager;
pub(crate) use resource::OwnedWgpuTexture;
#[cfg(test)]
pub(crate) use tests::{external_test_texture, request_test_device};
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[repr(transparent)]
pub struct ExternalTextureId(TextureId);
impl ExternalTextureId {
pub(super) const fn new(texture_id: TextureId) -> Self {
Self(texture_id)
}
#[must_use]
pub const fn texture_id(self) -> TextureId {
self.0
}
}
impl From<ExternalTextureId> for TextureId {
fn from(texture: ExternalTextureId) -> Self {
texture.texture_id()
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct ExternalTextureBinding {
pub texture: ExternalTextureId,
pub revision: NonZeroU64,
}
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct WgpuDrawDependencies {
pub external_bindings: Vec<ExternalTextureBinding>,
pub contains_unknown_callback_dependencies: bool,
}